feat(desktop): per-turn usage pill in the status bar#3127
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
esengine
left a comment
There was a problem hiding this comment.
Found a real one while reviewing: the entire .usage rule block is spliced inside .onboarding__skip:disabled { … } and reuses its closing brace (the last added rule has no } of its own), so the selectors nest under .onboarding__skip:disabled and the pill ships unstyled. Re-place the block at top level. Two smaller things for the same push: trim the 15-line header essay in UsageIndicator.tsx per the repo comment policy, and rebase (StatusBar/styles moved under this PR in today's batch). The feature itself is on-brand — cost visibility is the pitch — so happy to merge once those are in.
|
Thanks @HUQIANTAO. We are closing this PR as superseded by #4329, which is now the canonical integration route for the cost/currency/status-bar work. Your contribution is recorded in #4329: you introduced the compact per-turn usage indicator concept for prompt, completion, and cache-hit tokens in the desktop status bar. You are acknowledged in #4329 as a repository co-contributor for this work. |
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.