An enterprise Trae CN sign-in names console.enterprise.trae.cn. For such an account, the usage card now reads the console's seat pool:
- the limit is seat_pool_currency_quota, where 9999999999 means unlimited;
- the spend is this seat's total_cost_currency from get_user_model_usage;
- the reset date is get_personal_core_data's ResetTime.
The consumer credits row stays beside it, marked aside, so magpie does not route on it. If the spend can't be read, the card shows "? / ¥800.00" with no share; it never reads as ¥0. The Trae Global console path is unverified: a refusal there is an error card and keeps the sign-in.
Run at b96d0e58 (mote, temp HOME, fake server only):
- bun test in packages/trae: 262 pass, 0 fail.
- bun scripts/check.mjs: exit 0.
- git merge-tree against origin/main 3632d53b: clean.
- 15 probe cases, among them a spend read failing with 500, 401, an error code, a list under data, and the seat's own row missing.
Broken by hand, one at a time: 10 changes. All but the error label turned a test red: the unknown spend, Global's sign-in being kept, CN's console 401, own-seat summing, a null pool, and whenOf reset times.
Not tried: a real Trae account, the real console, and the GUI card.
Co-authored-by: qiuhao-wang001 <qiuhao-wang001@users.noreply.github.com>
@shad70w0 on X: "magpie + Trae 插件实测没办法走企业订阅" - a Trae enterprise
subscription couldn't be used through this plugin. The sign-in URL sent
hide_saas_login=true (copied from the relays in 6c048c7), which hides the
enterprise/SSO sign-in on www.trae.cn/authorization and
www.trae.ai/authorization, so an enterprise user could only sign in as a
personal account.
What changed:
- the authorization URL sends hide_saas_login=false.
- traeHost: a host a sign-in names is taken only when it is a well-formed
https host (no port, credentials, query) on trae.cn, trae.ai or
mchost.guru; anything else is ignored and the consumer host used, as
before.
- Trae CN: a sign-in host on mchost.guru / trae-api-*, or another trae.cn
host than www/api/grow*, is the account's model host. Trae Global: a
trae.ai host other than www/api-*/grow* is too, after the existing
US/coresg rules. Personal hosts (api.trae.cn, api-us-east, api-sg-central,
growsg-normal, coresg-normal) route as before.
- the sign-in's host (host), a token host the callback names (authHost /
auth_host / userInfo.AuthHost, on the realm's own domain only) and the
userInfo's tenant/enterprise/login-type fields (account; no field that
looks like a secret) are kept in the auth record. Renewal (sign-in and
refresh) goes to authHost when one is kept. Nothing new is sent.
- README: enterprise sign-in is offered, not tried with a real enterprise
account.
Run: bun test in packages/trae (103 pass, 6 new in enterprise.test.mjs);
the whole repo's bun test with HOME under a scratch TMPDIR (1168 pass, 0
fail); bun scripts/check.mjs. Each change broken by hand turns
enterprise.test.mjs red: hide_saas_login back to true, no enterprise CN
host, no domain check, http allowed, refresh at the consumer host, no
account kept, api.trae.cn taken as a model host, a secret-looking field kept.
Not tried: no real enterprise account. Which host(s) and fields an
enterprise sign-in sends back is unknown; the hosts in the tests are made
up, and whether the callback ever names an auth host is a guess.