@llblab/pi-actors 0.31.0 → 0.33.0
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 +7 -3
- package/BACKLOG.md +14 -55
- package/CHANGELOG.md +16 -0
- package/README.md +16 -11
- package/dist/lib/observability.js +17 -6
- package/dist/lib/paths.d.ts +1 -1
- package/dist/lib/paths.js +3 -3
- package/dist/lib/recipe-discovery.d.ts +1 -1
- package/dist/lib/recipe-discovery.js +11 -11
- package/dist/lib/tools.d.ts +6 -1
- package/dist/lib/tools.js +150 -37
- package/dist/scripts/conformance.mjs +34 -18
- package/dist/skills/actors/SKILL.md +14 -19
- package/dist/skills/swarm/SKILL.md +3 -3
- package/docs/actor-messages.md +1 -1
- package/docs/tool-registry.md +3 -3
- package/index.ts +1 -1
- package/lib/observability.ts +18 -6
- package/lib/paths.ts +3 -3
- package/lib/recipe-discovery.ts +11 -11
- package/lib/tools.ts +175 -52
- package/package.json +1 -1
- package/scripts/conformance.mjs +34 -18
- package/skills/actors/SKILL.md +14 -19
- package/skills/swarm/SKILL.md +3 -3
- package/dist/lib/conformance.d.ts +0 -12
- package/dist/lib/conformance.js +0 -28
- package/lib/conformance.ts +0 -46
package/skills/actors/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: actors
|
|
3
3
|
description: Required practical guide for non-trivial pi-actors use. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.33.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
|
@@ -39,12 +39,11 @@ Trusted local capability
|
|
|
39
39
|
|
|
40
40
|
- **Command template**: portable execution graph. String leaf, sequence array, or object node with controls.
|
|
41
41
|
- **Recipe**: saved JSON definition wrapping a template with args, defaults, imports, mailbox, artifacts, metadata, and optional `async: true`.
|
|
42
|
-
- **Run actor**: one detached execution instance addressable as `run:<id>` with status, logs, messages, mailbox metadata, files,
|
|
43
|
-
- **Room actor**: shared timeline + roster endpoint addressable as `room:<run>`; every spawned run gets `room:<run>`.
|
|
42
|
+
- **Run actor**: one detached execution instance addressable as `run:<id>` with status, logs, messages, mailbox metadata, files, and artifacts.
|
|
44
43
|
- **Tool actor**: registered persistent capability addressable as `tool:<name>` and callable through the generated tool or `message`. `tool:pi-actors` is reserved for runtime/status inspection.
|
|
45
|
-
- **Coordinator/session**: the current pi session endpoint that receives bounded actor follow-ups.
|
|
46
|
-
- **Mailbox**: public interaction contract: message types the actor accepts/emits.
|
|
47
44
|
- **Artifact**: named durable output path declared by a recipe/run.
|
|
45
|
+
- **Mailbox**: interaction contract: message types the actor accepts/emits.
|
|
46
|
+
- **Advanced group/coordination surfaces**: `branch:<run>/<branch>`, `room:<run>`, `coordinator`, `session:<id>`, and communication snapshots exist for multi-actor workflows and diagnostics; do not make them the default mental model.
|
|
48
47
|
|
|
49
48
|
## Three Verbs
|
|
50
49
|
|
|
@@ -86,8 +85,9 @@ Envelope fields:
|
|
|
86
85
|
|
|
87
86
|
- Required: `to`, `type`.
|
|
88
87
|
- Useful: `summary`, `body`, `from`, `reply_to`, `correlation_id`, `metadata`.
|
|
89
|
-
-
|
|
90
|
-
-
|
|
88
|
+
- Core addresses: `run:<id>`, `tool:<name>`.
|
|
89
|
+
- Advanced addresses: `branch:<run>/<branch>`, `room:<run>` for group timeline/roster, `coordinator`, `session:<id>`.
|
|
90
|
+
- Group posts to `room:<run>` require `from` from the same run (`run:<run>` or `branch:<run>/<branch>`).
|
|
91
91
|
- Runtime termination message: `control.kill` is the only documented actor message that kills a run. `control.stop` and `control.cancel` are actor-local mailbox vocabulary only when a recipe declares and handles them. Terminal retention messages: `control.archive`, `control.prune`.
|
|
92
92
|
- Long-lived child processes should remain in the run-owned process group unless the recipe implements an explicit daemon termination bridge; do not leave unowned detached services behind `control.kill`.
|
|
93
93
|
|
|
@@ -99,12 +99,7 @@ Check `inspect view=mailbox` before domain-specific messages.
|
|
|
99
99
|
{ "target": "run:repo-health", "view": "status" }
|
|
100
100
|
{ "target": "run:repo-health", "view": "tail", "lines": "80" }
|
|
101
101
|
{ "target": "run:repo-health", "view": "messages" }
|
|
102
|
-
{ "target": "run:repo-health", "view": "communication" }
|
|
103
102
|
{ "target": "run:repo-health", "view": "artifacts" }
|
|
104
|
-
{ "target": "room:repo-health", "view": "status" }
|
|
105
|
-
{ "target": "room:repo-health", "view": "roster" }
|
|
106
|
-
{ "target": "room:repo-health", "view": "contacts" }
|
|
107
|
-
{ "target": "room:repo-health", "view": "previews" }
|
|
108
103
|
{ "target": "tool:pi-actors", "view": "status" }
|
|
109
104
|
{ "target": "tool:music_player", "view": "status" }
|
|
110
105
|
{ "target": "recipes", "view": "status" }
|
|
@@ -116,10 +111,10 @@ Views:
|
|
|
116
111
|
- `status`: lifecycle, pid, values, progress, result, compact summary.
|
|
117
112
|
- `tail`: recent stdout/stderr/log tail.
|
|
118
113
|
- `messages`: actor messages emitted by the run, or room timeline entries for `room:*`.
|
|
119
|
-
- `communication`: run/branch
|
|
120
|
-
- `roster`: room member list with address, role, parent, caps, claim, status, and last seen.
|
|
121
|
-
- `contacts`: roster-derived direct-message targets without full roster metadata.
|
|
122
|
-
- `previews`: TUI-ready bounded
|
|
114
|
+
- Advanced `communication`: run/branch group-coordination snapshot with self/root/default-room/member/contact hints.
|
|
115
|
+
- Advanced `roster`: room member list with address, role, parent, caps, claim, status, and last seen.
|
|
116
|
+
- Advanced `contacts`: roster-derived direct-message targets without full roster metadata.
|
|
117
|
+
- Advanced `previews`: TUI-ready bounded group-message previews with timestamp/from/to/type/summary/body_preview.
|
|
123
118
|
- `mailbox`: declared accepts/emits contract for runs; queued direct branch inbox messages for `branch:<run>/<branch>` with `id`, status, route/type, and queue/handling timestamps.
|
|
124
119
|
- `files`: run state directory file list.
|
|
125
120
|
- `artifacts`: declared artifact paths/status.
|
|
@@ -218,13 +213,13 @@ Only matching filename ids compete. Higher priority shadows lower priority; with
|
|
|
218
213
|
Muscle-memory lens: pi-actors has two durable executable-memory layers.
|
|
219
214
|
|
|
220
215
|
1. `~/.pi/agent/recipes/*.json` and `*.md` are the agent's active capability memory. Every recipe in that directory becomes an easy-to-call tool automatically and survives into later sessions. Descriptions matter here because they become the tool's operator-facing title/context.
|
|
221
|
-
2. `~/.pi/agent/recipes/
|
|
216
|
+
2. `~/.pi/agent/recipes/drafts/*.json` is draft memory captured from successful inline `spawn template=...` runs. Drafts do not enter the injected tool surface. They remain reusable by explicit path, e.g. `spawn file="~/.pi/agent/recipes/drafts/<name>.json"`, and can be promoted by moving or copying one level up into `~/.pi/agent/recipes`.
|
|
222
217
|
|
|
223
|
-
Agents grow active memory by calling `register_tool` or by deliberate recipe-file edits. They grow
|
|
218
|
+
Agents grow active memory by calling `register_tool` or by deliberate recipe-file edits. They grow draft memory by trying ad hoc actors successfully. Treat both as executable habits: drafts are the workbench/proving ground; root recipes are promoted muscle memory.
|
|
224
219
|
|
|
225
220
|
Usage lens: user recipes may carry extension-maintained launch metadata such as `usage.calls` and `usage.last_called`. The extension increments the counter when it starts that concrete recipe; agents should not hand-edit counters as part of normal recipe maintenance. Treat usage as evidence for usefulness analysis: heavily used recipes are good candidates for promotion, documentation, or stronger tests; unused recipes are cleanup candidates. Do not use failure counts as a primary usefulness signal because failures may reflect bad caller judgment rather than bad recipes. Do not delete or demote solely from counters without operator approval.
|
|
226
221
|
|
|
227
|
-
Promotion lens: successful transient/ad hoc actor runs are evidence, not commands. Inline spawns leave
|
|
222
|
+
Promotion lens: successful transient/ad hoc actor runs are evidence, not commands. Inline spawns leave draft recipes as replayable evidence, not active tools. If a draft is repeatable, parameterized, safe enough, and likely useful later, the agent may promote it by moving/copying it into `~/.pi/agent/recipes` or by calling `register_tool` with a concise name, typed args/defaults, and a reviewed template or recipe path. Do not auto-register every success; do not promote temp paths, secrets, one-off prompts, or project-private assumptions without normalization and approval.
|
|
228
223
|
|
|
229
224
|
Cleanup rule: periodically inspect `~/.pi/agent/recipes` as the live muscle-memory set. For each stale, duplicate, too-specific, or low-value recipe, choose one explicit action: keep as a tool, move it out of the agent recipe root to retain recipe-only memory, merge into a better recipe, or delete/archive the file. Prefer moving over deletion when the recipe may still be useful as a component. Never silently remove tools during unrelated work.
|
|
230
225
|
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: swarm
|
|
3
3
|
description: Subagent orchestration with scoped locks and quorum consensus. Use for multi-model review, parallel scoped work, delegated audit, and coordinated subagent execution.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.33.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Swarm
|
|
@@ -30,8 +30,8 @@ Maintain this skill as a living orchestration standard. When real swarm work exp
|
|
|
30
30
|
- `Async Run`: A local lifecycle envelope around a command-template swarm composer or utility. It owns state, logs, status, cancellation, and observability, not swarm semantics.
|
|
31
31
|
- `Lens`: A deliberately narrow cognitive role assigned to one subagent, such as security, tests, architecture, economics, or operator UX.
|
|
32
32
|
- `Task Card`: A bounded implementation assignment with goal, allowed files, avoided files, expected output, and validation gates.
|
|
33
|
-
- `Component Capability`: An abstract adapter operation such as launcher, reviewer, verifier, merger, quorum, checkpoint, follow-up, judge, or normalizer. Swarm may target these capabilities, but local adapters bind them to concrete tools, recipes,
|
|
34
|
-
- `
|
|
33
|
+
- `Component Capability`: An abstract adapter operation such as launcher, reviewer, verifier, merger, quorum, checkpoint, follow-up, judge, or normalizer. Swarm may target these capabilities, but local adapters bind them to concrete tools, recipes, draft recipes, command templates, async runs, or services.
|
|
34
|
+
- `Draft Recipe`: A reusable but non-registered recipe captured from a successful inline actor spawn under `~/.pi/agent/recipes/drafts`. It can be replayed by explicit file path and later promoted into the active tool recipe root after enough dogfood.
|
|
35
35
|
- `Coordinator Checkpoint`: A deliberate subagent pause where the subagent preserves its working context, sends a bounded question or status to the orchestrator, receives a coordinator reply, and continues in the same subagent context.
|
|
36
36
|
- `Evidence Checkpoint`: A deliberate stop where a subagent records sources, assumptions, confidence, contradictions, or blocking evidence gaps before synthesis.
|
|
37
37
|
- `Integrator`: The human or agent that merges isolated branches/worktrees into the shared target and owns conflict resolution.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal conformance runner logic.
|
|
3
|
-
* Zones: CI/release validation, protocol regression suite selection
|
|
4
|
-
*/
|
|
5
|
-
export declare const conformanceSuites: string[];
|
|
6
|
-
export interface ConformanceReport {
|
|
7
|
-
code: number;
|
|
8
|
-
output: string;
|
|
9
|
-
summary: string;
|
|
10
|
-
suites: number;
|
|
11
|
-
}
|
|
12
|
-
export declare function runConformance(cwd?: URL): ConformanceReport;
|
package/dist/lib/conformance.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal conformance runner logic.
|
|
3
|
-
* Zones: CI/release validation, protocol regression suite selection
|
|
4
|
-
*/
|
|
5
|
-
import { spawnSync } from "node:child_process";
|
|
6
|
-
export const conformanceSuites = [
|
|
7
|
-
"tests/protocol-examples.test.ts",
|
|
8
|
-
"tests/recipe-discovery.test.ts",
|
|
9
|
-
"tests/registry.test.ts",
|
|
10
|
-
"tests/runtime-registry.test.ts",
|
|
11
|
-
"tests/async-runs.test.ts",
|
|
12
|
-
"tests/actor-rooms.test.ts",
|
|
13
|
-
"tests/tools.test.ts",
|
|
14
|
-
];
|
|
15
|
-
export function runConformance(cwd = new URL("..", import.meta.url)) {
|
|
16
|
-
const result = spawnSync(process.execPath, ["--experimental-strip-types", "--test", ...conformanceSuites], { cwd, encoding: "utf8", stdio: "pipe" });
|
|
17
|
-
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`;
|
|
18
|
-
const summary = output
|
|
19
|
-
.split("\n")
|
|
20
|
-
.filter((line) => /^ℹ (tests|pass|fail|cancelled|skipped|todo|duration_ms) /.test(line))
|
|
21
|
-
.join("\n");
|
|
22
|
-
return {
|
|
23
|
-
code: result.status ?? 1,
|
|
24
|
-
output,
|
|
25
|
-
summary,
|
|
26
|
-
suites: conformanceSuites.length,
|
|
27
|
-
};
|
|
28
|
-
}
|
package/lib/conformance.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal conformance runner logic.
|
|
3
|
-
* Zones: CI/release validation, protocol regression suite selection
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { spawnSync } from "node:child_process";
|
|
7
|
-
|
|
8
|
-
export const conformanceSuites = [
|
|
9
|
-
"tests/protocol-examples.test.ts",
|
|
10
|
-
"tests/recipe-discovery.test.ts",
|
|
11
|
-
"tests/registry.test.ts",
|
|
12
|
-
"tests/runtime-registry.test.ts",
|
|
13
|
-
"tests/async-runs.test.ts",
|
|
14
|
-
"tests/actor-rooms.test.ts",
|
|
15
|
-
"tests/tools.test.ts",
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export interface ConformanceReport {
|
|
19
|
-
code: number;
|
|
20
|
-
output: string;
|
|
21
|
-
summary: string;
|
|
22
|
-
suites: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function runConformance(cwd = new URL("..", import.meta.url)): ConformanceReport {
|
|
26
|
-
const result = spawnSync(
|
|
27
|
-
process.execPath,
|
|
28
|
-
["--experimental-strip-types", "--test", ...conformanceSuites],
|
|
29
|
-
{ cwd, encoding: "utf8", stdio: "pipe" },
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`;
|
|
33
|
-
const summary = output
|
|
34
|
-
.split("\n")
|
|
35
|
-
.filter((line) =>
|
|
36
|
-
/^ℹ (tests|pass|fail|cancelled|skipped|todo|duration_ms) /.test(line),
|
|
37
|
-
)
|
|
38
|
-
.join("\n");
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
code: result.status ?? 1,
|
|
42
|
-
output,
|
|
43
|
-
summary,
|
|
44
|
-
suites: conformanceSuites.length,
|
|
45
|
-
};
|
|
46
|
-
}
|