diff --git a/src/plugin-handlers/agent-config-handler.ts b/src/plugin-handlers/agent-config-handler.ts index 4f5ad9eaf..e078b0688 100644 --- a/src/plugin-handlers/agent-config-handler.ts +++ b/src/plugin-handlers/agent-config-handler.ts @@ -87,16 +87,28 @@ export async function applyAgentConfig(params: { const projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {}; const rawPluginAgents = params.pluginComponents.agents; + const pluginAgents = Object.fromEntries( + Object.entries(rawPluginAgents).map(([key, value]) => [ + key, + value ? migrateAgentConfig(value as Record) : value, + ]), + ); + + const configAgent = params.config.agent as AgentConfigRecord | undefined; + const customAgentSummaries = [ + ...Object.entries(configAgent ?? {}), ...Object.entries(userAgents), ...Object.entries(projectAgents), - ...Object.entries(rawPluginAgents).filter(([, config]) => config !== undefined), - ].map(([name, config]) => ({ - name, - description: typeof (config as Record)?.description === "string" - ? (config as Record).description as string - : "", - })); + ...Object.entries(pluginAgents).filter(([, config]) => config !== undefined), + ] + .filter(([, config]) => config != null) + .map(([name, config]) => ({ + name, + description: typeof (config as Record)?.description === "string" + ? ((config as Record).description as string) + : "", + })); const builtinAgents = await createBuiltinAgents( migratedDisabledAgents, @@ -114,13 +126,6 @@ export async function applyAgentConfig(params: { disableOmoEnv, ); - const pluginAgents = Object.fromEntries( - Object.entries(rawPluginAgents).map(([key, value]) => [ - key, - value ? migrateAgentConfig(value as Record) : value, - ]), - ); - const disabledAgentNames = new Set( (migratedDisabledAgents ?? []).map(a => a.toLowerCase()) ); @@ -138,8 +143,6 @@ export async function applyAgentConfig(params: { const shouldDemotePlan = plannerEnabled && replacePlan; const configuredDefaultAgent = getConfiguredDefaultAgent(params.config); - const configAgent = params.config.agent as AgentConfigRecord | undefined; - if (isSisyphusEnabled && builtinAgents.sisyphus) { if (configuredDefaultAgent) { (params.config as { default_agent?: string }).default_agent =