pi-crew 0.9.44 → 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.
- package/CHANGELOG.md +136 -0
- package/README.md +38 -3
- package/dist/build-meta.json +349 -203
- package/dist/index.mjs +2229 -2968
- package/dist/index.mjs.map +4 -4
- package/docs/decisions/2026-07-21-broker-phase4-default-on.md +77 -0
- package/docs/decisions/2026-07-21-broker-windows-perms.md +91 -0
- package/docs/decisions/2026-07-22-broker-phase4-gated-on.md +99 -0
- package/docs/decisions/README.md +3 -0
- package/docs/publishing.md +26 -0
- package/package.json +3 -1
- package/scripts/build-bundle.mjs +7 -0
- package/scripts/postinstall.mjs +35 -1
- package/scripts/pty_probe.py +174 -0
- package/skills/real-test-pi-crew/SKILL.md +659 -0
- package/src/agents/discover-agents.ts +1 -1
- package/src/config/config.ts +42 -1
- package/src/config/defaults.ts +45 -1
- package/src/config/types.ts +19 -0
- package/src/extension/register.ts +6 -1
- package/src/extension/registration/context-builder.ts +4 -0
- package/src/extension/registration/lifecycle-handlers.ts +200 -6
- package/src/extension/registration/registration-types.ts +9 -0
- package/src/extension/registration/subagent-manager-setup.ts +178 -59
- package/src/extension/run-import.ts +21 -1
- package/src/extension/team-tool/api.ts +4 -2
- package/src/prompt/prompt-runtime.ts +108 -0
- package/src/runtime/async-runner.ts +9 -1
- package/src/runtime/broker-issuer.ts +37 -0
- package/src/runtime/child-pi-spawn.ts +53 -0
- package/src/runtime/child-pi.ts +42 -11
- package/src/runtime/crew-broker-child.ts +88 -0
- package/src/runtime/crew-broker-client.ts +673 -0
- package/src/runtime/crew-broker-tokens.ts +84 -0
- package/src/runtime/crew-broker.ts +1276 -0
- package/src/runtime/dynamic-workflow-context.ts +7 -3
- package/src/runtime/dynamic-workflow-runner.ts +1 -1
- package/src/runtime/manifest-cache.ts +30 -0
- package/src/runtime/plan-templates.ts +8 -6
- package/src/runtime/resilient-edit.ts +16 -15
- package/src/runtime/role-permission.ts +27 -2
- package/src/runtime/run-coalesced-task-group.ts +72 -15
- package/src/runtime/task-packet.ts +1 -1
- package/src/schema/config-schema.ts +14 -0
- package/src/state/event-log.ts +88 -34
- package/src/state/locks.ts +53 -0
- package/src/state/mailbox.ts +208 -4
- package/src/state/run-metrics.ts +40 -12
- package/src/ui/key-utils.ts +42 -0
- package/src/ui/keybinding-map.ts +29 -3
- package/src/ui/live-run-sidebar.ts +1 -9
- package/src/ui/run-dashboard.ts +29 -9
- package/src/ui/settings-overlay.ts +42 -22
- package/src/utils/incremental-reader.ts +105 -0
- package/src/utils/ndjson.ts +115 -0
- package/src/utils/session-utils.ts +30 -0
- package/src/utils/socket-path.ts +127 -0
- package/src/utils/visual.ts +27 -91
- package/workflows/default.workflow.md +1 -1
- package/workflows/fast-fix.workflow.md +1 -1
- package/workflows/plan-execute.workflow.md +1 -1
- package/workflows/review.workflow.md +1 -1
- package/src/runtime/auto-resume.ts +0 -100
- package/src/runtime/notebook-helpers.ts +0 -88
- package/src/runtime/orphan-sentinel.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,142 @@
|
|
|
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
|
+
|
|
66
|
+
## [0.9.46] — UI stability + notification coalescing (2026-07-20)
|
|
67
|
+
|
|
68
|
+
Three user-facing UI/notification fixes layered on top of the v0.9.45
|
|
69
|
+
remediation, plus CI hygiene. All verified live in a restarted Pi session.
|
|
70
|
+
|
|
71
|
+
### UI flicker — stop render-path snapshot-cache deletes
|
|
72
|
+
|
|
73
|
+
The run-snapshot cache has a deliberate stale-while-revalidate design so the
|
|
74
|
+
widget always shows a populated snapshot. That was defeated by three hot-path
|
|
75
|
+
call sites in `lifecycle-handlers.ts` that hard-deleted cache entries; the worst
|
|
76
|
+
ran `invalidate(undefined)` on every ~160ms fallback tick, wiping ALL entries
|
|
77
|
+
→ `activeWidgetRuns` dropped every run to "(loading…)" until the async preload
|
|
78
|
+
rebuilt the cache → continuous flicker across the widget, powerbar, and live
|
|
79
|
+
sidebar/dashboard. (`src/extension/registration/lifecycle-handlers.ts`)
|
|
80
|
+
|
|
81
|
+
**Fix:** never hard-delete from the render path. A no-runId tick is now a no-op;
|
|
82
|
+
a specific runId calls `refreshIfStale` (stale-while-revalidate); the two
|
|
83
|
+
`fs.watch` change handlers call `refresh` (rebuild-in-place). All three keep the
|
|
84
|
+
entry populated so `get()` never returns `undefined`.
|
|
85
|
+
|
|
86
|
+
### TUI width-overflow crash — delegate `visibleWidth` to pi-tui
|
|
87
|
+
|
|
88
|
+
`Rendered line N exceeds terminal width (160 > 159)` killed the host Pi process
|
|
89
|
+
whenever an agent emitted an emoji that pi-crew's hand-maintained `WIDE_RANGES`
|
|
90
|
+
table counted as 1 column but pi-tui (the renderer) counted as 2 (e.g. `⏳`
|
|
91
|
+
U+23F3). pi-crew truncated/padded to its own measure, pi-tui re-measured and
|
|
92
|
+
hard-aborted. This was patched twice before by adding individual codepoints —
|
|
93
|
+
whack-a-mole, since ANY emoji in agent output could trigger it.
|
|
94
|
+
(`src/utils/visual.ts`)
|
|
95
|
+
|
|
96
|
+
**Definitive fix:** `visibleWidth` now delegates to pi-tui's own `visibleWidth`
|
|
97
|
+
(the function that drives the crash assert). truncate/pad/wrap therefore always
|
|
98
|
+
agree with the renderer; an emoji-width mismatch is structurally impossible. The
|
|
99
|
+
hand-maintained `WIDE_RANGES`/`isWideCodePoint` table is removed.
|
|
100
|
+
|
|
101
|
+
### Notification coalescing — N drip → 1 consolidated wake-up
|
|
102
|
+
|
|
103
|
+
Launching N background subagents (no `batch_id`) produced N separate "changed
|
|
104
|
+
state" wake-ups, delivered one-per-turn at turn boundaries; after the leader
|
|
105
|
+
joined them all, redundant per-agent notices kept dripping in over later turns.
|
|
106
|
+
(`src/extension/registration/subagent-manager-setup.ts`)
|
|
107
|
+
|
|
108
|
+
**Fix (Rule 3):** a debounced coalescer for non-batch completions. Completions
|
|
109
|
+
within an 800ms window (reset on each new arrival) merge into ONE wake-up; each
|
|
110
|
+
is `resultConsumed`-re-checked before emit (Rule 2), so already-joined agents
|
|
111
|
+
are dropped and an all-consumed batch is suppressed entirely. Completions far
|
|
112
|
+
apart (>800ms) still flush separately. The explicit-`batch_id` path (Rule 1,
|
|
113
|
+
BatchBarrier) is unchanged.
|
|
114
|
+
|
|
115
|
+
### CI hygiene
|
|
116
|
+
|
|
117
|
+
`biome check --write` applied across the v0.9.45 remediation files (lint +
|
|
118
|
+
format), and two unused test imports were removed — the local remediation
|
|
119
|
+
commits had never been CI-checked; this brings lint + format:check green.
|
|
120
|
+
|
|
121
|
+
## [0.9.45] — Deep-review 2026-07-20 remediation (all 5 phases, 14 findings)
|
|
122
|
+
|
|
123
|
+
### ⚠️ BREAKING: custom agent roles default to read-only (FIND-12)
|
|
124
|
+
|
|
125
|
+
`permissionForRole()` now returns `"read_only"` for unknown/custom agent
|
|
126
|
+
roles instead of the previous permissive `"workspace_write"`. This is a
|
|
127
|
+
security hardening (default-deny) to prevent privilege escalation via
|
|
128
|
+
typo'd or unrecognized agent names.
|
|
129
|
+
|
|
130
|
+
**Migration:** write-capable roles are now an EXPLICIT allowlist
|
|
131
|
+
(`WRITE_ROLES` in `src/runtime/role-permission.ts`). All shipped
|
|
132
|
+
write-capable roles are listed: `executor`, `writer`, `verifier`,
|
|
133
|
+
`test-engineer`, `agent` (direct-agent default), `cold-verifier`,
|
|
134
|
+
`chain-executor` (chain workflow), and `worker` (goal-loop + dynamic
|
|
135
|
+
workflow). A custom agent role that needs workspace write access
|
|
136
|
+
must be added to `WRITE_ROLES`. Built-in read-only roles (`explorer`,
|
|
137
|
+
`reviewer`, `security-reviewer`, `analyst`, `critic`, `planner`) are
|
|
138
|
+
unaffected. (An earlier draft proposed a `permissions.workspaceWrite`
|
|
139
|
+
agent-config opt-in; it was dropped — unreachable from the call sites.)
|
|
140
|
+
|
|
141
|
+
|
|
6
142
|
## [0.9.44] — 3 flaky CI test fixes (2026-07-19)
|
|
7
143
|
|
|
8
144
|
Three pre-existing flaky tests in the CI suite have been fixed, completing
|
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
|
|
|
@@ -282,7 +284,36 @@ The advisory is **informational only** — there is no `force:true` flag needed
|
|
|
282
284
|
|
|
283
285
|
- `test/functional/pi-crew-live.test.ts` + `test/functional/pi-crew-live-broad.test.ts` — 16 live integration tests run against the **real pi binary + real LLM provider** (verified after v0.9.42 audit, ~26 commits). Use these when you want to confirm end-to-end behavior, not just unit-level invariants.
|
|
284
286
|
|
|
285
|
-
## Recent changes
|
|
287
|
+
## Recent changes
|
|
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
|
+
|
|
297
|
+
### v0.9.45 – v0.9.46 (2026-07-20): security + perf remediation, UI stability
|
|
298
|
+
|
|
299
|
+
- **Custom agent roles default to read-only (FIND-12, breaking):**
|
|
300
|
+
`permissionForRole()` returns `"read_only"` for unknown roles (was
|
|
301
|
+
permissive `"workspace_write"`). Write-capable roles are now an explicit
|
|
302
|
+
allowlist (`WRITE_ROLES`). See `CHANGELOG.md` for the migration.
|
|
303
|
+
- **Mailbox / snapshot-cache / scan perf:** delivery cache + async append
|
|
304
|
+
(FIND-01/02), `listActive` TTL + mtime-sort strict limit (FIND-03/04),
|
|
305
|
+
byte-bounded event-log tail-read (FIND-05).
|
|
306
|
+
- **Heartbeat race (FIND-06):** in-flight guard + drain + terminal-safety +
|
|
307
|
+
late-save repair in the coalesced task group.
|
|
308
|
+
- **UI flicker eliminated:** the render path no longer hard-deletes snapshot
|
|
309
|
+
entries, so the crew widget / powerbar / live sidebar stay stable (no more
|
|
310
|
+
"(loading…)" flashing every ~160ms).
|
|
311
|
+
- **Emoji width-overflow crash fixed for good:** `visibleWidth` delegates to
|
|
312
|
+
pi-tui's own measure, so agent-output emoji can never exceed terminal width.
|
|
313
|
+
- **Background-subagent notifications coalesce:** N near-simultaneous
|
|
314
|
+
completions now produce ONE consolidated wake-up instead of N drips.
|
|
315
|
+
|
|
316
|
+
### v0.9.42 – v0.9.44: 4-wave audit + flaky-CI fixes
|
|
286
317
|
|
|
287
318
|
A 4-wave audit + fix pass was completed (see `UPGRADE_REVIEW.md` for the full 647-line report and `CHANGELOG.md` for the diff):
|
|
288
319
|
|
|
@@ -624,6 +655,9 @@ Your system prompt here.
|
|
|
624
655
|
|
|
625
656
|
| Variable | Purpose |
|
|
626
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. |
|
|
627
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`. |
|
|
628
662
|
| `PI_CREW_EXECUTE_WORKERS=0` | Disable child workers (scaffold mode) |
|
|
629
663
|
| `PI_TEAMS_EXECUTE_WORKERS=0` | Legacy disable flag |
|
|
@@ -656,13 +690,14 @@ The watcher is the dev-loop companion to `check:bundle-staleness` (CI gate) —
|
|
|
656
690
|
```bash
|
|
657
691
|
cd pi-crew
|
|
658
692
|
npm install # dependencies
|
|
659
|
-
npm test # unit + integration tests (~
|
|
693
|
+
npm test # unit + integration tests (~6,500 tests)
|
|
694
|
+
npm run test:critical # fast subset: 97 broker/UI tests in ~20s
|
|
660
695
|
npm run typecheck # tsc --noEmit
|
|
661
696
|
npm run ci # full CI-equivalent check
|
|
662
697
|
npm pack --dry-run # package verification
|
|
663
698
|
```
|
|
664
699
|
|
|
665
|
-
Stats: **
|
|
700
|
+
Stats: **477 source files** (108K lines) · **682 test files** (~6,500 tests) · **CI: Ubuntu ✅ macOS ✅ Windows ✅**
|
|
666
701
|
|
|
667
702
|
---
|
|
668
703
|
|