Files
openclaw/src/plugins/bundled-capability-runtime.ts
2026-03-27 13:46:17 +00:00

44 lines
1.3 KiB
TypeScript

import { createSubsystemLogger } from "../logging/subsystem.js";
import {
withBundledPluginEnablementCompat,
withBundledPluginVitestCompat,
} from "./bundled-compat.js";
import { loadOpenClawPlugins, type PluginLoadOptions } from "./loader.js";
const log = createSubsystemLogger("plugins");
export function buildBundledCapabilityRuntimeConfig(
pluginIds: readonly string[],
env?: PluginLoadOptions["env"],
): PluginLoadOptions["config"] {
const enablementCompat = withBundledPluginEnablementCompat({
config: undefined,
pluginIds,
});
return withBundledPluginVitestCompat({
config: enablementCompat,
pluginIds,
env,
});
}
export function loadBundledCapabilityRuntimeRegistry(params: {
pluginIds: readonly string[];
env?: PluginLoadOptions["env"];
pluginSdkResolution?: PluginLoadOptions["pluginSdkResolution"];
}) {
return loadOpenClawPlugins({
config: buildBundledCapabilityRuntimeConfig(params.pluginIds, params.env),
env: params.env,
onlyPluginIds: [...params.pluginIds],
pluginSdkResolution: params.pluginSdkResolution,
cache: false,
activate: false,
logger: {
info: (message) => log.info(message),
warn: (message) => log.warn(message),
error: (message) => log.error(message),
},
});
}