@llblab/pi-actors 0.22.3 → 0.22.4

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/BACKLOG.md CHANGED
@@ -1,74 +1,466 @@
1
1
  # Project Backlog
2
2
 
3
- ## Open Work
4
-
5
- ### Native Windows Smoke and Runtime Notification Follow-up
6
-
7
- - Priority: High.
8
- - Target: Post-0.22.0 validation and hardening.
9
- - Goal: Validate the cross-platform actor wake/notification layer on native Windows without changing the public actor API or replacing file-backed actor state as the observable source of truth.
10
- - Decision:
11
- - Keep files as durable truth: mailbox/state/event/room files remain canonical for `inspect`, observability, crash recovery, and replay.
12
- - Treat runtime notification as an advisory wake layer, not as the queue itself.
13
- - Preserve `spawn`, `message`, and `inspect` as the only public actor API; platform transport choices stay internal.
14
- - Progress:
15
- - Prepared the cross-platform runtime notification layer for release with a file-backed runtime notifier boundary using `notify(actor)` / `subscribe(actor, onWake)`, persisted `wake.jsonl` records, `fs.watch` subscription, and periodic fallback coverage.
16
- - Notifier subscriptions can now receive explicit reconciliation callbacks for initial scan, wake-triggered scans, and polling fallback.
17
- - Run-local `message` delivery now records the durable run inbox entry and advisory wake before attempting the optional live control endpoint; successful endpoint delivery marks the inbox entry `sent`.
18
- - Run mailbox inspection now shows recent durable inbox entries alongside recipe-declared mailbox metadata.
19
- - Added run inbox claim/handle/fail helpers for runtime loops, including locked claims so reconciliation callbacks can safely dispatch queued mailbox work once.
20
- - Added mailbox-only run control endpoints so runtimes can accept `message` through durable inbox/wake state without requiring FIFO or named-pipe delivery.
21
- - Migrated the packaged music-player control path to queued mailbox commands as the first concrete script using the mailbox-only runtime direction.
22
- - Added a native Windows `wmp` music-player backend using legacy Windows Media Player COM via `powershell.exe`, with `wmplayer.exe` detection in standard Program Files locations and mailbox-backed controls mapped to WMP play/pause/stop operations.
23
- - Hardened the music-player mailbox loop to avoid repeated unchanged mailbox reads by combining advisory wake records, `fs.watch`, and inbox signature polling.
24
- - Improved Unix-like playback support with the macOS-native `afplay` backend, broader audio extension scanning, and process-group signaling for child playback controls.
25
- - Room timeline appends and branch inbox append/status transitions now emit advisory wake records for the addressed room or branch actor.
26
- - Direction:
27
- - Continue wiring mailbox-only endpoints and notifier reconciliation callbacks into concrete packaged actor scripts where file-backed mailbox dispatch should replace transport-specific control loops.
28
- - Ensure message delivery writes durable file-backed mailbox/state first, then emits a wake notification.
29
- - Require actor runtimes to reconcile mailbox state on wake and also on a periodic fallback so missed notifications do not lose work.
30
- - Provide a universal baseline backend using file-system change notification plus periodic reconcile across Linux, macOS, and Windows.
31
- - Keep FIFO/named-pipe/socket style endpoints as optional fast wake backends or compatibility paths, not as required durable queues.
32
- - Document the model as "wake, not queue": notification wakes a live actor; files remain the queue and audit trail.
33
- - Windows smoke focus:
34
- - Run installed `@llblab/pi-actors@0.22.0` or newer on native Windows.
35
- - Verify simple `spawn` / `message` / `inspect` actor communication.
36
- - Verify small room-swarm/subagent communication, branch/direct messages, mailbox claim/handled transitions, graceful stop/cancel behavior, and opt-in retirement.
37
- - If smoke passes, update docs/release notes from "adapter support" to "Windows smoke-tested subagent communication" for the next release.
38
- - Exit:
39
- - Actor communication works through the cross-platform notifier layer with public API unchanged.
40
- - Inspect/observability continue to read canonical file state and do not depend on a live notifier process.
41
- - Missed wake notifications are recovered by mailbox reconciliation.
42
- - Windows subagent communication smoke is documented with results and any remaining limitations.
3
+ ## Implementation Boundary
4
+
5
+ Work only inside `pi-actors`: strengthen the current Pi extension and local actor kernel. Do not split work into an external transportable standard, do not design `mcp-actors`, and do not change public positioning.
6
+
7
+ Current carrying contour:
8
+
9
+ - `spawn`, `message`, and `inspect` stay the durable public verbs.
10
+ - Async run state stays file-backed and inspectable.
11
+ - Tool exposure stays recipe-based and location-derived from `~/.pi/agent/recipes`.
12
+ - Durable inbox and outbox files remain canonical intent and message state.
13
+ - Rooms, rosters, and branch inboxes remain local coordination memory.
14
+ - Wake notifications remain advisory acceleration, not the queue.
15
+ - Operator-facing observability stays explicit and bounded.
16
+
17
+ Core invariant:
18
+
19
+ ```text
20
+ Recipe = portable executable capability.
21
+ Run = addressable lifecycle instance.
22
+ Message = typed semantic envelope.
23
+ Mailbox = durable intent queue.
24
+ Wake = advisory acceleration.
25
+ Room = shared local coordination memory.
26
+ Inspect = intentional observation.
27
+ Artifact = durable result.
28
+ ```
29
+
30
+ Non-goals:
31
+
32
+ - Distributed workers.
33
+ - Generic scheduler DSL.
34
+ - Cloud sync.
35
+ - External transport standard.
36
+ - MCP implementation.
37
+ - Arbitrary subrooms.
38
+ - Heavy broker abstraction.
39
+
40
+ ## Hotfix Backlog
41
+
42
+ No open hotfix items.
43
+
44
+ ## Minor Backlog
45
+
46
+ ### M-01 Internal Protocol Contract Pack
47
+
48
+ - Priority: Medium.
49
+ - Goal: Add machine-readable internal schemas and fixtures for implementation, docs, tests, and inspector consistency.
50
+ - Files:
51
+ - `schemas/actor-message.schema.json`.
52
+ - `schemas/actor-address.schema.json`.
53
+ - `schemas/run-state.schema.json`.
54
+ - `schemas/run-inbox-message.schema.json`.
55
+ - `schemas/run-outbox-event.schema.json`.
56
+ - `schemas/room-message.schema.json`.
57
+ - `schemas/room-roster.schema.json`.
58
+ - `schemas/communication-snapshot.schema.json`.
59
+ - `schemas/recipe.schema.json`.
60
+ - `fixtures/protocol/run-minimal.json`.
61
+ - `fixtures/protocol/message-branch.json`.
62
+ - `fixtures/protocol/message-room-join.json`.
63
+ - `fixtures/protocol/mailbox-contract.json`.
64
+ - Acceptance:
65
+ - Normalization outputs validate.
66
+ - Docs examples validate.
67
+ - Fixtures are usable by tests.
68
+ - Schemas are versioned with package version.
43
69
 
44
- ### Consensus-First Build Recipe
70
+ ### M-02 Unified Actor Event Base
45
71
 
46
72
  - Priority: Medium.
47
- - Goal: Promote the proven proposer → implementer → QA → finalizer pattern into a generic packaged workflow instead of demo-specific scripts; pi-actors should grow its standard recipe/script library for recurring actor OS scenarios.
73
+ - Goal: Add a shared base envelope for actor event-like records without forcing one storage file.
74
+ - Target channels:
75
+ - `events`.
76
+ - `inbox`.
77
+ - `outbox`.
78
+ - `wake`.
79
+ - `room`.
80
+ - `branch`.
81
+ - Acceptance:
82
+ - New append helpers generate ids consistently.
83
+ - Existing files remain readable.
84
+ - `inspect` can show id, correlation, and causation.
85
+ - No migration is forced.
86
+
87
+ ### M-03 Mailbox Contract v1
88
+
89
+ - Priority: Medium.
90
+ - Goal: Extend `mailbox.accepts` and `mailbox.emits` from string arrays to backward-compatible typed contracts.
48
91
  - Direction:
49
- - Public inputs: mission, artifact paths/assertions, proposer role JSON, implementer prompt, QA prompt, model/thinking/tool knobs, and optional room/locker settings.
50
- - Proposers should coordinate through room messages with no write tools.
51
- - The implementer owns the first artifact write after inspecting room consensus.
52
- - QA inspects artifacts and room evidence without mutating files.
53
- - The finalizer applies QA-grounded fixes and emits `run.done` only after artifact assertions pass.
54
- - Reuse packaged subagent/message/artifact components where practical; if a script is needed, make it a generic packaged helper in the extension, not a task-local demo script.
55
- - Exit:
56
- - A packaged recipe can reproduce the interactive-music-instrument workflow shape for another single-artifact task without copying the demo script.
57
- - Docs and skills point agents to the packaged recipe and explain when to choose it over a free-form room swarm.
92
+ - Keep string declarations valid.
93
+ - Normalize typed entries for inspection.
94
+ - Support fields such as body schema, ack requirement, idempotency, response requirement, level, and summary.
95
+ - Acceptance:
96
+ - String declarations still work.
97
+ - `inspect view=mailbox` shows normalized contracts.
98
+ - Messages outside accepts produce advisory warnings by default, not hard blocks.
99
+ - Docs clarify advisory versus strict mode.
100
+
101
+ ### M-04 Actor Loop Helper SDK
102
+
103
+ - Priority: Medium.
104
+ - Goal: Provide reusable helpers for mailbox-consuming actors so recipe authors do not rewrite loops.
105
+ - Files:
106
+ - `lib/actor-loop.ts`.
107
+ - `scripts/actor-loop.mjs`.
108
+ - Capabilities:
109
+ - Initial reconciliation.
110
+ - Wake subscription.
111
+ - Polling fallback.
112
+ - Run and branch inbox claiming.
113
+ - Handled and failed status transitions.
114
+ - Outbox emission.
115
+ - Progress updates.
116
+ - Graceful stop handling.
117
+ - Acceptance:
118
+ - A packaged demo recipe uses a mailbox-only control endpoint.
119
+ - Concurrent wake and poll paths do not double-process messages.
120
+ - Helper supports run inbox and branch inbox.
58
121
 
59
- ### Persistent Backlog Implementer Workflow
122
+ ### M-05 Branch Delivery Unification
60
123
 
61
124
  - Priority: Medium.
62
- - Goal: Express persistent front/back backlog implementers as reusable extension-level recipe composition instead of bespoke workflow scripts.
125
+ - Goal: Route direct branch messages and room multicast branch copies through one internal helper.
126
+ - Target helper:
127
+ - `routeBranchEnvelope(stateDir, runId, message, { source })`.
128
+ - Acceptance:
129
+ - Direct branch messages and room multicast produce the same durable branch inbox shape.
130
+ - Parent run dispatch envelope is consistent.
131
+ - Tests cover both paths.
132
+
133
+ ### M-06 Attention Semantics v1
134
+
135
+ - Priority: Medium.
136
+ - Goal: Formalize coordinator attention behavior through semantic metadata rather than transport knobs.
63
137
  - Direction:
64
- - Use existing coordination cells such as `coordinator-locker` for queue/assignment/locking semantics.
65
- - Compose existing subagent launcher recipes for execution slices rather than adding dedicated implementer scripts.
66
- - Add missing reusable component recipes only when an implementer scenario cannot be expressed with the existing library.
67
- - Update `skills/actors/SKILL.md` whenever a new implementer/coordinator recipe is added so agents know which scenario to launch and which packaged recipes to use.
68
- - Preserve the protocol insight: implementers report `task.result` / `awaiting_assignment`, stay alive between assignments, and stop only after coordinator-issued control.
69
- - Exit:
70
- - A packaged workflow, if added, is described by recipes and existing helper cells; no one-off backlog-implementer scripts are required.
71
- - The actors skill documents the supported launch scenarios and the concrete packaged recipes for each.
138
+ - Support attention metadata such as `requires_response=true` and reason.
139
+ - Map response-required messages to follow-up.
140
+ - Keep progress/info messages inspectable or notify-only.
141
+ - Preserve existing internal `delivery` behavior.
142
+ - Acceptance:
143
+ - `requires_response=true` becomes coordinator follow-up.
144
+ - Progress info stays log or notification.
145
+ - Explicit stop and kill controls do not create duplicate terminal follow-up.
146
+
147
+ ### M-07 Recipe Doctor
148
+
149
+ - Priority: Medium.
150
+ - Goal: Add intentional recipe health inspection.
151
+ - Surface:
152
+ - `inspect target=recipes view=doctor`.
153
+ - `inspect target=recipes view=doctor verbose=true`.
154
+ - Checks:
155
+ - Import graph health.
156
+ - Shadowing and blockers.
157
+ - Invalid or disabled recipes.
158
+ - Risky command templates.
159
+ - Absolute path portability.
160
+ - OS compatibility.
161
+ - Root permissions.
162
+ - Mailbox completeness.
163
+ - Artifact placeholder resolution.
164
+ - Stale or unused usage.
165
+ - Acceptance:
166
+ - Compact output is grouped by severity.
167
+ - Verbose output is structured.
168
+ - No automatic cleanup happens.
169
+ - Every diagnostic has reason and suggested actions.
170
+
171
+ ### M-08 Artifact Manifest v1
172
+
173
+ - Priority: Medium.
174
+ - Goal: Extend recipe artifacts from string paths to backward-compatible artifact metadata.
175
+ - Direction:
176
+ - Keep string artifact paths valid.
177
+ - Add optional object fields such as path, kind, media type, and required.
178
+ - Resolve manifests with existence, size, and optional hash.
179
+ - Acceptance:
180
+ - String artifacts remain valid.
181
+ - Runtime resolves manifest with `exists`, `size`, and optional `sha256`.
182
+ - Terminal follow-ups group named artifacts.
183
+ - Missing required artifacts are visible in result and inspect output.
184
+
185
+ ### M-09 Lifecycle Retention Policy
186
+
187
+ - Priority: Medium.
188
+ - Goal: Add explicit archive and prune behavior for terminal run state.
189
+ - Messages:
190
+ - `control.archive`.
191
+ - `control.prune`.
192
+ - Direction:
193
+ - Only terminal runs can be archived or pruned.
194
+ - Active runs fail closed.
195
+ - Archive moves or compresses state with a tombstone.
196
+ - Prune deletes terminal state after ownership checks, optionally preserving artifacts.
197
+ - Acceptance:
198
+ - Terminal cleanup candidates are inspectable.
199
+ - Artifacts can be preserved.
200
+ - Active run deletion is impossible.
201
+
202
+ ### M-10 Inspector v2 For Unread Mentions And Needs Response
203
+
204
+ - Priority: Medium.
205
+ - Goal: Strengthen the TUI inspector as the operator membrane for multi-actor sessions.
206
+ - Direction:
207
+ - Add stable event ids in previews.
208
+ - Add unread cursor per session, run, and room.
209
+ - Preserve mention filtering.
210
+ - Add needs-response marker from attention semantics.
211
+ - Distinguish room timeline rows from branch inbox rows.
212
+ - Acceptance:
213
+ - `/actors-inspector-filter unread` works.
214
+ - `/actors-inspector-filter mention <text>` works.
215
+ - `/actors-inspect <number>` marks the item read for the current session.
216
+ - Unread state stays UI/session metadata, not protocol truth.
217
+
218
+ ### M-11 Run State Index
219
+
220
+ - Priority: Medium.
221
+ - Goal: Add a rebuildable run-state index to reduce recursive scans and improve observability performance.
222
+ - Target file:
223
+ - `~/.pi/agent/tmp/pi-actors/runs/index.json`.
224
+ - Contents:
225
+ - State dir.
226
+ - Run id.
227
+ - Owner id.
228
+ - Status.
229
+ - Updated time.
230
+ - Recipe or tool.
231
+ - Acceptance:
232
+ - Index accelerates list and summarize.
233
+ - Corruption falls back to scan.
234
+ - Rebuild helper exists.
235
+ - Nested runs are represented without id collision.
236
+
237
+ ### M-12 Internal Conformance Runner
238
+
239
+ - Priority: Medium.
240
+ - Goal: Add a CI-ready internal conformance runner for pi-actors protocol behavior.
241
+ - Script:
242
+ - `npm run conformance`.
243
+ - Suites:
244
+ - Recipe discovery.
245
+ - Register, update, and delete.
246
+ - Spawn lifecycle.
247
+ - Message routing.
248
+ - Room roster.
249
+ - Branch inbox.
250
+ - Ownership checks.
251
+ - Artifacts.
252
+ - Attention semantics.
253
+ - Acceptance:
254
+ - Runs without Pi UI where possible.
255
+ - Outputs compact report.
256
+ - Fixtures live in the repository.
257
+ - CI can run it.
258
+
259
+ ### M-13 Packaged Actor Worker Recipe Template
260
+
261
+ - Priority: Medium.
262
+ - Goal: Add a canonical packaged recipe or template for a long-lived worker-backed branch actor.
263
+ - Direction:
264
+ - Worker joins room.
265
+ - Worker declares mailbox accepts and emits.
266
+ - Worker claims branch inbox messages.
267
+ - Worker posts `task.claim`, `task.result`, and `awaiting_assignment`.
268
+ - Worker handles `control.stop`.
269
+ - Acceptance:
270
+ - Recipe demonstrates correct mailbox loop semantics.
271
+ - It is a recipe-authoring example, not a product feature.
272
+
273
+ ### M-14 Recipe Usage Integrity Improvements
274
+
275
+ - Priority: Medium.
276
+ - Goal: Make recipe usage tracking more explainable.
277
+ - Direction:
278
+ - Add fingerprint diff reason.
279
+ - Add reset reason.
280
+ - Consider optional last error.
281
+ - Split launch counts by tool, spawn, and direct recipe.
282
+ - Acceptance:
283
+ - `inspect recipes view=summary verbose=true` shows whether usage refers to current recipe content.
284
+ - Doctor can flag unused current meaning instead of stale old recipe history.
285
+
286
+ ### M-15 Safer Command Warning Policy
287
+
288
+ - Priority: Medium.
289
+ - Goal: Unify command-template diagnostics by severity and make warnings actionable without startup spam.
290
+ - Severity:
291
+ - `info`: portability.
292
+ - `warning`: broad mutation, shell, or eval.
293
+ - `error`: impossible, invalid, or unsafe repeat.
294
+ - Direction:
295
+ - Treat legitimate `bash` wrappers as expected trusted boundaries when already packaged or explicitly registered.
296
+ - Keep routine shell wrapper notes out of startup warning blocks.
297
+ - Surface shell/eval/destructive diagnostics through register-time warnings, doctor, and verbose recipe inspection.
298
+ - Acceptance:
299
+ - Command-template warnings include command label, reason, and suggested mitigation.
300
+ - `register_tool` shows relevant warnings.
301
+ - Recipe doctor aggregates warning policy.
302
+ - Startup no longer emits large warning blocks only because recipes wrap `bash`.
303
+
304
+ ### M-16 Output And Log Size Governance
305
+
306
+ - Priority: Medium.
307
+ - Goal: Keep stdout, stderr, result, outbox, and actor-message previews bounded in agent context.
308
+ - Direction:
309
+ - Centralize constants for body preview, outbox preview, inspector preview, and tail lines.
310
+ - Keep verbose output opt-in.
311
+ - Prefer files or artifacts for large bodies.
312
+ - Acceptance:
313
+ - Actor messages and previews share consistent caps.
314
+ - Verbose mode is explicit.
315
+ - Large bodies do not flood normal tool output.
316
+
317
+ ### M-17 Windows And Nix Portability Pass
318
+
319
+ - Priority: Medium.
320
+ - Goal: Strengthen current portability around FIFO, named-pipe, and mailbox-only paths without adding a new backend.
321
+ - Direction:
322
+ - Doctor flags FIFO-only recipes on native Windows.
323
+ - Keep mailbox-only demo cross-platform.
324
+ - Document platform matrix.
325
+ - Cover named-pipe adapter with injected sender where practical.
326
+ - Acceptance:
327
+ - Native Windows limitations are visible before launch.
328
+ - Mailbox-only recipe works cross-platform.
329
+ - Docs and tests cover the adapter split.
330
+
331
+ ### M-18 State Corruption Recovery
332
+
333
+ - Priority: Medium.
334
+ - Goal: Add resilient JSON and JSONL state readers.
335
+ - Direction:
336
+ - Malformed JSONL lines should not kill entire inspect paths.
337
+ - Corrupt JSON files should report diagnostics with paths.
338
+ - Consider optional `.corrupt` quarantine helper.
339
+ - Acceptance:
340
+ - Inspect remains useful when partial state survives.
341
+ - Corrupt paths are reported clearly.
342
+ - Canonical state is not silently rewritten without explicit action.
343
+
344
+ ### M-19 Recipe Import Graph Inspector
345
+
346
+ - Priority: Medium.
347
+ - Goal: Add focused inspection for recipe import graphs.
348
+ - Surface:
349
+ - `inspect target=recipes view=imports`.
350
+ - `inspect target=recipes view=imports verbose=true`.
351
+ - Acceptance:
352
+ - Shows import graph, aliases, resolved paths, and shadowed imports.
353
+ - Shows cyclic and depth diagnostics.
354
+ - Helps debug packaged and user recipe composition.
355
+
356
+ ### M-20 Spawn Preflight Mode
357
+
358
+ - Priority: Medium.
359
+ - Goal: Add dry-run launch planning for `spawn` and async recipe tool invocation.
360
+ - Direction:
361
+ - Resolve recipe, imports, args, artifacts, state dir, command graph, and mailbox metadata.
362
+ - Do not start a process.
363
+ - Return warnings and resolved launch plan.
364
+ - Acceptance:
365
+ - `preflight=true` returns a resolved plan.
366
+ - No process is spawned.
367
+ - Missing args and risky commands are reported before launch.
368
+
369
+ ### M-21 Run Restart And Reattach Policy
370
+
371
+ - Priority: Medium.
372
+ - Goal: Clarify and implement safe behavior for reused `run_id` and `state_dir`.
373
+ - Direction:
374
+ - Active reuse fails closed.
375
+ - Terminal restart with same id is allowed under explicit semantics.
376
+ - Record generation or restarted time.
377
+ - Preserve previous terminal-state policy.
378
+ - Acceptance:
379
+ - Active reuse remains blocked.
380
+ - Terminal restart records generation or `restartedAt`.
381
+ - Inspect shows restart semantics.
382
+ - Docs are updated.
383
+
384
+ ### M-22 Actor Address Helper CLI And Tooling
385
+
386
+ - Priority: Medium.
387
+ - Goal: Improve address normalization and diagnostics for recipe authors and tests.
388
+ - Direction:
389
+ - Add helper functions or inspect view for address validation.
390
+ - Improve invalid-address diagnostics.
391
+ - Acceptance:
392
+ - Diagnostics include expected forms.
393
+ - Examples cover branch, room, run, session, and tool addresses.
394
+ - No new public address kinds are added.
395
+
396
+ ### M-23 Room Compaction Metadata Improvements
397
+
398
+ - Priority: Medium.
399
+ - Goal: Record richer room compaction metadata.
400
+ - Direction:
401
+ - Track dropped count.
402
+ - Track first and last kept timestamps.
403
+ - Track configured max.
404
+ - Acceptance:
405
+ - `inspect room:<run> view=status verbose=true` shows compaction info.
406
+ - Compaction never corrupts JSONL.
407
+ - Tests cover low `PI_ACTORS_ROOM_MAX_MESSAGES`.
408
+
409
+ ### M-24 Coordinator Follow-Up Deduplication
410
+
411
+ - Priority: Medium.
412
+ - Goal: Suppress duplicate terminal transitions and outbox follow-ups across watcher reloads, session restarts, or line-counter resets.
413
+ - Direction:
414
+ - Use event id and stateDir for deduplication where available.
415
+ - Preserve terminal handled semantics.
416
+ - Simulate watcher restart in tests.
417
+ - Acceptance:
418
+ - Duplicate follow-up is suppressed after reasonable watcher reset.
419
+ - Terminal handled state remains effective.
420
+ - Tests cover restart and line-counter reset scenarios.
421
+
422
+ ### M-25 Documentation Refactor Runtime Contracts First
423
+
424
+ - Priority: Medium.
425
+ - Goal: Reorganize docs so implementation agents find stable contracts before examples.
426
+ - Target order:
427
+ - `docs/runtime-contracts.md`.
428
+ - `docs/actor-messages.md`.
429
+ - `docs/async-runs.md`.
430
+ - `docs/tool-registry.md`.
431
+ - `docs/template-recipes.md`.
432
+ - `docs/command-templates.md`.
433
+ - `docs/recipe-authoring.md`.
434
+ - `docs/troubleshooting.md`.
435
+ - Acceptance:
436
+ - No polling-first examples.
437
+ - Every example matches fixtures.
438
+ - Docs distinguish protocol semantics from Pi UI commands.
439
+ - No external standard or MCP work is introduced.
440
+
441
+ ## Suggested Milestone Order
442
+
443
+ ```text
444
+ Patch release:
445
+ H-01..H-12
446
+
447
+ Minor 0.23 — Contract consolidation:
448
+ M-01, M-02, M-03, M-12, M-25
449
+
450
+ Minor 0.24 — Runtime/message reliability:
451
+ M-04, M-05, M-06, M-13, M-24
452
+
453
+ Minor 0.25 — Operator hygiene:
454
+ M-07, M-08, M-09, M-14, M-15, M-16
455
+
456
+ Minor 0.26 — Inspector and state scaling:
457
+ M-10, M-11, M-18, M-19, M-23
458
+
459
+ Minor 0.27 — Portability and lifecycle polish:
460
+ M-17, M-20, M-21, M-22
461
+ ```
462
+
463
+ ## Blocked Or Opportunistic Carry-Over
72
464
 
73
465
  ### Branch-Local Checkpoint Semantics
74
466
 
@@ -90,30 +482,13 @@
90
482
  - Exit:
91
483
  - Deleting a recipe file removes the corresponding runtime tool definition and active-tool entry without session restart.
92
484
 
93
- ### Recipe Discovery Expansion
94
-
95
- - Priority: Low.
96
- - Goal: Support larger recipe libraries without confusing recipe identity or priority.
97
- - Direction:
98
- - Add nested recipe directories only after flat `recipes/*.json` discovery semantics are stable.
99
- - Keep same-id priority and invalid-blocking behavior explicit if nested ids are introduced.
100
-
101
485
  ### Actor Recipe Feedback Loop
102
486
 
103
487
  - Priority: Low.
104
488
  - Goal: Turn actor recipe-context awareness into a practical improvement loop for packaged recipes and operator-owned recipe memory.
105
489
  - Direction:
106
490
  - After real multi-agent runs, capture whether child actors report that recipe/import/mailbox/role boundaries fit the task.
107
- - Keep the loop advisory and operator-gated: feedback may suggest recipe edits or copying into `~/.pi/agent/recipes`, but must not auto-save or rewrite durable recipes without confirmation.
108
- - Prefer small recipe/readme/skill refinements over adding scenario catalogs; recurring patterns should become packaged recipes only after repeated use.
491
+ - Keep the loop advisory and operator-gated.
492
+ - Prefer small recipe, README, and skill refinements over scenario catalogs.
109
493
  - Exit:
110
- - At least one real run produces recipe-boundary feedback that is either applied to a recipe/docs change or explicitly rejected with rationale.
111
-
112
- ### Recipe Usage Telemetry Evolution
113
-
114
- - Priority: Low.
115
- - Goal: Improve long-term operator insight into recipe usefulness without making telemetry noisy.
116
- - Direction:
117
- - Consider sidecar stats sync/backup policy after inline user-owned `usage.calls` / `usage.last_called` proves useful.
118
- - Consider an operator-approved recipe promotion workflow that turns successful package/ad hoc/direct spawn suggestions into a reviewed `~/.pi/agent/recipes` entry with provenance and diff, without auto-saving.
119
- - Do not add failure counters as primary usefulness evidence unless there is a strong operator-facing need.
494
+ - At least one real run produces recipe-boundary feedback that is applied or explicitly rejected with rationale.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.22.4: Actor Isolation and Registry Diagnostics Hotfix
6
+
7
+ - `[Tests]` Added explicit regression coverage that ad hoc recipe files outside the user recipe root remain recipe components rather than automatically exposed tools, reinforcing the location-based tool exposure invariant.
8
+ - `[Registry]` Improved invalid recipe diagnostics for discovery summaries so JSON parse failures, missing templates, and malformed Markdown recipes keep actionable causes, structured severity, and suggested actions instead of collapsing to a generic invalid recipe message.
9
+ - `[Observability]` Keyed run transition observation by state directory instead of display run id so nested child runs or reused run names do not collide in terminal follow-ups and pruning state.
10
+ - `[Async Runs]` Normalized run-message delivery failures after durable inbox append: failures now preserve queued state details such as `queued`, `inbox_id`, and `delivery_error`, while successful FIFO, named-pipe, and mailbox-only deliveries also expose the inbox id.
11
+ - `[Tests]` Added explicit cross-session kill-control regression coverage so run ownership boundaries stay fail-closed for destructive actor controls as well as ordinary messages and inspection.
12
+ - `[Tests]` Added branch and room routing safety regressions for cross-run senders and invalid multicast recipients, including assertions that failed validation does not create branch inbox or room timeline records.
13
+ - `[Actor Rooms]` Hardened branch inbox reads and status rewrites against malformed JSONL lines; valid messages continue to update while corrupted record counts surface through branch mailbox inspection.
14
+ - `[Tests]` Added async lifecycle regression coverage for missing-result terminal status inference, preserving `cancelled`/`killed` over generic `exited`, and tail behavior when only event logs exist.
15
+ - `[Registry]` Allowed `register_tool` to persist object command-template configs with composition flags, aligning it with recipes and `spawn`, while preserving precise validation errors for invalid object templates.
16
+ - `[Registry]` Added deterministic live-reload regressions for invalid user updates blocking lower-priority fallback recipes and valid recovery refreshing the active tool schema without restart.
17
+ - `[Tools]` Preserved target tool failure shape through `message to=tool:<name>` by including the tool name, message type, bounded params preview, and original error on routed failures.
18
+ - `[Actors]` Tightened branch and room routing isolation so session-owned runs reject branch/room messages from a different current Pi session, keeping room state scoped to the owning actor tree.
19
+ - `[Tests]` Added executable protocol-example coverage for public actor-message, room join/leave, mailbox, spawn, and inspect examples so documentation drift fails in CI.
20
+
5
21
  ## 0.22.3: Idempotent GitHub Release Workflow Hotfix
6
22
 
7
23
  - `[Release]` Made the tag-triggered GitHub Release workflow idempotent: existing releases are edited with the generated title and notes instead of failing when an operator already created the release for the tag.
package/dist/index.js CHANGED
@@ -119,7 +119,7 @@ export default function toolRegistryExtension(pi) {
119
119
  details: transition,
120
120
  }, { deliverAs: "followUp", triggerTurn: true });
121
121
  }
122
- Observability.pruneRunObservationState(observedRuns, observedRunEventLines, summary, transitions.map((transition) => transition.run));
122
+ Observability.pruneRunObservationState(observedRuns, observedRunEventLines, summary, transitions.map((transition) => transition.stateDir ?? transition.run));
123
123
  for (const event of outboxEvents) {
124
124
  if (!Observability.shouldNotifyRunOutboxEvent(event))
125
125
  continue;
@@ -62,11 +62,17 @@ export interface ActorCommunicationSnapshot {
62
62
  updated_at: string;
63
63
  }
64
64
  export declare function readRoomRoster(stateDir: string, room: string): Record<string, RoomMember>;
65
- export declare function readBranchInboxMessages(stateDir: string, run: string, address: string, limit?: number): Array<ActorMessage & {
65
+ export interface BranchInboxRecord extends ActorMessage {
66
66
  id?: string;
67
67
  queued_at?: string;
68
68
  status?: string;
69
- }>;
69
+ }
70
+ export interface BranchInboxReadResult {
71
+ corrupted: number;
72
+ messages: BranchInboxRecord[];
73
+ }
74
+ export declare function readBranchInboxMessages(stateDir: string, run: string, address: string, limit?: number): BranchInboxRecord[];
75
+ export declare function readBranchInboxDiagnostics(stateDir: string, run: string, address: string, limit?: number): BranchInboxReadResult;
70
76
  export declare function getBranchInboxTerminalRetainLimit(): number;
71
77
  export declare function appendBranchInboxMessage(stateDir: string, run: string, address: string, message: ActorMessage): void;
72
78
  export declare function updateBranchInboxMessageStatus(stateDir: string, run: string, address: string, id: string, status: "claimed" | "handled" | "failed", metadata?: Record<string, unknown>): boolean;