feat(tui): add configurable session token header#4610
Conversation
|
Thanks @XhesicaFrost for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
Add an opt-in tui.header_items tokens chip to the active underwater header, showing cumulative input, cache-hit, and output usage. Preserve the existing header chrome under width pressure by eliding only the optional token breakdown. Cover deterministic 40/60/80/100-column behavior, config round trips, and the documented setting. Refs Hmbown#4520
17905a8 to
0b9cb71
Compare
|
Thank you for picking up the header token-breakdown request and for documenting the width matrix and baseline failures carefully. The linked issue was explicitly held for v0.9.2 so we do not expand the frozen v0.9.1 candidate; I have applied that label to the PR and am leaving the source branch intact. This is a deferral, not a rejection. After the 0.9.1 cut, the maintainer pass should rebase onto current main, run the strict locked workspace gate, resolve the full-suite delta, and review the provider missing-usage semantics called out in the issue before merge. |
Summary
Refs #4520.
Add an opt-in session token breakdown to the active underwater TUI header:
tui.header_itemsconfiguration contract.header_items = ["tokens"]for cumulative input, cache-hit, and output token counts.Example configuration:
The active underwater header continues to use its existing App data path and reads the three cumulative session counters from app.session.
This avoids introducing a second data-access pattern within the same renderer.
Unknown header_items values are ignored so that the configuration can be extended without breaking older clients.
Provider-specific missing-usage semantics are intentionally outside the scope of this change; the header treats the counters consistently
with the existing session token totals.
Testing
cargo test --workspace --all-featuresPR head:
codewhale-tuireported 7,639 passed, 15 failed, and 3 ignored.Direct parent baseline:
codewhale-tuireported 7,636 passed, 12 failed, and3 ignored under the same environment.
Eleven failures reproduced on the direct parent commit.
Four additional terminal-session failures appeared only during the parallel PR
run; the complete terminal-session test group passed 8/8 when run single-
threaded on both the PR head and its direct parent.
All six tests added by this PR passed.
commands::tests::execute_links_and_aliases_return_links_messagefails onboth revisions because it expects
https://codewhale.net/en/docs.Focused header rendering tests at 40, 60, 80, and 100 columns
Default opt-in behavior test
Header configuration parsing and round-trip tests
cargo build -p codewhale-tui --bin codewhale-tui --locked
The width tests verify deterministic rendering at the requested terminal widths:
are hidden by the existing compact layout.
meter remains visible.
At every tested width, the mode and effective-permission indicators remain
visible. When the optional token breakdown does not fit, only that configured item
is removed; the existing context and version chrome retain their original
behavior.
Checklist