Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

test(agent-tui): snapshot the transcript body

Akarshan Biswas8b8605681b74
diff --git a/src-tauri/src/core/cli/tui/tests/snapshot.rs b/src-tauri/src/core/cli/tui/tests/snapshot.rs
index a28056671..bf856ab5d 100644
--- a/src-tauri/src/core/cli/tui/tests/snapshot.rs
+++ b/src-tauri/src/core/cli/tui/tests/snapshot.rs
@@ -1,6 +1,6 @@
//! 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.
+//! subagent panels, `/agents`, the model picker, and the transcript body.
//!
//! Snapshot or substring? The two catch different regressions, so pick by what
//! would break:
@@ -29,6 +29,7 @@
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::{input_box_height, Level, TRANSCRIPT_BOTTOM_PAD};
use crate::core::cli::tui::theme::{with_theme, ColorDepth, Theme};
use ratatui::backend::TestBackend;
use ratatui::widgets::Paragraph;
@@ -556,3 +557,243 @@ fn model_picker_wide_with_a_query() {
}
assert_buffer("model_picker_w120_query", &frame(&mut app, DARK, 120, 14));
}
+
+// ---- Transcript body --------------------------------------------------------
+//
+// The conversation as `draw` lays it out, cropped to the body: the header,
+// the separator, the input box and the dock are covered above or by their own
+// tests, and leaving them out keeps a transcript change from reading as a
+// chrome change. Leading blank rows (the top padding that bottom-anchors a
+// short transcript) are dropped too, so the frame height is not part of the
+// baseline.
+
+const BODY_WIDTH: u16 = 80;
+const BODY_HEIGHT: u16 = 40;
+
+/// Draw the full frame, then keep only the body rows that carry content.
+fn body(app: &mut App) -> Buffer {
+ let full = frame(app, DARK, BODY_WIDTH, BODY_HEIGHT);
+ let input_h = pinned(DARK, || input_box_height(app, BODY_WIDTH));
+ // Header and the body's top border above; the air row, the rule, the
+ // input and the dock line below. No fixture docks a status panel.
+ let last = BODY_HEIGHT - TRANSCRIPT_BOTTOM_PAD - 1 - input_h - 1;
+ let blank = |y: u16| {
+ (0..BODY_WIDTH).all(|x| {
+ let cell = &full[(x, y)];
+ cell.symbol() == " " && style_key(cell).is_empty()
+ })
+ };
+ let first = (2..last).find(|&y| !blank(y)).unwrap_or(last);
+ let area = Rect::new(0, 0, BODY_WIDTH, (last - first).max(1));
+ let mut buf = Buffer::empty(area);
+ for y in first..last {
+ for x in 0..BODY_WIDTH {
+ buf[(x, y - first)] = full[(x, y)].clone();
+ }
+ }
+ buf
+}
+
+/// End the turn with a receipt, as the stream's `Done` does, then pin the
+/// receipt's clock-derived fields (the local timestamp, the elapsed time and
+/// the rate it implies) so the row is a pure function of the token counts.
+fn finish_turn(app: &mut App, prompt: u64, output: u64) {
+ app.apply(StreamEvent::TurnUsage {
+ usage: Usage {
+ prompt_tokens: Some(prompt),
+ completion_tokens: Some(output),
+ total_tokens: Some(prompt + output),
+ ..Usage::default()
+ },
+ execution_id: None,
+ });
+ app.run_started = Some(Instant::now());
+ app.on_done("stop".into(), None);
+ let receipt = app
+ .transcript
+ .iter()
+ .rposition(|r| {
+ matches!(&r.kind, RowKind::Line(l) if line_text(l).contains('\u{23f1}'))
+ })
+ .expect("the turn left a receipt");
+ let RowKind::Line(line) = &app.transcript[receipt].kind else {
+ unreachable!("matched a line row above");
+ };
+ let mut spans = line.spans.clone();
+ for (i, pinned) in [(0, "2026-01-02 03:04"), (6, "2.0s"), (8, "60.0/s")] {
+ spans[i].content = pinned.into();
+ }
+ app.transcript[receipt] = Row::line(Line::from(spans));
+}
+
+fn tool_call(app: &mut App, id: &str, name: &str, args: serde_json::Value) {
+ app.apply(StreamEvent::ToolCall {
+ id: id.into(),
+ name: name.into(),
+ args,
+ });
+}
+
+fn tool_result(app: &mut App, id: &str, content: &str, is_error: bool, diff: Option<&str>) {
+ app.apply(StreamEvent::ToolResult {
+ id: id.into(),
+ content: content.into(),
+ is_error,
+ diff: diff.map(String::from),
+ });
+}
+
+fn token(app: &mut App, text: &str) {
+ app.apply(StreamEvent::Token { text: text.into() });
+}
+
+#[test]
+fn transcript_markdown_answer_with_receipt() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "how do I build the cli?");
+ token(
+ &mut app,
+ concat!(
+ "## Building\n\n",
+ "Run these from `src-tauri`:\n\n",
+ "- stub the resources with `node ../scripts/stub-tauri-resources.mjs`\n",
+ "- then `cargo build --features cli`\n\n",
+ "The binary lands in **target/debug**.",
+ ),
+ );
+ finish_turn(&mut app, 12_400, 120);
+ assert_buffer("transcript_markdown_answer_with_receipt", &body(&mut app));
+}
+
+#[test]
+fn transcript_closed_tool_group() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "where is the parser?");
+ tool_call(&mut app, "c1", "grep", json!({ "pattern": "fn parse_command" }));
+ tool_call(&mut app, "c2", "glob", json!({ "pattern": "src/**/*.rs" }));
+ tool_call(&mut app, "c3", "read", json!({ "path": "src/core/cli/tui.rs" }));
+ tool_call(&mut app, "c4", "read", json!({ "path": "src/core/cli/mod.rs" }));
+ tool_result(&mut app, "c1", "src/core/cli/tui.rs:812: fn parse_command(", false, None);
+ tool_result(&mut app, "c2", "src/main.rs\nsrc/lib.rs\nsrc/core/cli/tui.rs", false, None);
+ tool_result(&mut app, "c3", "fn main() {}", false, None);
+ tool_result(&mut app, "c4", "pub mod tui;", false, None);
+ app.finalize_tool_group();
+ assert_buffer("transcript_closed_tool_group", &body(&mut app));
+}
+
+#[test]
+fn transcript_finished_shell_command() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "run the tests");
+ tool_call(&mut app, "b1", "bash", json!({ "command": "cargo test --lib parser" }));
+ tool_result(
+ &mut app,
+ "b1",
+ concat!(
+ "running 3 tests\n",
+ "test parser::empty ... ok\n",
+ "test parser::nested ... ok\n",
+ "test parser::unicode ... ok\n",
+ "\n",
+ "test result: ok. 3 passed; 0 failed",
+ ),
+ false,
+ None,
+ );
+ // While the group is still the current step the box lingers with its
+ // output; once it closes the call folds to its summary row.
+ let open = body(&mut app);
+ app.finalize_tool_group();
+ assert_buffer("transcript_finished_shell_command_open", &open);
+ assert_buffer("transcript_finished_shell_command", &body(&mut app));
+}
+
+#[test]
+fn transcript_running_shell_command() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "build it");
+ tool_call(&mut app, "b1", "bash", json!({ "command": "make build" }));
+ for chunk in ["compiling core\n", "compiling cli\n", "linking jan"] {
+ app.apply(StreamEvent::ToolOutputDelta {
+ id: "b1".into(),
+ delta: chunk.into(),
+ });
+ }
+ // The box reports whole elapsed seconds; a fresh start reads `0s`.
+ if let Some(group) = app.tool_group.as_mut() {
+ group.started = Instant::now();
+ }
+ assert_buffer("transcript_running_shell_command", &body(&mut app));
+}
+
+#[test]
+fn transcript_failed_tool_call() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "open the notes");
+ tool_call(&mut app, "c1", "read", json!({ "path": "docs/missing.md" }));
+ tool_result(
+ &mut app,
+ "c1",
+ "ERROR: No such file or directory: docs/missing.md",
+ true,
+ None,
+ );
+ app.finalize_tool_group();
+ assert_buffer("transcript_failed_tool_call", &body(&mut app));
+}
+
+#[test]
+fn transcript_edit_with_diff() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "use u64 for the area");
+ tool_call(&mut app, "e1", "edit", json!({ "path": "src/geometry.rs" }));
+ tool_result(
+ &mut app,
+ "e1",
+ "Applied 1 edit(s) to src/geometry.rs",
+ false,
+ Some(concat!(
+ "@@ edit 1/1 @@\n",
+ " use std::fmt;\n",
+ "-fn area(w: u32, h: u32) -> u32 {\n",
+ "+fn area(w: u64, h: u64) -> u64 {\n",
+ " w * h",
+ )),
+ );
+ assert_buffer("transcript_edit_with_diff", &body(&mut app));
+}
+
+#[test]
+fn transcript_folded_reasoning_and_answer() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "is 91 prime?");
+ app.apply(StreamEvent::Reasoning {
+ text: "91 is odd. Try 7: 7 * 13 = 91, so it has a factor.".into(),
+ });
+ // Backdated so the fold names a whole number of seconds.
+ app.thinking_since = Some(Instant::now() - Duration::from_secs(3));
+ token(&mut app, "No: 91 = 7 x 13.");
+ finish_turn(&mut app, 900, 40);
+ assert_buffer("transcript_folded_reasoning_and_answer", &body(&mut app));
+}
+
+#[test]
+fn transcript_error_and_warning_notes() {
+ let mut app = snapshot_app();
+ app.note("model switched to gpt-5-mini");
+ app.system(Level::Warn, "press Ctrl-C or Ctrl-D again to quit");
+ start_turn(&mut app, "summarize the log");
+ app.on_error("upstream".into(), "502 Bad Gateway from the provider".into());
+ assert_buffer("transcript_error_and_warning_notes", &body(&mut app));
+}
+
+#[test]
+fn transcript_user_tool_and_answer() {
+ let mut app = snapshot_app();
+ start_turn(&mut app, "what does main do?");
+ tool_call(&mut app, "c1", "read", json!({ "path": "src/main.rs" }));
+ tool_result(&mut app, "c1", "fn main() { app_lib::run() }", false, None);
+ token(&mut app, "It hands off to `app_lib::run`, which starts the app.");
+ finish_turn(&mut app, 3_100, 18);
+ assert_buffer("transcript_user_tool_and_answer", &body(&mut app));
+}
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_closed_tool_group.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_closed_tool_group.snap
new file mode 100644
index 000000000..846c0b7f5
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_closed_tool_group.snap
@@ -0,0 +1,14 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| where is the parser? |
+| |
+|│ ✓ Read 2 files; ran 1 search, 1 file search |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..21 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 21..22 bg=#282C3A
+ 2 0..2 fg=DarkGray
+ 2 2..4 fg=Green
+ 2 4..45 mod=DIM
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_edit_with_diff.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_edit_with_diff.snap
new file mode 100644
index 000000000..99e6f5018
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_edit_with_diff.snap
@@ -0,0 +1,73 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| use u64 for the area |
+| |
+|│ ✓ Edited geometry.rs |
+|│ ┌───────────────────────────────────┐ |
+|│ │ @@ edit 1/1 @@ │ |
+|│ │ use std::fmt; │ |
+|│ │ -fn area(w: u32, h: u32) -> u32 { │ |
+|│ │ +fn area(w: u64, h: u64) -> u64 { │ |
+|│ │ w * h │ |
+|│ └───────────────────────────────────┘ |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..21 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 21..22 bg=#282C3A
+ 2 0..2 fg=DarkGray
+ 2 2..4 fg=Green
+ 2 4..22 mod=DIM
+ 3 0..43 fg=DarkGray
+ 4 0..8 fg=DarkGray
+ 4 8..22 fg=Cyan mod=DIM
+ 4 22..43 fg=DarkGray
+ 5 0..8 fg=DarkGray
+ 5 8..9 mod=DIM
+ 5 9..12 fg=#B48EAD
+ 5 12..22 fg=#C0C5CE
+ 5 22..43 fg=DarkGray
+ 6 0..7 fg=DarkGray
+ 6 7..8 fg=DarkGray bg=#421A1E
+ 6 8..9 fg=Red bg=#421A1E mod=BOLD
+ 6 9..11 fg=#B48EAD bg=#421A1E
+ 6 11..12 fg=#C0C5CE bg=#421A1E
+ 6 12..16 fg=#8FA1B3 bg=#421A1E
+ 6 16..17 fg=#C0C5CE bg=#421A1E
+ 6 17..18 fg=#BF616A bg=#421A1E
+ 6 18..20 fg=#C0C5CE bg=#421A1E
+ 6 20..23 fg=#B48EAD bg=#421A1E
+ 6 23..25 fg=#C0C5CE bg=#421A1E
+ 6 25..26 fg=#BF616A bg=#421A1E
+ 6 26..28 fg=#C0C5CE bg=#421A1E
+ 6 28..31 fg=#B48EAD bg=#421A1E
+ 6 31..36 fg=#C0C5CE bg=#421A1E
+ 6 36..39 fg=#B48EAD bg=#421A1E
+ 6 39..41 fg=#C0C5CE bg=#421A1E
+ 6 41..42 fg=DarkGray bg=#421A1E
+ 6 42..43 fg=DarkGray
+ 7 0..7 fg=DarkGray
+ 7 7..8 fg=DarkGray bg=#163420
+ 7 8..9 fg=Green bg=#163420 mod=BOLD
+ 7 9..11 fg=#B48EAD bg=#163420
+ 7 11..12 fg=#C0C5CE bg=#163420
+ 7 12..16 fg=#8FA1B3 bg=#163420
+ 7 16..17 fg=#C0C5CE bg=#163420
+ 7 17..18 fg=#BF616A bg=#163420
+ 7 18..20 fg=#C0C5CE bg=#163420
+ 7 20..23 fg=#B48EAD bg=#163420
+ 7 23..25 fg=#C0C5CE bg=#163420
+ 7 25..26 fg=#BF616A bg=#163420
+ 7 26..28 fg=#C0C5CE bg=#163420
+ 7 28..31 fg=#B48EAD bg=#163420
+ 7 31..36 fg=#C0C5CE bg=#163420
+ 7 36..39 fg=#B48EAD bg=#163420
+ 7 39..41 fg=#C0C5CE bg=#163420
+ 7 41..42 fg=DarkGray bg=#163420
+ 7 42..43 fg=DarkGray
+ 8 0..8 fg=DarkGray
+ 8 8..9 mod=DIM
+ 8 9..18 fg=#C0C5CE
+ 8 18..43 fg=DarkGray
+ 9 0..43 fg=DarkGray
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_error_and_warning_notes.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_error_and_warning_notes.snap
new file mode 100644
index 000000000..d0e4a3839
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_error_and_warning_notes.snap
@@ -0,0 +1,18 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+|• model switched to gpt-5-mini |
+|• press Ctrl-C or Ctrl-D again to quit |
+| |
+| summarize the log |
+| |
+|• error: 502 Bad Gateway from the provider |
+
+ 0 0..2 fg=LightBlue
+ 0 2..30 mod=DIM
+ 1 0..38 fg=Yellow
+ 3 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 3 1..18 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 3 18..19 bg=#282C3A
+ 5 0..42 fg=Red mod=BOLD
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_failed_tool_call.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_failed_tool_call.snap
new file mode 100644
index 000000000..bcae560d7
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_failed_tool_call.snap
@@ -0,0 +1,14 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| open the notes |
+| |
+|│ ✗ Read missing.md |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..15 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 15..16 bg=#282C3A
+ 2 0..2 fg=DarkGray
+ 2 2..4 fg=Red
+ 2 4..19 mod=DIM
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_finished_shell_command.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_finished_shell_command.snap
new file mode 100644
index 000000000..4f3386d2d
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_finished_shell_command.snap
@@ -0,0 +1,14 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| run the tests |
+| |
+|│ ✓ Ran: cargo test --lib parser |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..14 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 14..15 bg=#282C3A
+ 2 0..2 fg=DarkGray
+ 2 2..4 fg=Green
+ 2 4..32 mod=DIM
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_finished_shell_command_open.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_finished_shell_command_open.snap
new file mode 100644
index 000000000..1ea4eb8f6
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_finished_shell_command_open.snap
@@ -0,0 +1,45 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| run the tests |
+| |
+|│ ┌──────────────────────────────────────────────────────────────────────────┐|
+|│ │ $ cargo test --lib parser │|
+|│ │ running 3 tests │|
+|│ │ test parser::empty ... ok │|
+|│ │ test parser::nested ... ok │|
+|│ │ test parser::unicode ... ok │|
+|│ │ │|
+|│ │ test result: ok. 3 passed; 0 failed │|
+|│ │ ✓ │|
+|│ └──────────────────────────────────────────────────────────────────────────┘|
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..14 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 14..15 bg=#282C3A
+ 2 0..80 fg=DarkGray
+ 3 0..6 fg=DarkGray
+ 3 6..8 fg=Cyan mod=BOLD
+ 3 8..31 mod=BOLD
+ 3 31..80 fg=DarkGray
+ 4 0..6 fg=DarkGray
+ 4 6..21 mod=DIM
+ 4 21..80 fg=DarkGray
+ 5 0..6 fg=DarkGray
+ 5 6..31 mod=DIM
+ 5 31..80 fg=DarkGray
+ 6 0..6 fg=DarkGray
+ 6 6..32 mod=DIM
+ 6 32..80 fg=DarkGray
+ 7 0..6 fg=DarkGray
+ 7 6..33 mod=DIM
+ 7 33..80 fg=DarkGray
+ 8 0..80 fg=DarkGray
+ 9 0..6 fg=DarkGray
+ 9 6..41 mod=DIM
+ 9 41..80 fg=DarkGray
+10 0..6 fg=DarkGray
+10 6..7 fg=Green
+10 7..80 fg=DarkGray
+11 0..80 fg=DarkGray
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_folded_reasoning_and_answer.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_folded_reasoning_and_answer.snap
new file mode 100644
index 000000000..bbc372eac
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_folded_reasoning_and_answer.snap
@@ -0,0 +1,26 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| is 91 prime? |
+| |
+|┊ Thought for 3s |
+| |
+|No: 91 = 7 x 13. |
+| |
+|2026-01-02 03:04 ↑ 900 ↓ 40 ⏱ 2.0s ⚡ 60.0/s |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..13 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 13..14 bg=#282C3A
+ 2 0..2 fg=DarkGray
+ 2 2..16 mod=DIM | ITALIC
+ 6 0..20 fg=#808080
+ 6 20..23 mod=DIM
+ 6 23..27 fg=#808080
+ 6 27..29 mod=DIM
+ 6 29..33 fg=#808080
+ 6 33..37 mod=DIM
+ 6 37..40 fg=#808080
+ 6 41..42 fg=#808080
+ 6 42..48 mod=DIM
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_markdown_answer_with_receipt.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_markdown_answer_with_receipt.snap
new file mode 100644
index 000000000..07fc47eea
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_markdown_answer_with_receipt.snap
@@ -0,0 +1,36 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| how do I build the cli? |
+| |
+|Building |
+| |
+|Run these from src-tauri: |
+| |
+|- stub the resources with node ../scripts/stub-tauri-resources.mjs |
+|- then cargo build --features cli |
+| |
+|The binary lands in target/debug. |
+| |
+|2026-01-02 03:04 ↑ 12K ↓ 120 ⏱ 2.0s ⚡ 60.0/s |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..24 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 24..25 bg=#282C3A
+ 2 0..8 fg=Cyan mod=BOLD
+ 4 15..24 fg=Cyan
+ 6 0..2 fg=Cyan
+ 6 26..66 fg=Cyan
+ 7 0..2 fg=Cyan
+ 7 7..33 fg=Cyan
+ 9 20..32 fg=#FFA500 mod=BOLD
+11 0..20 fg=#808080
+11 20..23 mod=DIM
+11 23..27 fg=#808080
+11 27..30 mod=DIM
+11 30..34 fg=#808080
+11 34..38 mod=DIM
+11 38..41 fg=#808080
+11 42..43 fg=#808080
+11 43..49 mod=DIM
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_running_shell_command.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_running_shell_command.snap
new file mode 100644
index 000000000..88b29bd68
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_running_shell_command.snap
@@ -0,0 +1,35 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| build it |
+| |
+|│ ┌──────────────────────────────────────────────────────────────────────────┐|
+|│ │ $ make build │|
+|│ │ compiling core │|
+|│ │ compiling cli │|
+|│ │ linking jan │|
+|│ │ • 0s │|
+|│ └──────────────────────────────────────────────────────────────────────────┘|
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..9 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 9..10 bg=#282C3A
+ 2 0..80 fg=DarkGray
+ 3 0..6 fg=DarkGray
+ 3 6..8 fg=Cyan mod=BOLD
+ 3 8..18 mod=BOLD
+ 3 18..80 fg=DarkGray
+ 4 0..6 fg=DarkGray
+ 4 6..20 mod=DIM
+ 4 20..80 fg=DarkGray
+ 5 0..6 fg=DarkGray
+ 5 6..19 mod=DIM
+ 5 19..80 fg=DarkGray
+ 6 0..6 fg=DarkGray
+ 6 6..17 mod=DIM
+ 6 17..80 fg=DarkGray
+ 7 0..6 fg=DarkGray
+ 7 6..8 fg=Cyan
+ 7 8..80 fg=DarkGray
+ 8 0..80 fg=DarkGray
diff --git a/src-tauri/src/core/cli/tui/tests/snapshots/transcript_user_tool_and_answer.snap b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_user_tool_and_answer.snap
new file mode 100644
index 000000000..d9cba0efc
--- /dev/null
+++ b/src-tauri/src/core/cli/tui/tests/snapshots/transcript_user_tool_and_answer.snap
@@ -0,0 +1,28 @@
+---
+source: src/core/cli/tui/tests/snapshot.rs
+expression: render_snapshot(buf)
+---
+| what does main do? |
+| |
+|│ ✓ Read main.rs |
+| |
+|It hands off to app_lib::run, which starts the app. |
+| |
+|2026-01-02 03:04 ↑ 3.1K ↓ 18 ⏱ 2.0s ⚡ 60.0/s |
+
+ 0 0..1 fg=LightMagenta bg=#282C3A mod=BOLD
+ 0 1..19 fg=#E9ECF2 bg=#282C3A mod=BOLD
+ 0 19..20 bg=#282C3A
+ 2 0..2 fg=DarkGray
+ 2 2..4 fg=Green
+ 2 4..16 mod=DIM
+ 4 16..28 fg=Cyan
+ 6 0..20 fg=#808080
+ 6 20..24 mod=DIM
+ 6 24..28 fg=#808080
+ 6 28..30 mod=DIM
+ 6 30..34 fg=#808080
+ 6 34..38 mod=DIM
+ 6 38..41 fg=#808080
+ 6 42..43 fg=#808080
+ 6 43..49 mod=DIM