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
chore(agents): model ui grouping (#6177)
Wolf Mermelstein8c6bc1ed2152
diff --git a/apps/web/src/features/block-agent/ui/AgentModelSelector.tsx b/apps/web/src/features/block-agent/ui/AgentModelSelector.tsxindex 2c1ec1e59c..4d0bf65b9c 100644--- a/apps/web/src/features/block-agent/ui/AgentModelSelector.tsx+++ b/apps/web/src/features/block-agent/ui/AgentModelSelector.tsx@@ -12,6 +12,8 @@* under a gradient so the overflow is visible rather than merely scrollable.*/+import { ModelCatalogPicker } from '@core/component/AI/component/input/ModelCatalogPicker';+import { isLargeModelCatalog } from '@core/component/AI/component/input/modelCatalog';import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';import CaretDown from '@phosphor-icons/core/regular/caret-down.svg?component-solid';import type { ModelOption } from '@service-agent-fold/generated/types';@@ -58,52 +60,86 @@ export function AgentModelSelector(props: AgentModelSelectorProps) {props.options.find((option) => option.id === shown())?.name ??shown() ??'Model';+ const catalogOptions = () =>+ props.options.map((option) => ({+ id: option.id,+ label: option.name,+ description: option.description ?? undefined,+ group: option.group ?? undefined,+ }));+ const useCatalog = () => isLargeModelCatalog(catalogOptions());return (<Show when={props.options.length > 0}>- <Dropdown placement="top-start">- <Dropdown.Trigger- variant="ghost"- size="sm"- class="h-6 gap-1 rounded-full bg-ink/5 px-2 text-xs text-ink-muted hover:bg-ink/10"- disabled={props.disabled || props.changingTo !== undefined}- >- <TextShimmer text={label()} active={props.changingTo !== undefined} />- <CaretDown />- </Dropdown.Trigger>- <Dropdown.Content class="overflow-hidden">- {/* The gradients anchor here, outside the scrolling box, and read- the menu background through `--color-surface`. */}- <div class="relative [--color-surface:var(--color-menu)]">- <Dropdown.Group- ref={setListRef}- class="overflow-y-auto overscroll-contain p-0"- style={{ 'max-height': LIST_MAX_HEIGHT }}+ <Show+ when={useCatalog()}+ fallback={+ <Dropdown placement="top-start">+ <Dropdown.Trigger+ variant="ghost"+ size="sm"+ class="h-6 gap-1 rounded-full bg-ink/5 px-2 text-xs text-ink-muted hover:bg-ink/10"+ disabled={props.disabled || props.changingTo !== undefined}>- <div class="flex flex-col p-1.5">- <For each={props.options}>- {(option) => (- <Dropdown.Item- class={cn(- 'h-7 shrink-0 gap-2',- option.id === shown() && 'text-ink font-medium'+ <TextShimmer+ text={label()}+ active={props.changingTo !== undefined}+ />+ <CaretDown />+ </Dropdown.Trigger>+ <Dropdown.Content class="overflow-hidden">+ {/* The gradients anchor here, outside the scrolling box, and read+ the menu background through `--color-surface`. */}+ <div class="relative [--color-surface:var(--color-menu)]">+ <Dropdown.Group+ ref={setListRef}+ class="overflow-y-auto overscroll-contain p-0"+ style={{ 'max-height': LIST_MAX_HEIGHT }}+ >+ <div class="flex flex-col p-1.5">+ <For each={props.options}>+ {(option) => (+ <Dropdown.Item+ class={cn(+ 'h-7 shrink-0 gap-2',+ option.id === shown() && 'text-ink font-medium'+ )}+ title={option.description ?? undefined}+ onSelect={() => {+ if (option.id !== props.model)+ props.onSelect(option.id);+ }}+ >+ <span class="flex-1 truncate text-xs">+ {option.name}+ </span>+ </Dropdown.Item>)}- title={option.description ?? undefined}- onSelect={() => {- if (option.id !== props.model)- props.onSelect(option.id);- }}- >- <span class="flex-1 truncate text-xs">{option.name}</span>- </Dropdown.Item>- )}- </For>+ </For>+ </div>+ </Dropdown.Group>+ <ScrollIndicators scrollRef={listRef} appearance="gradient" /></div>- </Dropdown.Group>- <ScrollIndicators scrollRef={listRef} appearance="gradient" />- </div>- </Dropdown.Content>- </Dropdown>+ </Dropdown.Content>+ </Dropdown>+ }+ >+ <div class="min-w-44">+ <ModelCatalogPicker+ value={shown()}+ options={catalogOptions()}+ onSelect={(id) => {+ if (id !== props.model) props.onSelect(id);+ }}+ disabled={props.disabled || props.changingTo !== undefined}+ ariaLabel="Agent model"+ searchPlaceholder="Search models"+ triggerClass="h-6 rounded-full bg-ink/5 px-2 text-xs text-ink-muted hover:bg-ink/10"+ contentClass="overflow-hidden"+ placement="top-start"+ />+ </div>+ </Show></Show>);}diff --git a/apps/web/src/features/settings/Agents.tsx b/apps/web/src/features/settings/Agents.tsxindex eb02f71007..ea997e2a30 100644--- a/apps/web/src/features/settings/Agents.tsx+++ b/apps/web/src/features/settings/Agents.tsx@@ -1,3 +1,5 @@+import { ModelCatalogPicker } from '@core/component/AI/component/input/ModelCatalogPicker';+import { isLargeModelCatalog } from '@core/component/AI/component/input/modelCatalog';import { MODEL_PRETTYNAME, Model } from '@core/component/AI/constant/model';import { toast } from '@core/component/Toast/Toast';import { MACRO_AGENT_BOT_ID } from '@core/constant/macroAgent';@@ -64,6 +66,8 @@ type ConnectedHarness = {type HarnessModel = {id: string;name: string;+ /** The heading the harness lists this model under, when it groups them. */+ group?: string;};type ChannelOption = ReturnType<typeof botAssignableChannelOptions>[number];@@ -115,6 +119,7 @@ export function Agents() {models: (cursorModels.data?.models ?? []).map((model) => ({id: model.id,name: model.displayName,+ group: model.group,})),kind: 'builtin' as const,},@@ -526,6 +531,13 @@ function AgentDialog(props: {);const selectedDefaultModelId = () =>defaultModelId() || selectedHarness()?.models[0]?.id || '';+ const selectedHarnessUsesCatalog = () =>+ isLargeModelCatalog(+ (selectedHarness()?.models ?? []).map((model) => ({+ id: model.id,+ label: model.name,+ }))+ );const [channelMode, setChannelMode] = createSignal<ChannelMode>(props.agent?.channel_scope ?? 'all');@@ -757,24 +769,46 @@ function AgentDialog(props: {<Showwhen={selectedHarness()?.kind === 'macrod'}fallback={- <select- class="settings-input w-full"- value={selectedDefaultModelId()}- onChange={(event) =>- setDefaultModelId(event.currentTarget.value)+ <Show+ when={selectedHarnessUsesCatalog()}+ fallback={+ <select+ class="settings-input w-full"+ value={selectedDefaultModelId()}+ onChange={(event) =>+ setDefaultModelId(event.currentTarget.value)+ }+ >+ <For each={selectedHarness()?.models ?? []}>+ {(model) => (+ <option+ value={model.id}+ selected={+ model.id === selectedDefaultModelId()+ }+ >+ {model.name}+ </option>+ )}+ </For>+ </select>}>- <For each={selectedHarness()?.models ?? []}>- {(model) => (- <option- value={model.id}- selected={model.id === selectedDefaultModelId()}- >- {model.name}- </option>+ <ModelCatalogPicker+ value={selectedDefaultModelId()}+ options={(selectedHarness()?.models ?? []).map(+ (model) => ({+ id: model.id,+ label: model.name,+ group: model.group,+ }))}- </For>- </select>+ onSelect={setDefaultModelId}+ ariaLabel="Default model"+ triggerClass="w-full justify-between"+ contentClass="overflow-hidden"+ />+ </Show>}><inputdiff --git a/apps/web/src/features/settings/Harness.tsx b/apps/web/src/features/settings/Harness.tsxindex 7435fc65c7..6439cd200e 100644--- a/apps/web/src/features/settings/Harness.tsx+++ b/apps/web/src/features/settings/Harness.tsx@@ -1,3 +1,5 @@+import { ModelCatalogPicker } from '@core/component/AI/component/input/ModelCatalogPicker';+import { isLargeModelCatalog } from '@core/component/AI/component/input/modelCatalog';import { toast } from '@core/component/Toast/Toast';import { ThrownResultError } from '@core/util/result';import CursorIcon from '@icon/wide-cursor-ide.svg';@@ -76,6 +78,14 @@ export function Harness() {// Only worth fetching once there is a key to ask Cursor through.const cursorModels = useCursorModelsQuery(cursorRegistered);const setCursorDefaultModel = useSetCursorDefaultModel();+ const cursorModelOptions = () =>+ (cursorModels.data?.models ?? []).map((model) => ({+ id: model.id,+ label: model.displayName,+ group: model.group,+ }));+ const selectedCursorModelId = () =>+ cursorStatus.data?.defaultModelId ?? cursorModelOptions()[0]?.id ?? null;const handleCursorModelChange = async (modelId: string) => {try {@@ -213,24 +223,42 @@ export function Harness() {<label for="cursor-default-model" class="text-xs text-ink">Default model</label>- <select- id="cursor-default-model"- class="settings-input w-56"- value={cursorStatus.data?.defaultModelId ?? ''}- disabled={setCursorDefaultModel.isPending}- onChange={(event) =>- void handleCursorModelChange(event.currentTarget.value)+ <Show+ when={isLargeModelCatalog(cursorModelOptions())}+ fallback={+ <select+ id="cursor-default-model"+ class="settings-input w-56"+ value={cursorStatus.data?.defaultModelId ?? ''}+ disabled={setCursorDefaultModel.isPending}+ onChange={(event) =>+ void handleCursorModelChange(+ event.currentTarget.value+ )+ }+ >+ <For each={cursorModels.data?.models ?? []}>+ {(model) => (+ <option value={model.id}>+ {model.displayName}+ </option>+ )}+ </For>+ </select>}>- <For each={cursorModels.data?.models ?? []}>- {(model) => (- <option value={model.id}>{model.displayName}</option>- )}- </For>- </select>+ <ModelCatalogPicker+ value={selectedCursorModelId()}+ options={cursorModelOptions()}+ onSelect={(id) => void handleCursorModelChange(id)}+ disabled={setCursorDefaultModel.isPending}+ ariaLabel="Default model"+ triggerClass="w-72 max-w-full justify-between"+ />+ </Show><p class="text-xs text-ink-extra-muted">- The model new @cursor sessions start on. You can still- switch it per session.+ The model new `@cursor` sessions start on. Recommended+ models stay up top; everything else is behind More models.</p></div>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.tsxnew file mode 100644index 0000000000..5360040af0--- /dev/null+++ b/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx@@ -0,0 +1,212 @@+import CaretDown from '@phosphor/caret-left.svg';+import CaretRight from '@phosphor/caret-right.svg';+import CheckIcon from '@phosphor/check.svg';+import { cn, Dropdown } from '@ui';+import { createMemo, createSignal, For, Show } from 'solid-js';+import {+ buildModelCatalog,+ type CatalogModelOption,+ matchesModelQuery,+ modelFamilyHint,+ moreModelFamilies,+} from './modelCatalog';++/**+ * Scrolling lists (search hits, More models) cap at roughly eight `h-8` rows+ * plus a label, so the popover never grows with the size of the catalog.+ */+const LIST_HEIGHT_CLASS = 'max-h-72 overflow-y-auto overscroll-contain';++type ModelCatalogPickerProps = {+ value: string | null;+ options: CatalogModelOption[];+ onSelect: (id: string) => void;+ disabled?: boolean;+ triggerClass?: string;+ contentClass?: string;+ placeholder?: string;+ searchPlaceholder?: string;+ ariaLabel?: string;+ placement?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';+};++function ModelRow(props: {+ option: CatalogModelOption;+ selected: boolean;+ /** Trailing muted text, e.g. the family a search hit belongs to. */+ hint?: string;+ onSelect: () => void;+}) {+ return (+ <Dropdown.Item+ class={cn('h-8 gap-2', props.selected && 'bg-ink/5 text-ink font-medium')}+ title={props.option.description ?? undefined}+ onSelect={props.onSelect}+ >+ <span class="min-w-0 flex-1 truncate text-sm">{props.option.label}</span>+ <Show when={props.hint}>+ <span class="shrink-0 text-xs text-ink-extra-muted">{props.hint}</span>+ </Show>+ <Show when={props.selected}>+ <CheckIcon class="size-3.5 shrink-0 text-accent" />+ </Show>+ </Dropdown.Item>+ );+}++export function ModelCatalogPicker(props: ModelCatalogPickerProps) {+ const [query, setQuery] = createSignal('');+ let searchRef: HTMLInputElement | undefined;++ const selected = () =>+ props.options.find((option) => option.id === props.value) ?? null;+ const displayValue = () => selected()?.label ?? props.placeholder ?? 'Model';++ const normalizedQuery = () => query().trim().toLowerCase();+ const filtered = createMemo(() => {+ const currentQuery = normalizedQuery();+ if (!currentQuery) return [];+ return props.options.filter((option) =>+ matchesModelQuery(option, currentQuery)+ );+ });+ const catalog = createMemo(() =>+ buildModelCatalog(props.options, props.value ?? undefined)+ );+ const extraFamilies = createMemo(() => moreModelFamilies(catalog()));+ const extraCount = createMemo(() =>+ extraFamilies().reduce((count, family) => count + family.options.length, 0)+ );++ return (+ <Dropdown placement={props.placement ?? 'top-start'}>+ <Dropdown.Trigger+ variant="ghost"+ size="sm"+ class={cn(+ 'h-9 justify-between rounded-lg border border-edge-muted bg-transparent px-3 text-left text-sm text-ink hover:bg-ink/3',+ props.triggerClass+ )}+ aria-label={props.ariaLabel}+ disabled={props.disabled}+ >+ <span class="truncate">{displayValue()}</span>+ <CaretDown class="size-3.5 rotate-[-90deg] opacity-70" />+ </Dropdown.Trigger>+ <Dropdown.Content+ class={cn(+ 'w-72 max-w-[min(24rem,calc(100vw-1rem))]',+ props.contentClass+ )}+ onOpenAutoFocus={(event) => {+ event.preventDefault();+ queueMicrotask(() => searchRef?.focus());+ }}+ >+ <div class="border-b border-edge-muted bg-menu p-1.5">+ <input+ ref={searchRef}+ aria-label={props.searchPlaceholder ?? 'Search models'}+ placeholder={props.searchPlaceholder ?? 'Search models'}+ value={query()}+ onInput={(event) => setQuery(event.currentTarget.value)}+ onMouseDown={(event) => event.stopPropagation()}+ onClick={(event) => event.stopPropagation()}+ onKeyDown={(event) => {+ if (event.key !== 'Escape') event.stopPropagation();+ }}+ onKeyUp={(event) => {+ if (event.key !== 'Escape') event.stopPropagation();+ }}+ class="w-full rounded-lg border border-edge-muted bg-transparent px-3 py-2 text-sm text-ink outline-none placeholder:text-ink-extra-muted focus:border-accent"+ />+ </div>++ <Show+ when={normalizedQuery().length > 0}+ fallback={+ <>+ <Show when={catalog().recommended.length > 0}>+ <Dropdown.Group>+ <Dropdown.GroupLabel>Recommended</Dropdown.GroupLabel>+ <For each={catalog().recommended}>+ {(option) => (+ <ModelRow+ option={option}+ hint={modelFamilyHint(option)}+ selected={option.id === props.value}+ onSelect={() => props.onSelect(option.id)}+ />+ )}+ </For>+ </Dropdown.Group>+ </Show>++ <Show when={extraCount() > 0}>+ <Dropdown.Separator class="h-px border-0 bg-edge-muted" />+ <Dropdown.Group>+ <Dropdown.Sub>+ <Dropdown.SubTrigger>+ <span class="truncate">More models</span>+ <span class="flex shrink-0 items-center gap-1 text-xs text-ink-extra-muted">+ {extraCount()}+ <CaretRight class="size-3" />+ </span>+ </Dropdown.SubTrigger>+ <Dropdown.SubContent class="w-72 max-w-[min(24rem,calc(100vw-1rem))]">+ <Dropdown.Group class={LIST_HEIGHT_CLASS}>+ <For each={extraFamilies()}>+ {(family) => (+ <>+ <Show when={family.label}>+ <Dropdown.GroupLabel>+ {family.label}+ </Dropdown.GroupLabel>+ </Show>+ <For each={family.options}>+ {(option) => (+ <ModelRow+ option={option}+ selected={option.id === props.value}+ onSelect={() => props.onSelect(option.id)}+ />+ )}+ </For>+ </>+ )}+ </For>+ </Dropdown.Group>+ </Dropdown.SubContent>+ </Dropdown.Sub>+ </Dropdown.Group>+ </Show>+ </>+ }+ >+ <Dropdown.Group class={LIST_HEIGHT_CLASS}>+ <Dropdown.GroupLabel>+ {filtered().length === 1+ ? '1 matching model'+ : `${filtered().length} matching models`}+ </Dropdown.GroupLabel>+ <For each={filtered()}>+ {(option) => (+ <ModelRow+ option={option}+ hint={modelFamilyHint(option)}+ selected={option.id === props.value}+ onSelect={() => props.onSelect(option.id)}+ />+ )}+ </For>+ <Show when={filtered().length === 0}>+ <div class="px-3 py-4 text-sm text-ink-muted">+ No models match that search.+ </div>+ </Show>+ </Dropdown.Group>+ </Show>+ </Dropdown.Content>+ </Dropdown>+ );+}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.tsnew file mode 100644index 0000000000..40f5e416c7--- /dev/null+++ b/apps/web/src/lib/core/component/AI/component/input/modelCatalog.ts@@ -0,0 +1,205 @@+export type CatalogModelOption = {+ id: string;+ label: string;+ description?: string;+ /**+ * The heading the harness listed this model under (an ACP select group+ * name). Absent when the harness offered a flat list, in which case the+ * catalog has one unlabelled family.+ */+ group?: string;+};++export type ModelFamily = {+ /** `null` for models the harness did not put under any heading. */+ label: string | null;+ options: CatalogModelOption[];+};++export type ModelCatalog = {+ recommended: CatalogModelOption[];+ families: ModelFamily[];+};++/**+ * The flagship models to feature on the first screen, matched against the+ * label the harness gave them. Product curation, not grouping: which model+ * belongs to which family is the harness's call and arrives on `group`.+ */+const RECOMMENDED_PREFIXES = [+ 'Auto',+ 'Cursor Grok 4.6',+ 'Claude Opus 5',+ 'Claude Sonnet 5',+ 'GPT-5.6 Sol',+ 'Gemini 3.8 Flash',+ 'Codex',+ 'Kimi K3',+] as const;++/** First-screen shortlist size; the rest goes behind More models. */+export const MAX_RECOMMENDED_MODELS = 5;++/** Large third-party catalogs need structure rather than one long flat list. */+export function isLargeModelCatalog(options: readonly CatalogModelOption[]) {+ return options.length > 10;+}++/**+ * A version-looking token: alphanumerics and dots with a digit first or+ * second (`4.6`, `5`, `K3`, `o3`, `R1`), but not `GPT`, `Sol`, or `Mini`.+ */+function isVersionToken(token: string): boolean {+ const [first, second] = token;+ const startsLikeAVersion =+ (first !== undefined && /\d/.test(first)) ||+ (first !== undefined &&+ second !== undefined &&+ /[A-Za-z]/.test(first) &&+ /\d/.test(second));+ return startsLikeAVersion && /^[A-Za-z0-9.]+$/.test(token);+}++/**+ * The family a display name belongs to: the words before its first+ * version-looking token, with `GPT-5.6` split at the hyphen so the version is+ * seen. A name with no version, or one that starts with a version (`Auto`,+ * `o3 Pro`), is its own family.+ *+ * This is the same rule the Cursor ACP agent applies before it sends ACP+ * groups (`CursorModel::family` in `crates/cursor_cloud_agents`). It runs+ * here only for harnesses that sent no groups, so those catalogs read the+ * same way rather than as one long flat list.+ */+export function inferModelFamily(label: string): string {+ const tokens = label+ .split(/\s+/)+ .filter(Boolean)+ .flatMap((token) => {+ const hyphen = token.indexOf('-');+ const afterHyphen = token[hyphen + 1];+ return hyphen > 0 && afterHyphen !== undefined && /\d/.test(afterHyphen)+ ? [token.slice(0, hyphen), token.slice(hyphen + 1)]+ : [token];+ });+ const family: string[] = [];+ for (const token of tokens) {+ if (isVersionToken(token)) break;+ family.push(token);+ }+ if (family.length === 0 || family.length === tokens.length)+ return label.trim();+ return family.join(' ');+}++function bucketBy(+ options: readonly CatalogModelOption[],+ labelOf: (option: CatalogModelOption) => string | null+): ModelFamily[] {+ const families: ModelFamily[] = [];+ for (const option of options) {+ const label = labelOf(option);+ const family = families.find((candidate) => candidate.label === label);+ if (family) family.options.push(option);+ else families.push({ label, options: [option] });+ }+ return families;+}++/**+ * Bucket options under the harness's headings, in the order it listed them.+ * A harness that sent no headings gets them inferred from the names; if that+ * still finds no family with two members, the list stays one unlabelled+ * family rather than gaining a header per model.+ */+function familiesOf(options: readonly CatalogModelOption[]): ModelFamily[] {+ if (options.some((option) => option.group)) {+ return bucketBy(options, (option) => option.group ?? null);+ }+ const inferred = bucketBy(options, (option) =>+ inferModelFamily(option.label)+ );+ return inferred.some((family) => family.options.length > 1)+ ? inferred+ : [{ label: null, options: [...options] }];+}++export function buildModelCatalog(+ options: readonly CatalogModelOption[],+ selectedId?: string | null+): ModelCatalog {+ const families = familiesOf(options);+ const recommended: CatalogModelOption[] = [];+ const recommendedIds = new Set<string>();+ const recommendedLabels = new Set<string>();++ const pushRecommended = (option: CatalogModelOption | undefined) => {+ if (+ !option ||+ recommended.length >= MAX_RECOMMENDED_MODELS ||+ recommendedIds.has(option.id) ||+ recommendedLabels.has(option.label)+ )+ return;+ recommended.push(option);+ recommendedIds.add(option.id);+ recommendedLabels.add(option.label);+ };++ pushRecommended(options.find((option) => option.id === selectedId));+ for (const prefix of RECOMMENDED_PREFIXES) {+ pushRecommended(+ options.find((option) =>+ prefix === 'Codex'+ ? option.label.startsWith(prefix)+ : option.label === prefix || option.label.startsWith(`${prefix} `)+ )+ );+ }+ // A harness whose names the curated list does not know still gets a useful+ // shortlist: the first model of each of its headings, in its own order.+ for (const family of families) {+ pushRecommended(family.options[0]);+ }++ return { recommended, families };+}++/** Family buckets with the first-screen recommended shortlist removed. */+export function moreModelFamilies(catalog: ModelCatalog): ModelFamily[] {+ const recommendedIds = new Set(+ catalog.recommended.map((option) => option.id)+ );+ const recommendedLabels = new Set(+ catalog.recommended.map((option) => option.label)+ );+ return catalog.families+ .map((family) => ({+ label: family.label,+ options: family.options.filter(+ (option) =>+ !recommendedIds.has(option.id) && !recommendedLabels.has(option.label)+ ),+ }))+ .filter((family) => family.options.length > 0);+}++/**+ * The heading to show beside a model: the harness's, or the inferred one when+ * the harness sent none. `undefined` when it would only repeat the label.+ */+export function modelFamilyHint(+ option: CatalogModelOption+): string | undefined {+ const family = option.group ?? inferModelFamily(option.label);+ return family === option.label ? undefined : family;+}++/** Whether a search query hits this model by name or by its heading. */+export function matchesModelQuery(option: CatalogModelOption, query: string) {+ const family = option.group ?? inferModelFamily(option.label);+ return (+ option.label.toLowerCase().includes(query) ||+ family.toLowerCase().includes(query)+ );+}diff --git a/apps/web/src/lib/service-clients/service-agent-fold/generated/types.ts b/apps/web/src/lib/service-clients/service-agent-fold/generated/types.tsindex 9813000f07..2de3be4058 100644--- a/apps/web/src/lib/service-clients/service-agent-fold/generated/types.ts+++ b/apps/web/src/lib/service-clients/service-agent-fold/generated/types.ts@@ -222,6 +222,13 @@ export type ModelOption = {name: string;/** Descriptive copy - pricing, context size, and the like. */description: string | null;+ /**+ * The heading the runtime listed this model under, when it grouped its+ * options (ACP's `SessionConfigSelectGroup.name`). `None` for a runtime+ * that offered a flat list; the flattened order still follows the+ * runtime's, group by group.+ */+ group: string | null;};/** One choice offered for a permission request. */@@ -437,10 +444,11 @@ export type SubagentResult = {* kind ACP defines - only for `switch_mode` (nothing a reader would want* rendered) and a kind this fold does not yet know about.*- * Two variants are chosen by *name* rather than kind: Macro's own tools+ * Three variants are chosen by *name* rather than kind: Macro's own tools* ([`Self::Macro`], [`Self::UserTool`]) arrive as ACP `other`, and what a- * reader wants for them is the tool's own JSON, not a generic card. The- * harness reader decides which names are Macro's.+ * reader wants for them is the tool's own JSON, not a generic card; a+ * delegation ([`Self::Subagent`]) is a tool call by whatever name its+ * harness gives it. The harness layer decides which names are which.*/export type ToolDetail =/** A shell command. ACP's `execute`. */diff --git a/apps/web/src/lib/service-clients/service-auth/generated/schemas/cursorModelOption.ts b/apps/web/src/lib/service-clients/service-auth/generated/schemas/cursorModelOption.tsindex 0cc8adce83..0d7212422c 100644--- a/apps/web/src/lib/service-clients/service-auth/generated/schemas/cursorModelOption.ts+++ b/apps/web/src/lib/service-clients/service-auth/generated/schemas/cursorModelOption.ts@@ -8,13 +8,17 @@/*** One model the settings dropdown can offer.-Just id and name: the dropdown lists models, not the hundreds of parameter-variants each carries. The chosen id's parameters are resolved to Cursor's-default variant at session start.+Id, name and family: the dropdown lists models, not the hundreds of+parameter variants each carries. The chosen id's parameters are resolved to+Cursor's default variant at session start. The family is the same heading+the Cursor ACP agent groups its session model select under, so the settings+picker and the in-session picker read the same way.*/export interface CursorModelOption {/** The human-readable name, e.g. `Cursor Grok 4.6`. */displayName: string;+ /** The family heading to list this model under, e.g. `Cursor Grok`. */+ group: string;/** The id to store and send, e.g. `grok-4.6`. */id: string;}diff --git a/apps/web/src/lib/service-clients/service-auth/openapi.json b/apps/web/src/lib/service-clients/service-auth/openapi.jsonindex af9f0f2ec1..20a615dc5d 100644--- a/apps/web/src/lib/service-clients/service-auth/openapi.json+++ b/apps/web/src/lib/service-clients/service-auth/openapi.json@@ -3938,13 +3938,17 @@},"CursorModelOption": {"type": "object",- "description": "One model the settings dropdown can offer.\n\nJust id and name: the dropdown lists models, not the hundreds of parameter\nvariants each carries. The chosen id's parameters are resolved to Cursor's\ndefault variant at session start.",- "required": ["id", "displayName"],+ "description": "One model the settings dropdown can offer.\n\nId, name and family: the dropdown lists models, not the hundreds of\nparameter variants each carries. The chosen id's parameters are resolved to\nCursor's default variant at session start. The family is the same heading\nthe Cursor ACP agent groups its session model select under, so the settings\npicker and the in-session picker read the same way.",+ "required": ["id", "displayName", "group"],"properties": {"displayName": {"type": "string","description": "The human-readable name, e.g. `Cursor Grok 4.6`."},+ "group": {+ "type": "string",+ "description": "The family heading to list this model under, e.g. `Cursor Grok`."+ },"id": {"type": "string","description": "The id to store and send, e.g. `grok-4.6`."diff --git a/crates/agent_fold/src/domain/fold/config.rs b/crates/agent_fold/src/domain/fold/config.rsindex 896217aa9f..7d1383b664 100644--- a/crates/agent_fold/src/domain/fold/config.rs+++ b/crates/agent_fold/src/domain/fold/config.rs@@ -6,8 +6,8 @@ use agent_client_protocol::schema::MaybeUndefined;use agent_client_protocol::schema::v1::{AvailableCommandInput, AvailableCommandsUpdate as AcpAvailableCommandsUpdate,InitializeRequest, InitializeResponse, LoadSessionRequest, NewSessionRequest,- ResumeSessionRequest, SessionConfigKind, SessionConfigOption, SessionConfigSelectOptions,- SessionInfoUpdate, SetSessionConfigOptionRequest,+ ResumeSessionRequest, SessionConfigKind, SessionConfigOption, SessionConfigSelectOption,+ SessionConfigSelectOptions, SessionInfoUpdate, SetSessionConfigOptionRequest,};use agent_client_protocol::{JsonRpcMessage, RawJsonRpcMessage};use agent_runtime_protocol::domain::action::MODEL_CONFIG_ID;@@ -104,20 +104,29 @@ impl FoldState {};let model = Some(select.current_value.to_string());- let supported: Vec<ModelOption> = match select.options {- SessionConfigSelectOptions::Ungrouped(options) => options,- SessionConfigSelectOptions::Grouped(groups) => {- groups.into_iter().flat_map(|group| group.options).collect()- }- _ => return false,- }- .into_iter()- .map(|option| ModelOption {+ let to_option = |option: SessionConfigSelectOption, group: Option<&str>| ModelOption {id: option.value.to_string(),name: option.name,description: option.description,- })- .collect();+ group: group.map(str::to_owned),+ };+ let supported: Vec<ModelOption> = match select.options {+ SessionConfigSelectOptions::Ungrouped(options) => options+ .into_iter()+ .map(|option| to_option(option, None))+ .collect(),+ SessionConfigSelectOptions::Grouped(groups) => groups+ .into_iter()+ .flat_map(|group| {+ let name = group.name;+ group+ .options+ .into_iter()+ .map(move |option| to_option(option, Some(&name)))+ })+ .collect(),+ _ => return false,+ };let changed = self.metadata.model != model || self.metadata.supported_models != supported;self.metadata.model = model;diff --git a/crates/agent_fold/src/domain/model/metadata.rs b/crates/agent_fold/src/domain/model/metadata.rsindex 9961a21fc7..edd5d5fe64 100644--- a/crates/agent_fold/src/domain/model/metadata.rs+++ b/crates/agent_fold/src/domain/model/metadata.rs@@ -88,4 +88,9 @@ pub struct ModelOption {pub name: String,/// Descriptive copy - pricing, context size, and the like.pub description: Option<String>,+ /// The heading the runtime listed this model under, when it grouped its+ /// options (ACP's `SessionConfigSelectGroup.name`). `None` for a runtime+ /// that offered a flat list; the flattened order still follows the+ /// runtime's, group by group.+ pub group: Option<String>,}diff --git a/crates/agent_fold/src/domain/test/metadata.rs b/crates/agent_fold/src/domain/test/metadata.rsindex 9256db084a..6cc6e9519b 100644--- a/crates/agent_fold/src/domain/test/metadata.rs+++ b/crates/agent_fold/src/domain/test/metadata.rs@@ -63,6 +63,56 @@ fn the_session_open_response_seeds_the_model_and_the_menu() {);}+/// The same handshake with the runtime grouping its models under family+/// headers, as the Cursor agent does.+const OPEN_GROUPED: &str = concat!(+ r#"{"direction":"to_runtime","content":{"type":"acp","jsonrpc":"2.0","id":"n","method":"session/new","params":{"cwd":"/w","mcpServers":[]}}}"#,+ "\n",+ r#"{"direction":"to_server","content":{"type":"acp","jsonrpc":"2.0","id":"n","result":{"sessionId":"s1","configOptions":[{"id":"model","name":"Model","type":"select","currentValue":"opus-5","options":[{"group":"claude-opus","name":"Claude Opus","options":[{"value":"opus-5","name":"Claude Opus 5"},{"value":"opus-4.8","name":"Claude Opus 4.8"}]},{"group":"gpt","name":"GPT","options":[{"value":"gpt-5.6","name":"GPT-5.6 Sol","description":"fast"}]}]}]}}}"#,+);++#[test]+fn grouped_models_keep_their_heading_in_listing_order() {+ let mut machine = FoldMachineImpl::new();+ let events = drive(&mut machine, OPEN_GROUPED);++ assert_eq!(events, 1);+ let metadata = machine.metadata();+ assert_eq!(metadata.model.as_deref(), Some("opus-5"));+ let listed: Vec<(&str, Option<&str>)> = metadata+ .supported_models+ .iter()+ .map(|model| (model.id.as_str(), model.group.as_deref()))+ .collect();+ assert_eq!(+ listed,+ vec![+ ("opus-5", Some("Claude Opus")),+ ("opus-4.8", Some("Claude Opus")),+ ("gpt-5.6", Some("GPT")),+ ]+ );+ assert_eq!(+ metadata.supported_models[2].description.as_deref(),+ Some("fast"),+ "the option's own fields survive grouping"+ );+}++#[test]+fn flat_models_carry_no_heading() {+ let mut machine = FoldMachineImpl::new();+ drive(&mut machine, OPEN);++ assert!(+ machine+ .metadata()+ .supported_models+ .iter()+ .all(|model| model.group.is_none())+ );+}+#[test]fn a_rejected_model_change_moves_nothing() {let mut machine = FoldMachineImpl::new();diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@command_invocation.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@command_invocation.jsonl.snapindex 91ffaf1503..f1b72a87cb 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@command_invocation.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@command_invocation.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/command_invocation.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Use the default model (currently Opus 5 (1M context)) · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks · $10/$50 per Mtok",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks · $2/$10 per Mtok · promo through Aug 31",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers · $1/$5 per Mtok",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@long_multi_resume.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@long_multi_resume.jsonl.snapindex a0b8c17e19..bc795cc0af 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@long_multi_resume.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@long_multi_resume.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/long_multi_resume.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Use the default model (currently Opus 5 (1M context)) · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks · $10/$50 per Mtok",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks · $2/$10 per Mtok · promo through Aug 31",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers · $1/$5 per Mtok",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@plan_todo.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@plan_todo.jsonl.snapindex 9847c1902f..8446fe84db 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@plan_todo.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@plan_todo.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/plan_todo.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Use the default model (currently Opus 5 (1M context)) · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks · $10/$50 per Mtok",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks · $2/$10 per Mtok · promo through Aug 31",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers · $1/$5 per Mtok",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_multi_turn.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_multi_turn.jsonl.snapindex 9f6bd24da0..583215cdcb 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_multi_turn.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_multi_turn.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/real_multi_turn.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_single_turn.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_single_turn.jsonl.snapindex 57eaf438dc..8358e2c986 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_single_turn.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@real_single_turn.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/real_single_turn.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_and_continued.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_and_continued.jsonl.snapindex 5568ff1f2f..ee6c7c9285 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_and_continued.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_and_continued.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/resumed_and_continued.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_no_prompt.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_no_prompt.jsonl.snapindex 4226e6ce9b..0accd3b040 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_no_prompt.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@resumed_no_prompt.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/resumed_no_prompt.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers",),+ group: None,},],title: None,diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_claude_code.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_claude_code.jsonl.snapindex 54980839c3..ff0914a890 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_claude_code.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_claude_code.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/subagent_claude_code.jsonl---@@ -16,6 +15,7 @@ SessionMetadata {description: Some("Use the default model (currently Opus 5 (1M context)) · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "opus[1m]",@@ -23,6 +23,7 @@ SessionMetadata {description: Some("Opus 5 with 1M context · Best for everyday, complex tasks · $5/$25 per Mtok",),+ group: None,},ModelOption {id: "claude-fable-5[1m]",@@ -30,6 +31,7 @@ SessionMetadata {description: Some("Fable 5 · Most capable for your hardest and longest-running tasks · $10/$50 per Mtok",),+ group: None,},ModelOption {id: "sonnet",@@ -37,6 +39,7 @@ SessionMetadata {description: Some("Sonnet 5 · Efficient for routine tasks · $2/$10 per Mtok · promo through Aug 31",),+ group: None,},ModelOption {id: "haiku",@@ -44,6 +47,7 @@ SessionMetadata {description: Some("Haiku 4.5 · Fastest for quick answers · $1/$5 per Mtok",),+ group: None,},],title: Some(diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_cursor.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_cursor.jsonl.snapindex b777f2142b..525b54e7d5 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_cursor.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_cursor.jsonl.snap@@ -13,191 +13,229 @@ SessionMetadata {id: "auto-smart",name: "Auto",description: None,+ group: None,},ModelOption {id: "default",name: "Auto",description: None,+ group: None,},ModelOption {id: "grok-4.6",name: "Cursor Grok 4.6",description: None,+ group: None,},ModelOption {id: "composer-2.5",name: "Composer 2.5",description: None,+ group: None,},ModelOption {id: "claude-opus-5",name: "Claude Opus 5",description: None,+ group: None,},ModelOption {id: "claude-opus-4-8",name: "Claude Opus 4.8",description: None,+ group: None,},ModelOption {id: "gpt-5.6-sol",name: "GPT-5.6 Sol",description: None,+ group: None,},ModelOption {id: "gpt-5.5",name: "GPT-5.5",description: None,+ group: None,},ModelOption {id: "claude-fable-5-1",name: "Claude Fable 5.1",description: None,+ group: None,},ModelOption {id: "claude-fable-5",name: "Claude Fable 5",description: None,+ group: None,},ModelOption {id: "grok-4.5",name: "Cursor Grok 4.5",description: None,+ group: None,},ModelOption {id: "gemini-3.8-flash",name: "Gemini 3.8 Flash",description: None,+ group: None,},ModelOption {id: "gemini-3.7-flash",name: "Gemini 3.7 Flash",description: None,+ group: None,},ModelOption {id: "gpt-5.6-terra",name: "GPT-5.6 Terra",description: None,+ group: None,},ModelOption {id: "claude-sonnet-5",name: "Claude Sonnet 5",description: None,+ group: None,},ModelOption {id: "claude-sonnet-4-6",name: "Claude Sonnet 4.6",description: None,+ group: None,},ModelOption {id: "gpt-5.3-codex",name: "Codex 5.3",description: None,+ group: None,},ModelOption {id: "claude-opus-4-7",name: "Claude Opus 4.7",description: None,+ group: None,},ModelOption {id: "gpt-5.4",name: "GPT-5.4",description: None,+ group: None,},ModelOption {id: "claude-opus-4-6",name: "Claude Opus 4.6",description: None,+ group: None,},ModelOption {id: "claude-opus-4-5",name: "Claude Opus 4.5",description: None,+ group: None,},ModelOption {id: "gpt-5.2",name: "GPT-5.2",description: None,+ group: None,},ModelOption {id: "gpt-5.6-luna",name: "GPT-5.6 Luna",description: None,+ group: None,},ModelOption {id: "gemini-3.6-flash",name: "Gemini 3.6 Flash",description: None,+ group: None,},ModelOption {id: "gemini-3.1-pro",name: "Gemini 3.1 Pro",description: None,+ group: None,},ModelOption {id: "gpt-5.4-mini",name: "GPT-5.4 Mini",description: None,+ group: None,},ModelOption {id: "gpt-5.4-nano",name: "GPT-5.4 Nano",description: None,+ group: None,},ModelOption {id: "claude-haiku-4-5",name: "Claude Haiku 4.5",description: None,+ group: None,},ModelOption {id: "claude-sonnet-4-5",name: "Claude Sonnet 4.5",description: None,+ group: None,},ModelOption {id: "gpt-5.1",name: "GPT-5.1",description: None,+ group: None,},ModelOption {id: "gemini-3-flash",name: "Gemini 3 Flash",description: None,+ group: None,},ModelOption {id: "gemini-3.5-flash",name: "Gemini 3.5 Flash",description: None,+ group: None,},ModelOption {id: "claude-sonnet-4",name: "Claude Sonnet 4",description: None,+ group: None,},ModelOption {id: "gpt-5-mini",name: "GPT-5 Mini",description: None,+ group: None,},ModelOption {id: "gemini-2.5-flash",name: "Gemini 2.5 Flash",description: None,+ group: None,},ModelOption {id: "kimi-k3",name: "Kimi K3",description: None,+ group: None,},ModelOption {id: "kimi-k2.7-code",name: "Kimi K2.7 Code",description: None,+ group: None,},ModelOption {id: "glm-5.2",name: "GLM 5.2",description: None,+ group: None,},],title: None,diff --git a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_opencode.jsonl.snap b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_opencode.jsonl.snapindex 90a19996c5..bfe200d37e 100644--- a/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_opencode.jsonl.snap+++ b/crates/agent_fold/src/domain/test/snapshots/agent_fold__domain__test__real_recordings__real_fixtures_derive_their_pinned_metadata@subagent_opencode.jsonl.snap@@ -1,6 +1,5 @@---source: crates/agent_fold/src/domain/test/real_recordings.rs-assertion_line: 270expression: machine.metadata()input_file: crates/agent_fold/fixtures/real/subagent_opencode.jsonl---@@ -14,21 +13,25 @@ SessionMetadata {id: "openai/gpt-5.4",name: "OpenAI/GPT-5.4",description: None,+ group: None,},ModelOption {id: "openai/gpt-5.5",name: "OpenAI/GPT-5.5",description: None,+ group: None,},ModelOption {id: "openai/gpt-5.6-terra",name: "OpenAI/GPT-5.6 Terra",description: None,+ group: None,},ModelOption {id: "openai/gpt-5.6-terra-fast",name: "OpenAI/GPT-5.6 Terra Fast",description: None,+ group: None,},],title: None,diff --git a/crates/cursor_cloud_agents/src/domain/model.rs b/crates/cursor_cloud_agents/src/domain/model.rsindex cfb2d1a2d7..d34707f0ba 100644--- a/crates/cursor_cloud_agents/src/domain/model.rs+++ b/crates/cursor_cloud_agents/src/domain/model.rs@@ -270,6 +270,119 @@ impl CursorModel {.unwrap_or_default(),}}++ /// The family this model belongs to, read off its display name.+ ///+ /// Cursor's listing carries no provider or family field, so the family is+ /// inferred: the words before the first version-looking token. `Claude+ /// Opus 4.8` and `Claude Opus 5` are both `Claude Opus`; `GPT-5.6 Sol` is+ /// `GPT`; `Kimi K3` is `Kimi`. A name with no version, or one that starts+ /// with a version (`Auto`, `o3 Pro`), is its own family, so nothing is ever+ /// forced into a bucket it does not plainly belong to.+ #[must_use]+ pub fn family(&self) -> String {+ model_family(&self.display_name)+ }+}++/// A group of models that share a family, as a picker would head them.+#[derive(Debug, Clone, PartialEq, Eq)]+pub struct ModelFamily {+ /// The family's name, e.g. `Claude Opus`.+ pub name: String,+ /// A stable id for the family: the name lowercased and hyphenated, e.g.+ /// `claude-opus`.+ pub id: String,+ /// The members, in the order the listing gave them.+ pub models: Vec<CursorModel>,+}++impl ModelFamily {+ /// Bucket models by [`CursorModel::family`], families in order of first+ /// appearance and each family's members in listing order, so a client that+ /// renders the groups in order shows the same overall order Cursor did.+ #[must_use]+ pub fn group(models: &[CursorModel]) -> Vec<ModelFamily> {+ let mut families: Vec<ModelFamily> = Vec::new();+ for model in models {+ let name = model.family();+ match families.iter_mut().find(|family| family.name == name) {+ Some(family) => family.models.push(model.clone()),+ None => families.push(ModelFamily {+ id: family_id(&name),+ name,+ models: vec![model.clone()],+ }),+ }+ }+ families+ }++ /// Whether grouping adds any structure: at least one family with more+ /// than one member. A listing of singletons is better shown flat than+ /// under one header per model.+ #[must_use]+ pub fn is_informative(families: &[ModelFamily]) -> bool {+ families.iter().any(|family| family.models.len() > 1)+ }+}++/// See [`CursorModel::family`].+fn model_family(display_name: &str) -> String {+ let tokens: Vec<&str> = display_name+ .split_whitespace()+ .flat_map(split_hyphenated_version)+ .collect();+ let family: Vec<&str> = tokens+ .iter()+ .take_while(|token| !is_version_token(token))+ .copied()+ .collect();+ if family.is_empty() || family.len() == tokens.len() {+ display_name.trim().to_owned()+ } else {+ family.join(" ")+ }+}++/// `GPT-5.6` is a name and a version joined by a hyphen; split it so the+/// version can be recognised. `gpt-oss` and the like stay whole.+fn split_hyphenated_version(token: &str) -> Vec<&str> {+ match token.split_once('-') {+ Some((head, tail))+ if !head.is_empty() && tail.chars().next().is_some_and(|c| c.is_ascii_digit()) =>+ {+ vec![head, tail]+ }+ _ => vec![token],+ }+}++/// A version-looking token: alphanumerics and dots, with a digit as the first+/// or second character. `4.6`, `5`, `K3`, `o3`, `4o`, `R1` — but not `GPT`,+/// `Sol`, `Fast` or `Mini`.+fn is_version_token(token: &str) -> bool {+ let mut chars = token.chars();+ let starts_with_version = match (chars.next(), chars.next()) {+ (Some(first), _) if first.is_ascii_digit() => true,+ (Some(first), Some(second)) => first.is_ascii_alphabetic() && second.is_ascii_digit(),+ _ => false,+ };+ starts_with_version && token.chars().all(|c| c.is_ascii_alphanumeric() || c == '.')+}++/// A family name as a stable id: lowercase, runs of non-alphanumerics as one+/// hyphen, no leading or trailing hyphen.+fn family_id(name: &str) -> String {+ let mut id = String::with_capacity(name.len());+ for c in name.chars() {+ if c.is_ascii_alphanumeric() {+ id.push(c.to_ascii_lowercase());+ } else if !id.ends_with('-') {+ id.push('-');+ }+ }+ id.trim_matches('-').to_owned()}/// One accepted id+params combination for a model.diff --git a/crates/cursor_cloud_agents/src/domain/model/test.rs b/crates/cursor_cloud_agents/src/domain/model/test.rsindex 33836e2578..3bdbd04d7f 100644--- a/crates/cursor_cloud_agents/src/domain/model/test.rs+++ b/crates/cursor_cloud_agents/src/domain/model/test.rs@@ -22,6 +22,103 @@ fn non_https_remotes_are_rejected_not_guessed() {assert_eq!(RepoUrl::parse(""), None);}+fn model(id: &str, display_name: &str) -> CursorModel {+ CursorModel {+ id: id.to_owned(),+ display_name: display_name.to_owned(),+ variants: Vec::new(),+ }+}++#[test]+fn families_are_the_words_before_the_version() {+ for (display_name, family) in [+ ("Claude Opus 4.8", "Claude Opus"),+ ("Claude Opus 5", "Claude Opus"),+ ("Claude Sonnet 4.5", "Claude Sonnet"),+ ("Cursor Grok 4.6 High Fast", "Cursor Grok"),+ ("GPT-5.6 Sol", "GPT"),+ ("GPT-5 Mini", "GPT"),+ ("Gemini 3.8 Flash", "Gemini"),+ ("Kimi K3", "Kimi"),+ ("GLM 5.2", "GLM"),+ ("Composer 2.5", "Composer"),+ ("DeepSeek R1", "DeepSeek"),+ ] {+ assert_eq!(+ model("m", display_name).family(),+ family,+ "{display_name:?} should be in {family:?}"+ );+ }+}++#[test]+fn names_without_a_leading_family_stay_whole() {+ for display_name in ["Auto", "o3 Pro", "4o Mini", "gpt-oss", " Auto "] {+ assert_eq!(+ model("m", display_name).family(),+ display_name.trim(),+ "{display_name:?} has no family to strip"+ );+ }+}++#[test]+fn grouping_keeps_listing_order_within_and_across_families() {+ let models = vec![+ model("default", "Auto"),+ model("opus-5", "Claude Opus 5"),+ model("gpt-5.6", "GPT-5.6 Sol"),+ model("opus-4.8", "Claude Opus 4.8"),+ model("gpt-5-mini", "GPT-5 Mini"),+ ];++ let families = ModelFamily::group(&models);++ let summary: Vec<(&str, &str, Vec<&str>)> = families+ .iter()+ .map(|family| {+ (+ family.id.as_str(),+ family.name.as_str(),+ family+ .models+ .iter()+ .map(|model| model.id.as_str())+ .collect(),+ )+ })+ .collect();+ assert_eq!(+ summary,+ vec![+ ("auto", "Auto", vec!["default"]),+ ("claude-opus", "Claude Opus", vec!["opus-5", "opus-4.8"]),+ ("gpt", "GPT", vec!["gpt-5.6", "gpt-5-mini"]),+ ]+ );+ assert!(ModelFamily::is_informative(&families));+}++#[test]+fn a_listing_of_singletons_is_not_worth_grouping() {+ let families = ModelFamily::group(&[+ model("composer-2.5", "Composer 2.5"),+ model("gpt-5.5", "GPT-5.5"),+ ]);++ assert_eq!(families.len(), 2);+ assert!(!ModelFamily::is_informative(&families));+}++#[test]+fn family_ids_are_url_safe() {+ assert_eq!(family_id("Claude Opus"), "claude-opus");+ assert_eq!(family_id("GPT"), "gpt");+ assert_eq!(family_id(" Odd / Name! "), "odd-name");+}+#[test]fn run_statuses_round_trip_unknown_values() {let known: RunStatus = serde_json::from_str("\"FINISHED\"").expect("known status");diff --git a/crates/cursor_cloud_agents/src/inbound/acp.rs b/crates/cursor_cloud_agents/src/inbound/acp.rsindex e06bc72505..bc180711e7 100644--- a/crates/cursor_cloud_agents/src/inbound/acp.rs+++ b/crates/cursor_cloud_agents/src/inbound/acp.rs@@ -28,7 +28,7 @@#[cfg(test)]mod test;-use crate::domain::model::{McpHeader, McpServer, McpTransport};+use crate::domain::model::{McpHeader, McpServer, McpTransport, ModelFamily};use crate::domain::ports::{CursorAgents, RepoResolver, RunStream, SessionNotifier};use crate::domain::service::CursorSessionService;use agent_client_protocol::schema::ProtocolVersion;@@ -37,10 +37,11 @@ use agent_client_protocol::schema::v1::{CloseSessionRequest, CloseSessionResponse, ContentBlock, Error as AcpError, HttpHeader,Implementation, InitializeRequest, InitializeResponse, LoadSessionRequest, LoadSessionResponse,McpCapabilities, McpServer as AcpMcpServer, NewSessionRequest, NewSessionResponse,- PromptCapabilities, PromptRequest, PromptResponse, SessionConfigId, SessionConfigKind,- SessionConfigOption, SessionConfigSelect, SessionConfigSelectOption,- SessionConfigSelectOptions, SessionConfigValueId, SessionId, SessionNotification,- SessionUpdate, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse,+ PromptCapabilities, PromptRequest, PromptResponse, SessionConfigGroupId, SessionConfigId,+ SessionConfigKind, SessionConfigOption, SessionConfigSelect, SessionConfigSelectGroup,+ SessionConfigSelectOption, SessionConfigSelectOptions, SessionConfigValueId, SessionId,+ SessionNotification, SessionUpdate, SetSessionConfigOptionRequest,+ SetSessionConfigOptionResponse,};use agent_client_protocol::{Agent, ByteStreams, Client, ConnectTo, ConnectionTo, on_receive_notification,@@ -453,6 +454,13 @@ where/// variant parameters (`effort`, `reasoning`, `fast`) is a separate control and/// a separate change.///+/// The entries go out grouped by family ([`ModelFamily`]) — ACP's select+/// options may be headed groups — so a client can show `Claude Opus` once with+/// its versions under it rather than forty rows sorted by nothing. The family+/// is inferred from the display name, because Cursor's listing carries nothing+/// else to group on. A listing where no family has two members goes out flat:+/// a header per single model is noise, not structure.+////// A failure to reach `GET /v1/models` costs the picker, not the session: the/// options come back empty and the client simply has nothing to offer, which is/// the state it was in before any of this existed.@@ -501,21 +509,35 @@ wherelet Some(current) = current else {return Vec::new();};- let options: Vec<SessionConfigSelectOption> = models- .iter()- .map(|model| {- SessionConfigSelectOption::new(- SessionConfigValueId::new(model.id.clone()),- model.display_name.clone(),- )- })- .collect();+ let select_option = |model: &crate::domain::model::CursorModel| {+ SessionConfigSelectOption::new(+ SessionConfigValueId::new(model.id.clone()),+ model.display_name.clone(),+ )+ };+ let families = ModelFamily::group(&models);+ let options = if ModelFamily::is_informative(&families) {+ SessionConfigSelectOptions::Grouped(+ families+ .iter()+ .map(|family| {+ SessionConfigSelectGroup::new(+ SessionConfigGroupId::new(family.id.clone()),+ family.name.clone(),+ family.models.iter().map(select_option).collect(),+ )+ })+ .collect(),+ )+ } else {+ SessionConfigSelectOptions::Ungrouped(models.iter().map(select_option).collect())+ };vec![SessionConfigOption::new(SessionConfigId::new(MODEL_CONFIG_ID),"Model",SessionConfigKind::Select(SessionConfigSelect::new(SessionConfigValueId::new(current),- SessionConfigSelectOptions::Ungrouped(options),+ options,)),)]}diff --git a/crates/cursor_cloud_agents/src/inbound/acp/test.rs b/crates/cursor_cloud_agents/src/inbound/acp/test.rsindex f8923342ce..8b302f7ddc 100644--- a/crates/cursor_cloud_agents/src/inbound/acp/test.rs+++ b/crates/cursor_cloud_agents/src/inbound/acp/test.rs@@ -732,6 +732,70 @@ async fn session_new_advertises_the_models_as_a_config_option() {assert_eq!(values, vec!["composer-2.5", "gpt-5.5"]);}+/// With two models of one family in the listing, the select goes out as ACP+/// groups headed by family — `Claude Opus` once, its versions under it — in+/// listing order, and the flat fixture above stays flat: singletons gain+/// nothing from a header each.+#[tokio::test]+async fn a_listing_with_families_is_advertised_as_headed_groups() {+ let cursor = FakeCursor::new();+ let mut models = offered_models();+ models.extend([+ CursorModel {+ id: "claude-opus-5".to_owned(),+ display_name: "Claude Opus 5".to_owned(),+ variants: Vec::new(),+ },+ CursorModel {+ id: "claude-opus-4.8".to_owned(),+ display_name: "Claude Opus 4.8".to_owned(),+ variants: Vec::new(),+ },+ ]);+ cursor.script_models(models);+ let (_service, mut client) =+ serve_over_channel_with_default_model(cursor, Some("claude-opus-5"), |_| {});++ let response = client+ .call(+ 1,+ "session/new",+ serde_json::json!({"cwd": "/workspace", "mcpServers": []}),+ )+ .await;+ let option = &expect_result(&response)["configOptions"][0];+ assert_eq!(option["currentValue"], "claude-opus-5");+ let groups: Vec<(&str, &str, Vec<&str>)> = option["options"]+ .as_array()+ .expect("grouped options")+ .iter()+ .map(|group| {+ (+ group["group"].as_str().expect("a group id"),+ group["name"].as_str().expect("a group name"),+ group["options"]+ .as_array()+ .expect("a group's options")+ .iter()+ .map(|entry| entry["value"].as_str().expect("a value id"))+ .collect(),+ )+ })+ .collect();+ assert_eq!(+ groups,+ vec![+ ("composer", "Composer", vec!["composer-2.5"]),+ ("gpt", "GPT", vec!["gpt-5.5"]),+ (+ "claude-opus",+ "Claude Opus",+ vec!["claude-opus-5", "claude-opus-4.8"]+ ),+ ]+ );+}+/// Setting the model mid-session is accepted and reflected back, and the next/// run carries it — the point being that Cursor honours `model` on a follow-up/// run, so a change does not have to wait for a new agent.diff --git a/packages/sdk/generated/auth/types.gen.ts b/packages/sdk/generated/auth/types.gen.tsindex 0467e2d34d..a1f8cd4f17 100644--- a/packages/sdk/generated/auth/types.gen.ts+++ b/packages/sdk/generated/auth/types.gen.ts@@ -137,15 +137,21 @@ export type CursorApiKeyStatus = {/*** One model the settings dropdown can offer.*- * Just id and name: the dropdown lists models, not the hundreds of parameter- * variants each carries. The chosen id's parameters are resolved to Cursor's- * default variant at session start.+ * Id, name and family: the dropdown lists models, not the hundreds of+ * parameter variants each carries. The chosen id's parameters are resolved to+ * Cursor's default variant at session start. The family is the same heading+ * the Cursor ACP agent groups its session model select under, so the settings+ * picker and the in-session picker read the same way.*/export type CursorModelOption = {/*** The human-readable name, e.g. `Cursor Grok 4.6`.*/displayName: string;+ /**+ * The family heading to list this model under, e.g. `Cursor Grok`.+ */+ group: string;/*** The id to store and send, e.g. `grok-4.6`.*/diff --git a/packages/sdk/specs/auth.json b/packages/sdk/specs/auth.jsonindex af9f0f2ec1..20a615dc5d 100644--- a/packages/sdk/specs/auth.json+++ b/packages/sdk/specs/auth.json@@ -3938,13 +3938,17 @@},"CursorModelOption": {"type": "object",- "description": "One model the settings dropdown can offer.\n\nJust id and name: the dropdown lists models, not the hundreds of parameter\nvariants each carries. The chosen id's parameters are resolved to Cursor's\ndefault variant at session start.",- "required": ["id", "displayName"],+ "description": "One model the settings dropdown can offer.\n\nId, name and family: the dropdown lists models, not the hundreds of\nparameter variants each carries. The chosen id's parameters are resolved to\nCursor's default variant at session start. The family is the same heading\nthe Cursor ACP agent groups its session model select under, so the settings\npicker and the in-session picker read the same way.",+ "required": ["id", "displayName", "group"],"properties": {"displayName": {"type": "string","description": "The human-readable name, e.g. `Cursor Grok 4.6`."},+ "group": {+ "type": "string",+ "description": "The family heading to list this model under, e.g. `Cursor Grok`."+ },"id": {"type": "string","description": "The id to store and send, e.g. `grok-4.6`."diff --git a/services/authentication_service/src/api/cursor_api_key/list_cursor_models.rs b/services/authentication_service/src/api/cursor_api_key/list_cursor_models.rsindex dbe3e136c6..6da25be812 100644--- a/services/authentication_service/src/api/cursor_api_key/list_cursor_models.rs+++ b/services/authentication_service/src/api/cursor_api_key/list_cursor_models.rs@@ -9,9 +9,11 @@ use crate::api::context::{ApiContext, AuthorizationService};/// One model the settings dropdown can offer.///-/// Just id and name: the dropdown lists models, not the hundreds of parameter-/// variants each carries. The chosen id's parameters are resolved to Cursor's-/// default variant at session start.+/// Id, name and family: the dropdown lists models, not the hundreds of+/// parameter variants each carries. The chosen id's parameters are resolved to+/// Cursor's default variant at session start. The family is the same heading+/// the Cursor ACP agent groups its session model select under, so the settings+/// picker and the in-session picker read the same way.#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]#[serde(rename_all = "camelCase")]pub struct CursorModelOption {@@ -19,6 +21,8 @@ pub struct CursorModelOption {pub id: String,/// The human-readable name, e.g. `Cursor Grok 4.6`.pub display_name: String,+ /// The family heading to list this model under, e.g. `Cursor Grok`.+ pub group: String,}/// The models this account may choose from.@@ -96,6 +100,7 @@ pub async fn handler(models: models.into_iter().map(|model| CursorModelOption {+ group: model.family(),id: model.id,display_name: model.display_name,})