Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(web): show Macro Agent's models as names with their provider logo (#6819)
Wolf Mermelsteinccf752b9fa72
diff --git a/apps/web/src/features/agents-view/components/ModelSelector.test.tsx b/apps/web/src/features/agents-view/components/ModelSelector.test.tsxindex 29af4a9019..dfdca274d8 100644--- a/apps/web/src/features/agents-view/components/ModelSelector.test.tsx+++ b/apps/web/src/features/agents-view/components/ModelSelector.test.tsx@@ -180,7 +180,9 @@ describe('shared model selector', () => {/>));const trigger = screen.getByRole('button', { name: 'Model' });- expect(trigger.textContent).toContain('gpt-5');+ // The id is all the selector has until the catalog lands; it still reads+ // as a name rather than a slug.+ expect(trigger.textContent).toContain('GPT-5');fireEvent.keyDown(trigger, { key: 'Enter' });expect(screen.getByRole('status').textContent).toContain('Waiting for the agent'diff --git a/apps/web/src/features/agents-view/components/ModelSelector.tsx b/apps/web/src/features/agents-view/components/ModelSelector.tsxindex c35cd7ba39..0d44c36346 100644--- a/apps/web/src/features/agents-view/components/ModelSelector.tsx+++ b/apps/web/src/features/agents-view/components/ModelSelector.tsx@@ -1,7 +1,7 @@import type { AgentModelSelectorProps } from '@app/features/block-agent/ui/AgentModelSelector';import { ModelCatalogPicker } from '@core/component/AI/component/input/ModelCatalogPicker';+import { modelLabel } from '@core/component/AI/constant/model-label';import type { JSX } from 'solid-js';-import { modelLabel } from './model-label';export type ModelChoice = {id: string;diff --git a/apps/web/src/features/agents-view/components/model-label.ts b/apps/web/src/features/agents-view/components/model-label.tsdeleted file mode 100644index 66962e69e3..0000000000--- a/apps/web/src/features/agents-view/components/model-label.ts+++ /dev/null@@ -1,16 +0,0 @@-import {- MODEL_PRETTYNAME,- type Model,-} from '@core/component/AI/constant/model';--/** Readable model names shared by the composer and running sessions. */-export function modelLabel(id: string | undefined, name?: string) {- if (!id) return 'Model';- return (- MODEL_PRETTYNAME[id as Model] ??- MODEL_PRETTYNAME[`anthropic/${id}` as Model] ??- (name ?? id)- .replace(/^(anthropic|openai|google)\//, '')- .replace(/^Claude /, '')- );-}diff --git a/apps/web/src/features/agents-view/views/AgentPicker.tsx b/apps/web/src/features/agents-view/views/AgentPicker.tsxindex dafddb7122..03e57a5b80 100644--- a/apps/web/src/features/agents-view/views/AgentPicker.tsx+++ b/apps/web/src/features/agents-view/views/AgentPicker.tsx@@ -1,18 +1,17 @@import { ModelCatalogMenu } from '@core/component/AI/component/input/ModelCatalogPicker';import {- modelProvider,+ ModelIcon,ProviderIcon,} from '@core/component/AI/component/ProviderIcon';+import { modelLabel } from '@core/component/AI/constant/model-label';import CaretDownIcon from '@phosphor/caret-down.svg';import CaretRightIcon from '@phosphor/caret-right.svg';import CheckIcon from '@phosphor/check.svg';import CodeIcon from '@phosphor/code.svg';import PlusIcon from '@phosphor/plus.svg';-import SparkleIcon from '@phosphor/sparkle.svg';import { Dropdown } from '@ui';import { createSignal, For, Show } from 'solid-js';import { AgentIcon } from '../components/AgentGlyph';-import { modelLabel } from '../components/model-label';import {MACRO_PERSONA_ID,type RosterAgent,@@ -111,12 +110,7 @@ export function AgentPicker(props: {onSelect={() => choose(agent(), option.id)}><span class="flex size-5 shrink-0 items-center justify-center">- <Show- when={modelProvider(option.id)}- fallback={<SparkleIcon class="size-4 shrink-0" />}- >- <ProviderIcon model={option.id} class="size-4" />- </Show>+ <ModelIcon model={option.id} /></span><span class="min-w-0 flex-1 truncate">{modelLabel(option.id, option.name)}diff --git a/apps/web/src/features/block-agent/component/compose-agent-session-options.ts b/apps/web/src/features/block-agent/component/compose-agent-session-options.tsindex 7f46e626e3..523eb7739f 100644--- a/apps/web/src/features/block-agent/component/compose-agent-session-options.ts+++ b/apps/web/src/features/block-agent/component/compose-agent-session-options.ts@@ -1,4 +1,5 @@import { isCoderHarness } from '@app/features/agents-view/core/agent-kind';+import { modelLabel } from '@core/component/AI/constant/model-label';import { isClaudeBotId } from '@core/constant/claudeAgent';import { isCodexBotId } from '@core/constant/codexAgent';import { isCursorBotId } from '@core/constant/cursorAgent';@@ -100,10 +101,14 @@ export function showsSessionHarness(session: {return isCoderHarness(sessionHarnessSlug(session));}-/** A model's display name, or its id when the runtime lists no name for it. */+/**+ * A model's display name. Runtimes that keep no name for a model report its+ * slug as the name, so the house label reads the id instead of showing+ * `claude-sonnet-5` where the rest of the app says "Sonnet 5".+ */export function modelDisplayName(id: string,available: readonly { id: string; name: string }[]): string {- return available.find((model) => model.id === id)?.name ?? id;+ return modelLabel(id, available.find((model) => model.id === id)?.name);}diff --git a/apps/web/src/features/block-agent/component/parts/ControlPart.test.tsx b/apps/web/src/features/block-agent/component/parts/ControlPart.test.tsxindex cc72d4c736..3cc48fbbbc 100644--- a/apps/web/src/features/block-agent/component/parts/ControlPart.test.tsx+++ b/apps/web/src/features/block-agent/component/parts/ControlPart.test.tsx@@ -45,18 +45,16 @@ const failedOf = (part: Control) => {};describe('a model change', () => {+ // The control carries a slug; the line names the model the way the rest of+ // the app does.it('reads as done the moment it is issued', () => {- expect(lineOf(setModel({ kind: 'pending' }))).toBe(- 'Model set to openai/gpt-5'- );- expect(lineOf(setModel({ kind: 'accepted' }))).toBe(- 'Model set to openai/gpt-5'- );+ expect(lineOf(setModel({ kind: 'pending' }))).toBe('Model set to GPT-5');+ expect(lineOf(setModel({ kind: 'accepted' }))).toBe('Model set to GPT-5');});it('says it did not happen when the runtime refuses', () => {const part = setModel({ kind: 'rejected', message: 'unknown model' });- expect(lineOf(part)).toContain("Couldn't switch to openai/gpt-5");+ expect(lineOf(part)).toContain("Couldn't switch to GPT-5");expect(lineOf(part)).not.toContain('Model set to');expect(failedOf(part)).toBe('true');expect(failedOf(setModel({ kind: 'accepted' }))).toBe('false');diff --git a/apps/web/src/features/block-agent/component/parts/ControlPart.tsx b/apps/web/src/features/block-agent/component/parts/ControlPart.tsxindex 2b27eee043..9544070459 100644--- a/apps/web/src/features/block-agent/component/parts/ControlPart.tsx+++ b/apps/web/src/features/block-agent/component/parts/ControlPart.tsx@@ -9,6 +9,7 @@* in-progress state would only make the switch look slower than it is.*/+import { modelLabel } from '@core/component/AI/constant/model-label';import type { MessagePart } from '@service-agent-fold/generated/types';import { match, P } from 'ts-pattern';import { ActionLine } from '../../ui';@@ -23,11 +24,11 @@ function label(part: ControlPartData): string {// runtime refusal, after the fact, reads differently..with([{ kind: 'set_model' }, { kind: P.union('pending', 'accepted') }],- ([control]) => `Model set to ${control.model}`+ ([control]) => `Model set to ${modelLabel(control.model)}`).with([{ kind: 'set_model' }, { kind: 'rejected' }],- ([control]) => `Couldn't switch to ${control.model}`+ ([control]) => `Couldn't switch to ${modelLabel(control.model)}`).with([{ kind: 'compact' }, { kind: 'pending' }],diff --git a/apps/web/src/features/block-agent/component/parts/SubagentToolCall.tsx b/apps/web/src/features/block-agent/component/parts/SubagentToolCall.tsxindex 91c9649885..0bc73d525c 100644--- a/apps/web/src/features/block-agent/component/parts/SubagentToolCall.tsx+++ b/apps/web/src/features/block-agent/component/parts/SubagentToolCall.tsx@@ -4,6 +4,7 @@* same part components), and what it reported back.*/+import { modelLabel } from '@core/component/AI/constant/model-label';import AgentIcon from '@phosphor/sparkle.svg';import type {MessagePart,@@ -154,7 +155,9 @@ export function SubagentToolCall(props: {</Show><Show when={result().model}>{(model) => (- <span class="text-xs text-ink-extra-muted">{model()}</span>+ <span class="text-xs text-ink-extra-muted">+ {modelLabel(model())}+ </span>)}</Show><Show when={result().tokens != null}>diff --git a/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx b/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsxindex fc2640d97d..045e3aca21 100644--- a/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx+++ b/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx@@ -12,6 +12,7 @@import { DiffCounts } from '@app/features/agent-changes/components/DiffCounts';import { useOptionalAgentChanges } from '@app/features/agent-changes/context/agent-changes-controller';import { SidePanel } from '@components/app/side-panel';+import { ModelIcon } from '@core/component/AI/component/ProviderIcon';import { References } from '@core/component/References';import { formatDate } from '@core/util/date';import { openExternalUrl } from '@core/util/url';@@ -24,6 +25,7 @@ import { activityCounts, latestPlan } from '../../state/session-summary';import { CountSummary, SessionStatusPill, TodoList } from '../../ui';import { AgentPullRequestChip } from '../AgentPullRequestChip';import {+ modelDisplayName,sessionHarnessTitle,sessionRepositoryUrl,showsSessionHarness,@@ -67,7 +69,13 @@ export function AgentSidePanelSections() {{(model) => (<SidePanel.Row label="Model"><SidePanel.Pill>- <span class="truncate">{model()}</span>+ <ModelIcon model={model()} class="size-3" />+ <span class="truncate">+ {modelDisplayName(+ model(),+ metadata()?.supportedModels ?? []+ )}+ </span></SidePanel.Pill></SidePanel.Row>)}diff --git a/apps/web/src/features/block-agent/debug/Gallery.tsx b/apps/web/src/features/block-agent/debug/Gallery.tsxindex 1ff47b3db2..426a519cc2 100644--- a/apps/web/src/features/block-agent/debug/Gallery.tsx+++ b/apps/web/src/features/block-agent/debug/Gallery.tsx@@ -110,16 +110,31 @@ const FIXTURE_MODELS: ModelOption[] = [},];+/**+ * A Macro Agent catalog: the in-memory harness keeps no display names, so+ * every option arrives named after its own slug.+ */+const FIXTURE_INMEM_MODELS: ModelOption[] = [+ 'anthropic/claude-sonnet-5',+ 'anthropic/claude-opus-5',+ 'anthropic/claude-haiku-4-5',+ 'openai/gpt-5.5',+ 'openai/gpt-5-mini',+].map((id) => ({ id, name: id, description: null, group: null }));+/** The composer as the block mounts it, with the model control wired. */-function ModelSelectorDemo() {- const [model, setModel] = createSignal<string | null>('grok-4.6-high-fast');+function ModelSelectorDemo(props: {+ options: ModelOption[];+ initialModel: string;+}) {+ const [model, setModel] = createSignal<string | null>(props.initialModel);return (<AgentInputonSend={(content) => console.info('[gallery] send', content)}modelControl={<AgentModelSelectormodel={model()}- options={FIXTURE_MODELS}+ options={props.options}onSelect={(id) => {console.info('[gallery] model', id);setModel(id);@@ -1221,8 +1236,22 @@ export default function AgentUiGallery() {/></Item>- <Item label="AgentInput with model selector">- <ModelSelectorDemo />+ <Item label="AgentInput with model selector (harness names)">+ <ModelSelectorDemo+ options={FIXTURE_MODELS}+ initialModel="grok-4.6-high-fast"+ />+ </Item>++ <Item label="AgentInput with model selector (slug-named catalog)">+ <p class="text-xs text-ink-muted">+ What Macro Agent reports: names that are only ids, shown as names+ with their provider's logo.+ </p>+ <ModelSelectorDemo+ options={FIXTURE_INMEM_MODELS}+ initialModel="anthropic/claude-sonnet-5"+ /></Item><Item label="AgentMessage (end-to-end)">diff --git a/apps/web/src/features/block-agent/ui/AgentModelSelector.test.tsx b/apps/web/src/features/block-agent/ui/AgentModelSelector.test.tsxnew file mode 100644index 0000000000..4f200821b6--- /dev/null+++ b/apps/web/src/features/block-agent/ui/AgentModelSelector.test.tsx@@ -0,0 +1,124 @@+import type { ModelOption } from '@service-agent-fold/generated/types';+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { AgentModelSelector } from './AgentModelSelector';++const device = vi.hoisted(() => ({ touch: false }));+vi.mock('@core/mobile/isTouchDevice', () => ({+ isTouchDevice: () => device.touch,+}));++/**+ * The in-memory Macro Agent keeps no display names, so every option comes+ * back named after its own slug.+ */+const INMEM_MODELS: ModelOption[] = [+ 'anthropic/claude-sonnet-5',+ 'anthropic/claude-haiku-4-5',+ 'openai/gpt-5.5',+].map((id) => ({ id, name: id, description: null, group: null }));++let motionStyles: HTMLStyleElement;+beforeEach(() => {+ // jsdom omits the motion defaults Kobalte and Corvu track presence with.+ motionStyles = document.createElement('style');+ motionStyles.textContent =+ '[role="menu"], [data-corvu-drawer-content], [data-corvu-drawer-overlay] { animation-name: none; transition-duration: 0s; }';+ document.head.append(motionStyles);+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ }+ );+ vi.stubGlobal('scrollTo', vi.fn());+});+afterEach(() => {+ cleanup();+ motionStyles.remove();+ device.touch = false;+ vi.unstubAllGlobals();+});++const providerOf = (element: Element | null) =>+ element+ ?.querySelector('[data-ai-provider]')+ ?.getAttribute('data-ai-provider');++describe('agent model selector', () => {+ it('names and badges a slug-named catalog on desktop', () => {+ const select = vi.fn();+ render(() => (+ <AgentModelSelector+ model="anthropic/claude-sonnet-5"+ options={INMEM_MODELS}+ onSelect={select}+ />+ ));+ const trigger = screen.getByRole('button');+ expect(trigger.textContent).toContain('Sonnet 5');+ expect(trigger.textContent).not.toContain('claude-sonnet-5');+ expect(providerOf(trigger)).toBe('anthropic');++ fireEvent.keyDown(trigger, { key: 'Enter' });+ const haiku = screen.getByRole('menuitem', { name: /^Haiku 4.5/ });+ expect(providerOf(haiku)).toBe('anthropic');+ expect(providerOf(screen.getByRole('menuitem', { name: /^GPT-5.5/ }))).toBe(+ 'openai'+ );+ expect(screen.queryByText('anthropic/claude-haiku-4-5')).toBeNull();++ fireEvent.keyDown(haiku, { key: 'Enter' });+ expect(select).toHaveBeenCalledWith('anthropic/claude-haiku-4-5');+ });++ it('names and badges the same catalog in the touch sheet', async () => {+ device.touch = true;+ const select = vi.fn();+ render(() => (+ <AgentModelSelector+ model="anthropic/claude-sonnet-5"+ options={INMEM_MODELS}+ onSelect={select}+ />+ ));+ const trigger = screen.getByRole('button', { name: /Agent model/ });+ expect(trigger.textContent).toContain('Sonnet 5');+ expect(providerOf(trigger)).toBe('anthropic');++ fireEvent.click(trigger);+ const haiku = screen.getByRole('radio', { name: /Haiku 4.5/ });+ expect(providerOf(haiku)).toBe('anthropic');+ expect(screen.queryByText('anthropic/claude-haiku-4-5')).toBeNull();++ fireEvent.click(haiku);+ expect(select).toHaveBeenCalledWith('anthropic/claude-haiku-4-5');+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());+ });++ it('keeps a harness display name when the harness has one', () => {+ render(() => (+ <AgentModelSelector+ model="opus-5-high"+ options={[+ {+ id: 'opus-5-high',+ name: 'Claude Opus 5 High',+ description: null,+ group: null,+ },+ ]}+ onSelect={vi.fn()}+ />+ ));+ expect(screen.getByRole('button').textContent).toContain('Opus 5 High');+ });+});diff --git a/apps/web/src/features/block-agent/ui/AgentModelSelector.tsx b/apps/web/src/features/block-agent/ui/AgentModelSelector.tsxindex dedc20f04c..2be810aa25 100644--- a/apps/web/src/features/block-agent/ui/AgentModelSelector.tsx+++ b/apps/web/src/features/block-agent/ui/AgentModelSelector.tsx@@ -1,10 +1,12 @@/*** The session's model, as a pill that opens the harness's own model list.*- * Everything here is harness-reported: the options come from the runtime's- * ACP `configOptions` and the current model is the fold's rejection-safe- * projection of them, so this component never needs a model registry of its- * own. Renders nothing until the harness has advertised its models.+ * The catalog is harness-reported: the options come from the runtime's ACP+ * `configOptions` and the current model is the fold's rejection-safe+ * projection of them. Names and logos still go through the house+ * `modelLabel` / `ModelIcon`, because a runtime that keeps no display name+ * for a model — the in-memory Macro Agent among them — reports the slug as+ * its name. Renders nothing until the harness has advertised its models.** Touch devices get a bottom sheet (`MobileDrawer`, the same chrome as the* split title menu) listing every model with a check on the current one, and@@ -26,6 +28,8 @@ import {isLargeModelCatalog,matchesModelQuery,} from '@core/component/AI/component/input/modelCatalog';+import { ModelIcon } from '@core/component/AI/component/ProviderIcon';+import { modelLabel } from '@core/component/AI/constant/model-label';import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';import { isTouchDevice } from '@core/mobile/isTouchDevice';import Check from '@phosphor/check.svg';@@ -80,13 +84,14 @@ export function AgentModelSelector(props: AgentModelSelectorProps) {const [query, setQuery] = createSignal('');const shown = () => props.changingTo ?? props.model;const label = () =>- props.options.find((option) => option.id === shown())?.name ??- shown() ??- 'Model';+ modelLabel(+ shown() ?? undefined,+ props.options.find((option) => option.id === shown())?.name+ );const options = createMemo(() => withoutRedundantGroups(props.options));const toCatalogOption = (option: ModelOption): CatalogModelOption => ({id: option.id,- label: option.name,+ label: modelLabel(option.id, option.name),description: option.description ?? undefined,group: option.group ?? undefined,});@@ -120,15 +125,16 @@ export function AgentModelSelector(props: AgentModelSelectorProps) {preventScroll={false}preventScrollbarShift={false}>- {/* Plain text + caret, like the reference composer — no pill. */}+ {/* Provider logo + text + caret, like the reference composer — no pill. */}<MobileDrawer.Triggeras={Button}variant="ghost"size="sm"aria-label="Agent model"disabled={props.disabled}- class="h-8 max-w-[60vw] min-w-0 justify-start gap-1 rounded-lg border-none bg-transparent px-1.5 text-left text-sm text-ink-subtle hover:bg-hover"+ class="h-8 max-w-[60vw] min-w-0 justify-start gap-1.5 rounded-lg border-none bg-transparent px-1.5 text-left text-sm text-ink-subtle hover:bg-hover">+ <ModelIcon model={shown()} /><span class="min-w-0 truncate">{label()}</span><CaretDown class="size-3.5 shrink-0" /></MobileDrawer.Trigger>@@ -177,8 +183,9 @@ export function AgentModelSelector(props: AgentModelSelectorProps) {title={option.description ?? undefined}onClick={() => pick(option.id)}>+ <ModelIcon model={option.id} /><span class="min-w-0 flex-1 truncate">- {option.name}+ {modelLabel(option.id, option.name)}</span><Show when={option.id === shown()}><Check class="size-3.5 shrink-0 text-accent" />@@ -204,8 +211,9 @@ export function AgentModelSelector(props: AgentModelSelectorProps) {class={PILL_TRIGGER_CLASS}disabled={props.disabled}>- {label()}- <CaretDown />+ <ModelIcon model={shown()} class="size-3.5" />+ <span class="min-w-0 truncate">{label()}</span>+ <CaretDown class="shrink-0" /></Dropdown.Trigger><Dropdown.Content class="w-60 max-w-[calc(100vw-1rem)] overflow-hidden">{/* The gradients anchor here, outside the scrolling box, and read@@ -227,7 +235,10 @@ export function AgentModelSelector(props: AgentModelSelectorProps) {title={option.description ?? undefined}onSelect={() => pick(option.id)}>- <span class="flex-1 truncate">{option.name}</span>+ <ModelIcon model={option.id} class="size-3.5" />+ <span class="flex-1 truncate">+ {modelLabel(option.id, option.name)}+ </span></Dropdown.Item>)}</For>diff --git a/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx b/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsxindex 1764bc78a7..276f17d51c 100644--- a/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx+++ b/apps/web/src/lib/core/component/AI/component/ProviderIcon.tsx@@ -1,4 +1,5 @@import ClaudeIcon from '@icon/wide-claude.svg';+import SparkleIcon from '@phosphor/sparkle.svg';import GoogleIcon from '@phosphor-fill/google-logo-fill.svg';import { type Component, type JSX, Show } from 'solid-js';import { Dynamic } from 'solid-js/web';@@ -54,3 +55,19 @@ export function ProviderIcon(props: {</span>);}++/**+ * The logo to show beside a model's name in a picker: its provider's, or a+ * neutral sparkle for a model whose provider the id does not give away.+ */+export function ModelIcon(props: { model?: string | null; class?: string }) {+ const sizing = () => props.class ?? 'size-4';+ return (+ <Show+ when={modelProvider(props.model)}+ fallback={<SparkleIcon class={`shrink-0 ${sizing()}`} />}+ >+ <ProviderIcon model={props.model} class={sizing()} />+ </Show>+ );+}diff --git a/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx b/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsxindex 3e8df761e7..7535edf2f3 100644--- a/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx+++ b/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx@@ -2,10 +2,9 @@ import CaretDown from '@phosphor/caret-left.svg';import CaretRight from '@phosphor/caret-right.svg';import CheckIcon from '@phosphor/check.svg';import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';-import SparkleIcon from '@phosphor/sparkle.svg';import { cn, Dropdown } from '@ui';import { createMemo, createSignal, For, type JSX, Show } from 'solid-js';-import { modelProvider, ProviderIcon } from '../ProviderIcon';+import { ModelIcon } from '../ProviderIcon';import {buildModelCatalog,type CatalogModelOption,@@ -32,17 +31,6 @@ type ModelCatalogPickerProps = {placement?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';};-function ModelIcon(props: { model?: string | null }) {- return (- <Show- when={modelProvider(props.model)}- fallback={<SparkleIcon class="size-4 shrink-0" />}- >- <ProviderIcon model={props.model} class="size-4" />- </Show>- );-}-function ModelRow(props: {option: CatalogModelOption;selected: boolean;diff --git a/apps/web/src/lib/core/component/AI/component/input/modelCatalog.ts b/apps/web/src/lib/core/component/AI/component/input/modelCatalog.tsindex 40f5e416c7..4e4083f320 100644--- a/apps/web/src/lib/core/component/AI/component/input/modelCatalog.ts+++ b/apps/web/src/lib/core/component/AI/component/input/modelCatalog.ts@@ -195,11 +195,16 @@ export function modelFamilyHint(return family === option.label ? undefined : family;}-/** Whether a search query hits this model by name or by its heading. */+/**+ * Whether a search query hits this model by name, by its heading, or by its+ * id — a name displayed as "Sonnet 5" should still be findable by typing the+ * vendor out of its `anthropic/claude-sonnet-5` slug.+ */export function matchesModelQuery(option: CatalogModelOption, query: string) {const family = option.group ?? inferModelFamily(option.label);return (option.label.toLowerCase().includes(query) ||- family.toLowerCase().includes(query)+ family.toLowerCase().includes(query) ||+ option.id.toLowerCase().includes(query));}diff --git a/apps/web/src/lib/core/component/AI/constant/model-label.test.ts b/apps/web/src/lib/core/component/AI/constant/model-label.test.tsnew file mode 100644index 0000000000..13b692589e--- /dev/null+++ b/apps/web/src/lib/core/component/AI/constant/model-label.test.ts@@ -0,0 +1,35 @@+import { describe, expect, it } from 'vitest';+import { modelLabel } from './model-label';++describe('modelLabel', () => {+ it('prefers the house name for models the app routes itself', () => {+ expect(modelLabel('anthropic/claude-sonnet-5')).toBe('Sonnet 5');+ expect(modelLabel('openai/gpt-5.6-mini')).toBe('GPT-5.6 mini');+ // Runtimes that drop the provider segment still get the house name.+ expect(modelLabel('claude-haiku-4-5')).toBe('Haiku 4.5');+ });++ it('reads an unknown slug as a name rather than showing it raw', () => {+ expect(modelLabel('anthropic/claude-sonnet-3.8')).toBe('Sonnet 3.8');+ expect(modelLabel('openai/gpt-5.5')).toBe('GPT-5.5');+ expect(modelLabel('openai/gpt-5-mini')).toBe('GPT-5 mini');+ expect(modelLabel('google/gemini-3.8-flash')).toBe('Gemini 3.8 Flash');+ expect(modelLabel('claude-3-7-sonnet-20250219')).toBe('3.7 Sonnet');+ });++ it('keeps a display name the runtime actually has', () => {+ expect(modelLabel('opus-5-high', 'Claude Opus 5 High')).toBe('Opus 5 High');+ expect(modelLabel('default', 'Auto')).toBe('Auto');+ });++ it('ignores a name that is only the id again', () => {+ // How a harness with no catalog names says it has no name for the model.+ expect(modelLabel('claude-sonnet-3.8', 'claude-sonnet-3.8')).toBe(+ 'Sonnet 3.8'+ );+ });++ it('falls back to a placeholder before a model is known', () => {+ expect(modelLabel(undefined)).toBe('Model');+ });+});diff --git a/apps/web/src/lib/core/component/AI/constant/model-label.ts b/apps/web/src/lib/core/component/AI/constant/model-label.tsnew file mode 100644index 0000000000..a0e6798cce--- /dev/null+++ b/apps/web/src/lib/core/component/AI/constant/model-label.ts@@ -0,0 +1,78 @@+/**+ * Readable model names, shared by every surface that shows one: the chat and+ * agent composers, the session side panel, and the transcript.+ *+ * Model ids reach the UI from three places — the frontend's own routed ids,+ * a harness's ACP catalog, and a session row — and only the first is+ * guaranteed to be in {@link MODEL_PRETTYNAME}. Harnesses that keep no+ * display name for a model (the in-memory Macro Agent among them) echo the+ * slug back as the name, so anything that renders the reported name verbatim+ * shows `claude-sonnet-5` where the rest of the app says "Sonnet 5". Route+ * those through {@link modelLabel} instead.+ */++import { MODEL_PRETTYNAME, type Model } from './model';++/** Vendor acronyms that read as shouting only when they are not shouted. */+const ACRONYMS = new Set(['gpt', 'ai', 'llm']);++/** Trailing qualifiers the house names keep lowercase ("GPT-5.6 mini"). */+const QUALIFIERS = new Set(['mini', 'nano', 'lite']);++const isVersion = (token: string) => /^\d+(\.\d+)*$/.test(token);++function formatToken(token: string): string {+ const lower = token.toLowerCase();+ if (ACRONYMS.has(lower)) return lower.toUpperCase();+ if (QUALIFIERS.has(lower)) return lower;+ if (isVersion(token)) return token;+ return token.charAt(0).toUpperCase() + token.slice(1);+}++/**+ * A slug nobody has a name for, read as a name: `anthropic/claude-sonnet-3.8`+ * becomes "Sonnet 3.8" and `openai/gpt-5-mini` becomes "GPT-5 mini". The+ * vendor prefix goes because the provider logo beside the label already says+ * it, and split version parts (`haiku-4-5`) rejoin as one number.+ */+function humanizeModelId(id: string): string {+ const tokens = id+ .trim()+ .replace(/^[\w.-]+\//, '')+ .split(/[-_\s]+/)+ .filter(Boolean);+ if (tokens.length > 1 && tokens[0]?.toLowerCase() === 'claude')+ tokens.shift();+ // A pinned release date ("claude-3-7-sonnet-20250219") is plumbing.+ if (tokens.length > 1 && /^\d{6,}$/.test(tokens.at(-1) ?? '')) tokens.pop();+ if (tokens.length === 0) return id;++ return tokens.reduce((label, token, index) => {+ const previous = tokens[index - 1];+ if (previous === undefined) return formatToken(token);+ if (isVersion(token) && isVersion(previous)) return `${label}.${token}`;+ if (isVersion(token) && ACRONYMS.has(previous.toLowerCase()))+ return `${label}-${token}`;+ return `${label} ${formatToken(token)}`;+ }, '');+}++/**+ * What to call a model: the house name when the app knows the id, otherwise+ * the runtime's own display name, otherwise the id read as a name. `name` is+ * ignored when it is just the id again, which is how a runtime says it has+ * no name for the model.+ */+export function modelLabel(id: string | undefined, name?: string): string {+ if (!id) return 'Model';+ const pretty =+ MODEL_PRETTYNAME[id as Model] ??+ MODEL_PRETTYNAME[`anthropic/${id}` as Model];+ if (pretty) return pretty;+ const reported = name?.trim();+ if (reported && reported !== id.trim())+ return reported+ .replace(/^(anthropic|openai|google)\//, '')+ .replace(/^Claude /, '');+ return humanizeModelId(id);+}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/create-magic-chip-model.ts b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/create-magic-chip-model.tsindex 241552f424..ff35c150bf 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/create-magic-chip-model.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/create-magic-chip-model.ts@@ -64,16 +64,16 @@ function agentName(session: {}/**- * The model's display name from the fold, its id when the runtime lists no- * name, or the slug the session was created with before the fold reports.+ * The model's display name from the fold, or the one the session was created+ * with before the fold reports.*/function modelName(metadata: SessionMetadata | undefined,session: SessionIdentity | undefined): string | undefined {- const model = metadata?.model;- if (!model) return session?.model || undefined;- return modelDisplayName(model, metadata.supportedModels);+ const model = metadata?.model || session?.model;+ if (!model) return undefined;+ return modelDisplayName(model, metadata?.supportedModels ?? []);}/** Replace the message under the same turn and author, or append it. */diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/presentation.ts b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/presentation.tsindex 58331dc4ef..ff303275ec 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/presentation.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MagicChip/presentation.ts@@ -1,3 +1,4 @@+import { modelLabel } from '@core/component/AI/constant/model-label';import type { MagicChipStatus } from '@macro-inc/lexical-core';import type {FoldedMessage,@@ -192,7 +193,7 @@ function partActivity(part: MessagePart): MagicChipActivity {})).with({ kind: 'control', control: { kind: 'set_model' } }, (part) => ({label: 'Model changed',- detail: part.control.model,+ detail: modelLabel(part.control.model),busy: false,})).with({ kind: 'control', control: { kind: 'compact' } }, () => ({diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.mdindex 32f356648d..eb1ccc4397 100644--- a/docs/AGENT_GUIDE/ai-chat.md+++ b/docs/AGENT_GUIDE/ai-chat.md@@ -424,9 +424,11 @@ text stays a link.On mobile the composer (and any queued prompts above it) floats in the bottomaccessory region above the dock — same placement as channel and AI chat — so itstays tappable and clear of the home indicator. The box is full width; the text-sits on top and a footer row holds the model name (left, e.g. `Auto ⌄`) and-**Send** (right). Tapping the model name opens a bottom sheet listing every-model with a check on the current one — pick a row to switch. On desktop the+sits on top and a footer row holds the model (left, as a provider logo and+name, e.g. `✳ Sonnet 5 ⌄`) and **Send** (right). Tapping the model opens a+bottom sheet listing every model the same way, with a check on the current one+— pick a row to switch. Models read as names even when the runtime reports+only ids: Macro Agent's `anthropic/claude-sonnet-5` shows as **Sonnet 5**. On desktop thetranscript and composer use the shared channel message width so expanding **Context** onlygrows vertically; your messages are right-aligned bubbles and the model pillsits above the box. Tap the session title