Fold away lead signal turns that end in NO_REPLY, tool calls included

This commit is contained in:
Ian Gulliver
2026-10-15 20:20:51 -07:00
parent 8d5ebe727a
commit 8cfe9de384
4 changed files with 41 additions and 8 deletions
+20 -3
View File
@@ -74,6 +74,7 @@ type Ctx = {
root: () => string;
taskId: string | undefined;
held: HTMLElement | undefined;
drawn: HTMLElement[] | undefined;
quiet: boolean;
handoff: { summary: HTMLElement; body: HTMLElement } | undefined;
};
@@ -216,6 +217,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
reviewButtons: new Map(),
run: undefined,
held: undefined,
drawn: undefined,
quiet: false,
handoff: undefined,
root: src.root,
@@ -250,6 +252,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
return;
}
ctx.held = undefined;
ctx.drawn?.push(el);
putBefore(el, stream?.el ?? pending[0]?.el);
syncRunning();
};
@@ -261,8 +264,18 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
if (!keepHeld) {
release();
}
ctx.drawn?.push(el);
putBefore(el, pending[0]?.el);
};
const fold = () => {
for (const el of ctx.drawn ?? []) {
el.remove();
}
ctx.drawn = undefined;
ctx.held = undefined;
ctx.quiet = false;
syncRunning();
};
const renderHead = () => {
syncRunning();
@@ -345,6 +358,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
const body = h("div", { class: "tool-group-body" });
const group = h("details", { class: "tool-group" }, summary, body);
run.first.replaceWith(group);
ctx.drawn?.push(group);
body.append(run.first);
run.group = { el: group, summary, body };
}
@@ -476,13 +490,16 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
if (ev.kind === "user.message" && p["handoff"] === true) {
openHandoff();
}
if (ev.kind === "turn.ended" && ctx.quiet && ctx.held) {
ctx.held = undefined;
ctx.quiet = false;
if (ev.kind === "turn.ended" && ctx.quiet && ctx.drawn) {
fold();
continue;
}
if (ev.kind === "turn.ended" || ev.kind === "user.message") {
ctx.drawn = undefined;
}
if (ev.kind === "user.message" && ev.actor === "byre" && ev.owner && p["mid_turn"] !== true && p["handoff"] !== true) {
ctx.held = el;
ctx.drawn = [];
syncRunning();
continue;
}