diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 99822ce1b..75a4e80c1 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -6690,7 +6690,7 @@ function accountPlan(a) { if (agent === "copilot") return named("GitHub", a.plan && cap(a.plan)); if (agent === "claude") return named("Claude", a.plan && cap(a.plan)); if (agent === "cursor") return named("Cursor", a.plan && cap(a.plan)); - if (agent === "grok") return a.plan || "SuperGrok"; + if (agent === "grok") return a.plan || "Grok"; if (agent === "gemini" || agent === "antigravity") return a.plan || "Google"; if (agent === "zcode") return a.plan || "GLM Coding Plan"; if (agent === "workbuddy") return a.plan || "WorkBuddy"; @@ -12104,7 +12104,7 @@ const SUBS = [ // cursor-agent keeps one account; signing in again replaces it { agent: "cursor", name: "Cursor", icon: "cursor", plans: "Pro · Ultra · Teams", single: true }, // so does Grok Build - { agent: "grok", name: "Grok (SuperGrok)", icon: "xai", plans: "SuperGrok · X Premium+", own: true }, + { agent: "grok", name: "Grok", icon: "xai", plans: "SuperGrok · X Premium+", own: true }, // signed in with GitHub's device code; the editors' own sign-in stays theirs { agent: "copilot", name: "Copilot", icon: "githubcopilot", plans: "Free · Education · Pro · Pro+ · Max · Business · Enterprise", own: true }, // Z.ai's GLM Coding Plan, signed in as ZCode does; ZCode's own account is read too diff --git a/internal/gui/tests/grok-plan.test.cjs b/internal/gui/tests/grok-plan.test.cjs new file mode 100644 index 000000000..512066f9e --- /dev/null +++ b/internal/gui/tests/grok-plan.test.cjs @@ -0,0 +1,66 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// #3668: an absent Grok plan is unknown, not an invented SuperGrok tier. +const assert = require("node:assert/strict"); +const fs = require("node:fs/promises"); +const path = require("node:path"); +const { test } = require("node:test"); +const { chromium, webkit } = require("playwright"); + +const assets = path.resolve(__dirname, "../assets"); +const accounts = [ + { agent: "grok", plan: "SuperGrok" }, + { agent: "grok-plugin", builtin: "grok", plan: "SuperGrok Heavy" }, + { agent: "grok" }, + { agent: "grok-plugin", builtin: "grok", plan: "" }, + { agent: "cursor", plan: "pro" }, + { agent: "cursor" }, +]; + +function serve(lang) { + const settings = { lang, theme: "light" }; + const providers = accounts.map((account, i) => ({ + id: "plan-" + i, name: account.builtin || account.agent, icon: "xai", host: "fixture", + models: [], agents: [], key: {}, keyList: [], headers: {}, fallback: [], + account: { user: "fixture-" + i, agentName: "Grok", ...account }, + })); + return async (route) => { + const url = new URL(route.request().url()); + const json = (data) => route.fulfill({ json: data }); + if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:false};` }); + if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); + if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings }); + if (url.pathname === "/api/settings") return json(settings); + if (url.pathname === "/api/providers") return json({ providers, presets: [], excluded: [], gateway: { running: false } }); + if (url.pathname === "/api/groups") return json({ groups: [], models: [] }); + if (url.pathname === "/api/plugins") return json({ plugins: [] }); + if (url.pathname.startsWith("/api/")) return json({}); + const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname); + const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)]; + await route.fulfill({ body: await fs.readFile(file), contentType }); + }; +} + +test("Grok account pills preserve known plans and leave absent plans unnamed", async (t) => { + for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) { + // Given: plugin and built-in accounts, with known and absent plans. + const context = await browser.newContext({ viewport: { width: 900, height: 700 } }); + const page = await context.newPage(); + const errors = []; + page.on("pageerror", (e) => errors.push(e.message)); + await page.route("**/*", serve(lang)); + // When: the real Providers page renders its account pills. + await page.goto("http://magpie.test/?view=providers"); + await page.locator(".row.provider .key.acct").first().waitFor(); + const labels = await page.locator(".row.provider .key.acct > span").allTextContents(); + // Then: no plan is invented; other agents retain their labels. + assert.deepEqual(labels.slice(0, 2), ["SuperGrok", "SuperGrok Heavy"], `${engine} ${lang}: known plans`); + assert.deepEqual(labels.slice(2, 4), ["Grok", "Grok"], `${engine} ${lang}: absent Grok plan names the provider, no invented tier`); + assert.deepEqual(labels.slice(4), ["Cursor Pro", "Cursor"], `${engine} ${lang}: other agents`); + assert.deepEqual(errors, []); + await context.close(); + } + } +}); diff --git a/internal/gui/tests/plugin-plan.test.cjs b/internal/gui/tests/plugin-plan.test.cjs index a6abaf84d..482bd85b0 100644 --- a/internal/gui/tests/plugin-plan.test.cjs +++ b/internal/gui/tests/plugin-plan.test.cjs @@ -1,7 +1,7 @@ // Run with Node's test runner and Playwright on the module path; see README.md. // A plugin's account beside a built-in subscription (cursor-plugin, the // account's builtin "cursor") reads its plan as the built-in's does: -// "Cursor Pro", "SuperGrok" with no plan told, not "Pro" or "signed in". +// "Cursor Pro", "Grok" with no plan told, not an invented "SuperGrok" tier. // A plugin of its own keeps its plan as told. English and Chinese; no // backend, the API is faked here. const assert = require("node:assert/strict"); @@ -51,7 +51,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", accountPlan({ agent: "copilot", plan: "Pro+" }), accountPlan({ agent: "copilot" }), ]); - assert.deepEqual(plans.slice(0, 4), ["Cursor Pro", "Cursor Pro", "SuperGrok", "SuperGrok"]); + assert.deepEqual(plans.slice(0, 4), ["Cursor Pro", "Cursor Pro", "Grok", "Grok"]); assert.equal(plans[4], "Max"); assert.deepEqual(plans.slice(5), ["GitHub Education", "GitHub Pro+", "GitHub"]); assert.equal(await page.evaluate(() => quotaText({ unlimited: true, display: "Unlimited", used: 0 })), lang === "zh" ? "无限" : "Unlimited"); diff --git a/internal/provider/plugin_usage.go b/internal/provider/plugin_usage.go index c11686aa5..eb51b521e 100644 --- a/internal/provider/plugin_usage.go +++ b/internal/provider/plugin_usage.go @@ -30,7 +30,7 @@ var movedCards = map[string]struct{ name, icon, site string }{ "workbuddy": {"WorkBuddy", "workbuddy-color", "https://www.codebuddy.cn"}, WorkBuddyAIID: {"WorkBuddy AI", "workbuddy-color", "https://www.workbuddy.ai"}, "cursor": {"Cursor", "cursor", "https://cursor.com"}, - "grok": {"Grok (SuperGrok)", "xai", "https://x.ai/cli"}, + "grok": {"Grok", "xai", "https://x.ai/cli"}, "devin": {"Devin", "devin", "https://devin.ai"}, } diff --git a/internal/provider/plugin_usage_test.go b/internal/provider/plugin_usage_test.go index 44e538711..66bb5666a 100644 --- a/internal/provider/plugin_usage_test.go +++ b/internal/provider/plugin_usage_test.go @@ -376,7 +376,7 @@ func TestPluginAccountModels(t *testing.T) { // provider had, whatever the plugin calls itself. func TestMovedProviderName(t *testing.T) { claudeHome(t) - for id, want := range map[string]string{CommandCodePlanID: "Command Code Plan", "grok": "Grok (SuperGrok)", "kiro": "Kiro"} { + for id, want := range map[string]string{CommandCodePlanID: "Command Code Plan", "grok": "Grok", "kiro": "Kiro"} { if err := setMigration(id, func(m *Migration) { m.State = MovePlugin }); err != nil { t.Fatal(err) }