@llblab/pi-actors 0.19.10 → 0.20.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 +1 -1
- package/BACKLOG.md +40 -1
- package/CHANGELOG.md +15 -0
- package/dist/lib/actor-inspector-tui.d.ts +55 -0
- package/dist/lib/actor-inspector-tui.js +559 -0
- package/dist/lib/actor-messages.d.ts +25 -0
- package/dist/lib/actor-messages.js +122 -0
- package/dist/lib/actor-recipe-context.d.ts +14 -0
- package/dist/lib/actor-recipe-context.js +79 -0
- package/dist/lib/actor-rooms.d.ts +81 -0
- package/dist/lib/actor-rooms.js +468 -0
- package/dist/lib/async-runs.d.ts +101 -0
- package/dist/lib/async-runs.js +612 -0
- package/dist/lib/command-templates.d.ts +70 -0
- package/dist/lib/command-templates.js +592 -0
- package/dist/lib/config.d.ts +34 -0
- package/dist/lib/config.js +226 -0
- package/dist/lib/execution.d.ts +63 -0
- package/dist/lib/execution.js +450 -0
- package/dist/lib/file-state.d.ts +6 -0
- package/dist/lib/file-state.js +25 -0
- package/dist/lib/identity.d.ts +9 -0
- package/dist/lib/identity.js +27 -0
- package/dist/lib/observability.d.ts +86 -0
- package/dist/lib/observability.js +534 -0
- package/dist/lib/output.d.ts +25 -0
- package/dist/lib/output.js +89 -0
- package/dist/lib/paths.d.ts +11 -0
- package/dist/lib/paths.js +28 -0
- package/dist/lib/prompts.d.ts +23 -0
- package/dist/lib/prompts.js +50 -0
- package/dist/lib/recipe-discovery.d.ts +50 -0
- package/dist/lib/recipe-discovery.js +317 -0
- package/dist/lib/recipe-migration.d.ts +21 -0
- package/dist/lib/recipe-migration.js +90 -0
- package/dist/lib/recipe-references.d.ts +67 -0
- package/dist/lib/recipe-references.js +542 -0
- package/dist/lib/recipe-usage.d.ts +6 -0
- package/dist/lib/recipe-usage.js +57 -0
- package/dist/lib/registry.d.ts +47 -0
- package/dist/lib/registry.js +222 -0
- package/dist/lib/runtime.d.ts +36 -0
- package/dist/lib/runtime.js +126 -0
- package/dist/lib/schema.d.ts +48 -0
- package/dist/lib/schema.js +355 -0
- package/dist/lib/temp.d.ts +10 -0
- package/dist/lib/temp.js +90 -0
- package/dist/lib/tools.d.ts +39 -0
- package/dist/lib/tools.js +982 -0
- package/lib/async-runs.ts +20 -4
- package/package.json +6 -3
- package/scripts/async-runner.mjs +26 -6
- package/scripts/validate-recipe.mjs +19 -2
- package/skills/actors/SKILL.md +1 -1
- package/skills/swarm/SKILL.md +1 -1
package/lib/async-runs.ts
CHANGED
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
writeSync,
|
|
21
21
|
} from "node:fs";
|
|
22
22
|
import { platform } from "node:os";
|
|
23
|
-
import { basename, extname, join, resolve } from "node:path";
|
|
23
|
+
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
24
|
+
import { fileURLToPath } from "node:url";
|
|
24
25
|
|
|
25
26
|
import type {
|
|
26
27
|
CommandTemplateFailureScope,
|
|
@@ -118,8 +119,23 @@ export interface AsyncRunMeta {
|
|
|
118
119
|
|
|
119
120
|
const DEFAULT_STATE_ROOT = Paths.getRunStateRoot();
|
|
120
121
|
const DEFAULT_RECIPE_ROOT = Paths.getRecipeRoot();
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
|
|
123
|
+
function packageRoot(): string {
|
|
124
|
+
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
125
|
+
if (basename(moduleDir) === "lib" && basename(dirname(moduleDir)) === "dist") {
|
|
126
|
+
return dirname(dirname(moduleDir));
|
|
127
|
+
}
|
|
128
|
+
return dirname(moduleDir);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const PACKAGE_ROOT = packageRoot();
|
|
132
|
+
const RUNNER_PATH = join(PACKAGE_ROOT, "scripts", "async-runner.mjs");
|
|
133
|
+
|
|
134
|
+
function asyncRunnerArgv(stateDir: string): string[] {
|
|
135
|
+
return existsSync(join(PACKAGE_ROOT, "dist", "lib", "execution.js"))
|
|
136
|
+
? [RUNNER_PATH, stateDir]
|
|
137
|
+
: ["--experimental-strip-types", RUNNER_PATH, stateDir];
|
|
138
|
+
}
|
|
123
139
|
|
|
124
140
|
function safeRunId(value: string | undefined): string {
|
|
125
141
|
const run = (value || `run-${Date.now()}`).trim();
|
|
@@ -400,7 +416,7 @@ export function startRun(
|
|
|
400
416
|
}
|
|
401
417
|
const outFd = openSync(stdout, "a");
|
|
402
418
|
const errFd = openSync(stderr, "a");
|
|
403
|
-
const argv =
|
|
419
|
+
const argv = asyncRunnerArgv(stateDir);
|
|
404
420
|
const values = {
|
|
405
421
|
...(startParams.values || {}),
|
|
406
422
|
actor_address: `run:${run}`,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llblab/pi-actors",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "Actor
|
|
5
|
+
"description": "Local Actor Kernel for Pi",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"pi-package",
|
|
8
8
|
"pi-extension",
|
|
@@ -28,12 +28,15 @@
|
|
|
28
28
|
"check": "node --experimental-strip-types -e \"await import('./index.ts'); console.log('pi-actors: extension import ok')\"",
|
|
29
29
|
"test": "node --experimental-strip-types --test tests/*.test.ts",
|
|
30
30
|
"pack:dry": "npm pack --dry-run",
|
|
31
|
-
"validate": "npx tsc --noEmit && npm run check && npm test && npm run pack:dry"
|
|
31
|
+
"validate": "npx tsc --noEmit && npm run build && npm run check && npm test && npm run pack:dry",
|
|
32
|
+
"build": "tsc -p tsconfig.build.json",
|
|
33
|
+
"prepack": "npm run build"
|
|
32
34
|
},
|
|
33
35
|
"files": [
|
|
34
36
|
"index.ts",
|
|
35
37
|
"lib",
|
|
36
38
|
"scripts",
|
|
39
|
+
"dist",
|
|
37
40
|
"recipes",
|
|
38
41
|
"skills",
|
|
39
42
|
"README.md",
|
package/scripts/async-runner.mjs
CHANGED
|
@@ -11,18 +11,38 @@
|
|
|
11
11
|
* Keep orchestration policy out of this file.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { appendFileSync, readFileSync } from "node:fs";
|
|
15
|
-
import { join } from "node:path";
|
|
14
|
+
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
16
17
|
|
|
17
18
|
const stateDir = process.argv[2];
|
|
18
19
|
if (!stateDir) {
|
|
19
20
|
console.error("missing state dir");
|
|
20
21
|
process.exit(1);
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
function scriptFile() {
|
|
25
|
+
return fileURLToPath(import.meta.url);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function packageRoot() {
|
|
29
|
+
return dirname(dirname(scriptFile()));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function libModulePath(name) {
|
|
33
|
+
const root = packageRoot();
|
|
34
|
+
const compiled = join(root, "dist", "lib", `${name}.js`);
|
|
35
|
+
return existsSync(compiled) ? compiled : join(root, "lib", `${name}.ts`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function importLib(name) {
|
|
39
|
+
return import(pathToFileURL(libModulePath(name)).href);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const { executeRegisteredTool } = await importLib("execution");
|
|
43
|
+
const { execCommandTemplate } = await importLib("command-templates");
|
|
44
|
+
const { appendRecipeContextToPiArgs } = await importLib("actor-recipe-context");
|
|
45
|
+
const { writeJsonAtomic } = await importLib("file-state");
|
|
26
46
|
const runPath = join(stateDir, "run.json");
|
|
27
47
|
const progressPath = join(stateDir, "progress.json");
|
|
28
48
|
const resultPath = join(stateDir, "result.json");
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --experimental-strip-types
|
|
2
2
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { resolve } from "node:path";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
function scriptFile() {
|
|
8
|
+
return fileURLToPath(import.meta.url);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function packageRoot() {
|
|
12
|
+
return dirname(dirname(scriptFile()));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function libModulePath(name) {
|
|
16
|
+
const root = packageRoot();
|
|
17
|
+
const compiled = join(root, "dist", "lib", `${name}.js`);
|
|
18
|
+
return existsSync(compiled) ? compiled : join(root, "lib", `${name}.ts`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { readResolvedRecipeConfig } = await import(
|
|
22
|
+
pathToFileURL(libModulePath("recipe-references")).href
|
|
23
|
+
);
|
|
7
24
|
|
|
8
25
|
function usage() {
|
|
9
26
|
console.error(`Usage:
|
package/skills/actors/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: actors
|
|
3
3
|
description: Highest-density practical guide for pi-actors. Read this skill whenever prompt and tools are not enough for 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.20.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
package/skills/swarm/SKILL.md
CHANGED