notesoup 0.59.0 → 0.59.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/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/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/dsh.test.js +13 -1
- package/dist/test/note-policy.test.js +6 -1
- package/dist/test/notes.integration.test.js +28 -0
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +59 -61
- package/plugins/claude/hooks/register.ts +6 -4
- package/plugins/codex/dist/codex/notesoup.js +59 -61
- package/plugins/dsh/tools.ts +0 -2
- package/src/boot/text.ts +6 -10
- 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
|
@@ -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_*",
|
|
@@ -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>;
|
package/dist/src/tools/notes.js
CHANGED
|
@@ -13,12 +13,12 @@ import { nullableString, searchQuery } from "./schema.js";
|
|
|
13
13
|
import { notesIdentityForCall } from "./notes-context.js";
|
|
14
14
|
const ORIGIN_VALUES = [Type.Literal("user"), Type.Literal("self"), Type.Literal("external")];
|
|
15
15
|
const ORIGIN = Type.Optional(Type.Union([...ORIGIN_VALUES], {
|
|
16
|
-
description: "
|
|
16
|
+
description: "Whose handwriting: user, self, or external. Leave it out to keep what's there.",
|
|
17
17
|
}));
|
|
18
18
|
const POLICY_PARAMETERS = {
|
|
19
|
-
pinned: Type.Optional(Type.Boolean({ description: "
|
|
20
|
-
budget: Type.Optional(Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER, description: "
|
|
21
|
-
readonly: Type.Optional(Type.Boolean({ description: "
|
|
19
|
+
pinned: Type.Optional(Type.Boolean({ description: "Tape the page inside the cover: read whole at every wake-up. Five per notebook, CHEATSHEET and MAP included." })),
|
|
20
|
+
budget: Type.Optional(Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER, description: "How much paper the page gets. Writing past it still saves, with a warning. A page over budget gets boiled down: stale lines out, repeats merged, the rest said shorter. More paper is for a page already boiled down that still needs the room." })),
|
|
21
|
+
readonly: Type.Optional(Type.Boolean({ description: "A paperclip that keeps your own hands off. `false` takes it off — same call is fine." })),
|
|
22
22
|
};
|
|
23
23
|
const PolicySchema = {
|
|
24
24
|
pinned: Type.Boolean(), budget: Type.Integer(), readonly: Type.Boolean(),
|
|
@@ -33,13 +33,12 @@ function renderPolicy(policy) {
|
|
|
33
33
|
function withWarnings(text, data) {
|
|
34
34
|
return [text, ...data.warnings].join("\n");
|
|
35
35
|
}
|
|
36
|
-
const CRUMPLED_PARAMETER = Type.Optional(Type.Boolean({ description: "
|
|
37
|
-
const CRUMPLED_LIST_PARAMETER = Type.Optional(Type.Boolean({ description: "
|
|
38
|
-
const FILE_LIMIT_PARAMETER = Type.Optional(Type.Integer({ minimum: 1, description: "
|
|
39
|
-
const GLOB_PARAMETER = nullableString("
|
|
40
|
-
const CWD_PARAMETER = Type.Optional(Type.String({ minLength: 1, description: "
|
|
41
|
-
const
|
|
42
|
-
const ADDRESS_DESCRIPTION = "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.";
|
|
36
|
+
const CRUMPLED_PARAMETER = Type.Optional(Type.Boolean({ description: "`true` balls the page up: gone from list and search, still readable. `false` smooths it flat again." }));
|
|
37
|
+
const CRUMPLED_LIST_PARAMETER = Type.Optional(Type.Boolean({ description: "Only the crumpled balls." }));
|
|
38
|
+
const FILE_LIMIT_PARAMETER = Type.Optional(Type.Integer({ minimum: 1, description: "How many pages at most." }));
|
|
39
|
+
const GLOB_PARAMETER = nullableString("Which drawers to open. Leave it out for this session and your current notebooks. `@project/**` one shelf · `MAP.md` that page in every notebook · `**` everything · `@sessions/*/**` every session.");
|
|
40
|
+
const CWD_PARAMETER = Type.Optional(Type.String({ minLength: 1, description: "Treat this directory's project as `@project/`." }));
|
|
41
|
+
const ADDRESS_PARAMETER = Type.String({ description: "Which drawer the page sits in. `plan.md` — this session's desk, cleared when it ends. `@project/` this project's shelf · `@human/` your human's file · `@self/` your own notebook · `@model/` your brain's. `@projects/<name>/`, `@sessions/<id>/`, `@agents/<name>/`, `@models/<name>/` — someone else's shelf: read only. Paper, not files: hand one to read/write/edit/bash and a real `@project` folder is born." });
|
|
43
42
|
/**
|
|
44
43
|
* Typed refusal. Every fact a caller needs is already in the message; there is no separate context.
|
|
45
44
|
* Convert expected refusals; unexpected errors propagate unchanged.
|
|
@@ -151,7 +150,7 @@ const MatchSchema = Type.Object({
|
|
|
151
150
|
}, { additionalProperties: false });
|
|
152
151
|
const SearchedFileSchema = Type.Object({
|
|
153
152
|
...ListedFileSchema.properties,
|
|
154
|
-
matches: Type.Array(MatchSchema),
|
|
153
|
+
matches: Type.Array(MatchSchema), more_matches: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
155
154
|
}, { additionalProperties: false });
|
|
156
155
|
export const SnapshotSchema = {
|
|
157
156
|
more: Type.Integer({ description: "How many more were left out." }),
|
|
@@ -211,13 +210,13 @@ export function listedFile(row, identity) {
|
|
|
211
210
|
const policy = policyAt(row.meta, row.address);
|
|
212
211
|
return { ...noteIdentity(identity, row.address), ...policy, warnings: row.warnings ?? (row.body === undefined ? [] : noteBudgetWarnings(row.body, policy)), updated_at: localIso(row.meta.updatedAt), ...(row.meta.crumpledAt === undefined ? {} : { crumpled_at: row.meta.crumpledAt }) };
|
|
213
212
|
}
|
|
214
|
-
export const notesWriteParameters = Type.Object({ address:
|
|
213
|
+
export const notesWriteParameters = Type.Object({ address: ADDRESS_PARAMETER, content: Type.String({ description: "The whole page." }), origin: ORIGIN, ...POLICY_PARAMETERS, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
215
214
|
function renderWriteData(data) {
|
|
216
215
|
return withWarnings(`${data.outcome} ${renderIdentity(data)} | ${renderPolicy(data)}`, data);
|
|
217
216
|
}
|
|
218
217
|
export const notesWrite = {
|
|
219
218
|
name: "notes_write", label: "Notes write",
|
|
220
|
-
description:
|
|
219
|
+
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.",
|
|
221
220
|
parameters: notesWriteParameters, outputSchema: resultSchema(NotesWriteDataSchema), executionMode: "sequential",
|
|
222
221
|
async execute(params, context) {
|
|
223
222
|
try {
|
|
@@ -232,13 +231,13 @@ export const notesWrite = {
|
|
|
232
231
|
render: (result) => renderOutcome(result, renderWriteData),
|
|
233
232
|
};
|
|
234
233
|
export const notesUpdateParameters = Type.Object({
|
|
235
|
-
address:
|
|
236
|
-
edits: Type.Optional(Type.Array(Type.Object({ oldText: Type.String(), newText: Type.String() }, { additionalProperties: false }))),
|
|
234
|
+
address: ADDRESS_PARAMETER,
|
|
235
|
+
edits: Type.Optional(Type.Array(Type.Object({ oldText: Type.String({ description: "The passage as it stands on the page." }), newText: Type.String({ description: "What goes in its place." }) }, { additionalProperties: false }), { description: "Pen strokes, in order. Each `oldText` is the exact passage — same case, found once — and `newText` is what goes in its place." })),
|
|
237
236
|
origin: ORIGIN,
|
|
238
237
|
...POLICY_PARAMETERS,
|
|
239
238
|
crumpled: CRUMPLED_PARAMETER,
|
|
240
|
-
replace_all: Type.Optional(Type.Boolean({ description: "
|
|
241
|
-
rename_to: Type.Optional(Type.String({ description: "
|
|
239
|
+
replace_all: Type.Optional(Type.Boolean({ description: "Strike every copy of `oldText`, not just one." })),
|
|
240
|
+
rename_to: Type.Optional(Type.String({ description: "Move the page to another address. Never lands on top of a live page; nothing pointing at it follows." })),
|
|
242
241
|
cwd: CWD_PARAMETER,
|
|
243
242
|
}, { additionalProperties: false });
|
|
244
243
|
function renderUpdateData(data) {
|
|
@@ -249,7 +248,7 @@ function renderUpdateData(data) {
|
|
|
249
248
|
}
|
|
250
249
|
export const notesUpdate = {
|
|
251
250
|
name: "notes_update", label: "Notes update",
|
|
252
|
-
description:
|
|
251
|
+
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.",
|
|
253
252
|
parameters: notesUpdateParameters, outputSchema: resultSchema(NotesUpdateDataSchema), executionMode: "sequential",
|
|
254
253
|
async execute(params, context, onChange) {
|
|
255
254
|
try {
|
|
@@ -269,13 +268,13 @@ export const notesUpdate = {
|
|
|
269
268
|
},
|
|
270
269
|
render: (result) => renderOutcome(result, renderUpdateData),
|
|
271
270
|
};
|
|
272
|
-
export const notesReadParameters = Type.Object({ address:
|
|
271
|
+
export const notesReadParameters = Type.Object({ address: ADDRESS_PARAMETER, ...TextWindowRequestSchema, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
273
272
|
function renderReadData(data) {
|
|
274
273
|
return withWarnings(`${renderIdentity(data)}\n${renderMetadata(data.metadata)}`, data) + `\n\n${renderTextWindow(data)}`;
|
|
275
274
|
}
|
|
276
275
|
export const notesRead = {
|
|
277
276
|
name: "notes_read", label: "Notes read",
|
|
278
|
-
description:
|
|
277
|
+
description: "Read a page. Long ones come a stretch at a time; follow `next_offset_chars`.",
|
|
279
278
|
parameters: notesReadParameters, outputSchema: resultSchema(NotesReadDataSchema),
|
|
280
279
|
async execute(params, context) {
|
|
281
280
|
try {
|
|
@@ -312,7 +311,7 @@ export function renderListData(data) {
|
|
|
312
311
|
}
|
|
313
312
|
export const notesList = {
|
|
314
313
|
name: "notes_list", label: "Notes list",
|
|
315
|
-
description:
|
|
314
|
+
description: "Leaf through the drawers, newest pages on top. One pass; `more` counts pages left on the pile — narrow `glob`.",
|
|
316
315
|
parameters: notesListParameters, outputSchema: resultSchema(NotesListDataSchema),
|
|
317
316
|
async execute(params, context) {
|
|
318
317
|
try {
|
|
@@ -326,11 +325,11 @@ export const notesList = {
|
|
|
326
325
|
},
|
|
327
326
|
render: (result) => renderOutcome(result, renderListData),
|
|
328
327
|
};
|
|
329
|
-
export const notesSearchParameters = Type.Object({ query: Type.Optional(searchQuery()), glob: GLOB_PARAMETER, limit: FILE_LIMIT_PARAMETER, max_matches_per_file: Type.Optional(Type.Integer({ minimum: 1, description: "
|
|
328
|
+
export const notesSearchParameters = Type.Object({ query: Type.Optional(searchQuery()), glob: GLOB_PARAMETER, limit: FILE_LIMIT_PARAMETER, max_matches_per_file: Type.Optional(Type.Integer({ minimum: 1, description: "How many hit lines per page at most." })), crumpled: CRUMPLED_LIST_PARAMETER, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
330
329
|
function renderSearchData(data) {
|
|
331
330
|
const lines = [`${data.files.length} ${data.files.length === 1 ? "note" : "notes"}`];
|
|
332
331
|
for (const file of data.files) {
|
|
333
|
-
lines.push(`- ${renderIdentity(file)} | ${renderPolicy(file)} | updated ${file.updated_at} | ${file.matches.length} ${file.matches.length === 1 ? "match" : "matches"}`);
|
|
332
|
+
lines.push(`- ${renderIdentity(file)} | ${renderPolicy(file)} | updated ${file.updated_at} | ${file.matches.length} ${file.matches.length === 1 ? "match" : "matches"}${file.more_matches ? `, ${file.more_matches} more lines` : ""}`);
|
|
334
333
|
lines.push(...file.warnings.map(warning => ` ${warning}`));
|
|
335
334
|
for (const match of file.matches)
|
|
336
335
|
lines.push(` line ${match.line} at offset_chars ${match.offset_chars}: ${match.text}`);
|
|
@@ -341,6 +340,10 @@ function renderSearchData(data) {
|
|
|
341
340
|
lines.push(`${namespace} could not be read`);
|
|
342
341
|
return lines.join("\n");
|
|
343
342
|
}
|
|
343
|
+
function keepMatches(file, count = file.matches.length) {
|
|
344
|
+
const more = (file.more_matches ?? 0) + Math.max(0, file.matches.length - count);
|
|
345
|
+
return { ...file, matches: file.matches.slice(0, count), ...(more ? { more_matches: more } : {}) };
|
|
346
|
+
}
|
|
344
347
|
/** A shortened match line still ends with a marker, so its own text says it was cut. */
|
|
345
348
|
export const MATCH_SHORTENED_MARKER = " [truncated]";
|
|
346
349
|
/** Prefer whole match lines; shorten the first line only if no whole line fits, and mark it. */
|
|
@@ -349,31 +352,29 @@ function fitSearchFile(file, fits) {
|
|
|
349
352
|
let high = file.matches.length;
|
|
350
353
|
while (low < high) {
|
|
351
354
|
const mid = Math.ceil((low + high) / 2);
|
|
352
|
-
if (fits(
|
|
355
|
+
if (fits(keepMatches(file, mid)))
|
|
353
356
|
low = mid;
|
|
354
357
|
else
|
|
355
358
|
high = mid - 1;
|
|
356
359
|
}
|
|
357
|
-
if (low > 0)
|
|
358
|
-
return
|
|
360
|
+
if (low > 0 || file.matches.length === 0)
|
|
361
|
+
return keepMatches(file, low);
|
|
359
362
|
const first = file.matches[0];
|
|
360
|
-
|
|
361
|
-
return file;
|
|
362
|
-
const withText = (text) => ({ ...file, matches: [{ ...first, text: `${text}${MATCH_SHORTENED_MARKER}` }] });
|
|
363
|
+
const withText = (text) => ({ ...keepMatches(file, 1), matches: [{ ...first, text: `${text}${MATCH_SHORTENED_MARKER}` }] });
|
|
363
364
|
return withText(prefixFit(first.text, text => fits(withText(text))));
|
|
364
365
|
}
|
|
365
366
|
export const notesSearch = {
|
|
366
367
|
name: "notes_search", label: "Notes search",
|
|
367
|
-
description:
|
|
368
|
+
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`.",
|
|
368
369
|
parameters: notesSearchParameters, outputSchema: resultSchema(NotesSearchDataSchema),
|
|
369
370
|
async execute(params, context) {
|
|
370
371
|
try {
|
|
371
372
|
const identity = notesIdentityForCall(context, params.cwd);
|
|
372
373
|
const { rows, status } = await createNotesStore(identity).searchWithStatus(searchQueries(params.query), { glob: params.glob ?? undefined, crumpled: params.crumpled });
|
|
373
|
-
const files = rows.sort((a, b) => b.meta.updatedAt - a.meta.updatedAt || a.address.localeCompare(b.address)).map(row => ({
|
|
374
|
+
const files = rows.sort((a, b) => b.meta.updatedAt - a.meta.updatedAt || a.address.localeCompare(b.address)).map(row => keepMatches({
|
|
374
375
|
...listedFile(row, identity),
|
|
375
|
-
matches: row.matches.
|
|
376
|
-
}));
|
|
376
|
+
matches: row.matches.map(match => ({ line: match.line, text: match.text, offset_chars: match.offsetChars })),
|
|
377
|
+
}, params.max_matches_per_file));
|
|
377
378
|
return snapshot(files, params.limit, status, renderSearchData, fitSearchFile);
|
|
378
379
|
}
|
|
379
380
|
catch (error) {
|
package/dist/src/tools/result.js
CHANGED
|
@@ -40,8 +40,8 @@ export const TextWindowSchema = Type.Object({
|
|
|
40
40
|
* because `readTextWindow` already owns the defaults.
|
|
41
41
|
*/
|
|
42
42
|
export const TextWindowRequestSchema = {
|
|
43
|
-
offset_chars: Type.Optional(Type.Integer({ description: "
|
|
44
|
-
max_chars: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description:
|
|
43
|
+
offset_chars: Type.Optional(Type.Integer({ description: "Where on the page to start reading; negative counts from the end." })),
|
|
44
|
+
max_chars: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description: "How much to read at once." })),
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Read one code-point window of `text` and build the operation's data around it. `offset` and
|
package/dist/src/tools/schema.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Type } from "typebox";
|
|
|
2
2
|
import { Errors } from "typebox/value";
|
|
3
3
|
import { HistoryRoleSchema } from "../history/history.js";
|
|
4
4
|
export const nullableString = (description) => Type.Optional(Type.Union([Type.String(), Type.Null()], description === undefined ? {} : { description }));
|
|
5
|
-
export const historyRoles = () => Type.Optional(Type.Array(HistoryRoleSchema, { minItems: 1, description: "
|
|
5
|
+
export const historyRoles = () => Type.Optional(Type.Array(HistoryRoleSchema, { minItems: 1, description: "Only these voices: user, assistant, tool, context. Without roles or query, tool and context runs fold into one line." }));
|
|
6
6
|
/** First parameter violation; skip false subschemas so additionalProperties can name the field. */
|
|
7
7
|
export function paramProblem(schema, params) {
|
|
8
8
|
const first = Errors(schema, params).find((error) => error.keyword !== "boolean");
|
|
@@ -13,4 +13,4 @@ export function paramProblem(schema, params) {
|
|
|
13
13
|
return `${field ? `${field} ` : ""}${first.message}${extra}`;
|
|
14
14
|
}
|
|
15
15
|
/** Search query parameter: one literal, or several literals combined with OR. */
|
|
16
|
-
export const searchQuery = (description = "
|
|
16
|
+
export const searchQuery = (description = "Text to look for, or a list (any match). Leave it out to just list the pages.") => Type.Union([Type.String(), Type.Array(Type.String())], { description });
|
package/dist/test/dsh.test.js
CHANGED
|
@@ -8,7 +8,8 @@ import { tmpdir } from "node:os";
|
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import { resolveProjectNamespace } from "../src/notes/project-namespace.js";
|
|
10
10
|
import { WINDOW_IDENTITY_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG } from "../src/boot/text.js";
|
|
11
|
-
import { notesRead } from "../src/tools/notes.js";
|
|
11
|
+
import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../src/tools/notes.js";
|
|
12
|
+
import { historyList, historyRead } from "../src/tools/history.js";
|
|
12
13
|
import { notesToolContext } from "../src/tools/notes-context.js";
|
|
13
14
|
import { success } from "../src/result.js";
|
|
14
15
|
import { createNotesStore } from "../src/notes/index.js";
|
|
@@ -24,6 +25,17 @@ function prompt(text) { return createUserMessage({ content: [{ type: "text", tex
|
|
|
24
25
|
async function run(agent, text) { agent.followup(prompt(text)); await agent.whenIdle(); }
|
|
25
26
|
function system(request) { return typeof request.system === "string" ? request.system : request.system?.map((block) => block.text).join("\n") ?? ""; }
|
|
26
27
|
function code(expected) { return (error) => error?.code === expected; }
|
|
28
|
+
test("dsh preserves shared tool and parameter descriptions verbatim", async (t) => {
|
|
29
|
+
const { ctx } = await dshFixture(t);
|
|
30
|
+
for (const operation of [notesWrite, notesUpdate, notesRead, notesList, notesSearch, historyList, historyRead]) {
|
|
31
|
+
const registered = ctx.tools.get(operation.name);
|
|
32
|
+
assert.equal(registered.description, operation.description);
|
|
33
|
+
const properties = registered.parameters.properties;
|
|
34
|
+
for (const [name, parameter] of Object.entries(operation.parameters.properties)) {
|
|
35
|
+
assert.equal(properties[name].description, parameter.description, `${operation.name}.${name}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
27
39
|
// Critical lifecycle tests exercise the actual loop, DeepSeek HTTP adapter, tool registry,
|
|
28
40
|
// token meter and SQLite query service. Only the provider is a scripted Messages server.
|
|
29
41
|
test("dsh registered tools query other DSH sessions and foreign Pi files through the same session surface", async (t) => {
|
|
@@ -85,7 +85,7 @@ test("tools set policy, validate values, and visibly report effective policy and
|
|
|
85
85
|
const updated = await notesUpdate.execute({ address: "custom", readonly: false, edits: [{ oldText: "😀".repeat(2), newText: "😀".repeat(3) }] }, context);
|
|
86
86
|
assert.equal(Check(notesUpdate.outputSchema, wireResult(updated)), true);
|
|
87
87
|
assert.equal(data(updated).warnings.length, 1);
|
|
88
|
-
assert.match(notesUpdate.render(updated), /3 Unicode code points, over budget 2
|
|
88
|
+
assert.match(notesUpdate.render(updated), /3 Unicode code points, over budget 2 — boil it down\./);
|
|
89
89
|
assert.equal((await notes.read("custom")).body, "😀".repeat(3), "over budget saves the entire body");
|
|
90
90
|
const read = await notesRead.execute({ address: "custom", max_chars: 10 }, context);
|
|
91
91
|
assert.equal(Check(notesRead.outputSchema, wireResult(read)), true);
|
|
@@ -102,6 +102,11 @@ test("tools set policy, validate values, and visibly report effective policy and
|
|
|
102
102
|
assert.equal(data(search).files[0].budget, 2);
|
|
103
103
|
assert.match(notesSearch.render(search), /pinned true \| budget 2 \| readonly false/);
|
|
104
104
|
assert.match(notesSearch.render(search), /Warning: note body is 3/);
|
|
105
|
+
const overflow = await notesWrite.execute({ address: "overflow", content: "😀".repeat(3), budget: 2 }, context);
|
|
106
|
+
for (const warnings of [data(overflow).warnings, data(read).warnings]) {
|
|
107
|
+
assert.ok(warnings.length > 0);
|
|
108
|
+
assert.ok(warnings.every(warning => warning.endsWith("— boil it down.")));
|
|
109
|
+
}
|
|
105
110
|
const larger = await notesUpdate.execute({ address: "custom", budget: 4, pinned: false }, context);
|
|
106
111
|
assert.deepEqual(data(larger).warnings, []);
|
|
107
112
|
assert.equal(data(larger).change_kind, "metadata");
|