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.
33 lines
2.3 KiB
JavaScript
33 lines
2.3 KiB
JavaScript
// 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);
|
|
};
|