Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
test(models): align catalog contracts with models.dev
vastsa09fee7dc101e
diff --git a/apps/desktop/test/model-advanced-capabilities.test.mjs b/apps/desktop/test/model-advanced-capabilities.test.mjsindex 1deb8928f..8c8fb94e4 100644--- a/apps/desktop/test/model-advanced-capabilities.test.mjs+++ b/apps/desktop/test/model-advanced-capabilities.test.mjs@@ -223,14 +223,11 @@ test("a model the catalog does not describe still reports its binding overrides"),);for (const block of [providerBlock, sessionBlock]) {- assert.doesNotMatch(block, /modelConfigWithBinding\(/);+ assert.match(block, /modelConfigWithBinding\(/);assert.match(block, /catalogModelConfigFor\(modelsDevCatalog/);assert.match(block, /providerId: provider.id/);}- assert.doesNotMatch(- providerCatalogSource,- /const modelConfig = catalogModelConfig\s*\n\s*\? modelConfigWithBinding/,- );+ assert.match(providerCatalogSource, /resolveBindingLimits\(catalogConfig, binding\)/);});test("the advanced body is a compact sheet without helper paragraphs", () => {diff --git a/apps/desktop/test/model-cache.test.mjs b/apps/desktop/test/model-cache.test.mjsindex ec0ce7eca..5e76834f1 100644--- a/apps/desktop/test/model-cache.test.mjs+++ b/apps/desktop/test/model-cache.test.mjs@@ -14,8 +14,10 @@ test("saved provider discovery persists models in the host catalog", () => {assert.match(mainSource, /req\.source === "cache"/);assert.match(mainSource, /"providers\.listModels"/);assert.match(mainSource, /"providers\.cacheModels"/);- assert.match(mainSource, /new ModelsDevCatalog\(\)/);- assert.doesNotMatch(mainSource, /catalogPath: app\.isPackaged/);+ assert.match(mainSource, /new ModelsDevCatalog\(\{/);+ assert.match(mainSource, /catalogPath: app\.isPackaged/);+ assert.match(mainSource, /join\(process\.resourcesPath, "models\.dev", "api\.json"\)/);+ assert.match(mainSource, /join\(app\.getAppPath\(\), "resources", "models\.dev", "api\.json"\)/);assert.match(mainSource, /modelsDevCatalog\.loadLocal\(\)/);assert.match(mainSource, /modelsDevCatalog\.refresh\(\)/);assert.match(mainSource, /const modelsDevModel = .*modelsDevCatalog\.publishedModelFor/);diff --git a/apps/desktop/test/provider-lookup-model-handler.test.mjs b/apps/desktop/test/provider-lookup-model-handler.test.mjsindex 577924e31..8a6a42a52 100644--- a/apps/desktop/test/provider-lookup-model-handler.test.mjs+++ b/apps/desktop/test/provider-lookup-model-handler.test.mjs@@ -1,4 +1,3 @@-import { fixtureProvider } from "./pi-catalog-fixtures.mjs";/*** Contract test for the custom-model library lookup.*@@ -39,10 +38,9 @@ function load(relative, imports) {}async function fixtureCatalog() {- const catalog = new modelsDev.ModelsDevCatalog({ providers: [fixtureProvider("anthropic", [{- id: "claude-opus-4.6", reasoning: true, input: ["text", "image"], contextWindow: 1_000_000, maxTokens: 128_000,- thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null },- }])] });+ const catalog = new modelsDev.ModelsDevCatalog({+ catalogPath: new URL("../resources/models.dev/api.json", import.meta.url).pathname,+ });assert.equal(await catalog.ensureLoaded(), true);return catalog;}@@ -113,15 +111,15 @@ function harness(realCatalog) {return { call: (input) => handler(input), catalogCalls, hostCalls };}-test("a published id returns the snapshot record for the typed id", async (t) => {+test("a published id returns the models.dev record for the typed id", async (t) => {const h = harness(await fixtureCatalog(t));const result = await h.call({- modelId: "Claude-Opus-4.6",+ modelId: "Claude-Opus-4-6",providerId: "provider-1",vendorKey: "anthropic",});assert.ok(result.info, "a published id must return its record");- assert.equal(result.info.modelId, "claude-opus-4.6");+ assert.equal(result.info.modelId, "claude-opus-4-6");assert.equal(result.info.providerId, "provider-1");assert.equal(result.info.contextWindow, 1_000_000);assert.equal(result.info.maxTokens, 128_000);@@ -135,7 +133,7 @@ test("a published id returns the snapshot record for the typed id", async (t) =>providerId: "provider-1",vendorKey: "anthropic",baseUrl: undefined,- modelId: "Claude-Opus-4.6",+ modelId: "Claude-Opus-4-6",});assert.deepEqual(h.hostCalls, []);});