refactor(agents): drop ZWSP prefixes from agent display names
The sort shim from the previous commit enforces canonical core ordering at runtime, so ZWSP prefixes are no longer needed. Removing them eliminates the Bun.stringWidth vs terminal-width drift that broke the TUI status bar (#3259). Drop AGENT_LIST_SORT_PREFIXES and getAgentRuntimeName from agent-display-names; switch all call sites to getAgentDisplayName. getAgentListDisplayName stays as a thin alias for external importers. Keep stripInvisibleAgentCharacters and the ZWSP regex paths so legacy session state and configs from v3.14.0-v3.16.0 still resolve. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import pc from "picocolors"
|
||||
import type { RunOptions } from "./types"
|
||||
import type { OhMyOpenCodeConfig } from "../../config"
|
||||
import { getAgentConfigKey, getAgentDisplayName, getAgentRuntimeName } from "../../shared/agent-display-names"
|
||||
import { getAgentConfigKey, getAgentDisplayName } from "../../shared/agent-display-names"
|
||||
|
||||
const CORE_AGENT_ORDER = ["sisyphus", "hephaestus", "prometheus", "atlas"] as const
|
||||
const DEFAULT_AGENT = "sisyphus"
|
||||
@@ -21,7 +21,7 @@ const normalizeAgentName = (agent?: string): ResolvedAgent | undefined => {
|
||||
|
||||
const configKey = getAgentConfigKey(trimmed)
|
||||
const displayName = getAgentDisplayName(configKey)
|
||||
const runtimeName = getAgentRuntimeName(configKey)
|
||||
const runtimeName = getAgentDisplayName(configKey)
|
||||
const isKnownAgent = displayName !== configKey
|
||||
|
||||
return {
|
||||
@@ -62,13 +62,13 @@ export const resolveRunAgent = (
|
||||
envAgent ??
|
||||
configAgent ?? {
|
||||
configKey: DEFAULT_AGENT,
|
||||
resolvedName: getAgentRuntimeName(DEFAULT_AGENT),
|
||||
resolvedName: getAgentDisplayName(DEFAULT_AGENT),
|
||||
}
|
||||
|
||||
if (isAgentDisabled(resolved.configKey, pluginConfig)) {
|
||||
const fallback = pickFallbackAgent(pluginConfig)
|
||||
const fallbackDisplayName = getAgentDisplayName(fallback)
|
||||
const fallbackRuntimeName = getAgentRuntimeName(fallback)
|
||||
const fallbackRuntimeName = getAgentDisplayName(fallback)
|
||||
const fallbackDisabled = isAgentDisabled(fallback, pluginConfig)
|
||||
if (fallbackDisabled) {
|
||||
console.log(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, spyOn } from "bun:test"
|
||||
import { OhMyOpenCodeConfigSchema, type OhMyOpenCodeConfig } from "../../config"
|
||||
import { resolveRunAgent } from "./agent-resolver"
|
||||
import { getAgentRuntimeName } from "../../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../../shared/agent-display-names"
|
||||
|
||||
const createConfig = (overrides: Partial<OhMyOpenCodeConfig> = {}): OhMyOpenCodeConfig =>
|
||||
OhMyOpenCodeConfigSchema.parse(overrides)
|
||||
@@ -32,7 +32,7 @@ describe("resolveRunAgent", () => {
|
||||
)
|
||||
|
||||
// then
|
||||
expect(agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
it("uses env agent over config", () => {
|
||||
@@ -44,7 +44,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, env)
|
||||
|
||||
// then
|
||||
expect(agent).toBe(getAgentRuntimeName("atlas"))
|
||||
expect(agent).toBe(getAgentDisplayName("atlas"))
|
||||
})
|
||||
|
||||
it("uses config agent over default", () => {
|
||||
@@ -55,7 +55,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe(getAgentRuntimeName("prometheus"))
|
||||
expect(agent).toBe(getAgentDisplayName("prometheus"))
|
||||
})
|
||||
|
||||
it("falls back to sisyphus when none set", () => {
|
||||
@@ -66,7 +66,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe(getAgentRuntimeName("sisyphus"))
|
||||
expect(agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
|
||||
it("skips disabled sisyphus for next available core agent", () => {
|
||||
@@ -77,7 +77,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
it("maps display-name style default_run_agent values to canonical runtime names", () => {
|
||||
@@ -88,7 +88,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe(getAgentRuntimeName("sisyphus"))
|
||||
expect(agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user