fix(agents): restore canonical core agent ordering

Remap the core agent keys, default agent, and command routing back to\nlist display names so OpenCode's name-based sorting keeps the\ncanonical Sisyphus -> Hephaestus -> Prometheus -> Atlas order.\n\nAlso teach tool config lookups to resolve the prefixed list keys and\nadd regression tests that exercise the real ordering and routing path.
This commit is contained in:
YeonGyu-Kim
2026-04-09 12:42:48 +09:00
parent 132a994cfc
commit 4f88e0f4e1
11 changed files with 107 additions and 68 deletions
+29 -8
View File
@@ -1,6 +1,6 @@
import { describe, it, expect } from "bun:test"
import { remapAgentKeysToDisplayNames } from "./agent-key-remapper"
import { getAgentDisplayName } from "../shared/agent-display-names"
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
describe("remapAgentKeysToDisplayNames", () => {
it("remaps known agent keys to display names", () => {
@@ -14,7 +14,7 @@ describe("remapAgentKeysToDisplayNames", () => {
const result = remapAgentKeysToDisplayNames(agents)
// then known agents get display name keys only
expect(result[getAgentDisplayName("sisyphus")]).toBeDefined()
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
expect(result["oracle"]).toBeDefined()
expect(result["sisyphus"]).toBeUndefined()
})
@@ -49,13 +49,13 @@ describe("remapAgentKeysToDisplayNames", () => {
const result = remapAgentKeysToDisplayNames(agents)
// then all get display name keys
expect(result[getAgentDisplayName("sisyphus")]).toBeDefined()
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
expect(result["sisyphus"]).toBeUndefined()
expect(result[getAgentDisplayName("hephaestus")]).toBeDefined()
expect(result[getAgentListDisplayName("hephaestus")]).toBeDefined()
expect(result["hephaestus"]).toBeUndefined()
expect(result[getAgentDisplayName("prometheus")]).toBeDefined()
expect(result[getAgentListDisplayName("prometheus")]).toBeDefined()
expect(result["prometheus"]).toBeUndefined()
expect(result[getAgentDisplayName("atlas")]).toBeDefined()
expect(result[getAgentListDisplayName("atlas")]).toBeDefined()
expect(result["atlas"]).toBeUndefined()
expect(result[getAgentDisplayName("athena")]).toBeDefined()
expect(result["athena"]).toBeUndefined()
@@ -77,8 +77,29 @@ describe("remapAgentKeysToDisplayNames", () => {
const result = remapAgentKeysToDisplayNames(agents)
// then only display key is emitted
expect(Object.keys(result)).toEqual([getAgentDisplayName("sisyphus")])
expect(result[getAgentDisplayName("sisyphus")]).toBeDefined()
expect(Object.keys(result)).toEqual([getAgentListDisplayName("sisyphus")])
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
expect(result["sisyphus"]).toBeUndefined()
})
it("keeps the four core agents in canonical order under opencode name sorting", () => {
// given
const result = remapAgentKeysToDisplayNames({
atlas: {},
prometheus: {},
hephaestus: {},
sisyphus: {},
})
// when
const sortedNames = Object.keys(result).sort()
// then
expect(sortedNames).toEqual([
getAgentListDisplayName("sisyphus"),
getAgentListDisplayName("hephaestus"),
getAgentListDisplayName("prometheus"),
getAgentListDisplayName("atlas"),
])
})
})