

























@@ -1,27 +1,66 @@
1-import { beforeEach, describe, expect, it } from "vitest";
1+import { describe, expect, it } from "vitest";
22import {
33withBundledPluginAllowlistCompat,
44withBundledPluginEnablementCompat,
55} from "../plugins/bundled-compat.js";
6-import { clearPluginDiscoveryCache } from "../plugins/discovery.js";
7-import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
6+import type { PluginManifestRecord, PluginManifestRegistry } from "../plugins/manifest-registry.js";
7+import type { PluginRegistrySnapshot } from "../plugins/plugin-registry.js";
88import { resolveEnabledProviderPluginIds } from "../plugins/providers.js";
9910-function providerRegistryEnv(): NodeJS.ProcessEnv {
10+const PROVIDER_PLUGIN_IDS = ["kilocode", "moonshot", "openrouter"] as const;
11+12+function createProviderManifestRecord(pluginId: string): PluginManifestRecord {
1113return {
12-OPENCLAW_DISABLE_PERSISTED_PLUGIN_REGISTRY: "1",
13-OPENCLAW_DISABLE_PLUGIN_DISCOVERY_CACHE: "1",
14-OPENCLAW_DISABLE_PLUGIN_MANIFEST_CACHE: "1",
15-VITEST: "1",
16-} as NodeJS.ProcessEnv;
14+id: pluginId,
15+channels: [],
16+providers: [pluginId],
17+cliBackends: [],
18+skills: [],
19+hooks: [],
20+origin: "bundled",
21+rootDir: `/virtual/${pluginId}`,
22+source: `/virtual/${pluginId}/index.ts`,
23+manifestPath: `/virtual/${pluginId}/openclaw.plugin.json`,
24+};
1725}
182619-describe("implicit provider plugin allowlist compatibility", () => {
20-beforeEach(() => {
21-clearPluginDiscoveryCache();
22-clearPluginManifestRegistryCache();
23-});
27+function createProviderRegistryRecord(pluginId: string): PluginRegistrySnapshot["plugins"][number] {
28+return {
29+ pluginId,
30+manifestPath: `/virtual/${pluginId}/openclaw.plugin.json`,
31+manifestHash: `${pluginId}-manifest-hash`,
32+rootDir: `/virtual/${pluginId}`,
33+origin: "bundled",
34+enabled: true,
35+enabledByDefault: true,
36+startup: {
37+sidecar: false,
38+memory: false,
39+deferConfiguredChannelFullLoadUntilAfterListen: false,
40+agentHarnesses: [],
41+},
42+compat: [],
43+};
44+}
45+46+const providerRegistry: PluginRegistrySnapshot = {
47+version: 1,
48+hostContractVersion: "2026.4.25",
49+compatRegistryVersion: "compat-v1",
50+migrationVersion: 1,
51+policyHash: "policy-v1",
52+generatedAtMs: 1777118400000,
53+installRecords: {},
54+plugins: PROVIDER_PLUGIN_IDS.map(createProviderRegistryRecord),
55+diagnostics: [],
56+};
245758+const providerManifestRegistry: PluginManifestRegistry = {
59+plugins: PROVIDER_PLUGIN_IDS.map(createProviderManifestRecord),
60+diagnostics: [],
61+};
62+63+describe("implicit provider plugin allowlist compatibility", () => {
2564it("keeps bundled implicit providers discoverable when plugins.allow is set", () => {
2665const config = withBundledPluginEnablementCompat({
2766config: withBundledPluginAllowlistCompat({
@@ -38,8 +77,9 @@ describe("implicit provider plugin allowlist compatibility", () => {
3877expect(
3978resolveEnabledProviderPluginIds({
4079 config,
41-env: providerRegistryEnv(),
42-onlyPluginIds: ["kilocode", "moonshot", "openrouter"],
80+registry: providerRegistry,
81+manifestRegistry: providerManifestRegistry,
82+onlyPluginIds: PROVIDER_PLUGIN_IDS,
4383}),
4484).toEqual(["kilocode", "moonshot", "openrouter"]);
4585});
@@ -61,8 +101,9 @@ describe("implicit provider plugin allowlist compatibility", () => {
61101expect(
62102resolveEnabledProviderPluginIds({
63103 config,
64-env: providerRegistryEnv(),
65-onlyPluginIds: ["kilocode", "moonshot", "openrouter"],
104+registry: providerRegistry,
105+manifestRegistry: providerManifestRegistry,
106+onlyPluginIds: PROVIDER_PLUGIN_IDS,
66107}),
67108).toEqual(["moonshot", "openrouter"]);
68109});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。