opencode-mempalace-persistence 2.5.0 → 2.5.1
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 +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,8 +82,23 @@ function toastsEnabled() {
|
|
|
82
82
|
catch { }
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
|
-
//
|
|
86
|
-
|
|
85
|
+
// Messages arrived after the sync cursor: still waiting for the next run.
|
|
86
|
+
function countPendingMessages(sinceMs) {
|
|
87
|
+
try {
|
|
88
|
+
const out = runPython(`
|
|
89
|
+
import sqlite3
|
|
90
|
+
db = sqlite3.connect(${JSON.stringify(OPENCODE_DB)})
|
|
91
|
+
n = db.execute("SELECT COUNT(*) FROM message WHERE time_created > ${sinceMs}").fetchone()[0]
|
|
92
|
+
db.close()
|
|
93
|
+
print(n)
|
|
94
|
+
`);
|
|
95
|
+
const n = parseInt(out.trim(), 10);
|
|
96
|
+
return isNaN(n) ? 0 : n;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
87
102
|
let cachedName = undefined;
|
|
88
103
|
let cachedVersion = undefined;
|
|
89
104
|
function pluginName() {
|
|
@@ -577,8 +592,11 @@ function doDbSync() {
|
|
|
577
592
|
const names = [...wings.keys()].join(", ");
|
|
578
593
|
const totalDrawers = [...wingDrawers.values()].reduce((a, b) => a + b, 0);
|
|
579
594
|
const detail = totalDrawers > 0 ? ` (${totalDrawers} drawers)` : "";
|
|
580
|
-
|
|
581
|
-
|
|
595
|
+
// Anything that arrived while this mine was running stays pending.
|
|
596
|
+
const remaining = countPendingMessages(now);
|
|
597
|
+
const tail = remaining > 0 ? `, ${remaining} message(s) still waiting` : ", queue empty";
|
|
598
|
+
toast("success", "MemPalace", `mined ${wingCount(wings)} session(s) → ${names}${detail}${tail}`);
|
|
599
|
+
ilog("mine", { outcome: "ok", sessions: wingCount(wings), wings: [...wings.keys()], drawers: totalDrawers, remaining });
|
|
582
600
|
return;
|
|
583
601
|
}
|
|
584
602
|
const [wing, files] = entries[i];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-mempalace-persistence",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
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",
|