xonecas.io
64875
Mc

mini-coder / commit c2d19d0

output: slow down streaming ticker to 8ms per character

xonecas2026-02-21 c2d19d088cccdc103d86f84484ebc4876388acff parent cb62267

2 files changed

TODO.md+0−3
@@ -1,3 +0,0 @@
1-# Undo needs to restore working directory
2-
3-Besides undoing the conversation turn, it should restore some snapshot, using git?
src/cli/output.ts+4−5
@@ -598,8 +598,8 @@ export async function renderTurn(
598598 let printQueue = "";
599599 // Next character index in printQueue to emit.
600600 let printPos = 0;
601- // Handle for the active setImmediate ticker, or null if idle.
602- let tickerHandle: ReturnType<typeof setImmediate> | null = null;
601+ // Handle for the active setTimeout ticker, or null if idle.
602+ let tickerHandle: ReturnType<typeof setTimeout> | null = null;
603603
604604 let inputTokens = 0;
605605 let outputTokens = 0;
@@ -621,7 +621,6 @@ export async function renderTurn(
621621 if (printPos < printQueue.length) {
622622 process.stdout.write(printQueue[printPos] as string);
623623 printPos++;
624- // TODO: Tick is too fast, print is almost instant
625624 scheduleTick();
626625 } else {
627626 // Queue fully drained — reclaim memory.
@@ -631,14 +630,14 @@ export async function renderTurn(
631630 }
632631
633632 function scheduleTick(): void {
634- tickerHandle = setImmediate(tick);
633+ tickerHandle = setTimeout(tick, 8);
635634 }
636635
637636 // Synchronously drain any remaining print queue — used when the turn ends
638637 // or a tool call interrupts the text stream.
639638 function drainQueue(): void {
640639 if (tickerHandle !== null) {
641- clearImmediate(tickerHandle);
640+ clearTimeout(tickerHandle);
642641 tickerHandle = null;
643642 }
644643 if (printPos < printQueue.length) {