Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: tell a Chinese reader Claude Desktop's gateway window has no Chinese (GZXYMH on X)

yetone4b4c4a806297
diff --git a/docs/subsystems/agent-wiring.md b/docs/subsystems/agent-wiring.md
index 4afcd9138..e0f0566e1 100644
--- a/docs/subsystems/agent-wiring.md
+++ b/docs/subsystems/agent-wiring.md
@@ -108,7 +108,7 @@ something else shows up as drift.
- Codex's "subagent model" field writes nothing to Codex's config: its lead names each subagent's model in `spawn_agent`, which `[agents]` can't overrule. It is magpie's setting (`settings.CodexSubagentModel`, [`codex_subagent.go`](../../internal/provider/codex_subagent.go)), and the gateway moves the subagent's request onto it (see [gateway routing](gateway-routing.md)). Its options are every model and routing group Codex's own lists show (`CatalogFor("codex")`, so a model taken out of them or not picked is left out here too), ChatGPT accounts' first (#1633: a lead on a chat provider wants its subagents there too). A task a ChatGPT-backed lead sealed opens only on a ChatGPT account, so the gateway keeps such a subagent on its own model when the one set is another provider's. Its setter takes any `provider/model` or `group/<id>`, also one magpie doesn't serve now, so a profile or backup put back on another computer still applies (`ApplyFields` stops at the first failed Set), and refuses one of Codex's own bare names.
- Claude Desktop's "subagent model" field (`subagent_model`, `desktopSubagentField` in [`claudedesktop.go`](../../internal/agent/claudedesktop.go)) writes nothing to Desktop's config: Desktop runs its Code tab's Claude Code with `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1`, under which Claude Code ignores `CLAUDE_CODE_SUBAGENT_MODEL`, `CLAUDE_CODE_SUBAGENT_MODEL_FORCE` and the tier variables in its settings files' `env` ("Ignoring … this session's provider routing is managed by the host", Claude Code 2.1.295), and the env Desktop builds for the Code tab has no key for it (Desktop 2.31226). It is magpie's setting (`settings.DesktopSubagentModel`, [`desktop_subagent.go`](../../internal/provider/desktop_subagent.go)), and the gateway moves each subagent's turn onto it (see [gateway routing](gateway-routing.md)). It is labelled as Codex's, so the Agents page gives it the same square. Its options are magpie's models and groups as Desktop's list shows them (`viaMagpie("claude-desktop")`), while Desktop is on magpie, as for the tiers. A Desktop alias picked is kept by its catalog id (`DesktopCatalogID`). Like Codex's, its setter takes any `provider/model` or `group/<id>`, also one magpie doesn't serve now, so a profile or backup still applies, and refuses a bare name. It is `Live`: the gateway reads it on each request.
- Claude Desktop's "subagent effort" (`desktopSubagentEffortField`, `settings.DesktopSubagentEffort`) is also Quiet and Live. Default keeps the effort the request asks for, including disabled thinking; it never selects a new default. A picked level works independently of the subagent model: no model pick, the same model and an unavailable model pick all still take the effort. While wired, the field offers the selected model's levels, or the standard levels when its model is inherited or unavailable; a model marked reasonless offers none. The stored pick survives model changes. A disconnected preference can be saved or cleared without connecting Desktop or showing restart advice, so profile restoration and Disconnect can restore a value saved before connecting; reconnect returns to the last live pick. `subEffortTitle` gives Desktop the Claude Code default explanation; Codex's default meaning is unchanged. The gateway fits each attempt to its actual model and preserves fixed group-member efforts (see [gateway routing](gateway-routing.md)).
-- Claude Desktop's 3p mode runs in a userData of its own (`Claude-3p`), whose `config.json` (Desktop's own settings, not `claude_desktop_config.json`) starts with no `locale`, so Desktop on magpie came up in the system's language rather than the one picked signed in with Anthropic (memory and Osal on Discord). Turning Desktop onto magpie copies that one key, `locale`, from the signed-in userData's `config.json` (`Claude`, `%APPDATA%\Claude` on Windows, the first set's before the others) into `Claude-3p/config.json` when that file is missing or a JSON object without one (`desktopCarryLocale` in [`claudedesktop.go`](../../internal/agent/claudedesktop.go)); only a name Desktop takes for a catalog is carried. A `locale` already in `Claude-3p`, Desktop's or set by hand, is never written over, and no other key of that file is ever written. Off removes the file only when magpie made it and it still holds nothing but the language carried (`TestClaudeDesktopCarriesTheLanguage`, `TestClaudeDesktopKeepsThe3pLanguage`, `TestClaudeDesktopUserEditsThenReapply`). Desktop shows the language only where its 3p window has that catalog: the window is Desktop's bundled UI (`Resources/ion-dist`, 11 catalogs and no Chinese in 2.7032, 2.9939 and 3.6556.2, while 3.6556.2's main process has `zh-Hans` and `zh-Hant` for the signed-in window). On every start that window asks the main process for its own pick (`requestLocaleChange`: its localStorage, else `navigator.languages` mapped onto its 11, else `en-US`), and the main process writes it into `Claude-3p/config.json`. So a Chinese `locale` there, carried or set by hand, is `en-US` again after each start, written by Desktop and not by magpie (Dx25 on Discord, Windows); nothing magpie writes can keep it.
+- Claude Desktop's 3p mode runs in a userData of its own (`Claude-3p`), whose `config.json` (Desktop's own settings, not `claude_desktop_config.json`) starts with no `locale`, so Desktop on magpie came up in the system's language rather than the one picked signed in with Anthropic (memory and Osal on Discord). Turning Desktop onto magpie copies that one key, `locale`, from the signed-in userData's `config.json` (`Claude`, `%APPDATA%\Claude` on Windows, the first set's before the others) into `Claude-3p/config.json` when that file is missing or a JSON object without one (`desktopCarryLocale` in [`claudedesktop.go`](../../internal/agent/claudedesktop.go)); only a name Desktop takes for a catalog is carried. A `locale` already in `Claude-3p`, Desktop's or set by hand, is never written over, and no other key of that file is ever written. Off removes the file only when magpie made it and it still holds nothing but the language carried (`TestClaudeDesktopCarriesTheLanguage`, `TestClaudeDesktopKeepsThe3pLanguage`, `TestClaudeDesktopUserEditsThenReapply`). Desktop shows the language only where its 3p window has that catalog: the window is Desktop's bundled UI (`Resources/ion-dist`, 11 catalogs and no Chinese in 2.7032, 2.9939, 3.6556.2 and 4.4212.0 (packed as `Resources/ion-dist.asar` there), while 3.6556.2's main process has `zh-Hans` and `zh-Hant` for the signed-in window). On every start that window asks the main process for its own pick (`requestLocaleChange`: its localStorage, else `navigator.languages` mapped onto its 11, else `en-US`), and the main process writes it into `Claude-3p/config.json`. So a Chinese `locale` there, carried or set by hand, is `en-US` again after each start, written by Desktop and not by magpie (Dx25 on Discord, Windows); nothing magpie writes can keep it. So the GUI says it to a Chinese reader: Claude Desktop's opened row on Agents has a line that Desktop on magpie is Anthropic's gateway window, with no Chinese, and that its Chinese comes back once disconnected, and the switch-on notice says the same in Chinese (GZXYMH on X, `desktop-lang.test.cjs`).
- Claude Desktop's sessions (Code and Cowork, `claude-code-sessions` and `local-agent-mode-sessions`) are kept in the userData Desktop runs in, keyed by account and organization (the claude.ai login signed in; in 3p the install id in `ant-did` and the profile's organization, both stable). So on magpie, in `Claude-3p`, the sessions made signed in with Anthropic are out of sight but untouched in `Claude`, and they show again when Desktop is switched back (lambdua on X: "切换账号,对话都不见"); claude.ai chats live on Anthropic's servers and 3p never shows them. magpie never writes or removes a session. Desktop imports them itself (Settings → Import: the signed-in userData, `~/.claude/projects`, other `Claude*` folders), copying under new ids and leaving the originals, but in 3p only when the profile's policy `claudeAiImport.enabled` is true (off by default, 3p only, from 1.28929.0). magpie's profile gets `"claudeAiImport":{"enabled":true,"bannerBehavior":"detect"}` once per folder set (`desktopSeedImport`, marked in the stash as `claude-desktop.import`): on the switch on and, for a Desktop already on magpie, from `Sync` at magpie's start. A `claudeAiImport` already there is kept, and one the user removes is not written again (`TestClaudeDesktopOffersItsSessionImport`).
- Claude Desktop's 3p mode reads its MCP servers (Settings → Developer, its connector list) from `Claude-3p/claude_desktop_config.json`, a file of its own, so on magpie the servers the user added signed in with Anthropic, in `Claude/claude_desktop_config.json`, were gone from the list (aa86222 on Discord: connectors didn't sync). Turning Desktop onto magpie copies each of those `mcpServers` entries that `Claude-3p` has none of the same name for (`desktopCarryMCP` in [`claudedesktop.go`](../../internal/agent/claudedesktop.go)); one of that name already there, the user's or the Library's (which writes both files), stays. `Sync` does it once for a Desktop already on magpie (`claude-desktop.mcp-seen`), so a server the user takes out in 3p isn't brought back. What was copied is stashed (`claude-desktop.mcp`), and off takes back each one still as copied; one the user changed since stays (`TestClaudeDesktopCarriesTheMCPServers`, `TestClaudeDesktopMCPKeepsThe3pServers`, `TestClaudeDesktopSyncCarriesTheMCPServersOnce`). Claude's file is never written. A claude.ai account's connectors can't come along: Desktop calls them through claude.ai with that account (`/api/organizations/<org>/mcp/servers/<id>/tools/call`, refused with `no_active_org` without one, Desktop 2.7032), and 3p mode has no account; Anthropic's docs say "Made by Anthropic" connectors are only in standard Desktop, and others reach 3p through `managedMcpServers` or plugins (claude.com/docs/third-party/claude-desktop/extensions).
- Claude Desktop names a Claude model with reasoning levels after its own catalog ("Opus 5.5"), not by the `display_name` magpie lists, because magpie lists it as `magpie-<number>.anthropic.<model>` to keep its effort picker (`claudeLooking` in [`desktop.go`](../../internal/gateway/desktop.go)). Two providers' rows of one model then differ in Desktop's menu only by that number, so the provider editor shows it on the model's chip (`gateway.DesktopNumber`, `desktopNumbers` in [`providers.go`](../../internal/gui/providers.go), #2578). The chip shows it only while Claude Desktop is installed and is shown that model. Every other model Desktop is shown carries no number on the chip: Desktop names it by `display_name`, which already says the provider, or by its own id.
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index d0486fc9d..8bc12eac1 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -1914,10 +1914,8 @@ async function addProviderFromAgents() {
if (!adding) $("#addProvider")?.click();
}
-// desktopLongestLine: Claude Desktop lists a model of 1M or more twice, the
-// plain one and a "1M context window" one of its own; switched on, magpie
-// lists it by its 1M id alone, one entry each (#1272). Desktop reads the
-// list as it starts.
+// desktopLongestLine: Desktop lists a 1M model twice; on, magpie lists its
+// 1M id alone (#1272)
function desktopLongestLine() {
const on = !!state.settings?.desktopLongest;
const l = el("label", "ag-vl ag-longest");
@@ -2120,7 +2118,10 @@ function connectPanel(a, { fields, fieldBtn }) {
}
kv(t("In {agent}", { agent: a.name }), ...parts);
} else if (menuFromList(a)) {
- kv(t("In {agent}", { agent: a.name }), line(t("{agent}'s model menu lists the models picked here; switch among them there. It reads the list as it starts: quit and reopen it after a change.", { agent: a.name })));
+ const p = [line(t("{agent}'s model menu lists the models picked here; switch among them there. It reads the list as it starts: quit and reopen it after a change.", { agent: a.name }))];
+ // its 3p window has no Chinese (GZXYMH on X)
+ if (a.id === "claude-desktop" && /^zh/.test(locale)) p.push(el("div", "ag-vl ag-warn ag-desktop-lang")), p[1].append(el("span", "ag-dot"), el("span", "", t("On magpie, Desktop shows Anthropic's gateway window, which has no Chinese; disconnect it for Chinese.")));
+ kv(t("In {agent}", { agent: a.name }), ...p);
}
// Hermes' other profiles, each on its own model
const bots = a.fields.filter(hermesBot);
@@ -2408,11 +2409,9 @@ async function reapplyAgent(a, btn) {
}
// ---------- the agents' CLIs (#202) ----------
-// Each agent's CLI shows its version after its name, faint; when a newer one
-// is out and magpie knows how the CLI was installed (its own updater, npm,
-// bun, pnpm, Homebrew), a pill beside it updates it. The versions come after
-// the rows are drawn, never holding them up; one magpie can't tell how it
-// was installed shows its version alone.
+// Each agent's CLI shows its version after its name; a newer one out and its
+// installer known (its updater, npm, bun, pnpm, Homebrew), a pill updates
+// it. The versions come after the rows are drawn, never holding them up.
let cliInfo = {}; // agent id → { version, latest, via, command, update }
const cliBusy = new Set(); // the ones being updated now
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index dd49597e7..7714ac8d7 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -632,6 +632,7 @@ const I18N = {
"The Codex app's model menu shows only the first {max}: the last {n} models can't be picked there (the Codex CLI's /model lists them all). In Pick, turn off the ones you don't use, or drag the ones you use to the front under Order.": "Codex App 的模型菜单只显示前 {max} 个:后面 {n} 个模型在那里选不到(Codex CLI 的 /model 能列出全部)。在「挑选」里关掉不用的,或在「排序」里把要用的拖到前面。",
"Only each model's largest window": "只显示每个模型的最大上下文",
"A model of 1M or more is listed once, as its 1M entry. Quit and reopen Claude Desktop after a change.": "上下文达到 1M 或以上的模型只列一项,即它的 1M 版本。改动后需退出并重新打开 Claude Desktop。",
+ "On magpie, Desktop shows Anthropic's gateway window, which has no Chinese; disconnect it for Chinese.": "接入 magpie 后,Claude Desktop 显示的是 Anthropic 自带的网关模式界面,它没有中文,会显示英文。这是 Claude Desktop 自身缺少的翻译;从 magpie 断开后,Desktop 的中文就会回来。",
"Saved — quit and reopen Claude Desktop to see it": "已保存——退出并重新打开 Claude Desktop 后生效",
"Model list": "模型列表",
"only the {n} picked": "仅显示所选的 {n} 个",
@@ -3908,7 +3909,7 @@ const I18N = {
// agents' advice after a change (NOTICES)
"Ante reads its catalog at start-up — restart open ante sessions to use this.": "Ante 启动时读取模型目录,需重启已打开的 ante 会话才会生效。",
"AtomCode reads its settings at start-up — restart open atomcode sessions to use this.": "AtomCode 启动时读取设置,需重启已打开的 atomcode 会话才会生效。",
- "Claude Desktop reads this at start-up — quit and reopen it to run on magpie (Code and Cowork, no Anthropic sign-in).": "Claude Desktop 启动时读取这项设置,退出并重新打开后即走 magpie(Code 和 Cowork,无需登录 Anthropic)。",
+ "Claude Desktop reads this at start-up — quit and reopen it to run on magpie (Code and Cowork, no Anthropic sign-in).": "Claude Desktop 启动时读取这项设置,退出并重新打开后即走 magpie(Code 和 Cowork,无需登录 Anthropic)。此时 Desktop 显示 Anthropic 自带的网关模式界面,它没有中文,会显示英文。",
"Claude Desktop reads this at start-up — quit and reopen it to sign in with Anthropic again.": "Claude Desktop 启动时读取这项设置,退出并重新打开后可重新用 Anthropic 登录。",
"Cline reads its provider as a session starts — open sessions keep the model they have; new ones use this. Reload VS Code's window for its extension.": "Cline 在会话开始时读取供应商:已打开的会话保留原来的模型,新会话使用这项设置。VS Code 扩展需重新加载 VS Code 窗口。",
"Cline reads its provider as a session starts — open sessions keep the model they have; new ones use this. Reload VS Code's window for its extension; Cline's desktop app keeps the model picked in its own composer — pick magpie's there.": "Cline 在会话开始时读取供应商:已打开的会话保留原来的模型,新会话使用这项设置。VS Code 扩展需重新加载 VS Code 窗口;Cline 桌面应用沿用它自己输入框里选的模型,请在那里选 magpie 的模型。",
@@ -4774,6 +4775,7 @@ const I18N = {
"The Codex app's model menu shows only the first {max}: the last {n} models can't be picked there (the Codex CLI's /model lists them all). In Pick, turn off the ones you don't use, or drag the ones you use to the front under Order.": "Codex App 的模型選單只顯示前 {max} 個:後面 {n} 個模型在那裡選不到(Codex CLI 的 /model 能列出全部)。在「挑選」裡關掉不用的,或在「排序」裡把要用的拖到前面。",
"Only each model's largest window": "只顯示每個模型的最大上下文",
"A model of 1M or more is listed once, as its 1M entry. Quit and reopen Claude Desktop after a change.": "上下文達到 1M 或以上的模型只列一項,即它的 1M 版本。改動後需結束並重新開啟 Claude Desktop。",
+ "On magpie, Desktop shows Anthropic's gateway window, which has no Chinese; disconnect it for Chinese.": "接入 magpie 後,Claude Desktop 顯示的是 Anthropic 內建的閘道模式介面,它沒有中文,會顯示英文。這是 Claude Desktop 本身缺少的翻譯;從 magpie 中斷連線後,Desktop 的中文就會回來。",
"Saved — quit and reopen Claude Desktop to see it": "已儲存——結束並重新開啟 Claude Desktop 後生效",
"Model list": "模型列表",
"only the {n} picked": "僅顯示所選的 {n} 個",
@@ -8031,7 +8033,7 @@ const I18N = {
// agents' advice after a change (NOTICES)
"Ante reads its catalog at start-up — restart open ante sessions to use this.": "Ante 啟動時讀取模型目錄,需重啟已打開的 ante 會話才會生效。",
"AtomCode reads its settings at start-up — restart open atomcode sessions to use this.": "AtomCode 啟動時讀取設定,需重啟已打開的 atomcode 會話才會生效。",
- "Claude Desktop reads this at start-up — quit and reopen it to run on magpie (Code and Cowork, no Anthropic sign-in).": "Claude Desktop 啟動時讀取這項設定,退出並重新打開後即走 magpie(Code 和 Cowork,無需登入 Anthropic)。",
+ "Claude Desktop reads this at start-up — quit and reopen it to run on magpie (Code and Cowork, no Anthropic sign-in).": "Claude Desktop 啟動時讀取這項設定,退出並重新打開後即走 magpie(Code 和 Cowork,無需登入 Anthropic)。此時 Desktop 顯示 Anthropic 內建的閘道模式介面,它沒有中文,會顯示英文。",
"Claude Desktop reads this at start-up — quit and reopen it to sign in with Anthropic again.": "Claude Desktop 啟動時讀取這項設定,退出並重新打開後可重新用 Anthropic 登入。",
"Cline reads its provider as a session starts — open sessions keep the model they have; new ones use this. Reload VS Code's window for its extension.": "Cline 在會話開始時讀取供應商:已打開的會話保留原來的模型,新會話使用這項設定。VS Code 擴充功能需重新載入 VS Code 視窗。",
"Cline reads its provider as a session starts — open sessions keep the model they have; new ones use this. Reload VS Code's window for its extension; Cline's desktop app keeps the model picked in its own composer — pick magpie's there.": "Cline 在會話開始時讀取供應商:已打開的會話保留原來的模型,新會話使用這項設定。VS Code 擴充功能需重新載入 VS Code 視窗;Cline 桌面應用沿用它自己輸入框裡選的模型,請在那裡選 magpie 的模型。",
@@ -8882,6 +8884,7 @@ const I18N = {
"The Codex app's model menu shows only the first {max}: the last {n} models can't be picked there (the Codex CLI's /model lists them all). In Pick, turn off the ones you don't use, or drag the ones you use to the front under Order.": "Codex アプリのモデルメニューには先頭の {max} 個しか表示されず、残りの {n} 個のモデルはそこで選べません(Codex CLI の /model にはすべて表示されます)。「選択」で使わないモデルをオフにするか、「並び順」で使うモデルを先頭へドラッグしてください。",
"Only each model's largest window": "各モデルの最大コンテキストのみ表示",
"A model of 1M or more is listed once, as its 1M entry. Quit and reopen Claude Desktop after a change.": "1M 以上のコンテキストを持つモデルは 1M 版の 1 項目だけ表示されます。変更後は Claude Desktop を終了して開き直してください。",
+ "On magpie, Desktop shows Anthropic's gateway window, which has no Chinese; disconnect it for Chinese.": "magpie 経由では、Claude Desktop は Anthropic 独自のゲートウェイ用ウィンドウを表示します。そこには中国語がなく、英語で表示されます。magpie から切断すると Desktop の中国語が戻ります。",
"Saved — quit and reopen Claude Desktop to see it": "保存しました。Claude Desktop を終了して開き直すと反映されます",
"Model list": "モデル一覧",
"only the {n} picked": "選んだ {n} 件のみ",
@@ -13007,6 +13010,7 @@ const I18N = {
"The Codex app's model menu shows only the first {max}: the last {n} models can't be picked there (the Codex CLI's /model lists them all). In Pick, turn off the ones you don't use, or drag the ones you use to the front under Order.": "Das Modellmenü der Codex-App zeigt nur die ersten {max}: Die letzten {n} Modelle lassen sich dort nicht wählen (/model in der Codex-CLI listet alle). Schalte unter „Wählen“ ungenutzte aus oder zieh unter „Reihenfolge“ die genutzten nach vorn.",
"Only each model's largest window": "Nur das größte Kontextfenster jedes Modells",
"A model of 1M or more is listed once, as its 1M entry. Quit and reopen Claude Desktop after a change.": "Ein Modell mit 1M oder mehr erscheint nur einmal, als 1M-Eintrag. Beende Claude Desktop nach einer Änderung und öffne es neu.",
+ "On magpie, Desktop shows Anthropic's gateway window, which has no Chinese; disconnect it for Chinese.": "Über magpie zeigt Claude Desktop Anthropics eigenes Fenster für ein Gateway, das kein Chinesisch hat: Es ist auf Englisch. Desktops Chinesisch kommt zurück, wenn es von magpie getrennt wird.",
"Saved — quit and reopen Claude Desktop to see it": "Gespeichert – beende Claude Desktop und öffne es neu, um es zu sehen",
"Model list": "Modellliste",
"only the {n} picked": "nur die {n} ausgewählten",
diff --git a/internal/gui/tests/desktop-lang.test.cjs b/internal/gui/tests/desktop-lang.test.cjs
new file mode 100644
index 000000000..5a361f362
--- /dev/null
+++ b/internal/gui/tests/desktop-lang.test.cjs
@@ -0,0 +1,87 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// Claude Desktop on magpie runs in its 3p mode, whose window is Anthropic's
+// bundled one for a gateway: 11 languages, no Chinese (up to 4.4212.0), so a
+// Chinese reader saw it turn English and took it for magpie's (GZXYMH on X).
+// Claude Desktop's opened row says so in Chinese and Traditional Chinese, and
+// to no one else, whose language Desktop has. Every language, wide and
+// narrow. No backend: faked here.
+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");
+
+function fixture(lang) {
+ const settings = { lang, theme: "light" };
+ const posts = [];
+ const state = () => ({
+ agents: [{
+ id: "claude-desktop", name: "Claude Desktop", path: "/test/claude_desktop_config.json", icon: "claude-color", wired: true,
+ fields: [{ key: "provider", label: "provider", value: "magpie", options: [{ value: "magpie", label: "magpie", icon: "magpie" }] }],
+ models: { shown: 2, listed: 2, by: [{ name: "OpenCode Go", icon: "opencode", n: 2 }], names: ["DeepSeek V4 Pro", "Exo Free"] },
+ }],
+ profiles: [], settings,
+ });
+ async function serve(route) {
+ const req = route.request(), url = new URL(req.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:true};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json(state());
+ if (url.pathname === "/api/usage/quotas") return json([]);
+ if (url.pathname === "/api/groups") return json({ groups: [] });
+ if (url.pathname === "/api/agents/cli") return json({ agents: {}, pending: false });
+ if (url.pathname === "/api/providers") return json({ providers: [], gateway: { running: true } });
+ 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 });
+ }
+ return { serve, posts };
+}
+
+// "Details" in each language, and what the line says where it is shown
+const W = {
+ en: { details: "Details" },
+ zh: { details: "详情", says: "没有中文" },
+ "zh-TW": { details: "詳情", says: "沒有中文" },
+ ja: { details: "詳細" },
+ de: { details: "Details" },
+};
+const cd = '.row.agent[data-id="claude-desktop"]';
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of Object.keys(W)) {
+ for (const width of [1100, 640]) {
+ test(`${engine} ${lang} ${width}px: Claude Desktop's row says its gateway window has no Chinese, to a Chinese reader alone`, async (t) => {
+ const w = W[lang];
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ const page = await browser.newPage({ viewport: { width, height: 700 } });
+ page.setDefaultTimeout(5000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ const fx = fixture(lang);
+ await page.route("**/*", fx.serve);
+ t.after(() => browser.close());
+ await page.goto("http://magpie.test/");
+ await page.locator(cd).waitFor();
+ await page.locator(`${cd} .ag-link`, { hasText: w.details }).click();
+ await page.locator(`${cd} .ag-exp .ag-longest`).waitFor();
+ const line = page.locator(`${cd} .ag-exp .ag-desktop-lang`);
+ if (!w.says) {
+ assert.equal(await line.count(), 0, "said to a reader whose language Desktop's gateway window has");
+ } else {
+ assert.ok((await line.textContent()).includes(w.says), await line.textContent());
+ const box = await line.boundingBox();
+ assert.ok(box.width <= width && box.height > 0, JSON.stringify(box));
+ // the page's width holds at a narrow window
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), "the page scrolls sideways");
+ }
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+}