Repository navigation
feat(native): usage page, pooled limits, and composer context window meter - #47
Merged
Merged
Conversation
Owner
Author
|
Rebased onto
Checks all pass: |
This was referenced Nov 2, 2026
Open
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 native app had no Usage page and no composer context meter (ledger
AP-USAGE,CO-METERS). This ports both from the web against the unmodified server.What's in it
Core (
crates/core/src/usage.rs,usage/), pure and tested (30 tests, cases ported from the web suites):server.getUsageSummary/server.refreshUsageRates(contracts/src/usage.ts). Forward-compatible arrays drop buckets and sources from providers this build doesn't know.mergeUsage(usageMerge.ts): shared transcript directories count once, newer partial scans add only new cells, contract mismatches are excluded.usageFormat.ts), matchingIntlandtoFixed, including how each rounds a tie.usageLimits.ts): account merging across native logins and limit sources, pool windows, pace, weekly-blocked sessions, Cursor and Antigravity ordering, notices, external usage links, and the/usage-limitsreport.contextWindow.ts), access, progress and saved preferences.usageLimitSourcesand decodes the full usage limits, auth email and workspace, andusageModelFilter.App (
crates/app/src/usage/): a route modal like Settings.cmd-shift-1..4). Shortcut titles come from the keymap.cmd-u(usage.open), the command palette ("Open usage"), and the sidebar footer. The footer is now one row (Settings, Pull requests, Usage), as on the web, and the existing Pull requests item moves into it.ContextWindowMeter.tsx), mounted beside Send with one line, plus its legacy Labs toggle "Context window indicator (legacy)".gen-theme.ts, which readsusageProviders.tsandusageBreakdown.ts. Five Lucide icons are vendored.--usage cost|tokens|limits,--usage-period,--usage-model,--context-meter. Limits skips the provider refresh, so runs stay read-only.Not ported yet (tracked in #43)
UsagePriceOverrides). The "Model prices" menu item and the dialog's "Set price" button are left out./usage-limitscomposer banner. Its logic is ported, but intercepting the command belongs to the composer's slash commands, sousageLimitsCommandis not advertised.Evidence
Headless decode (
cargo run -p t3-client --example usage_probe). Real-data server (14700, read-only):--refresh-rates:status: fresh, 4889 known models, all four periods decode.mergeUsagegive identical totals (30 days $9,101.79 / 39.8B / 2738 sessions / 23 models; 90 days $25,773.74 / 67B / 4572 / 36).usage_probe --thread <id>reads "Context window 27% used".Screenshots (offscreen snapshot tool, real-data server):
/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w12-shots/limits-light.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w12-shots/cost-30d-light.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w12-shots/tokens-24h-dark.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w12-shots/model-dialog-light.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w12-shots/meter-light.png(meter beside Send, sidebar footer row)Gates:
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings(also with--features snapshot),gen-theme --check,parity/sync.test.ts, conformance--check,vendor-icons --check.Ledger:
AP-USAGEandCO-METERSare nowpartial, with follow-ups in #43.Model: Opus 5.5, Claude Code (native-worker W12).