refactor: move bundled plugin policy into manifests

This commit is contained in:
Peter Steinberger
2026-03-27 16:38:41 +00:00
parent ed055f44ae
commit ef1784d264
80 changed files with 874 additions and 459 deletions

View File

@@ -1,5 +1,9 @@
import { normalizeChatChannelId } from "../channels/registry.js";
import type { OpenClawConfig } from "../config/config.js";
import {
BUNDLED_LEGACY_PLUGIN_ID_ALIASES,
BUNDLED_PROVIDER_PLUGIN_ID_ALIASES,
} from "./bundled-capability-metadata.js";
import type { PluginRecord } from "./registry.js";
import { defaultSlotIdForKey } from "./slots.js";
@@ -28,52 +32,13 @@ export type NormalizedPluginsConfig = {
>;
};
export const BUNDLED_ENABLED_BY_DEFAULT = new Set<string>([
"amazon-bedrock",
"anthropic",
"byteplus",
"cloudflare-ai-gateway",
"deepseek",
"device-pair",
"github-copilot",
"google",
"huggingface",
"kilocode",
"kimi",
"minimax",
"mistral",
"modelstudio",
"moonshot",
"nvidia",
"ollama",
"openai",
"opencode",
"opencode-go",
"openrouter",
"phone-control",
"qianfan",
"sglang",
"synthetic",
"talk-voice",
"together",
"venice",
"vercel-ai-gateway",
"vllm",
"volcengine",
"xai",
"xiaomi",
"zai",
]);
const PLUGIN_ID_ALIASES: Readonly<Record<string, string>> = {
"openai-codex": "openai",
"kimi-coding": "kimi",
"minimax-portal-auth": "minimax",
};
export function normalizePluginId(id: string): string {
const trimmed = id.trim();
return PLUGIN_ID_ALIASES[trimmed] ?? trimmed;
return (
BUNDLED_LEGACY_PLUGIN_ID_ALIASES[trimmed] ??
BUNDLED_PROVIDER_PLUGIN_ID_ALIASES[trimmed] ??
trimmed
);
}
const normalizeList = (value: unknown): string[] => {
@@ -299,7 +264,7 @@ export function resolveEnableState(
if (entry?.enabled === true) {
return { enabled: true };
}
if (origin === "bundled" && (enabledByDefault ?? BUNDLED_ENABLED_BY_DEFAULT.has(id))) {
if (origin === "bundled" && enabledByDefault === true) {
return { enabled: true };
}
if (origin === "bundled") {