mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 07:00:42 +00:00
fix(gateway): scope memory runtime plugin loading
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { normalizePluginsConfig } from "./config-state.js";
|
||||
import { resolveRuntimePluginRegistry } from "./loader.js";
|
||||
import { getMemoryRuntime } from "./memory-state.js";
|
||||
import {
|
||||
@@ -6,13 +7,25 @@ import {
|
||||
resolvePluginRuntimeLoadContext,
|
||||
} from "./runtime/load-context.js";
|
||||
|
||||
function resolveMemoryRuntimePluginIds(config: OpenClawConfig): string[] {
|
||||
const memorySlot = normalizePluginsConfig(config.plugins).slots.memory;
|
||||
return typeof memorySlot === "string" && memorySlot.trim().length > 0 ? [memorySlot] : [];
|
||||
}
|
||||
|
||||
function ensureMemoryRuntime(cfg?: OpenClawConfig) {
|
||||
const current = getMemoryRuntime();
|
||||
if (current || !cfg) {
|
||||
return current;
|
||||
}
|
||||
const context = resolvePluginRuntimeLoadContext({ config: cfg });
|
||||
const onlyPluginIds = resolveMemoryRuntimePluginIds(context.config);
|
||||
if (onlyPluginIds.length === 0) {
|
||||
return getMemoryRuntime();
|
||||
}
|
||||
resolveRuntimePluginRegistry(
|
||||
buildPluginRuntimeLoadOptions(resolvePluginRuntimeLoadContext({ config: cfg })),
|
||||
buildPluginRuntimeLoadOptions(context, {
|
||||
onlyPluginIds,
|
||||
}),
|
||||
);
|
||||
return getMemoryRuntime();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user