@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
@@ -145,13 +145,44 @@ try {
145
145
  }
146
146
  console.log("[release] removed-surface and legacy-fallback allowlists checked");
147
147
 
148
- const baselineShippedLines = 35_077;
148
+ const directTraceWrite = /(?:appendFileSync|writeFileSync|writeText(?:Atomic)?)\s*\(\s*[A-Za-z0-9_.]*?(?:trace|event)(?:Path|File)/iu;
149
+ for (const path of files.filter((candidate) =>
150
+ (candidate.startsWith("lib/") && candidate.endsWith(".ts")) ||
151
+ (candidate.startsWith("scripts/") && candidate.endsWith(".mjs"))
152
+ )) {
153
+ if (path === "lib/runs-trace.ts") continue;
154
+ check(!directTraceWrite.test(stagedText(path) ?? ""), `direct Trace writer outside canonical authority: ${path}`);
155
+ }
156
+ const canonicalTrace = stagedText("lib/runs-trace.ts") ?? "";
157
+ check(/withFileMutationLock\(path/u.test(canonicalTrace), "canonical Trace append lacks mutation lock");
158
+ for (const path of [
159
+ "scripts/async-runner.mjs",
160
+ "scripts/locker.mjs",
161
+ "scripts/music-player.mjs",
162
+ ]) {
163
+ const text = stagedText(path) ?? "";
164
+ check(
165
+ text.includes('importRuntimeModule("runs-trace")') && text.includes("appendRunTraceEvent"),
166
+ `first-party Trace writer bypasses canonical runtime module: ${path}`,
167
+ );
168
+ }
169
+ console.log("[release] canonical Trace writer residue checked");
170
+
171
+ check(
172
+ (stagedText("scripts/validate-recipe.mjs") ?? "").includes(
173
+ "qaReport.diagnostics.length === 0 && qaReport.warnings.length === 0",
174
+ ),
175
+ "Recipe QA warnings are not release-blocking",
176
+ );
177
+ console.log("[release] zero-warning Recipe QA gate checked");
178
+
179
+ const baselineShippedLines = 28_853;
149
180
  const shippedPath = /^(?:lib\/|scripts\/|recipes\/|docs\/|skills\/)/u;
150
181
  const shippedLines = files
151
182
  .filter((path) => shippedPath.test(path))
152
183
  .reduce((total, path) => total + (((stagedText(path) ?? "").match(/\n/gu) ?? []).length + 1), 0);
153
184
  check(shippedLines < baselineShippedLines, `shipped lines ${shippedLines} are not below baseline ${baselineShippedLines}`);
154
- console.log(`[release] shipped lines ${shippedLines} < frozen baseline ${baselineShippedLines}`);
185
+ console.log(`[release] shipped lines ${shippedLines} < released baseline ${baselineShippedLines}`);
155
186
 
156
187
  const sources = files.filter((path) => path === "index.ts" || (path.startsWith("lib/") && path.endsWith(".ts")));
157
188
  const sourceSet = new Set(sources);
@@ -29,7 +29,7 @@ export function validateRecipeUsage() {
29
29
  return `Usage:
30
30
  validate-recipe.mjs <recipe-file-or-dir> [--all] [--qa] [--summary]
31
31
 
32
- Validates one template recipe file, or all *.json/*.md files in a directory when --all is set. Add --qa for packaged-recipe quality checks. Add --summary for compact CLI output.`;
32
+ Validates one template recipe file, or all *.json/*.md files in a directory when --all is set. Add --qa for packaged-recipe quality checks, where diagnostics and warnings fail validation. Add --summary for compact CLI output.`;
33
33
  }
34
34
 
35
35
  function expandPath(value) {
@@ -120,8 +120,6 @@ function validateHelperPaths(file, config) {
120
120
  function qaDiagnostics(file, config) {
121
121
  const diagnostics = [];
122
122
  const warnings = [];
123
- if (typeof config.description !== "string" || !config.description.trim())
124
- warnings.push("description: missing or empty");
125
123
  if (config.mailbox !== undefined)
126
124
  diagnostics.push("recipe.mailbox was removed; use control actions and Trace events");
127
125
  diagnostics.push(...validateArtifactDeclarations(config));
@@ -138,7 +136,7 @@ function qaDiagnostics(file, config) {
138
136
  }
139
137
 
140
138
  function qaOk(qaReport) {
141
- return qaReport.diagnostics.length === 0;
139
+ return qaReport.diagnostics.length === 0 && qaReport.warnings.length === 0;
142
140
  }
143
141
 
144
142
  function validateFile(file, qa = false) {
@@ -225,6 +223,9 @@ function summarizeReport(report) {
225
223
  ...(result.qa?.diagnostics?.length
226
224
  ? { diagnostics: result.qa.diagnostics }
227
225
  : {}),
226
+ ...(result.qa?.warnings?.length
227
+ ? { warnings: result.qa.warnings }
228
+ : {}),
228
229
  })),
229
230
  };
230
231
  }
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  name: actors
3
3
  description: Required practical guide for non-trivial pi-actors use and Run-kernel work. Read before using or changing spawn, message, inspect, Runs, tools, Recipes, command templates, Control, Trace, artifacts, or lifecycle mechanics.
4
- metadata:
5
- version: 0.43.0
6
4
  ---
7
5
 
8
6
  # Actors (pi-actors)
@@ -38,20 +36,28 @@ Prefer maintained packaged Recipes over ad hoc wrappers. Keep model, thinking, m
38
36
  Trace records bounded structured observations in `trace.jsonl`:
39
37
 
40
38
  ```json
41
- {"id":"…","ts":"…","kind":"progress.update","summary":"…","data":{},"level":"info","attention":"notify"}
39
+ {
40
+ "id": "…",
41
+ "ts": "…",
42
+ "kind": "progress.update",
43
+ "summary": "…",
44
+ "data": {},
45
+ "level": "info",
46
+ "attention": "notify"
47
+ }
42
48
  ```
43
49
 
44
- Trace never carries sender, recipient, route, reply, or message-envelope fields. Use `attention: "notify"` for visible notification and `attention: "followup"` only when the coordinator must receive semantic follow-up context. Prefer artifacts or complete execution captures for large evidence.
50
+ Trace never carries sender, recipient, route, reply, or message-envelope fields. First-party writers use the canonical append authority, which validates and size-checks under a token-owned cross-process lock before one append-only JSONL write. Use `attention: "notify"` for visible notification and `attention: "followup"` only when the coordinator must receive semantic follow-up context. Prefer artifacts or complete execution captures for large evidence.
45
51
 
46
52
  ## Control
47
53
 
48
54
  The public Control request is exact:
49
55
 
50
56
  ```json
51
- {"target":"run:<id>","action":"pause","input":{},"verbose":false}
57
+ { "target": "run:<id>", "action": "pause", "input": {}, "verbose": false }
52
58
  ```
53
59
 
54
- Controls persist in `controls.jsonl` before delivery. Token-owned locks serialize atomic journal replacements. Service endpoints publish readiness in `control-endpoint.json` with the immutable startup `run_instance_id`; only FIFO and named-pipe endpoints transport Controls. Expected-status-fenced transitions remain monotonic when a fast consumer completes before sender delivery evidence. FIFO documents must fit the portable 512-byte atomic-write bound, partial writes fail, and controlled FIFO readers remain gap-free across writers. Delivery revalidates owner, generation, running state, and process identity under the lifecycle lock.
60
+ Valid Controls persist in `controls.jsonl` before delivery; invalid envelopes remain outside the journal. Token-owned locks serialize atomic journal replacements. Service endpoints publish readiness in `control-endpoint.json` with the immutable startup `run_instance_id`; only FIFO and named-pipe endpoints transport Controls. Both transports share one portable envelope: action is at most 64 lowercase ASCII characters, serialized JSON input is at most 380 bytes, and the newline-terminated wire record is at most 512 bytes. Partial writes fail, and controlled FIFO readers remain gap-free across writers. Put larger data in a declared artifact/path and send only its bounded reference or instruction through Control. Delivery revalidates owner, generation, running state, and process identity under the lifecycle lock.
55
61
 
56
62
  `kill` remains a runtime lifecycle action. Use an actor-local action such as `stop` only when the Recipe declares and implements it.
57
63
 
@@ -90,7 +96,6 @@ If work may outlive the current turn, needs steering, produces artifacts, fans o
90
96
 
91
97
  ## Deep References
92
98
 
93
- - [Actors deep reference](../../docs/actors-deep-reference.md)
94
99
  - [Recipe library](../../docs/recipe-library.md)
95
100
  - [Async Runs](../../docs/async-runs.md)
96
101
  - [Baseline and preservation gates](../../docs/0.43-baseline.md)
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  name: swarm
3
3
  description: Subagent and actor orchestration with scoped locks, fanout, and quorum consensus. Use before launching multiple parallel actors or subagents for independent implementation, artifact generation, review, delegated audit, coordinated execution, or any workflow that needs autonomous coordinator decomposition and integration.
4
- metadata:
5
- version: 0.43.0
6
4
  ---
7
5
 
8
6
  # Swarm
@@ -1,12 +1,21 @@
1
- # 0.43 Migration Baseline
1
+ # Released 0.43 Baseline
2
2
 
3
- Release `0.43.0` uses commit `14e46931899347f08b3f1db94bc03a4f260e75a6` (`0.42.3`) as the frozen preservation and compression baseline.
3
+ Release `0.43.0` is frozen at commit `0d6db30cd2e070c1d03ed1e60bef70538a3083c1`. Local and remote `main`, immutable tag `v0.43.0`, the GitHub Release, and `@llblab/pi-actors@0.43.0` all resolve to that commit. The npm artifact records the same `gitHead`, shasum `64b5982bc1cda5723ce2f80f4ed15476b6016d62`, and `latest` dist-tag.
4
4
 
5
- Commit `261297a2250711ca7f412a489cce4477ef899e89` has the same Git tree, so the two commits contain no product-code delta. The release gate may use the former as the canonical baseline while `dev` starts from the latter topology.
5
+ The continuing `dev` line descends from release parent `f4e4e78891e0c3d570b31c35572aeaa226af6f91`, whose tree exactly matches the tagged merge tree. This preserves content equivalence without copying the content-neutral merge wrapper into `dev`.
6
6
 
7
- ## Shipped-line ceiling
7
+ ## Reproduced Evidence
8
8
 
9
- The baseline contains 35,077 lines under the shipped surfaces measured by `scripts/release-gates.mjs`:
9
+ An isolated detached `v0.43.0` worktree produced this evidence on 2026-08-11:
10
+
11
+ - `npm ci` succeeded with 147 installed packages. Its generic audit summary included three peer-tree findings; the package-owned `--omit=peer` audit passed with zero vulnerabilities.
12
+ - `npm run test:preservation` passed 91 of 91 tests.
13
+ - `npm run release:validate` passed 525 tests with 5 platform skips, 106 conformance tests, 58 Recipe QA files, package dry-run, removed-surface checks, strict Domain DAG, and ABCd context validation.
14
+ - GitHub reported no open issue or pull request requiring post-release scope changes.
15
+
16
+ ## Shipped-Line Ratchet
17
+
18
+ The released tree contains exactly **28,853** lines under the surfaces measured by `scripts/release-gates.mjs`:
10
19
 
11
20
  - `lib/`
12
21
  - `scripts/`
@@ -14,31 +23,17 @@ The baseline contains 35,077 lines under the shipped surfaces measured by `scrip
14
23
  - `docs/`
15
24
  - `skills/`
16
25
 
17
- Release validation fails when the retained shipped tree exceeds that ceiling. The ceiling guards the breaking communication-plane deletion against replacement bloat; it does not grant deleted communication behavior preservation status.
26
+ Release validation requires every retained post-`0.43.0` tree to remain strictly below 28,853 lines. Tests, fixtures, and workflows remain outside this existing metric. The ratchet prevents deleted communication-plane code from funding replacement bloat; it does not grant removed behavior preservation status.
18
27
 
19
- ## Retained invariants
28
+ ## Retained Invariants
20
29
 
21
- The preservation suite keeps evidence for the safety properties that survive the migration:
22
-
23
- - owner-filtered Run discovery;
24
- - immutable `run_instance_id` fencing;
25
- - process identity checks and canonical lifecycle locking;
26
- - shutdown kill and parent teardown;
27
- - terminal reconciliation and bounded captures;
28
- - owned Pi session provenance;
29
- - path containment and structured redaction;
30
- - automatic-review retry, reset, transaction, and lineage safety;
31
- - generation-bound Control and canonical Trace evidence.
32
-
33
- Rooms, peer routing, messages, mailboxes, communication topology, and their tests do not belong to the retained baseline.
30
+ The preservation suite covers owner-filtered Run discovery, immutable generation fencing, process identity, lifecycle locking, shutdown and parent teardown, terminal reconciliation, bounded complete captures, Pi session provenance, path containment, redaction, review recovery, generation-bound Control, and canonical Trace. Rooms, routing, addressed messages, mailboxes, and communication topology are not retained.
34
31
 
35
32
  ## Validation
36
33
 
37
- Run:
38
-
39
34
  ```bash
40
35
  npm run test:preservation
41
36
  npm run release:validate
42
37
  ```
43
38
 
44
- The release gate also rejects removed-surface residue, Domain DAG violations, ABCd context drift, stale package contents, and shipped-line growth above the frozen ceiling.
39
+ Release gates also reject removed-surface residue, Domain DAG violations, ABCd context drift, stale package contents, and shipped-line growth at or above the released baseline.
package/docs/README.md CHANGED
@@ -4,16 +4,14 @@ Living index of all documentation in the `/docs` directory.
4
4
 
5
5
  ## Documents
6
6
 
7
- - [0.43-baseline.md](./0.43-baseline.md) — Frozen `0.42.3` line counts and retained-invariant preservation gate
8
- - [actors-deep-reference.md](./actors-deep-reference.md) — Recipe navigator, operating patterns, lifecycle discipline, and pitfalls
7
+ - [0.43-baseline.md](./0.43-baseline.md) — Released tree, strict shipped-line ratchet, and retained-invariant preservation evidence
9
8
  - [command-templates.md](./command-templates.md) — Portable synchronous command execution standard
10
9
  - [template-recipes.md](./template-recipes.md) — Saved JSON/Markdown recipe standard, imports, and reusable command-template graph composition
11
10
  - [async-runs.md](./async-runs.md) — Run lifecycle, state, Control, Trace, cancellation, and terminal reconciliation
12
11
  - [actor-inspector.md](./actor-inspector.md) — Owner-filtered actor-instance navigation through Recipe, Trace, and Control
13
12
  - [tool-registry.md](./tool-registry.md) — Local `pi-actors` registry storage and `register_tool` adaptation
14
13
  - [recipe-library.md](./recipe-library.md) — Packaged standard recipe library such as async subagents, coordinator pipelines, utilities, and music playback
15
- - [task-first-recipes.md](./task-first-recipes.md) — Task-first design map for deriving high-level recipes and missing component cells
16
- - [component-recipes.md](./component-recipes.md) — Weak component-recipe contract for composing subagent coordinator building blocks
14
+ - [releasing.md](./releasing.md) — Guarded tag validation, npm Trusted Publisher setup, registry verification, and GitHub Release convergence
17
15
 
18
16
  ## Root Context
19
17
 
@@ -18,13 +18,13 @@ Shows captured execution provenance:
18
18
  - declared artifacts and actor-local actions;
19
19
  - model/thinking policy and launch source.
20
20
 
21
- Captured Recipe evidence belongs to the Run generation and does not change when an active Recipe file later changes.
21
+ Captured Recipe evidence belongs to the Run generation and does not change when an active Recipe file later changes. Non-empty object values render as indented brace-delimited property lists rather than flattened inline strings.
22
22
 
23
23
  ## Trace
24
24
 
25
25
  Shows the unified bounded Trace projection. Sources include lifecycle/runtime observations, Controls, owned Pi turns, command-log tails, results, artifacts, and diagnostics. Filter by source and open a row for structured detail.
26
26
 
27
- Trace ordering stays deterministic and newest-first. The projection applies path containment and redaction before rendering.
27
+ Trace ordering stays deterministic and newest-first. Row numbers still read chronologically from bottom to top: the oldest visible event is `#1` and the newest carries the highest number. The projection applies path containment and redaction before rendering.
28
28
 
29
29
  ## Control
30
30
 
@@ -35,14 +35,14 @@ Shows:
35
35
  - generation-fenced endpoint readiness;
36
36
  - recent durable Control records and outcomes.
37
37
 
38
- A service endpoint counts as ready only when `control-endpoint.json` matches the Run's immutable `run_instance_id`.
38
+ A service endpoint counts as ready only when `control-endpoint.json` matches the Run's immutable `run_instance_id`. Recent Control input and errors use the same bounded structured redaction as tool inspection. The durable `controls.jsonl` journal remains raw and local; rendering never mutates it or attaches an unredacted copy.
39
39
 
40
40
  ## Keys
41
41
 
42
42
  The footer displays current bindings. Use tab navigation to switch Recipe/Trace/Control, movement keys to select rows, detail navigation to inspect evidence, refresh to reconcile disk state, and the documented kill key for lifecycle termination.
43
43
 
44
- Run kill revalidates owner and generation through the canonical lifecycle path. The Inspector never edits state directly and never derives authority from displayed data.
44
+ Run kill revalidates owner and generation through the canonical lifecycle path. After success, the Run status header is the sole confirmation; the content area does not duplicate it. The Inspector never edits state directly and never derives authority from displayed data.
45
45
 
46
46
  ## Scope
47
47
 
48
- The Actor Inspector treats each Run as a concrete actor instance. It does not expose group conversations, peer addresses, routing, or communication topology. Use `inspect target=runtime`, `inspect target=recipes`, and `inspect target=tool:<name>` for non-Run management targets.
48
+ The Actor Inspector treats each Run as a concrete actor instance. It does not expose group conversations, peer addresses, routing, or communication topology. Use `inspect target=runtime view=status`, `inspect target=recipes view=status`, and `inspect target=tool:<name> view=status` for non-Run management targets.
@@ -55,7 +55,7 @@ Trace records strict bounded events:
55
55
  {"id":"…","ts":"…","kind":"command.done","summary":"Command completed","data":{"code":0},"level":"info","attention":"followup"}
56
56
  ```
57
57
 
58
- Required fields: `id`, `ts`, `kind`. Optional fields: `summary`, `data`, `level`, `attention`. Trace rejects addressed-envelope fields and malformed or oversized data.
58
+ Required fields: `id`, `ts`, `kind`. Optional fields: `summary`, `data`, `level`, `attention`. Trace rejects addressed-envelope fields and malformed or oversized data. All first-party writers use the canonical append authority, which validates and size-checks inside a token-owned cross-process lock before one append-only JSONL write.
59
59
 
60
60
  Runtime lifecycle, runner progress, command completion, cancellation, kill, parent teardown, and controlled-service observations use Trace. `inspect view=trace` projects these events with Controls, owned Pi turns, logs, results, artifacts, and diagnostics under a deterministic global bound.
61
61
 
@@ -82,7 +82,7 @@ The runtime:
82
82
  5. writes the exact `{id, action, input?}` wire document to FIFO or named pipe;
83
83
  6. records delivered or failed outcome.
84
84
 
85
- Unix services may publish a FIFO; native Windows services publish a Windows named pipe. Native Windows FIFO delivery fails before transport rather than degrading to another protocol. FIFO wire documents above the portable 512-byte atomic-write bound fail before writing; named pipes retain the general Control input bound.
85
+ Unix services may publish a FIFO; native Windows services publish a Windows named pipe. Native Windows FIFO delivery fails before transport rather than degrading to another protocol. Both transports admit the same portable envelope: action is at most 64 lowercase ASCII characters, serialized JSON input is at most 380 bytes, and the newline-terminated wire record is at most 512 bytes. Invalid envelopes fail before journal admission or transport. Put larger data in a declared artifact/path and send only a bounded reference or instruction through Control.
86
86
 
87
87
  A service claims queued or transport-delivered Controls and records handled/failed outcomes under the token-owned Control journal lock. Journal snapshots replace atomically, and expected-status fencing prevents delivery failure evidence from regressing a Control already claimed or completed by a fast consumer. Terminal compaction remains bounded. Services capture their startup generation, so stale-generation Controls never execute.
88
88
 
@@ -16,7 +16,7 @@ Layer boundary: command templates own only the synchronous execution graph. Reci
16
16
 
17
17
  Command-template standard owns:
18
18
 
19
- - Command string splitting and direct argv execution.
19
+ - Command string splitting, portable script-interpreter inference, and direct argv execution.
20
20
  - Placeholder resolution, typed public args, defaults, `??`, ternary string selection, and array-index placeholders.
21
21
  - Synchronous graph shape: sequence, `parallel`, `when`, `repeat`, stdin flow, stdout joins, and output selection.
22
22
  - Per-node execution controls: `timeout`, `delay`, `retry`, `failure`, and `recover`.
@@ -72,7 +72,7 @@ A runtime must:
72
72
 
73
73
  1. Split the template into shell-like words with simple single quotes, double quotes, and backslash escapes
74
74
  2. Substitute placeholders inside each split word
75
- 3. Execute command + args directly, without shell evaluation
75
+ 3. Infer a first-word `.js` or `.mjs` script through the first available `node`, `bun`, or `deno run` runtime, infer `.sh` through `bash`, and otherwise execute command + args directly; explicit interpreters remain unchanged and no shell evaluates the resulting argv
76
76
  4. Treat exit code `0` as success and non-zero as failure
77
77
  5. Use stdout as the default result channel and stderr only for diagnostics
78
78
 
@@ -106,35 +106,11 @@ With runtime values `{ "text": "hello" }`, argv is:
106
106
 
107
107
  Use `defaults` for visible configuration data; use inline defaults for compact local literals. Prefer flag-style examples such as `/path/to/tool --file {file} --lang {lang=ru}` for readability, but positional forms such as `/path/to/tool {file} {lang=ru}` are valid when the invoked script defines that CLI contract.
108
108
 
109
- Fallback values can be selected with nullish coalescing:
110
-
111
- ```json
112
- {
113
- "template": "deploy --env {env??dev} --region {region??local}"
114
- }
115
- ```
116
-
117
- Optional flags can be mapped from boolean args with a ternary:
118
-
119
- ```json
120
- {
121
- "args": ["target:path", "all:bool"],
122
- "defaults": { "all": "true" },
123
- "template": "validate-recipe {target} {all?--all:}"
124
- }
125
- ```
109
+ Use `{env??dev}` for fallback values and `{all?--all:}` to map boolean args to optional text.
126
110
 
127
111
  Typed declarations annotate the public tool interface, not the shell command. They may live in `args` or inline placeholders such as `{request_timeout:int=60000}` and `{mode:enum(check,fix)=check}`. Use metadata-first authoring (`args` plus `defaults`) when long templates should stay visually short; use inline-first authoring when one self-contained `template` property is clearer. They do not sandbox or reinterpret the executable; they only let the host generate narrower input schemas and normalize runtime values before placeholder substitution. Untyped `args` and untyped placeholders continue to work unchanged.
128
112
 
129
- Node control fields can also read public args. Use distinct arg names so execution controls stay visually separate from public inputs:
130
-
131
- ```json
132
- {
133
- "args": ["timeout_ms:int"],
134
- "timeout": "{timeout_ms}",
135
- "template": "npm test"
136
- }
137
- ```
113
+ Node control fields can also read public args, for example `"timeout": "{timeout_ms}"`; use distinct names so execution controls stay visually separate from public inputs.
138
114
 
139
115
  ## Quoting
140
116
 
@@ -194,21 +170,6 @@ Composition rules:
194
170
  - `min_successful` adds a join header with `complete`, `degraded`, or `insufficient_data`; with `failure: "branch"` or `"root"`, an unmet threshold fails at that scope
195
171
  - Each leaf still applies its own inline defaults
196
172
 
197
- ```json
198
- {
199
- "template": [
200
- "/path/to/tts --text {text} --lang {lang} --out {mp3}",
201
- {
202
- "defaults": { "codec": "libopus" },
203
- "template": "ffmpeg -y -i {mp3} -c:a {codec} {ogg}"
204
- }
205
- ],
206
- "args": ["text", "lang", "mp3", "ogg"],
207
- "defaults": { "lang": "en" },
208
- "output": "ogg"
209
- }
210
- ```
211
-
212
173
  `output` selects the primary result channel. Omitted `output` means `"stdout"`, and explicitly writing `"output": "stdout"` is valid standard syntax. Artifact-producing handlers may instead name a runtime value or placeholder path, e.g. `"ogg"` or `"{ogg}"`. Do not use `artifacts` in command-template nodes; named artifact manifests belong to the template-recipe layer.
213
174
 
214
175
  ### Repeat
@@ -245,52 +206,7 @@ Repeat expressions support only integers, `index`, `prev`, `next`, `repeat`, par
245
206
 
246
207
  Repeat placeholders are local generated values. Call-time args should not use these reserved names to override the repeat index.
247
208
 
248
- Parallel nodes use the same object shape. Flags come first and `template` stays last:
249
-
250
- ```json
251
- {
252
- "template": [
253
- "prepare {out_dir}",
254
- {
255
- "parallel": true,
256
- "template": [
257
- {
258
- "label": "reviewer-a",
259
- "timeout": 300000,
260
- "template": "review-gpt {scope}"
261
- },
262
- {
263
- "label": "reviewer-b",
264
- "timeout": 300000,
265
- "template": "review-deepseek {scope}"
266
- },
267
- {
268
- "label": "kimi",
269
- "timeout": 300000,
270
- "template": "review-kimi {scope}"
271
- }
272
- ]
273
- },
274
- "merge {out_dir}"
275
- ]
276
- }
277
- ```
278
-
279
- A degraded parallel join is still usable when at least one branch succeeds:
280
-
281
- ```text
282
- --- branch: reviewer-a status: done ---
283
- review text
284
- --- branch: reviewer-b status: failed ---
285
- exit: 1
286
- stderr: provider balance exhausted
287
- ```
288
-
289
- Some local schemas may accept `pipe` as an alias, but the portable standard is `template: [...]`.
290
-
291
- ## Fail-Open Default Policy
292
-
293
- By default, composition continues on failure: the failed step is logged and the next step executes. This is analogous to `make -k` — the user sees all failures at once and decides what to fix.
209
+ Parallel children use the same object shape: flags come first and `template` stays last. A join remains usable when at least one branch succeeds and reports each branch label/status. Some local schemas may accept `pipe`, but the portable standard is `template: [...]`.
294
210
 
295
211
  ## Failure Propagation
296
212
 
@@ -302,33 +218,7 @@ Use `failure` when a node should stop more aggressively:
302
218
  - `"branch"`: stop the current sequence/subtree and return a failed branch to the nearest parent. In a parallel node, sibling branches keep running and the join becomes degraded. At the root, branch failure is still a tool failure.
303
219
  - `"root"`: abort the outermost composition.
304
220
 
305
- ```json
306
- {
307
- "parallel": true,
308
- "template": [
309
- {
310
- "label": "agent-a",
311
- "failure": "branch",
312
- "template": [
313
- "agent-a-work {scope}",
314
- "agent-a-validate {scope}",
315
- "agent-a-push {scope}"
316
- ]
317
- },
318
- {
319
- "label": "agent-b",
320
- "failure": "branch",
321
- "template": [
322
- "agent-b-work {scope}",
323
- "agent-b-validate {scope}",
324
- "agent-b-push {scope}"
325
- ]
326
- }
327
- ]
328
- }
329
- ```
330
-
331
- If `agent-a-validate` fails, `agent-a-push` is skipped, `agent-b` can still finish, and the parallel join reports degraded branch coverage.
221
+ A branch failure skips the remainder of that branch while parallel siblings can finish; their join reports degraded coverage.
332
222
 
333
223
  ## Retry
334
224
 
@@ -37,7 +37,7 @@ Artifact pipelines terminate in files/manifests and result evidence; they do not
37
37
  - `music-player.json` — playback service with declared playback actions, `controls.jsonl`, generation-fenced endpoint readiness, state artifact, and playback Trace. Player selection is `player:enum(auto,mpv,afplay,ffplay,cvlc,play,wmp)=auto`.
38
38
  - `resource-locker.json` — optional queue/lease-lock service with explicit owner/resource input and lock Trace.
39
39
 
40
- These are the packaged Recipes that declare actor-local Control. Ordinary one-shot Recipes omit it.
40
+ These are the packaged Recipes that declare actor-local Control. Ordinary one-shot Recipes omit it. Helper-backed packaged Recipes self-locate their installed package root when `repo` is omitted; an explicit caller value still wins for development or custom layouts.
41
41
 
42
42
  ## Component Recipes
43
43
 
@@ -76,12 +76,10 @@ Do not bulk-copy `recipes/*.json` into the user Recipe root. Internal `draft-rev
76
76
  npm run recipes:qa
77
77
  ```
78
78
 
79
- Recipe QA validates syntax, imports, Control declarations, artifact paths, helper references, and platform documentation. Removed mailbox declarations fail with the migration diagnostic rather than receiving automatic conversion.
79
+ Recipe QA validates syntax, imports, Control declarations, artifact paths, helper references, and platform documentation. Recipe descriptions are optional because discovery supplies stable fallback tool copy; internal component Recipes do not need boilerplate. The packaged baseline requires zero diagnostics and zero warnings, and any future warning is release-blocking with its concrete file and repair. Removed mailbox declarations fail with the migration diagnostic rather than receiving automatic conversion.
80
80
 
81
81
  ## Related
82
82
 
83
83
  - [Template Recipes](./template-recipes.md)
84
84
  - [Command templates](./command-templates.md)
85
85
  - [Runs](./async-runs.md)
86
- - [Component Recipes](./component-recipes.md)
87
- - [Task-first design](./task-first-recipes.md)
@@ -0,0 +1,28 @@
1
+ # Release Operations
2
+
3
+ Stable releases use one immutable tag workflow. The workflow runs the complete reusable Ubuntu, macOS, Windows, and dependency-audit boundary before any publication, publishes and verifies the exact npm package through Trusted Publisher, then creates or converges the GitHub Release from the matching changelog section.
4
+
5
+ ## One-time npm Trusted Publisher setup
6
+
7
+ Configure the existing public package `@llblab/pi-actors` on npmjs.com with a GitHub Actions Trusted Publisher using these exact values:
8
+
9
+ - **Owner:** `llblab`
10
+ - **Repository:** `pi-actors`
11
+ - **Workflow filename:** `release.yml`
12
+ - **Environment:** Leave empty unless the workflow and npm configuration later adopt the same named GitHub environment in one reviewed change.
13
+
14
+ The binding must target `.github/workflows/release.yml`; npm asks for the filename rather than the repository-relative path. npm does not verify this identity when the setting is saved, so the first tagged publication provides the decisive proof.
15
+
16
+ Do not create `NPM_TOKEN`, `NODE_AUTH_TOKEN`, or another long-lived npm publish secret. The publication job runs on a GitHub-hosted Ubuntu runner with `id-token: write`, Node 24, npm 11.5.1 or newer, the public npm registry, and package-manager caching disabled at the credential-bearing boundary.
17
+
18
+ ## Release sequence
19
+
20
+ 1. Merge the validated release tree through the repository's guarded `dev` to `main` flow.
21
+ 2. Create one immutable `v<package.version>` tag on the verified `main` commit.
22
+ 3. Let `.github/workflows/release.yml` invoke the complete reusable validation workflow.
23
+ 4. Let the publication job verify the tag commit, package manifests, and non-empty changelog section.
24
+ 5. Publish the exact public npm package through OIDC when the version does not exist.
25
+ 6. Verify npm version, `gitHead`, Pi extension/skill metadata, and packed runtime manifests.
26
+ 7. Create or update the GitHub Release only after npm verification succeeds.
27
+
28
+ A rerun skips `npm publish` only when the exact existing version reports the same tagged `gitHead`; contradictory identity fails closed because npm versions are immutable. Registry lookup retries remain bounded. A missing or mismatched Trusted Publisher usually surfaces as npm authentication or not-found failure and must be corrected in npm package settings—never by adding a token fallback.
@@ -87,7 +87,7 @@ Only a process that consumes actor-local input declares actions:
87
87
  }
88
88
  ```
89
89
 
90
- Actions must be lowercase, unique, and non-reserved. One-shot Recipes omit Control. Outputs belong in Trace, artifacts, execution evidence, or the command result.
90
+ Actions must be lowercase ASCII, unique, non-reserved, and at most 64 characters. Serialized Control input is at most 380 bytes so every admitted wire record remains within 512 bytes on FIFO and named pipe. One-shot Recipes omit Control. Larger data belongs in a declared artifact/path; outputs belong in Trace, artifacts, execution evidence, or the command result.
91
91
 
92
92
  ## Artifacts
93
93
 
@@ -27,8 +27,8 @@ User Recipes take priority over packaged Recipes. Active invalid or disabled sha
27
27
  Inspect registry state with:
28
28
 
29
29
  ```text
30
- inspect target=recipes
31
- inspect target=tool:<name>
30
+ inspect target=recipes view=status
31
+ inspect target=tool:<name> view=status
32
32
  ```
33
33
 
34
34
  Recipe inspection reports active, shadowed, invalid, disabled, diagnostic, risk, usage, and review evidence. Tool inspection reports the current capability definition/schema; a registered tool is not a running actor.
package/index.ts CHANGED
@@ -110,7 +110,7 @@ export default function toolRegistryExtension(pi: Pi.ExtensionAPI) {
110
110
  Tools.resolveActiveRuntimeTool(name, runtime.getTools(), (activeName) =>
111
111
  actorToolDefinitions.get(activeName),
112
112
  ),
113
- handleRuntimeMessage: automaticReview.handleMessage,
113
+ handleRuntimeControl: automaticReview.handleControl,
114
114
  registryRuntime: runtime,
115
115
  setActiveTools: (toolNames) => pi.setActiveTools(toolNames),
116
116
  }).map(withCurrentThinkingContext),
package/lib/async-runs.ts CHANGED
@@ -59,6 +59,7 @@ import {
59
59
  verifyRunProcessIdentity,
60
60
  type RunProcessIdentity,
61
61
  } from "./runs-process.ts";
62
+ import * as RuntimeIdentity from "./runtime-identity.ts";
62
63
  import * as RunsStart from "./runs-start.ts";
63
64
  import { appendRunTraceEvent } from "./runs-trace.ts";
64
65
  import * as RunsIndex from "./runs-index.ts";
@@ -173,7 +174,7 @@ export interface AsyncRunMeta {
173
174
  run: string;
174
175
  run_instance_id: string;
175
176
  state_dir: string;
176
- state_schema: "run-kernel-v1";
177
+ state_schema: typeof RuntimeIdentity.RUN_STATE_SCHEMA;
177
178
  status: AsyncRunStatus;
178
179
  tool?: string;
179
180
  template: CommandTemplateValue;
@@ -466,7 +467,22 @@ export function startRun(
466
467
  const resolved = resolveRunTemplate(startParams);
467
468
  const run = safeRunId(startParams.run_id);
468
469
  const stateDir = resolveStateDir(startParams, run);
470
+ const recipeFile = startParams.file
471
+ ? resolveRecipeFile(startParams.file)
472
+ : undefined;
473
+ const packagedRecipeRoot = resolve(Paths.getPackagedRecipeRoot());
474
+ const recipeRelation = recipeFile
475
+ ? relative(packagedRecipeRoot, recipeFile)
476
+ : undefined;
477
+ const packagedRepo =
478
+ startParams.defaults?.repo === "~/.pi/agent/extensions/pi-actors" &&
479
+ recipeRelation &&
480
+ !recipeRelation.startsWith("..") &&
481
+ !isAbsolute(recipeRelation)
482
+ ? dirname(packagedRecipeRoot)
483
+ : undefined;
469
484
  const values = {
485
+ ...(packagedRepo ? { repo: packagedRepo } : {}),
470
486
  ...(startParams.values || {}),
471
487
  run_id: run,
472
488
  state_dir: stateDir,
@@ -494,9 +510,6 @@ export function startRun(
494
510
  prepareStateDirForStart(stateDir);
495
511
  const stdout = join(stateDir, "stdout.log");
496
512
  const stderr = join(stateDir, "stderr.log");
497
- const recipeFile = startParams.file
498
- ? resolveRecipeFile(startParams.file)
499
- : undefined;
500
513
  const recipe = startParams.name || getRunIdFromFile(recipeFile);
501
514
  const includeActorRecipeContext =
502
515
  startParams.actor_context !== false &&
@@ -545,7 +558,7 @@ export function startRun(
545
558
  run,
546
559
  run_instance_id: randomUUID(),
547
560
  state_dir: stateDir,
548
- state_schema: "run-kernel-v1",
561
+ state_schema: RuntimeIdentity.RUN_STATE_SCHEMA,
549
562
  status: "running",
550
563
  ...(startParams.tool ? { tool: startParams.tool } : {}),
551
564
  template: resolved.template,
@@ -16,7 +16,7 @@ import * as ToolReviewScheduler from "./tool-review-scheduler.ts";
16
16
 
17
17
  export interface AutomaticReviewRuntime {
18
18
  close(): void;
19
- handleMessage(type: string, body: unknown): Record<string, unknown>;
19
+ handleControl(action: string, input: unknown): Record<string, unknown>;
20
20
  schedule(): void;
21
21
  start(ctx: Pi.ExtensionContext): void;
22
22
  }
@@ -52,18 +52,18 @@ export function createAutomaticReviewRuntime(
52
52
 
53
53
  return {
54
54
  close,
55
- handleMessage(type, body) {
56
- if (type !== "review.retry" && type !== "review.reset") {
57
- throw new Error("tool:pi-actors accepts review.retry or review.reset messages.");
55
+ handleControl(action, input) {
56
+ if (action !== "review.retry" && action !== "review.reset") {
57
+ throw new Error("runtime accepts review.retry or review.reset Controls.");
58
58
  }
59
- if (type === "review.retry" && !Paths.isAutomaticRecipeReviewEnabled()) {
59
+ if (action === "review.retry" && !Paths.isAutomaticRecipeReviewEnabled()) {
60
60
  throw new Error(
61
61
  "Automatic recipe review is disabled by PI_ACTORS_AUTOMATIC_REVIEW.",
62
62
  );
63
63
  }
64
64
  return ReviewControl.controlAutomaticReview(
65
- type,
66
- ReviewControl.parseAutomaticReviewScope(body),
65
+ action,
66
+ ReviewControl.parseAutomaticReviewScope(input),
67
67
  {
68
68
  scheduleDraft: () => draftScheduler?.schedule(),
69
69
  scheduleTool: () => toolScheduler?.schedule(),