fix: resolve category delegation and command routing with display name agent keys

Category-based delegation (task(category='quick')) was broken because
SISYPHUS_JUNIOR_AGENT sent 'sisyphus-junior' to session.prompt but
config.agent keys are now display names ('Sisyphus-Junior').

- Use getAgentDisplayName() for SISYPHUS_JUNIOR_AGENT constant
- Replace hardcoded 'sisyphus-junior' strings in tools.ts with constant
- Update background-output local constants to use display names
- Add remapCommandAgentFields() to translate command agent fields
- Add raw-key fallback in tool-config-handler agentByKey()
This commit is contained in:
YeonGyu-Kim
2026-02-16 21:32:33 +09:00
parent 0f5287e92e
commit 513e618bab
8 changed files with 30 additions and 10 deletions
@@ -1,4 +1,5 @@
import type { OhMyOpenCodeConfig } from "../config";
import { getAgentDisplayName } from "../shared/agent-display-names";
import {
loadUserCommands,
loadProjectCommands,
@@ -68,4 +69,14 @@ export async function applyCommandConfig(params: {
...params.pluginComponents.commands,
...params.pluginComponents.skills,
};
remapCommandAgentFields(params.config.command as Record<string, Record<string, unknown>>);
}
function remapCommandAgentFields(commands: Record<string, Record<string, unknown>>): void {
for (const cmd of Object.values(commands)) {
if (cmd?.agent && typeof cmd.agent === "string") {
cmd.agent = getAgentDisplayName(cmd.agent);
}
}
}
+3 -1
View File
@@ -4,7 +4,9 @@ import { getAgentDisplayName } from "../shared/agent-display-names";
type AgentWithPermission = { permission?: Record<string, unknown> };
function agentByKey(agentResult: Record<string, unknown>, key: string): AgentWithPermission | undefined {
return agentResult[getAgentDisplayName(key)] as AgentWithPermission | undefined;
return (agentResult[key] ?? agentResult[getAgentDisplayName(key)]) as
| AgentWithPermission
| undefined;
}
export function applyToolConfig(params: {