Asks AgentService/Run for emit_model_call_usage (AgentRunRequest field 37) and reads InteractionUpdate 31 (ModelCallCompletedUpdate: model_call_id, then input, output, cache read, cache write and reasoning tokens). These field numbers are checked against cursor-agent 2026.11.05-86047df's bundle. A multi-step native turn's final step reports that call's exact counts. The rest of TurnEnded's totals goes to usage.magpie_deferred, or the earlier calls' #31 sum when TurnEnded has no counts. A stateless step with a #31 before it seals takes that count and doesn't poll the dashboard. Without #31, both paths are as before. Reviewed at d2c49f3b on mote (mote-run, HOME=$(mktemp -d)): - bun scripts/check.mjs cursor: ok. - bun test packages/cursor: 406 pass, 0 fail. native-e2e alone 3 times: 145 pass each. - Probes: TurnEnded with no counts and a #31 per step, and only the final step's #31. Both give own 61000/700 and deferred 105000/1400, which add up to the turn. - Broken by hand, red each time: no field 37; native ignoring #31; #31 read unshifted; stateless ignoring #31; stateless still polling after #31. - Not red: dropping the lastStepUsage reset in nextStep. That test gap is filed as a follow-up. Not tried: a real Cursor account (whether api2 sends #31, and in what order).
13 lines
606 B
JSON
13 lines
606 B
JSON
{
|
|
"name": "@magpie-community/opencode-cursor-auth",
|
|
"version": "0.2.43",
|
|
"description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
|
|
"type": "module",
|
|
"main": "./opencode.mjs",
|
|
"exports": { ".": "./opencode2.mjs" },
|
|
"files": ["index.mjs", "opencode.mjs", "opencode2.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" }
|
|
}
|