notesoup 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/boot/snapshot.js +10 -3
- package/dist/src/boot/text.js +1 -2
- package/dist/src/budget/constants.d.ts +2 -4
- package/dist/src/budget/constants.js +2 -4
- package/dist/src/budget/policy.d.ts +2 -2
- package/dist/src/budget/policy.js +3 -3
- package/dist/src/budget/text.js +1 -1
- package/dist/src/dsh/budget.js +1 -1
- package/dist/src/dsh/tools.js +1 -1
- package/dist/src/notes/address.js +0 -2
- package/dist/src/notes/errors.d.ts +1 -1
- package/dist/src/notes/store.d.ts +4 -10
- package/dist/src/notes/store.js +42 -72
- package/dist/src/pi/budget.d.ts +1 -1
- package/dist/src/pi/budget.js +7 -8
- package/dist/src/pi/runtime.js +4 -3
- package/dist/src/tools/notes.js +8 -14
- package/dist/test/agent-loop.test.js +1 -1
- package/dist/test/boot.integration.test.js +10 -2
- package/dist/test/budget-settings.integration.test.js +6 -4
- package/dist/test/dsh.test.js +1 -1
- package/dist/test/host-neutral.test.js +12 -0
- package/dist/test/model-facing-text.test.js +1 -1
- package/dist/test/notes-library.test.js +67 -10
- package/dist/test/notes.integration.test.js +9 -9
- package/dist/test/notes.test.js +46 -13
- package/dist/test/reset-lifecycle.test.js +23 -1
- package/docs/dsh.md +1 -1
- package/docs/notes-library.md +7 -7
- package/mods/notesoup/.claude-plugin/plugin.json +1 -1
- package/mods/notesoup/dist/claude/helper.js +51 -76
- package/package.json +1 -1
- package/src/boot/snapshot.ts +9 -3
- package/src/boot/text.ts +1 -2
- package/src/budget/constants.ts +2 -4
- package/src/budget/policy.ts +3 -3
- package/src/budget/text.ts +1 -1
- package/src/dsh/budget.ts +1 -1
- package/src/dsh/tools.ts +1 -1
- package/src/notes/address.ts +0 -1
- package/src/notes/errors.ts +1 -1
- package/src/notes/store.ts +41 -73
- package/src/pi/budget.ts +7 -8
- package/src/pi/runtime.ts +4 -3
- package/src/tools/notes.ts +8 -14
package/src/tools/notes.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { nullableString, InvalidQueryError, searchQueries, searchQuery } from ".
|
|
|
9
9
|
|
|
10
10
|
const ORIGIN_VALUES = [Type.Literal("user"), Type.Literal("self"), Type.Literal("external")] as const;
|
|
11
11
|
const ORIGIN = Type.Optional(Type.Union([...ORIGIN_VALUES], {
|
|
12
|
-
description: "(optional
|
|
12
|
+
description: "(optional) Who wrote it: user, self, or external. Omit to keep the existing origin; new notes default to self.",
|
|
13
13
|
}));
|
|
14
14
|
const CRUMPLED_PARAMETER = Type.Optional(Type.Boolean({ description: "(optional) true = crumple (hide from list and search, still readable); false = restore." }));
|
|
15
15
|
const CRUMPLED_LIST_PARAMETER = Type.Optional(Type.Boolean({ description: "(optional) true = list only crumpled notes." }));
|
|
@@ -211,7 +211,7 @@ export const notesWrite = {
|
|
|
211
211
|
parameters: notesWriteParameters, outputSchema: resultSchema(NotesWriteDataSchema), executionMode: "sequential",
|
|
212
212
|
async execute(params: Static<typeof notesWriteParameters>, identity: NotesIdentity): Promise<Outcome<NotesWriteData>> {
|
|
213
213
|
try {
|
|
214
|
-
const { outcome } = await createNotesStore(identity).write(params.address, params.content, { origin: params.origin
|
|
214
|
+
const { outcome } = await createNotesStore(identity).write(params.address, params.content, { origin: params.origin });
|
|
215
215
|
return success({ ...noteIdentity(identity, params.address), outcome });
|
|
216
216
|
} catch (error) { return failureOf(error); }
|
|
217
217
|
},
|
|
@@ -224,7 +224,7 @@ export const notesUpdateParameters = Type.Object({
|
|
|
224
224
|
origin: ORIGIN,
|
|
225
225
|
crumpled: CRUMPLED_PARAMETER,
|
|
226
226
|
replace_all: Type.Optional(Type.Boolean({ description: "(optional) true = replace every match of `oldText`." })),
|
|
227
|
-
rename_to: Type.Optional(Type.String({ description: "(optional) Move to this address,
|
|
227
|
+
rename_to: Type.Optional(Type.String({ description: "(optional) Move to this address, optionally with edits or metadata changes. Won't overwrite a live note; references aren't updated." })),
|
|
228
228
|
}, { additionalProperties: false });
|
|
229
229
|
|
|
230
230
|
function renderUpdateData(data: NotesUpdateData): string {
|
|
@@ -263,17 +263,11 @@ export const notesUpdate = {
|
|
|
263
263
|
const store = createNotesStore(identity);
|
|
264
264
|
// Empty filler is not a request: models that pass every parameter get the edit path.
|
|
265
265
|
const renameTo = params.rename_to === "" ? undefined : params.rename_to;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const from = noteIdentity(identity, params.address).address;
|
|
272
|
-
const to = noteIdentity(identity, renameTo);
|
|
273
|
-
return boundedUpdate({ ...to, rename_from: from, change_kind: "moved", diff: `rename ${from} -> ${to.address}` });
|
|
274
|
-
}
|
|
275
|
-
const { change } = await store.update(params.address, params.edits, { origin: params.origin, crumpled: params.crumpled, replaceAll: params.replace_all });
|
|
276
|
-
return boundedUpdate({ ...noteIdentity(identity, params.address), change_kind: change.kind, diff: renderDiff(change) });
|
|
266
|
+
const { change, moved } = await store.update(params.address, params.edits, { origin: params.origin, crumpled: params.crumpled, replaceAll: params.replace_all, renameTo });
|
|
267
|
+
const from = noteIdentity(identity, params.address).address;
|
|
268
|
+
const to = noteIdentity(identity, renameTo ?? params.address);
|
|
269
|
+
const diff = renderDiff(change);
|
|
270
|
+
return boundedUpdate({ ...to, ...(moved ? { rename_from: from } : {}), change_kind: moved ? "moved" : change.kind, diff: moved ? [`rename ${from} -> ${to.address}`, diff].filter(Boolean).join("\n") : diff });
|
|
277
271
|
} catch (error) { return failureOf(error); }
|
|
278
272
|
},
|
|
279
273
|
render: renderUpdate,
|