Repository navigation
feat: on-demand usage meter with cap alerts - #80
Merged
Merged
Conversation
Show on-demand spend against the per-user cap from spendLimitUsage (individualUsed / individualLimit, cents) as its own section under Other Models. Off, unlimited, and limit-reached states are handled. The cap also feeds the threshold alerts, once per cycle. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Nov 10, 2026
Merged
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.
What
Adds an On-demand meter to the sidebar, between Other Models and the usage windows. It shows spend against the per-user cap set in Cursor, for example
.40 / .00, the percent of the limit used, and what is left.Off, no bar, with spend shown if any.2147483647): spend only, no bar.spendLimitUsageblock: the section is hidden. No fake ``.Threshold alerts (
cursorPlanUsage.alertThresholds, default 80 and 95) also cover the on-demand cap, once per threshold per billing cycle. Off and unlimited produce no alert.Data source
Field names and units come from Cursor's own dashboard client, found in the installed app bundle, not guessed:
spendLimitUsage.individualUsed(cents): on-demand spend this cyclespendLimitUsage.individualLimit(cents): the cap;0or missing means off;>= 2147483647means unlimitedThe parser is in
src/onDemand.tsand is pure, so it is covered by tests without the VS Code host.Tests
src/onDemand.test.ts: parsing for each mode and missing fields, formatting, view strings, alert readings and once-per-cycle alertingsrc/media/view.test.ts: section placement, headline, bar, Off, unlimited, limit-reached, and hidden-when-absent in jsdomsrc/contract.test.ts: newcurrentPeriodUsageOnDemand.jsonfixturenpm run check,npm test(231 passing),npm run compileandnpm run packageall pass locally.Notes
usageViewProvider.sameUsagecomparesonDemand, so the sidebar re-renders when only on-demand spend changes.