Keep quiet lead signal turns off-screen until they show something
This commit is contained in:
Vendored
+10
-4
@@ -233,11 +233,13 @@ export function mountChat(root, src, makeHead) {
|
||||
};
|
||||
const syncRunning = () => setRunning(src.session()?.state === "running" && ctx.open);
|
||||
const release = () => {
|
||||
if (!ctx.held) {
|
||||
const buffered = ctx.held;
|
||||
if (!buffered) {
|
||||
return;
|
||||
}
|
||||
ctx.held = undefined;
|
||||
ctx.open = true;
|
||||
putBefore(buffered, pending[0]?.el);
|
||||
syncRunning();
|
||||
};
|
||||
const put = (el, keepHeld = false) => {
|
||||
@@ -249,6 +251,10 @@ export function mountChat(root, src, makeHead) {
|
||||
release();
|
||||
}
|
||||
ctx.drawn?.push(el);
|
||||
if (ctx.held) {
|
||||
ctx.held.append(el);
|
||||
return;
|
||||
}
|
||||
putBefore(el, pending[0]?.el);
|
||||
};
|
||||
const fold = () => {
|
||||
@@ -327,7 +333,7 @@ export function mountChat(root, src, makeHead) {
|
||||
sub.run = extendRun(sub.run, el, call, parent, (e) => sub.body.append(e));
|
||||
return;
|
||||
}
|
||||
ctx.run = extendRun(ctx.run, el, call, parent, put);
|
||||
ctx.run = extendRun(ctx.run, el, call, parent, (e) => put(e, true));
|
||||
};
|
||||
const extendRun = (run, el, call, parent, place) => {
|
||||
if (!run || run.parent !== parent) {
|
||||
@@ -456,7 +462,7 @@ export function mountChat(root, src, makeHead) {
|
||||
continue;
|
||||
}
|
||||
ctx.run = undefined;
|
||||
put(el);
|
||||
put(el, true);
|
||||
continue;
|
||||
}
|
||||
if (ev.kind === "agent.tool_call") {
|
||||
@@ -501,7 +507,7 @@ export function mountChat(root, src, makeHead) {
|
||||
ctx.drawn = undefined;
|
||||
}
|
||||
if (ev.kind === "user.message" && ev.actor === "byre" && ev.owner && p["mid_turn"] !== true && p["handoff"] !== true) {
|
||||
ctx.held = el;
|
||||
ctx.held = document.createDocumentFragment();
|
||||
ctx.open = false;
|
||||
ctx.drawn = [];
|
||||
continue;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+12
-6
@@ -80,7 +80,7 @@ type Ctx = {
|
||||
run: Run | undefined;
|
||||
root: () => string;
|
||||
taskId: string | undefined;
|
||||
held: HTMLElement | undefined;
|
||||
held: DocumentFragment | undefined;
|
||||
open: boolean;
|
||||
drawn: HTMLElement[] | undefined;
|
||||
quiet: boolean;
|
||||
@@ -297,7 +297,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
transcript.classList.toggle("running", running);
|
||||
scanner.hidden = !running;
|
||||
};
|
||||
const putBefore = (el: HTMLElement, anchor: HTMLElement | undefined) => {
|
||||
const putBefore = (el: Node, anchor: HTMLElement | undefined) => {
|
||||
if (sink) {
|
||||
sink.append(el);
|
||||
return;
|
||||
@@ -310,11 +310,13 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
};
|
||||
const syncRunning = () => setRunning(src.session()?.state === "running" && ctx.open);
|
||||
const release = () => {
|
||||
if (!ctx.held) {
|
||||
const buffered = ctx.held;
|
||||
if (!buffered) {
|
||||
return;
|
||||
}
|
||||
ctx.held = undefined;
|
||||
ctx.open = true;
|
||||
putBefore(buffered, pending[0]?.el);
|
||||
syncRunning();
|
||||
};
|
||||
const put = (el: HTMLElement, keepHeld = false) => {
|
||||
@@ -326,6 +328,10 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
release();
|
||||
}
|
||||
ctx.drawn?.push(el);
|
||||
if (ctx.held) {
|
||||
ctx.held.append(el);
|
||||
return;
|
||||
}
|
||||
putBefore(el, pending[0]?.el);
|
||||
};
|
||||
const fold = () => {
|
||||
@@ -414,7 +420,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
sub.run = extendRun(sub.run, el, call, parent, (e) => sub.body.append(e));
|
||||
return;
|
||||
}
|
||||
ctx.run = extendRun(ctx.run, el, call, parent, put);
|
||||
ctx.run = extendRun(ctx.run, el, call, parent, (e) => put(e, true));
|
||||
};
|
||||
|
||||
const extendRun = (run: Run | undefined, el: HTMLElement, call: Call | undefined, parent: string, place: (el: HTMLElement) => void): Run => {
|
||||
@@ -546,7 +552,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
continue;
|
||||
}
|
||||
ctx.run = undefined;
|
||||
put(el);
|
||||
put(el, true);
|
||||
continue;
|
||||
}
|
||||
if (ev.kind === "agent.tool_call") {
|
||||
@@ -591,7 +597,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
ctx.drawn = undefined;
|
||||
}
|
||||
if (ev.kind === "user.message" && ev.actor === "byre" && ev.owner && p["mid_turn"] !== true && p["handoff"] !== true) {
|
||||
ctx.held = el;
|
||||
ctx.held = document.createDocumentFragment();
|
||||
ctx.open = false;
|
||||
ctx.drawn = [];
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user