From 7b6b6401ce54a0275b7737c10f42a001bd0a05e3 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 2 May 2026 08:48:43 -0700 Subject: [PATCH] test(plugins): cover partial provider install catalog --- src/plugins/provider-install-catalog.test.ts | 116 +++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/src/plugins/provider-install-catalog.test.ts b/src/plugins/provider-install-catalog.test.ts index f79dc1185cb..5a5b8b1286e 100644 --- a/src/plugins/provider-install-catalog.test.ts +++ b/src/plugins/provider-install-catalog.test.ts @@ -621,4 +621,120 @@ describe("provider install catalog", () => { expect(resolveProviderInstallCatalogEntry("moonshot-api-key")).toBeUndefined(); }); + + it("keeps missing provider-index entries visible when only some provider plugins are installed", () => { + loadPluginRegistrySnapshot.mockReturnValue({ + version: 1, + hostContractVersion: "test", + compatRegistryVersion: "test", + migrationVersion: 1, + policyHash: "test", + generatedAtMs: 0, + installRecords: {}, + plugins: [ + { + pluginId: "moonshot", + origin: "bundled", + manifestPath: "/repo/extensions/moonshot/openclaw.plugin.json", + manifestHash: "hash", + rootDir: "/repo/extensions/moonshot", + enabled: true, + startup: { + sidecar: false, + memory: false, + deferConfiguredChannelFullLoadUntilAfterListen: false, + agentHarnesses: [], + }, + compat: [], + }, + ], + diagnostics: [], + }); + loadOpenClawProviderIndex.mockReturnValue({ + version: 1, + providers: { + groq: { + id: "groq", + name: "Groq", + plugin: { + id: "groq", + package: "@openclaw/plugin-groq", + install: { + npmSpec: "@openclaw/plugin-groq@1.0.0", + defaultChoice: "npm", + }, + }, + authChoices: [ + { + method: "api-key", + choiceId: "groq-api-key", + choiceLabel: "Groq API key", + }, + ], + }, + moonshot: { + id: "moonshot", + name: "Moonshot AI", + plugin: { + id: "moonshot", + package: "@openclaw/plugin-moonshot", + install: { + clawhubSpec: "clawhub:openclaw/moonshot@2026.5.2", + npmSpec: "@openclaw/plugin-moonshot@2026.5.2", + defaultChoice: "clawhub", + }, + }, + authChoices: [ + { + method: "api-key", + choiceId: "moonshot-api-key", + choiceLabel: "Moonshot API key", + }, + ], + }, + vllm: { + id: "vllm", + name: "vLLM", + plugin: { + id: "vllm", + package: "@openclaw/plugin-vllm", + install: { + clawhubSpec: "clawhub:openclaw/vllm@2026.5.2", + npmSpec: "@openclaw/plugin-vllm@2026.5.2", + defaultChoice: "clawhub", + }, + }, + authChoices: [ + { + method: "server", + choiceId: "vllm-server", + choiceLabel: "vLLM server", + }, + ], + }, + }, + }); + + const entries = resolveProviderInstallCatalogEntries(); + + expect(entries.map((entry) => entry.choiceId)).toEqual(["groq-api-key", "vllm-server"]); + expect(resolveProviderInstallCatalogEntry("moonshot-api-key")).toBeUndefined(); + expect(resolveProviderInstallCatalogEntry("vllm-server")).toMatchObject({ + pluginId: "vllm", + install: { + clawhubSpec: "clawhub:openclaw/vllm@2026.5.2", + npmSpec: "@openclaw/plugin-vllm@2026.5.2", + defaultChoice: "clawhub", + }, + installSource: { + defaultChoice: "clawhub", + clawhub: { + spec: "clawhub:openclaw/vllm@2026.5.2", + }, + npm: { + spec: "@openclaw/plugin-vllm@2026.5.2", + }, + }, + }); + }); });