Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
test(agent-tui): insta snapshot tests for key rendering surfaces
Akarshan Biswasb302f8749ad7
diff --git a/src-tauri/.gitignore b/src-tauri/.gitignoreindex b7e3ee4f4..d29375dc5 100644--- a/src-tauri/.gitignore+++ b/src-tauri/.gitignore@@ -11,4 +11,6 @@ binariesplugins/*/permissions/autogenerated/# Runtime agent thread data (created when running `jan agent` from src-tauri/)-/threads/\ No newline at end of file+/threads/+# Pending insta snapshots; accept with `cargo insta review` (see CONTRIBUTING.md)+*.snap.newdiff --git a/src-tauri/CONTRIBUTING.md b/src-tauri/CONTRIBUTING.mdindex e9d68cfaf..178f09509 100644--- a/src-tauri/CONTRIBUTING.md+++ b/src-tauri/CONTRIBUTING.md@@ -44,6 +44,32 @@ yarn tauri buildcargo test```+### Snapshot tests (agent TUI)++A few TUI surfaces (permission prompt, diff preview, header badges, todo and+subagent panels, `/agents`, model picker) are pinned by+[insta](https://insta.rs) snapshots in+`src/core/cli/tui/tests/snapshot.rs`, with baselines in `tui/tests/snapshots/`.+Each `.snap` holds the rendered text and the colour/modifier runs per row. The+module doc says when to add a snapshot rather than a substring test.++```bash+# Run them (they are part of the normal cli test run)+cargo test --locked --no-default-features --features cli --lib -- core::cli::tui::tests::snapshot++# A mismatch fails the test and writes a pending `<name>.snap.new` beside the+# baseline. Review and accept or reject each one interactively:+cargo install cargo-insta # once+cargo insta review++# Or accept everything the run produces, without the review tool:+INSTA_UPDATE=always cargo test --locked --no-default-features --features cli --lib -- core::cli::tui::tests::snapshot+```++Commit the updated `.snap` files with the change that caused them, and never a+leftover `.snap.new`. With `CI=true` (set on GitHub Actions) and+`INSTA_UPDATE` unset, insta writes nothing and a mismatch only fails the test.+### State Management```rustdiff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 893effbdb..439106a0c 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -35,6 +35,7 @@ dependencies = ["hyper-util","ignore","indicatif",+ "insta","jan-utils","keyring","libc",@@ -3692,6 +3693,17 @@ dependencies = ["generic-array",]+[[package]]+name = "insta"+version = "1.49.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b67d3d2e287e4b86c10b3f3b641033d1f89b74bdb39d05f34952e2b9a6fe21cd"+dependencies = [+ "once_cell",+ "similar",+ "tempfile",+]+[[package]]name = "instability"version = "0.3.12"diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 9bda35be9..01ebad39c 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -265,6 +265,9 @@ features = ["protocol-asset", "macos-private-api", "test"][dev-dependencies]tempfile = "3.20.0"+# Snapshot tests for the agent TUI (src/core/cli/tui), so only exercised+# under the `cli` feature; dev-dependencies cannot be feature-gated.+insta = { version = "1.46", default-features = false }[target.'cfg(unix)'.dependencies]nix = { version = "=0.30.1", features = ["signal", "process", "resource"] }diff --git a/src-tauri/src/core/cli/tui.rs b/src-tauri/src/core/cli/tui.rsindex b2fede546..46262ede8 100644--- a/src-tauri/src/core/cli/tui.rs+++ b/src-tauri/src/core/cli/tui.rs@@ -43713,4 +43713,6 @@ mod tests {assert!(KEY_BINDINGS.iter().any(|(k, _)| k.contains("Ctrl-F")));assert!(KEY_BINDINGS.iter().any(|(k, _)| k.contains("n / N")));}++ mod snapshot;}diff --git a/src-tauri/src/core/cli/tui/tests/snapshot.rs b/src-tauri/src/core/cli/tui/tests/snapshot.rsnew file mode 100644index 000000000..e7a75fac4--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshot.rs@@ -0,0 +1,560 @@+//! Snapshot tests for the TUI's most layout- and style-sensitive surfaces: the+//! permission prompt, the diff preview, the header status badges, the todo and+//! subagent panels, `/agents`, and the model picker.+//!+//! Snapshot or substring? The two catch different regressions, so pick by what+//! would break:+//!+//! - Write a **substring test** (`render_rows(..)` + `contains`) for behaviour:+//! a word appears, a row is dropped, Enter does the right thing. These+//! survive cosmetic changes and say exactly what they guard.+//! - Write a **snapshot test** here only when the layout or the styling is the+//! thing under test: alignment, borders, truncation width, colour and+//! modifier choices. A substring test is blind to all of those.+//!+//! Do not snapshot a surface just because it exists; each snapshot is a file a+//! reviewer has to re-read on every intentional change. One or two+//! representative states (and widths, where the layout reflows) per surface.+//!+//! Every snapshot renders with motion reduced, the wave glyph off and a pinned+//! theme (dark truecolor unless the test is about another), and avoids+//! anything read from the clock or the machine: no running `run_started`+//! (the header shows the wall clock while a run is timed), no git branch, no+//! timestamps. Each frame is therefore a pure function of the fixture.+//!+//! Accepting an intentional change: run the tests, then `cargo insta review`+//! (or re-run with `INSTA_UPDATE=always`) and commit the updated `.snap`+//! files. See "Snapshot tests" in `src-tauri/CONTRIBUTING.md`.++use super::*;+use crate::core::agent::todo::TodoStatus::{Abandoned, Completed, InProgress, Pending as Open};+use crate::core::cli::tui::motion::{with_mode, MotionMode};+use crate::core::cli::tui::theme::{with_theme, ColorDepth, Theme};+use ratatui::backend::TestBackend;+use ratatui::widgets::Paragraph;+use ratatui::Terminal;+use std::fmt::Write as _;++const DARK: Theme = Theme {+ light: false,+ depth: ColorDepth::Truecolor,+};+const LIGHT: Theme = Theme {+ light: true,+ depth: ColorDepth::Truecolor,+};+const ANSI16: Theme = Theme {+ light: false,+ depth: ColorDepth::Ansi16,+};++/// Run `f` with every process-wide render input pinned: motion reduced, no+/// wave glyph (it is read from the user's config otherwise) and `theme`.+fn pinned<T>(theme: Theme, f: impl FnOnce() -> T) -> T {+ with_mode(MotionMode::Reduced, || {+ with_wave_glyph(None, || with_theme(theme, f))+ })+}++/// A fresh app with the machine-dependent inputs cleared: the branch is read+/// from `git` at construction and the dock prints the project root, and a+/// real model id reads better than `m`.+fn snapshot_app() -> TestApp {+ let mut app = test_app();+ app.git_branch = None;+ // Outside any plausible `$HOME`, so `tilde_path` never abbreviates it.+ app.project_root = std::path::PathBuf::from("/snapshot/repo");+ app.model = "gpt-5-mini".into();+ app+}++/// Start a turn without the wall clock: the header prints `HH:MM` and the+/// elapsed time while `run_started` is set.+fn start_turn(app: &mut App, text: &str) {+ app.submit_user(text.into());+ app.run_started = None;+}++/// Draw the whole frame, as the render loop does.+fn frame(app: &mut App, theme: Theme, w: u16, h: u16) -> Buffer {+ pinned(theme, || {+ let mut terminal = Terminal::new(TestBackend::new(w, h)).unwrap();+ terminal.draw(|f| super::super::draw(f, app)).unwrap();+ terminal.backend().buffer().clone()+ })+}++/// Draw `lines` alone into a buffer `w` wide and exactly as tall as they are,+/// for a surface built as lines rather than drawn into a frame.+fn lines_buffer(lines: Vec<Line<'static>>, w: u16) -> Buffer {+ let area = Rect::new(0, 0, w, lines.len().max(1) as u16);+ let mut buf = Buffer::empty(area);+ ratatui::widgets::Widget::render(Paragraph::new(lines), area, &mut buf);+ buf+}++/// Serialize a buffer as its text, then its styling as runs.+///+/// Text rows are fenced in `|` so trailing blanks (and so the width) survive+/// editors and diff tools. Styling is listed per row as runs of adjacent cells+/// sharing one style, `row x0..x1 fg=.. bg=.. mod=..`, with columns as cell+/// indices (end exclusive) and unset attributes left out. Unstyled runs are+/// omitted entirely, which keeps a mostly plain frame short.+///+/// The cell behind a wide grapheme holds a placeholder the terminal never+/// shows, so it is skipped in the text, as ratatui's own diff skips it.+fn render_snapshot(buf: &Buffer) -> String {+ let area = buf.area;+ let mut text = String::new();+ let mut styles = String::new();+ for y in 0..area.height {+ let mut row = String::new();+ let mut hidden = 0usize;+ // (start, key) of the run in progress.+ let mut run: Option<(u16, String)> = None;+ for x in 0..area.width {+ let cell = &buf[(area.x + x, area.y + y)];+ if hidden == 0 {+ row.push_str(cell.symbol());+ hidden = UnicodeWidthStr::width(cell.symbol()).max(1);+ }+ hidden -= 1;+ let key = style_key(cell);+ if run.as_ref().is_some_and(|(_, k)| *k != key) {+ let (start, k) = run.take().unwrap();+ push_run(&mut styles, y, start, x, &k);+ }+ if run.is_none() {+ run = Some((x, key));+ }+ }+ if let Some((start, k)) = run {+ push_run(&mut styles, y, start, area.width, &k);+ }+ let _ = writeln!(text, "|{row}|");+ }+ format!("{text}\n{styles}")+}++/// The non-default attributes of a cell, `""` when it is plain.+fn style_key(cell: &ratatui::buffer::Cell) -> String {+ let mut key = Vec::new();+ if cell.fg != Color::Reset {+ key.push(format!("fg={}", cell.fg));+ }+ if cell.bg != Color::Reset {+ key.push(format!("bg={}", cell.bg));+ }+ if !cell.modifier.is_empty() {+ key.push(format!("mod={:?}", cell.modifier));+ }+ key.join(" ")+}++fn push_run(out: &mut String, y: u16, x0: u16, x1: u16, key: &str) {+ if !key.is_empty() {+ let _ = writeln!(out, "{y:>2} {x0}..{x1} {key}");+ }+}++/// Assert `buf` against `snapshots/<name>.snap` beside this file.+fn assert_buffer(name: &str, buf: &Buffer) {+ insta::with_settings!({ prepend_module_to_snapshot => false }, {+ insta::assert_snapshot!(name, render_snapshot(buf));+ });+}++// ---- Header / status badge ------------------------------------------------++fn header_buffer(app: &App, theme: Theme) -> Buffer {+ pinned(theme, || lines_buffer(vec![Line::from(header_spans(app))], 100))+}++#[test]+fn header_idle_ready() {+ let app = snapshot_app();+ assert_buffer("header_idle_ready", &header_buffer(&app, DARK));+}++#[test]+fn header_running_working_with_turn_and_cache() {+ let mut app = snapshot_app();+ start_turn(&mut app, "go");+ app.turn = (3, 20);+ app.tokens = 41_200;+ app.session_cache_reported = true;+ app.session_prompt_tokens = 10_000;+ app.session_cached_tokens = 4_200;+ assert_buffer(+ "header_running_working_with_turn_and_cache",+ &header_buffer(&app, DARK),+ );+}++#[test]+fn header_running_thinking_reduced_motion() {+ let mut app = snapshot_app();+ app.stream_reasoning = false;+ start_turn(&mut app, "go");+ app.apply(StreamEvent::Token {+ text: "<think>pondering".into(),+ });+ assert!(app.is_thinking());+ assert_buffer(+ "header_running_thinking_reduced_motion",+ &header_buffer(&app, DARK),+ );+}++#[test]+fn header_parked_waiting_and_watching() {+ let mut app = snapshot_app();+ start_turn(&mut app, "go");+ app.apply(StreamEvent::Parked);+ let waiting = header_buffer(&app, DARK);+ app.apply(StreamEvent::Monitors {+ monitors: vec![monitor("mon-1", "ok", "grep OK build.log", 1)],+ });+ app.apply(StreamEvent::Parked);+ let watching = header_buffer(&app, DARK);+ assert_buffer("header_parked_waiting", &waiting);+ assert_buffer("header_parked_watching", &watching);+}++#[test]+fn header_zero_cache_hit_on_ansi16() {+ let mut app = snapshot_app();+ app.session_cache_reported = true;+ app.session_prompt_tokens = 8_000;+ app.session_cached_tokens = 0;+ assert_buffer("header_zero_cache_hit_ansi16", &header_buffer(&app, ANSI16));+}++// ---- Permission prompt ----------------------------------------------------++fn permission(app: &mut App, id: &str, command: &str) {+ app.apply(StreamEvent::PermissionRequest {+ request_id: id.into(),+ tool_name: "bash".into(),+ capability: "execute".into(),+ path: None,+ command: Some(command.into()),+ diff: None,+ prompt_kind: "exec".into(),+ offers_always: true,+ });+}++#[test]+fn permission_prompt_for_a_command() {+ let mut app = snapshot_app();+ start_turn(&mut app, "check the tree");+ permission(&mut app, "p1", "git status && cargo test --lib");+ assert_buffer(+ "permission_prompt_exec",+ &frame(&mut app, DARK, 80, 20),+ );+}++#[test]+fn permission_prompt_from_a_subagent_with_a_queue() {+ let mut app = snapshot_app();+ start_turn(&mut app, "fan out");+ app.apply(StreamEvent::Subagent {+ run_id: "sub-scout-1".into(),+ name: "scout".into(),+ event: Box::new(StreamEvent::PermissionRequest {+ request_id: "p1".into(),+ tool_name: "write".into(),+ capability: "write".into(),+ path: Some("notes.md".into()),+ command: None,+ diff: None,+ prompt_kind: "write".into(),+ offers_always: false,+ }),+ });+ permission(&mut app, "p2", "ls");+ assert_eq!(app.pending_queue.len(), 2);+ assert_buffer(+ "permission_prompt_subagent_queued",+ &frame(&mut app, DARK, 72, 18),+ );+}++#[test]+fn permission_prompt_with_a_diff_on_ansi16() {+ let mut app = snapshot_app();+ start_turn(&mut app, "rename it");+ app.apply(StreamEvent::PermissionRequest {+ request_id: "w1".into(),+ tool_name: "edit".into(),+ capability: "write".into(),+ path: Some("src/greet.rs".into()),+ command: None,+ diff: Some(+ concat!(+ "@@ -1,3 +1,3 @@\n",+ " fn greet() {\n",+ "- println!(\"hi ansi16\");\n",+ "+ println!(\"hello ansi16\");\n",+ " }",+ )+ .into(),+ ),+ prompt_kind: "write".into(),+ offers_always: true,+ });+ assert_buffer(+ "permission_prompt_diff_ansi16",+ &frame(&mut app, ANSI16, 70, 22),+ );+}++// ---- Diff preview ---------------------------------------------------------+//+// The highlighter caches by text, not by theme (the theme is fixed for a+// process outside tests), so each themed variant uses its own source text.++fn diff_buffer(theme: Theme, diff: &str, width: u16, lang: Option<&str>) -> Buffer {+ pinned(theme, || {+ lines_buffer(+ super::super::diff_lines_in(+ theme,+ diff,+ width as usize,+ DIFF_PREVIEW_MAX_ROWS,+ "",+ lang,+ ),+ width,+ )+ })+}++#[test]+fn diff_preview_highlighted_dark() {+ let diff = concat!(+ "@@ -2,4 +2,5 @@\n",+ " use std::fmt;\n",+ "-fn area(w: u32, h: u32) -> u32 {\n",+ "+/// Area in cells.\n",+ "+fn area(w: u64, h: u64) -> u64 {\n",+ " w * h\n",+ " }",+ );+ assert_buffer(+ "diff_preview_highlighted_dark",+ &diff_buffer(DARK, diff, 64, Some("src/geometry.rs")),+ );+}++#[test]+fn diff_preview_plain_light() {+ let diff = "@@ -1,2 +1,2 @@\n-colour = grey\n+colour = gray\n unchanged = true";+ assert_buffer(+ "diff_preview_plain_light",+ &diff_buffer(LIGHT, diff, 48, None),+ );+}++#[test]+fn diff_preview_truncates_long_rows_and_counts_the_rest() {+ let mut diff = String::from("@@ -1,0 +1,30 @@\n");+ for i in 0..30 {+ let _ = writeln!(diff, "+line {i:02} of a long generated block that overflows the box");+ }+ assert_buffer(+ "diff_preview_truncated_narrow",+ &diff_buffer(DARK, diff.trim_end(), 40, None),+ );+}++// ---- Todo panel -----------------------------------------------------------++#[test]+fn todo_panel_single_phase() {+ let mut app = snapshot_app();+ start_turn(&mut app, "plan it");+ app.todos = todos_from(vec![(+ "",+ vec![+ ("scaffold the crate", Completed),+ ("wire the routes", InProgress),+ ("write the docs", Open),+ ("support windows xp", Abandoned),+ ],+ )]);+ assert_buffer("todo_panel_single_phase", &frame(&mut app, DARK, 80, 16));+}++#[test]+fn todo_panel_multi_phase_beside_the_agents() {+ let mut app = snapshot_app();+ start_turn(&mut app, "build it");+ app.todos = todos_from(vec![+ (+ "backend",+ vec![("scaffold", Completed), ("routes", InProgress), ("auth", Open)],+ ),+ ("frontend", vec![("ui", Open)]),+ ]);+ app.subagents = vec![cached_panel("api-review", 6, 12_000, 9_000, true)];+ assert_buffer(+ "todo_panel_split_with_agents",+ &frame(&mut app, DARK, 100, 18),+ );+}++#[test]+fn todo_panel_stacks_above_the_agents_when_narrow() {+ let mut app = snapshot_app();+ start_turn(&mut app, "build it");+ app.todos = todos_from(vec![(+ "",+ vec![("routes", InProgress), ("auth", Open)],+ )]);+ app.subagents = vec![cached_panel("api-review", 2, 0, 0, false)];+ assert_buffer(+ "todo_panel_stacked_narrow",+ &frame(&mut app, DARK, 60, 18),+ );+}++// ---- Subagent panel and /agents --------------------------------------------++/// The reduced-motion throbber, as `motion::spinner` returns it.+const THROBBER: &str = "\u{2022}";++/// A running child with `calls` calls and, when `reported`, a prompt-cache+/// history of `cached` out of `prompt` tokens.+fn cached_panel(+ name: &str,+ calls: usize,+ prompt: u64,+ cached: u64,+ reported: bool,+) -> SubagentPanel {+ let mut panel = panel_with_calls(name, Vec::new());+ panel.calls = (0..calls).map(|i| format!("read src/mod_{i}.rs")).collect();+ panel.requests = calls as u32;+ panel.prompt_tokens = prompt;+ panel.total_prompt_tokens = prompt;+ panel.total_cached_tokens = cached;+ panel.cache_reported = reported;+ panel+}++/// The fan-out every agent snapshot shares: a cache hit, a cache miss (red), a+/// route that reports no cache, a queued child and a later-phase one.+fn fan_out() -> Vec<SubagentPanel> {+ let mut queued = cached_panel("docs-writer", 0, 0, 0, false);+ queued.queued = true;+ queued.waiting = 1;+ let mut waiting = cached_panel("collector", 0, 0, 0, false);+ waiting.pending = true;+ waiting.phase = Some(2);+ vec![+ cached_panel("kv-review", 4, 64_000, 48_000, true),+ cached_panel("perf-scan", 3, 20_000, 0, true),+ cached_panel("lint-fix", 1, 5_000, 0, false),+ queued,+ waiting,+ ]+}++#[test]+fn subagent_dock_shows_stats_and_cache_rates() {+ let mut panels = fan_out();+ let buf = pinned(DARK, || {+ lines_buffer(agents_column(&mut panels, 128_000, 72, 12, THROBBER), 72)+ });+ assert_buffer("subagent_dock_cache_rates", &buf);+}++#[test]+fn subagent_dock_overflow_points_at_agents() {+ let mut panels = fan_out();+ let buf = pinned(DARK, || {+ lines_buffer(agents_column(&mut panels, 128_000, 72, 4, THROBBER), 72)+ });+ assert_buffer("subagent_dock_overflow", &buf);+}++#[test]+fn agents_inspector_lists_the_fan_out() {+ let mut app = snapshot_app();+ start_turn(&mut app, "fan out");+ app.subagents = fan_out();+ open_agents_picker(&mut app);+ assert_buffer("agents_inspector_list", &frame(&mut app, DARK, 90, 16));+}++#[test]+fn agents_inspector_detail_for_one_child() {+ let mut app = snapshot_app();+ start_turn(&mut app, "fan out");+ let mut panel = cached_panel("kv-review", 2, 64_000, 48_000, true);+ panel.task = "Review the key-value store for races.\nThen report.".into();+ panel.log = vec![+ super::super::ChildLogEntry::Prose("Reading the store first.".into()),+ super::super::ChildLogEntry::Call {+ id: "c1".into(),+ label: "Read src/kv.rs".into(),+ result: Some(("120 lines".into(), false)),+ },+ super::super::ChildLogEntry::Steer("check the lock order too".into()),+ super::super::ChildLogEntry::Call {+ id: "c2".into(),+ label: "Ran cargo test kv".into(),+ result: Some(("error: 1 test failed".into(), true)),+ },+ ];+ app.subagents = vec![panel];+ open_agents_picker(&mut app);+ if let Some(picker) = app.picker.as_mut() {+ picker.kind = PickerKind::AgentDetail;+ }+ app.agent_detail = Some("sub-kv-review-1".into());+ assert_buffer("agents_inspector_detail", &frame(&mut app, DARK, 80, 20));+}++// ---- Model picker -----------------------------------------------------------++fn picker_app() -> TestApp {+ let mut app = snapshot_app();+ app.model_picker = super::super::ModelPicker::from_pairs(+ vec![+ ("anthropic".into(), "claude-sonnet-4-5".into()),+ ("anthropic".into(), "claude-haiku-4-5".into()),+ ("openai".into(), "gpt-5-mini".into()),+ ("openai".into(), "gpt-5.1".into()),+ ("tokamak".into(), "tokamak-1-preview".into()),+ ],+ "gpt-5-mini",+ );+ assert!(app.model_picker.is_some());+ app+}++#[test]+fn model_picker_narrow() {+ let mut app = picker_app();+ assert_buffer("model_picker_w48", &frame(&mut app, DARK, 48, 14));+}++#[test]+fn model_picker_medium() {+ let mut app = picker_app();+ assert_buffer("model_picker_w80", &frame(&mut app, DARK, 80, 14));+}++#[test]+fn model_picker_wide_with_a_query() {+ let mut app = picker_app();+ if let Some(picker) = app.model_picker.as_mut() {+ picker.query = "claude".into();+ picker.refresh_items();+ }+ assert_buffer("model_picker_w120_query", &frame(&mut app, DARK, 120, 14));+}diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/agents_inspector_detail.snap b/src-tauri/src/core/cli/tui/tests/snapshots/agents_inspector_detail.snapnew file mode 100644index 000000000..56e7d445e--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/agents_inspector_detail.snap@@ -0,0 +1,48 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|β subagent βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|βkv-review (sub-kv-review-1) β|+|β2 tools Β· 2 req Β· 75% cached β|+|β β|+|βReview the key-value store for races. β|+|β β|+|βReading the store first. β|+|ββ β Read src/kv.rs β|+|ββ 120 lines β|+|β> check the lock order too β|+|ββ β Ran cargo test kv β|+|ββ error: 1 test failed β|+|β β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|selectingβ¦ |+| |+|π /snapshot/repo m message x stop Esc back|++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+ 2 1..10 fg=Magenta mod=BOLD+ 2 10..29 fg=DarkGray+ 3 1..29 fg=DarkGray+ 5 1..38 mod=DIM | ITALIC+ 8 1..3 fg=DarkGray+ 8 3..5 fg=Green+ 8 5..19 mod=DIM+ 9 1..14 fg=DarkGray+10 1..27 fg=Magenta mod=BOLD+11 1..3 fg=DarkGray+11 3..5 fg=Red+11 5..22 mod=DIM+12 1..5 fg=DarkGray+12 5..25 fg=Red+17 0..10 mod=DIM | ITALIC+19 0..1 fg=DarkGray+19 2..17 fg=DarkGray+19 50..80 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/agents_inspector_list.snap b/src-tauri/src/core/cli/tui/tests/snapshots/agents_inspector_list.snapnew file mode 100644index 000000000..fdf4bfe9d--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/agents_inspector_list.snap@@ -0,0 +1,31 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|β subagents ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|ββΆ kv-review Β· 4t Β· 75% cached Β· read src/mod_3.rs β|+|β perf-scan Β· 3t Β· 0% cached Β· read src/mod_2.rs β|+|β lint-fix Β· 1t Β· read src/mod_0.rs β|+|β docs-writer Β· 0t Β· queued (1) β|+|β collector Β· 0t Β· phase 2 (waiting) β|+|β β|+|β β|+|β β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|selectingβ¦ |+| |+|π /snapshot/repo β/β select Enter view m message x stop Esc close|++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+ 2 1..89 fg=Cyan mod=BOLD+13 0..10 mod=DIM | ITALIC+15 0..1 fg=DarkGray+15 2..17 fg=DarkGray+15 33..90 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_highlighted_dark.snap b/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_highlighted_dark.snapnew file mode 100644index 000000000..abb89df99--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_highlighted_dark.snap@@ -0,0 +1,77 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|βββββββββββββββββββββββββββββββββββββ |+|β @@ -2,4 +2,5 @@ β |+|β use std::fmt; β |+|β -fn area(w: u32, h: u32) -> u32 { β |+|β +/// Area in cells. β |+|β +fn area(w: u64, h: u64) -> u64 { β |+|β w * h β |+|β } β |+|βββββββββββββββββββββββββββββββββββββ |++ 0 0..37 fg=DarkGray+ 1 0..2 fg=DarkGray+ 1 2..17 fg=Cyan mod=DIM+ 1 17..37 fg=DarkGray+ 2 0..2 fg=DarkGray+ 2 2..3 mod=DIM+ 2 3..6 fg=#B48EAD+ 2 6..16 fg=#C0C5CE+ 2 16..37 fg=DarkGray+ 3 0..1 fg=DarkGray+ 3 1..2 fg=DarkGray bg=#421A1E+ 3 2..3 fg=Red bg=#421A1E mod=BOLD+ 3 3..5 fg=#B48EAD bg=#421A1E+ 3 5..6 fg=#C0C5CE bg=#421A1E+ 3 6..10 fg=#8FA1B3 bg=#421A1E+ 3 10..11 fg=#C0C5CE bg=#421A1E+ 3 11..12 fg=#BF616A bg=#421A1E+ 3 12..14 fg=#C0C5CE bg=#421A1E+ 3 14..17 fg=#B48EAD bg=#421A1E+ 3 17..19 fg=#C0C5CE bg=#421A1E+ 3 19..20 fg=#BF616A bg=#421A1E+ 3 20..22 fg=#C0C5CE bg=#421A1E+ 3 22..25 fg=#B48EAD bg=#421A1E+ 3 25..30 fg=#C0C5CE bg=#421A1E+ 3 30..33 fg=#B48EAD bg=#421A1E+ 3 33..35 fg=#C0C5CE bg=#421A1E+ 3 35..36 fg=DarkGray bg=#421A1E+ 3 36..37 fg=DarkGray+ 4 0..1 fg=DarkGray+ 4 1..2 fg=DarkGray bg=#163420+ 4 2..3 fg=Green bg=#163420 mod=BOLD+ 4 3..21 fg=#65737E bg=#163420+ 4 21..36 fg=DarkGray bg=#163420+ 4 36..37 fg=DarkGray+ 5 0..1 fg=DarkGray+ 5 1..2 fg=DarkGray bg=#163420+ 5 2..3 fg=Green bg=#163420 mod=BOLD+ 5 3..5 fg=#B48EAD bg=#163420+ 5 5..6 fg=#C0C5CE bg=#163420+ 5 6..10 fg=#8FA1B3 bg=#163420+ 5 10..11 fg=#C0C5CE bg=#163420+ 5 11..12 fg=#BF616A bg=#163420+ 5 12..14 fg=#C0C5CE bg=#163420+ 5 14..17 fg=#B48EAD bg=#163420+ 5 17..19 fg=#C0C5CE bg=#163420+ 5 19..20 fg=#BF616A bg=#163420+ 5 20..22 fg=#C0C5CE bg=#163420+ 5 22..25 fg=#B48EAD bg=#163420+ 5 25..30 fg=#C0C5CE bg=#163420+ 5 30..33 fg=#B48EAD bg=#163420+ 5 33..35 fg=#C0C5CE bg=#163420+ 5 35..36 fg=DarkGray bg=#163420+ 5 36..37 fg=DarkGray+ 6 0..2 fg=DarkGray+ 6 2..3 mod=DIM+ 6 3..12 fg=#C0C5CE+ 6 12..37 fg=DarkGray+ 7 0..2 fg=DarkGray+ 7 2..3 mod=DIM+ 7 3..4 fg=#C0C5CE+ 7 4..37 fg=DarkGray+ 8 0..37 fg=DarkGraydiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_plain_light.snap b/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_plain_light.snapnew file mode 100644index 000000000..e50d795c6--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_plain_light.snap@@ -0,0 +1,32 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|βββββββββββββββββββββ |+|β @@ -1,2 +1,2 @@ β |+|β -colour = grey β |+|β +colour = gray β |+|β unchanged = true β |+|βββββββββββββββββββββ |++ 0 0..21 fg=DarkGray+ 1 0..2 fg=DarkGray+ 1 2..17 fg=Cyan mod=DIM+ 1 17..21 fg=DarkGray+ 2 0..1 fg=DarkGray+ 2 1..2 fg=DarkGray bg=#FFCDD2+ 2 2..3 fg=Red bg=#FFCDD2 mod=BOLD+ 2 3..16 bg=#FFCDD2+ 2 16..20 fg=DarkGray bg=#FFCDD2+ 2 20..21 fg=DarkGray+ 3 0..1 fg=DarkGray+ 3 1..2 fg=DarkGray bg=#C6EFCE+ 3 2..3 fg=Green bg=#C6EFCE mod=BOLD+ 3 3..16 bg=#C6EFCE+ 3 16..20 fg=DarkGray bg=#C6EFCE+ 3 20..21 fg=DarkGray+ 4 0..2 fg=DarkGray+ 4 2..19 mod=DIM+ 4 19..21 fg=DarkGray+ 5 0..21 fg=DarkGraydiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_truncated_narrow.snap b/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_truncated_narrow.snapnew file mode 100644index 000000000..59fc810b3--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/diff_preview_truncated_narrow.snap@@ -0,0 +1,151 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|ββββββββββββββββββββββββββββββββββββββββ|+|β @@ -1,0 +1,30 @@ β|+|β +line 00 of a long generated block β¦ β|+|β +line 01 of a long generated block β¦ β|+|β +line 02 of a long generated block β¦ β|+|β +line 03 of a long generated block β¦ β|+|β +line 04 of a long generated block β¦ β|+|β +line 05 of a long generated block β¦ β|+|β +line 06 of a long generated block β¦ β|+|β +line 07 of a long generated block β¦ β|+|β +line 08 of a long generated block β¦ β|+|β +line 09 of a long generated block β¦ β|+|β +line 10 of a long generated block β¦ β|+|β +line 11 of a long generated block β¦ β|+|β +line 12 of a long generated block β¦ β|+|β +line 13 of a long generated block β¦ β|+|β +line 14 of a long generated block β¦ β|+|β +line 15 of a long generated block β¦ β|+|β +line 16 of a long generated block β¦ β|+|β +line 17 of a long generated block β¦ β|+|β +line 18 of a long generated block β¦ β|+|β (+11 more) β|+|ββββββββββββββββββββββββββββββββββββββββ|++ 0 0..40 fg=DarkGray+ 1 0..2 fg=DarkGray+ 1 2..18 fg=Cyan mod=DIM+ 1 18..40 fg=DarkGray+ 2 0..1 fg=DarkGray+ 2 1..2 fg=DarkGray bg=#163420+ 2 2..3 fg=Green bg=#163420 mod=BOLD+ 2 3..38 bg=#163420+ 2 38..39 fg=DarkGray bg=#163420+ 2 39..40 fg=DarkGray+ 3 0..1 fg=DarkGray+ 3 1..2 fg=DarkGray bg=#163420+ 3 2..3 fg=Green bg=#163420 mod=BOLD+ 3 3..38 bg=#163420+ 3 38..39 fg=DarkGray bg=#163420+ 3 39..40 fg=DarkGray+ 4 0..1 fg=DarkGray+ 4 1..2 fg=DarkGray bg=#163420+ 4 2..3 fg=Green bg=#163420 mod=BOLD+ 4 3..38 bg=#163420+ 4 38..39 fg=DarkGray bg=#163420+ 4 39..40 fg=DarkGray+ 5 0..1 fg=DarkGray+ 5 1..2 fg=DarkGray bg=#163420+ 5 2..3 fg=Green bg=#163420 mod=BOLD+ 5 3..38 bg=#163420+ 5 38..39 fg=DarkGray bg=#163420+ 5 39..40 fg=DarkGray+ 6 0..1 fg=DarkGray+ 6 1..2 fg=DarkGray bg=#163420+ 6 2..3 fg=Green bg=#163420 mod=BOLD+ 6 3..38 bg=#163420+ 6 38..39 fg=DarkGray bg=#163420+ 6 39..40 fg=DarkGray+ 7 0..1 fg=DarkGray+ 7 1..2 fg=DarkGray bg=#163420+ 7 2..3 fg=Green bg=#163420 mod=BOLD+ 7 3..38 bg=#163420+ 7 38..39 fg=DarkGray bg=#163420+ 7 39..40 fg=DarkGray+ 8 0..1 fg=DarkGray+ 8 1..2 fg=DarkGray bg=#163420+ 8 2..3 fg=Green bg=#163420 mod=BOLD+ 8 3..38 bg=#163420+ 8 38..39 fg=DarkGray bg=#163420+ 8 39..40 fg=DarkGray+ 9 0..1 fg=DarkGray+ 9 1..2 fg=DarkGray bg=#163420+ 9 2..3 fg=Green bg=#163420 mod=BOLD+ 9 3..38 bg=#163420+ 9 38..39 fg=DarkGray bg=#163420+ 9 39..40 fg=DarkGray+10 0..1 fg=DarkGray+10 1..2 fg=DarkGray bg=#163420+10 2..3 fg=Green bg=#163420 mod=BOLD+10 3..38 bg=#163420+10 38..39 fg=DarkGray bg=#163420+10 39..40 fg=DarkGray+11 0..1 fg=DarkGray+11 1..2 fg=DarkGray bg=#163420+11 2..3 fg=Green bg=#163420 mod=BOLD+11 3..38 bg=#163420+11 38..39 fg=DarkGray bg=#163420+11 39..40 fg=DarkGray+12 0..1 fg=DarkGray+12 1..2 fg=DarkGray bg=#163420+12 2..3 fg=Green bg=#163420 mod=BOLD+12 3..38 bg=#163420+12 38..39 fg=DarkGray bg=#163420+12 39..40 fg=DarkGray+13 0..1 fg=DarkGray+13 1..2 fg=DarkGray bg=#163420+13 2..3 fg=Green bg=#163420 mod=BOLD+13 3..38 bg=#163420+13 38..39 fg=DarkGray bg=#163420+13 39..40 fg=DarkGray+14 0..1 fg=DarkGray+14 1..2 fg=DarkGray bg=#163420+14 2..3 fg=Green bg=#163420 mod=BOLD+14 3..38 bg=#163420+14 38..39 fg=DarkGray bg=#163420+14 39..40 fg=DarkGray+15 0..1 fg=DarkGray+15 1..2 fg=DarkGray bg=#163420+15 2..3 fg=Green bg=#163420 mod=BOLD+15 3..38 bg=#163420+15 38..39 fg=DarkGray bg=#163420+15 39..40 fg=DarkGray+16 0..1 fg=DarkGray+16 1..2 fg=DarkGray bg=#163420+16 2..3 fg=Green bg=#163420 mod=BOLD+16 3..38 bg=#163420+16 38..39 fg=DarkGray bg=#163420+16 39..40 fg=DarkGray+17 0..1 fg=DarkGray+17 1..2 fg=DarkGray bg=#163420+17 2..3 fg=Green bg=#163420 mod=BOLD+17 3..38 bg=#163420+17 38..39 fg=DarkGray bg=#163420+17 39..40 fg=DarkGray+18 0..1 fg=DarkGray+18 1..2 fg=DarkGray bg=#163420+18 2..3 fg=Green bg=#163420 mod=BOLD+18 3..38 bg=#163420+18 38..39 fg=DarkGray bg=#163420+18 39..40 fg=DarkGray+19 0..1 fg=DarkGray+19 1..2 fg=DarkGray bg=#163420+19 2..3 fg=Green bg=#163420 mod=BOLD+19 3..38 bg=#163420+19 38..39 fg=DarkGray bg=#163420+19 39..40 fg=DarkGray+20 0..1 fg=DarkGray+20 1..2 fg=DarkGray bg=#163420+20 2..3 fg=Green bg=#163420 mod=BOLD+20 3..38 bg=#163420+20 38..39 fg=DarkGray bg=#163420+20 39..40 fg=DarkGray+21 0..2 fg=DarkGray+21 2..12 mod=DIM+21 12..40 fg=DarkGray+22 0..40 fg=DarkGraydiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/header_idle_ready.snap b/src-tauri/src/core/cli/tui/tests/snapshots/header_idle_ready.snapnew file mode 100644index 000000000..c8c356cbc--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/header_idle_ready.snap@@ -0,0 +1,11 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [ready] |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..62 fg=Greendiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/header_parked_waiting.snap b/src-tauri/src/core/cli/tui/tests/snapshots/header_parked_waiting.snapnew file mode 100644index 000000000..ff01bfe4e--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/header_parked_waiting.snap@@ -0,0 +1,11 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [waiting] |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyandiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/header_parked_watching.snap b/src-tauri/src/core/cli/tui/tests/snapshots/header_parked_watching.snapnew file mode 100644index 000000000..c6d8dbf89--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/header_parked_watching.snap@@ -0,0 +1,11 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [watching] |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..65 fg=Cyandiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/header_running_thinking_reduced_motion.snap b/src-tauri/src/core/cli/tui/tests/snapshots/header_running_thinking_reduced_motion.snapnew file mode 100644index 000000000..42b18efda--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/header_running_thinking_reduced_motion.snap@@ -0,0 +1,11 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [thinking] |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..65 fg=Yellow mod=BOLDdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/header_running_working_with_turn_and_cache.snap b/src-tauri/src/core/cli/tui/tests/snapshots/header_running_working_with_turn_and_cache.snapnew file mode 100644index 000000000..591e573ff--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/header_running_working_with_turn_and_cache.snap@@ -0,0 +1,12 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium turn 3/20 ctx 41K/128K fallback cache 42% [working] |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 65..74 fg=Cyan+ 0 76..85 fg=Cyan mod=BOLDdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/header_zero_cache_hit_ansi16.snap b/src-tauri/src/core/cli/tui/tests/snapshots/header_zero_cache_hit_ansi16.snapnew file mode 100644index 000000000..51045e63d--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/header_zero_cache_hit_ansi16.snap@@ -0,0 +1,12 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback cache 0% [ready] |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 53..61 fg=Red mod=BOLD+ 0 63..70 fg=Greendiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w120_query.snap b/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w120_query.snapnew file mode 100644index 000000000..f01ba6a67--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w120_query.snap@@ -0,0 +1,63 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|β Models βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β All models 5βAll available models β|+|β tokamak 1ββ claudeβ β|+|β anthropic 2β anthropic / claude-haiku-4-5 β|+|β openai 2ββΆ anthropic / claude-sonnet-4-5 β|+|β β β|+|β β β|+|β β β|+|β β β|+|β β β|+|β β β|+|β βanthropic/claude-sonnet-4-5 Β· default β|+|βEnter choose Β· Left/Right panes Β· Up/Down move Β· type to search Β· Ctrl-R refresh Β· Esc close β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|++ 0 0..1 fg=Cyan+ 0 1..9 fg=Black bg=Cyan mod=BOLD+ 0 9..120 fg=Cyan+ 1 0..1 fg=Cyan+ 1 3..29 mod=REVERSED+ 1 29..30 fg=DarkGray+ 1 30..50 mod=BOLD+ 1 119..120 fg=Cyan+ 2 0..1 fg=Cyan+ 2 29..39 fg=DarkGray+ 2 119..120 fg=Cyan+ 3 0..1 fg=Cyan+ 3 29..30 fg=DarkGray+ 3 119..120 fg=Cyan+ 4 0..1 fg=Cyan+ 4 29..30 fg=DarkGray+ 4 30..119 mod=BOLD | REVERSED+ 4 119..120 fg=Cyan+ 5 0..1 fg=Cyan+ 5 29..30 fg=DarkGray+ 5 119..120 fg=Cyan+ 6 0..1 fg=Cyan+ 6 29..30 fg=DarkGray+ 6 119..120 fg=Cyan+ 7 0..1 fg=Cyan+ 7 29..30 fg=DarkGray+ 7 119..120 fg=Cyan+ 8 0..1 fg=Cyan+ 8 29..30 fg=DarkGray+ 8 119..120 fg=Cyan+ 9 0..1 fg=Cyan+ 9 29..30 fg=DarkGray+ 9 119..120 fg=Cyan+10 0..1 fg=Cyan+10 29..30 fg=DarkGray+10 119..120 fg=Cyan+11 0..1 fg=Cyan+11 29..67 fg=DarkGray+11 119..120 fg=Cyan+12 0..1 fg=Cyan+12 1..93 fg=DarkGray+12 119..120 fg=Cyan+13 0..120 fg=Cyandiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w48.snap b/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w48.snapnew file mode 100644index 000000000..725519145--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w48.snap@@ -0,0 +1,63 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|β Models βββββββββββββββββββββββββββββββββββββββ|+|β All models 5βAll available moβ¦β|+|β tokamak 1ββ β β|+|β anthropic 2β tokamak / tokaβ¦β|+|β openai 2β anthropic / clβ¦β|+|β β anthropic / clβ¦β|+|β ββΆ openai / gpt-5β¦β|+|β β openai / gpt-5β¦β|+|β β β|+|β β β|+|β β β|+|β βopenai/gpt-5-minβ¦β|+|βEnter choose Β· Left/Right panes Β· Up/Down movβ¦β|+|ββββββββββββββββββββββββββββββββββββββββββββββββ|++ 0 0..1 fg=Cyan+ 0 1..9 fg=Black bg=Cyan mod=BOLD+ 0 9..48 fg=Cyan+ 1 0..1 fg=Cyan+ 1 3..29 mod=REVERSED+ 1 29..30 fg=DarkGray+ 1 30..47 mod=BOLD+ 1 47..48 fg=Cyan+ 2 0..1 fg=Cyan+ 2 29..33 fg=DarkGray+ 2 47..48 fg=Cyan+ 3 0..1 fg=Cyan+ 3 29..30 fg=DarkGray+ 3 47..48 fg=Cyan+ 4 0..1 fg=Cyan+ 4 29..30 fg=DarkGray+ 4 47..48 fg=Cyan+ 5 0..1 fg=Cyan+ 5 29..30 fg=DarkGray+ 5 47..48 fg=Cyan+ 6 0..1 fg=Cyan+ 6 29..30 fg=DarkGray+ 6 30..47 mod=BOLD | REVERSED+ 6 47..48 fg=Cyan+ 7 0..1 fg=Cyan+ 7 29..30 fg=DarkGray+ 7 47..48 fg=Cyan+ 8 0..1 fg=Cyan+ 8 29..30 fg=DarkGray+ 8 47..48 fg=Cyan+ 9 0..1 fg=Cyan+ 9 29..30 fg=DarkGray+ 9 47..48 fg=Cyan+10 0..1 fg=Cyan+10 29..30 fg=DarkGray+10 47..48 fg=Cyan+11 0..1 fg=Cyan+11 29..47 fg=DarkGray+11 47..48 fg=Cyan+12 0..1 fg=Cyan+12 1..47 fg=DarkGray+12 47..48 fg=Cyan+13 0..48 fg=Cyandiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w80.snap b/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w80.snapnew file mode 100644index 000000000..9f4303f45--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/model_picker_w80.snap@@ -0,0 +1,63 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|β Models βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β All models 5βAll available models β|+|β tokamak 1ββ β β|+|β anthropic 2β tokamak / tokamak-1-preview β|+|β openai 2β anthropic / claude-haiku-4-5 β|+|β β anthropic / claude-sonnet-4-5 β|+|β ββΆ openai / gpt-5-mini β|+|β β openai / gpt-5.1 β|+|β β β|+|β β β|+|β β β|+|β βopenai/gpt-5-mini Β· current β|+|βEnter choose Β· Left/Right panes Β· Up/Down move Β· type to search Β· Ctrl-R refrβ¦β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|++ 0 0..1 fg=Cyan+ 0 1..9 fg=Black bg=Cyan mod=BOLD+ 0 9..80 fg=Cyan+ 1 0..1 fg=Cyan+ 1 3..29 mod=REVERSED+ 1 29..30 fg=DarkGray+ 1 30..50 mod=BOLD+ 1 79..80 fg=Cyan+ 2 0..1 fg=Cyan+ 2 29..33 fg=DarkGray+ 2 79..80 fg=Cyan+ 3 0..1 fg=Cyan+ 3 29..30 fg=DarkGray+ 3 79..80 fg=Cyan+ 4 0..1 fg=Cyan+ 4 29..30 fg=DarkGray+ 4 79..80 fg=Cyan+ 5 0..1 fg=Cyan+ 5 29..30 fg=DarkGray+ 5 79..80 fg=Cyan+ 6 0..1 fg=Cyan+ 6 29..30 fg=DarkGray+ 6 30..79 mod=BOLD | REVERSED+ 6 79..80 fg=Cyan+ 7 0..1 fg=Cyan+ 7 29..30 fg=DarkGray+ 7 79..80 fg=Cyan+ 8 0..1 fg=Cyan+ 8 29..30 fg=DarkGray+ 8 79..80 fg=Cyan+ 9 0..1 fg=Cyan+ 9 29..30 fg=DarkGray+ 9 79..80 fg=Cyan+10 0..1 fg=Cyan+10 29..30 fg=DarkGray+10 79..80 fg=Cyan+11 0..1 fg=Cyan+11 29..57 fg=DarkGray+11 79..80 fg=Cyan+12 0..1 fg=Cyan+12 1..79 fg=DarkGray+12 79..80 fg=Cyan+13 0..80 fg=Cyandiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_diff_ansi16.snap b/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_diff_ansi16.snapnew file mode 100644index 000000000..e18dda069--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_diff_ansi16.snap@@ -0,0 +1,94 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+| |+| |+|β permission required ββββββββββββββββββββββββββββββββββββββββββββββββ|+|βedit wants write β|+|βon src/greet.rs β|+|βββββββββββββββββββββββββββββββββββ β|+|ββ @@ -1,3 +1,3 @@ β β|+|ββ fn greet() { β β|+|ββ - println!("hi ansi16"); β β|+|ββ + println!("hello ansi16"); β β|+|ββ } β β|+|βββββββββββββββββββββββββββββββββββ β|+|ββΆ Allow once β|+|β Allow always (this thread) β|+|β Deny β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β’ workingβ¦ (Esc to cancel, type to steer the agent) |+| |+| β/β select Enter confirm Esc deny Ctrl-C cancel |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+ 5 0..1 fg=Yellow+ 5 1..22 fg=Black bg=Yellow mod=BOLD+ 5 22..70 fg=Yellow+ 6 0..1 fg=Yellow+ 6 1..5 fg=Cyan mod=BOLD+ 6 5..12 fg=DarkGray+ 6 12..17 fg=Yellow mod=BOLD+ 6 69..70 fg=Yellow+ 7 0..1 fg=Yellow+ 7 1..4 fg=DarkGray+ 7 69..70 fg=Yellow+ 8 0..1 fg=Yellow+ 8 1..35 fg=DarkGray+ 8 69..70 fg=Yellow+ 9 0..1 fg=Yellow+ 9 1..3 fg=DarkGray+ 9 3..18 fg=Cyan mod=DIM+ 9 18..35 fg=DarkGray+ 9 69..70 fg=Yellow+10 0..1 fg=Yellow+10 1..3 fg=DarkGray+10 3..4 mod=DIM+10 16..35 fg=DarkGray+10 69..70 fg=Yellow+11 0..1 fg=Yellow+11 1..3 fg=DarkGray+11 3..4 fg=Red mod=BOLD+11 4..30 fg=Red+11 30..35 fg=DarkGray+11 69..70 fg=Yellow+12 0..1 fg=Yellow+12 1..3 fg=DarkGray+12 3..4 fg=Green mod=BOLD+12 4..33 fg=Green+12 33..35 fg=DarkGray+12 69..70 fg=Yellow+13 0..1 fg=Yellow+13 1..3 fg=DarkGray+13 3..4 mod=DIM+13 5..35 fg=DarkGray+13 69..70 fg=Yellow+14 0..1 fg=Yellow+14 1..35 fg=DarkGray+14 69..70 fg=Yellow+15 0..1 fg=Yellow+15 1..69 fg=Cyan mod=BOLD+15 69..70 fg=Yellow+16 0..1 fg=Yellow+16 69..70 fg=Yellow+17 0..1 fg=Yellow+17 69..70 fg=Yellow+18 0..70 fg=Yellow+19 0..2 fg=Cyan+19 2..51 mod=DIM | ITALIC+21 1..4 fg=Yellow mod=BOLD+21 4..11 mod=DIM+21 14..19 fg=Yellow mod=BOLD+21 19..27 mod=DIM+21 30..33 fg=Yellow mod=BOLD+21 33..38 mod=DIM+21 41..47 fg=Yellow mod=BOLD+21 47..54 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_exec.snap b/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_exec.snapnew file mode 100644index 000000000..1a043ee38--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_exec.snap@@ -0,0 +1,61 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+| |+| |+| |+| |+| |+| |+| |+|β permission required ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|βbash wants execute β|+|β$ git status && cargo test --lib β|+|ββΆ Allow once β|+|β Allow all 'cargo', 'git' commands (this thread) β|+|β Deny β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β’ workingβ¦ (Esc to cancel, type to steer the agent) |+| |+|π /snapshot/repo β/β select Enter confirm Esc deny Ctrl-C cancel|++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+10 0..1 fg=Yellow+10 1..22 fg=Black bg=Yellow mod=BOLD+10 22..80 fg=Yellow+11 0..1 fg=Yellow+11 1..5 fg=Cyan mod=BOLD+11 5..12 fg=DarkGray+11 12..19 fg=Yellow mod=BOLD+11 79..80 fg=Yellow+12 0..1 fg=Yellow+12 1..3 fg=DarkGray+12 79..80 fg=Yellow+13 0..1 fg=Yellow+13 1..79 fg=Cyan mod=BOLD+13 79..80 fg=Yellow+14 0..1 fg=Yellow+14 79..80 fg=Yellow+15 0..1 fg=Yellow+15 79..80 fg=Yellow+16 0..80 fg=Yellow+17 0..2 fg=Cyan+17 2..51 mod=DIM | ITALIC+19 0..1 fg=DarkGray+19 2..17 fg=DarkGray+19 27..30 fg=Yellow mod=BOLD+19 30..37 mod=DIM+19 40..45 fg=Yellow mod=BOLD+19 45..53 mod=DIM+19 56..59 fg=Yellow mod=BOLD+19 59..64 mod=DIM+19 67..73 fg=Yellow mod=BOLD+19 73..80 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_subagent_queued.snap b/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_subagent_queued.snapnew file mode 100644index 000000000..f609caa64--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/permission_prompt_subagent_queued.snap@@ -0,0 +1,60 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+| |+| |+| |+| |+| |+|β permission required (1 of 2) βββββββββββββββββββββββββββββββββββββββββ|+|βsubagent scout is asking: β|+|βwrite wants write β|+|βon notes.md β|+|ββΆ Allow once β|+|β Deny β|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β’ workingβ¦ (Esc to cancel, type to steer the agent) |+| |+| β/β select Enter confirm Esc deny Ctrl-C cancel |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+ 8 0..1 fg=Yellow+ 8 1..31 fg=Black bg=Yellow mod=BOLD+ 8 31..72 fg=Yellow+ 9 0..1 fg=Yellow+ 9 1..10 fg=DarkGray+ 9 10..15 fg=Magenta mod=BOLD+ 9 15..26 fg=DarkGray+ 9 71..72 fg=Yellow+10 0..1 fg=Yellow+10 1..6 fg=Cyan mod=BOLD+10 6..13 fg=DarkGray+10 13..18 fg=Yellow mod=BOLD+10 71..72 fg=Yellow+11 0..1 fg=Yellow+11 1..4 fg=DarkGray+11 71..72 fg=Yellow+12 0..1 fg=Yellow+12 1..71 fg=Cyan mod=BOLD+12 71..72 fg=Yellow+13 0..1 fg=Yellow+13 71..72 fg=Yellow+14 0..72 fg=Yellow+15 0..2 fg=Cyan+15 2..51 mod=DIM | ITALIC+17 1..4 fg=Yellow mod=BOLD+17 4..11 mod=DIM+17 14..19 fg=Yellow mod=BOLD+17 19..27 mod=DIM+17 30..33 fg=Yellow mod=BOLD+17 33..38 mod=DIM+17 41..47 fg=Yellow mod=BOLD+17 47..54 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/subagent_dock_cache_rates.snap b/src-tauri/src/core/cli/tui/tests/snapshots/subagent_dock_cache_rates.snapnew file mode 100644index 000000000..4ca236f6f--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/subagent_dock_cache_rates.snap@@ -0,0 +1,37 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|β‘ 5 agents |+|β’ kv-review 4t Β· 4r Β· 50.0% Β· 75% cached |+| read src/mod_3.rs |+|β’ perf-scan 3t Β· 3r Β· 15.6% Β· 0% cached |+| read src/mod_2.rs |+|β’ lint-fix 1t Β· 1r Β· 3.9% |+| read src/mod_0.rs |+|Β· docs-writer queued (1) |+| review the file |+|Β· collector phase 2 Β· waiting |+| review the file |++ 0 0..2 fg=Magenta+ 0 2..10 fg=Magenta mod=BOLD+ 1 0..11 fg=Magenta+ 1 11..41 fg=DarkGray+ 2 3..20 mod=DIM+ 3 0..11 fg=Magenta+ 3 11..28 fg=DarkGray+ 3 28..40 fg=Red+ 4 3..20 mod=DIM+ 5 0..10 fg=Magenta+ 5 10..26 fg=DarkGray+ 6 3..20 mod=DIM+ 7 0..2 fg=Magenta+ 7 2..13 fg=Magenta mod=DIM+ 7 13..25 fg=Yellow+ 8 3..18 mod=DIM | ITALIC+ 9 0..2 fg=Magenta+ 9 2..11 fg=Magenta mod=DIM+ 9 11..30 fg=Yellow+10 3..18 mod=DIM | ITALICdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/subagent_dock_overflow.snap b/src-tauri/src/core/cli/tui/tests/snapshots/subagent_dock_overflow.snapnew file mode 100644index 000000000..0b055c85b--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/subagent_dock_overflow.snap@@ -0,0 +1,19 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+|β‘ 5 agents |+|β’ kv-review 4t Β· 4r Β· 50.0% Β· 75% cached |+|β’ perf-scan 3t Β· 3r Β· 15.6% Β· 0% cached |+| +3 more Β· /agents |++ 0 0..2 fg=Magenta+ 0 2..10 fg=Magenta mod=BOLD+ 1 0..11 fg=Magenta+ 1 11..41 fg=DarkGray+ 2 0..11 fg=Magenta+ 2 11..28 fg=DarkGray+ 2 28..40 fg=Red+ 3 0..12 fg=DarkGray+ 3 12..19 fg=Cyandiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_single_phase.snap b/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_single_phase.snapnew file mode 100644index 000000000..7252ba077--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_single_phase.snap@@ -0,0 +1,46 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+| |+| |+| plan it |+| |+|Todos Β· 2/4 /todo |+| β scaffold the crate |+| β wire the routes |+| β write the docs |+| β support windows xp |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β’ workingβ¦ (Esc to cancel, type to steer the agent) |+| |+|π /snapshot/repo Esc/Ctrl-C cancel PgUp/PgDn scroll Ctrl-O expand all|++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+ 5 0..1 fg=LightMagenta bg=#282C3A mod=BOLD+ 5 1..8 fg=#E9ECF2 bg=#282C3A mod=BOLD+ 5 8..9 bg=#282C3A+ 7 0..5 fg=Cyan mod=BOLD+ 7 5..11 mod=DIM+ 7 11..19 fg=DarkGray+ 8 1..21 mod=DIM | CROSSED_OUT+ 9 1..18 fg=Cyan+10 1..17 mod=DIM+11 1..21 fg=Red mod=CROSSED_OUT+13 0..2 fg=Cyan+13 2..51 mod=DIM | ITALIC+15 0..1 fg=DarkGray+15 2..17 fg=DarkGray+15 24..34 fg=Cyan mod=BOLD+15 34..41 mod=DIM+15 44..53 fg=Cyan mod=BOLD+15 53..60 mod=DIM+15 63..69 fg=Cyan mod=BOLD+15 69..80 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_split_with_agents.snap b/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_split_with_agents.snapnew file mode 100644index 000000000..b043642b5--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_split_with_agents.snap@@ -0,0 +1,58 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [working] |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+| |+| |+| |+| |+| |+| build it |+| |+|Todos Β· 1/2 Β· backend 1/3 /todo β β‘ 1 agent |+| β scaffold β β’ api-review 6t Β· 6r Β· 9.4% Β· 75% cached |+| β routes β review the file |+| β auth β read src/mod_5.rs |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β’ workingβ¦ (Esc to cancel, type to steer the agent) |+| |+|π /snapshot/repo Esc/Ctrl-C cancel PgUp/PgDn scroll Ctrl-O expand all|++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..64 fg=Cyan mod=BOLD+ 8 0..1 fg=LightMagenta bg=#282C3A mod=BOLD+ 8 1..9 fg=#E9ECF2 bg=#282C3A mod=BOLD+ 8 9..10 bg=#282C3A+10 0..5 fg=Cyan mod=BOLD+10 5..11 fg=Cyan+10 11..25 mod=DIM+10 25..33 fg=DarkGray+10 48..51 fg=DarkGray+10 51..53 fg=Magenta+10 53..60 fg=Magenta mod=BOLD+11 1..11 mod=DIM | CROSSED_OUT+11 48..51 fg=DarkGray+11 51..63 fg=Magenta+11 63..92 fg=DarkGray+12 1..9 fg=Cyan+12 48..51 fg=DarkGray+12 54..69 mod=DIM | ITALIC+13 1..7 mod=DIM+13 48..51 fg=DarkGray+13 54..71 mod=DIM+15 0..2 fg=Cyan+15 2..51 mod=DIM | ITALIC+17 0..1 fg=DarkGray+17 2..17 fg=DarkGray+17 44..54 fg=Cyan mod=BOLD+17 54..61 mod=DIM+17 64..73 fg=Cyan mod=BOLD+17 73..80 mod=DIM+17 83..89 fg=Cyan mod=BOLD+17 89..100 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_stacked_narrow.snap b/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_stacked_narrow.snapnew file mode 100644index 000000000..3d52b7f6e--- /dev/null+++ b/src-tauri/src/core/cli/tui/tests/snapshots/todo_panel_stacked_narrow.snap@@ -0,0 +1,50 @@+---+source: src/core/cli/tui/tests/snapshot.rs+assertion_line: 163+expression: render_snapshot(buf)+---+| π gpt-5-mini effort medium ctx 0K/128K fallback [work|+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+| |+| |+| |+| build it |+| |+|Todos Β· 0/2 /todo |+| β routes |+| β auth |+|β‘ 1 agent |+|β’ api-review 2t Β· 2r |+| review the file |+| read src/mod_1.rs |+|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|+|β’ workingβ¦ (Esc to cancel, type to steer the agent) |+| |+| Esc/Ctrl-C cancel PgUp/PgDn scroll Ctrl-O expand all |++ 0 0..2 fg=Yellow+ 0 3..14 mod=BOLD+ 0 14..29 fg=Yellow+ 0 55..60 fg=Cyan mod=BOLD+ 5 0..1 fg=LightMagenta bg=#282C3A mod=BOLD+ 5 1..9 fg=#E9ECF2 bg=#282C3A mod=BOLD+ 5 9..10 bg=#282C3A+ 7 0..5 fg=Cyan mod=BOLD+ 7 5..11 mod=DIM+ 7 11..19 fg=DarkGray+ 8 1..9 fg=Cyan+ 9 1..7 mod=DIM+10 0..2 fg=Magenta+10 2..9 fg=Magenta mod=BOLD+11 0..12 fg=Magenta+11 12..21 fg=DarkGray+12 3..18 mod=DIM | ITALIC+13 3..20 mod=DIM+15 0..2 fg=Cyan+15 2..51 mod=DIM | ITALIC+17 1..11 fg=Cyan mod=BOLD+17 11..18 mod=DIM+17 21..30 fg=Cyan mod=BOLD+17 30..37 mod=DIM+17 40..46 fg=Cyan mod=BOLD+17 46..57 mod=DIMdiff --git a/src-tauri/src/core/cli/tui/theme.rs b/src-tauri/src/core/cli/tui/theme.rsindex f5c5e5452..42db22f53 100644--- a/src-tauri/src/core/cli/tui/theme.rs+++ b/src-tauri/src/core/cli/tui/theme.rs@@ -54,9 +54,35 @@ pub(super) struct Theme {/// their background, one value serves both themes.const STRONG_ACCENT_ANSI16: Color = Color::Yellow;+#[cfg(test)]+thread_local! {+ /// Per-test override, like `motion::with_mode`: a snapshot test pins its+ /// own thread's theme instead of racing others on the shared statics.+ /// Deliberately not consulted by `is_light`, which seeds the process-wide+ /// syntect theme once: an override seen there would leak into every later+ /// test in the process.+ static THEME_OVERRIDE: std::cell::Cell<Option<Theme>> =+ const { std::cell::Cell::new(None) };+}++/// Run `f` with `theme` as this thread's resolved theme.+#[cfg(test)]+pub(super) fn with_theme<T>(theme: Theme, f: impl FnOnce() -> T) -> T {+ THEME_OVERRIDE.with(|c| c.set(Some(theme)));+ let out = f();+ THEME_OVERRIDE.with(|c| c.set(None));+ out+}+impl Theme {/// The theme resolved at startup (dark truecolor before resolution).pub(super) fn current() -> Self {+ #[cfg(test)]+ {+ if let Some(over) = THEME_OVERRIDE.with(std::cell::Cell::get) {+ return over;+ }+ }Self {light: is_light(),depth: ColorDepth::from_u8(DEPTH.load(Ordering::Relaxed)),