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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user