Skip to content

feat(tui): add configurable status line#86

Open
hakula139 wants to merge 10 commits into
mainfrom
feat/status-line
Open

feat(tui): add configurable status line#86
hakula139 wants to merge 10 commits into
mainfrom
feat/status-line

Conversation

@hakula139
Copy link
Copy Markdown
Owner

@hakula139 hakula139 commented May 14, 2026

Summary

Adds a configurable TUI status line backed by an ordered roster of built-in segments. The default line now shows project location, branch, model / effort, cache-aware context use, estimated in-process session cost, run state, and thread title while letting users reorder or omit segments through config.

  • Replaces the fixed status bar composition with [tui].status_line and OX_STATUS_LINE.
  • Threads Anthropic usage through the agent loop so the TUI can show context pressure and session cost estimates.
  • Documents the status-line design, current scope, and deferred account-limit / external-billing work.

Design decisions

  • Use a typed ordered roster. Built-in segment names keep rendering inside Ratatui while giving users control over order without introducing a command-renderer boundary yet.
  • Keep colors and separators theme-owned. Segment styling and the separator glyph come from the active theme, so there is no separate status-line color flag or separator setting to keep in sync.
  • Use local usage first. Context and cost use provider usage already observed by the current process, including cache creation and cache read tokens. External billing totals and provider account limits are deferred until there is a first-class telemetry boundary.
  • Preserve a curated picker. The model catalogue carries known rates, including the active Opus 4.1 row for explicit users, while /model aliases and picker rows stay focused on the current defaults.

Changes

File Description
config.rs, config/file.rs Add StatusLineSegment, default segment order, TOML parsing for [tui].status_line, OX_STATUS_LINE env support, and non-empty roster validation.
agent.rs, agent/event.rs, client/anthropic/*, model.rs Capture cache-aware usage, emit UsageUpdated, accumulate estimated session cost across every model request in a turn, and store first-party Claude rates beside model metadata.
main.rs, tui/app.rs, tui/components/status.rs, tui/components/status/line.rs, tui/theme.rs Feed cwd / git branch / usage state into the TUI, preserve usage state on failed resume, refresh current-time while idle, and render ordered status-line segments with omission and narrow-width fitting.
slash.rs, slash/context.rs, slash/model.rs, prompt/environment.rs Keep live session metadata and model lookup behavior aligned with the expanded status-line model catalogue.
tui/components/snapshots/*, tui/snapshots/* Update status and frame snapshots for the new status-line composition.
docs/research/tui/status-line.md, docs/design/tui/status-line.md, docs/guide/configuration.md, docs/guide/theming.md, docs/roadmap.md Add the research / design docs and update user-facing configuration, theming, roadmap, and status claims.
README.md, CLAUDE.md, docs/design/README.md, docs/research/README.md, docs/design/agent/auto-compaction.md, docs/design/slash/compact.md Sync docs index entries, crate tree, feature status, and compaction wording with the new usage surface.

Test plan

  • cargo fmt --all --check
  • cargo build
  • cargo clippy --all-targets -- -D warnings: zero warnings
  • cargo test: 2039 tests pass
  • cargo llvm-cov --ignore-filename-regex 'main\\.rs': 98.64% line coverage
  • pnpm lint: 0 errors
  • pnpm spellcheck: 0 issues

hakula139 added 3 commits May 14, 2026 15:10
Reframe the earlier usage-only design around the full status-line feature. The updated research keeps Claude Code, Codex, opencode, and the local setup as references while making the oxide-code choice explicit: a typed ordered roster of built-in segments first, with command hooks and account-limit telemetry deferred.

The design now documents configurable ordering, implemented segment names, usage/cost data flow, default order, and the boundaries for later billing and task metadata work.
Replace the fixed status bar layout with an ordered built-in segment roster driven by [tui].status_line and OX_STATUS_LINE. The renderer keeps styling in the active theme, omits unavailable segments, and drops lower-utility segments before clipping core model/run-state information on narrow terminals.

Thread Anthropic usage through the agent loop so the TUI can show cache-aware context pressure and an in-process estimated session cost. Pricing now lives on the model catalogue instead of a parallel matcher, with per-model rate rows for the known Claude catalogue.

Update user docs, roadmap status, crate-tree notes, and snapshots to match the new status-line surface.
Anthropic's current lifecycle table still lists Opus 4.1 as active, so treating it as unknown would break explicit dated-id users and suppress available session-cost estimates.

Keep Opus 4 deprecated and non-selectable, but restore the Opus 4.1 catalogue row with its higher first-party pricing. The picker remains curated to the latest Opus default.
@hakula139 hakula139 added the enhancement New feature or request label May 14, 2026
@hakula139 hakula139 self-assigned this May 14, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

❌ Patch coverage is 99.86825% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rates/oxide-code/src/tui/components/status/line.rs 99.58% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

hakula139 added 7 commits May 14, 2026 16:34
Keep the latest provider usage for context pressure and auto-compaction, but accumulate every model request in a turn for billing estimates. Multi-round tool turns otherwise charged only the final assistant response and under-reported the status-line session cost.
A failed mid-session resume leaves the user on the current session, so clearing auto-compaction and status-line usage state made the still-active session lose context pressure and cost accounting. Return whether the swap succeeded and reset state only after an actual session change.
The configurable current-time segment was rendered from wall-clock time but idle status bars never marked the app dirty. Track the displayed minute for status lines that include current-time and request a repaint when it changes, without waking bars that do not render time.
An empty status-line roster hides the run state and interrupt affordances without making that tradeoff explicit. Validate both OX_STATUS_LINE and TOML status_line after parsing so launch fails with an actionable error instead of drawing blank chrome.
Remove stale wording that treated token and cost status as wholly deferred after the configurable status line shipped. Keep the remaining roadmap focused on extensions such as account-level billing, detailed cost commands, and persisted restore.
Add focused tests for the user-visible status-line branches Codecov highlighted: current-time rendering, final-segment truncation at very narrow widths, and priority-based omission before context, model, and run state are dropped.
The status-line cost estimate reads the active prompt-cache TTL through the client. Extend the existing config exposure test so the accessor stays covered without adding a getter-only test case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant