zcode: a team seat lists the person's gift plans and their -Trial models (#359, #371)

A team seat's ZCode session also reads the person's own gift plans (#359): plansOf no longer returns {start:false, gift:null} for every team seat. A team seat stays on its team plan (its personal plan list is not read), its <model>-Trial entries are listed, its card shows the gift buckets beside the team's windows, and a team seat with no or an expired ZCode session gets the "ZCode gift plans (-Trial models) need ZCode's sign-in" line. Plain models spend the team key; -Trial models go to zcode.z.ai with the ZCode session and no team key or organization header.

Reviewed at 4778e0d (on main ba9801c, merges clean). Run in a worktree, Bun 1.4.2, sandbox HOME and TMPDIR: `bun test packages/zcode` 107 pass, 0 fail. With main's index.mjs put back, 6 fail (the 4 new team-gift tests and the two changed team-seat tests), so the tests guard the change. `bun scripts/check.mjs zcode` ok. Loaded through magpie's plugin host (magpie origin/main 4dfd88206, scripts/try.sh in a sandbox HOME): zcode listed with 4 models.

Not tried: a real team-seat account here; the author reports a BigModel team seat listing the trials and a Flash Trial request answering 200. The version bump (0.1.28) follows in its own commit.
This commit is contained in:
location-txl
2026-10-25 14:22:19 +08:00
committed by GitHub
parent 4ac4766217
commit 935ddb5b45
6 changed files with 137 additions and 16 deletions
+9
View File
@@ -17,6 +17,15 @@ Magpie plugin contract. No new UI page or test framework is introduced.
## Scenarios
### Show a team member's personal gift plans (#359)
- Given a team seat's ZCode session also holds personal gift plans.
- When the plugin lists models and reads usage, even before resolving the team's key.
- Then the trial entries and personal gift buckets appear beside the team plan.
- And plain models spend the team plan while trial entries spend the personal gift.
- And a missing or expired ZCode session explains why trial entries are absent.
- And a failed gift read leaves the team's allowance available and retries within a minute.
### Add a real limited-quota model
- Given a coding-plan account has an active grant for a model absent from its plan catalog.