mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:10:42 +00:00
fix(plugins): normalize compat allowlist aliases
This commit is contained in:
@@ -153,6 +153,30 @@ describe("implicit provider plugin allowlist compatibility", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("re-enables globally disabled plugins when allowlist mode accepts a plugin alias", () => {
|
||||
const config = withBundledPluginEnablementCompat({
|
||||
config: {
|
||||
plugins: {
|
||||
enabled: false,
|
||||
allow: [" Google-Gemini-Cli "],
|
||||
bundledDiscovery: "allowlist",
|
||||
},
|
||||
},
|
||||
pluginIds: ["google"],
|
||||
});
|
||||
|
||||
expect(config).toEqual({
|
||||
plugins: {
|
||||
enabled: true,
|
||||
allow: [" Google-Gemini-Cli "],
|
||||
bundledDiscovery: "allowlist",
|
||||
entries: {
|
||||
google: { enabled: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("still honors explicit plugin denies over compat allowlist injection", () => {
|
||||
const config = withBundledPluginEnablementCompat({
|
||||
config: withBundledPluginAllowlistCompat({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { PluginEntryConfig } from "../config/types.plugins.js";
|
||||
import { hasExplicitPluginConfig } from "./config-policy.js";
|
||||
import { normalizePluginId } from "./config-state.js";
|
||||
|
||||
export function withBundledPluginAllowlistCompat(params: {
|
||||
config: OpenClawConfig | undefined;
|
||||
@@ -45,7 +46,9 @@ export function withBundledPluginEnablementCompat(params: {
|
||||
const useCompatDiscovery = params.config?.plugins?.bundledDiscovery === "compat";
|
||||
const allow = params.config?.plugins?.allow;
|
||||
const allowSet =
|
||||
!useCompatDiscovery && Array.isArray(allow) && allow.length > 0 ? new Set(allow) : undefined;
|
||||
!useCompatDiscovery && Array.isArray(allow) && allow.length > 0
|
||||
? new Set(allow.map((pluginId) => normalizePluginId(pluginId)).filter(Boolean))
|
||||
: undefined;
|
||||
let hasEligiblePlugin = false;
|
||||
let changed = false;
|
||||
const nextEntries: Record<string, PluginEntryConfig> = { ...existingEntries };
|
||||
|
||||
Reference in New Issue
Block a user