pi-crew 0.9.46 → 0.9.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +16 -2
  3. package/dist/build-meta.json +289 -164
  4. package/dist/index.mjs +1744 -2732
  5. package/dist/index.mjs.map +4 -4
  6. package/docs/decisions/2026-07-21-broker-phase4-default-on.md +77 -0
  7. package/docs/decisions/2026-07-21-broker-windows-perms.md +91 -0
  8. package/docs/decisions/2026-07-22-broker-phase4-gated-on.md +99 -0
  9. package/docs/decisions/README.md +3 -0
  10. package/docs/publishing.md +26 -0
  11. package/package.json +3 -1
  12. package/scripts/build-bundle.mjs +7 -0
  13. package/scripts/postinstall.mjs +35 -1
  14. package/scripts/pty_probe.py +174 -0
  15. package/skills/real-test-pi-crew/SKILL.md +659 -0
  16. package/src/config/config.ts +42 -1
  17. package/src/config/defaults.ts +45 -1
  18. package/src/config/types.ts +19 -0
  19. package/src/extension/register.ts +6 -1
  20. package/src/extension/registration/context-builder.ts +4 -0
  21. package/src/extension/registration/lifecycle-handlers.ts +166 -3
  22. package/src/extension/registration/registration-types.ts +9 -0
  23. package/src/prompt/prompt-runtime.ts +108 -0
  24. package/src/runtime/broker-issuer.ts +37 -0
  25. package/src/runtime/child-pi-spawn.ts +53 -0
  26. package/src/runtime/child-pi.ts +42 -11
  27. package/src/runtime/crew-broker-child.ts +88 -0
  28. package/src/runtime/crew-broker-client.ts +673 -0
  29. package/src/runtime/crew-broker-tokens.ts +84 -0
  30. package/src/runtime/crew-broker.ts +1276 -0
  31. package/src/runtime/dynamic-workflow-context.ts +7 -3
  32. package/src/runtime/dynamic-workflow-runner.ts +1 -1
  33. package/src/runtime/plan-templates.ts +8 -6
  34. package/src/schema/config-schema.ts +14 -0
  35. package/src/state/mailbox.ts +43 -0
  36. package/src/ui/key-utils.ts +42 -0
  37. package/src/ui/keybinding-map.ts +29 -3
  38. package/src/ui/run-dashboard.ts +28 -0
  39. package/src/ui/settings-overlay.ts +42 -22
  40. package/src/utils/ndjson.ts +115 -0
  41. package/src/utils/session-utils.ts +30 -0
  42. package/src/utils/socket-path.ts +127 -0
  43. package/workflows/default.workflow.md +1 -1
  44. package/workflows/fast-fix.workflow.md +1 -1
  45. package/workflows/plan-execute.workflow.md +1 -1
  46. package/workflows/review.workflow.md +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,66 @@
3
3
  > **Note:** `atomic-write-v2.ts` / `AtomicWriter` mentioned in historical entries below was consolidated into `atomic-write.ts` as of v0.9.42. This changelog is preserved as historical record — the migration was completed (the v2 class was never adopted; v1 won on simplicity + symlink-safety + link+unlink atomicity). See `docs/migration/atomic-write-v2-migration.md` for the decision rationale.
4
4
 
5
5
 
6
+ ## [0.9.47] — Broker Phase 4 gated ON (default-on flip) (2026-07-22)
7
+
8
+ Flips `broker.enabled` from `false` to `true` as the new default on Linux
9
+ + macOS. Windows users continue to see the broker silently disabled
10
+ (decision doc `2026-07-21-broker-windows-perms.md` — no unix socket on
11
+ native Windows). Three independent kill switches remain available:
12
+
13
+ 1. `broker.enabled: false` in user config
14
+ 2. env `PI_CREW_BROKER=0` (beats config=true)
15
+ 3. Windows — auto-disabled
16
+
17
+ ### Changes
18
+
19
+ - **`src/config/defaults.ts`**: `DEFAULT_BROKER.enabled: false` → `true`.
20
+ - **`src/extension/registration/lifecycle-handlers.ts`**: `effectiveEnabled()`
21
+ now returns `cfg?.enabled !== false` (default-on) instead of
22
+ `cfg?.enabled === true` (opt-in).
23
+ - **`test/unit/crew-broker-feature-flag.test.ts`**: now asserts
24
+ `DEFAULT_BROKER.enabled === true` (Phase 4 default-on).
25
+ - **`test/unit/crew-broker-server-gate.test.ts`**: "config flag off" test
26
+ renamed to "env kill switch (PI_CREW_BROKER=0)" — env is the load-bearing
27
+ kill switch under default-on.
28
+ - **`docs/decisions/2026-07-22-broker-phase4-gated-on.md`**: new decision
29
+ doc supersedes the v0.9.46 default-off stance.
30
+ - **Plan templates + workflows** (verifier fix from prior session):
31
+ `verificationCommand` now `npm run test:critical && npx tsc --noEmit`
32
+ (97 broker+UI tests in ~20s; well under worker 300s timeout) instead of
33
+ full `npm test` (>4 min). All 4 verifier workflow prompts updated.
34
+ - **`package.json`**: new `test:critical` script — a curated 14-file subset
35
+ (97 tests, ~20s) for fast in-loop verification of broker/UI/config changes.
36
+ Full `npm test` (>4 min) caused verifier workers to hit the 300s
37
+ `RESPONSE_TIMEOUT_MS` and get SIGKILLed (exit 143).
38
+ - **`skills/real-test-pi-crew/SKILL.md`**: new skill distilling the 8-tier
39
+ end-to-end verification discipline used to ship the broker Phase-4 rollout
40
+ (critical tests → 3-path kill-switch proof → typecheck+bundle → bundle md5
41
+ sync → live TUI probing via tmux/pty → smoke team run). 659 lines, 26
42
+ sections, 15 triggers. Bundled `scripts/pty_probe.py` (174-line hardened
43
+ TUI probe with zombie reaping).
44
+ - **`scripts/postinstall.mjs`**: new `copySkills()` step mirrors every
45
+ `skills/<name>/` dir to `~/.pi/agent/skills/` on install, so pi-crew's
46
+ skills are available globally (not just inside the pi-crew project).
47
+ Best-effort, never fails the install.
48
+
49
+ ### Verification
50
+
51
+ - Default-on: `npm run test:critical` → **97/97 pass in ~15s**.
52
+ - Disabled: `PI_CREW_BROKER=0 npm run test:critical` → **97/97 pass in ~15s**.
53
+ - Explicit-on: `PI_CREW_BROKER=1 npm run test:critical` → **97/97 pass in ~15s**.
54
+ - Typecheck clean. Bundle rebuilt (md5 `d9c8412cb090735239935f5fa6d7b79a`, ~2.68 MB).
55
+ - Live TUI verified via tmux + pty probe (`/team-help` renders, no zombie
56
+ processes).
57
+ - Smoke team run `team_20260723154250_8955437a182b3f12` (fast-fix): 3/3 PASS,
58
+ verifier used `test:critical` cache, completed in 386s wall-clock (no hang).
59
+
60
+ ### Rollback
61
+
62
+ If post-release issues emerge: flip `DEFAULT_BROKER.enabled` back to `false`
63
+ in `src/config/defaults.ts`, rebuild bundle, cut v0.9.48. Users can also
64
+ disable immediately via `broker.enabled: false` or `PI_CREW_BROKER=0`.
65
+
6
66
  ## [0.9.46] — UI stability + notification coalescing (2026-07-20)
7
67
 
8
68
  Three user-facing UI/notification fixes layered on top of the v0.9.45
package/README.md CHANGED
@@ -68,6 +68,8 @@ repo: https://github.com/baphuongna/pi-crew
68
68
  - **Strict SKILL.md validation** (L3, v0.9.8) — skills with malformed frontmatter (missing/malformed `name`/`description`, type mismatches) now **fail-fast at discovery** with visible diagnostics, instead of silently producing broken behavior at runtime. HYBRID policy: HARD on required fields, SOFT (warn) on unknown props for forward-compat. Surfaced via `buildSkillValidationDiagnostics()`.
69
69
  - **Durable event replay** (L1, v0.9.8) — `RunEventBus.onWithReplay()` catches up a re-subscribing dashboard/overlay with events it missed during transient absence (toggle, reconnect), replaying from the durable JSONL log with seq-based dedup. No information loss even if the live subscriber was briefly gone.
70
70
  - **Lossless-by-default output handling** (L4, v0.9.8) — worker output thresholds sized from measured data (100% of real outputs fit without compaction); when compaction is unavoidable it keeps head+tail (preserves closing code fences/headings) instead of head-only truncation. No more `[pi-crew compacted N chars]` markers eating the end of a worker's result.
71
+ - **Inter-pi broker** (v0.9.47, default-on) — a Unix-domain-socket message bus that lets concurrently-running Pi sessions pass messages, steering notes, and task-status events to each other. **On by default** on Linux + macOS; auto-disabled on native Windows (no unix socket). Three independent kill switches: `broker.enabled: false` (config), `PI_CREW_BROKER=0` (env, always wins), Windows auto-disable. See [docs/decisions/2026-07-22-broker-phase4-gated-on.md](docs/decisions/2026-07-22-broker-phase4-gated-on.md).
72
+ - **`test:critical` + `real-test-pi-crew` skill** (v0.9.47) — a curated 14-file / 97-test subset (`npm run test:critical`, ~20s) for fast in-loop verification, plus a bundled skill distilling the full 8-tier end-to-end verification discipline (unit → 3-path kill-switch proof → typecheck/bundle → live TUI probing → smoke team run). Prevents the verifier-worker hang that full `npm test` (>4 min) caused against the 300s worker timeout.
71
73
 
72
74
  ---
73
75
 
@@ -284,6 +286,14 @@ The advisory is **informational only** — there is no `force:true` flag needed
284
286
 
285
287
  ## Recent changes
286
288
 
289
+ ### v0.9.47 (2026-07-22): Inter-pi broker Phase 4 (default-on) + verifier-hang fix + verification skill
290
+
291
+ - **Broker default-on**: `broker.enabled` flipped `false` → `true` on Linux + macOS. The inter-pi broker lets concurrent Pi sessions exchange messages, steering notes, and task-status events over a Unix-domain socket. Three kill switches remain: config `broker.enabled: false`, env `PI_CREW_BROKER=0` (always wins), Windows auto-disable.
292
+ - **Verifier-hang fix**: `npm run test:critical` — a curated 14-file / 97-test subset (~20s) replaces full `npm test` (>4 min) in verifier prompts. The full suite was exceeding the 300s `RESPONSE_TIMEOUT_MS`, killing workers with exit 143. Both plan-templates and all 4 workflow verifier prompts now specify the fast command.
293
+ - **`real-test-pi-crew` skill** (659 lines): distills the 8-tier verification discipline used to ship this release (critical tests → 3-path kill-switch proof → typecheck/bundle → bundle md5 sync → live TUI probing via tmux/pty → smoke team run). Bundled `scripts/pty_probe.py`.
294
+ - **Postinstall `copySkills()`**: `npx pi install .` now mirrors every `skills/<name>/` to `~/.pi/agent/skills/` for global availability.
295
+ - See [CHANGELOG.md](CHANGELOG.md) §0.9.47 and [docs/decisions/2026-07-22-broker-phase4-gated-on.md](docs/decisions/2026-07-22-broker-phase4-gated-on.md).
296
+
287
297
  ### v0.9.45 – v0.9.46 (2026-07-20): security + perf remediation, UI stability
288
298
 
289
299
  - **Custom agent roles default to read-only (FIND-12, breaking):**
@@ -645,6 +655,9 @@ Your system prompt here.
645
655
 
646
656
  | Variable | Purpose |
647
657
  |----------|---------|
658
+ | `PI_CREW_BROKER=0` | **Disable the inter-pi broker entirely** (always wins over config). Use to opt out of cross-session messaging. |
659
+ | `PI_CREW_BROKER=1` | Explicitly enable the broker (redundant under the v0.9.47 default-on; useful for overriding a config `broker.enabled: false`). |
660
+ | `PI_CREW_BROKER_DIAG_UI=1` | Make the run-dashboard `handleInput` emit a `[PI-CREW-DIAG]` line to stderr per keystroke — for TUI keybinding probes. |
648
661
  | `PI_CREW_USE_BUNDLE=1` | Load via bundled `dist/index.mjs` (~5% faster cold-start). Default: strip-types. Requires `npm run build:bundle` to have produced `dist/`. Falls back to strip-types with a one-time warning if the bundle is missing. See `scripts/bench-cold-start.mjs`. |
649
662
  | `PI_CREW_EXECUTE_WORKERS=0` | Disable child workers (scaffold mode) |
650
663
  | `PI_TEAMS_EXECUTE_WORKERS=0` | Legacy disable flag |
@@ -677,13 +690,14 @@ The watcher is the dev-loop companion to `check:bundle-staleness` (CI gate) —
677
690
  ```bash
678
691
  cd pi-crew
679
692
  npm install # dependencies
680
- npm test # unit + integration tests (~4,800 tests)
693
+ npm test # unit + integration tests (~6,500 tests)
694
+ npm run test:critical # fast subset: 97 broker/UI tests in ~20s
681
695
  npm run typecheck # tsc --noEmit
682
696
  npm run ci # full CI-equivalent check
683
697
  npm pack --dry-run # package verification
684
698
  ```
685
699
 
686
- Stats: **431 source files** (87K lines) · **606 test files** (85K lines) · **~5,860 tests, 0 failures** · **CI: Ubuntu ✅ macOS ✅ Windows ✅**
700
+ Stats: **477 source files** (108K lines) · **682 test files** (~6,500 tests) · **CI: Ubuntu ✅ macOS ✅ Windows ✅**
687
701
 
688
702
  ---
689
703