Skip to content

The agent that grows with you

feat(desktop): shift-click a model to pin it to the top of the picker

Brooklyn Nicholson641af6dfc521
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
index 8ba373c141e..71c2f5f2278 100644
--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
@@ -26,10 +26,11 @@ import {
setModelVisibilityOpen,
setVisibleModels
} from '@/store/model-visibility'
+import { $pinnedModels, pinnedModelKey, togglePinnedModel } from '@/store/pinned-models'
import { $defaultReasoningEffort } from '@/store/session'
import type { LocalRuntimeJob } from '@/types/hermes'
-import { ModelCatalogMenu, type ModelMenuController } from './model-catalog-menu'
+import { ModelCatalogMenu, ModelMenuCloseContext, type ModelMenuController } from './model-catalog-menu'
// Radix calls these on open; jsdom doesn't implement them.
beforeAll(() => {
@@ -39,6 +40,7 @@ beforeAll(() => {
})
const getGlobalModelOptions = vi.fn()
+const closeMenu = vi.fn()
vi.mock('@/hermes', () => ({
getGlobalModelOptions: (...args: unknown[]) => getGlobalModelOptions(...args),
@@ -62,7 +64,9 @@ vi.mock('@/hermes', () => ({
beforeEach((): void => {
queryClient.clear()
queryClient.setDefaultOptions({ queries: { ...queryClient.getDefaultOptions().queries, retry: false } })
+ window.localStorage.clear()
$visibleModels.set(null)
+ $pinnedModels.set([])
queryClient.setQueryData(localModelsKey(localModelsOwner(), 'jobs'), [])
// These suites exercise the local-models rows, which ship behind --local.
$localModelsEnabled.set(true)
@@ -162,11 +166,13 @@ function renderMenu(current: Partial<ModelMenuController['current']> = {}) {
render(
<QueryClientProvider client={client}>
- <DropdownMenu open>
- <DropdownMenuContent>
- <ModelCatalogMenu controller={controller} />
- </DropdownMenuContent>
- </DropdownMenu>
+ <ModelMenuCloseContext.Provider value={closeMenu}>
+ <DropdownMenu open>
+ <DropdownMenuContent>
+ <ModelCatalogMenu controller={controller} />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ModelMenuCloseContext.Provider>
</QueryClientProvider>
)
@@ -214,6 +220,104 @@ describe('the catalog owns model curation', () => {
})
})
+// Pinning is a promise about the LIST: "keep this one where I can always
+// reach it". That promise is what decides where a pinned row paints — its own
+// section at the top, and nowhere twice.
+describe('the catalog owns pinned models', () => {
+ it('lifts a pinned model into the Pinned section above the provider groups', async () => {
+ togglePinnedModel('google', 'gemini-2.5-flash')
+
+ renderMenu()
+
+ const rows = (await screen.findAllByText(/Gemini 2\.5/i)).map(node => node.closest('[role="menuitem"]')!)
+
+ // Its own section heading paints above the provider groups…
+ expect(screen.getByText('Pinned')).toBeTruthy()
+
+ // …and the row's DOM order reflects it: the section label comes before
+ // the provider group heading (the LAST 'Google' text — the pinned row's
+ // provider chip paints one first).
+ const pinnedLabel = screen.getByText('Pinned')
+ const googleTexts = screen.getAllByText('Google')
+ const googleHeading = googleTexts[googleTexts.length - 1]
+
+ expect(pinnedLabel.compareDocumentPosition(googleHeading) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
+
+ // The provider chip names the row's provider, so two labs sharing a model
+ // id stay apart in the mixed section.
+ expect(rows.some(row => row.textContent?.includes('Google'))).toBe(true)
+ })
+
+ it('does not also list a pinned model under its provider', async () => {
+ togglePinnedModel('google', 'gemini-2.5-flash')
+
+ renderMenu()
+
+ await screen.findByText('Pinned')
+
+ // Listed once, under Pinned — not also down in Google's group.
+ expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1)
+ })
+
+ it('keeps a pin whose provider is not connected without painting an empty section', async () => {
+ $pinnedModels.set([pinnedModelKey('anthropic', 'claude-sonnet-4.6')])
+
+ renderMenu()
+
+ await screen.findByText(/Gemini 3\.1 Pro/i)
+ expect(screen.queryByText('Pinned')).toBeNull()
+ })
+
+ // Curation and pinning are different questions: "which models do I usually
+ // want listed" vs "which one do I want first". A pin wins.
+ it('shows a pinned model the Edit Models shortlist hides', async () => {
+ setVisibleModels(new Set([modelVisibilityKey('google', 'gemini-3.1-pro')]))
+ togglePinnedModel('google', 'gemini-2.5-flash')
+
+ renderMenu()
+
+ await screen.findByText('Pinned')
+ expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1)
+ })
+
+ it('folds the section away while searching and lists the match in its provider place', async () => {
+ togglePinnedModel('google', 'gemini-2.5-flash')
+
+ renderMenu()
+ await screen.findByText('Pinned')
+
+ fireEvent.change(screen.getByRole('textbox', { name: 'Search models' }), { target: { value: 'gemini-2.5' } })
+
+ // A query means "show me every match": the section folds and the match
+ // paints in its provider's place. Still exactly once.
+ await vi.waitFor(() => {
+ expect(screen.queryByText('Pinned')).toBeNull()
+ })
+
+ expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1)
+ })
+
+ // The same gesture as a sidebar chat: shift-click pins, and the menu stays
+ // put so a second shift-click (now on the row in the Pinned section) undoes
+ // it. Neither click is a pick.
+ it('shift-click toggles the pin without selecting the model or closing the menu', async () => {
+ const select = renderMenu()
+ const row = (await screen.findByText('Gemini 2.5')).closest('[role="menuitem"]')!
+
+ fireEvent.click(row, { shiftKey: true })
+
+ expect($pinnedModels.get()).toEqual([pinnedModelKey('google', 'gemini-2.5-flash')])
+ await screen.findByText('Pinned')
+
+ fireEvent.click(screen.getByText('Gemini 2.5').closest('[role="menuitem"]')!, { shiftKey: true })
+
+ expect($pinnedModels.get()).toEqual([])
+ await vi.waitFor(() => expect(screen.queryByText('Pinned')).toBeNull())
+ expect(select).not.toHaveBeenCalled()
+ expect(closeMenu).not.toHaveBeenCalled()
+ })
+})
+
describe('in-flight local downloads', () => {
const DOWNLOAD_JOB: LocalRuntimeJob = {
job_id: 'dl1',
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsx
index ceb4dbc2798..c8d9ff1d12c 100644
--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx
+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx
@@ -31,6 +31,7 @@ import { HighlightMatches } from '@/components/ui/highlight-matches'
import { Skeleton } from '@/components/ui/skeleton'
import type { HermesGateway } from '@/hermes'
import { useI18n } from '@/i18n'
+import { triggerHaptic } from '@/lib/haptics'
import { isSubmitEnter } from '@/lib/ime'
import { catalogProviderMatches, modelOptionsQueryKey, requestModelOptions } from '@/lib/model-options'
import { displayModelName, modelDisplayParts } from '@/lib/model-status-label'
@@ -57,6 +58,7 @@ import {
seedKnownModels,
setModelVisibilityOpen
} from '@/store/model-visibility'
+import { $pinnedModels, pinnedModelKey, togglePinnedModel } from '@/store/pinned-models'
import { $collapsedProviders, toggleCollapsedProvider } from '@/store/provider-collapse'
import { $defaultReasoningEffort } from '@/store/session'
import type { LocalModelLoadProgress, LocalRuntimeJob } from '@/types/hermes'
@@ -215,8 +217,11 @@ export function ModelCatalogMenu({
// catalog must show the same shortlist. A per-caller opt-in is how the board
// and the composer would end up disagreeing about what "my models" means.
const visibleModels = useStore($visibleModels)
- const showPricing = useStore($showModelPricing)
const customModels = useStore($customModels)
+ // Pinned models, same reasoning as the shortlist above: one global
+ // preference owned by the catalog, so the composer pill, session tiles and
+ // the kanban override all show the same Pinned section.
+ const pinnedKeys = useStore($pinnedModels)
const modelOptions = useQuery({
queryKey: modelOptionsQueryKey(profile, sessionId, ownerConnectionId),
@@ -324,9 +329,29 @@ export function ModelCatalogMenu({
[visibleModels, pickerProviders]
)
+ // Pinned models paint their own section ABOVE the provider groups — the
+ // whole point of pinning one. Resolved against the catalog we actually
+ // fetched, so a pin whose provider is not connected (or whose model the lab
+ // retired) has no row to show; it is KEPT, not dropped, for when it returns.
+ // Pins ignore the Edit Models shortlist on purpose: pinning IS an explicit
+ // "always show me this one". A search turns the section off — a query means
+ // "show me every match", and those are listed in their provider's place.
+ const pinnedRows = useMemo(
+ () => (q ? [] : resolvePinnedRows(pickerProviders, pinnedKeys)),
+ [pickerProviders, pinnedKeys, q]
+ )
+
+ // The same rows are dropped from the provider groups, so no model is ever
+ // listed twice in one open menu.
+ const pinnedRowKeys = useMemo(
+ () => new Set(pinnedRows.map(({ family, provider }) => pinnedModelKey(provider.slug, family.id))),
+ [pinnedRows]
+ )
+
const groups = useMemo(
- () => groupModels(pickerProviders, search, { model: current.model, provider: current.provider }, shownKeys),
- [pickerProviders, search, current.model, current.provider, shownKeys]
+ () =>
+ groupModels(pickerProviders, search, { model: current.model, provider: current.provider }, shownKeys, pinnedRowKeys),
+ [pickerProviders, search, current.model, current.provider, shownKeys, pinnedRowKeys]
)
// Presets are searchable rows like everything else — an unfiltered preset
@@ -341,7 +366,9 @@ export function ModelCatalogMenu({
// The scrolling catalog list only mounts when it has rows; otherwise a
// section below it (MoA, custom slug) would sit under two separators.
- const hasList = !hideCatalog && (groups.length > 0 || shownDownloads.length > 0)
+ // Pins count: a catalog whose every curated family is pinned has
+ // groups but no group rows, and the section must still paint.
+ const hasList = !hideCatalog && (groups.length > 0 || shownDownloads.length > 0 || pinnedRows.length > 0)
// A typed id no provider lists is still a model to the backend. Offer it as
// a row per configured provider (the current one first) so a slug the
@@ -408,8 +435,8 @@ export function ModelCatalogMenu({
}
// ── Keyboard selection (cmdk semantics on a Radix menu) ───────────────────
- // One flat list mirroring EXACTLY what's rendered (collapse, filter, presets),
- // so the selection can never sit on a hidden row.
+ // One flat list mirroring EXACTLY what's rendered (Pinned section,
+ // collapse, filter, presets), so the selection can never sit on a hidden row.
type KbRow =
| { key: string; kind: 'custom'; provider: ModelOptionProvider; slug: string }
| { family: ModelFamily; key: string; kind: 'family'; provider: ModelOptionProvider }
@@ -417,6 +444,14 @@ export function ModelCatalogMenu({
const kbRows = useMemo<KbRow[]>(
() => [
+ ...pinnedRows.map(
+ ({ family, provider }): KbRow => ({
+ family,
+ key: `${provider.slug}:${family.id}`,
+ kind: 'family',
+ provider
+ })
+ ),
...groups.flatMap(group =>
collapsedProviders.includes(group.provider.slug) && !search
? []
@@ -437,7 +472,7 @@ export function ModelCatalogMenu({
}))
: [])
],
- [groups, collapsedProviders, search, shownMoaPresets, customSlug, customProviders]
+ [pinnedRows, groups, collapsedProviders, search, shownMoaPresets, customSlug, customProviders]
)
const [kbOverride, setKbOverride] = useState<null | number>(null)
@@ -641,12 +676,37 @@ export function ModelCatalogMenu({
<DropdownMenuItem className={dropdownMenuRow} disabled>
{error}
</DropdownMenuItem>
- ) : groups.length === 0 && moaPresets.length === 0 && shownDownloads.length === 0 && !customSlug ? (
+ ) : groups.length === 0 && pinnedRows.length === 0 && moaPresets.length === 0 && shownDownloads.length === 0 && !customSlug ? (
<DropdownMenuItem className={dropdownMenuRow} disabled>
{copy.noModels}
</DropdownMenuItem>
) : hasList ? (
<div className="max-h-[max(150px,30dvh)] overflow-y-auto py-0.5" ref={listRef}>
+ {/* Pinned models first — the shortcut the pin exists for. The
+ section paints nothing while searching, where every match is
+ listed in its provider's place instead. */}
+ {pinnedRows.length > 0 ? (
+ <DropdownMenuGroup className="py-0.5">
+ <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.pinned}</DropdownMenuLabel>
+ {pinnedRows.map(({ family, provider }) => (
+ <ModelFamilyRow
+ controller={controller}
+ current={current}
+ defaultEffort={defaultEffort}
+ family={family}
+ kbProps={kbRowProps(`${provider.slug}:${family.id}`)}
+ key={`${provider.slug}:${family.id}`}
+ loadingModels={loadingModels}
+ onSelect={selectFamily}
+ onSubOpenChange={handleSubOpenChange}
+ pinnedKeys={pinnedKeys}
+ provider={provider}
+ search={search}
+ showProvider
+ />
+ ))}
+ </DropdownMenuGroup>
+ ) : null}
{groups.map(group => {
const slug = group.provider.slug
@@ -674,144 +734,22 @@ export function ModelCatalogMenu({
/>
</DropdownMenuItem>
{!collapsed &&
- group.families.map(family => {
- // The active id may be the base or its -fast sibling; either
- // way this one family row represents both.
- const activeId =
- catalogProviderMatches(group.provider, current.provider) &&
- (current.model === family.id || current.model === family.fastId)
- ? current.model
- : null
-
- const isCurrent = activeId !== null
- const { name, tag } = modelDisplayParts(family.id)
- const caps = group.provider.capabilities?.[family.id]
-
- // Live per-model $/Mtok pricing (Nous Portal and other
- // providers that ship it). A `-fast` sibling shares the
- // base id's price: the collapsed row fronts the base, so
- // fall back to it when only the fast variant is unpriced.
- const pricing =
- group.provider.pricing?.[family.id] ??
- (family.fastId ? group.provider.pricing?.[family.fastId] : undefined)
-
- // Managed local model loading into memory right now:
- // real load percent, keyed by exact model id (remote
- // providers never collide with GGUF stems).
- const loadProgress =
- loadingModels[family.id] ?? (family.fastId ? loadingModels[family.fastId] : undefined)
-
- // Effective settings for this row: the live choice when it's
- // the active model, otherwise its remembered preset. Row
- // label AND submenu read from these so they never disagree.
- const preset = controller.presetFor(group.provider.slug, family.id)
- const effEffort = isCurrent ? current.effort : (preset.effort ?? '')
- const effFast = isCurrent ? current.fast : (preset.fast ?? false)
-
- const fastControl: FastControl = resolveFastControl(
- activeId ?? family.id,
- group.provider.models ?? [],
- caps?.fast ?? false,
- effFast
- )
-
- // Row meta (variant tag, fast mode, reasoning effort) renders as
- // discrete badge chips BESIDE the name — not appended to it — so
- // "High" reads as the model's reasoning setting, never as part of a
- // differently-named model.
- const metaTags = [
- tag || null,
- fastControl.kind !== 'none' && fastControl.on ? copy.fast : null,
- (caps?.reasoning ?? true) && !(isCurrent && current.effortPending)
- ? reasoningEffortLabel(effEffort || defaultEffort, isCurrent ? current.effortWire : undefined)
- : null
- ].filter((chip): chip is string => Boolean(chip))
-
- // Clicking the row commits the model and closes; the edit
- // submenu (reasoning/fast) is reached by HOVER, so you can
- // tweak those without the click dismissing everything. The
- // trailing caret is what advertises that submenu — without
- // it the row's effort badge reads as a fixed model+effort
- // combo rather than an editable setting (#86966).
- const activate = () => {
- if (!isCurrent) {
- void selectFamily(family, group.provider)
- }
-
- closeMenu()
- }
-
- return (
- <DropdownMenuSub
- key={`${group.provider.slug}:${family.id}`}
- onOpenChange={open => handleSubOpenChange(open, `${group.provider.slug}:${family.id}`)}
- >
- <DropdownMenuSubTrigger
- onClick={activate}
- onKeyDown={event => {
- if (event.key === 'Enter' || event.key === ' ') {
- activate()
- }
- }}
- {...kbRowProps(`${group.provider.slug}:${family.id}`)}
- >
- <span className="flex min-w-0 flex-1 items-center gap-1.5">
- <span className="min-w-0 truncate">
- <HighlightMatches foldSeparators query={search} text={name} />
- </span>
- {metaTags.map(chip => (
- <Badge className="shrink-0 uppercase tracking-wide" key={chip} size="xs" variant="muted">
- {chip}
- </Badge>
- ))}
- </span>
- {loadProgress ? (
- <span
- className="ml-auto flex shrink-0 items-center gap-1.5"
- title={copyPicker.loadingIntoMemory}
- >
- <span className="h-1 w-14 overflow-hidden rounded-full bg-(--ui-bg-tertiary)">
- <span
- className="block h-full rounded-full bg-primary transition-[width] duration-500"
- style={{ width: `${Math.max(2, loadProgress.percent)}%` }}
- />
- </span>
- <span className="text-[0.62rem] tabular-nums text-(--ui-text-tertiary)">
- {loadProgress.percent}%
- </span>
- </span>
- ) : null}
- {showPricing && pricing ? <ModelPrice pricing={pricing} /> : null}
- {isCurrent ? (
- <Codicon
- className={cn('text-foreground', loadProgress ? 'ml-1' : 'ml-auto')}
- name="check"
- size="0.75rem"
- />
- ) : null}
- </DropdownMenuSubTrigger>
- <ModelEditSubmenu
- canDisableReasoning={caps?.can_disable_reasoning ?? undefined}
- defaultEffort={defaultEffort}
- effort={effEffort}
- effortWire={isCurrent ? current.effortWire : undefined}
- fastControl={fastControl}
- isActive={isCurrent}
- model={family.id}
- onSelectModel={nextModel => controller.select(nextModel, group.provider.slug)}
- onSetOptions={patch =>
- controller.setOptions(patch, {
- isActive: isCurrent,
- model: family.id,
- provider: group.provider.slug
- })
- }
- provider={group.provider.slug}
- reasoning={caps?.reasoning ?? true}
- />
- </DropdownMenuSub>
- )
- })}
+ group.families.map(family => (
+ <ModelFamilyRow
+ controller={controller}
+ current={current}
+ defaultEffort={defaultEffort}
+ family={family}
+ kbProps={kbRowProps(`${group.provider.slug}:${family.id}`)}
+ key={`${group.provider.slug}:${family.id}`}
+ loadingModels={loadingModels}
+ onSelect={selectFamily}
+ onSubOpenChange={handleSubOpenChange}
+ pinnedKeys={pinnedKeys}
+ provider={group.provider}
+ search={search}
+ />
+ ))}
{!collapsed &&
slug === LOCAL_PROVIDER_SLUG &&
shownDownloads.map(job => (
@@ -917,6 +855,219 @@ export function ModelCatalogMenu({
/** Re-exported so callers building a footer row match the catalog's rows. */
export { dropdownMenuRow }
+/** Row props the flat keyboard selection paints onto whichever trigger is
+ * active — shared by the Pinned section and the provider groups. */
+interface KbRowProps {
+ 'data-kb-active'?: string
+ className: string
+}
+
+/** One pinned model, resolved against the live catalog. */
+interface PinnedRow {
+ family: ModelFamily
+ provider: ModelOptionProvider
+}
+
+/** Resolve stored pins into paintable rows, in the order the user pinned
+ * them. A key with no family in THIS catalog yields no row — and is not
+ * dropped, so it comes back when its provider reconnects. */
+function resolvePinnedRows(providers: readonly ModelOptionProvider[], keys: readonly string[]): PinnedRow[] {
+ const byKey = new Map<string, PinnedRow>()
+
+ for (const provider of providers) {
+ for (const family of collapseModelFamilies(provider.models ?? [])) {
+ byKey.set(pinnedModelKey(provider.slug, family.id), { family, provider })
+ }
+ }
+
+ return keys.flatMap(key => {
+ const row = byKey.get(key)
+
+ return row ? [row] : []
+ })
+}
+
+interface ModelFamilyRowProps {
+ controller: ModelMenuController
+ current: ModelChoice
+ defaultEffort: string
+ family: ModelFamily
+ /** Keyboard/hover props built by the host, so the Pinned section and the
+ * provider groups share ONE flat selection order. */
+ kbProps: KbRowProps
+ loadingModels: Record<string, LocalModelLoadProgress>
+ /** Commit this family — what a click means belongs to the host that owns it. */
+ onSelect: (family: ModelFamily, provider: ModelOptionProvider) => Promise<boolean | void> | void
+ /** Keyboard-focus round trip for the sub this row opens (#86966). */
+ onSubOpenChange?: (open: boolean, key: string) => void
+ pinnedKeys: readonly string[]
+ provider: ModelOptionProvider
+ search: string
+ /** Name the provider on the row. On in the Pinned section, where rows
+ * from every provider sit together and two labs can share a model name. */
+ showProvider?: boolean
+}
+
+/** One model family row: the trigger that commits the model, plus the
+ * hover-revealed options submenu. Shared by the Pinned section and the
+ * provider groups, so the two can never paint a model differently. */
+function ModelFamilyRow({
+ controller,
+ current,
+ defaultEffort,
+ family,
+ kbProps,
+ loadingModels,
+ onSelect,
+ onSubOpenChange,
+ pinnedKeys,
+ provider,
+ search,
+ showProvider
+}: ModelFamilyRowProps): ReactElement {
+ const { t } = useI18n()
+ const copy = t.shell.modelMenu
+ const copyPicker = t.modelPicker
+ const closeMenu = useContext(ModelMenuCloseContext)
+ const showPricing = useStore($showModelPricing)
+
+ const rowKey = `${provider.slug}:${family.id}`
+
+ // The active id may be the base or its -fast sibling; either way this one
+ // family row represents both.
+ const activeId =
+ catalogProviderMatches(provider, current.provider) &&
+ (current.model === family.id || current.model === family.fastId)
+ ? current.model
+ : null
+
+ const isCurrent = activeId !== null
+ const { name, tag } = modelDisplayParts(family.id)
+ const caps = provider.capabilities?.[family.id]
+
+ // Live per-model $/Mtok pricing (Nous Portal and other providers that ship
+ // it). A `-fast` sibling shares the base id's price: the collapsed row
+ // fronts the base, so fall back to it when only the fast variant is unpriced.
+ const pricing = provider.pricing?.[family.id] ?? (family.fastId ? provider.pricing?.[family.fastId] : undefined)
+
+ // Managed local model loading into memory right now: real load percent,
+ // keyed by exact model id (remote providers never collide with GGUF stems).
+ const loadProgress = loadingModels[family.id] ?? (family.fastId ? loadingModels[family.fastId] : undefined)
+
+ // Effective settings for this row: the live choice when it's the active
+ // model, otherwise its remembered preset. Row label AND submenu read from
+ // these so they never disagree.
+ const preset = controller.presetFor(provider.slug, family.id)
+ const effEffort = isCurrent ? current.effort : (preset.effort ?? '')
+ const effFast = isCurrent ? current.fast : (preset.fast ?? false)
+
+ const fastControl: FastControl = resolveFastControl(
+ activeId ?? family.id,
+ provider.models ?? [],
+ caps?.fast ?? false,
+ effFast
+ )
+
+ // Row meta (provider, variant tag, fast mode, reasoning effort) renders as
+ // discrete badge chips BESIDE the name — not appended to it — so "High"
+ // reads as the model's reasoning setting, never as part of a differently-
+ // named model. The provider chip only paints in the Pinned section,
+ // where rows from every provider sit together.
+ const metaTags = [
+ showProvider ? provider.name : null,
+ tag || null,
+ fastControl.kind !== 'none' && fastControl.on ? copy.fast : null,
+ (caps?.reasoning ?? true) && !(isCurrent && current.effortPending)
+ ? reasoningEffortLabel(effEffort || defaultEffort, isCurrent ? current.effortWire : undefined)
+ : null
+ ].filter((chip): chip is string => Boolean(chip))
+
+ // Clicking the row commits the model and closes; the edit submenu
+ // (reasoning/fast/pin) is reached by HOVER, so you can tweak those without
+ // the click dismissing everything. The trailing caret is what advertises
+ // that submenu — without it the row's effort badge reads as a fixed
+ // model+effort combo rather than an editable setting (#86966).
+ const activate = () => {
+ if (!isCurrent) {
+ void onSelect(family, provider)
+ }
+
+ closeMenu()
+ }
+
+ const togglePin = () => togglePinnedModel(provider.slug, family.id)
+
+ return (
+ <DropdownMenuSub onOpenChange={open => onSubOpenChange?.(open, rowKey)}>
+ <DropdownMenuSubTrigger
+ onClick={event => {
+ // Shift-click pins, the same gesture as a chat row in the sidebar.
+ // Nothing is picked and the menu stays open, so a second shift-click
+ // (on the row, now in the Pinned section) undoes it.
+ if (event.shiftKey) {
+ event.preventDefault()
+ triggerHaptic('selection')
+ togglePin()
+
+ return
+ }
+
+ activate()
+ }}
+ onKeyDown={event => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ activate()
+ }
+ }}
+ {...kbProps}
+ >
+ <span className="flex min-w-0 flex-1 items-center gap-1.5">
+ <span className="min-w-0 truncate">
+ <HighlightMatches foldSeparators query={search} text={name} />
+ </span>
+ {metaTags.map(chip => (
+ <Badge className="shrink-0 uppercase tracking-wide" key={chip} size="xs" variant="muted">
+ {chip}
+ </Badge>
+ ))}
+ </span>
+ {loadProgress ? (
+ <span className="ml-auto flex shrink-0 items-center gap-1.5" title={copyPicker.loadingIntoMemory}>
+ <span className="h-1 w-14 overflow-hidden rounded-full bg-(--ui-bg-tertiary)">
+ <span
+ className="block h-full rounded-full bg-primary transition-[width] duration-500"
+ style={{ width: `${Math.max(2, loadProgress.percent)}%` }}
+ />
+ </span>
+ <span className="text-[0.62rem] tabular-nums text-(--ui-text-tertiary)">{loadProgress.percent}%</span>
+ </span>
+ ) : null}
+ {showPricing && pricing ? <ModelPrice pricing={pricing} /> : null}
+ {isCurrent ? (
+ <Codicon className={cn('text-foreground', loadProgress ? 'ml-1' : 'ml-auto')} name="check" size="0.75rem" />
+ ) : null}
+ </DropdownMenuSubTrigger>
+ <ModelEditSubmenu
+ canDisableReasoning={caps?.can_disable_reasoning ?? undefined}
+ defaultEffort={defaultEffort}
+ effort={effEffort}
+ effortWire={isCurrent ? current.effortWire : undefined}
+ fastControl={fastControl}
+ isActive={isCurrent}
+ isPinned={pinnedKeys.includes(pinnedModelKey(provider.slug, family.id))}
+ model={family.id}
+ onSelectModel={nextModel => controller.select(nextModel, provider.slug)}
+ onSetOptions={patch =>
+ controller.setOptions(patch, { isActive: isCurrent, model: family.id, provider: provider.slug })
+ }
+ onTogglePin={togglePin}
+ provider={provider.slug}
+ reasoning={caps?.reasoning ?? true}
+ />
+ </DropdownMenuSub>
+ )
+}
+
/** True when the text cursor sits at the very end with nothing selected — the
* only state where ArrowRight is free for the menu to claim. */
function caretAtEnd(input: HTMLInputElement): boolean {
@@ -1004,7 +1155,8 @@ function groupModels(
providers: readonly ModelOptionProvider[],
search: string,
current: { model: string; provider: string },
- visible: Set<string> | null
+ visible: Set<string> | null,
+ pinned: ReadonlySet<string>
): ProviderGroup[] {
const q = normalize(search)
const groups: ProviderGroup[] = []
@@ -1044,7 +1196,20 @@ function groupModels(
? allFamilies.find(family => family.id === current.model || family.fastId === current.model)?.id
: undefined
- const families = allFamilies.filter(family => shown.has(family.id) || family.id === activeId)
+ // Pinned families already paint in the Pinned section, so drop them
+ // here: an open menu never lists the same model twice. Only while not
+ // searching — a query lists every match in its provider's place.
+ const pinnedHere = q
+ ? null
+ : new Set(
+ allFamilies
+ .filter(family => pinned.has(pinnedModelKey(provider.slug, family.id)))
+ .map(family => family.id)
+ )
+
+ const families = allFamilies.filter(
+ family => (shown.has(family.id) || family.id === activeId) && !pinnedHere?.has(family.id)
+ )
if (families.length > 0) {
groups.push({ families, provider })
diff --git a/apps/desktop/src/app/shell/model-edit-submenu.test.tsx b/apps/desktop/src/app/shell/model-edit-submenu.test.tsx
index 3685f8e44aa..6231acf1112 100644
--- a/apps/desktop/src/app/shell/model-edit-submenu.test.tsx
+++ b/apps/desktop/src/app/shell/model-edit-submenu.test.tsx
@@ -28,8 +28,10 @@ function renderSubmenu(opts: {
effort?: string
fastControl: FastControl
isActive?: boolean
+ isPinned?: boolean
onSelectModel?: (model: string) => void
onSetOptions: (patch: { effort?: string; fast?: boolean }) => void
+ onTogglePin?: () => void
reasoning: boolean
}) {
return render(
@@ -42,9 +44,11 @@ function renderSubmenu(opts: {
effort={opts.effort ?? 'medium'}
fastControl={opts.fastControl}
isActive={opts.isActive ?? true}
+ isPinned={opts.isPinned}
model="m1"
onSelectModel={opts.onSelectModel ?? vi.fn()}
onSetOptions={opts.onSetOptions}
+ onTogglePin={opts.onTogglePin}
provider="p1"
reasoning={opts.reasoning}
/>
@@ -129,3 +133,39 @@ describe('ModelEditSubmenu reports edits without performing them', () => {
expect(onSelectModel).toHaveBeenCalledWith('m1-fast')
})
})
+
+// Pinning is not a capability: lifting a model to the top of the picker has
+// nothing to do with what the model can be asked for, so the row reports it
+// even when the submenu has nothing else to offer.
+describe('ModelEditSubmenu reports pins without performing them', () => {
+ it('offers the pin even on a model with no reasoning or fast options', () => {
+ const onTogglePin = vi.fn()
+ renderSubmenu({ fastControl: { kind: 'none' }, onSetOptions: vi.fn(), onTogglePin, reasoning: false })
+
+ expect(screen.getByText('No options for this model')).toBeTruthy()
+
+ fireEvent.click(screen.getByText('Pin'))
+
+ expect(onTogglePin).toHaveBeenCalled()
+ })
+
+ it('names the pin action by state, so unpinning is never a blind click', () => {
+ renderSubmenu({
+ fastControl: { kind: 'none' },
+ isPinned: true,
+ onSetOptions: vi.fn(),
+ onTogglePin: vi.fn(),
+ reasoning: false
+ })
+
+ expect(screen.getByText('Unpin')).toBeTruthy()
+ expect(screen.queryByText('Pin')).toBeNull()
+ })
+
+ it('renders no pin row when the surface passes no toggle', () => {
+ renderSubmenu({ fastControl: { kind: 'none' }, onSetOptions: vi.fn(), reasoning: false })
+
+ expect(screen.queryByText('Pin')).toBeNull()
+ expect(screen.queryByText('Unpin')).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/app/shell/model-edit-submenu.tsx b/apps/desktop/src/app/shell/model-edit-submenu.tsx
index f7b38ced10b..b966aed4481 100644
--- a/apps/desktop/src/app/shell/model-edit-submenu.tsx
+++ b/apps/desktop/src/app/shell/model-edit-submenu.tsx
@@ -1,5 +1,6 @@
import { REASONING_EFFORTS } from '@hermes/shared'
+import { Codicon } from '@/components/ui/codicon'
import {
DropdownMenuItem,
DropdownMenuLabel,
@@ -8,6 +9,7 @@ import {
dropdownMenuRow,
dropdownMenuSectionLabel,
DropdownMenuSeparator,
+ DropdownMenuShortcut,
DropdownMenuSubContent
} from '@/components/ui/dropdown-menu'
import { Switch } from '@/components/ui/switch'
@@ -78,6 +80,9 @@ interface ModelEditSubmenuProps {
fastControl: FastControl
/** Whether this row's model is the active one. */
isActive: boolean
+ /** Whether this row's model is pinned (lifted to the top of the catalog).
+ * Only meaningful together with `onTogglePin`. */
+ isPinned?: boolean
/** This row's model id. */
model: string
/** Switch to a specific model id (used to swap base ⇄ -fast variant). */
@@ -87,6 +92,10 @@ interface ModelEditSubmenuProps {
* controller decides what an edit means. That's what lets the same submenu
* drive a live chat session and a detached per-task override. */
onSetOptions: (patch: { effort?: string; fast?: boolean }) => void
+ /** Pin or unpin this row's model — reported like any other edit, the
+ * catalog owns where a pin is kept. Absent on surfaces that have no
+ * catalog behind them (the composer's reasoning pill). */
+ onTogglePin?: () => void
/** This row's provider slug. */
provider: string
/** Whether this model supports reasoning effort. */
@@ -115,8 +124,10 @@ export function ModelOptionsContent({
effortWire,
fastControl,
isActive,
+ isPinned,
onSelectModel,
onSetOptions,
+ onTogglePin,
reasoning
}: ModelEditSubmenuProps) {
const { t } = useI18n()
@@ -149,44 +160,73 @@ export function ModelOptionsContent({
const hasFast = fastControl.kind !== 'none'
const fastOn = fastControl.kind === 'none' ? false : fastControl.on
- return !hasFast && !reasoning ? (
- <div className="px-2.5 py-3 text-xs text-(--ui-text-tertiary)">{copy.noOptions}</div>
- ) : (
+ return (
<>
- <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.options}</DropdownMenuLabel>
- {showThinkingToggle ? (
- <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>
- {copy.thinking}
- <Switch
- checked={thinkingOn}
- className="ml-auto"
- onCheckedChange={checked => onSetOptions({ effort: checked ? effortValue || defaultEffort : 'none' })}
- size="xs"
- />
- </DropdownMenuItem>
- ) : null}
- {hasFast ? (
- <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>
- {copy.fast}
- <Switch checked={fastOn} className="ml-auto" onCheckedChange={setFast} size="xs" />
- </DropdownMenuItem>
- ) : null}
- {reasoning ? (
+ {!hasFast && !reasoning ? (
+ <div className="px-2.5 py-3 text-xs text-(--ui-text-tertiary)">{copy.noOptions}</div>
+ ) : (
+ <>
+ <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.options}</DropdownMenuLabel>
+ {showThinkingToggle ? (
+ <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>
+ {copy.thinking}
+ <Switch
+ checked={thinkingOn}
+ className="ml-auto"
+ onCheckedChange={checked => onSetOptions({ effort: checked ? effortValue || defaultEffort : 'none' })}
+ size="xs"
+ />
+ </DropdownMenuItem>
+ ) : null}
+ {hasFast ? (
+ <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>
+ {copy.fast}
+ <Switch checked={fastOn} className="ml-auto" onCheckedChange={setFast} size="xs" />
+ </DropdownMenuItem>
+ ) : null}
+ {reasoning ? (
+ <>
+ <DropdownMenuSeparator className="mx-0" />
+ <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.effort}</DropdownMenuLabel>
+ <DropdownMenuRadioGroup onValueChange={value => onSetOptions({ effort: value })} value={effortValue}>
+ {REASONING_EFFORTS.map(value => (
+ <DropdownMenuRadioItem
+ className={dropdownMenuRow}
+ key={value}
+ onSelect={event => event.preventDefault()}
+ value={value}
+ >
+ {clamp?.effort === value ? `${copy[value]} (${copy.sendsOnRoute(copy[clamp.wire])})` : copy[value]}
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </>
+ ) : null}
+ </>
+ )}
+ {/* Pinning sits OUTSIDE the capability gates above: lifting a model to
+ the top of the picker has nothing to do with what it can be asked
+ for, so a model with no reasoning/fast options still offers it. Only
+ the catalog passes the callback; the reasoning pill has no list to
+ reorder. The trailing hint teaches the row's shift-click shortcut,
+ the same gesture that pins a chat in the sidebar. */}
+ {onTogglePin ? (
<>
<DropdownMenuSeparator className="mx-0" />
- <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.effort}</DropdownMenuLabel>
- <DropdownMenuRadioGroup onValueChange={value => onSetOptions({ effort: value })} value={effortValue}>
- {REASONING_EFFORTS.map(value => (
- <DropdownMenuRadioItem
- className={dropdownMenuRow}
- key={value}
- onSelect={event => event.preventDefault()}
- value={value}
- >
- {clamp?.effort === value ? `${copy[value]} (${copy.sendsOnRoute(copy[clamp.wire])})` : copy[value]}
- </DropdownMenuRadioItem>
- ))}
- </DropdownMenuRadioGroup>
+ <DropdownMenuItem
+ className={dropdownMenuRow}
+ onSelect={event => {
+ event.preventDefault()
+ onTogglePin()
+ }}
+ title={copy.shiftClickHint}
+ >
+ <Codicon name="pin" size="0.75rem" />
+ {isPinned ? copy.unpin : copy.pin}
+ {isPinned ? null : (
+ <DropdownMenuShortcut className="pl-3 tracking-normal">{copy.pinShortcut}</DropdownMenuShortcut>
+ )}
+ </DropdownMenuItem>
</>
) : null}
</>
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 21750ba1944..b8ec1f7cd2c 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -2955,6 +2955,7 @@ export const ar = defineLocale({
pin: 'تثبيت',
unpin: 'إلغاء التثبيت',
shiftClickHint: 'انقر مع Shift على نموذج لتثبيته',
+ pinShortcut: '⇧ نقرة',
effort: 'الجهد',
minimal: 'أدنى',
low: 'منخفض',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index bbe73ce47ae..8fdb8bac594 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -5059,6 +5059,7 @@ export const deOverrides = {
pin: 'Anpinnen',
unpin: 'Lösen',
shiftClickHint: 'Shift-Klick auf ein Modell zum Anpinnen',
+ pinShortcut: '⇧ Klick',
effort: 'Aufwand',
minimal: 'Minimal',
low: 'Niedrig',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 7bd00b4fbc9..18cf6e27bed 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -4662,6 +4662,7 @@ export const en: Translations = {
pin: 'Pin',
unpin: 'Unpin',
shiftClickHint: 'Shift-click a model to pin',
+ pinShortcut: '⇧ Click',
effort: 'Effort',
minimal: 'Minimal',
low: 'Low',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 2733a65fef7..7d72b814ec4 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -5051,6 +5051,7 @@ export const esOverrides = {
pin: 'Fijar',
unpin: 'Desfijar',
shiftClickHint: 'Mayús-clic en un modelo para fijarlo',
+ pinShortcut: '⇧ Clic',
effort: 'Esfuerzo',
minimal: 'Mínimo',
low: 'Bajo',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 0cca296e3c4..b6fba7459ef 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -5073,6 +5073,7 @@ export const frOverrides = {
pin: 'Épingler',
unpin: 'Désépingler',
shiftClickHint: "Shift-clic sur un modèle pour l'épingler",
+ pinShortcut: '⇧ Clic',
effort: 'Effort',
minimal: 'Minimal',
low: 'Faible',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 13cf95f1797..0f4333868f1 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -3404,6 +3404,7 @@ export const ja = defineLocale({
pin: 'ピン留め',
unpin: 'ピン留めを解除',
shiftClickHint: 'Shift クリックでモデルをピン留め',
+ pinShortcut: '⇧ クリック',
effort: '努力度',
minimal: '最小',
low: '低',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index ca23bd47c5c..66b1803c391 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -3631,6 +3631,7 @@ export const ru = defineLocale({
pin: 'Закрепить',
unpin: 'Открепить',
shiftClickHint: 'Shift-клик по модели, чтобы закрепить',
+ pinShortcut: '⇧ Клик',
effort: 'Усилия',
minimal: 'Минимально',
low: 'Низкое',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 406f6ed33c5..d53d50fd785 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -3913,6 +3913,7 @@ export interface Translations {
pin: string
unpin: string
shiftClickHint: string
+ pinShortcut: string
effort: string
minimal: string
low: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 75cafd88b6b..2aa9139e05e 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -3585,6 +3585,7 @@ export const zhHant = defineLocale({
pin: '釘選',
unpin: '取消釘選',
shiftClickHint: 'Shift + 點擊模型以釘選',
+ pinShortcut: '⇧ 點擊',
effort: '推理強度',
minimal: '最小',
low: '低',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index e6af324bf5b..117d21f1d71 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -4360,6 +4360,7 @@ export const zh = defineLocale({
pin: '置顶',
unpin: '取消置顶',
shiftClickHint: 'Shift+ 单击模型以置顶',
+ pinShortcut: '⇧ 单击',
effort: '推理强度',
minimal: '最小',
low: '低',
diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.md
index 66d03f7659e..537fbfd729f 100644
--- a/website/docs/user-guide/desktop.md
+++ b/website/docs/user-guide/desktop.md
@@ -106,6 +106,7 @@ The **microphone** is dictation; hover it and the other voice toggles fan out ab
- **The composer picker is sticky UI state and never touches your default.** It's remembered locally (per device) and **follows** across new chats and restarts instead of snapping back to the default — pick a model once and the next `Cmd/Ctrl+N` opens on it. With a live chat, switching models scopes the change to that **current chat**; either way the selection rides along when the session is created/switched and is **never** written to the profile default — with one exception: on a fresh profile that has no `model.default`/`model.provider` configured yet, the first pick is persisted so the app has a real default instead of falling through to a stray API-key env var on restart. Persistence follows the same rule as `/model` (`model.persist_switch_by_default`); use **Settings → Model** to change the default deliberately. (Switching [profiles](#sessions--profiles) reseeds to that profile's own default.)
- **Set the default in Settings → Model.** That "main" model is your **per-profile global default** — it's what new chats, crons, subagents, and auxiliary tasks start from, and it's the only place that writes it. Each [profile](#sessions--profiles) keeps its own default.
- **Per-model effort/fast presets.** Each model remembers its own reasoning effort and fast-mode choice in the desktop app, re-applied to the session whenever you pick that model. These presets are a desktop convenience and don't change crons or subagents.
+- **Pinned models.** Shift-click a model row (or open its options and choose **Pin**) to lift it into a **Pinned** section at the top of the picker — the same gesture that pins a chat in the sidebar. The menu stays open, so a second shift-click unpins. Pins show in the composer, in session tiles, and anywhere else a model is picked, because they are one stored preference. They persist per device, keep the order you pinned them, and ignore the **Edit models** shortlist (a pin IS an explicit "always show me this one"); a pin for a provider that is not connected is kept and reappears when it reconnects. Searching is unaffected — a query lists every match in its provider's place.
- **Mid-chat switches reset the prompt cache.** Switching the model inside a live chat means the next message re-reads the whole conversation at full input price (provider prompt caches are keyed to the model). Fine occasionally; on a long chat, a fresh chat on the new model is often cheaper than bouncing back and forth.
### File browser