Commit Graph
43 Commits
Author SHA1 Message Date
yetone 27a0cbd178 zcode: the mover's min is 0.1.40, the plugin that holds two accounts at once
01huadalang on Discord (#feedback): three ZCode accounts used at once
from one address had the address refused with a 405. zcode 0.1.40
(magpie-community/plugins 26864ec) declares maxAccounts 2, which the
previous commit's Accounts at once reads; keepMovedCurrent now updates
every moved user's plugin to it.

npm view @magpie-community/opencode-zcode-auth --prefer-online: version
0.1.40, magpie { maxAccounts: 2, maxConcurrency: 3 }, checked when this
landed. Run: internal/provider at this head with the commit before
(see its body). Not tried: a real ZCode account's move (none used, per
the task).
2026-11-01 07:39:08 +08:00
yetone 59109044c6 provider: the ZCode mover's min is 0.1.39, gift plans are also claimed from the ZCode app's banner feed (plugins#503)
Plugin 0.1.39 (magpie-community/plugins 2e580cf) reads the ZCode app's
claim banners from GET /api/v1/marketing/touch as well as
billing/preview. A banner plan (ZCODE WEEKEND BUILD, 10-30) is in
neither billing list while the app shows it, so the daily check-in said
there was nothing to claim (kongbai01203's capture on plugins#503). The
claim itself is the same POST /billing/claim; a list that doesn't read
is a failed check-in, asked again later. keepMovedCurrent brings every
moved ZCode user to it.

Run on mote, worktree at origin/main ec5571d6f + this change:
gofmt -l clean; `go vet`, GOOS=linux and GOOS=windows `go vet` of
./internal/provider/ ok; `go test -timeout 45m ./...`: every package ok
except internal/gui, whose ten real-window AppKit tests (TestPanelCloseHidesIt,
TestDockJoinLeadsCommandTab, TestMainWindowCorners, ...) were killed at
their 20-80s deadlines on mote, filed as #4125 and #2645; this change
touches only a string in internal/provider. Rebased onto 5bb252c8f
before the push; `go test ./internal/provider/` at the pushed tree: one
red, TestQuotaSpanCarriesEveryWindowField ("trayKind" isn't on
QuotaSpan), from 7d4a63148 on main, filed as #4457. `npm view
@magpie-community/opencode-zcode-auth version --prefer-online
--registry=https://registry.npmjs.org/` says 0.1.39. The plugin's own
record (zcode 178 pass, 3 red on the old code, dedupe and unread-list
returns broken by hand) is in 2e580cf.

Not tried: a real banner claim through the plugin; its feed fixture is
built from the capture's description of the fields.
2026-10-30 23:25:48 +08:00
yetone c28cc5c87a provider: the ZCode mover's min is 0.1.38, freeFirst spends a dual account's gift first (plugins#505)
Plugin 0.1.38 (magpie-community/plugins 5a9c776, jinpy666's #505) adds
freeFirst, an option off by default (Plugins › Options, or
provider.zcode.options): a plain model request on an account with a GLM
Coding Plan and a live gift spends the gift first, under the name the
gift lists, and any gift failure (spent, block page, 4xx/5xx, its busy
cap waited out, a network throw) is replayed on the coding plan in the
same request; a caller's abort stays an abort. keepMovedCurrent brings
every moved ZCode user to it.

Run (on mote, worktree at origin/main + this change): `go test -timeout
45m ./internal/provider/` ok; `go vet`, GOOS=linux and GOOS=windows `go
vet` of ./internal/provider/ ok; gofmt -l clean. `npm view
@magpie-community/opencode-zcode-auth version --prefer-online
--registry=https://registry.npmjs.org/` says 0.1.38. The plugin's own
review (zcode tests 173 pass, check.mjs ok, abort guard broken by hand
red) is in #505.

Not tried: freeFirst against a real dual account; the plugin's tests run
against a fetch fake.
2026-10-30 14:36:55 +08:00
yetone b26fa09037 provider: the ZCode mover's min is 0.1.37, an account with no gift plan to claim isn't a failed check-in (hykql on Discord)
hykql (v0.1.2143) saw every ZCode account's daily check-in say "签到失败,
magpie 稍后重试 · gift plans to claim: no plan list in the reply". ZCode's
billing/preview answers an account with nothing to claim with
{"code":0,"msg":"","logid":…}, no data at all, which 0.1.35/0.1.36 took
as unreadable. Plugin 0.1.37 (magpie-community/plugins 7673cd0) reads it
as a list of none, so the check-in is "inactive" (the Usage page says
"No check-in event now"). keepMovedCurrent brings every moved ZCode user
to it.

Run (on mote, worktree at origin/main + this change): `go test -timeout
45m ./internal/provider/` ok; `go vet`, GOOS=linux and GOOS=windows `go
vet` of ./internal/provider/ ok; gofmt -l clean. `npm view
@magpie-community/opencode-zcode-auth version --prefer-online
--registry=https://registry.npmjs.org/` says 0.1.37.

Not tried: a real claim of a plan (no account has one to claim now).
2026-10-30 13:59:18 +08:00
yetone 9e8c22dad8 provider: the ZCode mover's min is 0.1.36, gift buckets named by model first (plugins#504)
Danbuth's GLM Coding Max account held ZCode's Start Plan (ZCODE GLOBAL
BUILD) and read the card as having none: the plugin showed it as the
third ring, "ZCODE GLOBAL BUILD · GLM-5.3-Trial", which the ring cut to
"ZCODE GLOBAL BUI…". Plugin 0.1.36 (magpie-community/plugins 63748b9)
names a gift bucket by its model first, as ZCode's own "Today's balance"
lists it, then its plan. keepMovedCurrent brings every moved ZCode user
to it.

Run (on mote, worktree at origin/main + this change): `go test -timeout
45m ./internal/provider/` ok; `go vet`, GOOS=linux and GOOS=windows `go
vet` of ./internal/provider/ ok; gofmt -l clean. npm view --prefer-online
says 0.1.36.

Not changed: the tray panel shows at most three rings and the account
row two windows, so beside a Coding Plan's 5h and weekly only one gift
bucket is on the panel; the others are in its tooltip and on Usage.
2026-10-30 10:36:28 +08:00
yetone 484bdca7c7 provider: ZCode's mover min is 0.1.35, whose daily check-in claims the account's gift plans (plugins#503)
zcode 0.1.35 (on npm, checked with `npm view --prefer-online`) adds
auth.checkin: magpie's daily check-in reads ZCode's billing/preview and
claims each listed plan, judged by the reply's code (0 claimed, 1003
claimed before, 3007 captcha: claimed in the ZCode app; anything
unreadable failed, never claimed). It runs only once the user turns
ZCode on in Settings -> Daily check-in: PluginCheckinOn has no inherited
default for zcode, so it is off for everyone until then.
keepMovedCurrent brings every moved user's plugin to it.

Run: `go test ./internal/provider/` on mote, ok (90.98s), at this tree
(origin/main cdf8151a2 plus this one line).
Not tried: a real claim answering code 0; no account has a plan to
claim now (plugins 8ebbaa5's body has the rest).
2026-10-30 08:29:43 +08:00
yetone d9431dd2ec provider: ZCode's mover min is 0.1.34, whose card names a gift plan that starts later
windy (Discord): with a GLM Coding Plan, ZCode's card didn't tell the
Coding Plan's allowance from the Start Plan's, and a Start Plan taking
effect at 23:00 today wasn't shown. Fixed in the plugin
(@magpie-community/opencode-zcode-auth 0.1.34, plugins 3b3209e): a plan
whose starts_at is still to come is named in an aside line "ZCode gift
plan not started yet" with its start, and gets no requests before it;
beside a Coding Plan every gift bucket is prefixed with its plan's name.

- migrate_zcode.go: min 0.1.34, so keepMovedCurrent updates moved users.
  npm view --prefer-online served 0.1.34 before this commit.
- i18n.js: the new line's name in zh, zh-TW, ja and de.
- quota-name-translated.test.cjs: the not-started line is checked like
  the claim line, every language at 440/560/1000px in both engines.

Run on mote at this tree: gofmt -l clean; go vet ./internal/provider/
for darwin, linux (-tags nogui) and windows ok; go test -timeout 45m
./internal/provider/ ok; node --test quota-name-translated, i18n-keys,
quota-name-wrap and gui-ja, 29 pass 0 fail (chromium and webkit).

Not tried: a real account with a plan not started yet; which status
ZCode gives such a plan is unknown, the plugin goes by starts_at.
2026-10-29 22:38:16 +08:00
yetone 729d5d0c4c provider: zcode's mover min is 0.1.33, for a ZCode 3.16 sign-in's coding plan models (plugins#439)
dinghao-8 (plugins#439): a ZCode 3.16 sign-in that keeps only a
project-key-location record listed the Start Plan's models, without
GLM-5.3, since the plugin's models() read the sign-in without fetching
its key. 0.1.33 (plugins 2ef8b8b) reads the key first; npm shows 0.1.33
(npm view --prefer-online).

Run: `go test -count=1 -timeout 45m ./internal/provider/` at this tree with
both min raises applied, skipping four reds that are red on origin/main
e54a7d50b without them (run there by name): TestUnreadLoginsWriteErrors
KeepCredentials crashes the package (#3632), and TestFetchAsksOneList
OnceForTwoBasesOfIt, TestFetchUnionsProtocolListsWithoutChat and
TestFetchAsksASharedBaseOnce (#3854); the rest ok (157s). gofmt -l
clean; go vet, GOOS=windows and GOOS=linux go vet of internal/provider
clean.
Broken by hand: nothing; a min is a version string no test pins.
Not tried: a real ZCode 3.16 account (its key is in the Keychain).
2026-10-28 00:15:40 +08:00
yetone 39238183da provider: ZCode's mover min is 0.1.32 (plugins#395)
zcode 0.1.32 (plugins 8b21033, ANDY-JK) asks a 429 that is the plan's
in-flight cap (3008/3009) again, the same bytes, for about ten seconds,
no longer counts it as a spent gift, and declares maxConcurrency 3 as a
default magpie's per-account queue applies. keepMovedCurrent brings
every moved user up to it.

Run at this tree (origin/main 9fed5dc8c + this line):
- npm view @magpie-community/opencode-zcode-auth version --prefer-online:
  0.1.32.
- gofmt -l internal/provider clean; go vet ./internal/provider ok.
- go test ./internal/provider -run 'Mover|Moved|Migrat|ZCode|Min' ok.
- go test ./internal/provider: crashes in
  TestUnreadLoginsWriteErrorsKeepCredentials, "close of synctest channel
  from outside bubble" in filememo.Forget, which is #3632, open on main.
Not tried: a moved ZCode account updating to 0.1.32 in a running magpie.
2026-10-27 11:25:48 +08:00
yetone 82edec9cad provider: Kiro's mover needs 0.1.17, ZCode's 0.1.31 (plugins#408, #410)
kiro 0.1.17: the Free trial and Credits windows carry their credits used
and the limit, so the card's Left shows what is left (plugins#408).
zcode 0.1.31: ZCode 3.16's sign-in that keeps only a
project-key-location record reads that key, so its GLM Coding Plan is
found, not only the gift (plugins#410); also the bare-UUID x-session-id
(plugins#388).

npm view --prefer-online: opencode-kiro-auth 0.1.17,
opencode-zcode-auth 0.1.31.
Run: go test -tags nogui -count=1 ./internal/provider (with the #3632
test skipped) ok; gofmt.
2026-10-26 16:13:57 +08:00
yetone 0cba7fa680 provider: ZCode's mover min is 0.1.30 (plugins #387)
zcode 0.1.30 (plugins 57598ad) puts metadata.user_id
{"device_id":<sign-in's device>,"account_uuid":"","session_id":""} on a
GLM Coding Plan or team Messages request when the agent sent none, as
ZCode 3.14.3's client does on every Anthropic-format request
(glm/zcode.cjs Pst/MLs, vWr); before, only the Start Plan's dressed body
carried it. A key-only account's device is hashed from the key, the same
on every start. keepMovedCurrent brings every moved user up to it.

npm view --prefer-online @magpie-community/opencode-zcode-auth version:
0.1.30 when this landed.
Run at this tree: go test ./internal/provider/ -run
'Mover|Move|Moved|Migrat|ZCode|Retir|Adopt|HandOver' -count=1 -> ok.
Not run: the full suite (a one-line min change).
2026-10-25 18:34:27 +08:00
yetone d580537201 provider: the ZCode mover's min is 0.1.29, a sign-in keeping the account's user id
zcode 0.1.29 (plugins 5c9b7a4) gives each sign-in uid: ZCode's user_id,
so the plugin host tells two ZCode accounts of one name apart (wakkana
on Discord reported it for WorkBuddy), and the app's entry follows ZCode
only while it is signed in to that user id. keepMovedCurrent brings moved
users up to it.

npm view --prefer-online @magpie-community/opencode-zcode-auth version:
0.1.29 at landing. go test -run 'Mover|Movers|Notice|Migrat'
./internal/provider: ok.
2026-10-25 17:45:01 +08:00
yetone 492847818b provider: moved ZCode, Cursor, WorkBuddy and Qoder users get the plugins' latest fixes
Mover mins raised to the versions npm has at landing (npm view
--prefer-online): zcode 0.1.28 (plugins #369, #379), cursor 0.2.22
(#377), workbuddy/workbuddy-ai 0.1.34 (#337, #378, #346), qoder/qoder-cn
0.2.36 (#323, #378, QwenWork #319). keepMovedCurrent updates every moved
user's plugin to them.

Run: go test ./internal/provider/ ok (152s); gofmt -l clean.
Not tried: a real move or upgrade on a real account; the plugin fixes
themselves were reviewed and tested in the plugins repo, not against
the vendors' APIs.
2026-10-25 15:47:26 +08:00
yetone 7034378669 zcode: the Start Plan's 405 code 3012 says ZCode blocked the account, and rests it as restricted (plugins#348)
Since 10-24 many ZCode Start Plan accounts get 405 {"code":3012,"msg":
"request has been blocked due to unusual activity."} on every request.
On several of them ZCode's own app (3.16.3) gets the same 405, and
ZCode's support bot calls 3012 risk control on the account. magpie said
"though magpie sends it as the ZCode app does; it can be a network block
of this IP", rested the account as an unknown failure, and asked it again
soon after.

- provider.ZCodeRestrictedHint: the words @magpie-community/opencode-
  zcode-auth 0.1.27 puts after ZCode's own ("ZCode's risk control blocked
  this account for unusual activity (code 3012); it rests, and the
  group's other providers are used. If the ZCode app fails on this
  account too, only ZCode support can lift the block").
- gateway: restrictedSaid reads those words as failRestricted, as
  WorkBuddy's 11140: the account rests restrictedRest (2h), the next
  member is asked, and the Routing page's lift button brings it back.
- Routing page: the hint replaces the old one, in zh, zh-TW, ja and de.
- zcode mover min 0.1.27 (npm view --prefer-online: 0.1.27).

Not proven: why ZCode flags these accounts. Diffed against ZCode 3.16.3's
glm/zcode.cjs: the Start Plan goes unsigned there too (client request
signing is off for zhipu-account start-plan), and the headers match the
plugin's. Not tried with a real blocked account.

Run (sandbox HOME, at this tree): go test ./internal/provider ok;
go test -tags nogui ./internal/gui/... ok; go test ./internal/gateway
-run 'ZCode|Restricted|Blocked|EdgeBlocked|Moved' ok, and the new
TestZCodeStartPlanBlockRestsRestricted is red with routing.go reverted;
go vet darwin, linux, windows on provider and gateway ok; gofmt clean.
GUI (Playwright 1.62.0, chromium + webkit): routing-zcode-blocked,
i18n-keys, routing-blocked, routing-wb-restricted, gui-de, gui-ja,
gui-zh-tw: 41 pass, 0 fail. Not run: the full ./... suite (the machine
had a queue of full suites at load ~120).
2026-10-24 23:42:50 +08:00
yetone 638e51fe3f provider: ZCode's mover min is 0.1.26, so a signed-in account's gift plans keep their -Trial models
bigsteven (Discord #feedback, 10-24) saw no GLM-5.3-Trial on the latest
ZCode plugin. plugins cc0bd90 (0.1.26) fixes three ways the -Trial
entries went missing:
- ZCode's config out of reach marked the list fellBack, so magpie's host
  kept the last good list and dropped a gift's fresh -Trial entries;
- one failed gift-balance read hid them for 10 minutes (now 1);
- an API-key account, or a sign-in whose ZCode session expired, listed no
  -Trial models and the card said nothing. The card now says the gift
  plans need ZCode's sign-in.

Run: go test ./internal/provider (ok, 129s) at this head, on
origin/main b855cfee9. npm view --prefer-online gives 0.1.26.
In the plugins repo: bun test packages/zcode (102 pass) and
bun scripts/check.mjs zcode; each of the three fixes reverted by hand
turns its own tests red.
Not tried: a real account with a gift plan through the moved plugin.
2026-10-24 17:13:06 +08:00
yetone 4689ba69bd provider: the ZCode mover's min is 0.1.25, so a planless key says a ZCode gift plan needs ZCode's sign-in (rtbeilin on X)
rtbeilin's account is on ZCode 1024 Dev Day with no GLM Coding Plan.
ZCode's sign-in worked, an API key did not. zcode.z.ai serves gift
plans only to ZCode's session JWT, so a key can never spend one; 0.1.24
showed such a key an empty card and passed its requests' 1113 through
bare. zcode-auth 0.1.25 (plugins 71021b8) says why and what to use, on
the card and on the refusal. keepMovedCurrent brings every moved user
up to it.

npm: npm view --prefer-online @magpie-community/opencode-zcode-auth
version = 0.1.25; registry latest shasum 86033cf1 matches the publish
run 40078784618 (the run is red only for think-tags, plugins#180).

Run at this head (origin/main 6db5e9d59 + this change): gofmt -l and
go vet ./internal/provider/ clean; go test -count=1 ./internal/provider/
ok (97s), TestMovedBuiltinsSayTheirPlugin included.
Not tried: a moved account's plugin update from 0.1.24 in a real app.
2026-10-24 16:44:59 +08:00
yetone dd1e8822d9 provider: the ZCode move installs zcode-auth 0.1.24, so a Claude Code subagent on ZCode sees Bash, Read and Write
小八 on Discord (10-24): through magpie's ZCode plugin (glm-5.3, glm-5.3-flash)
a Claude Code subagent's tool list held only deferred MCP tools; Bash, Read
and Write were gone, the main conversation was fine. api.z.ai's Anthropic
endpoint, given a tool named exactly ToolSearch, shows the model no tool
but the ones a tool_reference loaded (input tokens 2886 with ToolSearch,
2439 with no tools, 6346 with it renamed). zcode-auth 0.1.24 (plugins
d1b6500) sends the search as ToolSearchTool, without defer_loading or the
placeholder, and renames the model's calls back. The Zhipu/Z.ai presets on
the gateway's Anthropic route are the same upstream; the cause is on #3253.

npm view @magpie-community/opencode-zcode-auth version --prefer-online:
0.1.24 at 23:44 UTC. The plugins publish run is red only for think-tags'
known E404 (plugins#180); zcode's line is "+ ...@0.1.24".

Run at this tree: gofmt -l internal/provider (clean); GOOS=linux, windows,
darwin go vet ./internal/provider (clean); go test -count=1 -timeout 45m
-ldflags='-s -w' ./internal/provider ok 86s (the disk had 250MB free, and
the unstripped test binary failed to link: no space left on device).
Not run: the full suite (same disk).
2026-10-24 07:46:27 +08:00
yetone a6a3dbde83 provider: the ZCode mover's min is 0.1.23, so a second gift plan's GLM-5.3 shows beside a spent one (01huadalang on Discord)
01huadalang's ZCode account has two gift plans, the 1024 Dev Day plan and
the new-user plan. Once the new-user plan's GLM-5.3 was used up the card
showed GLM-5.3 at 0 and never the 1024 plan's GLM-5.3. The plugin named
every bucket by its show_name alone and sent them in the balance's
order, so the account row's first two windows were the spent plan's and
the live plan's allowance sat in the tooltip under the same name.

Plugin 0.1.23 (magpie-community/plugins 1f8d38b) names each bucket after
its plan when there are several ("ZCode 1024 Dev Day · GLM-5.3") and puts
the buckets a request spends before those set aside. `npm view
@magpie-community/opencode-zcode-auth version --prefer-online` gives
0.1.23.

Run at this tree (origin/main a93190ae1 + this line): gofmt -l
internal/provider clean; GOOS=darwin, linux and windows go vet
./internal/provider ok; go build ./... ok; go test -timeout 45m
./internal/provider ok (89.7s). Plugin side: package tests 92 pass,
whole plugins repo 2375 pass, check.mjs ok; the new tests are red on
0.1.22's index.mjs.
Not tried: a real account with two active gift plans; the reporter's
own balance wasn't read.
2026-10-24 05:08:55 +08:00
yetone 843417957c provider: the ZCode mover's min is 0.1.22, so a Start Plan request goes with ZCode 3.16.3's headers alone (01huadalang on Discord)
01huadalang got the Start Plan's 405 again on plugin 0.1.21. A plugin
provider has no account of its own in the gateway, so Claude Code's own
headers (anthropic-beta, x-app, x-stainless-*,
anthropic-dangerous-direct-browser-access, x-claude-code-session-id)
and ?beta=true reached the plugin. 0.1.21 passed them on to zcode.z.ai.
The retired built-in never sent them.

Plugin 0.1.22 (magpie-community/plugins 57ec655) builds a Start Plan
request's headers from scratch, as ZCode.app 3.16.3 sends them: the new
x-zcode-query-source: main_turn, X-Os-Version as os.release(), and app
version 3.16.3. It also drops the URL's query. `npm view
@magpie-community/opencode-zcode-auth version --prefer-online` gives
0.1.22.

Run: go build ./..., go vet ./internal/provider, and go test -run
'Mover|Moved|Migrat|ZCode|Zcode|Min' ./internal/provider ok. Plugin
bun test (temp HOME): 90 pass.
Not tried: a real Start Plan account. Whether zcode.z.ai keys on these
headers is not established, and an IP block is still possible.
2026-10-24 00:50:49 +08:00
yetone c551a22997 provider: the ZCode mover's min is 0.1.21, whose Start Plan request keeps ZCode's three system blocks (plugins #343)
zcode.z.ai answers a Start Plan request whose system has a fourth block
with 405/3012 "request has been blocked due to unusual activity", and the
plugin up to 0.1.20 sent the agent's system prompt as that fourth block,
so every agent was turned away on a Start Plan account (fordlyn). 0.1.21
(plugins 44036e2) joins it to the end of ZCode's third block, as ZCode
3.14.3's ContextBuilder joins every dynamic system section.
keepMovedCurrent brings every moved user's plugin up to it.

npm view @magpie-community/opencode-zcode-auth version --prefer-online:
0.1.21 (its tarball carries the #343 change).
Run: gofmt -l internal/provider (clean); GOOS=darwin|linux|windows go vet
./internal/provider/ (ok); go test -timeout 45m ./internal/provider/ (ok,
98.9s). Not tried against the real API: no Start Plan account at hand.
2026-10-23 23:26:13 +08:00
yetone a00900d642 provider: ZCode's mover installs plugin 0.1.20, a team's plan beside the account's own (plugins #285)
An account with a GLM Coding Plan of its own and a seat on a team's could
only reach its own plan through the plugin. zcode 0.1.20 (plugins
d87dd8f, on npm) adds "ZCode: a team's GLM Coding Plan", which signs in
to the team seat as an account of its own, "<email> (team)". Raising the
min lets keepMovedCurrent bring every moved user to it.

Run at the parent 5fadf6ace: gofmt -l (clean); go vet ./... on darwin,
GOOS=linux -tags nogui and GOOS=windows (ok); set -o pipefail;
GOMODCACHE=/Users/yetone/go/pkg/mod go test -timeout 45m ./... (exit 0).
npm view @magpie-community/opencode-zcode-auth version --prefer-online:
0.1.20.
2026-10-21 09:35:44 +08:00
yetone f9ceac1628 provider: a move onto the plugin takes every account, and no model holds it back
The built-ins are retired (the owner, 10-16: 一定要下线完毕), so a move
can't be held back by something only the built-in could fix. Before, a
move failed when every account was lapsed, when one account's check
failed (the vendor unreachable through the plugin), when the vendor
refused every account, or when a model in use wasn't in the plugin's
list. Each of those left the user on a built-in that is going away.

Now Move installs the plugin and imports every account:
- one the vendor refuses goes along marked lapsed, as before;
- one already lapsed, or whose check fails otherwise, goes along untried
  and unmarked, for the plugin's own reads to judge, and is logged;
- no model is checked against the plugin's list.

Only an install failure, the plugin not serving the id, or a sign-in the
plugin won't import fails the move, which puts everything back and is
tried again after moveRetry. The movers' served (Devin, Cursor) and
builtin (ZCode) hooks, modelsInUse, modelNames, lapsedAll and devinBase
had no other use and are gone, with the tests of the hooks. The page still
translates an older magpie's lapsed, unserved and account whys, which
migrations.json can hold.

Tests:
- TestMoveEveryAccountLapsed and TestMoveTriesEachAccount are new, and
  TestMoveToPlugin's first case is now a refused account that moves.
  importAuth is a seam: the fake mover's "r-noimport" sign-in fails part
  way, so TestMoveToPlugin, TestMoveTidiesItsPlugin and TestMoveCutShort
  still test putting back.
- TestMoveCutShort's cut-short record now carries the sent sign-in's
  hash, as a real move writes it. Without it putBack took the built-in's
  sign-in as renewed. The old test passed only because the check renewed
  the token a second time.
- Broken by hand: with a failed check or a refusal returning an error
  again, TestMoveToPlugin and TestMoveTriesEachAccount go red.

What was run:
- go test -tags nogui ./internal/provider -run
  'Move|HandOver|Lapse|PutBack|Retir|Adopt|KeepMoved|ReleasePlugin|
  ZCodeStartPlan|Devin|Cursor' passes.
- go vet passes and gofmt -l is clean.
- At ab7b28510 on ba132d68b: go test -tags nogui ./... -count=1
  -timeout 90m, 66 packages ok, no FAIL; GOOS=linux and windows go vet
  of provider, gui and cli pass.
- Rebased onto origin/main with the next commit; the suite at that head
  is in its body.
2026-10-16 22:58:41 +08:00
yetone 53009f81a4 provider: every mover's min is the plugin that closes its gap with the built-in
Moved users are kept on these versions by keepMovedCurrent, each on npm
(npm view --prefer-online):
- devin 0.1.20: JSON output when asked; tool result images on the tool message
- commandcode 0.1.13: Credits reset at the subscription's end (#2454)
- cursor 0.2.18: a failed tool result read as isError; keychain backoff
- zed 0.1.8: "No plan" for a free account
- zcode 0.1.19: personal and team resets; Start Plan hint
- kiro 0.1.12: JSON output (output_config.format)

Run at 63be47717 with this batch: go test -tags nogui ./... -count=1 -timeout 90m, 66 packages ok, no FAIL (load ~250). gofmt -l clean; GOOS=linux and GOOS=windows go vet of provider, gateway and plugin pass. (devin's min rose after the run: go test ./internal/provider -run 'Mover|Moved' ok.)
2026-10-16 19:38:06 +08:00
yetone 63ad2b7c76 provider: a moved ZCode updates to plugin 0.1.18, which reads ZCode 3.15's plan key from config.json (#2130)
Plugin zcode 0.1.18 (magpie-community/plugins 5c0aebc, on npm) gives moved
users the built-in's 1d8e83a79 fix. ZCode 3.15 keeps the GLM Coding Plan
key only in config.json's provider options.apiKey, so a valid plan read
as "no plan, Start Plan ended". keepMovedCurrent now updates every moved
ZCode user to it.

Run: npm view @magpie-community/opencode-zcode-auth@0.1.18 resolves;
gofmt -l; go vet for darwin, linux (nogui) and windows;
go test ./internal/provider/ -run 'Move|Migrat|Plugin|ZCode' passes.
2026-10-14 15:50:26 +08:00
yetone 23611ca6a5 provider: a moved ZCode subscription takes plugin 0.1.17, which reads ZCode's sign-in from the folder its data was moved to
What changed: the zcode mover's min goes from 0.1.16 to 0.1.17, so
keepMovedCurrent updates every moved user's @magpie-community/opencode-zcode-auth.
41972b25f made the built-in follow ZCode 3.14's 数据存储路径 (dataBaseDir in the
home folder's .zcode/v2/setting.json); the plugin, which is what runs for a
moved ZCode subscription, still read ~/.zcode/v2/credentials.json and
runtime/provider only, so "ZCode app's sign-in" read the stale copy ZCode
left at home. plugins 65a7676 (0.1.17) reads dataBaseDir as ZCodeDataIn does
(trimmed, ignored when empty or not absolute) for credentials.json and the
zcode-builtin.json walk, and keeps reading setting.json from the home folder,
where ZCode keeps it (getSettingsFile; copyDataDirectory leaves it out).

ZCode's CLI session database (~/.zcode/cli/db/db.sqlite, internal/sessions)
does not move with dataBaseDir: the CLI (glm/zcode.cjs, 3.14.3) takes it
from storage.sessionDbPath, default "~/.zcode/cli/db/db.sqlite" expanded
with os.homedir(), and the host sets neither ZCODE_SESSION_DB_PATH nor
ZCODE_STORAGE_DIR; copyDataDirectory copies .zcode/v2 only. So the session
reader is unchanged.

What was run:
- npm view @magpie-community/opencode-zcode-auth@0.1.17: published (publish
  run 38370080577; that run is red only for zed-auth and zen-free-auth,
  E404 Trusted Publisher).
- Plugin: HOME=$(mktemp -d) bun test at the repo root, 1185 pass; its new
  moved.test.mjs fails with the old path.
- gofmt -l; go vet ./internal/provider (darwin), GOOS=linux and
  GOOS=windows go vet -tags nogui; go test -tags nogui ./internal/provider
  under a sandbox HOME: ok.
- Not run: a real ZCode with a moved folder, Windows.
2026-10-13 16:40:14 +08:00
yetone 6a8b2c6831 provider: a moved ZCode account is brought to plugin 0.1.16, whose app sign-in follows ZCode only while it is signed in to the same account (LingYi_Stu on X)
Raises the zcode mover's min so keepMovedCurrent updates every moved user
to @magpie-community/opencode-zcode-auth 0.1.16 (plugins d2be892). With
the "ZCode app's sign-in" added for account A and again after ZCode
switched to B, A's entry read ZCode's current credentials on every
request, so it sent B's requests and its usage card showed B. 0.1.16
follows ZCode only while ZCode's user is the entry's account; otherwise
it uses what was saved at sign-in, and asks for sign-in again when that
session has run out. Published by the plugins repo's publish workflow;
npm view says 0.1.16 is latest.

Run: go test ./internal/provider/ (ok, 99s); gofmt -l internal/provider
(clean); go vet ./internal/provider/ on darwin, GOOS=linux, GOOS=windows.
2026-10-12 14:47:13 +08:00
yetone c763d4fe1d provider: a moved ZCode or Command Code account is brought to plugin 0.1.15 / 0.1.10, which say the agent's folder (plugins #86, Hipple)
Raises the movers' min so keepMovedCurrent updates every moved user:
- @magpie-community/opencode-zcode-auth 0.1.15 (plugins baa788b): the
  Start Plan's environment section says the folder and git repository
  magpie tells it, never magpie's own folder, and leaves out what it
  isn't told and the shell.
- @magpie-community/opencode-commandcode-auth 0.1.10 (plugins 7e67b98): a
  Go request's workingDir and isGitRepo are the agent's.
Both were published by the plugins repo's publish workflow and are the
registry's latest. Run: go test internal/provider.
2026-10-11 21:51:34 +08:00
yetone 927da8c41a provider: moved ZCode users get plugin 0.1.14, which lists a gift-only account's GLM-5.3 as GLM-5.3 (#1261)
sun1090's ZCode account has no GLM Coding Plan, only the Start Plan, whose
buckets serve GLM-5.3 and GLM-5.3-Flash. The card counted GLM-5.3, but the
plugin listed the Start Plan's config models (GLM-5.3-Flash, GLM-5.2,
GLM-5-Turbo) and GLM-5.3 only as GLM-5.3-Trial. ZCode itself lists a Start
Plan account's models as its balance's buckets name them, so 0.1.14
(magpie-community/plugins aca7c59) lists them by their own names too, and
keeps the -Trial entries. keepMovedCurrent updates every moved ZCode user.
The builtin check's note says the plugin now lists GLM-5.3 while a gift
bucket serves it; the check itself is unchanged.

0.1.14 resolves with npm view and its publish run passed. The plugin's
bun test (75) passes and its new test fails on 0.1.13. go test -tags nogui
./internal/provider under a temp HOME passes; GOOS=linux and GOOS=windows
go vet pass. Not tried with a real Start Plan account here.
2026-10-08 16:23:52 +08:00
yetone e4c292f655 provider: moved ZCode users get plugin 0.1.13, whose claim line has one fixed name the GUI can translate (plugins #43) 2026-10-08 11:57:15 +08:00
yetone 92e4fc32fa provider: moved ZCode users get plugin 0.1.12 and moved WorkBuddy users 0.1.10 — ZCode's counted windows carry their amount and limit so the card's count follows used/left (#659, magpie-community/plugins#35); WorkBuddy's credits-used-up error (code 14018, matched as the whole code) says so with the nested message (plugins#25). Both versions resolve with npm view. go test -tags nogui ./internal/provider under a temp HOME passes; the plugins' own bun tests passed at merge. Not tried with a real ZCode or WorkBuddy account here. 2026-10-07 18:52:23 +08:00
yetone b95ce8c6f3 provider: ZCode's mover asks for @magpie-community/opencode-zcode-auth 0.1.11, which names a gift plan ZCode holds but hasn't granted on the usage card ("1 to claim · claim it in the ZCode app") — #1001 (MiFaZhan): a day's ZCode Trust Build is not on the account until the ZCode app claims it, and an account signed in through magpie alone let it lapse. The plugin (magpie-community/plugins#30) reads ZCode's own GET /api/v1/zcode-plan/billing/preview with the card and adds one window set aside, so routing, caps and the menu bar pass it over; it never claims (the claim needs the Aliyun captcha only the app's renderer makes). A failed or empty preview adds nothing and an error card asks nothing. keepMovedCurrent updates every moved ZCode user to it. go test ./internal/provider and gofmt pass; the plugin's bun test (72) and check.mjs pass, 4 of its new tests fail on 0.1.10. Not tried with a real ZCode account here. 2026-10-06 17:50:39 +08:00
yetone 15102c809f provider: a ZCode account's spent gift bucket doesn't hold up a model another of its plans still has (ganlerk on Discord) — an account with ZCode Trust Build (GLM-5.3-Flash 14.5% used) and the Start Plan (GLM-5.3-Flash all used) read GLM-5.3-Flash, and so the account, as 100% used: every bucket's window counted its model, and routing takes the fullest. The server picks the bucket (ZCode sends no plan with a request), so a model now counts on one bucket, a live one before a spent one, the least used; a bucket no model counts on stays on the card set aside. The plugin does the same from 0.1.10 (magpie-community/plugins 6b13dc0), and the mover's min is raised to it. TestZCodeStartSpentSiblingAside fails without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 20:02:13 +08:00
yetone 2350ea7aa7 provider: moved ZCode users get plugin 0.1.9, where the gift's models are trial entries the user picks (plugins #21) — 0.1.8 spent a dual account's gift before its GLM Coding Plan for every model the gift served, so a user who meant to spend the plan had no say. 0.1.9 lists each live gift model again as <model>-Trial (GLM-5.3-Flash-Trial): that entry spends the gift and answers 429 locally when its bucket is spent or blocked, and a plain model always spends the coding plan. Reviewed line by line and run against a fake upstream (a coding-only account's trial entry is a local 400, a streamed trial request reaches zcode.z.ai with the raw model, a 1113 inside a 200 becomes 429 and keeps the entry off for a minute, a plain model still goes to api.z.ai); bun test (65 pass) and bun scripts/check.mjs zcode pass. go vet and go test -tags nogui ./internal/provider/ under a temp HOME pass. 2026-10-05 14:29:35 +08:00
yetone 14f59920f0 zcode: moved accounts are brought to the plugin's 0.1.8, which spends an account's ZCode gift plans before its GLM Coding Plan (magpie-community/plugins#19, erlinerd) — an account with both a coding plan and a gift (a Trust Build grant, say) sent every request to the coding plan, and the gift lapsed unspent. 0.1.8 sends a model the gift serves to it first, replays to the coding plan on any refusal (a quota answer keeps that model off the gift for a minute), and shows the gift's buckets on the coding card. With the owner's real GLM Coding Lite account (no gift) the card and a glm-4.6 request were as before; the gift route is covered by the plugin's tests only. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-04 20:09:16 +08:00
yetone e194f97731 plugins: moving a subscription onto its plugin installs the plugin's newest fixes — cursor 0.1.7 (a model Cursor runs only in Max Mode is asked again in Max Mode, glm-5.3 and glm-5.3-flash listed), qoder 0.2.2 and workbuddy 0.1.6 (each model's credit rate, which magpie shows by it since v0.1.667), zcode 0.1.7, factory 0.1.8 (Claude 5's system-role metadata in the form Factory takes) — all on npm now. go test -tags nogui ./internal/provider ./internal/plugin under a temp HOME pass. 2026-10-02 23:21:58 +08:00
yetone 96446806bd zcode: a Start Plan account neither lists nor offers GLM-5.3, and the move to the plugin doesn't count it lost (悠悠哥 on Discord: "仍使用内置:插件不提供 GLM-5.3" moving ZCode onto its plugin) — GLM-5.3 is the Coding Plan's alone (ZCode's builtin config lists GLM-5.3-Flash, GLM-5.2 and GLM-5-Turbo for account:zai-start-plan), and the plugin serves a Start Plan account what ZCode does. But a Z.ai account with a key made and no Coding Plan bought, whose requests go to the Start Plan, was taken for a Coding Plan account until a request found its route (zcodeOnStart with no context said the Coding Plan), and afterwards was listed whatever list was fetched last (the Coding Plan's, another account's or its own before), so GLM-5.3 was listed, could be ticked, and the move found the plugin "short" of it. Now: before a route is found, the plan the account showed at sign-in says it (zcodeOnStartAs, zcodeStartNamed: "Start Plan"); on the Start Plan, a model the plan doesn't serve (zcodeStartServes: ZCode's config on the machine, else zcodeStartModels) is unusable, taken out of a fetched list and out of the picks, with a list fetched or not (Exposed); and a mover may say which models the built-in served on an account (mover.builtin), ZCode's saying a Start Plan account was never served GLM-5.3, so one the built-in didn't serve either is no loss. A model really lost is named with the account and its plan: "the plugin doesn't serve GLM-5.3 for a@x (GLM Coding Pro), though the built-in does" (插件没有为 … 提供 …(内置提供)), the why's args carrying user. TestZCodeStartPlanHasNoGLM53 (a Start Plan account before and after the Coding Plan's list was fetched, GLM-5.3 ticked or not; a Coding Plan account still has it; the mover's builtin) fails without the change (it listed GLM-5.3 GLM-5.3-Flash GLM-5.2 GLM-5-Turbo); TestMoveToPlugin's new case (a model the built-in didn't serve moves; one it did is named with "a@fake (Fake Start)"); plugin-move-unserved.test.cjs (WebKit, en and zh, with an account and without) fails without the app.js change and passes with it, plugin-move.test.cjs passes. No ZCode request or sign-in was made. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME, go test ./internal/gui pass. 2026-10-02 22:00:34 +08:00
yetone 51834ba937 migrate: a move installs the plugin versions that match their built-ins (要保证插件订阅 provider 跟内置的订阅 provider所有逻辑都要一模一样) — Command Code 0.1.6 (a Go account lists Go's models), Grok 0.1.4 (grok-4.7's reasoning levels), Qoder 0.1.4 (a refused refresh marks the sign-in), ZCode 0.1.5 (the MCP quota set aside) and Zed 0.1.6 (a model token refused while listing marks the account), all published and installed from npm in a sandbox before this. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-01 12:05:06 +08:00
yetone 475a55a702 migrate: built-ins move onto plugins that fail and mark the sign-in as they did — each mover now asks the plugin version that answers with its built-in's status and words and says through X-Magpie-Sign-In when the account's sign-in expired, stayed or renewed, in requests and usage reads alike: Command Code, Cursor, Devin, Kiro, MiMo, WorkBuddy and Zed 0.1.5, Factory and ZCode 0.1.4, Grok and Qoder 0.1.3, each published and installed from npm before this. go vet, go build -tags nogui (GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/provider ./internal/gateway ./internal/plugin pass. 2026-10-01 06:04:01 +08:00
yetone a170b909c9 plugins: a moved built-in's plugin comes up to date with magpie, as the built-in did — the fixes that bring each plugin in line with its built-in (plans, windows, lapsed sign-ins, refusals, bodies in bytes) are in @magpie-community's new releases, but a plugin was updated only by a click in Plugins, so an account moved before kept the old one. The magpie serving the gateway now updates, a little after it starts and every hour, the plugin of each built-in moved onto one to the version its move needs, and a move needs those versions: mimo 0.1.4, workbuddy 0.1.4, grok and qoder 0.1.2, the rest 0.1.3. One turned off, run from a folder or moved back is left alone. TestKeepMovedCurrent fails without the change. 2026-10-01 03:34:22 +08:00
yetone 566ae09db1 plugins: a moved provider's accounts keep what the built-in's had (你确保插件版的订阅 provider 和内置的一模一样了吗) — each account of a plugin provider has its own plan's models, not the first account's; a move carries each account's plan and a lapsed mark; a usage read that finds the sign-in gone marks the account and a clean one clears it, a network failure shows the last reading; a plugin that fails to load keeps its providers rather than taking them away; Kiro's API key is named and an OAuth account beside it stays off as in the built-in; Command Code Plan keeps its name. TestUnloadedPluginKeepsProviders, TestPluginUsageLapse, TestPluginAccountModels, TestMovedProviderName, TestKiroMover and the move test fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/provider ./internal/plugin ./internal/gateway pass. 2026-10-01 03:27:47 +08:00
yetone 94ba560257 plugins: a move installs the plugin as it now matches its built-in (插件版…保持一模一样) — each mover asks for the version published with the parity fixes (WorkBuddy 0.1.3; Command Code, Cursor, Devin, Factory, Kiro, MiMo, Zed, ZCode 0.1.2), updating an older one first, so a failed sign-in says why, a CLI's own account follows its key, refusals read as the built-in's. ZCode's own sign-in on its session alone (the Start Plan) no longer stops the move: zcode-auth 0.1.2 reads ZCode's credentials anew for each request, the session ZCode renews included, so the account goes marked as ZCode's and with no expiry of its own. TestCursorPluginContext and TestMoveDevin no longer lean on the machine: the first seeds its catalog (it failed wherever models.dev's cache wasn't there), the second waits for the fake CLI however loaded the machine. TestZCodeMover fails without the change. Each package installed from npm in an empty HOME comes at the version asked. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass but for TestUserPath and TestClaudeSignedOut, 5s timeouts under the whole run's load that pass alone. 2026-10-01 02:12:43 +08:00
yetone 1ce05f0270 plugins: a plugin's models show as the built-in's did (插件版…保持一模一样) — a model a plugin says its plan serves at no cost (WorkBuddy's x0.00 credits) is marked free, as the built-in marked it; Cursor's plugin models not named 1M hold what the catalog knows their base to (GPT-4o 128K, Kimi K2 131K), not Cursor's 200K, as the built-in's list; ZCode's own account moves marked as ZCode's, for the plugin (0.1.2) to read ZCode's own sign-in for each request and follow its switches, and comes back as ZCode's own with nothing saved. TestPluginUsage (free), TestCursorPluginContext and TestZCodeMover fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-01 01:18:04 +08:00
yetone 3bec6c0e40 providers: a built-in subscription moves onto its community plugin and back, its accounts with it (the user: 慢慢下掉内置的那些 Subscription Provider…不要让用户一升级完之后,突然发现他的所有服务都不可用了) — eleven built-ins (Zed, Qoder, Factory, MiMo, Devin, Grok, Command Code Plan, Cursor, Kiro, WorkBuddy, ZCode) each get a mover to their @magpie-community package. A move installs the plugin (updated when older than the mover needs), hands it every account in the plugin's shape, checks the plugin lists models for them, and only then lets the plugin serve the same provider id, so agents' model ids don't change; any failure rolls back and the built-in keeps serving. The built-in's accounts are kept as a backup, and "Run built-in again" (magpie plugin move-back <id>) takes the plugin's current sign-ins back, never copying a rotating token: they are taken out of the plugin in one step, and an account the built-in renewed meanwhile keeps its newer token. An account only the plugin can hold (Cursor's browser sign-in) stays with it. The provider editor shows "Runs on" with the button, a failed move's reason, and the CLI has magpie plugin move / move-back. Automatic moves (Retiring) are wired in but the list stays empty until the packages are on npm. Checked with real accounts in a sandbox HOME: Command Code Plan and Devin moved, answered a chat through the gateway on the plugin, moved back and answered again on the built-in. TestMove*, TestPutBackKeepsNewer, the movers' round-trip tests and plugin-move.test.cjs (Chromium, WebKit, en/zh) are new. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; click-scroll, old-webkit pass. 2026-09-30 21:21:58 +08:00