notesoup 0.51.1 → 0.51.2
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/entries.d.ts +2 -0
- package/dist/plugins/pi/entries.js +2 -0
- package/dist/plugins/pi/reset/artifacts.d.ts +10 -2
- package/dist/plugins/pi/reset/artifacts.js +24 -5
- package/dist/plugins/pi/reset/lifecycle.d.ts +9 -8
- package/dist/plugins/pi/reset/lifecycle.js +109 -31
- package/dist/plugins/pi/runtime.js +9 -10
- package/dist/plugins/pi/text.d.ts +11 -14
- package/dist/plugins/pi/text.js +15 -16
- package/dist/test/agent-loop.test.js +316 -163
- package/dist/test/boot.integration.test.js +3 -3
- package/dist/test/claude-validation.test.js +4 -2
- package/dist/test/dsh-cli.test.js +7 -6
- package/dist/test/helpers/dsh-messages.js +3 -0
- package/dist/test/model-facing-text.test.js +10 -4
- package/dist/test/reset-lifecycle.test.js +105 -15
- package/docs/reset-lifecycle.md +42 -58
- package/package.json +2 -2
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/paseo/OVERVIEW.md +7 -0
- package/plugins/paseo/README.md +12 -0
- package/plugins/paseo/client/source-row.ts +14 -0
- package/plugins/paseo/client/sticky-card.tsx +21 -0
- package/plugins/paseo/index.client.tsx +10 -0
- package/plugins/paseo/package.json +19 -0
- package/plugins/paseo/paseo-plugin.json +4 -0
- package/plugins/paseo/shared/last-word.ts +6 -0
- package/plugins/paseo/test/source-row.test.ts +19 -0
- package/plugins/paseo/tsconfig.json +16 -0
- package/plugins/pi/entries.ts +2 -0
- package/plugins/pi/reset/artifacts.ts +26 -5
- package/plugins/pi/reset/lifecycle.ts +101 -34
- package/plugins/pi/runtime.ts +9 -10
- package/plugins/pi/text.ts +17 -17
|
@@ -85,7 +85,7 @@ test("the root boot and reset boot carry durable window identity", async () => {
|
|
|
85
85
|
assert.equal(boundary.continue, true);
|
|
86
86
|
await runHandlers(captured, "turn_start", {}, ctx);
|
|
87
87
|
await runHandlers(captured, "agent_settled", {}, ctx);
|
|
88
|
-
assert.deepEqual(noticesOf(ctx).filter((notice) => notice.message.includes("
|
|
88
|
+
assert.deepEqual(noticesOf(ctx).filter((notice) => notice.message.includes("Fresh brain")), [{ message: "🥣 Fresh brain", type: "info" }], "the committed reset is announced once");
|
|
89
89
|
const entries = sessionManager.getBranch();
|
|
90
90
|
const marker = entries.find((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
|
|
91
91
|
assert.ok(marker && marker.type === "custom");
|
|
@@ -377,7 +377,7 @@ test("forced reset confirmation warns about overflow", async () => {
|
|
|
377
377
|
const ctx = context(sessionManager, undefined, { tokens: 199_000, contextWindow: 200_000, percent: 99.5 });
|
|
378
378
|
await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
379
379
|
await runHandlers(captured, "agent_settled", {}, ctx);
|
|
380
|
-
assert.deepEqual(noticesOf(ctx).filter((notice) => notice.message.includes("
|
|
380
|
+
assert.deepEqual(noticesOf(ctx).filter((notice) => notice.message.includes("forcibly emptied")), [{ message: "🥣 Brain forcibly emptied: overflow", type: "warning" }]);
|
|
381
381
|
});
|
|
382
382
|
test("committed reset confirmation survives later work while repair refuses that suffix", async () => {
|
|
383
383
|
const sessionManager = manager();
|
|
@@ -394,7 +394,7 @@ test("committed reset confirmation survives later work while repair refuses that
|
|
|
394
394
|
assert.equal(resetBoundaryCommitted(ctx, marker.id, windowId), true, "later work does not undo a committed native boundary");
|
|
395
395
|
await runHandlers(captured, "agent_settled", {}, ctx);
|
|
396
396
|
await runHandlers(captured, "turn_start", {}, ctx);
|
|
397
|
-
assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("
|
|
397
|
+
assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("Fresh brain")).length, 1);
|
|
398
398
|
assert.equal(resetBoundaryCommitted(ctx, marker.id, "wrong-window"), false);
|
|
399
399
|
const partial = manager();
|
|
400
400
|
const partialCtx = context(partial);
|
|
@@ -5,10 +5,12 @@ import { tmpdir } from "node:os";
|
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import test from "node:test";
|
|
7
7
|
const plugin = join(process.cwd(), "plugins/claude");
|
|
8
|
+
const CLAUDE_VALIDATE_TIMEOUT_MS = 60_000;
|
|
8
9
|
/** Only an absent executable may skip the real loader gate; other failures fail the suite. */
|
|
9
10
|
function validate(t, dir) {
|
|
10
11
|
const result = spawnSync("claude", ["plugin", "validate", dir, "--strict", "--json"], {
|
|
11
|
-
encoding: "utf8",
|
|
12
|
+
encoding: "utf8",
|
|
13
|
+
timeout: CLAUDE_VALIDATE_TIMEOUT_MS,
|
|
12
14
|
});
|
|
13
15
|
if (result.error?.code === "ENOENT") {
|
|
14
16
|
t.skip("Claude mod validation skipped: claude is not installed (not found on PATH)");
|
|
@@ -29,7 +31,7 @@ test("Claude mod passes the installed engine's strict loader validation", (t) =>
|
|
|
29
31
|
});
|
|
30
32
|
test("Claude mod typechecks against the vendored engine contract without Node globals", () => {
|
|
31
33
|
const result = spawnSync(process.execPath, ["node_modules/typescript/bin/tsc", "-p", "plugins/claude/tsconfig.json"], {
|
|
32
|
-
encoding: "utf8",
|
|
34
|
+
encoding: "utf8",
|
|
33
35
|
});
|
|
34
36
|
assert.ifError(result.error);
|
|
35
37
|
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
@@ -10,7 +10,7 @@ import { messagesServer } from "./helpers/dsh-messages.js";
|
|
|
10
10
|
const exec = promisify(execFile);
|
|
11
11
|
const repository = fileURLToPath(new URL("../../", import.meta.url));
|
|
12
12
|
const system = (request) => typeof request.system === "string" ? request.system : request.system?.map((block) => block.text).join("\n") ?? "";
|
|
13
|
-
test("dsh profile loads our rows and a second process restores the on-disk window",
|
|
13
|
+
test("dsh profile loads our rows and a second process restores the on-disk window", async (t) => {
|
|
14
14
|
const directory = await mkdtemp(join(tmpdir(), "notesoup-dsh-cli-"));
|
|
15
15
|
const mock = await messagesServer();
|
|
16
16
|
t.after(async () => { await mock.close(); await rm(directory, { recursive: true, force: true }); });
|
|
@@ -26,19 +26,20 @@ test("dsh profile loads our rows and a second process restores the on-disk windo
|
|
|
26
26
|
.replace("'notesoup/dsh'", `'${pathToFileURL(join(repository, "dist/plugins/dsh/index.js")).href}'`)
|
|
27
27
|
.replace("# notesHome: /absolute/path/to/notes", `notesHome: ${join(directory, "notes")}`);
|
|
28
28
|
await writeFile(join(profile, "cordis.patch.yml"), patch + "\n- id: session-title-llm\n disabled: true\n");
|
|
29
|
-
|
|
29
|
+
// A broken ambient proxy must not intercept the local Messages server.
|
|
30
|
+
const env = { ...process.env, NODE_USE_ENV_PROXY: "1", HTTP_PROXY: "http://127.0.0.1:1", http_proxy: "http://127.0.0.1:1", DSH_HOME: home, DEEPSEEK_API_KEY: "mock-key", DEEPSEEK_BASE_URL: mock.url, DSH_TOOLS_MODE: "native" };
|
|
30
31
|
const cli = resolve(repository, "node_modules/@deepseek-ai/dsh/lib/bin.js");
|
|
31
32
|
mock.script.push({ tool: "empty_brain", input: {} }, { text: "after reset" });
|
|
32
|
-
const first = await exec(process.execPath, [cli, "--profile", "notesoup-test", "old conversation"], { cwd: directory, env,
|
|
33
|
-
assert.equal(mock.requests.length, 2, first
|
|
33
|
+
const first = await exec(process.execPath, [cli, "--profile", "notesoup-test", "old conversation"], { cwd: directory, env, signal: t.signal, killSignal: "SIGKILL" });
|
|
34
|
+
assert.equal(mock.requests.length, 2, JSON.stringify(first));
|
|
34
35
|
assert.equal(mock.requests[1].messages.length, 1);
|
|
35
36
|
assert.notEqual(system(mock.requests[0]), system(mock.requests[1]));
|
|
36
37
|
const sessionPaths = await readdir(join(home, "sessions"), { recursive: true });
|
|
37
38
|
const sessionId = sessionPaths.map((entry) => entry.split("/").at(-1)).find((entry) => entry.startsWith("session-"));
|
|
38
39
|
assert.ok(sessionId, JSON.stringify(sessionPaths));
|
|
39
40
|
mock.script.push({ text: "reloaded" });
|
|
40
|
-
const second = await exec(process.execPath, [cli, "--profile", "notesoup-test", "--session-id", sessionId, "resume"], { cwd: directory, env,
|
|
41
|
-
assert.equal(mock.requests.length, 3, second
|
|
41
|
+
const second = await exec(process.execPath, [cli, "--profile", "notesoup-test", "--session-id", sessionId, "resume"], { cwd: directory, env, signal: t.signal, killSignal: "SIGKILL" });
|
|
42
|
+
assert.equal(mock.requests.length, 3, JSON.stringify(second));
|
|
42
43
|
assert.equal(system(mock.requests[2]), system(mock.requests[1]));
|
|
43
44
|
assert.equal(JSON.stringify(mock.requests[2].messages).includes("old conversation"), false);
|
|
44
45
|
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
|
+
// Keep local fixtures off inherited proxies, including in the DSH CLI child processes.
|
|
3
|
+
// Lowercase wins in Node's proxy settings; preserve that effective exclusion list.
|
|
4
|
+
process.env.no_proxy = process.env.NO_PROXY = [process.env.no_proxy || process.env.NO_PROXY, "127.0.0.1"].filter(Boolean).join(",");
|
|
2
5
|
/** Same Messages/SSE approach as /tmp/dsh-spike/mock/llm-server.mjs; no credentials or external traffic. */
|
|
3
6
|
export async function messagesServer() {
|
|
4
7
|
const requests = [];
|
|
@@ -6,7 +6,7 @@ import { renderBootBlock } from "../src/boot/render.js";
|
|
|
6
6
|
import { loadNotesSnapshot } from "../src/boot/snapshot.js";
|
|
7
7
|
import { DEFAULT_BOOT_TOOL_NAMES, MAPS_BLOCK, NOTES_PROTOCOL_CLOSE_TAG, NOTES_PROTOCOL_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG, renderProtocolBlock } from "../src/boot/text.js";
|
|
8
8
|
import { CLAUDE_WARNING_PROMPT, CLAUDE_WIPE_SENTENCE } from "../plugins/claude/src/text.js";
|
|
9
|
-
import { PI_PRE_RESET_HINTS, LAST_WORD_HINT, warningContent } from "../plugins/pi/text.js";
|
|
9
|
+
import { COMMAND_NOTICE, PI_PRE_RESET_HINTS, LAST_WORD_HINT, commandWarningContent, warningContent } from "../plugins/pi/text.js";
|
|
10
10
|
import { COUNTDOWN_LINE, FORCED_CONTINUATIONS, GUIDANCE_CLOSE_TAG, GUIDANCE_OPEN_TAG, NORMAL_CONTINUATIONS, WARNING_BODY, selectContinuation, tokenBudgetGuidance } from "../src/budget/text.js";
|
|
11
11
|
/**
|
|
12
12
|
* The reviewed Design text is what the model actually reads, so the golden copies below pin it
|
|
@@ -105,16 +105,22 @@ test("the countdown closes the second-tier notice only, in both hosts", () => {
|
|
|
105
105
|
assert.ok(pi.endsWith(`\n${GUIDANCE_CLOSE_TAG}`));
|
|
106
106
|
assert.ok(pi.includes(`\n${LAST_WORD_HINT}\n${COUNTDOWN_LINE}\n`), "the countdown comes after the Pi-only last-word hint");
|
|
107
107
|
assert.equal(pi.split(COUNTDOWN_LINE).length - 1, 1, "the second tier carries the countdown exactly once");
|
|
108
|
-
const prompted =
|
|
108
|
+
const prompted = commandWarningContent("/empty keep going");
|
|
109
109
|
assert.ok(prompted.includes("<notesoup:next_window_prompt>\n/empty keep going\n</notesoup:next_window_prompt>"));
|
|
110
|
-
assert.ok(prompted.
|
|
110
|
+
assert.ok(prompted.includes(`\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}\n<notesoup:next_window_prompt>`), "the prompt block follows the closed notice");
|
|
111
|
+
assert.equal(commandWarningContent(), `${GUIDANCE_OPEN_TAG}\n${COMMAND_NOTICE.bare}\n${WARNING_BODY}\n${LAST_WORD_HINT}\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}`);
|
|
112
|
+
assert.equal(prompted, `${GUIDANCE_OPEN_TAG}\n${COMMAND_NOTICE.prompted}\n${WARNING_BODY}\n${LAST_WORD_HINT}\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}\n<notesoup:next_window_prompt>\n/empty keep going\n</notesoup:next_window_prompt>`);
|
|
113
|
+
assert.equal(prompted.includes(PI_PRE_RESET_HINTS), false, "manual commands own reset timing");
|
|
111
114
|
assert.equal(CLAUDE_WARNING_PROMPT.endsWith(`\n${COUNTDOWN_LINE}`), true, "Claude's variant ends the same way");
|
|
112
115
|
assert.equal(tokenBudgetGuidance(100, "empty_brain").includes(COUNTDOWN_LINE), false, "the first tier never counts down");
|
|
113
116
|
for (const text of [pi, prompted, CLAUDE_WARNING_PROMPT, tokenBudgetGuidance(100, "empty_brain")]) {
|
|
114
117
|
assert.equal(/context_window/.test(text), false, "no pre-rename tag survives in model-facing text");
|
|
115
118
|
}
|
|
116
119
|
});
|
|
117
|
-
test("only Pi's protocol
|
|
120
|
+
test("only Pi's protocol explains that reset erases the human's view", () => {
|
|
121
|
+
assert.equal(PI_PRE_RESET_HINTS, "Anything you say here is erased with the reset — the human can't read it afterward either. Put the handoff in your notes; explanations belong after the reset.\nUnless the human explicitly directs otherwise, decide for yourself when to call empty_brain. Don't keep asking them whether to reset.");
|
|
122
|
+
assert.equal(COMMAND_NOTICE.bare, "The human ran /empty. Save your notes now and call `empty_brain` immediately. Anything you say here will be erased afterward — put the handoff in your notes. Anything the human sends from now on should be handled after the reset.");
|
|
123
|
+
assert.equal(COMMAND_NOTICE.prompted, "The human ran /empty. Save your notes now and call `empty_brain` immediately. Anything you say here will be erased afterward — put the handoff in your notes. The prompt below, and anything the human sends from now on, should be handled after the reset.");
|
|
118
124
|
const pi = renderProtocolBlock({ ...DEFAULT_BOOT_TOOL_NAMES, preResetHints: PI_PRE_RESET_HINTS });
|
|
119
125
|
assert.ok(pi.includes(`\n${PI_PRE_RESET_HINTS}\n${NOTES_PROTOCOL_CLOSE_TAG}`), "both hints end the protocol, before the closing tag");
|
|
120
126
|
assert.equal(pi.split(PI_PRE_RESET_HINTS).length - 1, 1, "the hints appear once");
|
|
@@ -6,13 +6,14 @@ import test from "node:test";
|
|
|
6
6
|
import { Check } from "typebox/value";
|
|
7
7
|
import { SessionManager as Manager } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import notesoup from "../plugins/pi/extension.js";
|
|
9
|
-
import { BOOT_TYPE, CONTINUATION_TYPE, GUIDANCE_TYPE, RESET_LAST_WORD_TYPE, RESET_MARKER_TYPE } from "../plugins/pi/entries.js";
|
|
9
|
+
import { BOOT_TYPE, CARRIED_INPUT_TYPE, CONTINUATION_TYPE, GUIDANCE_TYPE, RESET_LAST_WORD_TYPE, RESET_MARKER_TYPE } from "../plugins/pi/entries.js";
|
|
10
10
|
import { MANUAL_WIPE_TYPE } from "../plugins/pi/entries.js";
|
|
11
11
|
import { assertBootHistory, toolContext } from "./helpers/extension.js";
|
|
12
12
|
import { COUNTDOWN_LINE, FORCED_CONTINUATIONS, NORMAL_CONTINUATIONS } from "../src/budget/text.js";
|
|
13
|
-
import { LAST_WORD_HINT,
|
|
13
|
+
import { LAST_WORD_HINT, commandWarningContent } from "../plugins/pi/text.js";
|
|
14
14
|
import { historyFromSession, nextHistorySeq } from "../plugins/pi/history.js";
|
|
15
|
-
import { buildResetDrafts, LAST_WORD_PREFIX, MAX_LAST_WORD_CHARS, sanitizeLastWord } from "../plugins/pi/reset/artifacts.js";
|
|
15
|
+
import { buildResetDrafts, inspectResetTail, LAST_WORD_PREFIX, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "../plugins/pi/reset/artifacts.js";
|
|
16
|
+
import { resetBoundaryCommitted } from "../plugins/pi/reset/committed.js";
|
|
16
17
|
import { initialResetControl, reduceResetControl, registerResetLifecycle, } from "../plugins/pi/reset/lifecycle.js";
|
|
17
18
|
const previousNotesHome = process.env.PI_NOTES_HOME;
|
|
18
19
|
const testNotesHome = mkdtempSync(join(tmpdir(), "notesoup-lifecycle-notes-"));
|
|
@@ -235,14 +236,13 @@ test("off stops future automatic/manual reset requests while an existing marker
|
|
|
235
236
|
assert.equal(h.sent[0]?.customType, MANUAL_WIPE_TYPE);
|
|
236
237
|
const warning = h.sessionManager.getBranch().find((entry) => entry.type === "custom_message" && entry.customType === MANUAL_WIPE_TYPE);
|
|
237
238
|
assert.ok(warning && warning.type === "custom_message");
|
|
238
|
-
assert.equal(warning.content,
|
|
239
|
+
assert.equal(warning.content, commandWarningContent());
|
|
239
240
|
const markers = h.sessionManager.getBranch().filter((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
|
|
240
241
|
assert.equal(markers.length, 1, "manual command waits for an agent boundary; it does not persist an immediate reset");
|
|
241
242
|
});
|
|
242
243
|
test("manual /empty with a prompt shows the human's command line in the close-out", async () => {
|
|
243
244
|
const h = harness();
|
|
244
|
-
//
|
|
245
|
-
// and must precede the closing instruction, so the prompt cannot read as this window's task.
|
|
245
|
+
// Structure and carried values are checked here; exact copy lives in model-facing-text tests.
|
|
246
246
|
await h.runCommand("empty", "Continue reviewing the implementation");
|
|
247
247
|
const warning = h.sessionManager.getBranch().find((entry) => entry.type === "custom_message" && entry.customType === MANUAL_WIPE_TYPE);
|
|
248
248
|
assert.ok(warning?.type === "custom_message", "the close-out warning is persisted");
|
|
@@ -250,11 +250,10 @@ test("manual /empty with a prompt shows the human's command line in the close-ou
|
|
|
250
250
|
const promptLine = "/empty Continue reviewing the implementation";
|
|
251
251
|
const promptIndex = content.indexOf(promptLine);
|
|
252
252
|
assert.ok(promptIndex >= 0, "the human's raw command line reaches the closing model");
|
|
253
|
-
|
|
254
|
-
assert.ok(closingIndex > promptIndex, "the closing instruction follows the prompt, so the order stays prompt then act");
|
|
253
|
+
assert.ok(promptIndex > content.indexOf("</notesoup:budget_notice>"), "deferred work is outside the notice");
|
|
255
254
|
assert.ok(content.indexOf(COUNTDOWN_LINE) > content.indexOf(LAST_WORD_HINT), "the countdown follows the Pi-only last-word hint");
|
|
256
255
|
assert.equal(content.split(COUNTDOWN_LINE).length - 1, 1, "the notice carries the countdown once");
|
|
257
|
-
// The
|
|
256
|
+
// The same original text becomes the new window's task, not a notes-only hint.
|
|
258
257
|
const settle = resultEntries(await h.emit("agent_before_settle", {
|
|
259
258
|
type: "agent_before_settle",
|
|
260
259
|
entries: [],
|
|
@@ -267,7 +266,92 @@ test("manual /empty with a prompt shows the human's command line in the close-ou
|
|
|
267
266
|
RESET_MARKER_TYPE,
|
|
268
267
|
BOOT_TYPE,
|
|
269
268
|
CONTINUATION_TYPE,
|
|
270
|
-
|
|
269
|
+
CARRIED_INPUT_TYPE,
|
|
270
|
+
], "the reset tail ends with the carried human input");
|
|
271
|
+
assert.deepEqual(settle.entries.at(-1), { type: "custom_message", customType: CARRIED_INPUT_TYPE, content: "Continue reviewing the implementation", display: true });
|
|
272
|
+
});
|
|
273
|
+
test("input arriving during reset construction survives even when the hidden steer is never delivered", async () => {
|
|
274
|
+
const sessionManager = Manager.inMemory("/private/tmp/notesoup-late-input-test");
|
|
275
|
+
const handlers = new Map();
|
|
276
|
+
const steers = [];
|
|
277
|
+
const api = {
|
|
278
|
+
on(name, handler) { handlers.set(name, handler); },
|
|
279
|
+
sendMessage(message, options) { steers.push({ message, options }); },
|
|
280
|
+
};
|
|
281
|
+
const ctx = {
|
|
282
|
+
cwd: "/private/tmp", sessionManager, model: undefined, hasPendingMessages: () => false,
|
|
283
|
+
isProjectTrusted: () => true, ui: { notify() { } },
|
|
284
|
+
};
|
|
285
|
+
let release;
|
|
286
|
+
const gate = new Promise((resolve) => { release = resolve; });
|
|
287
|
+
const lifecycle = registerResetLifecycle(api, {
|
|
288
|
+
isEnabled: () => true,
|
|
289
|
+
budget: { automaticResetEnabled: () => true, hardReserveDue: () => false, consumeTurnEnd: () => [], clear() { } },
|
|
290
|
+
async buildReset(ctx, isCurrent, lastWord, firstSeq, origin) {
|
|
291
|
+
await gate;
|
|
292
|
+
return buildResetDrafts(ctx, undefined, isCurrent, lastWord, firstSeq, origin);
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
lifecycle.command(`pcw:${sessionManager.getSessionId().slice(0, 8)}:root`, false);
|
|
296
|
+
lifecycle.request(`pcw:${sessionManager.getSessionId().slice(0, 8)}:root`, "handoff");
|
|
297
|
+
const pending = handlers.get("agent_before_settle")({ ...fakeBoundaryEvent(), type: "agent_before_settle" }, ctx);
|
|
298
|
+
assert.equal(await handlers.get("input")({ source: "extension", text: "not intercepted" }, ctx), undefined);
|
|
299
|
+
assert.deepEqual(await handlers.get("input")({ source: "rpc", text: " first\ninput " }, ctx), { action: "handled" });
|
|
300
|
+
assert.deepEqual(await handlers.get("input")({ source: "interactive", text: "second" }, ctx), { action: "handled" });
|
|
301
|
+
release();
|
|
302
|
+
const boundary = resultEntries([await pending]);
|
|
303
|
+
assert.equal(boundary.continue, true, "late input overrides the bare command's stop");
|
|
304
|
+
assert.deepEqual(boundary.entries.slice(-2).map((entry) => entry.type === "custom_message" ? entry.content : null), [" first\ninput ", "second"]);
|
|
305
|
+
assert.equal(steers.length, 2, "steers were queued but never delivered by this host");
|
|
306
|
+
appendDrafts(sessionManager, boundary.entries);
|
|
307
|
+
const marker = sessionManager.getBranch().find((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
|
|
308
|
+
const windowId = marker.data.windowId;
|
|
309
|
+
assert.equal(resetBoundaryCommitted(ctx, marker.id, windowId), true);
|
|
310
|
+
assert.deepEqual(inspectResetTail(ctx, marker.id, windowId), { boot: true, continuation: true }, "last word and trailing inputs form a complete ordered boundary");
|
|
311
|
+
await repairResetTail(api, ctx, marker);
|
|
312
|
+
assert.equal(steers.length, 2, "repair never duplicates a complete boundary with carried inputs");
|
|
313
|
+
sessionManager.appendCustomMessageEntry(BOOT_TYPE, "late boot", false, { windowId });
|
|
314
|
+
assert.equal(inspectResetTail(ctx, marker.id, windowId), undefined, "artifacts cannot restart after carried input");
|
|
315
|
+
assert.equal(resetBoundaryCommitted(ctx, marker.id, windowId), true, "later malformed work does not undo a committed prefix");
|
|
316
|
+
sessionManager.appendCompaction("", null, 0);
|
|
317
|
+
const partialMarker = sessionManager.appendCustomEntry(RESET_MARKER_TYPE, { windowId: "partial" });
|
|
318
|
+
sessionManager.appendCustomMessageEntry(BOOT_TYPE, "boot", false, { windowId: "partial" });
|
|
319
|
+
sessionManager.appendCustomMessageEntry(CARRIED_INPUT_TYPE, "too early", true);
|
|
320
|
+
assert.equal(inspectResetTail(ctx, partialMarker, "partial"), undefined, "repair cannot append a continuation after human content");
|
|
321
|
+
assert.equal(resetBoundaryCommitted(ctx, partialMarker, "partial"), false);
|
|
322
|
+
});
|
|
323
|
+
test("abort during reset construction restores handled input at settlement, once", async () => {
|
|
324
|
+
const sessionManager = Manager.inMemory("/private/tmp/notesoup-cancelled-build-test");
|
|
325
|
+
const handlers = new Map();
|
|
326
|
+
const sent = [];
|
|
327
|
+
const api = {
|
|
328
|
+
on(name, handler) { handlers.set(name, handler); },
|
|
329
|
+
sendMessage(message, options) { sent.push({ message, options }); },
|
|
330
|
+
};
|
|
331
|
+
const controller = new AbortController();
|
|
332
|
+
const ctx = { sessionManager, signal: controller.signal, hasPendingMessages: () => false, ui: { notify() { } } };
|
|
333
|
+
let release;
|
|
334
|
+
const gate = new Promise((resolve) => { release = resolve; });
|
|
335
|
+
const lifecycle = registerResetLifecycle(api, {
|
|
336
|
+
isEnabled: () => true,
|
|
337
|
+
budget: { automaticResetEnabled: () => false, hardReserveDue: () => false, consumeTurnEnd: () => [], clear() { } },
|
|
338
|
+
async buildReset() { await gate; return []; },
|
|
339
|
+
});
|
|
340
|
+
const windowId = `pcw:${sessionManager.getSessionId().slice(0, 8)}:root`;
|
|
341
|
+
lifecycle.command(windowId, false);
|
|
342
|
+
const building = handlers.get("agent_before_settle")({ ...fakeBoundaryEvent(), type: "agent_before_settle" }, ctx);
|
|
343
|
+
assert.deepEqual(await handlers.get("input")({ source: "rpc", text: "cancelled during construction" }, ctx), { action: "handled" });
|
|
344
|
+
controller.abort();
|
|
345
|
+
release();
|
|
346
|
+
assert.equal(await building, undefined, "aborted construction must not commit a reset");
|
|
347
|
+
await handlers.get("agent_settled")({}, ctx);
|
|
348
|
+
await handlers.get("agent_settled")({}, ctx);
|
|
349
|
+
const restored = sent.filter((item) => item.message.customType === CARRIED_INPUT_TYPE);
|
|
350
|
+
assert.deepEqual(restored, [{ message: { type: "custom_message", customType: CARRIED_INPUT_TYPE, content: "cancelled during construction", display: true }, options: { triggerTurn: false } }]);
|
|
351
|
+
// A later command in the same window must not revive the cancelled command's steer.
|
|
352
|
+
lifecycle.command(windowId, false);
|
|
353
|
+
const stale = { role: "custom", ...sent[0].message };
|
|
354
|
+
assert.deepEqual(await handlers.get("context_with_system")({ messages: [stale] }, ctx), { messages: [] });
|
|
271
355
|
});
|
|
272
356
|
test("reset construction failure preserves incoming and budget drafts without continuation", async () => {
|
|
273
357
|
const sessionManager = Manager.inMemory("/private/tmp/notesoup-reset-failure-test");
|
|
@@ -519,7 +603,6 @@ test("reset-control: fallback is normal-stop only; hard reserve remains safety",
|
|
|
519
603
|
assert.equal(notNormalStop.effect, "none");
|
|
520
604
|
assert.deepEqual(notNormalStop.state, initialResetControl());
|
|
521
605
|
}
|
|
522
|
-
assert.deepEqual(reduceResetControl(manual, { type: "settled" }).state, initialResetControl());
|
|
523
606
|
});
|
|
524
607
|
test("reset-control: manual stop survives a hard-reserve reset across windows without a second wipe", () => {
|
|
525
608
|
const windowId = "pcw:test:window";
|
|
@@ -538,7 +621,7 @@ test("reset-control: manual stop survives a hard-reserve reset across windows wi
|
|
|
538
621
|
assert.equal(stop.effect, "stop", "the safety boundary already wiped; settlement must only stop");
|
|
539
622
|
assert.deepEqual(stop.state, initialResetControl());
|
|
540
623
|
assert.equal(reduceResetControl(safety.state, { type: "before_settle", facts: beforeSettleFacts() }).effect, "commit-boundary-stop", "a failed safety construction may be retried before settlement");
|
|
541
|
-
assert.deepEqual(reduceResetControl(safety.state, { type: "
|
|
624
|
+
assert.deepEqual(reduceResetControl(safety.state, { type: "before_settle", facts: beforeSettleFacts({ windowId: freshWindowId, aborted: true }) }).state, initialResetControl());
|
|
542
625
|
});
|
|
543
626
|
test("reset-control: manual overflow keeps stop intent while queued work supersedes the failure", () => {
|
|
544
627
|
const windowId = "pcw:test:window";
|
|
@@ -552,15 +635,22 @@ test("reset-control: manual overflow keeps stop intent while queued work superse
|
|
|
552
635
|
assert.deepEqual(success.state.request, manual.request, "a successful queued turn clears only the overflow, not the manual wipe");
|
|
553
636
|
assert.equal(success.state.overflow, "idle");
|
|
554
637
|
assert.equal(reduceResetControl(success.state, { type: "before_settle", facts: beforeSettleFacts() }).effect, "commit-boundary-stop");
|
|
638
|
+
const prompted = reduceResetControl(manual, { type: "input", windowId, input: "answer after reset" }).state;
|
|
639
|
+
const called = reduceResetControl(prompted, { type: "tool_request", windowId, lastWord: "saved" }).state;
|
|
640
|
+
const failed = reduceResetControl(called, { type: "turn_end", facts: turnEndFacts({ overflow: true, failed: true, automaticResetEnabled: false }) }).state;
|
|
641
|
+
const retry = reduceResetControl(failed, { type: "before_settle", facts: beforeSettleFacts({ failed: true, automaticResetEnabled: false }) });
|
|
642
|
+
assert.equal(retry.effect, "commit-boundary", "manual input continues even when automatic reset is disabled");
|
|
643
|
+
assert.equal(retry.origin, "forced", "an overflowing close-out is forced even after a tool request");
|
|
644
|
+
assert.equal(retry.lastWord, "saved");
|
|
645
|
+
assert.equal(retry.state.overflow, "spent", "manual recovery spends the same bounded attempt");
|
|
555
646
|
});
|
|
556
|
-
test("reset-control: abort
|
|
647
|
+
test("reset-control: explicit abort clears a pending request at turn end or settlement", () => {
|
|
557
648
|
const windowId = "pcw:test:window";
|
|
558
649
|
const pending = reduceResetControl(initialResetControl(), { type: "command", windowId, continueAfterReset: false }).state;
|
|
559
650
|
const aborted = reduceResetControl(pending, { type: "turn_end", facts: turnEndFacts({ aborted: true }) });
|
|
560
651
|
assert.equal(aborted.effect, "none");
|
|
561
652
|
assert.deepEqual(aborted.state, initialResetControl());
|
|
562
|
-
assert.deepEqual(reduceResetControl(pending, { type: "
|
|
563
|
-
assert.deepEqual(reduceResetControl(pending, { type: "settled" }).state, initialResetControl());
|
|
653
|
+
assert.deepEqual(reduceResetControl(pending, { type: "before_settle", facts: beforeSettleFacts({ aborted: true }) }).state, initialResetControl());
|
|
564
654
|
});
|
|
565
655
|
test("reset-control: overflow recovery is armed at turn_end and spent exactly once at settle", () => {
|
|
566
656
|
const armed = reduceResetControl(initialResetControl(), { type: "turn_end", facts: turnEndFacts({ overflow: true, failed: true }) });
|
package/docs/reset-lifecycle.md
CHANGED
|
@@ -1,87 +1,71 @@
|
|
|
1
1
|
# Reset lifecycle
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Boot acquisition/rendering is shared: `src/boot/snapshot.ts` receives explicit identity, a captured time and an optional scope loader; `src/boot/render.ts` receives the snapshot and logical tool bindings. Pi supplies its existing names. Shared history is an addressed query projection, never an inference transcript or reset scheduler. There is no generic HostEvent or Harness reducer, and no second commit database.
|
|
3
|
+
Pi reset control lives in `plugins/pi/reset/lifecycle.ts`: the pure `reduceResetControl` selects effects; `registerResetLifecycle` adapts public Pi events and constructs boundaries. `budget.ts` stages reminders and checks settings; `reset/artifacts.ts` builds and repairs ordered artifacts; `reset/committed.ts` confirms durable boundaries. `window.ts` owns identities and provider projection; `runtime.ts` wires commands and tools. No Pi source patches, native summarization requests, or second commit database are used.
|
|
6
4
|
|
|
7
5
|
## Lifecycle at a glance
|
|
8
6
|
|
|
7
|
+
**Human input not yet answered must survive a reset and be answered afterward. Only a bare `/empty` with no later human input stops after resetting.**
|
|
8
|
+
|
|
9
9
|
| Trigger | Behavior |
|
|
10
10
|
| --- | --- |
|
|
11
|
-
| `empty_brain` tool | Record
|
|
12
|
-
| `/fresh-window
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
11
|
+
| `empty_brain` tool | Record the actual call and optional last word. Without command policy, reset after the whole tool batch at `turn_end` and continue. Under command policy, wait for settlement. |
|
|
12
|
+
| `/empty <text>` or `/fresh-window <text>` | Send a hidden close-out warning (trigger when idle, steer when busy), then reset and continue. Carry the argument text verbatim as the next window's human message; it is not merely a notes hint. |
|
|
13
|
+
| Bare `/empty` or `/fresh-window` | Close out, reset, and stop, unless more human input arrives while close-out is pending. |
|
|
14
|
+
| Human input during command close-out | Intercept public `input` events except source `extension`, return `handled`, and stash text/images in command state. Also hidden-steer the bare `<notesoup:next_window_prompt>` block plus original images to the closing model. The originals are carried even if that steer never arrives; any carried input makes the reset continue. |
|
|
15
|
+
| Passive provider overflow / recoverable length | With automatic reset enabled, force a retain-none reset and continue once. Carry the failed logical run's human messages: starting prompt and delivered steering/follow-ups. A run started by our own continuation has no human input to carry. |
|
|
16
|
+
| Command close-out overflow | Force a reset even if automatic reset is disabled. Apply command policy: continue with text/carried input, otherwise stop. The recovery attempt is spent, so an oversized carried prompt cannot loop. |
|
|
17
|
+
| Budget warning | Stage reminders when automatic reset is enabled. Warnings alone never authorize reset. |
|
|
18
|
+
| Hard reserve | Independently reset at `turn_end` when automatic reset is enabled. A bare-command stop latch cancels empty tool follow-ups, but never real queued or carried human input. |
|
|
19
|
+
| Abort / ordinary error | Restore stashed originals as visible user-content custom messages before clearing command state. Explicit abort stays stopped; ordinary close-out errors do not force reset. |
|
|
20
|
+
| `/compact` while active | Cancel native compaction; manual attempts receive a `/fresh-window` notice. |
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
Switching to a smaller model does not proactively reset or select another model. If its request overflows, the same bounded automatic recovery carries the unanswered prompt into a fresh window on the selected model. Disabling automatic reset disables passive overflow recovery.
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
2. A `notesoup/reset-marker` custom entry with `{ windowId, origin }`.
|
|
22
|
-
3. A hidden `notesoup/boot` custom message with matching `details.windowId`.
|
|
23
|
-
4. A hidden continuation message carrying the paragraph drawn for that boundary.
|
|
24
|
-
5. If the closing window passed a `last_word`, a visible `notesoup/reset-last-word` message carrying it. Pi boundary drafts do not support ordinary user entries, so the parting line is committed with the reset instead of queued separately.
|
|
24
|
+
## Boundary order and handoff
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
One public boundary draft contains, in order:
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
1. A native `compaction` with `summary: ""` and `firstKeptEntryId: null` (Pi materializes its own ID: retain none).
|
|
29
|
+
2. A `notesoup/reset-marker` custom entry with `{ windowId, origin }`.
|
|
30
|
+
3. A hidden `notesoup/boot` custom message with matching `details.windowId`.
|
|
31
|
+
4. One hidden continuation paragraph, selected once when the artifact is built.
|
|
32
|
+
5. An optional visible `notesoup/reset-last-word` sticky note.
|
|
33
|
+
6. One visible `notesoup/carried-input` custom message per carried human input, preserving original text/image content and order.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
Boundary drafts cannot contain ordinary user entries. Pi's public custom-message conversion supplies role `user` to the provider, including text/image arrays. Carried inputs are appended atomically with the reset artifacts, not queued as separate prompts; any carried input returns `continue: true`.
|
|
35
36
|
|
|
36
|
-
The
|
|
37
|
+
The origin is `normal` for an actual tool request, otherwise `forced`; overflow recovery is always forced. Each origin has an approved complete-paragraph pool. Construction draws once and persists the paragraph verbatim; rendering, reads, reloads and repair never redraw an existing continuation. Legacy markers without a valid origin default to normal. Other hosts retain their own scheduling: dsh shares one draw across checkpoint and continuation; Claude caches its forced handoff per window.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
Raw session history remains available. The retain-none checkpoint excludes old conversational context while preserving Pi's empty summary wrapper and system/tool state. Marker-only legacy sessions use boot slicing as a compatibility fallback. A marker is checkpoint-backed only if it directly follows a self-retaining, empty native compaction.
|
|
39
40
|
|
|
40
|
-
## Reducer state
|
|
41
|
+
## Reducer and run state
|
|
41
42
|
|
|
42
|
-
`
|
|
43
|
+
`ResetControlState` combines a request and a bounded overflow phase:
|
|
43
44
|
|
|
44
|
-
|
|
|
45
|
+
| Request | Meaning |
|
|
45
46
|
| --- | --- |
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
|
|
50
|
-
| `overflow: "idle"` | No overflow recovery is pending. |
|
|
51
|
-
| `overflow: "pending"` | An overflow failure may recover once at pre-settlement. |
|
|
52
|
-
| `overflow: "pending-spent"` | Recovery was already spent in this failure chain. |
|
|
53
|
-
| `overflow: "spent"` | The one recovery has been used until the chain settles. |
|
|
54
|
-
|
|
55
|
-
### Transition rules
|
|
56
|
-
|
|
57
|
-
- `command(windowId, continueAfterReset)` stores settlement policy. Duplicate same-window commands retain the first policy; a pending tool request is retained.
|
|
58
|
-
- `tool_request(windowId, lastWord?)` records an actual call without changing command policy. Tool-only duplicates keep the first request; under command policy, repeated calls may supply the first nonempty last word.
|
|
59
|
-
- `turn_end` clears on abort. Overflow preserves command policy and its tool request; otherwise automatic recovery is armed only when enabled and unqueued. Other errors drop pending requests. Success commits a tool-only request or hard-reserve reset. Hard reserve under a bare command retains the cross-window `stop-pending` latch; a continuing command needs no stop latch.
|
|
60
|
-
- `agent_before_settle` waits for queued work. Command overflow resets even with automatic recovery disabled, honoring command continuation policy. Other overflow recovery gets one attempt. A committed stop latch stops without a second wipe; an uncommitted one can retry construction. Otherwise a successful command settles and resets. No command means no ordinary settle reset.
|
|
61
|
-
- `agent_settled`, session start/tree navigation/shutdown, `/notesoup off`, and abort clear transient request state. Durable checkpoint/marker history remains authoritative after transient state is gone.
|
|
62
|
-
|
|
63
|
-
After a manual safety reset, `context_with_system` verifies the committed checkpoint/marker/boot/continuation before using public `ctx.abort()` to cancel Pi's otherwise unavoidable tool-batch follow-up, returning a system-only safe context. Pending messages or a real user message after the reset marker bypass cancellation so queued work is not swallowed. A follow-up queue may require Pi's ordinary tool follow-up to finish before delivery; the stop intent remains armed until that work settles. Abort/settlement clears the run-scoped latch, so later user prompts work normally.
|
|
64
|
-
|
|
65
|
-
Budget warnings need no rearming or consumption in the lifecycle. Direct tool calls remain valid without a warning. Actual abort, synthetic assistant abort and generic provider failure keep their existing cleanup semantics.
|
|
47
|
+
| `none` | No command or tool request. |
|
|
48
|
+
| `pending` | Current `windowId`, optional `tool: { lastWord? }`, and optional `command: { continueAfterReset, inputs? }`. Command inputs retain originals, not prompt-block wrappers. Duplicate commands retain the first policy/text; tool calls do not overwrite command policy. |
|
|
49
|
+
| `stop-pending` | A bare-command hard-reserve reset's stop intent survives the window change. It retains the tool request for construction retry, but stops without a second wipe after commit. |
|
|
66
50
|
|
|
67
|
-
|
|
51
|
+
Overflow phases are `idle`, `pending`, `spent`, and `pending-spent`. `turn_end` arms enabled recovery; `agent_before_settle` waits for queued work and spends at most one attempt. A successful queued turn supersedes the failure. Command overflow also spends the attempt before continuing. Abort, final settlement, session start/tree/shutdown and `/notesoup off` clear transient state.
|
|
68
52
|
|
|
69
|
-
The
|
|
53
|
+
The adapter collects actual user `message_end` content until settlement or a successful reset boundary. Low-level `agent_start` events do not clear it: Pi can start additional loops while draining follow-ups/recovering. Custom boot/warning/continuation messages are never mistaken for human input. Successful boundary construction clears this run collection, so an automatic continuation does not replay old input.
|
|
70
54
|
|
|
71
|
-
|
|
55
|
+
Command state remains live during asynchronous notes acquisition. Inputs arriving during construction join that same boundary and override a proposed stop. Hidden steers carry window/command identity; provider projection excludes them once that command ends, including steers Pi delivers only after the reset. Originals remain available exactly once as carried input. Construction captures session/window generations and rechecks identity, enabled state and abort status before returning drafts. Stale work preserves incoming/budget entries but discards reset drafts; construction failures notify only while current and do not claim continuation. If close-out cannot commit, stashed originals are restored with public `sendMessage(..., { triggerTurn: false })`, including cancellation during construction; clearing command state must not erase input already reported as handled.
|
|
72
56
|
|
|
73
|
-
|
|
57
|
+
After a manual safety reset, `context_with_system` checks the committed boundary before using public `ctx.abort()` to cancel an unavoidable empty tool follow-up with system-only context. Pending messages, ordinary user entries or carried inputs after the marker bypass cancellation. Later user prompts are not affected by the run-scoped stop latch.
|
|
74
58
|
|
|
75
|
-
##
|
|
59
|
+
## Warnings, projection and repair
|
|
76
60
|
|
|
77
|
-
|
|
61
|
+
Budget reminders are staged once per window at reserve plus reminder margin, then reserve plus warning runway. Hard reserve remains independent. Budget and command warnings use different types. The final budget warning notifies at first provider injection, not durability; early guidance stays UI-silent. Budget drafts are instance-local and discarded on abort, failed turn, transition or window mismatch. Active-window usage and the exact public `SettingsManager` authority determine thresholds.
|
|
78
62
|
|
|
79
|
-
|
|
63
|
+
Manual warnings begin with the `/empty` notice inside `<notesoup:budget_notice>`, followed by `WARNING_BODY`, the last-word hint and countdown. Optional command text sits after the closing tag in `<notesoup:next_window_prompt>`. They omit budget timing hints. Pi's boot protocol and budget warnings explain that reset erases the human's view and leave timing to the model unless directed otherwise; other hosts do not inherit that Pi-only claim.
|
|
80
64
|
|
|
81
|
-
|
|
65
|
+
`context_with_system` selects the boot by durable window identity, using Pi's canonical checkpoint projection or legacy slicing. Missing boot aborts safely instead of exposing raw history. Usage estimates use the same projection decision. `/tree` summaries are suppressed when crossing reset branches because native branch summarization bypasses this projection.
|
|
82
66
|
|
|
83
|
-
|
|
67
|
+
`resetBoundaryCommitted` validates checkpoint -> marker -> matching hidden boot -> hidden continuation; trailing last words, carried input or later conversation cannot undo that committed prefix. `inspectResetTail` checks the entire repairable suffix: optional last word and carried inputs must follow the continuation, with no duplicate/misordered artifacts or later conversation. A carried input before boot/continuation blocks repair rather than allowing metadata to be appended after human content. Startup/tree repair only fills missing boot/continuation when safe, rechecking lifecycle identity after notes acquisition. UI success notices use committed confirmation, not repairability.
|
|
84
68
|
|
|
85
|
-
|
|
69
|
+
## Validation
|
|
86
70
|
|
|
87
|
-
|
|
71
|
+
Scripted SDK tests run Pi's real agent loop without network calls: smaller-model overflow and prompt replay, command text, bare stop, intercepted text/images, hard-reserve handling, overflowing close-out and bounded retry. They also cover passive tool-loop steering/follow-ups and input-free automatic continuations. Focused tests check late input during asynchronous construction, stale queued steer exclusion, abort/error restoration, ordered carry artifacts, commit confirmation, safe repair, canonical projection and persisted history. External-provider behavior and every malformed persisted/filesystem case are not established by this suite.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notesoup",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && node scripts/build-extension.mjs && node -e \"require('node:fs').chmodSync('dist/plugins/pi/dream/cli.js', 0o755)\"",
|
|
64
64
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p plugins/claude/tsconfig.json",
|
|
65
|
-
"test": "npm run build && node --test --test-concurrency=4 dist/test/*.test.js",
|
|
65
|
+
"test": "npm run build && node --test --test-concurrency=4 $(ls dist/test/*.test.js | grep -v dist/test/claude-validation.test.js) && node --test dist/test/claude-validation.test.js",
|
|
66
66
|
"prepublishOnly": "npm run typecheck",
|
|
67
67
|
"prepack": "npm run build"
|
|
68
68
|
},
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Notesoup last word
|
|
2
|
+
|
|
3
|
+
Displays notesoup last-word messages already present in Paseo’s timeline as expanded, selectable cards. Cards use the current theme and compact layout. Requires Paseo 0.11.2 on the client and daemon.
|
|
4
|
+
|
|
5
|
+
This client-only plugin transforms the existing custom-message row in place. It does not read session files or append messages. Other timeline items are unchanged.
|
|
6
|
+
|
|
7
|
+
Paseo 0.11.2 drops Pi boundary `entry_appended` events from its live timeline. This plugin cannot display messages that Paseo has not received; that adapter gap needs an upstream fix. Messages available through history can be rendered.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Notesoup Paseo plugin
|
|
2
|
+
|
|
3
|
+
Client-only last-word renderer. See [OVERVIEW.md](OVERVIEW.md) for behavior and the upstream live-event limitation.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
cd plugins/paseo
|
|
7
|
+
npm install --ignore-scripts --package-lock=false
|
|
8
|
+
npm run typecheck
|
|
9
|
+
npm test
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Install this directory with `paseo plugin install /absolute/path/to/plugins/paseo`. Source changes require `paseo plugin reload notesoup-last-word`; no daemon restart is needed.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
|
+
import { CARD_KIND, LAST_WORD_TYPE } from "../shared/last-word.ts";
|
|
3
|
+
|
|
4
|
+
type Transformer = Extract<Parameters<PluginClientContext["addTimelineTransformer"]>[0], { query: { itemType: "tool_call" } }>;
|
|
5
|
+
type Source = Parameters<Transformer["transform"]>[0];
|
|
6
|
+
|
|
7
|
+
export const sourceRowTransformer = {
|
|
8
|
+
id: "last-word-source",
|
|
9
|
+
query: { itemType: "tool_call" },
|
|
10
|
+
transform: ({ item }: Pick<Source, "item">) => {
|
|
11
|
+
if (item.type !== "tool_call" || item.metadata?.customType !== LAST_WORD_TYPE || item.detail?.type !== "plain_text" || typeof item.detail.text !== "string") return undefined;
|
|
12
|
+
return { items: [{ type: "plugin" as const, kind: CARD_KIND, version: 1, data: { text: item.detail.text } }] };
|
|
13
|
+
},
|
|
14
|
+
} satisfies Transformer;
|