opencode-mempalace-persistence 2.3.0 → 2.4.0
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/README.md +4 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +34 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,6 +181,10 @@ Session goes idle / process exits
|
|
|
181
181
|
→ Background mine of everything new since last sync
|
|
182
182
|
→ TUI toast confirms what was mined (disable with `"toasts": false`)
|
|
183
183
|
|
|
184
|
+
Every MemPalace call — plugin searches, model MCP calls (search, diary,
|
|
185
|
+
KG) — also raises a short TUI toast with what was asked and a result
|
|
186
|
+
preview, so background memory activity is always visible.
|
|
187
|
+
|
|
184
188
|
Compaction starts
|
|
185
189
|
→ [MemPalace Pre-Compact Emergency Save]: model files everything first
|
|
186
190
|
→ Identity + wake-up context re-attached so the summary cannot lose them
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,16 @@ declare const _default: ({ client }: any) => Promise<{
|
|
|
24
24
|
context: string[];
|
|
25
25
|
prompt?: string;
|
|
26
26
|
}) => Promise<void>;
|
|
27
|
+
"tool.execute.after": (input: {
|
|
28
|
+
tool: string;
|
|
29
|
+
sessionID: string;
|
|
30
|
+
callID: string;
|
|
31
|
+
args: any;
|
|
32
|
+
}, output: {
|
|
33
|
+
title: string;
|
|
34
|
+
output: string;
|
|
35
|
+
metadata: any;
|
|
36
|
+
}) => Promise<void>;
|
|
27
37
|
event: ({ event }: any) => Promise<void>;
|
|
28
38
|
}>;
|
|
29
39
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -251,14 +251,36 @@ function mempalaceSearch(query) {
|
|
|
251
251
|
encoding: "utf-8",
|
|
252
252
|
timeout: 15000,
|
|
253
253
|
}).trim();
|
|
254
|
-
if (!out || out.includes("No results"))
|
|
254
|
+
if (!out || out.includes("No results")) {
|
|
255
|
+
toast("info", "MemPalace", `search "${query.slice(0, 50)}" → no results`);
|
|
255
256
|
return "";
|
|
257
|
+
}
|
|
258
|
+
const n = (out.match(/\n\s*\[\d+\]/g) || []).length || 1;
|
|
259
|
+
toast("info", "MemPalace", `search "${query.slice(0, 50)}" → ${n} result(s)`);
|
|
256
260
|
return out.slice(0, MAX_INJECT_CHARS);
|
|
257
261
|
}
|
|
258
262
|
catch {
|
|
259
263
|
return "";
|
|
260
264
|
}
|
|
261
265
|
}
|
|
266
|
+
// TUI visibility for model-driven MCP calls (skill recall, diary, KG):
|
|
267
|
+
// the plugin can't see inside the agent, but it sees every tool result.
|
|
268
|
+
function isMemPalaceTool(name) {
|
|
269
|
+
return typeof name === "string" && name.toLowerCase().includes("mempalace");
|
|
270
|
+
}
|
|
271
|
+
function summarizeToolCall(tool, args, out) {
|
|
272
|
+
const short = tool.replace(/^mcp_+/, "").replace(/^mempalace_mempalace_/, "").replace(/^mempalace_/, "");
|
|
273
|
+
let asked = "";
|
|
274
|
+
try {
|
|
275
|
+
const a = typeof args === "string" ? args : JSON.stringify(args || {});
|
|
276
|
+
asked = a.replace(/\s+/g, " ").slice(0, 60);
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
asked = "";
|
|
280
|
+
}
|
|
281
|
+
const answered = (out || "").replace(/\s+/g, " ").slice(0, 80) || "(empty)";
|
|
282
|
+
return `${short} · asked: ${asked} → ${answered}`.slice(0, 220);
|
|
283
|
+
}
|
|
262
284
|
function getLastSync() {
|
|
263
285
|
if (!existsSync(STATE_FILE))
|
|
264
286
|
return 0;
|
|
@@ -652,6 +674,17 @@ export default (async ({ client }) => {
|
|
|
652
674
|
output.context.push(`[MemPalace Rescue — core memory, must survive compaction]\n${rescue.join("\n\n")}`);
|
|
653
675
|
}
|
|
654
676
|
},
|
|
677
|
+
"tool.execute.after": async (input, output) => {
|
|
678
|
+
try {
|
|
679
|
+
const name = input?.tool || "";
|
|
680
|
+
if (!isMemPalaceTool(name))
|
|
681
|
+
return;
|
|
682
|
+
const summary = summarizeToolCall(name, input?.args, output?.output || "");
|
|
683
|
+
log(`tool: ${summary}`);
|
|
684
|
+
toast("info", "MemPalace", summary);
|
|
685
|
+
}
|
|
686
|
+
catch { }
|
|
687
|
+
},
|
|
655
688
|
event: async ({ event }) => {
|
|
656
689
|
if (event?.type === "session.idle" || event?.type === "session.deleted") {
|
|
657
690
|
log(`${event.type} - queue sync`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-mempalace-persistence",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
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",
|