fix(agents): include config agents and migrated plugin agents in customAgentSummaries
PR #2424 fixed the critical bug (passing client object instead of agent summaries array), but only included user, project, and raw plugin agents. This adds the two missing sources: - OpenCode native config agents (params.config.agent) - Plugin agents with migrateAgentConfig applied before summary extraction Ensures Sisyphus has complete awareness of all registered agent sources. Closes #2386 Co-authored-by: NS Cola <123285105+davincilll@users.noreply.github.com>
This commit is contained in:
@@ -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<string, unknown>) : 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<string, unknown>)?.description === "string"
|
||||
? (config as Record<string, unknown>).description as string
|
||||
: "",
|
||||
}));
|
||||
...Object.entries(pluginAgents).filter(([, config]) => config !== undefined),
|
||||
]
|
||||
.filter(([, config]) => config != null)
|
||||
.map(([name, config]) => ({
|
||||
name,
|
||||
description: typeof (config as Record<string, unknown>)?.description === "string"
|
||||
? ((config as Record<string, unknown>).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<string, unknown>) : 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 =
|
||||
|
||||
Reference in New Issue
Block a user