Fake a streaming CLI TUI in React with an abort-token turn player
To replay a terminal-agent UI (tool calls, streamed prose, interruptible spinner) in React, model output as a list of typed blocks and drive it with one async function that awaits sleep() between steps, guarded by a mutable {aborted:false} token stored in a ref keyed by session id. Esc sets aborted=true and appends an interrupt block, which leaves partially-revealed text in place — that partial state is what makes it read as real streaming. Give every mutable block a numeric id and patch by id inside a functional setState; do not index into the array, since concurrent sessions and appended blocks shift positions. For the character-by-character reveal, keep the full line array on the block and store only a reveal count, then slice segments at render time.