openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
41 lines (40 loc) • 1.77 kB
JavaScript
import { t as createSubsystemLogger } from "./subsystem-Dy2tqXOS.js";
import "./logging-DB4bVraC.js";
//#region src/plugins/runtime/load-context.ts
const log = createSubsystemLogger("plugins");
const pluginRuntimeLoadContext = Symbol.for("openclaw.pluginRuntimeLoadContext");
function setPluginRuntimeLoadContext(registry, context) {
registry[pluginRuntimeLoadContext] = context;
}
/** Reads load facts carried by an exact lifecycle-owned registry. */
const getPluginRuntimeLoadContext = (registry) => registry?.[pluginRuntimeLoadContext];
/** Creates the default plugin runtime loader logger. */
function createPluginRuntimeLoaderLogger() {
return {
info: (message) => log.info(message),
warn: (message) => log.warn(message),
error: (message) => log.error(message),
debug: (message) => log.debug(message)
};
}
/** Builds plugin load options from a resolved runtime load context. */
function buildPluginRuntimeLoadOptions(context, overrides) {
return buildPluginRuntimeLoadOptionsFromValues(context, overrides);
}
/** Builds plugin load options from explicit runtime load values. */
function buildPluginRuntimeLoadOptionsFromValues(values, overrides) {
return {
config: values.config,
activationSourceConfig: values.activationSourceConfig,
autoEnabledReasons: values.autoEnabledReasons,
workspaceDir: values.workspaceDir,
env: values.env,
logger: values.logger,
manifestRegistry: values.manifestRegistry,
installRecords: values.installRecords,
preferBuiltPluginArtifacts: values.preferBuiltPluginArtifacts,
...overrides
};
}
//#endregion
export { setPluginRuntimeLoadContext as a, getPluginRuntimeLoadContext as i, buildPluginRuntimeLoadOptionsFromValues as n, createPluginRuntimeLoaderLogger as r, buildPluginRuntimeLoadOptions as t };