notesoup 0.48.1 → 0.50.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/budget/text.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/runtime.js +3 -3
- package/dist/src/tools/notes.js +8 -14
- package/dist/test/agent-loop.test.js +15 -15
- package/dist/test/boot.integration.test.js +5 -5
- package/dist/test/claude-mod.test.js +10 -5
- package/dist/test/dependencies.test.js +1 -1
- package/dist/test/host-neutral.test.js +12 -0
- package/dist/test/model-facing-text.test.js +2 -2
- 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 +31 -9
- package/docs/dsh.md +1 -1
- package/docs/notes-library.md +7 -7
- package/docs/reset-lifecycle.md +2 -2
- package/mods/notesoup/.claude-plugin/plugin.json +1 -1
- package/mods/notesoup/dist/claude/helper.js +51 -76
- package/mods/notesoup/hooks/register.ts +2 -2
- package/package.json +1 -1
- package/src/boot/snapshot.ts +9 -3
- package/src/budget/text.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/runtime.ts +3 -3
- package/src/tools/notes.ts +8 -14
|
@@ -7975,7 +7975,7 @@ function isFilesystemError(error) {
|
|
|
7975
7975
|
|
|
7976
7976
|
// src/notes/store.ts
|
|
7977
7977
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
7978
|
-
import { mkdir, readdir as readdir2, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
7978
|
+
import { mkdir, readdir as readdir2, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
7979
7979
|
import { dirname as dirname2, join as join3, resolve as resolve3 } from "node:path";
|
|
7980
7980
|
|
|
7981
7981
|
// src/text-match.ts
|
|
@@ -8106,7 +8106,6 @@ function assertAddress(value) {
|
|
|
8106
8106
|
if (path === "" && scope !== "agent" && scope !== "model") throw new NoteError("invalid_address", `${shown(value)} isn't a note address. ${ADDRESS_FORMS}`);
|
|
8107
8107
|
if (path === "" && who === void 0) throw new NoteError("invalid_address", `${shown(value)} isn't a note address. ${ADDRESS_FORMS}`);
|
|
8108
8108
|
}
|
|
8109
|
-
if (path.includes("@")) throw new NoteError("invalid_address", `${shown(value)} isn't a note address. ${ADDRESS_FORMS}`);
|
|
8110
8109
|
assertVirtualPath(path);
|
|
8111
8110
|
return { scope, path, who };
|
|
8112
8111
|
}
|
|
@@ -8427,20 +8426,6 @@ function assertWho(value) {
|
|
|
8427
8426
|
}
|
|
8428
8427
|
return value;
|
|
8429
8428
|
}
|
|
8430
|
-
async function homesFor(identity2, opts) {
|
|
8431
|
-
if (opts.scope !== void 0) {
|
|
8432
|
-
if (!isScope(opts.scope)) throw new NoteError("invalid_scope", `scope must be one of session, project, human, agent, model (got ${JSON.stringify(opts.scope)})`);
|
|
8433
|
-
const scope = opts.scope;
|
|
8434
|
-
if (opts.who !== void 0) {
|
|
8435
|
-
const who = assertWho(opts.who);
|
|
8436
|
-
if (scope !== "agent" && scope !== "model") throw new NoteError("invalid_scope", "who is only valid with agent or model scope");
|
|
8437
|
-
return [{ scope, who }];
|
|
8438
|
-
}
|
|
8439
|
-
return [{ scope }];
|
|
8440
|
-
}
|
|
8441
|
-
if (opts.who !== void 0) throw new NoteError("invalid_scope", "who requires agent or model scope");
|
|
8442
|
-
return await homesForPattern(normalizePattern(opts.glob, identity2), identity2) ?? SCOPE_ORDER.map((scope) => ({ scope }));
|
|
8443
|
-
}
|
|
8444
8429
|
function matchLineNumbers(body, needle) {
|
|
8445
8430
|
const lines = [];
|
|
8446
8431
|
let line = 1;
|
|
@@ -8552,27 +8537,40 @@ function createNotesStore(input) {
|
|
|
8552
8537
|
async function update(address, edits, options = {}) {
|
|
8553
8538
|
const operations = edits === void 0 ? [] : edits.map((operation) => ({ ...operation }));
|
|
8554
8539
|
const stableOptions = { ...options };
|
|
8555
|
-
const
|
|
8540
|
+
const from = assertAddress(address);
|
|
8541
|
+
const destination = stableOptions.renameTo === void 0 ? from : assertAddress(stableOptions.renameTo);
|
|
8556
8542
|
assertWritablePath(destination.path);
|
|
8557
8543
|
const scope = destination.scope;
|
|
8544
|
+
assertWritableHome(from.scope, from.who, identity2);
|
|
8558
8545
|
assertWritableHome(scope, destination.who, identity2);
|
|
8559
|
-
if (operations.length === 0 && stableOptions.origin === void 0 && stableOptions.crumpled === void 0) {
|
|
8560
|
-
throw new NoteError("nothing_to_do", "Nothing to change:
|
|
8546
|
+
if (operations.length === 0 && stableOptions.origin === void 0 && stableOptions.crumpled === void 0 && stableOptions.renameTo === void 0) {
|
|
8547
|
+
throw new NoteError("nothing_to_do", "Nothing to change: provide edits, an origin, a crumpled state, or a new address.");
|
|
8561
8548
|
}
|
|
8549
|
+
const fromPath = physicalPath(from.scope, from.path, identity2, from.who);
|
|
8562
8550
|
const path = physicalPath(scope, destination.path, identity2, destination.who);
|
|
8563
|
-
|
|
8564
|
-
|
|
8551
|
+
const differentPaths = resolve3(fromPath) !== resolve3(path);
|
|
8552
|
+
const mutate = async () => {
|
|
8553
|
+
const raw = await readFileIfExists(fromPath);
|
|
8565
8554
|
if (raw === void 0) throw new NoteError("not_found", `No note at ${noteIdentity(identity2, address).address}.`);
|
|
8555
|
+
const targetRaw = differentPaths ? await readFileIfExists(path) : void 0;
|
|
8556
|
+
const sourceReal = targetRaw === void 0 ? void 0 : await realpath(fromPath);
|
|
8557
|
+
const sameFile = sourceReal !== void 0 && sourceReal === await realpath(path);
|
|
8558
|
+
const moved = differentPaths && !sameFile;
|
|
8559
|
+
if (moved && targetRaw !== void 0 && parseNote(targetRaw).meta.crumpledAt === void 0) {
|
|
8560
|
+
throw new NoteError("already_exists", `${noteIdentity(identity2, stableOptions.renameTo).address} already holds a note; crumple it first or pick another address.`);
|
|
8561
|
+
}
|
|
8566
8562
|
const { meta, body } = parseNote(raw);
|
|
8567
|
-
meta.scope = scope;
|
|
8568
8563
|
const beforeMeta = { ...meta };
|
|
8564
|
+
meta.scope = scope;
|
|
8565
|
+
if (from.scope !== "session" && scope === "session") meta.project = identity2.projectKey;
|
|
8566
|
+
if (from.scope === "session" && scope !== "session") delete meta.project;
|
|
8569
8567
|
let next = body;
|
|
8570
8568
|
let applied = 0;
|
|
8571
8569
|
operations.forEach((operation, index) => {
|
|
8572
8570
|
const oldText = operation?.oldText;
|
|
8573
8571
|
const newText = operation?.newText;
|
|
8574
|
-
if (typeof oldText !== "string" || oldText.length === 0) throw new NoteError("
|
|
8575
|
-
if (typeof newText !== "string") throw new NoteError("
|
|
8572
|
+
if (typeof oldText !== "string" || oldText.length === 0) throw new NoteError("invalid_edit", `edits[${index}].oldText must be a non-empty string.`, { editIndex: index });
|
|
8573
|
+
if (typeof newText !== "string") throw new NoteError("invalid_edit", `edits[${index}].newText must be a string.`, { editIndex: index });
|
|
8576
8574
|
const lines = matchLineNumbers(next, oldText);
|
|
8577
8575
|
if (lines.length === 0) throw new NoteError("no_match", `edits[${index}].oldText isn't in the note${index > 0 ? " (after the earlier edits)" : ""}. Nothing was saved.`, { editIndex: index });
|
|
8578
8576
|
if (lines.length > 1 && !stableOptions.replaceAll) {
|
|
@@ -8590,49 +8588,26 @@ function createNotesStore(input) {
|
|
|
8590
8588
|
if (stableOptions.crumpled === false) delete meta.crumpledAt;
|
|
8591
8589
|
const bodyChanged = body !== next;
|
|
8592
8590
|
const originChanged = beforeMeta.origin !== meta.origin;
|
|
8593
|
-
if (bodyChanged || originChanged) meta.updatedAt = writeStamp();
|
|
8591
|
+
if (bodyChanged || originChanged || moved) meta.updatedAt = writeStamp();
|
|
8594
8592
|
const serialized = serializeNote(meta, next);
|
|
8595
8593
|
assertSerializedSize(serialized);
|
|
8596
8594
|
const metadataChanged = originChanged || beforeMeta.crumpledAt !== meta.crumpledAt;
|
|
8597
8595
|
let change;
|
|
8598
|
-
if (bodyChanged && metadataChanged) change = { kind: "body", before: raw, after: serialized };
|
|
8596
|
+
if (bodyChanged && (metadataChanged || moved)) change = { kind: "body", before: raw, after: serialized };
|
|
8599
8597
|
else if (bodyChanged) change = { kind: "body", before: body, after: next };
|
|
8600
8598
|
else if (metadataChanged) change = { kind: "metadata", before: frontmatterOf(beforeMeta), after: frontmatterOf(meta) };
|
|
8601
8599
|
else change = { kind: "none", before: "", after: "" };
|
|
8602
|
-
await atomicWrite(path, serialized);
|
|
8603
|
-
|
|
8604
|
-
|
|
8600
|
+
await atomicWrite(sameFile ? sourceReal : path, serialized);
|
|
8601
|
+
if (moved) await rm(fromPath, { force: true });
|
|
8602
|
+
return { meta, applied, resolvedScope: scope, change, moved, replacedCrumpledTarget: moved && targetRaw !== void 0 };
|
|
8603
|
+
};
|
|
8604
|
+
if (!differentPaths) return withPathQueue(path, mutate);
|
|
8605
|
+
const [first, second] = [fromPath, path].sort();
|
|
8606
|
+
return withPathQueue(first, () => withPathQueue(second, mutate));
|
|
8605
8607
|
}
|
|
8606
8608
|
async function rename2(fromAddress, toAddress) {
|
|
8607
|
-
const
|
|
8608
|
-
|
|
8609
|
-
const fromScope = from.scope;
|
|
8610
|
-
const toScope = to.scope;
|
|
8611
|
-
assertWritablePath(to.path);
|
|
8612
|
-
assertWritableHome(fromScope, from.who, identity2);
|
|
8613
|
-
assertWritableHome(toScope, to.who, identity2);
|
|
8614
|
-
const fromPath = physicalPath(fromScope, from.path, identity2, from.who);
|
|
8615
|
-
const toPath = physicalPath(toScope, to.path, identity2, to.who);
|
|
8616
|
-
if (resolve3(fromPath) === resolve3(toPath)) throw new NoteError("nothing_to_do", "rename_to points at the note itself.");
|
|
8617
|
-
const [first, second] = [fromPath, toPath].sort();
|
|
8618
|
-
return withPathQueue(first, () => withPathQueue(second, async () => {
|
|
8619
|
-
const raw = await readFileIfExists(fromPath);
|
|
8620
|
-
if (raw === void 0) throw new NoteError("not_found", `No note at ${noteIdentity(identity2, fromAddress).address}.`);
|
|
8621
|
-
const targetRaw = await readFileIfExists(toPath);
|
|
8622
|
-
if (targetRaw !== void 0 && parseNote(targetRaw).meta.crumpledAt === void 0) {
|
|
8623
|
-
throw new NoteError("already_exists", `${noteIdentity(identity2, toAddress).address} already holds a note; crumple it first or pick another address.`);
|
|
8624
|
-
}
|
|
8625
|
-
const { meta, body } = parseNote(raw);
|
|
8626
|
-
meta.scope = toScope;
|
|
8627
|
-
if (fromScope !== "session" && toScope === "session") meta.project = identity2.projectKey;
|
|
8628
|
-
if (fromScope === "session" && toScope !== "session") delete meta.project;
|
|
8629
|
-
meta.updatedAt = writeStamp();
|
|
8630
|
-
const serialized = serializeNote(meta, body);
|
|
8631
|
-
assertSerializedSize(serialized);
|
|
8632
|
-
await atomicWrite(toPath, serialized);
|
|
8633
|
-
await rm(fromPath, { force: true });
|
|
8634
|
-
return { meta, replacedCrumpledTarget: targetRaw !== void 0 };
|
|
8635
|
-
}));
|
|
8609
|
+
const { meta, replacedCrumpledTarget } = await update(fromAddress, void 0, { renameTo: toAddress });
|
|
8610
|
+
return { meta, replacedCrumpledTarget };
|
|
8636
8611
|
}
|
|
8637
8612
|
async function* scan(options, status) {
|
|
8638
8613
|
const pattern = normalizePattern(options.glob, identity2);
|
|
@@ -8640,7 +8615,7 @@ function createNotesStore(input) {
|
|
|
8640
8615
|
const matcher = normalized === void 0 ? void 0 : globToRegExp(normalized);
|
|
8641
8616
|
let homes;
|
|
8642
8617
|
try {
|
|
8643
|
-
homes = await
|
|
8618
|
+
homes = await homesForPattern(normalized, identity2) ?? SCOPE_ORDER.map((scope) => ({ scope }));
|
|
8644
8619
|
} catch (error) {
|
|
8645
8620
|
if (!status || !isFilesystemError(error) || !/^@(projects|agents|models)\//.test(options.glob ?? "")) throw error;
|
|
8646
8621
|
status.homesUnavailable.push(options.glob.split("/")[0]);
|
|
@@ -9004,7 +8979,7 @@ function searchQueries(query) {
|
|
|
9004
8979
|
// src/tools/notes.ts
|
|
9005
8980
|
var ORIGIN_VALUES = [typebox_exports.Literal("user"), typebox_exports.Literal("self"), typebox_exports.Literal("external")];
|
|
9006
8981
|
var ORIGIN = typebox_exports.Optional(typebox_exports.Union([...ORIGIN_VALUES], {
|
|
9007
|
-
description: "(optional
|
|
8982
|
+
description: "(optional) Who wrote it: user, self, or external. Omit to keep the existing origin; new notes default to self."
|
|
9008
8983
|
}));
|
|
9009
8984
|
var CRUMPLED_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "(optional) true = crumple (hide from list and search, still readable); false = restore." }));
|
|
9010
8985
|
var CRUMPLED_LIST_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "(optional) true = list only crumpled notes." }));
|
|
@@ -9161,7 +9136,7 @@ var notesWrite = {
|
|
|
9161
9136
|
executionMode: "sequential",
|
|
9162
9137
|
async execute(params, identity2) {
|
|
9163
9138
|
try {
|
|
9164
|
-
const { outcome } = await createNotesStore(identity2).write(params.address, params.content, { origin: params.origin
|
|
9139
|
+
const { outcome } = await createNotesStore(identity2).write(params.address, params.content, { origin: params.origin });
|
|
9165
9140
|
return success({ ...noteIdentity(identity2, params.address), outcome });
|
|
9166
9141
|
} catch (error) {
|
|
9167
9142
|
return failureOf(error);
|
|
@@ -9175,7 +9150,7 @@ var notesUpdateParameters = typebox_exports.Object({
|
|
|
9175
9150
|
origin: ORIGIN,
|
|
9176
9151
|
crumpled: CRUMPLED_PARAMETER,
|
|
9177
9152
|
replace_all: typebox_exports.Optional(typebox_exports.Boolean({ description: "(optional) true = replace every match of `oldText`." })),
|
|
9178
|
-
rename_to: typebox_exports.Optional(typebox_exports.String({ description: "(optional) Move to this address,
|
|
9153
|
+
rename_to: typebox_exports.Optional(typebox_exports.String({ description: "(optional) Move to this address, optionally with edits or metadata changes. Won't overwrite a live note; references aren't updated." }))
|
|
9179
9154
|
}, { additionalProperties: false });
|
|
9180
9155
|
function renderUpdateData(data) {
|
|
9181
9156
|
const head = data.rename_from === void 0 ? `${data.change_kind === "none" ? "unchanged" : "updated"} ${renderIdentity(data)}` : `moved ${data.rename_from} -> ${data.address}`;
|
|
@@ -9208,17 +9183,11 @@ var notesUpdate = {
|
|
|
9208
9183
|
try {
|
|
9209
9184
|
const store = createNotesStore(identity2);
|
|
9210
9185
|
const renameTo = params.rename_to === "" ? void 0 : params.rename_to;
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
const from = noteIdentity(identity2, params.address).address;
|
|
9217
|
-
const to = noteIdentity(identity2, renameTo);
|
|
9218
|
-
return boundedUpdate({ ...to, rename_from: from, change_kind: "moved", diff: `rename ${from} -> ${to.address}` });
|
|
9219
|
-
}
|
|
9220
|
-
const { change } = await store.update(params.address, params.edits, { origin: params.origin, crumpled: params.crumpled, replaceAll: params.replace_all });
|
|
9221
|
-
return boundedUpdate({ ...noteIdentity(identity2, params.address), change_kind: change.kind, diff: renderDiff(change) });
|
|
9186
|
+
const { change, moved } = await store.update(params.address, params.edits, { origin: params.origin, crumpled: params.crumpled, replaceAll: params.replace_all, renameTo });
|
|
9187
|
+
const from = noteIdentity(identity2, params.address).address;
|
|
9188
|
+
const to = noteIdentity(identity2, renameTo ?? params.address);
|
|
9189
|
+
const diff = renderDiff(change);
|
|
9190
|
+
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 });
|
|
9222
9191
|
} catch (error) {
|
|
9223
9192
|
return failureOf(error);
|
|
9224
9193
|
}
|
|
@@ -9864,13 +9833,19 @@ var NOTES_HOMES = [
|
|
|
9864
9833
|
{ scope: "model", label: "@model" }
|
|
9865
9834
|
];
|
|
9866
9835
|
async function loadNotesSnapshot(identity2, openedAt, loadHome) {
|
|
9867
|
-
const store = createNotesStore(identity2);
|
|
9868
|
-
const load = loadHome ?? ((scope) => store.list({ scope }));
|
|
9869
9836
|
const homes = /* @__PURE__ */ new Map();
|
|
9870
9837
|
const unavailable = [];
|
|
9838
|
+
if (!loadHome) {
|
|
9839
|
+
const { rows, status } = await createNotesStore(identity2).listWithStatus();
|
|
9840
|
+
for (const home of NOTES_HOMES) {
|
|
9841
|
+
homes.set(home.scope, rows.filter((row) => row.scope === home.scope));
|
|
9842
|
+
if (status.homesUnavailable.some((address) => home.scope === "session" ? !address.startsWith("@") : address === home.label || address.startsWith(`${home.label}/`))) unavailable.push(home);
|
|
9843
|
+
}
|
|
9844
|
+
return { openedAt, homes, unavailable };
|
|
9845
|
+
}
|
|
9871
9846
|
for (const home of NOTES_HOMES) {
|
|
9872
9847
|
try {
|
|
9873
|
-
homes.set(home.scope, await
|
|
9848
|
+
homes.set(home.scope, await loadHome(home.scope));
|
|
9874
9849
|
} catch (error) {
|
|
9875
9850
|
if (!isFilesystemError(error)) throw error;
|
|
9876
9851
|
homes.set(home.scope, []);
|
|
@@ -339,7 +339,7 @@ export function register(on: On) {
|
|
|
339
339
|
registered.clear()
|
|
340
340
|
await loadTexts($, state)
|
|
341
341
|
armManual($, state, manualSignal)
|
|
342
|
-
await $.command.register({ name: "empty
|
|
342
|
+
await $.command.register({ name: "empty", description: "Reset context to a fresh notes-only window", immediate: true })
|
|
343
343
|
await $.command.register({ name: "fresh-window", description: "Reset context to a fresh notes-only window", immediate: true })
|
|
344
344
|
const schemas = await run($, { op: "schemas" })
|
|
345
345
|
if (!schemas.ok || !Array.isArray(schemas.result)) return next(e)
|
|
@@ -390,7 +390,7 @@ export function register(on: On) {
|
|
|
390
390
|
return result
|
|
391
391
|
})
|
|
392
392
|
on("command.run", async ($, e, next) => {
|
|
393
|
-
if (e.command !== "empty
|
|
393
|
+
if (e.command !== "empty" && e.command !== "fresh-window") return next(e)
|
|
394
394
|
if (!await refreshIdentity($, state)) return { text: "🥣 Different brain now · try /fresh-window again" }
|
|
395
395
|
if (state.headless) return { text: `🥣 ${HEADLESS}` }
|
|
396
396
|
if (state.compactDisabled) return { text: `🥣 ${COMPACT_DISABLED}` }
|
package/package.json
CHANGED
package/src/boot/snapshot.ts
CHANGED
|
@@ -29,13 +29,19 @@ export function unavailableNotesSnapshot(openedAt: number): NotesSnapshot {
|
|
|
29
29
|
* malformed note data and unrelated construction errors remain visible to the caller.
|
|
30
30
|
*/
|
|
31
31
|
export async function loadNotesSnapshot(identity: NotesIdentity, openedAt: number, loadHome?: NotesLoader): Promise<NotesSnapshot> {
|
|
32
|
-
const store = createNotesStore(identity);
|
|
33
|
-
const load = loadHome ?? ((scope: Scope) => store.list({ scope }));
|
|
34
32
|
const homes = new Map<Scope, readonly NoteRow[]>();
|
|
35
33
|
const unavailable: NotesHome[] = [];
|
|
34
|
+
if (!loadHome) {
|
|
35
|
+
const { rows, status } = await createNotesStore(identity).listWithStatus();
|
|
36
|
+
for (const home of NOTES_HOMES) {
|
|
37
|
+
homes.set(home.scope, rows.filter(row => row.scope === home.scope));
|
|
38
|
+
if (status.homesUnavailable.some(address => home.scope === "session" ? !address.startsWith("@") : address === home.label || address.startsWith(`${home.label}/`))) unavailable.push(home);
|
|
39
|
+
}
|
|
40
|
+
return { openedAt, homes, unavailable };
|
|
41
|
+
}
|
|
36
42
|
for (const home of NOTES_HOMES) {
|
|
37
43
|
try {
|
|
38
|
-
homes.set(home.scope, await
|
|
44
|
+
homes.set(home.scope, await loadHome(home.scope));
|
|
39
45
|
} catch (error) {
|
|
40
46
|
if (!isFilesystemError(error)) throw error;
|
|
41
47
|
homes.set(home.scope, []);
|
package/src/budget/text.ts
CHANGED
|
@@ -46,7 +46,7 @@ export const WARNING_CALL = "When the notes are ready, call `empty_brain` to res
|
|
|
46
46
|
export const WARNING_CALL_PROMPTED = "Organize the notes first, then call `empty_brain` right away — do not wait to be cut off.";
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* The human typed `/empty
|
|
49
|
+
* The human typed `/empty <prompt>`: the raw command line leads the close-out so the
|
|
50
50
|
* closing model sees what the next window was asked to do, verbatim. The tag names it as the
|
|
51
51
|
* next window's prompt, so no prose has to explain that.
|
|
52
52
|
*/
|
package/src/notes/address.ts
CHANGED
|
@@ -76,7 +76,6 @@ export function assertAddress(value: unknown): NoteAddress {
|
|
|
76
76
|
if (path === "" && scope !== "agent" && scope !== "model") throw new NoteError("invalid_address", `${shown(value)} isn't a note address. ${ADDRESS_FORMS}`);
|
|
77
77
|
if (path === "" && who === undefined) throw new NoteError("invalid_address", `${shown(value)} isn't a note address. ${ADDRESS_FORMS}`);
|
|
78
78
|
}
|
|
79
|
-
if (path.includes("@")) throw new NoteError("invalid_address", `${shown(value)} isn't a note address. ${ADDRESS_FORMS}`);
|
|
80
79
|
assertVirtualPath(path);
|
|
81
80
|
return { scope, path, who };
|
|
82
81
|
}
|
package/src/notes/errors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type NoteErrorCode = "not_found" | "already_exists" | "ambiguous_edit" | "no_match" | "nothing_to_do" | "too_large" | "invalid_scope" | "invalid_origin" | "invalid_address" | "invalid_pattern" | "invalid_query" | "invalid_offset" | "io_error" | "internal_error";
|
|
1
|
+
export type NoteErrorCode = "not_found" | "already_exists" | "ambiguous_edit" | "no_match" | "invalid_edit" | "nothing_to_do" | "too_large" | "invalid_scope" | "invalid_origin" | "invalid_address" | "invalid_pattern" | "invalid_query" | "invalid_offset" | "io_error" | "internal_error";
|
|
2
2
|
|
|
3
3
|
/** Typed store refusal. Edit locations are exposed in camelCase. */
|
|
4
4
|
export class NoteError extends Error {
|
package/src/notes/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import type { Dirent } from "node:fs";
|
|
3
|
-
import { mkdir, readdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { mkdir, readdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { earliestMatchOffsetChars } from "../text-match.js";
|
|
6
6
|
import { assertAddress, assertGlobPattern, addressFor, canonicalAddressFor, globToRegExp, HOME_HEADS } from "./address.js";
|
|
@@ -8,7 +8,7 @@ import { isFilesystemError } from "./fs-error.js";
|
|
|
8
8
|
import { snapshotNotesIdentity, type NotesIdentity } from "./identity.js";
|
|
9
9
|
import { NoteError } from "./errors.js";
|
|
10
10
|
import { MAX_NOTE_BYTES, MAX_NOTE_PATH_BYTES } from "./constants.js";
|
|
11
|
-
import { isOrigin,
|
|
11
|
+
import { isOrigin, localIso, parseNote, serializeNote, stripLeadingFrontmatter, type NoteMeta, type Origin } from "./frontmatter.js";
|
|
12
12
|
import { namespaceSlugs, noteFileName, physicalPath, scopeDir, SLUG_PATTERN, type Scope } from "./paths.js";
|
|
13
13
|
import { projectHomes, projectReceipt, type ProjectReceipt } from "./project-home.js";
|
|
14
14
|
|
|
@@ -27,19 +27,15 @@ export type NoteMatch = { line: number; text: string; /** Code-point offset into
|
|
|
27
27
|
export type NoteSearchRow = { address: string; scope: Scope; path: string; meta: NoteMeta; matches: NoteMatch[] };
|
|
28
28
|
export type EditOperation = { oldText: string; newText: string };
|
|
29
29
|
export type WriteOptions = { origin?: Origin };
|
|
30
|
-
export type EditOptions = { origin?: Origin; crumpled?: boolean; replaceAll?: boolean };
|
|
31
|
-
export type NotesQuery =
|
|
32
|
-
| { scope?: undefined; who?: never }
|
|
33
|
-
| { scope: "session" | "project" | "human"; who?: never }
|
|
34
|
-
| { scope: "agent" | "model"; who?: string }
|
|
35
|
-
) & { glob?: string; crumpled?: boolean };
|
|
30
|
+
export type EditOptions = { origin?: Origin; crumpled?: boolean; replaceAll?: boolean; renameTo?: string };
|
|
31
|
+
export type NotesQuery = { glob?: string; crumpled?: boolean };
|
|
36
32
|
/** A read exposes metadata and the pure body; the serialized frontmatter is never part of the body. */
|
|
37
33
|
export type NoteReadResult = { meta: NoteMeta; body: string; resolvedScope: Scope };
|
|
38
34
|
export type NoteWriteResult = { meta: NoteMeta; outcome: "created" | "overwrote" | "uncrumpled" };
|
|
39
35
|
export type NoteChange =
|
|
40
36
|
| { kind: "none"; before: ""; after: "" }
|
|
41
37
|
| { kind: "body" | "metadata"; before: string; after: string };
|
|
42
|
-
export type NoteEditResult = { meta: NoteMeta; applied: number; resolvedScope: Scope; change: NoteChange };
|
|
38
|
+
export type NoteEditResult = { meta: NoteMeta; applied: number; resolvedScope: Scope; change: NoteChange; moved: boolean; replacedCrumpledTarget: boolean };
|
|
43
39
|
export type NoteRenameResult = { meta: NoteMeta; replacedCrumpledTarget: boolean };
|
|
44
40
|
/** A home, or one unreadable note inside it, that a status-reporting query could not read. */
|
|
45
41
|
export type NoteQueryStatus = { homesUnavailable: string[] };
|
|
@@ -151,21 +147,6 @@ function assertWho(value: unknown): string {
|
|
|
151
147
|
return value;
|
|
152
148
|
}
|
|
153
149
|
|
|
154
|
-
async function homesFor(identity: NotesIdentity, opts: NotesQuery): Promise<HomeRef[]> {
|
|
155
|
-
if (opts.scope !== undefined) {
|
|
156
|
-
if (!isScope(opts.scope)) throw new NoteError("invalid_scope", `scope must be one of session, project, human, agent, model (got ${JSON.stringify(opts.scope)})`);
|
|
157
|
-
const scope = opts.scope;
|
|
158
|
-
if (opts.who !== undefined) {
|
|
159
|
-
const who = assertWho(opts.who);
|
|
160
|
-
if (scope !== "agent" && scope !== "model") throw new NoteError("invalid_scope", "who is only valid with agent or model scope");
|
|
161
|
-
return [{ scope, who }];
|
|
162
|
-
}
|
|
163
|
-
return [{ scope }];
|
|
164
|
-
}
|
|
165
|
-
if (opts.who !== undefined) throw new NoteError("invalid_scope", "who requires agent or model scope");
|
|
166
|
-
return await homesForPattern(normalizePattern(opts.glob, identity), identity) ?? SCOPE_ORDER.map((scope) => ({ scope }));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
150
|
/**
|
|
170
151
|
* Line numbers (1-based) of every occurrence of `needle` in `body`. The scan walks forward
|
|
171
152
|
* once, counting newlines as it goes, so a body that repeats one anchor thousands of times
|
|
@@ -305,27 +286,41 @@ export function createNotesStore(input: NotesIdentity): NotesStore {
|
|
|
305
286
|
async function update(address: string, edits?: EditOperation[], options: EditOptions = {}): Promise<NoteEditResult> {
|
|
306
287
|
const operations = edits === undefined ? [] : edits.map((operation) => ({ ...operation }));
|
|
307
288
|
const stableOptions = { ...options };
|
|
308
|
-
const
|
|
289
|
+
const from = assertAddress(address);
|
|
290
|
+
const destination = stableOptions.renameTo === undefined ? from : assertAddress(stableOptions.renameTo);
|
|
309
291
|
assertWritablePath(destination.path);
|
|
310
292
|
const scope = destination.scope;
|
|
293
|
+
assertWritableHome(from.scope, from.who, identity);
|
|
311
294
|
assertWritableHome(scope, destination.who, identity);
|
|
312
|
-
if (operations.length === 0 && stableOptions.origin === undefined && stableOptions.crumpled === undefined) {
|
|
313
|
-
throw new NoteError("nothing_to_do", "Nothing to change:
|
|
295
|
+
if (operations.length === 0 && stableOptions.origin === undefined && stableOptions.crumpled === undefined && stableOptions.renameTo === undefined) {
|
|
296
|
+
throw new NoteError("nothing_to_do", "Nothing to change: provide edits, an origin, a crumpled state, or a new address.");
|
|
314
297
|
}
|
|
298
|
+
const fromPath = physicalPath(from.scope, from.path, identity, from.who);
|
|
315
299
|
const path = physicalPath(scope, destination.path, identity, destination.who);
|
|
316
|
-
|
|
317
|
-
|
|
300
|
+
const differentPaths = resolve(fromPath) !== resolve(path);
|
|
301
|
+
const mutate = async (): Promise<NoteEditResult> => {
|
|
302
|
+
const raw = await readFileIfExists(fromPath);
|
|
318
303
|
if (raw === undefined) throw new NoteError("not_found", `No note at ${noteIdentity(identity, address).address}.`);
|
|
304
|
+
const targetRaw = differentPaths ? await readFileIfExists(path) : undefined;
|
|
305
|
+
// Case and symlink aliases must not turn write-then-remove into deleting the result.
|
|
306
|
+
const sourceReal = targetRaw === undefined ? undefined : await realpath(fromPath);
|
|
307
|
+
const sameFile = sourceReal !== undefined && sourceReal === await realpath(path);
|
|
308
|
+
const moved = differentPaths && !sameFile;
|
|
309
|
+
if (moved && targetRaw !== undefined && parseNote(targetRaw).meta.crumpledAt === undefined) {
|
|
310
|
+
throw new NoteError("already_exists", `${noteIdentity(identity, stableOptions.renameTo!).address} already holds a note; crumple it first or pick another address.`);
|
|
311
|
+
}
|
|
319
312
|
const { meta, body } = parseNote(raw);
|
|
320
|
-
meta.scope = scope;
|
|
321
313
|
const beforeMeta: NoteMeta = { ...meta };
|
|
314
|
+
meta.scope = scope;
|
|
315
|
+
if (from.scope !== "session" && scope === "session") meta.project = identity.projectKey;
|
|
316
|
+
if (from.scope === "session" && scope !== "session") delete meta.project;
|
|
322
317
|
let next = body;
|
|
323
318
|
let applied = 0;
|
|
324
319
|
operations.forEach((operation, index) => {
|
|
325
320
|
const oldText = operation?.oldText;
|
|
326
321
|
const newText = operation?.newText;
|
|
327
|
-
if (typeof oldText !== "string" || oldText.length === 0) throw new NoteError("
|
|
328
|
-
if (typeof newText !== "string") throw new NoteError("
|
|
322
|
+
if (typeof oldText !== "string" || oldText.length === 0) throw new NoteError("invalid_edit", `edits[${index}].oldText must be a non-empty string.`, { editIndex: index });
|
|
323
|
+
if (typeof newText !== "string") throw new NoteError("invalid_edit", `edits[${index}].newText must be a string.`, { editIndex: index });
|
|
329
324
|
const lines = matchLineNumbers(next, oldText);
|
|
330
325
|
if (lines.length === 0) throw new NoteError("no_match", `edits[${index}].oldText isn't in the note${index > 0 ? " (after the earlier edits)" : ""}. Nothing was saved.`, { editIndex: index });
|
|
331
326
|
if (lines.length > 1 && !stableOptions.replaceAll) {
|
|
@@ -344,58 +339,31 @@ export function createNotesStore(input: NotesIdentity): NotesStore {
|
|
|
344
339
|
if (stableOptions.crumpled === false) delete meta.crumpledAt;
|
|
345
340
|
const bodyChanged = body !== next;
|
|
346
341
|
const originChanged = beforeMeta.origin !== meta.origin;
|
|
347
|
-
if (bodyChanged || originChanged) meta.updatedAt = writeStamp();
|
|
342
|
+
if (bodyChanged || originChanged || moved) meta.updatedAt = writeStamp();
|
|
348
343
|
const serialized = serializeNote(meta, next);
|
|
349
344
|
assertSerializedSize(serialized);
|
|
350
345
|
const metadataChanged = originChanged || beforeMeta.crumpledAt !== meta.crumpledAt;
|
|
351
346
|
let change: NoteChange;
|
|
352
347
|
// A body edit that also rewrites frontmatter is still a body change; its diff inputs span the
|
|
353
348
|
// whole serialized file, so the frontmatter part stays visible in the diff.
|
|
354
|
-
if (bodyChanged && metadataChanged) change = { kind: "body", before: raw, after: serialized };
|
|
349
|
+
if (bodyChanged && (metadataChanged || moved)) change = { kind: "body", before: raw, after: serialized };
|
|
355
350
|
else if (bodyChanged) change = { kind: "body", before: body, after: next };
|
|
356
351
|
else if (metadataChanged) change = { kind: "metadata", before: frontmatterOf(beforeMeta), after: frontmatterOf(meta) };
|
|
357
352
|
else change = { kind: "none", before: "", after: "" };
|
|
358
|
-
await atomicWrite(path, serialized);
|
|
359
|
-
|
|
360
|
-
|
|
353
|
+
await atomicWrite(sameFile ? sourceReal! : path, serialized);
|
|
354
|
+
if (moved) await rm(fromPath, { force: true });
|
|
355
|
+
return { meta, applied, resolvedScope: scope, change, moved, replacedCrumpledTarget: moved && targetRaw !== undefined };
|
|
356
|
+
};
|
|
357
|
+
// Exact aliases share one queue; other spellings lock both paths in stable order.
|
|
358
|
+
if (!differentPaths) return withPathQueue(path, mutate);
|
|
359
|
+
const [first, second] = [fromPath, path].sort();
|
|
360
|
+
return withPathQueue(first!, () => withPathQueue(second!, mutate));
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
/**
|
|
364
|
-
* Move one note to a new address with every metadata key preserved. Both ends must be
|
|
365
|
-
* writable; a live target refuses, a crumpled target is replaced. Locks both paths in
|
|
366
|
-
* sorted order so crossed renames cannot deadlock.
|
|
367
|
-
*/
|
|
363
|
+
/** Moving alone shares validation and persistence with a combined edit-and-move. */
|
|
368
364
|
async function rename(fromAddress: string, toAddress: string): Promise<NoteRenameResult> {
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
const fromScope = from.scope;
|
|
372
|
-
const toScope = to.scope;
|
|
373
|
-
assertWritablePath(to.path);
|
|
374
|
-
assertWritableHome(fromScope, from.who, identity);
|
|
375
|
-
assertWritableHome(toScope, to.who, identity);
|
|
376
|
-
const fromPath = physicalPath(fromScope, from.path, identity, from.who);
|
|
377
|
-
const toPath = physicalPath(toScope, to.path, identity, to.who);
|
|
378
|
-
if (resolve(fromPath) === resolve(toPath)) throw new NoteError("nothing_to_do", "rename_to points at the note itself.");
|
|
379
|
-
const [first, second] = [fromPath, toPath].sort();
|
|
380
|
-
return withPathQueue(first!, () => withPathQueue(second!, async () => {
|
|
381
|
-
const raw = await readFileIfExists(fromPath);
|
|
382
|
-
if (raw === undefined) throw new NoteError("not_found", `No note at ${noteIdentity(identity, fromAddress).address}.`);
|
|
383
|
-
const targetRaw = await readFileIfExists(toPath);
|
|
384
|
-
if (targetRaw !== undefined && parseNote(targetRaw).meta.crumpledAt === undefined) {
|
|
385
|
-
throw new NoteError("already_exists", `${noteIdentity(identity, toAddress).address} already holds a note; crumple it first or pick another address.`);
|
|
386
|
-
}
|
|
387
|
-
const { meta, body } = parseNote(raw);
|
|
388
|
-
meta.scope = toScope;
|
|
389
|
-
// Project ownership only changes when the move crosses the session boundary.
|
|
390
|
-
if (fromScope !== "session" && toScope === "session") meta.project = identity.projectKey;
|
|
391
|
-
if (fromScope === "session" && toScope !== "session") delete meta.project;
|
|
392
|
-
meta.updatedAt = writeStamp();
|
|
393
|
-
const serialized = serializeNote(meta, body);
|
|
394
|
-
assertSerializedSize(serialized);
|
|
395
|
-
await atomicWrite(toPath, serialized);
|
|
396
|
-
await rm(fromPath, { force: true });
|
|
397
|
-
return { meta, replacedCrumpledTarget: targetRaw !== undefined };
|
|
398
|
-
}));
|
|
365
|
+
const { meta, replacedCrumpledTarget } = await update(fromAddress, undefined, { renameTo: toAddress });
|
|
366
|
+
return { meta, replacedCrumpledTarget };
|
|
399
367
|
}
|
|
400
368
|
|
|
401
369
|
async function* scan(options: NotesQuery, status?: NoteQueryStatus): AsyncGenerator<Omit<NoteRow, "sizeBytes">> {
|
|
@@ -404,7 +372,7 @@ export function createNotesStore(input: NotesIdentity): NotesStore {
|
|
|
404
372
|
const matcher = normalized === undefined ? undefined : globToRegExp(normalized);
|
|
405
373
|
let homes: HomeRef[];
|
|
406
374
|
try {
|
|
407
|
-
homes = await
|
|
375
|
+
homes = await homesForPattern(normalized, identity) ?? SCOPE_ORDER.map((scope) => ({ scope }));
|
|
408
376
|
} catch (error) {
|
|
409
377
|
if (!status || !isFilesystemError(error) || !/^@(projects|agents|models)\//.test(options.glob ?? "")) throw error;
|
|
410
378
|
status.homesUnavailable.push(options.glob!.split("/")[0]!);
|
package/src/pi/runtime.ts
CHANGED
|
@@ -191,21 +191,21 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
191
191
|
}
|
|
192
192
|
cmdCtx.ui.notify("🥣 Brain being emptied", "info");
|
|
193
193
|
try {
|
|
194
|
-
pi.sendMessage({ customType: MANUAL_WIPE_TYPE, content: warningContent(prompt ? `/empty
|
|
194
|
+
pi.sendMessage({ customType: MANUAL_WIPE_TYPE, content: warningContent(prompt ? `/empty ${prompt}` : undefined), display: false }, { triggerTurn: true, deliverAs: "steer" });
|
|
195
195
|
} catch (error) {
|
|
196
196
|
resets.clear();
|
|
197
197
|
cmdCtx.ui.notify(`🥣 Brain refused to empty: ${errorMessage(error)}`, "error");
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
};
|
|
201
|
-
pi.registerCommand("empty
|
|
201
|
+
pi.registerCommand("empty", emptyBrainCommand);
|
|
202
202
|
pi.registerCommand("fresh-window", emptyBrainCommand);
|
|
203
203
|
|
|
204
204
|
pi.registerTool(defineTool({
|
|
205
205
|
name: "empty_brain",
|
|
206
206
|
label: "Empty Brain",
|
|
207
207
|
description: "Clear your in-context memory and start a fresh context window. Your session, notes, and history survive. Pass `last_word` to stick a tiny note on your forehead for after the wipe.",
|
|
208
|
-
parameters: Type.Object({ last_word: Type.Optional(Type.String({
|
|
208
|
+
parameters: Type.Object({ last_word: Type.Optional(Type.String({ description: `A tiny sticky note, at most ${MAX_LAST_WORD_CHARS} characters. After the wipe it is slapped on your forehead; longer notes are refused.` })) }, { additionalProperties: false }),
|
|
209
209
|
async execute(_id, params, _signal, _update, ctx) {
|
|
210
210
|
if (!enabled) return output({ error: "notesoup is off, so memory can't be cleared; the user can turn it on with `/notesoup on`." });
|
|
211
211
|
const lastWord = sanitizeLastWord(params.last_word);
|
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,
|