opencode-mempalace-persistence 2.7.1 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -380,6 +380,28 @@ function mempalaceSearch(query) {
|
|
|
380
380
|
function isMemPalaceTool(name) {
|
|
381
381
|
return typeof name === "string" && name.toLowerCase().includes("mempalace");
|
|
382
382
|
}
|
|
383
|
+
// MCP tool results arrive as content blocks ({content: [{type, text}]),
|
|
384
|
+
// NOT as a flat `output` string (diagnosed via shape logging 2026-09-19:
|
|
385
|
+
// keys=["content"], no `output` key at all).
|
|
386
|
+
function extractResultText(out) {
|
|
387
|
+
try {
|
|
388
|
+
const blocks = out?.content;
|
|
389
|
+
if (Array.isArray(blocks)) {
|
|
390
|
+
const text = blocks
|
|
391
|
+
.filter((b) => b && (b.type === "text" || typeof b.text === "string") && typeof b.text === "string")
|
|
392
|
+
.map((b) => String(b.text))
|
|
393
|
+
.join("\n");
|
|
394
|
+
if (text.trim())
|
|
395
|
+
return text;
|
|
396
|
+
}
|
|
397
|
+
if (typeof out?.output === "string" && out.output.trim())
|
|
398
|
+
return out.output;
|
|
399
|
+
if (typeof out === "string" && out.trim())
|
|
400
|
+
return out;
|
|
401
|
+
}
|
|
402
|
+
catch { }
|
|
403
|
+
return "";
|
|
404
|
+
}
|
|
383
405
|
function summarizeToolCall(tool, args, out) {
|
|
384
406
|
const short = tool.replace(/^mcp_+/, "").replace(/^mempalace_mempalace_/, "").replace(/^mempalace_/, "");
|
|
385
407
|
let asked = "";
|
|
@@ -390,8 +412,8 @@ function summarizeToolCall(tool, args, out) {
|
|
|
390
412
|
catch {
|
|
391
413
|
asked = "";
|
|
392
414
|
}
|
|
393
|
-
const answered = (out
|
|
394
|
-
return `${short} · asked: ${asked} → ${answered}`.slice(0,
|
|
415
|
+
const answered = extractResultText(out).replace(/\s+/g, " ").slice(0, 120) || "(empty)";
|
|
416
|
+
return `${short} · asked: ${asked} → ${answered}`.slice(0, 260);
|
|
395
417
|
}
|
|
396
418
|
function readSyncState() {
|
|
397
419
|
try {
|
|
@@ -922,7 +944,7 @@ export default (async ({ client }) => {
|
|
|
922
944
|
const name = input?.tool || "";
|
|
923
945
|
if (!isMemPalaceTool(name))
|
|
924
946
|
return;
|
|
925
|
-
const summary = summarizeToolCall(name, input?.args, output
|
|
947
|
+
const summary = summarizeToolCall(name, input?.args, output);
|
|
926
948
|
log(`tool: ${summary}`);
|
|
927
949
|
toast("info", "MemPalace", summary);
|
|
928
950
|
// Diagnostic: MCP results may live outside `output` — record the
|
|
@@ -936,7 +958,7 @@ export default (async ({ client }) => {
|
|
|
936
958
|
catch {
|
|
937
959
|
return "";
|
|
938
960
|
} })(),
|
|
939
|
-
answered:
|
|
961
|
+
answered: extractResultText(output).replace(/\s+/g, " ").slice(0, 300),
|
|
940
962
|
shape: {
|
|
941
963
|
keys: Object.keys(outAny),
|
|
942
964
|
title: outAny.title,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-mempalace-persistence",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "OpenCode plugin — auto-sync conversations to MemPalace memory in real-time. No forced wings, KG extraction via MCP tools.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|