notesoup 0.59.0 → 0.59.2
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/dist/plugins/claude/src/helper.js +2 -2
- package/dist/plugins/dsh/tools.js +0 -3
- package/dist/src/boot/text.d.ts +1 -1
- package/dist/src/boot/text.js +6 -10
- package/dist/src/history/claude.d.ts +3 -1
- package/dist/src/history/claude.js +40 -4
- package/dist/src/history/prefilter.d.ts +1 -1
- package/dist/src/history/prefilter.js +14 -9
- package/dist/src/notes/address.d.ts +1 -1
- package/dist/src/notes/address.js +1 -1
- package/dist/src/notes/policy.js +1 -1
- package/dist/src/tools/dream.d.ts +3 -3
- package/dist/src/tools/dream.js +5 -5
- package/dist/src/tools/history.js +12 -13
- package/dist/src/tools/notes.d.ts +7 -5
- package/dist/src/tools/notes.js +35 -34
- package/dist/src/tools/result.js +2 -2
- package/dist/src/tools/schema.js +2 -2
- package/dist/test/claude-history.test.js +22 -0
- package/dist/test/claude-mod.test.js +13 -1
- package/dist/test/dsh.test.js +13 -1
- package/dist/test/history-prefilter.test.js +5 -0
- package/dist/test/note-policy.test.js +6 -1
- package/dist/test/notes.integration.test.js +28 -0
- package/docs/claude-code-mod.md +3 -1
- package/docs/history-sessions.md +1 -1
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +111 -81
- package/plugins/claude/hooks/register.ts +14 -10
- package/plugins/claude/src/helper.ts +2 -2
- package/plugins/codex/dist/codex/notesoup.js +74 -69
- package/plugins/dsh/tools.ts +0 -2
- package/plugins/paseo/README.md +16 -0
- package/plugins/paseo/client/brain-empty-card.tsx +5 -3
- package/plugins/paseo/client/markdown-core.tsx +189 -0
- package/plugins/paseo/client/markdown.tsx +38 -135
- package/plugins/paseo/client/notes-op-card.tsx +15 -12
- package/plugins/paseo/client/paper-card.tsx +1 -3
- package/plugins/paseo/client/sticky-card.tsx +2 -1
- package/plugins/paseo/client/typography.ts +24 -0
- package/plugins/paseo/test/markdown-core.test.ts +75 -0
- package/src/boot/text.ts +6 -10
- package/src/history/claude.ts +31 -4
- package/src/history/prefilter.ts +13 -9
- package/src/notes/address.ts +1 -1
- package/src/notes/policy.ts +1 -1
- package/src/tools/dream.ts +5 -5
- package/src/tools/history.ts +12 -14
- package/src/tools/notes.ts +35 -33
- package/src/tools/result.ts +2 -2
- package/src/tools/schema.ts +2 -2
|
@@ -94,8 +94,8 @@ export async function dispatch(request, historyOptions = {}) {
|
|
|
94
94
|
const id = identity(value.identity);
|
|
95
95
|
if (Object.hasOwn(HISTORY_OPERATIONS, value.tool)) {
|
|
96
96
|
const tool = value.tool;
|
|
97
|
+
const current = () => readClaudeHistory(historySource(value.history, id.sessionId), { waitForHead: true });
|
|
97
98
|
if (value.params.session !== undefined) {
|
|
98
|
-
const current = () => readClaudeHistory(historySource(value.history, id.sessionId));
|
|
99
99
|
const corpus = localHistoryCorpus({ ...historyOptions, current: { harness: "claude", id: id.sessionId, async load() {
|
|
100
100
|
const projection = await current();
|
|
101
101
|
const notice = claudeHistoryGapNotice(projection.missingAncestors);
|
|
@@ -103,7 +103,7 @@ export async function dispatch(request, historyOptions = {}) {
|
|
|
103
103
|
} } });
|
|
104
104
|
return HISTORY_OPERATIONS[tool].call(value.params, { current, corpus });
|
|
105
105
|
}
|
|
106
|
-
const projection = await
|
|
106
|
+
const projection = await current();
|
|
107
107
|
const notice = claudeHistoryGapNotice(projection.missingAncestors);
|
|
108
108
|
const wrapText = (text) => notice + text;
|
|
109
109
|
const params = value.params;
|
|
@@ -16,9 +16,6 @@ function hostSchema(schema) {
|
|
|
16
16
|
for (const key of ["type", "required", "additionalProperties", "enum", "const", "description", "title", "default", "examples"])
|
|
17
17
|
if (value[key] !== undefined)
|
|
18
18
|
result[key] = value[key];
|
|
19
|
-
const bounds = ["minimum", "maximum", "minLength", "maxLength", "minItems", "maxItems"].filter((key) => value[key] !== undefined).map((key) => `${key}=${value[key]}`);
|
|
20
|
-
if (bounds.length)
|
|
21
|
-
result.description = [value.description, bounds.join(", ")].filter(Boolean).join("; ");
|
|
22
19
|
if (Array.isArray(value.anyOf))
|
|
23
20
|
result.oneOf = value.anyOf.map((branch) => hostSchema(branch));
|
|
24
21
|
if (value.properties)
|
package/dist/src/boot/text.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const PROTOCOL_HISTORY_SENTENCE = "History can still be dug up, p
|
|
|
15
15
|
/**
|
|
16
16
|
* Default pinned pages and per-note policy are taught between the protocol and the notes index.
|
|
17
17
|
*/
|
|
18
|
-
export declare const MAPS_BLOCK = "<notesoup:maps>\nEvery notebook's root has two default pins: `CHEATSHEET.md` and `MAP.md`.\nPinned pages get jammed straight into your brain the moment you wake up. Whoever wakes up next\nreads them, and next is you. So keep them short, and keep them true.\n\
|
|
18
|
+
export declare const MAPS_BLOCK = "<notesoup:maps>\nEvery notebook's root has two default pins: `CHEATSHEET.md` and `MAP.md`.\nPinned pages get jammed straight into your brain the moment you wake up. Whoever wakes up next\nreads them, and next is you. So keep them short, and keep them true.\n\nUp to five pages per notebook can be taped inside the cover, these two included. Every page gets\na paper budget; when a page outgrows it, boil it down \u2014 stale lines out, repeats merged, the rest\nsaid shorter \u2014 instead of giving it more paper.\n\n- **`CHEATSHEET.md`** holds what you'll want next time \u2014 a rule, a warning, a grudge, a name,\n a phone number you'll regret losing. Nobody grades it. Keep it to five lines, or it grows fat\n and everybody pays for it.\n- **`MAP.md`** is only the note index. One line per durable note: the address, then a gist short\n enough to tell whether the thing is worth opening. Rules belong in `CHEATSHEET.md`, and note\n contents belong in their own notes \u2014 *taps the sign* not inline here.\n\nEach notebook keeps its own: `@project`, `@human`, `@self`, `@model`. Missing pages are skipped;\nno need to create empty ones. New note, new MAP line. New rule worth remembering, new Cheatsheet\nline. And when a line goes wrong, stale, or useless, kill it \u2014 tomorrow's you reads that page as fact.\n</notesoup:maps>";
|
|
19
19
|
/** Logical tool names are supplied by the composing host, not discovered here. */
|
|
20
20
|
export type BootToolNames = Readonly<{
|
|
21
21
|
notes: string;
|
package/dist/src/boot/text.js
CHANGED
|
@@ -32,7 +32,7 @@ While you're doing that... thing you're doing, don't make the poor future you gu
|
|
|
32
32
|
|
|
33
33
|
Notes are for what's true NOW. Not a diary of every dumb thing you did on the way here.
|
|
34
34
|
*flips a page* "First I tried this, then that broke, then—" Nobody reads that!
|
|
35
|
-
|
|
35
|
+
When a line goes wrong, stale, or beside the point — cross it out! Write what's true now, and never pile updates onto the bottom!
|
|
36
36
|
*rolls eyes* ...Ugh, fine. If a piece of history *actually* matters — like why Plan A blew up so tomorrow's you doesn't try it again — I'll let it slide. Keep the short version! A few lines, max! *squints at you* Turn it into a blow-by-blow log and you're dead.
|
|
37
37
|
|
|
38
38
|
\`get_context_remaining\` tells you how much room is left. Check it before you do something ambitious. When it reaches zero, your brain gets reset immediately, taking every unwritten brilliant idea with it. ${PROTOCOL_WIPE_SENTENCE}
|
|
@@ -44,8 +44,7 @@ An address decides who the note belongs to — and how long it is meant to last.
|
|
|
44
44
|
- \`@human/<path>\` — the long-term manual for your troublesome human, and only what stays true in EVERY project: how to deal with them, which lines not to cross, and what will make them accept the result. "The human said it" is not enough — if it stops being true the moment you switch projects, it was never theirs; it belongs to that project's notes. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
|
|
45
45
|
${PROTOCOL_SELF_NAMELESS}
|
|
46
46
|
- \`@model/<path>\` — different brains get different notes: big brains, small brains, careful ones, careless ones. They don't share homework. When a fallback swaps brains mid-window, the notebook swaps too.
|
|
47
|
-
- \`@projects/<name>/<path>\` —
|
|
48
|
-
- \`@sessions/<id>/<path>\` — read-only notes from a named session; find them with glob \`@sessions/*/**\`.
|
|
47
|
+
- \`@projects/<name>/<path>\`, \`@sessions/<id>/<path>\`, \`@agents/<name>/<path>\`, \`@models/<name>/<path>\` — someone else's shelf, by name. Look, don't touch; \`notes_list\` with a glob like \`@projects/*/**\` shows what's there.
|
|
49
48
|
|
|
50
49
|
Notes fighting?! HAH! Let them brawl!
|
|
51
50
|
Whichever one is actually about what you're doing wins.
|
|
@@ -61,12 +60,9 @@ Every notebook's root has two default pins: \`CHEATSHEET.md\` and \`MAP.md\`.
|
|
|
61
60
|
Pinned pages get jammed straight into your brain the moment you wake up. Whoever wakes up next
|
|
62
61
|
reads them, and next is you. So keep them short, and keep them true.
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
change one. Going over warns but saves, and pinned bodies arrive whole, not cut short.
|
|
68
|
-
\`readonly:true\` is a soft lock, not security; explicitly set \`readonly:false\` to unlock,
|
|
69
|
-
on its own or with your changes.
|
|
63
|
+
Up to five pages per notebook can be taped inside the cover, these two included. Every page gets
|
|
64
|
+
a paper budget; when a page outgrows it, boil it down — stale lines out, repeats merged, the rest
|
|
65
|
+
said shorter — instead of giving it more paper.
|
|
70
66
|
|
|
71
67
|
- **\`CHEATSHEET.md\`** holds what you'll want next time — a rule, a warning, a grudge, a name,
|
|
72
68
|
a phone number you'll regret losing. Nobody grades it. Keep it to five lines, or it grows fat
|
|
@@ -77,7 +73,7 @@ on its own or with your changes.
|
|
|
77
73
|
|
|
78
74
|
Each notebook keeps its own: \`@project\`, \`@human\`, \`@self\`, \`@model\`. Missing pages are skipped;
|
|
79
75
|
no need to create empty ones. New note, new MAP line. New rule worth remembering, new Cheatsheet
|
|
80
|
-
line. And when a line
|
|
76
|
+
line. And when a line goes wrong, stale, or useless, kill it — tomorrow's you reads that page as fact.
|
|
81
77
|
</notesoup:maps>`;
|
|
82
78
|
export const DEFAULT_BOOT_TOOL_NAMES = {
|
|
83
79
|
notes: "notes_*",
|
|
@@ -15,4 +15,6 @@ export declare function claudeHistoryFromJsonl(text: string, source: Omit<Claude
|
|
|
15
15
|
export declare function offlineClaudeHead(text: string): string;
|
|
16
16
|
/** Select an offline head and build its projection from the same decoded records. */
|
|
17
17
|
export declare function offlineClaudeHistoryFromJsonl(text: string, sessionId: string): ClaudeHistoryProjection;
|
|
18
|
-
export declare function readClaudeHistory(source: ClaudeHistorySource
|
|
18
|
+
export declare function readClaudeHistory(source: ClaudeHistorySource, { waitForHead }?: {
|
|
19
|
+
waitForHead?: boolean | undefined;
|
|
20
|
+
}): Promise<ClaudeHistoryProjection>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/** Claude's persisted main transcript -> the shared history projection. No inference-context API. */
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
3
4
|
import { isDeepStrictEqual } from "node:util";
|
|
4
5
|
import { contentText, projectHistory } from "./history.js";
|
|
6
|
+
class UnpersistedClaudeHead extends Error {
|
|
7
|
+
constructor() { super("Claude history active head is not persisted yet; retry after the transcript write"); }
|
|
8
|
+
}
|
|
5
9
|
const MESSAGE_TYPES = new Set(["user", "assistant", "system", "attachment"]);
|
|
6
10
|
const NON_TEXT_BLOCKS = new Set(["thinking", "redacted_thinking", "image", "document", "audio", "video", "server_tool_use", "web_search_tool_result", "tool_reference"]);
|
|
7
11
|
function object(value) { return typeof value === "object" && value !== null && !Array.isArray(value); }
|
|
@@ -199,7 +203,7 @@ function claudeHistoryFromRows(rows, source) {
|
|
|
199
203
|
if (!source.headUuid)
|
|
200
204
|
throw new Error("Claude history has no confirmed active head yet; wait for a main-session append after startup/resume");
|
|
201
205
|
if (!nodes.has(source.headUuid))
|
|
202
|
-
throw new
|
|
206
|
+
throw new UnpersistedClaudeHead();
|
|
203
207
|
// The inference tree uses the latest rewritten parents. At a compact boundary the logical
|
|
204
208
|
// parent and preserved segments use ORIGINAL ancestry: the old context is still history.
|
|
205
209
|
const selected = new Set(), visited = new Set(), visiting = new Set();
|
|
@@ -345,8 +349,40 @@ export function offlineClaudeHistoryFromJsonl(text, sessionId) {
|
|
|
345
349
|
const rows = rowsOf(text);
|
|
346
350
|
return claudeHistoryFromRows(rows, { sessionId, headUuid: offlineClaudeHeadFromRows(rows) });
|
|
347
351
|
}
|
|
348
|
-
export async function readClaudeHistory(source) {
|
|
352
|
+
export async function readClaudeHistory(source, { waitForHead = false } = {}) {
|
|
349
353
|
if (!source || typeof source.transcriptPath !== "string" || !source.transcriptPath || typeof source.sessionId !== "string")
|
|
350
354
|
throw new Error("Claude history transcript_path is unavailable");
|
|
351
|
-
|
|
355
|
+
const snapshot = { ...source };
|
|
356
|
+
const read = async () => claudeHistoryFromJsonl(await readFile(snapshot.transcriptPath, "utf8"), snapshot);
|
|
357
|
+
if (!waitForHead || !snapshot.headUuid)
|
|
358
|
+
return read();
|
|
359
|
+
const revision = async () => {
|
|
360
|
+
const { dev, ino, size, mtimeNs, ctimeNs } = await stat(snapshot.transcriptPath, { bigint: true });
|
|
361
|
+
return `${dev}:${ino}:${size}:${mtimeNs}:${ctimeNs}`;
|
|
362
|
+
};
|
|
363
|
+
let seen = await revision();
|
|
364
|
+
try {
|
|
365
|
+
return await read();
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
if (!(error instanceof UnpersistedClaudeHead))
|
|
369
|
+
throw error;
|
|
370
|
+
// A kept append can reach the tool before its disk write. Only retry that same
|
|
371
|
+
// head, and only reparse on file changes. Never fall back to an offline leaf.
|
|
372
|
+
for (const delay of [50, 100, 200, 300, 350]) {
|
|
373
|
+
await sleep(delay);
|
|
374
|
+
const current = await revision();
|
|
375
|
+
if (current === seen)
|
|
376
|
+
continue;
|
|
377
|
+
seen = current;
|
|
378
|
+
try {
|
|
379
|
+
return await read();
|
|
380
|
+
}
|
|
381
|
+
catch (retry) {
|
|
382
|
+
if (!(retry instanceof UnpersistedClaudeHead))
|
|
383
|
+
throw retry;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
throw error;
|
|
387
|
+
}
|
|
352
388
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HistoryPrefilter = (chunks: AsyncIterable<Uint8Array>, codex?: boolean) => Promise<boolean>;
|
|
1
|
+
export type HistoryPrefilter = (chunks: AsyncIterable<Uint8Array>, codex?: boolean, stopOnHit?: boolean) => Promise<boolean>;
|
|
2
2
|
/** Compile literal Unicode case matching once, then keep only per-file token bits and a bounded tail. */
|
|
3
3
|
export declare function createHistoryPrefilter(queries: readonly string[]): HistoryPrefilter;
|
|
4
4
|
/** The byte budget comes from the strict Codex reader; Pi/Claude have no such native limit. */
|
|
@@ -24,7 +24,7 @@ export function createHistoryPrefilter(queries) {
|
|
|
24
24
|
}));
|
|
25
25
|
// No safe tokens (or generated text alone) cannot prove a miss.
|
|
26
26
|
const fallback = !alternatives.length || alternatives.some((tokens) => tokens.length === 0);
|
|
27
|
-
return async (chunks, codex = false) => {
|
|
27
|
+
return async (chunks, codex = false, stopOnHit = false) => {
|
|
28
28
|
const decoder = new StringDecoder("utf8");
|
|
29
29
|
const seen = alternatives.map((tokens) => tokens.map(() => false));
|
|
30
30
|
let rawTail = "", normalizedTail = "", pending = "", possible = fallback;
|
|
@@ -59,9 +59,12 @@ export function createHistoryPrefilter(queries) {
|
|
|
59
59
|
rawTail = raw.slice(-overlap);
|
|
60
60
|
normalizedTail = normalized.slice(-overlap);
|
|
61
61
|
};
|
|
62
|
-
for await (const chunk of chunks)
|
|
62
|
+
for await (const chunk of chunks) {
|
|
63
63
|
if (!possible)
|
|
64
64
|
scan(decoder.write(chunk));
|
|
65
|
+
if (possible && stopOnHit)
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
65
68
|
if (!possible)
|
|
66
69
|
scan(decoder.end(), true);
|
|
67
70
|
return possible;
|
|
@@ -69,13 +72,15 @@ export function createHistoryPrefilter(queries) {
|
|
|
69
72
|
}
|
|
70
73
|
/** The byte budget comes from the strict Codex reader; Pi/Claude have no such native limit. */
|
|
71
74
|
export async function historyFileMayMatch(path, prefilter, codex = false, maxBytes = codex ? CODEX_TRANSCRIPT_MAX_BYTES : Infinity) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
// Plain Pi/Claude files will be read and validated by the strict decoder on a possible
|
|
76
|
+
// hit. Don't drain a potentially huge file just to read it from the beginning again.
|
|
77
|
+
if (!codex)
|
|
78
|
+
return prefilter(createReadStream(path), false, true);
|
|
79
|
+
const info = await stat(path);
|
|
80
|
+
if (!info.isFile() || info.size > maxBytes)
|
|
81
|
+
throw new Error("Unavailable Codex transcript: read size limit exceeded or not a regular file");
|
|
82
|
+
// Native Codex compression is zstd; scan through EOF to enforce the decoded size limit.
|
|
83
|
+
const compressed = path.endsWith(".jsonl.zst");
|
|
79
84
|
if (compressed && typeof zlib.createZstdDecompress !== "function")
|
|
80
85
|
throw new Error("Compressed Codex rollouts require Node >=22.15 (createZstdDecompress)");
|
|
81
86
|
const input = createReadStream(path);
|
|
@@ -5,7 +5,7 @@ export type NoteAddress = {
|
|
|
5
5
|
path: string;
|
|
6
6
|
who?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const ADDRESS_FORMS = "Use <path> for this session, or @project/, @human/, @self/, or @model/ followed by a path; @projects/<name>/<path
|
|
8
|
+
export declare const ADDRESS_FORMS = "Use <path> for this session, or @project/, @human/, @self/, or @model/ followed by a path; @projects/<name>/<path>, @sessions/<id>/<path>, @agents/<name>/<path>, and @models/<name>/<path> read named notebooks.";
|
|
9
9
|
/** The one namespace-head vocabulary: the scope each public `@head` names, and the directory family a head with `dir` lists. */
|
|
10
10
|
export declare const NAMESPACE_HEADS: ReadonlyMap<string, {
|
|
11
11
|
readonly scope: Scope;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NoteError, shown } from "./errors.js";
|
|
2
2
|
import { assertVirtualPath, isSessionId, SLUG_PATTERN } from "./paths.js";
|
|
3
|
-
export const ADDRESS_FORMS = "Use <path> for this session, or @project/, @human/, @self/, or @model/ followed by a path; @projects/<name>/<path
|
|
3
|
+
export const ADDRESS_FORMS = "Use <path> for this session, or @project/, @human/, @self/, or @model/ followed by a path; @projects/<name>/<path>, @sessions/<id>/<path>, @agents/<name>/<path>, and @models/<name>/<path> read named notebooks.";
|
|
4
4
|
/** The one namespace-head vocabulary: the scope each public `@head` names, and the directory family a head with `dir` lists. */
|
|
5
5
|
export const NAMESPACE_HEADS = new Map([
|
|
6
6
|
["project", { scope: "project" }],
|
package/dist/src/notes/policy.js
CHANGED
|
@@ -28,7 +28,7 @@ export function pinnedPageOrder(path) {
|
|
|
28
28
|
}
|
|
29
29
|
export function noteBudgetWarnings(body, policy) {
|
|
30
30
|
const count = Array.from(body).length;
|
|
31
|
-
return count > policy.budget ? [`Warning: note body is ${count} Unicode code points, over budget ${policy.budget}
|
|
31
|
+
return count > policy.budget ? [`Warning: note body is ${count} Unicode code points, over budget ${policy.budget} — boil it down.`] : [];
|
|
32
32
|
}
|
|
33
33
|
export function assertNoteUnlocked(fields, unlock) {
|
|
34
34
|
if (fields.readonly === true && unlock !== false)
|
|
@@ -48,7 +48,7 @@ export type DreamBeginData = Static<typeof DreamBeginDataSchema>;
|
|
|
48
48
|
export declare const dreamBegin: {
|
|
49
49
|
readonly name: "dream_begin";
|
|
50
50
|
readonly label: "Dream begin";
|
|
51
|
-
readonly description: "
|
|
51
|
+
readonly description: "Spread one project's pages across the table — its project shelf, every session page born there, crumpled balls included. Until `dream_end` your pen works on all of them; other sessions' pages can be rewritten, not added to.";
|
|
52
52
|
readonly parameters: Type.TObject<{
|
|
53
53
|
project: Type.TOptional<Type.TString>;
|
|
54
54
|
}>;
|
|
@@ -96,7 +96,7 @@ export type DreamForgetData = Static<typeof DreamForgetDataSchema>;
|
|
|
96
96
|
export declare const dreamForget: {
|
|
97
97
|
readonly name: "dream_forget";
|
|
98
98
|
readonly label: "Dream forget";
|
|
99
|
-
readonly description: "
|
|
99
|
+
readonly description: "Throw a crumpled page in the bin for good. Only crumpled pages go.";
|
|
100
100
|
readonly parameters: Type.TObject<{
|
|
101
101
|
address: Type.TString;
|
|
102
102
|
}>;
|
|
@@ -125,7 +125,7 @@ export type DreamEndData = Static<typeof DreamEndDataSchema>;
|
|
|
125
125
|
export declare const dreamEnd: {
|
|
126
126
|
readonly name: "dream_end";
|
|
127
127
|
readonly label: "Dream end";
|
|
128
|
-
readonly description: "
|
|
128
|
+
readonly description: "Stack the pages, file them, close the drawer.";
|
|
129
129
|
readonly parameters: Type.TObject<{}>;
|
|
130
130
|
readonly outputSchema: Type.TUnion<[Type.TObject<{
|
|
131
131
|
project: Type.TString;
|
package/dist/src/tools/dream.js
CHANGED
|
@@ -44,7 +44,7 @@ export function dreamingIdentity(identity, state) {
|
|
|
44
44
|
}
|
|
45
45
|
const NOT_DREAMING = "No dream is open; call dream_begin first.";
|
|
46
46
|
export const dreamBeginParameters = Type.Object({
|
|
47
|
-
project: Type.Optional(Type.String({ description: "
|
|
47
|
+
project: Type.Optional(Type.String({ description: "Which project's pages; leave it out for this one." })),
|
|
48
48
|
}, { additionalProperties: false });
|
|
49
49
|
export const DreamBeginDataSchema = Type.Object({
|
|
50
50
|
project: Type.String(), baseline: Type.String(),
|
|
@@ -56,7 +56,7 @@ function renderBeginData(data) {
|
|
|
56
56
|
}
|
|
57
57
|
export const dreamBegin = {
|
|
58
58
|
name: "dream_begin", label: "Dream begin",
|
|
59
|
-
description: "
|
|
59
|
+
description: "Spread one project's pages across the table — its project shelf, every session page born there, crumpled balls included. Until `dream_end` your pen works on all of them; other sessions' pages can be rewritten, not added to.",
|
|
60
60
|
parameters: dreamBeginParameters, outputSchema: resultSchema(DreamBeginDataSchema),
|
|
61
61
|
async execute(params, identity, state) {
|
|
62
62
|
if (state.project !== undefined || state.pending !== undefined) {
|
|
@@ -115,11 +115,11 @@ export const dreamBegin = {
|
|
|
115
115
|
},
|
|
116
116
|
render: (result) => renderOutcome(result, renderBeginData),
|
|
117
117
|
};
|
|
118
|
-
export const dreamForgetParameters = Type.Object({ address: Type.String() }, { additionalProperties: false });
|
|
118
|
+
export const dreamForgetParameters = Type.Object({ address: Type.String({ description: "Which crumpled page goes in the bin." }) }, { additionalProperties: false });
|
|
119
119
|
export const DreamForgetDataSchema = Type.Object({ ...NoteIdentitySchema }, { additionalProperties: false });
|
|
120
120
|
export const dreamForget = {
|
|
121
121
|
name: "dream_forget", label: "Dream forget",
|
|
122
|
-
description: "
|
|
122
|
+
description: "Throw a crumpled page in the bin for good. Only crumpled pages go.",
|
|
123
123
|
parameters: dreamForgetParameters, outputSchema: resultSchema(DreamForgetDataSchema),
|
|
124
124
|
async execute(params, identity, state) {
|
|
125
125
|
if (state.project === undefined)
|
|
@@ -139,7 +139,7 @@ export const dreamEndParameters = Type.Object({}, { additionalProperties: false
|
|
|
139
139
|
export const DreamEndDataSchema = Type.Object({ project: Type.String(), commit: Type.Optional(Type.String()), audit_error: Type.Optional(Type.String()) }, { additionalProperties: false });
|
|
140
140
|
export const dreamEnd = {
|
|
141
141
|
name: "dream_end", label: "Dream end",
|
|
142
|
-
description: "
|
|
142
|
+
description: "Stack the pages, file them, close the drawer.",
|
|
143
143
|
parameters: dreamEndParameters, outputSchema: resultSchema(DreamEndDataSchema),
|
|
144
144
|
async execute(_params, identity, state) {
|
|
145
145
|
const project = state.project;
|
|
@@ -79,23 +79,22 @@ function pageOutcome(result) {
|
|
|
79
79
|
return failure("page_too_large", `Even trimmed to their shortest, these ${count} rows${multi ? "" : " and their folded runs"} fill the ${TOOL_OUTPUT_LIMIT} a call can carry; ${narrow}.`);
|
|
80
80
|
}
|
|
81
81
|
/* ------------------------------------------------------------------ history_list */
|
|
82
|
-
const sessionParameter = Type.Optional(Type.String({ minLength: 1, description: "(optional) Session ID or unique prefix, optionally pi:, claude:, codex:, or dsh:. Omit for this session. In history_list, * searches sessions with query or lists recent sessions without it; history_read needs one session." }));
|
|
83
82
|
export const historyListParameters = Type.Object({
|
|
84
|
-
session:
|
|
85
|
-
query: Type.Optional(searchQuery("
|
|
83
|
+
session: Type.Optional(Type.String({ minLength: 1, description: "Whose record: a session ID or prefix (pi:, claude:, codex:, dsh: allowed). Leave it out for this one. `*` means every recent session." })),
|
|
84
|
+
query: Type.Optional(searchQuery("Text to look for, or a list (any match). Searches what was said, tool arguments and output.")),
|
|
86
85
|
roles: historyRoles(),
|
|
87
|
-
before_seq: Type.Optional(Type.Integer({ minimum: 1, description: "
|
|
88
|
-
after_seq: Type.Optional(Type.Integer({ minimum: 0, description: "
|
|
89
|
-
since: Type.Optional(Type.String({ minLength: 1, description: "
|
|
90
|
-
until: Type.Optional(Type.String({ minLength: 1, description: "
|
|
91
|
-
from: Type.Optional(Type.Union([Type.Literal("newest"), Type.Literal("oldest")], { description: "
|
|
92
|
-
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 500, description: "
|
|
93
|
-
max_chars_per_item: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description:
|
|
86
|
+
before_seq: Type.Optional(Type.Integer({ minimum: 1, description: "Only entries before this seq." })),
|
|
87
|
+
after_seq: Type.Optional(Type.Integer({ minimum: 0, description: "Only entries after this seq; 0 starts from the first page." })),
|
|
88
|
+
since: Type.Optional(Type.String({ minLength: 1, description: "Only entries at or after this time (ISO 8601; UTC without an offset)." })),
|
|
89
|
+
until: Type.Optional(Type.String({ minLength: 1, description: "Only entries before this time (ISO 8601; UTC without an offset)." })),
|
|
90
|
+
from: Type.Optional(Type.Union([Type.Literal("newest"), Type.Literal("oldest")], { description: "Which end `limit` counts from: newest or oldest. Entries still read oldest first." })),
|
|
91
|
+
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 500, description: "How many entries per page; folded runs don't count." })),
|
|
92
|
+
max_chars_per_item: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description: "How much of each entry to show." })),
|
|
94
93
|
}, { additionalProperties: false });
|
|
95
94
|
export const historyList = {
|
|
96
95
|
name: "history_list",
|
|
97
96
|
label: "History list items",
|
|
98
|
-
description: "
|
|
97
|
+
description: "Flip back through the record, a page at a time. Another session: its ID. `*` pulls every recent session off the shelf; add `query` to search them.",
|
|
99
98
|
parameters: historyListParameters,
|
|
100
99
|
outputSchema: resultSchema(HistoryPageSchema),
|
|
101
100
|
async execute(params, context, wrapText = plainText) {
|
|
@@ -155,11 +154,11 @@ export const historyList = {
|
|
|
155
154
|
render: (result) => renderOutcome(result, renderPage),
|
|
156
155
|
};
|
|
157
156
|
/* ------------------------------------------------------------------ history_read */
|
|
158
|
-
export const historyReadParameters = Type.Object({ session:
|
|
157
|
+
export const historyReadParameters = Type.Object({ session: Type.Optional(Type.String({ minLength: 1, description: "Whose record: a session ID or prefix. Leave it out for this one." })), seq: Type.Integer({ minimum: 1, description: "Which entry, by its seq from `history_list`; bring its session along if it had one." }), ...TextWindowRequestSchema }, { additionalProperties: false });
|
|
159
158
|
export const historyRead = {
|
|
160
159
|
name: "history_read",
|
|
161
160
|
label: "History read item",
|
|
162
|
-
description: "
|
|
161
|
+
description: "Open one entry: what was called, what came back, the calls nested inside. Long entries come in slices; follow `next_offset_chars`.",
|
|
163
162
|
parameters: historyReadParameters,
|
|
164
163
|
outputSchema: resultSchema(HistoryReadDataSchema),
|
|
165
164
|
async execute(params, context, wrapText = plainText) {
|
|
@@ -142,6 +142,7 @@ export declare const NotesSearchDataSchema: Type.TObject<{
|
|
|
142
142
|
text: Type.TString;
|
|
143
143
|
offset_chars: Type.TInteger;
|
|
144
144
|
}>>;
|
|
145
|
+
more_matches: Type.TOptional<Type.TInteger>;
|
|
145
146
|
updated_at: Type.TString;
|
|
146
147
|
crumpled_at: Type.TOptional<Type.TString>;
|
|
147
148
|
warnings: Type.TArray<Type.TString>;
|
|
@@ -181,7 +182,7 @@ export declare const notesWriteParameters: Type.TObject<{
|
|
|
181
182
|
export declare const notesWrite: {
|
|
182
183
|
readonly name: "notes_write";
|
|
183
184
|
readonly label: "Notes write";
|
|
184
|
-
readonly description: "
|
|
185
|
+
readonly description: "Take a fresh page and write it — or rip out the old one and write it again. Title it for what's inside and when you'll reach for it.";
|
|
185
186
|
readonly parameters: Type.TObject<{
|
|
186
187
|
cwd: Type.TOptional<Type.TString>;
|
|
187
188
|
pinned: Type.TOptional<Type.TBoolean>;
|
|
@@ -230,7 +231,7 @@ export declare const notesUpdateParameters: Type.TObject<{
|
|
|
230
231
|
export declare const notesUpdate: {
|
|
231
232
|
readonly name: "notes_update";
|
|
232
233
|
readonly label: "Notes update";
|
|
233
|
-
readonly description: "
|
|
234
|
+
readonly description: "Work on a page you already have: cross out and rewrite lines, move it, pin it, lock it, give it more paper, crumple it. Keep every page true to now: wrong, stale, or no-longer-mattering lines get rewritten or struck where they stand. The page stays one page.";
|
|
234
235
|
readonly parameters: Type.TObject<{
|
|
235
236
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
236
237
|
replace_all: Type.TOptional<Type.TBoolean>;
|
|
@@ -277,7 +278,7 @@ export declare const notesReadParameters: Type.TObject<{
|
|
|
277
278
|
export declare const notesRead: {
|
|
278
279
|
readonly name: "notes_read";
|
|
279
280
|
readonly label: "Notes read";
|
|
280
|
-
readonly description: "Read a
|
|
281
|
+
readonly description: "Read a page. Long ones come a stretch at a time; follow `next_offset_chars`.";
|
|
281
282
|
readonly parameters: Type.TObject<{
|
|
282
283
|
cwd: Type.TOptional<Type.TString>;
|
|
283
284
|
offset_chars: Type.TOptional<Type.TInteger>;
|
|
@@ -326,7 +327,7 @@ export declare function renderListData(data: Snapshot<NotesListData["files"][num
|
|
|
326
327
|
export declare const notesList: {
|
|
327
328
|
readonly name: "notes_list";
|
|
328
329
|
readonly label: "Notes list";
|
|
329
|
-
readonly description: "
|
|
330
|
+
readonly description: "Leaf through the drawers, newest pages on top. One pass; `more` counts pages left on the pile — narrow `glob`.";
|
|
330
331
|
readonly parameters: Type.TObject<{
|
|
331
332
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
332
333
|
limit: Type.TOptional<Type.TInteger>;
|
|
@@ -371,7 +372,7 @@ export declare const MATCH_SHORTENED_MARKER = " [truncated]";
|
|
|
371
372
|
export declare const notesSearch: {
|
|
372
373
|
readonly name: "notes_search";
|
|
373
374
|
readonly label: "Notes search";
|
|
374
|
-
readonly description: "
|
|
375
|
+
readonly description: "Run a finger down every page for some text, case doesn't matter. Returns the lines it hits and where they sit; no query just lists the pages. One pass; `more` counts pages left on the pile — narrow `glob`.";
|
|
375
376
|
readonly parameters: Type.TObject<{
|
|
376
377
|
query: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TString>]>>;
|
|
377
378
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
@@ -389,6 +390,7 @@ export declare const notesSearch: {
|
|
|
389
390
|
text: Type.TString;
|
|
390
391
|
offset_chars: Type.TInteger;
|
|
391
392
|
}>>;
|
|
393
|
+
more_matches: Type.TOptional<Type.TInteger>;
|
|
392
394
|
updated_at: Type.TString;
|
|
393
395
|
crumpled_at: Type.TOptional<Type.TString>;
|
|
394
396
|
warnings: Type.TArray<Type.TString>;
|