feat(cli): Partial threading of AgentLoopContext. (#22978)

This commit is contained in:
joshualitt
2026-03-19 09:02:13 -07:00
committed by GitHub
parent 5acaacad96
commit 39d3b0e28c
68 changed files with 608 additions and 421 deletions
@@ -37,8 +37,11 @@ describe('modelCommand', () => {
}
const mockRefreshUserQuota = vi.fn();
mockContext.services.config = {
mockContext.services.agentContext = {
refreshUserQuota: mockRefreshUserQuota,
get config() {
return this;
},
} as unknown as Config;
await modelCommand.action(mockContext, '');
@@ -66,8 +69,11 @@ describe('modelCommand', () => {
(c) => c.name === 'manage',
);
const mockRefreshUserQuota = vi.fn();
mockContext.services.config = {
mockContext.services.agentContext = {
refreshUserQuota: mockRefreshUserQuota,
get config() {
return this;
},
} as unknown as Config;
await manageCommand!.action!(mockContext, '');
@@ -84,7 +90,7 @@ describe('modelCommand', () => {
expect(setCommand).toBeDefined();
const mockSetModel = vi.fn();
mockContext.services.config = {
mockContext.services.agentContext = {
setModel: mockSetModel,
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
getUserId: vi.fn().mockReturnValue('test-user'),
@@ -98,6 +104,9 @@ describe('modelCommand', () => {
getPolicyEngine: vi.fn().mockReturnValue({
getApprovalMode: vi.fn().mockReturnValue('auto'),
}),
get config() {
return this;
},
} as unknown as Config;
await setCommand!.action!(mockContext, 'gemini-pro');
@@ -116,7 +125,7 @@ describe('modelCommand', () => {
(c) => c.name === 'set',
);
const mockSetModel = vi.fn();
mockContext.services.config = {
mockContext.services.agentContext = {
setModel: mockSetModel,
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
getUserId: vi.fn().mockReturnValue('test-user'),
@@ -130,6 +139,9 @@ describe('modelCommand', () => {
getPolicyEngine: vi.fn().mockReturnValue({
getApprovalMode: vi.fn().mockReturnValue('auto'),
}),
get config() {
return this;
},
} as unknown as Config;
await setCommand!.action!(mockContext, 'gemini-pro --persist');