diff --git a/src/shared/migration/agent-names.ts b/src/shared/migration/agent-names.ts new file mode 100644 index 00000000..3321b0b8 --- /dev/null +++ b/src/shared/migration/agent-names.ts @@ -0,0 +1,70 @@ +export const AGENT_NAME_MAP: Record = { + // Sisyphus variants → "sisyphus" + omo: "sisyphus", + OmO: "sisyphus", + Sisyphus: "sisyphus", + sisyphus: "sisyphus", + + // Prometheus variants → "prometheus" + "OmO-Plan": "prometheus", + "omo-plan": "prometheus", + "Planner-Sisyphus": "prometheus", + "planner-sisyphus": "prometheus", + "Prometheus (Planner)": "prometheus", + prometheus: "prometheus", + + // Atlas variants → "atlas" + "orchestrator-sisyphus": "atlas", + Atlas: "atlas", + atlas: "atlas", + + // Metis variants → "metis" + "plan-consultant": "metis", + "Metis (Plan Consultant)": "metis", + metis: "metis", + + // Momus variants → "momus" + "Momus (Plan Reviewer)": "momus", + momus: "momus", + + // Sisyphus-Junior → "sisyphus-junior" + "Sisyphus-Junior": "sisyphus-junior", + "sisyphus-junior": "sisyphus-junior", + + // Already lowercase - passthrough + build: "build", + oracle: "oracle", + librarian: "librarian", + explore: "explore", + "multimodal-looker": "multimodal-looker", +} + +export const BUILTIN_AGENT_NAMES = new Set([ + "sisyphus", // was "Sisyphus" + "oracle", + "librarian", + "explore", + "multimodal-looker", + "metis", // was "Metis (Plan Consultant)" + "momus", // was "Momus (Plan Reviewer)" + "prometheus", // was "Prometheus (Planner)" + "atlas", // was "Atlas" + "build", +]) + +export function migrateAgentNames( + agents: Record +): { migrated: Record; changed: boolean } { + const migrated: Record = {} + let changed = false + + for (const [key, value] of Object.entries(agents)) { + const newKey = AGENT_NAME_MAP[key.toLowerCase()] ?? AGENT_NAME_MAP[key] ?? key + if (newKey !== key) { + changed = true + } + migrated[newKey] = value + } + + return { migrated, changed } +} diff --git a/src/shared/migration/hook-names.ts b/src/shared/migration/hook-names.ts new file mode 100644 index 00000000..35920272 --- /dev/null +++ b/src/shared/migration/hook-names.ts @@ -0,0 +1,36 @@ +// Migration map: old hook names → new hook names (for backward compatibility) +// null means the hook was removed and should be filtered out from disabled_hooks +export const HOOK_NAME_MAP: Record = { + // Legacy names (backward compatibility) + "anthropic-auto-compact": "anthropic-context-window-limit-recovery", + "sisyphus-orchestrator": "atlas", + + // Removed hooks (v3.0.0) - will be filtered out and user warned + "empty-message-sanitizer": null, +} + +export function migrateHookNames( + hooks: string[] +): { migrated: string[]; changed: boolean; removed: string[] } { + const migrated: string[] = [] + const removed: string[] = [] + let changed = false + + for (const hook of hooks) { + const mapping = HOOK_NAME_MAP[hook] + + if (mapping === null) { + removed.push(hook) + changed = true + continue + } + + const newHook = mapping ?? hook + if (newHook !== hook) { + changed = true + } + migrated.push(newHook) + } + + return { migrated, changed, removed } +}