notesoup 0.46.1 → 0.47.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/README.md +1 -1
- package/dist/src/boot/text.d.ts +2 -2
- package/dist/src/boot/text.js +4 -4
- package/dist/src/budget/text.d.ts +4 -4
- package/dist/src/budget/text.js +3 -3
- package/dist/src/dsh/index.js +1 -1
- package/dist/src/dsh/tools.js +2 -2
- package/dist/src/pi/budget.js +1 -1
- package/dist/src/pi/reset/artifacts.d.ts +1 -1
- package/dist/src/pi/reset/artifacts.js +1 -1
- package/dist/src/pi/reset/lifecycle.js +2 -2
- package/dist/src/pi/runtime.js +18 -17
- package/dist/test/agent-loop.test.js +45 -45
- package/dist/test/boot.integration.test.js +16 -16
- package/dist/test/budget-settings.integration.test.js +1 -1
- package/dist/test/claude-mod.test.js +13 -13
- package/dist/test/dependencies.test.js +2 -2
- package/dist/test/dsh-cli.test.js +1 -1
- package/dist/test/dsh.test.js +7 -7
- package/dist/test/host-neutral.test.js +1 -1
- package/dist/test/notes.integration.test.js +1 -1
- package/dist/test/reset-lifecycle.test.js +14 -14
- package/docs/architecture.md +1 -1
- package/docs/dsh.md +3 -3
- package/docs/reset-lifecycle.md +6 -6
- package/docs/tool-results.md +1 -1
- package/mods/notesoup/.claude-plugin/plugin.json +1 -1
- package/mods/notesoup/dist/claude/helper.js +5 -5
- package/mods/notesoup/hooks/register.ts +16 -16
- package/mods/notesoup/skills/memory/SKILL.md +1 -1
- package/package.json +2 -2
- package/skills/memory/SKILL.md +1 -1
- package/src/boot/text.ts +4 -4
- package/src/budget/text.ts +3 -3
- package/src/dsh/index.ts +1 -1
- package/src/dsh/tools.ts +2 -2
- package/src/pi/budget.ts +1 -1
- package/src/pi/reset/artifacts.ts +1 -1
- package/src/pi/reset/lifecycle.ts +2 -2
- package/src/pi/runtime.ts +18 -17
package/src/pi/runtime.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { registerBudget } from "./budget.js";
|
|
|
6
6
|
import { output } from "./tool-result.js";
|
|
7
7
|
import { currentReset, currentWindowId, isCheckpointBackedReset, isWindowBoot, isWindowMarker, projectRootWindow, projectWindow, rootWindowId, type WindowMarker } from "./window.js";
|
|
8
8
|
import { registerResetLifecycle } from "./reset/lifecycle.js";
|
|
9
|
-
import { buildResetDrafts, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
|
|
10
|
-
import { BOOT_TYPE, MANUAL_WIPE_TYPE } from "./entries.js";
|
|
9
|
+
import { buildResetDrafts, LAST_WORD_PREFIX, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
|
|
10
|
+
import { BOOT_TYPE, MANUAL_WIPE_TYPE, RESET_LAST_WORD_TYPE } from "./entries.js";
|
|
11
11
|
import { WARNING_CONTENT } from "../budget/text.js";
|
|
12
12
|
import { buildBootMessage, sendBoot, type IncompleteNotesNotifier } from "./boot.js";
|
|
13
13
|
import { errorMessage } from "../error-message.js";
|
|
@@ -71,7 +71,10 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
71
71
|
const marker = branch.find((entry): entry is WindowMarker => isWindowMarker(entry) && entry.data.windowId === windowId);
|
|
72
72
|
if (!marker || !isCheckpointBackedReset(ctx, marker) || !resetBoundaryCommitted(ctx, marker.id, windowId)) continue;
|
|
73
73
|
pendingResetNotices.delete(windowId);
|
|
74
|
-
|
|
74
|
+
const tail = branch.slice(branch.indexOf(marker) + 1);
|
|
75
|
+
const lastWordEntry = tail.find((entry) => (entry as { customType?: string }).customType === RESET_LAST_WORD_TYPE) as { content?: string } | undefined;
|
|
76
|
+
const lastWord = lastWordEntry?.content?.startsWith(LAST_WORD_PREFIX) ? lastWordEntry.content.slice(LAST_WORD_PREFIX.length) : undefined;
|
|
77
|
+
ctx.ui.notify(`🥣 Brain emptied${lastWord ? ` · last word: “${lastWord}”` : ""}`, "info");
|
|
75
78
|
}
|
|
76
79
|
};
|
|
77
80
|
pi.on("turn_start", (_event, ctx) => notifyCommittedResets(ctx));
|
|
@@ -83,7 +86,7 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
83
86
|
if (snapshot.unavailable.length === 0 || incompleteNotesNotified.has(windowId)) return;
|
|
84
87
|
incompleteNotesNotified.add(windowId);
|
|
85
88
|
const homes = snapshot.unavailable.map((home) => home.label).join(", ");
|
|
86
|
-
ctx.ui.notify(`🥣 Some notes
|
|
89
|
+
ctx.ui.notify(`🥣 Some notes went missing: ${homes}`, "warning");
|
|
87
90
|
};
|
|
88
91
|
const budget = registerBudget(pi, () => enabled, settingsManager);
|
|
89
92
|
|
|
@@ -110,7 +113,7 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
110
113
|
pi.on("session_before_tree", (event, ctx) => {
|
|
111
114
|
if (!event.preparation.userWantsSummary) return undefined;
|
|
112
115
|
if (!branchHasWindowMarker(ctx) && !branchHasWindowMarker(ctx, event.preparation.targetId)) return undefined;
|
|
113
|
-
ctx.ui.notify("🥣 Branch summary skipped · it
|
|
116
|
+
ctx.ui.notify("🥣 Branch summary skipped · it remembers too much", "info");
|
|
114
117
|
return { summary: { summary: "" } };
|
|
115
118
|
});
|
|
116
119
|
|
|
@@ -128,7 +131,7 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
128
131
|
} catch (error) {
|
|
129
132
|
if (missingBootNotice !== windowId) {
|
|
130
133
|
missingBootNotice = windowId;
|
|
131
|
-
ctx.ui.notify("🥣 Request cancelled ·
|
|
134
|
+
ctx.ui.notify("🥣 Request cancelled · brain is broken, run /fresh-window", "error");
|
|
132
135
|
}
|
|
133
136
|
ctx.abort();
|
|
134
137
|
const safeHead = getCurrentSystemMessage(event.messages);
|
|
@@ -163,11 +166,11 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
163
166
|
},
|
|
164
167
|
});
|
|
165
168
|
|
|
166
|
-
const
|
|
169
|
+
const emptyBrainCommand = {
|
|
167
170
|
description: "Flush memory to notes and continue in a fresh window; optional prompt runs there",
|
|
168
171
|
handler: async (args: string, cmdCtx: ExtensionCommandContext) => {
|
|
169
172
|
if (!enabled) {
|
|
170
|
-
cmdCtx.ui.notify("🥣 notesoup is off ·
|
|
173
|
+
cmdCtx.ui.notify("🥣 notesoup is off · no brain to empty", "error");
|
|
171
174
|
return;
|
|
172
175
|
}
|
|
173
176
|
const requestedWindowId = currentWindowId(cmdCtx);
|
|
@@ -181,26 +184,24 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
|
|
|
181
184
|
const prompt = args.trim() || undefined;
|
|
182
185
|
const armed = resets.closeOut(requestedWindowId, "manual", prompt);
|
|
183
186
|
if (armed === "already-pending") {
|
|
184
|
-
cmdCtx.ui.notify("🥣
|
|
187
|
+
cmdCtx.ui.notify("🥣 Brain already being emptied", "info");
|
|
185
188
|
return;
|
|
186
189
|
}
|
|
187
|
-
cmdCtx.ui.notify(
|
|
188
|
-
? "🥣 Clearing memory · notes first, then your prompt runs"
|
|
189
|
-
: "🥣 Clearing memory · notes first, then it stops", "info");
|
|
190
|
+
cmdCtx.ui.notify("🥣 Brain being emptied", "info");
|
|
190
191
|
try {
|
|
191
192
|
pi.sendMessage({ customType: MANUAL_WIPE_TYPE, content: WARNING_CONTENT, display: false }, { triggerTurn: true, deliverAs: "steer" });
|
|
192
193
|
} catch (error) {
|
|
193
194
|
resets.clear();
|
|
194
|
-
cmdCtx.ui.notify(`🥣
|
|
195
|
+
cmdCtx.ui.notify(`🥣 Brain refused to empty: ${errorMessage(error)}`, "error");
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
198
|
};
|
|
198
|
-
pi.registerCommand("
|
|
199
|
-
pi.registerCommand("fresh-window",
|
|
199
|
+
pi.registerCommand("empty-brain", emptyBrainCommand);
|
|
200
|
+
pi.registerCommand("fresh-window", emptyBrainCommand);
|
|
200
201
|
|
|
201
202
|
pi.registerTool(defineTool({
|
|
202
|
-
name: "
|
|
203
|
-
label: "
|
|
203
|
+
name: "empty_brain",
|
|
204
|
+
label: "Empty Brain",
|
|
204
205
|
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.",
|
|
205
206
|
parameters: Type.Object({ last_word: Type.Optional(Type.String({ maxLength: MAX_LAST_WORD_CHARS, 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 }),
|
|
206
207
|
async execute(_id, params, _signal, _update, ctx) {
|