"zcode" joins retiredBuiltins, as zed and mimo-app did: every ZCode
account is served by @magpie-community/opencode-zcode-auth, and the
hourly MoveRetiring moves the ones still on the built-in.
Removed: the built-in's sign-in (startZCodeSignIn, the team sign-in and
its route/key caches), Start Plan (zcode_start.go and its blocked hint,
which account.go Explain and test.go EdgeBlocked named), its client and
prompt (zcode_client.go, zcode_prompt.json), the models list
(zcode_models.go), the OS place readers (zcode_os_*.go), and its rows in
signin.go, logins.go (list, switch, forget), logins_on.go,
login_usage.go, subscription_usage.go and account.go. Tests that covered
only that code are git rm'd (zcode_accounts, _blocked, _client,
_device, _place, _quota, _start, _startmodels) with TestZCodeAccounts,
TestZCodeTeamSignIn, TestZCodeTeamNoSeat and TestZCodeFetchModels.
Kept: the mover (migrate_zcode.go) and what it reads (zcodeLogins,
zcodeSaved, the credential store readers, zcode_device.go's
zcodeDeviceMid); zcodeOwn, the plugin's own account; the Zhipu plan and
team-seat readers planquota.go uses (zcode_team.go, zcodeCall/Get);
zcodeDecode/Encode, moved into zcode.go because factory_client.go uses
them; the gateway's zcode countOn condition and zcode_blocked_test.go
(which builds its Provider directly), as the Zed commit kept zed's; the
StartSignInAt site parameter (generic); plugin_accounts and
account_seats cases; the parity tests.
Tests whose meaning changed: TestZCodePlanKeyFromConfig and
TestZCodeOwnTeam keep only their zcodeOwn checks (the quota, Start Plan
server, provider/Sign/LoginUsage parts were the built-in's).
TestZhipuKeyTeamWindows builds the team key directly instead of signing
in through the removed team sign-in. zcodeTestJWT moved to zcode_test.go
for migrate_movers_c_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 (only the pre-existing unused ones)
go test -tags nogui -count=1 -run 'ZCode|Zcode|Zhipu|Migrat|Move|Moved|
Retired|LoopbackSignIns|AsksOwnBackend|Mover|SayTheirPlugin|SideLogin|
PlanKey' ./internal/provider ./internal/gateway ./internal/cli
./internal/gui: ok (all four)
Not run: whole packages, the full suite, the GUI suite (machine load
~300). Not tried with a real ZCode account.
ZCode 3.15 keeps no coding plan key in credentials.json any more. The key
it uses is in config.json, at provider["builtin:bigmodel-coding-plan" /
"builtin:zai-coding-plan"].options.apiKey (ZCode 3.15.3's host reads that
value as it is). zcodeOwn found no key, so a signed-in BigModel GLM Coding
Pro account went on to the Start Plan and read as "this account has no GLM
Coding Plan, and ZCode's Start Plan has ended or was never started".
zcodeOwn now falls back to config.json when credentials.json has no key:
Z.ai's first, as before, then BigModel. It also accepts the provider ids
ZCode 3.15 normalizes to (account:*-individual-coding-plan) and a value
written encrypted. A value that isn't a key, such as "{env:...}", is
skipped. A key in credentials.json still comes first, and so does a team
switch.
What was run:
- TestZCodePlanKeyFromConfig uses the reporter's layout: credentials.json
with BigModel sign-in data and no key, and config.json with the key under
builtin:bigmodel-coding-plan. The account reads as GLM Coding Pro with
two windows and never asks the Start Plan. Without the zcode.go change
it fails, with the key empty.
- gofmt -l; go vet for darwin, linux (nogui) and windows.
- go test ./internal/provider/ passes.
Not tried: a real ZCode 3.15 account. The fix rests on the reporter's
account of their config.json, which they verified against the plan
endpoints with the key, and on ZCode 3.15.3's extracted host code.
Moved users get the same fix through the plugin, in a separate commit.
The list is asked with the plan's key, bare in Authorization, at the host its
term (subscription/list) is asked at, so open.bigmodel.cn and api.z.ai alike;
a ZCode account on the built-in gets the same. The tooltip says "The plan's
resets" for a person's own, "The team plan's" for a team's (ResetCredits.Team).
Tested: the reporter's literal reply (ids and times filled in, same shape)
in TestZhipuPersonalResets, TestPlanQuotas and TestZCodeAccounts, each
failing with the change reverted; reset-each-title in Chromium and WebKit,
en/zh/ja/de; a real Z.ai key through zhipuPersonalResets (1 five-hour,
1 weekly). Not tried: a real bigmodel.cn key.