fix: remove ZWSP from agent display names (#3146)
This commit is contained in:
@@ -150,6 +150,14 @@ describe("getAgentConfigKey", () => {
|
||||
expect(getAgentConfigKey("atlas - plan executor")).toBe("atlas")
|
||||
})
|
||||
|
||||
it("resolves legacy parenthesized display names", () => {
|
||||
// given legacy parenthesized display name from old configs/sessions
|
||||
// when getAgentConfigKey called
|
||||
// then resolves to canonical config key
|
||||
expect(getAgentConfigKey("Sisyphus (Ultraworker)")).toBe("sisyphus")
|
||||
expect(getAgentConfigKey("Atlas (Plan Executor)")).toBe("atlas")
|
||||
})
|
||||
|
||||
it("passes through lowercase config keys unchanged", () => {
|
||||
// given lowercase config key "prometheus"
|
||||
// when getAgentConfigKey called
|
||||
@@ -195,16 +203,16 @@ describe("getAgentListDisplayName", () => {
|
||||
|
||||
describe("normalizeAgentForPrompt", () => {
|
||||
it("strips core UI ordering prefixes back to canonical display names", () => {
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("sisyphus"))).toBe("Sisyphus - Ultraworker")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("hephaestus"))).toBe("Hephaestus - Deep Agent")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("prometheus"))).toBe("Prometheus - Plan Builder")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("atlas"))).toBe("Atlas - Plan Executor")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("sisyphus"))).toBe("Sisyphus (Ultraworker)")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("hephaestus"))).toBe("Hephaestus (Deep Agent)")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("prometheus"))).toBe("Prometheus (Plan Builder)")
|
||||
expect(normalizeAgentForPrompt(getAgentListDisplayName("atlas"))).toBe("Atlas (Plan Executor)")
|
||||
})
|
||||
})
|
||||
|
||||
describe("normalizeAgentForPromptKey", () => {
|
||||
it("converts built-in display names to config keys", () => {
|
||||
expect(normalizeAgentForPromptKey("Sisyphus - Ultraworker")).toBe("sisyphus")
|
||||
expect(normalizeAgentForPromptKey("Sisyphus (Ultraworker)")).toBe("sisyphus")
|
||||
})
|
||||
|
||||
it("preserves custom agents", () => {
|
||||
@@ -236,4 +244,15 @@ describe("AGENT_DISPLAY_NAMES", () => {
|
||||
// then contains all expected mappings
|
||||
expect(AGENT_DISPLAY_NAMES).toEqual(expectedMappings)
|
||||
})
|
||||
|
||||
it("all display names must be HTTP-header-safe (no parentheses)", () => {
|
||||
// given all agent display names
|
||||
const httpHeaderUnsafe = /[()]/
|
||||
|
||||
// when checking each display name
|
||||
for (const [key, 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