Expand description
Line buffering for streaming text.
Structured protocols (ACP, Claude stream-json, Codex app-server) emit text in small chunks.
Treating every chunk as a separate output would turn transcripts into one character per line.
StreamBuf reassembles chunks into complete lines and flushes on kind switches or turn end.
Structsยง
- Chunk
- Text ready to emit. When
appendis true, the first segment oftextcontinues the previously emitted line that had no trailing newline (seeStreamBuf::idle_flush_chunk). - Stream
Buf - Buffer that coalesces token-level chunks into complete lines.