notesoup 0.46.1 → 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/boot/text.d.ts +2 -2
- package/dist/src/boot/text.js +4 -4
- package/dist/src/budget/text.d.ts +4 -4
- package/dist/src/budget/text.js +3 -3
- package/dist/src/dsh/index.js +1 -1
- package/dist/src/dsh/tools.js +2 -2
- package/dist/src/pi/budget.js +1 -1
- package/dist/src/pi/reset/artifacts.d.ts +1 -1
- package/dist/src/pi/reset/artifacts.js +1 -1
- package/dist/src/pi/reset/lifecycle.js +2 -2
- package/dist/src/pi/runtime.js +18 -17
- package/dist/test/agent-loop.test.js +45 -45
- package/dist/test/boot.integration.test.js +16 -16
- package/dist/test/budget-settings.integration.test.js +1 -1
- package/dist/test/claude-mod.test.js +13 -13
- package/dist/test/dependencies.test.js +2 -2
- package/dist/test/dsh-cli.test.js +1 -1
- package/dist/test/dsh.test.js +7 -7
- package/dist/test/host-neutral.test.js +1 -1
- package/dist/test/notes.integration.test.js +1 -1
- package/dist/test/reset-lifecycle.test.js +14 -14
- package/docs/architecture.md +1 -1
- package/docs/dsh.md +3 -3
- package/docs/reset-lifecycle.md +6 -6
- package/docs/tool-results.md +1 -1
- package/mods/notesoup/.claude-plugin/plugin.json +1 -1
- package/mods/notesoup/dist/claude/helper.js +5 -5
- package/mods/notesoup/hooks/register.ts +16 -16
- package/mods/notesoup/skills/memory/SKILL.md +1 -1
- package/package.json +2 -2
- package/skills/memory/SKILL.md +1 -1
- package/src/boot/text.ts +4 -4
- package/src/budget/text.ts +3 -3
- package/src/dsh/index.ts +1 -1
- package/src/dsh/tools.ts +2 -2
- package/src/pi/budget.ts +1 -1
- package/src/pi/reset/artifacts.ts +1 -1
- package/src/pi/reset/lifecycle.ts +2 -2
- package/src/pi/runtime.ts +18 -17
|
@@ -88,7 +88,7 @@ async function openFixture(options) {
|
|
|
88
88
|
settingsManager,
|
|
89
89
|
sessionManager,
|
|
90
90
|
resourceLoader: loader,
|
|
91
|
-
tools: options.tools ?? ["
|
|
91
|
+
tools: options.tools ?? ["empty_brain", "notes_write", "get_context_remaining"],
|
|
92
92
|
});
|
|
93
93
|
session = created.session;
|
|
94
94
|
session.subscribe((event) => events.push(event));
|
|
@@ -124,13 +124,13 @@ async function openFixture(options) {
|
|
|
124
124
|
await session.bindExtensions({
|
|
125
125
|
uiContext: {
|
|
126
126
|
notify(message, type) {
|
|
127
|
-
if (message === "🥣
|
|
127
|
+
if (message === "🥣 Brain emptied") {
|
|
128
128
|
const marker = sessionManager.getBranch().filter((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE).at(-1);
|
|
129
129
|
const windowId = marker?.data?.windowId;
|
|
130
130
|
assert.ok(sessionManager.getBranch().some((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE && entry.data?.windowId === windowId), "notification follows the reset marker commit");
|
|
131
131
|
assert.ok(sessionManager.getBranch().some((entry) => entry.type === "custom_message" && entry.customType === BOOT_TYPE && entry.details?.windowId === windowId), "notification follows the reset boot commit");
|
|
132
132
|
}
|
|
133
|
-
if (type === "warning" && /^🥣
|
|
133
|
+
if (type === "warning" && /^🥣 Brain almost full/.test(message))
|
|
134
134
|
budgetNotices++;
|
|
135
135
|
notices.push(message);
|
|
136
136
|
},
|
|
@@ -386,7 +386,7 @@ test("real AgentSession: final warning survives its reset boundary and notifies
|
|
|
386
386
|
return assistant(fixture, [{ type: "toolCall", id: "final-budget-probe-2", name: "get_context_remaining", arguments: {} }], "toolUse", { usage: usage(60_000) });
|
|
387
387
|
if (request === 3) {
|
|
388
388
|
assert.ok(text(context).includes(WARNING_JSON), "the final warning reaches the model");
|
|
389
|
-
return assistant(fixture, [{ type: "toolCall", id: "final-budget-wipe", name: "
|
|
389
|
+
return assistant(fixture, [{ type: "toolCall", id: "final-budget-wipe", name: "empty_brain", arguments: {} }], "toolUse", { usage: usage(60_000) });
|
|
390
390
|
}
|
|
391
391
|
return assistant(fixture, [{ type: "text", text: "fresh window ready" }]);
|
|
392
392
|
},
|
|
@@ -400,12 +400,12 @@ test("real AgentSession: final warning survives its reset boundary and notifies
|
|
|
400
400
|
assert.equal(fixture.sessionManager.getBranch().filter((entry) => entry.type === "custom_message" && entry.customType === WARNING_TYPE).length, 1);
|
|
401
401
|
assert.equal(resetMarkers(fixture).length, 1, "the reset commits in the same boundary as the final warning");
|
|
402
402
|
assert.equal(fixture.budgetNotices(), 1, "the old-window committed warning reaches the UI after reset");
|
|
403
|
-
assert.equal(fixture.notices.filter((notice) => notice === "🥣
|
|
403
|
+
assert.equal(fixture.notices.filter((notice) => notice === "🥣 Brain emptied").length, 1, "reset notification remains intact");
|
|
404
404
|
assert.equal(fixture.notices.some((notice) => notice.includes("Context running low")), false, "early guidance stays silent");
|
|
405
405
|
await fixture.session.prompt("Continue after reset.");
|
|
406
406
|
await fixture.session.waitForIdle();
|
|
407
407
|
assert.equal(fixture.budgetNotices(), 1, "later turns cannot repeat the consumed final warning");
|
|
408
|
-
assert.equal(fixture.notices.filter((notice) => notice === "🥣
|
|
408
|
+
assert.equal(fixture.notices.filter((notice) => notice === "🥣 Brain emptied").length, 1, "the prior reset notification is also deduplicated");
|
|
409
409
|
}
|
|
410
410
|
finally {
|
|
411
411
|
fixture.close();
|
|
@@ -417,7 +417,7 @@ test("real AgentSession: explicit tiny-session wipe ignores keepRecentTokens and
|
|
|
417
417
|
compactionEnabled: false,
|
|
418
418
|
keepRecentTokens: 1_000_000,
|
|
419
419
|
script: (request, context) => request === 1
|
|
420
|
-
? assistant(fixture, [{ type: "toolCall", id: "wipe-1", name: "
|
|
420
|
+
? assistant(fixture, [{ type: "toolCall", id: "wipe-1", name: "empty_brain", arguments: { last_word: "shoe" } }], "toolUse")
|
|
421
421
|
: assistant(fixture, [{ type: "text", text: "resumed in a new window" }]),
|
|
422
422
|
});
|
|
423
423
|
try {
|
|
@@ -425,7 +425,7 @@ test("real AgentSession: explicit tiny-session wipe ignores keepRecentTokens and
|
|
|
425
425
|
assert.equal(fixture.notices.length, 0, "startup boot is silent");
|
|
426
426
|
await fixture.session.prompt("OLD_CONTEXT_SENTINEL: retain this only in durable history.");
|
|
427
427
|
await fixture.session.waitForIdle();
|
|
428
|
-
assert.
|
|
428
|
+
assert.deepEqual(fixture.notices.filter((message) => message.includes("Brain emptied")), ["🥣 Brain emptied · last word: “shoe”"], "the reset notifies once, carrying the last word");
|
|
429
429
|
assert.equal(fixture.requests.length, 2, "the tool starts exactly one continuation");
|
|
430
430
|
assert.ok(text(fixture.requests[0]).includes("OLD_CONTEXT_SENTINEL"));
|
|
431
431
|
assertFreshRequest(fixture, 1, "OLD_CONTEXT_SENTINEL");
|
|
@@ -455,7 +455,7 @@ test("real AgentSession: manual command spans its tool batch and stops at settle
|
|
|
455
455
|
if (request === 1)
|
|
456
456
|
return assistant(fixture, [{ type: "text", text: "before manual reset" }]);
|
|
457
457
|
if (request === 2) {
|
|
458
|
-
assert.ok(text(context).includes(WARNING_JSON), "idle /
|
|
458
|
+
assert.ok(text(context).includes(WARNING_JSON), "idle /empty-brain sends the shared checkpoint prompt");
|
|
459
459
|
return assistant(fixture, [{ type: "toolCall", id: "manual-note", name: "notes_write", arguments: { address: "manual-a.md", content: "MANUAL_NOTE_ALPHA" } }], "toolUse");
|
|
460
460
|
}
|
|
461
461
|
assert.equal(request, 3, "the close-out turn finishes in the old window");
|
|
@@ -466,7 +466,7 @@ test("real AgentSession: manual command spans its tool batch and stops at settle
|
|
|
466
466
|
try {
|
|
467
467
|
await fixture.session.prompt("MANUAL_CLOSEOUT_OLD_SENTINEL");
|
|
468
468
|
await fixture.session.waitForIdle();
|
|
469
|
-
await fixture.session.prompt("/
|
|
469
|
+
await fixture.session.prompt("/empty-brain");
|
|
470
470
|
await fixture.session.waitForIdle();
|
|
471
471
|
assert.equal(fixture.requests.length, 3, "the run stops at settlement instead of continuing in the fresh window");
|
|
472
472
|
assert.equal(resetMarkers(fixture).length, 1);
|
|
@@ -495,7 +495,7 @@ test("real AgentSession: manual command spans its tool batch and stops at settle
|
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
497
|
test("real AgentSession: clear commands append a prompt after continuation and resume once", { timeout: 25000 }, async () => {
|
|
498
|
-
for (const mode of ["
|
|
498
|
+
for (const mode of ["empty-brain", "fresh-window", "hard-reserve", "overflow"]) {
|
|
499
499
|
let fixture;
|
|
500
500
|
const prompt = 'AFTER_CLEAR_PROMPT /cm "literal text"';
|
|
501
501
|
fixture = await openFixture({
|
|
@@ -520,7 +520,7 @@ test("real AgentSession: clear commands append a prompt after continuation and r
|
|
|
520
520
|
});
|
|
521
521
|
try {
|
|
522
522
|
await fixture.session.prompt("PROMPT_RESET_OLD_SENTINEL");
|
|
523
|
-
await fixture.session.prompt(`/${mode === "
|
|
523
|
+
await fixture.session.prompt(`/${mode === "empty-brain" ? "empty-brain" : "fresh-window"} ${prompt} `);
|
|
524
524
|
await fixture.session.waitForIdle();
|
|
525
525
|
assert.equal(fixture.requests.length, 3);
|
|
526
526
|
assert.equal(resetMarkers(fixture).length, 1);
|
|
@@ -531,7 +531,7 @@ test("real AgentSession: clear commands append a prompt after continuation and r
|
|
|
531
531
|
assert.equal(appended.customType, "notesoup/reset-prompt");
|
|
532
532
|
assert.equal(appended.content, prompt);
|
|
533
533
|
assert.equal(appended.display, true);
|
|
534
|
-
assert.ok(fixture.notices.some((notice) => notice.includes("
|
|
534
|
+
assert.ok(fixture.notices.some((notice) => notice.includes("Brain emptied")));
|
|
535
535
|
}
|
|
536
536
|
finally {
|
|
537
537
|
fixture.close();
|
|
@@ -584,13 +584,13 @@ test("real AgentSession: streaming clear prompt keeps the first request", { time
|
|
|
584
584
|
const running = fixture.session.prompt("streaming old work");
|
|
585
585
|
await ready;
|
|
586
586
|
await fixture.session.prompt("/fresh-window FIRST_RESET_PROMPT", { streamingBehavior: "steer" });
|
|
587
|
-
await fixture.session.prompt("/
|
|
587
|
+
await fixture.session.prompt("/empty-brain IGNORED_RESET_PROMPT", { streamingBehavior: "steer" });
|
|
588
588
|
release();
|
|
589
589
|
await running;
|
|
590
590
|
await fixture.session.waitForIdle();
|
|
591
591
|
assert.equal(fixture.requests.length, 3);
|
|
592
592
|
assert.equal(resetMarkers(fixture).length, 1);
|
|
593
|
-
assert.ok(fixture.notices.some((notice) => notice.includes("already
|
|
593
|
+
assert.ok(fixture.notices.some((notice) => notice.includes("Brain already being emptied")));
|
|
594
594
|
}
|
|
595
595
|
finally {
|
|
596
596
|
release();
|
|
@@ -610,18 +610,18 @@ test("real AgentSession: manual hard-reserve reset stops clean and mixed-tool tu
|
|
|
610
610
|
assert.equal(request, 2, "no provider work follows the manual safety reset");
|
|
611
611
|
return assistant(fixture, mixed ? [
|
|
612
612
|
{ type: "toolCall", id: "pressure-note", name: "notes_write", arguments: { address: "pressure.md", content: "PRESERVED_PRESSURE_NOTE" } },
|
|
613
|
-
{ type: "toolCall", id: "pressure-wipe", name: "
|
|
613
|
+
{ type: "toolCall", id: "pressure-wipe", name: "empty_brain", arguments: {} },
|
|
614
614
|
] : [{ type: "text", text: "close-out complete" }], mixed ? "toolUse" : "stop", { usage: usage(80_000) });
|
|
615
615
|
},
|
|
616
616
|
});
|
|
617
617
|
try {
|
|
618
618
|
await fixture.session.prompt("HARD_RESERVE_OLD_SENTINEL");
|
|
619
|
-
await fixture.session.prompt("/
|
|
619
|
+
await fixture.session.prompt("/empty-brain");
|
|
620
620
|
await fixture.session.waitForIdle();
|
|
621
621
|
assert.equal(fixture.requests.length, 2);
|
|
622
622
|
assert.equal(resetMarkers(fixture).length, 1, "the safety wipe is not repeated at settlement");
|
|
623
623
|
assert.equal(JSON.stringify(fixture.sessionManager.buildSessionProjection().messages).includes("HARD_RESERVE_OLD_SENTINEL"), false);
|
|
624
|
-
assert.ok(fixture.notices.some((notice) => notice.includes("
|
|
624
|
+
assert.ok(fixture.notices.some((notice) => notice.includes("Brain emptied")));
|
|
625
625
|
if (mixed) {
|
|
626
626
|
assert.ok(existsSync(join(fixture.notesRoot, "pi", "session", fixture.sessionManager.getSessionId(), "pressure.md")), "the whole tool batch completes before the cut");
|
|
627
627
|
assert.equal(fixture.streamSignals.at(-1), true, "Pi's unavoidable tool follow-up is cancelled before provider work");
|
|
@@ -664,7 +664,7 @@ test("real AgentSession: manual safety reset answers queued user input once befo
|
|
|
664
664
|
});
|
|
665
665
|
try {
|
|
666
666
|
await fixture.session.prompt("QUEUED_SAFETY_OLD_SENTINEL");
|
|
667
|
-
await fixture.session.prompt("/
|
|
667
|
+
await fixture.session.prompt("/empty-brain");
|
|
668
668
|
await fixture.session.waitForIdle();
|
|
669
669
|
assert.equal(fixture.requests.length, 4, "queued input is answered once after Pi's tool follow-up, then the stop lands");
|
|
670
670
|
assert.equal(resetMarkers(fixture).length, 1);
|
|
@@ -687,18 +687,18 @@ test("real AgentSession: manual overflow wipes and stops even with automatic res
|
|
|
687
687
|
});
|
|
688
688
|
try {
|
|
689
689
|
await fixture.session.prompt("MANUAL_OVERFLOW_OLD_SENTINEL");
|
|
690
|
-
await fixture.session.prompt("/
|
|
690
|
+
await fixture.session.prompt("/empty-brain");
|
|
691
691
|
await fixture.session.waitForIdle();
|
|
692
692
|
assert.equal(fixture.requests.length, 2);
|
|
693
693
|
assert.equal(resetMarkers(fixture).length, 1);
|
|
694
694
|
assert.equal(JSON.stringify(fixture.sessionManager.buildSessionProjection().messages).includes("MANUAL_OVERFLOW_OLD_SENTINEL"), false);
|
|
695
|
-
assert.ok(fixture.notices.some((notice) => notice.includes("
|
|
695
|
+
assert.ok(fixture.notices.some((notice) => notice.includes("Brain emptied")));
|
|
696
696
|
}
|
|
697
697
|
finally {
|
|
698
698
|
fixture.close();
|
|
699
699
|
}
|
|
700
700
|
});
|
|
701
|
-
test("real AgentSession: streaming /
|
|
701
|
+
test("real AgentSession: streaming /empty-brain steers a close-out and stops at settlement", { timeout: 20000 }, async () => {
|
|
702
702
|
let fixture;
|
|
703
703
|
let announceStarted;
|
|
704
704
|
let releaseResponse;
|
|
@@ -720,9 +720,9 @@ test("real AgentSession: streaming /neuralyze steers a close-out and stops at se
|
|
|
720
720
|
try {
|
|
721
721
|
const running = fixture.session.prompt("STREAMING_WIPE_OLD_SENTINEL");
|
|
722
722
|
await started;
|
|
723
|
-
await fixture.session.prompt("/
|
|
724
|
-
await fixture.session.prompt("/
|
|
725
|
-
assert.equal(fixture.notices.filter((notice) => notice.includes("
|
|
723
|
+
await fixture.session.prompt("/empty-brain", { streamingBehavior: "steer" });
|
|
724
|
+
await fixture.session.prompt("/empty-brain", { streamingBehavior: "followUp" });
|
|
725
|
+
assert.equal(fixture.notices.filter((notice) => notice.includes("Brain being emptied")).length, 1, "the user is notified once while output is ongoing");
|
|
726
726
|
assert.equal(resetMarkers(fixture).length, 0, "the ongoing turn is not interrupted");
|
|
727
727
|
releaseResponse();
|
|
728
728
|
await running;
|
|
@@ -731,7 +731,7 @@ test("real AgentSession: streaming /neuralyze steers a close-out and stops at se
|
|
|
731
731
|
assert.equal(fixture.requests.length, 2, "the warning closes out and the run stops — no continuation in the fresh window");
|
|
732
732
|
assert.equal(fixture.sessionManager.getBranch().filter((entry) => entry.type === "custom_message" && entry.customType === MANUAL_WIPE_TYPE).length, 1, "the busy warning is persisted once");
|
|
733
733
|
assert.equal(JSON.stringify(fixture.sessionManager.buildSessionProjection().messages).includes("STREAMING_WIPE_OLD_SENTINEL"), false);
|
|
734
|
-
assert.ok(fixture.notices.some((notice) => notice.includes("
|
|
734
|
+
assert.ok(fixture.notices.some((notice) => notice.includes("Brain emptied")), "the committed boundary has a separate success notice");
|
|
735
735
|
}
|
|
736
736
|
finally {
|
|
737
737
|
releaseResponse();
|
|
@@ -755,9 +755,9 @@ test("real AgentSession: repeated manual commands share one pending window", { t
|
|
|
755
755
|
},
|
|
756
756
|
});
|
|
757
757
|
try {
|
|
758
|
-
const first = fixture.session.prompt("/
|
|
758
|
+
const first = fixture.session.prompt("/empty-brain");
|
|
759
759
|
await started;
|
|
760
|
-
const second = fixture.session.prompt("/
|
|
760
|
+
const second = fixture.session.prompt("/empty-brain");
|
|
761
761
|
releaseResponse();
|
|
762
762
|
await Promise.all([first, second]);
|
|
763
763
|
await fixture.session.waitForIdle();
|
|
@@ -796,7 +796,7 @@ test("real AgentSession: user abort, synthetic aborted response, and generic err
|
|
|
796
796
|
await fixture.session.waitForIdle();
|
|
797
797
|
assert.equal(resetMarkers(fixture).length, 0, `${mode} does not force a reset`);
|
|
798
798
|
assert.equal(fixture.sessionManager.getBranch().filter((entry) => entry.type === "compaction").length, 0);
|
|
799
|
-
assert.equal(fixture.notices.some((notice) => notice.includes("
|
|
799
|
+
assert.equal(fixture.notices.some((notice) => notice.includes("Brain emptied")), false);
|
|
800
800
|
if (mode === "ctx-abort")
|
|
801
801
|
assert.equal(fixture.streamSignals.at(-1), true, "this case aborts the real Pi operation signal");
|
|
802
802
|
else
|
|
@@ -834,7 +834,7 @@ test("real AgentSession: steering and follow-up queued during a manual reset are
|
|
|
834
834
|
},
|
|
835
835
|
});
|
|
836
836
|
try {
|
|
837
|
-
const command = fixture.session.prompt("/
|
|
837
|
+
const command = fixture.session.prompt("/empty-brain");
|
|
838
838
|
await started;
|
|
839
839
|
if (delivery === "steer")
|
|
840
840
|
fixture.session.steer("QUEUED_DURING_FALLBACK");
|
|
@@ -859,7 +859,7 @@ test("real AgentSession: a reset survives all notes-home read failures with an i
|
|
|
859
859
|
compactionEnabled: false,
|
|
860
860
|
notesRootFile: true,
|
|
861
861
|
script: (request) => request === 1
|
|
862
|
-
? assistant(fixture, [{ type: "toolCall", id: "wipe-notes-failure", name: "
|
|
862
|
+
? assistant(fixture, [{ type: "toolCall", id: "wipe-notes-failure", name: "empty_brain", arguments: {} }], "toolUse")
|
|
863
863
|
: assistant(fixture, [{ type: "text", text: "resumed despite notes failure" }]),
|
|
864
864
|
});
|
|
865
865
|
try {
|
|
@@ -903,7 +903,7 @@ test("real AgentSession: reset projection drops legacy message shapes but keeps
|
|
|
903
903
|
},
|
|
904
904
|
script: (request, context) => {
|
|
905
905
|
if (request === 1)
|
|
906
|
-
return assistant(fixture, [{ type: "toolCall", id: "wipe-legacy", name: "
|
|
906
|
+
return assistant(fixture, [{ type: "toolCall", id: "wipe-legacy", name: "empty_brain", arguments: {} }], "toolUse");
|
|
907
907
|
if (request === 2) {
|
|
908
908
|
const body = text(context);
|
|
909
909
|
for (const legacy of legacyTexts)
|
|
@@ -939,10 +939,10 @@ test("real AgentSession: successive resets and a mixed tool batch cut only after
|
|
|
939
939
|
compactionEnabled: false,
|
|
940
940
|
script: (request) => {
|
|
941
941
|
if (scenario === "successive" && request < 3)
|
|
942
|
-
return assistant(fixture, [{ type: "toolCall", id: `wipe-${request}`, name: "
|
|
942
|
+
return assistant(fixture, [{ type: "toolCall", id: `wipe-${request}`, name: "empty_brain", arguments: {} }], "toolUse");
|
|
943
943
|
if (scenario === "mixed" && request === 1)
|
|
944
944
|
return assistant(fixture, [
|
|
945
|
-
{ type: "toolCall", id: "wipe-1", name: "
|
|
945
|
+
{ type: "toolCall", id: "wipe-1", name: "empty_brain", arguments: {} },
|
|
946
946
|
{ type: "toolCall", id: "note-1", name: "notes_write", arguments: { address: "batch.md", content: "MIXED_BATCH_NOTE" } },
|
|
947
947
|
], "toolUse");
|
|
948
948
|
return assistant(fixture, [{ type: "text", text: "fresh completion" }]);
|
|
@@ -977,7 +977,7 @@ test("real AgentSession: two retain-none checkpoints survive session-file reopen
|
|
|
977
977
|
compactionEnabled: false,
|
|
978
978
|
sessionDir,
|
|
979
979
|
script: (request) => request < 3
|
|
980
|
-
? assistant(fixture, [{ type: "toolCall", id: `persisted-wipe-${request}`, name: "
|
|
980
|
+
? assistant(fixture, [{ type: "toolCall", id: `persisted-wipe-${request}`, name: "empty_brain", arguments: {} }], "toolUse")
|
|
981
981
|
: assistant(fixture, [{ type: "text", text: "second reset window complete" }]),
|
|
982
982
|
});
|
|
983
983
|
try {
|
|
@@ -1013,7 +1013,7 @@ test("real AgentSession: two retain-none checkpoints survive session-file reopen
|
|
|
1013
1013
|
assert.ok(canonical.some((message) => message.role === "compactionSummary"), "the accepted empty-summary wrapper survives reload");
|
|
1014
1014
|
const system = getCurrentSystemMessage(canonical);
|
|
1015
1015
|
assert.ok(JSON.stringify(system).includes("Use the tools as requested."), "the complete system prompt survives the checkpoint");
|
|
1016
|
-
assert.ok(system?.toolsAdded?.some((tool) => tool.name === "
|
|
1016
|
+
assert.ok(system?.toolsAdded?.some((tool) => tool.name === "empty_brain"), "the active tool loadout survives reopen");
|
|
1017
1017
|
const reopenedMarkers = branch.filter((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
|
|
1018
1018
|
const latestMarker = reopenedMarkers.at(-1);
|
|
1019
1019
|
const previousMarker = reopenedMarkers[0];
|
|
@@ -1035,7 +1035,7 @@ test("real AgentSession: steering and follow-up are delivered exactly once in th
|
|
|
1035
1035
|
compactionEnabled: false,
|
|
1036
1036
|
hook: (pi, getSession) => {
|
|
1037
1037
|
pi.on("tool_call", async (event) => {
|
|
1038
|
-
if (event.toolName !== "
|
|
1038
|
+
if (event.toolName !== "empty_brain")
|
|
1039
1039
|
return;
|
|
1040
1040
|
if (deliverAs === "steer")
|
|
1041
1041
|
await getSession().steer("QUEUED_ONCE");
|
|
@@ -1044,7 +1044,7 @@ test("real AgentSession: steering and follow-up are delivered exactly once in th
|
|
|
1044
1044
|
});
|
|
1045
1045
|
},
|
|
1046
1046
|
script: (request) => request === 1
|
|
1047
|
-
? assistant(fixture, [{ type: "toolCall", id: "wipe-queue", name: "
|
|
1047
|
+
? assistant(fixture, [{ type: "toolCall", id: "wipe-queue", name: "empty_brain", arguments: {} }], "toolUse")
|
|
1048
1048
|
: assistant(fixture, [{ type: "text", text: "queued message handled" }]),
|
|
1049
1049
|
});
|
|
1050
1050
|
try {
|
|
@@ -1070,7 +1070,7 @@ test("real AgentSession: hidden or missing reset boots refuse to move the bounda
|
|
|
1070
1070
|
try {
|
|
1071
1071
|
await fixture.session.prompt("ROOT_BEFORE_HIDDEN_BOOT");
|
|
1072
1072
|
await fixture.session.waitForIdle();
|
|
1073
|
-
await fixture.session.prompt("/
|
|
1073
|
+
await fixture.session.prompt("/empty-brain");
|
|
1074
1074
|
await fixture.session.waitForIdle();
|
|
1075
1075
|
await fixture.session.prompt("VALID_POST_MARKER_WORK");
|
|
1076
1076
|
await fixture.session.waitForIdle();
|
|
@@ -1124,7 +1124,7 @@ test("real AgentSession: the complete system message and a changed tool loadout
|
|
|
1124
1124
|
fixture = await openFixture({
|
|
1125
1125
|
compactionEnabled: false,
|
|
1126
1126
|
systemPrompt: ["SYSTEM_SECTION_ALPHA", "SYSTEM_SECTION_BETA", "SYSTEM_TOOLS_SECTION", "SYSTEM_LOADOUT_SECTION"].join("\n"),
|
|
1127
|
-
tools: ["
|
|
1127
|
+
tools: ["empty_brain"],
|
|
1128
1128
|
script: (request, context) => {
|
|
1129
1129
|
const systemText = JSON.stringify(context.messages.filter((message) => message.role === "system"));
|
|
1130
1130
|
const currentSystem = getCurrentSystemMessage(context.messages);
|
|
@@ -1134,11 +1134,11 @@ test("real AgentSession: the complete system message and a changed tool loadout
|
|
|
1134
1134
|
assert.ok(systemText.includes("SYSTEM_TOOLS_SECTION"));
|
|
1135
1135
|
assert.ok(systemText.includes("SYSTEM_LOADOUT_SECTION"));
|
|
1136
1136
|
if (request === 1) {
|
|
1137
|
-
assert.deepEqual(effectiveToolNames, ["
|
|
1138
|
-
fixture.session.setActiveToolsByName(["
|
|
1139
|
-
return assistant(fixture, [{ type: "toolCall", id: "wipe-system", name: "
|
|
1137
|
+
assert.deepEqual(effectiveToolNames, ["empty_brain"]);
|
|
1138
|
+
fixture.session.setActiveToolsByName(["empty_brain", "get_context_remaining"]);
|
|
1139
|
+
return assistant(fixture, [{ type: "toolCall", id: "wipe-system", name: "empty_brain", arguments: {} }], "toolUse");
|
|
1140
1140
|
}
|
|
1141
|
-
assert.deepEqual(effectiveToolNames, ["
|
|
1141
|
+
assert.deepEqual(effectiveToolNames, ["empty_brain", "get_context_remaining"]);
|
|
1142
1142
|
assert.ok(JSON.stringify(context.messages).includes(CONTEXT_WINDOW_OPEN_TAG));
|
|
1143
1143
|
return assistant(fixture, [{ type: "text", text: "all system sections survived" }]);
|
|
1144
1144
|
},
|
|
@@ -1506,7 +1506,7 @@ test("real AgentSession: warning precedes a durable checkpoint, including failed
|
|
|
1506
1506
|
content: "CHECKPOINT_SENTINEL",
|
|
1507
1507
|
} }], "toolUse", { usage: usage(60_000) });
|
|
1508
1508
|
if (request === 4 && scenario !== "ignored-warning")
|
|
1509
|
-
return assistant(fixture, [{ type: "toolCall", id: "wipe-after-checkpoint", name: "
|
|
1509
|
+
return assistant(fixture, [{ type: "toolCall", id: "wipe-after-checkpoint", name: "empty_brain", arguments: {} }], "toolUse", { usage: usage(60_000) });
|
|
1510
1510
|
return assistant(fixture, [{ type: "text", text: scenario === "ignored-warning" ? "warning intentionally ignored" : "checkpoint and wipe complete" }], "stop", { usage: usage(60_000) });
|
|
1511
1511
|
},
|
|
1512
1512
|
});
|
|
@@ -19,7 +19,7 @@ test("custom reset marker removes old provider context while history remains sea
|
|
|
19
19
|
const oldUserId = appendText(sessionManager, "user", "OLD-UNIQUE-TRANSCRIPT needle");
|
|
20
20
|
appendText(sessionManager, "assistant", "I will use a tool");
|
|
21
21
|
const toolResultId = appendText(sessionManager, "toolResult", "tool result safely recorded");
|
|
22
|
-
await call(captured, "
|
|
22
|
+
await call(captured, "empty_brain", {}, ctx);
|
|
23
23
|
const boundary = await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
24
24
|
assert.equal(boundary.continue, true);
|
|
25
25
|
const branch = sessionManager.getBranch();
|
|
@@ -80,13 +80,13 @@ test("the root boot and reset boot carry durable window identity", async () => {
|
|
|
80
80
|
assert.match(rootText, /decisions\.md · (?:just now|\d+s ago)/, "boot note metadata carries a relative update time");
|
|
81
81
|
assert.ok(rootText.includes(CONTEXT_WINDOW_PROTOCOL_OPEN_TAG));
|
|
82
82
|
// Reset: the marker and boot are committed together at the turn boundary.
|
|
83
|
-
await call(captured, "
|
|
83
|
+
await call(captured, "empty_brain", {}, ctx);
|
|
84
84
|
assert.equal(noticesOf(ctx).length, 0, "requesting a reset does not announce success");
|
|
85
85
|
const boundary = await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
86
86
|
assert.equal(boundary.continue, true);
|
|
87
87
|
await runHandlers(captured, "turn_start", {}, ctx);
|
|
88
88
|
await runHandlers(captured, "agent_settled", {}, ctx);
|
|
89
|
-
assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("
|
|
89
|
+
assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("Brain emptied")).length, 1, "the committed reset is announced once");
|
|
90
90
|
const entries = sessionManager.getBranch();
|
|
91
91
|
const marker = entries.find((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
|
|
92
92
|
assert.ok(marker && marker.type === "custom");
|
|
@@ -115,7 +115,7 @@ test("an aborted async boot repair emits no boot, continuation, or incomplete-no
|
|
|
115
115
|
controller.abort();
|
|
116
116
|
await pending;
|
|
117
117
|
assert.equal(captured.sent.length, 0, "aborted snapshot work cannot append the reset boot or continuation");
|
|
118
|
-
assert.equal(noticesOf(ctx).some((notice) => notice.message.includes("
|
|
118
|
+
assert.equal(noticesOf(ctx).some((notice) => notice.message.includes("went missing")), false, "aborted snapshot work cannot notify about missing homes");
|
|
119
119
|
assert.equal(sessionManager.getBranch().some((entry) => entry.type === "custom_message" && [BOOT_TYPE, CONTINUATION_TYPE].includes(entry.customType)), false);
|
|
120
120
|
});
|
|
121
121
|
test("a marker tail with only metadata repairs its missing boot and continuation without moving the boundary", async () => {
|
|
@@ -201,22 +201,22 @@ test("off preserves an existing marker window and still cancels native compactio
|
|
|
201
201
|
const windows = resultData(await call(captured, "history_windows", {}, ctx));
|
|
202
202
|
assert.equal(windows.windows.at(-1)?.window_id, windowId);
|
|
203
203
|
});
|
|
204
|
-
test("
|
|
204
|
+
test("empty_brain uses one turn boundary and never calls ctx.compact", async () => {
|
|
205
205
|
const sessionManager = manager();
|
|
206
206
|
const captured = makeExtension(sessionManager);
|
|
207
207
|
const ctx = context(sessionManager, () => assert.fail("ctx.compact must not be used"));
|
|
208
208
|
appendText(sessionManager, "user", "enough history for the boundary test");
|
|
209
|
-
const result = resultJson(await call(captured, "
|
|
209
|
+
const result = resultJson(await call(captured, "empty_brain", {}, ctx));
|
|
210
210
|
assert.ok(result.status);
|
|
211
211
|
const boundary = await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
212
212
|
assert.equal(boundary.continue, true);
|
|
213
213
|
assert.equal(sessionManager.getBranch().filter((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE).length, 1);
|
|
214
214
|
assert.equal(sessionManager.getBranch().filter((entry) => entry.type === "custom_message" && entry.customType === BOOT_TYPE && entry.details && typeof entry.details === "object" && "windowId" in entry.details).length, 1);
|
|
215
215
|
});
|
|
216
|
-
test("/
|
|
216
|
+
test("/empty-brain waits out non-agent busy work before starting its single-turn request", async () => {
|
|
217
217
|
const sessionManager = manager();
|
|
218
218
|
const captured = makeExtension(sessionManager);
|
|
219
|
-
const cmd = captured.commands.get("
|
|
219
|
+
const cmd = captured.commands.get("empty-brain");
|
|
220
220
|
assert.ok(cmd);
|
|
221
221
|
let waits = 0;
|
|
222
222
|
const notices = [];
|
|
@@ -229,9 +229,9 @@ test("/neuralyze waits out non-agent busy work before starting its single-turn r
|
|
|
229
229
|
assert.equal(waits, 1);
|
|
230
230
|
assert.equal(captured.sent.length, 1);
|
|
231
231
|
assert.equal(captured.sent[0]?.options?.triggerTurn, true);
|
|
232
|
-
assert.equal(notices.filter((message) => message.includes("
|
|
232
|
+
assert.equal(notices.filter((message) => message.includes("Brain being emptied")).length, 1);
|
|
233
233
|
});
|
|
234
|
-
test("notesoup command toggles future work, /
|
|
234
|
+
test("notesoup command toggles future work, /empty-brain schedules a turn-end reset, and /compact remains disabled", async () => {
|
|
235
235
|
const sessionManager = manager();
|
|
236
236
|
appendText(sessionManager, "user", "hello");
|
|
237
237
|
const captured = makeExtension(sessionManager);
|
|
@@ -246,13 +246,13 @@ test("notesoup command toggles future work, /neuralyze schedules a turn-end rese
|
|
|
246
246
|
assert.equal(sentOf(captured, GUIDANCE_TYPE).length, 0, "no guidance persisted while off");
|
|
247
247
|
await runHandlers(captured, "session_start", { reason: "startup" }, low);
|
|
248
248
|
assert.equal(captured.sent.length, 1, "no new boot block is persisted while off");
|
|
249
|
-
const offResult = resultJson(await call(captured, "
|
|
250
|
-
assert.match(offResult.error ?? "", /off/, "
|
|
249
|
+
const offResult = resultJson(await call(captured, "empty_brain", {}, low));
|
|
250
|
+
assert.match(offResult.error ?? "", /off/, "empty_brain refuses while off");
|
|
251
251
|
notices = await runCommand(captured, "notesoup", "on", low);
|
|
252
252
|
assert.match(notices[0]?.message ?? "", /on/);
|
|
253
|
-
notices = await runCommand(captured, "
|
|
253
|
+
notices = await runCommand(captured, "empty-brain", "", low);
|
|
254
254
|
assert.equal(notices.length, 1, "the command acknowledges the reset request");
|
|
255
|
-
assert.match(notices[0]?.message ?? "", /
|
|
255
|
+
assert.match(notices[0]?.message ?? "", /Brain being emptied/);
|
|
256
256
|
assert.equal(captured.sent.length, 2, "the command persists one hidden warning after the startup boot");
|
|
257
257
|
assert.equal(captured.sent[1]?.options?.triggerTurn, true, "the manual checkpoint prompt starts an ordinary agent turn");
|
|
258
258
|
assert.equal(captured.sent[1]?.message.customType, MANUAL_WIPE_TYPE);
|
|
@@ -272,7 +272,7 @@ test("committed reset confirmation survives later work while repair refuses that
|
|
|
272
272
|
const sessionManager = manager();
|
|
273
273
|
const captured = makeExtension(sessionManager);
|
|
274
274
|
const ctx = context(sessionManager);
|
|
275
|
-
await call(captured, "
|
|
275
|
+
await call(captured, "empty_brain", {}, ctx);
|
|
276
276
|
await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
277
277
|
const marker = sessionManager.getBranch().find((entry) => entry.type === "custom" && entry.customType === RESET_MARKER_TYPE);
|
|
278
278
|
assert.ok(marker && marker.type === "custom");
|
|
@@ -283,7 +283,7 @@ test("committed reset confirmation survives later work while repair refuses that
|
|
|
283
283
|
assert.equal(resetBoundaryCommitted(ctx, marker.id, windowId), true, "later work does not undo a committed native boundary");
|
|
284
284
|
await runHandlers(captured, "agent_settled", {}, ctx);
|
|
285
285
|
await runHandlers(captured, "turn_start", {}, ctx);
|
|
286
|
-
assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("
|
|
286
|
+
assert.equal(noticesOf(ctx).filter((notice) => notice.message.includes("Brain emptied")).length, 1);
|
|
287
287
|
assert.equal(resetBoundaryCommitted(ctx, marker.id, "wrong-window"), false);
|
|
288
288
|
const partial = manager();
|
|
289
289
|
const partialCtx = context(partial);
|
|
@@ -40,7 +40,7 @@ test("early guidance stays silent and the committed final warning notifies once"
|
|
|
40
40
|
await commitTurnEndBoundary(captured, sm, final);
|
|
41
41
|
await runHandlers(captured, "turn_start", {}, final);
|
|
42
42
|
await runHandlers(captured, "agent_settled", {}, final);
|
|
43
|
-
assert.equal(noticesOf(final).filter((notice) => notice.message === "🥣
|
|
43
|
+
assert.equal(noticesOf(final).filter((notice) => notice.message === "🥣 Brain almost full · taking notes").length, 1, "only the committed final warning notifies, exactly once");
|
|
44
44
|
});
|
|
45
45
|
test("the visible countdown ends at the warning line, clamps at zero, and preserves unknown usage", async () => {
|
|
46
46
|
const fixture = settingsFixture({
|
|
@@ -116,7 +116,7 @@ test("Claude helper boot uses actual Claude note tool bindings and a fresh snaps
|
|
|
116
116
|
} });
|
|
117
117
|
assert.match(boot, /mcp__notesoup__notes_\*/);
|
|
118
118
|
assert.match(boot, /claude:session/);
|
|
119
|
-
assert.doesNotMatch(boot, /
|
|
119
|
+
assert.doesNotMatch(boot, /brain empty|continuation/);
|
|
120
120
|
});
|
|
121
121
|
test("Claude helper serves the shared reset prose and the host's wipe sentence", async () => {
|
|
122
122
|
const texts = await dispatch({ op: "texts" });
|
|
@@ -193,7 +193,7 @@ test("Claude helper resolves limits across the boundary and never throws on nons
|
|
|
193
193
|
assert.ok(nonsense.result.warn > 0 && nonsense.result.warn < 100);
|
|
194
194
|
});
|
|
195
195
|
test("Claude's wipe sentence replaces only that sentence in the shared protocol block", () => {
|
|
196
|
-
const piTools = { notes: "notes_*", notesList: "notes_list", history: "history_*", remaining: "get_context_remaining", wipe: "
|
|
196
|
+
const piTools = { notes: "notes_*", notesList: "notes_list", history: "history_*", remaining: "get_context_remaining", wipe: "empty_brain" };
|
|
197
197
|
const pi = renderProtocolBlock(piTools);
|
|
198
198
|
assert.ok(pi.includes(PROTOCOL_WIPE_SENTENCE), "Pi keeps the default sentence, byte for byte");
|
|
199
199
|
const claude = renderProtocolBlock({ ...piTools, wipeSentence: CLAUDE_WIPE_SENTENCE });
|
|
@@ -303,7 +303,7 @@ test("Claude Mod boot failure preserves fallback with available, absent, or fail
|
|
|
303
303
|
...upstream,
|
|
304
304
|
blocks: [...upstream.blocks, { name: "notesoup:boot", text: "# notesoup\nYour notes didn't load this time (helper exited unsuccessfully). Try `mcp__notesoup__notes_list`; if it fails too, tell the human." }],
|
|
305
305
|
}, "boot failure keeps the original fallback and upstream fields even if notify is absent or fails");
|
|
306
|
-
const expectedNotifications = mode === "no ui" || mode === "no toast" ? [] : ["🥣 Notes
|
|
306
|
+
const expectedNotifications = mode === "no ui" || mode === "no toast" ? [] : ["🥣 Notes went missing"];
|
|
307
307
|
assert.deepEqual(notifications, expectedNotifications, "one user-facing notification reports the notes boot failure");
|
|
308
308
|
assert.equal(bootRequests, 1);
|
|
309
309
|
assert.equal(nextCalls, 1);
|
|
@@ -371,7 +371,7 @@ test("Claude Mod resets at Claude's resolved point after the turn, retains one f
|
|
|
371
371
|
host.session.usage = async () => { throw new Error("usage unavailable"); };
|
|
372
372
|
await invoke("session.measure");
|
|
373
373
|
await invoke("turn.complete");
|
|
374
|
-
assert.equal(notifications.filter((text) => text.includes("
|
|
374
|
+
assert.equal(notifications.filter((text) => text.includes("Brain fullness unknown")).length, 1, "usage failure logs once per session");
|
|
375
375
|
host.session.usage = async () => measured();
|
|
376
376
|
await dispatch({ op: "tool", tool: "notes_write", identity: { ...identity, home, cwd: home, sessionId: "hook-session" }, params: { address: "@human/MAP.md", content: "FRESH_NOTES_AT_RESET" } });
|
|
377
377
|
await invoke("turn.start");
|
|
@@ -418,9 +418,9 @@ test("Claude Mod headless detection skips compaction and logs once", async (t) =
|
|
|
418
418
|
await invoke("session.measure");
|
|
419
419
|
await invoke("turn.complete");
|
|
420
420
|
assert.equal(attempts, 0, "headless sessions skip the unsupported capability from startup");
|
|
421
|
-
assert.deepEqual(notifications, ["🥣
|
|
422
|
-
const manual = await invoke("command.run", { command: "
|
|
423
|
-
assert.match(manual.text, /
|
|
421
|
+
assert.deepEqual(notifications, ["🥣 No brain when headless"]);
|
|
422
|
+
const manual = await invoke("command.run", { command: "empty-brain" });
|
|
423
|
+
assert.match(manual.text, /No brain when headless/);
|
|
424
424
|
assert.equal(notifications.length, 1);
|
|
425
425
|
const boot = await handlers.get("prompt.context")(host, {}, async () => ({ blocks: [] }));
|
|
426
426
|
assert.match(boot.blocks[0].text, /Current context window id: claude:hook-session:0/);
|
|
@@ -479,8 +479,8 @@ test("Claude Mod manual reset uses one hidden close-out turn, then recovers its
|
|
|
479
479
|
};
|
|
480
480
|
(await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
|
|
481
481
|
await invoke("session.start", { cwd: home, isInteractive: true });
|
|
482
|
-
const command = await invoke("command.run", { command: "
|
|
483
|
-
assert.match(command.text, /
|
|
482
|
+
const command = await invoke("command.run", { command: "empty-brain" });
|
|
483
|
+
assert.match(command.text, /Brain being emptied/);
|
|
484
484
|
await Promise.resolve();
|
|
485
485
|
assert.equal(compactions, 0, "command.run must not call compact under its held turn");
|
|
486
486
|
assert.equal(timers.length, 1);
|
|
@@ -497,7 +497,7 @@ test("Claude Mod manual reset uses one hidden close-out turn, then recovers its
|
|
|
497
497
|
await invoke("session.start", { cwd: home, isInteractive: true });
|
|
498
498
|
assert.deepEqual(await handlers.get("prompt.context")(host, {}, async () => ({ blocks: [] })), { blocks: [] }, "reload does not duplicate the already-retained boot");
|
|
499
499
|
await invoke("turn.start");
|
|
500
|
-
await invoke("command.run", { command: "
|
|
500
|
+
await invoke("command.run", { command: "empty-brain" });
|
|
501
501
|
await invoke("turn.complete");
|
|
502
502
|
assert.equal(prompts.length, 1, "a busy manual request reuses the current turn instead of submitting another");
|
|
503
503
|
assert.match(kept[0].text, /Current context window id: claude:hook-session:2/);
|
|
@@ -568,7 +568,7 @@ test("Claude Mod stops the automatic reset and the manual command under DISABLE_
|
|
|
568
568
|
await invoke("session.start", { cwd: home, isInteractive: true });
|
|
569
569
|
assert.equal(notifications.length, 1, "one startup line");
|
|
570
570
|
assert.match(notifications[0], /DISABLE_COMPACT/);
|
|
571
|
-
const manual = await invoke("command.run", { command: "
|
|
571
|
+
const manual = await invoke("command.run", { command: "empty-brain" });
|
|
572
572
|
assert.match(manual.text, /DISABLE_COMPACT/);
|
|
573
573
|
assert.equal(timers.length, 0, "no close-out turn is queued");
|
|
574
574
|
await invoke("turn.start");
|
|
@@ -595,7 +595,7 @@ test("Claude Mod skips the automatic reset when thresholds cannot be resolved",
|
|
|
595
595
|
await invoke("turn.complete");
|
|
596
596
|
await invoke("session.measure");
|
|
597
597
|
assert.equal(compactions, 0, "an unresolvable point never resets");
|
|
598
|
-
assert.equal(notifications.filter((text) => text.includes("
|
|
598
|
+
assert.equal(notifications.filter((text) => text.includes("Brain size unknown")).length, 1, "one line, not one per turn");
|
|
599
599
|
});
|
|
600
600
|
test("Claude skill projections stay byte-identical to canonical shared files", () => {
|
|
601
601
|
assert.deepEqual(readFileSync(join(process.cwd(), "mods/notesoup/skills/memory/SKILL.md")), readFileSync(join(process.cwd(), "skills/memory/SKILL.md")));
|
|
@@ -694,7 +694,7 @@ test("Claude session.end gives /clear, /resume and /branch a fresh boot and iden
|
|
|
694
694
|
host.session.usage = async () => ({ context: { tokens: 142_424, window: 200_000 } });
|
|
695
695
|
assert.equal((await context()).blocks[0]?.name, "notesoup:warning", "the old window has already warned");
|
|
696
696
|
await invoke("turn.start");
|
|
697
|
-
await invoke("command.run", { command: "
|
|
697
|
+
await invoke("command.run", { command: "empty-brain" });
|
|
698
698
|
const ended = { sentinel: action };
|
|
699
699
|
assert.equal(await invoke("session.end", { reason: action === "clear" ? "clear" : "resume", sessionId: "hook-session" }, ended), ended);
|
|
700
700
|
host.session.id = async () => `after-${action}`;
|
|
@@ -155,8 +155,8 @@ test("configured extension source and moved dream CLI are executable current ent
|
|
|
155
155
|
registerTool(tool) { tools.push(tool); },
|
|
156
156
|
registerCommand(name) { commands.push(name); },
|
|
157
157
|
});
|
|
158
|
-
assert.deepEqual(tools.map((tool) => tool.name).sort(), ["get_context_remaining", "history_list", "history_read", "history_windows", "
|
|
159
|
-
assert.deepEqual(commands.sort(), ["
|
|
158
|
+
assert.deepEqual(tools.map((tool) => tool.name).sort(), ["empty_brain", "get_context_remaining", "history_list", "history_read", "history_windows", "notes_list", "notes_read", "notes_search", "notes_update", "notes_write"]);
|
|
159
|
+
assert.deepEqual(commands.sort(), ["empty-brain", "fresh-window", "notesoup"]);
|
|
160
160
|
const help = execFileSync(process.execPath, [resolve(root, manifest.bin.dream), "--help"], { cwd: root, encoding: "utf8" });
|
|
161
161
|
assert.ok(help.startsWith("dream doctor [--notes-home <dir>]"));
|
|
162
162
|
assert.ok(help.includes("Default playbook: <installed package root>/playbook.md"));
|
|
@@ -28,7 +28,7 @@ test("dsh profile loads our rows and a second process restores the on-disk windo
|
|
|
28
28
|
await writeFile(join(profile, "cordis.patch.yml"), patch + "\n- id: session-title-llm\n disabled: true\n");
|
|
29
29
|
const env = { ...process.env, DSH_HOME: home, DEEPSEEK_API_KEY: "mock-key", DEEPSEEK_BASE_URL: mock.url, DSH_TOOLS_MODE: "native" };
|
|
30
30
|
const cli = resolve(repository, "node_modules/@deepseek-ai/dsh/lib/bin.js");
|
|
31
|
-
mock.script.push({ tool: "
|
|
31
|
+
mock.script.push({ tool: "empty_brain", input: {} }, { text: "after reset" });
|
|
32
32
|
const first = await exec(process.execPath, [cli, "--profile", "notesoup-test", "old conversation"], { cwd: directory, env, timeout: 20000 });
|
|
33
33
|
assert.equal(mock.requests.length, 2, first.stderr);
|
|
34
34
|
assert.equal(mock.requests[1].messages.length, 1);
|