The KawaiiSpinner animation would occasionally spam dozens of duplicate lines instead of overwriting in-place with \r. This happened because prompt_toolkit's StdoutProxy processes each flush() as a separate run_in_terminal() call — when the write thread is slow (busy event loop during long tool executions), each \r frame gets its own call, and the terminal layout save/restore between calls breaks the \r overwrite semantics. Fix: rate-limit flush() calls to at most every 0.4s. Between flushes, \r-frame writes accumulate in StdoutProxy's buffer. When flushed, they concatenate into one string (e.g. \r frame1 \r frame2 \r frame3) and are written in a single run_in_terminal() call where \r works correctly. The spinner still animates (flush ~2.5x/sec) but each flush batches ~3 frames, guaranteeing the \r collapse always works. Most visible with execute_code and terminal tools (3+ second executions). |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| auxiliary_client.py | ||
| context_compressor.py | ||
| display.py | ||
| insights.py | ||
| model_metadata.py | ||
| prompt_builder.py | ||
| prompt_caching.py | ||
| redact.py | ||
| skill_commands.py | ||
| trajectory.py | ||