From f2f4ff4014d3abcb9851ff87af75d214786f5949 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 14 Oct 2026 23:22:05 +0800 Subject: [PATCH] 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. --- packages/cursor/index.mjs | 8 ++++++-- packages/cursor/package.json | 2 +- packages/cursor/usage.test.mjs | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/cursor/index.mjs b/packages/cursor/index.mjs index e48314d..f209d02 100644 --- a/packages/cursor/index.mjs +++ b/packages/cursor/index.mjs @@ -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" } }, }, diff --git a/packages/cursor/package.json b/packages/cursor/package.json index 4d10e2f..ccdfc9c 100644 --- a/packages/cursor/package.json +++ b/packages/cursor/package.json @@ -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", diff --git a/packages/cursor/usage.test.mjs b/packages/cursor/usage.test.mjs index 78f0cda..e7c2308 100644 --- a/packages/cursor/usage.test.mjs +++ b/packages/cursor/usage.test.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"]) +})