@llblab/pi-actors 0.42.3 → 0.43.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 (279) hide show
  1. package/AGENTS.md +127 -175
  2. package/BACKLOG.md +189 -1
  3. package/CHANGELOG.md +183 -292
  4. package/README.md +115 -276
  5. package/dist/fixtures/protocol/control-endpoint.json +6 -0
  6. package/dist/fixtures/protocol/control-record.json +9 -0
  7. package/dist/fixtures/protocol/recipe-summary.json +4 -12
  8. package/dist/fixtures/protocol/trace-event.json +9 -0
  9. package/dist/index.js +1 -1
  10. package/dist/lib/async-runs.d.ts +15 -38
  11. package/dist/lib/async-runs.js +173 -111
  12. package/dist/lib/automatic-review-runtime.d.ts +1 -1
  13. package/dist/lib/automatic-review-runtime.js +5 -5
  14. package/dist/lib/command-templates.d.ts +2 -0
  15. package/dist/lib/command-templates.js +38 -4
  16. package/dist/lib/control-projection.d.ts +20 -0
  17. package/dist/lib/control-projection.js +66 -0
  18. package/dist/lib/control.d.ts +15 -0
  19. package/dist/lib/control.js +97 -0
  20. package/dist/lib/draft-sleep.js +3 -3
  21. package/dist/lib/execution-sessions.d.ts +17 -0
  22. package/dist/lib/execution-sessions.js +85 -0
  23. package/dist/lib/file-state.d.ts +2 -0
  24. package/dist/lib/file-state.js +114 -46
  25. package/dist/lib/inspector-actions.d.ts +2 -2
  26. package/dist/lib/inspector-actions.js +2 -2
  27. package/dist/lib/inspector-command.js +3 -3
  28. package/dist/lib/inspector-overlay.d.ts +54 -70
  29. package/dist/lib/inspector-overlay.js +576 -910
  30. package/dist/lib/inspector.d.ts +3 -71
  31. package/dist/lib/inspector.js +19 -665
  32. package/dist/lib/limits.d.ts +7 -3
  33. package/dist/lib/limits.js +7 -3
  34. package/dist/lib/observability.d.ts +16 -16
  35. package/dist/lib/observability.js +43 -82
  36. package/dist/lib/prompts.d.ts +1 -1
  37. package/dist/lib/prompts.js +3 -3
  38. package/dist/lib/recipe-control.d.ts +7 -0
  39. package/dist/lib/recipe-control.js +43 -0
  40. package/dist/lib/recipes-discovery.js +2 -0
  41. package/dist/lib/recipes-references.d.ts +1 -14
  42. package/dist/lib/recipes-references.js +6 -21
  43. package/dist/lib/review-control.d.ts +1 -1
  44. package/dist/lib/review-control.js +4 -5
  45. package/dist/lib/review-projection.js +1 -5
  46. package/dist/lib/run-ui-runtime.js +2 -2
  47. package/dist/lib/runs-control-delivery.d.ts +28 -0
  48. package/dist/lib/runs-control-delivery.js +150 -0
  49. package/dist/lib/runs-controls.d.ts +37 -0
  50. package/dist/lib/runs-controls.js +146 -0
  51. package/dist/lib/runs-retention.d.ts +7 -0
  52. package/dist/lib/runs-retention.js +27 -3
  53. package/dist/lib/runs-start.js +4 -2
  54. package/dist/lib/runs-status.js +11 -6
  55. package/dist/lib/runs-trace.d.ts +24 -0
  56. package/dist/lib/runs-trace.js +102 -0
  57. package/dist/lib/runtime-identity.d.ts +7 -0
  58. package/dist/lib/runtime-identity.js +35 -0
  59. package/dist/lib/runtime-notifier.d.ts +1 -1
  60. package/dist/lib/runtime-notifier.js +1 -1
  61. package/dist/lib/runtime-triage.d.ts +29 -0
  62. package/dist/lib/runtime-triage.js +76 -0
  63. package/dist/lib/tool-review-scheduler.js +7 -7
  64. package/dist/lib/tools-inspect.d.ts +3 -3
  65. package/dist/lib/tools-inspect.js +241 -707
  66. package/dist/lib/tools-local.js +2 -10
  67. package/dist/lib/tools-message.d.ts +6 -7
  68. package/dist/lib/tools-message.js +95 -396
  69. package/dist/lib/tools-response.d.ts +1 -5
  70. package/dist/lib/tools-response.js +5 -48
  71. package/dist/lib/tools-spawn.js +16 -28
  72. package/dist/lib/tools.d.ts +1 -1
  73. package/dist/lib/tools.js +2 -3
  74. package/dist/lib/trace-projection.d.ts +22 -0
  75. package/dist/lib/trace-projection.js +185 -0
  76. package/dist/recipes/draft-review.json +0 -10
  77. package/dist/recipes/lens-swarm.json +0 -14
  78. package/dist/recipes/music-player.json +10 -19
  79. package/dist/recipes/pipeline-architect-coordinator.json +0 -11
  80. package/dist/recipes/pipeline-artifact-bundle.json +1 -22
  81. package/dist/recipes/pipeline-artifact-report.json +1 -18
  82. package/dist/recipes/pipeline-artifact-write.json +1 -18
  83. package/dist/recipes/pipeline-async-run-ops.json +0 -12
  84. package/dist/recipes/pipeline-checkpoint-continuation.json +0 -14
  85. package/dist/recipes/pipeline-development-tasking.json +0 -12
  86. package/dist/recipes/pipeline-docs-maintenance.json +0 -12
  87. package/dist/recipes/pipeline-media-library.json +0 -12
  88. package/dist/recipes/pipeline-quorum-review.json +0 -12
  89. package/dist/recipes/pipeline-release-readiness.json +0 -12
  90. package/dist/recipes/pipeline-release-summary.json +0 -12
  91. package/dist/recipes/pipeline-repo-health.json +0 -12
  92. package/dist/recipes/pipeline-research-synthesis.json +0 -11
  93. package/dist/recipes/pipeline-review-readiness.json +0 -12
  94. package/dist/recipes/resource-locker.json +27 -0
  95. package/dist/recipes/subagent-artifact.json +0 -9
  96. package/dist/recipes/subagent-checkpoint.json +0 -10
  97. package/dist/recipes/subagent-conflict-report.json +0 -11
  98. package/dist/recipes/subagent-contradiction-map.json +0 -11
  99. package/dist/recipes/subagent-critic.json +0 -11
  100. package/dist/recipes/subagent-evidence-map.json +0 -11
  101. package/dist/recipes/subagent-followup.json +0 -10
  102. package/dist/recipes/subagent-judge.json +0 -11
  103. package/dist/recipes/subagent-merge.json +0 -11
  104. package/dist/recipes/subagent-normalize.json +0 -11
  105. package/dist/recipes/subagent-plan.json +0 -11
  106. package/dist/recipes/subagent-preflight.json +0 -11
  107. package/dist/recipes/subagent-prompt.json +0 -10
  108. package/dist/recipes/subagent-quorum.json +0 -10
  109. package/dist/recipes/subagent-review-coordinator.json +0 -14
  110. package/dist/recipes/subagent-review.json +0 -11
  111. package/dist/recipes/subagent-task-card.json +0 -11
  112. package/dist/recipes/subagent-tools.json +0 -10
  113. package/dist/recipes/subagent-verify.json +0 -11
  114. package/dist/recipes/subagents-prompts.json +0 -10
  115. package/dist/recipes/tool-review.json +0 -10
  116. package/dist/scripts/async-runner.mjs +25 -25
  117. package/dist/scripts/conformance.mjs +4 -2
  118. package/dist/scripts/locker.mjs +196 -69
  119. package/dist/scripts/music-player.mjs +162 -159
  120. package/dist/scripts/recipe-utils.mjs +6 -96
  121. package/dist/scripts/release-gates.mjs +91 -0
  122. package/dist/scripts/validate-recipe.mjs +8 -57
  123. package/dist/skills/actors/SKILL.md +57 -265
  124. package/dist/skills/swarm/SKILL.md +10 -34
  125. package/docs/0.43-baseline.md +39 -0
  126. package/docs/README.md +4 -6
  127. package/docs/actor-inspector.md +26 -64
  128. package/docs/async-runs.md +81 -328
  129. package/docs/command-templates.md +8 -118
  130. package/docs/recipe-library.md +55 -182
  131. package/docs/releasing.md +28 -0
  132. package/docs/template-recipes.md +76 -289
  133. package/docs/tool-registry.md +41 -161
  134. package/fixtures/protocol/control-endpoint.json +6 -0
  135. package/fixtures/protocol/control-record.json +9 -0
  136. package/fixtures/protocol/recipe-summary.json +4 -12
  137. package/fixtures/protocol/trace-event.json +9 -0
  138. package/index.ts +1 -1
  139. package/lib/async-runs.ts +218 -204
  140. package/lib/automatic-review-runtime.ts +7 -7
  141. package/lib/command-templates.ts +44 -4
  142. package/lib/control-projection.ts +105 -0
  143. package/lib/control.ts +117 -0
  144. package/lib/draft-sleep.ts +3 -3
  145. package/lib/execution-sessions.ts +111 -0
  146. package/lib/file-state.ts +84 -64
  147. package/lib/inspector-actions.ts +2 -2
  148. package/lib/inspector-command.ts +3 -3
  149. package/lib/inspector-overlay.ts +617 -1126
  150. package/lib/inspector.ts +46 -979
  151. package/lib/limits.ts +7 -3
  152. package/lib/observability.ts +60 -101
  153. package/lib/prompts.ts +3 -3
  154. package/lib/recipe-control.ts +52 -0
  155. package/lib/recipes-discovery.ts +2 -0
  156. package/lib/recipes-references.ts +9 -45
  157. package/lib/review-control.ts +4 -5
  158. package/lib/review-projection.ts +1 -5
  159. package/lib/run-ui-runtime.ts +2 -2
  160. package/lib/runs-control-delivery.ts +209 -0
  161. package/lib/runs-controls.ts +213 -0
  162. package/lib/runs-retention.ts +38 -3
  163. package/lib/runs-start.ts +4 -2
  164. package/lib/runs-status.ts +11 -6
  165. package/lib/runs-trace.ts +136 -0
  166. package/lib/runtime-identity.ts +39 -0
  167. package/lib/runtime-notifier.ts +1 -1
  168. package/lib/runtime-triage.ts +120 -0
  169. package/lib/tool-review-scheduler.ts +7 -7
  170. package/lib/tools-inspect.ts +283 -900
  171. package/lib/tools-local.ts +2 -12
  172. package/lib/tools-message.ts +112 -520
  173. package/lib/tools-response.ts +5 -64
  174. package/lib/tools-spawn.ts +16 -32
  175. package/lib/tools.ts +5 -6
  176. package/lib/trace-projection.ts +244 -0
  177. package/package.json +2 -1
  178. package/recipes/draft-review.json +0 -10
  179. package/recipes/lens-swarm.json +0 -14
  180. package/recipes/music-player.json +10 -19
  181. package/recipes/pipeline-architect-coordinator.json +0 -11
  182. package/recipes/pipeline-artifact-bundle.json +1 -22
  183. package/recipes/pipeline-artifact-report.json +1 -18
  184. package/recipes/pipeline-artifact-write.json +1 -18
  185. package/recipes/pipeline-async-run-ops.json +0 -12
  186. package/recipes/pipeline-checkpoint-continuation.json +0 -14
  187. package/recipes/pipeline-development-tasking.json +0 -12
  188. package/recipes/pipeline-docs-maintenance.json +0 -12
  189. package/recipes/pipeline-media-library.json +0 -12
  190. package/recipes/pipeline-quorum-review.json +0 -12
  191. package/recipes/pipeline-release-readiness.json +0 -12
  192. package/recipes/pipeline-release-summary.json +0 -12
  193. package/recipes/pipeline-repo-health.json +0 -12
  194. package/recipes/pipeline-research-synthesis.json +0 -11
  195. package/recipes/pipeline-review-readiness.json +0 -12
  196. package/recipes/resource-locker.json +27 -0
  197. package/recipes/subagent-artifact.json +0 -9
  198. package/recipes/subagent-checkpoint.json +0 -10
  199. package/recipes/subagent-conflict-report.json +0 -11
  200. package/recipes/subagent-contradiction-map.json +0 -11
  201. package/recipes/subagent-critic.json +0 -11
  202. package/recipes/subagent-evidence-map.json +0 -11
  203. package/recipes/subagent-followup.json +0 -10
  204. package/recipes/subagent-judge.json +0 -11
  205. package/recipes/subagent-merge.json +0 -11
  206. package/recipes/subagent-normalize.json +0 -11
  207. package/recipes/subagent-plan.json +0 -11
  208. package/recipes/subagent-preflight.json +0 -11
  209. package/recipes/subagent-prompt.json +0 -10
  210. package/recipes/subagent-quorum.json +0 -10
  211. package/recipes/subagent-review-coordinator.json +0 -14
  212. package/recipes/subagent-review.json +0 -11
  213. package/recipes/subagent-task-card.json +0 -11
  214. package/recipes/subagent-tools.json +0 -10
  215. package/recipes/subagent-verify.json +0 -11
  216. package/recipes/subagents-prompts.json +0 -10
  217. package/recipes/tool-review.json +0 -10
  218. package/scripts/async-runner.mjs +25 -25
  219. package/scripts/conformance.mjs +4 -2
  220. package/scripts/locker.mjs +196 -69
  221. package/scripts/music-player.mjs +162 -159
  222. package/scripts/recipe-utils.mjs +6 -96
  223. package/scripts/release-gates.mjs +91 -0
  224. package/scripts/validate-recipe.mjs +8 -57
  225. package/skills/actors/SKILL.md +57 -265
  226. package/skills/swarm/SKILL.md +10 -34
  227. package/dist/fixtures/protocol/actor-message-branch.json +0 -13
  228. package/dist/fixtures/protocol/mailbox-contract.json +0 -15
  229. package/dist/fixtures/protocol/room-message.json +0 -11
  230. package/dist/fixtures/protocol/room-roster.json +0 -11
  231. package/dist/fixtures/protocol/run-inbox-message.json +0 -9
  232. package/dist/fixtures/protocol/run-outbox-event.json +0 -9
  233. package/dist/lib/mailbox-loop.d.ts +0 -41
  234. package/dist/lib/mailbox-loop.js +0 -60
  235. package/dist/lib/messages.d.ts +0 -25
  236. package/dist/lib/messages.js +0 -122
  237. package/dist/lib/rooms.d.ts +0 -104
  238. package/dist/lib/rooms.js +0 -647
  239. package/dist/lib/runs-mailbox.d.ts +0 -25
  240. package/dist/lib/runs-mailbox.js +0 -146
  241. package/dist/lib/runs-messages.d.ts +0 -15
  242. package/dist/lib/runs-messages.js +0 -179
  243. package/dist/lib/runs-outbox.d.ts +0 -41
  244. package/dist/lib/runs-outbox.js +0 -87
  245. package/dist/lib/tools-mailbox.d.ts +0 -8
  246. package/dist/lib/tools-mailbox.js +0 -48
  247. package/dist/recipes/actor-worker.json +0 -39
  248. package/dist/recipes/coordinator-locker.json +0 -45
  249. package/dist/recipes/locker.json +0 -45
  250. package/dist/recipes/pipeline-room-swarm.json +0 -50
  251. package/dist/recipes/subagent-message.json +0 -32
  252. package/dist/recipes/utility-actor-message.json +0 -23
  253. package/dist/scripts/actor-worker.mjs +0 -214
  254. package/dist/scripts/coordinator.mjs +0 -799
  255. package/docs/actor-messages.md +0 -225
  256. package/docs/actors-deep-reference.md +0 -66
  257. package/docs/component-recipes.md +0 -148
  258. package/docs/task-first-recipes.md +0 -263
  259. package/fixtures/protocol/actor-message-branch.json +0 -13
  260. package/fixtures/protocol/mailbox-contract.json +0 -15
  261. package/fixtures/protocol/room-message.json +0 -11
  262. package/fixtures/protocol/room-roster.json +0 -11
  263. package/fixtures/protocol/run-inbox-message.json +0 -9
  264. package/fixtures/protocol/run-outbox-event.json +0 -9
  265. package/lib/mailbox-loop.ts +0 -144
  266. package/lib/messages.ts +0 -151
  267. package/lib/rooms.ts +0 -939
  268. package/lib/runs-mailbox.ts +0 -208
  269. package/lib/runs-messages.ts +0 -252
  270. package/lib/runs-outbox.ts +0 -144
  271. package/lib/tools-mailbox.ts +0 -56
  272. package/recipes/actor-worker.json +0 -39
  273. package/recipes/coordinator-locker.json +0 -45
  274. package/recipes/locker.json +0 -45
  275. package/recipes/pipeline-room-swarm.json +0 -50
  276. package/recipes/subagent-message.json +0 -32
  277. package/recipes/utility-actor-message.json +0 -23
  278. package/scripts/actor-worker.mjs +0 -214
  279. package/scripts/coordinator.mjs +0 -799
@@ -1,263 +0,0 @@
1
- # Task-First Recipe Design
2
-
3
- Task-first recipe design starts from a high-level operator or coordinator task, then derives the component cells, utility recipes, helper scripts, and runtime semantics needed to make that task reusable.
4
-
5
- This complements atom-first growth. Atom-first asks: "What small capability can we expose?" Task-first asks: "What complete work pattern should an agent/operator be able to invoke, and which atoms must exist to support it?"
6
-
7
- ## Method
8
-
9
- For each high-level recipe candidate:
10
-
11
- 1. Name the task in operator language.
12
- 2. Define the trigger and expected output artifact.
13
- 3. Sketch the recipe pipeline at the highest useful abstraction.
14
- 4. Identify missing component cells.
15
- 5. Decide which cells are subagent components, local utilities, or helper-backed transforms.
16
- 6. Keep domain policy knobs public: models, tools, paths, evidence/risk policy, output shape, mailbox contract, and validation gates.
17
- 7. Add only the next smallest recipe/helper slice that validates the design.
18
-
19
- ## High-Level Recipe Cells
20
-
21
- ### Release Readiness Cell
22
-
23
- Purpose: decide whether a repo/package is ready for release.
24
-
25
- Pipeline:
26
-
27
- ```text
28
- scope snapshot → changelog/package check → release lens reviews → risk verifier → readiness report → release checklist artifact
29
- ```
30
-
31
- Likely needed cells:
32
-
33
- - Package metadata reader
34
- - Changelog section extractor
35
- - Package contents summarizer
36
- - Validation command wrapper
37
- - Release-risk reviewer
38
- - Readiness merger/judge
39
- - Release checklist artifact writer
40
-
41
- Existing seeds:
42
-
43
- - `utility-changelog-section`
44
- - `utility-package-summary`
45
- - `utility-validation-wrapper`
46
- - `pipeline-review-readiness`
47
- - `subagent-judge`
48
- - `subagent-artifact`
49
-
50
- Implemented seed:
51
-
52
- - `pipeline-release-readiness`: changelog section → package summary → packaged skill summary → validation wrapper → release review coordinator → artifact report.
53
-
54
- ### Repository Health Cell
55
-
56
- Purpose: summarize repo state for the next coordinator turn or release prep.
57
-
58
- Pipeline:
59
-
60
- ```text
61
- git status/log → package/docs/backlog snapshot → validation summary → health report → next action recommendation
62
- ```
63
-
64
- Likely needed cells:
65
-
66
- - Git status/log utility
67
- - Package version reader
68
- - Backlog open/blocked extractor
69
- - Docs index checker
70
- - Validation summary normalizer
71
- - Next-action recommender
72
-
73
- Existing seeds:
74
-
75
- - `utility-markdown-index`
76
- - `utility-validation-wrapper`
77
- - `subagent-normalize`
78
- - `subagent-plan`
79
-
80
- Implemented seed:
81
-
82
- - `pipeline-repo-health`: git status/log → docs index → validation wrapper → normalized artifact report.
83
-
84
- ### Async Run Operations Cell
85
-
86
- Purpose: inspect, summarize, and decide actions for local async runs.
87
-
88
- Pipeline:
89
-
90
- ```text
91
- run-state summary → actor-message tail → stale/active classification → recommended action → optional stop/control message
92
- ```
93
-
94
- Likely needed cells:
95
-
96
- - Run summary helper
97
- - JSONL actor-message tailer
98
- - Stale-run classifier
99
- - Control-message recommender
100
- - Run report artifact
101
-
102
- Existing seeds:
103
-
104
- - `utility-run-summary`
105
- - `utility-jsonl-tail`
106
- - `subagent-message`
107
- - `pipeline-artifact-report`
108
-
109
- Implemented seed:
110
-
111
- - `pipeline-async-run-ops`: structured run operations snapshot → normalized operations report → artifact report. The snapshot combines run summary, actor-message tail, and recommended inspect/control messages before the LLM normalization step.
112
-
113
- ### Research Brief Cell
114
-
115
- Purpose: turn a question and source set into a bounded evidence-backed brief.
116
-
117
- Pipeline:
118
-
119
- ```text
120
- question framing → evidence map → contradiction map → claim verification → synthesis → evidence gaps → next evidence slice
121
- ```
122
-
123
- Likely needed cells:
124
-
125
- - Question framer
126
- - Source inventory utility
127
- - Evidence mapper
128
- - Contradiction mapper
129
- - Verifier
130
- - Synthesis merger
131
- - Limitations normalizer
132
-
133
- Existing seeds:
134
-
135
- - `pipeline-research-synthesis`
136
- - `subagent-evidence-map`
137
- - `subagent-contradiction-map`
138
- - `subagent-verify`
139
-
140
- ### Consensus-First Build Cell
141
-
142
- Purpose: turn several expert proposals into one coherent artifact without parallel writers fragmenting the result.
143
-
144
- Pipeline:
145
-
146
- ```text
147
- mission → lens proposers in room → consensus transcript → named implementer writes artifact → QA reviewer checks artifact + transcript → finalizer applies fixes → artifact assertions
148
- ```
149
-
150
- Use this for creative demos, single-file artifacts, specs, docs, prompt packs, and product/UX deliverables where broad input matters but one owner should shape the final file. Proposers should have message/inspect tools only. The implementer should be the first role with write tools. QA should inspect/read but not mutate. The finalizer may write only after reading QA evidence.
151
-
152
- Required gates:
153
-
154
- - Artifact path, report path, and minimum acceptance checks are explicit inputs.
155
- - The workflow fails if the requested artifact is missing, too small, or not self-contained enough for the task.
156
- - `run.done` is emitted only after QA/finalizer passes, not merely after room discussion.
157
-
158
- Existing seeds:
159
-
160
- - `pipeline-room-swarm` for room-visible discussion and rosters.
161
- - `subagent-message` for explicit room handoffs.
162
- - `subagent-review` / `subagent-verify` for QA roles.
163
- - `pipeline-artifact-write` or a small helper script for deterministic artifact assertion.
164
-
165
- Next recipe direction:
166
-
167
- - Add a generic packaged consensus-build pipeline once the interface stabilizes around proposer roles, implementer prompt, QA prompt, artifact assertions, and public model/tool knobs.
168
-
169
- ### Implementation Tasking Cell
170
-
171
- Purpose: prepare bounded work for one or more implementation agents.
172
-
173
- Pipeline:
174
-
175
- ```text
176
- goal → mutation zones → task cards → validation gates → conflict risks → integrator handoff
177
- ```
178
-
179
- Likely needed cells:
180
-
181
- - Mutation-zone planner
182
- - Task-card generator
183
- - Ownership/conflict checker
184
- - Validation-gate normalizer
185
- - Integrator handoff artifact
186
-
187
- Existing seeds:
188
-
189
- - `pipeline-development-tasking`
190
- - `subagent-task-card`
191
- - `subagent-conflict-report`
192
-
193
- ### Documentation Maintenance Cell
194
-
195
- Purpose: keep docs/index/readme surfaces coherent after changes.
196
-
197
- Pipeline:
198
-
199
- ```text
200
- doc file inventory → index diff → stale link/routing review → rewrite suggestion → docs maintenance artifact
201
- ```
202
-
203
- Likely needed cells:
204
-
205
- - Markdown index utility
206
- - Link checker wrapper
207
- - Docs consistency reviewer
208
- - Docs update planner
209
- - Docs artifact writer
210
-
211
- Existing seeds:
212
-
213
- - `utility-markdown-index`
214
- - `subagent-review`
215
- - `subagent-plan`
216
- - `subagent-artifact`
217
-
218
- Implemented seed:
219
-
220
- - `pipeline-docs-maintenance`: docs index → documentation review → maintenance plan → artifact report.
221
-
222
- ### Media/Playlist Operations Cell
223
-
224
- Purpose: convert local media directories into controllable playback workflows.
225
-
226
- Pipeline:
227
-
228
- ```text
229
- media scan → playlist build → playback start → message summary → controls
230
- ```
231
-
232
- Likely needed cells:
233
-
234
- - Playlist builder
235
- - Music player
236
- - Run/message summary
237
- - Control recommender
238
-
239
- Existing seeds:
240
-
241
- - `utility-playlist-build`
242
- - `music-player`
243
- - `utility-run-summary`
244
- - `utility-jsonl-tail`
245
-
246
- Implemented seed:
247
-
248
- - `pipeline-media-library`: playlist build → media-library artifact report.
249
-
250
- ## Selection Rule
251
-
252
- Prefer adding a high-level recipe when at least three cells already exist and the missing cells are small. Prefer adding an atom when multiple high-level recipes need the same missing cell.
253
-
254
- ## Near-Term Candidates
255
-
256
- Good next candidates for the standard library after the first task-first wave:
257
-
258
- 1. Package/release metadata enrichment: implemented in `pipeline-release-readiness` by adding `utility-package-summary` and `utility-skill-summary` between changelog extraction and validation, making release-readiness reports more evidence-rich without adding publish automation.
259
- 2. Evidence-only release summary: implemented as `pipeline-release-summary`, which composes changelog/package/skill/validation evidence into a release summary, risk checklist, and PR body draft artifact while leaving commit, PR, merge, tag, and publish actions to explicit release gates.
260
- 3. Artifact packaging and manifesting: implemented as `pipeline-artifact-bundle`, which composes optional validation, `pipeline-artifact-write`, `utility-artifact-manifest`, deterministic manifest writing, and an actor-message handoff when the caller explicitly requests filesystem writes.
261
- 4. Async run cleanup planning: extend async-run operations with stale-run classification and recommended `message`, `cancel`, or `kill` controls, keeping actual control execution operator-gated.
262
-
263
- Each candidate should land with the minimum missing cells rather than a broad one-shot framework. Already implemented task-first seeds include `pipeline-release-readiness`, `pipeline-release-summary`, `pipeline-repo-health`, `pipeline-async-run-ops`, `pipeline-docs-maintenance`, `pipeline-media-library`, and `pipeline-artifact-bundle`.
@@ -1,13 +0,0 @@
1
- {
2
- "to": "branch:demo/reviewer",
3
- "from": "run:demo",
4
- "type": "task.assign",
5
- "summary": "Review the current slice",
6
- "body": {
7
- "task": "Check mailbox loop semantics"
8
- },
9
- "correlation_id": "task-001",
10
- "metadata": {
11
- "requires_response": true
12
- }
13
- }
@@ -1,15 +0,0 @@
1
- {
2
- "accepts": [
3
- "task.assign",
4
- {
5
- "type": "control.stop",
6
- "description": "Request graceful worker shutdown"
7
- }
8
- ],
9
- "emits": [
10
- "task.claim",
11
- "task.result",
12
- "awaiting_assignment",
13
- "actor.leave"
14
- ]
15
- }
@@ -1,11 +0,0 @@
1
- {
2
- "to": "room:demo",
3
- "from": "branch:demo/worker",
4
- "type": "task.result",
5
- "summary": "Worker completed task",
6
- "body": {
7
- "id": "inbox-001",
8
- "result": "ok"
9
- },
10
- "received_at": "2026-05-26T00:00:00.000Z"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "room": "main",
3
- "members": {
4
- "branch:demo/worker": {
5
- "display": "worker",
6
- "role": "worker",
7
- "status": "present",
8
- "last_seen": "2026-05-26T00:00:00.000Z"
9
- }
10
- }
11
- }
@@ -1,9 +0,0 @@
1
- {
2
- "id": "inbox-001",
3
- "status": "queued",
4
- "queued_at": "2026-05-26T00:00:00.000Z",
5
- "to": "run:demo",
6
- "from": "coordinator",
7
- "type": "control.continue",
8
- "body": "continue"
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "id": "event-001",
3
- "type": "task.result",
4
- "summary": "Worker completed task",
5
- "body": {
6
- "result": "ok"
7
- },
8
- "created_at": "2026-05-26T00:00:00.000Z"
9
- }
@@ -1,144 +0,0 @@
1
- /**
2
- * Mailbox worker loop primitives.
3
- * Zones: mailbox-consuming actors, run/branch inbox claiming, handler status transitions
4
- * Owns reusable claim/handle/drain behavior across run and branch inboxes; scheduling and task policy stay outside.
5
- */
6
-
7
- import {
8
- claimBranchInboxMessage,
9
- updateBranchInboxMessageStatus,
10
- type BranchInboxRecord,
11
- } from "./rooms.ts";
12
- import {
13
- claimRunInboxMessage,
14
- updateRunInboxMessageStatus,
15
- type RunInboxMessage,
16
- } from "./async-runs.ts";
17
-
18
- export type MailboxLoopMessage = RunInboxMessage | BranchInboxRecord;
19
-
20
- export type MailboxLoopTarget =
21
- | {
22
- kind: "run";
23
- runOrDir: string;
24
- }
25
- | {
26
- address: string;
27
- kind: "branch";
28
- run: string;
29
- stateDir: string;
30
- };
31
-
32
- export interface MailboxLoopClaimOptions {
33
- owner?: string;
34
- statuses?: string[];
35
- }
36
-
37
- export interface MailboxLoopHandleResult {
38
- handled: boolean;
39
- id?: string;
40
- message?: MailboxLoopMessage;
41
- target: MailboxLoopTarget;
42
- }
43
-
44
- export interface MailboxLoopDrainOptions extends MailboxLoopClaimOptions {
45
- maxMessages?: number;
46
- stopOnControl?: boolean;
47
- }
48
-
49
- export interface MailboxLoopDrainResult {
50
- handled: number;
51
- stopped: boolean;
52
- target: MailboxLoopTarget;
53
- }
54
-
55
- export function isMailboxLoopStopMessage(message: unknown): boolean {
56
- const type =
57
- message && typeof message === "object" && "type" in message
58
- ? (message as { type?: unknown }).type
59
- : undefined;
60
- return type === "control.kill";
61
- }
62
-
63
- function messageId(
64
- message: MailboxLoopMessage | undefined,
65
- ): string | undefined {
66
- return typeof message?.id === "string" ? message.id : undefined;
67
- }
68
-
69
- export function claimMailboxLoopMessage(
70
- target: MailboxLoopTarget,
71
- options: MailboxLoopClaimOptions = {},
72
- ): MailboxLoopMessage | undefined {
73
- const owner = options.owner ?? "mailbox-loop";
74
- const statuses = options.statuses ?? ["queued"];
75
- return target.kind === "run"
76
- ? claimRunInboxMessage(target.runOrDir, owner, statuses)
77
- : claimBranchInboxMessage(
78
- target.stateDir,
79
- target.run,
80
- target.address,
81
- owner,
82
- statuses,
83
- );
84
- }
85
-
86
- export function updateMailboxLoopMessageStatus(
87
- target: MailboxLoopTarget,
88
- id: string,
89
- status: "claimed" | "handled" | "failed",
90
- metadata: Record<string, unknown> = {},
91
- ): boolean {
92
- return target.kind === "run"
93
- ? updateRunInboxMessageStatus(target.runOrDir, id, status, metadata)
94
- : updateBranchInboxMessageStatus(
95
- target.stateDir,
96
- target.run,
97
- target.address,
98
- id,
99
- status,
100
- metadata,
101
- );
102
- }
103
-
104
- export async function handleMailboxLoopOnce(
105
- target: MailboxLoopTarget,
106
- handler: (message: MailboxLoopMessage) => Promise<void> | void,
107
- options: MailboxLoopClaimOptions = {},
108
- ): Promise<MailboxLoopHandleResult> {
109
- const message = claimMailboxLoopMessage(target, options);
110
- const id = messageId(message);
111
- if (!message || !id) return { handled: false, target };
112
- try {
113
- await handler(message);
114
- updateMailboxLoopMessageStatus(target, id, "handled");
115
- return { handled: true, id, message, target };
116
- } catch (error) {
117
- updateMailboxLoopMessageStatus(target, id, "failed", {
118
- error: error instanceof Error ? error.message : String(error),
119
- });
120
- throw error;
121
- }
122
- }
123
-
124
- export async function drainMailboxLoopMessages(
125
- target: MailboxLoopTarget,
126
- handler: (message: MailboxLoopMessage) => Promise<void> | void,
127
- options: MailboxLoopDrainOptions = {},
128
- ): Promise<MailboxLoopDrainResult> {
129
- const maxMessages = Math.max(1, Math.floor(options.maxMessages ?? 100));
130
- let handled = 0;
131
- for (; handled < maxMessages; handled += 1) {
132
- const result = await handleMailboxLoopOnce(target, handler, options);
133
- if (!result.handled || !result.message) {
134
- return { handled, stopped: false, target };
135
- }
136
- if (
137
- options.stopOnControl !== false &&
138
- isMailboxLoopStopMessage(result.message)
139
- ) {
140
- return { handled: handled + 1, stopped: true, target };
141
- }
142
- }
143
- return { handled, stopped: false, target };
144
- }
package/lib/messages.ts DELETED
@@ -1,151 +0,0 @@
1
- /**
2
- * Actor message protocol.
3
- * Zones: addressed envelopes, address parsing, route normalization
4
- * Owns pure validation/normalization for semantic actor messages; transport routing stays in adapters.
5
- */
6
-
7
- export type ActorAddressKind =
8
- | "branch"
9
- | "coordinator"
10
- | "room"
11
- | "run"
12
- | "session"
13
- | "tool";
14
-
15
- export interface ActorAddress {
16
- kind: ActorAddressKind;
17
- value?: string;
18
- branch?: string;
19
- room?: string;
20
- }
21
-
22
- export interface ActorMessage {
23
- to: string;
24
- type: string;
25
- body?: unknown;
26
- correlation_id?: string;
27
- from?: string;
28
- metadata?: Record<string, unknown>;
29
- reply_to?: string;
30
- summary?: string;
31
- }
32
-
33
- const ADDRESS_PATTERN = /^[A-Za-z0-9_.-]+$/;
34
- const MESSAGE_TYPE_PATTERN = /^[A-Za-z][A-Za-z0-9_.:-]*$/;
35
-
36
- function assertToken(value: string, label: string): string {
37
- const normalized = value.trim();
38
- if (!normalized) throw new Error(`${label} is required`);
39
- if (!ADDRESS_PATTERN.test(normalized)) {
40
- throw new Error(`${label} contains unsupported characters: ${value}`);
41
- }
42
- return normalized;
43
- }
44
-
45
- export function parseActorAddress(address: string): ActorAddress {
46
- const value = address.trim();
47
- if (value === "coordinator") return { kind: "coordinator" };
48
- const separator = value.indexOf(":");
49
- if (separator < 0)
50
- throw new Error(`Actor address must include kind: ${address}`);
51
- const kind = value.slice(0, separator) as ActorAddressKind;
52
- const rest = value.slice(separator + 1);
53
- switch (kind) {
54
- case "branch": {
55
- const [run, branch, ...extra] = rest.split("/");
56
- if (extra.length > 0)
57
- throw new Error(`Branch address has too many parts: ${address}`);
58
- return {
59
- kind,
60
- value: assertToken(run || "", "branch run"),
61
- branch: assertToken(branch || "", "branch id"),
62
- };
63
- }
64
- case "room": {
65
- const [run, room, ...extra] = rest.split("/");
66
- if (extra.length > 0)
67
- throw new Error(`Room address has too many parts: ${address}`);
68
- if (room && room !== "main") {
69
- throw new Error("Task rooms do not support named subrooms; use room:<run>.");
70
- }
71
- return {
72
- kind,
73
- value: assertToken(run || "", "room run"),
74
- room: "main",
75
- };
76
- }
77
- case "run":
78
- case "session":
79
- case "tool":
80
- return { kind, value: assertToken(rest, `${kind} address`) };
81
- default:
82
- throw new Error(`Unsupported actor address kind: ${kind}`);
83
- }
84
- }
85
-
86
- export function formatActorAddress(address: ActorAddress): string {
87
- if (address.kind === "coordinator") return "coordinator";
88
- if (address.kind === "branch") {
89
- return `branch:${assertToken(address.value || "", "branch run")}/${assertToken(address.branch || "", "branch id")}`;
90
- }
91
- if (address.kind === "room") {
92
- return `room:${assertToken(address.value || "", "room run")}`;
93
- }
94
- return `${address.kind}:${assertToken(address.value || "", `${address.kind} address`)}`;
95
- }
96
-
97
- function normalizeOptionalString(
98
- value: unknown,
99
- label: string,
100
- ): string | undefined {
101
- if (value === undefined || value === null) return undefined;
102
- if (typeof value !== "string") throw new Error(`${label} must be a string`);
103
- const normalized = value.trim();
104
- return normalized || undefined;
105
- }
106
-
107
- function normalizeMetadata(
108
- value: unknown,
109
- ): Record<string, unknown> | undefined {
110
- if (value === undefined || value === null) return undefined;
111
- if (typeof value !== "object" || Array.isArray(value)) {
112
- throw new Error("message metadata must be an object");
113
- }
114
- return value as Record<string, unknown>;
115
- }
116
-
117
- export function normalizeActorMessage(input: unknown): ActorMessage {
118
- if (!input || typeof input !== "object" || Array.isArray(input)) {
119
- throw new Error("actor message must be an object");
120
- }
121
- const record = input as Record<string, unknown>;
122
- const to = normalizeOptionalString(record.to, "message.to");
123
- if (!to) throw new Error("message.to is required");
124
- const parsedTo = parseActorAddress(to);
125
- const type = normalizeOptionalString(record.type, "message.type");
126
- if (!type) throw new Error("message.type is required");
127
- if (!MESSAGE_TYPE_PATTERN.test(type)) {
128
- throw new Error(`message.type contains unsupported characters: ${type}`);
129
- }
130
- const from = normalizeOptionalString(record.from, "message.from");
131
- if (from) parseActorAddress(from);
132
- const normalizedTo = formatActorAddress(parsedTo);
133
- return {
134
- to: normalizedTo,
135
- type,
136
- ...(record.body !== undefined ? { body: record.body } : {}),
137
- ...(record.correlation_id !== undefined
138
- ? { correlation_id: String(record.correlation_id) }
139
- : {}),
140
- ...(from ? { from: formatActorAddress(parseActorAddress(from)) } : {}),
141
- ...(record.metadata !== undefined
142
- ? { metadata: normalizeMetadata(record.metadata) }
143
- : {}),
144
- ...(record.reply_to !== undefined
145
- ? { reply_to: String(record.reply_to) }
146
- : {}),
147
- ...(record.summary !== undefined
148
- ? { summary: String(record.summary) }
149
- : {}),
150
- };
151
- }