@llblab/pi-actors 0.33.0 → 0.34.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 +22 -11
- package/BACKLOG.md +3 -34
- package/CHANGELOG.md +14 -0
- package/dist/index.js +10 -10
- package/dist/lib/async-runs.d.ts +23 -75
- package/dist/lib/async-runs.js +49 -801
- package/dist/lib/command-templates.d.ts +3 -3
- package/dist/lib/command-templates.js +3 -3
- package/dist/lib/config.d.ts +2 -2
- package/dist/lib/config.js +5 -5
- package/dist/lib/{output.d.ts → execution-output.d.ts} +3 -3
- package/dist/lib/{output.js → execution-output.js} +3 -3
- package/dist/lib/execution.js +1 -1
- package/dist/lib/{actor-inspector-tui.d.ts → inspector.d.ts} +3 -2
- package/dist/lib/{actor-inspector-tui.js → inspector.js} +3 -2
- package/dist/lib/mailbox-loop.d.ts +3 -3
- package/dist/lib/mailbox-loop.js +3 -3
- package/dist/lib/{actor-messages.d.ts → messages.d.ts} +3 -3
- package/dist/lib/{actor-messages.js → messages.js} +3 -3
- package/dist/lib/{actor-recipe-context.d.ts → recipes-context.d.ts} +3 -2
- package/dist/lib/{actor-recipe-context.js → recipes-context.js} +2 -1
- package/dist/lib/{recipe-discovery.d.ts → recipes-discovery.d.ts} +8 -8
- package/dist/lib/{recipe-discovery.js → recipes-discovery.js} +6 -6
- package/dist/lib/registry.d.ts +1 -1
- package/dist/lib/registry.js +22 -22
- package/dist/lib/{actor-rooms.d.ts → rooms.d.ts} +4 -4
- package/dist/lib/{actor-rooms.js → rooms.js} +3 -3
- package/dist/lib/runs-artifacts.d.ts +21 -0
- package/dist/lib/runs-artifacts.js +68 -0
- package/dist/lib/runs-control.d.ts +13 -0
- package/dist/lib/runs-control.js +59 -0
- package/dist/lib/runs-identity.d.ts +5 -0
- package/dist/lib/runs-identity.js +11 -0
- package/dist/lib/runs-index.d.ts +18 -0
- package/dist/lib/runs-index.js +119 -0
- package/dist/lib/runs-mailbox.d.ts +25 -0
- package/dist/lib/runs-mailbox.js +146 -0
- package/dist/lib/runs-messages.d.ts +15 -0
- package/dist/lib/runs-messages.js +179 -0
- package/dist/lib/runs-outbox.d.ts +41 -0
- package/dist/lib/runs-outbox.js +87 -0
- package/dist/lib/runs-process.d.ts +7 -0
- package/dist/lib/runs-process.js +36 -0
- package/dist/lib/runs-retention.d.ts +8 -0
- package/dist/lib/runs-retention.js +56 -0
- package/dist/lib/runs-start.d.ts +9 -0
- package/dist/lib/runs-start.js +67 -0
- package/dist/lib/runs-status.d.ts +8 -0
- package/dist/lib/runs-status.js +60 -0
- package/dist/lib/runtime.d.ts +2 -2
- package/dist/lib/runtime.js +5 -5
- package/dist/lib/schema.d.ts +9 -0
- package/dist/lib/schema.js +40 -0
- package/dist/lib/tools-access.d.ts +19 -0
- package/dist/lib/tools-access.js +44 -0
- package/dist/lib/tools-inspect.d.ts +11 -0
- package/dist/lib/tools-inspect.js +534 -0
- package/dist/lib/tools-local.d.ts +14 -0
- package/dist/lib/tools-local.js +156 -0
- package/dist/lib/tools-mailbox.d.ts +8 -0
- package/dist/lib/tools-mailbox.js +48 -0
- package/dist/lib/tools-message.d.ts +9 -0
- package/dist/lib/tools-message.js +428 -0
- package/dist/lib/tools-register.d.ts +18 -0
- package/dist/lib/tools-register.js +40 -0
- package/dist/lib/tools-response.d.ts +21 -0
- package/dist/lib/tools-response.js +219 -0
- package/dist/lib/tools-spawn.d.ts +12 -0
- package/dist/lib/tools-spawn.js +159 -0
- package/dist/lib/tools.d.ts +8 -39
- package/dist/lib/tools.js +11 -1490
- package/dist/recipes/utility-coordinator-lock-snapshot.json +1 -1
- package/dist/scripts/actor-worker.mjs +190 -7
- package/dist/scripts/async-runner.mjs +171 -8
- package/dist/scripts/build-dist.mjs +1 -1
- package/dist/scripts/conformance.mjs +3 -3
- package/dist/scripts/coordinator.mjs +733 -11
- package/dist/scripts/locker.mjs +345 -16
- package/dist/scripts/recipe-utils.mjs +478 -14
- package/dist/scripts/validate-recipe.mjs +110 -10
- package/dist/skills/actors/SKILL.md +1 -1
- package/dist/skills/swarm/SKILL.md +1 -1
- package/docs/recipe-library.md +1 -1
- package/docs/template-recipes.md +1 -1
- package/index.ts +11 -18
- package/lib/async-runs.ts +124 -1016
- package/lib/command-templates.ts +3 -3
- package/lib/config.ts +7 -7
- package/lib/{output.ts → execution-output.ts} +3 -3
- package/lib/execution.ts +5 -1
- package/lib/{actor-inspector-tui.ts → inspector.ts} +4 -3
- package/lib/mailbox-loop.ts +3 -3
- package/lib/{actor-messages.ts → messages.ts} +3 -3
- package/lib/{actor-recipe-context.ts → recipes-context.ts} +3 -2
- package/lib/{recipe-discovery.ts → recipes-discovery.ts} +19 -19
- package/lib/{recipe-usage.ts → recipes-usage.ts} +2 -2
- package/lib/registry.ts +37 -24
- package/lib/{actor-rooms.ts → rooms.ts} +4 -4
- package/lib/runs-artifacts.ts +96 -0
- package/lib/runs-control.ts +85 -0
- package/lib/runs-identity.ts +14 -0
- package/lib/runs-index.ts +156 -0
- package/lib/runs-mailbox.ts +208 -0
- package/lib/runs-messages.ts +252 -0
- package/lib/runs-outbox.ts +144 -0
- package/lib/runs-process.ts +51 -0
- package/lib/runs-retention.ts +77 -0
- package/lib/runs-start.ts +98 -0
- package/lib/runs-status.ts +78 -0
- package/lib/runtime.ts +6 -6
- package/lib/schema.ts +55 -0
- package/lib/tools-access.ts +68 -0
- package/lib/tools-inspect.ts +735 -0
- package/lib/tools-local.ts +234 -0
- package/lib/tools-mailbox.ts +56 -0
- package/lib/tools-message.ts +569 -0
- package/lib/tools-register.ts +64 -0
- package/lib/tools-response.ts +267 -0
- package/lib/tools-spawn.ts +240 -0
- package/lib/tools.ts +20 -2040
- package/package.json +1 -1
- package/recipes/utility-coordinator-lock-snapshot.json +1 -1
- package/scripts/actor-worker.mjs +190 -7
- package/scripts/async-runner.mjs +171 -8
- package/scripts/build-dist.mjs +1 -1
- package/scripts/conformance.mjs +3 -3
- package/scripts/coordinator.mjs +733 -11
- package/scripts/locker.mjs +345 -16
- package/scripts/recipe-utils.mjs +478 -14
- package/scripts/validate-recipe.mjs +110 -10
- package/skills/actors/SKILL.md +1 -1
- package/skills/swarm/SKILL.md +1 -1
- package/dist/lib/actor-worker.d.ts +0 -16
- package/dist/lib/actor-worker.js +0 -134
- package/dist/lib/async-runner.d.ts +0 -5
- package/dist/lib/async-runner.js +0 -134
- package/dist/lib/coordinator.d.ts +0 -5
- package/dist/lib/coordinator.js +0 -660
- package/dist/lib/locker.d.ts +0 -5
- package/dist/lib/locker.js +0 -310
- package/dist/lib/recipe-utils.d.ts +0 -5
- package/dist/lib/recipe-utils.js +0 -385
- package/dist/lib/validate-recipe.d.ts +0 -6
- package/dist/lib/validate-recipe.js +0 -104
- package/lib/actor-worker.ts +0 -174
- package/lib/async-runner.ts +0 -173
- package/lib/coordinator.ts +0 -742
- package/lib/locker.ts +0 -340
- package/lib/recipe-utils.ts +0 -486
- package/lib/validate-recipe.ts +0 -110
- /package/dist/lib/{recipe-references.d.ts → recipes-references.d.ts} +0 -0
- /package/dist/lib/{recipe-references.js → recipes-references.js} +0 -0
- /package/dist/lib/{recipe-usage.d.ts → recipes-usage.d.ts} +0 -0
- /package/dist/lib/{recipe-usage.js → recipes-usage.js} +0 -0
- /package/lib/{recipe-references.ts → recipes-references.ts} +0 -0
package/AGENTS.md
CHANGED
|
@@ -18,12 +18,12 @@ Treat this extension as an experimental self-evolution membrane for the agent ha
|
|
|
18
18
|
```text
|
|
19
19
|
Pi host
|
|
20
20
|
-> index.ts composition root
|
|
21
|
-
-> lib/tools
|
|
21
|
+
-> lib/tools*.ts / prompts.ts public tool + injected prompt surface
|
|
22
22
|
-> lib/runtime.ts / registry.ts active user recipe tools
|
|
23
|
-
-> lib/
|
|
23
|
+
-> lib/recipes-*.ts packaged/user/draft recipe discovery
|
|
24
24
|
-> lib/async-runs.ts spawn lifecycle and run state
|
|
25
|
-
-> lib/
|
|
26
|
-
-> scripts/*.mjs
|
|
25
|
+
-> lib/rooms.ts room, roster, mailbox, communication log
|
|
26
|
+
-> scripts/*.mjs self-contained process entrypoints
|
|
27
27
|
-> recipes/*.json packaged actor components
|
|
28
28
|
-> skills/* + docs/* agent guidance and transportable specs
|
|
29
29
|
```
|
|
@@ -34,19 +34,29 @@ Pi host
|
|
|
34
34
|
|
|
35
35
|
- `/lib/*.ts`: Flat Domain DAG modules for cohesive reusable behavior.
|
|
36
36
|
- `command-templates.ts`: portable command-template execution graph.
|
|
37
|
+
- `tools-access.ts`: shared public tool access/session ownership guards and normalized mismatch diagnostics.
|
|
38
|
+
- `tools-mailbox.ts`: mailbox contract normalization and accepted/emitted message type helpers for public tool responses.
|
|
37
39
|
- `schema.ts`: tool arg declarations and placeholder-derived schemas.
|
|
38
40
|
- `identity.ts`, `paths.ts`, `config.ts`: names, paths, and persistence.
|
|
39
41
|
- `registry.ts`, `runtime.ts`: register/update/delete, load/conflict/registration coordination.
|
|
40
|
-
- `execution.ts`, `output.ts`, `limits.ts`: registered-tool execution and bounded output.
|
|
41
|
-
- `
|
|
42
|
-
- `async-runs.ts
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
42
|
+
- `execution.ts`, `execution-output.ts`, `limits.ts`: registered-tool execution and bounded output.
|
|
43
|
+
- `recipes-references.ts`, `recipes-discovery.ts`, `recipes-usage.ts`: recipe graph, discovery, and usage metadata.
|
|
44
|
+
- `async-runs.ts`: detached run lifecycle facade; `runs-*` subdomains own artifacts, start guards, status, indexes, inbox/outbox, delivery, process control, and retention internals.
|
|
45
|
+
- `runtime-notifier.ts`, `mailbox-loop.ts`: wake notifications and reusable run/branch mailbox worker loops.
|
|
46
|
+
- `messages.ts`, `rooms.ts`, `recipes-context.ts`, `inspector.ts`, `observability.ts`: addressed message protocol, rooms, recipe prompt context, communication previews, and ambient run status.
|
|
47
|
+
- `prompts.ts`, `temp.ts`: LLM-facing copy and temp cleanup.
|
|
48
|
+
- `tools.ts`: public tool family composition and reserved tool names.
|
|
49
|
+
- `tools-message.ts`: public `message` tool behavior, including run controls, branch/room routing, tool actor invocation, and delivery feedback.
|
|
50
|
+
- `tools-inspect.ts`: public `inspect` tool behavior, including recipe registry, room/session/tool/run views, and observation formatting.
|
|
51
|
+
- `tools-spawn.ts`: public `spawn` tool behavior, including actor launch, draft recipe capture, and launch diagnostics.
|
|
52
|
+
- `tools-local.ts`: saved local capability execution, generated schemas, value normalization, and async recipe launch.
|
|
53
|
+
- `tools-register.ts`: public `register_tool` behavior and schema for persisted local capability registration.
|
|
54
|
+
- `tools-response.ts`: compact model-facing responses and next-action rendering shared by public tool execution paths.
|
|
45
55
|
|
|
46
56
|
## Repo Surfaces
|
|
47
57
|
|
|
48
|
-
- `/scripts/*.mjs`: Stable executables for detached/helper processes.
|
|
49
|
-
- `/lib/*.ts`: Compiled domains
|
|
58
|
+
- `/scripts/*.mjs`: Stable executables for detached/helper processes. Prefer self-contained script ownership; do not preemptively move script logic into `lib/` just to make scripts thin.
|
|
59
|
+
- `/lib/*.ts`: Compiled reusable domains for the extension/runtime. Move script behavior into `lib/` only when it has real non-script consumers or belongs to an existing reusable domain. Packaged JS-only execution, tests, or shim neatness alone do not justify a new `lib/` domain.
|
|
50
60
|
- `/recipes/*.json`: Packaged standard recipe library. Keep recipes optional, composable, policy-light, and caller-configurable.
|
|
51
61
|
- `/skills/actors/SKILL.md`: Dense practical reference for operating pi-actors itself.
|
|
52
62
|
- `/skills/swarm/SKILL.md`: Bundled methodology skill for multi-agent standards, strategies, and portable examples.
|
|
@@ -62,6 +72,7 @@ Pi host
|
|
|
62
72
|
- Keep published documentation portable: use `~`, `<repo>`, or relative paths instead of machine-local absolute paths.
|
|
63
73
|
- Preserve runtime output discipline because tool output flows directly into agent context.
|
|
64
74
|
- Optimize every actor-facing surface for signal over volume: prefer compact state-backed hints and fewer concepts over broad explanatory prose or speculative guidance.
|
|
75
|
+
- Split broad domains proactively when the current name becomes a generic bucket. Prefer concise domain names that match actual ownership. `tools.ts` is the public tool family owner; decomposed tool subdomains use `tools-<part>.ts` (`tools-message.ts`, `tools-inspect.ts`, `tools-spawn.ts`) under that family. Keep only genuinely cross-family domains unprefixed (`schema.ts`); tool-only helpers stay under `tools-*`. If a `tools-*` helper becomes reused by non-tools domains, remove the `tools-` prefix in the same slice and update ownership comments/imports so the name matches its broader responsibility. Avoid redundant internal `actor-` file prefixes in this actor-scoped package unless the file is deliberately tied to a public actor-named recipe/script/docs surface.
|
|
65
76
|
- Until a stable release greater than `1.x.x`, favor context compression over compatibility shims: do not preserve legacy actor-facing names, aliases, fields, env vars, paths, or docs solely for backward compatibility when a clearer current term exists. Remove compatibility layers in the same slice that renames a concept, and record the break in `CHANGELOG.md`.
|
|
66
77
|
- 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.
|
|
67
78
|
- 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.
|
package/BACKLOG.md
CHANGED
|
@@ -53,37 +53,6 @@ No open hotfix items.
|
|
|
53
53
|
|
|
54
54
|
The backlog is intentionally pruned to the 20% of work most likely to deliver 80% of value for `pi-actors` as a local actor kernel. Bias toward consolidation, smaller public surface area, and reliability over new feature breadth.
|
|
55
55
|
|
|
56
|
-
### M-15 Worker Stale-Claim Dogfood
|
|
57
|
-
|
|
58
|
-
- Priority: Medium.
|
|
59
|
-
- Status: Planned.
|
|
60
|
-
- Goal: Validate and harden actor-worker v2 stale-claim visibility under intentionally stale claimed branch messages.
|
|
61
|
-
- Why now: M-09 exposed `stale_claims`; real dogfood should verify the operator can diagnose stuck claimed work before adding recovery policy.
|
|
62
|
-
- Direction:
|
|
63
|
-
- Create deterministic stale claimed branch inbox fixtures or smoke tests.
|
|
64
|
-
- Verify `worker-status.json`, room events, and inspect surfaces make stale claims visible.
|
|
65
|
-
- Defer auto-recovery unless workflow evidence proves it is safe.
|
|
66
|
-
- Acceptance:
|
|
67
|
-
- Stale claims are reproducible and visible in worker status.
|
|
68
|
-
- Tests cover stale-claim counting without adding scheduler/broker policy.
|
|
69
|
-
|
|
70
|
-
### M-17 Message Delivery Outcome Contract
|
|
71
|
-
|
|
72
|
-
- Priority: High.
|
|
73
|
-
- Status: Planned.
|
|
74
|
-
- Goal: Normalize `message` results so operators can distinguish delivered, queued, persisted, forwarded, unsupported, and ownership-denied outcomes.
|
|
75
|
-
- Why now: Branch message UX already treats durable branch mailbox persistence as a successful queued outcome when a parent endpoint is unavailable; that local fix should become a consistent message-result membrane.
|
|
76
|
-
- Direction:
|
|
77
|
-
- Define compact delivery fields: `queued`, `delivered`, `persisted`, `forwarded`, `consumer`, `reason`, and `hint`.
|
|
78
|
-
- Apply the shape to `run:<id>`, `branch:<run>/<branch>`, `room:<run>`, `coordinator`, `session:`, and `tool:<name>` where meaningful.
|
|
79
|
-
- Reuse M-14 session mismatch shape for ownership-denied outcomes.
|
|
80
|
-
- Do not claim guaranteed live consumption unless a known consumer exists.
|
|
81
|
-
- Do not add a broker, distributed delivery semantics, or a new public noun.
|
|
82
|
-
- Acceptance:
|
|
83
|
-
- Branch messages clearly report queued/persisted state and known worker-consumer state where available.
|
|
84
|
-
- Room messages distinguish timeline append success from forwarded branch-targeted copies.
|
|
85
|
-
- Tests cover at least run, branch, room, coordinator, and ownership-denied outcomes.
|
|
86
|
-
|
|
87
56
|
### M-18 Draft Recipe Promotion UX
|
|
88
57
|
|
|
89
58
|
- Priority: High.
|
|
@@ -185,7 +154,7 @@ These are valid ideas but not current focus. Reintroduce only with concrete evid
|
|
|
185
154
|
## Suggested Milestone Order
|
|
186
155
|
|
|
187
156
|
```text
|
|
188
|
-
Next milestone: M-
|
|
189
|
-
Then: M-
|
|
190
|
-
Small cleanup lane:
|
|
157
|
+
Next milestone: M-18 Draft Recipe Promotion UX.
|
|
158
|
+
Then: M-19 Recipe Doctor Risk Labels v2.
|
|
159
|
+
Small cleanup lane: continue opportunistic domain polish only when a real ownership boundary appears.
|
|
191
160
|
```
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.34.1: Message Delivery Outcome Hotfix
|
|
6
|
+
|
|
7
|
+
- `[Dogfood]` Added a deterministic actor-worker stale-claim smoke covering an intentionally claimed branch inbox record; the worker now reports stale claim counts in both `worker-status.json` and its awaiting-assignment room event without adding auto-recovery or scheduler policy.
|
|
8
|
+
- `[Messages]` Completed the M-17 message delivery outcome contract by normalizing public message results with `delivered`, `persisted`, `queued`, `forwarded`, `consumer`, and `reason` fields across run, branch, room, coordinator, session, and tool destinations; room multicast now also exposes per-recipient branch delivery outcomes.
|
|
9
|
+
- `[Backlog]` Closed M-15 Worker Stale-Claim Dogfood and M-17 Message Delivery Outcome Contract after adding delivery-result coverage for run, branch, room, coordinator, session, tool, and ownership-denied paths.
|
|
10
|
+
|
|
11
|
+
## 0.34.0: Actor Kernel Domain Compression
|
|
12
|
+
|
|
13
|
+
- `[Domains]` Compressed the actor kernel into explicit domain families: `tools.ts` remains the public tool-family owner while `tools-*` owns message, inspect, spawn, register, local execution, response, access, and mailbox-contract behavior; `async-runs.ts` remains the lifecycle facade while `runs-*` owns artifacts, mailbox, process control, delivery, outbox, index, retention, status, start guards, and identity internals.
|
|
14
|
+
- `[Domains]` Removed redundant internal `actor-` prefixes and renamed the recipe family to plural `recipes-*`, leaving public actor-named recipe/script/docs surfaces intact while making core library ownership match the `tools-*` and `runs-*` convention.
|
|
15
|
+
- `[Scripts]` Collapsed script-only runner, worker, validator, recipe-utils, locker, and coordinator library shims back into their owning `scripts/*.mjs` entrypoints; reusable lifecycle, room, mailbox-loop, command-template, and recipe-reference primitives remain in `lib/`.
|
|
16
|
+
- `[Context]` Reversed the thin-script default, polished ownership headers, and kept completed script-autonomy/domain-compression work in the changelog instead of the backlog.
|
|
17
|
+
- `[Tests]` Mirrored renamed domains in test filenames and extended installed-package contract coverage to ensure stale renamed lib domains are absent from `dist/lib` while packaged JS-only script execution still works.
|
|
18
|
+
|
|
5
19
|
## 0.33.0: Signal-First Compatibility Pruning
|
|
6
20
|
|
|
7
21
|
- `[Breaking]` Removed pre-1.x compatibility shims for draft recipe terminology: draft captures now live under `~/.pi/agent/recipes/drafts`, recipe inspection no longer emits `candidates`, spawn details no longer emit `candidate_recipe`, and shadow diagnostics use `blocked_fallback` instead of `blocked_candidate`.
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Wraps command templates as callable pi tools, stores durable user tools as recipe files, and exposes actor orchestration across reloads and sessions.
|
|
6
6
|
*/
|
|
7
|
-
import * as ActorInspectorTui from "./lib/actor-inspector-tui.js";
|
|
8
7
|
import * as AsyncRuns from "./lib/async-runs.js";
|
|
9
8
|
import * as CommandTemplates from "./lib/command-templates.js";
|
|
9
|
+
import * as Inspector from "./lib/inspector.js";
|
|
10
10
|
import * as Observability from "./lib/observability.js";
|
|
11
11
|
import * as Paths from "./lib/paths.js";
|
|
12
12
|
import * as Pi from "./lib/pi.js";
|
|
@@ -20,7 +20,7 @@ export default function toolRegistryExtension(pi) {
|
|
|
20
20
|
let activeRunContext;
|
|
21
21
|
const runUi = Observability.createRunUiObservationState();
|
|
22
22
|
const retirementAttempts = new Set();
|
|
23
|
-
const actorInspector =
|
|
23
|
+
const actorInspector = Inspector.createActorInspectorControllerState();
|
|
24
24
|
const getRunOwnerId = Pi.getSessionId;
|
|
25
25
|
const retireCandidateRuns = (ctx, summary) => {
|
|
26
26
|
void Observability.executeRunRetirements(summary, {
|
|
@@ -38,7 +38,7 @@ export default function toolRegistryExtension(pi) {
|
|
|
38
38
|
? () => ({
|
|
39
39
|
invalidate() { },
|
|
40
40
|
render(width) {
|
|
41
|
-
return
|
|
41
|
+
return Inspector.renderActorInspectorPanel({
|
|
42
42
|
stateRoot: Paths.EXTENSION_RUNTIME_PATHS.runStateRoot,
|
|
43
43
|
state: actorInspector,
|
|
44
44
|
ownerId,
|
|
@@ -126,28 +126,28 @@ export default function toolRegistryExtension(pi) {
|
|
|
126
126
|
recipeReload.close();
|
|
127
127
|
});
|
|
128
128
|
pi.registerCommand("actors-inspector-toggle", {
|
|
129
|
-
description:
|
|
129
|
+
description: Inspector.ACTOR_INSPECTOR_COMMAND_DESCRIPTIONS.toggle,
|
|
130
130
|
handler: async (args, ctx) => {
|
|
131
|
-
const result =
|
|
131
|
+
const result = Inspector.handleActorInspectorToggle(actorInspector, args);
|
|
132
132
|
if (result.update)
|
|
133
133
|
updateRunUi(ctx);
|
|
134
134
|
ctx.ui.notify(result.notify, result.type);
|
|
135
135
|
},
|
|
136
136
|
});
|
|
137
137
|
pi.registerCommand("actors-inspector-filter", {
|
|
138
|
-
description:
|
|
138
|
+
description: Inspector.ACTOR_INSPECTOR_COMMAND_DESCRIPTIONS.filter,
|
|
139
139
|
handler: async (args, ctx) => {
|
|
140
|
-
const result =
|
|
140
|
+
const result = Inspector.handleActorInspectorFilter(actorInspector, args);
|
|
141
141
|
if (result.update)
|
|
142
142
|
updateRunUi(ctx);
|
|
143
143
|
ctx.ui.notify(result.notify, result.type);
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
146
|
pi.registerCommand("actors-inspect", {
|
|
147
|
-
description:
|
|
147
|
+
description: Inspector.ACTOR_INSPECTOR_COMMAND_DESCRIPTIONS.inspect,
|
|
148
148
|
handler: async (args, ctx) => {
|
|
149
|
-
const previews =
|
|
150
|
-
const result =
|
|
149
|
+
const previews = Inspector.readActorInspectorPreviews(Paths.EXTENSION_RUNTIME_PATHS.runStateRoot, actorInspector.rows, Inspector.getActorInspectorPreviewOptions(actorInspector, getRunOwnerId(ctx)));
|
|
150
|
+
const result = Inspector.handleActorInspectorInspect(actorInspector, args, previews);
|
|
151
151
|
if (result.update)
|
|
152
152
|
updateRunUi(ctx);
|
|
153
153
|
ctx.ui.notify(result.notify, result.type);
|
package/dist/lib/async-runs.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Command-template async run
|
|
3
|
-
*
|
|
4
|
-
* Owns detached run state, observation, log tailing, listing, and cancellation safety
|
|
2
|
+
* Command-template async run lifecycle facade.
|
|
3
|
+
* Owns launch, state observation, listing, message/control facade methods, and retention while runs-* subdomains own narrower run internals.
|
|
5
4
|
*/
|
|
6
5
|
import type { CommandTemplateFailureScope, CommandTemplateValue } from "./command-templates.ts";
|
|
7
|
-
import * as
|
|
6
|
+
import * as RecipesReferences from "./recipes-references.ts";
|
|
7
|
+
import { type RunArtifactDeclaration } from "./runs-artifacts.ts";
|
|
8
|
+
import { type RunOutboxEvent } from "./runs-outbox.ts";
|
|
9
|
+
import * as RunsIndex from "./runs-index.ts";
|
|
10
|
+
import { type ProcessRunInboxResult, type RunInboxMessage, type RunInboxStatus } from "./runs-mailbox.ts";
|
|
11
|
+
import { type SendRunMessageOptions } from "./runs-messages.ts";
|
|
8
12
|
export type AsyncRunLaunchSource = "spawn" | "tool";
|
|
9
13
|
export interface AsyncRunControlEndpoint {
|
|
10
14
|
path: string;
|
|
@@ -30,7 +34,7 @@ export interface AsyncRunStartParams {
|
|
|
30
34
|
delay?: number | string;
|
|
31
35
|
output?: string;
|
|
32
36
|
artifacts?: Record<string, RunArtifactDeclaration>;
|
|
33
|
-
mailbox?:
|
|
37
|
+
mailbox?: RecipesReferences.TemplateRecipeMailbox;
|
|
34
38
|
retire_when?: "children_terminal";
|
|
35
39
|
retry?: number | string;
|
|
36
40
|
failure?: CommandTemplateFailureScope;
|
|
@@ -41,26 +45,6 @@ export interface AsyncRunStartParams {
|
|
|
41
45
|
cwd?: string;
|
|
42
46
|
}
|
|
43
47
|
export type AsyncRunStatus = "running" | "done" | "failed" | "exited" | "cancelled" | "killed";
|
|
44
|
-
export type RunOutboxDelivery = "log" | "notify" | "followup";
|
|
45
|
-
export type RunOutboxLevel = "info" | "warning" | "error";
|
|
46
|
-
export interface RunOutboxEvent {
|
|
47
|
-
body?: unknown;
|
|
48
|
-
correlation_id?: string;
|
|
49
|
-
data?: unknown;
|
|
50
|
-
delivery: RunOutboxDelivery;
|
|
51
|
-
event: string;
|
|
52
|
-
from?: string;
|
|
53
|
-
id: string;
|
|
54
|
-
level: RunOutboxLevel;
|
|
55
|
-
metadata?: Record<string, unknown>;
|
|
56
|
-
reply_to?: string;
|
|
57
|
-
run: string;
|
|
58
|
-
state_dir: string;
|
|
59
|
-
summary: string;
|
|
60
|
-
to?: string;
|
|
61
|
-
ts: string;
|
|
62
|
-
type?: string;
|
|
63
|
-
}
|
|
64
48
|
export interface AsyncRunMeta {
|
|
65
49
|
argv: string[];
|
|
66
50
|
createdAt: string;
|
|
@@ -78,54 +62,25 @@ export interface AsyncRunMeta {
|
|
|
78
62
|
values: Record<string, unknown>;
|
|
79
63
|
artifacts?: Record<string, RunArtifactDeclaration>;
|
|
80
64
|
control?: AsyncRunControlEndpoint;
|
|
81
|
-
mailbox?:
|
|
82
|
-
recipe_context_records?:
|
|
65
|
+
mailbox?: RecipesReferences.TemplateRecipeMailbox;
|
|
66
|
+
recipe_context_records?: RecipesReferences.TemplateRecipeContextRecord[];
|
|
83
67
|
retire_when?: "children_terminal";
|
|
84
68
|
}
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
media_type?: string;
|
|
89
|
-
required?: boolean;
|
|
90
|
-
};
|
|
91
|
-
export interface RunArtifactManifestEntry {
|
|
92
|
-
exists: boolean;
|
|
93
|
-
kind?: string;
|
|
94
|
-
media_type?: string;
|
|
95
|
-
path: string;
|
|
96
|
-
required?: boolean;
|
|
97
|
-
sha256?: string;
|
|
98
|
-
size?: number;
|
|
99
|
-
}
|
|
100
|
-
export declare function resolveArtifactManifest(artifacts: Record<string, RunArtifactDeclaration> | undefined): Record<string, RunArtifactManifestEntry> | undefined;
|
|
69
|
+
export { safeRunId } from "./runs-identity.ts";
|
|
70
|
+
export { resolveArtifactManifest } from "./runs-artifacts.ts";
|
|
71
|
+
export type { RunArtifactDeclaration, RunArtifactManifestEntry, } from "./runs-artifacts.ts";
|
|
101
72
|
export declare function startRun(params: AsyncRunStartParams, cwd: string): AsyncRunMeta;
|
|
102
|
-
export
|
|
73
|
+
export { parseRunOutboxEventLine } from "./runs-outbox.ts";
|
|
74
|
+
export type { RunOutboxDelivery, RunOutboxEvent, RunOutboxLevel, } from "./runs-outbox.ts";
|
|
103
75
|
export declare function getRunStatus(runOrDir: string): Record<string, unknown>;
|
|
104
|
-
export
|
|
105
|
-
ownerId?: string;
|
|
106
|
-
recipe?: string;
|
|
107
|
-
run: string;
|
|
108
|
-
state_dir: string;
|
|
109
|
-
status: AsyncRunStatus;
|
|
110
|
-
tool?: string;
|
|
111
|
-
updated_at?: string;
|
|
112
|
-
}
|
|
76
|
+
export type { RunStateIndexEntry } from "./runs-index.ts";
|
|
113
77
|
export declare function listRunStateDirs(stateRoot?: string, depth?: number, seen?: Set<string>): string[];
|
|
114
|
-
export declare function rebuildRunStateIndex(stateRoot?: string): RunStateIndexEntry[];
|
|
115
|
-
export declare function readRunStateIndex(stateRoot?: string): RunStateIndexEntry[] | undefined;
|
|
78
|
+
export declare function rebuildRunStateIndex(stateRoot?: string): RunsIndex.RunStateIndexEntry[];
|
|
79
|
+
export declare function readRunStateIndex(stateRoot?: string): RunsIndex.RunStateIndexEntry[] | undefined;
|
|
116
80
|
export declare function listRuns(stateRoot?: string, statusFilter?: string): Array<Record<string, unknown>>;
|
|
117
81
|
export declare function tailRun(runOrDir: string, lines?: number): string;
|
|
118
82
|
export declare function readRunEvents(runOrDir: string, lines?: number): RunOutboxEvent[];
|
|
119
|
-
export type
|
|
120
|
-
export type RunInboxMessage = Record<string, unknown> & {
|
|
121
|
-
id?: string;
|
|
122
|
-
status?: RunInboxStatus | string;
|
|
123
|
-
};
|
|
124
|
-
export interface ProcessRunInboxResult {
|
|
125
|
-
claimed: number;
|
|
126
|
-
failed: number;
|
|
127
|
-
handled: number;
|
|
128
|
-
}
|
|
83
|
+
export type { ProcessRunInboxResult, RunInboxMessage, RunInboxStatus, } from "./runs-mailbox.ts";
|
|
129
84
|
export declare function readRunInboxMessages(runOrDir: string, lines?: number): RunInboxMessage[];
|
|
130
85
|
export declare function updateRunInboxMessageStatus(runOrDir: string, id: string, nextStatus: RunInboxStatus, metadata?: Record<string, unknown>): boolean;
|
|
131
86
|
export declare function claimRunInboxMessage(runOrDir: string, owner?: string, statuses?: string[]): RunInboxMessage | undefined;
|
|
@@ -148,17 +103,10 @@ export declare function appendRunOutboxEvent(runOrDir: string, event: {
|
|
|
148
103
|
to?: string;
|
|
149
104
|
type?: string;
|
|
150
105
|
}): Record<string, unknown>;
|
|
151
|
-
export
|
|
152
|
-
namedPipeSend?: (path: string, payload: string) => Promise<number>;
|
|
153
|
-
platform?: NodeJS.Platform;
|
|
154
|
-
}
|
|
106
|
+
export type { SendRunMessageOptions } from "./runs-messages.ts";
|
|
155
107
|
export declare function sendRunMessage(runOrDir: string, message: string, options?: SendRunMessageOptions): Promise<Record<string, unknown>>;
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
command?: string;
|
|
159
|
-
signalTarget: "processGroup" | "process" | "processTree";
|
|
160
|
-
}
|
|
161
|
-
export declare function getRunProcessSignalPlan(pid: number, signal: NodeJS.Signals, runtimePlatform?: NodeJS.Platform): RunProcessSignalPlan;
|
|
108
|
+
export { getRunProcessSignalPlan } from "./runs-control.ts";
|
|
109
|
+
export type { RunProcessSignalPlan } from "./runs-control.ts";
|
|
162
110
|
export declare function cancelRun(runOrDir: string): Record<string, unknown>;
|
|
163
111
|
export declare function archiveRun(runOrDir: string): Record<string, unknown>;
|
|
164
112
|
export declare function pruneRun(runOrDir: string, options?: {
|