@llblab/pi-actors 0.42.3 → 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.
- package/AGENTS.md +127 -175
- package/BACKLOG.md +189 -1
- package/CHANGELOG.md +183 -292
- package/README.md +115 -276
- package/dist/fixtures/protocol/control-endpoint.json +6 -0
- package/dist/fixtures/protocol/control-record.json +9 -0
- package/dist/fixtures/protocol/recipe-summary.json +4 -12
- package/dist/fixtures/protocol/trace-event.json +9 -0
- package/dist/index.js +1 -1
- package/dist/lib/async-runs.d.ts +15 -38
- package/dist/lib/async-runs.js +173 -111
- package/dist/lib/automatic-review-runtime.d.ts +1 -1
- package/dist/lib/automatic-review-runtime.js +5 -5
- package/dist/lib/command-templates.d.ts +2 -0
- package/dist/lib/command-templates.js +38 -4
- package/dist/lib/control-projection.d.ts +20 -0
- package/dist/lib/control-projection.js +66 -0
- package/dist/lib/control.d.ts +15 -0
- package/dist/lib/control.js +97 -0
- package/dist/lib/draft-sleep.js +3 -3
- package/dist/lib/execution-sessions.d.ts +17 -0
- package/dist/lib/execution-sessions.js +85 -0
- package/dist/lib/file-state.d.ts +2 -0
- package/dist/lib/file-state.js +114 -46
- package/dist/lib/inspector-actions.d.ts +2 -2
- package/dist/lib/inspector-actions.js +2 -2
- package/dist/lib/inspector-command.js +3 -3
- package/dist/lib/inspector-overlay.d.ts +54 -70
- package/dist/lib/inspector-overlay.js +576 -910
- package/dist/lib/inspector.d.ts +3 -71
- package/dist/lib/inspector.js +19 -665
- package/dist/lib/limits.d.ts +7 -3
- package/dist/lib/limits.js +7 -3
- package/dist/lib/observability.d.ts +16 -16
- package/dist/lib/observability.js +43 -82
- package/dist/lib/prompts.d.ts +1 -1
- package/dist/lib/prompts.js +3 -3
- package/dist/lib/recipe-control.d.ts +7 -0
- package/dist/lib/recipe-control.js +43 -0
- package/dist/lib/recipes-discovery.js +2 -0
- package/dist/lib/recipes-references.d.ts +1 -14
- package/dist/lib/recipes-references.js +6 -21
- package/dist/lib/review-control.d.ts +1 -1
- package/dist/lib/review-control.js +4 -5
- package/dist/lib/review-projection.js +1 -5
- package/dist/lib/run-ui-runtime.js +2 -2
- package/dist/lib/runs-control-delivery.d.ts +28 -0
- package/dist/lib/runs-control-delivery.js +150 -0
- package/dist/lib/runs-controls.d.ts +37 -0
- package/dist/lib/runs-controls.js +146 -0
- package/dist/lib/runs-retention.d.ts +7 -0
- package/dist/lib/runs-retention.js +27 -3
- package/dist/lib/runs-start.js +4 -2
- package/dist/lib/runs-status.js +11 -6
- package/dist/lib/runs-trace.d.ts +24 -0
- package/dist/lib/runs-trace.js +102 -0
- package/dist/lib/runtime-identity.d.ts +7 -0
- package/dist/lib/runtime-identity.js +35 -0
- package/dist/lib/runtime-notifier.d.ts +1 -1
- package/dist/lib/runtime-notifier.js +1 -1
- package/dist/lib/runtime-triage.d.ts +29 -0
- package/dist/lib/runtime-triage.js +76 -0
- package/dist/lib/tool-review-scheduler.js +7 -7
- package/dist/lib/tools-inspect.d.ts +3 -3
- package/dist/lib/tools-inspect.js +241 -707
- package/dist/lib/tools-local.js +2 -10
- package/dist/lib/tools-message.d.ts +6 -7
- package/dist/lib/tools-message.js +95 -396
- package/dist/lib/tools-response.d.ts +1 -5
- package/dist/lib/tools-response.js +5 -48
- package/dist/lib/tools-spawn.js +16 -28
- package/dist/lib/tools.d.ts +1 -1
- package/dist/lib/tools.js +2 -3
- package/dist/lib/trace-projection.d.ts +22 -0
- package/dist/lib/trace-projection.js +185 -0
- package/dist/recipes/draft-review.json +0 -10
- package/dist/recipes/lens-swarm.json +0 -14
- package/dist/recipes/music-player.json +10 -19
- package/dist/recipes/pipeline-architect-coordinator.json +0 -11
- package/dist/recipes/pipeline-artifact-bundle.json +1 -22
- package/dist/recipes/pipeline-artifact-report.json +1 -18
- package/dist/recipes/pipeline-artifact-write.json +1 -18
- package/dist/recipes/pipeline-async-run-ops.json +0 -12
- package/dist/recipes/pipeline-checkpoint-continuation.json +0 -14
- package/dist/recipes/pipeline-development-tasking.json +0 -12
- package/dist/recipes/pipeline-docs-maintenance.json +0 -12
- package/dist/recipes/pipeline-media-library.json +0 -12
- package/dist/recipes/pipeline-quorum-review.json +0 -12
- package/dist/recipes/pipeline-release-readiness.json +0 -12
- package/dist/recipes/pipeline-release-summary.json +0 -12
- package/dist/recipes/pipeline-repo-health.json +0 -12
- package/dist/recipes/pipeline-research-synthesis.json +0 -11
- package/dist/recipes/pipeline-review-readiness.json +0 -12
- package/dist/recipes/resource-locker.json +27 -0
- package/dist/recipes/subagent-artifact.json +0 -9
- package/dist/recipes/subagent-checkpoint.json +0 -10
- package/dist/recipes/subagent-conflict-report.json +0 -11
- package/dist/recipes/subagent-contradiction-map.json +0 -11
- package/dist/recipes/subagent-critic.json +0 -11
- package/dist/recipes/subagent-evidence-map.json +0 -11
- package/dist/recipes/subagent-followup.json +0 -10
- package/dist/recipes/subagent-judge.json +0 -11
- package/dist/recipes/subagent-merge.json +0 -11
- package/dist/recipes/subagent-normalize.json +0 -11
- package/dist/recipes/subagent-plan.json +0 -11
- package/dist/recipes/subagent-preflight.json +0 -11
- package/dist/recipes/subagent-prompt.json +0 -10
- package/dist/recipes/subagent-quorum.json +0 -10
- package/dist/recipes/subagent-review-coordinator.json +0 -14
- package/dist/recipes/subagent-review.json +0 -11
- package/dist/recipes/subagent-task-card.json +0 -11
- package/dist/recipes/subagent-tools.json +0 -10
- package/dist/recipes/subagent-verify.json +0 -11
- package/dist/recipes/subagents-prompts.json +0 -10
- package/dist/recipes/tool-review.json +0 -10
- package/dist/scripts/async-runner.mjs +25 -25
- package/dist/scripts/conformance.mjs +4 -2
- package/dist/scripts/locker.mjs +196 -69
- package/dist/scripts/music-player.mjs +162 -159
- package/dist/scripts/recipe-utils.mjs +6 -96
- package/dist/scripts/release-gates.mjs +91 -0
- package/dist/scripts/validate-recipe.mjs +8 -57
- package/dist/skills/actors/SKILL.md +57 -265
- package/dist/skills/swarm/SKILL.md +10 -34
- package/docs/0.43-baseline.md +39 -0
- package/docs/README.md +4 -6
- package/docs/actor-inspector.md +26 -64
- package/docs/async-runs.md +81 -328
- package/docs/command-templates.md +8 -118
- package/docs/recipe-library.md +55 -182
- package/docs/releasing.md +28 -0
- package/docs/template-recipes.md +76 -289
- package/docs/tool-registry.md +41 -161
- package/fixtures/protocol/control-endpoint.json +6 -0
- package/fixtures/protocol/control-record.json +9 -0
- package/fixtures/protocol/recipe-summary.json +4 -12
- package/fixtures/protocol/trace-event.json +9 -0
- package/index.ts +1 -1
- package/lib/async-runs.ts +218 -204
- package/lib/automatic-review-runtime.ts +7 -7
- package/lib/command-templates.ts +44 -4
- package/lib/control-projection.ts +105 -0
- package/lib/control.ts +117 -0
- package/lib/draft-sleep.ts +3 -3
- package/lib/execution-sessions.ts +111 -0
- package/lib/file-state.ts +84 -64
- package/lib/inspector-actions.ts +2 -2
- package/lib/inspector-command.ts +3 -3
- package/lib/inspector-overlay.ts +617 -1126
- package/lib/inspector.ts +46 -979
- package/lib/limits.ts +7 -3
- package/lib/observability.ts +60 -101
- package/lib/prompts.ts +3 -3
- package/lib/recipe-control.ts +52 -0
- package/lib/recipes-discovery.ts +2 -0
- package/lib/recipes-references.ts +9 -45
- package/lib/review-control.ts +4 -5
- package/lib/review-projection.ts +1 -5
- package/lib/run-ui-runtime.ts +2 -2
- package/lib/runs-control-delivery.ts +209 -0
- package/lib/runs-controls.ts +213 -0
- package/lib/runs-retention.ts +38 -3
- package/lib/runs-start.ts +4 -2
- package/lib/runs-status.ts +11 -6
- package/lib/runs-trace.ts +136 -0
- package/lib/runtime-identity.ts +39 -0
- package/lib/runtime-notifier.ts +1 -1
- package/lib/runtime-triage.ts +120 -0
- package/lib/tool-review-scheduler.ts +7 -7
- package/lib/tools-inspect.ts +283 -900
- package/lib/tools-local.ts +2 -12
- package/lib/tools-message.ts +112 -520
- package/lib/tools-response.ts +5 -64
- package/lib/tools-spawn.ts +16 -32
- package/lib/tools.ts +5 -6
- package/lib/trace-projection.ts +244 -0
- package/package.json +2 -1
- package/recipes/draft-review.json +0 -10
- package/recipes/lens-swarm.json +0 -14
- package/recipes/music-player.json +10 -19
- package/recipes/pipeline-architect-coordinator.json +0 -11
- package/recipes/pipeline-artifact-bundle.json +1 -22
- package/recipes/pipeline-artifact-report.json +1 -18
- package/recipes/pipeline-artifact-write.json +1 -18
- package/recipes/pipeline-async-run-ops.json +0 -12
- package/recipes/pipeline-checkpoint-continuation.json +0 -14
- package/recipes/pipeline-development-tasking.json +0 -12
- package/recipes/pipeline-docs-maintenance.json +0 -12
- package/recipes/pipeline-media-library.json +0 -12
- package/recipes/pipeline-quorum-review.json +0 -12
- package/recipes/pipeline-release-readiness.json +0 -12
- package/recipes/pipeline-release-summary.json +0 -12
- package/recipes/pipeline-repo-health.json +0 -12
- package/recipes/pipeline-research-synthesis.json +0 -11
- package/recipes/pipeline-review-readiness.json +0 -12
- package/recipes/resource-locker.json +27 -0
- package/recipes/subagent-artifact.json +0 -9
- package/recipes/subagent-checkpoint.json +0 -10
- package/recipes/subagent-conflict-report.json +0 -11
- package/recipes/subagent-contradiction-map.json +0 -11
- package/recipes/subagent-critic.json +0 -11
- package/recipes/subagent-evidence-map.json +0 -11
- package/recipes/subagent-followup.json +0 -10
- package/recipes/subagent-judge.json +0 -11
- package/recipes/subagent-merge.json +0 -11
- package/recipes/subagent-normalize.json +0 -11
- package/recipes/subagent-plan.json +0 -11
- package/recipes/subagent-preflight.json +0 -11
- package/recipes/subagent-prompt.json +0 -10
- package/recipes/subagent-quorum.json +0 -10
- package/recipes/subagent-review-coordinator.json +0 -14
- package/recipes/subagent-review.json +0 -11
- package/recipes/subagent-task-card.json +0 -11
- package/recipes/subagent-tools.json +0 -10
- package/recipes/subagent-verify.json +0 -11
- package/recipes/subagents-prompts.json +0 -10
- package/recipes/tool-review.json +0 -10
- package/scripts/async-runner.mjs +25 -25
- package/scripts/conformance.mjs +4 -2
- package/scripts/locker.mjs +196 -69
- package/scripts/music-player.mjs +162 -159
- package/scripts/recipe-utils.mjs +6 -96
- package/scripts/release-gates.mjs +91 -0
- package/scripts/validate-recipe.mjs +8 -57
- package/skills/actors/SKILL.md +57 -265
- package/skills/swarm/SKILL.md +10 -34
- package/dist/fixtures/protocol/actor-message-branch.json +0 -13
- package/dist/fixtures/protocol/mailbox-contract.json +0 -15
- package/dist/fixtures/protocol/room-message.json +0 -11
- package/dist/fixtures/protocol/room-roster.json +0 -11
- package/dist/fixtures/protocol/run-inbox-message.json +0 -9
- package/dist/fixtures/protocol/run-outbox-event.json +0 -9
- package/dist/lib/mailbox-loop.d.ts +0 -41
- package/dist/lib/mailbox-loop.js +0 -60
- package/dist/lib/messages.d.ts +0 -25
- package/dist/lib/messages.js +0 -122
- package/dist/lib/rooms.d.ts +0 -104
- package/dist/lib/rooms.js +0 -647
- package/dist/lib/runs-mailbox.d.ts +0 -25
- package/dist/lib/runs-mailbox.js +0 -146
- package/dist/lib/runs-messages.d.ts +0 -15
- package/dist/lib/runs-messages.js +0 -179
- package/dist/lib/runs-outbox.d.ts +0 -41
- package/dist/lib/runs-outbox.js +0 -87
- package/dist/lib/tools-mailbox.d.ts +0 -8
- package/dist/lib/tools-mailbox.js +0 -48
- package/dist/recipes/actor-worker.json +0 -39
- package/dist/recipes/coordinator-locker.json +0 -45
- package/dist/recipes/locker.json +0 -45
- package/dist/recipes/pipeline-room-swarm.json +0 -50
- package/dist/recipes/subagent-message.json +0 -32
- package/dist/recipes/utility-actor-message.json +0 -23
- package/dist/scripts/actor-worker.mjs +0 -214
- package/dist/scripts/coordinator.mjs +0 -799
- package/docs/actor-messages.md +0 -225
- package/docs/actors-deep-reference.md +0 -66
- package/docs/component-recipes.md +0 -148
- package/docs/task-first-recipes.md +0 -263
- package/fixtures/protocol/actor-message-branch.json +0 -13
- package/fixtures/protocol/mailbox-contract.json +0 -15
- package/fixtures/protocol/room-message.json +0 -11
- package/fixtures/protocol/room-roster.json +0 -11
- package/fixtures/protocol/run-inbox-message.json +0 -9
- package/fixtures/protocol/run-outbox-event.json +0 -9
- package/lib/mailbox-loop.ts +0 -144
- package/lib/messages.ts +0 -151
- package/lib/rooms.ts +0 -939
- package/lib/runs-mailbox.ts +0 -208
- package/lib/runs-messages.ts +0 -252
- package/lib/runs-outbox.ts +0 -144
- package/lib/tools-mailbox.ts +0 -56
- package/recipes/actor-worker.json +0 -39
- package/recipes/coordinator-locker.json +0 -45
- package/recipes/locker.json +0 -45
- package/recipes/pipeline-room-swarm.json +0 -50
- package/recipes/subagent-message.json +0 -32
- package/recipes/utility-actor-message.json +0 -23
- package/scripts/actor-worker.mjs +0 -214
- package/scripts/coordinator.mjs +0 -799
package/README.md
CHANGED
|
@@ -1,48 +1,13 @@
|
|
|
1
1
|
# pi-actors
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Local actor kernel for Pi.**
|
|
6
|
-
|
|
7
|
-
`pi-actors` turns trusted local programs, scripts, services, pipelines, recipes, and sub-agents into addressable actors that Pi can spawn, steer, inspect, and reuse. It is the bridge between one-shot shell commands and durable local capability memory.
|
|
8
|
-
|
|
9
|
-
A command is a moment. An actor is a local thing with time: address, lifecycle, logs, mailbox, messages, artifacts, state, and an interaction contract.
|
|
3
|
+
Local Run kernel and persistent tool registry for [Pi](https://github.com/badlogic/pi-mono).
|
|
10
4
|
|
|
11
5
|
```text
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
→ recipe
|
|
15
|
-
→ spawn
|
|
16
|
-
→ run:<id>
|
|
17
|
-
→ message / inspect / artifacts
|
|
18
|
-
→ reusable tool memory
|
|
6
|
+
Recipe --spawn--> Run
|
|
7
|
+
Run = Recipe + Trace + Control
|
|
19
8
|
```
|
|
20
9
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Agents are good at reasoning, but they should not reconstruct the same fragile background command every time a task becomes long-lived. `pi-actors` gives Pi a local-first actor layer: work can outlive the current turn, expose bounded state, receive typed instructions, produce artifacts, and graduate into persistent recipe-backed tools under `~/.pi/agent/recipes`.
|
|
24
|
-
|
|
25
|
-
Use it when the correct shape is not "run a command and forget" but "start a local capability, keep its handle, and come back with intent."
|
|
26
|
-
|
|
27
|
-
## The promise
|
|
28
|
-
|
|
29
|
-
- **Spawn long-lived work without shell gymnastics.** Start services, workers, subagents, fanouts, and pipelines as named actor runs.
|
|
30
|
-
- **Steer instead of restarting.** Send typed `message` envelopes to runs, tools, branches, rooms, sessions, or coordinators.
|
|
31
|
-
- **Inspect intentionally.** Read status, logs, messages, mailboxes, artifacts, registry health, and room rosters at decision points.
|
|
32
|
-
- **Promote what works.** Persist trusted command templates and recipes as durable local tools in `~/.pi/agent/recipes`.
|
|
33
|
-
- **Keep orchestration local.** State is file-backed, inspectable, operator-owned, and designed for Pi sessions rather than a cloud broker.
|
|
34
|
-
|
|
35
|
-
## Core verbs
|
|
36
|
-
|
|
37
|
-
`pi-actors` compresses local orchestration into three public verbs:
|
|
38
|
-
|
|
39
|
-
| Verb | Use it when | Result |
|
|
40
|
-
| --- | --- | --- |
|
|
41
|
-
| `spawn` | Work may outlive this turn, fan out, produce artifacts, or need later steering | A `run:<id>` actor with lifecycle and state |
|
|
42
|
-
| `message` | An existing actor should be continued, stopped, approved, killed, or given scoped input | One typed envelope delivered to one address |
|
|
43
|
-
| `inspect` | You need evidence before deciding the next step | Bounded views of status, logs, messages, registry, artifacts, or rooms |
|
|
44
|
-
|
|
45
|
-
Everything else is an adapter until proven otherwise.
|
|
10
|
+
An **actor** is any runnable local capability: a script, tool, service, pipeline, or subagent. A **Recipe** is its reusable executable definition. `spawn` creates a **Run**—one concrete actor instance—which captures its Recipe, appends observable **Trace**, and may consume actor-local **Control**.
|
|
46
11
|
|
|
47
12
|
## Install
|
|
48
13
|
|
|
@@ -50,317 +15,191 @@ Everything else is an adapter until proven otherwise.
|
|
|
50
15
|
pi install npm:@llblab/pi-actors
|
|
51
16
|
```
|
|
52
17
|
|
|
53
|
-
|
|
18
|
+
For local development:
|
|
54
19
|
|
|
55
20
|
```bash
|
|
56
|
-
pi install
|
|
21
|
+
pi install /path/to/pi-actors
|
|
57
22
|
```
|
|
58
23
|
|
|
59
|
-
The
|
|
24
|
+
The package contributes the extension, packaged Recipes, and the `actors` and `swarm` skills.
|
|
60
25
|
|
|
61
|
-
##
|
|
26
|
+
## Public Tools
|
|
62
27
|
|
|
63
|
-
|
|
28
|
+
### `spawn`
|
|
64
29
|
|
|
65
|
-
|
|
30
|
+
Create a Run from a packaged/local Recipe or an inline command template:
|
|
66
31
|
|
|
67
32
|
```text
|
|
68
33
|
spawn template="sleep 30" as=run:demo
|
|
34
|
+
spawn recipe=pipeline-repo-health values={"repo":"/work/project","model":"provider/model"}
|
|
35
|
+
spawn template="make test" as=run:test
|
|
69
36
|
```
|
|
70
37
|
|
|
71
|
-
|
|
38
|
+
Use a Run when work may outlive the current turn, needs steering, fans out, produces artifacts, or must remain inspectable. Short foreground commands can remain ordinary tools.
|
|
72
39
|
|
|
73
|
-
|
|
74
|
-
inspect target=run:demo view=status
|
|
75
|
-
inspect target=run:demo view=tail lines=40
|
|
76
|
-
```
|
|
40
|
+
### `message`
|
|
77
41
|
|
|
78
|
-
|
|
42
|
+
Send one exact Control:
|
|
79
43
|
|
|
80
|
-
```
|
|
81
|
-
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"target": "run:player",
|
|
47
|
+
"action": "pause",
|
|
48
|
+
"input": { "reason": "operator" },
|
|
49
|
+
"verbose": false
|
|
50
|
+
}
|
|
82
51
|
```
|
|
83
52
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## Address surface
|
|
87
|
-
|
|
88
|
-
Core addresses stay small:
|
|
53
|
+
Run targets accept only actions declared by the captured Recipe. Runtime targets accept only reserved review actions:
|
|
89
54
|
|
|
90
55
|
```text
|
|
91
|
-
|
|
92
|
-
|
|
56
|
+
message target=runtime action=review.retry input={"scope":"draft"}
|
|
57
|
+
message target=runtime action=review.retry input={"scope":"tool"}
|
|
58
|
+
message target=runtime action=review.reset input={"scope":"draft"}
|
|
59
|
+
message target=runtime action=review.reset input={"scope":"tool"}
|
|
93
60
|
```
|
|
94
61
|
|
|
95
|
-
|
|
62
|
+
Lifecycle `kill` remains runtime-owned rather than Recipe-declared.
|
|
96
63
|
|
|
97
|
-
|
|
98
|
-
branch:<run>/<branch> branch-local worker endpoint
|
|
99
|
-
room:<run> run-local group timeline plus roster
|
|
100
|
-
coordinator current session coordination path
|
|
101
|
-
session: current session actor surface
|
|
102
|
-
session:all cross-session diagnostics inventory
|
|
103
|
-
```
|
|
64
|
+
### `inspect`
|
|
104
65
|
|
|
105
|
-
|
|
66
|
+
Inspect one exact management target:
|
|
106
67
|
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"reply_to": "msg_123",
|
|
115
|
-
"correlation_id": "task_456",
|
|
116
|
-
"metadata": {}
|
|
117
|
-
}
|
|
68
|
+
```text
|
|
69
|
+
inspect target=run:test view=recipe
|
|
70
|
+
inspect target=run:test view=trace source=lifecycle lines=40
|
|
71
|
+
inspect target=run:test view=control
|
|
72
|
+
inspect target=runtime view=status
|
|
73
|
+
inspect target=recipes view=status
|
|
74
|
+
inspect target=tool:my_tool view=status
|
|
118
75
|
```
|
|
119
76
|
|
|
120
|
-
|
|
77
|
+
A Run exposes exactly `recipe`, `trace`, and `control` views.
|
|
121
78
|
|
|
122
|
-
|
|
79
|
+
### `register_tool`
|
|
123
80
|
|
|
124
|
-
|
|
125
|
-
| --- | --- | --- |
|
|
126
|
-
| Command templates | Portable command graphs with placeholders, defaults, guards, retries, parallel nodes, recovery, and timeouts | Wrap a trusted local executable without writing a bespoke tool |
|
|
127
|
-
| Recipes | JSON/Markdown capability specs with metadata, args, defaults, imports, mailbox contracts, artifacts, and async mode | Save a known-good local workflow as reusable muscle memory |
|
|
128
|
-
| Async runs | File-backed detached lifecycle, logs, progress, output, cancellation, artifacts, and durable terminal follow-up notifications | Let model work, media jobs, services, or pipelines continue after the turn |
|
|
129
|
-
| Message protocol | Typed envelopes across run, tool, branch, room, coordinator, and session targets | Continue, approve, kill, or route work without restarting actors |
|
|
130
|
-
| Rooms and rosters | Run-local group timeline with actor join/leave, contacts, previews, and branch-aware delivery | Coordinate multiple subagents under one visible run |
|
|
131
|
-
| Registry and recipe doctor | Discovered tools, overrides, drafts, invalid recipes, and advisory risk labels | Audit local capability memory before using or promoting it |
|
|
132
|
-
| Draft promotion | Captured ad hoc spawn patterns can become explicit recipes through one operator-selected promotion or bounded automatic unchanged-source review | Turn successful improvisation into durable local tools without granting a reviewer executable-authoring authority |
|
|
133
|
-
| Review/swarm recipes | Maintained packaged pipelines with preflight, marked semantic evidence, quorum knobs, model/thinking inheritance, one-turn prompt-file transport, and diagnostics | Delegate reviews without rebuilding fanout commands |
|
|
134
|
-
| Actor inspector | One manual `Recipe → Messages or Turns → timeline → one detail level` overlay for owned actor evidence, plus confirmed `K` → `control.kill` for the selected running run | Understand the selected recipe and launch, follow actor traffic and persisted subagent turns, or explicitly terminate one owned actor without exposing another session or signaling directly |
|
|
135
|
-
| Packaged recipe QA | Installed-package-safe checks for helper paths, mailbox contracts, platform scope, artifacts, and recipe structure | Keep shipped actor components executable and diagnosable |
|
|
81
|
+
Persist a trusted command template or Recipe-backed capability under `~/.pi/agent/recipes`. Registration remains separate from running Control.
|
|
136
82
|
|
|
137
|
-
|
|
83
|
+
## Recipe
|
|
138
84
|
|
|
139
|
-
|
|
85
|
+
Recipes can declare:
|
|
140
86
|
|
|
141
|
-
|
|
87
|
+
- args and typed defaults;
|
|
88
|
+
- imports and command-template composition;
|
|
89
|
+
- retry, failure, recovery, repeat, concurrency, and timeout policy;
|
|
90
|
+
- artifact paths;
|
|
91
|
+
- `control: ["action"]` only for inputs a service actually consumes.
|
|
142
92
|
|
|
143
|
-
|
|
144
|
-
mkdir -p ~/.pi/agent/recipes
|
|
93
|
+
Example controlled Recipe:
|
|
145
94
|
|
|
146
|
-
|
|
95
|
+
```json
|
|
147
96
|
{
|
|
148
|
-
"description": "Start an async docs review actor",
|
|
149
97
|
"async": true,
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"accepts": ["control.kill", "control.continue"],
|
|
154
|
-
"emits": ["review.completed", "run.failed"]
|
|
155
|
-
},
|
|
156
|
-
"template": "pi -p --model {model} --thinking {thinking} --no-tools \"Review {scope} for unclear actor-runtime onboarding. Return concise findings.\""
|
|
98
|
+
"control": ["pause", "resume", "stop"],
|
|
99
|
+
"artifacts": { "state": "{state_dir}/player-state.json" },
|
|
100
|
+
"template": "{repo}/scripts/player.mjs --state-dir {state_dir}"
|
|
157
101
|
}
|
|
158
|
-
JSON
|
|
159
102
|
```
|
|
160
103
|
|
|
161
|
-
|
|
104
|
+
Ordinary one-shot Recipes should omit `control`. Recipe imports compose definitions inside one Run; they do not create peer actors.
|
|
162
105
|
|
|
163
|
-
|
|
106
|
+
String command-template leaves execute directly without shell interpretation. Use template arrays for sequencing or an explicit trusted shell/script when shell semantics matter.
|
|
164
107
|
|
|
165
|
-
|
|
166
|
-
docs_review scope="README.md" run_id=docs_review
|
|
167
|
-
```
|
|
108
|
+
## Trace
|
|
168
109
|
|
|
169
|
-
|
|
110
|
+
`trace.jsonl` contains bounded structured observations:
|
|
170
111
|
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"id": "cfd0…",
|
|
115
|
+
"ts": "2026-01-01T00:00:00.000Z",
|
|
116
|
+
"kind": "progress.update",
|
|
117
|
+
"summary": "Indexed 40 files",
|
|
118
|
+
"data": { "files": 40 },
|
|
119
|
+
"level": "info",
|
|
120
|
+
"attention": "notify"
|
|
121
|
+
}
|
|
177
122
|
```
|
|
178
123
|
|
|
179
|
-
|
|
124
|
+
Trace fields are exact: `id`, `ts`, `kind`, and optional `summary`, `data`, `level`, `attention`. Address, sender, recipient, reply, and routing fields fail validation. The canonical append authority validates and size-checks under a cross-process mutation lock before one append-only JSONL write; first-party scripts never append this file directly.
|
|
180
125
|
|
|
181
|
-
|
|
182
|
-
message to=run:docs_review type=control.continue body=continue
|
|
183
|
-
message to=run:docs_review type=control.kill body=stop
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Recipe memory model
|
|
126
|
+
Use `attention: "notify"` for visible status and `attention: "followup"` only when the coordinator needs semantic follow-up context. Store large evidence in artifacts or bounded execution captures.
|
|
187
127
|
|
|
188
|
-
|
|
128
|
+
## Control
|
|
189
129
|
|
|
190
|
-
|
|
191
|
-
~/.pi/agent/recipes/*.json
|
|
192
|
-
~/.pi/agent/recipes/*.md
|
|
193
|
-
```
|
|
130
|
+
Controls persist to `controls.jsonl` before transport. Token-owned dead-process-reclaiming locks serialize atomic journal replacements. Every record carries the immutable `run_instance_id`; expected-status fencing advances outcomes monotonically through queued/delivered/claimed/handled/failed evidence, while a fast consumer may claim or handle before the sender adds independent delivery-time evidence.
|
|
194
131
|
|
|
195
|
-
|
|
132
|
+
Long-lived services publish `control-endpoint.json` only when ready:
|
|
196
133
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
|
|
204
|
-
- Batch draft consolidation is automatic and silent. Prefer fenced `register_tool draft=...` for one early promotion; deliberate move/copy into the recipe root remains valid but may defer an already captured batch.
|
|
205
|
-
|
|
206
|
-
Register a foreground tool:
|
|
207
|
-
|
|
208
|
-
```text
|
|
209
|
-
register_tool name=transcribe_audio \
|
|
210
|
-
description="Transcribe a local audio file" \
|
|
211
|
-
template="~/bin/transcribe {file:path} {lang=ru} {model:string}"
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"path": "/path/to/control.fifo",
|
|
137
|
+
"type": "fifo",
|
|
138
|
+
"ready_at": "2026-01-01T00:00:00.000Z",
|
|
139
|
+
"run_instance_id": "generation-id"
|
|
140
|
+
}
|
|
212
141
|
```
|
|
213
142
|
|
|
214
|
-
|
|
143
|
+
Supported transports are Unix FIFO and Windows named pipe. Every actor-local Control uses 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. Put larger data in a declared artifact/path and send only its bounded reference or instruction through Control. Delivery revalidates owner, generation, state, and process identity under the canonical lifecycle lock.
|
|
215
144
|
|
|
216
|
-
|
|
217
|
-
register_tool name=docs_review \
|
|
218
|
-
description="Start an async docs review actor" \
|
|
219
|
-
template="docs_review" \
|
|
220
|
-
args="scope:path,model:string"
|
|
221
|
-
```
|
|
145
|
+
## Run State
|
|
222
146
|
|
|
223
|
-
|
|
147
|
+
Owned state lives under:
|
|
224
148
|
|
|
225
149
|
```text
|
|
226
|
-
|
|
150
|
+
~/.pi/agent/tmp/pi-actors/runs/<run>/
|
|
227
151
|
```
|
|
228
152
|
|
|
229
|
-
|
|
153
|
+
Core files:
|
|
230
154
|
|
|
231
|
-
|
|
155
|
+
- `run.json` — identity, owner, generation, captured Recipe, policy, process identity;
|
|
156
|
+
- `trace.jsonl` — structured observations;
|
|
157
|
+
- `controls.jsonl` — durable Controls and outcomes;
|
|
158
|
+
- `control-endpoint.json` — generation-fenced service readiness;
|
|
159
|
+
- `execution.json` — command/session provenance and complete-capture references;
|
|
160
|
+
- `result.json`, command logs, progress, and declared artifacts.
|
|
232
161
|
|
|
233
|
-
|
|
162
|
+
The runtime preserves owner filtering, process-identity verification, lifecycle locking, shutdown kill, terminal reconciliation, bounded captures, owned Pi sessions, path containment, and redaction.
|
|
234
163
|
|
|
235
|
-
|
|
236
|
-
inspect target=recipes view=status
|
|
237
|
-
inspect target=recipes view=reviews
|
|
238
|
-
inspect target=recipes view=summary verbose=true
|
|
239
|
-
inspect target=tool:pi-actors view=triage
|
|
240
|
-
```
|
|
164
|
+
## Actor Inspector
|
|
241
165
|
|
|
242
|
-
|
|
166
|
+
Open the owner-filtered TUI:
|
|
243
167
|
|
|
244
168
|
```text
|
|
245
|
-
|
|
246
|
-
message to=tool:pi-actors type=review.retry body={"scope":"tool"}
|
|
247
|
-
message to=tool:pi-actors type=review.reset body={"scope":"draft"}
|
|
169
|
+
/actor-inspector
|
|
248
170
|
```
|
|
249
171
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
## Command templates
|
|
253
|
-
|
|
254
|
-
A command template is the launch substrate. It can be a string, a sequence, or a composed graph.
|
|
255
|
-
|
|
256
|
-
Templates support:
|
|
257
|
-
|
|
258
|
-
- Named placeholders such as `{file}`, `{model}`, `{prompt}`;
|
|
259
|
-
- Compact types such as `string`, `path`, `int`, `number`, `bool`, `enum(a,b)`;
|
|
260
|
-
- Defaults such as `{lang=ru}` and `{dry_run:bool=true}`;
|
|
261
|
-
- Fallback and small ternary forms;
|
|
262
|
-
- Sequences with stdin flow;
|
|
263
|
-
- Parallel nodes;
|
|
264
|
-
- Retries, recovery, failure policy, delays, guards, and timeouts;
|
|
265
|
-
- Async run values such as `{run_id}`, `{state_dir}`, `{actor_address}`, `{default_room}`, and `{communication_file}`.
|
|
266
|
-
|
|
267
|
-
The template owns execution shape. The recipe owns saved metadata, defaults, imports, mailbox, artifacts, and async launch policy. The run actor owns detached lifecycle, state, messages, cancellation, and inspection.
|
|
268
|
-
|
|
269
|
-
## Packaged recipe library
|
|
270
|
-
|
|
271
|
-
Packaged recipes live under `recipes/` and helper scripts live under `scripts/`.
|
|
272
|
-
|
|
273
|
-
The library includes:
|
|
172
|
+
It presents actor instances through Recipe, Trace, and Control tabs, with source filtering, detail navigation, refresh, and generation-fenced Run kill.
|
|
274
173
|
|
|
275
|
-
|
|
276
|
-
- Review, critic, planner, verifier, merger, judge, normalizer, and artifact atoms;
|
|
277
|
-
- Quorum and lens-style pipelines;
|
|
278
|
-
- Repo-health, release-summary, research-synthesis, development-tasking, docs-maintenance, and room-swarm pipelines;
|
|
279
|
-
- Coordinator-locker and actor-message utilities;
|
|
280
|
-
- Local music-player actor recipe.
|
|
174
|
+
## Packaged Recipes
|
|
281
175
|
|
|
282
|
-
|
|
176
|
+
Useful entry points include:
|
|
283
177
|
|
|
284
|
-
|
|
178
|
+
- `pipeline-repo-health`
|
|
179
|
+
- `pipeline-quorum-review`
|
|
180
|
+
- `pipeline-artifact-bundle`
|
|
181
|
+
- `music-player` — controlled playback service
|
|
182
|
+
- `resource-locker` — optional controlled resource-lock service
|
|
285
183
|
|
|
286
|
-
|
|
287
|
-
| --- | --- |
|
|
288
|
-
| Short, bounded, and foreground | Ordinary tools or registered foreground tools |
|
|
289
|
-
| Long-running, service-like, parallel, agentic, artifact-producing, or controllable | `spawn` / async recipe |
|
|
290
|
-
| Already running and needs new input | `message` |
|
|
291
|
-
| Unclear, failing, or ready for a decision | `inspect` |
|
|
292
|
-
| A multi-actor collaboration under one run | `room:<run>` plus branch addresses |
|
|
293
|
-
| A useful output that should survive context compression | Artifacts |
|
|
294
|
-
| A repeated local workflow | Recipe/tool memory |
|
|
184
|
+
Validate Recipes with:
|
|
295
185
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
Core actor state, inspection, foreground tools, and basic async runs are portable Node.js behavior. Run-local messaging and stop/kill use platform adapters under the same `message` API.
|
|
301
|
-
|
|
302
|
-
| Surface | Linux/macOS/WSL | Native Windows |
|
|
303
|
-
| --- | --- | --- |
|
|
304
|
-
| Foreground tools, recipe discovery, inspect | Supported | Supported |
|
|
305
|
-
| Async runs and file-backed state | Supported | Supported |
|
|
306
|
-
| Mailbox-only actors and worker recipe | Supported | Supported |
|
|
307
|
-
| FIFO control endpoints | Supported | Not supported; use mailbox or named pipe |
|
|
308
|
-
| Named-pipe control endpoints | Not needed | Supported when recipe exposes one |
|
|
309
|
-
| Process cancel/kill | Process group signal with pid fallback | Windows process-tree adapter |
|
|
310
|
-
|
|
311
|
-
Packaged recipes should prefer mailbox/wake behavior for portable control. Recipes that require FIFO, Unix shell tools, or platform-specific media backends should make that limitation visible in docs or diagnostics before launch.
|
|
312
|
-
|
|
313
|
-
## Safety boundary
|
|
314
|
-
|
|
315
|
-
`pi-actors` is local-first, not sandbox-first.
|
|
316
|
-
|
|
317
|
-
Commands execute directly without shell evaluation where possible, but trusted executables still run with the same system permissions as Pi. Only register commands, scripts, recipes, and paths you trust.
|
|
318
|
-
|
|
319
|
-
High-risk templates such as shells, interpreter eval modes, network access, external side effects, and broad filesystem mutation may surface warnings, but the runtime is not a security boundary. Automatic reviewers cannot author or change executable contracts: they receive attached immutable evidence with no tools and may only select unchanged-source lifecycle/name operations. Disable all automatic draft/tool review and safe-boundary activation before starting Pi with `PI_ACTORS_AUTOMATIC_REVIEW=off`; `inspect target=tool:pi-actors view=status` reports `automatic_review=false`.
|
|
320
|
-
|
|
321
|
-
Prefer:
|
|
322
|
-
|
|
323
|
-
- Narrow commands;
|
|
324
|
-
- Explicit paths;
|
|
325
|
-
- Typed args;
|
|
326
|
-
- Bounded timeouts for bounded work;
|
|
327
|
-
- Explicit tool allowlists for subagents;
|
|
328
|
-
- Deterministic utility recipes for filesystem writes;
|
|
329
|
-
- Human approval for destructive or external side effects.
|
|
330
|
-
|
|
331
|
-
## Non-goals
|
|
332
|
-
|
|
333
|
-
`pi-actors` is not:
|
|
334
|
-
|
|
335
|
-
- A generic workflow DSL;
|
|
336
|
-
- A remote agent interoperability protocol;
|
|
337
|
-
- A heavyweight broker;
|
|
338
|
-
- A sandbox;
|
|
339
|
-
- A facade that hides logs, artifacts, ownership, or local side effects;
|
|
340
|
-
- A polling-first async runner.
|
|
341
|
-
|
|
342
|
-
Its job is narrower: make trusted local capabilities addressable, messageable, inspectable, and reusable by agents.
|
|
343
|
-
|
|
344
|
-
## Documentation
|
|
186
|
+
```bash
|
|
187
|
+
npm run recipes:qa
|
|
188
|
+
```
|
|
345
189
|
|
|
346
|
-
|
|
190
|
+
## Development
|
|
347
191
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
192
|
+
```bash
|
|
193
|
+
npm install
|
|
194
|
+
npm run build
|
|
195
|
+
npm test
|
|
196
|
+
npm run validate
|
|
197
|
+
npm run test:preservation
|
|
198
|
+
```
|
|
354
199
|
|
|
355
|
-
|
|
200
|
+
See the [documentation index](./docs/README.md), [Run lifecycle](./docs/async-runs.md), [Recipe library](./docs/recipe-library.md), and [0.43 baseline](./docs/0.43-baseline.md).
|
|
356
201
|
|
|
357
|
-
|
|
358
|
-
- [Template recipes](./docs/template-recipes.md)
|
|
359
|
-
- [Async runs](./docs/async-runs.md)
|
|
360
|
-
- [Actor messages](./docs/actor-messages.md)
|
|
361
|
-
- [Actor inspector](./docs/actor-inspector.md)
|
|
362
|
-
- [Tool registry](./docs/tool-registry.md)
|
|
363
|
-
- [Recipe library](./docs/recipe-library.md)
|
|
202
|
+
Project context: [AGENTS.md](./AGENTS.md) · [BACKLOG.md](./BACKLOG.md) · [CHANGELOG.md](./CHANGELOG.md).
|
|
364
203
|
|
|
365
204
|
## License
|
|
366
205
|
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
3
|
-
"path": "recipes/
|
|
2
|
+
"id": "music-player",
|
|
3
|
+
"path": "recipes/music-player.json",
|
|
4
4
|
"location": "packaged",
|
|
5
5
|
"active": true,
|
|
6
|
-
"args": [
|
|
7
|
-
|
|
8
|
-
"branch",
|
|
9
|
-
"poll_ms",
|
|
10
|
-
"state_dir"
|
|
11
|
-
],
|
|
12
|
-
"mailbox": {
|
|
13
|
-
"kind": "branch",
|
|
14
|
-
"accepts": ["task.assign", "control.stop"]
|
|
15
|
-
}
|
|
6
|
+
"args": ["repo", "command", "source", "loop", "volume", "player", "state_dir"],
|
|
7
|
+
"control": ["play", "pause", "resume", "toggle", "next", "previous", "stop", "status"]
|
|
16
8
|
}
|
package/dist/index.js
CHANGED
|
@@ -106,7 +106,7 @@ export default function toolRegistryExtension(pi) {
|
|
|
106
106
|
configPath: Paths.EXTENSION_RUNTIME_PATHS.configPath,
|
|
107
107
|
getActiveTools: () => pi.getActiveTools(),
|
|
108
108
|
getRuntimeTool: (name) => Tools.resolveActiveRuntimeTool(name, runtime.getTools(), (activeName) => actorToolDefinitions.get(activeName)),
|
|
109
|
-
|
|
109
|
+
handleRuntimeControl: automaticReview.handleControl,
|
|
110
110
|
registryRuntime: runtime,
|
|
111
111
|
setActiveTools: (toolNames) => pi.setActiveTools(toolNames),
|
|
112
112
|
}).map(withCurrentThinkingContext));
|