From 5e715de6c573f7741510677e459bd8858f42b6c7 Mon Sep 17 00:00:00 2001 From: Shakker Date: Sat, 25 Apr 2026 02:16:19 +0100 Subject: [PATCH] test: preserve model catalog manifest metadata --- src/plugins/manifest-registry.test.ts | 125 ++++++++++++++++++++++++++ src/plugins/manifest-registry.ts | 3 + 2 files changed, 128 insertions(+) diff --git a/src/plugins/manifest-registry.test.ts b/src/plugins/manifest-registry.test.ts index 192fd0f4a3f..53856775f9a 100644 --- a/src/plugins/manifest-registry.test.ts +++ b/src/plugins/manifest-registry.test.ts @@ -478,6 +478,131 @@ describe("loadPluginManifestRegistry", () => { ]); }); + it("preserves model catalog metadata from plugin manifests", () => { + const dir = makeTempDir(); + writeManifest(dir, { + id: "moonshot", + providers: ["moonshot"], + modelCatalog: { + providers: { + moonshot: { + baseUrl: "https://api.moonshot.ai/v1", + api: "openai-responses", + headers: { + "x-provider": "moonshot", + }, + models: [ + { + id: "kimi-k2.6", + name: "Kimi K2.6", + input: ["text", "image", "bogus"], + reasoning: true, + contextWindow: 256000, + maxTokens: 128000, + cost: { + input: 0.6, + output: 2.5, + cacheRead: 0.15, + tieredPricing: [ + { + input: 0.6, + output: 2.5, + range: [0, 256000], + }, + ], + }, + compat: { + supportsTools: true, + }, + status: "available", + tags: ["default"], + }, + ], + }, + }, + aliases: { + kimi: { + provider: "moonshot", + api: "openai-responses", + }, + }, + suppressions: [ + { + provider: "openai", + model: "legacy-kimi", + reason: "superseded by moonshot/kimi-k2.6", + }, + ], + discovery: { + moonshot: "static", + ignored: "unknown", + }, + }, + configSchema: { type: "object" }, + }); + + const registry = loadSingleCandidateRegistry({ + idHint: "moonshot", + rootDir: dir, + origin: "bundled", + }); + + expect(registry.plugins[0]?.modelCatalog).toEqual({ + providers: { + moonshot: { + baseUrl: "https://api.moonshot.ai/v1", + api: "openai-responses", + headers: { + "x-provider": "moonshot", + }, + models: [ + { + id: "kimi-k2.6", + name: "Kimi K2.6", + input: ["text", "image"], + reasoning: true, + contextWindow: 256000, + maxTokens: 128000, + cost: { + input: 0.6, + output: 2.5, + cacheRead: 0.15, + tieredPricing: [ + { + input: 0.6, + output: 2.5, + range: [0, 256000], + }, + ], + }, + compat: { + supportsTools: true, + }, + status: "available", + tags: ["default"], + }, + ], + }, + }, + aliases: { + kimi: { + provider: "moonshot", + api: "openai-responses", + }, + }, + suppressions: [ + { + provider: "openai", + model: "legacy-kimi", + reason: "superseded by moonshot/kimi-k2.6", + }, + ], + discovery: { + moonshot: "static", + }, + }); + }); + it("reports non-bundled providerAuthEnvVars as deprecated compat metadata", () => { const dir = makeTempDir(); writeManifest(dir, { diff --git a/src/plugins/manifest-registry.ts b/src/plugins/manifest-registry.ts index 1da837c777f..21d1640ae09 100644 --- a/src/plugins/manifest-registry.ts +++ b/src/plugins/manifest-registry.ts @@ -36,6 +36,7 @@ import { type PluginManifestChannelConfig, type PluginManifestContracts, type PluginManifestMediaUnderstandingProviderMetadata, + type PluginManifestModelCatalog, type PluginManifestModelSupport, type PluginManifestProviderEndpoint, type PluginManifestQaRunner, @@ -110,6 +111,7 @@ export type PluginManifestRecord = { providers: string[]; providerDiscoverySource?: string; modelSupport?: PluginManifestModelSupport; + modelCatalog?: PluginManifestModelCatalog; providerEndpoints?: PluginManifestProviderEndpoint[]; cliBackends: string[]; syntheticAuthRefs?: string[]; @@ -373,6 +375,7 @@ function buildRecord(params: { ) : undefined, modelSupport: params.manifest.modelSupport, + modelCatalog: params.manifest.modelCatalog, providerEndpoints: params.manifest.providerEndpoints, cliBackends: params.manifest.cliBackends ?? [], syntheticAuthRefs: params.manifest.syntheticAuthRefs ?? [],