opencode-mempalace-persistence 2.5.2 → 2.6.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 CHANGED
@@ -177,7 +177,8 @@ The model responds
177
177
  → Model records new KG facts via MCP tools (only when something new emerged)
178
178
 
179
179
  Session goes idle / process exits
180
- → Background mine of everything new since last sync
180
+ → Background mine of everything new since last sync (per-wing cursors:
181
+ each wing advances independently, so one slow wing never stalls the rest)
181
182
  → TUI toast confirms what was mined (disable with `"toasts": false`)
182
183
 
183
184
  Every MemPalace call — plugin searches, model MCP calls (search, diary,
package/dist/index.js CHANGED
@@ -487,11 +487,24 @@ for (mid, mts, mdata_raw) in rows:
487
487
  # is created when a reply STARTS, parts stream in afterwards, and
488
488
  # finish is set only on completion. Exporting mid-reply would
489
489
  # snapshot partial parts while the cursor advances past the message
490
- # timestamp — losing the rest of the reply forever. So assistant
491
- # messages without finish are skipped and revisited next sync.
490
+ # timestamp — losing the rest of the reply forever. So unfinished
491
+ # replies are skipped and revisited next sync — BUT only while
492
+ # recently active. A reply with no new parts for a while is dead
493
+ # (killed session, crashed run): treating it as perpetually
494
+ # in-flight would pin the cursor forever (seen live: a stillborn
495
+ # message froze sync for 7h). Dead replies are exported as-is.
496
+ now_ms = int(__import__("time").time() * 1000)
497
+ STALE_PART_MS = 30 * 60 * 1000
498
+ STALE_EMPTY_MS = 10 * 60 * 1000
492
499
  if role == "assistant" and not mdata.get("finish"):
493
- incomplete.append(mts)
494
- continue
500
+ max_part = db.execute("SELECT MAX(time_created) FROM part WHERE message_id = ?", (mid,)).fetchone()[0]
501
+ if max_part is None:
502
+ alive = (now_ms - mts) < STALE_EMPTY_MS
503
+ else:
504
+ alive = (now_ms - max_part) < STALE_PART_MS
505
+ if alive:
506
+ incomplete.append(mts)
507
+ continue
495
508
  for (pdata_raw,) in db.execute("SELECT data FROM part WHERE message_id = ? ORDER BY time_created", (mid,)).fetchall():
496
509
  try:
497
510
  pdata = json.loads(pdata_raw)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-mempalace-persistence",
3
- "version": "2.5.2",
3
+ "version": "2.6.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",