notesoup 0.59.2 → 0.60.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 (62) hide show
  1. package/README.md +3 -17
  2. package/dist/plugins/claude/src/helper.js +1 -2
  3. package/dist/plugins/codex/src/mcp.js +1 -2
  4. package/dist/plugins/dsh/tools.js +1 -2
  5. package/dist/plugins/pi/notes/tools.d.ts +1 -1
  6. package/dist/plugins/pi/notes/tools.js +2 -3
  7. package/dist/src/history/history.d.ts +10 -11
  8. package/dist/src/history/history.js +8 -19
  9. package/dist/src/history/query.d.ts +3 -14
  10. package/dist/src/history/query.js +73 -85
  11. package/dist/src/index.d.ts +1 -1
  12. package/dist/src/index.js +1 -1
  13. package/dist/src/notes/address.js +3 -3
  14. package/dist/src/notes/store.d.ts +2 -4
  15. package/dist/src/notes/store.js +1 -2
  16. package/dist/src/tools/history.d.ts +4 -6
  17. package/dist/src/tools/history.js +69 -29
  18. package/dist/src/tools/notes.d.ts +18 -78
  19. package/dist/src/tools/notes.js +39 -50
  20. package/dist/src/tools/schema.d.ts +0 -1
  21. package/dist/src/tools/schema.js +0 -1
  22. package/dist/test/claude-history.test.js +5 -6
  23. package/dist/test/claude-mod.test.js +6 -7
  24. package/dist/test/codex-history.test.js +1 -1
  25. package/dist/test/codex-plugin.test.js +1 -2
  26. package/dist/test/dependencies.test.js +2 -2
  27. package/dist/test/dsh.test.js +2 -2
  28. package/dist/test/history-corpus.test.js +21 -36
  29. package/dist/test/history-summary-cache.test.js +3 -3
  30. package/dist/test/history.integration.test.js +53 -106
  31. package/dist/test/host-neutral.test.js +1 -1
  32. package/dist/test/note-policy.test.js +5 -5
  33. package/dist/test/notes-cwd.test.js +5 -5
  34. package/dist/test/notes-query-namespaces.test.js +2 -6
  35. package/dist/test/notes.integration.test.js +30 -35
  36. package/dist/test/notes.test.js +12 -14
  37. package/dist/test/project-namespace.test.js +3 -3
  38. package/docs/architecture.md +3 -3
  39. package/docs/claude-code-mod.md +2 -2
  40. package/docs/codex.md +1 -1
  41. package/docs/dsh.md +2 -2
  42. package/docs/history-sessions.md +8 -9
  43. package/docs/notes-library.md +3 -3
  44. package/docs/tool-results.md +12 -6
  45. package/package.json +1 -1
  46. package/plugins/claude/dist/claude/helper.js +162 -153
  47. package/plugins/claude/skills/memory/SKILL.md +6 -6
  48. package/plugins/claude/src/helper.ts +1 -2
  49. package/plugins/codex/README.md +1 -1
  50. package/plugins/codex/dist/codex/notesoup.js +161 -152
  51. package/plugins/codex/src/mcp.ts +1 -2
  52. package/plugins/dsh/tools.ts +1 -2
  53. package/plugins/pi/notes/tools.ts +2 -3
  54. package/skills/memory/SKILL.md +6 -6
  55. package/src/history/history.ts +11 -16
  56. package/src/history/query.ts +67 -99
  57. package/src/index.ts +1 -1
  58. package/src/notes/address.ts +2 -2
  59. package/src/notes/store.ts +3 -6
  60. package/src/tools/history.ts +60 -29
  61. package/src/tools/notes.ts +39 -54
  62. package/src/tools/schema.ts +0 -1
@@ -149,7 +149,7 @@ test("a copied plugin without src or node_modules still initializes and lists al
149
149
  const listed = await client.listTools();
150
150
  assert.deepEqual(listed.tools.map((tool) => tool.name).sort(), [
151
151
  "history_list", "history_read",
152
- "notes_list", "notes_read", "notes_search", "notes_update", "notes_write",
152
+ "notes_list", "notes_read", "notes_update", "notes_write",
153
153
  ]);
154
154
  for (const tool of listed.tools) {
155
155
  const schema = tool.outputSchema;
@@ -184,7 +184,6 @@ test("bundled Codex MCP reads another harness and wildcard results retain their
184
184
  const limited = await call(client, { name: "history_list", arguments: { session: "*", query: "needle", limit: 1 }, _meta: metaFor(ROOT, ROOT) });
185
185
  assert.equal(limited.structuredContent.has_older, true);
186
186
  assert.equal(limited.structuredContent.items.length, 1, "the limit bounds the page to one item");
187
- assert.doesNotMatch(textOf(limited), /before_seq|after_seq/);
188
187
  const invalid = await call(client, { name: "history_read", arguments: { session: "*", seq: 1 }, _meta: metaFor(ROOT, ROOT) });
189
188
  assert.equal(errorCode(invalid), "invalid_session");
190
189
  });
@@ -246,7 +246,7 @@ test("AST guard sees every literal module edge, not import-like prose or comment
246
246
  test("the core entry is host-neutral and the Pi plugin entry owns the extension", () => {
247
247
  assert.deepEqual(Object.keys(core).sort(), [
248
248
  "DEFAULT_BOOT_TOOL_NAMES", "NoteError", "createNotesStore", "deriveThresholds", "effectiveNotePolicy", "historyList", "historyRead",
249
- "loadNotesSnapshot", "noteIdentity", "notesIdentityForCall", "notesList", "notesRead", "notesSearch", "notesToolContext", "notesUpdate", "notesWrite", "projectHistory",
249
+ "loadNotesSnapshot", "noteIdentity", "notesIdentityForCall", "notesList", "notesRead", "notesToolContext", "notesUpdate", "notesWrite", "projectHistory",
250
250
  "projectKey", "remainingBudget", "renderBootBlock", "renderProtocolBlock", "selectContinuation", "slugify",
251
251
  "tokenBudgetGuidance", "unavailableNotesSnapshot", "warningPrompt", "WARNING_BODY",
252
252
  ].sort(), "the core exports a curated host-neutral surface and no extension");
@@ -269,7 +269,7 @@ test("the configured extension source is the executable current entry", async ()
269
269
  registerTool(tool) { tools.push(tool); },
270
270
  registerCommand(name) { commands.push(name); },
271
271
  });
272
- assert.deepEqual(tools.map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "empty_brain", "get_context_remaining", "history_list", "history_read", "notes_list", "notes_read", "notes_search", "notes_update", "notes_write"]);
272
+ assert.deepEqual(tools.map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "empty_brain", "get_context_remaining", "history_list", "history_read", "notes_list", "notes_read", "notes_update", "notes_write"]);
273
273
  assert.deepEqual(tools.filter((tool) => tool.exposure === "deferred").map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "history_list", "history_read"], "dream and history tools stay hidden until searched");
274
274
  assert.deepEqual(commands.sort(), ["empty", "fresh-window", "notesoup"]);
275
275
  });
@@ -8,7 +8,7 @@ import { tmpdir } from "node:os";
8
8
  import { join } from "node:path";
9
9
  import { resolveProjectNamespace } from "../src/notes/project-namespace.js";
10
10
  import { WINDOW_IDENTITY_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG } from "../src/boot/text.js";
11
- import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../src/tools/notes.js";
11
+ import { notesList, notesRead, notesUpdate, notesWrite } from "../src/tools/notes.js";
12
12
  import { historyList, historyRead } from "../src/tools/history.js";
13
13
  import { notesToolContext } from "../src/tools/notes-context.js";
14
14
  import { success } from "../src/result.js";
@@ -27,7 +27,7 @@ function system(request) { return typeof request.system === "string" ? request.s
27
27
  function code(expected) { return (error) => error?.code === expected; }
28
28
  test("dsh preserves shared tool and parameter descriptions verbatim", async (t) => {
29
29
  const { ctx } = await dshFixture(t);
30
- for (const operation of [notesWrite, notesUpdate, notesRead, notesList, notesSearch, historyList, historyRead]) {
30
+ for (const operation of [notesWrite, notesUpdate, notesRead, notesList, historyList, historyRead]) {
31
31
  const registered = ctx.tools.get(operation.name);
32
32
  assert.equal(registered.description, operation.description);
33
33
  const properties = registered.parameters.properties;
@@ -112,18 +112,17 @@ test("all single-session recipes preserve the resolved identity, including folde
112
112
  { seq: 4, windowId: "w", role: "assistant", text: "last" },
113
113
  ] }], 4, new Set([1, 2, 3, 4]));
114
114
  const ctx = context([descriptor("claude", "target-session", p)]);
115
- const page = await historyList.execute({ session: "claude:target", limit: 1, after_seq: 1, before_seq: 5, from: "newest" }, ctx);
115
+ const page = await historyList.execute({ session: "claude:target", limit: 1, before: 5 }, ctx);
116
116
  assert.equal(data(page).has_older, true);
117
- assert.match(historyList.render(page), /→ older: \{"session":"claude:target-session","before_seq":4\}/);
118
- const first = await historyList.execute({ session: "target", from: "oldest", limit: 1 }, ctx);
117
+ assert.match(historyList.render(page), /→ older: \{"session":"claude:target-session","before":4\}/);
118
+ const first = await historyList.execute({ session: "target", after: 0, limit: 1 }, ctx);
119
119
  assert.equal(data(first).has_newer, true);
120
- assert.match(historyList.render(first), /→ newer: \{"session":"claude:target-session","after_seq":1\}/);
120
+ assert.match(historyList.render(first), /→ newer: \{"session":"claude:target-session","after":1\}/);
121
121
  const foldPage = await historyList.execute({ session: "target", limit: 3 }, ctx);
122
122
  const expand = /→ expand: (\{[^\n]+\})/.exec(historyList.render(foldPage));
123
123
  assert.ok(expand);
124
124
  const recipe = JSON.parse(expand[1]);
125
125
  assert.equal(recipe.session, "claude:target-session");
126
- assert.equal("from" in recipe, false);
127
126
  assert.deepEqual(data(await historyList.execute(recipe, ctx)).items.map((item) => item.seq), [2]);
128
127
  assert.match(historyList.render(foldPage), /session claude:target-session \| seq 1 \| user/);
129
128
  const read = await historyRead.execute({ session: "target", seq: 3 }, ctx);
@@ -144,30 +143,21 @@ test("recipes expand a fold at seq 1 and read its neighborhood from the start",
144
143
  const expand = /→ expand: (\{[^\n]+\})/.exec(historyList.render(folded));
145
144
  assert.ok(expand);
146
145
  const recipe = JSON.parse(expand[1]);
147
- assert.equal(recipe.after_seq, 0);
146
+ assert.equal(recipe.after, 0);
148
147
  assert.ok(Check(historyList.parameters, recipe));
149
148
  assert.deepEqual(data(await historyList.execute(recipe, ctx)).items.map((item) => item.seq), [1, 2]);
150
149
  const read = await historyRead.execute({ session: "first-fold", seq: 3 }, ctx);
151
150
  const neighborhood = /neighborhood → `history_list`\((\{[^\n]+\})\)/.exec(historyRead.render(read));
152
151
  assert.ok(neighborhood);
153
152
  const nearby = JSON.parse(neighborhood[1]);
154
- assert.equal(nearby.after_seq, 0);
153
+ assert.equal(nearby.after, 0);
155
154
  assert.ok(Check(historyList.parameters, nearby));
156
155
  assert.ok(data(await historyList.execute(nearby, ctx)).items.length > 0);
157
156
  });
158
157
  test("wildcard refusals precede discovery, and read accepts no wildcard selector", async () => {
159
158
  const ctx = { current: () => { throw new Error("must not load current"); }, corpus: { currentHarness: "pi", sessions: async () => { throw new Error("must not discover"); } } };
160
- for (const session of ["*", "pi:*", "pre*fix"]) {
161
- for (const query of [undefined, "", [], ["", ""], "needle"]) {
162
- for (const bounds of [{ before_seq: 10 }, { after_seq: 0 }, { after_seq: 1 }, { before_seq: 10, after_seq: 1 }]) {
163
- refusal(await historyList.execute({ session, query, ...bounds }, ctx), "invalid_bounds");
164
- }
165
- }
166
- }
167
- for (const session of ["*", "pi:*", "cl*", "dsh:pre*suffix"]) {
168
- refusal(await historyRead.execute({ session, seq: 1 }, ctx), "invalid_session");
169
- }
170
- refusal(await historyList.execute({ session: "*", query: "needle", since: "not-a-date" }, ctx), "invalid_time");
159
+ assert.match(refusal(await historyList.execute({ session: "pi:*", query: "needle", after: "3" }, ctx), "invalid_bounds"), /requires times/);
160
+ refusal(await historyRead.execute({ session: "*", seq: 1 }, ctx), "invalid_session");
171
161
  });
172
162
  test("native filesystem discovery decodes three harnesses, compressed Codex, and keeps source bytes/mtime unchanged", async (t) => {
173
163
  const f = await fixture(t);
@@ -205,14 +195,12 @@ test("wildcard query merges every role chronologically, limits from either end,
205
195
  assert.deepEqual(newest.items, page.items.slice(-2));
206
196
  assert.equal(newest.has_older, true);
207
197
  assert.equal(newest.has_newer, false);
208
- assert.doesNotMatch(historyList.render(newestResult), /before_seq|after_seq/);
209
- const oldestResult = await historyList.execute({ session: "*", query: "needle", limit: 2, from: "oldest" }, ctx);
198
+ const oldestResult = await historyList.execute({ session: "*", query: "needle", limit: 2, after: "2026-10-06" }, ctx);
210
199
  const oldest = data(oldestResult);
211
200
  assert.deepEqual(oldest.items, page.items.slice(0, 2));
212
201
  assert.equal(oldest.has_older, false);
213
202
  assert.equal(oldest.has_newer, true);
214
- assert.doesNotMatch(historyList.render(oldestResult), /before_seq|after_seq/);
215
- const filtered = data(await historyList.execute({ session: "*", query: "needle", roles: ["tool", "context"], since: "2026-10-06T01:02:05", until: "2026-10-06T01:02:07Z" }, ctx));
203
+ const filtered = data(await historyList.execute({ session: "*", query: "needle", roles: ["tool", "context"], after: "2026-10-06T01:02:04", before: "2026-10-06T01:02:07Z" }, ctx));
216
204
  assert.deepEqual(filtered.items.map((item) => item.role), ["tool"]);
217
205
  const harness = data(await historyList.execute({ session: "claude:*", query: "needle" }, ctx));
218
206
  assert.ok(harness.items.every((item) => "session" in item && item.session === "claude:claude-one"));
@@ -235,12 +223,11 @@ test("bounded wildcard search scans every session and orders untimed and tied ma
235
223
  }));
236
224
  const ctx = context(sessions);
237
225
  const ids = (page) => page.items.map((item) => "seq" in item ? [item.session, item.seq] : null);
238
- assert.deepEqual(ids(data(await historyList.execute({ session: "*", query: "needle", from: "oldest", limit: 3 }, ctx))), [["pi:a", 1], ["pi:a", 2], ["pi:m", 1]]);
226
+ assert.deepEqual(ids(data(await historyList.execute({ session: "*", query: "needle", after: "2026-10-06", limit: 3 }, ctx))), [["pi:a", 3], ["pi:a", 4], ["pi:a", 5]]);
239
227
  assert.deepEqual(seen, ["z", "a", "m"]);
240
228
  seen.length = 0;
241
229
  assert.deepEqual(ids(data(await historyList.execute({ session: "*", query: "needle", limit: 3 }, ctx))), [["pi:z", 198], ["pi:z", 199], ["pi:z", 200]]);
242
230
  assert.deepEqual(seen, ["z", "a", "m"]);
243
- assert.deepEqual(ids(data(await historyList.execute({ session: "*", query: "needle", from: "oldest", limit: 1, since: AT }, ctx))), [["pi:a", 3]]);
244
231
  });
245
232
  test("query-less wildcards browse recent sessions, normalize empty queries, and keep canonical IDs", async (t) => {
246
233
  const { ctx } = await fixture(t);
@@ -278,7 +265,7 @@ test("session overviews order discovery by mtime, stop at the session limit, the
278
265
  assert.deepEqual(loaded, Array.from({ length: 20 }, (_, index) => 24 - index));
279
266
  assert.deepEqual(recent.items.map((item) => item.session), loaded.map((index) => `pi:s-${index}`));
280
267
  loaded.length = 0;
281
- const oldest = data(await historyList.execute({ session: "*", from: "oldest", limit: 2 }, ctx));
268
+ const oldest = data(await historyList.execute({ session: "*", after: AT, limit: 2 }, ctx));
282
269
  assert.equal(oldest.has_older, false);
283
270
  assert.equal(oldest.has_newer, true);
284
271
  assert.deepEqual(loaded, [0, 1]);
@@ -308,12 +295,11 @@ test("session representatives respect visibility, role/time filters, opening use
308
295
  assert.deepEqual(await chosen({ roles: ["context", "tool"] }), [8]);
309
296
  assert.deepEqual(await chosen({ roles: ["tool"] }), [6]);
310
297
  assert.deepEqual(await chosen({ roles: [] }), []);
311
- assert.deepEqual(await chosen({ since: at(2), until: at(3) }), [4]);
312
- assert.deepEqual(await chosen({ since: at(3) }), [5]);
313
- assert.deepEqual(await chosen({ until: at(1) }), [1]);
314
- assert.deepEqual(await chosen({ since: at(4) }), [8]);
315
- assert.deepEqual(await chosen({ since: at(4), roles: ["user"] }), []);
316
- assert.deepEqual(await chosen({ since: at(7) }), []);
298
+ assert.deepEqual(await chosen({ after: at(1), before: at(3) }), [4]);
299
+ assert.deepEqual(await chosen({ after: at(2) }), [5]);
300
+ assert.deepEqual(await chosen({ before: at(1) }), [1]);
301
+ assert.deepEqual(await chosen({ after: at(4) }), [8]);
302
+ assert.deepEqual(await chosen({ after: at(4), roles: ["user"] }), []);
317
303
  const noUsers = { ...p, windows: p.windows.map((window) => ({ ...window, items: window.items.filter((item) => item.role !== "user") })) };
318
304
  const fallback = data(await historyList.execute({ session: "*" }, context([descriptor("pi", "assistant-topic", noUsers)])));
319
305
  assert.deepEqual(fallback.items.map((item) => "seq" in item ? item.seq : null), [4]);
@@ -418,13 +404,12 @@ test("oversized cross-session reads/searches obey both wire budgets and retain c
418
404
  });
419
405
  test("wildcard byte budgets report retained candidates beyond either end", async () => {
420
406
  const ctx = context([descriptor("pi", "large", projection("needle " + "x".repeat(20_000)))]);
421
- for (const from of ["newest", "oldest"]) {
422
- const result = await historyList.execute({ session: "*", query: "needle", from, limit: 5, max_chars_per_item: 50_000 }, ctx);
407
+ for (const after of [undefined, AT]) {
408
+ const result = await historyList.execute({ session: "*", query: "needle", after, limit: 5, max_chars_per_item: 50_000 }, ctx);
423
409
  const page = data(result);
424
410
  assert.ok(page.items.length < 5);
425
- assert.equal(page.has_older, from === "newest");
426
- assert.equal(page.has_newer, from === "oldest");
427
- assert.doesNotMatch(historyList.render(result), /before_seq|after_seq/);
411
+ assert.equal(page.has_older, after === undefined);
412
+ assert.equal(page.has_newer, after !== undefined);
428
413
  }
429
414
  });
430
415
  test("qualified lookup and current-harness matches do not inspect unrelated roots", async (t) => {
@@ -138,7 +138,7 @@ test("search, roles, time filters and explicit sessions bypass the summary while
138
138
  for (const query of ["", [], ["", ""]])
139
139
  await historyList.execute({ session: "pi:*", query }, ctx);
140
140
  assert.equal(reads.length, 1);
141
- for (const filters of [{ roles: ["assistant"] }, { since: "2026-10-07" }, { until: "2026-10-07" }, { query: "later" }, { session: "pi:offline" }]) {
141
+ for (const filters of [{ roles: ["assistant"] }, { after: AT }, { before: "2026-10-07" }, { query: "later" }, { session: "pi:offline" }]) {
142
142
  const before = reads.length;
143
143
  const params = { session: "pi:*", ...filters };
144
144
  const result = await historyList.execute(params, ctx);
@@ -146,8 +146,8 @@ test("search, roles, time filters and explicit sessions bypass the summary while
146
146
  const plain = { current: () => projection("live"), corpus: { currentHarness: "dsh", sessions: async (harness) => (await f.corpus().sessions(harness)).map(({ loadRepresentative: _cache, ...session }) => session) } };
147
147
  assert.deepEqual(result, await historyList.execute(params, plain));
148
148
  }
149
- assert.equal(data(await historyList.execute({ session: "pi:*", since: "2026-10-07" }, ctx)).items.length, 1);
150
- assert.equal(data(await historyList.execute({ session: "pi:*", until: AT }, ctx)).items.length, 0, "until is exclusive");
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");
151
151
  });
152
152
  test("corrupt cache/schema and unwritable roots fall back; a warm cache cannot hide malformed or unsupported transcripts", async (t) => {
153
153
  const f = await fixture(t);
@@ -49,34 +49,12 @@ test("Pi registered tools resolve another persisted session and propagate its id
49
49
  const current = resultData(await call(captured, "history_read", { session: `pi:${session.getSessionId()}`, seq: 1 }, ctx));
50
50
  assert.equal(current.session, `pi:${session.getSessionId()}`);
51
51
  });
52
- test("history_list exposes bounded paging, `from` and a literal query", () => {
52
+ test("Pi registers the shared history schemas", () => {
53
53
  const captured = makeExtension(manager());
54
- const readSchema = captured.tools.get("history_read")?.parameters;
55
- assert.ok(readSchema.properties?.seq);
56
- assert.deepEqual(readSchema.required, ["seq"]);
57
- assert.equal(readSchema.properties?.window_id, undefined, "history_read accepts no window selector");
58
54
  const listSchema = captured.tools.get("history_list").parameters;
59
- const properties = listSchema.properties;
60
- assert.equal(properties.before_seq?.minimum, 1, "bounds are positive seqs");
61
- assert.equal(properties.after_seq?.minimum, 0);
62
- assert.equal(Check(listSchema, { before_seq: 0 }), false, "before_seq:0 is refused by the schema, not answered with a silent empty page");
63
- assert.equal(Check(listSchema, { after_seq: 0 }), true);
64
- assert.equal(Check(listSchema, { after_seq: -1 }), false);
65
- assert.deepEqual(properties.from?.anyOf?.map((item) => item.const), ["newest", "oldest"]);
66
- assert.ok(properties.query);
67
- assert.deepEqual(properties.roles?.items?.anyOf?.map((item) => item.const), ["user", "assistant", "tool", "context"], "the role filter carries the four public roles");
68
- assert.ok(properties.since, "the time filter has a since param");
69
- assert.ok(properties.until, "the time filter has an until param");
70
- assert.equal(Check(listSchema, { since: "2026-10-10", until: "2026-10-10T06:00:00Z" }), true);
71
- assert.equal(Check(listSchema, { since: "" }), false, "an empty time value is refused by the schema");
72
- assert.equal(Check(listSchema, { query: "needle", from: "oldest", roles: ["tool"] }), true);
73
- assert.equal(Check(listSchema, { from: "recent" }), false);
74
- assert.equal(Check(listSchema, { query: "" }), true, "an empty literal is equivalent to an omitted query");
75
- for (const invalid of [{ roles: ["tool_call"] }, { roles: ["system"] }, { roles: [] }]) {
76
- assert.equal(Check(listSchema, invalid), false, JSON.stringify(invalid));
77
- }
78
- assert.deepEqual(Object.keys(properties).sort(), ["session", "query", "roles", "before_seq", "after_seq", "since", "until", "from", "limit", "max_chars_per_item"].sort());
79
- assert.equal(Check(listSchema, { window_id: "anything" }), false, "removed filters are refused as unknown parameters");
55
+ assert.deepEqual(listSchema, historyList.parameters);
56
+ assert.ok(Check(listSchema, { after: 0, before: "2026-10-10", query: "needle", context: 1 }));
57
+ assert.deepEqual(captured.tools.get("history_read").parameters, historyRead.parameters);
80
58
  });
81
59
  test("every history operation declares a result schema its own payload satisfies", async () => {
82
60
  const session = manager();
@@ -159,67 +137,48 @@ test("history page schema exposes plain boolean paging flags", () => {
159
137
  assert.equal("description" in field, false);
160
138
  }
161
139
  });
162
- test("history_list pages from the end `from` names and returns bounded ranges", async () => {
140
+ test("history_list pages forward with after and otherwise back from before", async () => {
163
141
  const session = manager();
164
142
  const captured = makeExtension(session);
165
143
  const ctx = context(session);
166
- for (let index = 1; index <= 5; index++)
167
- appendText(session, "user", `message-${index}`);
168
- assert.deepEqual(seqs(await call(captured, "history_list", { limit: 2 }, ctx)), [4, 5], "the default newest page is the highest seqs, ascending");
169
- assert.deepEqual(seqs(await call(captured, "history_list", { limit: 2, from: "oldest" }, ctx)), [1, 2], "from oldest takes the other end of the same selection");
170
- appendText(session, "user", "message-6");
171
- const older = page(await call(captured, "history_list", { before_seq: 5, limit: 2 }, ctx));
172
- assert.deepEqual(older.items.map((item) => item.seq), [3, 4]);
173
- assert.equal(older.has_older, true);
174
- assert.equal(older.has_newer, false);
175
- assert.deepEqual(seqs(await call(captured, "history_list", { after_seq: 5, limit: 2, from: "oldest" }, ctx)), [6]);
176
- for (let index = 7; index <= 10; index++)
144
+ for (let index = 1; index <= 7; index++)
177
145
  appendText(session, "user", `message-${index}`);
178
- assert.deepEqual(seqs(await call(captured, "history_list", { after_seq: 0, limit: 3 }, ctx)), [1, 2, 3]);
179
- assert.deepEqual(seqs(await call(captured, "history_list", { after_seq: 2, limit: 3 }, ctx)), [3, 4, 5]);
180
- assert.deepEqual(seqs(await call(captured, "history_list", { after_seq: 2, limit: 3, from: "newest" }, ctx)), [8, 9, 10]);
181
- assert.deepEqual(seqs(await call(captured, "history_list", { after_seq: 2, before_seq: 10, limit: 3 }, ctx)), [3, 4, 5]);
182
- assert.deepEqual(seqs(await call(captured, "history_list", { after_seq: 2, before_seq: 10, limit: 3, from: "newest" }, ctx)), [7, 8, 9]);
183
- assert.deepEqual(seqs(await call(captured, "history_list", { before_seq: 10, limit: 3, from: "oldest" }, ctx)), [1, 2, 3]);
184
- let forward = { after_seq: 2, before_seq: 10, limit: 3 };
185
- const forwardSeqs = [];
186
- while (true) {
187
- const result = await call(captured, "history_list", forward, ctx);
188
- const current = page(result);
189
- forwardSeqs.push(...seqs(result));
190
- if (!current.has_newer)
191
- break;
192
- const footer = /→ newer: (\{[^\n]+\})/.exec(rendered(result));
193
- assert.ok(footer);
194
- forward = { ...forward, ...JSON.parse(footer[1]) };
195
- }
196
- assert.deepEqual(forwardSeqs, [3, 4, 5, 6, 7, 8, 9]);
197
- let backward = { after_seq: 2, before_seq: 10, limit: 3, from: "newest" };
198
- const backwardPages = [];
199
- while (true) {
200
- const result = await call(captured, "history_list", backward, ctx);
201
- const current = page(result);
202
- backwardPages.unshift(seqs(result));
203
- if (!current.has_older)
204
- break;
205
- const footer = /→ older: (\{[^\n]+\})/.exec(rendered(result));
206
- assert.ok(footer);
207
- backward = { ...backward, ...JSON.parse(footer[1]) };
146
+ const list = (params) => call(captured, "history_list", params, ctx);
147
+ assert.deepEqual(seqs(await list({ limit: 2 })), [6, 7]);
148
+ assert.deepEqual(seqs(await list({ after: 0, limit: 2 })), [1, 2]);
149
+ assert.deepEqual(seqs(await list({ after: "2", limit: 2 })), [3, 4]);
150
+ const older = await list({ before: 6, limit: 2 });
151
+ assert.deepEqual(seqs(older), [4, 5]);
152
+ assert.match(rendered(older), /→ older: \{"before":4\}/);
153
+ assert.deepEqual(seqs(await list({ after: 1, before: 5 })), [2, 3, 4]);
154
+ });
155
+ test("history_list merges context across hit bounds without moving the page anchor", async () => {
156
+ const session = manager();
157
+ const captured = makeExtension(session);
158
+ const ctx = context(session);
159
+ for (const text of ["setup", "needle one", "shared reply", "needle two", "follow-up", "unrelated", "needle three"]) {
160
+ appendText(session, text.startsWith("needle") ? "user" : "assistant", text);
208
161
  }
209
- assert.deepEqual(backwardPages.flat(), [3, 4, 5, 6, 7, 8, 9]);
162
+ const result = await call(captured, "history_list", { after: 1, query: "needle", roles: ["user"], limit: 2, context: 1 }, ctx);
163
+ assert.deepEqual(page(result).items.map(item => [item.content, !!item.context]), [
164
+ ["setup", true], ["needle one", false], ["shared reply", true], ["needle two", false], ["follow-up", true],
165
+ ]);
166
+ assert.ok(Check(historyList.outputSchema, result.structuredContent));
167
+ assert.match(rendered(result), /→ newer: \{"after":4\}/);
168
+ assert.match(resultError(await call(captured, "history_list", { context: 1 }, ctx)).message, /requires a non-empty `query`/);
210
169
  });
211
170
  test("a one-row page budget admits the newest candidate first", () => {
212
171
  const windowId = "w1";
213
172
  const items = [1, 2, 3].map((seq) => ({ seq, windowId, role: "user", text: `message-${seq}`, createdAt: undefined }));
214
173
  const projection = projectHistory([{ windowId, items }], 12, new Set([1, 2, 3]));
215
- const keptSeqs = (fitsRows, from) => {
216
- const outcome = selectPage(projection, { limit: 3, ...(from === undefined ? {} : { from }) }, (candidate) => candidate.items.length <= fitsRows, 200);
174
+ const keptSeqs = (fitsRows, after) => {
175
+ const outcome = selectPage(projection, { limit: 3, after }, (candidate) => candidate.items.length <= fitsRows, 200);
217
176
  assert.equal(outcome.ok, true);
218
177
  return outcome.ok ? outcome.data.items.map((item) => item.seq) : [];
219
178
  };
220
179
  assert.deepEqual(keptSeqs(1), [3], "a budget for one row admits the newest candidate, not the oldest");
221
180
  assert.deepEqual(keptSeqs(2), [2, 3], "a truncated prefix is the newest rows, delivered in chronological order");
222
- assert.deepEqual(keptSeqs(1, "oldest"), [1], "from oldest keeps the other end when the budget is short");
181
+ assert.deepEqual(keptSeqs(1, { seq: 0 }), [1], "after keeps the forward end when the budget is short");
223
182
  });
224
183
  test("query reports budget failures while tools refuse the page", async () => {
225
184
  const projection = projectHistory([{ windowId: "w1", items: [{ seq: 1, windowId: "w1", role: "user", text: "message" }] }], 1, new Set([1]));
@@ -290,7 +249,7 @@ test("conversation paging prepares ordered folds once, including during first-ro
290
249
  ]);
291
250
  assert.deepEqual(full.data.folded_after, { first_seq: 9, last_seq: 9, count: 1, tools: {} });
292
251
  assert.equal(traversals, 1, "growing the page never re-traverses the source windows");
293
- const oldest = selectPage(projection, { limit: 1, from: "oldest" }, () => true, 1000);
252
+ const oldest = selectPage(projection, { limit: 1, after: { seq: 0 } }, () => true, 1000);
294
253
  assert.ok(oldest.ok);
295
254
  if (oldest.ok)
296
255
  assert.deepEqual(oldest.data.items[0].folded_before, { first_seq: 1, last_seq: 1, count: 1, tools: {} });
@@ -337,7 +296,7 @@ test("list shortening charges folded rows against both text and JSON budgets", a
337
296
  assert.ok(Buffer.byteLength(JSON.stringify(folded.data), "utf8") <= TOOL_OUTPUT_MAX_BYTES);
338
297
  assert.ok(Buffer.byteLength(historyList.render(folded), "utf8") <= TOOL_OUTPUT_MAX_BYTES);
339
298
  });
340
- test("since and until select a half-open time range, compose with query and paging, and refuse bad bounds", async () => {
299
+ test("after and before accept exclusive ISO 8601 times and default to UTC", async () => {
341
300
  const items = [
342
301
  { seq: 1, windowId: "w1", role: "user", text: "first needle", createdAt: "2026-10-10T00:00:00.000Z" },
343
302
  { seq: 2, windowId: "w1", role: "assistant", text: "second", createdAt: "2026-10-10T06:00:00.000Z" },
@@ -351,23 +310,11 @@ test("since and until select a half-open time range, compose with query and pagi
351
310
  assert.equal(outcome.ok, true, JSON.stringify(outcome));
352
311
  return outcome.ok ? outcome.data.items.map((item) => item.seq) : [];
353
312
  };
354
- assert.deepEqual(await selected({ roles: ["user", "assistant"], from: "oldest", since: "2026-10-10T06:00:00Z" }), [2, 3, 4], "since keeps later events and drops one with no time");
355
- assert.deepEqual(await selected({ roles: ["user", "assistant"], from: "oldest", until: "2026-10-10T12:00:00Z" }), [1, 2], "until is exclusive");
356
- assert.deepEqual(await selected({ roles: ["user", "assistant"], from: "oldest", since: "2026-10-10T06:00:00Z", until: "2026-10-10T18:00:00Z" }), [2, 3], "both bounds make a half-open range");
357
- assert.deepEqual(await selected({ query: "needle", from: "oldest", since: "2026-10-10T06:00:00Z" }), [3], "a query composes with the time range");
358
- assert.deepEqual(await selected({ roles: ["user", "assistant"], from: "oldest", since: "2026-10-10T00:00:00Z", until: "2026-10-10T18:00:00Z", after_seq: 1, before_seq: 4 }), [2, 3], "seq paging composes with the time range");
359
- assert.deepEqual(await selected({ roles: ["user", "assistant"], from: "oldest", since: "2026-10-10" }), [1, 2, 3, 4], "a date-only since is inclusive UTC midnight, not local midnight");
360
- assert.deepEqual(await selected({ roles: ["user", "assistant"], from: "oldest", until: "2026-10-10T12:00" }), [1, 2], "a time without an offset is UTC");
361
- const malformed = await historyList.execute({ since: "yesterday" }, projection);
362
- assert.equal(malformed.ok, false);
363
- if (!malformed.ok) {
364
- assert.equal(malformed.error.code, "invalid_time");
365
- assert.match(malformed.error.message, /"yesterday"/, "the refusal names the offending param and value");
366
- }
367
- const inverted = await historyList.execute({ since: "2026-10-11", until: "2026-10-10" }, projection);
368
- assert.equal(inverted.ok, false);
369
- if (!inverted.ok)
370
- assert.equal(inverted.error.code, "invalid_time");
313
+ assert.deepEqual(await selected({ after: "2026-10-10T06:00", limit: 1 }), [3]);
314
+ assert.deepEqual(await selected({ after: "2026-10-10", before: "2026-10-10T18:00Z" }), [2, 3]);
315
+ const malformed = await historyList.execute({ after: "yesterday" }, projection);
316
+ assert.ok(!malformed.ok);
317
+ assert.match(malformed.error.message, /`after`.*"yesterday"/);
371
318
  });
372
319
  test("time bounds also keep untimed events out of the folded conversation view", async () => {
373
320
  const items = [
@@ -376,7 +323,7 @@ test("time bounds also keep untimed events out of the folded conversation view",
376
323
  { seq: 3, windowId: "w1", role: "user", text: "after", createdAt: "2026-10-10T12:00:00.000Z" },
377
324
  ];
378
325
  const projection = projectHistory([{ windowId: "w1", items }], 3, new Set([1, 2, 3]));
379
- const bounded = await historyList.execute({ since: "2026-10-10T00:00:00Z" }, projection);
326
+ const bounded = await historyList.execute({ before: "2026-10-11" }, projection);
380
327
  assert.equal(bounded.ok, true);
381
328
  if (bounded.ok)
382
329
  assert.deepEqual(bounded.data.items.map((item) => `seq ${item.seq}`), ["seq 1", "seq 3"], "an untimed tool event is not folded into a bounded selection");
@@ -414,9 +361,9 @@ test("conversation view folds tools and injected messages, while explicit roles
414
361
  assert.equal(folded.count, 3, "two tool events and one injected context are folded, not the empty assistant message");
415
362
  assert.deepEqual(folded.tools, { bash: 1, read: 1 });
416
363
  assert.equal("custom_types" in folded, false);
417
- const empty = page(await call(captured, "history_list", { roles: ["context"], before_seq: 2 }, ctx));
364
+ const empty = page(await call(captured, "history_list", { roles: ["context"], before: 2 }, ctx));
418
365
  assert.deepEqual(empty.items, []);
419
- const hiddenOnly = page(await call(captured, "history_list", { after_seq: 2, before_seq: 6 }, ctx));
366
+ const hiddenOnly = page(await call(captured, "history_list", { after: 2, before: 6 }, ctx));
420
367
  assert.deepEqual(hiddenOnly.items, []);
421
368
  assert.deepEqual(hiddenOnly.folded_after, { first_seq: 3, last_seq: 4, count: 2, tools: { bash: 1, read: 1 } });
422
369
  const expanded = page(await call(captured, "history_list", { roles: ["tool"] }, ctx));
@@ -583,22 +530,22 @@ test("list renders paging and fold recipes across resets, and read renders a nei
583
530
  session.appendCustomEntry("notesoup/reset-marker", { windowId: "pcw:test:w2" });
584
531
  appendText(session, "user", "current window");
585
532
  const listed = await call(captured, "history_list", {}, ctx);
586
- assert.match(rendered(listed), /→ older: \{"before_seq":\d+\}/, "the footer prints the exact call to page older");
587
- const earlier = page(await call(captured, "history_list", { before_seq: 31, from: "oldest", limit: 30 }, ctx));
533
+ assert.match(rendered(listed), /→ older: \{"before":\d+\}/, "the footer prints the call to page older");
534
+ const earlier = page(await call(captured, "history_list", { before: 31, limit: 30 }, ctx));
588
535
  assert.deepEqual(earlier.items.map((item) => item.seq), Array.from({ length: 30 }, (_, index) => index + 1));
589
- const earlierQuery = page(await call(captured, "history_list", { query: "older window", before_seq: 31, limit: 30 }, ctx));
536
+ const earlierQuery = page(await call(captured, "history_list", { query: "older window", before: 31, limit: 30 }, ctx));
590
537
  assert.equal(earlierQuery.items.length, 30, "queries and seq bounds recover earlier windows without a separate address");
591
- const current = page(await call(captured, "history_list", { after_seq: 30 }, ctx));
538
+ const current = page(await call(captured, "history_list", { after: 30 }, ctx));
592
539
  assert.deepEqual(current.items.map((item) => [item.seq, item.content]), [[31, "current window"]], "the reset marker consumes no address");
593
540
  toolCall(session, "t1", "bash", { command: "ls" });
594
541
  toolResult(session, "t1", "bash", "done");
595
542
  appendText(session, "user", "after tools");
596
543
  const folded = await call(captured, "history_list", {}, ctx);
597
- assert.match(rendered(folded), /→ expand: \{"after_seq":\d+,"before_seq":\d+,"roles":\["tool","context"\]\}/, "a folded row prints its own expand recipe");
544
+ assert.match(rendered(folded), /→ expand: \{"after":\d+,"before":\d+,"roles":\["tool","context"\]\}/, "a folded row prints its own expand recipe");
598
545
  appendText(session, "user", "needle read target");
599
546
  const hits = page(await call(captured, "history_list", { query: "needle read target" }, ctx));
600
547
  const read = await call(captured, "history_read", { seq: hits.items[0].seq }, ctx);
601
- assert.match(rendered(read), /neighborhood → `history_list`\(\{"after_seq":\d+,"before_seq":\d+\}\)/, "a read prints the call for surrounding events");
548
+ assert.match(rendered(read), /neighborhood → `history_list`\(\{"after":\d+,"before":\d+\}\)/, "a read prints the call for surrounding events");
602
549
  });
603
550
  test("compaction summary becomes context and is folded in the default list", async () => {
604
551
  const session = manager();
@@ -628,17 +575,17 @@ test("a query covers every role, carries match offsets and treats empty queries
628
575
  const developers = page(await call(captured, "history_list", { query: "needle", roles: ["context"] }, ctx));
629
576
  assert.deepEqual(developers.items.map((item) => item.role), ["context"]);
630
577
  assert.equal("custom_type" in developers.items[0], false);
631
- const first = page(await call(captured, "history_list", { query: "needle", after_seq: 1, limit: 1, from: "oldest" }, ctx));
578
+ const first = page(await call(captured, "history_list", { query: "needle", after: 1, limit: 1 }, ctx));
632
579
  assert.deepEqual(first.items.map((item) => item.seq), [2]);
633
580
  assert.equal(first.has_newer, true);
634
- const next = page(await call(captured, "history_list", { query: "needle", after_seq: first.items.at(-1).seq, limit: 2 }, ctx));
581
+ const next = page(await call(captured, "history_list", { query: "needle", after: first.items.at(-1).seq, limit: 2 }, ctx));
635
582
  assert.deepEqual(next.items.map((item) => item.seq), [3]);
636
583
  const absent = await call(captured, "history_list", { query: "absent" }, ctx);
637
584
  assert.deepEqual(page(absent).items, []);
638
585
  assert.notEqual(rendered(absent).trim(), "", "an empty page says so instead of rendering nothing");
639
586
  for (const query of ["", [], ["", ""]]) {
640
587
  assert.deepEqual(page(await call(captured, "history_list", { query }, ctx)), page(await call(captured, "history_list", {}, ctx)), "empty queries preserve conversation folding");
641
- const filters = { roles: ["context"], after_seq: 1, before_seq: 3 };
588
+ const filters = { roles: ["context"], after: 1, before: 3 };
642
589
  assert.deepEqual(page(await call(captured, "history_list", { ...filters, query }, ctx)), page(await call(captured, "history_list", filters, ctx)), "other filters still apply");
643
590
  }
644
591
  assert.deepEqual(page(await call(captured, "history_list", { query: ["", "needle"] }, ctx)), all, "empty entries do not turn OR into match-all");
@@ -650,13 +597,13 @@ test("has_older and has_newer round-trip a session with no duplicates and no gap
650
597
  for (let seq = 1; seq <= 10; seq++)
651
598
  appendText(session, "user", `needle ${seq}`);
652
599
  const forward = [];
653
- let current = page(await call(captured, "history_list", { query: "needle", from: "oldest", limit: 3 }, ctx));
600
+ let current = page(await call(captured, "history_list", { query: "needle", after: 0, limit: 3 }, ctx));
654
601
  assert.deepEqual(current.items.map((item) => item.seq), [1, 2, 3]);
655
602
  assert.equal(current.has_older, false, "the first page in `from` oldest has nothing older");
656
603
  assert.equal(current.has_newer, true);
657
604
  forward.push(...current.items.map((item) => item.seq));
658
605
  while (current.has_newer) {
659
- const cursor = { after_seq: current.items.at(-1).seq };
606
+ const cursor = { after: current.items.at(-1).seq };
660
607
  current = page(await call(captured, "history_list", { query: "needle", ...cursor, limit: 3 }, ctx));
661
608
  forward.push(...current.items.map((item) => item.seq));
662
609
  }
@@ -667,7 +614,7 @@ test("has_older and has_newer round-trip a session with no duplicates and no gap
667
614
  assert.equal(current.has_older, true);
668
615
  backward.push(...current.items.map((item) => item.seq));
669
616
  while (current.has_older) {
670
- const cursor = { before_seq: current.items[0].seq };
617
+ const cursor = { before: current.items[0].seq };
671
618
  current = page(await call(captured, "history_list", { query: "needle", ...cursor, limit: 3 }, ctx));
672
619
  backward.push(...current.items.map((item) => item.seq));
673
620
  }
@@ -281,7 +281,7 @@ test("history paging bounds are the schema's, and a zero limit still pages one e
281
281
  assert.equal(Check(historyList.parameters, { limit: 0 }), false, "the schema refuses a zero limit");
282
282
  assert.equal(Check(historyList.parameters, { limit: 501 }), false, "the schema refuses a limit past its maximum");
283
283
  assert.equal(Check(historyList.parameters, { max_chars_per_item: 0 }), false, "the schema refuses a zero preview budget");
284
- const zero = data(await historyList.execute({ limit: 0, from: "oldest", roles: ["user"] }, projection));
284
+ const zero = data(await historyList.execute({ limit: 0, after: 0, roles: ["user"] }, projection));
285
285
  assert.equal(zero.items.length, 1, "an unvalidated zero limit still returns one row instead of none");
286
286
  const negative = data(await historyList.execute({ max_chars_per_item: -5, roles: ["user"] }, projection));
287
287
  const row = negative.items[0];
@@ -6,7 +6,7 @@ import test from "node:test";
6
6
  import { Check } from "typebox/value";
7
7
  import { createNotesStore, effectiveNotePolicy, NoteError } from "../src/notes/index.js";
8
8
  import { parseNote } from "../src/notes/frontmatter.js";
9
- import { DEFAULT_BOOT_TOOL_NAMES, loadNotesSnapshot, notesList, notesRead, notesSearch, notesToolContext, notesUpdate, notesWrite, renderBootBlock } from "../src/index.js";
9
+ import { DEFAULT_BOOT_TOOL_NAMES, loadNotesSnapshot, notesList, notesRead, notesToolContext, notesUpdate, notesWrite, renderBootBlock } from "../src/index.js";
10
10
  import { wireResult } from "../src/tools/result.js";
11
11
  function fixture(t) {
12
12
  const home = mkdtempSync(join(tmpdir(), "note-policy-"));
@@ -97,11 +97,11 @@ test("tools set policy, validate values, and visibly report effective policy and
97
97
  assert.equal(data(list).files[0].pinned, true);
98
98
  assert.match(notesList.render(list), /pinned true \| budget 2 \| readonly false/);
99
99
  assert.match(notesList.render(list), /Warning: note body is 3/);
100
- const search = await notesSearch.execute({ query: "😀", max_matches_per_file: 1 }, context);
101
- assert.equal(Check(notesSearch.outputSchema, wireResult(search)), true);
100
+ const search = await notesList.execute({ query: "😀", max_matches_per_file: 1 }, context);
101
+ assert.equal(Check(notesList.outputSchema, wireResult(search)), true);
102
102
  assert.equal(data(search).files[0].budget, 2);
103
- assert.match(notesSearch.render(search), /pinned true \| budget 2 \| readonly false/);
104
- assert.match(notesSearch.render(search), /Warning: note body is 3/);
103
+ assert.match(notesList.render(search), /pinned true \| budget 2 \| readonly false/);
104
+ assert.match(notesList.render(search), /Warning: note body is 3/);
105
105
  const overflow = await notesWrite.execute({ address: "overflow", content: "😀".repeat(3), budget: 2 }, context);
106
106
  for (const warnings of [data(overflow).warnings, data(read).warnings]) {
107
107
  assert.ok(warnings.length > 0);
@@ -6,7 +6,7 @@ import test from "node:test";
6
6
  import { Check } from "typebox/value";
7
7
  import { createNotesStore, projectKey, snapshotNotesIdentity } from "../src/notes/index.js";
8
8
  import { parseNote } from "../src/notes/frontmatter.js";
9
- import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../src/tools/notes.js";
9
+ import { notesList, notesRead, notesUpdate, notesWrite } from "../src/tools/notes.js";
10
10
  import { notesToolContext } from "../src/tools/notes-context.js";
11
11
  function fixture(t) {
12
12
  const root = mkdtempSync(join(tmpdir(), "notesoup-notes-cwd-"));
@@ -32,11 +32,11 @@ function refusal(result) {
32
32
  assert.fail("expected refusal");
33
33
  return result.error;
34
34
  }
35
- test("all five notes schemas accept one optional non-empty cwd", () => {
36
- for (const operation of [notesWrite, notesUpdate, notesRead, notesList, notesSearch]) {
35
+ test("all notes schemas accept one optional non-empty cwd", () => {
36
+ for (const operation of [notesWrite, notesUpdate, notesRead, notesList]) {
37
37
  const base = operation === notesWrite ? { address: "a", content: "x" }
38
38
  : operation === notesUpdate ? { address: "a", edits: [{ oldText: "x", newText: "y" }] }
39
- : operation === notesSearch ? { query: "x" }
39
+ : operation === notesList ? { query: "x" }
40
40
  : operation === notesRead ? { address: "a" } : {};
41
41
  assert.equal(Check(operation.parameters, { ...base, cwd: "../other" }), true, operation.name);
42
42
  assert.equal(Check(operation.parameters, { ...base, cwd: "" }), false, `${operation.name} rejects empty cwd`);
@@ -66,7 +66,7 @@ test("one relative cwd retargets every operation without changing later calls",
66
66
  const listed = data(await notesList.execute({ glob: "@project/**", cwd }, context));
67
67
  assert.deepEqual(listed.files.map(file => file.address).sort(), ["@project/other.md", "@project/renamed.md"]);
68
68
  assert.ok(listed.files.every(file => file.project_key === beta.projectKey));
69
- const searched = data(await notesSearch.execute({ query: "needle", glob: "@project/**", cwd }, context));
69
+ const searched = data(await notesList.execute({ query: "needle", glob: "@project/**", cwd }, context));
70
70
  assert.deepEqual(searched.files.map(file => file.address), ["@project/other.md"]);
71
71
  // The captured context is unchanged: omitting cwd still means alpha.
72
72
  assert.equal(data(await notesRead.execute({ address: "@project/decision" }, context)).text, "alpha needle");
@@ -29,13 +29,10 @@ async function populate(t) {
29
29
  ].sort();
30
30
  return { ...fixtureData, current, all };
31
31
  }
32
- test("default spellings stay local while explicit ** lists and searches each notebook once", async (t) => {
32
+ test("omitted glob stays local while explicit ** lists and searches each notebook once", async (t) => {
33
33
  const { notes, current, all, identity } = await populate(t);
34
34
  assert.deepEqual(addresses(await notes.list()), current);
35
- for (const glob of [null, "", "@default"]) {
36
- assert.deepEqual(addresses(await notes.list({ glob })), current);
37
- assert.deepEqual(addresses(await notes.search(["needle"], { glob })), current);
38
- }
35
+ assert.deepEqual(addresses(await notes.search(["needle"])), current);
39
36
  const rows = await notes.list({ glob: "**" });
40
37
  assert.deepEqual(addresses(rows), all);
41
38
  assert.deepEqual(addresses(await notes.list({ glob: "*" })), all);
@@ -44,7 +41,6 @@ test("default spellings stay local while explicit ** lists and searches each not
44
41
  assert.equal(new Set(rows.map(row => row.address)).size, rows.length);
45
42
  for (const row of rows)
46
43
  assert.equal((await notes.read(row.address))?.body.startsWith("needle"), true, "every result is a real readable address");
47
- assert.deepEqual(await notes.list({ glob: "@default/**" }), [], "@default is a bare selector, not an address prefix");
48
44
  assert.deepEqual(addresses(await notes.list({ glob: "@project/**" })), ["@project/shared.md"]);
49
45
  assert.deepEqual(addresses(await notes.list({ glob: "@self/**" })), ["@self/shared.md"]);
50
46
  assert.deepEqual(addresses(await notes.list({ glob: "@model/**" })), ["@model/shared.md"]);