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.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/src/boot/snapshot.js +10 -3
  3. package/dist/src/boot/text.js +1 -2
  4. package/dist/src/budget/constants.d.ts +2 -4
  5. package/dist/src/budget/constants.js +2 -4
  6. package/dist/src/budget/policy.d.ts +2 -2
  7. package/dist/src/budget/policy.js +3 -3
  8. package/dist/src/budget/text.js +1 -1
  9. package/dist/src/dsh/budget.js +1 -1
  10. package/dist/src/dsh/tools.js +1 -1
  11. package/dist/src/notes/address.js +0 -2
  12. package/dist/src/notes/errors.d.ts +1 -1
  13. package/dist/src/notes/store.d.ts +4 -10
  14. package/dist/src/notes/store.js +42 -72
  15. package/dist/src/pi/budget.d.ts +1 -1
  16. package/dist/src/pi/budget.js +7 -8
  17. package/dist/src/pi/runtime.js +4 -3
  18. package/dist/src/tools/notes.js +8 -14
  19. package/dist/test/agent-loop.test.js +1 -1
  20. package/dist/test/boot.integration.test.js +10 -2
  21. package/dist/test/budget-settings.integration.test.js +6 -4
  22. package/dist/test/dsh.test.js +1 -1
  23. package/dist/test/host-neutral.test.js +12 -0
  24. package/dist/test/model-facing-text.test.js +1 -1
  25. package/dist/test/notes-library.test.js +67 -10
  26. package/dist/test/notes.integration.test.js +9 -9
  27. package/dist/test/notes.test.js +46 -13
  28. package/dist/test/reset-lifecycle.test.js +23 -1
  29. package/docs/dsh.md +1 -1
  30. package/docs/notes-library.md +7 -7
  31. package/mods/notesoup/.claude-plugin/plugin.json +1 -1
  32. package/mods/notesoup/dist/claude/helper.js +51 -76
  33. package/package.json +1 -1
  34. package/src/boot/snapshot.ts +9 -3
  35. package/src/boot/text.ts +1 -2
  36. package/src/budget/constants.ts +2 -4
  37. package/src/budget/policy.ts +3 -3
  38. package/src/budget/text.ts +1 -1
  39. package/src/dsh/budget.ts +1 -1
  40. package/src/dsh/tools.ts +1 -1
  41. package/src/notes/address.ts +0 -1
  42. package/src/notes/errors.ts +1 -1
  43. package/src/notes/store.ts +41 -73
  44. package/src/pi/budget.ts +7 -8
  45. package/src/pi/runtime.ts +4 -3
  46. package/src/tools/notes.ts +8 -14
@@ -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, default self) Who wrote it: user, self, or external.",
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 ?? "self" });
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, keeping metadata. Use alone. Won't overwrite a live note; references aren't updated." })),
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
- if (renameTo !== undefined) {
267
- if ((params.edits?.length ?? 0) > 0 || params.origin !== undefined || params.crumpled !== undefined || params.replace_all === true) {
268
- return failureOf(new NoteError("invalid_scope", "rename_to is used alone: do not combine it with edits, origin, crumpled, or replace_all"));
269
- }
270
- await store.rename(params.address, renameTo);
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,