mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:50:42 +00:00
test: preserve model catalog manifest metadata
This commit is contained in:
@@ -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, {
|
||||
|
||||
@@ -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 ?? [],
|
||||
|
||||
Reference in New Issue
Block a user