Repository navigation
feat(tui): add opt-in context meter status item - #223
Merged
Merged
Conversation
The status line can already show remaining context headroom as a bare percentage (context-remaining), but a numeric readout is easy to miss while working. Add an opt-in context-meter item that renders the same remaining-headroom value as a compact gauge, e.g. 'Context ▕██████░░▏ 77% left', so the line drains and recolors as the Session approaches its context window. - New canonical item 'context-meter' with 'context-bar' and 'context-gauge' aliases; not part of the default item order. - Renderer shares the runtime usage snapshot, model fallback, and error/warning thresholds with 'context-remaining', and shrinks to a shorter gauge before collapsing to the 'Ctx N%' minimal variant. - Settings picker gains English/Chinese descriptions; the shared status line documentation covers the item, aliases, and opt-in semantics. Validation: tsc -p tsconfig.standalone.json clean; vitest tui-status-line-items.test.ts, tui-workspace-status-line.test.ts, and status-line-picker.test.ts pass (98 tests); node scripts/source-inventory.mjs passes with no inventory changes.
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.
Change
Add the opt-in
context-meterstatus item, withcontext-barandcontext-gaugealiases. The default status line order remains unchanged. The meter shows remaining context as an eight-cell gauge, shrinks to six cells, then toCtx N%when space is limited. It shares usage, model-capacity fallback, color thresholds and fitting priorities withcontext-remaining; absent or invalid data stays hidden. When both items are configured, the meter takes precedence at its configured position. English and Chinese settings descriptions and the status-line configuration guide are updated.Refs #217. This imports the reviewed community contribution from drowzeys/minimax-code, commit 4076c6f521eadccc05c1179c9a73baf004a0a7af, preserving drowzeys as author in commit 3d06380. A separate maintainer commit fixes the missing deduplication, removes duplicated threshold/rendering logic, and adds boundary coverage. Two regression cases reproduced the duplicate percentage before the fix.
Validation
pnpm typecheckandgit diff --check: passed.pnpm verifyon clean committed HEAD787248eec16c38d1f21b7443223c5e6bafee1a64(macOS arm64, Node 26.4.0): 14/14 gates passed, 208.1 seconds.Publication and contribution checks
test/vitest-suites.json.Maintainer handoff
Publication scope or license changes: none.
Shared-source port: pending after public review.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.