pi-crew 0.11.10 → 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 (52) hide show
  1. package/CHANGELOG.md +110 -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/async-notifier.ts +5 -2
  9. package/src/extension/registration/tool-registration.ts +7 -0
  10. package/src/extension/registration/verify-gate-tool.ts +263 -0
  11. package/src/extension/team-tool/cancel.ts +5 -6
  12. package/src/prompt/inbox-poll.ts +141 -3
  13. package/src/runtime/attention-events.ts +4 -0
  14. package/src/runtime/broker/crew-broker.ts +48 -2
  15. package/src/runtime/broker/protocol/request-parsers.ts +8 -1
  16. package/src/runtime/child-pi/child-pi-constants.ts +24 -0
  17. package/src/runtime/child-pi/child-pi-kill.ts +59 -2
  18. package/src/runtime/child-pi/child-pi-rpc.ts +1021 -0
  19. package/src/runtime/child-pi/child-pi-steering.ts +10 -8
  20. package/src/runtime/child-pi/child-pi-streams.ts +69 -19
  21. package/src/runtime/child-pi/child-pi.ts +29 -30
  22. package/src/runtime/child-pi/owned-process.ts +434 -0
  23. package/src/runtime/child-pi/postmortem-registry.ts +134 -0
  24. package/src/runtime/classifier/ambient-noise-gate.ts +126 -0
  25. package/src/runtime/classifier/classifier-service.ts +277 -61
  26. package/src/runtime/dispatch-batch.ts +32 -0
  27. package/src/runtime/goal-workflow/dynamic-workflow-context.ts +14 -6
  28. package/src/runtime/goal-workflow/dynamic-workflow-runner.ts +12 -10
  29. package/src/runtime/group-join.ts +5 -0
  30. package/src/runtime/live-session/live-agent-control.ts +2 -0
  31. package/src/runtime/live-session/live-agent-manager.ts +72 -2
  32. package/src/runtime/live-session/live-session-runtime.ts +472 -41
  33. package/src/runtime/plan-approval.ts +5 -2
  34. package/src/runtime/recovery/crash-recovery.ts +194 -25
  35. package/src/runtime/recovery/retry-executor.ts +29 -0
  36. package/src/runtime/stale-reconciler.ts +36 -1
  37. package/src/runtime/task-output-context.ts +61 -15
  38. package/src/runtime/task-packet.ts +33 -12
  39. package/src/runtime/task-runner/prompt-builder.ts +15 -5
  40. package/src/runtime/task-runner.ts +103 -0
  41. package/src/runtime/verification/classifier-pre-gate.ts +262 -0
  42. package/src/runtime/verification/verification-gates.ts +5 -1
  43. package/src/runtime/verification/verify-gate.ts +394 -0
  44. package/src/schema/config-schema.ts +13 -0
  45. package/src/state/contracts.ts +13 -0
  46. package/src/state/coordination/mailbox.ts +203 -55
  47. package/src/state/stores/sqlite-run-state.ts +378 -0
  48. package/src/state/stores/state-store.ts +145 -6
  49. package/src/ui/agents-jobs-browser.ts +154 -8
  50. package/src/ui/events-state-source.ts +358 -0
  51. package/src/ui/run-snapshot-cache.ts +87 -3
  52. package/src/ui/widget/widget-model.ts +13 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,115 @@
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
+
82
+ ## [0.11.11] — Upgrade Wave 1: U1 dead-option, U2 buffered events, U3 key-free E2E, U10 measured-token handoff (2026-10-10)
83
+
84
+ Wave 1 of the upgrade-spec program (`pi-crew-upgrade-spec-2026-10-09.md`, verified over
85
+ 10 research/verify rounds). Four independent specs, one commit each; `test:critical`
86
+ 120/0, full suite 8752/8778 (22 pre-existing env failures, proven on pristine HEAD),
87
+ `dist/index.mjs` rebuilt fresh in-tree.
88
+
89
+ ### Changed
90
+
91
+ - **U1** — removed the dead `modelRegistry` option from the `createAgentSession` call
92
+ (live-session-runtime): the option never existed in any pi SDK release; model control
93
+ stays on `model` + `scopedModels`. (19c3f54c)
94
+ - **U2** — migrated the remaining hot sync `appendEvent` call-sites to async/buffered
95
+ primitives (12 of 39; 27 kept sync by documented contract — forcing all was previously
96
+ reverted by CI, b6eba80f/3a748640). Real-SIGTERM test proves buffered events survive
97
+ graceful shutdown (40/40); buffered writer ≈30-45x sync throughput. (37edbc83)
98
+ - **U10** — dependency-context handoff budgets now anchor on the worker's *measured*
99
+ token usage (message_end) instead of the chars/4 heuristic (never loosens, max-floor
100
+ preserved), and the worker handoff template follows the pinned 6-section structure
101
+ (Goal / Constraints & Preferences / Progress / Key Decisions / Next Steps /
102
+ Critical Context) rendered verbatim. (25f96120)
103
+
104
+ ### Added
105
+
106
+ - **U3** — key-free, network-free E2E seam for the in-process live-session worker via
107
+ pi-ai `fauxProvider`: scripted responses (ok / tool-use / error / retry) run inside
108
+ an unshared netns with zero auth env vars. Foundation for U4/U11 embedded-tier tests.
109
+ (bdebf179)
110
+
111
+ # Changelog
112
+
3
113
  ## [0.11.10] — F1: `V` live-conversation dead-end replaced with runtime-aware notice (2026-10-08)
4
114
 
5
115
  ### Fixed