notesoup 0.54.2 → 0.55.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.
Files changed (70) hide show
  1. package/dist/plugins/pi/budget.js +1 -1
  2. package/dist/plugins/pi/marker.d.ts +1 -1
  3. package/dist/plugins/pi/marker.js +11 -7
  4. package/dist/plugins/pi/notes/tools.js +5 -1
  5. package/dist/plugins/pi/render.d.ts +4 -1
  6. package/dist/plugins/pi/render.js +3 -7
  7. package/dist/plugins/pi/runtime.js +5 -5
  8. package/dist/plugins/pi/tool-result.d.ts +4 -2
  9. package/dist/plugins/pi/tool-result.js +5 -4
  10. package/dist/src/history/claude.d.ts +1 -1
  11. package/dist/src/history/claude.js +11 -6
  12. package/dist/src/history/codex-transcript.d.ts +2 -0
  13. package/dist/src/history/codex-transcript.js +3 -2
  14. package/dist/src/history/corpus.d.ts +2 -1
  15. package/dist/src/history/corpus.js +5 -2
  16. package/dist/src/history/history.d.ts +1 -1
  17. package/dist/src/history/history.js +1 -1
  18. package/dist/src/history/local.d.ts +2 -6
  19. package/dist/src/history/local.js +34 -2
  20. package/dist/src/history/query.d.ts +4 -2
  21. package/dist/src/history/query.js +17 -8
  22. package/dist/src/tools/history.js +17 -13
  23. package/dist/src/tools/notes.d.ts +2 -7
  24. package/dist/src/tools/notes.js +5 -26
  25. package/dist/test/boot.integration.test.js +24 -0
  26. package/dist/test/budget-settings.integration.test.js +2 -2
  27. package/dist/test/claude-history.test.js +4 -6
  28. package/dist/test/codex-history.test.js +3 -2
  29. package/dist/test/dependencies.test.js +3 -4
  30. package/dist/test/dream-tools.test.js +3 -3
  31. package/dist/test/history-corpus.test.js +238 -14
  32. package/dist/test/history.integration.test.js +9 -9
  33. package/dist/test/host-neutral.test.js +7 -9
  34. package/dist/test/marker.test.js +34 -27
  35. package/dist/test/notes.integration.test.js +8 -10
  36. package/dist/test/notes.test.js +9 -7
  37. package/dist/test/pi-render.test.js +7 -7
  38. package/dist/test/project-namespace.test.js +4 -4
  39. package/docs/claude-code-mod.md +1 -1
  40. package/docs/history-sessions.md +9 -7
  41. package/docs/skills.md +1 -1
  42. package/docs/tool-results.md +3 -3
  43. package/package.json +1 -1
  44. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  45. package/plugins/claude/dist/claude/helper.js +68 -47
  46. package/plugins/claude/skills/memory/SKILL.md +4 -2
  47. package/plugins/codex/dist/codex/notesoup.js +68 -47
  48. package/plugins/paseo/OVERVIEW.md +2 -2
  49. package/plugins/paseo/client/brain-empty-card.tsx +1 -1
  50. package/plugins/paseo/client/notes-op-card.tsx +1 -1
  51. package/plugins/paseo/client/notes-op-transformer.ts +16 -1
  52. package/plugins/paseo/client/paper-palette.ts +18 -18
  53. package/plugins/paseo/test/fixtures/claude-tool-calls.ts +1 -1
  54. package/plugins/paseo/test/notes-op.test.ts +4 -4
  55. package/plugins/paseo/test/paper-palette.test.ts +3 -3
  56. package/plugins/pi/budget.ts +1 -1
  57. package/plugins/pi/marker.ts +11 -6
  58. package/plugins/pi/notes/tools.ts +5 -1
  59. package/plugins/pi/render.ts +7 -8
  60. package/plugins/pi/runtime.ts +4 -3
  61. package/plugins/pi/tool-result.ts +10 -9
  62. package/skills/memory/SKILL.md +4 -2
  63. package/src/history/claude.ts +9 -4
  64. package/src/history/codex-transcript.ts +3 -2
  65. package/src/history/corpus.ts +9 -3
  66. package/src/history/history.ts +1 -1
  67. package/src/history/local.ts +36 -4
  68. package/src/history/query.ts +17 -6
  69. package/src/tools/history.ts +13 -12
  70. package/src/tools/notes.ts +5 -27
@@ -150,7 +150,6 @@ export type NotesWriteData = Static<typeof NotesWriteDataSchema>;
150
150
  export const NotesUpdateDataSchema = Type.Object({
151
151
  ...NoteIdentitySchema,
152
152
  change_kind: Type.Union([Type.Literal("none"), Type.Literal("body"), Type.Literal("metadata"), Type.Literal("moved")]),
153
- diff: Type.String(),
154
153
  rename_from: Type.Optional(Type.String()),
155
154
  }, { additionalProperties: false });
156
155
  export type NotesUpdateData = Static<typeof NotesUpdateDataSchema>;
@@ -239,50 +238,29 @@ export const notesUpdateParameters = Type.Object({
239
238
  }, { additionalProperties: false });
240
239
 
241
240
  function renderUpdateData(data: NotesUpdateData): string {
242
- const head = data.rename_from === undefined
241
+ return data.rename_from === undefined
243
242
  ? `${data.change_kind === "none" ? "unchanged" : "updated"} ${renderIdentity(data)}`
244
243
  : `moved ${data.rename_from} -> ${data.address}`;
245
- const lines = [head];
246
- if (data.diff.length > 0) lines.push("diff:", data.diff);
247
- return lines.join("\n");
248
- }
249
-
250
- function renderUpdate(result: Outcome<NotesUpdateData>): string {
251
- return renderOutcome(result, renderUpdateData);
252
- }
253
-
254
- /** A shortened diff still says so in the receipt's own text, on both surfaces. */
255
- export const DIFF_SHORTENED_MARKER = "[diff truncated; update applied]";
256
-
257
- const RECEIPT_TOO_LONG = `Saved, but the receipt is too long to hand back (${TOOL_OUTPUT_LIMIT} per call). Check the note with \`notes_read\`.`;
258
-
259
- /** Bound a mutation receipt on both surfaces; a huge diff is cut to the longest fitting prefix and marked. */
260
- function boundedUpdate(data: NotesUpdateData): Outcome<NotesUpdateData> {
261
- if (fitsResult(success(data), renderUpdate)) return success(data);
262
- if (data.diff === "") return failure("output_too_large", RECEIPT_TOO_LONG);
263
- const diff = prefixFit(data.diff, (candidate) => fitsResult(success({ ...data, diff: `${candidate}\n${DIFF_SHORTENED_MARKER}` }), renderUpdate));
264
- const result = success({ ...data, diff: `${diff}\n${DIFF_SHORTENED_MARKER}` });
265
- return fitsResult(result, renderUpdate) ? result : failure("output_too_large", RECEIPT_TOO_LONG);
266
244
  }
267
245
 
268
246
  export const notesUpdate = {
269
247
  name: "notes_update", label: "Notes update",
270
248
  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. ${ADDRESS_DESCRIPTION}`,
271
249
  parameters: notesUpdateParameters, outputSchema: resultSchema(NotesUpdateDataSchema), executionMode: "sequential",
272
- async execute(params: Static<typeof notesUpdateParameters>, context: NotesToolContext, renderDiff: (change: NoteChange) => string = (change) => change.kind === "none" ? "" : `note ${change.kind}`): Promise<Outcome<NotesUpdateData>> {
250
+ async execute(params: Static<typeof notesUpdateParameters>, context: NotesToolContext, onChange?: (change: NoteChange) => void): Promise<Outcome<NotesUpdateData>> {
273
251
  try {
274
252
  const identity = notesIdentityForCall(context, params.cwd);
275
253
  const store = createNotesStore(identity);
276
254
  // Empty filler is not a request: models that pass every parameter get the edit path.
277
255
  const renameTo = params.rename_to === "" ? undefined : params.rename_to;
278
256
  const { change, moved } = await store.update(params.address, params.edits, { origin: params.origin, crumpled: params.crumpled, replaceAll: params.replace_all, renameTo });
257
+ onChange?.(change);
279
258
  const from = noteIdentity(identity, params.address).address;
280
259
  const to = noteIdentity(identity, renameTo ?? params.address);
281
- const diff = renderDiff(change);
282
- 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 });
260
+ return success({ ...to, ...(moved ? { rename_from: from } : {}), change_kind: moved ? "moved" : change.kind });
283
261
  } catch (error) { return failureOf(error); }
284
262
  },
285
- render: renderUpdate,
263
+ render: (result: Outcome<NotesUpdateData>): string => renderOutcome(result, renderUpdateData),
286
264
  } as const;
287
265
 
288
266
  export const notesReadParameters = Type.Object({ address: Type.String(), ...TextWindowRequestSchema, cwd: CWD_PARAMETER }, { additionalProperties: false });