an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
feat: move the provider model lists into a checked-in JSON catalog
Aaron Covillee8e4474983fe
diff --git a/src/renderer/src/store/config.ts b/src/renderer/src/store/config.tsindex 77931f6e..2bdee34b 100644--- a/src/renderer/src/store/config.ts+++ b/src/renderer/src/store/config.ts@@ -12,6 +12,8 @@ import type {OrgTriggerConfig,WebhookTrigger} from '@shared/triggers';+import { isNewer } from '@shared/updateState';+import modelCatalog from '@shared/modelCatalog.json';export {AGENT_PROVIDER_PRESETS,@@ -160,178 +162,118 @@ export interface ModelOption {label: string;}-/** The models offered in the "add agent" picker and the per-agent selector.- * `[1m]` selects the 1M-token context window variant. */-// Deliberately has NO "pass no --model flag" entry. Every option here names a-// real model, because the whole reason to open this picker is to know which-// model an agent is on — and a no-flag option resolves to whatever Claude Code-// happens to choose, which the UI cannot show and the user cannot predict. The-// harness default is marked ` · default` instead, and it names a real model.-export const AGENT_MODELS: ModelOption[] = [- { id: 'claude-fable-5', label: 'Fable 5' },- { id: 'claude-opus-5', label: 'Opus 5 · 1M' },- { id: 'claude-opus-4-8', label: 'Opus 4.8' },- { id: 'claude-opus-4-8[1m]', label: 'Opus 4.8 · 1M' },- { id: 'claude-sonnet-5', label: 'Sonnet 5' },- { id: 'claude-sonnet-4-6', label: 'Sonnet 4.6' },- { id: ASSISTANT_MODEL, label: 'Sonnet 4.6 · 1M' },- { id: 'claude-haiku-4-5-20251001', label: 'Haiku 4.5' }-];--/** Current OpenAI models offered by Codex for coding agents. The command field- * stays editable and `codex --model <id>` is the source of truth. */-export const CODEX_MODELS: ModelOption[] = [- // No `--model` flag at all — whatever the CLI itself defaults to. NOT the- // harness's `config.defaultModel`; the pickers mark that one separately, and- // labelling both "default" is what made the two impossible to tell apart.- { id: undefined, label: 'CLI default' },- { id: 'gpt-5.6-sol', label: 'GPT-5.6 Sol' },- { id: 'gpt-5.6-terra', label: 'GPT-5.6 Terra' },- { id: 'gpt-5.6-luna', label: 'GPT-5.6 Luna' }-];--/** Models offered when an agent runs on the Antigravity CLI (`agy`). agy's- * `--model` takes the DISPLAY-NAME LABEL exactly as `agy models` prints it- * (verified: agy logs `Propagating selected model override … label="…"`), not a- * slug — so these ids ARE the labels (spaces/parens included; buildSpawnCommand- * quotes them and the command tokenizer keeps them whole). The command field- * stays editable; `agy models` is the source of truth for the live list. */-export const ANTIGRAVITY_MODELS: ModelOption[] = [- // No `--model` flag at all — whatever the CLI itself defaults to. NOT the- // harness's `config.defaultModel`; the pickers mark that one separately, and- // labelling both "default" is what made the two impossible to tell apart.- { id: undefined, label: 'CLI default' },- { id: 'Gemini 3.1 Pro (High)', label: 'Gemini 3.1 Pro · High' },- { id: 'Gemini 3.1 Pro (Low)', label: 'Gemini 3.1 Pro · Low' },- { id: 'Gemini 3.5 Flash (High)', label: 'Gemini 3.5 Flash · High' },- { id: 'Gemini 3.5 Flash (Medium)', label: 'Gemini 3.5 Flash · Med' },- { id: 'Gemini 3.5 Flash (Low)', label: 'Gemini 3.5 Flash · Low' },- { id: 'Claude Sonnet 4.6 (Thinking)', label: 'Claude Sonnet 4.6' },- { id: 'Claude Opus 4.6 (Thinking)', label: 'Claude Opus 4.6' },- { id: 'GPT-OSS 120B (Medium)', label: 'GPT-OSS 120B' }-];--/** Stable model aliases accepted by the official Google Gemini CLI. The aliases- * intentionally follow the CLI instead of pinning preview model ids that drift. */-export const GEMINI_MODELS: ModelOption[] = [- { id: undefined, label: 'CLI default' },- { id: 'auto', label: 'Auto' },- { id: 'pro', label: 'Pro' },- { id: 'flash', label: 'Flash' },- { id: 'flash-lite', label: 'Flash Lite' }-];--/** Models offered when an agent runs on qwen-code (`qwen`), the proxy-bridge CLI- * driving an OpenAI-compatible endpoint. Starting suggestions only (editable- * command field). // TODO-verify the live list (`qwen` model ids). */-export const QWEN_MODELS: ModelOption[] = [- { id: undefined, label: 'default' },- { id: 'qwen3-coder-plus', label: 'Qwen3 Coder Plus' },- { id: 'qwen3-coder', label: 'Qwen3 Coder' },- { id: 'qwen-max', label: 'Qwen Max' }-];--/** Models offered when an agent runs on OpenCode (`opencode`). OpenCode's `--model`- * takes a `provider/model` slug; these are curated BYOK suggestions (the command- * field stays editable; `opencode models` / models.dev is the source of truth).- * // TODO-verify exact live slugs (humanQA — they drift). */-export const OPENCODE_MODELS: ModelOption[] = [- // "CLI default", not "default" — the distinction ANTIGRAVITY_MODELS already- // draws: pass NO --model and run whatever OpenCode itself is configured and- // authenticated for. That is not the harness's own default model, and calling- // both "default" is what made the two impossible to tell apart. This is now the- // PRESELECTED entry for OpenCode, because a BYOK slug the user holds no key for- // fails silently — see the recommendedOrchestratorModel note in agentProvider.ts.- { id: undefined, label: 'CLI default' },- { id: 'anthropic/claude-sonnet-4-5', label: 'Claude Sonnet 4.5 (Anthropic)' },- { id: 'anthropic/claude-haiku-4-5', label: 'Claude Haiku 4.5 (Anthropic)' },- { id: 'openai/gpt-5', label: 'GPT-5 (OpenAI)' },- { id: 'openai/gpt-5-mini', label: 'GPT-5 mini (OpenAI)' },- { id: 'openrouter/anthropic/claude-sonnet-4.5', label: 'Claude Sonnet 4.5 (OpenRouter)' },- { id: 'google/gemini-2.5-pro', label: 'Gemini 2.5 Pro (Google)' },- { id: 'local/llama3', label: 'Local · OpenAI-compatible (set base-URL)' }-];+/** One row of the model catalog. `minAppVersion` / `maxAppVersion` are INCLUSIVE+ * app-version bounds: the model is offered while the running build sits inside+ * them, and null (or an absent key) means unbounded in that direction. That is+ * what lets a release introduce or retire a model without a code change. */+interface CatalogModel {+ /** absent = use the CLI default (no --model flag) */+ id?: string;+ label: string;+ minAppVersion?: string | null;+ maxAppVersion?: string | null;+}-/** Models offered when an agent runs on Crush (`crush`). Crush's `--model` takes a- * `provider/model-id` slug; free-text editable (Crush accepts arbitrary slugs).- * // TODO-verify exact live ids (humanQA). */-export const CRUSH_MODELS: ModelOption[] = [- { id: undefined, label: 'Crush default (config)' },- { id: 'anthropic/claude-sonnet-4-5', label: 'Claude Sonnet 4.5 (Anthropic)' },- { id: 'anthropic/claude-opus-4-1', label: 'Claude Opus (Anthropic)' },- { id: 'openai/gpt-4o', label: 'GPT-4o (OpenAI)' },- { id: 'openai/o3', label: 'o3 (OpenAI)' },- { id: 'gemini/gemini-2.5-pro', label: 'Gemini 2.5 Pro' },- { id: 'openrouter/auto', label: 'OpenRouter (auto)' },- // OpenAI-wire local slug so traffic routes through the proxy (the harness overrides- // the `openai` provider's base_url → loopback → your configured Crush base-URL).- // An `ollama/*` slug would bypass the proxy (Dwight verify-crush NIT-2).- { id: 'openai/local', label: 'Local · OpenAI-compatible (set base-URL)' }-];+interface ModelCatalog {+ version: number;+ providers: Record<string, CatalogModel[]>;+}-/** Models offered when an agent runs on Pi (`pi`). Pi's `--model` takes a- * `provider/model` slug (thinking via a `:high` suffix). Curated BYOK suggestions;- * free-text editable. // TODO-verify exact live slugs (humanQA). */-export const PI_MODELS: ModelOption[] = [- { id: undefined, label: 'default' },- { id: 'anthropic/claude-sonnet-4-5', label: 'Claude Sonnet 4.5 (Anthropic)' },- { id: 'anthropic/claude-opus-4-1', label: 'Claude Opus (Anthropic)' },- { id: 'openai/gpt-5', label: 'GPT-5 (OpenAI)' },- { id: 'google/gemini-2.5-pro', label: 'Gemini 2.5 Pro (Google)' },- { id: 'groq/llama-3.3-70b', label: 'Llama 3.3 70B (Groq)' },- { id: 'local/llama3', label: 'Local · OpenAI-compatible (set base-URL)' }-];+/** The model presets every provider picker offers.+ *+ * These were a dozen hardcoded `ModelOption[]` arrays in this file, so shipping+ * a model — one string — meant editing, type-checking and rebuilding renderer+ * source. They now live in src/shared/modelCatalog.json, imported at BUILD time+ * (no fs, no network, offline-safe) and filtered per running version, so adding+ * a model is a one-line JSON edit and a model can name the releases it belongs+ * to instead of appearing in builds whose CLI never shipped it.+ *+ * What the arrays used to say — kept, because it explains why the entries look+ * the way they do:+ *+ * - claude: `[1m]` selects the 1M-token context-window variant. The list+ * deliberately has NO "pass no --model flag" entry: every option names a real+ * model, because the whole reason to open this picker is to know which model+ * an agent is on, and a no-flag option resolves to whatever Claude Code+ * happens to choose — which the UI cannot show and the user cannot predict.+ * The harness default is marked ` · default` instead, and it names a real model.+ * - The leading `CLI default` entry several providers carry means no `--model`+ * flag at all — whatever the CLI itself defaults to. That is NOT the harness's+ * `config.defaultModel`; the pickers mark that one separately, and labelling+ * both "default" is what made the two impossible to tell apart.+ * - codex: current OpenAI models offered by Codex. The command field stays+ * editable and `codex --model <id>` is the source of truth.+ * - antigravity: agy's `--model` takes the DISPLAY-NAME LABEL exactly as+ * `agy models` prints it (verified: agy logs `Propagating selected model+ * override … label="…"`), not a slug — so these ids ARE labels, spaces and+ * parens included; buildSpawnCommand quotes them and the command tokenizer+ * keeps them whole. `agy models` is the source of truth for the live list.+ * - gemini: stable aliases accepted by the official Google Gemini CLI. They+ * follow the CLI instead of pinning preview model ids that drift.+ * - qwen: qwen-code (`qwen`), the proxy-bridge CLI driving an OpenAI-compatible+ * endpoint. Starting suggestions only. // TODO-verify the live list.+ * - opencode: `--model` takes a `provider/model` slug; curated BYOK suggestions+ * (`opencode models` / models.dev is the source of truth). `CLI default` is the+ * PRESELECTED entry, because a BYOK slug the user holds no key for fails+ * silently — see the recommendedOrchestratorModel note in agentProvider.ts.+ * // TODO-verify exact live slugs (they drift).+ * - crush: `--model` takes a `provider/model-id` slug; free-text editable (Crush+ * accepts arbitrary slugs). The local pick is an OpenAI-wire slug so traffic+ * routes through the proxy (the harness overrides the `openai` provider's+ * base_url → loopback → your configured Crush base-URL); an `ollama/*` slug+ * would bypass the proxy. // TODO-verify exact live ids.+ * - pi: `--model` takes a `provider/model` slug (thinking via a `:high` suffix).+ * Curated BYOK suggestions; free-text editable. // TODO-verify exact live slugs.+ * - copilot: `--model` takes a plain model id ('auto' lets Copilot pick); curated+ * suggestions, editable command field. // TODO-verify exact live ids (the+ * /model picker is the source of truth; they drift).+ * - cursor: ids match `cursor-agent models` / `--model` (Cursor account catalog).+ * Luna is the cheap, high-context default for Michael; the rest are curated+ * quick-picks and the command field stays editable for any live slug.+ * - grok: the models reported by the installed Grok CLI (`grok models`).+ * - kimi: managed Kimi Code aliases accepted by `kimi --model <alias>`.+ * - custom: no presets at all; the command field is the whole interface.+ */+const CATALOG: ModelCatalog = modelCatalog;-/** Models offered when an agent runs on GitHub Copilot (`copilot`). Copilot's- * `--model` takes a plain model id ('auto' lets Copilot pick); these are curated- * suggestions and the command field stays editable. // TODO-verify exact live ids- * (the /model picker is the source of truth; they drift). */-export const COPILOT_MODELS: ModelOption[] = [- { id: undefined, label: 'default (Claude Sonnet 4.5)' },- { id: 'auto', label: 'Auto (Copilot picks)' },- { id: 'claude-sonnet-4.5', label: 'Claude Sonnet 4.5' },- { id: 'claude-sonnet-4', label: 'Claude Sonnet 4' },- { id: 'gpt-5.4', label: 'GPT-5.4' },- { id: 'gpt-5', label: 'GPT-5' }-];+declare const __APP_VERSION__: string | undefined;-/** Models offered when an agent runs on Cursor Agent CLI (`cursor-agent`). Ids match- * `cursor-agent models` / `--model` (Cursor account catalog). Luna is the cheap,- * high-context default for Michael; other entries are curated quick-picks —- * the command field stays editable for any live slug. */-export const CURSOR_MODELS: ModelOption[] = [- { id: undefined, label: 'CLI default (auto)' },- { id: 'auto', label: 'Auto' },- { id: 'gpt-5.6-luna-high', label: 'GPT-5.6 Luna 1M High (cheap)' },- { id: 'gpt-5.6-sol-medium', label: 'GPT-5.6 Sol 1M' },- { id: 'gpt-5.6-sol-high', label: 'GPT-5.6 Sol 1M High' },- { id: 'composer-2.5', label: 'Composer 2.5' },- { id: 'composer-2.5-fast', label: 'Composer 2.5 Fast' },- { id: 'gpt-5.2', label: 'GPT-5.2' },- { id: 'claude-opus-4-8-high', label: 'Opus 4.8 1M' },- { id: 'claude-sonnet-5-thinking-high', label: 'Sonnet 5 1M Thinking' }-];+/** The version of the running build. electron-vite replaces `__APP_VERSION__`+ * with package.json's version at build time — the same value the update badge+ * shows — so the renderer knows it synchronously, with no round trip to main.+ * Outside a build (unit tests) the define is absent and there is no version to+ * compare against; see the fail-open note on `offeredAtVersion`. */+export function runningAppVersion(): string {+ return typeof __APP_VERSION__ === 'string' ? __APP_VERSION__ : '';+}-/** Models reported by the installed Grok CLI (`grok models`). */-export const GROK_MODELS: ModelOption[] = [- // No `--model` flag at all — whatever the CLI itself defaults to. NOT the- // harness's `config.defaultModel`; the pickers mark that one separately, and- // labelling both "default" is what made the two impossible to tell apart.- { id: undefined, label: 'CLI default' },- { id: 'grok-4.6', label: 'Grok 4.6' },- { id: 'grok-4.5', label: 'Grok 4.5' }-];+/** Whether a catalog entry belongs in a picker on this build. Both bounds are+ * inclusive of the release they name. Anything unparseable — an absent bound, a+ * malformed one, an unknown app version — is ignored rather than hiding the+ * model: a picker that silently loses every model is far worse than one that+ * offers a model this build's CLI cannot run (the command field is editable and+ * the CLI reports the bad slug). */+function offeredAtVersion(model: CatalogModel, appVersion: string): boolean {+ if (model.minAppVersion && isNewer(model.minAppVersion, appVersion)) return false;+ if (model.maxAppVersion && isNewer(appVersion, model.maxAppVersion)) return false;+ return true;+}-/** Managed Kimi Code aliases accepted by `kimi --model <alias>`. */-export const KIMI_MODELS: ModelOption[] = [- // No `--model` flag at all — whatever the CLI itself defaults to. NOT the- // harness's `config.defaultModel`; the pickers mark that one separately, and- // labelling both "default" is what made the two impossible to tell apart.- { id: undefined, label: 'CLI default' },- { id: 'kimi-code/k3', label: 'Kimi K3' },- { id: 'kimi-code/kimi-for-coding', label: 'Kimi K2.7 Code' },- { id: 'kimi-code/kimi-for-coding-highspeed', label: 'Kimi K2.7 · HighSpeed' }-];+/** The model preset list for a provider's picker, as of a given app version.+ * `providers` is injectable so the version filter can be exercised against+ * bounded entries — the shipped catalog is deliberately all-unbounded. */+export function modelsForProviderAtVersion(+ provider: AgentProvider,+ appVersion: string,+ providers: Record<string, CatalogModel[]> = CATALOG.providers+): ModelOption[] {+ // An unknown provider falls back to the Claude list, as the hardcoded dispatch+ // did. 'custom' is a real key holding an empty list, not a missing one.+ const entries = providers[provider] ?? providers.claude ?? [];+ return entries+ .filter((model) => offeredAtVersion(model, appVersion))+ .map((model) => (model.id === undefined ? { label: model.label } : { id: model.id, label: model.label }));+}// tokenizeCommand moved to src/shared/commandLine.ts so main's spawn-request// path splits command lines with the SAME rules as the renderer's spawn flows@@ -339,23 +281,14 @@ export const KIMI_MODELS: ModelOption[] = [// importers keep their path.export { tokenizeCommand } from '@shared/commandLine';-/** The model preset list for a given provider's picker. */+/** The model preset list for a given provider's picker, on this build. */export function modelsForProvider(provider: AgentProvider): ModelOption[] {- if (provider === 'codex') return CODEX_MODELS;- if (provider === 'grok') return GROK_MODELS;- if (provider === 'kimi') return KIMI_MODELS;- if (provider === 'gemini') return GEMINI_MODELS;- if (provider === 'antigravity') return ANTIGRAVITY_MODELS;- if (provider === 'qwen') return QWEN_MODELS;- if (provider === 'opencode') return OPENCODE_MODELS;- if (provider === 'crush') return CRUSH_MODELS;- if (provider === 'pi') return PI_MODELS;- if (provider === 'copilot') return COPILOT_MODELS;- if (provider === 'cursor') return CURSOR_MODELS;- if (provider === 'custom') return [];- return AGENT_MODELS;+ return modelsForProviderAtVersion(provider, runningAppVersion());}+/** The Claude presets, for the surfaces that only ever offer Claude models. */+export const AGENT_MODELS: ModelOption[] = modelsForProvider('claude');+/** Providers shown in the Command Center's cross-provider model picker.* God must remain on a provider with a working inbox drain; otherwise switching* to a terminal-only provider would silently disable orchestration. */diff --git a/src/shared/agentProvider.ts b/src/shared/agentProvider.tsindex e667b7a8..09c5f6ac 100644--- a/src/shared/agentProvider.ts+++ b/src/shared/agentProvider.ts@@ -382,8 +382,8 @@ export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [// Sonnet 4.5 — the picker said one model, the agent ran another, and nothing// flagged the divergence. Undefined means buildSpawnCommand emits no// `--model` at all, so OpenCode uses the model the user actually configured;- // every BYOK slug in OPENCODE_MODELS stays one click away for whoever has- // the key.+ // every BYOK slug in the OpenCode model catalog stays one click away for+ // whoever has the key.recommendedOrchestratorModel: undefined,// Capturing the TUI session id for resume is unverified; spawn fresh on respawn// (protocol re-injected as the initial prompt), matching codex.diff --git a/src/shared/modelCatalog.json b/src/shared/modelCatalog.jsonnew file mode 100644index 00000000..191f9547--- /dev/null+++ b/src/shared/modelCatalog.json@@ -0,0 +1,106 @@+{+ "version": 1,+ "providers": {+ "claude": [+ { "id": "claude-fable-5", "label": "Fable 5", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-opus-5", "label": "Opus 5 · 1M", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-opus-4-8", "label": "Opus 4.8", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-opus-4-8[1m]", "label": "Opus 4.8 · 1M", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-sonnet-5", "label": "Sonnet 5", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-sonnet-4-6", "label": "Sonnet 4.6", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-sonnet-4-6[1m]", "label": "Sonnet 4.6 · 1M", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-haiku-4-5-20251001", "label": "Haiku 4.5", "minAppVersion": null, "maxAppVersion": null }+ ],+ "codex": [+ { "label": "CLI default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.6-sol", "label": "GPT-5.6 Sol", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.6-terra", "label": "GPT-5.6 Terra", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.6-luna", "label": "GPT-5.6 Luna", "minAppVersion": null, "maxAppVersion": null }+ ],+ "grok": [+ { "label": "CLI default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "grok-4.6", "label": "Grok 4.6", "minAppVersion": null, "maxAppVersion": null },+ { "id": "grok-4.5", "label": "Grok 4.5", "minAppVersion": null, "maxAppVersion": null }+ ],+ "kimi": [+ { "label": "CLI default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "kimi-code/k3", "label": "Kimi K3", "minAppVersion": null, "maxAppVersion": null },+ { "id": "kimi-code/kimi-for-coding", "label": "Kimi K2.7 Code", "minAppVersion": null, "maxAppVersion": null },+ { "id": "kimi-code/kimi-for-coding-highspeed", "label": "Kimi K2.7 · HighSpeed", "minAppVersion": null, "maxAppVersion": null }+ ],+ "gemini": [+ { "label": "CLI default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "auto", "label": "Auto", "minAppVersion": null, "maxAppVersion": null },+ { "id": "pro", "label": "Pro", "minAppVersion": null, "maxAppVersion": null },+ { "id": "flash", "label": "Flash", "minAppVersion": null, "maxAppVersion": null },+ { "id": "flash-lite", "label": "Flash Lite", "minAppVersion": null, "maxAppVersion": null }+ ],+ "antigravity": [+ { "label": "CLI default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Gemini 3.1 Pro (High)", "label": "Gemini 3.1 Pro · High", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Gemini 3.1 Pro (Low)", "label": "Gemini 3.1 Pro · Low", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Gemini 3.5 Flash (High)", "label": "Gemini 3.5 Flash · High", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Gemini 3.5 Flash (Medium)", "label": "Gemini 3.5 Flash · Med", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Gemini 3.5 Flash (Low)", "label": "Gemini 3.5 Flash · Low", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Claude Sonnet 4.6 (Thinking)", "label": "Claude Sonnet 4.6", "minAppVersion": null, "maxAppVersion": null },+ { "id": "Claude Opus 4.6 (Thinking)", "label": "Claude Opus 4.6", "minAppVersion": null, "maxAppVersion": null },+ { "id": "GPT-OSS 120B (Medium)", "label": "GPT-OSS 120B", "minAppVersion": null, "maxAppVersion": null }+ ],+ "qwen": [+ { "label": "default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "qwen3-coder-plus", "label": "Qwen3 Coder Plus", "minAppVersion": null, "maxAppVersion": null },+ { "id": "qwen3-coder", "label": "Qwen3 Coder", "minAppVersion": null, "maxAppVersion": null },+ { "id": "qwen-max", "label": "Qwen Max", "minAppVersion": null, "maxAppVersion": null }+ ],+ "opencode": [+ { "label": "CLI default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "anthropic/claude-sonnet-4-5", "label": "Claude Sonnet 4.5 (Anthropic)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "anthropic/claude-haiku-4-5", "label": "Claude Haiku 4.5 (Anthropic)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openai/gpt-5", "label": "GPT-5 (OpenAI)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openai/gpt-5-mini", "label": "GPT-5 mini (OpenAI)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openrouter/anthropic/claude-sonnet-4.5", "label": "Claude Sonnet 4.5 (OpenRouter)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "google/gemini-2.5-pro", "label": "Gemini 2.5 Pro (Google)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "local/llama3", "label": "Local · OpenAI-compatible (set base-URL)", "minAppVersion": null, "maxAppVersion": null }+ ],+ "crush": [+ { "label": "Crush default (config)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "anthropic/claude-sonnet-4-5", "label": "Claude Sonnet 4.5 (Anthropic)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "anthropic/claude-opus-4-1", "label": "Claude Opus (Anthropic)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openai/gpt-4o", "label": "GPT-4o (OpenAI)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openai/o3", "label": "o3 (OpenAI)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gemini/gemini-2.5-pro", "label": "Gemini 2.5 Pro", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openrouter/auto", "label": "OpenRouter (auto)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openai/local", "label": "Local · OpenAI-compatible (set base-URL)", "minAppVersion": null, "maxAppVersion": null }+ ],+ "pi": [+ { "label": "default", "minAppVersion": null, "maxAppVersion": null },+ { "id": "anthropic/claude-sonnet-4-5", "label": "Claude Sonnet 4.5 (Anthropic)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "anthropic/claude-opus-4-1", "label": "Claude Opus (Anthropic)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "openai/gpt-5", "label": "GPT-5 (OpenAI)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "google/gemini-2.5-pro", "label": "Gemini 2.5 Pro (Google)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "groq/llama-3.3-70b", "label": "Llama 3.3 70B (Groq)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "local/llama3", "label": "Local · OpenAI-compatible (set base-URL)", "minAppVersion": null, "maxAppVersion": null }+ ],+ "copilot": [+ { "label": "default (Claude Sonnet 4.5)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "auto", "label": "Auto (Copilot picks)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-sonnet-4.5", "label": "Claude Sonnet 4.5", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-sonnet-4", "label": "Claude Sonnet 4", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.4", "label": "GPT-5.4", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5", "label": "GPT-5", "minAppVersion": null, "maxAppVersion": null }+ ],+ "cursor": [+ { "label": "CLI default (auto)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "auto", "label": "Auto", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.6-luna-high", "label": "GPT-5.6 Luna 1M High (cheap)", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.6-sol-medium", "label": "GPT-5.6 Sol 1M", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.6-sol-high", "label": "GPT-5.6 Sol 1M High", "minAppVersion": null, "maxAppVersion": null },+ { "id": "composer-2.5", "label": "Composer 2.5", "minAppVersion": null, "maxAppVersion": null },+ { "id": "composer-2.5-fast", "label": "Composer 2.5 Fast", "minAppVersion": null, "maxAppVersion": null },+ { "id": "gpt-5.2", "label": "GPT-5.2", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-opus-4-8-high", "label": "Opus 4.8 1M", "minAppVersion": null, "maxAppVersion": null },+ { "id": "claude-sonnet-5-thinking-high", "label": "Sonnet 5 1M Thinking", "minAppVersion": null, "maxAppVersion": null }+ ],+ "custom": []+ }+}diff --git a/test/model-catalog.test.cjs b/test/model-catalog.test.cjsnew file mode 100644index 00000000..b3689d9a--- /dev/null+++ b/test/model-catalog.test.cjs@@ -0,0 +1,194 @@+'use strict';++const test = require('node:test');+const assert = require('node:assert/strict');+const loadTs = require('./load-ts.cjs');+const catalog = require('../src/shared/modelCatalog.json');++const {+ ASSISTANT_MODEL,+ modelsForProvider,+ modelsForProviderAtVersion,+ runningAppVersion+} = loadTs('src/renderer/src/store/config.ts');++/** Every model the pickers offered while the lists were hardcoded TypeScript+ * arrays, as `[id, label]` pairs — the providers whose full list no other test+ * pins (provider-config.test.cjs pins codex/grok/kimi/gemini/custom). Moving+ * the lists into JSON must not change one byte of what a user sees, and these+ * literals are the only record of what shipped before the move. */+const SHIPPED = {+ claude: [+ ["claude-fable-5", "Fable 5"],+ ["claude-opus-5", "Opus 5 · 1M"],+ ["claude-opus-4-8", "Opus 4.8"],+ ["claude-opus-4-8[1m]", "Opus 4.8 · 1M"],+ ["claude-sonnet-5", "Sonnet 5"],+ ["claude-sonnet-4-6", "Sonnet 4.6"],+ ["claude-sonnet-4-6[1m]", "Sonnet 4.6 · 1M"],+ ["claude-haiku-4-5-20251001", "Haiku 4.5"]+ ],+ antigravity: [+ [undefined, "CLI default"],+ ["Gemini 3.1 Pro (High)", "Gemini 3.1 Pro · High"],+ ["Gemini 3.1 Pro (Low)", "Gemini 3.1 Pro · Low"],+ ["Gemini 3.5 Flash (High)", "Gemini 3.5 Flash · High"],+ ["Gemini 3.5 Flash (Medium)", "Gemini 3.5 Flash · Med"],+ ["Gemini 3.5 Flash (Low)", "Gemini 3.5 Flash · Low"],+ ["Claude Sonnet 4.6 (Thinking)", "Claude Sonnet 4.6"],+ ["Claude Opus 4.6 (Thinking)", "Claude Opus 4.6"],+ ["GPT-OSS 120B (Medium)", "GPT-OSS 120B"]+ ],+ qwen: [+ [undefined, "default"],+ ["qwen3-coder-plus", "Qwen3 Coder Plus"],+ ["qwen3-coder", "Qwen3 Coder"],+ ["qwen-max", "Qwen Max"]+ ],+ opencode: [+ [undefined, "CLI default"],+ ["anthropic/claude-sonnet-4-5", "Claude Sonnet 4.5 (Anthropic)"],+ ["anthropic/claude-haiku-4-5", "Claude Haiku 4.5 (Anthropic)"],+ ["openai/gpt-5", "GPT-5 (OpenAI)"],+ ["openai/gpt-5-mini", "GPT-5 mini (OpenAI)"],+ ["openrouter/anthropic/claude-sonnet-4.5", "Claude Sonnet 4.5 (OpenRouter)"],+ ["google/gemini-2.5-pro", "Gemini 2.5 Pro (Google)"],+ ["local/llama3", "Local · OpenAI-compatible (set base-URL)"]+ ],+ crush: [+ [undefined, "Crush default (config)"],+ ["anthropic/claude-sonnet-4-5", "Claude Sonnet 4.5 (Anthropic)"],+ ["anthropic/claude-opus-4-1", "Claude Opus (Anthropic)"],+ ["openai/gpt-4o", "GPT-4o (OpenAI)"],+ ["openai/o3", "o3 (OpenAI)"],+ ["gemini/gemini-2.5-pro", "Gemini 2.5 Pro"],+ ["openrouter/auto", "OpenRouter (auto)"],+ ["openai/local", "Local · OpenAI-compatible (set base-URL)"]+ ],+ pi: [+ [undefined, "default"],+ ["anthropic/claude-sonnet-4-5", "Claude Sonnet 4.5 (Anthropic)"],+ ["anthropic/claude-opus-4-1", "Claude Opus (Anthropic)"],+ ["openai/gpt-5", "GPT-5 (OpenAI)"],+ ["google/gemini-2.5-pro", "Gemini 2.5 Pro (Google)"],+ ["groq/llama-3.3-70b", "Llama 3.3 70B (Groq)"],+ ["local/llama3", "Local · OpenAI-compatible (set base-URL)"]+ ],+ copilot: [+ [undefined, "default (Claude Sonnet 4.5)"],+ ["auto", "Auto (Copilot picks)"],+ ["claude-sonnet-4.5", "Claude Sonnet 4.5"],+ ["claude-sonnet-4", "Claude Sonnet 4"],+ ["gpt-5.4", "GPT-5.4"],+ ["gpt-5", "GPT-5"]+ ],+ cursor: [+ [undefined, "CLI default (auto)"],+ ["auto", "Auto"],+ ["gpt-5.6-luna-high", "GPT-5.6 Luna 1M High (cheap)"],+ ["gpt-5.6-sol-medium", "GPT-5.6 Sol 1M"],+ ["gpt-5.6-sol-high", "GPT-5.6 Sol 1M High"],+ ["composer-2.5", "Composer 2.5"],+ ["composer-2.5-fast", "Composer 2.5 Fast"],+ ["gpt-5.2", "GPT-5.2"],+ ["claude-opus-4-8-high", "Opus 4.8 1M"],+ ["claude-sonnet-5-thinking-high", "Sonnet 5 1M Thinking"]+ ],+};++/** A stand-in catalog: the real one is deliberately all-unbounded (the port had+ * to be behaviour-identical), so the version bounds can only be exercised+ * against models invented here. `modelsForProviderAtVersion` takes the provider+ * map as its last argument for exactly this reason — the test drives the real+ * filter, not a copy of it. */+const BOUNDED = {+ claude: [+ { id: 'unbounded', label: 'Unbounded', minAppVersion: null, maxAppVersion: null },+ { id: 'no-bound-keys', label: 'No bound keys at all' },+ { id: 'since-0.5.0', label: 'Ships in a later release', minAppVersion: '0.5.0', maxAppVersion: null },+ { id: 'since-0.4.5', label: 'Ships in this release', minAppVersion: '0.4.5', maxAppVersion: null },+ { id: 'until-0.4.4', label: 'Retired one release ago', minAppVersion: null, maxAppVersion: '0.4.4' },+ { id: 'until-0.4.5', label: 'Retired after this release', minAppVersion: null, maxAppVersion: '0.4.5' },+ { id: 'window', label: 'Only inside a window', minAppVersion: '0.4.0', maxAppVersion: '0.4.9' }+ ]+};++const ids = (models) => models.map((model) => model.id);++test('the pickers offer exactly the models that shipped before the catalog', () => {+ for (const [provider, expected] of Object.entries(SHIPPED)) {+ assert.deepEqual(+ modelsForProvider(provider).map((model) => [model.id, model.label]),+ expected,+ provider+ );+ }+});++test('the Claude list still offers the 1M-context assistant model', () => {+ // The hardcoded array built this entry out of the ASSISTANT_MODEL constant.+ // The catalog carries the id as a literal, so this is now the only thing+ // holding the picker entry and the constant together.+ assert.ok(ids(modelsForProvider('claude')).includes(ASSISTANT_MODEL));+});++test('the catalog is the schema config.ts expects', () => {+ assert.equal(catalog.version, 1);+ assert.deepEqual(+ Object.keys(catalog.providers).sort(),+ ['antigravity', 'claude', 'copilot', 'codex', 'crush', 'cursor', 'custom',+ 'gemini', 'grok', 'kimi', 'opencode', 'pi', 'qwen'].sort()+ );+});++test('a model is offered only by the app versions its bounds cover', () => {+ assert.deepEqual(ids(modelsForProviderAtVersion('claude', '0.4.5', BOUNDED)), [+ 'unbounded',+ 'no-bound-keys',+ 'since-0.4.5',+ 'until-0.4.5',+ 'window'+ ]);+ assert.deepEqual(ids(modelsForProviderAtVersion('claude', '0.5.0', BOUNDED)), [+ 'unbounded',+ 'no-bound-keys',+ 'since-0.5.0',+ 'since-0.4.5'+ ]);+ assert.deepEqual(ids(modelsForProviderAtVersion('claude', '0.3.0', BOUNDED)), [+ 'unbounded',+ 'no-bound-keys',+ 'until-0.4.4',+ 'until-0.4.5'+ ]);+});++test('both bounds are inclusive of the release named in them', () => {+ assert.ok(ids(modelsForProviderAtVersion('claude', '0.4.5', BOUNDED)).includes('since-0.4.5'));+ assert.ok(ids(modelsForProviderAtVersion('claude', '0.4.5', BOUNDED)).includes('until-0.4.5'));+ assert.ok(!ids(modelsForProviderAtVersion('claude', '0.4.4', BOUNDED)).includes('since-0.4.5'));+ assert.ok(!ids(modelsForProviderAtVersion('claude', '0.4.6', BOUNDED)).includes('until-0.4.5'));+});++test('a version the filter cannot read hides nothing', () => {+ // A picker that silently loses every model is far worse than one that offers+ // a model the running build cannot use, so an unreadable version fails open.+ assert.deepEqual(ids(modelsForProviderAtVersion('claude', '', BOUNDED)), ids(BOUNDED.claude));+});++test('an unknown provider falls back to the Claude list, custom to nothing', () => {+ assert.deepEqual(modelsForProvider('not-a-provider'), modelsForProvider('claude'));+ assert.deepEqual(modelsForProvider('custom'), []);+});++test('the filter reads the version the app was built with', () => {+ // electron-vite defines __APP_VERSION__ from package.json at build time; the+ // renderer already reads it that way for the update badge.+ globalThis.__APP_VERSION__ = '1.2.3';+ try {+ assert.equal(runningAppVersion(), '1.2.3');+ } finally {+ delete globalThis.__APP_VERSION__;+ }+ assert.equal(runningAppVersion(), '');+});