fix: keep provider index previews authoritative

This commit is contained in:
Shakker
2026-04-26 04:48:29 +01:00
parent 911172e1e6
commit e827778129
3 changed files with 20 additions and 7 deletions

View File

@@ -740,7 +740,11 @@ Catalog authority order:
4. OpenClaw Provider Index preview rows.
The Provider Index must not contain secrets, enabled state, runtime hooks, or
live account-specific model data. Providers with live `/models` discovery should
live account-specific model data. Its preview catalogs use the same
`modelCatalog` provider row shape as plugin manifests, but should stay limited
to stable display metadata unless runtime adapter fields such as `api`,
`baseUrl`, pricing, or compatibility flags are intentionally kept aligned with
the installed plugin manifest. Providers with live `/models` discovery should
write refreshed rows through the explicit model catalog cache path instead of
making normal listing or onboarding call provider APIs.

View File

@@ -99,6 +99,8 @@ describe("OpenClaw provider index", () => {
it("loads the bundled provider index without runtime plugin loading", () => {
const index = loadOpenClawProviderIndex();
expect(index.providers.moonshot?.previewCatalog).not.toHaveProperty("api");
expect(index.providers.moonshot?.previewCatalog).not.toHaveProperty("baseUrl");
expect(index.providers.moonshot?.previewCatalog?.models).toEqual(
expect.arrayContaining([
expect.objectContaining({
@@ -108,5 +110,13 @@ describe("OpenClaw provider index", () => {
]),
);
expect(index.providers.deepseek?.plugin.id).toBe("deepseek");
expect(index.providers.deepseek?.previewCatalog?.models).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: "deepseek-chat",
contextWindow: 131072,
}),
]),
);
});
});

View File

@@ -3,6 +3,9 @@ import type { OpenClawProviderIndex } from "./types.js";
// OpenClaw-owned preview metadata for providers whose plugins may not be
// installed yet. Installed plugin manifests remain authoritative; this index is
// a fallback for installable-provider and pre-install model picker surfaces.
// Preview catalogs use the shared model catalog type, but intentionally keep to
// stable display fields unless runtime adapter metadata is kept in sync with
// the installed plugin manifest.
export const OPENCLAW_PROVIDER_INDEX = {
version: 1,
providers: {
@@ -15,8 +18,6 @@ export const OPENCLAW_PROVIDER_INDEX = {
docs: "/providers/moonshot",
categories: ["cloud", "llm"],
previewCatalog: {
api: "openai-responses",
baseUrl: "https://api.moonshot.ai/v1",
models: [
{
id: "kimi-k2.6",
@@ -36,21 +37,19 @@ export const OPENCLAW_PROVIDER_INDEX = {
docs: "/providers/deepseek",
categories: ["cloud", "llm"],
previewCatalog: {
api: "openai-responses",
baseUrl: "https://api.deepseek.com/v1",
models: [
{
id: "deepseek-chat",
name: "DeepSeek Chat",
input: ["text"],
contextWindow: 64000,
contextWindow: 131072,
},
{
id: "deepseek-reasoner",
name: "DeepSeek Reasoner",
input: ["text"],
reasoning: true,
contextWindow: 64000,
contextWindow: 131072,
},
],
},