pub struct ThinkingDeltaRenderer;Expand description
Renderer for streaming thinking deltas.
Supports the same append-only pattern as TextDeltaRenderer:
- First delta: prefix + “Thinking: “ + content (no newline)
- Subsequent deltas: Parser computes and emits only new suffix
- Completion: single newline via
DeltaRenderer::render_completion
§Append-Only Pattern
For true append-only streaming in Full mode, parsers should:
- Call
render_first_deltafor the first thinking delta (shows prefix + content) - Track last rendered content and emit only new suffixes directly (bypass
render_subsequent_delta) - Call
render_completionwhen thinking completes (adds final newline)
This avoids cursor movement and works correctly under terminal wrapping.
§CCS Spam Prevention (Bug Fix)
Like TextDeltaRenderer, this implementation suppresses per-delta output in non-TTY modes
to prevent repeated “[ccs/codex] Thinking:” and “[ccs/glm] Thinking:” lines in logs.
The fix is validated with ultra-extreme streaming tests (1000+ thinking deltas).
See comprehensive regression tests:
tests/integration_tests/ccs_delta_spam_systematic_reproduction.rs(NEW: systematic reproduction test)tests/integration_tests/ccs_all_delta_types_spam_reproduction.rs(1000+ deltas, rapid succession, interleaved blocks)tests/integration_tests/ccs_extreme_streaming_regression.rs(500+ deltas per block)tests/integration_tests/ccs_streaming_spam_all_deltas.rs(all delta types)tests/integration_tests/codex_reasoning_spam_regression.rs(original reasoning fix)
Trait Implementations§
Source§impl DeltaRenderer for ThinkingDeltaRenderer
impl DeltaRenderer for ThinkingDeltaRenderer
Source§fn render_first_delta(
accumulated: &str,
prefix: &str,
colors: Colors,
terminal_mode: TerminalMode,
) -> String
fn render_first_delta( accumulated: &str, prefix: &str, colors: Colors, terminal_mode: TerminalMode, ) -> String
Render the first delta of a content block. Read more
Source§fn render_subsequent_delta(
_accumulated: &str,
_prefix: &str,
_colors: Colors,
terminal_mode: TerminalMode,
) -> String
fn render_subsequent_delta( _accumulated: &str, _prefix: &str, _colors: Colors, terminal_mode: TerminalMode, ) -> String
Render a subsequent delta (in-place update). Read more
Source§fn render_completion(terminal_mode: TerminalMode) -> String
fn render_completion(terminal_mode: TerminalMode) -> String
Render the completion of streaming. Read more
Auto Trait Implementations§
impl Freeze for ThinkingDeltaRenderer
impl RefUnwindSafe for ThinkingDeltaRenderer
impl Send for ThinkingDeltaRenderer
impl Sync for ThinkingDeltaRenderer
impl Unpin for ThinkingDeltaRenderer
impl UnwindSafe for ThinkingDeltaRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more