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 projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {};
|
||||||
const rawPluginAgents = params.pluginComponents.agents;
|
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 = [
|
const customAgentSummaries = [
|
||||||
|
...Object.entries(configAgent ?? {}),
|
||||||
...Object.entries(userAgents),
|
...Object.entries(userAgents),
|
||||||
...Object.entries(projectAgents),
|
...Object.entries(projectAgents),
|
||||||
...Object.entries(rawPluginAgents).filter(([, config]) => config !== undefined),
|
...Object.entries(pluginAgents).filter(([, config]) => config !== undefined),
|
||||||
].map(([name, config]) => ({
|
]
|
||||||
name,
|
.filter(([, config]) => config != null)
|
||||||
description: typeof (config as Record<string, unknown>)?.description === "string"
|
.map(([name, config]) => ({
|
||||||
? (config as Record<string, unknown>).description as string
|
name,
|
||||||
: "",
|
description: typeof (config as Record<string, unknown>)?.description === "string"
|
||||||
}));
|
? ((config as Record<string, unknown>).description as string)
|
||||||
|
: "",
|
||||||
|
}));
|
||||||
|
|
||||||
const builtinAgents = await createBuiltinAgents(
|
const builtinAgents = await createBuiltinAgents(
|
||||||
migratedDisabledAgents,
|
migratedDisabledAgents,
|
||||||
@@ -114,13 +126,6 @@ export async function applyAgentConfig(params: {
|
|||||||
disableOmoEnv,
|
disableOmoEnv,
|
||||||
);
|
);
|
||||||
|
|
||||||
const pluginAgents = Object.fromEntries(
|
|
||||||
Object.entries(rawPluginAgents).map(([key, value]) => [
|
|
||||||
key,
|
|
||||||
value ? migrateAgentConfig(value as Record<string, unknown>) : value,
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
const disabledAgentNames = new Set(
|
const disabledAgentNames = new Set(
|
||||||
(migratedDisabledAgents ?? []).map(a => a.toLowerCase())
|
(migratedDisabledAgents ?? []).map(a => a.toLowerCase())
|
||||||
);
|
);
|
||||||
@@ -138,8 +143,6 @@ export async function applyAgentConfig(params: {
|
|||||||
const shouldDemotePlan = plannerEnabled && replacePlan;
|
const shouldDemotePlan = plannerEnabled && replacePlan;
|
||||||
const configuredDefaultAgent = getConfiguredDefaultAgent(params.config);
|
const configuredDefaultAgent = getConfiguredDefaultAgent(params.config);
|
||||||
|
|
||||||
const configAgent = params.config.agent as AgentConfigRecord | undefined;
|
|
||||||
|
|
||||||
if (isSisyphusEnabled && builtinAgents.sisyphus) {
|
if (isSisyphusEnabled && builtinAgents.sisyphus) {
|
||||||
if (configuredDefaultAgent) {
|
if (configuredDefaultAgent) {
|
||||||
(params.config as { default_agent?: string }).default_agent =
|
(params.config as { default_agent?: string }).default_agent =
|
||||||
|
|||||||
Reference in New Issue
Block a user