@llblab/pi-actors 0.33.0 → 0.34.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 +22 -11
- package/BACKLOG.md +1 -1
- package/CHANGELOG.md +22 -1
- 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 +346 -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 +186 -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 +483 -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 +186 -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
|
@@ -187,5 +187,5 @@ These are valid ideas but not current focus. Reintroduce only with concrete evid
|
|
|
187
187
|
```text
|
|
188
188
|
Next milestone: M-15 Worker Stale-Claim Dogfood.
|
|
189
189
|
Then: M-17 Message Delivery Outcome Contract → M-18 Draft Recipe Promotion UX.
|
|
190
|
-
Small cleanup lane:
|
|
190
|
+
Small cleanup lane: continue opportunistic domain polish only when a real ownership boundary appears.
|
|
191
191
|
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.34.0: Actor Kernel Domain Compression
|
|
4
|
+
|
|
5
|
+
- `[Context]` Added a critical tools-domain split track and durable naming guidance: split broad buckets proactively, use `tool-<verb>.ts` for independent public agent-tool domains when deleting `tools.ts`, reserve `tools-<part>.ts` only for a retained `tools.ts` aggregate-root architecture, keep non-tool domains unprefixed, and avoid new `utils` or compatibility barrels when direct owned-domain imports work.
|
|
6
|
+
- `[Domains]` Started the `tools.ts` split by moving JSON schema builders into `schema.ts` and compact response helpers into the tool-family response path, reducing the remaining tool bucket to public tool composition rather than generic schema ownership.
|
|
7
|
+
- `[Domains]` Moved the public `message` actor tool behavior into `tools-message.ts`, including run controls, branch/room delivery, tool actor invocation, and compact delivery next actions.
|
|
8
|
+
- `[Domains]` Moved shared session ownership guards and normalized mismatch diagnostics into `tools-access.ts` so public tools can share one access contract without copying ownership checks.
|
|
9
|
+
- `[Domains]` Moved mailbox contract normalization and accepted/emitted type extraction into `tools-mailbox.ts`, removing duplicated mailbox metadata handling from message and inspect tool paths.
|
|
10
|
+
- `[Domains]` Added `tools-response.ts` for compact public tool responses and next-action rendering shared by spawn, inspect, and registered tool paths; moved recipe registry compact summaries and doctor/import next-action rendering into it.
|
|
11
|
+
- `[Domains]` Moved the public `inspect` actor tool behavior into `tools-inspect.ts`, including recipe registry inspection, room/session/tool/run views, and inspect-specific compact observation formatting.
|
|
12
|
+
- `[Domains]` Moved the public `spawn` actor tool behavior into `tools-spawn.ts`, including actor launch, draft recipe capture, shadowed recipe launch diagnostics, and spawn next-action feedback.
|
|
13
|
+
- `[Domains]` Removed the over-thin `tool-context.ts` extraction and kept tool execution context types local to the domains that use them.
|
|
14
|
+
- `[Domains]` Moved saved local capability execution into `tools-local.ts`, including generated schemas, argument usage hints, runtime value normalization, and async recipe launch behavior.
|
|
15
|
+
- `[Domains]` Moved public `register_tool` behavior into `tools-register.ts`, including the register schema and registry mutation bridge for persisted local capabilities.
|
|
16
|
+
- `[Domains]` Kept `tools.ts` as the public tool-family composition owner, moved decomposed behavior into `tools-*` subdomains, removed the redundant `actor-tools.ts` prefix because this package is already actor-scoped, and documented that any `tools-*` helper reused by non-tools domains must drop the prefix in the same slice.
|
|
17
|
+
- `[Domains]` Removed redundant internal `actor-` prefixes from core library domains: `inspector.ts`, `messages.ts`, `recipes-context.ts`, and `rooms.ts`; public recipe/script/docs names that intentionally expose actor terminology stay unchanged.
|
|
18
|
+
- `[Scripts]` Collapsed the one-off `run-executor.ts`, `worker.ts`, `validate-recipe.ts`, `recipe-utils.ts`, `locker.ts`, and `coordinator.ts` domains into their owning scripts; reusable lifecycle, room, mailbox, and recipe-reference primitives stay in `lib/`, while public scripts own their executable control loops directly.
|
|
19
|
+
- `[Domains]` Started decomposing the oversized `async-runs.ts` lifecycle aggregate into `runs-*` subdomains, moving artifact manifest handling to `runs-artifacts.ts`, durable run inbox locking/claim handling to `runs-mailbox.ts`, process-control signal helpers to `runs-control.ts`, outbox event parsing/payload formatting to `runs-outbox.ts`, run-state index discovery/rebuild logic to `runs-index.ts`, id normalization to `runs-identity.ts`, archive/prune retention behavior to `runs-retention.ts`, process identity/liveness checks to `runs-process.ts`, run message delivery to `runs-messages.ts`, status/log derivation to `runs-status.ts`, and start lock/reuse guards to `runs-start.ts` while preserving the `async-runs.ts` facade.
|
|
20
|
+
- `[Context]` Reversed the thin-script default: `scripts/*.mjs` should own script-only executable behavior, and behavior should move into `lib/` only for real non-script reuse or existing reusable domain ownership; packaging/tests/shim neatness alone no longer justify a lib domain.
|
|
21
|
+
- `[Context]` Polished domain ownership headers after the file moves so command templates, actor messages, rooms, recipe context, inspector previews, and mailbox loops describe their actual reasons to change without generic helper wording.
|
|
22
|
+
- `[Domains]` Renamed generic `output.ts` to `execution-output.ts` so registered-tool stdout/stderr truncation and temp artifact formatting are tied to the execution domain instead of a broad output bucket.
|
|
23
|
+
- `[Domains]` Renamed the recipe domain family from singular `recipe-*` to plural `recipes-*` (`recipes-references.ts`, `recipes-discovery.ts`, `recipes-usage.ts`, `recipes-context.ts`) to match the `tools-*` and `runs-*` family convention.
|
|
24
|
+
- `[Tests]` Extended installed-package contract coverage to assert stale renamed lib domains are absent from `dist/lib`, keeping packaged JS output aligned with the current domain names.
|
|
4
25
|
|
|
5
26
|
## 0.33.0: Signal-First Compatibility Pruning
|
|
6
27
|
|
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?: {
|