notesoup 0.53.2 → 0.54.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 +6 -4
- package/dist/plugins/claude/src/helper.d.ts +2 -1
- package/dist/plugins/claude/src/helper.js +21 -24
- package/dist/plugins/claude/src/history.d.ts +3 -14
- package/dist/plugins/claude/src/history.js +2 -298
- package/dist/plugins/claude/src/text.d.ts +0 -1
- package/dist/plugins/claude/src/text.js +0 -1
- package/dist/plugins/codex/src/history.d.ts +3 -8
- package/dist/plugins/codex/src/history.js +2 -238
- package/dist/plugins/codex/src/hooks.js +1 -1
- package/dist/plugins/codex/src/identity.d.ts +1 -1
- package/dist/plugins/codex/src/identity.js +3 -3
- package/dist/plugins/codex/src/mcp.js +9 -8
- package/dist/plugins/codex/src/text.d.ts +1 -1
- package/dist/plugins/codex/src/text.js +2 -2
- package/dist/plugins/codex/src/transcript.d.ts +3 -39
- package/dist/plugins/codex/src/transcript.js +2 -313
- package/dist/plugins/dsh/engine.js +2 -2
- package/dist/plugins/dsh/history.d.ts +3 -0
- package/dist/plugins/dsh/history.js +15 -0
- package/dist/plugins/dsh/tools.js +12 -12
- package/dist/plugins/dsh/window.d.ts +1 -0
- package/dist/plugins/dsh/window.js +7 -3
- package/dist/plugins/pi/history-tools.d.ts +1 -1
- package/dist/plugins/pi/history-tools.js +9 -5
- package/dist/plugins/pi/history.d.ts +2 -3
- package/dist/plugins/pi/history.js +4 -147
- package/dist/plugins/pi/notes/tools.js +8 -6
- package/dist/plugins/pi/render.js +7 -4
- package/dist/plugins/pi/runtime.js +2 -2
- package/dist/plugins/pi/window.js +21 -7
- package/dist/src/boot/render.js +9 -11
- package/dist/src/boot/snapshot.d.ts +7 -7
- package/dist/src/boot/snapshot.js +17 -17
- package/dist/src/boot/text.d.ts +5 -3
- package/dist/src/boot/text.js +18 -10
- package/dist/src/dream/git.d.ts +2 -11
- package/dist/src/dream/git.js +6 -23
- package/dist/src/dream/lock.d.ts +2 -2
- package/dist/src/dream/lock.js +3 -3
- package/dist/src/history/claude.d.ts +16 -0
- package/dist/src/history/claude.js +336 -0
- package/dist/src/history/codex-transcript.d.ts +39 -0
- package/dist/src/history/codex-transcript.js +315 -0
- package/dist/src/history/codex.d.ts +8 -0
- package/dist/src/history/codex.js +238 -0
- package/dist/src/history/corpus.d.ts +35 -0
- package/dist/src/history/corpus.js +54 -0
- package/dist/src/history/history.d.ts +4 -8
- package/dist/src/history/history.js +3 -11
- package/dist/src/history/local.d.ts +17 -0
- package/dist/src/history/local.js +101 -0
- package/dist/src/history/pi.d.ts +36 -0
- package/dist/src/history/pi.js +202 -0
- package/dist/src/history/query.d.ts +15 -5
- package/dist/src/history/query.js +42 -13
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.js +6 -4
- package/dist/src/notes/address.d.ts +8 -8
- package/dist/src/notes/address.js +13 -13
- package/dist/src/notes/errors.d.ts +1 -1
- package/dist/src/notes/frontmatter.js +2 -2
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/paths.d.ts +6 -6
- package/dist/src/notes/paths.js +9 -9
- package/dist/src/notes/{project-home.d.ts → project-namespace.d.ts} +7 -7
- package/dist/src/notes/{project-home.js → project-namespace.js} +67 -25
- package/dist/src/notes/store.d.ts +4 -4
- package/dist/src/notes/store.js +55 -52
- package/dist/src/tools/dream.d.ts +21 -3
- package/dist/src/tools/dream.js +54 -16
- package/dist/src/tools/history.d.ts +7 -19
- package/dist/src/tools/history.js +80 -93
- package/dist/src/tools/notes-context.d.ts +10 -0
- package/dist/src/tools/notes-context.js +27 -0
- package/dist/src/tools/notes.d.ts +69 -20
- package/dist/src/tools/notes.js +40 -31
- package/dist/test/boot.integration.test.js +2 -3
- package/dist/test/claude-history.test.js +47 -34
- package/dist/test/claude-mod.test.js +96 -50
- package/dist/test/codex-history.test.js +4 -10
- package/dist/test/codex-plugin.test.js +50 -12
- package/dist/test/context-edit-budget.test.js +121 -0
- package/dist/test/dependencies.test.js +73 -6
- package/dist/test/dream-tools.test.js +153 -8
- package/dist/test/dsh.test.js +88 -19
- package/dist/test/helpers/dsh.d.ts +4 -1
- package/dist/test/helpers/dsh.js +20 -4
- package/dist/test/helpers/extension.d.ts +5 -1
- package/dist/test/helpers/extension.js +33 -2
- package/dist/test/helpers/history-corpus.d.ts +7 -0
- package/dist/test/helpers/history-corpus.js +26 -0
- package/dist/test/history-corpus.test.js +307 -0
- package/dist/test/history.integration.test.js +40 -48
- package/dist/test/host-neutral.test.js +20 -33
- package/dist/test/model-facing-text.test.js +14 -8
- package/dist/test/notes-cwd.test.d.ts +1 -0
- package/dist/test/notes-cwd.test.js +114 -0
- package/dist/test/notes-library.test.js +4 -4
- package/dist/test/notes-query-namespaces.test.d.ts +1 -0
- package/dist/test/{notes-query-homes.test.js → notes-query-namespaces.test.js} +13 -13
- package/dist/test/notes.integration.test.js +73 -24
- package/dist/test/notes.test.js +51 -21
- package/dist/test/pi-render.test.js +33 -1
- package/dist/test/project-namespace.test.d.ts +1 -0
- package/dist/test/project-namespace.test.js +324 -0
- package/docs/architecture.md +19 -12
- package/docs/claude-code-mod.md +7 -5
- package/docs/codex.md +6 -6
- package/docs/dsh.md +9 -9
- package/docs/history-sessions.md +52 -0
- package/docs/notes-library.md +9 -5
- package/docs/skills.md +3 -3
- package/docs/tool-results.md +14 -8
- package/package.json +4 -6
- package/playbook.md +6 -6
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +2164 -1341
- package/plugins/claude/hooks/register.ts +19 -11
- package/plugins/claude/playbook.md +6 -6
- package/plugins/claude/skills/memory/SKILL.md +9 -7
- package/plugins/claude/src/helper.ts +22 -25
- package/plugins/claude/src/history.ts +3 -257
- package/plugins/claude/src/text.ts +0 -1
- package/plugins/codex/README.md +1 -1
- package/plugins/codex/dist/codex/notesoup.js +1582 -969
- package/plugins/codex/src/history.ts +3 -193
- package/plugins/codex/src/hooks.ts +1 -1
- package/plugins/codex/src/identity.ts +3 -3
- package/plugins/codex/src/mcp.ts +9 -8
- package/plugins/codex/src/text.ts +2 -2
- package/plugins/codex/src/transcript.ts +3 -275
- package/plugins/dsh/engine.ts +2 -2
- package/plugins/dsh/history.ts +17 -0
- package/plugins/dsh/tools.ts +12 -12
- package/plugins/dsh/window.ts +8 -3
- package/plugins/paseo/OVERVIEW.md +4 -4
- package/plugins/paseo/README.md +1 -1
- package/plugins/paseo/client/brain-empty-card.tsx +3 -4
- package/plugins/paseo/client/markdown.tsx +159 -0
- package/plugins/paseo/client/notes-op-card.tsx +35 -34
- package/plugins/paseo/client/notes-op-transformer.ts +17 -68
- package/plugins/paseo/client/paper-card.tsx +8 -19
- package/plugins/paseo/client/paper-palette.ts +40 -0
- package/plugins/paseo/client/sticky-card.tsx +6 -4
- package/plugins/paseo/package.json +3 -0
- package/plugins/paseo/paseo-plugin.json +2 -2
- package/plugins/paseo/shared/notes-op.ts +13 -9
- package/plugins/paseo/test/notes-op.test.ts +52 -73
- package/plugins/paseo/test/paper-palette.test.ts +54 -0
- package/plugins/pi/history-tools.ts +11 -5
- package/plugins/pi/history.ts +8 -157
- package/plugins/pi/notes/tools.ts +8 -6
- package/plugins/pi/render.ts +6 -4
- package/plugins/pi/runtime.ts +2 -2
- package/plugins/pi/window.ts +22 -7
- package/skills/memory/SKILL.md +9 -7
- package/src/boot/render.ts +10 -13
- package/src/boot/snapshot.ts +20 -20
- package/src/boot/text.ts +18 -10
- package/src/dream/git.ts +7 -24
- package/src/dream/lock.ts +3 -3
- package/src/history/claude.ts +286 -0
- package/src/history/codex-transcript.ts +276 -0
- package/src/history/codex.ts +193 -0
- package/src/history/corpus.ts +69 -0
- package/src/history/history.ts +5 -12
- package/src/history/local.ts +93 -0
- package/src/history/pi.ts +199 -0
- package/src/history/query.ts +45 -15
- package/src/index.ts +8 -5
- package/src/notes/address.ts +13 -13
- package/src/notes/errors.ts +1 -1
- package/src/notes/frontmatter.ts +2 -2
- package/src/notes/index.ts +1 -1
- package/src/notes/paths.ts +9 -9
- package/src/notes/{project-home.ts → project-namespace.ts} +59 -28
- package/src/notes/store.ts +61 -58
- package/src/tools/dream.ts +63 -16
- package/src/tools/history.ts +71 -101
- package/src/tools/notes-context.ts +29 -0
- package/src/tools/notes.ts +39 -29
- package/dist/test/project-home.test.js +0 -134
- /package/dist/test/{notes-query-homes.test.d.ts → context-edit-budget.test.d.ts} +0 -0
- /package/dist/test/{project-home.test.d.ts → history-corpus.test.d.ts} +0 -0
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
/** Host-neutral history operations: one bounded payload for text and structured results. */
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
-
import { HISTORY_PREVIEW_CHARS, MAX_READ_WINDOW_CHARS
|
|
3
|
+
import { HISTORY_PREVIEW_CHARS, MAX_READ_WINDOW_CHARS } from "./output.js";
|
|
4
4
|
import { failure, fitsResult, resultSchema, readTextWindow, renderOutcome, renderTextWindow, success, TextWindowRequestSchema, TextWindowSchema } from "./result.js";
|
|
5
5
|
import { historyRoles, searchQuery } from "./schema.js";
|
|
6
|
-
import { HistoryPageSchema, selectPage } from "../history/query.js";
|
|
7
|
-
import {
|
|
6
|
+
import { HistoryPageSchema, corpusSelection, selectCorpusPage, selectPage } from "../history/query.js";
|
|
7
|
+
import { currentHistory, loadHistorySession, matchesSession, parseSessionSelector, resolveSession, sessionIdentity } from "../history/corpus.js";
|
|
8
|
+
import { allItems, eventDocument, nestedCallSummary, toolSummary, HistoryRoleSchema, NestedCallSummarySchema, ToolSummarySchema } from "../history/history.js";
|
|
8
9
|
/** One read: identity, tool summary and a flat document slice. */
|
|
9
10
|
const HistoryReadDataSchema = Type.Object({
|
|
11
|
+
session: Type.Optional(Type.String()),
|
|
12
|
+
notice: Type.Optional(Type.String()),
|
|
10
13
|
seq: Type.Integer({ minimum: 1 }),
|
|
11
|
-
window_id: Type.String(),
|
|
12
14
|
role: HistoryRoleSchema,
|
|
13
15
|
created_at: Type.Union([Type.String(), Type.Null()]),
|
|
14
16
|
...ToolSummarySchema.properties,
|
|
15
17
|
nested_calls: Type.Optional(NestedCallSummarySchema),
|
|
16
18
|
...TextWindowSchema.properties,
|
|
17
19
|
}, { additionalProperties: false });
|
|
18
|
-
const HistoryWindowsDataSchema = Type.Object({
|
|
19
|
-
session_id: Type.String(),
|
|
20
|
-
windows: Type.Array(Type.Object({
|
|
21
|
-
window_id: Type.String(),
|
|
22
|
-
created_at: Type.Union([Type.String(), Type.Null()]),
|
|
23
|
-
first_seq: Type.Union([Type.Integer({ minimum: 1 }), Type.Null()]),
|
|
24
|
-
last_seq: Type.Union([Type.Integer({ minimum: 1 }), Type.Null()]),
|
|
25
|
-
}, { additionalProperties: false })),
|
|
26
|
-
more: Type.Integer({ minimum: 0, description: "How many more were left out." }),
|
|
27
|
-
}, { additionalProperties: false });
|
|
28
20
|
/* ------------------------------------------------------------------ rendering */
|
|
29
21
|
function header(item) {
|
|
30
|
-
return `
|
|
22
|
+
return `${item.session === undefined ? "" : `session ${item.session} | `}seq ${item.seq} | ${item.role}`;
|
|
31
23
|
}
|
|
32
24
|
function toolHeader(item) {
|
|
33
25
|
if (item.role !== "tool")
|
|
@@ -50,86 +42,32 @@ function renderPageItem(item) {
|
|
|
50
42
|
}
|
|
51
43
|
function renderFoldedRow(row) {
|
|
52
44
|
const tools = Object.entries(row.tools).map(([name, count]) => `${name} ${count}`).join(", ");
|
|
53
|
-
const
|
|
54
|
-
|
|
45
|
+
const identity = row.session === undefined ? {} : { session: row.session };
|
|
46
|
+
const expand = `\n\t→ expand: ${JSON.stringify({ ...identity, after_seq: row.first_seq - 1, before_seq: row.last_seq + 1, from: "oldest", roles: ["tool", "context"] })}`;
|
|
47
|
+
return `${row.session === undefined ? "" : `session ${row.session} | `}seqs ${row.first_seq}-${row.last_seq} | folded ${row.count} events${tools ? ` | ${tools}` : ""}${expand}`;
|
|
55
48
|
}
|
|
56
49
|
function renderPage(page) {
|
|
57
50
|
// An empty selection has no anchors either, so it would otherwise render as nothing at all.
|
|
58
51
|
if (page.items.length === 0)
|
|
59
|
-
return "No events match these filters
|
|
52
|
+
return `${page.notice ?? ""}No events match these filters.`;
|
|
60
53
|
const body = page.items.map((item) => ("folded" in item ? renderFoldedRow(item) : renderPageItem(item))).join("\n\n");
|
|
61
54
|
const cursors = [
|
|
62
55
|
page.page_older === null ? "" : `→ older: ${JSON.stringify(page.page_older)}`,
|
|
63
56
|
page.page_newer === null ? "" : `→ newer: ${JSON.stringify(page.page_newer)}`,
|
|
64
57
|
].filter((line) => line !== "");
|
|
65
|
-
return cursors.length === 0 ? body : `${body}\n\n${cursors.join(" | ")}
|
|
58
|
+
return (page.notice ?? "") + (cursors.length === 0 ? body : `${body}\n\n${cursors.join(" | ")}`);
|
|
66
59
|
}
|
|
67
60
|
function renderRead(data) {
|
|
68
61
|
const tool = toolHeader(data);
|
|
69
62
|
const afterSeq = data.seq - 10;
|
|
70
|
-
const neighborhood = `neighborhood → \`history_list\`(${JSON.stringify({ ...(afterSeq >= 1 ? { after_seq: afterSeq } : {}), before_seq: data.seq + 10 })})`;
|
|
71
|
-
return [header(data), ...(tool ? [tool] : []), neighborhood, "", data.total_chars === 0 ? "No visible text recorded for this event." : renderTextWindow(data)].join("\n");
|
|
63
|
+
const neighborhood = `neighborhood → \`history_list\`(${JSON.stringify({ ...(data.session === undefined ? {} : { session: data.session }), ...(afterSeq >= 1 ? { after_seq: afterSeq } : {}), before_seq: data.seq + 10 })})`;
|
|
64
|
+
return (data.notice ?? "") + [header(data), ...(tool ? [tool] : []), neighborhood, "", data.total_chars === 0 ? "No visible text recorded for this event." : renderTextWindow(data)].join("\n");
|
|
72
65
|
}
|
|
73
66
|
const plainText = (text) => text;
|
|
74
|
-
// Sample known ids in the refusal message itself, never as a second listing.
|
|
75
|
-
const MAX_REPORTED_WINDOWS = 5;
|
|
76
|
-
/** At most `MAX_REPORTED_WINDOWS` known ids, appended to an unknown_window_id message. */
|
|
77
|
-
function knownWindowSuffix(known) {
|
|
78
|
-
return known.length === 0 ? "" : `; its windows: ${known.slice(0, MAX_REPORTED_WINDOWS).join(", ")}`;
|
|
79
|
-
}
|
|
80
|
-
export const PREVIOUS_WINDOW = "@previous";
|
|
81
|
-
/** Resolve "@previous" against oldest-first windows; every other value passes through. */
|
|
82
|
-
function resolveWindowId(projection, windowId) {
|
|
83
|
-
if (windowId !== PREVIOUS_WINDOW)
|
|
84
|
-
return { ok: true, window_id: windowId };
|
|
85
|
-
const previous = projection.windows.at(-2);
|
|
86
|
-
if (previous !== undefined)
|
|
87
|
-
return { ok: true, window_id: previous.windowId };
|
|
88
|
-
const known = projection.windows.map((current) => current.windowId);
|
|
89
|
-
return { ok: false, outcome: failure("unknown_window_id", `"${PREVIOUS_WINDOW}" has nothing to point at: this session has no window before the current one${knownWindowSuffix(known)}.`) };
|
|
90
|
-
}
|
|
91
|
-
function badWindowId(projection, params) {
|
|
92
|
-
const badWindow = unknownWindowId(projection, params);
|
|
93
|
-
if (!badWindow)
|
|
94
|
-
return undefined;
|
|
95
|
-
return failure("unknown_window_id", `${badWindow.message}${knownWindowSuffix(badWindow.known)}.`);
|
|
96
|
-
}
|
|
97
|
-
/* ------------------------------------------------------------------ history_windows */
|
|
98
|
-
export const historyWindowsParameters = Type.Object({}, { additionalProperties: false });
|
|
99
|
-
export const historyWindows = {
|
|
100
|
-
name: "history_windows",
|
|
101
|
-
label: "History list windows",
|
|
102
|
-
description: "List this session's context windows, oldest first, with seq ranges.",
|
|
103
|
-
parameters: historyWindowsParameters,
|
|
104
|
-
outputSchema: resultSchema(HistoryWindowsDataSchema),
|
|
105
|
-
async execute(_params, projection, sessionId, wrapText = plainText) {
|
|
106
|
-
const data = { session_id: sessionId, windows: [], more: projection.windows.length };
|
|
107
|
-
const fits = (candidate) => fitsResult(success(candidate), (result) => wrapText(renderOutcome(result, renderWindows)));
|
|
108
|
-
for (const window of projection.windows) {
|
|
109
|
-
let first = null;
|
|
110
|
-
let last = null;
|
|
111
|
-
for (const event of window.items) {
|
|
112
|
-
first = first === null ? event.seq : Math.min(first, event.seq);
|
|
113
|
-
last = last === null ? event.seq : Math.max(last, event.seq);
|
|
114
|
-
}
|
|
115
|
-
const row = { window_id: window.windowId, created_at: window.createdAt ?? null, first_seq: first, last_seq: last };
|
|
116
|
-
if (!fits({ ...data, windows: [...data.windows, row], more: data.more - 1 }))
|
|
117
|
-
break;
|
|
118
|
-
data.windows.push(row);
|
|
119
|
-
data.more--;
|
|
120
|
-
}
|
|
121
|
-
return fits(data) ? success(data) : failure("output_too_large", `The session id alone fills the ${TOOL_OUTPUT_LIMIT} a call can carry.`);
|
|
122
|
-
},
|
|
123
|
-
render: (result) => renderOutcome(result, renderWindows),
|
|
124
|
-
};
|
|
125
|
-
function renderWindows(data) {
|
|
126
|
-
const lines = [`session ${data.session_id}`, ...data.windows.map((window) => `window ${window.window_id} | seqs ${window.first_seq ?? "-"}-${window.last_seq ?? "-"}`)];
|
|
127
|
-
if (data.more > 0)
|
|
128
|
-
lines.push(`${data.more} more windows not shown; every \`history_list\` event also names its window.`);
|
|
129
|
-
return lines.join("\n");
|
|
130
|
-
}
|
|
131
67
|
/* ------------------------------------------------------------------ history_list */
|
|
68
|
+
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 (query required); history_read needs one session." }));
|
|
132
69
|
export const historyListParameters = Type.Object({
|
|
70
|
+
session: sessionParameter,
|
|
133
71
|
query: Type.Optional(searchQuery("(optional) Text, or a list of texts (any match). Empty text/list means no search filter; empty entries are ignored. Searches every role, tool arguments and output included; returns only hits.")),
|
|
134
72
|
roles: historyRoles(),
|
|
135
73
|
before_seq: Type.Optional(Type.Integer({ minimum: 1, description: "(optional) Only events with seq below this." })),
|
|
@@ -137,39 +75,86 @@ export const historyListParameters = Type.Object({
|
|
|
137
75
|
since: Type.Optional(Type.String({ minLength: 1, description: "(optional) ISO 8601 time; only events at or after it. UTC if no offset." })),
|
|
138
76
|
until: Type.Optional(Type.String({ minLength: 1, description: "(optional) ISO 8601 time; only events before it. UTC if no offset." })),
|
|
139
77
|
from: Type.Optional(Type.Union([Type.Literal("newest"), Type.Literal("oldest")], { description: "(optional, default newest) Which end `limit` counts from: newest or oldest. Results stay oldest first." })),
|
|
140
|
-
window_id: Type.Optional(Type.String({ minLength: 1, description: `(optional) Only this context window. From \`history_windows\` or any event; \`${PREVIOUS_WINDOW}\` is the one before this.` })),
|
|
141
78
|
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 500, description: "(optional, default 20) Max events per page; folded rows don't count." })),
|
|
142
79
|
max_chars_per_item: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description: `(optional, default ${HISTORY_PREVIEW_CHARS}) Max preview chars per event.` })),
|
|
143
80
|
}, { additionalProperties: false });
|
|
144
81
|
export const historyList = {
|
|
145
82
|
name: "history_list",
|
|
146
83
|
label: "History list items",
|
|
147
|
-
description: "Browse or search
|
|
84
|
+
description: "Browse or search events, a page at a time. Omit session for this session; pass an ID/prefix for another, or * with query to search across local harnesses. Read one in full with `history_read`.",
|
|
148
85
|
parameters: historyListParameters,
|
|
149
86
|
outputSchema: resultSchema(HistoryPageSchema),
|
|
150
|
-
async execute(params,
|
|
151
|
-
|
|
152
|
-
if (!resolved.ok)
|
|
153
|
-
return resolved.outcome;
|
|
154
|
-
const scoped = { ...params, window_id: resolved.window_id };
|
|
155
|
-
const badWindow = badWindowId(projection, scoped);
|
|
156
|
-
if (badWindow)
|
|
157
|
-
return badWindow;
|
|
158
|
-
// Charge wrapped rendering and cursors, not only event previews.
|
|
87
|
+
async execute(params, context, wrapText = plainText) {
|
|
88
|
+
// Charge wrapped rendering, identities, notices and recipes, not only event previews.
|
|
159
89
|
const fits = (page) => fitsResult(success(page), (result) => wrapText(renderOutcome(result, renderPage)));
|
|
160
|
-
|
|
90
|
+
const maxChars = params.max_chars_per_item ?? HISTORY_PREVIEW_CHARS;
|
|
91
|
+
if (params.session === undefined)
|
|
92
|
+
return selectPage(await currentHistory(context), params, fits, maxChars);
|
|
93
|
+
const selector = parseSessionSelector(params.session);
|
|
94
|
+
if (!selector.ok)
|
|
95
|
+
return selector;
|
|
96
|
+
const corpus = "corpus" in context ? context.corpus : undefined;
|
|
97
|
+
if (selector.data.wildcard) {
|
|
98
|
+
const scoped = corpusSelection(params);
|
|
99
|
+
if (!scoped.ok)
|
|
100
|
+
return scoped;
|
|
101
|
+
if (corpus === undefined)
|
|
102
|
+
return failure("unknown_session", "This host supplied no cross-session history corpus.");
|
|
103
|
+
const sessions = (await corpus.sessions(selector.data.harness)).filter((session) => matchesSession(session, selector.data));
|
|
104
|
+
const loaded = [];
|
|
105
|
+
const notices = [];
|
|
106
|
+
for (const session of sessions) {
|
|
107
|
+
const result = await loadHistorySession(session);
|
|
108
|
+
if (!result.ok)
|
|
109
|
+
return result;
|
|
110
|
+
loaded.push({ session: sessionIdentity(session), projection: result.data.projection });
|
|
111
|
+
if (result.data.notice)
|
|
112
|
+
notices.push(`session ${sessionIdentity(session)}: ${result.data.notice}`);
|
|
113
|
+
}
|
|
114
|
+
const notice = notices.length ? { notice: notices.join("") } : {};
|
|
115
|
+
const result = selectCorpusPage(loaded, scoped.data, (page) => fits({ ...page, ...notice }), maxChars);
|
|
116
|
+
return result.ok ? success({ ...result.data, ...notice }) : result;
|
|
117
|
+
}
|
|
118
|
+
const target = await resolveSession(corpus, selector.data);
|
|
119
|
+
if (!target.ok)
|
|
120
|
+
return target;
|
|
121
|
+
const loaded = await loadHistorySession(target.data);
|
|
122
|
+
if (!loaded.ok)
|
|
123
|
+
return loaded;
|
|
124
|
+
const notice = loaded.data.notice === undefined ? {} : { notice: loaded.data.notice };
|
|
125
|
+
const result = selectPage(loaded.data.projection, { ...params, session: sessionIdentity(target.data) }, (page) => fits({ ...page, ...notice }), maxChars);
|
|
126
|
+
return result.ok ? success({ ...result.data, ...notice }) : result;
|
|
161
127
|
},
|
|
162
128
|
render: (result) => renderOutcome(result, renderPage),
|
|
163
129
|
};
|
|
164
130
|
/* ------------------------------------------------------------------ history_read */
|
|
165
|
-
export const historyReadParameters = Type.Object({ seq: Type.Integer({ minimum: 1, description: "Event seq, from `history_list`." }), ...TextWindowRequestSchema }, { additionalProperties: false });
|
|
131
|
+
export const historyReadParameters = Type.Object({ session: sessionParameter, seq: Type.Integer({ minimum: 1, description: "Event seq, from `history_list`. Pass its session too when present." }), ...TextWindowRequestSchema }, { additionalProperties: false });
|
|
166
132
|
export const historyRead = {
|
|
167
133
|
name: "history_read",
|
|
168
134
|
label: "History read item",
|
|
169
135
|
description: "Read one event in full: tool arguments, output, and nested calls.",
|
|
170
136
|
parameters: historyReadParameters,
|
|
171
137
|
outputSchema: resultSchema(HistoryReadDataSchema),
|
|
172
|
-
async execute(params,
|
|
138
|
+
async execute(params, context, wrapText = plainText) {
|
|
139
|
+
let projection;
|
|
140
|
+
let identity = {};
|
|
141
|
+
if (params.session === undefined)
|
|
142
|
+
projection = await currentHistory(context);
|
|
143
|
+
else {
|
|
144
|
+
const selector = parseSessionSelector(params.session);
|
|
145
|
+
if (!selector.ok)
|
|
146
|
+
return selector;
|
|
147
|
+
if (selector.data.wildcard)
|
|
148
|
+
return failure("invalid_session", "`history_read` reads one session; pass a specific `session` ID, not a wildcard.");
|
|
149
|
+
const target = await resolveSession("corpus" in context ? context.corpus : undefined, selector.data);
|
|
150
|
+
if (!target.ok)
|
|
151
|
+
return target;
|
|
152
|
+
const loaded = await loadHistorySession(target.data);
|
|
153
|
+
if (!loaded.ok)
|
|
154
|
+
return loaded;
|
|
155
|
+
projection = loaded.data.projection;
|
|
156
|
+
identity = { session: sessionIdentity(target.data), ...(loaded.data.notice === undefined ? {} : { notice: loaded.data.notice }) };
|
|
157
|
+
}
|
|
173
158
|
const item = allItems(projection).find((event) => event.seq === params.seq);
|
|
174
159
|
// Address checks run in one order: past the end of the file, off this branch, then
|
|
175
160
|
// consumed by a pairing. Only the last two can mention what is at the address.
|
|
@@ -177,6 +162,8 @@ export const historyRead = {
|
|
|
177
162
|
return failure("unknown_seq", `There is no seq ${params.seq}; this session runs from seq 1 to ${projection.highestSeq}.`);
|
|
178
163
|
}
|
|
179
164
|
if (!projection.branchSeqs.has(params.seq)) {
|
|
165
|
+
if (identity.notice)
|
|
166
|
+
return failure("unconfirmed_seq", `Seq ${params.seq} is outside the confirmed selected history; it may be on another branch or beyond an unresolved ancestry gap.`);
|
|
180
167
|
return failure("not_on_branch", `Seq ${params.seq} is on another branch of this session; it can't be read from here.`);
|
|
181
168
|
}
|
|
182
169
|
if (item === undefined) {
|
|
@@ -192,8 +179,8 @@ export const historyRead = {
|
|
|
192
179
|
return failure("invalid_offset", `This event ends at char ${totalChars}; offset_chars ${params.offset_chars} is past the last word.`);
|
|
193
180
|
}
|
|
194
181
|
return readTextWindow(document, params.offset_chars, params.max_chars, (window) => ({
|
|
182
|
+
...identity,
|
|
195
183
|
seq: item.seq,
|
|
196
|
-
window_id: item.windowId,
|
|
197
184
|
role: item.role,
|
|
198
185
|
created_at: item.createdAt ?? null,
|
|
199
186
|
...toolSummary(item),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type NotesIdentity } from "../notes/index.js";
|
|
2
|
+
/** Host-supplied facts for one notes tool registration; overrides never mutate this context. */
|
|
3
|
+
export type NotesToolContext = Readonly<{
|
|
4
|
+
identity: NotesIdentity;
|
|
5
|
+
cwd: string;
|
|
6
|
+
}>;
|
|
7
|
+
/** Capture the host's base cwd alongside its default identity. */
|
|
8
|
+
export declare function notesToolContext(identity: NotesIdentity, cwd: string): NotesToolContext;
|
|
9
|
+
/** Resolve the current-project override once, before any address, receipt, or ownership decision. */
|
|
10
|
+
export declare function notesIdentityForCall(context: NotesToolContext, cwd?: string): NotesIdentity;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { statSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { NoteError } from "../notes/errors.js";
|
|
4
|
+
import { projectKey, snapshotNotesIdentity } from "../notes/index.js";
|
|
5
|
+
/** Capture the host's base cwd alongside its default identity. */
|
|
6
|
+
export function notesToolContext(identity, cwd) {
|
|
7
|
+
if (typeof cwd !== "string" || cwd.length === 0)
|
|
8
|
+
throw new TypeError("notes tool cwd must be a non-empty string");
|
|
9
|
+
return Object.freeze({ identity: snapshotNotesIdentity(identity), cwd: resolve(cwd) });
|
|
10
|
+
}
|
|
11
|
+
/** Resolve the current-project override once, before any address, receipt, or ownership decision. */
|
|
12
|
+
export function notesIdentityForCall(context, cwd) {
|
|
13
|
+
if (cwd === undefined)
|
|
14
|
+
return context.identity;
|
|
15
|
+
const resolved = resolve(context.cwd, cwd);
|
|
16
|
+
let directory = false;
|
|
17
|
+
try {
|
|
18
|
+
directory = statSync(resolved).isDirectory();
|
|
19
|
+
}
|
|
20
|
+
catch { /* Report one typed refusal below. */ }
|
|
21
|
+
if (!directory)
|
|
22
|
+
throw new NoteError("invalid_cwd", `cwd is not an existing directory: ${JSON.stringify(cwd)} (resolved to ${resolved}).`);
|
|
23
|
+
return snapshotNotesIdentity({
|
|
24
|
+
...context.identity,
|
|
25
|
+
projectKey: projectKey(resolved, context.identity.home),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { NotesIdentity } from "../notes/identity.js";
|
|
|
2
2
|
import { Type, type Static } from "typebox";
|
|
3
3
|
import { type NoteChange, type NoteQueryStatus, type NoteRow } from "../notes/index.js";
|
|
4
4
|
import { type Outcome } from "./result.js";
|
|
5
|
+
import { type NotesToolContext } from "./notes-context.js";
|
|
5
6
|
/**
|
|
6
7
|
* Typed refusal. Every fact a caller needs is already in the message; there is no separate context.
|
|
7
8
|
* Convert expected refusals; unexpected errors propagate unchanged.
|
|
@@ -17,18 +18,46 @@ export declare const NoteMetadataSchema: Type.TObject<{
|
|
|
17
18
|
extra: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
18
19
|
}>;
|
|
19
20
|
export type NoteMetadata = Static<typeof NoteMetadataSchema>;
|
|
20
|
-
|
|
21
|
+
/** Display context a named project notebook adds to its receipts; ordinary notebooks omit both. */
|
|
22
|
+
export declare const ProjectReceiptSchema: {
|
|
23
|
+
project_root: Type.TOptional<Type.TString>;
|
|
24
|
+
project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
|
|
25
|
+
name: Type.TString;
|
|
26
|
+
path: Type.TString;
|
|
27
|
+
}>>>;
|
|
28
|
+
};
|
|
29
|
+
/** One note identity, shared by every receipt: read/list/search rows and all mutations alike. */
|
|
30
|
+
export declare const NoteIdentitySchema: {
|
|
31
|
+
project_root: Type.TOptional<Type.TString>;
|
|
32
|
+
project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
|
|
33
|
+
name: Type.TString;
|
|
34
|
+
path: Type.TString;
|
|
35
|
+
}>>>;
|
|
21
36
|
address: Type.TString;
|
|
22
37
|
project_key: Type.TOptional<Type.TString>;
|
|
38
|
+
};
|
|
39
|
+
export declare const NotesWriteDataSchema: Type.TObject<{
|
|
23
40
|
outcome: Type.TUnion<[Type.TLiteral<"created">, Type.TLiteral<"overwrote">, Type.TLiteral<"uncrumpled">]>;
|
|
41
|
+
project_root: Type.TOptional<Type.TString>;
|
|
42
|
+
project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
|
|
43
|
+
name: Type.TString;
|
|
44
|
+
path: Type.TString;
|
|
45
|
+
}>>>;
|
|
46
|
+
address: Type.TString;
|
|
47
|
+
project_key: Type.TOptional<Type.TString>;
|
|
24
48
|
}>;
|
|
25
49
|
export type NotesWriteData = Static<typeof NotesWriteDataSchema>;
|
|
26
50
|
export declare const NotesUpdateDataSchema: Type.TObject<{
|
|
27
|
-
address: Type.TString;
|
|
28
|
-
project_key: Type.TOptional<Type.TString>;
|
|
29
51
|
change_kind: Type.TUnion<[Type.TLiteral<"none">, Type.TLiteral<"body">, Type.TLiteral<"metadata">, Type.TLiteral<"moved">]>;
|
|
30
52
|
diff: Type.TString;
|
|
31
53
|
rename_from: Type.TOptional<Type.TString>;
|
|
54
|
+
project_root: Type.TOptional<Type.TString>;
|
|
55
|
+
project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
|
|
56
|
+
name: Type.TString;
|
|
57
|
+
path: Type.TString;
|
|
58
|
+
}>>>;
|
|
59
|
+
address: Type.TString;
|
|
60
|
+
project_key: Type.TOptional<Type.TString>;
|
|
32
61
|
}>;
|
|
33
62
|
export type NotesUpdateData = Static<typeof NotesUpdateDataSchema>;
|
|
34
63
|
export declare const NotesReadDataSchema: Type.TObject<{
|
|
@@ -55,7 +84,7 @@ export declare const NotesReadDataSchema: Type.TObject<{
|
|
|
55
84
|
export type NotesReadData = Static<typeof NotesReadDataSchema>;
|
|
56
85
|
export declare const NotesListDataSchema: Type.TObject<{
|
|
57
86
|
more: Type.TInteger;
|
|
58
|
-
|
|
87
|
+
namespaces_unavailable: Type.TArray<Type.TString>;
|
|
59
88
|
files: Type.TArray<Type.TObject<{
|
|
60
89
|
updated_at: Type.TString;
|
|
61
90
|
last_accessed: Type.TString;
|
|
@@ -72,7 +101,7 @@ export declare const NotesListDataSchema: Type.TObject<{
|
|
|
72
101
|
export type NotesListData = Static<typeof NotesListDataSchema>;
|
|
73
102
|
export declare const NotesSearchDataSchema: Type.TObject<{
|
|
74
103
|
more: Type.TInteger;
|
|
75
|
-
|
|
104
|
+
namespaces_unavailable: Type.TArray<Type.TString>;
|
|
76
105
|
files: Type.TArray<Type.TObject<{
|
|
77
106
|
matches: Type.TArray<Type.TObject<{
|
|
78
107
|
line: Type.TInteger;
|
|
@@ -104,26 +133,33 @@ export declare const notesWriteParameters: Type.TObject<{
|
|
|
104
133
|
address: Type.TString;
|
|
105
134
|
content: Type.TString;
|
|
106
135
|
origin: Type.TOptional<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"self">, Type.TLiteral<"external">]>>;
|
|
136
|
+
cwd: Type.TOptional<Type.TString>;
|
|
107
137
|
}>;
|
|
108
138
|
export declare const notesWrite: {
|
|
109
139
|
readonly name: "notes_write";
|
|
110
140
|
readonly label: "Notes write";
|
|
111
|
-
readonly description: "Create a note, or overwrite its whole body. Name it for what it holds and when to use it. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable
|
|
141
|
+
readonly description: "Create a note, or overwrite its whole body. Name it for what it holds and when to use it. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable notebooks; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
112
142
|
readonly parameters: Type.TObject<{
|
|
113
143
|
address: Type.TString;
|
|
114
144
|
content: Type.TString;
|
|
115
145
|
origin: Type.TOptional<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"self">, Type.TLiteral<"external">]>>;
|
|
146
|
+
cwd: Type.TOptional<Type.TString>;
|
|
116
147
|
}>;
|
|
117
148
|
readonly outputSchema: Type.TUnion<[Type.TObject<{
|
|
149
|
+
outcome: Type.TUnion<[Type.TLiteral<"created">, Type.TLiteral<"overwrote">, Type.TLiteral<"uncrumpled">]>;
|
|
150
|
+
project_root: Type.TOptional<Type.TString>;
|
|
151
|
+
project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
|
|
152
|
+
name: Type.TString;
|
|
153
|
+
path: Type.TString;
|
|
154
|
+
}>>>;
|
|
118
155
|
address: Type.TString;
|
|
119
156
|
project_key: Type.TOptional<Type.TString>;
|
|
120
|
-
outcome: Type.TUnion<[Type.TLiteral<"created">, Type.TLiteral<"overwrote">, Type.TLiteral<"uncrumpled">]>;
|
|
121
157
|
}>, Type.TObject<{
|
|
122
158
|
error: Type.TString;
|
|
123
159
|
code: Type.TString;
|
|
124
160
|
}>]>;
|
|
125
161
|
readonly executionMode: "sequential";
|
|
126
|
-
readonly execute: (params: Static<typeof notesWriteParameters>,
|
|
162
|
+
readonly execute: (params: Static<typeof notesWriteParameters>, context: NotesToolContext) => Promise<Outcome<NotesWriteData>>;
|
|
127
163
|
readonly render: (result: Outcome<NotesWriteData>) => string;
|
|
128
164
|
};
|
|
129
165
|
export declare const notesUpdateParameters: Type.TObject<{
|
|
@@ -136,6 +172,7 @@ export declare const notesUpdateParameters: Type.TObject<{
|
|
|
136
172
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
137
173
|
replace_all: Type.TOptional<Type.TBoolean>;
|
|
138
174
|
rename_to: Type.TOptional<Type.TString>;
|
|
175
|
+
cwd: Type.TOptional<Type.TString>;
|
|
139
176
|
}>;
|
|
140
177
|
declare function renderUpdate(result: Outcome<NotesUpdateData>): string;
|
|
141
178
|
/** A shortened diff still says so in the receipt's own text, on both surfaces. */
|
|
@@ -143,7 +180,7 @@ export declare const DIFF_SHORTENED_MARKER = "[diff truncated; update applied]";
|
|
|
143
180
|
export declare const notesUpdate: {
|
|
144
181
|
readonly name: "notes_update";
|
|
145
182
|
readonly label: "Notes update";
|
|
146
|
-
readonly description: "Change part of a note's body, its origin or crumpled state, or its address. When
|
|
183
|
+
readonly description: "Change part of a note's body, its origin or crumpled state, or its address. When things change, replace the stale part in place; don't just tack an update onto the bottom. Each `oldText` must match exactly once unless `replace_all` is true. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable notebooks; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
147
184
|
readonly parameters: Type.TObject<{
|
|
148
185
|
address: Type.TString;
|
|
149
186
|
edits: Type.TOptional<Type.TArray<Type.TObject<{
|
|
@@ -154,22 +191,29 @@ export declare const notesUpdate: {
|
|
|
154
191
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
155
192
|
replace_all: Type.TOptional<Type.TBoolean>;
|
|
156
193
|
rename_to: Type.TOptional<Type.TString>;
|
|
194
|
+
cwd: Type.TOptional<Type.TString>;
|
|
157
195
|
}>;
|
|
158
196
|
readonly outputSchema: Type.TUnion<[Type.TObject<{
|
|
159
|
-
address: Type.TString;
|
|
160
|
-
project_key: Type.TOptional<Type.TString>;
|
|
161
197
|
change_kind: Type.TUnion<[Type.TLiteral<"none">, Type.TLiteral<"body">, Type.TLiteral<"metadata">, Type.TLiteral<"moved">]>;
|
|
162
198
|
diff: Type.TString;
|
|
163
199
|
rename_from: Type.TOptional<Type.TString>;
|
|
200
|
+
project_root: Type.TOptional<Type.TString>;
|
|
201
|
+
project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
|
|
202
|
+
name: Type.TString;
|
|
203
|
+
path: Type.TString;
|
|
204
|
+
}>>>;
|
|
205
|
+
address: Type.TString;
|
|
206
|
+
project_key: Type.TOptional<Type.TString>;
|
|
164
207
|
}>, Type.TObject<{
|
|
165
208
|
error: Type.TString;
|
|
166
209
|
code: Type.TString;
|
|
167
210
|
}>]>;
|
|
168
211
|
readonly executionMode: "sequential";
|
|
169
|
-
readonly execute: (params: Static<typeof notesUpdateParameters>,
|
|
212
|
+
readonly execute: (params: Static<typeof notesUpdateParameters>, context: NotesToolContext, renderDiff?: (change: NoteChange) => string) => Promise<Outcome<NotesUpdateData>>;
|
|
170
213
|
readonly render: typeof renderUpdate;
|
|
171
214
|
};
|
|
172
215
|
export declare const notesReadParameters: Type.TObject<{
|
|
216
|
+
cwd: Type.TOptional<Type.TString>;
|
|
173
217
|
offset_chars: Type.TOptional<Type.TInteger>;
|
|
174
218
|
max_chars: Type.TOptional<Type.TInteger>;
|
|
175
219
|
address: Type.TString;
|
|
@@ -177,8 +221,9 @@ export declare const notesReadParameters: Type.TObject<{
|
|
|
177
221
|
export declare const notesRead: {
|
|
178
222
|
readonly name: "notes_read";
|
|
179
223
|
readonly label: "Notes read";
|
|
180
|
-
readonly description: "Read a note. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable
|
|
224
|
+
readonly description: "Read a note. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable notebooks; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
181
225
|
readonly parameters: Type.TObject<{
|
|
226
|
+
cwd: Type.TOptional<Type.TString>;
|
|
182
227
|
offset_chars: Type.TOptional<Type.TInteger>;
|
|
183
228
|
max_chars: Type.TOptional<Type.TInteger>;
|
|
184
229
|
address: Type.TString;
|
|
@@ -207,27 +252,29 @@ export declare const notesRead: {
|
|
|
207
252
|
error: Type.TString;
|
|
208
253
|
code: Type.TString;
|
|
209
254
|
}>]>;
|
|
210
|
-
readonly execute: (params: Static<typeof notesReadParameters>,
|
|
255
|
+
readonly execute: (params: Static<typeof notesReadParameters>, context: NotesToolContext) => Promise<Outcome<NotesReadData>>;
|
|
211
256
|
readonly render: (result: Outcome<NotesReadData>) => string;
|
|
212
257
|
};
|
|
213
258
|
export declare const notesListParameters: Type.TObject<{
|
|
214
259
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
215
260
|
limit: Type.TOptional<Type.TInteger>;
|
|
216
261
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
262
|
+
cwd: Type.TOptional<Type.TString>;
|
|
217
263
|
}>;
|
|
218
264
|
export declare function renderListData(data: NotesListData): string;
|
|
219
265
|
export declare const notesList: {
|
|
220
266
|
readonly name: "notes_list";
|
|
221
267
|
readonly label: "Notes list";
|
|
222
|
-
readonly description: "List notes, newest first. Not pageable; `more` counts the rest. Omit `glob` or use `@default` for this session and current shared
|
|
268
|
+
readonly description: "List notes, newest first. Not pageable; `more` counts the rest. Omit `glob` or use `@default` for this session and current shared notebooks; `**` searches all notebooks, `@sessions/*/**` searches all sessions. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable notebooks; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
223
269
|
readonly parameters: Type.TObject<{
|
|
224
270
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
225
271
|
limit: Type.TOptional<Type.TInteger>;
|
|
226
272
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
273
|
+
cwd: Type.TOptional<Type.TString>;
|
|
227
274
|
}>;
|
|
228
275
|
readonly outputSchema: Type.TUnion<[Type.TObject<{
|
|
229
276
|
more: Type.TInteger;
|
|
230
|
-
|
|
277
|
+
namespaces_unavailable: Type.TArray<Type.TString>;
|
|
231
278
|
files: Type.TArray<Type.TObject<{
|
|
232
279
|
updated_at: Type.TString;
|
|
233
280
|
last_accessed: Type.TString;
|
|
@@ -244,7 +291,7 @@ export declare const notesList: {
|
|
|
244
291
|
error: Type.TString;
|
|
245
292
|
code: Type.TString;
|
|
246
293
|
}>]>;
|
|
247
|
-
readonly execute: (params: Static<typeof notesListParameters>,
|
|
294
|
+
readonly execute: (params: Static<typeof notesListParameters>, context: NotesToolContext) => Promise<Outcome<NotesListData>>;
|
|
248
295
|
readonly render: (result: Outcome<NotesListData>) => string;
|
|
249
296
|
};
|
|
250
297
|
export declare const notesSearchParameters: Type.TObject<{
|
|
@@ -253,23 +300,25 @@ export declare const notesSearchParameters: Type.TObject<{
|
|
|
253
300
|
limit: Type.TOptional<Type.TInteger>;
|
|
254
301
|
max_matches_per_file: Type.TOptional<Type.TInteger>;
|
|
255
302
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
303
|
+
cwd: Type.TOptional<Type.TString>;
|
|
256
304
|
}>;
|
|
257
305
|
/** A shortened match line still ends with a marker, so its own text says it was cut. */
|
|
258
306
|
export declare const MATCH_SHORTENED_MARKER = " [truncated]";
|
|
259
307
|
export declare const notesSearch: {
|
|
260
308
|
readonly name: "notes_search";
|
|
261
309
|
readonly label: "Notes search";
|
|
262
|
-
readonly description: "Search note bodies for literal text, case-insensitive. Without a query, lists notes with no match lines. Returns matching lines with offsets for `notes_read`. Not pageable; `more` counts the rest. Omit `glob` or use `@default` for this session and current shared
|
|
310
|
+
readonly description: "Search note bodies for literal text, case-insensitive. Without a query, lists notes with no match lines. Returns matching lines with offsets for `notes_read`. Not pageable; `more` counts the rest. Omit `glob` or use `@default` for this session and current shared notebooks; `**` searches all notebooks, `@sessions/*/**` searches all sessions. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable notebooks; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
263
311
|
readonly parameters: Type.TObject<{
|
|
264
312
|
query: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TString>]>>;
|
|
265
313
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
266
314
|
limit: Type.TOptional<Type.TInteger>;
|
|
267
315
|
max_matches_per_file: Type.TOptional<Type.TInteger>;
|
|
268
316
|
crumpled: Type.TOptional<Type.TBoolean>;
|
|
317
|
+
cwd: Type.TOptional<Type.TString>;
|
|
269
318
|
}>;
|
|
270
319
|
readonly outputSchema: Type.TUnion<[Type.TObject<{
|
|
271
320
|
more: Type.TInteger;
|
|
272
|
-
|
|
321
|
+
namespaces_unavailable: Type.TArray<Type.TString>;
|
|
273
322
|
files: Type.TArray<Type.TObject<{
|
|
274
323
|
matches: Type.TArray<Type.TObject<{
|
|
275
324
|
line: Type.TInteger;
|
|
@@ -291,7 +340,7 @@ export declare const notesSearch: {
|
|
|
291
340
|
error: Type.TString;
|
|
292
341
|
code: Type.TString;
|
|
293
342
|
}>]>;
|
|
294
|
-
readonly execute: (params: Static<typeof notesSearchParameters>,
|
|
343
|
+
readonly execute: (params: Static<typeof notesSearchParameters>, context: NotesToolContext) => Promise<Outcome<NotesSearchData>>;
|
|
295
344
|
readonly render: (result: Outcome<NotesSearchData>) => string;
|
|
296
345
|
};
|
|
297
346
|
export {};
|