From 4ddc150c664c574eb15a287bfd4068df3ea36c02 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 11 Nov 2026 12:46:21 +0800 Subject: [PATCH] gui: a hover hint beside the account switch says how it works and why it is the agent's own use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The owner (11-11): "在这个切换开关旁边有一个 hover 的提示,提示这个原理是啥, 以及它为什么不会让你的账号被封禁". Beside Switch {agent}'s account automatically, an ⓘ mark; resting on the row (or a key reaching the switch) shows settingshints.js's card with three lines: - how: the next account's sign-in is written where the agent keeps its own, as /login or codex login does; what is left is read by Claude Code's own /usage, or where Codex's /status reads it; sessions already open keep their account until restarted; - why it is the agent's own use: Claude Code still sends every request itself, straight to Anthropic, unchanged, and magpie sends none (an account's own proxy kept); for Codex, only which of your own accounts it is signed in to changes; - the limit: the same as switching by hand; use only your own accounts, sharing one is against the vendor's terms. It promises nothing about bans: that is the vendor's call. Only where the switch moves the sign-in. Under the gateway it moves Claude Code's requests instead, and the "straight to Anthropic" line would be false, so SignInMovesOf now says `routed` on a kept Claude whose requests go through the gateway, and the hint shows for `moves` and for `kept` without it. The lines and mark are in autoswitchtip.js, imported when the switch is drawn; app.js gets the one import line, paid for by cutting this branch's own two comments: the core is 1,533,771, under 1,533,802, no raise. Strings in zh, zh-TW, ja and de. Run (xiaomi-gpu, Windows 11, win-run; mote refuses ssh): - node --test sign-in-moves, keep-login, pool-ends, old-webkit, i18n-keys, i18n-en-no-cjk, settings-hints, editor-hints: 148/152. The 4 reds are the same at the base 156861b3a: old-webkit's headerpresets.js (#6030) and Safari 15.0 :has() (#5919), and settings-hints webkit de at 420px, filed as #6073. - the new test (Chromium and WebKit, en and zh): the mark sits beside the switch on its line, the lines rest out of sight, hovering shows the card with the three lines beside the row, a press on the mark posts nothing; no mark for kept+routed or gateway. - Broken by hand, each red: the mark's preventDefault removed (a press turned the switch off); the routed check dropped (kept+routed showed it); Routed not set in SignInMovesOf (TestSignInMovesSaysWhatSwitchDoes). - go test -run "SignInMoves|ClaudeRoutedSignIn|KeepLogin|SwitchOnly" ./internal/provider ok; go vet ./internal/provider ok; TestCoreScriptBudget ok; gofmt -l clean. - A Chromium screenshot of the card in zh looked at. Not tried: the Codex variant's card in a browser (its strings pass i18n-keys); the real app; macOS and Linux. --- docs/subsystems/providers-accounts.md | 2 +- internal/gui/assets/app.css | 12 +++++ internal/gui/assets/app.js | 5 +- internal/gui/assets/autoswitchtip.js | 32 +++++++++++++ internal/gui/assets/i18n.js | 24 ++++++++++ internal/gui/core_budget_test.go | 2 +- internal/gui/tests/old-webkit.test.cjs | 3 +- internal/gui/tests/sign-in-moves.test.cjs | 57 ++++++++++++++++++++++- internal/provider/sign_in_moves.go | 9 +++- internal/provider/sign_in_moves_test.go | 6 +-- 10 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 internal/gui/assets/autoswitchtip.js diff --git a/docs/subsystems/providers-accounts.md b/docs/subsystems/providers-accounts.md index ecbf2045a..848932140 100644 --- a/docs/subsystems/providers-accounts.md +++ b/docs/subsystems/providers-accounts.md @@ -59,7 +59,7 @@ keys and accounts per request is in [Gateway routing and fallback](gateway-routi | Claude setup-token | A Claude account can be added from the long-lived token `claude setup-token` prints (sfss5362 on X), which Claude Code takes in `CLAUDE_CODE_OAUTH_TOKEN` (the window's *Use a setup-token instead…* and *Add an account by setup-token…*, `POST /api/signin/claude-token`). `AddClaudeSetupToken` keeps it in `logins.json` as `{"setupToken":…}`, named `Claude setup-token <6 hex of its hash>` (it tells no email), on beside the others; the same token again is the same account. Such a token has the inference scope only: Claude Code's `auth status` says `oauth_token` with no email or plan, and its `/usage` prints the API cost view, so `/usage` is never run for it and its allowance is unknown (`errClaudeSetupToken`, kept by `passing` as saying nothing about the account) until a reply's rate-limit event tells it. Its config directory (`claudeTokenDir`) holds no `.credentials.json`, which Claude Code could fall back to on a refused token. Claude Code itself is never signed in to it: `addLogin`, `switchLogin`, `putClaudeLogin`, `SetKeepLoginAs`, `NextLogin` and `signInToFirst` pass it over, and the window shows Remove and *magpie only* in place of Use and Make first. Not tried with a real token. | [`claude_setup_token.go`](../../internal/provider/claude_setup_token.go), [`claude_subscription.go`](../../internal/gateway/claude_subscription.go) (`inClaudeDir`), [`providers.go`](../../internal/gui/providers.go) | | ChatGPT access token only | A saved ChatGPT account can be kept with only the access token it has (EastonXvii on X: `savedLogin.AccessOnly`, `codex_access_only.go`), from the import (`ImportCodexAccessOnly`; the window's *Access token only* tick, `magpie accounts import codex --access-only`) or on a saved account (`SetLoginAccessOnly`; `POST /api/login/access-only` and `/renewed`, the row's ⋯, `magpie accounts access-only codex on|off`). magpie never refreshes it, which would rotate its refresh token and sign out where it came from: the import sends nothing to ChatGPT's token endpoint and needs an unexpired access token and an id_token (a refresh token is optional, and the import is told apart by its access token); `renewSaved` hands out the token while its own exp is ahead (`accessOnlyToken`), refuses a forced renewal without lapsing, and lapses the account once the token has run out or the backend turned it away (`accessOnlyLapse`, a `refreshRefused`); the keep-alive passes it over. Codex itself is never signed in to it (`switchable`, `switchSavedLogin`, `NextLogin`'s return, keep-as), and the account Codex renews itself, here or in another `CODEX_HOME`, can't be kept so (`errAccessOnlyHeld`). Its row says *magpie only*, and once lapsed *Access expired* with *Import again*. Signing in to it again in magpie, or importing it without the tick, replaces the entry with one magpie renews. | | Switch accounts only | magpie as a Claude Code (or Codex) account switcher alone, with nothing connected (the owner on X; growaiskills, Rennix7t). In the window, the Agents row of a Claude Code or Codex not connected says the account it is signed in to (`switchEntry` in app.js, from the providers list `prefetchProviders` reads at start, so `/api/state` reads no keychain for it), also when magpie has no models to connect (`switchable`, before the `empty` line). Its menu, headed *Switch accounts only*, lists the agent's saved accounts: a pick goes through `POST /api/login/switch` (`SwitchLogin`), or `provider/keeplogin` with `keepLoginAs` when the agent is kept signed in to an account of the user's choosing, as the account rows do; the button says *Switched* for five seconds and the status line says new sessions use the account, one already open keeps its own until started again. *Only switch {agent}'s sign-in* (`SwitchOnly` above, `provider/switchonly`) is a ticked item there (Codex: with more than one usable account, as under Providers), and the row then says *Not connected · switching accounts only*. *Manage accounts…*, and a pick whose sign-in lapsed, open Providers › the agent. A Codex failing over (#1385) has it in place of the old *ChatGPT accounts* button. In the tray panel (whose Quick panel shortcut opens it from any app, shuizhuyu on X) it is the *account* line of the agent's opened row (`.ag-who`), drawn from the list kept from the last read (`panelAccounts`, `GET /api/providers?last=1`, no keychain read; a fresh read only when none is kept), so opening the panel reads no sign-in. The menu waits for one fresh `/api/providers` read and opens on what it says; *Manage accounts…* and a lapsed pick open the window's Providers (`window/main?view=providers`). The provider and login actions keep their answer as the last list (`keepProviders`), so a switch made anywhere is in the panel's next line at once (`TestKeptProvidersFollowActions`, `panel-switch-accounts.test.cjs`). Not on a WSL twin's row, not on a connected agent's. | [`app.js`](../../internal/gui/assets/app.js), [`logins.go`](../../internal/provider/logins.go) | -| Used-up switch | When the account Codex or Claude Code is signed in to has used its allowance, the agent is signed in to the next account that is on and has room (#208). Claude Code whose requests go to magpie's gateway (`ClaudeThroughMagpie`: its settings' `ANTHROPIC_BASE_URL` is the gateway, either sign-in) is not moved: the gateway already sends its requests to an account with room, and moving the sign-in only took away what the user signed it in for, such as claude.ai connectors (oreoft on Discord set it back more than ten times; `TestClaudeRoutedThroughMagpieKeepsItsSignIn`). Not routed, or with *Only switch Claude Code's sign-in*, it still moves. Codex's sign-in goes back to the account it moved off once that has room again, as the gateway's Smart and In order give it requests again; routed Until used up it doesn't, as the gateway keeps the requests on the next (`routes.Drain`), so it stays with them till that one is used up too, as Claude Code's and a switch-only Codex's do unless routed In order (`returnsToFirst`; WalterAIBuilder on X: Codex signed back in to the first showed that one in use while the second's week was spent, `TestCodexDrainSignInStaysOnTheNext`). When every one is past its line too, it goes to the one with the most room left (`roomLeft`: the fullest stopping window's distance below the switch share, or the account's own cap when lower), when that has more than the account it is on by `roomMargin` (1 point), so two all but even accounts don't trade it each look; else it stays (StringKe in #4532, after cswap's `best`; `TestNextLoginTakesTheMostRoomWhenAllArePast`). A Claude account on overages (/usage's "You are currently using your overages…" line) is read with its windows and a spent *Extra usage* row of text (`claudeOveragesWindow`: Used 100, ending when the last used-up window renews, else at the next reading), so it is moved off as a used-up one; before, the line made the reading an error, and the switch, which stays on an account it can't read, left Claude Code billing overages (StringKe, #4532; `TestClaudeSwitchOffOverages`). The GUI says the row *In use* in the reader's language. Under the accounts of a Claude Code or Codex with more than one, the switch is a switch of its own, *Switch {agent}'s account automatically* (the `auto-switch` box in app.js; off is `KeepLogin`, posted to `provider/keeplogin`; before 11-11 a *Keep {agent} signed in to* tick that turned it off, which a user read as the switch gone). On, a line under it says what the switch does with that agent's sign-in (`SignInMovesOf`, `signInMoves` on its `/api/providers` row, `signInMovesLine`): left where the user put it while Claude Code's requests go through the gateway (`gateway`), else the share it moves at and whether it comes back to the first (`moves`), each decided as `NextLogin` decides it (`TestSignInMovesSaysWhatSwitchDoes`). Off, it names the account the agent stays on, with a pick of another (`keepLoginAs`). Switch-only always moves the sign-in, so the switch is held on there (sign-in-moves.test.cjs). Routing (`Allowances`) skips Text rows, so the gateway's own choice of account doesn't count it. A model's own week (`Current week (Sonnet only)`, `(Fable)`) counts for that model in routing, not for the switch, which moves the sign-in only on windows that count every model (`usedPast`); "Sonnet only" is read as the Sonnet week, `7 days · Sonnet` counting `sonnet`, the window the `seven_day_sonnet` header keeps (#4532, `TestClaudeUsageSonnetOnly`). `magpie accounts switch next` (`NextInOrder`) takes the other accounts the agent can be signed in to (`switchable`, not lapsed), on or off in magpie as the accounts list's *Use* does, so one the agent signed itself in to, which starts off, is in the rotation (StringKe, #4532; `TestNextTakesAccountsThatAreOff`), from the one after the account the agent is on, wrapping round: the first with room, else the one with the most room left, said to be past its line; with no reading of any, it refuses rather than guess (`TestNextInOrder`). For Codex, *Only switch Codex's sign-in* (`SwitchOnly`, `SetSwitchOnly`) keeps magpie's `openai_base_url` failover out of Codex's config, so the switch is all magpie does (#1907); an unreadable providers.json reads as switch-only, so the failover is not written on a guess. For Claude, the same setting keeps the accounts to Claude Code (`Provider.KeptToAgent`): `On()` is false, so the gateway, catalog and groups serve nothing on them, while switching and usage, gated by `leftAlone` on the raw `Off`, go on. No request of a saved Claude account passes magpie then, so one Claude Code wasn't signed in to since has no reading: once the account Claude Code is on is spent, `NextLogin` reads such a spare (`readSpare`, `spareRead` in `claudeWindows`) by Claude Code's own `/usage` in the account's directory, in order and only till one has room; a spare read once is not read again, and one whose read failed waits `claudeUsageWait` (cn_Vincentzyx on X, `TestClaudeSwitchOnlyReadsUnreadSpares`). Codex's spares are read through their saved tokens and had no such gap. Claude Code on its own login is out long before a five-minute look notices (#4443: 4% left to refused in two minutes): while Claude has an account to move to, `KeepOnAnAccountWithRoom` looks at its sign-in every `claudeLookEvery` (a minute) between its full looks when `claudeLookDue`, that is when the account Claude Code is on is near out (`claudeNearOut`, `codexNearShare`; its `/usage` is then due after `claudeNearOutWait` rather than `claudeUsageWait`), or when Claude Code wrote a `rate_limit` refusal ("You've hit your … limit") into one of its sessions since that account's last `/usage` (`scanClaudeLimits`, which reads only what was appended to each `projects/*/*.jsonl` since the last scan). The refusal names no account, so it only makes the `/usage` read due (and the reading stale, `StaleAllowance`); the read decides (`TestClaudeNearOutIsReadEveryMinute`, `TestClaudeRefusalInSessionReadsAtOnce`, `TestKeepOnAnAccountWithRoomLooksAtClaudeNearOut`). | [`codex_switch.go`](../../internal/provider/codex_switch.go) | +| Used-up switch | When the account Codex or Claude Code is signed in to has used its allowance, the agent is signed in to the next account that is on and has room (#208). Claude Code whose requests go to magpie's gateway (`ClaudeThroughMagpie`: its settings' `ANTHROPIC_BASE_URL` is the gateway, either sign-in) is not moved: the gateway already sends its requests to an account with room, and moving the sign-in only took away what the user signed it in for, such as claude.ai connectors (oreoft on Discord set it back more than ten times; `TestClaudeRoutedThroughMagpieKeepsItsSignIn`). Not routed, or with *Only switch Claude Code's sign-in*, it still moves. Codex's sign-in goes back to the account it moved off once that has room again, as the gateway's Smart and In order give it requests again; routed Until used up it doesn't, as the gateway keeps the requests on the next (`routes.Drain`), so it stays with them till that one is used up too, as Claude Code's and a switch-only Codex's do unless routed In order (`returnsToFirst`; WalterAIBuilder on X: Codex signed back in to the first showed that one in use while the second's week was spent, `TestCodexDrainSignInStaysOnTheNext`). When every one is past its line too, it goes to the one with the most room left (`roomLeft`: the fullest stopping window's distance below the switch share, or the account's own cap when lower), when that has more than the account it is on by `roomMargin` (1 point), so two all but even accounts don't trade it each look; else it stays (StringKe in #4532, after cswap's `best`; `TestNextLoginTakesTheMostRoomWhenAllArePast`). A Claude account on overages (/usage's "You are currently using your overages…" line) is read with its windows and a spent *Extra usage* row of text (`claudeOveragesWindow`: Used 100, ending when the last used-up window renews, else at the next reading), so it is moved off as a used-up one; before, the line made the reading an error, and the switch, which stays on an account it can't read, left Claude Code billing overages (StringKe, #4532; `TestClaudeSwitchOffOverages`). The GUI says the row *In use* in the reader's language. Under the accounts of a Claude Code or Codex with more than one, the switch is a switch of its own, *Switch {agent}'s account automatically* (the `auto-switch` box in app.js; off is `KeepLogin`, posted to `provider/keeplogin`; before 11-11 a *Keep {agent} signed in to* tick that turned it off, which a user read as the switch gone). On, a line under it says what the switch does with that agent's sign-in (`SignInMovesOf`, `signInMoves` on its `/api/providers` row, `signInMovesLine`): left where the user put it while Claude Code's requests go through the gateway (`gateway`), else the share it moves at and whether it comes back to the first (`moves`), each decided as `NextLogin` decides it (`TestSignInMovesSaysWhatSwitchDoes`). Off, it names the account the agent stays on, with a pick of another (`keepLoginAs`). Switch-only always moves the sign-in, so the switch is held on there (sign-in-moves.test.cjs). Beside the switch, an ⓘ mark whose hover card (settingshints.js, the box a `.hint-row` with its `.hint` lines out of sight) says how the switch works and why it is the agent's own use of the account: the sign-in written where the agent keeps its own, as `/login` or `codex login` does; usage read by Claude Code's own `/usage` or where Codex's `/status` reads it; for Claude Code, every request still sent by Claude Code itself straight to Anthropic; and that sharing an account is against the vendor's terms. It promises nothing about bans (autoswitchtip.js, loaded when the switch is drawn). Only where the sign-in moves: `moves`, or `kept` without `routed`, which `SignInMovesOf` sets when Claude Code goes through the gateway, so turning the switch on would move its requests, not its sign-in. Routing (`Allowances`) skips Text rows, so the gateway's own choice of account doesn't count it. A model's own week (`Current week (Sonnet only)`, `(Fable)`) counts for that model in routing, not for the switch, which moves the sign-in only on windows that count every model (`usedPast`); "Sonnet only" is read as the Sonnet week, `7 days · Sonnet` counting `sonnet`, the window the `seven_day_sonnet` header keeps (#4532, `TestClaudeUsageSonnetOnly`). `magpie accounts switch next` (`NextInOrder`) takes the other accounts the agent can be signed in to (`switchable`, not lapsed), on or off in magpie as the accounts list's *Use* does, so one the agent signed itself in to, which starts off, is in the rotation (StringKe, #4532; `TestNextTakesAccountsThatAreOff`), from the one after the account the agent is on, wrapping round: the first with room, else the one with the most room left, said to be past its line; with no reading of any, it refuses rather than guess (`TestNextInOrder`). For Codex, *Only switch Codex's sign-in* (`SwitchOnly`, `SetSwitchOnly`) keeps magpie's `openai_base_url` failover out of Codex's config, so the switch is all magpie does (#1907); an unreadable providers.json reads as switch-only, so the failover is not written on a guess. For Claude, the same setting keeps the accounts to Claude Code (`Provider.KeptToAgent`): `On()` is false, so the gateway, catalog and groups serve nothing on them, while switching and usage, gated by `leftAlone` on the raw `Off`, go on. No request of a saved Claude account passes magpie then, so one Claude Code wasn't signed in to since has no reading: once the account Claude Code is on is spent, `NextLogin` reads such a spare (`readSpare`, `spareRead` in `claudeWindows`) by Claude Code's own `/usage` in the account's directory, in order and only till one has room; a spare read once is not read again, and one whose read failed waits `claudeUsageWait` (cn_Vincentzyx on X, `TestClaudeSwitchOnlyReadsUnreadSpares`). Codex's spares are read through their saved tokens and had no such gap. Claude Code on its own login is out long before a five-minute look notices (#4443: 4% left to refused in two minutes): while Claude has an account to move to, `KeepOnAnAccountWithRoom` looks at its sign-in every `claudeLookEvery` (a minute) between its full looks when `claudeLookDue`, that is when the account Claude Code is on is near out (`claudeNearOut`, `codexNearShare`; its `/usage` is then due after `claudeNearOutWait` rather than `claudeUsageWait`), or when Claude Code wrote a `rate_limit` refusal ("You've hit your … limit") into one of its sessions since that account's last `/usage` (`scanClaudeLimits`, which reads only what was appended to each `projects/*/*.jsonl` since the last scan). The refusal names no account, so it only makes the `/usage` read due (and the reading stale, `StaleAllowance`); the read decides (`TestClaudeNearOutIsReadEveryMinute`, `TestClaudeRefusalInSessionReadsAtOnce`, `TestKeepOnAnAccountWithRoomLooksAtClaudeNearOut`). | [`codex_switch.go`](../../internal/provider/codex_switch.go) | | Removing the signed-in account | `ForgetLogin` signs Codex or Claude Code in to another of its accounts first (`nextOnForget`: the first other that is on, else one whose sign-in holds, else any, never a setup-token account or one Codex keeps in another folder: `switchable`), then forgets this one; a switch that fails removes nothing (StringKe, #4532: Claude's was refused while Codex's switched). Codex's only account is signed out as `codex logout` does. Claude Code is never signed out: its last account it can be signed in to is refused with `SignedInError{Only}` (GUI code `signed_in_only`, and that account has no *Remove*). Claude Code's own credential is never deleted; the forgotten account's folder (`forgetClaudeDir`) is its own. `TestForgetLiveClaudeSwitchesFirst`, `TestForgetOnlyClaudeIsKept`, `codex-signout.test.cjs`. | | Claude Code's proxy | Claude Code on its own subscription asks Anthropic itself, through the proxy its env names. While any Claude account has a proxy of its own (`AccountProxies`), the `env` of Claude Code's `settings.json` names the proxy of the account it is signed in to (#1807): `HTTPS_PROXY` and `HTTP_PROXY` set to that account's own, else the subscription's `Proxy` (`ProxyOfLogin`), and `NO_PROXY` to loopback; none for `direct` or a SOCKS proxy, which Claude Code can't use. It is written on every switch (`switchLogin`, the user's or `SwitchWhenSpent`), when the Claude subscription is saved, and at the gateway's look every `loginSwitchEvery` (a sign-in made in Claude Code itself). Claude Code reads its env at start, so only sessions started after the switch take it. A proxy key the user set (in either case) is theirs: magpie then writes none and takes out none of theirs. What magpie wrote is kept in `claude-proxy-env.json`, and a key is magpie's only while it holds that value. A `settings.json` that doesn't parse is left as it is. Its log lines name the proxy through `netproxy.Redact`, without its user and password (#1886); the env gets it whole. | [`claude_proxy_env.go`](../../internal/provider/claude_proxy_env.go) | | Routing groups | User-made groups from the Routing view, and auto-found groups of the same model across providers (derived, never stored). The same model is the same id as vendors agree on it (`sameModel`): lowercase, without a vendor's prefix, a version's dot as `-`, a run of spaces, `_` and `-` as one `-` (a relay listing its display name as the id, `GPT-6 Sol`, joins `gpt-6-sol`, Chill on Discord: `TestSameModelDisplayNameAsID`), and without a YYYYMMDD or Ark YYMMDD snapshot date. Every word still counts (`gpt-6`, `gpt-6-mini` and `gpt-6-sol` stay apart), as do a `:variant`, a four-digit release and OpenAI's dashed date (`gpt-4o-2024-08-06`, a pinned snapshot whose group id agents may already name). A provider kept "Only through routing groups" joins them the same way. Members are `provider/model[:effort]`. A group can nest another (`group/`); `SaveGroup` refuses loops. A group given another id (`agent.RenameGroup`: the Routing groups page, `magpie groups rename`, the TUI) moves every agent field on `group/` to `group/`, spelled as the agent spells it, through the same `renameRefs` a provider's rename uses, then `SyncCatalog`; before, the agents stayed on a group magpie no longer had (lucis0116 on X, `TestRenameGroupMovesTheAgentsOnIt`). A provider's or group's display name needs no move: `store` and `SaveGroup` drop the catalog, and `SyncCatalog` writes the new labels into every agent's list. `Match` takes a glob or `re:` pattern (#766), both matched in any case (`compilePattern`; `(?-i)` inside a `re:` makes case matter). What a pattern matches follows the members named, in the catalog's order, until the user drags it elsewhere (usrname1833 on Discord): `Placed` keeps the whole order, named and matched alike, and the group is read and routed in it (`placedIn`); a model matched since goes last, one no longer matched drops out, a save that sends the named members only leaves the matched where they were (`placedOver`), and a provider's or group's rename carries it (`TestGroupPatternMembersKeepTheirPlace`, `group-member-drag.test.cjs`). A found group follows the providers magpie has: one removed leaves it, while one switched off stays in it (`foundGroups`, `heldOffEntries`; one without a key, such as a plugin not signed in, finds no group), skipped by `membersIn`, left off a found group's card, logos and TUI line with a count of those switched off (XYenon on Discord: `routing-provider-off.test.cjs`, `TestFoundGroupLineLeavesASwitchedOffProviderOut`) and said as switched off in its editor and the TUI's group page, so switching one of two providers off for a while doesn't take the group away from the agents, rules and groups set to it; it is back in its place once on again (#2671: `TestFoundGroupStaysWithAProviderOff`, `TestFoundGroupWithAProviderOff`, `TestReseatKeepsAFoundGroupWithAProviderOff`, `TestFoundGroupMemberOfASwitchedOffProvider`). A found group the user changed (an `auto-…` id stored) is read without the members of providers magpie no longer has (`withoutRemoved`, not written back, so a provider back under its id is back in it), except a manual group's pick, a rule's model, or all of them when none would be left. It keeps following its model as a found group does (Kxsg79bEYFP4 on X: a third provider with the model, a plugin's, had stayed out of a group the user had changed): `SaveGroup` stores, for an `auto-…` id, what it had seen (`Group.Seen`: the models magpie found in it by that save, and those the user named, as `provider/model`), and a provider that serves the model since joins it as it is read, after the user's own members (`joined`, not written back), unless kept out of found groups. A model seen and not a member is one the user took out, and stays out; a provider's rename or a fold carries `Seen` (`mapModelRefs`), and a shared group leaves it behind. A found group changed before `Seen` was kept takes in nothing, as nothing says which of its models the user took out; its next save sees what is found then (`TestChangedFoundGroupTakesInANewProvider`, `TestChangedFoundGroupFromBeforeKeepsItsMembers`, `TestChangedFoundGroupTakesInAPluginProvider`). A switched-off provider's members stay in it, skipped by `membersIn`, and the Routing groups page says them as switched off (`memberJSON.providerOff`). The user's own groups keep their members. Three templates make a group in one click from the models the user has (`provider.Templates`, `AddTemplate`; the Routing groups page's cards before a first group and its Templates menu after, `magpie group template [kind] [name]`): `smart` sends a hard turn to the strongest model and an easy one or a compaction to a cheap one, asked by a classifier (the decision API when there is one, else the cheapest priced model that doesn't reason); `thrifty` starts on two cheap models of different providers and sends high reasoning to the strongest; `steady` fails over between the strongest model of up to three providers. A model is weighed by its maker's list price when known, else what its provider charges, else by its id's size words (`sizeOf`); one over `tooDear` (USD 100 a million output tokens) is never picked. A template that can't be made says what is missing (`Need`). It is saved under a name and id no group has (`freeGroupName`, shared with `CopyGroup`), never over one. A group is shared as text (`ShareGroup`, a group row's Copy to share): JSON marked `"magpie": "routing-group"` with a format `version` (`ShareVersion`), holding the group's members as it names them, patterns, routing, rules, classifier and settings. A group holds only `provider/model` ids, never a key, account or address, and the derived matches, found/hidden/off flags and the rules that hold by a folder (a path on the sharer's machine, `Rule.Folders`) stay behind; a pasted one is left out too. `ImportGroup` (the Routing groups page's Import, `POST /api/groups/import`) reads it with words or a code fence around it, refuses another text, a newer format or none (`ShareError`, said in the reader's language). A member whose provider the importer has is kept; else the same model (`AutoGroupOf`) under the first provider of theirs that serves it (`Instead`); else it is left out and named (`Missing`), with the rules that send to it, its place among the off and fast members, and a classifier gone takes the intent rules and auto effort with it. Nothing is added when no member is left; what is added gets a free name, never replacing a group. A group of patterns only that match nothing now (a plugin's models not listed) has no members: `/api/groups` says them, and an unmakeable template's, as `[]`, never `null`; the Routing groups page reads the response through `groupsFrom` and draws a group it still can't draw as one row saying so, so one bad group never hides the rest (#1585). | [`group.go`](../../internal/provider/group.go), [`grouptemplate.go`](../../internal/provider/grouptemplate.go), [`group_share.go`](../../internal/provider/group_share.go) | diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 6147472b9..fbf090c45 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -2867,6 +2867,18 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; } .editor .accts .auto-switch .as-head { display: flex; text-align: left; padding-top: 0; align-items: center; gap: 8px; min-height: 18px; cursor: pointer; } .editor .accts .auto-switch .as-name { flex: 1; min-width: 0; } .editor .accts .auto-switch .as-head .lib-switch { flex: none; } +/* how the switch works (autoswitchtip.js): its lines rest out of sight and + settingshints.js shows them in its card; the mark says one is there. A + touch screen, with no hover, keeps the lines in place and no mark */ +.editor .accts .auto-switch .as-head .as-tip { display: none; flex: none; color: var(--muted); } +.editor .accts .auto-switch > .hint { margin: 0; line-height: 1.5; color: var(--fg-2); } +@media (hover: hover) { + .editor .accts .auto-switch .as-head .as-tip { display: inline-flex; } + .editor .accts .auto-switch.hint-row { position: relative; } + .editor .accts .auto-switch.hint-row > .hint { + --hint: 1; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; + } +} .editor .accts .auto-switch .sign-in-moves { line-height: 1.5; color: var(--fg-2); } .editor .accts .auto-switch .as-keep { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--fg-2); } .editor .accts .auto-switch .keep-as { max-width: 240px; } diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index ffdb15917..04df6d995 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -12215,7 +12215,7 @@ function routingOfDraft(p) { if (draft?.sink !== undefined && draft.sink !== !!p.sink) out.sink = draft.sink; return out; } -// signInMovesLine: how magpie moves the agent's own sign-in (provider.SignInMovesOf) +// how magpie moves the agent's sign-in (provider.SignInMovesOf) function signInMovesLine(p, agent) { const m = p.signInMoves; if (!m) return ""; @@ -13556,7 +13556,7 @@ function renderAccounts(a, p) { if (amBox) row.append(amBox); list.append(row); } - // moving the agent's sign-in is a switch (the owner, 11-11); off: the account it stays on (#524) + // the owner, 11-11; off: the account kept (#524) if ((a.agent === "codex" || a.agent === "claude") && several && p) { const box = el("div", "auto-switch"), on = !!p.switchOnly || !p.keepLogin; const head = el("label", "as-head"); @@ -13568,6 +13568,7 @@ function renderAccounts(a, p) { } head.append(name, sw); box.append(head); + import("./autoswitchtip.js").then(() => autoSwitchTip(box, head, p), () => {}); let keepAs = kept; const post = (keepLogin) => { const body = { id: p.id, keepLogin }; diff --git a/internal/gui/assets/autoswitchtip.js b/internal/gui/assets/autoswitchtip.js new file mode 100644 index 000000000..ec2c458ed --- /dev/null +++ b/internal/gui/assets/autoswitchtip.js @@ -0,0 +1,32 @@ +// The hover hint beside Switch {agent}'s account automatically (the owner, +// 11-11): how magpie switches the agent's account, and why that is the +// agent's own use of the account. It says what is sent and by whom, and +// promises nothing about bans: what an account may be used for is the +// vendor's call. Its lines rest out of sight in the accounts list, and +// settingshints.js shows them in its card. Only where the switch moves the +// sign-in: under the gateway it moves Claude Code's requests instead. +// app.js imports this when it draws the switch, so the core doesn't +// carry it. + +// autoSwitchTip puts the hint's lines in box and its mark after the +// switch's name in head, for p's agent (Codex or Claude Code) +window.autoSwitchTip = function (box, head, p) { + const m = p.signInMoves; + if (!m || !(m.mode === "moves" || m.mode === "kept" && !m.routed) || box.querySelector(":scope > .hint")) return; + const codex = p.account?.agent === "codex"; + const lines = codex + ? [t("magpie writes the next account's sign-in to Codex's own auth.json, as codex login does, and reads what is left where Codex's /status reads it. Sessions already open keep their account until they are restarted."), + t("It changes which of your own accounts Codex is signed in to, and nothing else: the requests are the ones Codex makes."), + t("So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against OpenAI's terms.")] + : [t("magpie writes the next account's sign-in where Claude Code keeps its own, as /login does, and reads what is left by running Claude Code's own /usage. Sessions already open keep their account until they are restarted."), + t("Claude Code itself still sends every request, straight to Anthropic and unchanged; magpie sends none of them. An account with its own proxy keeps it."), + t("So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against Anthropic's terms.")]; + box.classList.add("hint-row"); + box.append(...lines.map((s) => el("p", "hint", s))); + const mark = el("span", "as-tip"); + mark.setAttribute("aria-hidden", "true"); // a screen reader reads the lines + mark.append(svg(INFO_I, 13, 1.6)); + // a press on it is not one on the switch's label + mark.onclick = (e) => e.preventDefault(); + head.querySelector(".as-name")?.after(mark); +}; diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 5b4bf67b9..2f75d4a81 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -2062,6 +2062,12 @@ const I18N = { "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and back to the first once that has room again.": "经 magpie 的请求由路由挑选账号;{agent} 直连时用它登录的账号,该账号用到 98% 时,magpie 把 {agent} 登录到下一个已勾选且有余量的账号,首选账号恢复后切回。", "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and keeps it there till that one is 98% used too.": "经 magpie 的请求由路由挑选账号;{agent} 直连时用它登录的账号,该账号用到 98% 时,magpie 把 {agent} 登录到下一个已勾选且有余量的账号,并一直用它,直到它也用到 98%。", "Switch {agent}'s account automatically": "自动切换 {agent} 的账号", + "magpie writes the next account's sign-in to Codex's own auth.json, as codex login does, and reads what is left where Codex's /status reads it. Sessions already open keep their account until they are restarted.": "magpie 把下一个账号的登录写进 Codex 自己的 auth.json,和 codex login 一样;剩余额度从 Codex 的 /status 读取的同一处读取。已经打开的会话继续用原来的账号,直到重新启动。", + "It changes which of your own accounts Codex is signed in to, and nothing else: the requests are the ones Codex makes.": "它只改变 Codex 登录的是你自己的哪一个账号,别的都不动:请求仍是 Codex 自己发出的那些。", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against OpenAI's terms.": "所以这和你手动切换账号是一样的。请只用你自己的账号:共享账号违反 OpenAI 的条款。", + "magpie writes the next account's sign-in where Claude Code keeps its own, as /login does, and reads what is left by running Claude Code's own /usage. Sessions already open keep their account until they are restarted.": "magpie 把下一个账号的登录写到 Claude Code 自己保存登录的地方,和 /login 一样;剩余额度通过运行 Claude Code 自己的 /usage 读取。已经打开的会话继续用原来的账号,直到重新启动。", + "Claude Code itself still sends every request, straight to Anthropic and unchanged; magpie sends none of them. An account with its own proxy keeps it.": "每个请求仍由 Claude Code 本身发出,直接发往 Anthropic,原样不改;magpie 一个都不发。设了自己代理的账号继续走它的代理。", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against Anthropic's terms.": "所以这和你手动切换账号是一样的。请只用你自己的账号:共享账号违反 Anthropic 的条款。", "Always on while magpie only switches {agent}'s sign-in": "{agent} 只切换登录时始终开启", "{agent}'s requests go through magpie, which sends each one to an account with room; its own sign-in stays where you put it.": "{agent} 的请求经过 magpie,每个请求都发给有额度的账号;{agent} 自己的登录保持你选的账号不变。", "When the account {agent} is signed in to is used up, magpie signs it in to the next ticked account with room.": "{agent} 登录的账号用完时,magpie 把它登录到下一个已勾选且有额度的账号。", @@ -7084,6 +7090,12 @@ const I18N = { "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and back to the first once that has room again.": "經 magpie 的請求由路由挑選帳號;{agent} 直連時用它登入的帳號,該帳號用到 98% 時,magpie 把 {agent} 登入到下一個已勾選且有餘量的帳號,首選帳號恢復後切回。", "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and keeps it there till that one is 98% used too.": "經 magpie 的請求由路由挑選帳號;{agent} 直連時用它登入的帳號,該帳號用到 98% 時,magpie 把 {agent} 登入到下一個已勾選且有餘量的帳號,並一直用它,直到它也用到 98%。", "Switch {agent}'s account automatically": "自動切換 {agent} 的帳號", + "magpie writes the next account's sign-in to Codex's own auth.json, as codex login does, and reads what is left where Codex's /status reads it. Sessions already open keep their account until they are restarted.": "magpie 把下一個帳號的登入寫進 Codex 自己的 auth.json,和 codex login 一樣;剩餘額度從 Codex 的 /status 讀取的同一處讀取。已經開啟的工作階段繼續用原來的帳號,直到重新啟動。", + "It changes which of your own accounts Codex is signed in to, and nothing else: the requests are the ones Codex makes.": "它只改變 Codex 登入的是你自己的哪一個帳號,其他都不動:請求仍是 Codex 自己發出的那些。", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against OpenAI's terms.": "所以這和你手動切換帳號是一樣的。請只用你自己的帳號:共用帳號違反 OpenAI 的條款。", + "magpie writes the next account's sign-in where Claude Code keeps its own, as /login does, and reads what is left by running Claude Code's own /usage. Sessions already open keep their account until they are restarted.": "magpie 把下一個帳號的登入寫到 Claude Code 自己保存登入的地方,和 /login 一樣;剩餘額度透過執行 Claude Code 自己的 /usage 讀取。已經開啟的工作階段繼續用原來的帳號,直到重新啟動。", + "Claude Code itself still sends every request, straight to Anthropic and unchanged; magpie sends none of them. An account with its own proxy keeps it.": "每個請求仍由 Claude Code 本身發出,直接送往 Anthropic,原封不動;magpie 一個都不送。設了自己代理的帳號繼續走它的代理。", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against Anthropic's terms.": "所以這和你手動切換帳號是一樣的。請只用你自己的帳號:共用帳號違反 Anthropic 的條款。", "Always on while magpie only switches {agent}'s sign-in": "{agent} 只切換登入時始終開啟", "{agent}'s requests go through magpie, which sends each one to an account with room; its own sign-in stays where you put it.": "{agent} 的請求經過 magpie,每個請求都發給有額度的帳號;{agent} 自己的登入保持你選的帳號不變。", "When the account {agent} is signed in to is used up, magpie signs it in to the next ticked account with room.": "{agent} 登入的帳號用完時,magpie 把它登入到下一個已勾選且有額度的帳號。", @@ -12082,6 +12094,12 @@ const I18N = { "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and back to the first once that has room again.": "magpie 経由のリクエストはルーティングがアカウントを選びます。{agent} 単体ではサインイン中のアカウントを使い、そのアカウントが 98% 使用されると magpie が残量のある次のチェック済みアカウントに切り替え、最初のアカウントに残量が戻ると元に戻します。", "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and keeps it there till that one is 98% used too.": "magpie 経由のリクエストはルーティングがアカウントを選びます。{agent} 単体ではサインイン中のアカウントを使い、そのアカウントが 98% 使用されると magpie が残量のある次のチェック済みアカウントに切り替え、そのアカウントも 98% 使用されるまでそのまま使います。", "Switch {agent}'s account automatically": "{agent} のアカウントを自動で切り替える", + "magpie writes the next account's sign-in to Codex's own auth.json, as codex login does, and reads what is left where Codex's /status reads it. Sessions already open keep their account until they are restarted.": "magpie は次のアカウントのサインインを Codex 自身の auth.json に書き込みます(codex login と同じです)。残りは Codex の /status が読むのと同じところから読みます。開いているセッションは再起動するまで元のアカウントのままです。", + "It changes which of your own accounts Codex is signed in to, and nothing else: the requests are the ones Codex makes.": "変わるのは Codex がサインインしている自分のアカウントだけで、ほかは何も変えません。リクエストは Codex 自身が送るものです。", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against OpenAI's terms.": "つまり手でアカウントを切り替えるのと同じです。自分のアカウントだけを使ってください。アカウントの共有は OpenAI の規約に反します。", + "magpie writes the next account's sign-in where Claude Code keeps its own, as /login does, and reads what is left by running Claude Code's own /usage. Sessions already open keep their account until they are restarted.": "magpie は次のアカウントのサインインを Claude Code が自分のサインインを保存する場所に書き込みます(/login と同じです)。残りは Claude Code 自身の /usage を実行して読みます。開いているセッションは再起動するまで元のアカウントのままです。", + "Claude Code itself still sends every request, straight to Anthropic and unchanged; magpie sends none of them. An account with its own proxy keeps it.": "リクエストはすべて Claude Code 自身が Anthropic へ直接、そのまま送ります。magpie は一つも送りません。独自のプロキシを持つアカウントはそのプロキシを使い続けます。", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against Anthropic's terms.": "つまり手でアカウントを切り替えるのと同じです。自分のアカウントだけを使ってください。アカウントの共有は Anthropic の規約に反します。", "Always on while magpie only switches {agent}'s sign-in": "{agent} のサインインだけを切り替えるときは常にオン", "{agent}'s requests go through magpie, which sends each one to an account with room; its own sign-in stays where you put it.": "{agent} のリクエストは magpie を経由し、各リクエストは残量のあるアカウントに送られます。{agent} 自身のサインインは選んだアカウントのままです。", "When the account {agent} is signed in to is used up, magpie signs it in to the next ticked account with room.": "{agent} がサインインしているアカウントを使い切ると、magpie は残量のある次のチェック済みアカウントにサインインし直します。", @@ -17111,6 +17129,12 @@ const I18N = { "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and back to the first once that has room again.": "Die Weiterleitung wählt für jede Anfrage über magpie das Konto; {agent} selbst nutzt das Konto, bei dem es angemeldet ist; magpie meldet es beim nächsten angehakten Konto mit freiem Kontingent an, sobald das aktuelle zu 98 % verbraucht ist, und wieder beim ersten, sobald dort wieder Kontingent frei ist.", "Routing picks the account for each request through magpie; {agent} on its own uses the one it is signed in to, which magpie moves to the next ticked account with room once it is 98% used, and keeps it there till that one is 98% used too.": "Die Weiterleitung wählt für jede Anfrage über magpie das Konto; {agent} selbst nutzt das Konto, bei dem es angemeldet ist; magpie meldet es beim nächsten angehakten Konto mit freiem Kontingent an, sobald das aktuelle zu 98 % verbraucht ist, und bleibt dort, bis auch dieses zu 98 % verbraucht ist.", "Switch {agent}'s account automatically": "{agent}-Konto automatisch wechseln", + "magpie writes the next account's sign-in to Codex's own auth.json, as codex login does, and reads what is left where Codex's /status reads it. Sessions already open keep their account until they are restarted.": "magpie schreibt die Anmeldung des nächsten Kontos in Codex' eigene auth.json, wie codex login es tut, und liest das Verbleibende dort, wo Codex' /status es liest. Bereits offene Sitzungen behalten ihr Konto, bis sie neu gestartet werden.", + "It changes which of your own accounts Codex is signed in to, and nothing else: the requests are the ones Codex makes.": "Es ändert nur, bei welchem deiner eigenen Konten Codex angemeldet ist, sonst nichts: Die Anfragen sind die, die Codex stellt.", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against OpenAI's terms.": "Es ist also dasselbe wie ein Kontowechsel von Hand. Nutze nur Konten, die dir gehören: Ein Konto zu teilen verstößt gegen die Bedingungen von OpenAI.", + "magpie writes the next account's sign-in where Claude Code keeps its own, as /login does, and reads what is left by running Claude Code's own /usage. Sessions already open keep their account until they are restarted.": "magpie schreibt die Anmeldung des nächsten Kontos dorthin, wo Claude Code seine eigene speichert, wie /login es tut, und liest das Verbleibende, indem es Claude Codes eigenes /usage ausführt. Bereits offene Sitzungen behalten ihr Konto, bis sie neu gestartet werden.", + "Claude Code itself still sends every request, straight to Anthropic and unchanged; magpie sends none of them. An account with its own proxy keeps it.": "Claude Code selbst sendet weiterhin jede Anfrage, direkt und unverändert an Anthropic; magpie sendet keine davon. Ein Konto mit eigenem Proxy behält ihn.", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against Anthropic's terms.": "Es ist also dasselbe wie ein Kontowechsel von Hand. Nutze nur Konten, die dir gehören: Ein Konto zu teilen verstößt gegen die Bedingungen von Anthropic.", "Always on while magpie only switches {agent}'s sign-in": "Immer an, solange magpie nur die Anmeldung von {agent} wechselt", "{agent}'s requests go through magpie, which sends each one to an account with room; its own sign-in stays where you put it.": "Die Anfragen von {agent} laufen über magpie, das jede an ein Konto mit Kontingent schickt; die eigene Anmeldung von {agent} bleibt, wo du sie gesetzt hast.", "When the account {agent} is signed in to is used up, magpie signs it in to the next ticked account with room.": "Ist das Konto, bei dem {agent} angemeldet ist, aufgebraucht, meldet magpie es beim nächsten angehakten Konto mit Kontingent an.", diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index ebd873e93..bd8431eaa 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_802 // 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); 1,533,802 with a closed Mac window telling its page it is out of sight (#4293, pipi-1997), in app.js, which every page needs, its comments cut to one line, with no room added (11-01); Warm up on a Codex or Claude account's Usage card (01huadalang on Discord), in plugins/usage/page.js, its one call in app.js paid for by two comments cut, no raise (11-01); Settings' Check in now for one account (xiaowu_95660), its row and press in checkinnow.js, loaded when Settings draws a check-in, its one call in app.js paid for by three check-in comments cut, no raise (11-02); a ChatGPT account's plan end under its row on Providers (danzi002 on Discord), its line in app.js paid for by two account-row comments cut, no raise (11-02); Scroll to top and Scroll to bottom (#1090, emo172), in scrollends.js, imported on the window's first scroll, its one line in app.js paid for by two comments cut, no raise (11-02); a new-api relay's User ID beside the balance token (zxc56823), in app.js, paid for by four comments cut, no raise (11-03); Air's opened rows saying whether Air's own Codex and Claude Agent go through magpie (jumy_18634 on Discord), in app.js, paid for by six Agents-page comments cut, no raise (11-03); a key's spend cap on its row (sparkling_lemur_62868 on Discord), its pill and held line in keyspend.js, loaded when the provider editor draws a key, its one call in app.js, no raise (11-03); Claude Code's status line square beside ultracode (steven_4422 on Discord), in app.js, paid for by foldSame's comment cut, no raise (11-03); Codex's Restart the app when magpie switches its account tick (atom0964 on Discord), in app.js, paid for by five account-row comments cut, no raise (11-03); over it at 1,534,154 (#5139), 1,533,125 at e928b57f0, 677 bytes under it, and 1,525,207 with Settings › Sync's server form (davForm: WebDAV, S3 and GitHub) moved out to syncfiles.js, loaded when it opens, not lowered since what is left plus 1.5% is over it (11-04); a Mac window's page letting go of its layers after 30s out of sight (#5530, Matrix on Discord), in app.js, paid for by four comments cut, no raise (11-06); a plugin's tools hidden from every agent from its Plugins row (chengming0v0 on Discord), in plugins.js, paid for by two comments cut, no raise (11-07); a key's balance typed by hand (tenacious_eagle on Discord), its pill in keybalance.js, loaded by keyspend.js when the provider editor draws a key of a provider that takes one, nothing in app.js, no raise (11-08); a key's provider's model list off (axelburks on Discord), its tick in app.js, paid for by four Models-section comments cut, no raise (11-08); a model's own headers in Model settings (axelburks on Discord), the core's own editor, paid for by sixteen of its comments cut, no raise (11-08); a model asked on System One (axelburks on Discord), in app.js, paid for by three of the editor's comments cut, no raise (11-08); a typed balance's part that expires (tenacious_eagle_96548 on Discord), its days on the Usage page and the panel in app.js (expiresIn), paid for by five balance comments cut, no raise (11-08); a model's context window and max output in its Model settings row (sayagoodbyeplz on Discord), the row's boxes in modellimits.js, loaded when the provider editor draws a model, its one call in app.js paid for by nine comments cut, no raise (11-08); Make first under Smart saying the order only settles ties (CryptoSarom on X, 4436b7d98, 1,080 bytes in app.js) took it to 1,534,166 (#5720), and About's Open-source licenses dialog moved out to notices.js and Sync's Restore and Upload asks to syncfiles.js, each loaded when it opens, brought it back to 1,530,548, no raise (11-09); a subscription's warm-ups, check-ins and resets moved from Settings into its provider's editor (the owner, 11-07), in app.js, paid for by comments cut, no raise (11-09); Settings › Models › Images' Video generation (a custom provider's video model, Discord #feedback), its row in videogen.js, loaded when Settings draws Image generation, its one call in app.js, no raise (11-09); a window's cap at an amount of its unit (9won_25273 on Discord, 40cbdaa7e) took it to 1,535,556 (#5795), and the account-cap rows' comments cut brought it back to 1,533,547, no raise (11-09); Claude Desktop's Claude Magpie switch (#5671, baranwang on X), in app.js, one switch helper shared with the largest-window one and four comments cut, no raise (11-09); a plugin's page sharing a picture it drew (the day card, JungleyYeh on X), its copy and save in pageshare.js, loaded the first time a page shares one, its one call in pluginpages.js paid for by two of its comments cut, no raise (11-09); the quick panel wording unpriced calls as the Usage page does (tenacious_eagle on Discord), in app.js, paid for by four of the panel's comments cut, no raise (11-10); the Codex reset note naming its ChatGPT projects and chats (b3a57b3d8), paid for by appBackSaid's comment cut, no raise (11-10); the daily check-in's time of day (times_ang on X), its row in checkinnow.js, its one call in app.js, went over it at 1,534,281 on a main that had grown under it, and six check-in comments cut brought it back to 1,533,495, no raise (11-10); Codex's service tier row (JackyFill on X), in app.js, paid for by eight Codex-row comments cut, no raise (11-10); the panel's Usage tab putting a vendor's account first from its count (RealZeroP27 on X), its menu in panelfirst.js, loaded when the count is pressed, paid for by the Allowances tab's arranging moved out to panelarrange.js, loaded when Arrange is pressed, no comments cut, no raise (11-10); an agent's own telemetry off in its settings (OipsAnthony on X), in app.js, paid for by sixteen Agents-page comments cut, 1,532,840 after, no raise (11-10); the provider editor's URL taking the /v1 a test found it was typed without (Cyrus_4433 on X), in app.js, paid for by five provider-test comments cut, 1,533,689 after, no raise (11-10); 1,528,998 with the Agents page's Manage agents dialog moved out to agentsmanager.js, loaded when Manage is pressed (11-10); 1,529,335 with an agent's own Provider in model names in agentsuffix.js, loaded when its Details open, and the line that loads it (KillTry27355 on X), no raise (11-10); a Remote magpie's models named by the provider serving them there (lcc580 on X), in app.js, paid for by four comments cut, 1,533,535 after, no raise (11-10); Discover as one market with this week's picks, and Install as a thin ring with its arrow (the owner), in plugins.js, paid for by a plugin's README renderer moved out to pluginmd.js, imported once plugins.js has run, no raise (11-10); Settings › Privacy's Turn off telemetry for all agents (OipsAnthony on X), in app.js, paid for by ten Privacy-section comments cut, 1,530,820 after, no raise (11-11); the accounts list's Switch {agent}'s account automatically and the line under it (the owner, 11-11), in app.js, on a main 4 bytes over, paid for by one helper for every lib-switch button and one for a button that opens a menu (libSwitch, menuOf), shared by ten switches and five menus, 1,533,756 after, no raise (11-11) + coreScriptBudget = 1_533_802 // 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); 1,533,802 with a closed Mac window telling its page it is out of sight (#4293, pipi-1997), in app.js, which every page needs, its comments cut to one line, with no room added (11-01); Warm up on a Codex or Claude account's Usage card (01huadalang on Discord), in plugins/usage/page.js, its one call in app.js paid for by two comments cut, no raise (11-01); Settings' Check in now for one account (xiaowu_95660), its row and press in checkinnow.js, loaded when Settings draws a check-in, its one call in app.js paid for by three check-in comments cut, no raise (11-02); a ChatGPT account's plan end under its row on Providers (danzi002 on Discord), its line in app.js paid for by two account-row comments cut, no raise (11-02); Scroll to top and Scroll to bottom (#1090, emo172), in scrollends.js, imported on the window's first scroll, its one line in app.js paid for by two comments cut, no raise (11-02); a new-api relay's User ID beside the balance token (zxc56823), in app.js, paid for by four comments cut, no raise (11-03); Air's opened rows saying whether Air's own Codex and Claude Agent go through magpie (jumy_18634 on Discord), in app.js, paid for by six Agents-page comments cut, no raise (11-03); a key's spend cap on its row (sparkling_lemur_62868 on Discord), its pill and held line in keyspend.js, loaded when the provider editor draws a key, its one call in app.js, no raise (11-03); Claude Code's status line square beside ultracode (steven_4422 on Discord), in app.js, paid for by foldSame's comment cut, no raise (11-03); Codex's Restart the app when magpie switches its account tick (atom0964 on Discord), in app.js, paid for by five account-row comments cut, no raise (11-03); over it at 1,534,154 (#5139), 1,533,125 at e928b57f0, 677 bytes under it, and 1,525,207 with Settings › Sync's server form (davForm: WebDAV, S3 and GitHub) moved out to syncfiles.js, loaded when it opens, not lowered since what is left plus 1.5% is over it (11-04); a Mac window's page letting go of its layers after 30s out of sight (#5530, Matrix on Discord), in app.js, paid for by four comments cut, no raise (11-06); a plugin's tools hidden from every agent from its Plugins row (chengming0v0 on Discord), in plugins.js, paid for by two comments cut, no raise (11-07); a key's balance typed by hand (tenacious_eagle on Discord), its pill in keybalance.js, loaded by keyspend.js when the provider editor draws a key of a provider that takes one, nothing in app.js, no raise (11-08); a key's provider's model list off (axelburks on Discord), its tick in app.js, paid for by four Models-section comments cut, no raise (11-08); a model's own headers in Model settings (axelburks on Discord), the core's own editor, paid for by sixteen of its comments cut, no raise (11-08); a model asked on System One (axelburks on Discord), in app.js, paid for by three of the editor's comments cut, no raise (11-08); a typed balance's part that expires (tenacious_eagle_96548 on Discord), its days on the Usage page and the panel in app.js (expiresIn), paid for by five balance comments cut, no raise (11-08); a model's context window and max output in its Model settings row (sayagoodbyeplz on Discord), the row's boxes in modellimits.js, loaded when the provider editor draws a model, its one call in app.js paid for by nine comments cut, no raise (11-08); Make first under Smart saying the order only settles ties (CryptoSarom on X, 4436b7d98, 1,080 bytes in app.js) took it to 1,534,166 (#5720), and About's Open-source licenses dialog moved out to notices.js and Sync's Restore and Upload asks to syncfiles.js, each loaded when it opens, brought it back to 1,530,548, no raise (11-09); a subscription's warm-ups, check-ins and resets moved from Settings into its provider's editor (the owner, 11-07), in app.js, paid for by comments cut, no raise (11-09); Settings › Models › Images' Video generation (a custom provider's video model, Discord #feedback), its row in videogen.js, loaded when Settings draws Image generation, its one call in app.js, no raise (11-09); a window's cap at an amount of its unit (9won_25273 on Discord, 40cbdaa7e) took it to 1,535,556 (#5795), and the account-cap rows' comments cut brought it back to 1,533,547, no raise (11-09); Claude Desktop's Claude Magpie switch (#5671, baranwang on X), in app.js, one switch helper shared with the largest-window one and four comments cut, no raise (11-09); a plugin's page sharing a picture it drew (the day card, JungleyYeh on X), its copy and save in pageshare.js, loaded the first time a page shares one, its one call in pluginpages.js paid for by two of its comments cut, no raise (11-09); the quick panel wording unpriced calls as the Usage page does (tenacious_eagle on Discord), in app.js, paid for by four of the panel's comments cut, no raise (11-10); the Codex reset note naming its ChatGPT projects and chats (b3a57b3d8), paid for by appBackSaid's comment cut, no raise (11-10); the daily check-in's time of day (times_ang on X), its row in checkinnow.js, its one call in app.js, went over it at 1,534,281 on a main that had grown under it, and six check-in comments cut brought it back to 1,533,495, no raise (11-10); Codex's service tier row (JackyFill on X), in app.js, paid for by eight Codex-row comments cut, no raise (11-10); the panel's Usage tab putting a vendor's account first from its count (RealZeroP27 on X), its menu in panelfirst.js, loaded when the count is pressed, paid for by the Allowances tab's arranging moved out to panelarrange.js, loaded when Arrange is pressed, no comments cut, no raise (11-10); an agent's own telemetry off in its settings (OipsAnthony on X), in app.js, paid for by sixteen Agents-page comments cut, 1,532,840 after, no raise (11-10); the provider editor's URL taking the /v1 a test found it was typed without (Cyrus_4433 on X), in app.js, paid for by five provider-test comments cut, 1,533,689 after, no raise (11-10); 1,528,998 with the Agents page's Manage agents dialog moved out to agentsmanager.js, loaded when Manage is pressed (11-10); 1,529,335 with an agent's own Provider in model names in agentsuffix.js, loaded when its Details open, and the line that loads it (KillTry27355 on X), no raise (11-10); a Remote magpie's models named by the provider serving them there (lcc580 on X), in app.js, paid for by four comments cut, 1,533,535 after, no raise (11-10); Discover as one market with this week's picks, and Install as a thin ring with its arrow (the owner), in plugins.js, paid for by a plugin's README renderer moved out to pluginmd.js, imported once plugins.js has run, no raise (11-10); Settings › Privacy's Turn off telemetry for all agents (OipsAnthony on X), in app.js, paid for by ten Privacy-section comments cut, 1,530,820 after, no raise (11-11); the accounts list's Switch {agent}'s account automatically and the line under it (the owner, 11-11), in app.js, on a main 4 bytes over, paid for by one helper for every lib-switch button and one for a button that opens a menu (libSwitch, menuOf), shared by ten switches and five menus, 1,533,756 after, no raise (11-11); the switch's hover hint, how it works and why it is the agent's own use of the account (the owner, 11-11), in autoswitchtip.js, loaded when the switch is drawn, its one call in app.js paid for by its own comments cut, 1,533,771 after, no raise (11-11) ) func TestCoreScriptBudget(t *testing.T) { diff --git a/internal/gui/tests/old-webkit.test.cjs b/internal/gui/tests/old-webkit.test.cjs index 7b69efe27..ecda57470 100644 --- a/internal/gui/tests/old-webkit.test.cjs +++ b/internal/gui/tests/old-webkit.test.cjs @@ -172,9 +172,10 @@ test("compat.js is the first of the page's own scripts", async () => { // pluginmd.js (a README's renderer) once plugins.js has run; // plugincounts.js (Discover's counts) when the Plugins page loads; // navicons.js (the sidebar lists' marks) with the first list drawn; + // autoswitchtip.js when a provider's accounts draw their switch; // the checks above // still read them - for (const f of await scripts()) if (!["webfonts.js", "cfgblocked.js", "signsheets.js", "ruleedit.js", "ratewindows.js", "traywindows.js", "autoresetown.js", "registry.js", "navlamp.js", "whatsnew.js", "claudemode.js", "ctxtext.js", "resetask.js", "quotaall.js", "quitask.js", "checkinnow.js", "proxies.js", "autobackup.js", "scrollends.js", "profilerename.js", "settingshints.js", "keyspend.js", "syncfiles.js", "agentcompact.js", "balfound.js", "passerrors.js", "keybalance.js", "modellimits.js", "notices.js", "videogen.js", "provlinks.js", "setfeats.js", "pageshare.js", "panelfirst.js", "panelarrange.js", "modelfind.js", "agentsmanager.js", "agentsuffix.js", "phonetabs.js", "pluginmd.js", "bark.js", "acctexport.js", "plugincounts.js", "navicons.js"].includes(f)) assert(all.includes(f), f + " is not loaded by index.html"); + for (const f of await scripts()) if (!["webfonts.js", "cfgblocked.js", "signsheets.js", "ruleedit.js", "ratewindows.js", "traywindows.js", "autoresetown.js", "registry.js", "navlamp.js", "whatsnew.js", "claudemode.js", "ctxtext.js", "resetask.js", "quotaall.js", "quitask.js", "checkinnow.js", "proxies.js", "autobackup.js", "scrollends.js", "profilerename.js", "settingshints.js", "keyspend.js", "syncfiles.js", "agentcompact.js", "balfound.js", "passerrors.js", "keybalance.js", "modellimits.js", "notices.js", "videogen.js", "provlinks.js", "setfeats.js", "pageshare.js", "panelfirst.js", "panelarrange.js", "modelfind.js", "agentsmanager.js", "agentsuffix.js", "phonetabs.js", "pluginmd.js", "bark.js", "acctexport.js", "plugincounts.js", "navicons.js", "autoswitchtip.js"].includes(f)) assert(all.includes(f), f + " is not loaded by index.html"); }); test("the styles hold up in Safari 15.0", async () => { diff --git a/internal/gui/tests/sign-in-moves.test.cjs b/internal/gui/tests/sign-in-moves.test.cjs index ed0c7648c..29315635d 100644 --- a/internal/gui/tests/sign-in-moves.test.cjs +++ b/internal/gui/tests/sign-in-moves.test.cjs @@ -6,7 +6,10 @@ // the server tells it (signInMoves): moved on at 98% or once used up, back // to the first or not, or left alone while its requests go through the // gateway. Off, the account it stays on. Switch-only holds it on. Nothing -// with one account. English and Chinese, Chromium and WebKit. +// with one account. Beside the switch, a mark whose hover card says how +// the switch works and why it is Claude Code's own use of the account +// ("提示这个原理是啥,以及它为什么不会让你的账号被封禁"), only where the +// sign-in moves. English and Chinese, Chromium and WebKit. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -64,6 +67,11 @@ const words = { name: "Switch Claude Code's account automatically", keep: "Keep Claude Code signed in to", gateway: "Claude Code's requests go through magpie, which sends each one to an account with room; its own sign-in stays where you put it.", + tip: [ + "magpie writes the next account's sign-in where Claude Code keeps its own, as /login does, and reads what is left by running Claude Code's own /usage. Sessions already open keep their account until they are restarted.", + "Claude Code itself still sends every request, straight to Anthropic and unchanged; magpie sends none of them. An account with its own proxy keeps it.", + "So it is the same as switching accounts by hand. Use only accounts that are yours: sharing one is against Anthropic's terms.", + ], }, zh: { at98: "Claude Code 登录的账号用到 98% 时,magpie 把它登录到下一个已勾选且有额度的账号。之后一直用这个账号,直到它的额度也快用完。", @@ -71,6 +79,11 @@ const words = { name: "自动切换 Claude Code 的账号", keep: "Claude Code 始终登录", gateway: "Claude Code 的请求经过 magpie,每个请求都发给有额度的账号;Claude Code 自己的登录保持你选的账号不变。", + tip: [ + "magpie 把下一个账号的登录写到 Claude Code 自己保存登录的地方,和 /login 一样;剩余额度通过运行 Claude Code 自己的 /usage 读取。已经打开的会话继续用原来的账号,直到重新启动。", + "每个请求仍由 Claude Code 本身发出,直接发往 Anthropic,原样不改;magpie 一个都不发。设了自己代理的账号继续走它的代理。", + "所以这和你手动切换账号是一样的。请只用你自己的账号:共享账号违反 Anthropic 的条款。", + ], }, }; @@ -146,6 +159,48 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.deepEqual(errors, []); }); + test(`${engine} ${lang}: the mark beside the switch shows how it works on hover, and only where the sign-in moves`, async (t) => { + for (const [opts, shown] of [ + [{}, true], + [{ signInMoves: { mode: "kept" }, keepLogin: true }, true], + [{ signInMoves: { mode: "kept", routed: true }, keepLogin: true }, false], + [{ signInMoves: { mode: "gateway" } }, false], + ]) { + const { page, errors, posts } = await open(t, opts); + const mark = page.locator(".editor .accts .auto-switch .as-head .as-tip"); + if (!shown) { + // the module is in by the time a shown one's mark is drawn + await page.waitForFunction(() => !!window.autoSwitchTip); + assert.equal(await mark.count(), 0, JSON.stringify(opts)); + assert.equal(await page.locator(".editor .accts .auto-switch > .hint").count(), 0); + assert.deepEqual(errors, []); + await page.close(); + continue; + } + await mark.waitFor(); + // beside the switch, on its line + const [m, s] = await Promise.all([mark.boundingBox(), sw(page).boundingBox()]); + assert.ok(s.x - (m.x + m.width) >= 0 && s.x - (m.x + m.width) < 16, `the mark sits beside the switch: ${JSON.stringify([m, s])}`); + assert.ok(Math.abs(m.y + m.height / 2 - (s.y + s.height / 2)) < 3, "on the switch's line"); + // its lines rest out of sight, read by a screen reader + const lines = page.locator(".editor .accts .auto-switch > .hint"); + assert.deepEqual((await lines.allTextContents()).map((x) => x.trim()), w.tip); + assert.ok((await lines.first().boundingBox()).width <= 1, "out of sight till asked"); + await mark.hover(); + const card = page.locator(".set-hint.on"); + await card.waitFor(); + assert.deepEqual((await card.locator("p").allTextContents()).map((x) => x.trim()), w.tip); + const c = await card.boundingBox(), box = await page.locator(".editor .accts .auto-switch").boundingBox(); + assert.ok(c.y >= box.y + box.height - 1 || c.y + c.height <= box.y + 1, "the card is beside the row, not over it"); + // a press on the mark is no press on the switch + await mark.click(); + assert.deepEqual(posts, []); + assert.equal(await sw(page).getAttribute("aria-checked"), opts.keepLogin ? "false" : "true"); + assert.deepEqual(errors, []); + await page.close(); + } + }); + test(`${engine} ${lang}: switch-only holds it on; nothing with one account, no line when off in magpie`, async (t) => { const only = await open(t, { switchOnly: true, keepLogin: true }); assert.equal(await sw(only.page).getAttribute("aria-checked"), "true"); diff --git a/internal/provider/sign_in_moves.go b/internal/provider/sign_in_moves.go index 62c9bd16e..889a9e0b0 100644 --- a/internal/provider/sign_in_moves.go +++ b/internal/provider/sign_in_moves.go @@ -20,6 +20,10 @@ type SignInMoves struct { // Back: once the account moved off has room again, the agent is // signed back in to it (returnsToFirst). Only "moves". Back bool `json:"back,omitempty"` + // Routed: kept, but Claude Code goes through the gateway, so turning + // the switch on moves requests, not its sign-in (mode "gateway" + // then). Only "kept". + Routed bool `json:"routed,omitempty"` } // SignInMovesOf is SignInMoves for agent; nil for one whose sign-in magpie @@ -32,10 +36,11 @@ func SignInMovesOf(agent string) *SignInMoves { return &SignInMoves{Mode: "off"} } share, keep := loginSwitching(agent) + routed := agent == "claude" && ClaudeThroughMagpie() && !SwitchOnly(agent) switch { case keep: - return &SignInMoves{Mode: "kept"} - case agent == "claude" && ClaudeThroughMagpie() && !SwitchOnly(agent): + return &SignInMoves{Mode: "kept", Routed: routed} + case routed: return &SignInMoves{Mode: "gateway"} } return &SignInMoves{Mode: "moves", Share: share, Back: returnsToFirst(agent)} diff --git a/internal/provider/sign_in_moves_test.go b/internal/provider/sign_in_moves_test.go index d665317ce..edfe7a47a 100644 --- a/internal/provider/sign_in_moves_test.go +++ b/internal/provider/sign_in_moves_test.go @@ -77,14 +77,14 @@ func TestSignInMovesSaysWhatSwitchDoes(t *testing.T) { routing string mode string share float64 - back bool + back, kRouted bool }{ {name: "not routed", mode: "moves", share: SpentShare}, {name: "not routed, in order", routing: Ordered, mode: "moves", share: 100, back: true}, {name: "routed", routed: true, mode: "gateway"}, {name: "routed, switch only", routed: true, only: true, mode: "moves", share: SpentShare}, {name: "kept on the first", keep: true, mode: "kept"}, - {name: "kept, routed", keep: true, routed: true, mode: "kept"}, + {name: "kept, routed", keep: true, routed: true, mode: "kept", kRouted: true}, } for _, c := range cases { routed = c.routed @@ -102,7 +102,7 @@ func TestSignInMovesSaysWhatSwitchDoes(t *testing.T) { } setLoginReturn("claude", loginReturn{}) m := SignInMovesOf("claude") - if m == nil || m.Mode != c.mode || m.Share != c.share || m.Back != c.back { + if m == nil || m.Mode != c.mode || m.Share != c.share || m.Back != c.back || m.Routed != c.kRouted { t.Fatalf("%s: says %+v, want mode %s share %g back %v", c.name, m, c.mode, c.share, c.back) } to := switched()