@llblab/pi-actors 0.12.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 (86) hide show
  1. package/AGENTS.md +72 -0
  2. package/BACKLOG.md +38 -0
  3. package/CHANGELOG.md +179 -0
  4. package/README.md +338 -0
  5. package/docs/README.md +21 -0
  6. package/docs/actor-messages.md +149 -0
  7. package/docs/async-runs.md +335 -0
  8. package/docs/command-templates.md +424 -0
  9. package/docs/component-recipes.md +148 -0
  10. package/docs/recipe-library.md +176 -0
  11. package/docs/task-first-recipes.md +233 -0
  12. package/docs/template-recipes.md +285 -0
  13. package/docs/tool-registry.md +142 -0
  14. package/index.ts +198 -0
  15. package/lib/actor-messages.ts +120 -0
  16. package/lib/async-runs.ts +688 -0
  17. package/lib/command-templates.ts +795 -0
  18. package/lib/config.ts +266 -0
  19. package/lib/execution.ts +720 -0
  20. package/lib/file-state.ts +24 -0
  21. package/lib/identity.ts +29 -0
  22. package/lib/observability.ts +525 -0
  23. package/lib/output.ts +123 -0
  24. package/lib/paths.ts +35 -0
  25. package/lib/prompts.ts +75 -0
  26. package/lib/recipe-references.ts +586 -0
  27. package/lib/registry.ts +302 -0
  28. package/lib/runtime.ts +101 -0
  29. package/lib/schema.ts +402 -0
  30. package/lib/temp.ts +44 -0
  31. package/lib/tools.ts +651 -0
  32. package/package.json +52 -0
  33. package/recipes/music-player.json +25 -0
  34. package/recipes/pipeline-architect-coordinator.json +88 -0
  35. package/recipes/pipeline-artifact-report.json +52 -0
  36. package/recipes/pipeline-artifact-write.json +66 -0
  37. package/recipes/pipeline-async-run-ops.json +67 -0
  38. package/recipes/pipeline-checkpoint-continuation.json +57 -0
  39. package/recipes/pipeline-development-tasking.json +73 -0
  40. package/recipes/pipeline-docs-maintenance.json +72 -0
  41. package/recipes/pipeline-media-library.json +51 -0
  42. package/recipes/pipeline-quorum-review.json +72 -0
  43. package/recipes/pipeline-release-readiness.json +83 -0
  44. package/recipes/pipeline-repo-health.json +81 -0
  45. package/recipes/pipeline-research-synthesis.json +87 -0
  46. package/recipes/pipeline-review-readiness.json +49 -0
  47. package/recipes/subagent-artifact.json +26 -0
  48. package/recipes/subagent-checkpoint.json +27 -0
  49. package/recipes/subagent-conflict-report.json +25 -0
  50. package/recipes/subagent-contradiction-map.json +26 -0
  51. package/recipes/subagent-critic.json +28 -0
  52. package/recipes/subagent-evidence-map.json +26 -0
  53. package/recipes/subagent-followup.json +27 -0
  54. package/recipes/subagent-judge.json +26 -0
  55. package/recipes/subagent-merge.json +26 -0
  56. package/recipes/subagent-message.json +29 -0
  57. package/recipes/subagent-normalize.json +24 -0
  58. package/recipes/subagent-plan.json +26 -0
  59. package/recipes/subagent-prompt.json +22 -0
  60. package/recipes/subagent-quorum.json +41 -0
  61. package/recipes/subagent-review-coordinator.json +107 -0
  62. package/recipes/subagent-review.json +30 -0
  63. package/recipes/subagent-task-card.json +28 -0
  64. package/recipes/subagent-tools.json +17 -0
  65. package/recipes/subagent-verify.json +27 -0
  66. package/recipes/subagents-prompts.json +32 -0
  67. package/recipes/utility-actor-message.json +24 -0
  68. package/recipes/utility-artifact-manifest.json +17 -0
  69. package/recipes/utility-artifact-write.json +17 -0
  70. package/recipes/utility-changelog-head.json +12 -0
  71. package/recipes/utility-changelog-section.json +14 -0
  72. package/recipes/utility-git-log.json +12 -0
  73. package/recipes/utility-git-status.json +10 -0
  74. package/recipes/utility-jsonl-tail.json +11 -0
  75. package/recipes/utility-markdown-index.json +15 -0
  76. package/recipes/utility-package-summary.json +12 -0
  77. package/recipes/utility-playlist-build.json +18 -0
  78. package/recipes/utility-playlist-scan.json +12 -0
  79. package/recipes/utility-run-state-files.json +14 -0
  80. package/recipes/utility-run-summary.json +12 -0
  81. package/recipes/utility-validate-recipe.json +14 -0
  82. package/recipes/utility-validation-wrapper.json +14 -0
  83. package/scripts/async-runner.mjs +170 -0
  84. package/scripts/music-player.mjs +637 -0
  85. package/scripts/recipe-utils.mjs +273 -0
  86. package/scripts/validate-recipe.mjs +89 -0
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "subagent-quorum",
3
+ "async": true,
4
+ "imports": {
5
+ "subagent": "subagent-prompt.json"
6
+ },
7
+ "args": [
8
+ "prompt:string",
9
+ "models:array",
10
+ "thinking:string",
11
+ "tools:string",
12
+ "output_format:string"
13
+ ],
14
+ "defaults": {
15
+ "models": [
16
+ "openai-codex/gpt-5.5",
17
+ "openai-codex/gpt-5.4",
18
+ "deepseek/deepseek-v4-flash"
19
+ ],
20
+ "thinking": "off",
21
+ "tools": "",
22
+ "output_format": "Vote-style Markdown: Verdict, Rationale, Evidence, Confidence."
23
+ },
24
+ "mailbox": {
25
+ "accepts": ["control.stop"],
26
+ "emits": ["command.done", "run.done", "run.failed"]
27
+ },
28
+ "repeat": "{models.length}",
29
+ "parallel": true,
30
+ "failure": "branch",
31
+ "template": {
32
+ "name": "subagent",
33
+ "values": {
34
+ "prompt": "{prompt}",
35
+ "model": "{models[index]}",
36
+ "thinking": "{thinking}",
37
+ "tools": "{tools}",
38
+ "output_format": "{output_format}"
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "subagent-review-coordinator",
3
+ "async": true,
4
+ "imports": {
5
+ "reviewer": "subagent-review.json",
6
+ "verifier": "subagent-verify.json",
7
+ "merger": "subagent-merge.json",
8
+ "judge": "subagent-judge.json",
9
+ "normalizer": "subagent-normalize.json"
10
+ },
11
+ "args": [
12
+ "scope:string",
13
+ "lenses:array",
14
+ "claim:string",
15
+ "reviewer_model:string",
16
+ "verifier_model:string",
17
+ "merger_model:string",
18
+ "judge_model:string",
19
+ "thinking:string",
20
+ "tools:string",
21
+ "evidence_policy:string",
22
+ "risk_policy:string",
23
+ "output_format:string"
24
+ ],
25
+ "defaults": {
26
+ "lenses": [
27
+ "correctness",
28
+ "architecture",
29
+ "operator UX"
30
+ ],
31
+ "claim": "The reviewed scope is ready for the next implementation or release step.",
32
+ "reviewer_model": "openai-codex/gpt-5.5",
33
+ "verifier_model": "openai-codex/gpt-5.5",
34
+ "merger_model": "openai-codex/gpt-5.5",
35
+ "judge_model": "openai-codex/gpt-5.5",
36
+ "thinking": "off",
37
+ "tools": "",
38
+ "evidence_policy": "Cite inspected files, command output, or explicit uncertainty for every material claim.",
39
+ "risk_policy": "Preserve minority high-impact risks and separate confirmed issues from hypotheses.",
40
+ "output_format": "Markdown sections: Summary, Consensus Findings, Minority Findings, Verification, Judge Notes, Risks, Next Actions."
41
+ },
42
+ "mailbox": {
43
+ "accepts": ["control.stop"],
44
+ "emits": ["review.completed", "verification.completed", "merge.completed", "judge.completed", "command.done", "run.done", "run.failed"]
45
+ },
46
+ "template": [
47
+ {
48
+ "parallel": true,
49
+ "repeat": "{lenses.length}",
50
+ "failure": "branch",
51
+ "template": {
52
+ "name": "reviewer",
53
+ "values": {
54
+ "scope": "{scope}",
55
+ "lens": "{lenses[index]}",
56
+ "model": "{reviewer_model}",
57
+ "thinking": "{thinking}",
58
+ "tools": "{tools}",
59
+ "evidence_policy": "{evidence_policy}",
60
+ "risk_policy": "{risk_policy}"
61
+ }
62
+ }
63
+ },
64
+ {
65
+ "name": "verifier",
66
+ "values": {
67
+ "claim": "{claim}",
68
+ "evidence": "Use previous reviewer outputs from stdin and named scope: {scope}.",
69
+ "model": "{verifier_model}",
70
+ "thinking": "{thinking}",
71
+ "tools": "{tools}",
72
+ "evidence_policy": "{evidence_policy}"
73
+ }
74
+ },
75
+ {
76
+ "name": "merger",
77
+ "values": {
78
+ "inputs": "Use previous reviewer and verifier outputs from stdin.",
79
+ "mode": "consensus-first",
80
+ "model": "{merger_model}",
81
+ "thinking": "medium",
82
+ "tools": "{tools}",
83
+ "risk_policy": "{risk_policy}"
84
+ }
85
+ },
86
+ {
87
+ "name": "judge",
88
+ "values": {
89
+ "report": "Use merged output from stdin.",
90
+ "evidence": "Use previous reviewer, verifier, and merger outputs from stdin.",
91
+ "model": "{judge_model}",
92
+ "thinking": "medium",
93
+ "tools": "{tools}"
94
+ }
95
+ },
96
+ {
97
+ "name": "normalizer",
98
+ "values": {
99
+ "input": "Use merged and judged output from stdin.",
100
+ "format": "{output_format}",
101
+ "model": "{merger_model}",
102
+ "thinking": "off",
103
+ "tools": "{tools}"
104
+ }
105
+ }
106
+ ]
107
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "subagent-review",
3
+ "async": true,
4
+ "args": [
5
+ "scope:string",
6
+ "lens:string",
7
+ "instructions:string",
8
+ "evidence_policy:string",
9
+ "risk_policy:string",
10
+ "output_format:string",
11
+ "model:string",
12
+ "thinking:string",
13
+ "tools:string"
14
+ ],
15
+ "defaults": {
16
+ "lens": "evidence-grounded review",
17
+ "instructions": "Return findings with evidence, risk, and recommended next action.",
18
+ "evidence_policy": "Cite inspected files, command output, or explicit uncertainty for every material claim.",
19
+ "risk_policy": "Preserve minority high-impact risks and separate confirmed issues from hypotheses.",
20
+ "output_format": "Markdown sections: Findings, Evidence, Risks, Next Actions.",
21
+ "model": "openai-codex/gpt-5.5",
22
+ "thinking": "off",
23
+ "tools": ""
24
+ },
25
+ "mailbox": {
26
+ "accepts": ["control.stop"],
27
+ "emits": ["review.completed", "command.done", "run.done", "run.failed"]
28
+ },
29
+ "template": "pi -p --model {model} --thinking {thinking} {tools?--tools:--no-tools} {tools} Review {scope} through this lens: {lens}. Instructions: {instructions}. Evidence policy: {evidence_policy}. Risk policy: {risk_policy}. Output format: {output_format}"
30
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "subagent-task-card",
3
+ "async": true,
4
+ "args": [
5
+ "goal:string",
6
+ "allowed:string",
7
+ "avoided:string",
8
+ "checks:string",
9
+ "handoff_format:string",
10
+ "model:string",
11
+ "thinking:string",
12
+ "tools:string"
13
+ ],
14
+ "defaults": {
15
+ "allowed": "Caller must name allowed files, directories, or logical scope.",
16
+ "avoided": "Avoid unrelated files, public contracts, generated artifacts, and broad refactors unless explicitly allowed.",
17
+ "checks": "Name the smallest validation commands or review gates that prove completion.",
18
+ "handoff_format": "Markdown sections: Task, Allowed Files, Avoid Files, Expected Output, Checks, Handoff Notes.",
19
+ "model": "openai-codex/gpt-5.5",
20
+ "thinking": "off",
21
+ "tools": ""
22
+ },
23
+ "mailbox": {
24
+ "accepts": ["control.stop"],
25
+ "emits": ["task_card.completed", "command.done", "run.done", "run.failed"]
26
+ },
27
+ "template": "pi -p --model {model} --thinking {thinking} {tools?--tools:--no-tools} {tools} Create a bounded implementation task card. Goal: {goal}. Allowed: {allowed}. Avoided: {avoided}. Checks: {checks}. Handoff format: {handoff_format}"
28
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "subagent-tools",
3
+ "async": true,
4
+ "args": [
5
+ "prompt:string",
6
+ "tools:string",
7
+ "model:string"
8
+ ],
9
+ "defaults": {
10
+ "model": "openai-codex/gpt-5.5"
11
+ },
12
+ "mailbox": {
13
+ "accepts": ["control.stop"],
14
+ "emits": ["command.done", "run.done", "run.failed"]
15
+ },
16
+ "template": "pi -p --model {model} --tools {tools} {prompt}"
17
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "subagent-verify",
3
+ "async": true,
4
+ "args": [
5
+ "claim:string",
6
+ "evidence:string",
7
+ "acceptance:string",
8
+ "evidence_policy:string",
9
+ "output_format:string",
10
+ "model:string",
11
+ "thinking:string",
12
+ "tools:string"
13
+ ],
14
+ "defaults": {
15
+ "acceptance": "Separate proven, disproven, unknown, and missing evidence.",
16
+ "evidence_policy": "Do not infer beyond provided evidence or inspected artifacts.",
17
+ "output_format": "Markdown sections: Verdict, Evidence, Gaps, Confidence.",
18
+ "model": "openai-codex/gpt-5.5",
19
+ "thinking": "off",
20
+ "tools": ""
21
+ },
22
+ "mailbox": {
23
+ "accepts": ["control.stop"],
24
+ "emits": ["verification.completed", "command.done", "run.done", "run.failed"]
25
+ },
26
+ "template": "pi -p --model {model} --thinking {thinking} {tools?--tools:--no-tools} {tools} Verify this claim against the provided evidence. Claim: {claim}. Evidence or artifact paths: {evidence}. Acceptance: {acceptance}. Evidence policy: {evidence_policy}. Output format: {output_format}"
27
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "subagents-prompts",
3
+ "async": true,
4
+ "imports": {
5
+ "subagent": "subagent-prompt.json"
6
+ },
7
+ "args": [
8
+ "prompts:array",
9
+ "report_path:path",
10
+ "summary_path:path"
11
+ ],
12
+ "defaults": {
13
+ "report_path": "{state_dir}/stdout.log",
14
+ "summary_path": "{state_dir}/result.json"
15
+ },
16
+ "artifacts": {
17
+ "report": "{report_path}",
18
+ "summary": "{summary_path}"
19
+ },
20
+ "mailbox": {
21
+ "emits": ["command.done", "run.done", "run.failed"]
22
+ },
23
+ "repeat": "{prompts.length}",
24
+ "parallel": true,
25
+ "failure": "branch",
26
+ "template": {
27
+ "name": "subagent",
28
+ "values": {
29
+ "prompt": "{prompts[index]}"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "utility-actor-message",
3
+ "async": false,
4
+ "args": [
5
+ "type:string",
6
+ "to:string",
7
+ "from:string",
8
+ "summary:string",
9
+ "metadata:string",
10
+ "correlation_id:string",
11
+ "reply_to:string",
12
+ "repo:path"
13
+ ],
14
+ "defaults": {
15
+ "to": "coordinator",
16
+ "from": "run:{run_id}",
17
+ "summary": "",
18
+ "metadata": "{}",
19
+ "correlation_id": "",
20
+ "reply_to": "",
21
+ "repo": "~/.pi/agent/extensions/pi-actors"
22
+ },
23
+ "template": "node {repo}/scripts/recipe-utils.mjs actor-message {type} {to} {from} {summary} {metadata} {correlation_id} {reply_to}"
24
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "utility-artifact-manifest",
3
+ "args": [
4
+ "repo:path",
5
+ "artifact_path:path",
6
+ "title:string",
7
+ "status:enum(draft,ready,blocked,accepted)",
8
+ "summary:string"
9
+ ],
10
+ "defaults": {
11
+ "repo": "~/.pi/agent/extensions/pi-actors",
12
+ "title": "Artifact",
13
+ "status": "draft",
14
+ "summary": "Machine-readable artifact manifest."
15
+ },
16
+ "template": "{repo}/scripts/recipe-utils.mjs artifact-manifest {artifact_path} {title} {status} {summary}"
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "utility-artifact-write",
3
+ "async": false,
4
+ "args": [
5
+ "repo:path",
6
+ "artifact_path:path",
7
+ "mode:enum(create,overwrite,append)"
8
+ ],
9
+ "defaults": {
10
+ "repo": "~/.pi/agent/extensions/pi-actors",
11
+ "mode": "create"
12
+ },
13
+ "template": {
14
+ "template": "{repo}/scripts/recipe-utils.mjs artifact-write {artifact_path} {mode}",
15
+ "output": "stdout"
16
+ }
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "utility-changelog-head",
3
+ "args": [
4
+ "file:path",
5
+ "lines:int"
6
+ ],
7
+ "defaults": {
8
+ "file": "CHANGELOG.md",
9
+ "lines": "80"
10
+ },
11
+ "template": "head -n {lines} {file}"
12
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "utility-changelog-section",
3
+ "args": [
4
+ "repo:path",
5
+ "file:path",
6
+ "version:string"
7
+ ],
8
+ "defaults": {
9
+ "repo": "~/.pi/agent/extensions/pi-actors",
10
+ "file": "CHANGELOG.md",
11
+ "version": "0.7.1"
12
+ },
13
+ "template": "{repo}/scripts/recipe-utils.mjs changelog-section {file} {version}"
14
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "utility-git-log",
3
+ "args": [
4
+ "repo:path",
5
+ "count:int"
6
+ ],
7
+ "defaults": {
8
+ "repo": ".",
9
+ "count": "8"
10
+ },
11
+ "template": "git -C {repo} log --oneline --decorate -n {count}"
12
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "utility-git-status",
3
+ "args": [
4
+ "repo:path"
5
+ ],
6
+ "defaults": {
7
+ "repo": "."
8
+ },
9
+ "template": "git -C {repo} status --short --branch"
10
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "utility-jsonl-tail",
3
+ "args": [
4
+ "file:path",
5
+ "lines:int"
6
+ ],
7
+ "defaults": {
8
+ "lines": "40"
9
+ },
10
+ "template": "tail -n {lines} {file}"
11
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "utility-markdown-index",
3
+ "args": [
4
+ "directory:path",
5
+ "title:string",
6
+ "include_pattern:string",
7
+ "output_format:string"
8
+ ],
9
+ "defaults": {
10
+ "title": "Documentation Index",
11
+ "include_pattern": "*.md",
12
+ "output_format": "Markdown bullet list with relative links and one-line descriptions when headings are available."
13
+ },
14
+ "template": "find {directory} -maxdepth 1 -name {include_pattern} -type f -printf '%f\\n'"
15
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "utility-package-summary",
3
+ "args": [
4
+ "package_json:path",
5
+ "repo:path"
6
+ ],
7
+ "defaults": {
8
+ "package_json": "package.json",
9
+ "repo": "~/.pi/agent/extensions/pi-actors"
10
+ },
11
+ "template": "{repo}/scripts/recipe-utils.mjs package-summary {package_json}"
12
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "utility-playlist-build",
3
+ "args": [
4
+ "repo:path",
5
+ "source_dir:path",
6
+ "extensions:string",
7
+ "max_depth:int",
8
+ "output_mode:enum(paths,m3u,inline)"
9
+ ],
10
+ "defaults": {
11
+ "repo": "~/.pi/agent/extensions/pi-actors",
12
+ "source_dir": "~/Music",
13
+ "extensions": ".mp3,.ogg,.wav,.flac,.m4a",
14
+ "max_depth": "2",
15
+ "output_mode": "paths"
16
+ },
17
+ "template": "{repo}/scripts/recipe-utils.mjs playlist {source_dir} {extensions} {max_depth} {output_mode}"
18
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "utility-playlist-scan",
3
+ "args": [
4
+ "source_dir:path",
5
+ "max_depth:int"
6
+ ],
7
+ "defaults": {
8
+ "source_dir": "~/Music",
9
+ "max_depth": "2"
10
+ },
11
+ "template": "find {source_dir} -maxdepth {max_depth} -type f -print"
12
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "utility-run-state-files",
3
+ "args": [
4
+ "state_root:path",
5
+ "file_name:string",
6
+ "max_depth:int"
7
+ ],
8
+ "defaults": {
9
+ "state_root": "~/.pi/agent/tmp/pi-actors/runs",
10
+ "file_name": "run.json",
11
+ "max_depth": "2"
12
+ },
13
+ "template": "find {state_root} -maxdepth {max_depth} -name {file_name} -type f -print"
14
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "utility-run-summary",
3
+ "args": [
4
+ "repo:path",
5
+ "state_root:path"
6
+ ],
7
+ "defaults": {
8
+ "repo": "~/.pi/agent/extensions/pi-actors",
9
+ "state_root": "~/.pi/agent/tmp/pi-actors/runs"
10
+ },
11
+ "template": "{repo}/scripts/recipe-utils.mjs run-summary {state_root}"
12
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "utility-validate-recipe",
3
+ "args": [
4
+ "target:path",
5
+ "all:bool",
6
+ "repo:path"
7
+ ],
8
+ "defaults": {
9
+ "target": "recipes",
10
+ "all": "true",
11
+ "repo": "~/.pi/agent/extensions/pi-actors"
12
+ },
13
+ "template": "{repo}/scripts/validate-recipe.mjs {target} {all?--all:}"
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "utility-validation-wrapper",
3
+ "args": [
4
+ "command:string",
5
+ "scope:string",
6
+ "timeout_ms:int"
7
+ ],
8
+ "defaults": {
9
+ "scope": ".",
10
+ "timeout_ms": "300000"
11
+ },
12
+ "timeout": "{timeout_ms}",
13
+ "template": "bash -lc 'cd {scope} && {command}'"
14
+ }