Fit streamed markdown tables to their content, and test that replies don't jump

Replies already stream through <markdown streaming>; tables now size to their
cells with the theme's border colour. Tests cover tables mid-stream and settled,
the newest line staying in view, and a scrolled-up view staying still.
This commit is contained in:
Callum Alpass committed 2026-11-03 03:08:26 +11:00
1 parent d87026a66b
commit a9a4b47566
5 files changed
+78 -4

No files matched your search

+8
View File
@@ -166,3 +166,11 @@ export function withOmittedOutput(): OrchestrationV2ThreadProjection {
visibleTurnItems: [{ position: 0, visibility: "local", sourceThreadId: omittedCommand.threadId, sourceItemId: omittedCommand.id, item: omittedCommand }],
} as unknown as OrchestrationV2ThreadProjection;
}
/** The finished turn, its reply replaced by `text`, still streaming in if `streaming`. */
export function withReply(text: string, streaming: boolean): OrchestrationV2ThreadProjection {
const turn = structuredClone(withCompletedTurn()) as unknown as { turnItems: Record<string, unknown>[]; visibleTurnItems: { item: Record<string, unknown> }[] };
for (const item of turn.turnItems) if (item.type === "assistant_message") Object.assign(item, { text, streaming, status: streaming ? "running" : "completed" });
for (const visible of turn.visibleTurnItems) visible.item = turn.turnItems.find((item) => item.id === visible.item.id)!;
return turn as unknown as OrchestrationV2ThreadProjection;
}