Skip to content

feat(tui): add opt-in context meter status item - #223

Merged
hetaoBackend merged 2 commits into
mainfrom
feat/tui-context-meter
Sep 20, 2026
Merged

hetaoBackend merged 2 commits into
mainfrom
feat/tui-context-meter

Conversation

@hetaoBackend

@hetaoBackend hetaoBackend commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Add the opt-in context-meter status item, with context-bar and context-gauge aliases. The default status line order remains unchanged. The meter shows remaining context as an eight-cell gauge, shrinks to six cells, then to Ctx N% when space is limited. It shares usage, model-capacity fallback, color thresholds and fitting priorities with context-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

  • Focused status-item, workspace projection and settings-picker suites: 127 tests passed. Coverage includes aliases, unchanged defaults, precedence in either order, snapshot/model fallback, warning/error boundaries, clamping, missing/NaN/infinite values, 30/20/7/6-column fitting, cleared usage, build-mode precedence, and English/Chinese selection and save.
  • pnpm typecheck and git diff --check: passed.
  • Full pnpm verify on clean committed HEAD 787248eec16c38d1f21b7443223c5e6bafee1a64 (macOS arm64, Node 26.4.0): 14/14 gates passed, 208.1 seconds.
  • NOT RUN locally: Linux/Windows verification, live-provider sessions and visual inspection across terminal fonts. Rendering and projection tests use synthetic local data; they do not establish live-service acceptance.

Publication and contribution checks

  • I have permission to contribute these changes under the existing licenses applicable to the changed files/packages; imported material and its provenance are identified and existing notices are preserved. The contributor explicitly offered this patch under the existing MIT terms in Context-meter status line item (validated contribution on fork) #217.
  • No credentials, account data, real user content, internal source history or private review material is included.
  • No source files were added or removed; inventory regeneration is unnecessary. Added tests extend existing files already declared in test/vitest-suites.json.
  • English/Chinese settings descriptions and relevant documentation are updated. Offline results are not described as live-service acceptance.

Maintainer handoff

Publication scope or license changes: none.

Shared-source port: pending after public review.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

drowzeys and others added 2 commits September 20, 2026 11:01
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.
Review and harden the opt-in contribution from drowzeys/minimax-code commit 4076c6f (issue #217). Preserve the original author commit; cover aliases, priority, fallback, thresholds, width fitting, missing data and localized settings.
@hetaoBackend
hetaoBackend merged commit ee8ed6c into main Sep 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants