refactor: share plugin runtime load context

This commit is contained in:
Peter Steinberger
2026-04-06 15:26:12 +01:00
parent 9568cceee3
commit 58f4099a4f
14 changed files with 507 additions and 214 deletions

View File

@@ -1,19 +1,19 @@
import type { OpenClawConfig } from "../config/config.js";
import { applyPluginAutoEnable } from "../config/plugin-auto-enable.js";
import { resolveRuntimePluginRegistry } from "./loader.js";
import { getMemoryRuntime } from "./memory-state.js";
import {
buildPluginRuntimeLoadOptions,
resolvePluginRuntimeLoadContext,
} from "./runtime/load-context.js";
function ensureMemoryRuntime(cfg?: OpenClawConfig) {
const current = getMemoryRuntime();
if (current || !cfg) {
return current;
}
const autoEnabled = applyPluginAutoEnable({ config: cfg, env: process.env });
resolveRuntimePluginRegistry({
config: autoEnabled.config,
activationSourceConfig: cfg,
autoEnabledReasons: autoEnabled.autoEnabledReasons,
});
resolveRuntimePluginRegistry(
buildPluginRuntimeLoadOptions(resolvePluginRuntimeLoadContext({ config: cfg })),
);
return getMemoryRuntime();
}