Commit Graph
5 Commits
Author SHA1 Message Date
yetone 1d8e83a797 provider: ZCode 3.15's GLM Coding Plan key is read from its config.json, so a valid plan no longer reads as "no plan" (#2130, Hanhan758)
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.
2026-10-14 15:44:00 +08:00
wizzy-yangandwizzy-yang 8c661279f2 zcode: a bucket counted in amounts says its count as used or as left, as the share beside it is (#659) — the Start Plan's buckets and a Coding Plan's limits told only the vendor's used-first text, "28746939 / 100000000", so the card froze that count beside a "71.3% left" figure. A window whose whole is told now carries the count as amount of limit, as WorkBuddy's credits do. TestZCodeStartBucketsCarryTheirCount, TestZCodeWindowsCarryTheirCount and the amount/limit assertions in TestZCodeAccounts fail without the change; go vet, gofmt (byte-exact, the repo's CRLF aside) and go test ./internal/provider/ pass, its one failure (TestLoginUsageClaudeAskedMeanwhile) the same on a clean origin/main. (#1137)
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
2026-10-13 12:17:39 +08:00
yetone b69b0e8100 usage: a GLM Coding Plan key's card on bigmodel.cn or Z.ai shows its reset cards, five-hour and weekly, counted from customer-package-reset/list (targetType=PERSONAL) as the vendor's usage page counts them: only those still available; a list that can't be read shows none, never 0. Read only, never spent from magpie (#1191)
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.
2026-10-08 05:57:48 +08:00
yetone 6546033109 kiro: removing kiro-cli's or the Kiro IDE's own sign-in hides it in magpie, and it shows again when Kiro signs in anew (Discord 碳碳双键: 本机没安装 kiro,但旧的 Kiro 数据还在,magpie 列出一个"Kiro account"(登录已失效,请重新添加此账号),添加新账号并设为首位后,旧的数据无法移除) — magpie reads Kiro's own sign-in from kiro-cli's database or ~/.aws/sso/cache and lists it among the accounts it signed in; Remove on it said "that is kiro-cli's or the Kiro IDE's own sign-in; run kiro-cli logout or sign out in the IDE", which with neither installed left a dead account there for good. The same refusal was shared by every agent whose own sign-in magpie only reads (forgetSideLogin: Kiro, Devin, Grok, Copilot, ZCode, WorkBuddy and WorkBuddy AI, Command Code, Gemini CLI, Antigravity). Now Remove on the agent's own sign-in hides it: logins.json's entry for it keeps a Hidden mark, and it is left out of the account list and so of the gateway's tries (the first and the ones behind it both come from that list); the agent's files are never deleted or written. It shows again when that sign-in changes: for Kiro, by a mark that is a digest of where the sign-in is (kiro-cli's row or the IDE's file) and its refresh token (never the token itself), so a new kiro-cli login or IDE sign-in, to any account, brings it back; for the others, which have no such mark, when it is another account. Removing it while it is first is allowed now, the next account being put first (saved, so it stays first when the own one comes back); removed when it was the only one, the agent has no account left. One of magpie's own accounts is removed with its home as before, and still can't be while it is first. The error and its per-agent sign-out hints are gone. Logins carry own, and the accounts list shows Remove on the agent's own sign-in also while it is first, its title "magpie stops showing and using Kiro's own sign-in; its files are left as they are, and it shows again when Kiro signs in anew" (magpie 不再显示和使用 Kiro 自己的登录;它的文件保持原样,Kiro 重新登录后会再次出现). Tested with a new internal/provider/side_logins_hide_test.go in a sandbox HOME: an expired kiro-cli sign-in ("Kiro account") behind a Google one magpie signed in is removed, stays gone across reads, isn't the account used nor among AlsoOn, kiro-cli's database byte-for-byte and mtime as it was, the refresh token nowhere in magpie's files; a new kiro-cli sign-in brings it back behind the one first; put first and removed, the next is first; one of magpie's removed takes its home and leaves the other's; the only account removed leaves Kiro with none; Grok's CLI sign-in hidden with auth.json untouched, back once it is another account. The agents' tests that expected the refusal (Command Code, Copilot, Devin, Grok, WorkBuddy, ZCode) no longer do. A new internal/gui/tests/own-signin-remove.test.cjs in Chromium and WebKit, en and zh: kiro-cli's sign-in behind another and alone first both have Remove with that title and post login/forget, magpie's first account has none. go build -tags nogui (and GOOS=linux, GOOS=windows), go test -tags nogui ./... and the whole GUI suite (138) pass. Not tried with a real Kiro, kiro-cli or the Kiro IDE. 2026-09-29 23:52:33 +08:00
yetone ac352a7755 provider(zcode): a ZCode subscription — Z.ai's GLM Coding Plan, as ZCode uses it: ZCode's own account is read from its credential store (~/.zcode/v2/credentials.json, decrypted as ZCode does, never written), and more are added from magpie with ZCode's own sign-in (zcode.z.ai's polling flow, then the account's zcode-api-key, made if missing), kept in logins.json beside it; requests go to the plan's Anthropic endpoint with the key, the models are ZCode's coding-plan list (GLM-5.3, -Flash, 5.2, 5-Turbo), and usage shows the five-hour and weekly credits. A phone sign-in is named by its number 2026-09-26 01:37:01 +08:00