mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:50:42 +00:00
refactor(hooks): centralize live plugin config lookup
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
resolveAgentWorkspaceDir,
|
||||
} from "openclaw/plugin-sdk/agent-runtime";
|
||||
import {
|
||||
resolvePluginConfigObject,
|
||||
resolveSessionStoreEntry,
|
||||
updateSessionStore,
|
||||
type OpenClawConfig,
|
||||
@@ -573,14 +574,10 @@ function isActiveMemoryGloballyEnabled(cfg: OpenClawConfig): boolean {
|
||||
if (entry?.enabled === false) {
|
||||
return false;
|
||||
}
|
||||
const pluginConfig = asRecord(entry?.config);
|
||||
const pluginConfig = resolvePluginConfigObject(cfg, "active-memory");
|
||||
return pluginConfig?.enabled !== false;
|
||||
}
|
||||
|
||||
function resolveActiveMemoryPluginConfigFromConfig(cfg: OpenClawConfig): unknown {
|
||||
return asRecord(cfg.plugins?.entries?.["active-memory"])?.config;
|
||||
}
|
||||
|
||||
function updateActiveMemoryGlobalEnabledInConfig(
|
||||
cfg: OpenClawConfig,
|
||||
enabled: boolean,
|
||||
@@ -1887,7 +1884,7 @@ export default definePluginEntry({
|
||||
warnDeprecatedModelFallbackPolicy(api.pluginConfig);
|
||||
const refreshLiveConfigFromRuntime = () => {
|
||||
const livePluginConfig =
|
||||
resolveActiveMemoryPluginConfigFromConfig(api.runtime.config.loadConfig()) ??
|
||||
resolvePluginConfigObject(api.runtime.config.loadConfig(), "active-memory") ??
|
||||
api.pluginConfig;
|
||||
config = normalizePluginConfig(livePluginConfig);
|
||||
warnDeprecatedModelFallbackPolicy(livePluginConfig);
|
||||
|
||||
Reference in New Issue
Block a user