Files
codewhale/crates/tui
Hunter Bown de4085304d feat(tui): inline spillover-path annotation in tool cells (#423)
PR #422 (sister commit on this branch) shipped the storage half:
\`crates/tui/src/tools/truncate.rs\` writes large tool outputs to
\`~/.deepseek/tool_outputs/<id>.txt\` and the boot prune drops files
older than 7 days. This commit ships the UI half — the inline
annotation that surfaces the spilled path in the tool cell so the
user (and the model) can find the elided tail.

### What's wired

- New \`spillover_path: Option<PathBuf>\` field on \`GenericToolCell\`.
  Threaded through every construction site (production +
  test fixtures = 28 sites; bulk-updated via a Python regex that
  preserves indentation per site).
- \`tool_routing::push_orphan_tool_completion\` now reads
  \`ToolResult.metadata.spillover_path\` and stamps it on the cell.
  When tools start writing the metadata field (#500's wiring step),
  the annotation lights up automatically.
- \`GenericToolCell::lines_with_mode\` emits a one-line muted
  annotation in \`RenderMode::Live\` only:

      full output: /Users/you/.deepseek/tool_outputs/call-abc12.txt

  Transcript-mode replay omits the annotation because the full
  output is already inline.
- \`render_spillover_annotation\` truncates the path to fit narrow
  widths (40-col sidebar friendly) using the existing
  \`truncate_text\` helper.

### Why no OSC 8 hyperlink yet

The OSC 8 wrap-link helper lives on PR #515's branch (also stacked
on \`chore/v0.8.8-stabilization\`); both PRs land independently to
\`main\`. Once both are in, a follow-up commit can wrap the path
in \`osc8::wrap_link\` so supporting terminals make it
Cmd+click-openable. The plain-text path works in every terminal
today, so there's no functional regression.

### Tests

4 new tests in \`tui::history::tests\`:
- \`render_spillover_annotation_shows_path\` — full path appears in
  the live-mode render
- \`render_spillover_annotation_omitted_in_transcript_mode\` —
  transcript replay leaves the annotation off
- \`render_spillover_annotation_omitted_when_no_path_set\` — the
  common case (most tool results don't trigger spillover) is
  unaffected
- \`render_spillover_annotation_truncates_to_width\` — narrow
  widths don't overflow the line

### Verification

cargo fmt --all -- --check                                          ✓
cargo clippy --workspace --all-targets --all-features --locked --   -D warnings   ✓
cargo test --workspace --all-features --locked                      ✓ 1877 + supporting (was 1873)

Closes #423. #500 (preview pane) now has both halves of its
prerequisites in place — the bytes are on disk (#422) and the path
is surfaced in the cell (#423).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 04:44:43 -05:00
..