notesoup 0.51.1 → 0.51.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/plugins/pi/entries.d.ts +2 -0
  2. package/dist/plugins/pi/entries.js +2 -0
  3. package/dist/plugins/pi/reset/artifacts.d.ts +10 -2
  4. package/dist/plugins/pi/reset/artifacts.js +24 -5
  5. package/dist/plugins/pi/reset/lifecycle.d.ts +37 -21
  6. package/dist/plugins/pi/reset/lifecycle.js +132 -57
  7. package/dist/plugins/pi/runtime.js +9 -10
  8. package/dist/plugins/pi/text.d.ts +11 -14
  9. package/dist/plugins/pi/text.js +15 -16
  10. package/dist/test/agent-loop.test.js +316 -163
  11. package/dist/test/boot.integration.test.js +3 -3
  12. package/dist/test/claude-validation.test.js +4 -2
  13. package/dist/test/dsh-cli.test.js +7 -6
  14. package/dist/test/helpers/dsh-messages.js +3 -0
  15. package/dist/test/model-facing-text.test.js +10 -4
  16. package/dist/test/reset-lifecycle.test.js +272 -88
  17. package/docs/architecture.md +1 -1
  18. package/docs/reset-lifecycle.md +42 -57
  19. package/package.json +2 -2
  20. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  21. package/plugins/paseo/OVERVIEW.md +7 -0
  22. package/plugins/paseo/README.md +12 -0
  23. package/plugins/paseo/client/source-row.ts +14 -0
  24. package/plugins/paseo/client/sticky-card.tsx +21 -0
  25. package/plugins/paseo/index.client.tsx +10 -0
  26. package/plugins/paseo/package.json +19 -0
  27. package/plugins/paseo/paseo-plugin.json +4 -0
  28. package/plugins/paseo/shared/last-word.ts +6 -0
  29. package/plugins/paseo/test/source-row.test.ts +19 -0
  30. package/plugins/paseo/tsconfig.json +16 -0
  31. package/plugins/pi/entries.ts +2 -0
  32. package/plugins/pi/reset/artifacts.ts +26 -5
  33. package/plugins/pi/reset/lifecycle.ts +135 -70
  34. package/plugins/pi/runtime.ts +9 -10
  35. 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("Brain emptied")), [{ message: "🥣 Brain emptied", type: "info" }], "the committed reset is announced once");
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("Brain emptied")), [{ message: "🥣 Brain emptied forcibly: overflow", type: "warning" }]);
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("Brain emptied")).length, 1);
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", timeout: 30_000,
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", timeout: 30_000,
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", { timeout: 45000 }, async (t) => {
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
- const env = { ...process.env, DSH_HOME: home, DEEPSEEK_API_KEY: "mock-key", DEEPSEEK_BASE_URL: mock.url, DSH_TOOLS_MODE: "native" };
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, timeout: 20000 });
33
- assert.equal(mock.requests.length, 2, first.stderr);
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, timeout: 20000 });
41
- assert.equal(mock.requests.length, 3, second.stderr);
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 = warningContent("/empty keep going");
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.endsWith(`\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}`), "the prompt block does not displace the countdown");
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 claims the reset clears the human's chat view", () => {
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");