Skip to content

zcode-cli 3.8.1-30

Choose a tag to compare

@xhqing xhqing released this 06 Sep 03:07
· 15 commits to main since this release

The TUI footer no longer falls back to the literal "default" for the model name: startup now resolves the configured <provider>/<model_id> form.

Why: A user reported (with a screenshot) that after running zcode, the footer showed ◇ default — ◉ yolo — … and asked for the model name to always display <provider>/<model_id>. Root cause: the official runtime's login gate only checks the official zai/bigmodel slots, so boots with model access configured in an env-file slot (env-<id>, custom-provider.env) are marked loginRequired and receive no startup model metadata. The TUI constructor fell back to the literal "default" for a missing initialModel, and the run() startup sequence had no config-based fallback — the existing readConfiguredModelAccess() fallback in handleResult only triggered after the first message was submitted, so the footer showed "default" from first paint until the first message.

What changed:

  • The TUI run() startup sequence gains resolveStartupModel() (awaited before the first frame is drawn): when this.model is "default" (the marker for missing startup metadata), it first consults readConfiguredModelAccess() — on a hit (the slot pointed to by model.main declares the model and carries a key) it backfills displayModelRef(access.model) for display and corrects loginRequired to false under the existing semantics (consistent with the re-check semantics of handleResult / handleLocalLogin); on a miss it falls back to the new readConfiguredMainModel() (src/model-access.ts, which only reads model.main from config.json without requiring a key in the slot) — so loginRequired boots without configured access also show the configured model (e.g. the default zai/glm-5.2) instead of "default".
  • Display goes through displayModelRef(), which uniformly strips the env- prefix: the env slot env-bigmodel/glm-5.3 displays as bigmodel/glm-5.3.
  • Smoke tests (scripts/smoke-tui.ts): the main flow gains an assertion that before login (pristine HOME, no key) the footer already shows ◈ zai/glm-5.2 (covering the main-fallback path), plus a new standalone verifyEnvSlotModelDisplay() section that pre-writes an env- slot + key + model.main config to replicate the user's scenario and asserts the footer shows bigmodel/glm-5.3 with no ◈ default anywhere (covering the access-hit path); the lenient ◈ default fallback branch of the /mode plan assertion is tightened to a concrete model form so regressions cannot hide.
  • model-access unit tests gain two readConfiguredMainModel cases: main is readable even without a key; missing / blank / unreadable JSON returns null.
  • Version bumped to 3.8.1-30 (VERSION, package.json, test/update.test.ts, version badges and install URLs in all three READMEs).

Compatibility assessment: 3.8.1-25 established the re-check semantics for loginRequired (an env slot with configured access is not treated as unconfigured; the warning was removed in 3.8.1-28 but the re-check semantics stayed in handleResult). This change simply moves that re-check from "after the first message" to "at startup" — an addition, not a weakening. The identity semantics of 3.8.1-27 (env-slot access counts as "not signed in"; the banner identity only recognizes official slots / OAuth) are untouched — in the env-slot scenario the banner still shows "Not signed in" while the footer shows the model; the two coexist without contradiction (sign-in identity and model availability are separate concerns). The existing handleResult fallback and modelLabel() behavior are unchanged; normally signed-in boots (official slot / OAuth) still get model metadata directly from the runtime and never go through the new path.

Verification: tsc --noEmit passes; full bun test 693 pass / 0 fail (78 files); all 5 TUI smoke tests pass (smoke-tui with the two new assertions and the env-slot section; features / clear / pressure / widths without regression); after build:tui the vendored @zcode/tui copy was synced manually following the same steps as installLocalTui (no runtime changes).

Install

npm install -g https://github.com/xhqing/zcode-cli/releases/latest/download/zcode-cli-3.8.1-30.tgz