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.
- package/dist/plugins/pi/budget.js +1 -1
- package/dist/plugins/pi/marker.d.ts +1 -1
- package/dist/plugins/pi/marker.js +11 -7
- package/dist/plugins/pi/notes/tools.js +5 -1
- package/dist/plugins/pi/render.d.ts +4 -1
- package/dist/plugins/pi/render.js +3 -7
- package/dist/plugins/pi/runtime.js +5 -5
- package/dist/plugins/pi/tool-result.d.ts +4 -2
- package/dist/plugins/pi/tool-result.js +5 -4
- package/dist/src/history/claude.d.ts +1 -1
- package/dist/src/history/claude.js +11 -6
- package/dist/src/history/codex-transcript.d.ts +2 -0
- package/dist/src/history/codex-transcript.js +3 -2
- package/dist/src/history/corpus.d.ts +2 -1
- package/dist/src/history/corpus.js +5 -2
- package/dist/src/history/history.d.ts +1 -1
- package/dist/src/history/history.js +1 -1
- package/dist/src/history/local.d.ts +2 -6
- package/dist/src/history/local.js +34 -2
- package/dist/src/history/query.d.ts +4 -2
- package/dist/src/history/query.js +17 -8
- package/dist/src/tools/history.js +17 -13
- package/dist/src/tools/notes.d.ts +2 -7
- package/dist/src/tools/notes.js +5 -26
- package/dist/test/boot.integration.test.js +24 -0
- package/dist/test/budget-settings.integration.test.js +2 -2
- package/dist/test/claude-history.test.js +4 -6
- package/dist/test/codex-history.test.js +3 -2
- package/dist/test/dependencies.test.js +3 -4
- package/dist/test/dream-tools.test.js +3 -3
- package/dist/test/history-corpus.test.js +238 -14
- package/dist/test/history.integration.test.js +9 -9
- package/dist/test/host-neutral.test.js +7 -9
- package/dist/test/marker.test.js +34 -27
- package/dist/test/notes.integration.test.js +8 -10
- package/dist/test/notes.test.js +9 -7
- package/dist/test/pi-render.test.js +7 -7
- package/dist/test/project-namespace.test.js +4 -4
- package/docs/claude-code-mod.md +1 -1
- package/docs/history-sessions.md +9 -7
- package/docs/skills.md +1 -1
- package/docs/tool-results.md +3 -3
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +68 -47
- package/plugins/claude/skills/memory/SKILL.md +4 -2
- package/plugins/codex/dist/codex/notesoup.js +68 -47
- package/plugins/paseo/OVERVIEW.md +2 -2
- package/plugins/paseo/client/brain-empty-card.tsx +1 -1
- package/plugins/paseo/client/notes-op-card.tsx +1 -1
- package/plugins/paseo/client/notes-op-transformer.ts +16 -1
- package/plugins/paseo/client/paper-palette.ts +18 -18
- package/plugins/paseo/test/fixtures/claude-tool-calls.ts +1 -1
- package/plugins/paseo/test/notes-op.test.ts +4 -4
- package/plugins/paseo/test/paper-palette.test.ts +3 -3
- package/plugins/pi/budget.ts +1 -1
- package/plugins/pi/marker.ts +11 -6
- package/plugins/pi/notes/tools.ts +5 -1
- package/plugins/pi/render.ts +7 -8
- package/plugins/pi/runtime.ts +4 -3
- package/plugins/pi/tool-result.ts +10 -9
- package/skills/memory/SKILL.md +4 -2
- package/src/history/claude.ts +9 -4
- package/src/history/codex-transcript.ts +3 -2
- package/src/history/corpus.ts +9 -3
- package/src/history/history.ts +1 -1
- package/src/history/local.ts +36 -4
- package/src/history/query.ts +17 -6
- package/src/tools/history.ts +13 -12
- package/src/tools/notes.ts +5 -27
package/src/tools/notes.ts
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
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
|
-
|
|
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:
|
|
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 });
|