ac4af582301a4e8a29245dbba767eba31334ddf9
24
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8e97e26d67 |
providers: WorkBuddy's sign-in warns that Tencent may ban the account first
NancyTom on X (11-04): WorkBuddy accounts used from DeepSeek Harness through magpie were banned, the international build's (WorkBuddy AI) most; repliers saw the same. Changing DSH's prompt isn't a fix: the plugin already rewords DSH's opener and moves the system prompt into the first user turn (REFUSED.md), and the bans came anyway. So magpie says it before an account is added, as it does for Claude, Zed, Qoder, Factory, MiMo and Command Code. - app.js: WorkBuddy and WorkBuddy AI carry risk with WORKBUDDY_RISK. A moved subscription (every user's now) gets it through subOf, so the plugin's sign-in waits behind "Sign in anyway" too. - i18n.js: zh, zh-TW, ja, de. - CLI: `magpie accounts add workbuddy|workbuddy-ai` asks the same (provider.WorkBuddyRisk, the window's words; a GUI test checks the two are equal). - Core script budget: no raise; the SUBS header comment was cut down. Run (mote, at |
||
|
|
5d63b3f995 |
accounts: a Claude import never writes an older sign-in over a newer one (#4532)
Importing a claude-swap export of the account Claude Code was signed in to wrote the file's sign-in over Claude Code's own (addLogin, using). cswap exports what it saved when it last switched; Claude Code has refreshed since, each refresh spending the refresh token before it, so the file's was spent and Claude Code was signed out. A saved account was replaced the same way. Only an identical refresh token was caught. Now a Claude sign-in for an account magpie already has (Claude Code's own, or a saved one that can still be used) with another refresh token is taken only when the file's expiresAt is later than what magpie has, the account's own config directory counted (claudeNewerKept). Otherwise it is "exists" with why, nothing written. cswapEntry and loginEntry read claudeAiOauth.expiresAt. The CLI prints the reason. Run (mote, -tags nogui): - TestImportCswapKeepsNewerSignIn: older-than-live, undated, newer-than- live, older-than-saved. Red with the check turned off by hand (three subtests: updated over live / saved), green with it. - go test ./internal/provider -run 'TestImport|Login' ok. - go vet ./internal/provider ./internal/cli on darwin, linux, windows; gofmt clean. Not tried: a real cswap export against a real Claude Code sign-in. A sign-in that was itself imported and never run is saved with expiresAt 1 (so Claude Code refreshes it first), so any dated file still replaces it. |
||
|
|
64cdb68035 |
accounts: import claude reads claude-swap's export (#4532)
StringKe (#4532) is moving from claude-swap (cswap 0.29.0) to magpie, and `magpie accounts import claude` didn't read cswap's export. It does now: parseLoginImport takes cswap's format-1 envelope ({version: 1, swapVersion, encrypted, accounts: [...]}, read from cswap 0.29.0's transfer.py) and cswapEntry reads each account's credentials.claudeAiOauth and config.oauthAccount: email, account and organization uuid, and the organization's name. The tokens are kept as the file has them; magpie asks Anthropic nothing. Refused, each with what to do: an encrypted export (decrypt with gpg -d first), another format version, a Codex entry, and an API-key entry (added as a key instead). An entry with no refresh token is accessOnly, as for every other file. cswap's alias becomes the account's name in magpie (importNames) when the account was added or updated, has no name yet, and no other account is called that or signed in as it, so the name stays a selector for one account (the previous commit's rule). testdata/cswap_0.29.0_export.json is claude-swap 0.29.0's own `cswap export` output, made from its source in a sandbox HOME in WSL with two accounts and fake tokens (cswap's add step asked Anthropic once with the fake refresh token, which it called dead; no real account was involved). Run (mote unless said): - At this commit's tree (on origin/main |
||
|
|
149e763e9e |
accounts: a name you gave an account picks it wherever an email does (#4532)
StringKe (#4532): `magpie accounts switch claude work` failed when "work" was the alias; accountNamed matched the email only. provider.AccountByName resolves a name (magpie accounts alias) among an agent's accounts. It refuses a name two accounts share, and a name that is another account's email or email part, so a name never picks the wrong account. It is used by: - accountNamed: accounts switch/on/off/remove/alias/cap and the rest that take <email>; - provider pool --accounts; - accountRef (GUI and account-cap): the exact email first, then a name, so another account's alias never shadows an email; - account-cap's display, through AccountRefOf (it filtered by email). Run (mote, at this commit): - go test -timeout 45m -count=1 ./internal/provider ./internal/cli: ok (104.9s, 33.2s). - TestAccountsAliasPicksTheAccount, new: switch, alias, pool --accounts and account-cap by name; a shared name and another account's email refused. Red with each part removed by hand: the accountNamed call, pool's resolution, the clash check, the shared-name check, accountRef's name step. Not run: the GUI suite (no GUI file changed); real accounts. |
||
|
|
15b83901ac |
accounts: switch to the next account with room, or the one with the most left (#4532)
StringKe (#4532), comparing magpie with cswap 0.29.0: there was no "switch to the next account", and when every account was past its line the automatic switch stayed on the spent one, where cswap moves to the account with the most room left. - `magpie accounts switch <claude|codex> next` (provider.NextInOrder) takes the other accounts that are on in magpie, from the one after the account the agent is on, wrapping round: the first whose allowance is known and has room, else the one with the most room left, and says it is past its line. A saved Claude account not read yet is read first (readSpare), as the automatic switch's spares are. With no reading of any it refuses rather than guess; for any other agent it asks for the account by name. - NextLogin (shared by Codex and Claude Code): when the account the agent is on is spent and every spare is past its line too, it moves to the spare 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 at least roomMargin (1 point) more than the one it is on, so two all but even accounts don't trade the agent each look. A held, failed or unknown reading is never moved to. One model's own window still counts for nothing, as before. - docs: reference.md (the automatic switch and `next`; its "a Claude account magpie knows nothing of is not moved to" was stale since readSpare), providers-accounts.md's Used-up switch row, the en/zh/ja start pages' command table, `magpie help`. Run (on mote, sandbox HOME through the packages' TestMain): - go test -timeout 45m -count=1 ./internal/provider ./internal/cli: ok (144s, 44s), at this change's tree before the next commit's edits. - TestNextLoginTakesTheMostRoomWhenAllArePast and TestNextInOrder, each over codex and claude with three accounts: green; red with the fallback taken out of NextLogin (the two "most room" cases, both agents) and with NextInOrder not starting after the signed-in account ("the one after it", both agents). The "none has more by the margin" case fails without roomMargin. - Built the nogui binary and ran in a fresh sandbox HOME on mote: `accounts switch claude next --help` (prints the accounts help), `switch claude next` and `switch codex next` with no accounts ("has no other account that is on"), `switch gemini next` (asks for a name), `switch claude nxt` (no such account), `switch claude` (usage). - gofmt -l clean. Cross-OS vet: run at the head of this stack. Not tried: a real switch between real Claude or Codex accounts; the CLI `next` with real saved accounts (the provider tests cover the choice). |
||
|
|
fbb1b36d1f |
provider: the Claude keep-alive keeps off accounts, its reading, and its turn (#4532)
stringke read |
||
|
|
b48881f507 |
provider: keep idle saved Claude accounts signed in, by Claude Code itself (#4532)
#4532: a saved Claude account switched on but not needed for weeks (switch-only) had nothing run on it, its refresh token sat idle, and it was found signed out when the switch wanted it. Codex's saved sign-ins already had a keep-alive (RenewLogins, every 8 days, one account an hourly look). The same loop now takes saved Claude accounts that are on, not Claude Code's own, not added by setup-token and not already signed out (claudeKeptAlive). For one that is due it has real Claude Code run /usage in the account's own CLAUDE_CONFIG_DIR, the path a card's refresh takes (readSavedClaudeUsage, inSavedClaudeDir), and syncSavedClaude keeps whatever sign-in Claude Code refreshed. magpie asks Anthropic nothing itself: no OAuth or usage endpoint, as removed in |
||
|
|
a45a0f1c5d |
signin: Settings can keep sign-in pages out of the default browser (max2020)
max2020 on Discord signs in from a separate, fingerprint browser so the vendor never sees their default one. Every waiting sign-in already shows its link with Copy link (since |
||
|
|
3b5dccd527 |
accounts: a plugin account goes by its usage's name, not its id (#4416)
A Huawei Cloud CodeArts account is kept by its accountId, an IAM id (iam::<domain>:user:<name>), and every list showed that id while its quota card showed the masked phone the plugin's usage() names it by. Display only: an account now reads as the name the user gave it, else the `user` its plugin's last usage read gave (PluginUserOf: the in-memory read, else quotas.json), else its id. The id stays the key everything is kept by; nothing stored changes or migrates. A read that fails keeps the last good name; nothing read yet is the id, never blank. One rule in provider (AccountShown, AccountShownOf, AccountLabelOf), used by every list: cards' Alias (Usage page, tray panel, /v1/magpie/quotas, magpie quota), magpie accounts, magpie providers, the TUI's Providers rows and quota titles, usageapi's Account filter, the quota alert. The GUI gets it as /api/providers' accountUsers (accountShownOf in app.js): the editor's account rows (the id in the tooltip), the per-account proxy lines, Routing's userShown, the Providers search, Hide accounts. app.js's account lookups share one helper, so the core stays in its budget (1,536,561 of 1,536,586), with no room added. Run: - go test ./... -timeout 45m on mote at |
||
|
|
d99e213f5b |
codex: an account switch restarts nothing while Codex's provider takes no ChatGPT account
danzi002 on Discord: with requires_openai_auth = false on Codex's provider,
switching the Codex account in magpie still restarted the Codex app's
app-server and said the app and daemon were left on the old account.
Codex's provider with no requires_openai_auth = true goes by no ChatGPT
account: codex-rs ModelProviderInfo::account_state answers no account, and
resolve_provider_auth sends the table's key, never auth.json. So which
account auth.json holds is nothing a running Codex uses.
- provider.CodexNoAccount (set to agent.codexNoAccount): the config's top
model_provider is not openai, has a [model_providers] table, and the table
doesn't say requires_openai_auth = true. A profile, the built-in provider,
no table or an unreadable config count as false (may use the account).
- codexAppStep forgets a switch (and a spent switch) while it holds, so the
app-server is left running; a route change still restarts it.
- CodexAppStale / CodexDaemonStale say nothing, and `magpie accounts`'
switch line says nothing needs restarting.
- Kept: route-change restarts (model_provider, openai_base_url,
model_catalog_json, base_url, catalog hash: read only as the app-server
starts) and the daemon's model-list restarts; and switch restarts when
magpie writes requires_openai_auth = true (ChatGPT sign-in with room).
Run (mote-run; full suite at this change on
|
||
|
|
628ac36fc9 |
agents: Add magpie says when nothing here opens the app's import link (sungt)
sungt (Discord #feedback, Windows, magpie 0.1.1976, Cindy 0.1.119, Cindy
open): on the Agents page Cindy's 添加 magpie "spins, no response".
What magpie got wrong: Cindy, AionUi and Lody take magpie only through
their import link, which magpie hands to rundll32 / open / xdg-open and
never waits on. A link nothing opens did nothing, the button never awaited
/api/open nor caught its error, and `magpie cindy add` printed "opened"
whatever happened.
- agent.OpenAppLink asks the system, without opening anything, whether
something opens the link's scheme: Windows' HKCR\<scheme> (what
Electron's setAsDefaultProtocolClient writes) and then the user's
UrlAssociations UserChoice; macOS Launch Services (cgo builds); Linux
`xdg-mime query default`. Only "none", or a registered program whose
full path is gone, refuses the link (NoLinkHandlerError); anything
unknown hands it over as before.
- /api/open (Cindy, AionUi, Lody after OpenLody) answers
code no_link_handler with app, exe and said, an i18n.js key from
linkSaid that api() puts through t() as it does bunSaid's.
- The import button now waits for /api/open and shows the result: "Sent
to {name}: confirm adding magpie there", or the reason in the
reader's language.
- The CLI's add returns the same error.
This is not verified as sungt's cause. Cindy was open, and Cindy
registers cindy:// at every start, so the check most likely passes on
their machine. If so, the spinner is Cindy's own import dialog
(previewProviderImport / fetching magpie's /v1/models). Cindy 0.1.119
wasn't available here. We still need Cindy's log around "received deep
link" from sungt.
Run (worktree at origin/main
|
||
|
|
ec3dad75ae |
provider, gateway, gui, cli: Claude's accounts can be kept to Claude Code's own sign-in, magpie serving nothing on them (myduso)
myduso on Discord asked for an exclusive mode on Claude's subscription: switch the credentials locally and proxy no traffic, since Claude Code is used on its own and the SDK run magpie's bridge makes spends more of the allowance than the interactive client. The switch-only setting Codex has (#1907) now also takes claude. On it, Provider.KeptToAgent is true and On() false, so the gateway, catalog, groups, fallbacks, search, draw and embeddings serve nothing on the Claude accounts, and a request naming them is refused 404 saying they are kept to Claude Code's own sign-in and how to undo it (switchedOff). Switching Claude Code's sign-in when an account is used up, and reading usage, go on: both are gated by leftAlone on the raw Off, which this doesn't set. Groups magpie found keep their Claude members (heldOffEntries). Nothing is sent as Claude Code: magpie only writes and restores Claude Code's own credentials as it already did. GUI: the tick under Claude's accounts, shown with one account too, drawn by the block Codex's tick had (one block now, its strings picked by agent). app.js stays under its budget with no raise (1,311,711 of 1,311,735). CLI: magpie accounts switch-only <codex|claude> [on|off]. Docs: reference.md, subsystems/providers-accounts.md. Run on mote at this tree on 06950fbbb; then rebased on |
||
|
|
8bade6c5e2 |
provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.
- host.js passes a finite balance on (at least 0), anything else as null.
plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
Aside, so routing knows the account with no Used invented. allowanceOf
copies it into Limit.Balance; an empty wallet counts as used up.
Allowance.Left(model) is the least balance of the windows that count
the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
provider and unit). Smart, pace and usage (least used) put the seat
with more left first where they would otherwise tie (byLeft), only
when every seat with a balance shares one LeftIn: balances in two
units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
text, no bar, a why sentence, the account list), magpie accounts and
the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
providers-accounts, plugin-runtime, host.js typings and the site's
plugins page (en, zh, ja).
Run, at base
|
||
|
|
1dfa284840 |
usage: a plugin's row of text alone shows its text, not "· 100% left"
AutoClaw's 积分余额, Cline's balance, Cursor's Auto + Composer note and
the other plugin rows that are only words come to magpie as a window set
aside with a display and nothing counted (used 0, no amount, no limit).
Every surface read that used 0 as a share: the usage card said
"1,234 积分 · 100% left" (or "· 0% used") beside an empty meter, the
panel drew an empty ring, the TUI an empty bar, `magpie accounts` and
`magpie quota` "积分余额 0% (1,234 积分)", and the status line
"积分余额 0%".
provider: QuotaWindow.Text (json "text") marks such a row in
quotaOfPlugin: aside, a display, used/amount/limit all 0. Aside is
required: Cursor's On-demand "$0 / $20" isn't set aside and is a real
0%. QuotaSpan carries it to /api/quotas.
GUI (app.js): quotaText gives the display alone; the account row's
meter, the Usage page's track and the panel's rings leave the row out;
a panel card with only such rows shows their text on its line, as an
Unlimited card does. The tray's menu-bar text already skips aside rows.
TUI quotaCell, the CLI's quotaCell (accounts, quota) and statuslineCard
write the name and the text.
app.js stays under its budget (1,322,289, not raised; now 1,322,275):
to make room, the 8 copies of Math.max(0, Math.min(100, x)) are one
to100(x), and 8 one-line [..].filter(Boolean).join("\n") tooltips are
tipLines(..). Same results; the GUI files below cover those callers.
Readings cached before this release have no text flag and show as
before until the account is read again (a minute's cache, or Refresh).
Run, at this commit's tree (rebased on origin/main
|
||
|
|
5b2b3d3f50 |
providers: a switched-off provider says how to turn it on, after a sign-in too
Atlas (Discord) signed in to WorkBuddy AI with `magpie plugin login
workbuddy-ai`, and `magpie providers` then showed "○ switched off" with
nothing saying why or how to undo it. magpie never sets Provider.Off by
itself; only the user's own switch does, and a sign-in rightly keeps it.
So the setting stays as the user left it, and magpie now says how to
change it:
- `magpie plugin login <id>` and `magpie accounts add <id>` (plugin and
built-in paths), finishing for a provider that is switched off, print
"! <Name> is switched off in magpie, so agents aren't given its models
· turn it on: magpie provider on <id>". One that can't be found says
nothing (not known to be off).
- `magpie providers` puts "magpie provider on <id>" in the switched-off
row's last, unpadded column, so the key column keeps its width.
- The TUI's Providers row notes "o switches it on" (its `o` key).
- The GUI row already shows a "Switched off" badge and its own switch,
and the editor says how to switch it on: left alone.
Run, at this tree (base
|
||
|
|
ed91aa04ef |
checkin: an inactive or ineligible check-in shows the plugin's reason (plugins#304)
Qoder's plugin 0.2.32 (magpie-community/plugins 74be632) says why no check-in was offered: it asked with this machine's own device identity and Qoder offered no campaign, and Qoder desktop can claim one it shows. magpie dropped a hook's message for inactive and ineligible and showed only "No check-in event now". Now: - GUI: the Usage card's row reads "<label> · <message>", wrapped under the label rather than cut off with "…" (data-why, as a failed row's reason wraps, #821); Settings' check-in line under the plugin's switch carries it too. A result without a message reads as before. No new i18n keys: the message is the plugin's own text, as for failed rows. - TUI: the Usage cell is too narrow, so it adds "c says why"; c's flash carries the message (checkinWhy). - CLI: `magpie accounts checkin` prints it after the label. - The Qoder mover's min is 0.2.32 (npm view --prefer-online: 0.2.32). - docs/subsystems/provider-plugins.md says how the message is shown. Run at this tree (based on origin/main |
||
|
|
45fa29973c |
checkin: an early "already checked in" is asked again, not kept for the day (#3326)
connoryang331 (v0.1.1328, Windows): at 00:00:28 Beijing 14 of 29 plugin
check-ins (AutoClaw CN x5, WorkBuddy x2, CodeArts, Trae x3, MiniMax,
Raccoon x2) answered "already" (done). magpie kept that as the day's
result and never asked again, and Check in now answered from the record
without asking. A real claim at 10:54 paid +200: the vendors' days turn
later than Beijing midnight, so 00:00's "already" was yesterday's.
The class, in the checkiner every check-in shares (built-in and plugin):
- A done, inactive or ineligible answered before noon Beijing
(checkinSureHour) for an account magpie hasn't seen claim that Beijing
day is provisional. The loop asks it again 30 minutes (wbCheckinEvery)
after the answer, until a claim or an answer from noon on: at most 24
more asks a day per such account, none once magpie claims.
- A press (soon) asks again at once for done, inactive and ineligible,
whatever the hour. own-app (Trae 9074) and captcha still stand.
- A claim stamps Claimed, carried over while later answers that day say
done, so a done after magpie's own claim is settled (Qoder's claim then
done case).
- The record goes out with again: true (worked out when shown, never
kept). The card says "{name} says already checked in; its day may not
have turned yet, so magpie asks again later" and keeps Check in now;
Settings, TUI and CLI say the same. en, zh, zh-TW, ja, de.
- Qoder's recheck (#2696, pluginRechecks) is unchanged: its tests pass
as they were.
The plugins repo does not cache "already": autoclaw reads the task list
or calls dailySignin each time, codearts, minimax, raccoon and trae ask
the server each call (read at magpie-community/plugins origin/main
652f06d). No plugin change, publish or mover min.
Tests:
- TestPluginCheckinEarlyDoneAskedAgain (the reporter's 00:00:28: loop at
+29m no ask, +30m asks then claims; a press at 10:54 claims; done all
day is 25 asks and settles at noon; done after magpie's claim settled)
and TestWorkBuddyCheckinEarlyDoneAskedAgain.
- TestPluginCheckinOthersSettledForTheDay now answers at 12:00 Beijing
and checks a press asks again (claimed still settled);
TestPluginCheckinRunsAsTheBuiltinsDo, TestTraeCheckinAnswers and the
WorkBuddy nothing-to-claim/refused tests follow the new rule.
- TestCheckinAgainNotShownAsToday (TUI words and cell).
- checkin-early-done.test.cjs: again card's wording, data-state wait,
Check in now asks plugin-checkin {provider: autoclaw-cn}; a kept done
is "Checked in today +50" with no press. Chromium and WebKit, 5
languages, 900 and 440px, 20/20.
Red on the old code: with the non-test change reverse-applied (fields
kept so it compiles), TestPluginCheckinRunsAsTheBuiltinsDo,
TestPluginCheckinOthersSettledForTheDay (inactive, done, ineligible) and
all 4 subtests of TestPluginCheckinEarlyDoneAskedAgain fail; with
origin/main's app.js, checkin-early-done fails ("Checked in today").
Run at this tree:
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... clean.
- go test -tags nogui ./internal/provider/ -run 'Checkin|CheckIn',
./internal/tui/ -run 'Checkin|OwnApp': ok.
- GUI: checkin-account, checkin-early-done, i18n-keys, plugin-checkin,
qoder-checkin-recheck, usage-card-refresh, usage-checkin: 177/179. The
2 reds are usage-checkin's "webkit en/zh: Settings has a Qoder check-in
tab", red the same alone on origin/main
|
||
|
|
6da19bf181 |
provider: Factory's built-in is retired; its plugin serves it
"factory" joins retiredBuiltins: every Factory account is served by
@magpie-community/opencode-factory-auth, and the hourly MoveRetiring
moves the ones still on the built-in.
Removed: the built-in's sign-in (factory_signin.go, WorkOS's device
flow), keeping the sign-in (renew, lapse, org reconcile and mend,
headers, factoryGet), its provider and account (factoryProvider,
factoryAccount, factoryAlsoOn), its login list, switch, on/off and
forget, its usage card (factoryLoginQuota), droid's prompt and body
rewriting (factory_client.go), and its rows in signin.go, logins.go,
logins_on.go, login_usage.go, subscription_usage.go and account.go.
zcodeDecode/Encode, kept in zcode.go only for factory_client.go, go
with it. An API key always goes to the plugin now (factoryAddKey), and
`magpie accounts import factory` keeps saying to add it with accounts
add factory; its dead import branches are gone.
Kept: the mover and what it reads (factoryLogins, factorySaved,
factoryCreds, factoryMu); ImportFactoryKeys, factory_key.go and
factoryWhoami, for "Use an API key instead"; droid's model table with
factoryAPIs and factoryCore, since the plugin's provider is named
"factory" (account.go APIs, FactoryGemini and servedByFactory still
answer for it); factoryAPI for the moved provider's host
(builtinHost); factory_usage.go's limits reader behind
FactoryAllowanceForTest, which the gateway's pool tests use; the
gateway's "factory" lists (estimatedMoved, the account check), as the
Zed commit kept zed's; the parity tests.
Tests:
- git rm'd, built-in only: factory_test.go (sign-in, refresh, accounts,
orgs), factory_client_test.go, gateway factory_agents_test.go
(droid's line on every wire, the generate route to chat) and
factory_think_off_test.go (TestPluginThinkingOff covers the plugin);
TestFactoryAPIKey, TestFactoryKeyAgainReadsUsageAfresh,
TestFactoryServesModelsAddedSinceItsFetch, TestUserAgentAccountUntouched
(TestUserAgentFor still covers an account's User-Agent).
- Changed meaning: TestGeminiEmptyReplyIsAnError,
TestGeminiEmptyRepliesAskedAgain and TestGeminiImageModelReturnsItsImage
used Factory's generate route as a fake-able Gemini upstream; they now
use a Gemini API of the user's own (saveGem), the same decoder, and the
image test checks :streamGenerateContent instead of /api/llm/g/v1/generate.
TestMovedShowsBuiltinHost's first check is now a plain plugin
(fakeco), and a retired Factory with no migration record shows
api.factory.ai. TestFactoryAPIKeyMoved checks factoryLogins() is empty
instead of the removed factoryLookup. factorySite/factoryJSON moved
into factory_key_test.go.
Run in this worktree:
gofmt -l internal: nothing
go vet -tags nogui ./internal/provider ./internal/gateway ./internal/cli
./internal/gui, GOOS=darwin, linux, windows: clean
staticcheck -checks U1000 -tests=false (darwin, windows) on
internal/provider: nothing new
go test -tags nogui -count=1 -run 'Factory|Gemini|PaymentRequired|
ResetsInWords|UserAgent|UsedWindow|Vertex|PayloadTooLarge|UsageCache|
AnthropicImage|ThinkingOff|Moved|Retired|Mover|Migrat|Move|
SayTheirPlugin|Allowance|Discovery|ClaudeModels|GrokPrice|
LoopbackSignIns|AsksOwnBackend|SideLogin|Import|Accounts|ZCode|MiMo'
on the four packages: ok (all four); TestFactoryAPIKeyMoved ran with
Bun (PASS), not skipped.
Not run: whole packages, the full suite, the GUI suite (machine load
~300). Not tried with a real Factory account. docs/subsystems not
changed, as for Zed.
|
||
|
|
0f1666b387 |
provider: a built-in can be retired, its plugin serving it moved or not, and its unmoved accounts get a Move line
The owner (10-16) wants every deprecated built-in taken out of magpie,
one at a time. This is the ground for that; it retires nothing yet.
- retiredBuiltins / BuiltinRetired(id) in migrate.go name a built-in
whose code is gone. Only an id with a mover can be retired.
- PluginServes(id) is Moved(id) or retired. Every gate that asked
Moved(id) asks it now: sign-in, Factory keys, usage, logins, cards,
forget, accounts, check-ins, plugin sign-in, the CLI's accounts and
providers, the GUI's account label.
- A retired row's move.state is plugin, and its id is in onPlugins
once the plugin is installed.
- /api/providers lists a retired subscription's built-in accounts that
haven't moved in `unmoved` (MoveCandidate, now with the failed move's
error and why). The GUI shows a quiet line over the Providers list
for each, with Move / Try again (unmovedLine), in en, zh, zh-TW, ja
and de.
- AGENTS.md and docs/subsystems/provider-plugins.md say what a retired
built-in is.
Run at 270aa1c9c with this change:
- go test -tags nogui ./... -count=1 -timeout 90m: 66 packages ok.
- gofmt -l internal: nothing. GOOS=linux and GOOS=windows
go vet -tags nogui ./...: clean.
- GUI, both engines, en and zh: retired-move (new, 4/4), plugin-move,
deprecation-notice, deprecated-subscriptions, plugin-move-unserved,
plugin-movable-review, i18n-keys: 39 pass.
- TestRetiredBuiltinIsThePlugins -count=20 (it picks a mover at random).
The Move line is the Providers list's own, not a page that could be a
plugin. It took the core's scripts to 1,427,218 bytes, which the budget
main raised in
|
||
|
|
e894443932 |
trae: a check-in Trae CN refused 9074 says Trae refused it and to check in in the Trae CN app, not that Trae pays only its own app (#1920)
#1920 showed Buddy Switch checking in third-party Trae CN accounts, so
"Trae CN only gives check-in credits to its own app" wasn't true. What is
known is that Trae CN answered the claim 9074 (当前参与用户太多). The
own-app outcome stays as it was (the day's answer, no Check in now), but a
Trae account (By "trae") now has its own text in every place it shows:
- GUI card and Settings line: two new keys in en, zh, zh-TW, ja and de
("Trae CN refused this check-in (9074: too many taking part); check in
in the Trae CN app" / "Trae CN 拒绝了这次签到(9074 当前参与用户太多),
请在 Trae CN App 里签到"). WorkBuddy keeps the shared own-app key.
- TUI line and cell, CLI: provider.TraeRefusedWords; the cell says
"签到 refused by Trae CN (9074) · check in in its app".
- trae_checkin.go, workbuddy_checkin.go and provider-plugins.md comments
and the claim's fallback message say the same. They also note the
plugin side: since @magpie-community/opencode-trae-auth 0.2.14 the
account the machine's own Trae CN client is signed in as checks in with
the client's device id, read only. No id is made up or rotated (#1705).
Ran (worktree at origin/main
|
||
|
|
00afcf97a1 |
provider, gui, cli: a Codex account's auto-use of its resets is two switches, its week used up and one about to expire (#2078, alanwalk)
alanwalk asked for "自动使用重置卡" to be split: they want a reset that is
about to expire used rather than lost, but a used-up week waited out rather
than spending a reset on it (and the other way round for others).
What changed:
- settings: codexAutoResetOnly narrows an account in codexAutoReset to
"week" or "expiring". An account with no entry keeps both, so every
existing config means what it meant: nothing to migrate, and no user
value is rewritten. Load drops entries for accounts not in the list or
with an unknown value.
- provider: CodexAutoResetWhen(user) reads both times. AutoUseCodexReset
(the week used up, called from the gateway's autoReset and
autoResetSignedIn through AutoResetsWeek) only acts when the week is on;
SpendExpiringCodexResets and routing's resetRunsOut only count on the
expiring reset when that is on. SetCodexAutoResetCase(user, when, on)
sets one time and keeps the other; SetCodexAutoReset still sets both.
Both off removes the account.
- gateway: POST /api/settings/codex-auto-reset takes an optional "when";
POST /api/settings keeps codexAutoResetOnly, which the page doesn't send.
- GUI: the account's card (Usage page and the menu bar panel) says
"Auto-use resets:" with each time on its own line and its own switch;
the brief account's one switch still sets both, its title naming each
time; Settings › Usage gives each account an Off/On per time. The status
line says which times are on now. "· auto-used before it expires" on
the resets held follows the expiring switch alone. Strings in zh, zh-TW,
ja and de.
- CLI/TUI: `magpie quota auto-reset <account> week|expiring on|off`; the
quota and accounts tables and the TUI say "auto", "auto when the week
runs out" or "auto before one expires".
What was run (worktree on origin/main
|
||
|
|
b319657301 |
gui: a sign-in whose browser didn't open says why and shows its link, and Windows names rundll32 by its path (#2043)
xiaobaifly7: on Windows, signing in to Cloudflare's MCP server (and any
sign-in) opened no browser, and the window said to finish in the
browser until the sign-in timed out. Wails' Browser.OpenURL starts
rundll32 by its bare name, which Go looks up with PATHEXT's extensions;
a PATHEXT without .EXE (WSL passes one on as ".CPL") finds nothing, and
host.OpenURL dropped the error.
- proc.OpenBrowser starts %SystemRoot%\System32\rundll32.exe by its
path (open / xdg-open / termux-open-url elsewhere) and returns the
launcher's error. host.OpenURL falls back to it when Wails' fails, and
the CLI's account sign-in uses it.
- Windows.OpenURL returns the error. /api/signin, the plugin sign-in and
/api/library/mcp-signin answer it as openError; /api/open fails with
it, so Open again says why.
- The sign-in card shows "magpie couldn't open your browser: {error}.
Open the sign-in link below in a browser yourself." where it said
magpie opened the page, with the link already shown below; the MCP
editor shows the error with the link and a copy button. Translated
(zh, zh-TW, ja, de).
- Open again matched its sign-in by identity, so a poll that put a fresh
copy of the same sign-in in place kept the old error after a
successful retry; it now matches by id.
Run:
- TestBrowserNamesRundll32ByItsPath, TestMCPSignInSaysTheBrowserDidntOpen
and the /api/open and /api/signin tests in signin_open_2043_test.go.
Broken by hand: the bare name back in browserCommand fails the first;
openError returning "" fails the gui tests.
- On the Windows box (amd64, cmd with PATHEXT=.CPL): exec.Command
("rundll32", ...).Start() gave `exec: "rundll32": executable file not
found in %PATH%`; proc.OpenBrowser started it (nil). The proc test
binary's TestBrowserNamesRundll32ByItsPath passed there.
- signin-browser-down.test.cjs (new): the card's text, the link, no
sideways overflow, Open again failing then succeeding, and the MCP
editor's error and link, in Chromium and WebKit at 1100 and 420 in
every language: 20/20. The related sign-in GUI tests: 451/452, the
one a signin-proxy flake also on main (fixed in its own commit).
- gofmt -l clean; go vet darwin, linux -tags nogui, windows; GOOS=linux
and windows builds; go test -tags nogui ./internal/gui/
./internal/proc/ ./internal/cli/.
Not tried: the real Wails app on Windows under PATHEXT=.CPL (the
fallback path is exercised only through proc.OpenBrowser), WSL itself,
the reporter's machine. Not covered: internal/tui/sessions.go and
internal/provider/install.go start `powershell` by its bare name, which
would miss the same way under such a PATHEXT.
|
||
|
|
d6fd9b3a36 |
provider, agent, gui, cli: Codex can switch only its own sign-in between accounts, never through the gateway (#1907, foobra)
foobra wants Codex Desktop and the CLI kept on their own ChatGPT subscription, moved to the next saved account when the signed-in one is used up and back when it resets, without magpie's gateway in the way. magpie already did the switch (codex_switch.go: 98%, 100% In order, back under 90%, unknown usage never switches), but with more than one Codex account on it also wrote openai_base_url into config.toml so a refused request fails over through the gateway (codexFailover). There was no way to have the first without the second. Now Codex's subscription has SwitchOnly (providers.json "switchOnly", opt-in, off by default so nothing changes for anyone who doesn't tick it): - provider.SetSwitchOnly / provider.SwitchOnly; only Codex's own subscription takes it. An unreadable providers.json reads as on, so magpie's own failover is never written on a guess. - agent.codexFailover is false when it is on: no openai_base_url, no failover note, no magpie models in Codex's list. A base URL the user wrote stays. - The account Save copy keeps it. - GUI: "Only switch Codex's sign-in" tick under Providers > Codex's accounts (with more than one on), posting provider/switchonly; the Agents row's failover title points at it. zh, zh-TW, ja, de. - CLI: magpie accounts switch-only codex [on|off]. - docs/reference.md and providers-accounts.md say what it does and that an open Codex app or app-server stays on its account until reopened. Run (darwin, sandbox HOME, -tags nogui): - go test ./internal/provider -run 'TestCodexSwitchOnly|TestCodexSwitchedWhenUsedUp|KeepLogin' - go test ./internal/agent -run 'TestCodexSwitchOnly|TestCodexFailover|TestCodexOwnModelThroughMagpie|TestCodexHandWritten' - Broken by hand, each red: codexFailover guard removed (agent test), SwitchOnly dropped from the Save copy, SwitchOnly reading false on an unreadable file (provider test), the tick drawn unticked (GUI, 16/16). - GUI: switch-only (new), keep-login, agent-failover, gui-ja, gui-de, gui-zh-tw in Chromium and WebKit, en/zh/ja/de at 1100 and 420: 77 pass. - The built binary's `accounts switch-only` in an empty sandbox HOME: reads off, refuses on with no Codex provider, refuses claude. - gofmt -l clean; darwin go vet. Reviewed and rerun after rebasing onto |
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |