mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
29 lines
897 B
TypeScript
29 lines
897 B
TypeScript
import type { PluginLogger } from "../plugins/types.js";
|
|
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
|
import { loadConfig } from "../config/config.js";
|
|
import { createSubsystemLogger } from "../logging.js";
|
|
import { loadOpenClawPlugins } from "../plugins/loader.js";
|
|
|
|
const log = createSubsystemLogger("plugins");
|
|
let pluginRegistryLoaded = false;
|
|
|
|
export function ensurePluginRegistryLoaded(): void {
|
|
if (pluginRegistryLoaded) {
|
|
return;
|
|
}
|
|
const config = loadConfig();
|
|
const workspaceDir = resolveAgentWorkspaceDir(config, resolveDefaultAgentId(config));
|
|
const logger: PluginLogger = {
|
|
info: (msg) => log.info(msg),
|
|
warn: (msg) => log.warn(msg),
|
|
error: (msg) => log.error(msg),
|
|
debug: (msg) => log.debug(msg),
|
|
};
|
|
loadOpenClawPlugins({
|
|
config,
|
|
workspaceDir,
|
|
logger,
|
|
});
|
|
pluginRegistryLoaded = true;
|
|
}
|