@llblab/pi-actors 0.19.11 → 0.20.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 +1 -1
- package/CHANGELOG.md +14 -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 +33 -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/lib/paths.ts +5 -1
- package/package.json +5 -2
- package/scripts/async-runner.mjs +8 -12
- package/scripts/validate-recipe.mjs +9 -13
- 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/lib/paths.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Owns agent directory, tools config, recipe root, and actor run state root resolution
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
7
8
|
import { homedir } from "node:os";
|
|
8
9
|
import { dirname, join, resolve } from "node:path";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -36,5 +37,8 @@ export function getRecipeRoot(agentDir = getAgentDir()): string {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export function getPackagedRecipeRoot(): string {
|
|
39
|
-
|
|
40
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
const compiledRoot = resolve(here, "..", "..", "recipes");
|
|
42
|
+
if (existsSync(compiledRoot)) return compiledRoot;
|
|
43
|
+
return resolve(here, "..", "recipes");
|
|
40
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llblab/pi-actors",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Local Actor Kernel for Pi",
|
|
6
6
|
"keywords": [
|
|
@@ -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,7 +11,7 @@
|
|
|
11
11
|
* Keep orchestration policy out of this file.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { appendFileSync,
|
|
14
|
+
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
15
15
|
import { dirname, join } from "node:path";
|
|
16
16
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
17
|
|
|
@@ -25,22 +25,18 @@ function scriptFile() {
|
|
|
25
25
|
return fileURLToPath(import.meta.url);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function packageRoot() {
|
|
29
|
+
return dirname(dirname(scriptFile()));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const copiedLib = join(stateDir, ".type-strip-lib");
|
|
37
|
-
if (!existsSync(copiedLib)) cpSync(sourceLib, copiedLib, { recursive: true });
|
|
38
|
-
return copiedLib;
|
|
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`);
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
const typeStripImportRoot = prepareTypeStripImportRoot();
|
|
42
38
|
async function importLib(name) {
|
|
43
|
-
return import(pathToFileURL(
|
|
39
|
+
return import(pathToFileURL(libModulePath(name)).href);
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
const { executeRegisteredTool } = await importLib("execution");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --experimental-strip-types
|
|
2
|
-
import {
|
|
3
|
-
import { homedir
|
|
2
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
|
|
@@ -8,22 +8,18 @@ function scriptFile() {
|
|
|
8
8
|
return fileURLToPath(import.meta.url);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function packageRoot() {
|
|
12
|
+
return dirname(dirname(scriptFile()));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const copiedLib = join(mkdtempSync(join(tmpdir(), "pi-actors-validate-lib-")), "lib");
|
|
20
|
-
cpSync(sourceLib, copiedLib, { recursive: true });
|
|
21
|
-
return copiedLib;
|
|
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`);
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
const typeStripImportRoot = prepareTypeStripImportRoot();
|
|
25
21
|
const { readResolvedRecipeConfig } = await import(
|
|
26
|
-
pathToFileURL(
|
|
22
|
+
pathToFileURL(libModulePath("recipe-references")).href
|
|
27
23
|
);
|
|
28
24
|
|
|
29
25
|
function 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.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
package/skills/swarm/SKILL.md
CHANGED