@llblab/pi-actors 0.42.0 → 0.42.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.
Files changed (49) hide show
  1. package/BACKLOG.md +1 -5
  2. package/CHANGELOG.md +10 -0
  3. package/README.md +2 -0
  4. package/dist/lib/async-runs.d.ts +12 -0
  5. package/dist/lib/async-runs.js +46 -5
  6. package/dist/lib/command-templates.js +1 -1
  7. package/dist/lib/inspector-overlay.d.ts +4 -1
  8. package/dist/lib/inspector-overlay.js +71 -15
  9. package/dist/lib/inspector.js +1 -1
  10. package/dist/lib/observability.d.ts +12 -0
  11. package/dist/lib/observability.js +149 -5
  12. package/dist/lib/runs-control.d.ts +2 -0
  13. package/dist/lib/runs-control.js +14 -1
  14. package/dist/lib/runs-ownership.js +17 -3
  15. package/dist/lib/runs-process.js +4 -3
  16. package/dist/lib/runs-start.js +1 -0
  17. package/dist/lib/runs-status.js +3 -0
  18. package/dist/lib/tools-inspect.js +2 -1
  19. package/dist/lib/tools-local.js +17 -2
  20. package/dist/lib/tools-spawn.js +10 -1
  21. package/dist/scripts/async-runner.mjs +9 -9
  22. package/dist/scripts/build-dist.mjs +6 -1
  23. package/dist/scripts/conformance.mjs +6 -1
  24. package/dist/scripts/recipe-utils.mjs +3 -3
  25. package/dist/skills/actors/SKILL.md +1 -1
  26. package/dist/skills/swarm/SKILL.md +1 -1
  27. package/docs/actor-inspector.md +1 -1
  28. package/docs/async-runs.md +7 -1
  29. package/docs/tool-registry.md +2 -0
  30. package/lib/async-runs.ts +65 -5
  31. package/lib/command-templates.ts +1 -1
  32. package/lib/inspector-overlay.ts +67 -15
  33. package/lib/inspector.ts +1 -1
  34. package/lib/observability.ts +180 -4
  35. package/lib/runs-control.ts +20 -1
  36. package/lib/runs-ownership.ts +22 -3
  37. package/lib/runs-process.ts +4 -3
  38. package/lib/runs-start.ts +1 -0
  39. package/lib/runs-status.ts +5 -0
  40. package/lib/tools-inspect.ts +2 -1
  41. package/lib/tools-local.ts +21 -2
  42. package/lib/tools-spawn.ts +14 -1
  43. package/package.json +4 -3
  44. package/scripts/async-runner.mjs +9 -9
  45. package/scripts/build-dist.mjs +6 -1
  46. package/scripts/conformance.mjs +6 -1
  47. package/scripts/recipe-utils.mjs +3 -3
  48. package/skills/actors/SKILL.md +1 -1
  49. package/skills/swarm/SKILL.md +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-actors",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "private": false,
5
5
  "description": "Local Actor Kernel for Pi",
6
6
  "keywords": [
@@ -27,11 +27,12 @@
27
27
  "scripts": {
28
28
  "check": "node --experimental-strip-types -e \"await import('./index.ts'); console.log('pi-actors: extension import ok')\"",
29
29
  "conformance": "node scripts/conformance.mjs",
30
- "test": "node --experimental-strip-types --test tests/*.test.ts",
30
+ "test": "node --experimental-strip-types --test --test-concurrency=1 tests/*.test.ts",
31
31
  "pack:dry": "npm pack --dry-run",
32
32
  "recipes:qa": "node scripts/validate-recipe.mjs recipes --all --qa --summary",
33
33
  "release:validate": "npm run validate && node scripts/release-gates.mjs",
34
- "validate": "npx tsc --noEmit && npm run recipes:qa && npm run build && npm run check && npm test && npm run conformance && npm audit --audit-level=high && npm run pack:dry",
34
+ "validate": "npx tsc --noEmit && npm run recipes:qa && npm run build && npm run check && npm test && npm run conformance && npm run pack:dry",
35
+ "audit:dependencies": "npm audit --audit-level=high --omit=peer",
35
36
  "build": "node scripts/build-dist.mjs",
36
37
  "prepack": "npm run build"
37
38
  },
@@ -135,7 +135,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
135
135
  try {
136
136
  return readdirSync(sessionDir, { withFileTypes: true })
137
137
  .filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl"))
138
- .map((entry) => relative(stateDir, join(sessionDir, entry.name)))
138
+ .map((entry) => relative(stateDir, join(sessionDir, entry.name)).replaceAll("\\", "/"))
139
139
  .sort();
140
140
  } catch {
141
141
  return [];
@@ -167,12 +167,12 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
167
167
  ...(recipeContext ? { recipe_context: recipeContext } : {}),
168
168
  command: commandDetail,
169
169
  ...(materialized.promptFile
170
- ? { prompt_file: relative(stateDir, materialized.promptFile) }
170
+ ? { prompt_file: relative(stateDir, materialized.promptFile).replaceAll("\\", "/") }
171
171
  : {}),
172
172
  ...(materialized.promptBytes
173
173
  ? { prompt_bytes: materialized.promptBytes }
174
174
  : {}),
175
- ...(sessionDir ? { session_dir: relative(stateDir, sessionDir) } : {}),
175
+ ...(sessionDir ? { session_dir: relative(stateDir, sessionDir).replaceAll("\\", "/") } : {}),
176
176
  attempts: [],
177
177
  semantic_acceptance:
178
178
  options?.evidenceContext?.acceptOutput === "review_evidence" ||
@@ -209,11 +209,11 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
209
209
  attempts.push({
210
210
  attempt,
211
211
  stdout: {
212
- path: relative(stateDir, stdoutFile),
212
+ path: relative(stateDir, stdoutFile).replaceAll("\\", "/"),
213
213
  bytes: existsSync(stdoutFile) ? statSync(stdoutFile).size : 0,
214
214
  },
215
215
  stderr: {
216
- path: relative(stateDir, stderrFile),
216
+ path: relative(stateDir, stderrFile).replaceAll("\\", "/"),
217
217
  bytes: existsSync(stderrFile) ? statSync(stderrFile).size : 0,
218
218
  },
219
219
  });
@@ -248,12 +248,12 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
248
248
  ...(recipeContext ? { recipe_context: recipeContext } : {}),
249
249
  command: commandDetail,
250
250
  ...(materialized.promptFile
251
- ? { prompt_file: relative(stateDir, materialized.promptFile) }
251
+ ? { prompt_file: relative(stateDir, materialized.promptFile).replaceAll("\\", "/") }
252
252
  : {}),
253
253
  ...(materialized.promptBytes
254
254
  ? { prompt_bytes: materialized.promptBytes }
255
255
  : {}),
256
- ...(sessionDir ? { session_dir: relative(stateDir, sessionDir) } : {}),
256
+ ...(sessionDir ? { session_dir: relative(stateDir, sessionDir).replaceAll("\\", "/") } : {}),
257
257
  ...(commandSessionFiles(sessionDir).length > 0
258
258
  ? { session_files: commandSessionFiles(sessionDir) }
259
259
  : {}),
@@ -386,7 +386,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
386
386
  command: commandDetail,
387
387
  ...(materialized.promptFile ? { prompt_file: materialized.promptFile } : {}),
388
388
  ...(materialized.promptBytes ? { prompt_bytes: materialized.promptBytes } : {}),
389
- ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir) } : {}),
389
+ ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir).replaceAll("\\", "/") } : {}),
390
390
  });
391
391
  progressRunning();
392
392
  const captureDir = join(stateDir, "captures", commandId);
@@ -457,7 +457,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
457
457
  ...captureDetails(result),
458
458
  ...(materialized.promptFile ? { prompt_file: materialized.promptFile } : {}),
459
459
  ...(materialized.promptBytes ? { prompt_bytes: materialized.promptBytes } : {}),
460
- ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir) } : {}),
460
+ ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir).replaceAll("\\", "/") } : {}),
461
461
  ...(commandSessionFiles(session.sessionDir).length > 0
462
462
  ? { session_files: commandSessionFiles(session.sessionDir) }
463
463
  : {}),
@@ -20,13 +20,18 @@ import { join } from "node:path";
20
20
 
21
21
  function run(command, args) {
22
22
  const result = spawnSync(command, args, { stdio: "inherit" });
23
+ if (result.error) throw result.error;
23
24
  if (result.status !== 0) process.exit(result.status ?? 1);
24
25
  }
25
26
 
26
27
  rmSync("dist", { recursive: true, force: true });
27
28
  mkdirSync("dist", { recursive: true });
28
29
 
29
- run("tsc", ["-p", "tsconfig.build.json"]);
30
+ run(process.execPath, [
31
+ join("node_modules", "typescript", "bin", "tsc"),
32
+ "-p",
33
+ "tsconfig.build.json",
34
+ ]);
30
35
 
31
36
  mkdirSync(join("dist", "pi-actors"), { recursive: true });
32
37
  writeFileSync(
@@ -28,7 +28,12 @@ function packageRoot() {
28
28
 
29
29
  const result = spawnSync(
30
30
  process.execPath,
31
- ["--experimental-strip-types", "--test", ...conformanceSuites],
31
+ [
32
+ "--experimental-strip-types",
33
+ "--test",
34
+ "--test-concurrency=1",
35
+ ...conformanceSuites,
36
+ ],
32
37
  { cwd: packageRoot(), encoding: "utf8", stdio: "pipe" },
33
38
  );
34
39
 
@@ -16,7 +16,7 @@ import {
16
16
  statSync,
17
17
  writeFileSync,
18
18
  } from "node:fs";
19
- import { dirname, extname, join, relative, resolve } from "node:path";
19
+ import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
20
20
 
21
21
  function usage() {
22
22
  console.error(`Usage:
@@ -101,7 +101,7 @@ function collectRunSummary(rootValue) {
101
101
  const root = resolve(
102
102
  rootValue.replace(/^~(?=\/|$)/, process.env.HOME ?? "~"),
103
103
  );
104
- const files = walkFiles(root, 2).filter((file) => file.endsWith("/run.json"));
104
+ const files = walkFiles(root, 2).filter((file) => basename(file) === "run.json");
105
105
  const rows = [];
106
106
  for (const file of files) {
107
107
  const run = readJson(file);
@@ -118,7 +118,7 @@ function collectRunSummary(rootValue) {
118
118
  const progress = readJson(join(runDir, "progress.json"));
119
119
  const result = readJson(join(runDir, "result.json"));
120
120
  rows.push({
121
- run: run.run_id ?? run.run ?? relative(root, file).split("/")[0],
121
+ run: run.run_id ?? run.run ?? relative(root, file).split(sep)[0],
122
122
  status: getRunStatus(run, progress, result),
123
123
  recipe: run.recipe ?? run.recipe_file ?? "",
124
124
  updated:
@@ -2,7 +2,7 @@
2
2
  name: actors
3
3
  description: Required practical guide for non-trivial pi-actors use, including parallel actor launches, subagent fanout, and autonomous coordinator workflows. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
4
4
  metadata:
5
- version: 0.42.0
5
+ version: 0.42.1
6
6
  ---
7
7
 
8
8
  # Actors (pi-actors)
@@ -2,7 +2,7 @@
2
2
  name: swarm
3
3
  description: Subagent and actor orchestration with scoped locks, fanout, and quorum consensus. Use before launching multiple parallel actors or subagents for independent implementation, artifact generation, review, delegated audit, coordinated execution, or any workflow that needs autonomous coordinator decomposition and integration.
4
4
  metadata:
5
- version: 0.42.0
5
+ version: 0.42.1
6
6
  ---
7
7
 
8
8
  # Swarm