notesoup 0.59.1 → 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 (79) hide show
  1. package/README.md +3 -17
  2. package/dist/plugins/claude/src/helper.js +3 -4
  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/claude.d.ts +3 -1
  8. package/dist/src/history/claude.js +40 -4
  9. package/dist/src/history/history.d.ts +10 -11
  10. package/dist/src/history/history.js +8 -19
  11. package/dist/src/history/prefilter.d.ts +1 -1
  12. package/dist/src/history/prefilter.js +14 -9
  13. package/dist/src/history/query.d.ts +3 -14
  14. package/dist/src/history/query.js +73 -85
  15. package/dist/src/index.d.ts +1 -1
  16. package/dist/src/index.js +1 -1
  17. package/dist/src/notes/address.js +3 -3
  18. package/dist/src/notes/store.d.ts +2 -4
  19. package/dist/src/notes/store.js +1 -2
  20. package/dist/src/tools/history.d.ts +4 -6
  21. package/dist/src/tools/history.js +69 -29
  22. package/dist/src/tools/notes.d.ts +18 -78
  23. package/dist/src/tools/notes.js +39 -50
  24. package/dist/src/tools/schema.d.ts +0 -1
  25. package/dist/src/tools/schema.js +0 -1
  26. package/dist/test/claude-history.test.js +27 -6
  27. package/dist/test/claude-mod.test.js +19 -8
  28. package/dist/test/codex-history.test.js +1 -1
  29. package/dist/test/codex-plugin.test.js +1 -2
  30. package/dist/test/dependencies.test.js +2 -2
  31. package/dist/test/dsh.test.js +2 -2
  32. package/dist/test/history-corpus.test.js +21 -36
  33. package/dist/test/history-prefilter.test.js +5 -0
  34. package/dist/test/history-summary-cache.test.js +3 -3
  35. package/dist/test/history.integration.test.js +53 -106
  36. package/dist/test/host-neutral.test.js +1 -1
  37. package/dist/test/note-policy.test.js +5 -5
  38. package/dist/test/notes-cwd.test.js +5 -5
  39. package/dist/test/notes-query-namespaces.test.js +2 -6
  40. package/dist/test/notes.integration.test.js +30 -35
  41. package/dist/test/notes.test.js +12 -14
  42. package/dist/test/project-namespace.test.js +3 -3
  43. package/docs/architecture.md +3 -3
  44. package/docs/claude-code-mod.md +5 -3
  45. package/docs/codex.md +1 -1
  46. package/docs/dsh.md +2 -2
  47. package/docs/history-sessions.md +9 -10
  48. package/docs/notes-library.md +3 -3
  49. package/docs/tool-results.md +12 -6
  50. package/package.json +1 -1
  51. package/plugins/claude/dist/claude/helper.js +214 -173
  52. package/plugins/claude/hooks/register.ts +8 -6
  53. package/plugins/claude/skills/memory/SKILL.md +6 -6
  54. package/plugins/claude/src/helper.ts +3 -4
  55. package/plugins/codex/README.md +1 -1
  56. package/plugins/codex/dist/codex/notesoup.js +176 -160
  57. package/plugins/codex/src/mcp.ts +1 -2
  58. package/plugins/dsh/tools.ts +1 -2
  59. package/plugins/paseo/README.md +16 -0
  60. package/plugins/paseo/client/brain-empty-card.tsx +5 -3
  61. package/plugins/paseo/client/markdown-core.tsx +189 -0
  62. package/plugins/paseo/client/markdown.tsx +38 -135
  63. package/plugins/paseo/client/notes-op-card.tsx +15 -12
  64. package/plugins/paseo/client/paper-card.tsx +1 -3
  65. package/plugins/paseo/client/sticky-card.tsx +2 -1
  66. package/plugins/paseo/client/typography.ts +24 -0
  67. package/plugins/paseo/test/markdown-core.test.ts +75 -0
  68. package/plugins/pi/notes/tools.ts +2 -3
  69. package/skills/memory/SKILL.md +6 -6
  70. package/src/history/claude.ts +31 -4
  71. package/src/history/history.ts +11 -16
  72. package/src/history/prefilter.ts +13 -9
  73. package/src/history/query.ts +67 -99
  74. package/src/index.ts +1 -1
  75. package/src/notes/address.ts +2 -2
  76. package/src/notes/store.ts +3 -6
  77. package/src/tools/history.ts +60 -29
  78. package/src/tools/notes.ts +39 -54
  79. package/src/tools/schema.ts +0 -1
@@ -3,6 +3,8 @@ import type { EngineInterface, On, ProcessRunResult, ToolCallInput, ToolCallResu
3
3
  const PREFIX = "mcp__notesoup__"
4
4
  const HELPER = `${import.meta.dir}/../dist/claude/helper.js`
5
5
  const TIMEOUT_MS = 10_000
6
+ // A cold history query can scan gigabytes of transcripts; notes and reset plumbing should fail fast.
7
+ const HISTORY_TIMEOUT_MS = 120_000
6
8
  const OUTPUT_LIMIT = 1024 * 1024
7
9
 
8
10
  type Identity = { home: string; sessionId: string; cwd: string; agent: string; model: string }
@@ -322,10 +324,10 @@ function decode(result: ProcessRunResult): { ok: true; result: unknown } | { ok:
322
324
  return { ok: false, error: typeof value.error === "string" ? value.error : "helper returned an invalid error" }
323
325
  } catch { return { ok: false, error: "helper returned invalid JSON" } }
324
326
  }
325
- async function run($: { process: { run: (argv: readonly string[], init?: { cwd?: string; stdin?: string; timeoutMs?: number }) => Promise<ProcessRunResult> } }, request: unknown) {
327
+ async function run($: { process: { run: (argv: readonly string[], init?: { cwd?: string; stdin?: string; timeoutMs?: number }) => Promise<ProcessRunResult> } }, request: unknown, timeoutMs = TIMEOUT_MS) {
326
328
  // A session may still name a removed worktree. Project identity travels in stdin;
327
329
  // launch from the plugin directory so removing that worktree cannot prevent spawn.
328
- try { return decode(await $.process.run(["node", HELPER], { cwd: import.meta.dir, stdin: `${JSON.stringify(request)}\n`, timeoutMs: TIMEOUT_MS })) }
330
+ try { return decode(await $.process.run(["node", HELPER], { cwd: import.meta.dir, stdin: `${JSON.stringify(request)}\n`, timeoutMs })) }
329
331
  // The host's rejection is the only diagnosis there is: it carries the spawn failure's own
330
332
  // reason (`timed out after …`), which a bare phrase would throw away.
331
333
  catch (error) { return { ok: false as const, error: `helper execution failed: ${describeFailure(error)}` } }
@@ -523,10 +525,9 @@ export function register(on: On) {
523
525
  }
524
526
  return result
525
527
  })
526
- on("command.run", async ($, e, next) => {
528
+ on("command.run", { command: ["notesoup", "empty", "fresh-window"] }, async ($, e, next) => {
527
529
  if (state.disabled) return next(e)
528
530
  if (e.command === "notesoup") return capCommand($, state, e.args)
529
- if (e.command !== "empty" && e.command !== "fresh-window") return next(e)
530
531
  if (!await refreshIdentity($, state)) return { text: "🥣 Different brain now · try /fresh-window again" }
531
532
  if (state.compactDisabled) return { text: `🥣 ${COMPACT_DISABLED}` }
532
533
  const first = state.flow.requestReset()
@@ -619,8 +620,9 @@ async function callNotesTool($: Engine, state: ResetState, e: ToolCallInput): Pr
619
620
  if (state.flow.requestReset({ lastWord, terminate: terminate === true })) state.continuation = undefined
620
621
  return { result: `Brain reset requested. This tool batch will finish, then the turn stops before its next model request unless it has new user input to handle. Your notes and sticky note survive the reset.${state.flow.request!.resume ? " You will continue in a fresh window after the reset." : " No automatic continuation will be submitted."}` }
621
622
  }
622
- if (name.startsWith("history_") && agentId !== undefined) return errorResult("history is unavailable for subagents; main-session history is not their transcript")
623
- const result = await run($, { op: "tool", tool: name, params, identity, history: state.history })
623
+ const history = name === "history_list" || name === "history_read"
624
+ if (history && agentId !== undefined) return errorResult("history is unavailable for subagents; main-session history is not their transcript")
625
+ const result = await run($, { op: "tool", tool: name, params, identity, history: state.history }, history ? HISTORY_TIMEOUT_MS : TIMEOUT_MS)
624
626
  if (!result.ok) return errorResult(result.error)
625
627
  const outcome = toolResultOf(result.result)
626
628
  if (!outcome) return errorResult("helper returned an invalid tool result")
@@ -38,15 +38,15 @@ Keep notes focused on what is true now; if a piece of past context still matters
38
38
 
39
39
  ## Finding things again
40
40
 
41
- For list/search, omit `glob` or use the collection alias `@default` for this session and current shared notebooks. Use `**` for all notebooks or `@sessions/*/**` for all sessions. Results carry readable note addresses; `@default` itself is not a read/write address.
41
+ In `notes_list`, omit `glob` for this session and the current shared notebooks. Use `**` for all notebooks or `@sessions/*/**` for all sessions.
42
42
 
43
- - **A note**: `notes_list` with a `glob` when you know roughly where it lives, `notes_search` when you know a phrase; then `notes_read` the address.
44
- - **Something that happened**: `history_list` to browse or search this session's events; `history_read` the seq for the whole event.
45
- - **An earlier window**: use its seq range from the boot window tree with `history_list`'s `before_seq` / `after_seq` bounds, or search for a remembered phrase.
43
+ - **A note**: add `glob` to narrow where `notes_list` looks, and `query` if you remember a phrase. Then use `notes_read` with the address and, for a match, its `offset_chars`.
44
+ - **Something that happened**: `history_list` browses or searches this session's events. Add `context: 1` with a `query` to include neighboring events. Use `history_read` with the seq for the whole event.
45
+ - **An earlier window**: use its seq range from the boot window tree with `history_list`'s exclusive `after` / `before` bounds, or search for a remembered phrase. With `after` you page forward; otherwise you page back from the newest eligible end.
46
46
  - **Another session**: pass `session: "<id-or-prefix>"` or `"pi:<id>"`, `"claude:<id>"`, `"codex:<id>"`, `"dsh:<id>"`. An unqualified selector checks this harness first. If ambiguous, use a longer ID or a harness prefix; never pick a candidate blindly.
47
- - **A phrase across sessions**: `history_list({ session: "*", query: "remembered phrase" })`, or restrict to a harness with `"pi:*"`. A wildcard cannot use `before_seq`/`after_seq` or `history_read`. Query results cover every role unless `roles` narrows them, are chronological, and have no paging cursors; narrow by time, role, query or session pattern instead. DSH sessions are discoverable only from DSH.
47
+ - **A phrase across sessions**: `history_list({ session: "*", query: "remembered phrase" })`, or restrict to a harness with `"pi:*"`. A wildcard takes ISO 8601 times only in `after` / `before` and cannot use `history_read`. Hits cover every role unless `roles` narrows them. Results are chronological and have no paging cursors; narrow by time, role, query or session pattern instead. DSH sessions are discoverable only from DSH.
48
48
 
49
- - **Recent sessions, no remembered phrase**: `history_list({ session: "*" })` returns one representative event per session, preferring its first visible user prompt, up to `limit` (default 20). Sessions are chosen newest-modified first (`from: "oldest"` reverses that), then results are sorted chronologically. Empty queries also browse. Role/time filters apply before choosing representatives; with `roles`, the latest matching event represents each session. No paging cursors.
49
+ - **Recent sessions, no remembered phrase**: `history_list({ session: "*" })` returns one representative event per session, preferring its first visible user prompt, up to `limit` (default 20). Sessions are chosen newest-modified first (oldest-modified first with `after`), then results are sorted chronologically. Empty queries also browse. Role/time filters apply before choosing representatives; with `roles`, the latest matching event represents each session. No paging cursors.
50
50
 
51
51
  Seqs are stable **within a session**. When a hit carries `session`, copy it together with `seq` into `history_read` and save both in your note. The paging/expand/neighborhood recipes already preserve the resolved session. Omit `session` only when you mean your current host session. A single unreadable or unsupported local transcript refuses explicitly; wildcards skip individual sessions that cannot load. An empty result is not proof the remembered event never happened.
52
52
 
@@ -3,7 +3,7 @@ import { pathToFileURL } from "node:url";
3
3
  import type { Static, TSchema } from "typebox";
4
4
  import { Check } from "typebox/value";
5
5
  import { paramProblem } from "../../../src/tools/schema.js";
6
- import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../../../src/tools/notes.js";
6
+ import { notesList, notesRead, notesUpdate, notesWrite } from "../../../src/tools/notes.js";
7
7
  import { historyList, historyRead, type HistoryTextWrapper } from "../../../src/tools/history.js";
8
8
  import { localHistoryCorpus, type LocalHistoryOptions } from "../../../src/history/local.js";
9
9
  import { readClaudeHistory, type ClaudeHistorySource } from "./history.js";
@@ -54,7 +54,6 @@ const OPERATIONS: Record<string, BoundOperation<[NotesToolContext]>> = {
54
54
  notes_update: boundOperation(notesUpdate),
55
55
  notes_read: boundOperation(notesRead),
56
56
  notes_list: boundOperation(notesList),
57
- notes_search: boundOperation(notesSearch),
58
57
  };
59
58
 
60
59
  const HISTORY_OPERATIONS = {
@@ -101,8 +100,8 @@ export async function dispatch(request: unknown, historyOptions: Pick<LocalHisto
101
100
  const id = identity(value.identity as ClaudeIdentityInput);
102
101
  if (Object.hasOwn(HISTORY_OPERATIONS, value.tool)) {
103
102
  const tool = value.tool as keyof typeof HISTORY_OPERATIONS;
103
+ const current = () => readClaudeHistory(historySource(value.history, id.sessionId), { waitForHead: true });
104
104
  if ((value.params as { session?: string }).session !== undefined) {
105
- const current = () => readClaudeHistory(historySource(value.history, id.sessionId));
106
105
  const corpus = localHistoryCorpus({ ...historyOptions, current: { harness: "claude", id: id.sessionId, async load() {
107
106
  const projection = await current();
108
107
  const notice = claudeHistoryGapNotice(projection.missingAncestors);
@@ -110,7 +109,7 @@ export async function dispatch(request: unknown, historyOptions: Pick<LocalHisto
110
109
  } } });
111
110
  return HISTORY_OPERATIONS[tool].call(value.params, { current, corpus });
112
111
  }
113
- const projection = await readClaudeHistory(historySource(value.history, id.sessionId));
112
+ const projection = await current();
114
113
  const notice = claudeHistoryGapNotice(projection.missingAncestors);
115
114
  const wrapText: HistoryTextWrapper = (text) => notice + text;
116
115
  const params = value.params;
@@ -1,6 +1,6 @@
1
1
  # notesoup for Codex
2
2
 
3
- Native notes and history for Codex **0.160.1**. The plugin bundles one stdio MCP server with the five notebooks and three history tools, and one hook helper that injects the notes boot into each native context window. `new_context` and `get_context_remaining` stay Codex's own tools; notesoup does not replace Codex's reset or budget.
3
+ Native notes and history for Codex **0.160.1**. The plugin bundles one stdio MCP server with the five notebooks and two history tools, and one hook helper that injects the notes boot into each native context window. `new_context` and `get_context_remaining` stay Codex's own tools; notesoup does not replace Codex's reset or budget.
4
4
 
5
5
  ## Install
6
6