pi-crew 0.11.11 → 0.11.12

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 (42) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/index.mjs +550 -519
  3. package/package.json +1 -1
  4. package/src/config/config-validation.ts +9 -0
  5. package/src/config/defaults.ts +7 -0
  6. package/src/config/env-vars.ts +24 -0
  7. package/src/config/types.ts +11 -0
  8. package/src/extension/registration/tool-registration.ts +7 -0
  9. package/src/extension/registration/verify-gate-tool.ts +263 -0
  10. package/src/prompt/inbox-poll.ts +141 -3
  11. package/src/runtime/broker/crew-broker.ts +48 -2
  12. package/src/runtime/broker/protocol/request-parsers.ts +8 -1
  13. package/src/runtime/child-pi/child-pi-constants.ts +24 -0
  14. package/src/runtime/child-pi/child-pi-kill.ts +59 -2
  15. package/src/runtime/child-pi/child-pi-rpc.ts +1021 -0
  16. package/src/runtime/child-pi/child-pi-steering.ts +10 -8
  17. package/src/runtime/child-pi/child-pi-streams.ts +69 -19
  18. package/src/runtime/child-pi/child-pi.ts +29 -30
  19. package/src/runtime/child-pi/owned-process.ts +434 -0
  20. package/src/runtime/child-pi/postmortem-registry.ts +134 -0
  21. package/src/runtime/classifier/ambient-noise-gate.ts +126 -0
  22. package/src/runtime/classifier/classifier-service.ts +277 -61
  23. package/src/runtime/dispatch-batch.ts +32 -0
  24. package/src/runtime/live-session/live-agent-control.ts +2 -0
  25. package/src/runtime/live-session/live-agent-manager.ts +72 -2
  26. package/src/runtime/live-session/live-session-runtime.ts +435 -40
  27. package/src/runtime/recovery/crash-recovery.ts +141 -3
  28. package/src/runtime/recovery/retry-executor.ts +29 -0
  29. package/src/runtime/stale-reconciler.ts +36 -1
  30. package/src/runtime/task-runner.ts +103 -0
  31. package/src/runtime/verification/classifier-pre-gate.ts +262 -0
  32. package/src/runtime/verification/verification-gates.ts +5 -1
  33. package/src/runtime/verification/verify-gate.ts +394 -0
  34. package/src/schema/config-schema.ts +13 -0
  35. package/src/state/contracts.ts +13 -0
  36. package/src/state/coordination/mailbox.ts +203 -55
  37. package/src/state/stores/sqlite-run-state.ts +378 -0
  38. package/src/state/stores/state-store.ts +134 -6
  39. package/src/ui/agents-jobs-browser.ts +154 -8
  40. package/src/ui/events-state-source.ts +358 -0
  41. package/src/ui/run-snapshot-cache.ts +87 -3
  42. package/src/ui/widget/widget-model.ts +13 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.12] — Upgrade Wave 2: U4 live-session v2, U5 mailbox dedup, U6A classifier triage, U14 rpc mode, U15 OwnedProcess (2026-10-10)
4
+
5
+ Wave 2 of the upgrade-spec program. One commit per spec; test:critical 120/0,
6
+ full npm test 0 fail (unit 8842/8845 + integration 139/143, gated skips only),
7
+ bundle rebuilt fresh; wave-2 review 0 MAJOR with MINOR-1..4 pool/env hardening
8
+ landed as follow-up. Waves 2+3 released together as 0.11.12.
9
+
10
+ ### Changed
11
+
12
+ - **U4** — live-session v2: shared services bundle (one lazy build, sessions
13
+ from `createAgentSessionFromServices` — measured init drop ~2240ms → <50ms
14
+ via `session_created.elapsedMs`), two-layer recursion guard (loader-level
15
+ noExtensions + foreign-extension assert), `streamingBehavior` on every
16
+ prompt path, normalized dispose (drain pendingSteers, terminated handles
17
+ reject steer), D4 planning-window steer-loss fix (placeholder session
18
+ queues and replays to the real session), hung-tool drop-reference escape.
19
+ - **U5** — mailbox `requestId` dedup: every send carries a unique requestId,
20
+ receivers dedup by (direction, requestId) durably, resend-after-resume is
21
+ idempotent (7/7 tests).
22
+ - **U14** — child-pi protocol v2: `--mode rpc` transport (steer receipts,
23
+ isStreaming-gated steer + clear_queue before prompt, type-filtered event
24
+ subscription, absolute bundle cliPath), 18/18 tests; pool reuse opt-in
25
+ (`PI_CREW_CHILD_PI_POOL`, default off). MINOR-1..4: busy-alive pool entries
26
+ never evicted, drain ceiling gated on pool flag, run-scoped named listeners
27
+ detached in settle(), env-splice canary.
28
+ - **U15** — OwnedProcess port: process-group ownership (detached spawn →
29
+ group-kill), escalating dispose with hard cap, root-exit drain-reconcile,
30
+ pid-recycle guard, postmortem registry; 11/11 tests.
31
+
32
+ ### Added
33
+
34
+ - **U6A** — classifier retry-triage flag (`classifierEnabled`, default off):
35
+ confidence passthrough + histogram + `task.noise_gate` events, soft-fail on
36
+ every branch (12 tests).
37
+
38
+
39
+ ## [0.11.12] — Upgrade Wave 3 (con't): U7 events view layer, U8 sqlite state, U9 reconcile-at-open, U6B classifier pre-gate, U13 verify_gate (2026-10-10)
40
+
41
+ Wave 3 of the upgrade-spec program (`pi-crew-upgrade-spec-2026-10-09.md`), branch
42
+ `upgrade/wave-3`, one commit per spec. Final gate: unit 8934 tests (8925 pass;
43
+ 4 shard/snapshot registrations fixed and re-verified green; 2 load-flakes green in
44
+ isolation), integration 144/0 fail, typecheck + lint clean, `dist/index.mjs` rebuilt
45
+ fresh with every wave-3 string-literal marker verified in-bundle.
46
+
47
+ ### Added
48
+
49
+ - **U7** — events state source view layer: `eventsStateSource(runId)`
50
+ CommittedStateSource adapter (snapshot = one full parse to the current seq; frames =
51
+ `readEventsCursor` tail-follow batches; >100-frame backlog or inode change → ONE
52
+ root-replacement resync). `run-snapshot-cache` opt-in `{ eventsState: { pollMs } }`
53
+ shares ONE unref'd poll interval per entry; browser tick CPU 6.98ms → 0.41ms.
54
+ `events.jsonl` is never written — pure derived view. (665b443a)
55
+ - **U8** — opt-in sqlite run-state backend: `PI_CREW_STATE_BACKEND=sqlite` stores
56
+ manifest + tasks + worker-status in `<runId>/state.sqlite` via `node:sqlite` with
57
+ ONE transaction per batch write (all-or-nothing); JSON files stay written as
58
+ read-side mirrors for legacy consumers while loads read the db. The `events.jsonl`
59
+ audit spine is unchanged in both modes. (ae49628f)
60
+ - **U9** — reconcile-at-open fast-path: crashed runs with NO live claim (dead async
61
+ pid + no live registry entry) requeue `running`→`queued` in ONE locked pass
62
+ (attempt / checkpoint / deps / partial state preserved) and the run is marked
63
+ `failed`-for-resume; the verdict tree now only runs for live-claim runs. Interrupted-
64
+ run detection latency 300000ms → 1-9ms. New reconcile verdict `requeued_no_claim`.
65
+ (456c9283)
66
+ - **U6B** — classifier verifier pre-gate: score-question variant consults the ambient
67
+ classifier before a verifier-role spawn (block score ≥ 0.9 / confidence ≥ 0.8);
68
+ soft-fail — every classifier error path escalates to the LLM verifier. (6b6c0aca)
69
+ - **U13** — deterministic `verify_gate` pre-gate + tool: verifier-role spawns first run
70
+ the package.json-script checks (typecheck / test:critical) via
71
+ `ctx.executeTool("bash", ...)` with per-check timeout (`PI_CREW_VERIFY_GATE`,
72
+ `PI_CREW_VERIFY_GATE_TIMEOUT_MS`, default 120s); PASS skips the LLM verifier spawn,
73
+ FAILED/INCONCLUSIVE spawns it with the gate results in the prompt. (ef67cd04)
74
+
75
+ ### Fixed (wave-3 gate remediation)
76
+
77
+ - env-vars registry snapshot now includes the wave-3 keys (`PI_CREW_STATE_BACKEND`,
78
+ `PI_CREW_VERIFY_GATE`, `PI_CREW_VERIFY_GATE_TIMEOUT_MS`).
79
+ - shard-partition table registers the new `test/unit/registration/` dir (U13 test).
80
+ - import sort in `sqlite-run-state.test.ts` (biome organizeImports).
81
+
3
82
  ## [0.11.11] — Upgrade Wave 1: U1 dead-option, U2 buffered events, U3 key-free E2E, U10 measured-token handoff (2026-10-10)
4
83
 
5
84
  Wave 1 of the upgrade-spec program (`pi-crew-upgrade-spec-2026-10-09.md`, verified over