mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 18:12:52 +00:00
refactor: move bundled plugin policy into manifests
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user