notesoup 0.53.1 → 0.54.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 (153) hide show
  1. package/README.md +2 -2
  2. package/dist/plugins/claude/src/helper.js +2 -1
  3. package/dist/plugins/claude/src/history.js +2 -3
  4. package/dist/plugins/claude/src/thresholds.js +4 -2
  5. package/dist/plugins/codex/src/hooks.js +1 -1
  6. package/dist/plugins/codex/src/identity.d.ts +1 -1
  7. package/dist/plugins/codex/src/identity.js +3 -3
  8. package/dist/plugins/codex/src/mcp.js +2 -1
  9. package/dist/plugins/codex/src/text.d.ts +1 -1
  10. package/dist/plugins/codex/src/text.js +2 -2
  11. package/dist/plugins/dsh/engine.js +2 -2
  12. package/dist/plugins/dsh/tools.js +8 -7
  13. package/dist/plugins/dsh/window.d.ts +1 -0
  14. package/dist/plugins/dsh/window.js +7 -3
  15. package/dist/plugins/pi/entries.d.ts +1 -0
  16. package/dist/plugins/pi/entries.js +1 -0
  17. package/dist/plugins/pi/history-tools.d.ts +1 -1
  18. package/dist/plugins/pi/history-tools.js +4 -4
  19. package/dist/plugins/pi/marker.d.ts +9 -0
  20. package/dist/plugins/pi/marker.js +36 -0
  21. package/dist/plugins/pi/notes/tools.js +8 -6
  22. package/dist/plugins/pi/render.js +7 -4
  23. package/dist/plugins/pi/reset/artifacts.d.ts +2 -2
  24. package/dist/plugins/pi/reset/artifacts.js +2 -2
  25. package/dist/plugins/pi/runtime.js +11 -8
  26. package/dist/plugins/pi/text.d.ts +2 -0
  27. package/dist/plugins/pi/text.js +4 -0
  28. package/dist/plugins/pi/window.js +21 -7
  29. package/dist/src/boot/render.js +7 -7
  30. package/dist/src/boot/snapshot.d.ts +7 -7
  31. package/dist/src/boot/snapshot.js +17 -17
  32. package/dist/src/boot/text.d.ts +2 -2
  33. package/dist/src/boot/text.js +7 -5
  34. package/dist/src/dream/git.d.ts +2 -11
  35. package/dist/src/dream/git.js +6 -23
  36. package/dist/src/dream/lock.d.ts +2 -2
  37. package/dist/src/dream/lock.js +3 -3
  38. package/dist/src/index.d.ts +2 -1
  39. package/dist/src/index.js +3 -2
  40. package/dist/src/notes/address.d.ts +8 -8
  41. package/dist/src/notes/address.js +13 -13
  42. package/dist/src/notes/errors.d.ts +1 -1
  43. package/dist/src/notes/frontmatter.js +2 -2
  44. package/dist/src/notes/index.d.ts +1 -1
  45. package/dist/src/notes/index.js +1 -1
  46. package/dist/src/notes/paths.d.ts +6 -6
  47. package/dist/src/notes/paths.js +9 -9
  48. package/dist/src/notes/{project-home.d.ts → project-namespace.d.ts} +7 -7
  49. package/dist/src/notes/{project-home.js → project-namespace.js} +67 -25
  50. package/dist/src/notes/store.d.ts +4 -4
  51. package/dist/src/notes/store.js +55 -52
  52. package/dist/src/tools/dream.d.ts +21 -3
  53. package/dist/src/tools/dream.js +54 -16
  54. package/dist/src/tools/notes-context.d.ts +10 -0
  55. package/dist/src/tools/notes-context.js +27 -0
  56. package/dist/src/tools/notes.d.ts +69 -20
  57. package/dist/src/tools/notes.js +40 -31
  58. package/dist/test/agent-loop.test.js +8 -8
  59. package/dist/test/boot.integration.test.js +5 -5
  60. package/dist/test/claude-history.test.js +26 -0
  61. package/dist/test/claude-mod.test.js +257 -86
  62. package/dist/test/codex-plugin.test.js +18 -1
  63. package/dist/test/context-edit-budget.test.js +121 -0
  64. package/dist/test/dependencies.test.js +71 -4
  65. package/dist/test/dream-tools.test.js +153 -8
  66. package/dist/test/dsh.test.js +62 -15
  67. package/dist/test/helpers/dsh.d.ts +4 -1
  68. package/dist/test/helpers/dsh.js +20 -4
  69. package/dist/test/helpers/extension.d.ts +5 -0
  70. package/dist/test/helpers/extension.js +33 -2
  71. package/dist/test/host-neutral.test.js +17 -15
  72. package/dist/test/marker.test.js +78 -0
  73. package/dist/test/model-facing-text.test.js +12 -8
  74. package/dist/test/notes-cwd.test.d.ts +1 -0
  75. package/dist/test/notes-cwd.test.js +114 -0
  76. package/dist/test/notes-library.test.js +4 -4
  77. package/dist/test/notes-query-namespaces.test.d.ts +1 -0
  78. package/dist/test/{notes-query-homes.test.js → notes-query-namespaces.test.js} +13 -13
  79. package/dist/test/notes.integration.test.js +72 -23
  80. package/dist/test/notes.test.js +50 -20
  81. package/dist/test/pi-render.test.js +33 -1
  82. package/dist/test/project-namespace.test.d.ts +1 -0
  83. package/dist/test/project-namespace.test.js +324 -0
  84. package/dist/test/reset-lifecycle.test.js +12 -0
  85. package/docs/architecture.md +13 -8
  86. package/docs/claude-code-mod.md +7 -7
  87. package/docs/codex.md +4 -4
  88. package/docs/dsh.md +8 -8
  89. package/docs/notes-library.md +9 -5
  90. package/docs/skills.md +3 -3
  91. package/docs/tool-results.md +6 -2
  92. package/package.json +4 -6
  93. package/playbook.md +6 -6
  94. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  95. package/plugins/claude/dist/claude/helper.js +681 -617
  96. package/plugins/claude/hooks/register.ts +61 -65
  97. package/plugins/claude/playbook.md +6 -6
  98. package/plugins/claude/skills/memory/SKILL.md +4 -4
  99. package/plugins/claude/src/helper.ts +3 -2
  100. package/plugins/claude/src/history.ts +2 -3
  101. package/plugins/claude/src/thresholds.ts +4 -2
  102. package/plugins/codex/README.md +1 -1
  103. package/plugins/codex/dist/codex/notesoup.js +877 -815
  104. package/plugins/codex/src/hooks.ts +1 -1
  105. package/plugins/codex/src/identity.ts +3 -3
  106. package/plugins/codex/src/mcp.ts +2 -1
  107. package/plugins/codex/src/text.ts +2 -2
  108. package/plugins/dsh/engine.ts +2 -2
  109. package/plugins/dsh/tools.ts +8 -7
  110. package/plugins/dsh/window.ts +8 -3
  111. package/plugins/paseo/OVERVIEW.md +4 -4
  112. package/plugins/paseo/README.md +1 -1
  113. package/plugins/paseo/client/brain-empty-card.tsx +3 -4
  114. package/plugins/paseo/client/markdown.tsx +179 -0
  115. package/plugins/paseo/client/notes-op-card.tsx +35 -34
  116. package/plugins/paseo/client/notes-op-transformer.ts +17 -68
  117. package/plugins/paseo/client/paper-card.tsx +8 -19
  118. package/plugins/paseo/client/paper-palette.ts +40 -0
  119. package/plugins/paseo/client/sticky-card.tsx +6 -4
  120. package/plugins/paseo/package.json +3 -0
  121. package/plugins/paseo/paseo-plugin.json +2 -2
  122. package/plugins/paseo/shared/notes-op.ts +13 -9
  123. package/plugins/paseo/test/notes-op.test.ts +52 -73
  124. package/plugins/paseo/test/paper-palette.test.ts +54 -0
  125. package/plugins/pi/entries.ts +1 -0
  126. package/plugins/pi/history-tools.ts +4 -4
  127. package/plugins/pi/marker.ts +39 -0
  128. package/plugins/pi/notes/tools.ts +8 -6
  129. package/plugins/pi/render.ts +6 -4
  130. package/plugins/pi/reset/artifacts.ts +2 -2
  131. package/plugins/pi/runtime.ts +9 -8
  132. package/plugins/pi/text.ts +5 -0
  133. package/plugins/pi/window.ts +22 -7
  134. package/skills/memory/SKILL.md +4 -4
  135. package/src/boot/render.ts +8 -8
  136. package/src/boot/snapshot.ts +20 -20
  137. package/src/boot/text.ts +7 -5
  138. package/src/dream/git.ts +7 -24
  139. package/src/dream/lock.ts +3 -3
  140. package/src/index.ts +4 -3
  141. package/src/notes/address.ts +13 -13
  142. package/src/notes/errors.ts +1 -1
  143. package/src/notes/frontmatter.ts +2 -2
  144. package/src/notes/index.ts +1 -1
  145. package/src/notes/paths.ts +9 -9
  146. package/src/notes/{project-home.ts → project-namespace.ts} +59 -28
  147. package/src/notes/store.ts +61 -58
  148. package/src/tools/dream.ts +63 -16
  149. package/src/tools/notes-context.ts +29 -0
  150. package/src/tools/notes.ts +39 -29
  151. package/dist/test/project-home.test.js +0 -134
  152. /package/dist/test/{notes-query-homes.test.d.ts → context-edit-budget.test.d.ts} +0 -0
  153. /package/dist/test/{project-home.test.d.ts → marker.test.d.ts} +0 -0
@@ -130,7 +130,7 @@ async function openFixture(options) {
130
130
  await session.bindExtensions({
131
131
  uiContext: {
132
132
  notify(message, type) {
133
- if (message === "🥣 Fresh brain") {
133
+ if (message === "🥣 Brain forcibly emptied: overflow") {
134
134
  const marker = sessionManager.getBranch().filter((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE).at(-1);
135
135
  const windowId = marker?.data?.windowId;
136
136
  assert.ok(sessionManager.getBranch().some((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE && entry.data?.windowId === windowId), "notification follows the reset marker commit");
@@ -210,7 +210,7 @@ const COMMAND_WARNING_JSON = JSON.stringify(commandWarningContent()).slice(1, -1
210
210
  function assertUserContent(context, content) {
211
211
  assert.ok(context?.messages.some((message) => message.role === "user" && JSON.stringify(message.content) === JSON.stringify(content)), "carried input reaches the provider verbatim as user content");
212
212
  }
213
- /** The committed-reset success notice: fresh wording for the model's own wipe, forced for system resets. */
213
+ /** Recognize reset completion notices, including the removed normal-reset wording. */
214
214
  const isResetSuccessNotice = (notice) => notice.includes("🥣 Fresh brain") || notice.includes("🥣 Brain forcibly emptied");
215
215
  function resetMarkers(fixture) {
216
216
  return fixture.sessionManager.getBranch().filter((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
@@ -418,12 +418,12 @@ test("real AgentSession: final warning survives its reset boundary and notifies
418
418
  assert.equal(fixture.sessionManager.getBranch().filter((entry) => entry.type === "custom_message" && entry.customType === WARNING_TYPE).length, 1);
419
419
  assert.equal(resetMarkers(fixture).length, 1, "the reset commits in the same boundary as the final warning");
420
420
  assert.equal(fixture.budgetNotices(), 1, "the old-window committed warning reaches the UI after reset");
421
- assert.equal(fixture.notices.filter((notice) => notice === "🥣 Fresh brain").length, 1, "reset notification remains intact");
421
+ assert.equal(fixture.notices.filter(isResetSuccessNotice).length, 0, "normal reset completion stays silent");
422
422
  assert.equal(fixture.notices.some((notice) => notice.includes("Context running low")), false, "early guidance stays silent");
423
423
  await fixture.session.prompt("Continue after reset.");
424
424
  await fixture.session.waitForIdle();
425
425
  assert.equal(fixture.budgetNotices(), 1, "later turns cannot repeat the consumed final warning");
426
- assert.equal(fixture.notices.filter((notice) => notice === "🥣 Fresh brain").length, 1, "the prior reset notification is also deduplicated");
426
+ assert.equal(fixture.notices.filter(isResetSuccessNotice).length, 0, "later turns do not announce normal reset completion");
427
427
  }
428
428
  finally {
429
429
  fixture.close();
@@ -443,7 +443,7 @@ test("real AgentSession: explicit tiny-session wipe ignores keepRecentTokens and
443
443
  assert.equal(fixture.notices.length, 0, "startup boot is silent");
444
444
  await fixture.session.prompt("OLD_CONTEXT_SENTINEL: retain this only in durable history.");
445
445
  await fixture.session.waitForIdle();
446
- assert.deepEqual(fixture.notices.filter(isResetSuccessNotice), ["🥣 Fresh brain"], "the reset notifies once, without repeating the last word");
446
+ assert.deepEqual(fixture.notices.filter(isResetSuccessNotice), [], "normal reset completion stays silent");
447
447
  assert.equal(fixture.requests.length, 2, "the tool starts exactly one continuation");
448
448
  assert.ok(text(fixture.requests[0]).includes("OLD_CONTEXT_SENTINEL"));
449
449
  assertFreshRequest(fixture, 1, "OLD_CONTEXT_SENTINEL");
@@ -541,7 +541,7 @@ test("real AgentSession: /empty text is carried verbatim and answered after clos
541
541
  const branch = fixture.sessionManager.getBranch();
542
542
  const continuationIndex = branch.findIndex((entry) => entry.type === "custom_message" && entry.customType === CONTINUATION_TYPE);
543
543
  assert.deepEqual(branch.slice(continuationIndex + 1, continuationIndex + 3).map((entry) => entry.type === "custom_message" ? entry.customType : entry.type), ["notesoup/reset-last-word", CARRIED_INPUT_TYPE]);
544
- assert.ok(fixture.notices.some(isResetSuccessNotice));
544
+ assert.equal(fixture.notices.some(isResetSuccessNotice), false);
545
545
  }
546
546
  finally {
547
547
  fixture.close();
@@ -636,7 +636,7 @@ test("real AgentSession: manual hard-reserve reset stops clean and mixed-tool tu
636
636
  assert.equal(fixture.requests.length, 2);
637
637
  assert.equal(resetMarkers(fixture).length, 1, "the safety wipe is not repeated at settlement");
638
638
  assert.equal(JSON.stringify(fixture.sessionManager.buildSessionProjection().messages).includes("HARD_RESERVE_OLD_SENTINEL"), false);
639
- assert.ok(fixture.notices.some(isResetSuccessNotice));
639
+ assert.equal(fixture.notices.some(isResetSuccessNotice), !mixed, "only forced reset completion notifies");
640
640
  if (mixed) {
641
641
  assert.ok(existsSync(join(fixture.notesRoot, "pi", "session", fixture.sessionManager.getSessionId(), "pressure.md")), "the whole tool batch completes before the cut");
642
642
  assert.equal(fixture.streamSignals.at(-1), true, "Pi's unavoidable tool follow-up is cancelled before provider work");
@@ -705,7 +705,7 @@ test("real AgentSession: streaming /empty steers a close-out and stops at settle
705
705
  await started;
706
706
  await fixture.session.prompt("/empty", { streamingBehavior: "steer" });
707
707
  await fixture.session.prompt("/empty", { streamingBehavior: "followUp" });
708
- assert.equal(fixture.notices.filter((notice) => notice.includes("Brain being emptied")).length, 1, "the user is notified once while output is ongoing");
708
+ assert.equal(fixture.notices.filter((notice) => notice.includes("Dumping Brain")).length, 1, "the user is notified once while output is ongoing");
709
709
  assert.equal(resetMarkers(fixture).length, 0, "the ongoing turn is not interrupted");
710
710
  releaseResponse();
711
711
  await running;
@@ -85,7 +85,7 @@ test("the root boot and reset boot carry durable window identity", async () => {
85
85
  assert.equal(boundary.continue, true);
86
86
  await runHandlers(captured, "turn_start", {}, ctx);
87
87
  await runHandlers(captured, "agent_settled", {}, ctx);
88
- assert.deepEqual(noticesOf(ctx).filter((notice) => notice.message.includes("Fresh brain")), [{ message: "🥣 Fresh brain", type: "info" }], "the committed reset is announced once");
88
+ assert.deepEqual(noticesOf(ctx), [], "normal reset completion stays silent");
89
89
  const entries = sessionManager.getBranch();
90
90
  const marker = entries.find((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
91
91
  assert.ok(marker && marker.type === "custom");
@@ -181,7 +181,7 @@ test("an aborted async boot repair emits no boot, continuation, or incomplete-no
181
181
  controller.abort();
182
182
  await pending;
183
183
  assert.equal(captured.sent.length, 0, "aborted snapshot work cannot append the reset boot or continuation");
184
- assert.equal(noticesOf(ctx).some((notice) => notice.message.includes("went missing")), false, "aborted snapshot work cannot notify about missing homes");
184
+ assert.equal(noticesOf(ctx).some((notice) => notice.message.includes("went missing")), false, "aborted snapshot work cannot notify about missing notebooks");
185
185
  assert.equal(sessionManager.getBranch().some((entry) => entry.type === "custom_message" && [BOOT_TYPE, CONTINUATION_TYPE].includes(entry.customType)), false);
186
186
  });
187
187
  test("a marker tail with only metadata repairs its missing boot and continuation without moving the boundary", async () => {
@@ -332,7 +332,7 @@ test("/empty waits out non-agent busy work before starting its single-turn reque
332
332
  assert.equal(waits, 1);
333
333
  assert.equal(captured.sent.length, 1);
334
334
  assert.equal(captured.sent[0]?.options?.triggerTurn, true);
335
- assert.equal(notices.filter((message) => message.includes("Brain being emptied")).length, 1);
335
+ assert.equal(notices.filter((message) => message.includes("Dumping Brain")).length, 1);
336
336
  });
337
337
  test("notesoup command toggles future work, /empty schedules a turn-end reset, and /compact remains disabled", async () => {
338
338
  const sessionManager = manager();
@@ -357,7 +357,7 @@ test("notesoup command toggles future work, /empty schedules a turn-end reset, a
357
357
  assert.match(notices[0]?.message ?? "", /on/);
358
358
  notices = await runCommand(captured, "empty", "", low);
359
359
  assert.equal(notices.length, 1, "the command acknowledges the reset request");
360
- assert.match(notices[0]?.message ?? "", /Brain being emptied/);
360
+ assert.match(notices[0]?.message ?? "", /Dumping Brain/);
361
361
  assert.equal(captured.sent.length, 2, "the command persists one hidden warning after the startup boot");
362
362
  assert.equal(captured.sent[1]?.options?.triggerTurn, true, "the manual checkpoint prompt starts an ordinary agent turn");
363
363
  assert.equal(captured.sent[1]?.message.customType, MANUAL_WIPE_TYPE);
@@ -396,7 +396,7 @@ test("committed reset confirmation survives later work while repair refuses that
396
396
  assert.equal(resetBoundaryCommitted(ctx, marker.id, windowId), true, "later work does not undo a committed native boundary");
397
397
  await runHandlers(captured, "agent_settled", {}, ctx);
398
398
  await runHandlers(captured, "turn_start", {}, ctx);
399
- assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("Fresh brain")).length, 1);
399
+ assert.deepEqual(noticesOf(ctx), [], "later work does not announce normal reset completion");
400
400
  assert.equal(resetBoundaryCommitted(ctx, marker.id, "wrong-window"), false);
401
401
  const partial = manager();
402
402
  const partialCtx = context(partial);
@@ -176,6 +176,32 @@ test("Claude reset crosses native turn_duration graph metadata with no message c
176
176
  assert.ok((await historyRead.execute({ seq: 2 }, projection)).ok);
177
177
  assert.ok((await historyWindows.execute({}, projection, sessionId)).ok);
178
178
  });
179
+ test("Claude api_error retry metadata keeps compact ancestry without allocating seq or exposing internals", async () => {
180
+ const retry = { type: "system", subtype: "api_error", uuid: "retry", parentUuid: "old", sessionId, isSidechain: false,
181
+ level: "error", error: { message: "Connection error.", formatted: "Connection dropped (ECONNRESET)",
182
+ connection: { code: "ECONNRESET", message: "PRIVATE_RETRY_PAYLOAD", isSSLError: false }, isNetworkDown: false, rateLimits: null, noResponse: null },
183
+ retryInMs: 620, retryAttempt: 1, maxRetries: 10, source: "request_retry", timestamp: "2026-10-22T03:20:21.859Z", version: "2.1.295" };
184
+ const prefix = [user("u", null, "before retry"), assistant("old", "u", "finished turn")];
185
+ const rows = [...prefix, retry, compact("boundary", "retry"), row("boot", "boundary", "user", bootText(1)), user("after", "boot", "after reset")];
186
+ const projection = project(rows, "after");
187
+ assert.deepEqual(projection.missingAncestors, []);
188
+ assert.equal(projection.highestSeq, 5, "retry metadata allocates no message or seq");
189
+ assert.equal(projection.windows.length, 2);
190
+ assert.equal(projection.currentWindowOrdinal, 1);
191
+ assert.deepEqual(project([...prefix, { ...rows[3], logicalParentUuid: "old" }, ...rows.slice(4)], "after"), projection, "metadata leaves all addresses and windows unchanged");
192
+ assert.doesNotMatch(allItems(projection).map(eventDocument).join("\n"), /PRIVATE_RETRY_PAYLOAD|ECONNRESET|request_retry/);
193
+ assert.ok((await historyList.execute({}, projection)).ok);
194
+ const previous = await historyList.execute({ window_id: "@previous" }, projection);
195
+ assert.ok(previous.ok);
196
+ assert.match(JSON.stringify(previous), /before retry|finished turn/);
197
+ assert.ok((await historyRead.execute({ seq: 2 }, projection)).ok);
198
+ assert.ok((await historyWindows.execute({}, projection, sessionId)).ok);
199
+ assert.deepEqual(project(rows, "after"), projection, "reload preserves seq");
200
+ assert.deepEqual(project([...prefix, { ...retry, subtype: "future_metadata" }, ...rows.slice(3)], "after"), projection, "metadata does not depend on a subtype whitelist");
201
+ const withBody = project([...prefix, { ...retry, content: "visible system notice" }], "retry");
202
+ assert.match(allItems(withBody).map(eventDocument).join("\n"), /visible system notice/, "a body is read regardless of subtype");
203
+ assert.throws(() => project([...prefix, row("broken", "old", "system", { invalid: true })], "broken"), /invalid Claude transcript message content/);
204
+ });
179
205
  test("Claude resolves forward persisted ancestry without renumbering or using later rewritten parent versions", () => {
180
206
  const notice = row("notice", "attachment", "system", "hook notice");
181
207
  const attachment = { type: "attachment", uuid: "attachment", parentUuid: "u", sessionId };