refactor: use memory slot defaults in core paths · openclaw/openclaw@03846d6
steipete
·
2026-04-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,6 +7,7 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
|
7 | 7 | import type { PluginInstallRecord } from "../config/types.plugins.js"; |
8 | 8 | import { enablePluginInConfig } from "../plugins/enable.js"; |
9 | 9 | import { listMarketplacePlugins } from "../plugins/marketplace.js"; |
| 10 | +import { defaultSlotIdForKey } from "../plugins/slots.js"; |
10 | 11 | import { formatPluginSourceForTable, resolvePluginSourceRoots } from "../plugins/source-display.js"; |
11 | 12 | import { |
12 | 13 | buildAllPluginInspectReports, |
@@ -579,7 +580,7 @@ export function registerPluginsCli(program: Command) {
|
579 | 580 | preview.push("load path"); |
580 | 581 | } |
581 | 582 | if (cfg.plugins?.slots?.memory === pluginId) { |
582 | | -preview.push(`memory slot (will reset to "memory-core")`); |
| 583 | +preview.push(`memory slot (will reset to "${defaultSlotIdForKey("memory")}")`); |
583 | 584 | } |
584 | 585 | const channelIds = plugin?.status === "loaded" ? plugin.channelIds : undefined; |
585 | 586 | const channels = cfg.channels as Record<string, unknown> | undefined; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ import { normalizeControlUiBasePath } from "../gateway/control-ui-shared.js";
|
5 | 5 | import { resolveGatewayProbeTarget } from "../gateway/probe-target.js"; |
6 | 6 | import type { probeGateway as probeGatewayFn } from "../gateway/probe.js"; |
7 | 7 | import type { MemoryProviderStatus } from "../memory-host-sdk/engine-storage.js"; |
| 8 | +import { defaultSlotIdForKey } from "../plugins/slots.js"; |
8 | 9 | import { |
9 | 10 | normalizeOptionalLowercaseString, |
10 | 11 | normalizeOptionalString, |
@@ -76,7 +77,7 @@ export function resolveMemoryPluginStatus(cfg: OpenClawConfig): MemoryPluginStat
|
76 | 77 | if (normalizeOptionalLowercaseString(raw) === "none") { |
77 | 78 | return { enabled: false, slot: null, reason: 'plugins.slots.memory="none"' }; |
78 | 79 | } |
79 | | -return { enabled: true, slot: raw || "memory-core" }; |
| 80 | +return { enabled: true, slot: raw || defaultSlotIdForKey("memory") }; |
80 | 81 | } |
81 | 82 | |
82 | 83 | export async function resolveGatewayProbeSnapshot(params: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,6 +8,7 @@ import { resolveMainSessionKey } from "../config/sessions.js";
|
8 | 8 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
9 | 9 | import { logWarn } from "../logger.js"; |
10 | 10 | import { isTestDefaultMemorySlotDisabled } from "../plugins/config-state.js"; |
| 11 | +import { defaultSlotIdForKey } from "../plugins/slots.js"; |
11 | 12 | import { |
12 | 13 | normalizeOptionalLowercaseString, |
13 | 14 | normalizeOptionalString, |
@@ -193,7 +194,7 @@ export async function handleToolsInvokeHttpRequest(
|
193 | 194 | type: "invalid_request", |
194 | 195 | message: |
195 | 196 | `memory tools are disabled in tests${suffix}. ` + |
196 | | -'Enable by setting plugins.slots.memory="memory-core" (and ensure plugins.enabled is not false).', |
| 197 | +`Enable by setting plugins.slots.memory="${defaultSlotIdForKey("memory")}" (and ensure plugins.enabled is not false).`, |
197 | 198 | }, |
198 | 199 | }); |
199 | 200 | return true; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,6 +21,7 @@ import {
|
21 | 21 | } from "./config-normalization-shared.js"; |
22 | 22 | import { loadPluginManifestRegistry } from "./manifest-registry.js"; |
23 | 23 | import type { PluginOrigin } from "./plugin-origin.types.js"; |
| 24 | +import { defaultSlotIdForKey } from "./slots.js"; |
24 | 25 | |
25 | 26 | export type { PluginActivationSource }; |
26 | 27 | export type PluginActivationState = PluginActivationStateLike; |
@@ -101,7 +102,10 @@ const hasExplicitMemorySlot = (plugins?: OpenClawConfig["plugins"]) =>
|
101 | 102 | Boolean(plugins?.slots && Object.prototype.hasOwnProperty.call(plugins.slots, "memory")); |
102 | 103 | |
103 | 104 | const hasExplicitMemoryEntry = (plugins?: OpenClawConfig["plugins"]) => |
104 | | -Boolean(plugins?.entries && Object.prototype.hasOwnProperty.call(plugins.entries, "memory-core")); |
| 105 | +Boolean( |
| 106 | +plugins?.entries && |
| 107 | +Object.prototype.hasOwnProperty.call(plugins.entries, defaultSlotIdForKey("memory")), |
| 108 | +); |
105 | 109 | |
106 | 110 | export const hasExplicitPluginConfig = (plugins?: OpenClawConfig["plugins"]) => |
107 | 111 | hasExplicitPluginConfigShared(plugins); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,6 +2,7 @@ import { collectConfiguredAgentHarnessRuntimes } from "../agents/harness-runtime
|
2 | 2 | import { listPotentialConfiguredChannelIds } from "../channels/config-presence.js"; |
3 | 3 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
4 | 4 | import { |
| 5 | +DEFAULT_MEMORY_DREAMING_PLUGIN_ID, |
5 | 6 | resolveMemoryDreamingConfig, |
6 | 7 | resolveMemoryDreamingPluginConfig, |
7 | 8 | resolveMemoryDreamingPluginId, |
@@ -49,7 +50,7 @@ function resolveGatewayStartupDreamingPluginIds(config: OpenClawConfig): Set<str
|
49 | 50 | if (!dreamingConfig.enabled) { |
50 | 51 | return new Set(); |
51 | 52 | } |
52 | | -return new Set(["memory-core", resolveMemoryDreamingPluginId(config)]); |
| 53 | +return new Set([DEFAULT_MEMORY_DREAMING_PLUGIN_ID, resolveMemoryDreamingPluginId(config)]); |
53 | 54 | } |
54 | 55 | |
55 | 56 | function resolveExplicitMemorySlotStartupPluginId(config: OpenClawConfig): string | undefined { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。