notesoup 0.61.0 → 0.62.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.
Files changed (200) hide show
  1. package/.agents/plugins/marketplace.json +15 -0
  2. package/README.md +14 -11
  3. package/dist/plugins/antigravity/src/cli.d.ts +1 -0
  4. package/dist/plugins/antigravity/src/cli.js +23 -0
  5. package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
  6. package/dist/plugins/antigravity/src/hooks.js +53 -0
  7. package/dist/plugins/antigravity/src/identity.d.ts +26 -0
  8. package/dist/plugins/antigravity/src/identity.js +129 -0
  9. package/dist/plugins/claude/src/helper.js +2 -1
  10. package/dist/plugins/codex/src/hooks.js +1 -0
  11. package/dist/plugins/codex/src/identity.d.ts +6 -1
  12. package/dist/plugins/codex/src/identity.js +13 -1
  13. package/dist/plugins/codex/src/mcp.d.ts +35 -7
  14. package/dist/plugins/codex/src/mcp.js +26 -88
  15. package/dist/plugins/codex/src/text.js +3 -3
  16. package/dist/plugins/dsh/tools.js +8 -4
  17. package/dist/plugins/mcp/operations.d.ts +15 -0
  18. package/dist/plugins/mcp/operations.js +43 -0
  19. package/dist/plugins/mcp/server.d.ts +14 -0
  20. package/dist/plugins/mcp/server.js +13 -0
  21. package/dist/plugins/pi/budget.d.ts +1 -1
  22. package/dist/plugins/pi/budget.js +3 -2
  23. package/dist/plugins/pi/entries.d.ts +1 -0
  24. package/dist/plugins/pi/entries.js +1 -0
  25. package/dist/plugins/pi/history-tools.js +2 -1
  26. package/dist/plugins/pi/history.js +18 -1
  27. package/dist/plugins/pi/notes/tools.js +7 -3
  28. package/dist/plugins/pi/render.d.ts +7 -1
  29. package/dist/plugins/pi/render.js +2 -2
  30. package/dist/plugins/pi/reset/lifecycle.d.ts +1 -1
  31. package/dist/plugins/pi/reset/lifecycle.js +8 -9
  32. package/dist/plugins/pi/runtime.js +102 -61
  33. package/dist/plugins/pi/tool-result.js +7 -7
  34. package/dist/plugins/pi/window.d.ts +33 -3
  35. package/dist/plugins/pi/window.js +209 -9
  36. package/dist/src/boot/render.js +18 -15
  37. package/dist/src/boot/text.d.ts +3 -1
  38. package/dist/src/boot/text.js +22 -20
  39. package/dist/src/budget/text.d.ts +2 -2
  40. package/dist/src/budget/text.js +13 -13
  41. package/dist/src/history/claude.d.ts +2 -0
  42. package/dist/src/history/claude.js +46 -0
  43. package/dist/src/history/codex-transcript.js +7 -5
  44. package/dist/src/history/codex.js +3 -0
  45. package/dist/src/history/corpus.d.ts +28 -1
  46. package/dist/src/history/corpus.js +40 -0
  47. package/dist/src/history/history.d.ts +37 -46
  48. package/dist/src/history/history.js +21 -40
  49. package/dist/src/history/local.js +67 -32
  50. package/dist/src/history/pi.d.ts +2 -1
  51. package/dist/src/history/pi.js +122 -48
  52. package/dist/src/history/prefilter.js +76 -19
  53. package/dist/src/history/query.d.ts +28 -49
  54. package/dist/src/history/query.js +83 -68
  55. package/dist/src/history/summary-cache.d.ts +8 -1
  56. package/dist/src/history/summary-cache.js +138 -12
  57. package/dist/src/index.d.ts +1 -1
  58. package/dist/src/index.js +1 -1
  59. package/dist/src/notes/errors.d.ts +1 -1
  60. package/dist/src/notes/frontmatter.d.ts +0 -2
  61. package/dist/src/notes/frontmatter.js +0 -2
  62. package/dist/src/notes/index.d.ts +1 -1
  63. package/dist/src/notes/index.js +1 -1
  64. package/dist/src/notes/policy.d.ts +15 -1
  65. package/dist/src/notes/policy.js +46 -5
  66. package/dist/src/notes/store.d.ts +12 -0
  67. package/dist/src/notes/store.js +16 -20
  68. package/dist/src/text-match.d.ts +10 -1
  69. package/dist/src/text-match.js +42 -3
  70. package/dist/src/tools/dream.d.ts +22 -93
  71. package/dist/src/tools/dream.js +30 -27
  72. package/dist/src/tools/history.d.ts +33 -26
  73. package/dist/src/tools/history.js +257 -163
  74. package/dist/src/tools/notes.d.ts +51 -163
  75. package/dist/src/tools/notes.js +146 -100
  76. package/dist/src/tools/output.d.ts +2 -1
  77. package/dist/src/tools/output.js +2 -1
  78. package/dist/src/tools/result.d.ts +4 -7
  79. package/dist/src/tools/result.js +8 -9
  80. package/dist/src/tools/schema.d.ts +4 -1
  81. package/dist/src/tools/schema.js +25 -1
  82. package/dist/test/agent-loop.test.js +198 -16
  83. package/dist/test/antigravity-live.test.d.ts +1 -0
  84. package/dist/test/antigravity-live.test.js +142 -0
  85. package/dist/test/antigravity-plugin.test.d.ts +1 -0
  86. package/dist/test/antigravity-plugin.test.js +101 -0
  87. package/dist/test/boot.integration.test.js +133 -14
  88. package/dist/test/claude-history.test.js +14 -13
  89. package/dist/test/claude-mod.test.js +9 -6
  90. package/dist/test/codex-history.test.js +15 -3
  91. package/dist/test/codex-plugin.test.js +76 -38
  92. package/dist/test/dependencies.test.js +7 -3
  93. package/dist/test/dream-skill.test.js +3 -3
  94. package/dist/test/dream-tools.test.js +101 -56
  95. package/dist/test/dsh.test.js +34 -19
  96. package/dist/test/helpers/dependency-graph.js +2 -2
  97. package/dist/test/helpers/extension.d.ts +65 -2
  98. package/dist/test/helpers/extension.js +72 -3
  99. package/dist/test/history-corpus.test.js +79 -77
  100. package/dist/test/history-summary-cache.test.js +97 -9
  101. package/dist/test/history.integration.test.js +234 -168
  102. package/dist/test/host-neutral.test.js +69 -19
  103. package/dist/test/marker.test.js +1 -1
  104. package/dist/test/note-policy.test.js +96 -77
  105. package/dist/test/notes.integration.test.js +212 -94
  106. package/dist/test/notes.test.js +184 -113
  107. package/dist/test/pi-render.test.js +20 -12
  108. package/dist/test/project-namespace.test.js +3 -2
  109. package/dist/test/reset-lifecycle.test.js +2 -2
  110. package/docs/antigravity.md +44 -0
  111. package/docs/architecture.md +6 -4
  112. package/docs/claude-code-mod.md +2 -2
  113. package/docs/codex.md +36 -38
  114. package/docs/dsh.md +3 -3
  115. package/docs/history-sessions.md +28 -50
  116. package/docs/notes-library.md +4 -4
  117. package/docs/skills.md +3 -3
  118. package/docs/tool-results.md +47 -28
  119. package/package.json +3 -2
  120. package/playbook.md +1 -1
  121. package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
  122. package/plugins/antigravity/hooks.json +7 -0
  123. package/plugins/antigravity/mcp_config.json +8 -0
  124. package/plugins/antigravity/plugin.json +6 -0
  125. package/plugins/antigravity/src/cli.ts +22 -0
  126. package/plugins/antigravity/src/hooks.ts +51 -0
  127. package/plugins/antigravity/src/identity.ts +127 -0
  128. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  129. package/plugins/claude/dist/claude/helper.js +1059 -534
  130. package/plugins/claude/hooks/register.ts +2 -2
  131. package/plugins/claude/playbook.md +1 -1
  132. package/plugins/claude/skills/dream/SKILL.md +1 -1
  133. package/plugins/claude/skills/notesoup/SKILL.md +92 -0
  134. package/plugins/claude/src/helper.ts +2 -1
  135. package/plugins/codex/.codex-plugin/plugin.json +8 -0
  136. package/plugins/codex/.mcp.json +11 -0
  137. package/plugins/codex/README.md +5 -21
  138. package/plugins/codex/dist/codex/notesoup.js +18480 -17946
  139. package/plugins/codex/src/hooks.ts +1 -0
  140. package/plugins/codex/src/identity.ts +14 -1
  141. package/plugins/codex/src/mcp.ts +28 -98
  142. package/plugins/codex/src/text.ts +3 -3
  143. package/plugins/dsh/tools.ts +8 -4
  144. package/plugins/mcp/operations.ts +50 -0
  145. package/plugins/mcp/server.ts +23 -0
  146. package/plugins/paseo/README.md +5 -10
  147. package/plugins/paseo/client/brain-empty-card.tsx +3 -3
  148. package/plugins/paseo/client/markdown.tsx +50 -38
  149. package/plugins/paseo/client/notes-op-card.tsx +12 -9
  150. package/plugins/paseo/client/paper-card.tsx +6 -5
  151. package/plugins/paseo/client/paper-palette.ts +2 -9
  152. package/plugins/paseo/client/sticky-card.tsx +2 -2
  153. package/plugins/paseo/client/tool-result.ts +7 -14
  154. package/plugins/paseo/package-lock.json +3406 -0
  155. package/plugins/paseo/package.json +1 -0
  156. package/plugins/paseo/test/markdown-core.test.ts +73 -66
  157. package/plugins/pi/budget.ts +3 -3
  158. package/plugins/pi/entries.ts +1 -0
  159. package/plugins/pi/history-tools.ts +2 -1
  160. package/plugins/pi/history.ts +30 -1
  161. package/plugins/pi/notes/tools.ts +7 -3
  162. package/plugins/pi/render.ts +6 -6
  163. package/plugins/pi/reset/lifecycle.ts +9 -10
  164. package/plugins/pi/runtime.ts +96 -60
  165. package/plugins/pi/tool-result.ts +8 -8
  166. package/plugins/pi/window.ts +198 -9
  167. package/skills/dream/SKILL.md +1 -1
  168. package/skills/notesoup/SKILL.md +92 -0
  169. package/src/boot/render.ts +18 -15
  170. package/src/boot/text.ts +23 -19
  171. package/src/budget/text.ts +13 -13
  172. package/src/history/claude.ts +41 -0
  173. package/src/history/codex-transcript.ts +6 -4
  174. package/src/history/codex.ts +2 -0
  175. package/src/history/corpus.ts +51 -2
  176. package/src/history/history.ts +35 -44
  177. package/src/history/local.ts +67 -27
  178. package/src/history/pi.ts +113 -35
  179. package/src/history/prefilter.ts +73 -15
  180. package/src/history/query.ts +93 -73
  181. package/src/history/summary-cache.ts +142 -17
  182. package/src/index.ts +1 -1
  183. package/src/notes/errors.ts +1 -1
  184. package/src/notes/frontmatter.ts +0 -3
  185. package/src/notes/index.ts +1 -1
  186. package/src/notes/policy.ts +44 -5
  187. package/src/notes/store.ts +17 -20
  188. package/src/text-match.ts +46 -4
  189. package/src/tools/dream.ts +29 -31
  190. package/src/tools/history.ts +249 -142
  191. package/src/tools/notes.ts +145 -113
  192. package/src/tools/output.ts +2 -1
  193. package/src/tools/result.ts +12 -11
  194. package/src/tools/schema.ts +24 -1
  195. package/plugins/claude/skills/memory/SKILL.md +0 -69
  196. package/plugins/codex/mcp.json +0 -10
  197. package/plugins/codex/plugin.json +0 -6
  198. package/plugins/paseo/client/markdown-core.tsx +0 -189
  199. package/plugins/paseo/client/typography.ts +0 -24
  200. package/skills/memory/SKILL.md +0 -69
@@ -7,9 +7,11 @@ import { dirname, join } from "node:path";
7
7
  import { test } from "node:test";
8
8
  import { zstdCompressSync } from "node:zlib";
9
9
  import { localHistoryCorpus } from "../src/history/local.js";
10
- import { cachedSessionRepresentative, historySummaryCacheRoot } from "../src/history/summary-cache.js";
10
+ import { piHistoryFromFile, piHistoryFromJsonl } from "../src/history/pi.js";
11
+ import { offlineClaudeHistoryFromFile, offlineClaudeHistoryFromJsonl } from "../src/history/claude.js";
12
+ import { cachedSessionRepresentative, HISTORY_SUMMARY_CACHE_TTL_MS, historySummaryCacheRoot, pruneHistorySummaryCache } from "../src/history/summary-cache.js";
11
13
  import { projectHistory } from "../src/history/history.js";
12
- import { historyList, historyRead } from "../src/tools/history.js";
14
+ import { historyList, historySearch, historyRead } from "../src/tools/history.js";
13
15
  const AT = "2026-10-06T01:02:03.000Z";
14
16
  const ROOT = "019a0000-0000-7000-8000-000000000001";
15
17
  const CHILD = "019a0000-0000-7000-8000-000000000002";
@@ -129,25 +131,63 @@ test("append, equal-size rewrite with restored mtime, and atomic replacement inv
129
131
  assert.equal(replaced.items[0].content, "third");
130
132
  assert.equal(reads.length, 5);
131
133
  });
132
- test("search, roles, time filters and explicit sessions bypass the summary while empty queries reuse it", async (t) => {
134
+ test("roles and disjoint/contained time windows reuse the summary while partial overlaps, overlapping searches and explicit sessions decode strictly", async (t) => {
133
135
  const f = await fixture(t);
134
136
  await f.put(f.piPath, piText("opening", [{ type: "message", id: "a", parentId: "u", timestamp: "2026-10-07T00:00:00Z", message: { role: "assistant", content: "later" } }]));
135
137
  const reads = transcriptReads(t, [f.piPath]);
136
138
  const ctx = f.context();
139
+ const plain = {
140
+ current: () => projection("live"),
141
+ corpus: {
142
+ currentHarness: "dsh",
143
+ sessions: async (harness) => (await f.corpus().sessions(harness)).map(({ loadRepresentative: _r, loadSummary: _s, peekSummary: _p, ...session }) => session),
144
+ },
145
+ };
137
146
  await historyList.execute({ session: "pi:*" }, ctx);
138
- for (const query of ["", [], ["", ""]])
139
- await historyList.execute({ session: "pi:*", query }, ctx);
140
147
  assert.equal(reads.length, 1);
141
- for (const filters of [{ roles: ["assistant"] }, { after: AT }, { before: "2026-10-07" }, { query: "later" }, { session: "pi:offline" }]) {
148
+ // Cache-satisfied filters: roles-only, strictly contained window, and disjoint windows (overview & query).
149
+ for (const filters of [
150
+ { roles: ["assistant"] },
151
+ { roles: ["user", "assistant"] },
152
+ { roles: ["tool"] },
153
+ { since: "2026-10-05", until: "2026-10-08" },
154
+ { since: "2026-10-05", roles: ["assistant"] },
155
+ { until: AT },
156
+ { since: "2026-10-07T00:00:00Z" },
157
+ ]) {
158
+ const before = reads.length;
159
+ const params = { session: "pi:*", ...filters };
160
+ const result = await historyList.execute(params, ctx);
161
+ assert.equal(reads.length, before, `expected cache hit for ${JSON.stringify(params)}`);
162
+ assert.deepEqual(result, await historyList.execute(params, plain));
163
+ }
164
+ for (const filters of [
165
+ { query: "later", until: AT },
166
+ { query: "later", since: "2026-10-07T00:00:00Z" },
167
+ ]) {
168
+ const before = reads.length;
169
+ const params = { session: "pi:*", ...filters };
170
+ const result = await historySearch.execute(params, ctx);
171
+ assert.equal(reads.length, before, `expected cache hit for ${JSON.stringify(params)}`);
172
+ assert.deepEqual(result, await historySearch.execute(params, plain));
173
+ }
174
+ // Strict fallback filters: partial time overlaps, overlapping query, and explicit single-session reads.
175
+ for (const filters of [{ since: AT }, { until: "2026-10-07" }, { session: "pi:offline" }]) {
142
176
  const before = reads.length;
143
177
  const params = { session: "pi:*", ...filters };
144
178
  const result = await historyList.execute(params, ctx);
145
179
  assert.ok(reads.length > before, JSON.stringify(params));
146
- const plain = { current: () => projection("live"), corpus: { currentHarness: "dsh", sessions: async (harness) => (await f.corpus().sessions(harness)).map(({ loadRepresentative: _cache, ...session }) => session) } };
147
180
  assert.deepEqual(result, await historyList.execute(params, plain));
148
181
  }
149
- assert.equal(data(await historyList.execute({ session: "pi:*", after: AT }, ctx)).items.length, 1);
150
- assert.equal(data(await historyList.execute({ session: "pi:*", before: AT }, ctx)).items.length, 0, "before is exclusive");
182
+ {
183
+ const before = reads.length;
184
+ const params = { session: "pi:*", query: "later" };
185
+ const result = await historySearch.execute(params, ctx);
186
+ assert.ok(reads.length > before, JSON.stringify(params));
187
+ assert.deepEqual(result, await historySearch.execute(params, plain));
188
+ }
189
+ assert.equal(data(await historyList.execute({ session: "pi:*", since: AT }, ctx)).items.length, 1);
190
+ assert.equal(data(await historyList.execute({ session: "pi:*", until: AT }, ctx)).items.length, 0, "before is exclusive");
151
191
  });
152
192
  test("corrupt cache/schema and unwritable roots fall back; a warm cache cannot hide malformed or unsupported transcripts", async (t) => {
153
193
  const f = await fixture(t);
@@ -295,3 +335,51 @@ test("Codex cache fingerprints actual archived compressed ancestors and revalida
295
335
  await fs.unlink(ancestorPath);
296
336
  assert.equal(data(await historyList.execute(params, f.context())).items.length, 0);
297
337
  });
338
+ test("cold partial-overlap overview reads each transcript once and populates the summary cache", async (t) => {
339
+ const f = await fixture(t);
340
+ await f.put(f.piPath, piText("opening", [{ type: "message", id: "a", parentId: "u", timestamp: "2026-10-07T00:00:00Z", message: { role: "assistant", content: "later" } }]));
341
+ const reads = transcriptReads(t, [f.piPath]);
342
+ const result = data(await historyList.execute({ session: "pi:*", since: AT }, f.context()));
343
+ assert.equal(result.items.length, 1);
344
+ assert.equal(result.items[0].content, "later");
345
+ assert.equal(reads.length, 1, "cold partial overlap must reuse the projection from summary load instead of decoding twice");
346
+ assert.equal(data(await historyList.execute({ session: "pi:*" }, f.context())).items[0].content, "opening");
347
+ assert.equal(reads.length, 1, "cold partial overlap also populated the summary cache");
348
+ });
349
+ test("streaming Pi and Claude file decoders match in-memory JSONL decoding", async (t) => {
350
+ const f = await fixture(t);
351
+ const piBody = piText("opening", [
352
+ { type: "message", id: "a", parentId: "u", timestamp: "2026-10-07T00:00:00Z", message: { role: "assistant", content: [{ type: "thinking", thinking: "ignored" }, { type: "text", text: "visible" }] } },
353
+ ]) + '{"unterminated":';
354
+ await f.put(f.piPath, piBody);
355
+ assert.deepEqual(await piHistoryFromFile(f.piPath, "offline", 100 * 1024 * 1024), piHistoryFromJsonl(piBody, "offline"));
356
+ const claudePath = join(f.roots.claude, "workspace", "offline-claude.jsonl");
357
+ const claudeBody = jsonl([
358
+ { type: "user", uuid: "u1", parentUuid: null, sessionId: "offline-claude", timestamp: AT, message: { role: "user", content: "hello" } },
359
+ { type: "assistant", uuid: "a1", parentUuid: "u1", sessionId: "offline-claude", timestamp: "2026-10-07T00:00:00Z", message: { role: "assistant", content: [{ type: "text", text: "world" }] } },
360
+ ]) + '{"partial":';
361
+ await f.put(claudePath, claudeBody);
362
+ assert.deepEqual(await offlineClaudeHistoryFromFile(claudePath, "offline-claude", 100 * 1024 * 1024), offlineClaudeHistoryFromJsonl(claudeBody, "offline-claude"));
363
+ });
364
+ test("summary cache entries expire after 3 days and pruning removes expired and v1 files", async (t) => {
365
+ const f = await fixture(t);
366
+ await f.put(f.piPath, piText("opening"));
367
+ const reads = transcriptReads(t, [f.piPath]);
368
+ await historyList.execute({ session: "pi:*" }, f.context());
369
+ assert.equal(reads.length, 1);
370
+ const [name] = await cacheEntries(f.cacheRoot);
371
+ const cachePath = join(f.cacheRoot, name);
372
+ const expiredTime = new Date(Date.now() - HISTORY_SUMMARY_CACHE_TTL_MS - 60_000);
373
+ await fs.utimes(cachePath, expiredTime, expiredTime);
374
+ // Expired entry must miss and trigger a strict reload.
375
+ await historyList.execute({ session: "pi:*" }, f.context());
376
+ assert.equal(reads.length, 2);
377
+ // Pruning deletes v1 and expired files while preserving fresh v2 entries.
378
+ const v1Path = join(f.cacheRoot, "legacy-v1.json");
379
+ const expiredPath = join(f.cacheRoot, "expired-v2.json");
380
+ await fs.writeFile(v1Path, JSON.stringify({ version: "strict-representative-v1" }));
381
+ await fs.writeFile(expiredPath, await fs.readFile(cachePath, "utf8"));
382
+ await fs.utimes(expiredPath, expiredTime, expiredTime);
383
+ await pruneHistorySummaryCache(f.cacheRoot);
384
+ assert.deepEqual(await cacheEntries(f.cacheRoot), [name]);
385
+ });