@llblab/pi-actors 0.50.0 → 0.52.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 (49) hide show
  1. package/AGENTS.md +5 -3
  2. package/BACKLOG.md +1 -1
  3. package/CHANGELOG.md +15 -0
  4. package/README.md +5 -3
  5. package/dist/index.js +4 -1
  6. package/dist/lib/async-runs.d.ts +2 -2
  7. package/dist/lib/async-runs.js +42 -19
  8. package/dist/lib/extension-runtime.d.ts +2 -1
  9. package/dist/lib/extension-runtime.js +7 -2
  10. package/dist/lib/limits.d.ts +9 -0
  11. package/dist/lib/limits.js +9 -0
  12. package/dist/lib/observability.d.ts +10 -11
  13. package/dist/lib/observability.js +81 -56
  14. package/dist/lib/pi.d.ts +31 -0
  15. package/dist/lib/pi.js +180 -0
  16. package/dist/lib/run-delivery.d.ts +115 -0
  17. package/dist/lib/run-delivery.js +623 -0
  18. package/dist/lib/run-ui-runtime.d.ts +3 -0
  19. package/dist/lib/run-ui-runtime.js +341 -13
  20. package/dist/lib/runs-trace.d.ts +1 -1
  21. package/dist/lib/runs-trace.js +5 -3
  22. package/dist/lib/session-evidence.d.ts +16 -0
  23. package/dist/lib/session-evidence.js +143 -0
  24. package/dist/lib/temp.js +1 -1
  25. package/dist/lib/tools-inspect.js +3 -1
  26. package/dist/scripts/async-runner.mjs +5 -19
  27. package/dist/skills/actors/SKILL.md +2 -2
  28. package/dist/skills/actors/references/runs.md +1 -1
  29. package/dist/skills/swarm/SKILL.md +1 -1
  30. package/docs/README.md +1 -0
  31. package/docs/async-runs.md +8 -4
  32. package/docs/coordinator-delivery.md +207 -0
  33. package/index.ts +4 -1
  34. package/lib/async-runs.ts +42 -21
  35. package/lib/extension-runtime.ts +8 -3
  36. package/lib/limits.ts +9 -0
  37. package/lib/observability.ts +97 -78
  38. package/lib/pi.ts +210 -0
  39. package/lib/run-delivery.ts +800 -0
  40. package/lib/run-ui-runtime.ts +370 -18
  41. package/lib/runs-trace.ts +6 -4
  42. package/lib/session-evidence.ts +153 -0
  43. package/lib/temp.ts +1 -1
  44. package/lib/tools-inspect.ts +4 -1
  45. package/package.json +3 -3
  46. package/scripts/async-runner.mjs +5 -19
  47. package/skills/actors/SKILL.md +2 -2
  48. package/skills/actors/references/runs.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.50.0",
3
+ "version": "0.52.0",
4
4
  "private": false,
5
5
  "description": "Local Actor Kernel for Pi",
6
6
  "keywords": [
@@ -66,8 +66,8 @@
66
66
  "image": "https://raw.githubusercontent.com/llblab/pi-actors/main/banner.jpg"
67
67
  },
68
68
  "peerDependencies": {
69
- "@earendil-works/pi-coding-agent": "*",
70
- "@earendil-works/pi-tui": "*"
69
+ "@earendil-works/pi-coding-agent": ">=0.84.4",
70
+ "@earendil-works/pi-tui": ">=0.84.4"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/node": "latest",
@@ -284,9 +284,6 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
284
284
  complete_allowed: missing.length === 0,
285
285
  };
286
286
  }
287
- function getCommandDoneDelivery(result) {
288
- return result.code !== 0 || activeSubagents > 0 ? "followup" : "log";
289
- }
290
287
  function progressRunning() {
291
288
  progress("running", {
292
289
  activeSubagents,
@@ -433,21 +430,6 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
433
430
  ...(preflightDiagnostic ? { preflight: preflightDiagnostic } : {}),
434
431
  });
435
432
  }
436
- event("command.done", {
437
- activeSubagents,
438
- command_id: commandId,
439
- code: result.code,
440
- command: commandDetail,
441
- killed: result.killed,
442
- ...captureDetails(result),
443
- ...(materialized.promptFile ? { prompt_file: materialized.promptFile } : {}),
444
- ...(materialized.promptBytes ? { prompt_bytes: materialized.promptBytes } : {}),
445
- ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir).replaceAll("\\", "/") } : {}),
446
- ...(commandSessionFiles(session.sessionDir).length > 0
447
- ? { session_files: commandSessionFiles(session.sessionDir) }
448
- : {}),
449
- ...(preflightDiagnostic ? { preflight: preflightDiagnostic } : {}),
450
- });
451
433
  observation(
452
434
  "command.done",
453
435
  `Command ${summarizeCommandDetail(commandDetail)} completed with code ${result.code}`,
@@ -462,9 +444,13 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
462
444
  ...captureDetails(result),
463
445
  ...(materialized.promptFile ? { prompt_file: materialized.promptFile } : {}),
464
446
  ...(materialized.promptBytes ? { prompt_bytes: materialized.promptBytes } : {}),
447
+ ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir).replaceAll("\\", "/") } : {}),
448
+ ...(commandSessionFiles(session.sessionDir).length > 0
449
+ ? { session_files: commandSessionFiles(session.sessionDir) }
450
+ : {}),
465
451
  ...(preflightDiagnostic ? { preflight: preflightDiagnostic } : {}),
466
452
  },
467
- getCommandDoneDelivery(result),
453
+ "log",
468
454
  result.code === 0 ? "info" : "error",
469
455
  );
470
456
  progressRunning();
@@ -85,7 +85,7 @@ There are two distinct multi-instance shapes:
85
85
 
86
86
  In host-coordinator mode, the top-level agent receives declarative outcomes, preserves user authority and global context, delegates bounded concrete execution, and owns integration plus final validation. It is not merely another worker after delegation begins. One bounded implementation worker normally runs with reasoning off; consequential output receives a separate reasoning-enabled review. Several independent participants or reviewers additionally use `swarm`.
87
87
 
88
- Delegation is not mandatory for every prompt. Work inline when one short bounded act has one natural validation boundary and spawning would add more coordination than isolation, latency hiding, clean context, or continued coordinator availability can repay. For admitted delegation, prefer terminal follow-up and durable Trace/artifacts; inspect on meaningful attention, operator request, or an evidence-based overdue timer rather than busy polling.
88
+ Delegation is not mandatory for every prompt. Work inline when one short bounded act has one natural validation boundary and spawning would add more coordination than isolation, latency hiding, clean context, or continued coordinator availability can repay. For admitted delegation, prefer the settled completion batch and durable Trace/artifacts; inspect on meaningful attention, operator request, or an evidence-based overdue timer rather than busy polling. Treat `attention: "steer"` as an actor-authored urgent semantic checkpoint at Pi's next safe boundary, never as a status-derived completion signal; the later root terminal still arrives through its ordinary completion batch.
89
89
 
90
90
  ## Run workflow
91
91
 
@@ -97,7 +97,7 @@ Run = Recipe + Trace + Control
97
97
  ```
98
98
 
99
99
  1. Spawn with the exact logical Recipe identity and caller-owned values.
100
- 2. Retain the returned `run:<id>` and normally wait for terminal follow-up instead of polling.
100
+ 2. Retain the returned `run:<id>` and normally wait for its settled completion batch instead of polling.
101
101
  3. Inspect `view=trace` when retained observations or attention matter.
102
102
  4. Inspect `view=control` before diagnosing service readiness, stale work, or saturation.
103
103
  5. Send `message` only for an action declared and consumed by that controlled Recipe.
@@ -14,7 +14,7 @@ A rare Skill Recipe may declare `singleton: true`. Do not pass `as`: the runtime
14
14
 
15
15
  ## Observe
16
16
 
17
- Normally wait for terminal follow-up. Inspect only when requested, when meaningful attention arrives, or when the Run is overdue or blocked:
17
+ Normally wait for the settled completion batch. Inspect only when requested, when meaningful attention arrives, or when the Run is overdue or blocked:
18
18
 
19
19
  ```text
20
20
  inspect target=run:<id> view=recipe
@@ -15,7 +15,7 @@ A swarm can be coordinated without an external gateway. In this model the curren
15
15
 
16
16
  This resembles gateway orchestration in dependency direction but not in ownership: the coordinator is itself an agent instance with inspectable Runs, not an infrastructure service that implicitly creates sessions. Preserve that distinction in prompts, docs, recovery, and target routing.
17
17
 
18
- Once work is delegated, keep the coordinator available for decisions and integration instead of duplicating participant implementation. Wait for terminal follow-up by default; use meaningful attention or evidence-based timers for overdue work rather than a tight inspection loop.
18
+ Once work is delegated, keep the coordinator available for decisions and integration instead of duplicating participant implementation. Wait for the settled completion batch by default; use meaningful attention or evidence-based timers for overdue work rather than a tight inspection loop.
19
19
 
20
20
  ## Reasoning allocation
21
21