notesoup 0.39.0 → 0.40.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 (53) hide show
  1. package/README.md +5 -2
  2. package/dist/src/boot/render.js +2 -2
  3. package/dist/src/boot/text.d.ts +0 -4
  4. package/dist/src/boot/text.js +9 -13
  5. package/dist/src/history/history.d.ts +23 -18
  6. package/dist/src/history/history.js +37 -20
  7. package/dist/src/history/query.d.ts +37 -49
  8. package/dist/src/history/query.js +114 -56
  9. package/dist/src/notes/store.d.ts +3 -4
  10. package/dist/src/notes/store.js +12 -16
  11. package/dist/src/pi/history-tools.d.ts +1 -1
  12. package/dist/src/pi/history-tools.js +2 -3
  13. package/dist/src/pi/runtime.js +1 -1
  14. package/dist/src/pi/tool-names.d.ts +0 -4
  15. package/dist/src/pi/tool-names.js +0 -4
  16. package/dist/src/tools/history.d.ts +24 -33
  17. package/dist/src/tools/history.js +57 -98
  18. package/dist/src/tools/notes.d.ts +26 -58
  19. package/dist/src/tools/notes.js +85 -103
  20. package/dist/src/tools/result.d.ts +16 -13
  21. package/dist/src/tools/result.js +24 -50
  22. package/dist/src/tools/schema.d.ts +2 -2
  23. package/dist/src/tools/schema.js +3 -3
  24. package/dist/test/agent-loop.test.js +1 -1
  25. package/dist/test/boot.integration.test.js +1 -1
  26. package/dist/test/claude-mod.test.js +4 -4
  27. package/dist/test/dependencies.test.js +1 -1
  28. package/dist/test/helpers/extension.js +2 -3
  29. package/dist/test/history.integration.test.js +200 -123
  30. package/dist/test/host-neutral.test.js +32 -58
  31. package/dist/test/notes-library.test.js +8 -8
  32. package/dist/test/notes.integration.test.js +75 -57
  33. package/dist/test/notes.test.js +44 -42
  34. package/docs/architecture.md +3 -3
  35. package/docs/notes-library.md +6 -6
  36. package/docs/tool-results.md +15 -25
  37. package/mods/notesoup/.claude-plugin/plugin.json +1 -1
  38. package/mods/notesoup/dist/claude/helper.js +119 -178
  39. package/mods/notesoup/hooks/register.ts +1 -2
  40. package/package.json +1 -1
  41. package/skills/memory/SKILL.md +6 -6
  42. package/src/boot/render.ts +2 -2
  43. package/src/boot/text.ts +9 -17
  44. package/src/history/history.ts +36 -20
  45. package/src/history/query.ts +130 -55
  46. package/src/notes/store.ts +15 -18
  47. package/src/pi/history-tools.ts +2 -3
  48. package/src/pi/runtime.ts +1 -1
  49. package/src/pi/tool-names.ts +0 -4
  50. package/src/tools/history.ts +61 -100
  51. package/src/tools/notes.ts +84 -97
  52. package/src/tools/result.ts +24 -49
  53. package/src/tools/schema.ts +3 -3
@@ -46,7 +46,7 @@ test("custom reset marker removes old provider context while history remains sea
46
46
  assert.ok(oldSeq);
47
47
  const read = resultRead(await call(captured, "history_read", { seq: oldSeq }, ctx));
48
48
  assert.match(read.content, /OLD-UNIQUE-TRANSCRIPT/);
49
- const found = resultData(await call(captured, "history_search", { query: "needle" }, ctx));
49
+ const found = resultData(await call(captured, "history_list", { query: "needle" }, ctx));
50
50
  assert.equal(found.items.length, 1);
51
51
  assert.equal(found.items[0]?.seq, oldSeq);
52
52
  });
@@ -81,8 +81,8 @@ test("Claude helper refuses schema-invalid parameters before any operation runs"
81
81
  const cases = [
82
82
  { name: "a string offset", params: { address, offset_chars: "0" } },
83
83
  { name: "a fractional offset", params: { address, offset_chars: 0.5 } },
84
- { name: "a zero limit", params: { address, limit_chars: 0 } },
85
- { name: "a limit past the maximum", params: { address, limit_chars: 999_999_999 } },
84
+ { name: "a zero limit", params: { address, max_chars: 0 } },
85
+ { name: "a limit past the maximum", params: { address, max_chars: 999_999_999 } },
86
86
  ];
87
87
  for (const { name, params } of cases) {
88
88
  const refused = JSON.parse(await handleLine(JSON.stringify({ op: "tool", tool: "notes_read", identity, params })));
@@ -95,14 +95,14 @@ test("Claude helper refuses schema-invalid parameters before any operation runs"
95
95
  const absent = await callTool("notes_read", { address: "rejected.md" });
96
96
  assert.equal(absent.outcome.ok, false);
97
97
  assert.equal(absent.outcome.error?.code, "not_found", "the refused write never reached the store");
98
- const valid = await callTool("notes_read", { address, offset_chars: 0, limit_chars: 8 });
98
+ const valid = await callTool("notes_read", { address, offset_chars: 0, max_chars: 8 });
99
99
  assert.equal(valid.outcome.ok, true, "a schema-valid window still reads");
100
100
  assert.match(valid.text, /^boundary\.md/);
101
101
  });
102
102
  test("Claude helper boot uses actual Claude note tool bindings and a fresh snapshot", async () => {
103
103
  const boot = await dispatch({ op: "boot", identity, openedAt: 1700000000000, tools: {
104
104
  notes: "mcp__notesoup__notes_*", notesList: "mcp__notesoup__notes_list",
105
- history: "history unavailable", historyWindows: "history_windows unavailable", historyList: "history_list unavailable", historySearch: "history_search unavailable", historyRead: "history_read unavailable",
105
+ history: "history unavailable",
106
106
  remaining: "remaining unavailable", wipe: "wipe unavailable",
107
107
  } });
108
108
  assert.match(boot, /mcp__notesoup__notes_\*/);
@@ -93,7 +93,7 @@ test("configured extension source and moved dream CLI are executable current ent
93
93
  registerTool(tool) { tools.push(tool); },
94
94
  registerCommand(name) { commands.push(name); },
95
95
  });
96
- assert.deepEqual(tools.map((tool) => tool.name).sort(), ["clear_memory", "get_context_remaining", "history_list", "history_read", "history_search", "history_windows", "notes_list", "notes_read", "notes_search", "notes_update", "notes_write"]);
96
+ assert.deepEqual(tools.map((tool) => tool.name).sort(), ["clear_memory", "get_context_remaining", "history_list", "history_read", "history_windows", "notes_list", "notes_read", "notes_search", "notes_update", "notes_write"]);
97
97
  assert.deepEqual(commands.sort(), ["clear-memory", "cm", "notesoup"]);
98
98
  const help = execFileSync(process.execPath, [resolve(root, manifest.bin.dream), "--help"], { cwd: root, encoding: "utf8" });
99
99
  assert.ok(help.startsWith("dream doctor [--notes-home <dir>]"));
@@ -210,8 +210,7 @@ function isTextWindow(value) {
210
210
  if (typeof value !== "object" || value === null)
211
211
  return false;
212
212
  const candidate = value;
213
- return typeof candidate.text === "string" && typeof candidate.offset_chars === "number" &&
214
- typeof candidate.total_chars === "number" &&
213
+ return typeof candidate.text === "string" && typeof candidate.total_chars === "number" &&
215
214
  (candidate.next_offset_chars === null || typeof candidate.next_offset_chars === "number");
216
215
  }
217
216
  /** Data of a successful outcome, asserting both the structured success and the non-error result. */
@@ -225,7 +224,7 @@ export function resultData(result) {
225
224
  export function resultError(result) {
226
225
  const outcome = outcomeOf(result);
227
226
  assert.equal(result.isError, true, "a refusal is delivered as an error result");
228
- const error = { code: outcome.code, message: outcome.error, ...(outcome.details === undefined ? {} : { details: outcome.details }) };
227
+ const error = { code: outcome.code, message: outcome.error };
229
228
  assert.ok(isOperationError(error), "refusal carries a code and an error message");
230
229
  return error;
231
230
  }