cursor 0.2.12: Grok Bot is among magpie's three panel rings ahead of an On-demand with no limit (yetone/magpie#2213, Morganwan90)
The usage windows went Cursor Models, Other Models, On-demand, Grok Bot, Total. magpie's tray panel draws an account's first three, so on an account that may spend on-demand without a limit, the On-demand ring (always 0%, only a dollar figure) pushed Grok Bot out, while an account with no on-demand showed Bot third. An On-demand with no limit (aside) now goes after Bot, beside Total. One with a limit keeps its third place ahead of Bot: it is the window that can stop the account's requests, with the pools aside. Run: bun test in packages/cursor (89 pass), bun scripts/check.mjs (all packages ok). The new test fails on 0.2.11's index.mjs (Bot fourth, On-demand third). Not tried with a real Cursor account that has Grok Bot and on-demand.
This commit is contained in:
@@ -2349,8 +2349,12 @@ export async function CursorAuthPlugin() {
|
||||
return { error: e.message, windows: [], signIn: "kept" }
|
||||
}
|
||||
const [u, plan, bot] = await Promise.all([usage(tok, Object.keys(provider?.models ?? {})), planOf(tok), botUsage(tok)])
|
||||
// Put Bot before Total for magpie's three menu-bar rings.
|
||||
const windows = [...u.windows.filter((w) => w.name !== "Total"), ...bot, ...u.windows.filter((w) => w.name === "Total")]
|
||||
// Bot goes among magpie's three menu-bar rings: before Total, and
|
||||
// before an On-demand with no limit, which is only a dollar figure on
|
||||
// a ring that never fills (magpie #2213, Morganwan90). An On-demand
|
||||
// with a limit stays ahead of it: that is what can stop the account.
|
||||
const last = (w) => w.name === "Total" || (w.name === "On-demand" && w.aside)
|
||||
const windows = [...u.windows.filter((w) => !last(w)), ...bot, ...u.windows.filter(last)]
|
||||
return { ...u, windows, ...(plan ? { plan } : {}), signIn: "kept" }
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-cursor-auth",
|
||||
"version": "0.2.11",
|
||||
"version": "0.2.12",
|
||||
"description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
|
||||
"type": "module",
|
||||
"main": "./index.mjs",
|
||||
|
||||
@@ -307,3 +307,21 @@ test("no on-demand allowed, none set or not known: the pools are the allowance,
|
||||
]
|
||||
for (const [i, [period, hard]] of cases.entries()) expect([i, shape((await onDemand(period, hard)).u)]).toEqual([i, before])
|
||||
})
|
||||
|
||||
// magpie #2213 (Morganwan90): the panel draws an account's first three
|
||||
// windows, and an On-demand with no limit (a dollar figure on a ring that
|
||||
// never fills) pushed Grok Bot to the fourth. One with a limit is what can
|
||||
// stop the account, and keeps its place ahead of Bot.
|
||||
const botOnDemand = (period, hard) =>
|
||||
run(botAuth(), (url) => {
|
||||
if (url === PLAN) return Response.json({})
|
||||
if (url === BOT) return Response.json(paidBot)
|
||||
if (url === HARD) return Response.json(hard)
|
||||
return Response.json(period)
|
||||
})
|
||||
test("Bot is among the first three windows ahead of an On-demand with no limit, behind one with a limit", async () => {
|
||||
const open = (await botOnDemand({ ...spent, spendLimitUsage: { individualUsed: 900, limitType: "team" } }, { hardLimit: 2000, perUserMonthlyLimitDollars: 0 })).u
|
||||
expect(open.windows.map((w) => w.name)).toEqual(["Cursor Models", "Other Models", "Grok Bot", "On-demand", "Total"])
|
||||
const capped = (await botOnDemand({ ...spent, spendLimitUsage: { individualUsed: 500, limitType: "user" } }, { hardLimit: 20 })).u
|
||||
expect(capped.windows.map((w) => w.name)).toEqual(["Cursor Models", "Other Models", "On-demand", "Grok Bot", "Total"])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user