@vshulcz/pi-deja 0.23.0 → 0.23.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  English | [中文](https://github.com/vshulcz/deja-vu/blob/main/extensions/pi/docs/zh.md)
4
4
 
5
5
  pi remembers its own sessions. This extension answers the other question: what
6
- was done in the forty-one other coding agents on this machine — Claude Code,
6
+ was done in the forty-two other coding agents on this machine — Claude Code,
7
7
  Codex, Cursor, Gemini, OpenClaw and Hermes among them — including the months
8
8
  before pi was installed.
9
9
 
package/index.ts CHANGED
@@ -187,7 +187,9 @@ export default function (pi: any) {
187
187
  // quiet reminder that memory is on rather than a one-off toast.
188
188
  const stats = run(["statusline"], "");
189
189
  if (stats) ctx.ui.setStatus("deja", stats);
190
- return { message: { customType: "deja-recall", content: digest, display: false } };
190
+ // Marked, so a resume can tell the digest from a prompt's recall
191
+ // (#5314).
192
+ return { message: { customType: "deja-recall", content: digest, display: false, details: { digest: true } } };
191
193
  }
192
194
  // Nothing to recall: either there is no history yet, or the first
193
195
  // index is still building. Only the second is worth saying, once.
package/lib.mjs CHANGED
@@ -73,8 +73,16 @@ export function sessionKey(event, ctx) {
73
73
  // compaction, and the entries it kept from before it, firstKeptEntryId on.
74
74
  // pi keeps the block as a custom_message and sends it again on a resume, and
75
75
  // a fork copies it from its source.
76
+ //
77
+ // What counts is the start digest, not any recall: a prompt's recall goes
78
+ // under the same customType, and a compaction that kept a later one but not
79
+ // the digest left a resumed session with no digest (#5314). The digest
80
+ // carries details.digest; a branch with no marked digest anywhere was written
81
+ // before the mark, and any block of ours still counts there.
76
82
  export function branchHoldsRecall(branch) {
77
83
  const entries = Array.isArray(branch) ? branch : []
84
+ const marked = entries.some(isDigest)
85
+ const counts = (e) => (marked ? isDigest(e) : e.type === "custom_message" && e.customType === "deja-recall")
78
86
  let keep = ""
79
87
  for (let i = entries.length - 1; i >= 0; i--) {
80
88
  const e = entries[i] || {}
@@ -83,8 +91,14 @@ export function branchHoldsRecall(branch) {
83
91
  if (!keep) return false
84
92
  continue
85
93
  }
86
- if (e.type === "custom_message" && e.customType === "deja-recall") return true
94
+ if (counts(e)) return true
87
95
  if (keep && e.id === keep) return false
88
96
  }
89
97
  return false
90
98
  }
99
+
100
+ // isDigest reports whether a branch entry is the start digest this package
101
+ // sent, which it marks with details.digest.
102
+ function isDigest(e) {
103
+ return !!e && e.type === "custom_message" && e.customType === "deja-recall" && !!(e.details && e.details.digest)
104
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vshulcz/pi-deja",
3
- "version": "0.23.0",
4
- "description": "deja-vu memory for pi: the coding sessions already on this machine — pi, Claude Code, Codex, Cursor and 38 more — recalled at session start and on every prompt, searchable with /deja. A local index, no LLM.",
3
+ "version": "0.23.1",
4
+ "description": "deja-vu memory for pi: the coding sessions already on this machine — pi, Claude Code, Codex, Cursor and 39 more — recalled at session start and on every prompt, searchable with /deja. A local index, no LLM.",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "index.ts",
@@ -45,7 +45,7 @@
45
45
  "node": ">=18"
46
46
  },
47
47
  "dependencies": {
48
- "@vshulcz/deja-vu": "^0.23.0"
48
+ "@vshulcz/deja-vu": "^0.23.1"
49
49
  },
50
50
  "pi": {
51
51
  "extensions": [