The request (X, 2117210897471169009): when the account has gift quota
for a GLM model, which ZCode hands out every weekend, spend that first.
freeFirst (#505) already does it, but only when it was turned on, so a
gift lapsed unused behind an agent that asks for the plain model. It is
now on unless the plugin's options or the provider's say
`"freeFirst": false`, which are still honoured as they are. Every way
the gift can fail (spent, a model it doesn't serve, no ZCode session, a
refusal's minute of rest) still falls back to the coding plan, as
before. A team seat's plain model spends the personal gift first too.
The tests that are about the plan and the -Trial picks now build the
plugin with freeFirst off, as they assumed it was.
Run on mote: HOME=$(mktemp -d) bun test in packages/zcode, 187 pass;
bun scripts/check.mjs zcode ok.
Broken by hand: with the default back to off, "free first is on when
nothing sets it" and "free first is on by default for a team seat"
fail; the rest pass.
Not tried: a real account with a claimed gift. The owner's account has
only an unclaimed one, which wasn't claimed for this.
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.