Skip to main content

ThinkingDeltaRenderer

Struct ThinkingDeltaRenderer 

Source
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:

  1. Call render_first_delta for the first thinking delta (shows prefix + content)
  2. Track last rendered content and emit only new suffixes directly (bypass render_subsequent_delta)
  3. Call render_completion when 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

Source§

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

Render a subsequent delta (in-place update). Read more
Source§

fn render_completion(terminal_mode: TerminalMode) -> String

Render the completion of streaming. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.