Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(tinfoil): move the default chat model from glm-5-2 to glm-5-3 (#2018)
Joshua9e86381d456f
diff --git a/scripts/llm-canary.mjs b/scripts/llm-canary.mjsindex 8473270ae..283d26e33 100644--- a/scripts/llm-canary.mjs+++ b/scripts/llm-canary.mjs@@ -38,7 +38,10 @@ const PROVIDERS = [id: "tinfoil",keyEnv: "LLM_CANARY_TINFOIL_KEY",base: "https://inference.tinfoil.sh/v1",- models: ["gpt-oss-120b", "deepseek-v4-flash", "llama3-3-70b"],+ // glm-5-3 is the registry default, so it is the model most Tinfoil users+ // are on — and the Tinfoil transport has no param-stripping ladder, so a+ // reasoning-param rejection there hard-errors (#1611).+ models: ["glm-5-3", "gpt-oss-120b", "deepseek-v4-flash", "llama3-3-70b"],},{id: "gemini",@@ -169,8 +172,12 @@ for (const entry of PROVIDERS) {report.push(`| ${label} | _catalog_ | ⚠️ ${diff.error} |`);} else {if (diff.vanished.length) {- report.push(`| ${label} | _catalog_ | ⚠️ registry ids missing live: ${diff.vanished.join(", ")} |`);- failures.push(`${label}: registry ids vanished from live catalog: ${diff.vanished.join(", ")}`);+ report.push(+ `| ${label} | _catalog_ | ⚠️ registry ids missing live: ${diff.vanished.join(", ")} |`+ );+ failures.push(+ `${label}: registry ids vanished from live catalog: ${diff.vanished.join(", ")}`+ );}if (diff.newConstrained.length) {report.push(diff --git a/src/components/onboarding/ProviderSetupStep.tsx b/src/components/onboarding/ProviderSetupStep.tsxindex 8c76fcbc5..4327521b9 100644--- a/src/components/onboarding/ProviderSetupStep.tsx+++ b/src/components/onboarding/ProviderSetupStep.tsx@@ -23,6 +23,7 @@ import {type CloudProviderData,type TranscriptionProviderData,} from "../../models/ModelRegistry";+import { pickDefaultModelId } from "../../models/providerDefaultModel";import type { OnboardingStepId } from "./flow";import { forgetPendingLocalModel, rememberPendingLocalModel } from "./pendingLocalModels";import { isLocalStageDownloadActive } from "./localDownloadState";@@ -286,8 +287,7 @@ export function ByokProviderStep({};const chooseProvider = (providerId: string) => {- const provider = providers.find((item) => item.id === providerId);- const fallbackModel = provider?.models[0]?.id ?? "";+ const fallbackModel = pickDefaultModelId(providers.find((item) => item.id === providerId));setSelectedProvider(providerId);setSelectedModel(fallbackModel);setDraftApiKey(providerCredential(providerId, store).value);diff --git a/src/config/retiredCloudModels.ts b/src/config/retiredCloudModels.tsnew file mode 100644index 000000000..6e66533db--- /dev/null+++ b/src/config/retiredCloudModels.ts@@ -0,0 +1,98 @@+/**+ * Cloud models their providers have retired. A scope still pointing at one 404s+ * on every request, so the sweep below repoints it at startup — before the+ * first request and without a network round-trip.+ *+ * This is deliberately separate from the live-catalog reconcile in+ * models/tinfoilModels.ts, which cannot cover the same ground: that one only+ * repairs a selection after a successful fetch, so it misses an offline launch+ * and loses the race against the first request of a session.+ *+ * Each provider's remap is one-shot, keyed by its own sentinel: repointing a+ * selection the user never chose is a repair, but doing it again to a model+ * they picked back would be the app arguing with them.+ *+ * That makes the sentinel, not the table, the unit of work: an id added under a+ * key a released build already writes reaches nobody who has launched it, so+ * add the id AND rotate that provider's `migratedKey`. The snapshot in+ * test/helpers/retiredCloudModels.test.js trips on either edit, which forces+ * the decision into the diff but cannot check you made it.+ */+export interface RetiredProviderModels {+ migratedKey: string;+ models: Record<string, string>;+}++export const RETIRED_CLOUD_MODELS: Record<string, RetiredProviderModels> = {+ // Retired 2026-08-16. The key predates this table and is already set on+ // installed apps, so it stays exactly as it shipped.+ groq: {+ migratedKey: "_retiredGroqModelsMigrated",+ models: {+ "qwen/qwen3-32b": "openai/gpt-oss-120b",+ "llama-3.3-70b-versatile": "openai/gpt-oss-120b",+ "llama-3.1-8b-instant": "openai/gpt-oss-20b",+ },+ },+ // All three shipped as seed entries — deepseek-v4-pro and kimi-k2-6 through+ // v1.7.6, glm-5-2 until this release — so anyone who simply took a default+ // can be on one. This key has not shipped yet, so the set could still grow.+ tinfoil: {+ migratedKey: "_retiredTinfoilModelsMigrated",+ models: {+ "glm-5-2": "glm-5-3",+ "deepseek-v4-pro": "deepseek-v4-flash",+ "kimi-k2-6": "kimi-k3",+ },+ },+};++interface RetiredModelStorage {+ getItem(key: string): string | null;+ setItem(key: string, value: string): void;+}++interface ScopeStorageKeys {+ provider: string;+ model: string;+}++export interface SweptModelSelection {+ storeKey: string;+ provider: string;+ from: string;+ to: string;+}++/**+ * Repoints every scope selecting a retired model at its replacement, reporting+ * what it rewrote so the caller can log it and tell the user.+ */+export function sweepRetiredCloudModelSelections(+ storage: RetiredModelStorage,+ scopes: readonly ScopeStorageKeys[]+): SweptModelSelection[] {+ const swept: SweptModelSelection[] = [];++ for (const [providerId, entry] of Object.entries(RETIRED_CLOUD_MODELS)) {+ try {+ if (storage.getItem(entry.migratedKey) === "1") continue;++ for (const keys of scopes) {+ if (storage.getItem(keys.provider) !== providerId) continue;+ const from = storage.getItem(keys.model);+ const to = from ? entry.models[from] : undefined;+ if (!from || !to) continue;+ storage.setItem(keys.model, to);+ swept.push({ storeKey: keys.model, provider: providerId, from, to });+ }++ storage.setItem(entry.migratedKey, "1");+ } catch {+ // A storage failure leaves this provider's sentinel unset, so the next+ // launch retries; a scope repointed before the failure is then a no-op.+ }+ }++ return swept;+}diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex c473a7623..643b57434 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -2645,8 +2645,7 @@"anthropic_claude_opus_4_7": "Leistungsstarkes Opus-Modell","anthropic_claude_opus_4_6": "Vorherige Opus-Generation, 1M Kontext","anthropic_claude_opus_4_5": "Früheres Opus-Modell",- "tinfoil_deepseek_v4_pro": "Privates Long-Context-Reasoning in sicheren Enklaven, 800K Kontext",- "tinfoil_glm_5_2": "Privates agentisches Engineering-Modell in sicheren Enklaven, 384K Kontext",+ "tinfoil_glm_5_3": "Privates agentisches Coding-Modell in sicheren Enklaven, 1M Kontext","tinfoil_gemma4_31b": "Privates mehrsprachiges Reasoning-Modell mit Tool-Aufrufen, 256K Kontext","tinfoil_gpt_oss_120b": "Privates Open-Weight-Reasoning-Modell mit Tool-Nutzung, 131K Kontext","tinfoil_llama3_3_70b": "Privates Konversationsmodell mit Tool-Aufrufen, 128K Kontext",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 01bef4ea2..1c8cf0d03 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -2645,8 +2645,7 @@"anthropic_claude_opus_4_7": "Powerful Opus model","anthropic_claude_opus_4_6": "Previous Opus generation, 1M context","anthropic_claude_opus_4_5": "Earlier Opus model",- "tinfoil_deepseek_v4_pro": "Private long-context reasoning in secure enclaves, 800K context",- "tinfoil_glm_5_2": "Private agentic engineering model in secure enclaves, 384K context",+ "tinfoil_glm_5_3": "Private agentic coding model in secure enclaves, 1M context","tinfoil_gemma4_31b": "Private multilingual reasoning model with tool calling, 256K context","tinfoil_gpt_oss_120b": "Private open-weight reasoning model with tool use, 131K context","tinfoil_llama3_3_70b": "Private conversational model with tool calling, 128K context",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 12845189f..b2ea829a8 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -2600,8 +2600,7 @@"anthropic_claude_opus_4_7": "Modelo Opus potente","anthropic_claude_opus_4_6": "Generación anterior de Opus, contexto de 1M","anthropic_claude_opus_4_5": "Modelo Opus anterior",- "tinfoil_deepseek_v4_pro": "Razonamiento privado de contexto largo en enclaves seguros, contexto de 800K",- "tinfoil_glm_5_2": "Modelo privado de ingeniería agéntica en enclaves seguros, contexto de 384K",+ "tinfoil_glm_5_3": "Modelo privado de programación agéntica en enclaves seguros, contexto de 1M","tinfoil_gemma4_31b": "Modelo privado de razonamiento multilingüe con llamada a herramientas, contexto de 256K","tinfoil_gpt_oss_120b": "Modelo privado de razonamiento de pesos abiertos con uso de herramientas, contexto de 131K","tinfoil_llama3_3_70b": "Modelo privado conversacional con llamada a herramientas, contexto de 128K",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 14359842d..6d56b1320 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -2645,8 +2645,7 @@"anthropic_claude_opus_4_7": "Modèle Opus puissant","anthropic_claude_opus_4_6": "Génération Opus précédente, contexte 1M","anthropic_claude_opus_4_5": "Modèle Opus antérieur",- "tinfoil_deepseek_v4_pro": "Raisonnement privé à long contexte dans des enclaves sécurisées, contexte 800K",- "tinfoil_glm_5_2": "Modèle privé d'ingénierie agentique dans des enclaves sécurisées, contexte 384K",+ "tinfoil_glm_5_3": "Modèle privé de codage agentique dans des enclaves sécurisées, contexte 1M","tinfoil_gemma4_31b": "Modèle privé de raisonnement multilingue avec appel d'outils, contexte 256K","tinfoil_gpt_oss_120b": "Modèle privé de raisonnement à poids ouverts avec usage d'outils, contexte 131K","tinfoil_llama3_3_70b": "Modèle privé conversationnel avec appel d'outils, contexte 128K",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex c0149e555..3b30649f4 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -2552,8 +2552,7 @@"anthropic_claude_opus_4_7": "Modello Opus potente","anthropic_claude_opus_4_6": "Generazione Opus precedente, contesto da 1M","anthropic_claude_opus_4_5": "Modello Opus meno recente",- "tinfoil_deepseek_v4_pro": "Ragionamento privato a contesto lungo in enclave sicure, contesto 800K",- "tinfoil_glm_5_2": "Modello privato di ingegneria agentica in enclave sicure, contesto 384K",+ "tinfoil_glm_5_3": "Modello privato di coding agentico in enclave sicure, contesto 1M","tinfoil_gemma4_31b": "Modello privato di ragionamento multilingue con chiamata di strumenti, contesto 256K","tinfoil_gpt_oss_120b": "Modello privato di ragionamento open-weight con uso di strumenti, contesto 131K","tinfoil_llama3_3_70b": "Modello privato conversazionale con chiamata di strumenti, contesto 128K",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 4ea49df14..793324443 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -2552,8 +2552,7 @@"anthropic_claude_opus_4_7": "高性能な Opus モデル","anthropic_claude_opus_4_6": "前世代の Opus、100 万トークンコンテキスト","anthropic_claude_opus_4_5": "旧世代の Opus モデル",- "tinfoil_deepseek_v4_pro": "セキュアエンクレーブ内のプライベート長文脈推論、800K コンテキスト",- "tinfoil_glm_5_2": "セキュアエンクレーブ内のプライベート・エージェント型エンジニアリングモデル、384K コンテキスト",+ "tinfoil_glm_5_3": "セキュアエンクレーブ内のプライベート・エージェント型コーディングモデル、1M コンテキスト","tinfoil_gemma4_31b": "ツール呼び出し対応のプライベート多言語推論モデル、256K コンテキスト","tinfoil_gpt_oss_120b": "ツール使用対応のプライベート・オープンウェイト推論モデル、131K コンテキスト","tinfoil_llama3_3_70b": "ツール呼び出し対応のプライベート会話モデル、128K コンテキスト",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 327bd40ef..a2d456470 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -2531,8 +2531,7 @@"anthropic_claude_opus_4_7": "Modelo Opus potente","anthropic_claude_opus_4_6": "Geração anterior do Opus, contexto de 1M","anthropic_claude_opus_4_5": "Modelo Opus mais antigo",- "tinfoil_deepseek_v4_pro": "Raciocínio privado de contexto longo em enclaves seguros, contexto de 800K",- "tinfoil_glm_5_2": "Modelo privado de engenharia agêntica em enclaves seguros, contexto de 384K",+ "tinfoil_glm_5_3": "Modelo privado de programação agêntica em enclaves seguros, contexto de 1M","tinfoil_gemma4_31b": "Modelo privado de raciocínio multilíngue com chamada de ferramentas, contexto de 256K","tinfoil_gpt_oss_120b": "Modelo privado de raciocínio de pesos abertos com uso de ferramentas, contexto de 131K","tinfoil_llama3_3_70b": "Modelo privado conversacional com chamada de ferramentas, contexto de 128K",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex bd4a33f45..204ad2665 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -2568,8 +2568,7 @@"anthropic_claude_opus_4_7": "Мощная модель Opus","anthropic_claude_opus_4_6": "Предыдущее поколение Opus, контекст 1M","anthropic_claude_opus_4_5": "Более ранняя модель Opus",- "tinfoil_deepseek_v4_pro": "Приватное рассуждение с длинным контекстом в защищённых анклавах, контекст 800K",- "tinfoil_glm_5_2": "Приватная агентная инженерная модель в защищённых анклавах, контекст 384K",+ "tinfoil_glm_5_3": "Приватная агентная модель для программирования в защищённых анклавах, контекст 1M","tinfoil_gemma4_31b": "Приватная многоязычная модель рассуждений с вызовом инструментов, контекст 256K","tinfoil_gpt_oss_120b": "Приватная модель рассуждений с открытыми весами и использованием инструментов, контекст 131K","tinfoil_llama3_3_70b": "Приватная разговорная модель с вызовом инструментов, контекст 128K",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex b9db87e56..93a22b1b9 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -2552,8 +2552,7 @@"anthropic_claude_opus_4_7": "强大的 Opus 模型","anthropic_claude_opus_4_6": "上一代 Opus,1M 上下文","anthropic_claude_opus_4_5": "更早的 Opus 模型",- "tinfoil_deepseek_v4_pro": "安全飞地中的私密长上下文推理,800K 上下文",- "tinfoil_glm_5_2": "安全飞地中的私密智能体工程模型,384K 上下文",+ "tinfoil_glm_5_3": "安全飞地中的私密智能体编程模型,1M 上下文","tinfoil_gemma4_31b": "支持工具调用的私密多语言推理模型,256K 上下文","tinfoil_gpt_oss_120b": "支持工具使用的私密开源权重推理模型,131K 上下文","tinfoil_llama3_3_70b": "支持工具调用的私密对话模型,128K 上下文",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 30158c461..9d62156b6 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -2552,8 +2552,7 @@"anthropic_claude_opus_4_7": "強大的 Opus 模型","anthropic_claude_opus_4_6": "上一代 Opus 模型,1M 上下文","anthropic_claude_opus_4_5": "較早的 Opus 模型",- "tinfoil_deepseek_v4_pro": "安全飛地中的私密長上下文推理,800K 上下文",- "tinfoil_glm_5_2": "安全飛地中的私密智能體工程模型,384K 上下文",+ "tinfoil_glm_5_3": "安全飛地中的私密智能體程式設計模型,1M 上下文","tinfoil_gemma4_31b": "支援工具呼叫的私密多語言推理模型,256K 上下文","tinfoil_gpt_oss_120b": "支援工具使用的私密開放權重推理模型,131K 上下文","tinfoil_llama3_3_70b": "支援工具呼叫的私密對話模型,128K 上下文",diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.tsindex f24bb7077..d9168a27c 100644--- a/src/models/ModelRegistry.ts+++ b/src/models/ModelRegistry.ts@@ -52,6 +52,8 @@ export interface CloudModelDefinition {export interface CloudProviderData {id: string;name: string;+ /** Named default for providers whose list order isn't ours — see pickProviderDefaultModel. */+ defaultModel?: string;models: CloudModelDefinition[];}@@ -305,6 +307,10 @@ export function getTinfoilModels(): CloudModelDefinition[] {return getTinfoilCloudProvider()?.models ?? [];}+export function getCloudProviderDefaultModelId(providerId: string): string | undefined {+ return modelData.cloudProviders.find((provider) => provider.id === providerId)?.defaultModel;+}+export function applyTinfoilModels(models: CloudModelDefinition[]): void {const provider = getTinfoilCloudProvider();if (provider) {diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.jsonindex 5c18c4f37..fa0c4824f 100644--- a/src/models/modelRegistryData.json+++ b/src/models/modelRegistryData.json@@ -598,14 +598,15 @@{"id": "tinfoil","name": "Tinfoil",+ "defaultModel": "glm-5-3","models": [{- "id": "glm-5-2",- "name": "GLM-5.2",- "description": "Private agentic engineering model in secure enclaves, 384K context",+ "id": "glm-5-3",+ "name": "GLM-5.3",+ "description": "Private agentic coding model in secure enclaves, 1M context","tokenParam": "max_tokens","supportsTemperature": true,- "descriptionKey": "models.descriptions.cloud.tinfoil_glm_5_2",+ "descriptionKey": "models.descriptions.cloud.tinfoil_glm_5_3","supportsThinking": true},{diff --git a/src/models/providerDefaultModel.ts b/src/models/providerDefaultModel.tsnew file mode 100644index 000000000..5be888b01--- /dev/null+++ b/src/models/providerDefaultModel.ts@@ -0,0 +1,27 @@+/**+ * A provider's default model. Static registry lists are ordered best-first, so+ * position is the rule; a live catalog (Tinfoil) is ordered by the provider, so+ * it names its default in the registry and that name wins instead.+ *+ * Kept import-free so the settings store can use it: ModelRegistry imports the+ * store, so the store cannot import ModelRegistry back.+ */+export function pickProviderDefaultModel<T extends { id: string }>(+ models: readonly T[] | undefined,+ defaultModelId: string | undefined+): T | undefined {+ return models?.find((model) => model.id === defaultModelId) ?? models?.[0];+}++interface ProviderWithModels {+ models?: readonly { id: string }[];+ defaultModel?: string;+}++/**+ * Empty when the provider ships no models. Takes the provider so no caller has+ * to know that naming a default is optional.+ */+export function pickDefaultModelId(provider: ProviderWithModels | undefined): string {+ return pickProviderDefaultModel(provider?.models, provider?.defaultModel)?.id ?? "";+}diff --git a/src/models/tinfoilModels.ts b/src/models/tinfoilModels.tsindex 23c6ea614..ef736ade9 100644--- a/src/models/tinfoilModels.ts+++ b/src/models/tinfoilModels.ts@@ -1,4 +1,10 @@-import { applyTinfoilModels, getTinfoilModels, type CloudModelDefinition } from "./ModelRegistry";+import {+ applyTinfoilModels,+ getCloudProviderDefaultModelId,+ getTinfoilModels,+ type CloudModelDefinition,+} from "./ModelRegistry";+import { pickProviderDefaultModel } from "./providerDefaultModel";import {isCachedListFresh,readCachedTinfoilModels,@@ -20,9 +26,8 @@ export interface TinfoilCatalogModel {* Curated, translated descriptions keyed by model id. The endpoint only returns* English copy.*/-const DESCRIPTION_KEYS: Record<string, string> = {- "deepseek-v4-pro": "models.descriptions.cloud.tinfoil_deepseek_v4_pro",- "glm-5-2": "models.descriptions.cloud.tinfoil_glm_5_2",+export const DESCRIPTION_KEYS: Record<string, string> = {+ "glm-5-3": "models.descriptions.cloud.tinfoil_glm_5_3","gemma4-31b": "models.descriptions.cloud.tinfoil_gemma4_31b","gpt-oss-120b": "models.descriptions.cloud.tinfoil_gpt_oss_120b","llama3-3-70b": "models.descriptions.cloud.tinfoil_llama3_3_70b",@@ -40,12 +45,10 @@ function toCloudModels(catalog: TinfoilCatalogModel[]): CloudModelDefinition[] {}));}-const DEFAULT_MODEL_ID = "glm-5-2";-export function pickDefaultTinfoilModel(models: CloudModelDefinition[]): CloudModelDefinition | undefined {- return models.find((model) => model.id === DEFAULT_MODEL_ID) ?? models[0];+ return pickProviderDefaultModel(models, getCloudProviderDefaultModelId("tinfoil"));}/**diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex 0262a625a..da518e2e0 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -14,6 +14,7 @@ import type {import type { CalendarAccount } from "../types/calendar";import { PROMPT_KIND_LIST, type PromptKind } from "../config/prompts/registry";import { sweepRetiredPromptOverrides } from "../config/retiredPrompts";+import { sweepRetiredCloudModelSelections } from "../config/retiredCloudModels";import {deriveReasoningMode,buildReasoningScopePatches,@@ -29,6 +30,11 @@ import {import { normalizeChineseScriptPreference } from "../utils/chineseScript";import { adjustBedrockModelForRegion } from "../utils/bedrockRegions";import modelRegistryData from "../models/modelRegistryData.json";+import { pickDefaultModelId } from "../models/providerDefaultModel";+// Both are leaves: tinfoilModelCache imports only a type from ModelRegistry and+// the switch store only zustand, so neither reopens the ModelRegistry cycle.+import { readCachedTinfoilModels } from "../models/tinfoilModelCache";+import { recordTinfoilModelSwitch } from "./tinfoilModelSwitchStore";import {getTranscriptionSelection,isScreenContextAllowed,@@ -148,8 +154,7 @@ function defaultLlmModel(mode: InferenceMode, providerId: string, bedrockRegion:: mode === "enterprise"? modelRegistryData.enterpriseProviders: modelRegistryData.cloudProviders;- const defaultModel =- providers.find((provider) => provider.id === providerId)?.models[0]?.id ?? "";+ const defaultModel = pickDefaultModelId(providers.find(({ id }) => id === providerId));return mode === "enterprise" && providerId === "bedrock"? adjustBedrockModelForRegion(defaultModel, bedrockRegion): defaultModel;@@ -591,29 +596,47 @@ function migrateLLMScopeKeys() {migrateLLMScopeKeys();-// Groq retired these models on 2026-08-16, so a scope still pointing at one-// 404s on every request. Remap to the closest replacement Groq still serves.-// Runs after migrateLLMScopeKeys so scope values live under their final keys.-const RETIRED_GROQ_MODELS: Record<string, string> = {- "qwen/qwen3-32b": "openai/gpt-oss-120b",- "llama-3.3-70b-versatile": "openai/gpt-oss-120b",- "llama-3.1-8b-instant": "openai/gpt-oss-20b",-};+// Resolved offline, so a retired model's name survives only in the user's own+// catalog cache and a replacement's only if we seed it. The raw-id fallback is+// what the live-catalog reconcile shows too.+function tinfoilModelName(modelId: string): string {+ const named =+ readCachedTinfoilModels().models.find((model) => model.id === modelId) ??+ modelRegistryData.cloudProviders+ .find((provider) => provider.id === "tinfoil")+ ?.models.find((model) => model.id === modelId);+ return named?.name ?? modelId;+}-function migrateRetiredGroqModels() {+// A scope still pointing at a model its provider has retired 404s on every+// request. Runs after migrateLLMScopeKeys so scope values live under their+// final keys, and before the store reads them, so the first request of the+// session already carries a model the provider serves.+function migrateRetiredCloudModels() {if (!isBrowser) return;- if (localStorage.getItem("_retiredGroqModelsMigrated") === "1") return;+ const swept = sweepRetiredCloudModelSelections(+ localStorage,+ Object.values(INFERENCE_SCOPES).map(({ storeKeys }) => storeKeys)+ );+ if (swept.length === 0) return;- for (const { storeKeys } of Object.values(INFERENCE_SCOPES)) {- if (localStorage.getItem(storeKeys.provider) !== "groq") continue;- const replacement = RETIRED_GROQ_MODELS[localStorage.getItem(storeKeys.model) ?? ""];- if (replacement) localStorage.setItem(storeKeys.model, replacement);- }+ logger.info(+ "Repointed retired cloud model selections",+ { scopes: swept.map(({ storeKey }) => storeKey) },+ "settings"+ );- localStorage.setItem("_retiredGroqModelsMigrated", "1");+ // Tinfoil is the one provider that tells the user their model was switched+ // out, and getting here first means reconcileSelectedModels no longer will.+ const announced = new Set<string>();+ for (const { provider, from, to } of swept) {+ if (provider !== "tinfoil" || announced.has(from)) continue;+ announced.add(from);+ recordTinfoilModelSwitch({ from: tinfoilModelName(from), to: tinfoilModelName(to) });+ }}-migrateRetiredGroqModels();+migrateRetiredCloudModels();export interface SettingsStateextends@@ -2867,7 +2890,7 @@ export function reconcileRetiredCloudModelSelections(): void {if (!provider || !model || provider === "tinfoil") continue;const providerDef = modelRegistryData.cloudProviders.find((p) => p.id === provider);if (!providerDef || reasoningModelBelongsToProvider(provider, model)) continue;- const replacement = providerDef.models[0]?.id;+ const replacement = pickDefaultModelId(providerDef);if (!replacement) continue;setStringSetting(scope.storeKeys.model as keyof SettingsState, replacement);logger.info(diff --git a/test/helpers/retiredCloudModels.test.js b/test/helpers/retiredCloudModels.test.jsnew file mode 100644index 000000000..85fb4791c--- /dev/null+++ b/test/helpers/retiredCloudModels.test.js@@ -0,0 +1,173 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const load = () => import("../../src/config/retiredCloudModels.ts");++const CLEANUP = { provider: "cleanupProvider", model: "cleanupModel" };+const CHAT = { provider: "chatAgentProvider", model: "chatAgentModel" };++const makeStorage = (initial = {}) => {+ const map = new Map(Object.entries(initial));+ return {+ map,+ getItem(key) {+ return map.has(key) ? map.get(key) : null;+ },+ setItem(key, value) {+ map.set(key, String(value));+ },+ };+};++test("remaps a scope pinned to a model Tinfoil retired", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ const storage = makeStorage({ cleanupProvider: "tinfoil", cleanupModel: "glm-5-2" });++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), [+ { storeKey: "cleanupModel", provider: "tinfoil", from: "glm-5-2", to: "glm-5-3" },+ ]);+ assert.equal(storage.map.get("cleanupModel"), "glm-5-3");+});++test("remaps every other Tinfoil model the app has offered and Tinfoil has since retired", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ // Both shipped as seed defaults and are both gone from the live catalog now,+ // so they 404 exactly like glm-5-2 did.+ const storage = makeStorage({+ cleanupProvider: "tinfoil",+ cleanupModel: "deepseek-v4-pro",+ chatAgentProvider: "tinfoil",+ chatAgentModel: "kimi-k2-6",+ });++ sweepRetiredCloudModelSelections(storage, [CLEANUP, CHAT]);++ assert.equal(storage.map.get("cleanupModel"), "deepseek-v4-flash");+ assert.equal(storage.map.get("chatAgentModel"), "kimi-k3");+});++test("still remaps the models Groq retired", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ const storage = makeStorage({+ cleanupProvider: "groq",+ cleanupModel: "llama-3.3-70b-versatile",+ chatAgentProvider: "groq",+ chatAgentModel: "qwen/qwen3-32b",+ });++ sweepRetiredCloudModelSelections(storage, [CLEANUP, CHAT]);++ assert.equal(storage.map.get("cleanupModel"), "openai/gpt-oss-120b");+ assert.equal(storage.map.get("chatAgentModel"), "openai/gpt-oss-120b");+});++test("leaves a model the provider still serves alone", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ const storage = makeStorage({ cleanupProvider: "tinfoil", cleanupModel: "gpt-oss-120b" });++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), []);+ assert.equal(storage.map.get("cleanupModel"), "gpt-oss-120b");+});++test("a retired id under a different provider is not remapped", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ // Someone self-hosting GLM-5.2 behind the custom provider keeps their model.+ const storage = makeStorage({ cleanupProvider: "custom", cleanupModel: "glm-5-2" });++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), []);+ assert.equal(storage.map.get("cleanupModel"), "glm-5-2");+});++test("each provider's remap is one-shot, so a re-picked model is left alone", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ const storage = makeStorage({ cleanupProvider: "tinfoil", cleanupModel: "glm-5-2" });++ sweepRetiredCloudModelSelections(storage, [CLEANUP]);+ storage.setItem("cleanupModel", "glm-5-2");++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), []);+ assert.equal(storage.map.get("cleanupModel"), "glm-5-2");+});++test("Groq's already-shipped sentinel does not suppress another provider's remap", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ // Anyone upgrading from a build that ran the Groq-only migration carries it.+ const storage = makeStorage({+ _retiredGroqModelsMigrated: "1",+ cleanupProvider: "tinfoil",+ cleanupModel: "glm-5-2",+ });++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), [+ { storeKey: "cleanupModel", provider: "tinfoil", from: "glm-5-2", to: "glm-5-3" },+ ]);+ assert.equal(storage.map.get("cleanupModel"), "glm-5-3");+});++test("a provider whose sentinel is already set is skipped", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ const storage = makeStorage({+ _retiredGroqModelsMigrated: "1",+ cleanupProvider: "groq",+ cleanupModel: "llama-3.3-70b-versatile",+ });++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), []);+ assert.equal(storage.map.get("cleanupModel"), "llama-3.3-70b-versatile");+});++test("no replacement is itself retired, and every provider has its own sentinel", async () => {+ const { RETIRED_CLOUD_MODELS } = await load();+ const sentinels = new Set();++ for (const [provider, entry] of Object.entries(RETIRED_CLOUD_MODELS)) {+ assert.ok(!sentinels.has(entry.migratedKey), `${provider} reuses another provider's sentinel`);+ sentinels.add(entry.migratedKey);++ for (const [retired, replacement] of Object.entries(entry.models)) {+ assert.notEqual(retired, replacement, `${provider}: ${retired} maps to itself`);+ assert.ok(+ !(replacement in entry.models),+ `${provider}: ${retired} maps to ${replacement}, which is itself retired`+ );+ }+ }+});++// The sweep is one-shot per sentinel, so an id added under a key installed apps+// already carry never runs. Tripping on either edit is what forces the rotation+// into the diff — this cannot check it happened.+test("each provider's sentinel is pinned to the exact set of ids it covers", async () => {+ const { RETIRED_CLOUD_MODELS } = await load();++ const covered = Object.fromEntries(+ Object.entries(RETIRED_CLOUD_MODELS).map(([provider, entry]) => [+ provider,+ { migratedKey: entry.migratedKey, retired: Object.keys(entry.models).sort() },+ ])+ );++ assert.deepEqual(covered, {+ groq: {+ migratedKey: "_retiredGroqModelsMigrated",+ retired: ["llama-3.1-8b-instant", "llama-3.3-70b-versatile", "qwen/qwen3-32b"],+ },+ tinfoil: {+ migratedKey: "_retiredTinfoilModelsMigrated",+ retired: ["deepseek-v4-pro", "glm-5-2", "kimi-k2-6"],+ },+ });+});++test("a storage that cannot be written leaves the sentinel unset, so the next launch retries", async () => {+ const { sweepRetiredCloudModelSelections } = await load();+ const storage = makeStorage({ cleanupProvider: "tinfoil", cleanupModel: "glm-5-2" });+ storage.setItem = () => {+ throw new Error("QuotaExceededError");+ };++ assert.deepEqual(sweepRetiredCloudModelSelections(storage, [CLEANUP]), []);+ assert.equal(storage.map.get("_retiredTinfoilModelsMigrated"), undefined);+ // Groq shares the storage but not the failure's blast radius.+ assert.equal(storage.map.get("_retiredGroqModelsMigrated"), undefined);+});diff --git a/test/helpers/tinfoilCatalog.test.js b/test/helpers/tinfoilCatalog.test.jsindex 4a32cdb4a..9eab600fe 100644--- a/test/helpers/tinfoilCatalog.test.js+++ b/test/helpers/tinfoilCatalog.test.js@@ -30,8 +30,8 @@ function okResponse(data) {}const CHAT_MODEL = {- id: "glm-5-2",- name: "GLM-5.2",+ id: "glm-5-3",+ name: "GLM-5.3",description: "d",type: "chat",reasoning: true,@@ -49,7 +49,7 @@ test("keeps only chat models reachable at /v1/chat/completions", async () => {);assert.deepEqual(await getTinfoilChatModels(), [- { id: "glm-5-2", name: "GLM-5.2", description: "d", supportsThinking: true },+ { id: "glm-5-3", name: "GLM-5.3", description: "d", supportsThinking: true },]);});diff --git a/test/helpers/tinfoilDefaultModel.test.js b/test/helpers/tinfoilDefaultModel.test.jsnew file mode 100644index 000000000..3695e501f--- /dev/null+++ b/test/helpers/tinfoilDefaultModel.test.js@@ -0,0 +1,228 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");++const modelRegistryData = require("../../src/models/modelRegistryData.json");+const english = require("../../src/locales/en/translation.json");++// Tinfoil retires GLM-5.2 on 2026-09-10 (replaced by glm-5-3) and its live+// /v1/models list already omits it. The default lookup must follow, otherwise+// every reconciled selection lands on whatever Tinfoil happens to list first.+const LIVE_CATALOG = [+ { id: "deepseek-v4-flash", name: "DeepSeek V4 Flash", description: "", supportsThinking: true },+ { id: "glm-5-3", name: "GLM-5.3", description: "", supportsThinking: true },+ { id: "gpt-oss-120b", name: "GPT-OSS 120B", description: "", supportsThinking: true },+];++test("tinfoil default model follows the glm-5-3 replacement", async (t) => {+ installBrowserGlobals(t);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tinfoil-default-model-test-",+ });+ const { pickDefaultTinfoilModel } = await vite.ssrLoadModule("/models/tinfoilModels.ts");++ await t.test("picks glm-5-3 even when Tinfoil lists another model first", () => {+ assert.equal(pickDefaultTinfoilModel(LIVE_CATALOG)?.id, "glm-5-3");+ });++ await t.test("still falls back to the first served model when the default is gone", () => {+ assert.equal(pickDefaultTinfoilModel(LIVE_CATALOG.slice(0, 1))?.id, "deepseek-v4-flash");+ });++ await t.test("registry names the default and no longer ships glm-5-2", () => {+ const tinfoil = modelRegistryData.cloudProviders.find((provider) => provider.id === "tinfoil");+ assert.equal(tinfoil.defaultModel, "glm-5-3");+ assert.ok(+ !tinfoil.models.some((model) => model.id === "glm-5-2"),+ "retired id must be out of the seed"+ );+ });++ await t.test("every curated description key resolves in English", async () => {+ const { DESCRIPTION_KEYS } = await vite.ssrLoadModule("/models/tinfoilModels.ts");+ for (const key of Object.values(DESCRIPTION_KEYS)) {+ const path = key.split(".");+ const value = path.reduce((node, segment) => node?.[segment], english);+ assert.equal(typeof value, "string", `${key} is missing from en`);+ assert.ok(value.length > 0, `${key} is empty in en`);+ }+ });+});++// Tinfoil's catalog is fetched live and cached, so its order is Tinfoil's, not+// ours. Anything that resolves a default from list position lands on whatever+// the enclave happens to serve first — deepseek-v4-flash today.+test("a cached catalog does not displace the named Tinfoil default", async (t) => {+ installBrowserGlobals(t, {+ initialStorage: {+ _llmScopeKeysMigrated: "1",+ tinfoilModels: JSON.stringify({ models: LIVE_CATALOG, fetchedAt: Date.now() }),+ cleanupMode: "providers",+ cleanupProvider: "openai",+ cleanupModel: "gpt-5-mini",+ },+ });+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tinfoil-cached-default-test-",+ });+ // Loading the registry applies the cached list, exactly as app startup does.+ await vite.ssrLoadModule("/models/ModelRegistry.ts");+ const { useSettingsStore, selectPolicyEffectiveSettings } = await vite.ssrLoadModule(+ "/stores/settingsStore.ts"+ );++ const effective = selectPolicyEffectiveSettings(useSettingsStore.getState(), {+ status: "managed",+ appVersion: "1.9.2",+ policy: {+ version: 1,+ transcription: { allowedModes: ["local"], allowedByokProviders: [] },+ llm: {+ allowedModes: ["providers"],+ allowedByokProviders: ["tinfoil"],+ allowedEnterpriseProviders: [],+ },+ features: { agentEnabled: true, webSearchEnabled: true },+ sharing: { externalLinkSharing: "allowed" },+ dataRetention: {+ audioRetentionMaxDays: null,+ localHistoryMode: "user_choice",+ cloudBackupAllowed: true,+ },+ minAppVersion: null,+ },+ });++ assert.equal(effective.cleanupProvider, "tinfoil");+ assert.equal(effective.cleanupModel, "glm-5-3");+});++test("a persisted glm-5-2 selection is repointed before any request", async (t) => {+ installBrowserGlobals(t, {+ initialStorage: {+ _llmScopeKeysMigrated: "1",+ cleanupMode: "providers",+ cleanupProvider: "tinfoil",+ cleanupModel: "glm-5-2",+ },+ });+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tinfoil-retired-selection-test-",+ });+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");++ // No catalog fetch and no network: the store repairs the selection on load,+ // so the first request of the session already carries a served model.+ assert.equal(useSettingsStore.getState().cleanupModel, "glm-5-3");+});++// The app tells a user when Tinfoil retires the model they picked. The startup+// sweep now moves them before the live-catalog reconcile can, so the notice has+// to come from the sweep or it is lost.+test("the retirement notice fires when the startup sweep is what moved the user", async (t) => {+ installBrowserGlobals(t, {+ initialStorage: {+ _llmScopeKeysMigrated: "1",+ // The user's own cached catalog is the only place the retired model's+ // display name still exists; the replacement's comes from the seed.+ tinfoilModels: JSON.stringify({+ models: [{ id: "glm-5-2", name: "GLM-5.2", description: "", supportsThinking: true }],+ fetchedAt: Date.now(),+ }),+ cleanupMode: "providers",+ cleanupProvider: "tinfoil",+ cleanupModel: "glm-5-2",+ chatAgentProvider: "tinfoil",+ chatAgentModel: "glm-5-2",+ },+ });+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tinfoil-sweep-notice-test-",+ });+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");+ const { consumeTinfoilModelSwitches } = await vite.ssrLoadModule(+ "/stores/tinfoilModelSwitchStore.ts"+ );++ assert.equal(useSettingsStore.getState().cleanupModel, "glm-5-3");+ // Two scopes moved, but the user is told about the model once.+ assert.deepEqual(consumeTinfoilModelSwitches(), [{ from: "GLM-5.2", to: "GLM-5.3" }]);+});++test("a Groq remap is not announced as a Tinfoil retirement", async (t) => {+ installBrowserGlobals(t, {+ initialStorage: {+ _llmScopeKeysMigrated: "1",+ cleanupMode: "providers",+ cleanupProvider: "groq",+ cleanupModel: "llama-3.3-70b-versatile",+ },+ });+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-groq-sweep-notice-test-",+ });+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");+ const { consumeTinfoilModelSwitches } = await vite.ssrLoadModule(+ "/stores/tinfoilModelSwitchStore.ts"+ );++ assert.equal(useSettingsStore.getState().cleanupModel, "openai/gpt-oss-120b");+ assert.deepEqual(consumeTinfoilModelSwitches(), []);+});++// Every live site that resolves a provider's default reads the name the+// registry gives it, through one helper.+test("a provider's named default beats its list position", async (t) => {+ installBrowserGlobals(t);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-provider-default-hops-test-",+ });+ const { pickDefaultModelId } = await vite.ssrLoadModule("/models/providerDefaultModel.ts");++ const byId = Object.fromEntries(+ modelRegistryData.cloudProviders.map((provider) => [provider.id, provider])+ );++ await t.test("the shared helper prefers the named default over list position", () => {+ // The seed leads with its own default, so only a list that doesn't can+ // tell the two rules apart.+ assert.equal(+ pickDefaultModelId({ models: [{ id: "listed-first" }, { id: "named" }], defaultModel: "named" }),+ "named"+ );+ assert.equal(pickDefaultModelId(byId.tinfoil), "glm-5-3");+ });++ await t.test("a provider that names no default still leads with its first model", () => {+ assert.equal(pickDefaultModelId(byId.openai), byId.openai.models[0].id);+ assert.equal(pickDefaultModelId(undefined), "");+ });+});++// The sweep runs before any fetch, so a replacement outside the curated seed+// has no display name to show yet. Naming it by id keeps the notice truthful+// rather than dropping it; reconcileSelectedModels degrades the same way.+test("a replacement with no curated name is still announced, by id", async (t) => {+ installBrowserGlobals(t, {+ initialStorage: {+ _llmScopeKeysMigrated: "1",+ tinfoilModels: JSON.stringify({+ models: [{ id: "kimi-k2-6", name: "Kimi K2.6", description: "", supportsThinking: true }],+ fetchedAt: Date.now(),+ }),+ cleanupMode: "providers",+ cleanupProvider: "tinfoil",+ cleanupModel: "kimi-k2-6",+ },+ });+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tinfoil-unnamed-replacement-test-",+ });+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");+ const { consumeTinfoilModelSwitches } = await vite.ssrLoadModule(+ "/stores/tinfoilModelSwitchStore.ts"+ );++ assert.equal(useSettingsStore.getState().cleanupModel, "kimi-k3");+ assert.deepEqual(consumeTinfoilModelSwitches(), [{ from: "Kimi K2.6", to: "kimi-k3" }]);+});