Skip to content

Commit 1b31130

Browse files
qin-ctxclaude
andauthored
fix(openclaw-memory-plugin): add missing files to download list and merge config properly (#516)
Add tsconfig.json and new source files (client.ts, process-manager.ts, memory-ranking.ts, text-utils.ts) to install scripts. Merge plugin load paths and allow list instead of overwriting existing config. Adjust default recallLimit to 6. Update uv.lock with resolved bot-full deps. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d35152e commit 1b31130

File tree

5 files changed

+52
-16
lines changed

5 files changed

+52
-16
lines changed

examples/openclaw-memory-plugin/install.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ function Download-Plugin {
326326
"examples/openclaw-memory-plugin/openclaw.plugin.json",
327327
"examples/openclaw-memory-plugin/package.json",
328328
"examples/openclaw-memory-plugin/package-lock.json",
329+
"examples/openclaw-memory-plugin/tsconfig.json",
329330
"examples/openclaw-memory-plugin/.gitignore"
330331
)
331332

@@ -386,7 +387,14 @@ function Configure-OpenClawPlugin {
386387
$mergedPaths = @($existingPaths + @($PluginDest) | Select-Object -Unique)
387388

388389
$cfg["plugins"]["enabled"] = $true
389-
$cfg["plugins"]["allow"] = @("memory-openviking")
390+
$existingAllow = @()
391+
if ($cfg["plugins"].ContainsKey("allow") -and $cfg["plugins"]["allow"]) {
392+
$existingAllow = @($cfg["plugins"]["allow"])
393+
}
394+
if ($existingAllow -notcontains "memory-openviking") {
395+
$existingAllow += "memory-openviking"
396+
}
397+
$cfg["plugins"]["allow"] = $existingAllow
390398
$cfg["plugins"]["slots"]["memory"] = "memory-openviking"
391399
$cfg["plugins"]["load"]["paths"] = $mergedPaths
392400

examples/openclaw-memory-plugin/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ download_plugin() {
561561
"examples/openclaw-memory-plugin/openclaw.plugin.json"
562562
"examples/openclaw-memory-plugin/package.json"
563563
"examples/openclaw-memory-plugin/package-lock.json"
564+
"examples/openclaw-memory-plugin/tsconfig.json"
564565
"examples/openclaw-memory-plugin/.gitignore"
565566
)
566567
local total=${#files[@]}

examples/openclaw-memory-plugin/openclaw.plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
},
6666
"recallLimit": {
6767
"label": "Recall Limit",
68-
"placeholder": "20",
68+
"placeholder": "6",
6969
"advanced": true
7070
},
7171
"recallScoreThreshold": {

examples/openclaw-memory-plugin/setup-helper/cli.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,14 @@ async function fetchPluginFromGitHub(dest) {
427427
const files = [
428428
"examples/openclaw-memory-plugin/index.ts",
429429
"examples/openclaw-memory-plugin/config.ts",
430+
"examples/openclaw-memory-plugin/client.ts",
431+
"examples/openclaw-memory-plugin/process-manager.ts",
432+
"examples/openclaw-memory-plugin/memory-ranking.ts",
433+
"examples/openclaw-memory-plugin/text-utils.ts",
430434
"examples/openclaw-memory-plugin/openclaw.plugin.json",
431435
"examples/openclaw-memory-plugin/package.json",
432436
"examples/openclaw-memory-plugin/package-lock.json",
437+
"examples/openclaw-memory-plugin/tsconfig.json",
433438
"examples/openclaw-memory-plugin/.gitignore",
434439
];
435440
await mkdir(dest, { recursive: true });
@@ -534,14 +539,22 @@ async function configureOpenclawViaCli(pluginPath, serverPort, installMode, plug
534539
}
535540
await run("openclaw", ["plugins", "install", "-l", pluginPath], extraEnv);
536541
} else {
537-
await runNoShell("openclaw", ["config", "set", "plugins.load.paths", JSON.stringify([pluginPath])], { silent: true }).catch(() => {});
542+
// Merge into existing load paths instead of overwriting
543+
let currentPaths = [];
544+
try {
545+
const rawPaths = await runCapture("openclaw", ["config", "get", "plugins.load.paths", "--json"], { ...extraEnv });
546+
currentPaths = JSON.parse(rawPaths.out || "[]");
547+
} catch {}
548+
if (!Array.isArray(currentPaths)) currentPaths = [];
549+
if (!currentPaths.includes(pluginPath)) currentPaths.push(pluginPath);
550+
await runNoShell("openclaw", ["config", "set", "plugins.load.paths", JSON.stringify(currentPaths), "--json"], { silent: true }).catch(() => {});
538551
}
539552
await runNoShell("openclaw", ["config", "set", "plugins.enabled", "true"]);
540553
// Merge into existing allow list instead of overwriting
541554
let currentAllow = [];
542555
try {
543-
const raw = await run("openclaw", ["config", "get", "plugins.allow", "--json"], { ...extraEnv, silent: true });
544-
currentAllow = JSON.parse(raw.stdout || "[]");
556+
const raw = await runCapture("openclaw", ["config", "get", "plugins.allow", "--json"], { ...extraEnv });
557+
currentAllow = JSON.parse(raw.out || "[]");
545558
} catch {}
546559
if (!Array.isArray(currentAllow)) currentAllow = [];
547560
if (!currentAllow.includes("memory-openviking")) currentAllow.push("memory-openviking");

0 commit comments

Comments
 (0)