From 7516d636d8280a14383fd5820929375671038ac1 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 10 Oct 2026 10:58:09 +0800 Subject: [PATCH] cursor 0.2.4: a model asked for by its bare name (grok-4.7) counts in the pool its sized ids (grok-4.7@256k) are in (Will on Discord) The model list offers Grok 4.7 only at its context sizes, grok-4.7@256k and grok-4.7@500k, while a routing group picked before the list had sizes still asks for bare grok-4.7, which named() runs at its default size. usage() built the Cursor Models window's models (and Other Models' notModels) from the listed ids only, so magpie counted bare grok-4.7 in Other Models: used up, 0% left on the Routing page, ranked last, while Cursor Models had ~84% left. The pool now also names each listed id's bare name; inPool still decides which pool it is in. magpie 99009b93 makes the same match on its side for every plugin (a bare id and its id@size count as one); this release covers magpie versions before it. Verified: the new usage.test.mjs case fails on 0.2.3's index.mjs ("Grok 4.7" counted false/true) and passes now; packages/cursor 67 pass; check.mjs green. The whole-repo bun test needs HOME=$(mktemp -d) (CI does it), not run here that way. --- packages/cursor/index.mjs | 8 ++++++-- packages/cursor/package.json | 2 +- packages/cursor/usage.test.mjs | 12 ++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/cursor/index.mjs b/packages/cursor/index.mjs index 0ed214e..1ad6ae8 100644 --- a/packages/cursor/index.mjs +++ b/packages/cursor/index.mjs @@ -405,8 +405,12 @@ async function usage(tok, ids) { return bucket.has(model) || firstParty(model) } // Auto is always one, so the pool's list is never empty (which would - // count every model) - const pool = [...new Set(["auto", ...ids, ...(data.autoBucketModels ?? [])])].filter(inPool) + // count every model). A model listed at its context sizes (grok-4.7@256k) + // is still asked for by its bare name (grok-4.7) where it was picked + // before the list had sizes, and runs as its default, so the pool names + // that too (Will on Discord) + const asked = ids.flatMap((id) => [id, id.replace(/@[^@]*$/, "")]) + const pool = [...new Set(["auto", ...asked, ...(data.autoBucketModels ?? [])])].filter(inPool) const num = (v) => (typeof v === "number" ? v : 0) // the two pools fit the line; the total goes in its tooltip return { diff --git a/packages/cursor/package.json b/packages/cursor/package.json index f971c7d..ac282c4 100644 --- a/packages/cursor/package.json +++ b/packages/cursor/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-cursor-auth", - "version": "0.2.3", + "version": "0.2.4", "description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to", "type": "module", "main": "./index.mjs", diff --git a/packages/cursor/usage.test.mjs b/packages/cursor/usage.test.mjs index 682a1f7..e2b8420 100644 --- a/packages/cursor/usage.test.mjs +++ b/packages/cursor/usage.test.mjs @@ -100,6 +100,18 @@ for (const bucket of [["default", "composer-2.5", "cursor-grok-4.5-high", "futur }) } +// Will on Discord: the list has grok-4.7 only at its sizes, a routing group +// still asks for bare grok-4.7, and it was counted in Other Models (used up) +test("a model asked for by its bare name counts in the pool its sized ids are in", async () => { + const { u } = await run(auth, () => + Response.json({ billingCycleEnd: "1792833042000", planUsage: { autoPercentUsed: 16, apiPercentUsed: 100, totalPercentUsed: 60 } }), + ) + const [cursor, other] = u.windows + for (const m of ["grok-4.7", "Grok-4.7"]) expect([m, counts(cursor, m), counts(other, m)]).toEqual([m, true, false]) + // a bare other model stays in Other Models + expect(["claude-opus-5-5", counts(cursor, "claude-opus-5-5"), counts(other, "claude-opus-5-5")]).toEqual(["claude-opus-5-5", false, true]) +}) + test("an enterprise plan's spend is no window", async () => { expect((await run(fresh(), () => Response.json({ spendLimitUsage: {} }))).u).toEqual({ windows: [], signIn: "kept" }) })