fix(chat): settle authoritative turns and make capabilities explicit

This commit is contained in:
2026-10-20 15:45:09 +01:00
parent 016fcb552a
commit e504780976
16 changed files with 615 additions and 56 deletions
+16 -3
View File
@@ -888,14 +888,27 @@ test("attachmentDisplayName prefers the name, then the uri's basename, then file
assert.equal(attachmentDisplayName("", ""), "file");
});
test("attachmentError reports an unreadable file and the 25 MiB limit by name", () => {
test("intermediate tool steps preserve Stop and the running turn", () => {
let thread = applyChatEvent(newChatThread("ses_1"), { kind: "step", step: { status: "started" } }, 100);
for (let index = 0; index < 3; index++) {
const frame = { kind: "step", step: { status: "ended", intermediate: true, index } };
thread = applyChatEvent(thread, frame, 200 + index);
assert.equal(thread.running, true);
assert.equal(runningAfterFrame(true, frame), true);
assert.equal(composerAction(thread), "stop");
}
thread = applyChatEvent(thread, { kind: "step", step: { status: "ended" } }, 300);
assert.equal(thread.running, false);
});
test("attachmentError reports an unreadable file and the server's 1 MiB limit by name", () => {
assert.equal(attachmentError("a.txt", 3, true), null);
assert.equal(attachmentError("a.txt", 3, false), '"a.txt" could not be read.');
assert.equal(attachmentError("", 3, false), '"file" could not be read.');
assert.equal(MAX_ATTACHMENT_BYTES, 25 * 1024 * 1024);
assert.equal(MAX_ATTACHMENT_BYTES, 1024 * 1024);
assert.equal(
attachmentError("big.bin", MAX_ATTACHMENT_BYTES + 1, true),
'"big.bin" is too large (25.0 MiB limit).',
'"big.bin" is too large (1.0 MiB limit).',
);
// Exactly at the limit is allowed; the limit reads through the shared humanBytes.
assert.equal(attachmentError("big.bin", MAX_ATTACHMENT_BYTES, true), null);