feat(tui): Phase 1+2 — theme layer, block-accent grammar, foldable tool output#98
Merged
Conversation
Adopts grok-build's visual grammar: a named color-slot theme and a left accent-bar that marks every agent "machinery" line, so a glance tells you what each block is. - theme.rs: a Theme with ~30 role slots (accent_user/tool/error/…, diff_*, path, status, prompt borders). Three palettes — a GrokNight- style truecolor `dark`, a `light`, and an `ansi` that reproduces hi's historical terminal-respecting look. HI_THEME selects (auto: dark on a truecolor terminal, ansi otherwise), so truecolor users get the designed palette and basic terminals never regress. Global theme() read per-render; set_theme() ready for a future /theme. - render.rs: gutter()/accent_line() helpers (the role-colored `┃ ` bar); diff and code colors now come from theme slots. - transcript.rs: tool calls render as `┃ ◆ verb rest` (accent bar + diamond bullet, bold verb); tool output sits under a dim continuation gutter; status/error/warning/success/changed-files lines carry a role-colored accent bar; the status stream is muted so it no longer shares the user's color. User prompts become a flush-left `❯ …` in accent_user (no bar) and the assistant's prose stays flush-left — the two are the "content", everything else sits behind the accent bar. The result: user/assistant flush-left, all agent activity behind a role-colored bar. Verified with a screen-dump smoke test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ine, prompt) Completes the Phase-1 restyle by moving the app chrome onto the theme slots, so the whole TUI reads as one designed system (not just the transcript). - Title row is now a styled status bar: `hi` as an accent brand mark, provider/model muted, and right-aligned chips — a goal chip in accent_goal, a context chip that warms to the warning color past 80%. - Transcript border, `↓ N new` scroll hint, and the trimmed marker take theme colors (prompt_border / selection / gray_dim). - Pinned plan/goal checklists: headers and step glyphs (✓ ▸ ✗ ☐ ○) from accent_plan/goal/success/error instead of hardcoded Cyan/Magenta. - The "Working" wave and spinner lead use accent_running; the live tool-stream tail uses gray_dim. - Input box border brightens to prompt_border_active while working; its prompt prefix is now `❯` in accent_user, matching the transcript echo. Modal pickers/forms keep their colors for now (less central); they can migrate later. Verified with a full-frame screen-dump smoke. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The first structured (non-flat) transcript entry: tool output is now a
TranscriptEntry::ToolOutput block that retains the *entire* body and
folds long output to a preview instead of hard-truncating it.
- lib.rs: new ToolOutput { body } variant; flatten() gains a
show_tool_output arg. Short output (≤ 16 lines) renders in full as
before — no regression; longer output shows the 16-line preview plus a
"… +N more lines · Ctrl-O to expand" footer, and the full body on
demand. text() (used by /copy and /export) always returns everything.
- Ctrl-O toggles show_tool_output (mirrors Ctrl-T for reasoning),
expanding/collapsing every block's full body; added to the help panel
and the startup hint.
- transcript.rs: push_result keeps the whole result (the old path
discarded everything past line 16) and emits one ToolOutput block;
diff coloring now covers the full output, not just the preview.
- reasoning blocks also moved onto theme slots (accent_thinking /
gray_dim) in the same flatten pass.
This lands the structured-block foundation with fold/expand. Deferred to
P3 (need a per-block selection cursor or full-width block backgrounds):
sunken output panels, per-block folding, the running accent-wave, sticky
headers, mouse selection.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ht the repeat guard Root cause of the "what does this program do" stall (regressed by the 0.2 hardening's task_needs_repository_context keyword gate, 8990b57): orientation questions matched no marker, so the turn ran with NO task context index. A repo-blind model (reproduced with two different models) never explored — it re-posted its update_plan call every round until the turn died. Widen the gate with comprehension markers (" program", " project", " explain", " what ", …) so questions about the workspace carry the repository map. Fix the amplifiers that turned that blindness into a dead turn: - The repeat guard stripped skipped calls from the transcript, leaving a "Provider-invisible content was omitted" placeholder and a nudge claiming "you just ran that exact command" — models concluded their tool layer was broken and gave up. Skipped calls now stay in the transcript paired with synthetic "[not executed: …]" tool results. - Identical update_plan/record_decision re-posts get targeted nudges (the generic "act on that output" read as nonsense for bookkeeping acks) and withhold the whole coordination-tool family for one round (new hi_tools::is_coordination) — withholding only update_plan made the model slide to repeating record_decision instead. - Consecutive repeat-skipped rounds now escalate recovery sampling (StallMode::Repeat): a byte-identical re-emission loop is a token-level pathology that nudge text alone doesn't break. Verified live: the failing prompt now yields a grounded, correct summary (plan completed 3/3) instead of "incomplete · stalled" with zero exploration. 549 tests pass (5 new regression tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts grok-build's TUI visual grammar onto hi's ratatui frontend, in two phases. No layout-tree rewrite, no new dependencies — low-risk and reversible (
HI_THEME=ansirestores the previous look).Phase 1 — theme layer + block-accent grammar
Theme layer (
theme.rs): ~30 named role slots with three palettes — a GrokNight-style truecolor dark, a light, and an ansi that reproduces hi's historical terminal-respecting look.HI_THEMEselects (auto→ dark on a truecolor terminal, ansi otherwise). Every color now flows from one place instead of ~230 scattered literals.Block-accent grammar: tool calls render as
┃ ◆ verb rest(role-colored accent bar + diamond bullet); tool output/status/error/success lines carry a role-colored bar; the status stream is muted; user prompts (❯ …) and the assistant's prose stay flush-left as the "content", everything the agent does sits behind the bar.Themed chrome: title row is a status bar (
himark + muted provider/model + goal/context chips that warm past 80%); borders, scroll hint, plan/goal checklists, the Working wave, and the input box (❯prefix, border brightens while working) all take theme colors.Phase 2 — foldable structured tool-output blocks
The first non-flat transcript entry. Tool output becomes a
ToolOutputblock that keeps the entire body and folds long output to a preview (… +N more lines · Ctrl-O to expand) instead of hard-truncating at 16 lines. Short output renders in full as before (no regression);Ctrl-Oexpands/collapses every block;/copyand/exportalways get the full text.Deferred (P3 tier — structural or new engines)
Sunken output panel backgrounds, per-block selection folding, the running accent-wave animation, sticky prompt headers, mouse selection, a real markdown/syntect engine, OS light/dark auto-follow.
Verification
149 hi-tui tests pass (stale color/glyph expectations migrated to theme slots; new fold + visual-grammar smoke tests);
cargo clippy -D warnings+cargo fmtclean. The real acceptance test is running it in a truecolor terminal.🤖 Generated with Claude Code