feat(tui): show managed usage quotas in footer status bar#702
feat(tui): show managed usage quotas in footer status bar#702grandmaster451 wants to merge 9 commits into
Conversation
- Poll managed usage every 30s for the default OAuth provider. - Cache the last server-side quotas so they stay visible when offline. - Add current-turn token usage as a live delta between refreshes. - Render aligned quota rows under the context percentage with a green-to-red gradient for the percentage value.
🦋 Changeset detectedLatest commit: 87202b6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91043b4260
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| private scheduleQuotaRefresh(): void { | ||
| this.clearQuotaRefreshTimer(); | ||
| const providerKey = this.host.state.appState.availableModels[this.host.state.appState.model]?.provider; | ||
| if (!isManagedUsageProvider(providerKey)) return; |
There was a problem hiding this comment.
Reschedule quota polling after model changes
When the TUI starts on one provider and the user later switches models with /model, this quota refresh is not revisited: performModelSwitch updates appState.model, and agent.status.updated can also patch the model, but neither path calls scheduleQuotaRefresh or clears appState.quotas. As a result, switching from a custom provider to the managed provider never starts quota polling, while switching away from managed keeps the last quota rows visible because subsequent refreshes just return early. Please reschedule/clear the quota state whenever the active model's provider changes, not only when the session subscription starts.
Useful? React with 👍 / 👎.
Schedule or cancel the managed-usage refresh timer when the active model changes, so switching to/from a managed provider starts/stops polling immediately. Add unit test for the switch-to-managed case.
… width, trim weekly minutes
This PR adds managed OAuth usage quotas to the TUI footer.
What changed
QuotaInfoto the TUI app state and exposedfetchManagedQuotas()fromKimiTUI.SessionEventHandlerpolls managed usage every 30 s for the default OAuth provider and caches the last server-side values so the footer keeps showing numbers while offline.context:,week:, and5h:share aligned columns.Footer layout
Details of the layout:
weekly limit→week,5h limit→5h) and right-aligned so the words sit next to the colons.100.0 %; reaching 100 % does not shift the block.hours, minuteswhen under a day, keeping the suffix column stable.Why
Users on managed Kimi Code plans previously had to run
/infoor open the status card to see weekly/hourly limits. Showing them in the always-visible footer makes remaining quota glanceable.Testing
pnpm run typecheckpasses.test/tui/components/chrome/footer.test.tstest/tui/components/panels/footer-context.test.tstest/tui/controllers/session-event-handler-quota.test.tspnpm run build:native:seasucceeds for darwin-arm64.Notes
.kimi-code/skills/engineering/kimi-code-cli/SKILL.mdunder TUI Footer / Status Line Alignment Gotchas.