notesoup 0.60.1 → 0.62.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/.agents/plugins/marketplace.json +15 -0
- package/README.md +14 -10
- package/dist/plugins/antigravity/src/cli.d.ts +1 -0
- package/dist/plugins/antigravity/src/cli.js +23 -0
- package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
- package/dist/plugins/antigravity/src/hooks.js +53 -0
- package/dist/plugins/antigravity/src/identity.d.ts +26 -0
- package/dist/plugins/antigravity/src/identity.js +129 -0
- package/dist/plugins/claude/src/helper.js +2 -1
- package/dist/plugins/codex/src/hooks.js +1 -0
- package/dist/plugins/codex/src/identity.d.ts +6 -1
- package/dist/plugins/codex/src/identity.js +13 -1
- package/dist/plugins/codex/src/mcp.d.ts +35 -7
- package/dist/plugins/codex/src/mcp.js +26 -88
- package/dist/plugins/codex/src/text.js +3 -3
- package/dist/plugins/dsh/tools.js +8 -4
- package/dist/plugins/mcp/operations.d.ts +15 -0
- package/dist/plugins/mcp/operations.js +43 -0
- package/dist/plugins/mcp/server.d.ts +14 -0
- package/dist/plugins/mcp/server.js +13 -0
- package/dist/plugins/pi/budget.d.ts +1 -1
- package/dist/plugins/pi/budget.js +3 -2
- package/dist/plugins/pi/entries.d.ts +1 -0
- package/dist/plugins/pi/entries.js +1 -0
- package/dist/plugins/pi/history-tools.js +2 -1
- package/dist/plugins/pi/history.js +18 -1
- package/dist/plugins/pi/notes/tools.js +7 -3
- package/dist/plugins/pi/render.d.ts +7 -1
- package/dist/plugins/pi/render.js +2 -2
- package/dist/plugins/pi/reset/lifecycle.d.ts +1 -1
- package/dist/plugins/pi/reset/lifecycle.js +8 -9
- package/dist/plugins/pi/runtime.js +102 -61
- package/dist/plugins/pi/tool-result.js +7 -7
- package/dist/plugins/pi/window.d.ts +33 -3
- package/dist/plugins/pi/window.js +209 -9
- package/dist/src/boot/render.d.ts +5 -0
- package/dist/src/boot/render.js +60 -28
- package/dist/src/boot/text.d.ts +3 -3
- package/dist/src/boot/text.js +27 -26
- package/dist/src/budget/text.d.ts +2 -2
- package/dist/src/budget/text.js +13 -13
- package/dist/src/history/claude.d.ts +2 -0
- package/dist/src/history/claude.js +46 -0
- package/dist/src/history/codex-transcript.js +7 -5
- package/dist/src/history/codex.js +3 -0
- package/dist/src/history/corpus.d.ts +28 -1
- package/dist/src/history/corpus.js +40 -0
- package/dist/src/history/history.d.ts +37 -46
- package/dist/src/history/history.js +21 -40
- package/dist/src/history/local.js +67 -32
- package/dist/src/history/pi.d.ts +2 -1
- package/dist/src/history/pi.js +122 -48
- package/dist/src/history/prefilter.js +76 -19
- package/dist/src/history/query.d.ts +28 -49
- package/dist/src/history/query.js +83 -68
- package/dist/src/history/summary-cache.d.ts +8 -1
- package/dist/src/history/summary-cache.js +138 -12
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/notes/frontmatter.d.ts +4 -0
- package/dist/src/notes/frontmatter.js +15 -1
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/policy.d.ts +15 -1
- package/dist/src/notes/policy.js +47 -6
- package/dist/src/notes/store.d.ts +14 -0
- package/dist/src/notes/store.js +33 -12
- package/dist/src/text-match.d.ts +10 -1
- package/dist/src/text-match.js +42 -3
- package/dist/src/tools/dream.d.ts +22 -91
- package/dist/src/tools/dream.js +30 -27
- package/dist/src/tools/history.d.ts +33 -26
- package/dist/src/tools/history.js +257 -163
- package/dist/src/tools/notes.d.ts +58 -160
- package/dist/src/tools/notes.js +151 -99
- package/dist/src/tools/output.d.ts +2 -1
- package/dist/src/tools/output.js +2 -1
- package/dist/src/tools/result.d.ts +4 -7
- package/dist/src/tools/result.js +8 -9
- package/dist/src/tools/schema.d.ts +4 -1
- package/dist/src/tools/schema.js +25 -1
- package/dist/test/agent-loop.test.js +198 -16
- package/dist/test/antigravity-live.test.d.ts +1 -0
- package/dist/test/antigravity-live.test.js +142 -0
- package/dist/test/antigravity-plugin.test.d.ts +1 -0
- package/dist/test/antigravity-plugin.test.js +101 -0
- package/dist/test/boot.integration.test.js +133 -14
- package/dist/test/claude-history.test.js +14 -13
- package/dist/test/claude-mod.test.js +9 -6
- package/dist/test/codex-history.test.js +15 -3
- package/dist/test/codex-plugin.test.js +76 -38
- package/dist/test/dependencies.test.js +7 -3
- package/dist/test/dream-skill.test.js +3 -3
- package/dist/test/dream-tools.test.js +101 -56
- package/dist/test/dsh.test.js +34 -19
- package/dist/test/helpers/dependency-graph.js +2 -2
- package/dist/test/helpers/extension.d.ts +65 -2
- package/dist/test/helpers/extension.js +72 -3
- package/dist/test/history-corpus.test.js +79 -77
- package/dist/test/history-summary-cache.test.js +97 -9
- package/dist/test/history.integration.test.js +234 -168
- package/dist/test/host-neutral.test.js +69 -19
- package/dist/test/marker.test.js +1 -1
- package/dist/test/note-policy.test.js +189 -56
- package/dist/test/notes.integration.test.js +212 -94
- package/dist/test/notes.test.js +184 -113
- package/dist/test/pi-render.test.js +20 -12
- package/dist/test/project-namespace.test.js +3 -2
- package/dist/test/reset-lifecycle.test.js +2 -2
- package/docs/antigravity.md +44 -0
- package/docs/architecture.md +6 -4
- package/docs/claude-code-mod.md +2 -2
- package/docs/codex.md +36 -38
- package/docs/dsh.md +4 -4
- package/docs/history-sessions.md +28 -50
- package/docs/notes-library.md +6 -6
- package/docs/reset-lifecycle.md +1 -1
- package/docs/skills.md +3 -3
- package/docs/tool-results.md +47 -28
- package/package.json +3 -2
- package/playbook.md +3 -3
- package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
- package/plugins/antigravity/hooks.json +7 -0
- package/plugins/antigravity/mcp_config.json +8 -0
- package/plugins/antigravity/plugin.json +6 -0
- package/plugins/antigravity/src/cli.ts +22 -0
- package/plugins/antigravity/src/hooks.ts +51 -0
- package/plugins/antigravity/src/identity.ts +127 -0
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +1129 -549
- package/plugins/claude/hooks/register.ts +2 -2
- package/plugins/claude/playbook.md +3 -3
- package/plugins/claude/skills/dream/SKILL.md +2 -2
- package/plugins/claude/skills/notesoup/SKILL.md +92 -0
- package/plugins/claude/src/helper.ts +2 -1
- package/plugins/codex/.codex-plugin/plugin.json +8 -0
- package/plugins/codex/.mcp.json +11 -0
- package/plugins/codex/README.md +5 -21
- package/plugins/codex/dist/codex/notesoup.js +18494 -17905
- package/plugins/codex/src/hooks.ts +1 -0
- package/plugins/codex/src/identity.ts +14 -1
- package/plugins/codex/src/mcp.ts +28 -98
- package/plugins/codex/src/text.ts +3 -3
- package/plugins/dsh/tools.ts +8 -4
- package/plugins/mcp/operations.ts +50 -0
- package/plugins/mcp/server.ts +23 -0
- package/plugins/paseo/README.md +5 -10
- package/plugins/paseo/client/brain-empty-card.tsx +3 -3
- package/plugins/paseo/client/markdown.tsx +50 -38
- package/plugins/paseo/client/notes-op-card.tsx +12 -9
- package/plugins/paseo/client/paper-card.tsx +6 -5
- package/plugins/paseo/client/paper-palette.ts +2 -9
- package/plugins/paseo/client/sticky-card.tsx +2 -2
- package/plugins/paseo/client/tool-result.ts +7 -14
- package/plugins/paseo/package-lock.json +3406 -0
- package/plugins/paseo/package.json +1 -0
- package/plugins/paseo/test/markdown-core.test.ts +73 -66
- package/plugins/pi/budget.ts +3 -3
- package/plugins/pi/entries.ts +1 -0
- package/plugins/pi/history-tools.ts +2 -1
- package/plugins/pi/history.ts +30 -1
- package/plugins/pi/notes/tools.ts +7 -3
- package/plugins/pi/render.ts +6 -6
- package/plugins/pi/reset/lifecycle.ts +9 -10
- package/plugins/pi/runtime.ts +96 -60
- package/plugins/pi/tool-result.ts +8 -8
- package/plugins/pi/window.ts +198 -9
- package/skills/dream/SKILL.md +2 -2
- package/skills/notesoup/SKILL.md +92 -0
- package/src/boot/render.ts +59 -25
- package/src/boot/text.ts +30 -27
- package/src/budget/text.ts +13 -13
- package/src/history/claude.ts +41 -0
- package/src/history/codex-transcript.ts +6 -4
- package/src/history/codex.ts +2 -0
- package/src/history/corpus.ts +51 -2
- package/src/history/history.ts +35 -44
- package/src/history/local.ts +67 -27
- package/src/history/pi.ts +113 -35
- package/src/history/prefilter.ts +73 -15
- package/src/history/query.ts +93 -73
- package/src/history/summary-cache.ts +142 -17
- package/src/index.ts +1 -1
- package/src/notes/frontmatter.ts +16 -1
- package/src/notes/index.ts +1 -1
- package/src/notes/policy.ts +45 -6
- package/src/notes/store.ts +30 -15
- package/src/text-match.ts +46 -4
- package/src/tools/dream.ts +29 -31
- package/src/tools/history.ts +249 -142
- package/src/tools/notes.ts +150 -112
- package/src/tools/output.ts +2 -1
- package/src/tools/result.ts +12 -11
- package/src/tools/schema.ts +24 -1
- package/plugins/claude/skills/memory/SKILL.md +0 -69
- package/plugins/codex/mcp.json +0 -10
- package/plugins/codex/plugin.json +0 -6
- package/plugins/paseo/client/markdown-core.tsx +0 -189
- package/plugins/paseo/client/typography.ts +0 -24
- package/skills/memory/SKILL.md +0 -69
|
@@ -2,15 +2,16 @@ import { resetBoundaryCommitted } from "../plugins/pi/reset/committed.js";
|
|
|
2
2
|
import { inspectResetTail } from "../plugins/pi/reset/artifacts.js";
|
|
3
3
|
import assert from "node:assert/strict";
|
|
4
4
|
import { rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
5
6
|
import test from "node:test";
|
|
6
7
|
import { historyFromSession } from "../plugins/pi/history.js";
|
|
7
|
-
import { BOOT_TYPE, GUIDANCE_TYPE, RESET_MARKER_TYPE } from "../plugins/pi/entries.js";
|
|
8
|
+
import { BOOT_TYPE, GUIDANCE_TYPE, MARKER_TYPE, RESET_MARKER_TYPE, WARNING_TYPE } from "../plugins/pi/entries.js";
|
|
8
9
|
import { MAPS_BLOCK, NOTES_PROTOCOL_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG } from "../src/boot/text.js";
|
|
9
|
-
import { rootWindowId } from "../plugins/pi/window.js";
|
|
10
|
+
import { NOTESOUP_TOOL_NAMES, rootWindowId } from "../plugins/pi/window.js";
|
|
10
11
|
import { FORCED_CONTINUATIONS, NORMAL_CONTINUATIONS } from "../src/budget/text.js";
|
|
11
12
|
import { listNotes } from "./helpers/notes.js";
|
|
12
13
|
import { CONTINUATION_TYPE, MANUAL_WIPE_TYPE } from "../plugins/pi/entries.js";
|
|
13
|
-
import { appendText, assertBootHistory, call, commitTurnEndBoundary, context, explicitBoot, makeExtension, manager, noticesOf,
|
|
14
|
+
import { appendText, assertBootHistory, call, commitTurnEndBoundary, context, explicitBoot, makeExtension, manager, noticesOf, resultJson, resultText, runContextHook, runContextWithSystemHook, runHandlers, runManualCompact, runBeforeAgentStart, runCommand, runInput, sentOf, } from "./helpers/extension.js";
|
|
14
15
|
import { installExtensionTestHooks } from "./helpers/extension-test-environment.js";
|
|
15
16
|
const testEnvironment = installExtensionTestHooks("notesoup-integration");
|
|
16
17
|
test("custom reset marker removes old provider context while history remains searchable", async () => {
|
|
@@ -46,11 +47,11 @@ test("custom reset marker removes old provider context while history remains sea
|
|
|
46
47
|
assert.ok(oldWindow);
|
|
47
48
|
const oldSeq = windows[0]?.items.find((item) => item.text.includes("OLD-UNIQUE-TRANSCRIPT"))?.seq;
|
|
48
49
|
assert.ok(oldSeq);
|
|
49
|
-
const read =
|
|
50
|
-
assert.match(read
|
|
51
|
-
const found =
|
|
52
|
-
assert.
|
|
53
|
-
assert.
|
|
50
|
+
const read = resultText(await call(captured, "history_read", { seq: oldSeq }, ctx));
|
|
51
|
+
assert.match(read, /OLD-UNIQUE-TRANSCRIPT/);
|
|
52
|
+
const found = resultText(await call(captured, "history_search", { query: "needle" }, ctx));
|
|
53
|
+
assert.match(found, new RegExp(`seq ${oldSeq} \\| user`));
|
|
54
|
+
assert.match(found, /\bneedle\b/);
|
|
54
55
|
});
|
|
55
56
|
test("a checkpoint-backed reset projects from its boot and drops the empty compaction wrapper", async () => {
|
|
56
57
|
const sessionManager = manager();
|
|
@@ -83,8 +84,10 @@ test("the root boot and reset boot carry durable window identity", async () => {
|
|
|
83
84
|
appendText(sessionManager, "user", "task before reset");
|
|
84
85
|
appendText(sessionManager, "assistant", "working");
|
|
85
86
|
await call(captured, "notes_write", { address: "decisions.md", content: "use terra" }, ctx);
|
|
86
|
-
// Root
|
|
87
|
+
// Root windows boot lazily: startup alone writes nothing, the first input does.
|
|
87
88
|
await runHandlers(captured, "session_start", { reason: "startup" }, ctx);
|
|
89
|
+
assert.equal(captured.sent.length, 0, "session_start never builds a root boot");
|
|
90
|
+
await runInput(captured, ctx);
|
|
88
91
|
assert.equal(captured.sent.length, 1);
|
|
89
92
|
const rootBoot = captured.sent[0];
|
|
90
93
|
assert.equal(rootBoot?.message.customType, BOOT_TYPE);
|
|
@@ -92,6 +95,8 @@ test("the root boot and reset boot carry durable window identity", async () => {
|
|
|
92
95
|
assert.equal(rootBoot?.options?.triggerTurn, false);
|
|
93
96
|
assert.equal(noticesOf(ctx).length, 0, "initial boot is silent");
|
|
94
97
|
await runHandlers(captured, "session_start", { reason: "reload" }, ctx);
|
|
98
|
+
await runInput(captured, ctx);
|
|
99
|
+
assert.equal(captured.sent.length, 1, "reload never duplicates the existing root boot");
|
|
95
100
|
assert.equal(noticesOf(ctx).length, 0, "reload is silent");
|
|
96
101
|
assert.deepEqual(rootBoot?.message.details, { windowId: `pcw:${sessionManager.getSessionId().slice(0, 8)}:root` });
|
|
97
102
|
const rootText = typeof rootBoot?.message.content === "string" ? rootBoot.message.content : "";
|
|
@@ -153,6 +158,7 @@ test("an empty root boot starts at the first projected seq", async () => {
|
|
|
153
158
|
const captured = makeExtension(sessionManager);
|
|
154
159
|
const ctx = context(sessionManager);
|
|
155
160
|
await runHandlers(captured, "session_start", { reason: "startup" }, ctx);
|
|
161
|
+
await runInput(captured, ctx);
|
|
156
162
|
const body = String(captured.sent[0]?.message.content);
|
|
157
163
|
const projection = historyFromSession(ctx);
|
|
158
164
|
assert.equal(projection.windows.length, 1);
|
|
@@ -164,6 +170,7 @@ test("boot ranges include tool-call slots and both completed reset checkpoints",
|
|
|
164
170
|
const captured = makeExtension(sessionManager);
|
|
165
171
|
const ctx = context(sessionManager);
|
|
166
172
|
await runHandlers(captured, "session_start", { reason: "startup" }, ctx);
|
|
173
|
+
await runInput(captured, ctx);
|
|
167
174
|
appendText(sessionManager, "user", "before tools");
|
|
168
175
|
sessionManager.appendMessage({
|
|
169
176
|
role: "assistant",
|
|
@@ -196,6 +203,7 @@ test("a boot beyond three windows shows only root, the previous window, and the
|
|
|
196
203
|
const captured = makeExtension(sessionManager);
|
|
197
204
|
const ctx = context(sessionManager);
|
|
198
205
|
await runHandlers(captured, "session_start", { reason: "startup" }, ctx);
|
|
206
|
+
await runInput(captured, ctx);
|
|
199
207
|
for (let round = 0; round < 4; round++) {
|
|
200
208
|
appendText(sessionManager, "user", `work before reset ${round}`);
|
|
201
209
|
await call(captured, "empty_brain", {}, ctx);
|
|
@@ -338,20 +346,74 @@ test("a marker tail followed by real conversation is never repaired", async () =
|
|
|
338
346
|
assert.equal(sessionManager.getBranch().filter((entry) => entry.type === "custom_message" && entry.customType === BOOT_TYPE).length, 0, "no boot is appended after real work");
|
|
339
347
|
assert.equal(sessionManager.getBranch().filter((entry) => entry.type === "custom_message" && entry.customType === CONTINUATION_TYPE).length, 0, "no continuation is appended after real work");
|
|
340
348
|
});
|
|
341
|
-
test("off preserves an existing
|
|
349
|
+
test("off preserves an existing reset window before compaction, allows native compaction, and lets re-enabling re-boot cleanly", async () => {
|
|
342
350
|
const sessionManager = manager();
|
|
343
351
|
const captured = makeExtension(sessionManager);
|
|
344
352
|
const ctx = context(sessionManager);
|
|
345
353
|
appendText(sessionManager, "user", "old context must stay hidden");
|
|
346
354
|
const windowId = "pcw:test:existing";
|
|
355
|
+
sessionManager.appendCompaction("", null, 0);
|
|
347
356
|
sessionManager.appendCustomEntry(RESET_MARKER_TYPE, { windowId });
|
|
348
357
|
sessionManager.appendCustomMessageEntry(BOOT_TYPE, "fresh boot", false, { windowId });
|
|
358
|
+
sessionManager.appendCustomMessageEntry(WARNING_TYPE, "old warning", false);
|
|
359
|
+
appendText(sessionManager, "user", "post-reset message");
|
|
349
360
|
await runCommand(captured, "notesoup", "off", ctx);
|
|
350
361
|
const before = await runManualCompact(captured, ctx);
|
|
351
|
-
assert.
|
|
352
|
-
const
|
|
353
|
-
|
|
362
|
+
assert.equal(before, undefined, "off hands manual/auto compaction back to native Pi");
|
|
363
|
+
const beforeCompact = await runContextWithSystemHook(captured, ctx, sessionManager.buildSessionProjection().messages);
|
|
364
|
+
const beforeMessages = (beforeCompact?.messages ?? []);
|
|
365
|
+
assert.equal(JSON.stringify(beforeMessages).includes("old context must stay hidden"), false);
|
|
366
|
+
assert.equal(beforeMessages.some((m) => m.role === "compactionSummary"), false, "empty reset wrapper stays hidden before native compaction");
|
|
367
|
+
assert.equal(historyFromSession(ctx).windows.at(-1)?.windowId, windowId);
|
|
368
|
+
// Native compaction runs while off and compacts away the old boot and warning.
|
|
369
|
+
const keptId = appendText(sessionManager, "user", "kept after native compact");
|
|
370
|
+
sessionManager.appendCompaction("NATIVE_COMPACT_SUMMARY", keptId, 12_000);
|
|
371
|
+
appendText(sessionManager, "user", "after native compact");
|
|
372
|
+
const afterCompactOff = await runContextWithSystemHook(captured, ctx, sessionManager.buildSessionProjection().messages);
|
|
373
|
+
const offJson = JSON.stringify(afterCompactOff?.messages ?? []);
|
|
374
|
+
assert.ok(offJson.includes("NATIVE_COMPACT_SUMMARY"), "native compaction summary reaches the model while off");
|
|
375
|
+
assert.ok(offJson.includes("kept after native compact"));
|
|
376
|
+
assert.equal(offJson.includes("old context must stay hidden"), false);
|
|
354
377
|
assert.equal(historyFromSession(ctx).windows.at(-1)?.windowId, windowId);
|
|
378
|
+
// Re-enabling notesoup after native compaction lazily re-boots for the current window and resets warning eligibility.
|
|
379
|
+
await runCommand(captured, "notesoup", "on", ctx);
|
|
380
|
+
const started = await runBeforeAgentStart(captured, ctx);
|
|
381
|
+
const bootMsg = started.result?.message;
|
|
382
|
+
assert.equal(bootMsg?.customType, BOOT_TYPE, "re-enabling after native compaction injects a fresh boot");
|
|
383
|
+
assert.deepEqual(bootMsg?.details, { windowId }, "the fresh boot stays on the branch's logical window");
|
|
384
|
+
sessionManager.appendCustomMessageEntry(BOOT_TYPE, bootMsg.content, false, bootMsg.details);
|
|
385
|
+
const afterCompactOn = await runContextWithSystemHook(captured, ctx, sessionManager.buildSessionProjection().messages);
|
|
386
|
+
const onMessages = (afterCompactOn?.messages ?? []);
|
|
387
|
+
const onJson = JSON.stringify(onMessages);
|
|
388
|
+
assert.ok(onJson.includes("NATIVE_COMPACT_SUMMARY"), "re-enabling notesoup preserves the native compaction summary");
|
|
389
|
+
assert.equal(onMessages.some((m) => m.role === "custom" && m.customType === BOOT_TYPE), true);
|
|
390
|
+
const low = context(sessionManager, undefined, { tokens: 170_000, contextWindow: 200_000, percent: 85 });
|
|
391
|
+
const budgetHook = await runContextHook(captured, low);
|
|
392
|
+
const budgetMessages = (budgetHook?.messages ?? []);
|
|
393
|
+
assert.equal(budgetMessages.some((m) => m.role === "custom" && m.customType === WARNING_TYPE), true, "warning eligibility resets after native compaction");
|
|
394
|
+
});
|
|
395
|
+
test("native compaction that retains an earlier reset boot does not slice away the native summary", async () => {
|
|
396
|
+
const sessionManager = manager();
|
|
397
|
+
const captured = makeExtension(sessionManager);
|
|
398
|
+
const ctx = context(sessionManager);
|
|
399
|
+
const windowId = "pcw:test:retained-boot";
|
|
400
|
+
sessionManager.appendCompaction("", null, 0);
|
|
401
|
+
sessionManager.appendCustomEntry(RESET_MARKER_TYPE, { windowId });
|
|
402
|
+
const bootId = sessionManager.appendCustomMessageEntry(BOOT_TYPE, "retained boot", false, { windowId });
|
|
403
|
+
appendText(sessionManager, "user", "kept user turn");
|
|
404
|
+
await runCommand(captured, "notesoup", "off", ctx);
|
|
405
|
+
sessionManager.appendCompaction("RETAINED_BOOT_NATIVE_SUMMARY", bootId, 12_000);
|
|
406
|
+
const projectedOff = await runContextWithSystemHook(captured, ctx, sessionManager.buildSessionProjection().messages);
|
|
407
|
+
const offMessages = (projectedOff?.messages ?? []);
|
|
408
|
+
assert.ok(JSON.stringify(offMessages).includes("RETAINED_BOOT_NATIVE_SUMMARY"));
|
|
409
|
+
assert.equal(offMessages.some((m) => m.role === "custom" && m.customType === BOOT_TYPE), false, "retained boot stays stripped while off");
|
|
410
|
+
await runCommand(captured, "notesoup", "on", ctx);
|
|
411
|
+
const started = await runBeforeAgentStart(captured, ctx);
|
|
412
|
+
assert.equal(started.result, undefined, "retained boot is reused without emitting a duplicate");
|
|
413
|
+
const projectedOn = await runContextWithSystemHook(captured, ctx, sessionManager.buildSessionProjection().messages);
|
|
414
|
+
const onMessages = (projectedOn?.messages ?? []);
|
|
415
|
+
assert.ok(JSON.stringify(onMessages).includes("RETAINED_BOOT_NATIVE_SUMMARY"));
|
|
416
|
+
assert.equal(onMessages.some((m) => m.role === "custom" && m.customType === BOOT_TYPE), true);
|
|
355
417
|
});
|
|
356
418
|
test("empty_brain uses one turn boundary and never calls ctx.compact", async () => {
|
|
357
419
|
const sessionManager = manager();
|
|
@@ -385,14 +447,17 @@ test("notesoup command toggles future work, /empty schedules a turn-end reset, a
|
|
|
385
447
|
appendText(sessionManager, "user", "hello");
|
|
386
448
|
const captured = makeExtension(sessionManager);
|
|
387
449
|
const low = context(sessionManager, undefined, { tokens: 170_000, contextWindow: 200_000, percent: 85 });
|
|
388
|
-
// On by default:
|
|
450
|
+
// On by default: the first input persists the root boot block.
|
|
389
451
|
await runHandlers(captured, "session_start", { reason: "startup" }, low);
|
|
452
|
+
assert.equal(captured.sent.length, 0, "startup alone is lazy");
|
|
453
|
+
await runInput(captured, low);
|
|
390
454
|
assert.equal(captured.sent.length, 1);
|
|
391
455
|
assert.equal(captured.sent[0]?.message.customType, BOOT_TYPE);
|
|
392
456
|
let notices = await runCommand(captured, "notesoup", "off", low);
|
|
393
457
|
assert.equal(await runContextHook(captured, low), undefined, "no guidance while off");
|
|
394
458
|
assert.equal(sentOf(captured, GUIDANCE_TYPE).length, 0, "no guidance persisted while off");
|
|
395
459
|
await runHandlers(captured, "session_start", { reason: "startup" }, low);
|
|
460
|
+
await runInput(captured, low);
|
|
396
461
|
assert.equal(captured.sent.length, 1, "no new boot block is persisted while off");
|
|
397
462
|
const offResultRaw = await call(captured, "empty_brain", {}, low);
|
|
398
463
|
assert.equal(offResultRaw.isError, true, "a refusal is a failed tool call, not a successful answer");
|
|
@@ -457,3 +522,57 @@ test("committed reset confirmation survives later work while repair refuses that
|
|
|
457
522
|
partial.appendCustomMessageEntry(CONTINUATION_TYPE, "continuation", false);
|
|
458
523
|
assert.equal(resetBoundaryCommitted(partialCtx, partialMarker, windowId), false, "a bare legacy marker is not evidence of a new checkpoint commit");
|
|
459
524
|
});
|
|
525
|
+
test("--no-notesoup starts disabled; /notesoup on overrides it and /notesoup reset returns to the flag default", async () => {
|
|
526
|
+
const sessionManager = manager();
|
|
527
|
+
const captured = makeExtension(sessionManager, undefined, { flags: { "no-notesoup": true } });
|
|
528
|
+
const ctx = context(sessionManager);
|
|
529
|
+
assert.deepEqual(captured.flags, ["no-notesoup"]);
|
|
530
|
+
const notesoupSkills = join(process.cwd(), "skills");
|
|
531
|
+
const skillPath = join(notesoupSkills, "notesoup", "SKILL.md");
|
|
532
|
+
await runHandlers(captured, "session_start", { reason: "startup" }, ctx);
|
|
533
|
+
await runInput(captured, ctx);
|
|
534
|
+
const disabled = await runBeforeAgentStart(captured, ctx, { skills: [{ name: "notesoup", filePath: skillPath }] });
|
|
535
|
+
assert.equal(captured.sent.length, 0, "the flag suppresses the root boot");
|
|
536
|
+
assert.equal(disabled.result, undefined, "no lazy boot sneaks in from before_agent_start");
|
|
537
|
+
assert.equal(disabled.event.systemPromptOptions.sections.notesoup_tools, undefined, "no tool directory");
|
|
538
|
+
assert.equal(disabled.event.systemPromptOptions.sections.notesoup_protocol, undefined, "no protocol teaching");
|
|
539
|
+
assert.deepEqual(disabled.event.systemPromptOptions.skills, [], "notesoup skills are filtered out");
|
|
540
|
+
assert.match((await runCommand(captured, "notesoup", "", ctx))[0]?.message ?? "", /notesoup off/);
|
|
541
|
+
const disabledMessages = [
|
|
542
|
+
{ role: "system", content: "", timestamp: 0, sections: { preamble: "p", notesoup_tools: "tools", notesoup_protocol: "protocol" },
|
|
543
|
+
toolsAdded: [...NOTESOUP_TOOL_NAMES].map((name) => ({ name, description: name, parameters: {} })) },
|
|
544
|
+
{ role: "custom", customType: MARKER_TYPE, content: "hidden marker", display: false, timestamp: 0 },
|
|
545
|
+
{ role: "user", content: "hello", timestamp: 0 },
|
|
546
|
+
];
|
|
547
|
+
const projected = await runContextWithSystemHook(captured, ctx, disabledMessages);
|
|
548
|
+
const providerMessages = projected?.messages;
|
|
549
|
+
assert.deepEqual(providerMessages[0]?.sections, { preamble: "p" }, "notesoup sections never reach the provider");
|
|
550
|
+
assert.equal(providerMessages[0]?.toolsAdded, undefined, "notesoup tools never reach the provider");
|
|
551
|
+
assert.equal(providerMessages.some((message) => message.role === "custom" && message.customType === MARKER_TYPE), false);
|
|
552
|
+
const on = await runCommand(captured, "notesoup", "on", ctx);
|
|
553
|
+
assert.match(on[0]?.message ?? "", /notesoup on/, "the branch override wins over the flag");
|
|
554
|
+
await runInput(captured, ctx);
|
|
555
|
+
assert.equal(sentOf(captured, BOOT_TYPE).length, 1, "an explicit on boots the root window");
|
|
556
|
+
const reset = await runCommand(captured, "notesoup", "reset", ctx);
|
|
557
|
+
assert.match(reset[0]?.message ?? "", /notesoup off/, "reset clears the branch override back to the flag");
|
|
558
|
+
const stillOff = await runBeforeAgentStart(captured, ctx, { skills: [{ name: "notesoup", filePath: skillPath }] });
|
|
559
|
+
assert.equal(stillOff.event.systemPromptOptions.sections.notesoup_tools, undefined);
|
|
560
|
+
assert.equal(stillOff.event.systemPromptOptions.skills.length, 0);
|
|
561
|
+
});
|
|
562
|
+
test("pi-souls naked state disables notesoup, /notesoup on overrides it, and /soul naked off restores the default", async () => {
|
|
563
|
+
const sessionManager = manager();
|
|
564
|
+
const captured = makeExtension(sessionManager);
|
|
565
|
+
const ctx = context(sessionManager);
|
|
566
|
+
captured.events.on("pi-souls:state", (data) => { data.naked = true; });
|
|
567
|
+
assert.match((await runCommand(captured, "notesoup", "", ctx))[0]?.message ?? "", /notesoup off/, "a naked run starts disabled");
|
|
568
|
+
assert.match((await runCommand(captured, "notesoup", "on", ctx))[0]?.message ?? "", /notesoup on/, "/notesoup on overrides pi-souls");
|
|
569
|
+
assert.match((await runCommand(captured, "notesoup", "", ctx))[0]?.message ?? "", /notesoup on/, "the explicit choice outranks the naked signal");
|
|
570
|
+
// The durable fallback entry, as written by pi-souls when its extension is not loaded.
|
|
571
|
+
const fallback = manager();
|
|
572
|
+
const fallbackCaptured = makeExtension(fallback);
|
|
573
|
+
const fallbackCtx = context(fallback);
|
|
574
|
+
fallback.appendCustomEntry("pi-souls:naked", { naked: true });
|
|
575
|
+
assert.match((await runCommand(fallbackCaptured, "notesoup", "", fallbackCtx))[0]?.message ?? "", /notesoup off/, "the naked entry disables on its own");
|
|
576
|
+
fallback.appendCustomEntry("pi-souls:naked", { naked: false });
|
|
577
|
+
assert.match((await runCommand(fallbackCaptured, "notesoup", "", fallbackCtx))[0]?.message ?? "", /notesoup on/, "/soul naked off re-enables notesoup when no explicit choice exists");
|
|
578
|
+
});
|
|
@@ -9,7 +9,7 @@ import { renderBootBlock } from "../src/boot/render.js";
|
|
|
9
9
|
import { unavailableNotesSnapshot } from "../src/boot/snapshot.js";
|
|
10
10
|
import { DEFAULT_BOOT_TOOL_NAMES } from "../src/boot/text.js";
|
|
11
11
|
import { allItems, eventDocument } from "../src/history/history.js";
|
|
12
|
-
import { historyList, historyRead } from "../src/tools/history.js";
|
|
12
|
+
import { historyList, historySearch, historyRead } from "../src/tools/history.js";
|
|
13
13
|
import { TOOL_OUTPUT_MAX_BYTES } from "../src/tools/output.js";
|
|
14
14
|
import { dispatch } from "../plugins/claude/src/helper.js";
|
|
15
15
|
import { writePiTranscript } from "./helpers/history-corpus.js";
|
|
@@ -44,7 +44,7 @@ test("Claude helper resolves foreign history without requiring a current append
|
|
|
44
44
|
assert.ok(read.ok);
|
|
45
45
|
assert.match(read.text, /^session pi:foreign-pi \| seq 1 \| user/);
|
|
46
46
|
assert.match(read.text, /foreign needle/);
|
|
47
|
-
const list = await invoke("
|
|
47
|
+
const list = await invoke("history_search", { session: "pi:*", query: "needle" });
|
|
48
48
|
assert.ok(list.ok);
|
|
49
49
|
assert.match(list.text, /session pi:foreign-pi/);
|
|
50
50
|
const invalid = await invoke("history_read", { session: "*", seq: 1 });
|
|
@@ -90,7 +90,7 @@ test("Claude append and result arrival preserve call addresses and use the share
|
|
|
90
90
|
const resultRead = await historyRead.execute({ seq: 7 }, completed);
|
|
91
91
|
assert.ok(resultRead.ok);
|
|
92
92
|
assert.equal(resultRead.data.seq, 3);
|
|
93
|
-
const search = await
|
|
93
|
+
const search = await historySearch.execute({ query: "output one" }, completed);
|
|
94
94
|
assert.ok(search.ok);
|
|
95
95
|
assert.deepEqual(search.data.items.map((item) => "seq" in item ? item.seq : -1), [3]);
|
|
96
96
|
});
|
|
@@ -286,7 +286,7 @@ test("Claude gaps retain only confirmed suffixes, keep pairing/seqs, and disappe
|
|
|
286
286
|
assert.equal(incomplete.pairedResults.get(6), 4);
|
|
287
287
|
assert.equal(incomplete.highestSeq, 7);
|
|
288
288
|
assert.match(incomplete.windows[0].windowId, /:unknown:missing$/);
|
|
289
|
-
const suffix = await
|
|
289
|
+
const suffix = await historySearch.execute({ query: "searchable suffix" }, incomplete);
|
|
290
290
|
assert.ok(suffix.ok);
|
|
291
291
|
assert.deepEqual(suffix.data.items.map((item) => "seq" in item ? item.seq : -1), [3]);
|
|
292
292
|
const tool = await historyRead.execute({ seq: 4 }, incomplete);
|
|
@@ -314,7 +314,7 @@ test("Claude helper reports gaps on list/read and re-anchors reset state only wi
|
|
|
314
314
|
const invoke = (tool, params = {}) => dispatch({ op: "tool", tool, params, identity, history });
|
|
315
315
|
writeFileSync(transcriptPath, jsonl(rows));
|
|
316
316
|
for (const [tool, params] of [["history_list", {}], ["history_read", { seq: 2 }],
|
|
317
|
-
["
|
|
317
|
+
["history_search", { query: "no matches" }], ["history_read", { seq: 99 }]]) {
|
|
318
318
|
const response = await invoke(tool, params);
|
|
319
319
|
assert.match(response.text, /"missing"/, "the gap evidence still names the missing ancestor");
|
|
320
320
|
assert.doesNotMatch(response.text, /do not expose/);
|
|
@@ -341,7 +341,7 @@ test("Claude helper reports gaps on list/read and re-anchors reset state only wi
|
|
|
341
341
|
assert.deepEqual(await dispatch({ op: "history_state", identity, history }), { window: 8 }, "never windows.length - 1");
|
|
342
342
|
const anchoredRead = await invoke("history_read", { seq: 6 });
|
|
343
343
|
assert.match(anchoredRead.text, /history is incomplete/);
|
|
344
|
-
assert.match(anchoredRead.text, /seq 6 \| user
|
|
344
|
+
assert.match(anchoredRead.text, /seq 6 \| user(?: \| [^|\n]+)?\n/);
|
|
345
345
|
rows.push(compact("next", "after"), row("next-boot", "next", "user", bootText(9)), user("latest", "next-boot", "latest"));
|
|
346
346
|
writeFileSync(transcriptPath, jsonl(rows));
|
|
347
347
|
history.headUuid = "latest";
|
|
@@ -386,13 +386,13 @@ test("Claude gap notices participate in list/read budgets without changing read
|
|
|
386
386
|
return response.text;
|
|
387
387
|
};
|
|
388
388
|
const first = await invoke("history_read", { seq: 1, max_chars: 50000 });
|
|
389
|
-
const offset = Number(/\[truncated; continue at offset_chars=(\d+)\]$/.exec(first)?.[1]);
|
|
389
|
+
const offset = Number(/\[truncated at \d+\/\d+ chars; continue at offset_chars=(\d+)\]$/.exec(first)?.[1]);
|
|
390
390
|
assert.ok(offset > 0 && offset < text.length);
|
|
391
|
-
const firstBody = /\n\n(x+)\n\n\[truncated
|
|
391
|
+
const firstBody = /\n\n(x+)\n\n\[truncated at /.exec(first)?.[1];
|
|
392
392
|
assert.equal(firstBody, text.slice(0, offset), "the footer addresses the first undelivered character, not the decorated text");
|
|
393
393
|
const rest = await invoke("history_read", { seq: 1, offset_chars: offset, max_chars: 50000 });
|
|
394
394
|
assert.equal(/\n\n(x+)$/.exec(rest)?.[1], text.slice(offset));
|
|
395
|
-
assert.doesNotMatch(rest, /\[truncated
|
|
395
|
+
assert.doesNotMatch(rest, /\[truncated at /);
|
|
396
396
|
await invoke("history_list", { max_chars_per_item: 50000 });
|
|
397
397
|
});
|
|
398
398
|
test("Claude helper history tools reuse shared schemas, outcomes and text rendering from a supplied path", async (t) => {
|
|
@@ -406,12 +406,13 @@ test("Claude helper history tools reuse shared schemas, outcomes and text render
|
|
|
406
406
|
const identity = { home: join(root, "notes"), sessionId, cwd: root, agent: "claude", model: "claude" };
|
|
407
407
|
const history = { sessionId, transcriptPath, headUuid: "r" };
|
|
408
408
|
const projection = await readClaudeHistory(history);
|
|
409
|
-
const operations = [historyList, historyRead];
|
|
409
|
+
const operations = [historyList, historySearch, historyRead];
|
|
410
410
|
for (const operation of operations) {
|
|
411
|
-
const params = operation.name === "history_read" ? { seq: 3 } : {};
|
|
411
|
+
const params = operation.name === "history_read" ? { seq: 3 } : operation.name === "history_search" ? { query: "remember" } : {};
|
|
412
412
|
const actual = await dispatch({ op: "tool", tool: operation.name, params, identity, history });
|
|
413
|
-
const expected = operation
|
|
414
|
-
|
|
413
|
+
const expected = { text: operation === historyRead ? historyRead.render(await historyRead.execute({ seq: 3 }, projection))
|
|
414
|
+
: operation === historySearch ? historySearch.render(await historySearch.execute({ query: "remember" }, projection))
|
|
415
|
+
: historyList.render(await historyList.execute({}, projection)), ok: true };
|
|
415
416
|
assert.deepEqual(actual, expected);
|
|
416
417
|
}
|
|
417
418
|
assert.deepEqual(await dispatch({ op: "history_state", identity, history }), { window: 0 });
|
|
@@ -124,7 +124,7 @@ test("Claude notes survive removal of the session's worktree cwd", async (t) =>
|
|
|
124
124
|
});
|
|
125
125
|
test("Claude helper exposes the shared notes/history schemas", async () => {
|
|
126
126
|
const schemas = await dispatch({ op: "schemas" });
|
|
127
|
-
assert.deepEqual(schemas.map((schema) => schema.name), ["notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_read"]);
|
|
127
|
+
assert.deepEqual(schemas.map((schema) => schema.name), ["notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_search", "history_read"]);
|
|
128
128
|
assert.ok(schemas.every((schema) => schema.description.length > 20 && schema.inputSchema.type === "object"));
|
|
129
129
|
});
|
|
130
130
|
test("Claude helper delivers only shared rendered text and success", async () => {
|
|
@@ -155,7 +155,7 @@ test("Claude helper rejects malformed or unknown requests", async () => {
|
|
|
155
155
|
const malformed = JSON.parse(await handleLine("not json"));
|
|
156
156
|
assert.equal(malformed.ok, false);
|
|
157
157
|
assert.match(malformed.error, /Unexpected|malformed/);
|
|
158
|
-
const unknown = JSON.parse(await handleLine(JSON.stringify({ op: "tool", tool: "
|
|
158
|
+
const unknown = JSON.parse(await handleLine(JSON.stringify({ op: "tool", tool: "history_unknown", identity, params: {} })));
|
|
159
159
|
assert.equal(unknown.ok, false);
|
|
160
160
|
assert.equal(unknown.error, "unknown tool");
|
|
161
161
|
});
|
|
@@ -328,7 +328,7 @@ test("Claude Mod helper runs from a standalone copied plugin directory", () => {
|
|
|
328
328
|
}));
|
|
329
329
|
const schemas = run('{"op":"schemas"}');
|
|
330
330
|
assert.equal(schemas.ok, true);
|
|
331
|
-
assert.equal(schemas.result?.length,
|
|
331
|
+
assert.equal(schemas.result?.length, 7);
|
|
332
332
|
assert.equal(run("not json").ok, false);
|
|
333
333
|
}
|
|
334
334
|
finally {
|
|
@@ -524,7 +524,7 @@ test("Claude Mod hook delivers the helper's shared text, and marks only a refusa
|
|
|
524
524
|
const handlers = new Map();
|
|
525
525
|
hooks.register((event, handler) => handlers.set(event, handler));
|
|
526
526
|
await handlers.get("session.start")(host, { cwd: home, isInteractive: true }, async (event) => event);
|
|
527
|
-
assert.deepEqual(registered.map((spec) => spec.name), ["empty_brain", "notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_read"]);
|
|
527
|
+
assert.deepEqual(registered.map((spec) => spec.name), ["empty_brain", "notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_search", "history_read"]);
|
|
528
528
|
for (const spec of registered) {
|
|
529
529
|
assert.equal(spec.isDeferred, false, `${spec.name} is available from the start without tool search`);
|
|
530
530
|
assert.ok(spec.description.length > 20);
|
|
@@ -1079,7 +1079,7 @@ test("Claude Mod skips the warning when thresholds cannot be resolved", async (t
|
|
|
1079
1079
|
assert.equal(notifications.filter((text) => text.includes("Brain size unknown")).length, 1, "one line, not one per turn");
|
|
1080
1080
|
});
|
|
1081
1081
|
test("Claude skill projections stay byte-identical to canonical shared files", () => {
|
|
1082
|
-
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/
|
|
1082
|
+
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/notesoup/SKILL.md")), readFileSync(join(process.cwd(), "skills/notesoup/SKILL.md")));
|
|
1083
1083
|
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/dream/SKILL.md")), readFileSync(join(process.cwd(), "skills/dream/SKILL.md")));
|
|
1084
1084
|
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/playbook.md")), readFileSync(join(process.cwd(), "playbook.md")));
|
|
1085
1085
|
const skill = readFileSync(join(process.cwd(), "plugins/claude/skills/dream/SKILL.md"), "utf8");
|
|
@@ -1848,7 +1848,9 @@ test("Claude history keeps classic transcript_path across startup, confirms appe
|
|
|
1848
1848
|
assert.doesNotMatch(listed.result, /another branch/);
|
|
1849
1849
|
const boot = await invoke("prompt.context", {}, { blocks: [] });
|
|
1850
1850
|
assert.match(boot.blocks[0].text, /mcp__notesoup__history_\*/);
|
|
1851
|
-
const
|
|
1851
|
+
const search = await call("history_search", { query: "startup injection" });
|
|
1852
|
+
assert.match(search.result, /startup injection/);
|
|
1853
|
+
const subagent = await call("history_search", {}, "worker");
|
|
1852
1854
|
assert.equal(subagent.isError, true);
|
|
1853
1855
|
assert.match(subagent.result, /unavailable for subagents/);
|
|
1854
1856
|
// Subagent classic payloads/append results must not overwrite the main binding.
|
|
@@ -1867,6 +1869,7 @@ test("Claude history keeps classic transcript_path across startup, confirms appe
|
|
|
1867
1869
|
await call("notes_list");
|
|
1868
1870
|
assert.equal(budgets.get("history_list"), 120_000);
|
|
1869
1871
|
assert.equal(budgets.get("history_read"), 120_000);
|
|
1872
|
+
assert.equal(budgets.get("history_search"), 120_000);
|
|
1870
1873
|
assert.equal(budgets.get("notes_list"), 10_000);
|
|
1871
1874
|
assert.equal(budgets.get("history_state"), 10_000);
|
|
1872
1875
|
});
|
|
@@ -9,7 +9,7 @@ import { readCodexHistory } from "../src/history/codex.js";
|
|
|
9
9
|
import { readCodexTranscriptState } from "../src/history/codex-transcript.js";
|
|
10
10
|
import { createCodexTranscriptReader } from "../src/history/codex-transcript.js";
|
|
11
11
|
import { allItems, eventDocument } from "../src/history/history.js";
|
|
12
|
-
import { historyList, historyRead } from "../src/tools/history.js";
|
|
12
|
+
import { historyList, historySearch, historyRead } from "../src/tools/history.js";
|
|
13
13
|
/* Producer-shaped synthetic fixtures, not captured/private transcripts.
|
|
14
14
|
* Frozen official rust-v0.160.1, d27764b82f7118f674371e6d6e76271d9d606edb:
|
|
15
15
|
* - history/src/{lib.rs,rollout_payload.rs}: flattened JSONL envelope, top-level
|
|
@@ -180,7 +180,7 @@ test("root: raw messages, top-level envelope metadata, native tool pairing and n
|
|
|
180
180
|
const omitted = await historyRead.execute({ seq: 6 }, projection);
|
|
181
181
|
assert.ok(!omitted.ok);
|
|
182
182
|
assert.equal(omitted.error.code, "unknown_seq");
|
|
183
|
-
const page = await
|
|
183
|
+
const page = await historySearch.execute({ query: "printf output" }, projection);
|
|
184
184
|
assert.ok(page.ok);
|
|
185
185
|
assert.equal(page.data.items.length, 1);
|
|
186
186
|
assert.equal(page.data.items[0]?.seq, 7);
|
|
@@ -372,12 +372,24 @@ test("header-only native facts exist before any compaction, but absent facts are
|
|
|
372
372
|
await appendFile(f.path, jsonl([row("response_item", message("user", "unaddressable"), 1)]));
|
|
373
373
|
await assert.rejects(readCodexHistory(source), /native window identity missing/);
|
|
374
374
|
});
|
|
375
|
+
test("producer version is informational; 0.171.0 tool catalog preserves ordinal coordinates", async (t) => {
|
|
376
|
+
const f = await fixture(t), source = { transcriptPath: f.path, threadId: ROOT };
|
|
377
|
+
await writeFile(f.path, jsonl([
|
|
378
|
+
row("session_meta", meta(ROOT, { cli_version: "0.171.0" }), 0),
|
|
379
|
+
row("response_item", { type: "additional_tools", id: "at_test", role: "developer", tools: [{ type: "namespace", name: "functions", tools: [] }] }, 1),
|
|
380
|
+
row("response_item", message("user", "live shape"), 2),
|
|
381
|
+
]));
|
|
382
|
+
const parsed = await readCodexHistory(source);
|
|
383
|
+
assert.equal(parsed.cliVersion, "0.171.0");
|
|
384
|
+
assert.deepEqual(parsed.projection.windows.flatMap((w) => w.items).map((item) => [item.seq, item.text]), [[3, "live shape"]]);
|
|
385
|
+
});
|
|
375
386
|
test("committed malformed, unsupported, unsafe and unproved native shapes refuse explicitly", async (t) => {
|
|
376
387
|
const f = await fixture(t), source = { transcriptPath: f.path, threadId: ROOT };
|
|
377
388
|
await assert.rejects(readCodexHistory(source), /ENOENT/);
|
|
378
389
|
const head = row("session_meta", meta(), 0);
|
|
379
390
|
for (const [rows, expected] of [
|
|
380
|
-
[[row("session_meta", meta(ROOT, { cli_version:
|
|
391
|
+
[[row("session_meta", meta(ROOT, { cli_version: 171 }), 0)], /session_meta.cli_version/],
|
|
392
|
+
[[head, row("response_item", { type: "additional_tools", role: "developer", tools: {} }, 1)], /Invalid Codex additional_tools/],
|
|
381
393
|
[[head, row("future_record", {}, 1)], /Unsupported Codex rollout record/],
|
|
382
394
|
[[head, row("response_item", { type: "future_item" }, 1)], /Unsupported Codex response/],
|
|
383
395
|
[[head, row("response_item", message("user", "x"))], /paginated record ordinal/],
|