mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
## What changed - Update the status heading from the latest usable reasoning line and retain it through tool activity and empty reasoning items. Keep completed reasoning in the expanded transcript only. - Restore active reasoning after resume, thread switches, and session refreshes, including when earlier events have left the replay buffer. - Default new embedded TUI threads to `model_reasoning_summary = "detailed"`, honoring explicit summary settings. Keep `concurrent_reasoning_summaries` opt-in and disable it when summaries are `none`. - Persist the request's captured reasoning summary setting in context updates and local and remote compaction checkpoints. - Animate status text with a smooth, grapheme-aware shimmer that respects terminal colors and reduced motion. ## Testing Add regression coverage for reasoning status updates, transcript visibility, resume and buffered replay, outbound summary configuration, and summary settings across all three compaction modes. Add shimmer snapshots and checks for smooth brightness changes and Unicode grapheme preservation. GitOrigin-RevId: 725c7de20f23166d7a3da6daeca617add5cbc600
57 lines
2.1 KiB
Rust
57 lines
2.1 KiB
Rust
//! Smooth, whole-grapheme status shimmer with a two-second sweep.
|
|
//!
|
|
//! Only brightness changes: the moving band uses the terminal foreground, while
|
|
//! the remaining text blends halfway into the background. The wave spans at
|
|
//! least six terminal columns so short labels do not flash one letter at a time.
|
|
//! Unknown palettes use static dim text instead of a stepped animation.
|
|
|
|
use std::time::Duration;
|
|
|
|
use ratatui::style::Style;
|
|
use ratatui::text::Span;
|
|
use unicode_segmentation::UnicodeSegmentation;
|
|
use unicode_width::UnicodeWidthStr;
|
|
|
|
use crate::color::blend;
|
|
use crate::motion::MotionMode;
|
|
use crate::terminal_palette::StdoutColorLevel;
|
|
use crate::terminal_palette::default_bg;
|
|
use crate::terminal_palette::default_fg;
|
|
use crate::terminal_palette::effective_stdout_color_level;
|
|
use crate::terminal_palette::rgb_color;
|
|
|
|
pub(crate) fn summary_shimmer(
|
|
text: &str,
|
|
elapsed: Duration,
|
|
motion: MotionMode,
|
|
) -> Vec<Span<'static>> {
|
|
if motion == MotionMode::Reduced {
|
|
return vec![text.to_owned().into()];
|
|
}
|
|
let (StdoutColorLevel::TrueColor, Some(fg), Some(bg)) =
|
|
(effective_stdout_color_level(), default_fg(), default_bg())
|
|
else {
|
|
return vec![Span::styled(text.to_owned(), Style::default().dim())];
|
|
};
|
|
let width = text.width() as f64;
|
|
let half_width = (width * 0.1).max(/*other*/ 3.0);
|
|
let position = (elapsed.as_secs_f64() % 2.0) / 2.0 * (width + 2.0 * half_width) - half_width;
|
|
let mut column = 0.0;
|
|
text.graphemes(/*is_extended*/ true)
|
|
.map(|grapheme| {
|
|
let glyph_width = grapheme.width() as f64;
|
|
let center = column + glyph_width / 2.0;
|
|
column += glyph_width;
|
|
let distance = ((center - position).abs() / half_width).min(/*other*/ 1.0);
|
|
let intensity = 0.5 * (1.0 + (std::f64::consts::PI * distance).cos());
|
|
let alpha = (0.5 + 0.5 * intensity) as f32;
|
|
let style = Style::default().fg(rgb_color(blend(fg, bg, alpha)));
|
|
Span::styled(grapheme.to_owned(), style)
|
|
})
|
|
.collect()
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "summary_shimmer_tests.rs"]
|
|
mod tests;
|