2026-02-16 20:43:18 +09:00
|
|
|
import { describe, it, expect } from "bun:test"
|
|
|
|
|
import { remapAgentKeysToDisplayNames } from "./agent-key-remapper"
|
2026-04-06 18:07:07 +09:00
|
|
|
import { getAgentListDisplayName } from "../shared/agent-display-names"
|
2026-02-16 20:43:18 +09:00
|
|
|
|
|
|
|
|
describe("remapAgentKeysToDisplayNames", () => {
|
2026-02-26 15:58:02 -07:00
|
|
|
it("remaps known agent keys to display names", () => {
|
2026-02-16 20:43:18 +09:00
|
|
|
// given agents with lowercase keys
|
|
|
|
|
const agents = {
|
|
|
|
|
sisyphus: { prompt: "test", mode: "primary" },
|
|
|
|
|
oracle: { prompt: "test", mode: "subagent" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// when remapping
|
|
|
|
|
const result = remapAgentKeysToDisplayNames(agents)
|
|
|
|
|
|
2026-03-29 04:02:13 +00:00
|
|
|
// then known agents get display name keys only
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
|
2026-02-16 20:43:18 +09:00
|
|
|
expect(result["oracle"]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["sisyphus"]).toBeUndefined()
|
2026-02-16 20:43:18 +09:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("preserves unknown agent keys unchanged", () => {
|
|
|
|
|
// given agents with a custom key
|
|
|
|
|
const agents = {
|
|
|
|
|
"custom-agent": { prompt: "custom" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// when remapping
|
|
|
|
|
const result = remapAgentKeysToDisplayNames(agents)
|
|
|
|
|
|
|
|
|
|
// then custom key is unchanged
|
|
|
|
|
expect(result["custom-agent"]).toBeDefined()
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-26 15:58:02 -07:00
|
|
|
it("remaps all core agents to display names", () => {
|
2026-02-16 20:43:18 +09:00
|
|
|
// given all core agents
|
|
|
|
|
const agents = {
|
|
|
|
|
sisyphus: {},
|
|
|
|
|
hephaestus: {},
|
|
|
|
|
prometheus: {},
|
|
|
|
|
atlas: {},
|
2026-03-29 04:02:13 +00:00
|
|
|
athena: {},
|
2026-02-16 20:43:18 +09:00
|
|
|
metis: {},
|
|
|
|
|
momus: {},
|
|
|
|
|
"sisyphus-junior": {},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// when remapping
|
|
|
|
|
const result = remapAgentKeysToDisplayNames(agents)
|
|
|
|
|
|
2026-03-29 04:02:13 +00:00
|
|
|
// then all get display name keys
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["sisyphus"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("hephaestus")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["hephaestus"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("prometheus")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["prometheus"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("atlas")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["atlas"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("athena")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["athena"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("metis")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["metis"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("momus")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["momus"]).toBeUndefined()
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(result[getAgentListDisplayName("sisyphus-junior")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["sisyphus-junior"]).toBeUndefined()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("does not emit both config and display keys for remapped agents", () => {
|
|
|
|
|
// given one remapped agent
|
|
|
|
|
const agents = {
|
|
|
|
|
sisyphus: { prompt: "test", mode: "primary" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// when remapping
|
|
|
|
|
const result = remapAgentKeysToDisplayNames(agents)
|
|
|
|
|
|
|
|
|
|
// then only display key is emitted
|
2026-04-06 18:07:07 +09:00
|
|
|
expect(Object.keys(result)).toEqual([getAgentListDisplayName("sisyphus")])
|
|
|
|
|
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
|
2026-03-29 04:02:13 +00:00
|
|
|
expect(result["sisyphus"]).toBeUndefined()
|
2026-02-16 20:43:18 +09:00
|
|
|
})
|
|
|
|
|
})
|