@llblab/pi-actors 0.19.11 → 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.
Files changed (54) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +8 -0
  3. package/dist/lib/actor-inspector-tui.d.ts +55 -0
  4. package/dist/lib/actor-inspector-tui.js +559 -0
  5. package/dist/lib/actor-messages.d.ts +25 -0
  6. package/dist/lib/actor-messages.js +122 -0
  7. package/dist/lib/actor-recipe-context.d.ts +14 -0
  8. package/dist/lib/actor-recipe-context.js +79 -0
  9. package/dist/lib/actor-rooms.d.ts +81 -0
  10. package/dist/lib/actor-rooms.js +468 -0
  11. package/dist/lib/async-runs.d.ts +101 -0
  12. package/dist/lib/async-runs.js +612 -0
  13. package/dist/lib/command-templates.d.ts +70 -0
  14. package/dist/lib/command-templates.js +592 -0
  15. package/dist/lib/config.d.ts +34 -0
  16. package/dist/lib/config.js +226 -0
  17. package/dist/lib/execution.d.ts +63 -0
  18. package/dist/lib/execution.js +450 -0
  19. package/dist/lib/file-state.d.ts +6 -0
  20. package/dist/lib/file-state.js +25 -0
  21. package/dist/lib/identity.d.ts +9 -0
  22. package/dist/lib/identity.js +27 -0
  23. package/dist/lib/observability.d.ts +86 -0
  24. package/dist/lib/observability.js +534 -0
  25. package/dist/lib/output.d.ts +25 -0
  26. package/dist/lib/output.js +89 -0
  27. package/dist/lib/paths.d.ts +11 -0
  28. package/dist/lib/paths.js +28 -0
  29. package/dist/lib/prompts.d.ts +23 -0
  30. package/dist/lib/prompts.js +50 -0
  31. package/dist/lib/recipe-discovery.d.ts +50 -0
  32. package/dist/lib/recipe-discovery.js +317 -0
  33. package/dist/lib/recipe-migration.d.ts +21 -0
  34. package/dist/lib/recipe-migration.js +90 -0
  35. package/dist/lib/recipe-references.d.ts +67 -0
  36. package/dist/lib/recipe-references.js +542 -0
  37. package/dist/lib/recipe-usage.d.ts +6 -0
  38. package/dist/lib/recipe-usage.js +57 -0
  39. package/dist/lib/registry.d.ts +47 -0
  40. package/dist/lib/registry.js +222 -0
  41. package/dist/lib/runtime.d.ts +36 -0
  42. package/dist/lib/runtime.js +126 -0
  43. package/dist/lib/schema.d.ts +48 -0
  44. package/dist/lib/schema.js +355 -0
  45. package/dist/lib/temp.d.ts +10 -0
  46. package/dist/lib/temp.js +90 -0
  47. package/dist/lib/tools.d.ts +39 -0
  48. package/dist/lib/tools.js +982 -0
  49. package/lib/async-runs.ts +20 -4
  50. package/package.json +5 -2
  51. package/scripts/async-runner.mjs +8 -12
  52. package/scripts/validate-recipe.mjs +9 -13
  53. package/skills/actors/SKILL.md +1 -1
  54. 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
- const RUNNER_PATH = new URL("../scripts/async-runner.mjs", import.meta.url)
122
- .pathname;
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 = ["--experimental-strip-types", RUNNER_PATH, stateDir];
419
+ const argv = asyncRunnerArgv(stateDir);
404
420
  const values = {
405
421
  ...(startParams.values || {}),
406
422
  actor_address: `run:${run}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-actors",
3
- "version": "0.19.11",
3
+ "version": "0.20.0",
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",
@@ -11,7 +11,7 @@
11
11
  * Keep orchestration policy out of this file.
12
12
  */
13
13
 
14
- import { appendFileSync, cpSync, existsSync, readFileSync } from "node:fs";
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 isUnderNodeModules(file) {
29
- return /[/\\]node_modules[/\\]/.test(file);
28
+ function packageRoot() {
29
+ return dirname(dirname(scriptFile()));
30
30
  }
31
31
 
32
- function prepareTypeStripImportRoot() {
33
- const packageRoot = dirname(dirname(scriptFile()));
34
- const sourceLib = join(packageRoot, "lib");
35
- if (!isUnderNodeModules(packageRoot)) return sourceLib;
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(join(typeStripImportRoot, `${name}.ts`)).href);
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 { cpSync, existsSync, mkdtempSync, readdirSync, statSync } from "node:fs";
3
- import { homedir, tmpdir } from "node:os";
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 isUnderNodeModules(file) {
12
- return /[/\\]node_modules[/\\]/.test(file);
11
+ function packageRoot() {
12
+ return dirname(dirname(scriptFile()));
13
13
  }
14
14
 
15
- function prepareTypeStripImportRoot() {
16
- const packageRoot = dirname(dirname(scriptFile()));
17
- const sourceLib = join(packageRoot, "lib");
18
- if (!isUnderNodeModules(packageRoot)) return sourceLib;
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(join(typeStripImportRoot, "recipe-references.ts")).href
22
+ pathToFileURL(libModulePath("recipe-references")).href
27
23
  );
28
24
 
29
25
  function usage() {
@@ -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.19.11
5
+ version: 0.20.0
6
6
  ---
7
7
 
8
8
  # Actors (pi-actors)
@@ -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.19.11
5
+ version: 0.20.0
6
6
  ---
7
7
 
8
8
  # Swarm