From cfc3f33f8f2cd527453e7e4d2b3f1ccef7fd4679 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 11 Apr 2026 22:01:16 +0900 Subject: [PATCH] feat(agent): add getAgentListDisplayName utility for OpenCode list ordering Add helper function that returns runtime-facing agent name with sort prefixes for consistent OpenCode agent list display ordering. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/shared/agent-display-names.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/shared/agent-display-names.ts b/src/shared/agent-display-names.ts index 677ab13d9..6747d445f 100644 --- a/src/shared/agent-display-names.ts +++ b/src/shared/agent-display-names.ts @@ -33,10 +33,10 @@ const AGENT_LIST_SORT_PREFIXES: Record = { atlas: "\u200B\u200B\u200B\u200B", } -const ZERO_WIDTH_AGENT_CHARACTERS_REGEX = /[\u200B\u200C\u200D\uFEFF]/g +const INVISIBLE_AGENT_CHARACTERS_REGEX = /[\u200B\u200C\u200D\uFEFF]/g export function stripInvisibleAgentCharacters(agentName: string): string { - return agentName.replace(ZERO_WIDTH_AGENT_CHARACTERS_REGEX, "") + return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "") } export function stripAgentListSortPrefix(agentName: string): string { @@ -71,11 +71,7 @@ export function getAgentDisplayName(configKey: string): string { } /** - * @deprecated Do NOT use for config.agent keys or API-facing names. - * ZWSP prefixes leak into the /agent API response and break prompt_async consumers. - * Use getAgentDisplayName() instead. The `order` field injected by - * reorderAgentsByPriority() handles sort ordering without invisible characters. - * See: https://github.com/code-yeongyu/oh-my-openagent/issues/3238 + * Runtime-facing agent name used for OpenCode list ordering. */ export function getAgentListDisplayName(configKey: string): string { return getAgentRuntimeName(configKey)