Skip to content

Cursor adapter: dashboard usage pools + Grok weekly window (v0.2.0) - #9

Merged
devudilip merged 1 commit into
mainfrom
claude/ration-quota-tracker-g3uwc6
Aug 29, 2026
Merged

Cursor adapter: dashboard usage pools + Grok weekly window (v0.2.0)#9
devudilip merged 1 commit into
mainfrom
claude/ration-quota-tracker-g3uwc6

Conversation

@devudilip

Copy link
Copy Markdown
Owner

Provider #3, verified against a live capture — and the proof of the single-file contribution story from CONTRIBUTING.md: one adapter file, one registry line, one manifest origin, fixtures, tests.

How it reads Cursor

Two cookie-authed POST endpoints back cursor.com's own dashboard:

  • /api/dashboard/get-current-period-usage → the "Included usage" pools: Cursor Models (auto bucket, autoPercentUsed) and Other Models (named/API models, apiPercentUsed), both resetting at billingCycleEnd (epoch-ms string, normalized).
  • /api/dashboard/get-sand-usage-status → the Grok Bot weekly window (usagePercent, nextResetTimestampUtc). Plans without the feature return 4xx there — treated as "no lane", not an error.

Team-id discovery: team accounts require {"teamId": N} in the body, but the extension can't read the team_id cookie (no cookies permission, by design). The adapter tries the bare {} request first (individual accounts), and on refusal discovers the id via /api/dashboard/teams, caching whichever strategy worked so steady-state refreshes stay minimal.

Contract invariants hold and are tested: never throws, unknown shapes are endpoint_not_verified/schema_mismatch errors (never a number), no Authorization header, cookie values never touched.

Verification

  • npm run ci green: typecheck + 66 tests + build. Cursor tests cover: live-fixture happy path (headrooms 100/90/97 matching the capturing account's dashboard: 1%/10%/3% used), team-discovery flow with caching, absent-Grok plans, unauthenticated/rate-limited mapping, HTML-body handling, never-throws, and the no-Authorization assertion.
  • After merge: rebuild, reload the extension, toggle on Cursor while logged into cursor.com — three lanes should match the dashboard.

Version bumped to 0.2.0 (this is the next store upload once the v0.1.1 review completes). README provider table and CONTRIBUTING references updated.


Generated by Claude Code

Verified against a live capture. Two cookie-authed POST endpoints back
the cursor.com dashboard: get-current-period-usage for the included
usage pools (Cursor Models auto bucket + Other Models API usage, reset
at billingCycleEnd) and get-sand-usage-status for the Grok Bot weekly
window. Team accounts require a teamId in the request body, so the
adapter tries the bare request first, discovers the team id via
/api/dashboard/teams on refusal, and caches whichever strategy worked.
Plans without the Grok feature simply omit that lane (4xx on the sand
endpoint is absence, not an error); everything else keeps the contract —
never throws, never coerces an unknown shape to a number, no
Authorization header, no cookie access.

Third provider proves the single-file contribution story: adapter file,
registry line, manifest origin, fixtures, tests. Version 0.2.0.
@devudilip
devudilip merged commit 9322cec into main Aug 29, 2026
1 check passed
@devudilip
devudilip deleted the claude/ration-quota-tracker-g3uwc6 branch August 29, 2026 17:31
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.

1 participant