Stream each task's transcript over its own SSE; keep session note order

This commit is contained in:
Ian Gulliver
2026-10-14 23:53:17 -07:00
parent eabfc10c8d
commit 2b4d92e7d5
18 changed files with 304 additions and 191 deletions
+6 -3
View File
@@ -116,13 +116,16 @@ export function mountTranscript(root: HTMLElement): () => void {
transcript.scrollTop = transcript.scrollHeight;
}
};
const put = (el: HTMLElement) => {
if (spinner.parentNode === transcript) {
const putBefore = (el: HTMLElement, anchor: HTMLElement | undefined) => {
if (anchor?.parentNode === transcript) {
transcript.insertBefore(el, anchor);
} else if (spinner.parentNode === transcript) {
transcript.insertBefore(el, spinner);
} else {
transcript.append(el);
}
};
const put = (el: HTMLElement) => putBefore(el, pending[0]?.el);
const renderHead = () => {
const task = state.selectedTaskId ? findTask(state.selectedTaskId) : undefined;
@@ -207,7 +210,7 @@ export function mountTranscript(root: HTMLElement): () => void {
const entry = { el, text, imgs };
pending.push(entry);
ctx.run = undefined;
put(el);
putBefore(el, spinner);
transcript.scrollTop = transcript.scrollHeight;
return () => {
el.remove();