diff --git a/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts b/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts new file mode 100644 index 000000000..221356e90 --- /dev/null +++ b/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts @@ -0,0 +1,16 @@ +// GSD-2 — Provider display name mapping tests +import { test, describe } from "node:test"; +import assert from "node:assert/strict"; +import { providerDisplayName } from "../model-selector.js"; + +describe("providerDisplayName", () => { + test("renames 'anthropic' to 'anthropic-api'", () => { + assert.equal(providerDisplayName("anthropic"), "anthropic-api"); + }); + + test("passes through unmapped providers unchanged", () => { + assert.equal(providerDisplayName("claude-code"), "claude-code"); + assert.equal(providerDisplayName("openai"), "openai"); + assert.equal(providerDisplayName("bedrock"), "bedrock"); + }); +}); diff --git a/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts b/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts index c86347b6f..9f978ffdf 100644 --- a/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +++ b/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts @@ -15,6 +15,15 @@ import { theme } from "../theme/theme.js"; import { DynamicBorder } from "./dynamic-border.js"; import { keyHint } from "./keybinding-hints.js"; +/** Display names for providers in the model selector UI. */ +const PROVIDER_DISPLAY_NAMES: Record = { + anthropic: "anthropic-api", +}; + +export function providerDisplayName(provider: string): string { + return PROVIDER_DISPLAY_NAMES[provider] ?? provider; +} + function formatTokenCount(count: number): string { if (count >= 1_000_000) { const millions = count / 1_000_000; @@ -391,7 +400,7 @@ export class ModelSelectorComponent extends Container implements Focusable { const ctx = formatTokenCount(item.model.contextWindow); const ctxBadge = theme.fg("muted", `${ctx}`); - const providerBadge = theme.fg("muted", `[${item.provider}]`); + const providerBadge = theme.fg("muted", `[${providerDisplayName(item.provider)}]`); const checkmark = isCurrent ? theme.fg("success", " ✓") : ""; let line: string; @@ -447,7 +456,7 @@ export class ModelSelectorComponent extends Container implements Focusable { if (row.kind === "header") { // Provider group header — always unselectable - const providerLabel = theme.fg("borderAccent", row.provider); + const providerLabel = theme.fg("borderAccent", providerDisplayName(row.provider)); const count = theme.fg("muted", ` (${row.count})`); // Add blank line before header if not the very first visible row if (i > startIndex) {