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.
This commit is contained in:
@@ -405,8 +405,12 @@ async function usage(tok, ids) {
|
|||||||
return bucket.has(model) || firstParty(model)
|
return bucket.has(model) || firstParty(model)
|
||||||
}
|
}
|
||||||
// Auto is always one, so the pool's list is never empty (which would
|
// Auto is always one, so the pool's list is never empty (which would
|
||||||
// count every model)
|
// count every model). A model listed at its context sizes (grok-4.7@256k)
|
||||||
const pool = [...new Set(["auto", ...ids, ...(data.autoBucketModels ?? [])])].filter(inPool)
|
// 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)
|
const num = (v) => (typeof v === "number" ? v : 0)
|
||||||
// the two pools fit the line; the total goes in its tooltip
|
// the two pools fit the line; the total goes in its tooltip
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@magpie-community/opencode-cursor-auth",
|
"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",
|
"description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./index.mjs",
|
"main": "./index.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 () => {
|
test("an enterprise plan's spend is no window", async () => {
|
||||||
expect((await run(fresh(), () => Response.json({ spendLimitUsage: {} }))).u).toEqual({ windows: [], signIn: "kept" })
|
expect((await run(fresh(), () => Response.json({ spendLimitUsage: {} }))).u).toEqual({ windows: [], signIn: "kept" })
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user