@llblab/pi-actors 0.12.3 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Concept
11
11
 
12
- `pi-actors` is a local-first, cybernetic actor layer for pi. It persists user/agent-registered actor-control tools in `~/.pi/agent/actors-tools.json` and registers them automatically across sessions, giving agents durable operational muscle memory for trusted local commands, scripts, actor recipes, and async actor runs. Treat it as MCP-adjacent local capability creation: the agent can create and refine its own tools instead of depending only on external tool servers.
12
+ `pi-actors` is a local-first actor runtime and orchestrator for pi. It wraps trusted local programs, scripts, services, pipelines, and recipes as addressable actors that agents can `spawn`, control with typed `message` envelopes, and observe with `inspect`. It also persists user/agent-registered actor-control tools in `~/.pi/agent/actors-tools.json`, giving agents durable operational muscle memory for launching and managing the local actor zoo.
13
13
 
14
14
  ## Topology
15
15
 
@@ -30,7 +30,7 @@
30
30
  - Prefer explicit migration boundaries over silent user-config rewrites
31
31
  - Keep published documentation portable: use `~`, `<repo>`, or relative paths instead of machine-local absolute paths
32
32
  - Preserve runtime output discipline because tool output flows directly into agent context
33
- - Keep the project lens local-first and cybernetic: agents create durable local capabilities, then use semantic tools instead of repeatedly reconstructing shell commands
33
+ - Keep the project lens local-first and cybernetic: agents wrap durable local capabilities as actors, then use semantic tools and messages instead of repeatedly reconstructing shell commands
34
34
  - Design recipes as agent-callable tools: make prompts, scopes, paths, models, and policy knobs public args/defaults when the caller should decide them at invocation time
35
35
 
36
36
  ## Durable Conventions
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.12.4: Actor Runtime Positioning
6
+
7
+ - `[Docs]` Reframed README and package metadata around `pi-actors` as an actor runtime and orchestrator for agent-managed local processes, while preserving the persistent actor-tool registry as one capability. Impact: new readers see how templates, recipes, mailboxes, messages, artifacts, and run state turn any trusted local process into an agent-controllable actor.
8
+
5
9
  ## 0.12.3: Package Metadata Hygiene
6
10
 
7
11
  - `[Package]` Normalized npm repository metadata to the canonical `git+https://` URL form. Impact: npm publish no longer needs to auto-correct package metadata.
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # pi-actors
2
2
 
3
- Actor runtime and persistent local tool registry extension for the pi coding agent.
3
+ Actor runtime and orchestrator for agent-managed local processes.
4
4
 
5
- `pi-actors` is a local-first, cybernetic actor layer for agents. It is MCP-adjacent in spirit, but instead of waiting for external servers to define every capability, the agent can turn trusted local commands, scripts, and recipes into durable tools itself. Those tools persist across reloads as a kind of operational muscle memory: short semantic names, typed args, reusable recipes, and async runs replace repeated shell reconstruction.
5
+ `pi-actors` turns local programs, scripts, services, recipes, and long-running processes into addressable actors that agents can start, message, inspect, and compose. A music player, a sub-agent fanout, a repo-health pipeline, or any trusted local process can become an actor when it has a template-backed launch path, a mailbox contract, and observable runtime state.
6
+
7
+ The persistent tool registry is still useful: it lets agents keep durable operational muscle memory for trusted local commands and wrappers. But the project lens is broader than stored tools. `pi-actors` is a local-first orchestration runtime for wrapping capabilities as agent-managed entities with explicit interfaces.
6
8
 
7
9
  ## Start Here
8
10
 
@@ -11,20 +13,48 @@ Actor runtime and persistent local tool registry extension for the pi coding age
11
13
  - [Changelog](./CHANGELOG.md)
12
14
  - [Documentation](./docs/README.md)
13
15
 
16
+ ## What It Is
17
+
18
+ `pi-actors` is the runtime layer that lets a pi agent turn a local capability into a controllable actor:
19
+
20
+ ```text
21
+ program/process/service
22
+ → command template
23
+ → actor recipe
24
+ → spawn
25
+ → addressable actor
26
+ → message / inspect / artifacts
27
+ ```
28
+
29
+ An actor can be:
30
+
31
+ - A sub-agent running `pi -p` in a clean context.
32
+ - A background music player controlled by `player.next` or `player.pause` messages.
33
+ - A validation or repo-health pipeline that reports completion and artifacts.
34
+ - A parallel quorum review with branch-level progress.
35
+ - Any trusted local process with a launch template and a useful control surface.
36
+
37
+ The key move is not just “register a command.” It is to wrap a process in an agent-readable contract:
38
+
39
+ - **Launch**: `spawn` starts the actor from a template or recipe.
40
+ - **Interface**: `mailbox` declares accepted and emitted message types.
41
+ - **Control**: `message` sends typed envelopes to runs, branches, tools, or the coordinator.
42
+ - **Observation**: `inspect` reads status, logs, messages, mailbox metadata, files, and artifacts intentionally.
43
+ - **Persistence**: `artifacts` and state files make outcomes durable.
44
+ - **Memory**: `actors-tools.json` stores reusable actor-control wrappers across sessions.
45
+
14
46
  ## Key Features
15
47
 
16
- - **Local-First Tool Memory**: Lets agents create and persist their own trusted local tools, forming durable operational muscle memory instead of one-off shell commands.
17
- - **Commands Become Capabilities**: Turns stable local workflows into semantic agent tools, so the agent chooses what it can do instead of reconstructing how to run shell commands.
18
- - **Actor Tool Registry**: Stores actor-control tool definitions in `~/.pi/agent/actors-tools.json` and registers them automatically on session start.
19
- - **Compact Semantic Interface**: Exposes short tool names, descriptions, named args, and defaults instead of long paths, positional command-arg order, and repeated command boilerplate.
20
- - **Safer Local Automation**: Wraps trusted command templates as narrow tools using split-first command-arg construction, placeholder substitution, and no shell evaluation.
21
- - **Reusable Building Blocks**: Makes skill scripts, sub-agent wrappers, diagnostics, and project workflows available as composable agent capabilities.
22
- - **Immediate Updates**: Registered and updated tools become callable in the active session; deleted tools are removed from active tools and fully disappear after reload.
23
- - **Bounded Output**: Tool stdout is returned to the agent with truncation safeguards; full oversized output is saved to a temp file.
24
- - **Template Recipes**: Stores reusable command-template JSON under `~/.pi/agent/recipes/*.json`; recipes can import other recipes, reuse defaults, declare ordered named `artifacts`, and run foreground or declare `async: true` for detached lifecycle.
25
- - **Actor Runs**: Starts detached recipe or inline-template runs as addressable actors backed by state files under `~/.pi/agent/tmp/pi-actors`.
26
- - **Context Onboarding**: Injects a compact system-prompt note explaining templates, recipes, async runs, tasks, and agent fanout so installed sessions have the mental model available by default.
27
- - **Coordinator-Scoped Run Observability**: Shows at least one stable triangle per running async run started by the current agent session, adds triangles for active parallel branches, then injects compact completion events only back to the launching coordinator when attention is needed.
48
+ - **Actor Runtime**: Starts local templates and recipes as addressable `run:<id>` actors with state, logs, message mailboxes, cancellation, and artifacts.
49
+ - **Agent-Managed Processes**: Wraps sub-agents, media players, pipelines, diagnostics, and other local programs as controllable entities instead of one-off commands.
50
+ - **Message-Oriented Control**: Uses `spawn`, `message`, and `inspect` as the public coordination vocabulary for start, control, and observation.
51
+ - **Mailbox Contracts**: Lets recipes declare what messages they accept and emit, so agents can discover how to interact with an actor.
52
+ - **Actor Tool Registry**: Stores persistent actor-control tool definitions in `~/.pi/agent/actors-tools.json` and registers them automatically on session start.
53
+ - **Command Template Substrate**: Keeps process launch portable with named placeholders, typed args, defaults, sequences, guarded nodes, retries, failure policy, and `parallel: true` fanout.
54
+ - **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`.
55
+ - **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.
56
+ - **Bounded Context Impact**: Returns compact output by default, truncates oversized stdout, and keeps full logs/artifacts in files for intentional inspection.
57
+ - **Local-First Tool Memory**: Still lets agents create durable semantic tools from trusted commands so they do not repeatedly reconstruct shell invocations.
28
58
 
29
59
  ## Install
30
60
 
@@ -64,33 +94,35 @@ The extension does not silently rewrite old registry files; keep or delete the o
64
94
 
65
95
  ## Mental Model
66
96
 
67
- `pi-actors` has one execution idea that grows in place:
97
+ `pi-actors` separates launch mechanics from actor semantics:
68
98
 
69
99
  ```text
70
- command
71
- command template
72
- template recipe
73
- registered tool
74
- async run
100
+ command template = how to start work
101
+ actor recipe = saved actor definition
102
+ spawn = create actor instance
103
+ message = connect/control actors
104
+ inspect = observe intentionally
105
+ artifacts = persist outcomes
106
+ mailbox = declare interaction contract
75
107
  ```
76
108
 
77
109
  - A **command** is one concrete local process.
78
- - A **command template** is the reusable shape of that process, with named placeholders.
79
- - A **template recipe** is saved JSON containing a template plus defaults and run mode.
80
- - A **registered tool** gives a command template or recipe a stable agent-facing name.
81
- - An **async run** is one execution instance with state, logs, script-authored events, status, tail, message send, cancel, and kill.
110
+ - A **command template** is the reusable launch shape for that process, with named placeholders.
111
+ - An **actor recipe** is saved JSON containing a template, defaults, imports, mailbox metadata, artifacts, and optional detached lifecycle.
112
+ - A **registered tool** gives a template or actor recipe a stable agent-facing name.
113
+ - A **run actor** is one execution instance with state, logs, actor messages, mailbox metadata, status, cancellation, and kill control.
82
114
 
83
- The template remains the execution language. The recipe is saved actor configuration. `async: true` is the detached lifecycle switch. The extension injects this compact mental model into the system prompt on each agent turn, including where to look first (`README.md`, `docs/README.md`, recipe/async docs, and `recipes/`) so an agent asked to inspect pi-actors can quickly understand the model and start composing async subagents or other long-running recipes.
115
+ 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.
84
116
 
85
117
  ## Operator Onboarding
86
118
 
87
- Start with foreground templates for short deterministic work:
119
+ Start with foreground templates when the work is short and deterministic:
88
120
 
89
121
  ```text
90
122
  register_tool name=lint_docs description="Lint docs" template="npm run lint:docs"
91
123
  ```
92
124
 
93
- Move to async recipes when work is long-running, parallel, or agentic:
125
+ Move to actor recipes when work is long-running, parallel, service-like, or agentic:
94
126
 
95
127
  ```json
96
128
  {
@@ -101,13 +133,13 @@ Move to async recipes when work is long-running, parallel, or agentic:
101
133
  }
102
134
  ```
103
135
 
104
- Expose a reusable recipe as a normal capability:
136
+ Expose a reusable actor recipe as a normal capability:
105
137
 
106
138
  ```text
107
139
  register_tool name=shader_ring description="Start shader ring" template="shader-ring-8-parallel.json" args="theme,out_dir"
108
140
  ```
109
141
 
110
- `Task` is the user's work item. `Template` is the execution graph. `Recipe` is saved JSON. `Run` is one execution instance with status, logs, cancellation, and ambient triangles.
142
+ `Task` is the user's work item. `Template` is the execution graph. `Actor recipe` is saved JSON. `Run` is one actor instance with status, logs, messages, cancellation, artifacts, and ambient triangles.
111
143
 
112
144
  ## Compose Recipes With Imports
113
145
 
@@ -152,13 +184,13 @@ register_tool name=review_pair \
152
184
 
153
185
  Imported recipes are recipe definitions, not nested async runs. The parent recipe's `async: true` creates one run with one state dir; imported recipes contribute command-template graph, args, defaults, and values.
154
186
 
155
- ## Register Tools
187
+ ## Register Actor-Control Tools
156
188
 
157
- `register_tool` lists, registers, updates, or deletes persistent tools. Call it without arguments to list the current registry.
189
+ `register_tool` lists, registers, updates, or deletes persistent actor-control tools. Call it without arguments to list the current registry. These tools are convenient handles for creating or invoking actors, not the whole runtime model.
158
190
 
159
191
  ### Local command: transcription
160
192
 
161
- `pi-actors` is useful for exposing stable local commands as normal tools. For example, register an STT command:
193
+ `pi-actors` is also useful for exposing stable local commands as normal tools. For example, register an STT command:
162
194
 
163
195
  ```text
164
196
  register_tool name=transcribe \
@@ -168,7 +200,7 @@ register_tool name=transcribe \
168
200
 
169
201
  ### Template recipe
170
202
 
171
- For reusable workflows, keep the large template in a recipe file and register a small tool:
203
+ For reusable actor workflows, keep the large template and mailbox contract in a recipe file and register a small tool:
172
204
 
173
205
  ```text
174
206
  register_tool name=shader_ring \
@@ -240,9 +272,9 @@ The commands above persist entries like this in `~/.pi/agent/actors-tools.json`;
240
272
 
241
273
  This file is the durable actor-tool registry. `register_tool` is the interactive API; `actors-tools.json` is the persisted state that is loaded on future sessions.
242
274
 
243
- ## Manage Run Actors
275
+ ## Manage Actors
244
276
 
245
- Use `spawn` when a command template may outlive the current turn. It starts the work now as an addressable actor, returns immediately with state metadata, and keeps ordinary files under `~/.pi/agent/tmp/pi-actors/runs/<run>` for later inspection.
277
+ Use `spawn` when a command template, service, pipeline, or recipe may outlive the current turn. It starts the work now as an addressable actor, returns immediately with state metadata, and keeps ordinary files under `~/.pi/agent/tmp/pi-actors/runs/<run>` for later inspection.
246
278
 
247
279
  Start from an inline template as an addressable run actor:
248
280
 
@@ -316,7 +348,7 @@ See [`docs/recipe-library.md`](./docs/recipe-library.md) for install notes and r
316
348
 
317
349
  ## Runtime Contract
318
350
 
319
- - Tool names are normalized to snake_case.
351
+ - Actor-control tool names are normalized to snake_case.
320
352
  - Reserved built-in names are blocked.
321
353
  - Templates are split into shell-like words first, then placeholders are substituted per command arg.
322
354
  - Tool args are derived from placeholders when `args` is omitted.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@llblab/pi-actors",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "private": false,
5
- "description": "Persistent template-backed tools for pi",
5
+ "description": "Actor runtime and orchestrator for agent-managed local processes",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -16,9 +16,10 @@
16
16
  "keywords": [
17
17
  "pi-package",
18
18
  "pi-extension",
19
- "tools",
19
+ "actors",
20
+ "orchestration",
20
21
  "automation",
21
- "binding"
22
+ "tools"
22
23
  ],
23
24
  "scripts": {
24
25
  "check": "node --experimental-strip-types -e \"await import('./index.ts'); console.log('pi-actors: extension import ok')\"",