@osolmaz/pi-workflows 0.16.2 → 0.16.3

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 (315) hide show
  1. package/README.md +41 -41
  2. package/dist/builtins/monitor.workflow.d.ts +1 -1
  3. package/dist/builtins/monitor.workflow.js +8 -8
  4. package/dist/builtins/pi-agent-group.js +3 -3
  5. package/dist/builtins/pi-agent-group.js.map +1 -1
  6. package/dist/channels/adapter-entry.js +14 -14
  7. package/dist/channels/adapter-entry.js.map +1 -1
  8. package/dist/client/client.d.ts +6 -6
  9. package/dist/client/client.js +27 -27
  10. package/dist/client/client.js.map +1 -1
  11. package/dist/client/protocol.d.ts +4 -1
  12. package/dist/client/protocol.js +17 -11
  13. package/dist/client/protocol.js.map +1 -1
  14. package/dist/client/resolver.d.ts +4 -4
  15. package/dist/client/view.d.ts +1 -1
  16. package/dist/extension/index.d.ts +1 -1
  17. package/dist/extension/index.js +32 -32
  18. package/dist/extension/index.js.map +1 -1
  19. package/dist/extension/recorder.d.ts +1 -1
  20. package/dist/extension/recorder.js +1 -1
  21. package/dist/extension/recorder.js.map +1 -1
  22. package/dist/extension/remote-recorder-store.d.ts +1 -1
  23. package/dist/extension/remote-recorder-store.js +2 -2
  24. package/dist/extension/remote-recorder-store.js.map +1 -1
  25. package/dist/extension/{controller-command.d.ts → resource-manager-command.d.ts} +6 -6
  26. package/dist/extension/{controller-command.js → resource-manager-command.js} +7 -7
  27. package/dist/extension/resource-manager-command.js.map +1 -0
  28. package/dist/extension/session-delivery.d.ts +1 -1
  29. package/dist/extension/session-delivery.js +2 -2
  30. package/dist/extension/session-delivery.js.map +1 -1
  31. package/dist/extension/session-view.d.ts +1 -1
  32. package/dist/extension/session-view.js +1 -1
  33. package/dist/extension/session-view.js.map +1 -1
  34. package/dist/extension/workflow-message-coordinator.d.ts +1 -1
  35. package/dist/extension/workflow-message-coordinator.js +6 -6
  36. package/dist/extension/workflow-message-coordinator.js.map +1 -1
  37. package/dist/resource-managers/conditions.d.ts +6 -0
  38. package/dist/{controllers → resource-managers}/conditions.js +3 -3
  39. package/dist/resource-managers/conditions.js.map +1 -0
  40. package/dist/resource-managers/definition.d.ts +6 -0
  41. package/dist/resource-managers/definition.js +45 -0
  42. package/dist/resource-managers/definition.js.map +1 -0
  43. package/dist/resource-managers/effects.d.ts +15 -0
  44. package/dist/{controllers → resource-managers}/effects.js +2 -2
  45. package/dist/resource-managers/effects.js.map +1 -0
  46. package/dist/resource-managers/errors.d.ts +12 -0
  47. package/dist/resource-managers/errors.js +25 -0
  48. package/dist/resource-managers/errors.js.map +1 -0
  49. package/dist/resource-managers/index.d.ts +12 -0
  50. package/dist/resource-managers/index.js +12 -0
  51. package/dist/resource-managers/index.js.map +1 -0
  52. package/dist/resource-managers/json.js.map +1 -0
  53. package/dist/resource-managers/loader.d.ts +23 -0
  54. package/dist/resource-managers/loader.js +75 -0
  55. package/dist/resource-managers/loader.js.map +1 -0
  56. package/dist/resource-managers/results.d.ts +5 -0
  57. package/dist/resource-managers/results.js.map +1 -0
  58. package/dist/resource-managers/runtime.d.ts +59 -0
  59. package/dist/{controllers/manager.js → resource-managers/runtime.js} +57 -57
  60. package/dist/resource-managers/runtime.js.map +1 -0
  61. package/dist/{controllers → resource-managers}/sqlite.d.ts +44 -44
  62. package/dist/{controllers → resource-managers}/sqlite.js +139 -130
  63. package/dist/resource-managers/sqlite.js.map +1 -0
  64. package/dist/{controllers → resource-managers}/store.d.ts +33 -33
  65. package/dist/{controllers → resource-managers}/store.js.map +1 -1
  66. package/dist/{controllers → resource-managers}/types.d.ts +41 -41
  67. package/dist/{controllers → resource-managers}/types.js.map +1 -1
  68. package/dist/resource-managers/workflows.d.ts +34 -0
  69. package/dist/{controllers → resource-managers}/workflows.js +15 -15
  70. package/dist/resource-managers/workflows.js.map +1 -0
  71. package/dist/server/channel-effects.js.map +1 -0
  72. package/dist/{host → server}/channel-supervisor.d.ts +6 -6
  73. package/dist/{host → server}/channel-supervisor.js +3 -3
  74. package/dist/server/channel-supervisor.js.map +1 -0
  75. package/dist/{host/child-worker-supervisor.d.ts → server/child-runner-supervisor.d.ts} +15 -13
  76. package/dist/{host/child-worker-supervisor.js → server/child-runner-supervisor.js} +6 -5
  77. package/dist/server/child-runner-supervisor.js.map +1 -0
  78. package/dist/{host → server}/processes.d.ts +3 -3
  79. package/dist/{host → server}/processes.js +3 -3
  80. package/dist/server/processes.js.map +1 -0
  81. package/dist/{host → server}/resolver-entry.d.ts +6 -6
  82. package/dist/{host → server}/resolver-entry.js +14 -14
  83. package/dist/server/resolver-entry.js.map +1 -0
  84. package/dist/server/resource-runner-entry.d.ts +2 -0
  85. package/dist/{host/controller-worker-entry.js → server/resource-runner-entry.js} +33 -33
  86. package/dist/server/resource-runner-entry.js.map +1 -0
  87. package/dist/server/resource-runner-protocol.d.ts +36 -0
  88. package/dist/server/resource-runner-protocol.js +49 -0
  89. package/dist/server/resource-runner-protocol.js.map +1 -0
  90. package/dist/server/resource-runner-supervisor.d.ts +21 -0
  91. package/dist/{host/worker-supervisor.js → server/resource-runner-supervisor.js} +17 -17
  92. package/dist/server/resource-runner-supervisor.js.map +1 -0
  93. package/dist/{host → server}/rpc-bridge.d.ts +3 -3
  94. package/dist/{host → server}/rpc-bridge.js +3 -3
  95. package/dist/server/rpc-bridge.js.map +1 -0
  96. package/dist/{host → server}/rpc-executor.d.ts +1 -1
  97. package/dist/{host → server}/rpc-executor.js +3 -3
  98. package/dist/server/rpc-executor.js.map +1 -0
  99. package/dist/{host/host-entry.js → server/server-entry.js} +6 -6
  100. package/dist/server/server-entry.js.map +1 -0
  101. package/dist/{host/runner.d.ts → server/server.d.ts} +39 -38
  102. package/dist/{host/runner.js → server/server.js} +408 -374
  103. package/dist/server/server.js.map +1 -0
  104. package/dist/{host → server}/state.d.ts +25 -25
  105. package/dist/{host → server}/state.js +49 -49
  106. package/dist/server/state.js.map +1 -0
  107. package/dist/{host → server}/view.d.ts +7 -7
  108. package/dist/{host → server}/view.js +13 -13
  109. package/dist/server/view.js.map +1 -0
  110. package/dist/server/workflow-runner-content.d.ts +6 -0
  111. package/dist/server/workflow-runner-content.js +96 -0
  112. package/dist/server/workflow-runner-content.js.map +1 -0
  113. package/dist/{host/worker-entry.d.ts → server/workflow-runner-entry.d.ts} +3 -3
  114. package/dist/{host/worker-entry.js → server/workflow-runner-entry.js} +68 -35
  115. package/dist/server/workflow-runner-entry.js.map +1 -0
  116. package/dist/server/workflow-runner-protocol.d.ts +69 -0
  117. package/dist/server/workflow-runner-protocol.js +176 -0
  118. package/dist/server/workflow-runner-protocol.js.map +1 -0
  119. package/dist/{host/worker-store.d.ts → server/workflow-runner-store.d.ts} +11 -11
  120. package/dist/{host/worker-store.js → server/workflow-runner-store.js} +8 -8
  121. package/dist/server/workflow-runner-store.js.map +1 -0
  122. package/dist/server/workflow-runner-supervisor.d.ts +22 -0
  123. package/dist/server/workflow-runner-supervisor.js +56 -0
  124. package/dist/server/workflow-runner-supervisor.js.map +1 -0
  125. package/dist/state/prune.d.ts +1 -1
  126. package/dist/state/prune.js +17 -10
  127. package/dist/state/prune.js.map +1 -1
  128. package/dist/state/schema.js +2 -2
  129. package/dist/state/workflow-messages.d.ts +1 -1
  130. package/dist/state/workflow-messages.js +1 -1
  131. package/dist/state/workflow-messages.js.map +1 -1
  132. package/dist/viewer/backup.js +1 -1
  133. package/dist/viewer/backup.js.map +1 -1
  134. package/dist/viewer/cli.d.ts +2 -2
  135. package/dist/viewer/cli.js +46 -32
  136. package/dist/viewer/cli.js.map +1 -1
  137. package/dist/viewer/tui.d.ts +1 -1
  138. package/dist/viewer/tui.js +1 -1
  139. package/dist/viewer/tui.js.map +1 -1
  140. package/dist/workflows/command-batch.js +2 -2
  141. package/dist/workflows/engine.js +14 -15
  142. package/dist/workflows/engine.js.map +1 -1
  143. package/dist/workflows/store.d.ts +12 -11
  144. package/dist/workflows/store.js +24 -18
  145. package/dist/workflows/store.js.map +1 -1
  146. package/dist/workflows/types.d.ts +2 -2
  147. package/docs/2026-08-20-durable-workflow-launch-plan.md +12 -12
  148. package/docs/2026-08-25-workflow-follow-ups.md +7 -7
  149. package/docs/2026-08-25-workflow-settings.md +3 -3
  150. package/docs/2026-08-30-out-of-process-workflow-host-plan.md +3 -3
  151. package/docs/2026-09-01-restore-session-delivery-controls-plan.md +5 -5
  152. package/docs/2026-09-01-unified-workflow-client-plan.md +6 -6
  153. package/docs/2026-09-02-installed-live-e2e-plan.md +3 -3
  154. package/docs/2026-09-02-unify-workflow-messages-plan.md +8 -8
  155. package/docs/2026-09-04-workflow-run-state-plan.md +6 -6
  156. package/docs/DEFERRED_TURNS.md +7 -7
  157. package/docs/DESIGN_PHILOSOPHY.md +1 -1
  158. package/docs/HUMAN_DECISIONS.md +11 -11
  159. package/docs/HUMAN_DECISION_PRESENTATIONS.md +4 -4
  160. package/docs/MONITOR.md +1 -1
  161. package/docs/RESOURCE_MANAGERS.md +221 -0
  162. package/docs/SQLITE_STATE.md +35 -33
  163. package/docs/WORKFLOW_COMPOSITION.md +1 -1
  164. package/docs/{WORKFLOW_HOST.md → WORKFLOW_SERVER.md} +125 -119
  165. package/docs/WORKFLOW_STEP_MESSAGES.md +18 -18
  166. package/docs/WORKFLOW_UPDATES.md +16 -16
  167. package/docs/development.md +15 -14
  168. package/docs/live-replay-protocol.md +20 -20
  169. package/docs/plans/2026-08-04-controller-runtime-plan.md +25 -25
  170. package/docs/plans/2026-08-05-always-on-workflows-plan.md +8 -8
  171. package/docs/plans/2026-08-10-agent-managed-monitor-workflows-plan.md +2 -2
  172. package/docs/plans/2026-08-13-session-addressed-workflow-notifications-plan.md +1 -1
  173. package/docs/plans/2026-08-16-workflow-updates-plan.md +5 -5
  174. package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
  175. package/docs/plans/2026-08-20-bounded-command-batches-plan.md +1 -1
  176. package/docs/plans/2026-08-21-deferred-turn-intents-plan.md +3 -3
  177. package/docs/plans/2026-08-21-sanity-check-plan.md +2 -2
  178. package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +5 -5
  179. package/docs/plans/2026-08-23-sqlite-state-plan.md +25 -25
  180. package/docs/plans/2026-08-25-live-workflow-settings-plan.md +4 -4
  181. package/docs/plans/2026-08-27-workflow-terminal-restart-plan.md +3 -3
  182. package/docs/plans/2026-09-04-workflow-runner-resume-state-plan.md +318 -0
  183. package/docs/plans/piw-viewer-experience-implementation-plan.md +1 -1
  184. package/docs/tui-viewer.md +9 -9
  185. package/docs/workflows.md +72 -66
  186. package/examples/{controllers/pull-request.controller.ts → resource-managers/pull-request.resource-manager.ts} +12 -12
  187. package/herdr-plugin.toml +1 -1
  188. package/package.json +5 -5
  189. package/protocol/client.v1.schema.json +7 -7
  190. package/protocol/fixtures/client-v1.json +1 -1
  191. package/src/builtins/monitor.workflow.ts +9 -9
  192. package/src/builtins/pi-agent-group.ts +3 -3
  193. package/src/channels/adapter-entry.ts +14 -14
  194. package/src/client/client.ts +33 -32
  195. package/src/client/protocol.ts +16 -11
  196. package/src/client/resolver.ts +4 -4
  197. package/src/client/view.ts +1 -1
  198. package/src/extension/index.ts +44 -34
  199. package/src/extension/recorder.ts +1 -1
  200. package/src/extension/remote-recorder-store.ts +2 -2
  201. package/src/extension/resource-manager-command.ts +45 -0
  202. package/src/extension/session-delivery.ts +2 -2
  203. package/src/extension/session-view.ts +1 -1
  204. package/src/extension/workflow-message-coordinator.ts +6 -6
  205. package/src/{controllers → resource-managers}/conditions.ts +23 -23
  206. package/src/resource-managers/definition.ts +71 -0
  207. package/src/{controllers → resource-managers}/effects.ts +9 -9
  208. package/src/resource-managers/errors.ts +27 -0
  209. package/src/resource-managers/index.ts +88 -0
  210. package/src/resource-managers/loader.ts +111 -0
  211. package/src/{controllers → resource-managers}/results.ts +4 -4
  212. package/src/{controllers/manager.ts → resource-managers/runtime.ts} +95 -92
  213. package/src/{controllers → resource-managers}/sqlite.ts +198 -186
  214. package/src/{controllers → resource-managers}/store.ts +46 -38
  215. package/src/{controllers → resource-managers}/types.ts +50 -41
  216. package/src/{controllers → resource-managers}/workflows.ts +43 -41
  217. package/src/{host → server}/channel-supervisor.ts +8 -8
  218. package/src/{host/child-worker-supervisor.ts → server/child-runner-supervisor.ts} +22 -18
  219. package/src/{host → server}/processes.ts +3 -3
  220. package/src/{host → server}/resolver-entry.ts +28 -25
  221. package/src/{host/controller-worker-entry.ts → server/resource-runner-entry.ts} +67 -65
  222. package/src/server/resource-runner-protocol.ts +103 -0
  223. package/src/server/resource-runner-supervisor.ts +76 -0
  224. package/src/{host → server}/rpc-bridge.ts +3 -3
  225. package/src/{host → server}/rpc-executor.ts +4 -4
  226. package/src/{host/host-entry.ts → server/server-entry.ts} +5 -5
  227. package/src/{host/runner.ts → server/server.ts} +526 -461
  228. package/src/{host → server}/state.ts +78 -67
  229. package/src/{host → server}/view.ts +15 -15
  230. package/src/server/workflow-runner-content.ts +119 -0
  231. package/src/{host/worker-entry.ts → server/workflow-runner-entry.ts} +98 -57
  232. package/src/server/workflow-runner-protocol.ts +241 -0
  233. package/src/{host/worker-store.ts → server/workflow-runner-store.ts} +18 -20
  234. package/src/server/workflow-runner-supervisor.ts +79 -0
  235. package/src/state/prune.ts +27 -9
  236. package/src/state/schema.ts +2 -2
  237. package/src/state/workflow-messages.ts +1 -1
  238. package/src/viewer/backup.ts +1 -1
  239. package/src/viewer/cli.ts +50 -36
  240. package/src/viewer/tui.ts +1 -1
  241. package/src/workflows/command-batch.ts +2 -2
  242. package/src/workflows/engine.ts +14 -15
  243. package/src/workflows/store.ts +31 -28
  244. package/src/workflows/types.ts +2 -2
  245. package/dist/controllers/conditions.d.ts +0 -6
  246. package/dist/controllers/conditions.js.map +0 -1
  247. package/dist/controllers/definition.d.ts +0 -6
  248. package/dist/controllers/definition.js +0 -45
  249. package/dist/controllers/definition.js.map +0 -1
  250. package/dist/controllers/effects.d.ts +0 -15
  251. package/dist/controllers/effects.js.map +0 -1
  252. package/dist/controllers/errors.d.ts +0 -12
  253. package/dist/controllers/errors.js +0 -25
  254. package/dist/controllers/errors.js.map +0 -1
  255. package/dist/controllers/index.d.ts +0 -12
  256. package/dist/controllers/index.js +0 -12
  257. package/dist/controllers/index.js.map +0 -1
  258. package/dist/controllers/json.js.map +0 -1
  259. package/dist/controllers/loader.d.ts +0 -23
  260. package/dist/controllers/loader.js +0 -74
  261. package/dist/controllers/loader.js.map +0 -1
  262. package/dist/controllers/manager.d.ts +0 -59
  263. package/dist/controllers/manager.js.map +0 -1
  264. package/dist/controllers/results.d.ts +0 -5
  265. package/dist/controllers/results.js.map +0 -1
  266. package/dist/controllers/sqlite.js.map +0 -1
  267. package/dist/controllers/workflows.d.ts +0 -34
  268. package/dist/controllers/workflows.js.map +0 -1
  269. package/dist/extension/controller-command.js.map +0 -1
  270. package/dist/host/channel-effects.js.map +0 -1
  271. package/dist/host/channel-supervisor.js.map +0 -1
  272. package/dist/host/child-worker-supervisor.js.map +0 -1
  273. package/dist/host/controller-worker-entry.d.ts +0 -2
  274. package/dist/host/controller-worker-entry.js.map +0 -1
  275. package/dist/host/controller-worker-protocol.d.ts +0 -36
  276. package/dist/host/controller-worker-protocol.js +0 -49
  277. package/dist/host/controller-worker-protocol.js.map +0 -1
  278. package/dist/host/controller-worker-supervisor.d.ts +0 -21
  279. package/dist/host/controller-worker-supervisor.js +0 -54
  280. package/dist/host/controller-worker-supervisor.js.map +0 -1
  281. package/dist/host/host-entry.js.map +0 -1
  282. package/dist/host/processes.js.map +0 -1
  283. package/dist/host/resolver-entry.js.map +0 -1
  284. package/dist/host/rpc-bridge.js.map +0 -1
  285. package/dist/host/rpc-executor.js.map +0 -1
  286. package/dist/host/runner.js.map +0 -1
  287. package/dist/host/state.js.map +0 -1
  288. package/dist/host/view.js.map +0 -1
  289. package/dist/host/worker-entry.js.map +0 -1
  290. package/dist/host/worker-protocol.d.ts +0 -46
  291. package/dist/host/worker-protocol.js +0 -122
  292. package/dist/host/worker-protocol.js.map +0 -1
  293. package/dist/host/worker-store.js.map +0 -1
  294. package/dist/host/worker-supervisor.d.ts +0 -22
  295. package/dist/host/worker-supervisor.js.map +0 -1
  296. package/docs/CONTROLLERS.md +0 -217
  297. package/src/controllers/definition.ts +0 -65
  298. package/src/controllers/errors.ts +0 -27
  299. package/src/controllers/index.ts +0 -88
  300. package/src/controllers/loader.ts +0 -104
  301. package/src/extension/controller-command.ts +0 -45
  302. package/src/host/controller-worker-protocol.ts +0 -104
  303. package/src/host/controller-worker-supervisor.ts +0 -79
  304. package/src/host/worker-protocol.ts +0 -176
  305. package/src/host/worker-supervisor.ts +0 -74
  306. /package/dist/{controllers → resource-managers}/json.d.ts +0 -0
  307. /package/dist/{controllers → resource-managers}/json.js +0 -0
  308. /package/dist/{controllers → resource-managers}/results.js +0 -0
  309. /package/dist/{controllers → resource-managers}/store.js +0 -0
  310. /package/dist/{controllers → resource-managers}/types.js +0 -0
  311. /package/dist/{host → server}/channel-effects.d.ts +0 -0
  312. /package/dist/{host → server}/channel-effects.js +0 -0
  313. /package/dist/{host/host-entry.d.ts → server/server-entry.d.ts} +0 -0
  314. /package/src/{controllers → resource-managers}/json.ts +0 -0
  315. /package/src/{host → server}/channel-effects.ts +0 -0
package/docs/workflows.md CHANGED
@@ -21,7 +21,7 @@ planning workflow that was first released as `autodevise`; the old command and
21
21
  export are not retained. A project or global file named `monitor.workflow.ts`
22
22
  replaces the built-in monitor. Each built-in has a stable reference such as
23
23
  `builtin:monitor` and an explicit revision. A resolver child snapshots the
24
- selected built-in before start, and each run worker verifies that identity
24
+ selected built-in before start, and each run runner verifies that identity
25
25
  before execution. A revision mismatch refuses resume. Project and global
26
26
  workflow files also use their absolute path and SHA-256 hash as source
27
27
  identity.
@@ -108,54 +108,60 @@ Function actions receive `WorkflowActionContext`, which adds
108
108
 
109
109
  ## Durable runs, parking, and resume
110
110
 
111
- Every run enters one global SQLite queue. One package-owned host claims runs,
111
+ Every run enters one global SQLite queue. One package-owned server claims runs,
112
112
  renews live claims, commits state, and supervises one child process for each
113
- active run generation. The extension is a local host client. It does not run
113
+ active run generation. The extension is a local server client. It does not run
114
114
  the workflow engine or workflow definitions.
115
115
 
116
- The host starts on demand when a Pi or CLI client needs it. These commands
117
- control the same user-level host for all projects:
116
+ The server starts on demand when a Pi or CLI client needs it. These commands
117
+ control the same user-level server for all projects:
118
118
 
119
119
  ```bash
120
- pi-workflows host start
121
- pi-workflows host status
122
- pi-workflows host stop
123
- pi-workflows host run
120
+ pi-workflows server start
121
+ pi-workflows server status
122
+ pi-workflows server stop
123
+ pi-workflows server run
124
124
  ```
125
125
 
126
- `host run` stays attached. The other commands start, inspect, or stop the
126
+ `server run` stays attached. The other commands start, inspect, or stop the
127
127
  on-demand process. No command installs an operating-system service.
128
128
 
129
- The extension, CLI, and `piw` use the same version-1 client protocol over a Unix socket or Windows named pipe. The host sends byte-bounded run-list and run-view pages. Clients collect a complete run list for one revision and reject stale run pages whose cursor or revision no longer matches. The host reads only the selected history ranges and reuses an unchanged subscribed view after a lightweight revision check. It waits for a slow socket to drain and removes every subscription when its client unsubscribes. Large values stay available through verified content chunks. Host-generated aggregate values are saved and linked to the run before the host advertises them.
129
+ The extension, CLI, and `piw` use the same version-1 client protocol over a Unix socket or Windows named pipe. The server sends byte-bounded run-list and run-view pages. Clients collect a complete run list for one revision and reject stale run pages whose cursor or revision no longer matches. The server reads only the selected history ranges and reuses an unchanged subscribed view after a lightweight revision check. It waits for a slow socket to drain and removes every subscription when its client unsubscribes. Large values stay available through verified content chunks. Server-generated aggregate values are saved and linked to the run before the server advertises them.
130
130
 
131
- A worker verifies the root and all mounted source identities before it loads
131
+ A runner verifies the root and all mounted source identities before it loads
132
132
  workflow modules. It then checks the resolved mounted-source map and executes
133
- from committed state through a host-backed store. A source mismatch parks the
133
+ from committed state through a server-backed store. Resume and continuation
134
+ reads return only `WorkflowRunState`. Session messages, tool results, activity
135
+ events, viewer history, settings, follow-ups, and other inspection data stay in
136
+ server-owned SQLite. If one required result exceeds the runner protocol frame,
137
+ the server returns a digest-bound reference and the runner reads and verifies it
138
+ in bounded parts. A source mismatch parks the
134
139
  run with `workflowSourceChanged`; normal scheduling does not retry it. Restore
135
140
  the recorded source and explicitly resume, or cancel the run. A headless Pi
136
- child uses its own registered process group. The worker stops that group on
137
- normal completion, and the host reaps it if the worker exits first. If the
138
- worker stops for another recoverable reason, pure work can run again. A
141
+ child uses its own registered process group. The runner stops that group on
142
+ normal completion, and the server reaps it if the runner exits first. If the
143
+ runner stops for another recoverable reason, pure work can run again. A
139
144
  protected write checks and renews the exact live token and generation in one
140
145
  transaction. An expired or replaced owner cannot revive itself.
141
146
 
142
147
  Interactive agent and assistant-message steps do not run headlessly for a Pi
143
- session. The worker commits a durable interaction request and parks. The origin
148
+ session. The runner commits a durable interaction request and parks. The origin
144
149
  session presents the request through documented Pi APIs and submits the exact
145
- request, node, attempt, and revision. The host records submitted output as
146
- provisional. A new supervised worker loads the workflow and runs its `validate`
147
- function before the host accepts the submission. A validation error leaves the
150
+ request, node, attempt, and revision. The server records submitted output as
151
+ provisional. A new supervised runner loads the workflow and runs its `validate`
152
+ function before the server accepts the submission. A validation error leaves the
148
153
  same request pending and returns the error to the model. Closing Pi leaves that
149
154
  request pending; reopening the same session adopts the existing session entry
150
155
  or presents it once. Step prompts, protected decisions, notifications, terminal
151
- results, and follow-ups use the host-owned `workflow_messages` table and one
156
+ results, and follow-ups use the server-owned `workflow_messages` table and one
152
157
  extension sender. Initial, reminder, and resumed prompts are the same step-message
153
- kind with different display reasons. A terminal workflow message becomes eligible only after
154
- the terminal outcome is committed. A controller child without an origin session can use a supervised
155
- headless `pi --mode rpc` child for structured agent steps.
158
+ kind with different display reasons. A terminal workflow message becomes
159
+ eligible only after the terminal outcome is committed. A resource manager child
160
+ without an origin session can use a supervised headless `pi --mode rpc` child
161
+ for structured agent steps.
156
162
 
157
- Pause stops the worker and parks at the last durable boundary. Resume takes a
158
- new generation. Cancellation can stop a live worker or atomically claim and
163
+ Pause stops the runner and parks at the last durable boundary. Resume takes a
164
+ new generation. Cancellation can stop a live runner or atomically claim and
159
165
  cancel an expired running row. Resume refuses changed workflow source.
160
166
 
161
167
  ## Node types
@@ -194,15 +200,15 @@ agent({
194
200
  because an invalid response is already visible and must not be retried.
195
201
 
196
202
  For submitted output, the engine appends the existing workflow-tool contract.
197
- The host checks the durable transport identifiers, stores a `validating`
198
- submission, and starts a supervised worker. In that worker, the output passes
203
+ The server checks the durable transport identifiers, stores a `validating`
204
+ submission, and starts a supervised runner. In that runner, the output passes
199
205
  through tolerant JSON normalization and then `validate`. The tool reports
200
206
  success only after this check accepts the output. If the tool turn is aborted,
201
- the client stops waiting but does not cancel the durable host command. A retry
207
+ the client stops waiting but does not cancel the durable server command. A retry
202
208
  uses a new transport request ID with the same durable submission identity and
203
209
  adopts the stored result. Rejected submissions return
204
210
  the validation error and can retry in the same step. If the model settles
205
- without submitting, the host increments the request's unproductive-turn counter
211
+ without submitting, the server increments the request's unproductive-turn counter
206
212
  and can create at most two step messages with reason `reminder`. The next
207
213
  unproductive turn fails the step. The timeout remains active during each
208
214
  reported model turn, and cancellation remains active throughout. For assistant-message output, the engine appends a normal-response contract,
@@ -214,7 +220,7 @@ form's active Pi turn.
214
220
  node context that returns either value. Omit it to use the 15-minute engine
215
221
  default. The limit counts active node execution. For an origin-session agent
216
222
  node, it counts reported model-turn time from an active connected Pi session.
217
- It excludes message delivery, waiting, paused time, disconnects, and host downtime. Set it to `null` to disable only this deadline; cancellation,
223
+ It excludes message delivery, waiting, paused time, disconnects, and server downtime. Set it to `null` to disable only this deadline; cancellation,
218
224
  parking, claim loss, shutdown, and the node's abort signal still work. A timeout
219
225
  function can use prepared outputs to select a policy for this run. It has 30
220
226
  seconds to return. Computed timeout functions are runtime code, so definition
@@ -232,7 +238,7 @@ compute({ run: ({ outputs }) => ({ merged: { ...outputs } }) });
232
238
 
233
239
  Queues a durable plain-text message for the Pi session that started the run.
234
240
  The runner does not write the message into its own conversation. A standalone
235
- host can execute this node, and the message still waits for the origin session.
241
+ server can execute this node, and the message still waits for the origin session.
236
242
 
237
243
  ```typescript
238
244
  notify({
@@ -245,13 +251,13 @@ The runtime gives each logical execution of a notification node a stable index.
245
251
  A retry after a crash reuses that index, so it cannot queue the same message
246
252
  twice. Re-entering the node later in a loop gets the next index. A workflow
247
253
  with a `notify` node must be an interactive queued run with an origin session.
248
- Controller child workflows are detached and must report through their
249
- controller resource instead.
254
+ ResourceManager child workflows are detached and must report through their
255
+ managed resource instead.
250
256
 
251
257
  ### action
252
258
 
253
259
  Performs managed work. Every function action and shell action must declare how
254
- the host recovers if the worker exits after the external operation but before
260
+ the server recovers if the runner exits after the external operation but before
255
261
  it saves a receipt.
256
262
 
257
263
  Use `idempotentEffect(type)` only when the operation has a stable external
@@ -267,8 +273,8 @@ action({
267
273
  ```
268
274
 
269
275
  Use `manualEffect(type)` when the external system cannot prove whether an
270
- uncertain request applied. An uncertain worker exit marks that effect
271
- `ambiguous`, parks the run, and requires explicit operator recovery. The host
276
+ uncertain request applied. An uncertain runner exit marks that effect
277
+ `ambiguous`, parks the run, and requires explicit operator recovery. The server
272
278
  does not retry it automatically.
273
279
 
274
280
  The shell form (`shell` is a synonym that requires `exec`) runs a command owned
@@ -323,7 +329,7 @@ keeps normal output capture. Lines and update data are each limited to 64 KiB.
323
329
  See [WORKFLOW_UPDATES.md](WORKFLOW_UPDATES.md) for the envelope, progress
324
330
  schema, limits, estimation, and error rules.
325
331
 
326
- The host reserves the effect before it lets the action run. The engine creates
332
+ The server reserves the effect before it lets the action run. The engine creates
327
333
  the internal key from the run ID, effect type, full compiled node path, and node
328
334
  visit number. Workflow code does not supply that key. Two included workflows
329
335
  can use the same local node name without sharing an effect. A repeated key with
@@ -382,9 +388,9 @@ humanDecision({
382
388
  });
383
389
  ```
384
390
 
385
- The waiting run stores a versioned request and asks every channel configured for the logical audience. The structured `subject` remains machine data. Channels receive only the normalized `presentation`, title, choices, input prompts, and any deadline policy. The first valid verified human answer wins. When `onTimeout` is present and no human answer wins before the saved deadline, the host takes a control claim on the waiting parent and atomically applies the validated response with `timeout` provenance, closes the interaction, and reserves the continuation. This policy can continue without a configured channel. A continuation preserves the original workflow input and exposes the resolved response as the checkpoint output. `humanDecisionEdge()` provides exhaustive routing for the choices. The removed `body` request form is invalid under the alpha hard cut.
391
+ The waiting run stores a versioned request and asks every channel configured for the logical audience. The structured `subject` remains machine data. Channels receive only the normalized `presentation`, title, choices, input prompts, and any deadline policy. The first valid verified human answer wins. When `onTimeout` is present and no human answer wins before the saved deadline, the server takes a control claim on the waiting parent and atomically applies the validated response with `timeout` provenance, closes the interaction, and reserves the continuation. This policy can continue without a configured channel. A continuation preserves the original workflow input and exposes the resolved response as the checkpoint output. `humanDecisionEdge()` provides exhaustive routing for the choices. The removed `body` request form is invalid under the alpha hard cut.
386
392
 
387
- The model-facing workflow tool cannot answer a protected human decision. The origin Pi session displays the request without starting a model turn. A person uses `/workflow answer` to send the answer through the host-owned path. Ordinary checkpoints can also use the model-facing `answer` action.
393
+ The model-facing workflow tool cannot answer a protected human decision. The origin Pi session displays the request without starting a model turn. A person uses `/workflow answer` to send the answer through the server-owned path. Ordinary checkpoints can also use the model-facing `answer` action.
388
394
 
389
395
  See [Human decisions](HUMAN_DECISIONS.md) for channels, recovery, persistence, and plan approval.
390
396
 
@@ -490,8 +496,8 @@ A direct user request to continue or resume the active workflow maps to
490
496
  `resume` immediately. The model does not call `status` instead of `resume` or
491
497
  use it as a prerequisite. An already active run adopts the resume request. A
492
498
  pending interaction on a paused run remains the same durable request and resumes
493
- without a worker. Other paused or parked work gets a new claim generation and worker.
494
- With no resumable run, the host rejects the request.
499
+ without a runner. Other paused or parked work gets a new claim generation and runner.
500
+ With no resumable run, the server rejects the request.
495
501
 
496
502
  The origin Pi session shows its active run in the workflow widget. `Shift+Up`
497
503
  and `Shift+Down` scroll it. A sent step message is open only while its
@@ -503,16 +509,16 @@ pending step messages. A turn that starts while the run is paused does not bind
503
509
  to the workflow. The paused run does not accept updates, submissions, or
504
510
  decision answers until `resume`.
505
511
 
506
- `status` reports the durable queue projection. A host command succeeds only
512
+ `status` reports the durable queue projection. A server command succeeds only
507
513
  after its transaction commits. The protocol stores request fingerprints and
508
514
  receipts, so an exact duplicate adopts the committed result and conflicting
509
515
  reuse is rejected.
510
516
 
511
517
  The normal extension offers these actions through the origin Pi session. The
512
- headless RPC bridge offers only `update` and `submit`, so a controller child
513
- cannot recursively control unrelated runs. Controller code can use its narrow
518
+ headless RPC bridge offers only `update` and `submit`, so a resource manager child
519
+ cannot recursively control unrelated runs. ResourceManager code can use its narrow
514
520
  `ctx.workflows` methods for child runs, settings, and follow-up records. Those
515
- methods also commit through the global host.
521
+ methods also commit through the global server.
516
522
 
517
523
  ### Built-in plain summary
518
524
 
@@ -666,7 +672,7 @@ The interval uses the existing shell action to launch the current Node
666
672
  executable with a timer. This works on every platform supported by Pi. The node
667
673
  and command timeouts are higher than the maximum interval. Cancelling the
668
674
  workflow aborts the timer process immediately. If the owning Pi process or
669
- standalone host stops during the wait, normal parking rules abort the shell node
675
+ standalone server stops during the wait, normal parking rules abort the shell node
670
676
  and resume later by running that wait again from the beginning.
671
677
 
672
678
  A monitor uses the session's single active workflow slot. It does not provide
@@ -709,7 +715,7 @@ notification does not start an assistant response. Step prompts, decisions, noti
709
715
 
710
716
  Workflow nodes normally produce structured values for routing and persistence.
711
717
  When a person must receive normal prose, use an agent node with
712
- `expectedOutput: assistantMessage()`. The worker parks and records the exact
718
+ `expectedOutput: assistantMessage()`. The runner parks and records the exact
713
719
  step request. The origin Pi session starts the model turn, and the visible
714
720
  assistant text becomes the node output after the turn settles.
715
721
 
@@ -718,7 +724,7 @@ looks for an existing session entry with the durable request ID. It inserts a
718
724
  new visible message only when no adopted entry exists. A repeated submission
719
725
  returns its stored receipt.
720
726
 
721
- A headless controller child cannot produce a visible assistant message without
727
+ A headless resource manager child cannot produce a visible assistant message without
722
728
  an approved origin-session binding. Use structured agent output for detached
723
729
  work. A final continuation-chain outcome creates its own terminal workflow message through the shared coordinator only after the outcome is durable.
724
730
 
@@ -732,42 +738,42 @@ possible. Defaults worth knowing:
732
738
  number or context callback. A timed-out node has outcome `timed_out` and can
733
739
  be routed with `$result.outcome`. A timed-out agent node also aborts its Pi
734
740
  turn, and late output for that attempt is rejected. Interactive runs save the
735
- resolved deadline before they park. The host advances it only during a
741
+ resolved deadline before they park. The server advances it only during a
736
742
  reported model turn from an active connected origin session. Message delivery,
737
- waiting, pauses, disconnects, and host downtime do not consume the limit. This
738
- active-time budget survives host restart.
743
+ waiting, pauses, disconnects, and server downtime do not consume the limit. This
744
+ active-time budget survives server restart.
739
745
  - `maxSteps` (workflow-level, default 100) bounds loops built from cycles in
740
746
  the graph.
741
747
  - `/workflow pause` atomically parks the run with `paused: true`, stores the
742
- receipt, and fences the worker before process-group shutdown. `/workflow
748
+ receipt, and fences the runner before process-group shutdown. `/workflow
743
749
  resume` takes a new generation and reruns only work after the last durable
744
750
  boundary.
745
- - The host tells each worker to `start`, `resume`, `continue`, or `restart`.
751
+ - The server tells each runner to `start`, `resume`, `continue`, or `restart`.
746
752
  A checkpoint continuation names its waiting parent. A restart begins at the
747
753
  workflow start and does not reuse checkpoint continuation rules.
748
754
  - Resuming an active run adopts the existing work. Duplicate start, control,
749
755
  update, and submission messages return their stored receipts.
750
756
  - A start is committed as `queued` with its final run ID before the command
751
- reports success. Cancellation can use that run ID before its scheduled worker
757
+ reports success. Cancellation can use that run ID before its scheduled runner
752
758
  starts. Active cancellation commits its terminal state and command receipt
753
- together before worker shutdown. It cancels effects that have not started and
759
+ together before runner shutdown. It cancels effects that have not started and
754
760
  marks applying effects ambiguous for explicit recovery. `workflow status` and
755
761
  `workflow cancel` can use the run ID immediately.
756
762
  - One interactive workflow request is presented per Pi session. Other requests
757
763
  remain durable and ordered.
758
764
  - Each protected write renews only its exact live token and generation in the
759
765
  same transaction. Claim loss does not write a failed run event.
760
- - An uncommitted pure or idempotent node can run again after a worker crash. An
766
+ - An uncommitted pure or idempotent node can run again after a runner crash. An
761
767
  uncertain manual effect parks as ambiguous and never retries automatically.
762
- If a ready worker exits before the saved run revision advances, the host parks
763
- the run with `workerNoProgress`. The scheduler does not claim it again until
768
+ If a ready runner exits before the saved run revision advances, the server parks
769
+ the run with `runnerNoProgress`. The scheduler does not claim it again until
764
770
  an operator explicitly resumes or cancels it.
765
- - Host status reports safe counts and timestamps. It does not report session
771
+ - Server status reports safe counts and timestamps. It does not report session
766
772
  IDs, project paths, prompts, payloads, tokens, process IDs, or credentials.
767
773
 
768
- ## Workflows started by controllers
774
+ ## Workflows started by resource managers
769
775
 
770
- A controller can start a workflow as a finite child job with `ctx.workflows.ensure()`. The request key is stable across reconciliation passes, and the input fingerprint prevents one key from being reused for different work.
776
+ A resource manager can start a workflow as a finite child job with `ctx.workflows.ensure()`. The request key is stable across reconciliation passes, and the input fingerprint prevents one key from being reused for different work.
771
777
 
772
778
  ```typescript
773
779
  const run = await ctx.workflows.ensure({
@@ -788,16 +794,16 @@ if (run.state !== "succeeded") {
788
794
  }
789
795
  ```
790
796
 
791
- Child workflow completion queues the parent resource again. The global host runs the child through the same queue and supervised worker model as any other run. A host or worker crash resumes the existing durable run when its committed effect state makes that safe. Consequential external mutations belong in the workflow or controller effect API; an uncertain result stops for explicit recovery.
797
+ Child workflow completion queues the parent resource again. The global server runs the child through the same queue and supervised runner model as any other run. A server or runner crash resumes the existing durable run when its committed effect state makes that safe. Consequential external mutations belong in the workflow or resource manager effect API; an uncertain result stops for explicit recovery.
792
798
 
793
- See [CONTROLLERS.md](CONTROLLERS.md) for controller definitions and the full recovery contract.
799
+ See [RESOURCE_MANAGERS.md](RESOURCE_MANAGERS.md) for resource manager definitions and the full recovery contract.
794
800
 
795
801
  ## Using the engine outside Pi
796
802
 
797
803
  The engine remains Pi-agnostic. `WorkflowEngine` takes any `AgentStepExecutor`,
798
804
  so tests and custom library integrations can script agent steps. The package's
799
805
  production extension does not use this as a selectable embedded runtime; it
800
- always sends runs to the global host.
806
+ always sends runs to the global server.
801
807
 
802
808
  ```typescript
803
809
  import { WorkflowEngine, type AgentStepExecutor } from "@osolmaz/pi-workflows";
@@ -822,7 +828,7 @@ const { state } = await engine.run(workflow, { task: "..." });
822
828
  The installed-package end-to-end test packs this repository and installs the
823
829
  archive with production dependencies in a temporary consumer project. It then
824
830
  starts the repository-pinned base Pi with only that Pi Workflows installation.
825
- The test checks command isolation, host startup, widget and status changes,
831
+ The test checks command isolation, server startup, widget and status changes,
826
832
  pause, resume, completion, and `piw <runId> --once` output.
827
833
 
828
834
  Run the deterministic phase without a model call:
@@ -2,9 +2,9 @@ import {
2
2
  conditionFalse,
3
3
  conditionTrue,
4
4
  conditionUnknown,
5
- defineController,
5
+ defineResourceManager,
6
6
  type ChildWorkflowRecord,
7
- } from "@osolmaz/pi-workflows/controllers";
7
+ } from "@osolmaz/pi-workflows/resource-managers";
8
8
 
9
9
  type PullRequestSpec = {
10
10
  apiBaseUrl: string;
@@ -30,7 +30,7 @@ type CommitStatus = {
30
30
  state: "error" | "failure" | "pending" | "success";
31
31
  };
32
32
 
33
- export default defineController<PullRequestSpec, PullRequestStatus>({
33
+ export default defineResourceManager<PullRequestSpec, PullRequestStatus>({
34
34
  name: "pull-request",
35
35
  initialStatus: () => ({ phase: "observing" }),
36
36
 
@@ -41,14 +41,14 @@ export default defineController<PullRequestSpec, PullRequestStatus>({
41
41
 
42
42
  if (pullRequest.merged) {
43
43
  return ctx.settled({
44
- controllerStatus: { phase: "merged", ...observed },
44
+ resourceManagerStatus: { phase: "merged", ...observed },
45
45
  conditions: [conditionTrue("Ready", "Merged")],
46
46
  workflowRun: null,
47
47
  });
48
48
  }
49
49
  if (pullRequest.head.sha !== resource.spec.expectedHeadSha) {
50
50
  return ctx.settled({
51
- controllerStatus: { phase: "blocked", ...observed },
51
+ resourceManagerStatus: { phase: "blocked", ...observed },
52
52
  conditions: [conditionFalse("Ready", "HeadChanged")],
53
53
  });
54
54
  }
@@ -65,14 +65,14 @@ export default defineController<PullRequestSpec, PullRequestStatus>({
65
65
  const workflowRun = workflowReference(child);
66
66
  if (child.state === "failed") {
67
67
  return ctx.settled({
68
- controllerStatus: { phase: "blocked", ...observed },
68
+ resourceManagerStatus: { phase: "blocked", ...observed },
69
69
  conditions: [conditionFalse("Ready", "RepairFailed", child.error)],
70
70
  workflowRun,
71
71
  });
72
72
  }
73
73
  if (child.state !== "succeeded") {
74
74
  return ctx.requeueAfter(5_000, {
75
- controllerStatus: { phase: "repairing", ...observed },
75
+ resourceManagerStatus: { phase: "repairing", ...observed },
76
76
  conditions: [conditionUnknown("Ready", "RepairRunning")],
77
77
  workflowRun,
78
78
  });
@@ -81,14 +81,14 @@ export default defineController<PullRequestSpec, PullRequestStatus>({
81
81
  const checks = await client.commitStatus(pullRequest.head.sha, ctx.signal);
82
82
  if (checks.state !== "success") {
83
83
  return ctx.requeueAfter(30_000, {
84
- controllerStatus: { phase: "waiting", ...observed },
84
+ resourceManagerStatus: { phase: "waiting", ...observed },
85
85
  conditions: [conditionUnknown("Ready", "ChecksPending", checks.state)],
86
86
  workflowRun,
87
87
  });
88
88
  }
89
89
  if (!resource.spec.mergeApproved) {
90
90
  return ctx.settled({
91
- controllerStatus: { phase: "ready", ...observed },
91
+ resourceManagerStatus: { phase: "ready", ...observed },
92
92
  conditions: [conditionFalse("Ready", "ApprovalRequired")],
93
93
  workflowRun,
94
94
  });
@@ -116,20 +116,20 @@ export default defineController<PullRequestSpec, PullRequestStatus>({
116
116
  });
117
117
  if (effect.state === "rejected") {
118
118
  return ctx.settled({
119
- controllerStatus: { phase: "blocked", ...observed },
119
+ resourceManagerStatus: { phase: "blocked", ...observed },
120
120
  conditions: [conditionFalse("Ready", "MergeRejected", effect.error)],
121
121
  workflowRun,
122
122
  });
123
123
  }
124
124
  if (effect.state === "indeterminate") {
125
125
  return ctx.requeueAfter(10_000, {
126
- controllerStatus: { phase: "waiting", ...observed },
126
+ resourceManagerStatus: { phase: "waiting", ...observed },
127
127
  conditions: [conditionUnknown("Ready", "MergeUncertain", effect.error)],
128
128
  workflowRun,
129
129
  });
130
130
  }
131
131
  return ctx.requeue({
132
- controllerStatus: { phase: "waiting", ...observed },
132
+ resourceManagerStatus: { phase: "waiting", ...observed },
133
133
  conditions: [conditionUnknown("Ready", "MergeSubmitted")],
134
134
  workflowRun,
135
135
  });
package/herdr-plugin.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  id = "osolmaz.pi-workflows"
2
2
  name = "pi-workflows"
3
- version = "0.16.2"
3
+ version = "0.16.3"
4
4
  min_herdr_version = "0.7.0"
5
5
  description = "Open the active pi-workflows run in piw from a managed Herdr pane."
6
6
  platforms = ["linux", "macos"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@osolmaz/pi-workflows",
3
- "version": "0.16.2",
4
- "description": "Workflow and controller runtime with a live terminal viewer for the pi coding agent",
3
+ "version": "0.16.3",
4
+ "description": "Workflow and resource manager runtime with a live terminal viewer for the pi coding agent",
5
5
  "keywords": [
6
6
  "pi-package"
7
7
  ],
@@ -44,9 +44,9 @@
44
44
  "types": "./dist/client/index.d.ts",
45
45
  "default": "./dist/client/index.js"
46
46
  },
47
- "./controllers": {
48
- "types": "./dist/controllers/index.d.ts",
49
- "default": "./dist/controllers/index.js"
47
+ "./resource-managers": {
48
+ "types": "./dist/resource-managers/index.d.ts",
49
+ "default": "./dist/resource-managers/index.js"
50
50
  },
51
51
  "./builtins": {
52
52
  "types": "./dist/builtins/index.d.ts",
@@ -47,13 +47,13 @@
47
47
  "notification.deliver",
48
48
  "turn.claim",
49
49
  "turn.resolve",
50
- "controller.list",
51
- "controller.get",
52
- "controller.apply",
53
- "controller.reconcile",
54
- "controller.delete",
55
- "host.status",
56
- "host.stop",
50
+ "resourceManager.list",
51
+ "resourceManager.get",
52
+ "resourceManager.apply",
53
+ "resourceManager.reconcile",
54
+ "resourceManager.delete",
55
+ "server.status",
56
+ "server.stop",
57
57
  "view.runs.watch",
58
58
  "view.runs.page",
59
59
  "view.run.get",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "valid": [
3
3
  "{\"connectionId\":\"connection-1\",\"packageVersion\":\"0.15.3\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"hello\"}",
4
- "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-1\",\"operation\":\"host.status\",\"payload\":{},\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
4
+ "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-1\",\"operation\":\"server.status\",\"payload\":{},\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
5
5
  "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-runs-page\",\"operation\":\"view.runs.page\",\"payload\":{\"cursor\":2,\"revision\":\"3:10:20\"},\"requestId\":\"request-runs-page\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
6
6
  "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-run-get\",\"operation\":\"view.run.get\",\"payload\":{},\"requestId\":\"request-run-get\",\"runId\":\"run-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
7
7
  "{\"clientId\":\"client-1\",\"expectedRevision\":7,\"idempotencyKey\":\"key-page\",\"operation\":\"view.page\",\"payload\":{\"cursor\":299,\"kind\":\"steps\"},\"requestId\":\"request-page\",\"runId\":\"run-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
@@ -83,7 +83,7 @@ type MonitorCostSafety = {
83
83
  };
84
84
  type MonitorDefectSafety = {
85
85
  sharedCodeOrDataDefect: boolean;
86
- paidWorkers: "not-applicable" | "stopped" | "running";
86
+ paidRunners: "not-applicable" | "stopped" | "running";
87
87
  evidence: string;
88
88
  };
89
89
  type MonitorActionRequest = {
@@ -308,20 +308,20 @@ function parseCostSafety(input: unknown): MonitorCostSafety {
308
308
 
309
309
  function parseDefectSafety(input: unknown): MonitorDefectSafety {
310
310
  const value = requireRecord(input, "action defect");
311
- requireExactKeys(value, ["sharedCodeOrDataDefect", "paidWorkers", "evidence"], "action defect");
311
+ requireExactKeys(value, ["sharedCodeOrDataDefect", "paidRunners", "evidence"], "action defect");
312
312
  if (typeof value.sharedCodeOrDataDefect !== "boolean") {
313
313
  throw new Error("action defect sharedCodeOrDataDefect must be boolean");
314
314
  }
315
315
  if (
316
- value.paidWorkers !== "not-applicable" &&
317
- value.paidWorkers !== "stopped" &&
318
- value.paidWorkers !== "running"
316
+ value.paidRunners !== "not-applicable" &&
317
+ value.paidRunners !== "stopped" &&
318
+ value.paidRunners !== "running"
319
319
  ) {
320
- throw new Error("action defect paidWorkers is invalid");
320
+ throw new Error("action defect paidRunners is invalid");
321
321
  }
322
322
  return {
323
323
  sharedCodeOrDataDefect: value.sharedCodeOrDataDefect,
324
- paidWorkers: value.paidWorkers,
324
+ paidRunners: value.paidRunners,
325
325
  evidence: requireBoundedString(value.evidence, "action defect evidence", MAX_ACTION_TEXT_CHARS),
326
326
  };
327
327
  }
@@ -396,7 +396,7 @@ function parseActionRequest(input: unknown): MonitorActionRequest {
396
396
  if (
397
397
  request.kind === "repair" &&
398
398
  request.defect.sharedCodeOrDataDefect &&
399
- request.defect.paidWorkers === "running"
399
+ request.defect.paidRunners === "running"
400
400
  ) {
401
401
  throw new Error("paid workers must stop before a shared code or data repair");
402
402
  }
@@ -850,7 +850,7 @@ const monitorWorkflow: WorkflowDefinition = defineWorkflow({
850
850
  ].join("\n\n");
851
851
  },
852
852
  expectedOutput:
853
- '{ "route": "wait" | "act" | "stop", "goalState": "complete" | "incomplete" | "blocked", "workState": "running" | "waiting" | "idle" | "failed" | "stopped" | "unknown", "observation": "factual state", "report": "concise factual summary", "targetStateId": "stable observed target-state ID", "authorizedActions": ["safe action already authorized by the user"], "progress": { "tracks": [{ "key": "stable-key", "data": { "schema": "pi-workflows.progress.v1", "status": "running", "completed": 1, "total": 2, "unit": "items" } }] } (optional), "action": { "kind": "advance" | "recover" | "repair", "incomplete": "what remains", "evidence": {}, "nextAction": "one exact action", "authority": { "status": "authorized", "basis": "existing authority", "allowedMutations": ["allowed file, system, or resource"], "forbiddenMutations": [], "costLimit": "recorded limit or not applicable", "providerRuntime": "recorded contract or not applicable", "requiredChecks": [], "stopConditions": [], "allowedRecoveryActions": [], "repository": "optional absolute path", "baseBranch": "optional branch", "merge": false, "repairApproval": { "mode": "auto" | "required" | "skip" } }, "cost": { "paidAction": false, "status": "not-applicable" | "within-limit", "evidence": "cost evidence" }, "defect": { "sharedCodeOrDataDefect": false, "paidWorkers": "not-applicable" | "stopped" | "running", "evidence": "worker evidence" }, "verification": "how to prove success", "failureId": "stable failure ID", "targetStateId": "stable target-state ID" } (required only for act), "reason": "short reason" }',
853
+ '{ "route": "wait" | "act" | "stop", "goalState": "complete" | "incomplete" | "blocked", "workState": "running" | "waiting" | "idle" | "failed" | "stopped" | "unknown", "observation": "factual state", "report": "concise factual summary", "targetStateId": "stable observed target-state ID", "authorizedActions": ["safe action already authorized by the user"], "progress": { "tracks": [{ "key": "stable-key", "data": { "schema": "pi-workflows.progress.v1", "status": "running", "completed": 1, "total": 2, "unit": "items" } }] } (optional), "action": { "kind": "advance" | "recover" | "repair", "incomplete": "what remains", "evidence": {}, "nextAction": "one exact action", "authority": { "status": "authorized", "basis": "existing authority", "allowedMutations": ["allowed file, system, or resource"], "forbiddenMutations": [], "costLimit": "recorded limit or not applicable", "providerRuntime": "recorded contract or not applicable", "requiredChecks": [], "stopConditions": [], "allowedRecoveryActions": [], "repository": "optional absolute path", "baseBranch": "optional branch", "merge": false, "repairApproval": { "mode": "auto" | "required" | "skip" } }, "cost": { "paidAction": false, "status": "not-applicable" | "within-limit", "evidence": "cost evidence" }, "defect": { "sharedCodeOrDataDefect": false, "paidRunners": "not-applicable" | "stopped" | "running", "evidence": "worker evidence" }, "verification": "how to prove success", "failureId": "stable failure ID", "targetStateId": "stable target-state ID" } (required only for act), "reason": "short reason" }',
854
854
  validate: validateMonitorObservation,
855
855
  }),
856
856
  guard: compute({ run: guardObservation }),
@@ -33,7 +33,7 @@ const BUILTIN_TOOLS = new Set(["read", "grep", "find", "ls"]);
33
33
  const RESERVED_EXTENSION_NAMES = new Set([
34
34
  "workflow",
35
35
  "piw",
36
- "controller",
36
+ "resource-manager",
37
37
  "workflow-update",
38
38
  "workflow-answer",
39
39
  "workflow-submit",
@@ -162,8 +162,8 @@ export async function runPiAgentGroup(
162
162
  }
163
163
  };
164
164
 
165
- const workerCount = Math.min(options.maxConcurrency, requests.length);
166
- await Promise.all(Array.from({ length: workerCount }, worker));
165
+ const runnerCount = Math.min(options.maxConcurrency, requests.length);
166
+ await Promise.all(Array.from({ length: runnerCount }, worker));
167
167
 
168
168
  if (options.signal.aborted) throw cancellationError("group", options.signal.reason);
169
169
  if (primary !== undefined) {