@llblab/pi-actors 0.43.0 → 0.43.1

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 (95) hide show
  1. package/AGENTS.md +12 -6
  2. package/BACKLOG.md +189 -1
  3. package/CHANGELOG.md +180 -301
  4. package/README.md +9 -7
  5. package/dist/index.js +1 -1
  6. package/dist/lib/async-runs.d.ts +2 -1
  7. package/dist/lib/async-runs.js +16 -4
  8. package/dist/lib/automatic-review-runtime.d.ts +1 -1
  9. package/dist/lib/automatic-review-runtime.js +5 -5
  10. package/dist/lib/command-templates.d.ts +2 -0
  11. package/dist/lib/command-templates.js +38 -4
  12. package/dist/lib/control-projection.d.ts +20 -0
  13. package/dist/lib/control-projection.js +66 -0
  14. package/dist/lib/control.d.ts +3 -0
  15. package/dist/lib/control.js +27 -14
  16. package/dist/lib/draft-sleep.js +3 -3
  17. package/dist/lib/file-state.d.ts +1 -0
  18. package/dist/lib/file-state.js +98 -42
  19. package/dist/lib/inspector-overlay.d.ts +2 -0
  20. package/dist/lib/inspector-overlay.js +92 -53
  21. package/dist/lib/limits.d.ts +5 -3
  22. package/dist/lib/limits.js +5 -3
  23. package/dist/lib/prompts.d.ts +1 -1
  24. package/dist/lib/prompts.js +1 -1
  25. package/dist/lib/recipe-control.js +6 -2
  26. package/dist/lib/review-control.d.ts +1 -1
  27. package/dist/lib/review-control.js +4 -5
  28. package/dist/lib/runs-control-delivery.d.ts +8 -1
  29. package/dist/lib/runs-control-delivery.js +38 -15
  30. package/dist/lib/runs-controls.d.ts +2 -0
  31. package/dist/lib/runs-controls.js +5 -3
  32. package/dist/lib/runs-trace.d.ts +2 -2
  33. package/dist/lib/runs-trace.js +24 -20
  34. package/dist/lib/runtime-identity.d.ts +7 -0
  35. package/dist/lib/runtime-identity.js +35 -0
  36. package/dist/lib/runtime-triage.d.ts +29 -0
  37. package/dist/lib/runtime-triage.js +76 -0
  38. package/dist/lib/tool-review-scheduler.js +7 -7
  39. package/dist/lib/tools-inspect.js +53 -14
  40. package/dist/lib/tools-message.d.ts +1 -2
  41. package/dist/lib/tools-message.js +6 -6
  42. package/dist/lib/tools-response.d.ts +0 -1
  43. package/dist/lib/tools-response.js +0 -9
  44. package/dist/lib/tools.d.ts +1 -1
  45. package/dist/lib/tools.js +1 -1
  46. package/dist/lib/trace-projection.js +30 -10
  47. package/dist/scripts/locker.mjs +9 -16
  48. package/dist/scripts/music-player.mjs +7 -13
  49. package/dist/scripts/release-gates.mjs +33 -2
  50. package/dist/scripts/validate-recipe.mjs +5 -4
  51. package/dist/skills/actors/SKILL.md +12 -7
  52. package/dist/skills/swarm/SKILL.md +0 -2
  53. package/docs/0.43-baseline.md +18 -23
  54. package/docs/README.md +2 -4
  55. package/docs/actor-inspector.md +5 -5
  56. package/docs/async-runs.md +2 -2
  57. package/docs/command-templates.md +6 -116
  58. package/docs/recipe-library.md +2 -4
  59. package/docs/releasing.md +28 -0
  60. package/docs/template-recipes.md +1 -1
  61. package/docs/tool-registry.md +2 -2
  62. package/index.ts +1 -1
  63. package/lib/async-runs.ts +18 -5
  64. package/lib/automatic-review-runtime.ts +7 -7
  65. package/lib/command-templates.ts +44 -4
  66. package/lib/control-projection.ts +105 -0
  67. package/lib/control.ts +33 -18
  68. package/lib/draft-sleep.ts +3 -3
  69. package/lib/file-state.ts +68 -61
  70. package/lib/inspector-overlay.ts +93 -58
  71. package/lib/limits.ts +5 -3
  72. package/lib/prompts.ts +1 -1
  73. package/lib/recipe-control.ts +9 -2
  74. package/lib/review-control.ts +4 -5
  75. package/lib/runs-control-delivery.ts +45 -17
  76. package/lib/runs-controls.ts +12 -3
  77. package/lib/runs-trace.ts +23 -19
  78. package/lib/runtime-identity.ts +39 -0
  79. package/lib/runtime-triage.ts +120 -0
  80. package/lib/tool-review-scheduler.ts +7 -7
  81. package/lib/tools-inspect.ts +60 -16
  82. package/lib/tools-message.ts +7 -8
  83. package/lib/tools-response.ts +0 -12
  84. package/lib/tools.ts +4 -4
  85. package/lib/trace-projection.ts +33 -10
  86. package/package.json +1 -1
  87. package/scripts/locker.mjs +9 -16
  88. package/scripts/music-player.mjs +7 -13
  89. package/scripts/release-gates.mjs +33 -2
  90. package/scripts/validate-recipe.mjs +5 -4
  91. package/skills/actors/SKILL.md +12 -7
  92. package/skills/swarm/SKILL.md +0 -2
  93. package/docs/actors-deep-reference.md +0 -108
  94. package/docs/component-recipes.md +0 -45
  95. package/docs/task-first-recipes.md +0 -261
package/AGENTS.md CHANGED
@@ -8,7 +8,7 @@
8
8
  - `CHANGELOG.md`: completed delivery history.
9
9
  - `docs/README.md`: documentation index.
10
10
 
11
- Keep these surfaces distinct and reconcile them after meaningful changes.
11
+ Keep these surfaces distinct and reconcile them after meaningful changes. Every release section, historical or new, keeps at most 8 outcome records of at most 512 characters.
12
12
 
13
13
  ## Concept
14
14
 
@@ -48,15 +48,16 @@ Pi host
48
48
  - `recipes-references.ts`, `recipes-discovery.ts`, `recipe-control.ts`: Recipe resolution, imports, shadowing, and Control declarations.
49
49
  - `async-runs.ts`: lifecycle facade.
50
50
  - `runs-start.ts`, `runs-status.ts`, `runs-control.ts`, `runs-control-delivery.ts`, `runs-controls.ts`, `runs-trace.ts`, `runs-process.ts`, `runs-retention.ts`, `runs-parent-teardown.ts`: focused Run internals.
51
- - `execution-sessions.ts`, `trace-projection.ts`, `session-evidence.ts`: bounded/redacted execution and inspection evidence.
51
+ - `execution-sessions.ts`, `trace-projection.ts`, `control-projection.ts`, `session-evidence.ts`: bounded/redacted execution and inspection evidence.
52
52
  - `tools-message.ts`: exact Control facade.
53
53
  - `tools-inspect.ts`: exact `run:<id>`, `runtime`, `recipes`, and `tool:<name>` inspection.
54
+ - `runtime-identity.ts`, `runtime-triage.ts`: immutable package/schema identity and pure pending/stale Control classification.
54
55
  - `tools-spawn.ts`, `tools-register.ts`, `tools-local.ts`, `tools-response.ts`: Run creation, persistent capabilities, Recipe-backed tools, and compact results.
55
56
  - `inspector.ts`, `inspector-overlay.ts`, `inspector-command.ts`, `inspector-actions.ts`: actor-instance Recipe/Trace/Control projection, navigation, command wiring, and fenced actions. **Actor Inspector** remains the product and command name, not a separate domain.
56
57
  - `observability.ts`, `runtime-notifier.ts`, `run-ui-runtime.ts`: Trace attention, terminal reconciliation, and Pi follow-up delivery.
57
58
  - automatic draft/tool review domains: structurally redacted model review, journaled mutation, lineage, recovery, and explicit retry/reset safety.
58
59
 
59
- Scripts remain self-contained when no non-script consumer justifies a TypeScript domain. Recipes stay optional, composable, policy-light, and caller-configurable.
60
+ Scripts remain self-contained when no non-script consumer justifies a TypeScript domain. Command-template script leaves infer `.js`/`.mjs` in order through Node, Bun, or `deno run` and `.sh` through Bash without shell evaluation. Helper-backed packaged Recipes self-locate their installed package root while explicit caller values remain authoritative. Recipes stay optional, composable, policy-light, and caller-configurable.
60
61
 
61
62
  ## Operating Principles
62
63
 
@@ -77,7 +78,7 @@ Canonical event:
77
78
  {"id":"…","ts":"…","kind":"…","summary":"…","data":{},"level":"info","attention":"notify"}
78
79
  ```
79
80
 
80
- Keep events bounded and free of addressing/routing fields. Use artifacts or execution captures for large evidence. `attention: "followup"` must remain rare and semantically justified.
81
+ Keep events bounded and free of addressing/routing fields. Every first-party writer must call `appendRunTraceEvent`; it validates and size-checks inside the canonical token-owned mutation lock, then performs one append-only JSONL write. Never append `trace.jsonl` directly from scripts. Use artifacts or execution captures for large evidence. `attention: "followup"` must remain rare and semantically justified.
81
82
 
82
83
  ### Control
83
84
 
@@ -87,7 +88,9 @@ Public shape:
87
88
  {"target":"run:<id>","action":"…","input":{},"verbose":false}
88
89
  ```
89
90
 
90
- Persist Control before transport. Fence every record and endpoint with immutable `run_instance_id`; controlled services capture that generation at startup. Serialize atomic journal replacement through token-owned dead-process-reclaiming locks, and keep status transitions expected-state-fenced and monotonic when consumers complete before producer delivery evidence. FIFO and named pipe are transport details, not public concepts; constrain FIFO documents to the portable atomic-write bound, reject partial writes, and keep FIFO readers gap-free across writers. Revalidate owner, generation, state, and process identity under the lifecycle lock immediately before delivery.
91
+ Admit only lowercase ASCII actions of at most 64 characters, serialized JSON input of at most 380 bytes, and complete newline-terminated wire records of at most 512 bytes on both FIFO and named pipe. Invalid envelopes remain outside the journal; persist every admitted Control before transport. Put larger data in a declared artifact/path and send only a bounded reference or instruction through Control. Fence every record and endpoint with immutable `run_instance_id`; controlled services capture that generation at startup. Serialize atomic journal replacement through token-owned dead-process-reclaiming locks, and keep status transitions expected-state-fenced and monotonic when consumers complete before producer delivery evidence. FIFO and named pipe are transport details, not public concepts; reject partial writes and keep FIFO readers gap-free across writers. Revalidate owner, generation, state, and process identity under the lifecycle lock immediately before delivery.
92
+
93
+ Keep `controls.jsonl` raw and local for execution fidelity. Every model-facing and Actor Inspector Control surface must use the shared bounded `control-projection.ts` redaction before exposure; never attach a second raw copy in tool details.
91
94
 
92
95
  Runtime lifecycle and review actions remain runtime-owned.
93
96
 
@@ -115,7 +118,7 @@ Lifecycle operations fail closed when identity, ownership, or generation cannot
115
118
 
116
119
  ## Registry and Evolution
117
120
 
118
- `~/.pi/agent/recipes/*.json` is executable capability memory. Preserve filename identity, atomic writes, canonical per-path locks, explicit operator-gated changes, and transportability.
121
+ `~/.pi/agent/recipes/*.json` is executable capability memory. Preserve filename identity, atomic writes, canonical per-path locks with atomic owner publication and non-blocking abandoned staging, explicit operator-gated changes, and transportability.
119
122
 
120
123
  Automatic review receives value-free structural projections, not executable content, paths, prose, canonical names, or secrets. Deterministic executors derive unchanged Recipes from trusted captures. Approved mutation must journal intent before mutation and roll forward safely after crashes.
121
124
 
@@ -134,5 +137,8 @@ When a deferred Run result gates the next step, wait for its terminal follow-up.
134
137
  - Keep published text portable: use `~`, `<repo>`, or relative paths.
135
138
  - Update `skills/actors/SKILL.md` when durable operating mechanics change.
136
139
  - Keep `skills/swarm/SKILL.md` focused on multi-agent methodology rather than kernel internals.
140
+ - Recipe `description` is optional because discovery supplies stable fallback tool copy; packaged Recipe QA must report zero diagnostics and zero release-blocking warnings without component boilerplate.
137
141
  - Before release run build, full tests, preservation tests, Recipe QA, Domain DAG validation, ABCd context validation, line-count gates, and release gates.
142
+ - `.github/workflows/release.yml` owns the immutable sequence reusable validation → npm Trusted Publisher publication/verification → GitHub Release convergence; follow [docs/releasing.md](docs/releasing.md).
143
+ - Keep npm publication tokenless: use the exact npm Trusted Publisher binding and job-scoped OIDC permission, never a long-lived npm token or token fallback.
138
144
  - Until a stable version beyond `1.x`, prefer clean breaking simplification over compatibility aliases or renamed legacy abstractions.
package/BACKLOG.md CHANGED
@@ -1,3 +1,191 @@
1
1
  # Project Backlog
2
2
 
3
- No open items.
3
+ ## 0.43.1 — Contract Closure
4
+
5
+ **Base:** `0.43.0` at `0d6db30cd2e070c1d03ed1e60bef70538a3083c1`
6
+ **Release type:** patch-level assurance and distribution closure
7
+ **Release sentence:** the Run kernel is published, portable, redacted, and mechanically self-consistent.
8
+
9
+ ## Mission
10
+
11
+ Close the concrete gaps exposed after the `0.43.0` Run-kernel migration without adding another orchestration layer or expanding the public model.
12
+
13
+ The canonical model remains unchanged:
14
+
15
+ ```text
16
+ Recipe --spawn--> Run
17
+ Run = Recipe + Trace + Control
18
+ ```
19
+
20
+ The public lifecycle remains:
21
+
22
+ ```text
23
+ spawn create a Run
24
+ message apply Control
25
+ inspect read Recipe, Trace, or Control
26
+ ```
27
+
28
+ `register_tool` remains the separate capability-memory surface.
29
+
30
+ `0.43.1` succeeds when the same contract is true in source mode, installed-package mode, documentation, diagnostics, first-party controlled services, CI, GitHub Release, and npm distribution.
31
+
32
+ ## Hard Boundaries
33
+
34
+ The release must preserve:
35
+
36
+ - exactly the existing public Run nouns: `Recipe`, `Run`, `Trace`, and `Control`;
37
+ - exactly the existing Run views: `recipe`, `trace`, and `control`;
38
+ - exactly the existing management targets: `runtime`, `recipes`, and `tool:<name>`;
39
+ - the stable public tool names `spawn`, `message`, `inspect`, and `register_tool`;
40
+ - owner filtering, immutable `run_instance_id` fencing, canonical lifecycle locking, and process-identity verification;
41
+ - shutdown and parent-teardown behavior;
42
+ - terminal reconciliation and bounded follow-up context;
43
+ - complete command captures, owned Pi-session evidence, redaction, path containment, and symlink rejection;
44
+ - automatic Recipe review, immutable capture, CAS, journaled mutation, lineage, retry, reset, and recovery safety;
45
+ - shell-free command-template execution;
46
+ - the strict Domain DAG and removed-communication-surface gates.
47
+
48
+ The release must not add:
49
+
50
+ - actor chat, rooms, branches, peers, routing, mailboxes, inboxes, outboxes, or addressed envelopes under any name;
51
+ - a task tree, planner hierarchy, decision registry, swarm scheduler, model router, or model-economics subsystem to the kernel;
52
+ - new public targets, views, request fields, Trace fields, Control states, or Recipe keys;
53
+ - a remote protocol, broker, workflow DSL, or general event bus;
54
+ - compatibility aliases for removed `0.42` surfaces;
55
+ - a long-lived npm token or third-party publish action;
56
+ - new runtime dependencies unless an existing retained invariant cannot be closed otherwise.
57
+
58
+ ## Deferred Beyond This Release
59
+
60
+ Do not absorb these future lines into `0.43.1`:
61
+
62
+ - total Trace retention, rotation, or semantic compaction;
63
+ - pending-Control admission backpressure and queue quotas;
64
+ - outcome/cost aggregation for Recipe fitness;
65
+ - automatic model selection or planner/worker economics;
66
+ - task-tree or decision-ownership orchestration;
67
+ - a generalized acknowledgement protocol for arbitrary controlled services.
68
+
69
+ Those require separate evidence and belong to later releases.
70
+
71
+ ## Known Closure Gaps
72
+
73
+ The executor must verify this observation against the current checkout before changing code:
74
+
75
+ 1. The repository-side Trusted Publisher path is prepared, but npm account binding and tagged publication proof remain external release preconditions.
76
+
77
+ If the observation no longer holds, preserve the already-closed behavior and remove only the corresponding obsolete task. Do not reimplement solved work.
78
+
79
+ ---
80
+
81
+ ## P0 — Release and Contract Closure
82
+
83
+ ### CCL-02 — Activate npm Trusted Publisher and prove registry convergence
84
+
85
+ **Goal:** make `pi install npm:@llblab/pi-actors` install the released Run kernel through the prepared tokenless, provenance-bearing path.
86
+
87
+ **Status:** repository preparation is complete; npm account configuration and one tagged release proof remain externally gated.
88
+
89
+ **External operator precondition:**
90
+
91
+ - Configure the npm Trusted Publisher for package `@llblab/pi-actors` with owner `llblab`, repository `pi-actors`, workflow filename `release.yml`, and no environment unless both sides adopt the same reviewed environment name.
92
+ - Do not add `NPM_TOKEN`, `NODE_AUTH_TOKEN`, or another long-lived token fallback.
93
+ - Remove any obsolete account-level automation tokens only after one Trusted Publisher release succeeds.
94
+
95
+ **Release-time closure:**
96
+
97
+ - The tagged workflow passes reusable validation, publishes or safely recognizes the exact npm version, verifies matching `gitHead` and packed Pi runtime manifests, then converges the GitHub Release.
98
+ - `npm view @llblab/pi-actors@0.43.1 version` and npm `latest` resolve to `0.43.1`.
99
+ - The GitHub Release and npm package identify the same tag commit.
100
+ - The Pi package index may update asynchronously; observe it without unbounded polling or repository mutation.
101
+ - If Trusted Publisher remains unconfigured or mismatched, report that exact external blocker and keep publication failed closed.
102
+
103
+ **Dependencies:** npm account configuration and the final tagged release.
104
+
105
+ ---
106
+
107
+ ## P1 — Signal, Compression, and Integration Closure
108
+
109
+ ### CCL-12 — Close release evidence and publish `0.43.1`
110
+
111
+ **Goal:** leave one internally consistent source tree, package, release, and empty future-work file.
112
+
113
+ **Work:**
114
+
115
+ - Reconcile implementation comments, README, `AGENTS.md`, `docs/`, Actors skill, fixtures, schemas, tests, and release notes.
116
+ - Keep Swarm skill changes limited to kernel-interface corrections; do not expand orchestration methodology in this release.
117
+ - Update package version and packaged skill metadata to `0.43.1` only after all implementation tasks close.
118
+ - Move completed work into one concise `CHANGELOG.md` section with externally meaningful behavior and impact.
119
+ - Reset `BACKLOG.md` to:
120
+
121
+ ```text
122
+ # Project Backlog
123
+
124
+ No open items.
125
+ ```
126
+
127
+ - Run the final local boundary:
128
+
129
+ ```bash
130
+ npm ci
131
+ npm run test:preservation
132
+ npm run release:validate
133
+ npm run audit:dependencies
134
+ ```
135
+
136
+ - Create tag `v0.43.1` only from the validated release commit.
137
+ - Observe the gated workflow through successful validation, npm publication, npm verification, and GitHub Release publication.
138
+ - Verify the final public package through npm, not only `npm pack --dry-run`.
139
+
140
+ **Release closure:**
141
+
142
+ - Ubuntu, macOS, Windows, and dependency-audit jobs succeed.
143
+ - GitHub Release is published only after validation and npm verification.
144
+ - npm exact version and `latest` both resolve to `0.43.1`.
145
+ - The installed package reports `0.43.1`, exposes the same schemas as source, and contains no removed communication surface.
146
+ - Recipe QA has zero diagnostics and zero baseline warnings.
147
+ - Shipped lines remain below `28,853`.
148
+ - No unresolved P0/P1 finding remains.
149
+ - `BACKLOG.md` contains no completed work.
150
+
151
+ **Dependencies:** all prior tasks and the npm Trusted Publisher external precondition.
152
+
153
+ ---
154
+
155
+ ## Dependency Order
156
+
157
+ ```text
158
+ Released 0.43.0 baseline
159
+ └── CCL-02 → CCL-12
160
+ ```
161
+
162
+ `CCL-02` may proceed in parallel with kernel fixes after the frozen released baseline, but no tag may be created until the complete graph closes.
163
+
164
+ ## Required Test Matrix
165
+
166
+ At minimum, retain or add direct evidence for:
167
+
168
+ | Boundary | Required evidence |
169
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
170
+ | Public Control request | exact fields, action length, serialized-input bound, removed-field rejection |
171
+ | Recipe Control | same action grammar/length, duplicate and runtime-reserved rejection |
172
+ | Control journal | generation fencing, monotonic transitions, compaction, stale-lock recovery |
173
+ | Control projection | recursive redaction in tool content/details, triage, and Actor Inspector |
174
+ | Control transport | exact complete-wire bound, FIFO atomicity, named-pipe parity, partial-write failure |
175
+ | Runtime status | exact version in source and packed/dist modes |
176
+ | Runtime triage | pending/stale distinction, delivered inclusion, age boundaries, owner/lifecycle filtering |
177
+ | Trace append | canonical validation, cross-process serialization, no malformed/lost/duplicate records |
178
+ | First-party services | canonical Trace only, canonical Control claim/finalization, endpoint generation |
179
+ | Documentation | canonical examples accepted by current schemas/dispatchers |
180
+ | Recipe QA | zero diagnostics and zero normalized warnings |
181
+ | Release | validation-before-publication, OIDC-only npm publishing, rerun convergence |
182
+ | Compression | strict shipped-line ratchet from `0.43.0` |
183
+ | Installed package | compiled entrypoint, skills, version, schemas, no stale files/source imports |
184
+
185
+ ## Final Decision Rule
186
+
187
+ Do not release because the code compiles or because the new abstractions look cleaner.
188
+
189
+ Release only when this statement is supported end to end:
190
+
191
+ > A user installing `@llblab/pi-actors@0.43.1` receives the same validated Run kernel described by the repository: every Run exposes one captured Recipe, one redacted causal Trace, and one portable generation-fenced Control boundary—without a communication plane and without distribution ambiguity.