mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-21 22:21:33 +00:00
refactor: derive bundled contracts from extension manifests
This commit is contained in:
41
src/plugins/bundled-capability-runtime.ts
Normal file
41
src/plugins/bundled-capability-runtime.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
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"];
|
||||
}) {
|
||||
return loadOpenClawPlugins({
|
||||
config: buildBundledCapabilityRuntimeConfig(params.pluginIds, params.env),
|
||||
env: params.env,
|
||||
onlyPluginIds: [...params.pluginIds],
|
||||
cache: false,
|
||||
activate: false,
|
||||
logger: {
|
||||
info: (message) => log.info(message),
|
||||
warn: (message) => log.warn(message),
|
||||
error: (message) => log.error(message),
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user