The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(usage-window): a pinned current model never takes the Recommended heading in the composer menu
Tekniume106c2c9faf4
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsxindex bd81e499731..b34f3217ba1 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx@@ -207,6 +207,37 @@ describe('usage-window plan rows', () => {})})+describe('usage-window plan sections', () => {+ it('a pinned current model the catalog omits goes under Other models, never under Recommended', async () => {+ getGlobalModelOptions.mockResolvedValue({+ providers: [+ {+ authenticated: true,+ models: ['example/model-a', 'example/model-b'],+ name: 'Nous',+ plan_usage: {+ featured_model_ids: ['example/model-a'],+ gauges: [{ label: 'day', left_fraction: 0.5, scope: 'all', style: 'green' }],+ kind: 'usage_window'+ },+ slug: 'nous'+ }+ ]+ })+ renderMenu({ model: 'custom/model-x', provider: 'nous' })++ const recommended = await screen.findByText('Recommended')+ const other = screen.getByText('Other models')+ const pick = screen.getByText(/model[- ]a/i)+ const pinned = screen.getByText(/model[- ]x/i)+ const follows = (a: Element, b: Element) => Boolean(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING)++ expect(follows(recommended, pick)).toBe(true)+ expect(follows(pick, other)).toBe(true)+ expect(follows(other, pinned)).toBe(true)+ })+})+describe('the reasoning-effort badge (#51833)', () => {it('renders the effort as its own Badge chip beside the name, never inside it', async () => {renderMenu({ effort: 'high', model: 'gemini-2.5-flash', provider: 'google' })diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsxindex a02f8a337cc..048db76b711 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx@@ -1,5 +1,12 @@import type { ModelOptionProvider, ModelOptionsResult, ModelPricing } from '@hermes/shared'-import { DEFAULT_REASONING_EFFORT, planBlocks, sectionAt, usageLevel, usageTag } from '@hermes/shared'+import {+ DEFAULT_REASONING_EFFORT,+ planBlocks,+ sectionAt,+ splitRecommended,+ usageLevel,+ usageTag+} from '@hermes/shared'import { useStore } from '@nanostores/react'import { useQuery } from '@tanstack/react-query'import {@@ -1364,7 +1371,7 @@ function groupModels(current.model &&!allFamilies.some(family => family.id === current.model || family.fastId === current.model)) {- allFamilies = [{ fastId: null, id: current.model }, ...allFamilies]+ allFamilies = recommendedFirst(provider, [{ fastId: null, id: current.model }, ...allFamilies])}if (allFamilies.length === 0) {@@ -1440,6 +1447,21 @@ function nousPricingPoll(data: ModelOptionsResult | undefined, updates: number):return updates < 6 && data?.providers?.some(p => isNous(p) && p.pricing_pending) ? 2_000 : false}+// Window plans: the plan's featured picks lead (the backend lists them first). Re-applied after the+// current-model pin above, so a pinned custom model lands under "Other models" instead of taking the+// first pick's "Recommended" heading.+function recommendedFirst(provider: ModelOptionProvider, families: ModelFamily[]): ModelFamily[] {+ const split = splitRecommended(provider, families.map(family => family.id))++ if (!split) {+ return families+ }++ const byId = new Map(families.map(family => [family.id, family]))++ return [...split.recommended, ...split.other].flatMap(id => byId.get(id) ?? [])+}+// Window plans, no query: "Recommended" above the first of the plan's featured families and// "Other models" above the first family after them. The backend already lists the picks first.function sectionTitle(diff --git a/apps/shared/src/plan-usage.ts b/apps/shared/src/plan-usage.tsindex 78575849064..608f7d55785 100644--- a/apps/shared/src/plan-usage.ts+++ b/apps/shared/src/plan-usage.ts@@ -69,7 +69,8 @@ export function splitRecommended(}/** The section title a window-plan picker shows above row *idx* of *models* (no query): `recommended`- * above the first featured pick, `other` above the first row after them, else null. */+ * above the first featured pick, `other` above the first row after them, else null. *models* must be in+ * `splitRecommended` order (picks first): a caller that pins an extra row re-orders after the pin. */export function sectionAt(provider: PlanProvider,models: readonly string[],