feat(desktop): per-turn usage pill in the status bar#3127
Open
HUQIANTAO wants to merge 1 commit into
Open
Conversation
…tion ↻cache) The status bar showed session-aggregate cache-hit % and the running turn's wall-clock + token count, but the actual per-turn prompt/completion/cache numbers were only visible by digging into the WireUsage payload in devtools. For a cost-aware user (especially on DeepSeek where cache hits are 90% cheaper than misses) the billable numbers deserve a permanent place. Add components/UsageIndicator.tsx: a 3-cell pill that mounts in the status bar to the right of the cache-hit %. Each cell is a tiny caption + value pair: ↑ 1.2k prompt tokens this turn ↓ 280 completion tokens this turn ↻ 850 cache-hit tokens (only rendered when > 0) The values are k-rounded (1.2k / 18k / 0) to keep the bar compact. The cache cell uses the existing --add-fg token so the green cue matches the rest of the UI. A real sparkline (per-turn history) needs a separate ring buffer in the controller — the WireUsage payload only carries the latest turn. That's a follow-up; the pill is the immediate win and the sparkline is a drop-in upgrade. StatusBar.tsx mounts the pill when usage is present (the controller dispatches a usage event on every model step, so the pill ticks as the turn progresses).
2bb4e71 to
4239449
Compare
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.
The status bar showed session-aggregate cache-hit % and the running turn's wall-clock + token count, but the actual per-turn prompt/completion/cache numbers were only visible by digging into the WireUsage payload in devtools. For a cost-aware user the billable numbers deserve a permanent place.
Add
components/UsageIndicator.tsx: a 3-cell pill that mounts in the status bar:↑ 1.2k prompt tokens this turn
↓ 280 completion tokens this turn
↻ 850 cache-hit tokens (only rendered when > 0)
The values are k-rounded to keep the bar compact. The cache cell uses --add-fg so the green cue matches the rest of the UI.