refactor(agent-display): centralize name normalization resolution

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-11 22:28:58 +09:00
parent f5dc1c0eba
commit e9b6bba1d7
2 changed files with 24 additions and 32 deletions
+9 -1
View File
@@ -217,6 +217,10 @@ describe("normalizeAgentForPrompt", () => {
it("removes zero-width characters before returning canonical names", () => {
expect(normalizeAgentForPrompt("Sisyphus\u200B - Ultraworker")).toBe("Sisyphus - Ultraworker")
})
it("converts legacy parenthesized names to canonical display names", () => {
expect(normalizeAgentForPrompt("Atlas (Plan Executor)")).toBe("Atlas - Plan Executor")
})
})
describe("normalizeAgentForPromptKey", () => {
@@ -224,6 +228,10 @@ describe("normalizeAgentForPromptKey", () => {
expect(normalizeAgentForPromptKey("Sisyphus (Ultraworker)")).toBe("sisyphus")
})
it("strips UI ordering prefixes before returning config keys", () => {
expect(normalizeAgentForPromptKey(getAgentListDisplayName("atlas"))).toBe("atlas")
})
it("preserves custom agents", () => {
expect(normalizeAgentForPromptKey("MyCustomAgent")).toBe("MyCustomAgent")
})
@@ -259,7 +267,7 @@ describe("AGENT_DISPLAY_NAMES", () => {
const httpHeaderUnsafe = /[()]/
// when checking each display name
for (const [key, displayName] of Object.entries(AGENT_DISPLAY_NAMES)) {
for (const [, displayName] of Object.entries(AGENT_DISPLAY_NAMES)) {
// then none should contain parentheses
expect(httpHeaderUnsafe.test(displayName)).toBe(false)
}