diff --git a/docs/reference.md b/docs/reference.md index fcea6dc97..a1f4cf8f9 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -593,7 +593,10 @@ solves captchas. See [provider-plugins.md](subsystems/provider-plugins.md#a-plug A plugin can also declare its own switches for its provider (`auth.options`). They are listed under **Plugin options** in the provider's editor, an Off/On -each with the plugin's own words, and saved with the provider. The values are +each with the plugin's own words (in the window's language when the +plugin gives them, `labels` and `descriptions`), and saved with the +provider. While a switch that leaves models out (`filtersModels`) is on, +the Models field says the list is filtered. The values are kept in `pluginOptions` in `settings.json`, and the plugin reads them as it works. Changing one starts nothing by itself. See [provider-plugins.md](subsystems/provider-plugins.md#a-plugins-own-options). diff --git a/docs/subsystems/provider-plugins.md b/docs/subsystems/provider-plugins.md index c1a9f0240..663a6c1dc 100644 --- a/docs/subsystems/provider-plugins.md +++ b/docs/subsystems/provider-plugins.md @@ -70,11 +70,11 @@ Qoder plugins without `auth.checkin` still use [`qoder_checkin.go`](../../intern ## A plugin's own options -A plugin can declare switches for its provider (#2038): its `auth` hook gains `options: [{key, label, description?, default?, confirm?}]`. The host ([`host.js`](../../internal/plugin/host.js) `optionsOf`) keeps an option whose `key` matches `[a-z0-9_-]{1,40}` and whose `label` isn't empty, drops a key seen before, caps the label at 60 characters and the description and `confirm` at 300, takes `default` only when it is `true`, and keeps the first 16. The provider is listed with them (`plugin.Provider.Options`). +A plugin can declare switches for its provider (#2038): its `auth` hook gains `options: [{key, label, description?, default?, confirm?}]`. The host ([`host.js`](../../internal/plugin/host.js) `optionsOf`) keeps an option whose `key` matches `[a-z0-9_-]{1,40}` and whose `label` isn't empty, drops a key seen before, caps the label at 60 characters and the description and `confirm` at 300, takes `default` only when it is `true`, and keeps the first 16. The provider is listed with them (`plugin.Provider.Options`). An option may give its words in the window's other languages, as a page's `titles` do (plugins#590): `labels`, `descriptions` and `confirms`, each `{"zh": "…", "zh-TW": "…", "ja": "…", "de": "…"}`, kept without what isn't a string or is empty, a language name over 16, or past 16 languages, each capped as the plain one is. `label` stays a string beside them, so an older magpie, which copies only the plain fields, shows the plain words, and OpenCode, whose `AuthHook` is `provider`, `loader` and `methods`, never reads `options` at all. `filtersModels: true` (anything else is false) says the plugin's model list leaves models out while the switch is on, as WorkBuddy's "Free models only" does. The user's values are kept in `settings.PluginOptions` by the plugin's own provider id and the option's key, and set with `POST /api/settings/plugin-option {provider, key, on}`, which checks the key the same way. The host is handed them at `init` (`options`) and again after each change (`setProviderOptions`, `plugin.SetProviderOptions`, sent only to a host already running). A plugin reads them through `input.magpie.option(provider, key)` (the user's value, else the default; false for a key it didn't declare) or `input.magpie.options(provider)` (every declared key). Both read the current values each time, so a change reaches the plugin without a restart. A plugin written for older hosts checks `input.magpie?.option` first. When an option changes magpie keeps and hands over the value, and forgets the providers it keeps, so they are listed again: a models hook may list by an option (WorkBuddy's "Free models only", plugins#430). Nothing else runs. The check-in switch is separate and unchanged. -The provider's editor lists them under *Plugin options* (`pluginOptionsField` in [`app.js`](../../internal/gui/assets/app.js), the values from `/api/providers`' `plugins[].options[].on`), an Off/On each beside the plugin's label and description, put in as text. One with `confirm` asks it before it is turned on. Changes wait for Save, which posts each changed one before the provider. +The provider's editor lists them under *Plugin options* (`pluginOptionsField` in [`app.js`](../../internal/gui/assets/app.js), the values from `/api/providers`' `plugins[].options[].on`), an Off/On each beside the plugin's label and description, put in as text, in the window's language (`optionWords`: its `labels`/`descriptions`/`confirms` by the language, then by its first part, so zh-TW reads zh, else the plain one). One with `confirm` asks it before it is turned on. Changes wait for Save, which posts each changed one before the provider. While an option that says `filtersModels` is on, as saved (the list was read with it), the Models field says so under the chips (`pluginFilterNote`): "Only some models are listed: the plugin option “…” is on.", with the option's label in the window's language. Off, or with no such option, nothing is said. ## A plugin whose upstream searches @@ -268,7 +268,7 @@ Gateway parity tests in [`plugin_parity_test.go`](../../internal/gateway/plugin_ [`plugin_checkin_test.go`](../../internal/provider/plugin_checkin_test.go) runs the fake plugin's `auth.checkin` (`FAKE_CHECKIN`) through the schedule: off, each outcome, no second press the same day, failures only after the retry window, the next day, cards and Settings, and the vendor check-in stepping aside; `TestPluginCheckinTellsSignInsOfOneNameApart` signs in four accounts under two names, two of each (plugins#254), and checks each is checked in, kept, carded and switched off on its own, and `TestPluginCheckinCarriesOverDisplayNameEntries` upgrades a file and an `Off` kept by display name. `TestPluginCheckinQoderRechecksCampaigns` holds the Qoder plugins' recheck, by the loop and a press, after `inactive` and `done`, `TestPluginCheckinOthersSettledForTheDay` every other plugin's day from noon Beijing, and `TestPluginCheckinEarlyDoneAskedAgain` the reporter's 00:00:28 done asked again by the loop and a press (#3326); `TestPluginCheckinAsksAgainAtUntil` holds the clock from 09:27 Beijing through the next day's 10:30, with the machine in UTC, UTC-8 and Beijing, and checks the asks land at 09:27, 10:01, the Beijing day's turn and 10:01 again, and a failure in the 09:59 gap at 10:01; `checkin-early-done.test.cjs` covers that card; `qoder-checkin-recheck.test.cjs` covers the card's press. `plugin-checkin.test.cjs` covers the card row and the Settings tab. -[`plugin_options_test.go`](../../internal/plugin/plugin_options_test.go) loads `testdata/options` in a real host: which declared options are kept and how they are capped, the user's value over the default at start, a change read by the plugin after `SetProviderOptions` without a restart, and a models hook's list that goes by an option following it after the change. [`plugin_option_api_test.go`](../../internal/gui/plugin_option_api_test.go) covers the endpoint, a bad key, and a Settings save keeping the values. `plugin-options.test.cjs` covers the editor in Chromium and WebKit, 1100 and 420 wide, in every language. +[`plugin_options_test.go`](../../internal/plugin/plugin_options_test.go) loads `testdata/options` in a real host: which declared options are kept and how they are capped, the user's value over the default at start, a change read by the plugin after `SetProviderOptions` without a restart, and a models hook's list that goes by an option following it after the change. [`plugin_option_api_test.go`](../../internal/gui/plugin_option_api_test.go) covers the endpoint, a bad key, and a Settings save keeping the values. `plugin-options.test.cjs` covers the editor in Chromium and WebKit, 1100 and 420 wide, in every language. `plugin-option-words.test.cjs` covers the words in each language (zh-TW falling back to zh, ja and de to the plain ones when a plugin gives only zh) and the note under the models, on and off, in both engines, 1100 and 420 wide. [`plugin_cliproxy_test.go`](../../internal/plugin/plugin_cliproxy_test.go)'s `TestPluginHostTakesANewProxy` starts a real host without a proxy, sets one, and checks that a program the plugin starts gets it. [`plugin_lan_test.go`](../../internal/plugin/plugin_lan_test.go)'s `TestPluginLeavesTheUserNetworkDirect` checks with a real host that fetches (http:// and https://) and an HTTP/2 session to this computer's private address reach it directly with a proxy set, and that a public address and an unresolvable name still go through the proxy. `plugin-signed-out-account.test.cjs` covers a moved Grok account signed out while in use and as the agent's own, in Chromium and WebKit, en and zh, 420 and 1100 wide. diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 400b6d09a..fe838d967 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -7717,11 +7717,12 @@ function pluginOptionsField(sub) { const row = el("div", "plugin-option"); row.dataset.key = o.key; const text = el("div", "plugin-option-text"); - text.append(el("div", "n", o.label)); - if (o.description) text.append(el("div", "hint", o.description)); + const label = optionWords(o, "label"), about = optionWords(o, "description"), ask = optionWords(o, "confirm"); + text.append(el("div", "n", label)); + if (about) text.append(el("div", "hint", about)); const draw = () => { const seg = segs([["off", t("Off")], ["on", t("On")]], now(o) ? "on" : "off", async (v) => { - if (v === "on" && !now(o) && o.confirm && !(await confirmAction(t("Turn on {name}?", { name: o.label }), o.confirm, t("Turn on")))) { + if (v === "on" && !now(o) && ask && !(await confirmAction(t("Turn on {name}?", { name: label }), ask, t("Turn on")))) { seg.replaceWith(draw()); return; } @@ -7734,6 +7735,16 @@ function pluginOptionsField(sub) { } return field(t("Plugin options"), box, t("{plugin} declares these and reads them as it works; nothing runs on its own when one changes.", { plugin: sub.plugin.name || sub.plugin.pid })); } +// a plugin option's words in the window's language (plugins#590) +function optionWords(o, which) { + const m = o[which + "s"] || {}; + return m[locale] || m[locale.split("-")[0]] || o[which] || ""; +} +// said under the models while a filtersModels switch is on, as saved +function pluginFilterNote(sub) { + return (sub?.plugin?.options || []).filter((o) => o.filtersModels && o.on) + .map((o) => t("Only some models are listed: the plugin option “{option}” is on.", { option: optionWords(o, "label") })).join(" "); +} // savePluginOptions saves the draft's changed plugin options, by its own id. async function savePluginOptions(sub) { const pid = sub?.plugin?.pid; @@ -8979,11 +8990,7 @@ const decideOnly = (p) => !!p?.decide && !(p.chat || p.responses || p.anthropic // they are: its Jev Router (typesafe/jev-router) is a chat model const decidesModel = (p, id) => !!p.decide && (decideOnly(p) || (p.deciders ? p.deciders.includes(id) : id.split("/").some((s) => /^jev(?:-|$)/i.test(s)))); // modelAPIs: the APIs one of p's models can be asked on alone, those it has -// a URL for when it has more than one — a custom provider's, a preset's or -// a subscription's alike (01huadalang on Discord: 一个 api 里有很多模型但是不同协议; -// OpenCode Go's DeepSeek answers on Responses too), its Gemini URL's -// among them (Kayphoon on Discord: 自定义供应商兼容 gemini 格式了,模型的 -// 配置里还是只能选 chat 和 anthropic) +// a URL for when it has more than one, Gemini's too (01huadalang, Kayphoon) const modelAPIs = (p) => { const urls = ["chat", "responses", "anthropic", "gemini"].filter((k) => ((draft?.id === p.id ? draft[k] : undefined) ?? p[k] ?? "").trim()); return urls.length < 2 ? [] : PROTOS.filter(([k]) => urls.includes(k)); @@ -9201,13 +9208,9 @@ function drawEditor(p, presetID) { b.title = t(hint); b.onclick = () => { if (draft.api === v) return; - // each protocol keeps its own URL (#105). One typed here and not - // saved moves to a protocol without one, spelled as that protocol - // wants it: the kind was picked after the URL (#73). A saved URL - // stays where it is, and one not given yet stays empty. - // A URL then typed for the protocol it was carried to is that - // protocol's own, and the carried one goes back where it was typed, - // so a URL can be typed for each protocol in turn (#1231). + // each protocol keeps its own URL (#105); an unsaved one moves to a + // protocol without one, in its spelling (#73), and goes back once + // that protocol is given its own (#1231) const from = apiField[draft.api], to = apiField[v]; carried = null; if (!draft[to] && draft[from] && draft[from] !== (p?.[from] || "")) { @@ -9321,7 +9324,7 @@ function drawEditor(p, presetID) { acct.append(icon(a.agentIcon), el("span", "n", a.user), hideAccounts.eye(a.user, p.id), el("span", "plan", accountPlan(a))); ed.append(...field(t("Account"), acct, t("{agent}'s sign-in, read from its own files. Sign out there and this provider goes away.", { agent: a.agentName }))); } - ed.append(...field(t("Models"), renderModels(p), "")); + ed.append(...field(t("Models"), renderModels(p), pluginFilterNote(subOf(a.agent)))); if (p.drawIds?.length) ed.append(...renderDrawers(p)); // a subscription's window too: Codex's backend says 272K for models // that take 872K (#120) @@ -9403,11 +9406,8 @@ function drawEditor(p, presetID) { ed.append(...field(t("Endpoint"), endpoint, pr.endpointHint ? t(pr.endpointHint) : "")); } - // a server on this machine (Ollama, LM Studio, oMLX, MLX-Serve) can - // listen on another port, or be another computer's: its address moves each URL, each API - // keeping its path, as provider.AtAddress does. Shown first and never - // folded: folded under the key, an LM Studio on another computer read - // as one whose base URL can't be changed (mengxiangziyou on X) + // a local server's address moves each URL, keeping its path + // (provider.AtAddress); shown first, never folded (mengxiangziyou on X) let address = null, addressField = null; if (pr?.kind === "local") { // a saved provider's URLs (or a duplicate's) start it; a new one's are diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index d4bcda839..aec80c620 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -2347,6 +2347,7 @@ const I18N = { "Count its models as free": "把它的模型算作免费", "For a free quota, like a daily allowance: Free first uses its models before paid ones, and Cheapest first counts them as costing nothing. Prices and the costs Usage counts stay as listed.": "适用于免费额度,比如每日免费额度:「免费优先」会先用它的模型,再用付费的;「最便宜优先」把它们算作不花钱。价格和用量统计的费用保持原样。", "Plugin options": "插件选项", + "Only some models are listed: the plugin option “{option}” is on.": "只列出部分模型:插件选项「{option}」已开启。", "{plugin} declares these and reads them as it works; nothing runs on its own when one changes.": "{plugin} 声明了这些选项,并在工作时读取;更改选项不会自行运行任何操作。", "Turn on {name}?": "开启「{name}」?", "1, the official price": "1,即官方价格", @@ -6667,6 +6668,7 @@ const I18N = { "Count its models as free": "把它的模型算作免費", "For a free quota, like a daily allowance: Free first uses its models before paid ones, and Cheapest first counts them as costing nothing. Prices and the costs Usage counts stay as listed.": "適用於免費額度,例如每日免費額度:「免費優先」會先用它的模型,再用付費的;「最便宜優先」把它們算作不花錢。價格和用量統計的費用維持原樣。", "Plugin options": "外掛選項", + "Only some models are listed: the plugin option “{option}” is on.": "只列出部分模型:外掛選項「{option}」已開啟。", "{plugin} declares these and reads them as it works; nothing runs on its own when one changes.": "{plugin} 宣告了這些選項,並在工作時讀取;變更選項不會自行執行任何動作。", "Turn on {name}?": "開啟「{name}」?", "1, the official price": "1,即官方價格", @@ -10965,6 +10967,7 @@ const I18N = { "Count its models as free": "このモデルを無料として扱う", "For a free quota, like a daily allowance: Free first uses its models before paid ones, and Cheapest first counts them as costing nothing. Prices and the costs Usage counts stay as listed.": "毎日の無料枠のような無料分に。「無料優先」は有料のものより先にこのモデルを使い、「最安優先」はコストなしとして扱います。価格と使用量で数える費用はそのままです。", "Plugin options": "プラグインのオプション", + "Only some models are listed: the plugin option “{option}” is on.": "一部のモデルのみ表示しています。プラグインのオプション「{option}」がオンです。", "{plugin} declares these and reads them as it works; nothing runs on its own when one changes.": "{plugin} が宣言し、動作中に読み取ります。変更しても、それだけで何かが実行されることはありません。", "Turn on {name}?": "「{name}」をオンにしますか?", "1, the official price": "1(公式価格)", @@ -15294,6 +15297,7 @@ const I18N = { "Count its models as free": "Seine Modelle als kostenlos zählen", "For a free quota, like a daily allowance: Free first uses its models before paid ones, and Cheapest first counts them as costing nothing. Prices and the costs Usage counts stay as listed.": "Für ein Gratiskontingent, etwa ein tägliches: „Kostenlos zuerst“ nutzt seine Modelle vor bezahlten, und „Günstigste zuerst“ rechnet sie als kostenlos. Preise und die Kosten in der Nutzung bleiben wie gelistet.", "Plugin options": "Plugin-Optionen", + "Only some models are listed: the plugin option “{option}” is on.": "Nur einige Modelle werden angezeigt: Die Plugin-Option „{option}“ ist an.", "{plugin} declares these and reads them as it works; nothing runs on its own when one changes.": "{plugin} legt diese fest und liest sie bei der Arbeit; eine Änderung löst selbst nichts aus.", "Turn on {name}?": "{name} einschalten?", "1, the official price": "1, der offizielle Preis", diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index e2c0ace1a..2cbd8de63 100644 --- a/internal/gui/core_budget_test.go +++ b/internal/gui/core_budget_test.go @@ -16,7 +16,7 @@ import ( // raises them and says why in its commit. const ( appScriptBudget = 1_316_874 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25); 1,326,105 with many releases' notes merged into one list by kind, each line with its version (the owner), in the update sheet and What's new, with no room added (10-25); 1,321,319 with Settings › Observability moved out to its plugin (plugins/otel/page.js) and its Langfuse setup there (an X user), the budget lowered to it (10-26); a quota card whose window is used but names no reset no longer saying "Not used yet" (windy on Discord) raised it to 1,321,347, and back to 1,321,319 with Settings' model pickers sharing one row helper (modelOpt) where six kept their own copy, no raise (10-26); 1,325,845 with every slow page's skeletons getting magpie's bird hopping bar to bar (skelBird, the owner after the Plugins page's README), one bird for the window over whatever page or dialog is loading, the core's own, with no room added (10-26); 1,310,129 with Settings › Network and sharing's gateway rows (its port, bare ids, local network, allowed addresses, web pages) moved out to the gateway plugin (plugins/gateway/settings.js), the budget lowered to it (10-27); 1,310,269 with Test models naming the first model that failed and its error in the status line, where it said only how many (ysm119 on Discord), the provider editor's, the core's own, with no room added (10-27); 1,310,460 with Settings › About's Website row linking usemagpie.ai (the owner), Settings' own row, with no room added (10-27); 1,309,669 with a pool's Stop at the caps and Check usage near a cap ticks under a provider's accounts (plugins#349), the core's own editor, its account rows' Remove and add rows each drawn by one helper (forgetOf, addRow), with no room added (10-28); 1,311,681 with Install another agent on the Agents page naming the agents Plugins has (More in Plugins) and opening Plugins at its Agents (the owner), the Agents page's, the core's own, with no room added (10-28); 1,311,735 with More in Plugins in sight while Install another agent is folded (the owner), with no room added (10-29); 1,313,704 with a window whose WebKit scrolls under wheels it never tells of (macOS 13) remembered once seen, a scroll at rest then waiting 120ms for a second the same way within 80ms before it is put back, kept for a late wheel to give back (waitsBack), and a load landing under the wheel keeping the reader's way (backAfterLoad, issennknight), the window's own scroll guard, with no room added (10-29); back to 1,311,735 with Settings › Models › Web search's rows (renderSearch, renderSearcher, the search APIs' keys) moved out to the search plugin (plugins/search/settings.js), app.js 1,292,527 after it, not lowered further since what is left plus 1.5% is over it (#4133, 10-29); 1,315,316 with the Agents row of a Claude Code or Codex not connected saying the account it is signed in to and switching it to another (Switch accounts only, the owner on X), in place of the failover line's ChatGPT accounts button, the Agents page's, the core's own, its comments cut down, with no room added (10-30); 1,317,705 with a Claude account added from a setup-token (sfss5362 on X): the sign-in's Use a setup-token instead…, its sheet, and its account row's magpie only, the provider editor's account rows, the core's own editor, its comments cut down, with no room added (10-30); back to 1,315,316 with the setup-token sheet and Copilot's GHE.com one moved out to signsheets.js, loaded when one is asked for (signAsk, 10-30); 1,315,479 with the provider editor lining its Advanced up with its fields (the owner: 高级这个折叠按钮为什么在一个前不着村后不着店的位置?) and a refresh on each of its accounts (在这里也要加上手动刷新用量的按钮), the core's own editor, with no room added (10-31); 1,315,603 with About's Log row, the path of the log the app writes and an Open for its folder (rayem1w on X), in app.js, its comment cut to one line, with no room added (10-31); 1,316,781 with a provider's model listed by an id of the user's (zeewell on X), the provider editor's Names & levels Listed as box beside Same as, the core's own editor, with no room added (10-31); 1,316,874 with a package manager's magpie (the AUR's magpie-bin) naming the command that updates it in Settings' Version row and lighting no Update pill (shuhai on Discord), the core's own update row, which the tray panel reads too, its comments cut to one line, with no room added (10-31); Settings › Sync's Kept on this computer row (hayden4608 on Discord) raised it to 1,317,497, which is no bound; the 1,316,874 it had came back once later trims left app.js at 1,308,363 (10-31) - coreScriptBudget = 1_533_105 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28); 1,528,076 with the Partners heading's light (the owner), in app.js, with no room added (10-28); 1,530,449 with Install another agent's More in Plugins row (the owner), in app.js, and Plugins opening at its Agents, in plugins.js, with no room added (10-28); 1,530,807 with layout.js measuring the scrollbar into --bar, which every page's right padding takes off so its sides match (the owner), the window's own shell, with no room added (10-28); 1,530,861 with More in Plugins in sight while Install another agent is folded (the owner), in app.js, with no room added (10-29); 1,532,830 with waitsBack and backAfterLoad (issennknight, macOS 13), the window's own scroll guard, in app.js, with no room added (10-29); the context map's tile wording (a4e929212) and Cindy's Add magpie (628ac36fc) had taken the core over it, and Web search's rows moved out to plugins/search/settings.js brought it back to 1,530,861 (#4133, 10-29); 1,532,459 with a provider editor's account rows on one line each, First or Make first at its right end and the settings that aren't set under ⋯ (the owner), the core's own editor, in app.js, which stays in its budget with its comments cut down, with no room added (10-29); 1,532,602 with a plugin's README waiting for its bird to land on three lines before it goes in, however soon it came (the owner, 10-30), in plugins.js, with no room added; 1,536,357 with Switch accounts only on the Agents row (the owner on X), in app.js, with no room added (10-30); 1,537,034 with a plugin's README read once shown at once, with no bird, when its page opens again and read again behind it, the last 20 kept (the owner), in plugins.js, with no room added (10-30); 1,539,423 with a Claude account added from a setup-token (sfss5362 on X), in app.js, with no room added (10-30); 1,538,975 with purposes.js written as compact JSON by genpurposes and the MCP tool purpose in it, 448 bytes less in all (ferock on Discord), lowered to it (10-30); 1,536,586 with the setup-token sheet and Copilot's GHE.com one moved out to signsheets.js, lowered by the 2,389 the setup-token raised it (10-30); 1,536,631 with the 45 bytes b62fa332f added to app.js (Send requests unmasked for subscriptions and plugin providers too) without a raise, with no room added (10-31); 1,537,356 with Settings › Models › Replies › Claude Code's interactive mode, a row beside Short Claude system prompt (the owner), in app.js, with no room added (10-31); Long conversations in Codex's row naming the config.toml keys Codex reads before it, with Take it out, and the window magpie tells Codex for the model it runs (zgjfjfl on Discord) raised it to 1,537,669, and it is back under 1,537,356 with the key list and the window's size written by the server (codexKeysText, tokensSize) and the row's words cut, no raise (10-31); 1,538,554 with the same two, with no room added (10-31); 1,538,678 with About's Log row (rayem1w on X), with no room added (10-31); 1,539,856 with a model's Listed as id (zeewell on X), in app.js, with no room added (10-31); Tuned for you's Codex row offering the advice to background compaction (herman_hong on Discord) and a package manager's magpie naming its command (shuhai on Discord) took it to 1,541,798, and the release notes' dialogs (What's new, the update's ask) moved out to whatsnew.js, loaded when one opens, brought it back under 1,539,856, no raise (10-31); 1,540,479 for Settings › Sync's Kept on this computer row (hayden4608 on Discord) was taken back to 1,539,856 once the core weighed 1,533,355, no raise (10-31); 1,532,958 with the context window card's head naming the agent and the model's lab (the owner), in context.js, after the card's part text viewer moved out to ctxtext.js (7,005 bytes), lowered to it (10-31); 1,533,105 with the provider editor's Claude Code runs as row moved above the accounts, its pill and hover card in claudemode.js, and Settings found at the row that draws anew (the owner), in app.js and i18n.js, with no room added (11-01); a Codex account's credits spent only after every other account, key and fallback (gokoshiki on Discord) fit in it with the Codex options' comments in app.js cut down, no raise (11-01) + coreScriptBudget = 1_533_105 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28); 1,528,076 with the Partners heading's light (the owner), in app.js, with no room added (10-28); 1,530,449 with Install another agent's More in Plugins row (the owner), in app.js, and Plugins opening at its Agents, in plugins.js, with no room added (10-28); 1,530,807 with layout.js measuring the scrollbar into --bar, which every page's right padding takes off so its sides match (the owner), the window's own shell, with no room added (10-28); 1,530,861 with More in Plugins in sight while Install another agent is folded (the owner), in app.js, with no room added (10-29); 1,532,830 with waitsBack and backAfterLoad (issennknight, macOS 13), the window's own scroll guard, in app.js, with no room added (10-29); the context map's tile wording (a4e929212) and Cindy's Add magpie (628ac36fc) had taken the core over it, and Web search's rows moved out to plugins/search/settings.js brought it back to 1,530,861 (#4133, 10-29); 1,532,459 with a provider editor's account rows on one line each, First or Make first at its right end and the settings that aren't set under ⋯ (the owner), the core's own editor, in app.js, which stays in its budget with its comments cut down, with no room added (10-29); 1,532,602 with a plugin's README waiting for its bird to land on three lines before it goes in, however soon it came (the owner, 10-30), in plugins.js, with no room added; 1,536,357 with Switch accounts only on the Agents row (the owner on X), in app.js, with no room added (10-30); 1,537,034 with a plugin's README read once shown at once, with no bird, when its page opens again and read again behind it, the last 20 kept (the owner), in plugins.js, with no room added (10-30); 1,539,423 with a Claude account added from a setup-token (sfss5362 on X), in app.js, with no room added (10-30); 1,538,975 with purposes.js written as compact JSON by genpurposes and the MCP tool purpose in it, 448 bytes less in all (ferock on Discord), lowered to it (10-30); 1,536,586 with the setup-token sheet and Copilot's GHE.com one moved out to signsheets.js, lowered by the 2,389 the setup-token raised it (10-30); 1,536,631 with the 45 bytes b62fa332f added to app.js (Send requests unmasked for subscriptions and plugin providers too) without a raise, with no room added (10-31); 1,537,356 with Settings › Models › Replies › Claude Code's interactive mode, a row beside Short Claude system prompt (the owner), in app.js, with no room added (10-31); Long conversations in Codex's row naming the config.toml keys Codex reads before it, with Take it out, and the window magpie tells Codex for the model it runs (zgjfjfl on Discord) raised it to 1,537,669, and it is back under 1,537,356 with the key list and the window's size written by the server (codexKeysText, tokensSize) and the row's words cut, no raise (10-31); 1,538,554 with the same two, with no room added (10-31); 1,538,678 with About's Log row (rayem1w on X), with no room added (10-31); 1,539,856 with a model's Listed as id (zeewell on X), in app.js, with no room added (10-31); Tuned for you's Codex row offering the advice to background compaction (herman_hong on Discord) and a package manager's magpie naming its command (shuhai on Discord) took it to 1,541,798, and the release notes' dialogs (What's new, the update's ask) moved out to whatsnew.js, loaded when one opens, brought it back under 1,539,856, no raise (10-31); 1,540,479 for Settings › Sync's Kept on this computer row (hayden4608 on Discord) was taken back to 1,539,856 once the core weighed 1,533,355, no raise (10-31); 1,532,958 with the context window card's head naming the agent and the model's lab (the owner), in context.js, after the card's part text viewer moved out to ctxtext.js (7,005 bytes), lowered to it (10-31); 1,533,105 with the provider editor's Claude Code runs as row moved above the accounts, its pill and hover card in claudemode.js, and Settings found at the row that draws anew (the owner), in app.js and i18n.js, with no room added (11-01); a Codex account's credits spent only after every other account, key and fallback (gokoshiki on Discord) fit in it with the Codex options' comments in app.js cut down, no raise (11-01); a plugin option's words in the window's language and the filtered-models note (plugins#590, anewuser6937 on Discord) fit in it with three of the provider editor's comments in app.js cut down, no raise (11-01) ) func TestCoreScriptBudget(t *testing.T) { diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md index 06beb1f48..92d38016e 100644 --- a/internal/gui/tests/README.md +++ b/internal/gui/tests/README.md @@ -337,6 +337,14 @@ leaving it off; Save posting each changed one by the plugin's provider id before the provider, and none switched back. Chromium and WebKit, 1100 and 420 wide, every language. +`plugin-option-words.test.cjs` checks a plugin option in the reader's +language (plugins#590): its `labels`, `descriptions` and `confirms` by the +window's language, zh-TW falling back to zh and the rest to the plain +words; and, while a `filtersModels` switch is on as saved, the note under +the Models field's chips that the list is filtered, inside the editor; off, +none. A WorkBuddy moved onto its plugin, Chromium and WebKit, 1100 and 420 +wide, every language. + `plugin-move-overflow.test.cjs` checks a Plugins card that offers a built-in's accounts: the button is one word beside the name, as Install is ("Move", its title saying whose accounts and how many), on one line, and it diff --git a/internal/gui/tests/plugin-option-words.test.cjs b/internal/gui/tests/plugin-option-words.test.cjs new file mode 100644 index 000000000..8d3db81ec --- /dev/null +++ b/internal/gui/tests/plugin-option-words.test.cjs @@ -0,0 +1,119 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// A plugin option in the reader's language, and a short model list said to +// be filtered (plugins#590, anewuser6937 on Discord): WorkBuddy's "Free +// models only" showed in English inside the Chinese window, and with it on +// the editor listed one model with nothing saying why, so the plugin read as +// broken. The option's labels, descriptions and confirms give its words by +// the window's language (zh-TW falls back to zh, any other to the plain +// one), and while a switch that says filtersModels is on, as saved, the +// Models field says so under the chips. Off, nothing is said. Both engines, +// 1100 and 420 wide, every language. +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 free = (on) => ({ + key: "free_only", label: "Free models only", description: "Lists only the models WorkBuddy serves at no cost.", + labels: { zh: "仅免费模型", "zh-TW": "僅免費模型", ja: "無料モデルのみ", de: "Nur kostenlose Modelle" }, + descriptions: { zh: "只列出 WorkBuddy 免费提供的模型。", "zh-TW": "只列出 WorkBuddy 免費提供的模型。", ja: "WorkBuddy が無料で提供するモデルだけを表示します。", de: "Listet nur die Modelle, die WorkBuddy kostenlos anbietet." }, + filtersModels: true, on, +}); +// only Simplified Chinese words: zh-TW reads them, the rest the plain ones +const beta = { key: "beta", label: "Beta models", confirm: "Beta models may be withdrawn.", labels: { zh: "测试版模型" }, confirms: { zh: "测试版模型可能会下线。" }, on: false }; + +function serve(lang, on) { + const plugin = { id: "workbuddy", pid: "workbuddy", name: "WorkBuddy", icon: "generic", spec: "@magpie-community/opencode-workbuddy-auth", signedIn: true, models: 1, + methods: [{ type: "api", label: "API key" }], options: [free(on), beta] }; + const payload = { providers: [{ id: "workbuddy", name: "WorkBuddy", icon: "generic", chat: "plugin://workbuddy/v1", responses: "", anthropic: "", catalog: "", + models: [{ id: "hy3", name: "Hy3", on: true }], agents: [], fallback: [], headers: {}, keyList: [], key: {}, proxy: "", maxConcurrency: null, + account: { agent: "workbuddy", agentName: "WorkBuddy", agentIcon: "generic", user: "me@fake", logins: [{ user: "me@fake", active: true, on: true }] } }], + // moved onto its plugin, as every WorkBuddy user is since 10-17 + presets: [], excluded: [], gateway: { running: true, window: true }, plugins: [plugin], onPlugins: ["workbuddy"] }; + 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: { lang, theme: "light" } }); + if (url.pathname === "/api/providers") return json(payload); + if (url.pathname === "/api/groups") return json({ groups: [], pools: [] }); + 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)]; + try { await route.fulfill({ body: await fs.readFile(file), contentType }); } catch { await route.fulfill({ status: 404, body: "" }); } + }; +} + +const W = { + en: { models: "Models", on: "On", label: "Free models only", about: "Lists only the models WorkBuddy serves at no cost.", beta: "Beta models", ask: "Beta models may be withdrawn.", + note: "Only some models are listed: the plugin option “Free models only” is on." }, + zh: { models: "模型", on: "开启", label: "仅免费模型", about: "只列出 WorkBuddy 免费提供的模型。", beta: "测试版模型", ask: "测试版模型可能会下线。", + note: "只列出部分模型:插件选项「仅免费模型」已开启。" }, + "zh-TW": { models: "模型", on: "開啟", label: "僅免費模型", about: "只列出 WorkBuddy 免費提供的模型。", beta: "测试版模型", ask: "测试版模型可能会下线。", + note: "只列出部分模型:外掛選項「僅免費模型」已開啟。" }, + ja: { models: "モデル", on: "オン", label: "無料モデルのみ", about: "WorkBuddy が無料で提供するモデルだけを表示します。", beta: "Beta models", ask: "Beta models may be withdrawn.", + note: "一部のモデルのみ表示しています。プラグインのオプション「無料モデルのみ」がオンです。" }, + de: { models: "Modelle", on: "An", label: "Nur kostenlose Modelle", about: "Listet nur die Modelle, die WorkBuddy kostenlos anbietet.", beta: "Beta models", ask: "Beta models may be withdrawn.", + note: "Nur einige Modelle werden angezeigt: Die Plugin-Option „Nur kostenlose Modelle“ ist an." }, +}; + +for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + test(engine + ": a plugin option's own words and its filtered list", async (t) => { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + for (const width of [1100, 420]) for (const lang of Object.keys(W)) for (const on of [true, false]) { + await t.test(`${width} ${lang} ${on ? "on" : "off"}`, async () => { + const w = W[lang]; + const ctx = await browser.newContext({ viewport: { width, height: 800 }, reducedMotion: "reduce" }); + const page = await ctx.newPage(); + page.setDefaultTimeout(5000); + page.setDefaultNavigationTimeout(60000); + const errors = []; + page.on("pageerror", (e) => errors.push(e.message)); + await page.route("**/*", serve(lang, on)); + await page.goto("http://magpie.test/?view=providers"); + await page.locator(".row.provider", { hasText: "WorkBuddy" }).click(); + const ed = page.locator("#modal .editor"); + const box = ed.locator(".plugin-options"); + await box.waitFor(); + await page.waitForTimeout(300); // the editor drawn again as what it asked for comes in + const row = (k) => box.locator(`.plugin-option[data-key="${k}"]`); + assert.equal(await row("free_only").locator(".n").textContent(), w.label); + assert.equal(await row("free_only").locator(".hint").textContent(), w.about); + assert.equal(await row("beta").locator(".n").textContent(), w.beta); + + // the Models field: its label, then the chips, the note under them + const models = ed.locator("label", { hasText: new RegExp("^" + w.models + "$") }).first(); + await models.waitFor(); + const field = models.locator("xpath=following-sibling::div[1]"); + const notes = await field.locator(":scope > .hint").allTextContents(); + if (on) { + assert.deepEqual(notes, [w.note]); + const where = await field.evaluate((f) => { + const hint = f.querySelector(":scope > .hint"), chips = f.firstElementChild, r = f.closest(".editor").getBoundingClientRect(), h = hint.getBoundingClientRect(); + return { below: h.top >= chips.getBoundingClientRect().bottom - 1, spill: h.right - r.right, page: document.documentElement.scrollWidth - document.documentElement.clientWidth }; + }); + assert.ok(where.below, "the note is under the chips"); + assert.ok(where.spill <= 0, "the note runs past the editor by " + where.spill); + assert.ok(where.page <= 0, "the page scrolls sideways by " + where.page); + if (process.env.ARTIFACT_DIR) await field.screenshot({ path: path.join(process.env.ARTIFACT_DIR, `plugin-option-words-${engine}-${width}-${lang}.png`) }); + } else { + assert.deepEqual(notes, [], "nothing said while the switch is off"); + } + + // its confirm in the reader's language too + await row("beta").locator(".opt", { hasText: w.on }).click(); + const dialog = page.locator("dialog.action-confirm"); + await dialog.waitFor(); + assert.equal(await dialog.locator("p").textContent(), w.ask); + assert.ok((await dialog.locator("h2").textContent()).includes(w.beta)); + assert.deepEqual(errors, []); + await ctx.close(); + }); + } + }); +} diff --git a/internal/plugin/host.js b/internal/plugin/host.js index 28b0aa872..d8eb49ae7 100644 --- a/internal/plugin/host.js +++ b/internal/plugin/host.js @@ -1894,14 +1894,34 @@ const shown = (v, n) => (typeof v === "string" ? v.trim().slice(0, n) : "") // optionsOf are the switches a plugin declares for its provider, magpie's // own field (#2038, Vocllum): auth.options, each {key, label, description?, -// default?, confirm?}. magpie shows each as an Off/On switch in the -// provider's editor and keeps what the user sets; the plugin reads it with -// input.magpie.option(provider, key). A switch is kept and handed over, -// and the models listed again (one may go by it); nothing else is run. Keys are [a-z0-9_-], 1–40 long, -// the first of a key kept; at most MAX_OPTIONS; one without a key or a -// label is left out. +// default?, confirm?, labels?, descriptions?, confirms?, filtersModels?}. +// magpie shows each as an Off/On switch in the provider's editor and keeps +// what the user sets; the plugin reads it with input.magpie.option(provider, +// key). A switch is kept and handed over, and the models listed again (one +// may go by it); nothing else is run. Keys are [a-z0-9_-], 1–40 long, the +// first of a key kept; at most MAX_OPTIONS; one without a key or a label is +// left out. labels, descriptions and confirms are the same words in the +// window's other languages ({"zh": "…", "zh-TW": "…", "ja": "…", "de": +// "…"}), as a page's titles are (plugins#590): label stays a string beside +// them, so an older magpie still reads the option. filtersModels says the +// plugin's model list leaves models out while the switch is on, which the +// editor says by the models. const MAX_OPTIONS = 16 const OPTION_KEY = /^[a-z0-9_-]{1,40}$/ +// inLanguages are words by language, each capped at n, at most 16, without +// the empty ones; undefined for none or for what isn't an object +function inLanguages(m, n) { + if (!m || typeof m !== "object" || Array.isArray(m)) return undefined + let out + for (const [k, v] of Object.entries(m)) { + const lang = k.trim(), said = shown(v, n) + if (!lang || lang.length > 16 || !said) continue + out ??= {} + if (Object.keys(out).length >= 16) break + out[lang] = said + } + return out +} function optionsOf(auth) { const out = [] if (!Array.isArray(auth?.options)) return out @@ -1917,6 +1937,10 @@ function optionsOf(auth) { description: shown(o.description, 300), default: o.default === true, confirm: shown(o.confirm, 300), + labels: inLanguages(o.labels, 60), + descriptions: inLanguages(o.descriptions, 300), + confirms: inLanguages(o.confirms, 300), + filtersModels: o.filtersModels === true, }) } return out diff --git a/internal/plugin/plugin_options_test.go b/internal/plugin/plugin_options_test.go index 18f2990d7..c6cd53e95 100644 --- a/internal/plugin/plugin_options_test.go +++ b/internal/plugin/plugin_options_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "path/filepath" + "reflect" "strings" "testing" "time" @@ -44,14 +45,18 @@ func TestPluginOptions(t *testing.T) { if len(opts) != 16 { t.Fatalf("optco has %d options, want 16: %+v", len(opts), opts) } - if opts[0] != (Option{Key: "auto-claim", Label: "Claim rewards", Description: "Claims the daily reward when usage is read.", Default: true}) { + if want := (Option{Key: "auto-claim", Label: "Claim rewards", Description: "Claims the daily reward when usage is read.", Default: true, + Descriptions: map[string]string{"zh": "读取用量时领取每日奖励。"}, FiltersModels: true}); !reflect.DeepEqual(opts[0], want) { t.Errorf("first = %+v", opts[0]) } - if opts[1] != (Option{Key: "beta", Label: "Beta models", Confirm: "Beta models may be withdrawn."}) { + // plugins#590: the words in other languages, without what isn't one + if want := (Option{Key: "beta", Label: "Beta models", Confirm: "Beta models may be withdrawn.", + Labels: map[string]string{"zh": "测试版模型", "de": "Beta-Modelle"}, Confirms: map[string]string{"zh": "测试版模型可能会下线。"}}); !reflect.DeepEqual(opts[1], want) { t.Errorf("second = %+v", opts[1]) } - if o := opts[2]; o.Key != "long" || len([]rune(o.Label)) > 60 || len([]rune(o.Description)) > 300 || o.Default { - t.Errorf("long = %q (%d), %d, default %v", o.Key, len([]rune(o.Label)), len([]rune(o.Description)), o.Default) + if o := opts[2]; o.Key != "long" || len([]rune(o.Label)) > 60 || len([]rune(o.Description)) > 300 || o.Default || o.FiltersModels || o.Labels != nil || + len([]rune(o.Descriptions["zh"])) != 300 || len(o.Confirms) != 16 { + t.Errorf("long = %q (%d), %d, default %v, filters %v, labels %v, %d, %d confirms", o.Key, len([]rune(o.Label)), len([]rune(o.Description)), o.Default, o.FiltersModels, o.Labels, len([]rune(o.Descriptions["zh"])), len(o.Confirms)) } if opts[15].Key != "o12" { t.Errorf("last = %q, want o12", opts[15].Key) diff --git a/internal/plugin/providers.go b/internal/plugin/providers.go index fbdd7c233..9769fb4c4 100644 --- a/internal/plugin/providers.go +++ b/internal/plugin/providers.go @@ -190,6 +190,16 @@ type Option struct { // Confirm is asked before the switch is turned on, when the plugin // says turning it on does something the user should agree to Confirm string `json:"confirm,omitempty"` + // Labels, Descriptions and Confirms are the same words in the window's + // other languages, by its language ("zh", "zh-TW", "ja", "de"), as a + // page's Titles are (plugins#590); the plain ones are the fallback + Labels map[string]string `json:"labels,omitempty"` + Descriptions map[string]string `json:"descriptions,omitempty"` + Confirms map[string]string `json:"confirms,omitempty"` + // FiltersModels says the plugin's model list leaves models out while + // the switch is on (WorkBuddy's "Free models only"): the editor says + // so by the models + FiltersModels bool `json:"filtersModels,omitempty"` } // OptionOn is option o of a provider as it stands with the user's values diff --git a/internal/plugin/testdata/options/index.js b/internal/plugin/testdata/options/index.js index 8f6000506..eb6058390 100644 --- a/internal/plugin/testdata/options/index.js +++ b/internal/plugin/testdata/options/index.js @@ -19,12 +19,14 @@ export const Optco = async (input) => ({ auth: { provider: "optco", options: [ - { key: "auto-claim", label: " Claim rewards ", description: "Claims the daily reward when usage is read.", default: true }, - { key: "beta", label: "Beta models", confirm: "Beta models may be withdrawn." }, + { key: "auto-claim", label: " Claim rewards ", description: "Claims the daily reward when usage is read.", default: true, descriptions: { zh: " 读取用量时领取每日奖励。 " }, filtersModels: true }, + // the words in other languages (plugins#590): what isn't a string, + // an empty one and a language name over 16 are left out + { key: "beta", label: "Beta models", confirm: "Beta models may be withdrawn.", labels: { zh: " 测试版模型 ", "zh-TW": "", ja: 5, "a-language-name-too-long": "x", de: "Beta-Modelle" }, confirms: { zh: "测试版模型可能会下线。" } }, { key: "beta", label: "the same key again" }, // dropped { key: "Bad Key", label: "not a key" }, // dropped { key: "nolabel" }, // dropped - { key: "long", label: "L".repeat(200), description: "D".repeat(1000), default: "yes" }, // default is no boolean: off + { key: "long", label: "L".repeat(200), description: "D".repeat(1000), default: "yes", filtersModels: "yes", labels: "not an object", descriptions: { zh: "D".repeat(1000) }, confirms: Object.fromEntries(Array.from({ length: 20 }, (_, i) => ["l" + i, "c"])) }, // default and filtersModels are no boolean: off; the words capped, at most 16 languages ...Array.from({ length: 20 }, (_, i) => ({ key: "o" + i, label: "Option " + i })), ], methods: [ diff --git a/internal/provider/migrate_workbuddy.go b/internal/provider/migrate_workbuddy.go index b8e7846cc..62a317fb4 100644 --- a/internal/provider/migrate_workbuddy.go +++ b/internal/provider/migrate_workbuddy.go @@ -16,7 +16,7 @@ func init() { for _, w := range []*wbSite{wbCN, wbAI} { movers[w.id] = &mover{ pkg: "@magpie-community/opencode-workbuddy-auth", - min: "0.2.9", // 0.2.9: a model declared before the account's list is read (an API key, or a /v3/config that failed) takes images, as both builds' config says of every model, so WorkBuddy AI's kimi-k3 no longer reads image: false (a real chat to it with a blue|yellow PNG answered "Blue yellow"); WorkBuddy AI's GLM models stay text-only (kongbai01203, plugins #572); 0.2.8: deepseek-v4.1-flash takes the config's 1000000 tokens on the China build (copilot.tencent.com) again, as China accounts took 110k-992k-token prompts on it; 0.2.7's 100000 cap made every client compact at 100k, and a prompt WorkBuddy finds too long is its own 400 "prompt is too long", which magpie takes as an overflow (plugins #561); 0.2.7: deepseek-v4.1-flash and -sg list a "none" level, which WorkBuddy takes (0 reasoning tokens) though its config says onlyReasoning (plugins #563); 0.2.6: an empty "tool_calls": [], which copilot.tencent.com puts on every delta, is no call, so the filter's refusal is held and taken out, not let through at the first delta (itspig, plugins #540); 0.2.5: the filter's line is taken out with the newline WorkBuddy sends on each side of it ("\nSorry, I can't respond to this question.\n"), which 0.2.4 let through as an answer (itspig, plugins #540); 0.2.4: a streamed chat that WorkBuddy's safety filter ends content_filter after its canned "Sorry, I can't respond to this question." has that line taken out, so the reply says nothing before the filter's stop and magpie hands it to the group's next member, not to the agent as an answer (itspig, plugins #540); 0.2.3: an opening WorkBuddy refuses (11128) that FLAGGED does not know is sent once more with one more comma before the system prompt is moved, only in system and assistant messages, and a system prompt whose comma passed goes with it from the next chat on; a refusal that stands names REFUSED.md, where its fix is written (MYCF711, plugins #513); 0.2.2: DeepSeek Harness's opener goes as "You are an AI agent, powered by DeepSeek Harness.", which passes WorkBuddy's whole-line check (11128) and keeps the harness's name, where 0.1.27's neutral line took it out (MYCF711, plugins #511); 0.2.1: a sign-in to an enterprise account (a team, or 「WorkBuddy 教育公益版」, picked on WorkBuddy's sign-in page) is named "nickname · enterprise", so it no longer replaces the same person's personal account, which shares its uid and nickname (jwaitq on Discord, plugins b9cbb9d); 0.2.0: a WorkBuddy (China) account claims its daily check-in credits through the billing meter, as WorkBuddy's client does, and an API-key account reports itself ineligible for check-in instead of failing and being tried again every 30 minutes (plugins #177); 0.1.48: WorkBuddy AI's card shows the free model's daily token window, read from magpie's usage ledger (plugins #299); 0.1.47: a conversation's X-Conversation-ID and X-Conversation-Request-ID are one account's own (they hash the account too), so a session spread over a group of accounts no longer sends the same ids under every X-User-Id, which WorkBuddy's client, signed in as one account, never does (plugins 1e7122e, leaves5760 on Discord: a group's accounts restricted, not verified as the cause); 0.1.46: WorkBuddy AI's chats carry its current desktop client's headers, WorkBuddy/5.9.3 workbuddy-ai/5.9.3 CLI/2.165.0 with X-IDE-Version 5.9.3 and X-Agent-Runtime local-agent, not 5.8.4's (plugins b08a6c1); 0.1.45: only a chat completion goes gzipped, so magpie's drawings (the Magpie Image MCP, /v1/images/*) reach WorkBuddy's images API as plain JSON again, not 400 11101 "invalid character '\x1f'" (iwinux on Discord, broken since 0.1.43); 0.1.44: a 45 MiB chat's conversation and turn ids are hashed from its pieces, not from fresh copies of the whole message, and "Free models only" and a model that wants a reply after tools read the one parse too, so the repro's peak goes 717-760 to 583 MiB with every byte sent unchanged (plugins #461); 0.1.43: a chat that names no effort goes at the model's own default from WorkBuddy's config (DeepSeek-V4.1-Flash: high), as WorkBuddy's client sends it, so OpenCode's default variant thinks (troilus1011 on X); a chat goes gzipped, as WorkBuddy's client sends it, so the upload is the size the official client's is (runmiNeverstop on X, 2.89 GB up); 0.1.42: a chat is parsed once on its way, not once a step, and goes as it came when nothing changed it, so a 45 MiB chat no longer holds seven parsed copies in the plugin host (plugins #461, #4004); 0.1.41: a package with no cycle total (a prepaid wallet) is a balance window, "Prepaid credits", beside the share of packages that have one (plugins #450, #3950); 0.1.40: a chat carries the headers of each build's current desktop app: its CLI's User-Agent (WorkBuddy/ / CLI/, was WorkBuddy/5.5.6), X-IDE-Version, X-Agent-Type on both builds, X-Agent-Runtime on the China build, and the OpenAI SDK's X-Stainless headers, read from WorkBuddy 5.9.3 and WorkBuddy AI 5.8.4 (accounts restricted, a header-fingerprint check reported on X); 0.1.39: an earlier turn's reasoning_content (or reasoning_details text) goes as `reasoning`, as WorkBuddy's own client sends it, since WorkBuddy drops reasoning_content and Grok Build's history lost its thinking (uk.jent on Discord); 0.1.38: a "Free models only" switch lists only the free models and refuses any other before it is sent, so no credits are spent (plugins #430); 0.1.37: sign in with a WorkBuddy API key from the profile/keys page, sent as WorkBuddy's own client sends it (plugins #407); 0.1.35: used credits say when the plan's cycle starts again, as WorkBuddy's client does, so the card no longer reads "Not used yet" beside them (windy on Discord); 0.1.34: a free account's plan reads "Free plan" (plugins #337); 0.1.33: an untyped object oneOf goes to Kimi as type "object" (plugins #378); 0.1.32: plugins #346; 0.1.31: a 401 is renewed once, whatever the token's time, and sent once more; when the retry is refused too, the 401 says to sign in again (Providers → WorkBuddy → this account), and the account is marked expired only on WorkBuddy's word that the sign-in is gone (refresh token refused, or invalid_token with nothing to renew with) (wenchen855443 on X); 0.1.30: a refused line the model quotes back into an assistant message is reworded there too, so a long DeepSeek Harness chat isn't refused for good (plugins #291); 0.1.29: a system prompt WorkBuddy refuses as an unapproved channel (11128) is sent once more as the first user message's instructions, with WorkBuddy's default system prompt, since WorkBuddy checks only system and assistant messages; the refusal still rests no account (Wing on Discord); 0.1.28: a refusal of words not reworded yet ends in a hint that names no one client (plugins #279); 0.1.27: DeepSeek Harness's opening identity line is reworded to a neutral one, which WorkBuddy otherwise refuses as an unapproved channel (11128) (plugins #279, #280); 0.1.26: a model that says only supportsReasoning and a default effort lists low, high, max and that default, not "doesn't reason" (plugins #255); 0.1.25: WorkBuddy AI's fast, balanced and primary models keep the credit rate its config gives as "x0.34 credits", not unknown (plugins #216); 0.1.24: a refused sign-in on a chat over 2 MiB says the 401 and to sign in again: WorkBuddy's front door resets such a request instead of answering, so it read as 502 ECONNRESET (wyp on Discord); 0.1.23: credits used up leave the free models counted out of the credits window, so an account is not ranked spent for them (plugins #138); 0.1.22: an MCP server's tool schemas reach Kimi and DeepSeek: an enum with no type, or of several types, is typed, and true or false where a schema goes is {} or {"not": {}}, so they aren't 400 11133 "Invalid request parameters" (plugins #122); 0.1.21: a model free only at night (Hy4 preview) is never said free, and a whole-day discount shows the price before it, from WorkBuddy's modelPromotions (plugins #121); 0.1.20: tool results followed by the user's message reach WorkBuddy AI's gemini-3.8-flash, not 400 "the conversation must end with a user message" (plugins #113); 0.1.19: an enterprise account's card shows its credits, from the enterprise meter WorkBuddy's usage page reads (#1904); 0.1.18: WorkBuddy 5.6+ keeps its desktop sign-in encrypted, and the plugin says so and points to the browser sign-in instead of a 502 (plugins #18); 0.1.17: a restricted account's 403 11140 ends in provider.WBRestrictedHint, so it rests 2h as restricted (#1849); 0.1.16: WorkBuddy AI's GLM models are text-only, so magpie's image-describing model reads their images (Yirasumi on Discord); 0.1.15: a system prompt sent as a developer message passes the channel check, an object tool_choice is sent as WorkBuddy takes it, and max_completion_tokens goes as max_tokens so the cap holds (plugins #96); 0.1.14: the Credits window says when the soonest credits left run out, for Smart routing to spend them first (cdredfox on X); an enterprise account names its enterprise, so it lists and uses the enterprise's models, not the personal plan's (plugins #75); a chat's tools get shapes WorkBuddy AI's models take, so ZCode's and DeepSeek Harness's chats on deepseek-v4.1-flash aren't 400 "Invalid request parameters" (wyh on Discord); one user send is one request in the usage list: every step carries one X-Conversation-Request-ID, and both builds name the client (使用端) (plugins #48); credits used up (code 14018) say so, with the nested error message (plugins #25); Codex's and Claude Code's chats pass WorkBuddy's channel check (#182); a failure's status and its sign-in mark as the built-in's; each model's credit rate; the sign-in renewed ahead of time through auth.refresh; the credits' count beside their share (#659) + min: "0.2.10", // 0.2.10: "Free models only" gives its label and description in Chinese, Traditional Chinese, Japanese and German, and says filtersModels, so the editor says under the models that the list is filtered while it is on (anewuser6937 on Discord, plugins #590); 0.2.9: a model declared before the account's list is read (an API key, or a /v3/config that failed) takes images, as both builds' config says of every model, so WorkBuddy AI's kimi-k3 no longer reads image: false (a real chat to it with a blue|yellow PNG answered "Blue yellow"); WorkBuddy AI's GLM models stay text-only (kongbai01203, plugins #572); 0.2.8: deepseek-v4.1-flash takes the config's 1000000 tokens on the China build (copilot.tencent.com) again, as China accounts took 110k-992k-token prompts on it; 0.2.7's 100000 cap made every client compact at 100k, and a prompt WorkBuddy finds too long is its own 400 "prompt is too long", which magpie takes as an overflow (plugins #561); 0.2.7: deepseek-v4.1-flash and -sg list a "none" level, which WorkBuddy takes (0 reasoning tokens) though its config says onlyReasoning (plugins #563); 0.2.6: an empty "tool_calls": [], which copilot.tencent.com puts on every delta, is no call, so the filter's refusal is held and taken out, not let through at the first delta (itspig, plugins #540); 0.2.5: the filter's line is taken out with the newline WorkBuddy sends on each side of it ("\nSorry, I can't respond to this question.\n"), which 0.2.4 let through as an answer (itspig, plugins #540); 0.2.4: a streamed chat that WorkBuddy's safety filter ends content_filter after its canned "Sorry, I can't respond to this question." has that line taken out, so the reply says nothing before the filter's stop and magpie hands it to the group's next member, not to the agent as an answer (itspig, plugins #540); 0.2.3: an opening WorkBuddy refuses (11128) that FLAGGED does not know is sent once more with one more comma before the system prompt is moved, only in system and assistant messages, and a system prompt whose comma passed goes with it from the next chat on; a refusal that stands names REFUSED.md, where its fix is written (MYCF711, plugins #513); 0.2.2: DeepSeek Harness's opener goes as "You are an AI agent, powered by DeepSeek Harness.", which passes WorkBuddy's whole-line check (11128) and keeps the harness's name, where 0.1.27's neutral line took it out (MYCF711, plugins #511); 0.2.1: a sign-in to an enterprise account (a team, or 「WorkBuddy 教育公益版」, picked on WorkBuddy's sign-in page) is named "nickname · enterprise", so it no longer replaces the same person's personal account, which shares its uid and nickname (jwaitq on Discord, plugins b9cbb9d); 0.2.0: a WorkBuddy (China) account claims its daily check-in credits through the billing meter, as WorkBuddy's client does, and an API-key account reports itself ineligible for check-in instead of failing and being tried again every 30 minutes (plugins #177); 0.1.48: WorkBuddy AI's card shows the free model's daily token window, read from magpie's usage ledger (plugins #299); 0.1.47: a conversation's X-Conversation-ID and X-Conversation-Request-ID are one account's own (they hash the account too), so a session spread over a group of accounts no longer sends the same ids under every X-User-Id, which WorkBuddy's client, signed in as one account, never does (plugins 1e7122e, leaves5760 on Discord: a group's accounts restricted, not verified as the cause); 0.1.46: WorkBuddy AI's chats carry its current desktop client's headers, WorkBuddy/5.9.3 workbuddy-ai/5.9.3 CLI/2.165.0 with X-IDE-Version 5.9.3 and X-Agent-Runtime local-agent, not 5.8.4's (plugins b08a6c1); 0.1.45: only a chat completion goes gzipped, so magpie's drawings (the Magpie Image MCP, /v1/images/*) reach WorkBuddy's images API as plain JSON again, not 400 11101 "invalid character '\x1f'" (iwinux on Discord, broken since 0.1.43); 0.1.44: a 45 MiB chat's conversation and turn ids are hashed from its pieces, not from fresh copies of the whole message, and "Free models only" and a model that wants a reply after tools read the one parse too, so the repro's peak goes 717-760 to 583 MiB with every byte sent unchanged (plugins #461); 0.1.43: a chat that names no effort goes at the model's own default from WorkBuddy's config (DeepSeek-V4.1-Flash: high), as WorkBuddy's client sends it, so OpenCode's default variant thinks (troilus1011 on X); a chat goes gzipped, as WorkBuddy's client sends it, so the upload is the size the official client's is (runmiNeverstop on X, 2.89 GB up); 0.1.42: a chat is parsed once on its way, not once a step, and goes as it came when nothing changed it, so a 45 MiB chat no longer holds seven parsed copies in the plugin host (plugins #461, #4004); 0.1.41: a package with no cycle total (a prepaid wallet) is a balance window, "Prepaid credits", beside the share of packages that have one (plugins #450, #3950); 0.1.40: a chat carries the headers of each build's current desktop app: its CLI's User-Agent (WorkBuddy/ / CLI/, was WorkBuddy/5.5.6), X-IDE-Version, X-Agent-Type on both builds, X-Agent-Runtime on the China build, and the OpenAI SDK's X-Stainless headers, read from WorkBuddy 5.9.3 and WorkBuddy AI 5.8.4 (accounts restricted, a header-fingerprint check reported on X); 0.1.39: an earlier turn's reasoning_content (or reasoning_details text) goes as `reasoning`, as WorkBuddy's own client sends it, since WorkBuddy drops reasoning_content and Grok Build's history lost its thinking (uk.jent on Discord); 0.1.38: a "Free models only" switch lists only the free models and refuses any other before it is sent, so no credits are spent (plugins #430); 0.1.37: sign in with a WorkBuddy API key from the profile/keys page, sent as WorkBuddy's own client sends it (plugins #407); 0.1.35: used credits say when the plan's cycle starts again, as WorkBuddy's client does, so the card no longer reads "Not used yet" beside them (windy on Discord); 0.1.34: a free account's plan reads "Free plan" (plugins #337); 0.1.33: an untyped object oneOf goes to Kimi as type "object" (plugins #378); 0.1.32: plugins #346; 0.1.31: a 401 is renewed once, whatever the token's time, and sent once more; when the retry is refused too, the 401 says to sign in again (Providers → WorkBuddy → this account), and the account is marked expired only on WorkBuddy's word that the sign-in is gone (refresh token refused, or invalid_token with nothing to renew with) (wenchen855443 on X); 0.1.30: a refused line the model quotes back into an assistant message is reworded there too, so a long DeepSeek Harness chat isn't refused for good (plugins #291); 0.1.29: a system prompt WorkBuddy refuses as an unapproved channel (11128) is sent once more as the first user message's instructions, with WorkBuddy's default system prompt, since WorkBuddy checks only system and assistant messages; the refusal still rests no account (Wing on Discord); 0.1.28: a refusal of words not reworded yet ends in a hint that names no one client (plugins #279); 0.1.27: DeepSeek Harness's opening identity line is reworded to a neutral one, which WorkBuddy otherwise refuses as an unapproved channel (11128) (plugins #279, #280); 0.1.26: a model that says only supportsReasoning and a default effort lists low, high, max and that default, not "doesn't reason" (plugins #255); 0.1.25: WorkBuddy AI's fast, balanced and primary models keep the credit rate its config gives as "x0.34 credits", not unknown (plugins #216); 0.1.24: a refused sign-in on a chat over 2 MiB says the 401 and to sign in again: WorkBuddy's front door resets such a request instead of answering, so it read as 502 ECONNRESET (wyp on Discord); 0.1.23: credits used up leave the free models counted out of the credits window, so an account is not ranked spent for them (plugins #138); 0.1.22: an MCP server's tool schemas reach Kimi and DeepSeek: an enum with no type, or of several types, is typed, and true or false where a schema goes is {} or {"not": {}}, so they aren't 400 11133 "Invalid request parameters" (plugins #122); 0.1.21: a model free only at night (Hy4 preview) is never said free, and a whole-day discount shows the price before it, from WorkBuddy's modelPromotions (plugins #121); 0.1.20: tool results followed by the user's message reach WorkBuddy AI's gemini-3.8-flash, not 400 "the conversation must end with a user message" (plugins #113); 0.1.19: an enterprise account's card shows its credits, from the enterprise meter WorkBuddy's usage page reads (#1904); 0.1.18: WorkBuddy 5.6+ keeps its desktop sign-in encrypted, and the plugin says so and points to the browser sign-in instead of a 502 (plugins #18); 0.1.17: a restricted account's 403 11140 ends in provider.WBRestrictedHint, so it rests 2h as restricted (#1849); 0.1.16: WorkBuddy AI's GLM models are text-only, so magpie's image-describing model reads their images (Yirasumi on Discord); 0.1.15: a system prompt sent as a developer message passes the channel check, an object tool_choice is sent as WorkBuddy takes it, and max_completion_tokens goes as max_tokens so the cap holds (plugins #96); 0.1.14: the Credits window says when the soonest credits left run out, for Smart routing to spend them first (cdredfox on X); an enterprise account names its enterprise, so it lists and uses the enterprise's models, not the personal plan's (plugins #75); a chat's tools get shapes WorkBuddy AI's models take, so ZCode's and DeepSeek Harness's chats on deepseek-v4.1-flash aren't 400 "Invalid request parameters" (wyh on Discord); one user send is one request in the usage list: every step carries one X-Conversation-Request-ID, and both builds name the client (使用端) (plugins #48); credits used up (code 14018) say so, with the nested error message (plugins #25); Codex's and Claude Code's chats pass WorkBuddy's channel check (#182); a failure's status and its sign-in mark as the built-in's; each model's credit rate; the sign-in renewed ahead of time through auth.refresh; the credits' count beside their share (#659) agents: []string{w.id}, out: func() ([]Moving, error) { var out []Moving