cursor-agent sends the team a request is billed to in `x-cursor-team-id`, from
cli-config.json's `authInfo.activeTeamId`. Without it, Cursor takes the
token's default team. In an organization that team may have on-demand spend
turned off, and the request then fails with "Team budget limit reached".
The plugin now sends the same header on Run (both the native and the stateless
path) and on the dashboard calls. It takes the team only when the token's
`sub` is the config's `authInfo.authId`, so an account signed in from magpie
never gets another account's team. GetHardLimit and GetCurrentPeriodUsage still
go out with `{}`, as cursor-agent sends them. GetFilteredUsageEvents names the
team only when there is one. The config's location (CURSOR_CONFIG_DIR, then
$XDG_CONFIG_HOME/cursor, then ~/.cursor) and the team check (a positive
integer) match cursor-agent 2026.10.01's paths.js and request.js.
Run at d4476ff merged onto main 1fbe22b, in a sandbox HOME, with the network
pointed at a dead proxy:
- `bun test` (whole repo): 2640 pass, 0 fail. `bun test packages/cursor`:
303 pass. `bun scripts/check.mjs cursor`: ok.
- Broke each change by hand, and team-id.test.mjs went red each time (11 pass,
1 fail): the header removed from runNative, the header removed from runOnce,
and the team put back into GetCurrentPeriodUsage's body.
- Real Cursor account (no team) through the plugin's loader: one chat turn with
a config that has no team, and one whose activeTeamId is a team the account
isn't in. Both returned 200 "ok", so a single-team account is unchanged. The
author ran a real account in two teams: the budget-spent team returned 429,
the other returned 200.
Not tried: a multi-team account here. Accounts signed in from magpie get no
team (#233 covers those).
Co-authored-by: bborn2 <bborn2@users.noreply.github.com>
13 lines
557 B
JSON
13 lines
557 B
JSON
{
|
|
"name": "@magpie-community/opencode-cursor-auth",
|
|
"version": "0.2.23",
|
|
"description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"exports": "./index.mjs",
|
|
"files": ["index.mjs", "native-session.mjs", "README.md"],
|
|
"keywords": ["opencode", "opencode-plugin", "magpie", "cursor"],
|
|
"license": "MIT",
|
|
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/cursor" }
|
|
}
|