@llblab/pi-actors 0.16.4 → 0.17.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 +8 -8
- package/BACKLOG.md +56 -21
- package/CHANGELOG.md +19 -8
- package/README.md +170 -274
- package/banner.jpg +0 -0
- package/docs/actor-messages.md +66 -3
- package/docs/async-runs.md +25 -3
- package/docs/recipe-library.md +4 -3
- package/docs/template-recipes.md +3 -4
- package/docs/tool-registry.md +7 -12
- package/index.ts +103 -3
- package/lib/actor-inspector-tui.ts +532 -0
- package/lib/actor-messages.ts +18 -0
- package/lib/actor-rooms.ts +373 -0
- package/lib/async-runs.ts +17 -1
- package/lib/config.ts +1 -1
- package/lib/paths.ts +1 -1
- package/lib/prompts.ts +3 -2
- package/lib/recipe-discovery.ts +83 -1
- package/lib/recipe-migration.ts +2 -2
- package/lib/recipe-references.ts +2 -0
- package/lib/tools.ts +292 -9
- package/package.json +1 -1
- package/recipes/lens-swarm.json +0 -1
- package/recipes/pipeline-room-swarm.json +49 -0
- package/scripts/room-swarm.mjs +244 -0
- package/skills/actors/SKILL.md +52 -9
- package/skills/swarm/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -1,206 +1,178 @@
|
|
|
1
1
|
# pi-actors
|
|
2
2
|
|
|
3
|
-
> Actor
|
|
3
|
+
> Local Actor Kernel for Pi
|
|
4
4
|
|
|
5
|
-
[
|
|
5
|
+

|
|
6
6
|
|
|
7
|
-
`pi-actors` turns local programs, scripts, services,
|
|
7
|
+
`pi-actors` turns trusted local programs, scripts, recipes, services, pipelines, and sub-agents into addressable actors that agents can spawn, message, inspect, and compose.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Start Here
|
|
12
|
-
|
|
13
|
-
- [Project Context](./AGENTS.md)
|
|
14
|
-
- [Open Backlog](./BACKLOG.md)
|
|
15
|
-
- [Changelog](./CHANGELOG.md)
|
|
16
|
-
- [Documentation](./docs/README.md)
|
|
17
|
-
- [Actors skill](./skills/actors/SKILL.md) — dense agent-facing reference for operating the extension
|
|
18
|
-
- [Swarm skill](./skills/swarm/SKILL.md) — multi-agent methodology, strategies, standards, and portable examples for actor-backed swarms
|
|
19
|
-
- [Swarm MAWP notes](./skills/swarm/references/development-swarm.md) — optional small-team development swarm reference
|
|
20
|
-
|
|
21
|
-
## What It Is
|
|
22
|
-
|
|
23
|
-
`pi-actors` is the runtime layer that lets a pi agent turn a local capability into a controllable actor:
|
|
9
|
+
It is not just a command registry. A tool is a verb. An actor is a noun with time: address, lifecycle, state, logs, mailbox, artifacts, and an interaction contract.
|
|
24
10
|
|
|
25
11
|
```text
|
|
26
|
-
program/process/service
|
|
12
|
+
program / process / service
|
|
27
13
|
→ command template
|
|
28
14
|
→ actor recipe
|
|
29
15
|
→ spawn
|
|
30
|
-
→
|
|
16
|
+
→ run:<id>
|
|
31
17
|
→ message / inspect / artifacts
|
|
32
18
|
```
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- A sub-agent running `pi -p` in a clean context.
|
|
37
|
-
- A background music player controlled by `player.next` or `player.pause` messages.
|
|
38
|
-
- A validation or repo-health pipeline that reports completion and artifacts.
|
|
39
|
-
- A parallel quorum review with branch-level progress.
|
|
40
|
-
- Any trusted local process with a launch template and a useful control surface.
|
|
20
|
+
## Core Contract
|
|
41
21
|
|
|
42
|
-
|
|
22
|
+
`pi-actors` compresses local agent orchestration to three durable verbs:
|
|
43
23
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- **Memory**: `~/.pi/agent/recipes/*.json` stores reusable actor-control wrappers across sessions.
|
|
24
|
+
```text
|
|
25
|
+
spawn create an addressable actor
|
|
26
|
+
message send one typed envelope to one address
|
|
27
|
+
inspect intentionally read state, logs, messages, contracts, or artifacts
|
|
28
|
+
```
|
|
50
29
|
|
|
51
|
-
|
|
30
|
+
Everything else is an adapter until proven otherwise.
|
|
52
31
|
|
|
53
|
-
|
|
54
|
-
- **Agent-Managed Processes**: Wraps sub-agents, media players, pipelines, diagnostics, and other local programs as controllable entities instead of one-off commands.
|
|
55
|
-
- **Message-Oriented Control**: Uses `spawn`, `message`, and `inspect` as the public coordination vocabulary for start, control, and observation.
|
|
56
|
-
- **Mailbox Contracts**: Lets recipes declare what messages they accept and emit, so agents can discover how to interact with an actor.
|
|
57
|
-
- **Actor Tool Registry**: Stores persistent actor-control tools as recipe files in `~/.pi/agent/recipes/*.json` and registers them automatically on session start.
|
|
58
|
-
- **Command Template Substrate**: Keeps process launch portable with named placeholders, typed args, defaults, sequences, guarded nodes, retries, failure policy, and `parallel: true` fanout.
|
|
59
|
-
- **Composable Actor Recipes**: Stores reusable recipe JSON under `~/.pi/agent/recipes/*.json`; recipes can import other recipes, reuse defaults, declare artifacts, and opt into detached actor lifecycle with `async: true`.
|
|
60
|
-
- **Coordinator-Scoped Observability**: Shows ambient triangles for active actor runs and sends compact completion or request-for-attention follow-ups only to the launching coordinator.
|
|
61
|
-
- **Bounded Context Impact**: Returns compact output by default, truncates oversized stdout, and keeps full logs/artifacts in files for intentional inspection.
|
|
62
|
-
- **Local-First Tool Memory**: Still lets agents create durable semantic tools from trusted commands so they do not repeatedly reconstruct shell invocations.
|
|
32
|
+
Use `spawn` when work may outlive the current turn. Use `message` when the actor should be steered rather than restarted. Use `inspect` at decision points, after actor follow-ups, or during diagnosis. Do not build polling loops as the default coordination pattern.
|
|
63
33
|
|
|
64
34
|
## Install
|
|
65
35
|
|
|
66
|
-
From npm:
|
|
67
|
-
|
|
68
36
|
```bash
|
|
69
37
|
pi install npm:@llblab/pi-actors
|
|
70
38
|
```
|
|
71
39
|
|
|
72
|
-
|
|
40
|
+
Or from git:
|
|
73
41
|
|
|
74
42
|
```bash
|
|
75
43
|
pi install git:github.com/llblab/pi-actors
|
|
76
44
|
```
|
|
77
45
|
|
|
78
|
-
##
|
|
46
|
+
## Address Surface
|
|
79
47
|
|
|
80
|
-
|
|
48
|
+
Actors and coordination endpoints are addressed with compact route strings:
|
|
81
49
|
|
|
82
50
|
```text
|
|
83
|
-
|
|
51
|
+
run:<id> one detached actor run
|
|
52
|
+
branch:<run>/<branch> branch-local actor endpoint
|
|
53
|
+
room:<run> shared run-local task room
|
|
54
|
+
coordinator launching coordinator attention path
|
|
55
|
+
session: current session actor surface
|
|
56
|
+
session:all cross-session inventory surface
|
|
57
|
+
tool:<name> executable registered tool
|
|
84
58
|
```
|
|
85
59
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
If `~/.pi/agent/actors-tools.json` exists from an older release, pi-actors treats it as legacy compatibility input, migrates entries into recipe files when possible, writes a migration report, and archives the legacy file only when migration is clean.
|
|
60
|
+
Actor messages use one envelope shape:
|
|
89
61
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
mailbox = declare interaction contract
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"to": "run:review",
|
|
65
|
+
"from": "coordinator",
|
|
66
|
+
"type": "control.continue",
|
|
67
|
+
"summary": "Continue after checkpoint",
|
|
68
|
+
"body": "continue",
|
|
69
|
+
"reply_to": "msg_123",
|
|
70
|
+
"correlation_id": "task_456",
|
|
71
|
+
"metadata": {}
|
|
72
|
+
}
|
|
102
73
|
```
|
|
103
74
|
|
|
104
|
-
|
|
105
|
-
- A **command template** is the reusable launch shape for that process, with named placeholders.
|
|
106
|
-
- An **actor recipe** is saved JSON containing a template, defaults, imports, mailbox metadata, artifacts, and optional detached lifecycle.
|
|
107
|
-
- A **registered tool** gives a template or actor recipe a stable agent-facing name.
|
|
108
|
-
- A **run actor** is one execution instance with state, logs, actor messages, mailbox metadata, status, cancellation, and kill control.
|
|
109
|
-
|
|
110
|
-
The template remains the execution substrate. The recipe is the actor definition. `async: true` opts into detached actor lifecycle. `spawn` creates actors, `message` connects or controls them, and `inspect` observes them without teaching agents to poll blindly.
|
|
111
|
-
|
|
112
|
-
## Operator Onboarding
|
|
75
|
+
Routing is inferred from `to`, actor ownership, and runtime policy. Recipes should expose semantic message types, not transport knobs.
|
|
113
76
|
|
|
114
|
-
|
|
77
|
+
## Golden Path
|
|
115
78
|
|
|
116
|
-
|
|
117
|
-
register_tool name=lint_docs description="Lint docs" template="npm run lint:docs"
|
|
118
|
-
```
|
|
79
|
+
Create a reusable async actor recipe in the user recipe root:
|
|
119
80
|
|
|
120
|
-
|
|
81
|
+
```bash
|
|
82
|
+
mkdir -p ~/.pi/agent/recipes
|
|
121
83
|
|
|
122
|
-
|
|
84
|
+
cat > ~/.pi/agent/recipes/docs_review.json <<'JSON'
|
|
123
85
|
{
|
|
124
|
-
"
|
|
86
|
+
"description": "Start an async docs review actor",
|
|
125
87
|
"async": true,
|
|
126
88
|
"args": ["scope:path", "model:string"],
|
|
127
|
-
"defaults": {},
|
|
128
89
|
"mailbox": {
|
|
129
|
-
"accepts": ["control.stop"],
|
|
90
|
+
"accepts": ["control.stop", "control.continue"],
|
|
130
91
|
"emits": ["review.completed", "run.failed"]
|
|
131
92
|
},
|
|
132
93
|
"template": "pi -p --model {model} --no-tools \"Review {scope} for unclear actor-runtime onboarding. Return concise findings.\""
|
|
133
94
|
}
|
|
95
|
+
JSON
|
|
134
96
|
```
|
|
135
97
|
|
|
136
|
-
|
|
98
|
+
Because it lives under `~/.pi/agent/recipes/`, the file becomes a persistent agent tool by location. The filename is the tool id.
|
|
99
|
+
|
|
100
|
+
Start it:
|
|
137
101
|
|
|
138
102
|
```text
|
|
139
|
-
|
|
103
|
+
docs_review scope="README.md" model="current-review-model" run_id=docs_review
|
|
140
104
|
```
|
|
141
105
|
|
|
142
|
-
|
|
106
|
+
Inspect only when there is a reason:
|
|
143
107
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
108
|
+
```text
|
|
109
|
+
inspect target=run:docs_review view=status
|
|
110
|
+
inspect target=run:docs_review view=tail lines=80
|
|
111
|
+
inspect target=run:docs_review view=messages
|
|
112
|
+
inspect target=run:docs_review view=mailbox
|
|
113
|
+
```
|
|
147
114
|
|
|
148
|
-
|
|
115
|
+
Steer it through messages:
|
|
149
116
|
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"args": ["scope:string", "model:string"],
|
|
154
|
-
"defaults": {},
|
|
155
|
-
"template": "pi -p --model {model} --no-tools \"Review {scope}\""
|
|
156
|
-
}
|
|
117
|
+
```text
|
|
118
|
+
message to=run:docs_review type=control.continue body=continue
|
|
119
|
+
message to=run:docs_review type=control.stop body=stop
|
|
157
120
|
```
|
|
158
121
|
|
|
159
|
-
|
|
122
|
+
## Actor Rooms
|
|
160
123
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
{ "name": "review", "values": { "scope": "docs/template-recipes.md" } }
|
|
173
|
-
]
|
|
174
|
-
}
|
|
124
|
+
Every spawned run can have a shared room at `room:<run>`. A room is not a broker and not a chat app. It is a run-local coordination surface: append-only timeline, compact roster, member discovery, and previews.
|
|
125
|
+
|
|
126
|
+
Actors can join, post, leave, and discover peers:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
message \
|
|
130
|
+
to=room:review \
|
|
131
|
+
from=branch:review/security \
|
|
132
|
+
type=actor.join \
|
|
133
|
+
summary="Security reviewer joined" \
|
|
134
|
+
body='{"role":"reviewer","caps":["security-review"],"claim":"Review auth boundary risks"}'
|
|
175
135
|
```
|
|
176
136
|
|
|
177
|
-
|
|
137
|
+
Inspect the room intentionally:
|
|
178
138
|
|
|
179
139
|
```text
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
140
|
+
inspect target=room:review view=status
|
|
141
|
+
inspect target=room:review view=previews
|
|
142
|
+
inspect target=room:review view=roster
|
|
143
|
+
inspect target=room:review view=contacts
|
|
144
|
+
inspect target=room:review view=messages
|
|
183
145
|
```
|
|
184
146
|
|
|
185
|
-
|
|
147
|
+
Room posts require a same-run sender, so unrelated runs do not pollute the roster. Direct messages and room messages use the same envelope; only the address changes.
|
|
186
148
|
|
|
187
|
-
##
|
|
149
|
+
## Registry Model
|
|
188
150
|
|
|
189
|
-
|
|
151
|
+
The persistent tool surface is file-discovered:
|
|
190
152
|
|
|
191
|
-
|
|
153
|
+
```text
|
|
154
|
+
~/.pi/agent/recipes/*.json
|
|
155
|
+
```
|
|
192
156
|
|
|
193
|
-
|
|
157
|
+
That directory is operator-managed executable memory.
|
|
158
|
+
|
|
159
|
+
Rules:
|
|
160
|
+
|
|
161
|
+
- User recipes in `~/.pi/agent/recipes/` are tools by location;
|
|
162
|
+
- Recipe filenames define tool ids;
|
|
163
|
+
- User recipes override same-name lower-priority recipes;
|
|
164
|
+
- Packaged recipes are standard-library components, not automatically installed operator policy;
|
|
165
|
+
- `register_tool` creates, updates, lists, or deletes user recipe files through the normal agent interface.
|
|
166
|
+
|
|
167
|
+
Example foreground tool:
|
|
194
168
|
|
|
195
169
|
```text
|
|
196
|
-
register_tool name=
|
|
170
|
+
register_tool name=transcribe_audio \
|
|
197
171
|
description="Transcribe a local audio file" \
|
|
198
|
-
template="/
|
|
172
|
+
template="~/bin/transcribe {file:path} {lang=ru} {model:string}"
|
|
199
173
|
```
|
|
200
174
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
For reusable actor workflows, keep the large template and mailbox contract in a recipe file and register a small tool:
|
|
175
|
+
Example recipe-backed tool:
|
|
204
176
|
|
|
205
177
|
```text
|
|
206
178
|
register_tool name=docs_review \
|
|
@@ -209,183 +181,107 @@ register_tool name=docs_review \
|
|
|
209
181
|
args="scope:path,model:string"
|
|
210
182
|
```
|
|
211
183
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
When keeping metadata and the recipe body together is clearer, `register_tool` writes a complete user recipe file:
|
|
184
|
+
Inspect the discovered registry:
|
|
215
185
|
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
"tool": true,
|
|
220
|
-
"async": true,
|
|
221
|
-
"args": ["scope:path", "model:string"],
|
|
222
|
-
"template": "pi -p --model {model} --tools read,bash \"Review {scope}\""
|
|
223
|
-
}
|
|
186
|
+
```text
|
|
187
|
+
inspect target=recipes view=status
|
|
188
|
+
inspect target=recipes view=summary verbose=true
|
|
224
189
|
```
|
|
225
190
|
|
|
226
|
-
|
|
191
|
+
## Command Templates
|
|
227
192
|
|
|
228
|
-
|
|
193
|
+
A command template is the portable launch substrate. It can be a string, a sequence, or a composed graph.
|
|
229
194
|
|
|
230
|
-
|
|
231
|
-
register_tool name=call_subagent \
|
|
232
|
-
description="Run pi as a non-interactive sub-agent" \
|
|
233
|
-
template="pi -p --model {model} --no-tools {prompt}" args="prompt:string,model:string"
|
|
234
|
-
```
|
|
195
|
+
Templates support:
|
|
235
196
|
|
|
236
|
-
|
|
197
|
+
- Named placeholders: `{file}`, `{model}`, `{prompt}`;
|
|
198
|
+
- Compact types: `string`, `path`, `int`, `number`, `bool`, `enum(a,b)`;
|
|
199
|
+
- Defaults: `{lang=ru}`, `{dry_run:bool=true}`;
|
|
200
|
+
- Fallback and small ternary forms;
|
|
201
|
+
- Sequences with stdin flow;
|
|
202
|
+
- Parallel nodes;
|
|
203
|
+
- Retries, recovery, failure policy, delays, and guarded execution;
|
|
204
|
+
- Async run values such as `{run_id}`, `{state_dir}`, `{actor_address}`, `{default_room}`, and `{communication_file}`.
|
|
237
205
|
|
|
238
|
-
|
|
239
|
-
register_tool name=call_subagent \
|
|
240
|
-
description="Run a focused pi sub-agent without tools" \
|
|
241
|
-
update=true
|
|
242
|
-
```
|
|
206
|
+
The template owns execution shape. The recipe owns saved metadata, defaults, imports, mailbox, and artifacts. The run actor owns detached lifecycle, state, messages, cancellation, and inspection.
|
|
243
207
|
|
|
244
|
-
|
|
208
|
+
## Recipe Library
|
|
245
209
|
|
|
246
|
-
|
|
247
|
-
register_tool name=call_subagent template=null
|
|
248
|
-
```
|
|
210
|
+
Packaged recipes live under `recipes/` and helper scripts live under `scripts/`.
|
|
249
211
|
|
|
250
|
-
|
|
212
|
+
The library includes:
|
|
251
213
|
|
|
252
|
-
|
|
214
|
+
- Sub-agent launchers;
|
|
215
|
+
- Review, critic, planner, verifier, merger, judge, normalizer, and artifact atoms;
|
|
216
|
+
- Quorum and lens-style pipelines;
|
|
217
|
+
- Repo-health, release-summary, research-synthesis, development-tasking, docs-maintenance, and room-swarm pipelines;
|
|
218
|
+
- Coordinator-locker and actor-message utilities;
|
|
219
|
+
- Local music-player actor recipe.
|
|
253
220
|
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
"description": "Transcribe a local audio file",
|
|
257
|
-
"tool": true,
|
|
258
|
-
"template": "/path/to/stt --file {file} --lang {lang=ru}"
|
|
259
|
-
}
|
|
260
|
-
```
|
|
221
|
+
Packaged recipes are building blocks. Copy them into `~/.pi/agent/recipes/` or register tools that point at them when they should become durable operator-facing capabilities.
|
|
261
222
|
|
|
262
|
-
|
|
263
|
-
{
|
|
264
|
-
"description": "Run pi as a non-interactive sub-agent",
|
|
265
|
-
"tool": true,
|
|
266
|
-
"args": ["prompt:string", "model:string"],
|
|
267
|
-
"template": "pi -p --model {model} --no-tools {prompt}"
|
|
268
|
-
}
|
|
269
|
-
```
|
|
223
|
+
## When To Use What
|
|
270
224
|
|
|
271
|
-
|
|
225
|
+
Use a foreground registered tool when the work is short, bounded, and does not need lifecycle.
|
|
272
226
|
|
|
273
|
-
|
|
227
|
+
Use an async recipe or `spawn` when the work is long-running, service-like, parallel, agentic, artifact-producing, or needs later control.
|
|
274
228
|
|
|
275
|
-
Use `
|
|
229
|
+
Use `room:<run>` when multiple actors in the same run need shared context, roster discovery, or group-visible progress.
|
|
276
230
|
|
|
277
|
-
|
|
231
|
+
Use artifacts when outputs should survive context compression.
|
|
278
232
|
|
|
279
|
-
|
|
280
|
-
{
|
|
281
|
-
"as": "run:docs-review",
|
|
282
|
-
"template": "pi -p --model {model} --no-tools {prompt}",
|
|
283
|
-
"values": {
|
|
284
|
-
"prompt": "Review docs/spec.md for contradictions.",
|
|
285
|
-
"model": "current-review-model"
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
```
|
|
233
|
+
Use mailbox declarations when an actor has a stable conversational surface.
|
|
289
234
|
|
|
290
|
-
|
|
235
|
+
## Safety Boundary
|
|
291
236
|
|
|
292
|
-
|
|
293
|
-
{ "to": "run:docs-review", "type": "control.continue", "body": "continue" }
|
|
294
|
-
```
|
|
237
|
+
`pi-actors` is local-first, not sandbox-first.
|
|
295
238
|
|
|
296
|
-
|
|
239
|
+
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.
|
|
297
240
|
|
|
298
|
-
|
|
299
|
-
{ "target": "run:docs-review", "view": "tail", "lines": "80" }
|
|
300
|
-
```
|
|
241
|
+
High-risk templates such as shells, interpreter eval modes, and broad filesystem mutation may surface warnings, but the runtime is not a security boundary.
|
|
301
242
|
|
|
302
|
-
|
|
243
|
+
Prefer:
|
|
303
244
|
|
|
304
|
-
|
|
245
|
+
- Narrow commands;
|
|
246
|
+
- Explicit paths;
|
|
247
|
+
- Typed args;
|
|
248
|
+
- Bounded timeouts for bounded work;
|
|
249
|
+
- Explicit tool allowlists for sub-agents;
|
|
250
|
+
- Deterministic utility recipes for filesystem writes;
|
|
251
|
+
- Human approval for destructive or external side effects.
|
|
305
252
|
|
|
306
|
-
|
|
253
|
+
## Non-Goals
|
|
307
254
|
|
|
308
|
-
|
|
255
|
+
`pi-actors` is NOT:
|
|
309
256
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
description="Start an async pi subagent with an explicit tool allowlist" \
|
|
317
|
-
template="subagent-tools.json"
|
|
318
|
-
|
|
319
|
-
register_tool name=subagents_prompts \
|
|
320
|
-
description="Start parallel no-tools subagents from a prompt array as one run actor" \
|
|
321
|
-
template="subagents-prompts.json"
|
|
322
|
-
|
|
323
|
-
subagent_prompt prompt="Review docs/async-runs.md for unclear wording." run_id=docs-review
|
|
324
|
-
subagent_tools prompt="Inspect package metadata and report risks." tools="read,bash" run_id=package-review
|
|
325
|
-
subagents_prompts \
|
|
326
|
-
prompts='["Review README.md for unclear release-onboarding wording. Return concise findings.","Review docs/template-recipes.md for unclear recipe-import wording. Return concise findings."]' \
|
|
327
|
-
run_id=review-prompts
|
|
328
|
-
inspect target=run:review-prompts view=tail
|
|
329
|
-
```
|
|
257
|
+
- A generic workflow DSL;
|
|
258
|
+
- A remote agent interoperability protocol;
|
|
259
|
+
- A heavyweight broker or chat subsystem;
|
|
260
|
+
- A sandbox;
|
|
261
|
+
- A facade that hides logs, artifacts, ownership, or local side effects;
|
|
262
|
+
- A polling-first async runner.
|
|
330
263
|
|
|
331
|
-
|
|
264
|
+
Its job is narrower: make trusted local capabilities addressable, messageable, inspectable, and reusable by agents.
|
|
332
265
|
|
|
333
|
-
|
|
334
|
-
register_tool name=music_player \
|
|
335
|
-
description="Start async music player playback through the Node.js wrapper" \
|
|
336
|
-
template="music-player.json" \
|
|
337
|
-
args="source:string,loop:bool=true,volume:int=70,player:enum(auto,mpv,ffplay,cvlc,play)=auto"
|
|
338
|
-
|
|
339
|
-
music_player source="~/Music" volume=55 run_id=music
|
|
340
|
-
message to=run:music type=player.next body=next
|
|
341
|
-
message to=run:music type=player.pause body=pause
|
|
342
|
-
message to=run:music type=player.play body=play
|
|
343
|
-
message to=run:music type=player.stop body=stop
|
|
344
|
-
```
|
|
266
|
+
## Documentation
|
|
345
267
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
-
|
|
358
|
-
-
|
|
359
|
-
-
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
- Failed steps default to `failure: "continue"`, which records the failure and continues with empty stdin.
|
|
364
|
-
- `failure: "branch"` stops the current sequence/subtree without cancelling sibling parallel branches; `failure: "root"` aborts the composition.
|
|
365
|
-
- `retry` retries a leaf or whole node on non-zero exit; default attempts is `1`.
|
|
366
|
-
- `recover` runs a cleanup command template between failed retry attempts and stops retries if cleanup fails.
|
|
367
|
-
- Commands execute directly without shell evaluation, but trusted executables still run with the same permissions as pi.
|
|
368
|
-
- Obvious high-risk templates such as shells, interpreter eval modes, and broad filesystem mutation surface lightweight warnings without blocking existing tools.
|
|
369
|
-
- `async: true` on a recipe selects detached run-actor lifecycle; omitted or false runs the recipe foreground through registered tools.
|
|
370
|
-
- Layer boundaries stay explicit: command templates define synchronous execution graphs; template recipes add saved JSON metadata/import resolution and named `artifacts`; run actors add detached lifecycle, state, IPC, and observability.
|
|
371
|
-
- `spawn`, `message`, and `inspect` are high-level actor adapters. `spawn` creates `run:<id>` actors from recipes or inline templates with optional state/artifact metadata, `message` sends one typed envelope to `run:<id>` mailboxes, `branch:<run>/<branch>` mailboxes, `tool:<name>` calls, or coordinator/session attention paths, and `inspect` intentionally reads `run:<id>` status/tail/messages/mailbox metadata, coordinator/session run status, or registered `tool:<name>` contracts while the broader actor/message protocol is refined.
|
|
372
|
-
- `spawn`, `message`, and `inspect` are the public async coordination vocabulary. Low-level async actions map to this actor API: start belongs to `spawn`; send/control/stop/kill belongs to `message`; status/tail/messages/list belongs to `inspect`. Use `inspect view=messages` for actor-envelope streams. Use `control.stop`, `control.cancel`, and `control.kill` for run termination; runtime-prefixed control aliases are no longer part of the public surface.
|
|
373
|
-
- Actor management returns compact text by default; pass `verbose: true` to `inspect` when full JSON state is needed.
|
|
374
|
-
- Detached runs inject `{run_id}` and `{state_dir}` into template values for run-local artifacts or recipe-specific control endpoints.
|
|
375
|
-
- Runtime actor messages are persisted in the run state dir; coordinator attention is inferred by the runtime, not exposed as recipe or message-envelope input. Follow-ups preserve bounded body previews and metadata for decision messages.
|
|
376
|
-
- Native Windows should use WSL or a recipe-specific transport for run-local message-controlled recipes; Linux uses stricter `/proc` runner ownership checks for stale PID protection.
|
|
377
|
-
- Registered tools may set `template` to a recipe JSON path/name; calling them follows that recipe's `async` mode.
|
|
378
|
-
- File-backed recipes may declare `imports` and embed imported recipes with `{ "name": "alias" }` nodes, or read `{alias.defaults.key}`, `{alias.defaults.key=fallback}`, and `{alias.values.key?yes:no}` references before command-template execution.
|
|
379
|
-
- Interactive sessions show ambient actor activity as stable `▷` triangles aggregated across runs started by the current agent session. Each running run actor contributes at least one triangle; parallel active branches can contribute more. One `▶` wave moves over the active set; terminal `done`/`failed`/unhandled `killed`/`exited` messages are delivered as compact follow-up context only to the launching coordinator agent, while intentional `cancel`, `kill`, and `stop` actions stay silent because the action already reports synchronously. Failed commands and in-flight parallel branch completions can bubble through `command.done`; successful final leaf completions remain diagnostic to avoid sequential pipeline noise.
|
|
380
|
-
- Use `{file}` as the canonical local file path arg.
|
|
381
|
-
- Stored `script` entries are rejected with migration guidance.
|
|
382
|
-
|
|
383
|
-
See [`docs/command-templates.md`](./docs/command-templates.md) for the portable synchronous command-template contract; [`docs/template-recipes.md`](./docs/template-recipes.md) for saved recipe JSON; [`docs/async-runs.md`](./docs/async-runs.md) for detached lifecycle, state files, cancellation, and observability; [`docs/tool-registry.md`](./docs/tool-registry.md) for registry storage; and [`docs/recipe-library.md`](./docs/recipe-library.md) for the packaged standard recipe library.
|
|
384
|
-
|
|
385
|
-
## Notes
|
|
386
|
-
|
|
387
|
-
- Only register trusted local commands. Registered tools run with the same system permissions as pi.
|
|
388
|
-
- `index.ts` is a small composition root; reusable behavior lives in flat `/lib` domains covered by focused tests.
|
|
268
|
+
Start here:
|
|
269
|
+
|
|
270
|
+
- [Project context](./AGENTS.md)
|
|
271
|
+
- [Changelog](./CHANGELOG.md)
|
|
272
|
+
- [Open backlog](./BACKLOG.md)
|
|
273
|
+
- [Documentation index](./docs/README.md)
|
|
274
|
+
- [Actors skill](./skills/actors/SKILL.md)
|
|
275
|
+
- [Swarm skill](./skills/swarm/SKILL.md)
|
|
276
|
+
|
|
277
|
+
Core docs:
|
|
278
|
+
|
|
279
|
+
- [Command templates](./docs/command-templates.md)
|
|
280
|
+
- [Template recipes](./docs/template-recipes.md)
|
|
281
|
+
- [Async runs](./docs/async-runs.md)
|
|
282
|
+
- [Actor messages](./docs/actor-messages.md)
|
|
283
|
+
- [Tool registry](./docs/tool-registry.md)
|
|
284
|
+
- [Recipe library](./docs/recipe-library.md)
|
|
389
285
|
|
|
390
286
|
## License
|
|
391
287
|
|
package/banner.jpg
CHANGED
|
Binary file
|