v0.6.8
polycli v0.6.8
Adds background-worker run-ledger plumbing and a read-only terminal TUI inspector on top of v0.6.7. No provider runtime semantics or upstream CLI behavior changed.
What changed
Background-job ledger plumbing (Q6 Spec 2)
- The parent process persists a top-level
runContext(runId / command / hostSurface / argv / jobId / provider / kind / model / defaultModel / logFile) into the per-job config when--run-id(orPOLYCLI_RUN_ID) is in scope. After spawning the worker, the parent writes onejob_startedevent. _job-workerreadsrunContextand writesattempt_startedbeforerunProviderPromptStreaming. After the job write succeeds, the worker writesattempt_result(statuscompleted/failed) plusprovider_decision(adoptedon ok,failed reason=<kind>_failedon not-ok). Worker-observed cancellation producesattempt_result status=cancelled+provider_decision status=cancelled reason=job_cancelled.- New shared writer
recordRunEventForContext(workspaceRoot, runContext, base); existingrecordRunEventdelegates viabuildCurrentRunContext(). Worker code never mutates the parent-sideRUN_CONTEXTglobal. createRunLedgerEventschema gains nullablepid/durationMsslots; foreground events round-trip with the existing fields and addnulldefaults for the new ones.- Tests: 3 new background integration tests (success with
--run-id, failedcmd askwithout full-prompt leakage, explicitPOLYCLI_HOST_SURFACE=codex-skillpropagation). - Killed-worker (
kill -9after provider returns but before the ledger write) perfect recovery is open ledger-side hardening (reaper or scan-on-read step), not a TUI gate.
Read-only TUI inspector (Q6 Spec 3)
- New terminal-only
polycli tuicommand, routed through the existing@bbingz/polycliwrapper. It does not run, retry, cancel, or mutate provider jobs; it only renders persisted run-ledger / debug data. - Pure view-model layer (
packages/polycli-terminal/lib/tui/view-model.mjs) withclassifyProviderStates,formatReproductionCommand,truncateMiddle,applyKey,buildTuiModel,renderTuiFrame— testable without a real TTY. - Real navigation:
up/down/k/jmove run selection (clamped at the ends),enteropens the selected run's detail view,breturns to list,tabcycles the focused pane (runs→providers→events→repro),?toggles a Help line,rrefreshes from the ledger,q/ Ctrl-C quit. Footer only names keys actually wired. - Selection change reloads the selected run's
debug show+debug explainso the matrix / timeline / detail panes always reflect the active run, not the initial one.rrefresh preserves the current selection unless the run disappears from the index. - Raw-mode safety:
interactive()enters raw mode under atry / finallyguard with an idempotentrestoreRawMode(also hooked intoSIGINTandexit). Initial-load failure and refresh-load failure both restore raw mode before exiting; refresh failures show an error frame and stay in the loop untilq. --history <count>validates a non-negative integer and slices the runs index in the TUI (companiondebug runscontract unchanged).--run-id <id>selects an explicit run.- TUI files ship in the
@bbingz/polyclitarball:bin/polycli-tui.mjs,lib/tui/view-model.mjs. New packaging assertion inscripts/tests/open-source-packaging.test.mjs. - Jobs with
startedorattempt_startedbut no terminalattempt_result/provider_decisionrender asunfinished/unknown. Killed-worker perfect recovery is the open ledger-side follow-up; it is not a TUI gate. - Smoke-only
--script-keys "<k1,k2,...>"test hook drives the runtime through key sequences (down,down,enter, etc.) so selection-change-reloads-detail and other key transitions are testable without a real TTY.
Run-ledger debug examples docs
docs/polycli-v1-public-surface.mdadds a "Run ledger debug examples" section that walks through the original Q6 narrative end-to-end:cmdhealth passed, but twoaskattempts failed → not adopted.pihealth failed → skipped before any prompt-bearing work.
- Examples reference event-schema slots (
provider_decision,health_result,reason: ask_failed/health_failed) andpolycli debug runs / show / explain, not invented live provider output.
Manual smoke (v0.6.8 prep)
Automated smoke against the real node packages/polycli-terminal/bin/polycli.mjs tui ... binary (via --smoke and --script-keys) on 2026-05-07:
- ✅ TUI renders a frame from a real ledger fixture (
view:list pane:runs, run list, provider matrix, footer). - ✅
downreloads run-b's detail (matrix flips fromqwen adoptedtopi skipped health_failed). - ✅
down,enterenters detail view and surfaces run-b's explanation block (view:detail,explanation,pi skipped (health_failed)). - ✅
down,enter,breturns toview:list. - ✅
?toggles theHelp:line on; the persistent footer stays. - ✅
tab,tabcycles focused pane toevents. - ✅
--history=1renders only one run. - ✅ Non-TTY interactive entry exits 1 with the
requires an interactive TTYerror and never enters raw mode.
User-side TTY verification still required before tagging / publishing v0.6.8 (these paths are interactive-only and cannot be exercised from a non-TTY harness):
polycli tuiopens in a real terminal andqquits without leaving the terminal in raw mode.rrefresh in interactive mode re-reads the ledger and re-renders without crashing.- Visible cursor / colour state restored after
q.
Verification targets
node --test scripts/tests/terminal-tui.test.mjs scripts/tests/open-source-packaging.test.mjsnpm testnpm run release:check
Publish notes
This release adds no new npm package. Same 6 release artifacts as v0.6.7:
- GitHub release
v0.6.8 - npm
@bbingz/polycli-opencode@0.6.8 - npm
@bbingz/polycli@0.6.8 - Utility packages stay on independent v1.x cadence (
@bbingz/polycli-utils@1.0.1,@bbingz/polycli-timing@1.0.1).
See docs/release.md for the full sequence.