web: one chat activity line, clearer groups and paste attachments

Replace the reasoning, tool and bottom thinking rows with one stable activity
line and refresh Stop on the step frame. Make directory and Closed bands share
an elevated square surface, centred text and a collapse toggle. Read pasted
files into the composer attachment path and show sent files in user bubbles.
This commit is contained in:
2026-10-20 14:30:57 +01:00
parent f5ccec8e1f
commit 3799d37d7c
11 changed files with 583 additions and 306 deletions
+37
View File
@@ -136,6 +136,7 @@ import {
queuedAfterFrame,
readChatSeen,
reasoningLabel,
relativeSessionTime,
renameChatOverride,
restoreChatOverride,
resumedThread,
@@ -510,6 +511,18 @@ test("sessionActivity and its badge word follow streaming, unseen then open", ()
assert.equal(sessionActivityBadge("idle", false), "Idle");
});
test("relativeSessionTime names the latest chat update, not a meaningless idle state", () => {
const now = Date.UTC(2026, 9, 20, 12, 0, 0);
assert.equal(relativeSessionTime(0, now), "");
assert.equal(relativeSessionTime(now - 20_000, now), "just now");
assert.equal(relativeSessionTime(now - 50_000, now), "1 min ago");
assert.equal(relativeSessionTime(now - 2 * 60_000, now), "2 min ago");
assert.equal(relativeSessionTime(now - 3 * 60 * 60_000, now), "3 hr ago");
assert.equal(relativeSessionTime(now - 26 * 60 * 60_000, now), "1 day ago");
assert.equal(relativeSessionTime(now - 3 * 24 * 60 * 60_000, now), "3 days ago");
assert.equal(relativeSessionTime(Date.UTC(2026, 8, 12, 9, 0, 0), now), "12 Sept");
});
test("sessionStatusLabel reads Closed first, then Running or Idle", () => {
assert.equal(sessionStatusLabel(true, true), "Closed");
assert.equal(sessionStatusLabel(true, false), "Running");
@@ -1109,6 +1122,30 @@ test("a text delta appends to the part the first frame started", () => {
assert.equal(thread.lastDeltaAt, 1001);
});
test("a remote user turn carries its file attachments into the message", () => {
let thread = newChatThread("s1");
thread = applyChatEvent(
thread,
evt("user", {
message_id: "u1",
operation_id: "op1",
client: "Phone",
part: { type: "text", text: "See attached" },
attachments: [{ type: "file", name: "note.txt", mime: "text/plain", uri: "file:///tmp/note.txt" }],
}),
1000,
);
const message = thread.messages[0];
assert.equal(message.role, "user");
assert.equal(message.parts[0].text, "See attached");
assert.deepEqual(message.parts[1], {
type: "file",
name: "note.txt",
mime: "text/plain",
uri: "file:///tmp/note.txt",
});
});
test("a text delta and a reasoning delta sharing a bare id land in separate parts", () => {
let thread = newChatThread("s1");
thread = applyChatEvent(thread, evt("text", { message_id: "a1", part: { id: "x" }, delta: "answer" }), 1000);