feat(core, cli): Add support for agents in settings.json. (#16433)

This commit is contained in:
joshualitt
2026-01-13 12:16:02 -08:00
committed by GitHub
parent e931ebe581
commit 92e31e3c4a
8 changed files with 382 additions and 56 deletions
+26 -1
View File
@@ -69,7 +69,10 @@ import type { FallbackModelHandler } from '../fallback/types.js';
import { ModelAvailabilityService } from '../availability/modelAvailabilityService.js';
import { ModelRouterService } from '../routing/modelRouterService.js';
import { OutputFormat } from '../output/types.js';
import type { ModelConfigServiceConfig } from '../services/modelConfigService.js';
import type {
ModelConfig,
ModelConfigServiceConfig,
} from '../services/modelConfigService.js';
import { ModelConfigService } from '../services/modelConfigService.js';
import { DEFAULT_MODEL_CONFIGS } from './defaultModelConfigs.js';
import { ContextManager } from '../services/contextManager.js';
@@ -159,6 +162,21 @@ export interface CliHelpAgentSettings {
enabled?: boolean;
}
export interface AgentRunConfig {
maxTimeMinutes?: number;
maxTurns?: number;
}
export interface AgentOverride {
modelConfig?: ModelConfig;
runConfig?: AgentRunConfig;
disabled?: boolean;
}
export interface AgentSettings {
overrides?: Record<string, AgentOverride>;
}
/**
* All information required in CLI to handle an extension. Defined in Core so
* that the collection of loaded, active, and inactive extensions can be passed
@@ -364,6 +382,7 @@ export interface ConfigParameters {
onModelChange?: (model: string) => void;
mcpEnabled?: boolean;
extensionsEnabled?: boolean;
agents?: AgentSettings;
onReload?: () => Promise<{ disabledSkills?: string[] }>;
}
@@ -496,6 +515,7 @@ export class Config {
| undefined;
private readonly enableAgents: boolean;
private readonly agents: AgentSettings;
private readonly skillsSupport: boolean;
private disabledSkills: string[];
@@ -570,6 +590,7 @@ export class Config {
this.model = params.model;
this._activeModel = params.model;
this.enableAgents = params.enableAgents ?? false;
this.agents = params.agents ?? {};
this.disableLLMCorrection = params.disableLLMCorrection ?? false;
this.skillsSupport = params.skillsSupport ?? false;
this.disabledSkills = params.disabledSkills ?? [];
@@ -1443,6 +1464,10 @@ export class Config {
return this.noBrowser;
}
getAgentsSettings(): AgentSettings {
return this.agents;
}
isBrowserLaunchSuppressed(): boolean {
return this.getNoBrowser() || !shouldAttemptBrowserLaunch();
}