From 91060c35ab23e3c1c6fee1c2fb1398cbb3f67f85 Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Fri, 23 Jan 2026 21:27:26 +0900 Subject: [PATCH] refactor(agents): use lowercase config keys in utils --- src/agents/types.ts | 8 ++--- src/agents/utils.test.ts | 42 +++++++++++++-------------- src/agents/utils.ts | 42 +++++++++++++-------------- src/index.ts | 2 +- src/plugin-handlers/config-handler.ts | 4 +-- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/agents/types.ts b/src/agents/types.ts index f22683a27..5c21c3320 100644 --- a/src/agents/types.ts +++ b/src/agents/types.ts @@ -57,14 +57,14 @@ export function isGptModel(model: string): boolean { } export type BuiltinAgentName = - | "Sisyphus" + | "sisyphus" | "oracle" | "librarian" | "explore" | "multimodal-looker" - | "Metis (Plan Consultant)" - | "Momus (Plan Reviewer)" - | "Atlas" + | "metis" + | "momus" + | "atlas" export type OverridableAgentName = | "build" diff --git a/src/agents/utils.test.ts b/src/agents/utils.test.ts index 7b9b40b67..2aff017f5 100644 --- a/src/agents/utils.test.ts +++ b/src/agents/utils.test.ts @@ -12,24 +12,24 @@ describe("createBuiltinAgents with model overrides", () => { const agents = await createBuiltinAgents([], {}, undefined, TEST_DEFAULT_MODEL) // #then - expect(agents.Sisyphus.model).toBe("anthropic/claude-opus-4-5") - expect(agents.Sisyphus.thinking).toEqual({ type: "enabled", budgetTokens: 32000 }) - expect(agents.Sisyphus.reasoningEffort).toBeUndefined() + expect(agents.sisyphus.model).toBe("anthropic/claude-opus-4-5") + expect(agents.sisyphus.thinking).toEqual({ type: "enabled", budgetTokens: 32000 }) + expect(agents.sisyphus.reasoningEffort).toBeUndefined() }) test("Sisyphus with GPT model override has reasoningEffort, no thinking", async () => { // #given const overrides = { - Sisyphus: { model: "github-copilot/gpt-5.2" }, + sisyphus: { model: "github-copilot/gpt-5.2" }, } // #when const agents = await createBuiltinAgents([], overrides, undefined, TEST_DEFAULT_MODEL) // #then - expect(agents.Sisyphus.model).toBe("github-copilot/gpt-5.2") - expect(agents.Sisyphus.reasoningEffort).toBe("medium") - expect(agents.Sisyphus.thinking).toBeUndefined() + expect(agents.sisyphus.model).toBe("github-copilot/gpt-5.2") + expect(agents.sisyphus.reasoningEffort).toBe("medium") + expect(agents.sisyphus.thinking).toBeUndefined() }) test("Sisyphus uses system default when no availableModels provided", async () => { @@ -40,9 +40,9 @@ describe("createBuiltinAgents with model overrides", () => { const agents = await createBuiltinAgents([], {}, undefined, systemDefaultModel) // #then - falls back to system default when no availability match - expect(agents.Sisyphus.model).toBe("anthropic/claude-opus-4-5") - expect(agents.Sisyphus.thinking).toEqual({ type: "enabled", budgetTokens: 32000 }) - expect(agents.Sisyphus.reasoningEffort).toBeUndefined() + expect(agents.sisyphus.model).toBe("anthropic/claude-opus-4-5") + expect(agents.sisyphus.thinking).toEqual({ type: "enabled", budgetTokens: 32000 }) + expect(agents.sisyphus.reasoningEffort).toBeUndefined() }) test("Oracle uses first fallback entry when no availableModels provided (no cache scenario)", async () => { @@ -90,19 +90,19 @@ describe("createBuiltinAgents with model overrides", () => { expect(agents.oracle.textVerbosity).toBeUndefined() }) - test("non-model overrides are still applied after factory rebuild", async () => { - // #given - const overrides = { - Sisyphus: { model: "github-copilot/gpt-5.2", temperature: 0.5 }, - } + test("non-model overrides are still applied after factory rebuild", async () => { + // #given + const overrides = { + sisyphus: { model: "github-copilot/gpt-5.2", temperature: 0.5 }, + } - // #when - const agents = await createBuiltinAgents([], overrides, undefined, TEST_DEFAULT_MODEL) + // #when + const agents = await createBuiltinAgents([], overrides, undefined, TEST_DEFAULT_MODEL) - // #then - expect(agents.Sisyphus.model).toBe("github-copilot/gpt-5.2") - expect(agents.Sisyphus.temperature).toBe(0.5) - }) + // #then + expect(agents.sisyphus.model).toBe("github-copilot/gpt-5.2") + expect(agents.sisyphus.temperature).toBe(0.5) + }) }) describe("buildAgent with category and skills", () => { diff --git a/src/agents/utils.ts b/src/agents/utils.ts index 4006cad25..af2ecdaf0 100644 --- a/src/agents/utils.ts +++ b/src/agents/utils.ts @@ -19,16 +19,16 @@ import type { LoadedSkill, SkillScope } from "../features/opencode-skill-loader/ type AgentSource = AgentFactory | AgentConfig const agentSources: Record = { - Sisyphus: createSisyphusAgent, + sisyphus: createSisyphusAgent, oracle: createOracleAgent, librarian: createLibrarianAgent, explore: createExploreAgent, "multimodal-looker": createMultimodalLookerAgent, - "Metis (Plan Consultant)": createMetisAgent, - "Momus (Plan Reviewer)": createMomusAgent, + metis: createMetisAgent, + momus: createMomusAgent, // Note: Atlas is handled specially in createBuiltinAgents() // because it needs OrchestratorContext, not just a model string - Atlas: createAtlasAgent as unknown as AgentFactory, + atlas: createAtlasAgent as unknown as AgentFactory, } /** @@ -186,12 +186,12 @@ export async function createBuiltinAgents( const availableSkills: AvailableSkill[] = [...builtinAvailable, ...discoveredAvailable] - for (const [name, source] of Object.entries(agentSources)) { - const agentName = name as BuiltinAgentName + for (const [name, source] of Object.entries(agentSources)) { + const agentName = name as BuiltinAgentName - if (agentName === "Sisyphus") continue - if (agentName === "Atlas") continue - if (includesCaseInsensitive(disabledAgents, agentName)) continue + if (agentName === "sisyphus") continue + if (agentName === "atlas") continue + if (includesCaseInsensitive(disabledAgents, agentName)) continue const override = findCaseInsensitive(agentOverrides, agentName) const requirement = AGENT_MODEL_REQUIREMENTS[agentName] @@ -234,9 +234,9 @@ export async function createBuiltinAgents( } } - if (!disabledAgents.includes("Sisyphus")) { - const sisyphusOverride = agentOverrides["Sisyphus"] - const sisyphusRequirement = AGENT_MODEL_REQUIREMENTS["Sisyphus"] + if (!disabledAgents.includes("sisyphus")) { + const sisyphusOverride = agentOverrides["sisyphus"] + const sisyphusRequirement = AGENT_MODEL_REQUIREMENTS["sisyphus"] // Use resolver to determine model const { model: sisyphusModel, variant: sisyphusResolvedVariant } = resolveModelWithFallback({ @@ -270,12 +270,12 @@ export async function createBuiltinAgents( sisyphusConfig = mergeAgentConfig(sisyphusConfig, sisyphusOverride) } - result["Sisyphus"] = sisyphusConfig - } + result["sisyphus"] = sisyphusConfig + } - if (!disabledAgents.includes("Atlas")) { - const orchestratorOverride = agentOverrides["Atlas"] - const atlasRequirement = AGENT_MODEL_REQUIREMENTS["Atlas"] + if (!disabledAgents.includes("atlas")) { + const orchestratorOverride = agentOverrides["atlas"] + const atlasRequirement = AGENT_MODEL_REQUIREMENTS["atlas"] // Use resolver to determine model const { model: atlasModel, variant: atlasResolvedVariant } = resolveModelWithFallback({ @@ -303,8 +303,8 @@ export async function createBuiltinAgents( orchestratorConfig = mergeAgentConfig(orchestratorConfig, orchestratorOverride) } - result["Atlas"] = orchestratorConfig - } + result["atlas"] = orchestratorConfig + } - return result -} + return result + } diff --git a/src/index.ts b/src/index.ts index f155c19d7..cc4b9fefe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -241,7 +241,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { directory: ctx.directory, userCategories: pluginConfig.categories, gitMasterConfig: pluginConfig.git_master, - sisyphusJuniorModel: pluginConfig.agents?.["Sisyphus-Junior"]?.model, + sisyphusJuniorModel: pluginConfig.agents?.["sisyphus-junior"]?.model, }); const disabledSkills = new Set(pluginConfig.disabled_skills ?? []); const systemMcpNames = getSystemMcpServerNames(); diff --git a/src/plugin-handlers/config-handler.ts b/src/plugin-handlers/config-handler.ts index d779921d3..4f1e3d17b 100644 --- a/src/plugin-handlers/config-handler.ts +++ b/src/plugin-handlers/config-handler.ts @@ -199,7 +199,7 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { }; agentConfig["Sisyphus-Junior"] = createSisyphusJuniorAgentWithOverrides( - pluginConfig.agents?.["Sisyphus-Junior"], + pluginConfig.agents?.["sisyphus-junior"], config.model as string | undefined ); @@ -228,7 +228,7 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { planConfigWithoutName as Record ); const prometheusOverride = - pluginConfig.agents?.["Prometheus (Planner)"] as + pluginConfig.agents?.["prometheus"] as | (Record & { category?: string; model?: string }) | undefined; const defaultModel = config.model as string | undefined;