notesoup 0.59.2 → 0.60.1
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.
- package/README.md +3 -17
- package/dist/plugins/claude/src/helper.js +1 -2
- package/dist/plugins/codex/src/mcp.js +1 -2
- package/dist/plugins/dsh/tools.js +1 -2
- package/dist/plugins/pi/notes/tools.d.ts +1 -1
- package/dist/plugins/pi/notes/tools.js +2 -3
- package/dist/src/dream/git.js +12 -13
- package/dist/src/history/history.d.ts +10 -11
- package/dist/src/history/history.js +8 -19
- package/dist/src/history/query.d.ts +3 -14
- package/dist/src/history/query.js +73 -85
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/notes/address.js +3 -3
- package/dist/src/notes/project-namespace.js +39 -73
- package/dist/src/notes/store.d.ts +2 -4
- package/dist/src/notes/store.js +1 -2
- package/dist/src/sqlite-lock.d.ts +2 -0
- package/dist/src/sqlite-lock.js +17 -0
- package/dist/src/tools/dream.d.ts +2 -4
- package/dist/src/tools/dream.js +15 -16
- package/dist/src/tools/history.d.ts +4 -6
- package/dist/src/tools/history.js +69 -29
- package/dist/src/tools/notes.d.ts +18 -78
- package/dist/src/tools/notes.js +39 -50
- package/dist/src/tools/schema.d.ts +0 -1
- package/dist/src/tools/schema.js +0 -1
- package/dist/test/claude-history.test.js +5 -6
- package/dist/test/claude-mod.test.js +6 -7
- package/dist/test/codex-history.test.js +1 -1
- package/dist/test/codex-plugin.test.js +1 -2
- package/dist/test/dependencies.test.js +2 -2
- package/dist/test/dream-tools.test.js +42 -14
- package/dist/test/dsh.test.js +2 -2
- package/dist/test/history-corpus.test.js +21 -36
- package/dist/test/history-summary-cache.test.js +3 -3
- package/dist/test/history.integration.test.js +53 -106
- package/dist/test/host-neutral.test.js +1 -1
- package/dist/test/note-policy.test.js +5 -5
- package/dist/test/notes-cwd.test.js +5 -5
- package/dist/test/notes-query-namespaces.test.js +2 -6
- package/dist/test/notes.integration.test.js +33 -42
- package/dist/test/notes.test.js +12 -14
- package/dist/test/project-namespace.test.js +36 -91
- package/docs/architecture.md +3 -3
- package/docs/claude-code-mod.md +2 -2
- package/docs/codex.md +1 -1
- package/docs/dsh.md +2 -2
- package/docs/history-sessions.md +8 -9
- package/docs/notes-library.md +9 -3
- package/docs/skills.md +2 -6
- package/docs/tool-results.md +12 -6
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +212 -211
- package/plugins/claude/skills/memory/SKILL.md +6 -6
- package/plugins/claude/src/helper.ts +1 -2
- package/plugins/codex/README.md +1 -1
- package/plugins/codex/dist/codex/notesoup.js +211 -210
- package/plugins/codex/src/mcp.ts +1 -2
- package/plugins/dsh/tools.ts +1 -2
- package/plugins/pi/notes/tools.ts +2 -3
- package/skills/memory/SKILL.md +6 -6
- package/src/dream/git.ts +11 -11
- package/src/history/history.ts +11 -16
- package/src/history/query.ts +67 -99
- package/src/index.ts +1 -1
- package/src/notes/address.ts +2 -2
- package/src/notes/project-namespace.ts +37 -59
- package/src/notes/store.ts +3 -6
- package/src/sqlite-lock.ts +14 -0
- package/src/tools/dream.ts +15 -14
- package/src/tools/history.ts +60 -29
- package/src/tools/notes.ts +39 -54
- package/src/tools/schema.ts +0 -1
- package/dist/src/dream/lock.d.ts +0 -14
- package/dist/src/dream/lock.js +0 -29
- package/src/dream/lock.ts +0 -28
package/docs/tool-results.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Notes and history tool results
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The six notes/history tools share one result model on Pi, Claude Code, Codex and Cordis. Pi exposes compact results as `structuredContent` to codemode and renders them as `content` for ordinary model calls. Host adapters use the same shared handlers and text rendering; they do not re-run a query or truncate a different page.
|
|
4
4
|
|
|
5
5
|
This is a breaking tool protocol change: successes no longer have `ok/data` wrappers, errors are flat, and read fields no longer sit under `window`. History execution details live once in the pageable document. Stored notes and raw Pi session entries are not deleted or rewritten by this change. In Pi, `get_context_remaining` independently declares `{ remaining_tokens }` as its output schema; `empty_brain` remains outside this protocol.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ This is a breaking tool protocol change: successes no longer have `ok/data` wrap
|
|
|
10
10
|
type Result<T> = T | { error: string; code: string };
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Each operation declares its concrete success schema; `error` is reserved for a refusal message. Success and expected failure both have a structured result; Pi's `isError` follows the outcome. Host-level argument validation, blocked execution and transport errors remain host failures. Shared handlers
|
|
13
|
+
Each operation declares its concrete success schema; `error` is reserved for a refusal message. Success and expected failure both have a structured result; Pi's `isError` follows the outcome. Host-level argument validation, blocked execution and transport errors remain host failures. Shared handlers return an internal `Outcome<T>` (`{ ok: true, data }` or `{ ok: false, error: { code, message } }`); this envelope is not the Pi wire result. The Claude hook returns rendered text as a string result and sets `isError: true` only on a refusal.
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
16
|
const result = await tools.notes_list({ glob: "@project/**" });
|
|
@@ -22,7 +22,7 @@ The text representation uses short mutation receipts, lists, search hits or raw
|
|
|
22
22
|
|
|
23
23
|
## Per-call project selection
|
|
24
24
|
|
|
25
|
-
All
|
|
25
|
+
All four notes tools accept optional `cwd`. Omitted means the host session's current project. A relative value resolves against the host session/binding cwd, and an existing directory is required; invalid explicit paths produce `invalid_cwd`. The override lasts one call and consistently drives `@project`, default/current-project globs, mutation endpoints, receipts, and new session-note ownership. It does not change the notes root or the physical session notebook.
|
|
26
26
|
|
|
27
27
|
## Read windows
|
|
28
28
|
|
|
@@ -55,7 +55,7 @@ The suffix and presentation header are never part of `text`, search offsets or t
|
|
|
55
55
|
|
|
56
56
|
The native adapter allocates seqs from session append order, selects the active branch and decodes facts. Shared history pairs calls and results without allocating a second transcript. A paired execution is addressed by its call seq. Its result's raw slot is not a public event address; list/search provide the canonical seq. Unpaired results remain independently addressable. Inactive-branch addresses are not readable.
|
|
57
57
|
|
|
58
|
-
Seqs address events across the whole session, including earlier windows. With `session` omitted, list and read headers use `seq <seq> | <role>`; the boot window tree supplies
|
|
58
|
+
Seqs address events across the whole session, including earlier windows. With `session` omitted, list and read headers use `seq <seq> | <role>`; the boot window tree supplies seq ranges for narrowing a list with `after` and `before`. With an explicit selector, returned events/read data carry canonical `session`, headers use `session <harness>:<id> | seq <seq> | <role>`, and all paging/expand/neighborhood recipes carry that same identity. Wildcards accept time bounds only, and report whether more results may exist beyond the page. See [cross-session history](history-sessions.md) for discovery, representative selection and refusal rules.
|
|
59
59
|
|
|
60
60
|
Tool events expose `tool`, `tool_status`, and, when recorded, `output_truncated` and `full_output_path`; a truncated run is named even when the host recorded no path, and the full text path is named only when it exists. `history_read` also reports `nested_calls`; a page row does not. Full arguments and nested-call records live only in the searchable/readable document, avoiding a second structured copy on every read.
|
|
61
61
|
|
|
@@ -67,13 +67,19 @@ Pi's nested records contain child ID, name, optional arguments, status, timing a
|
|
|
67
67
|
|
|
68
68
|
One selection determines the structured result and its text. Both complete representations must fit the 32 KiB output budget, including metadata, cursor and rendered notice. A programmatic caller does not receive an unbounded hidden payload beside a truncated textual one. History operations accept an optional pure text wrapper from the host: selection and read-window checks measure that wrapper around the shared rendering, and the caller must apply the same wrapper at delivery. Host prose stays in its plugin; no final clipping or separate query is involved.
|
|
69
69
|
|
|
70
|
-
`
|
|
70
|
+
`history_list` takes exclusive `after` and `before` bounds. Each accepts a seq (an integer or a digit-only string) or an ISO 8601 time (UTC when no offset is given). With `after`, `limit` counts forward (`after: 0` starts at the oldest event); without it, `limit` counts back from the newest eligible end. Both bounds define a range. Rows always come back oldest first.
|
|
71
|
+
|
|
72
|
+
With a non-empty `query`, `context: N` includes up to N events on each side of each hit, from the same session’s visible events. `after`, `before`, and `roles` limit hits, not their neighbors. Neighbor rows carry `context: true` and do not count toward `limit`; overlapping windows merge and the same output budget applies. History pages carry boolean `has_older` and `has_newer` flags. To page a single session, use the first non-context item's `seq` as `before` or the last non-context item's `seq` as `after`, with its `session` when present. Keep the search filters on the next call. Wildcard pages suggest narrowing by time, query, roles or session pattern instead. Only single-session browsing without roles folds tool/context runs.
|
|
73
|
+
|
|
74
|
+
`notes_list` with a non-empty `query` returns only matching notes and adds `matches` containing `line`, `text` and `offset_chars`, plus `more_matches` when lines are omitted. `max_matches_per_file` requires a query, as does history's `context`. Queries are literal and case-insensitive; a list matches any entry, ignoring empty entries. An empty or omitted query browses. Notes results are unpaged snapshots with a `more` count. Omit `glob` for current notebooks or supply a non-empty glob to narrow or widen the selection.
|
|
75
|
+
|
|
76
|
+
A history read can stop anywhere in the event document, including inside serialized arguments; concatenate its verbatim text slices before parsing any arguments.
|
|
71
77
|
|
|
72
78
|
`notes_write` and `notes_update` accept optional `pinned`, `budget`, and `readonly` policy fields. Their receipts, list/search rows, and read `metadata` expose the effective `pinned`, `budget`, and `readonly` values as structured fields **and visible text**. Successes also carry a `warnings` array (per file for list/search), rendered visibly when a body exceeds its budget: the default is 4096 Unicode code points for ordinary pages and 2048 for root `CHEATSHEET.md` and `MAP.md`, adjustable per note. Overflow saves successfully; boot injects full pinned bodies instead of cutting them. Pi's custom write/update/read renderers show policy and warnings even when collapsed, outside the expandable body/diff and clipped summary. A readonly note refuses mutations with `readonly` until explicitly unlocked with `readonly:false`; this is a soft lock, not security. Pin admission refuses a sixth live pin per notebook with `pin_limit`, including restore/move/rename. Invalid policy fields refuse with `invalid_policy`.
|
|
73
79
|
|
|
74
80
|
A note read reports unrecognized frontmatter under `metadata.extra`; a value too large to carry, or past the verbatim budget, is named in place as `[omitted: too large]` under its key rather than delivered in part, and the value itself stays in the note file. A rename receipt uses `address` for the destination and `rename_from` for the source; it has no duplicate `rename_to` field.
|
|
75
81
|
|
|
76
|
-
`output_too_large` is not one failure. Each operation's own message says what it means: a read that cannot deliver a single advancing character is refused rather than answered with an empty window, and a search result whose first match line cannot fit is cut to the longest prefix that does and ends with ` [truncated]`. `notes_update` returns a compact policy-bearing receipt plus any budget warning; Pi attaches the rendered diff under `details.diff` for the UI rather than repeating it in model-facing text or `structuredContent`. Narrowing helps only where a parameter genuinely reduces the selection — `glob` or `query`, `roles`, `limit`, `max_chars_per_item`,
|
|
82
|
+
`output_too_large` is not one failure. Each operation's own message says what it means: a read that cannot deliver a single advancing character is refused rather than answered with an empty window, and a search result whose first match line cannot fit is cut to the longest prefix that does and ends with ` [truncated]`. `notes_update` returns a compact policy-bearing receipt plus any budget warning; Pi attaches the rendered diff under `details.diff` for the UI rather than repeating it in model-facing text or `structuredContent`. Narrowing helps only where a parameter genuinely reduces the selection — `glob` or `query`, `roles`, `limit`, `max_chars_per_item`, or an `after`/`before` seq or time range — and cannot help a read whose own metadata is what overflows. History pages refuse with `page_too_large` for the same reason. Nothing is ever quietly delivered short: every other omission is reported on the successful result that carries it.
|
|
77
83
|
|
|
78
84
|
## Ownership
|
|
79
85
|
|
package/package.json
CHANGED