Keep the handoff continuation message when its turn is folded away

This commit is contained in:
Ian Gulliver
2026-10-15 11:16:50 -07:00
parent d83212d46b
commit 3fe0374ac5
7 changed files with 25 additions and 5 deletions
+3 -1
View File
@@ -159,6 +159,7 @@ export function mountChat(root, src, makeHead) {
unplaced: [],
lastMessage: undefined,
turnStart: undefined,
keepTurnStart: false,
quiet: false,
handoff: undefined,
root: src.root(),
@@ -437,7 +438,7 @@ export function mountChat(root, src, makeHead) {
openHandoff();
}
if (ev.kind === "turn.ended" && ctx.quiet && ctx.turnStart?.parentNode === transcript) {
let node = ctx.turnStart;
let node = ctx.keepTurnStart ? ctx.turnStart.nextSibling : ctx.turnStart;
while (node && node !== spinner) {
const next = node.nextSibling;
node.remove();
@@ -450,6 +451,7 @@ export function mountChat(root, src, makeHead) {
put(el);
if (ev.kind === "user.message" && p["mid_turn"] !== true) {
ctx.turnStart = el;
ctx.keepTurnStart = p["continuation"] === true;
}
if (ev.kind === "turn.ended" || ev.kind === "inbox.created") {
addAnchor(ev.seq, el, ev.kind === "turn.ended");