@osolmaz/pi-workflows 0.16.2 → 0.16.4

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 +12 -11
  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
@@ -10,7 +10,7 @@ status: implemented
10
10
 
11
11
  pi-workflows should feel the same whether the user watches a run or walks away from it. In the user's words: "I might start a workflow locally in Pi then I wait for it to complete. All the while I am looking at the screen and I'm not closing the Pi window. When the workflow ends I just want to be able to continue the same Pi session like normal with a session up to date with what happened in the workflow." And: "I just want to interact by starting a workflow, closing it, and then coming back and then still being able to continue it when I open it up. It's syncing continuously or something."
12
12
 
13
- These are not two modes. The user asked for "both in a single unified system." This plan makes the Pi window irrelevant to execution: closing or opening the window is a change in observation, not in the run. The work stays on one machine, uses the merged controller runtime as its foundation, and does not modify Pi core.
13
+ These are not two modes. The user asked for "both in a single unified system." This plan makes the Pi window irrelevant to execution: closing or opening the window is a change in observation, not in the run. The work stays on one machine, uses the merged resource manager runtime as its foundation, and does not modify Pi core.
14
14
 
15
15
  This revision incorporates an external design review of the first draft. The review confirmed the three design rules and found five structural gaps in the details. The Decisions section resolves each one before implementation starts.
16
16
 
@@ -23,7 +23,7 @@ Four rules define the system:
23
23
  3. **The session is always a view.** It attaches to a run's event stream and renders it. An open window sees a live tail; a reopened window catches up from the same stream. Interaction such as approvals uses durable waiting states, never prompts tied to the window's lifetime.
24
24
  4. **Claims arbitrate every lifecycle decision.** Only the current claim holder may resume, interrupt, or write a terminal event for a run. Recovery code that finds an abandoned run goes through the queue instead of writing to the bundle directly.
25
25
 
26
- The controller runtime already provides most of the machinery: a deduplicated queue with expiring claims, a structured event table, crash recovery through the trace tail, and guarded effect records. This plan extends that treatment to runs the user starts interactively and adds the view layer.
26
+ The resource manager runtime already provides most of the machinery: a deduplicated queue with expiring claims, a structured event table, crash recovery through the trace tail, and guarded effect records. This plan extends that treatment to runs the user starts interactively and adds the view layer.
27
27
 
28
28
  ## Decisions
29
29
 
@@ -31,8 +31,8 @@ These points were open in the first draft. External review showed each one is lo
31
31
 
32
32
  1. **Write fencing on bundles.** Every claim records a runner ID, a token, and a lease expiry in the store. Every bundle write verifies the token inside the run lock before appending and fails the runner fast when the token no longer matches. Expiring claims alone do not stop a stalled runner from writing; fencing does.
33
33
  2. **Explicit resume protocol.** Resume is a named operation, not a restart. It truncates a torn trace tail to the last complete line, rebuilds run state from the trace, seeds the trace sequence from the tail, accounts for already-executed steps against the step limit, and records a resume boundary event before continuing.
34
- 3. **Resume scope.** User-started runs get node-level resume. Controller child runs keep their current new-attempt semantics, because attempt immutability and parent-side retry already work and are tested. Both behaviors are explicit; nothing mixes silently.
35
- 4. **A dedicated run queue.** Interactive runs do not fit the controller queue, which is keyed to controller resources. A new `workflow_run_queue` table shares the claim, lease, and fencing pattern and adds runner affinity fields. Runs stay out of `/controller list`.
34
+ 3. **Resume scope.** User-started runs get node-level resume. ResourceManager child runs keep their current new-attempt semantics, because attempt immutability and parent-side retry already work and are tested. Both behaviors are explicit; nothing mixes silently.
35
+ 4. **A dedicated run queue.** Interactive runs do not fit the controller queue, which is keyed to managed resources. A new `workflow_run_queue` table shares the claim, lease, and fencing pattern and adds runner affinity fields. Runs stay out of `/resource-manager list`.
36
36
  5. **Origin affinity.** An interactively started run is inserted and claimed in one transaction, so the session that started it owns it from birth. The standalone host takes over only when that claim is released or expires. This guarantees a watched run's conversation happens in the watching session.
37
37
  6. **Close-to-park shutdown.** `session_shutdown` stops writing a terminal cancel event for queued runs. It aborts in-flight work without a terminal event and releases the claim, leaving a resumable bundle. A clean close releases claims explicitly; a crash relies on lease expiry.
38
38
  7. **Per-attempt capture.** Session capture becomes segmented per attempt, keyed by attempt ID, so a run handed off to the host or a new session starts a fresh capture segment instead of failing integrity checks.
@@ -40,7 +40,7 @@ These points were open in the first draft. External review showed each one is lo
40
40
  9. **Source pinning.** The manifest stores a content hash of the workflow source at run start. Resume refuses to continue against changed source unless forced, and a forced resume records the mismatch in the trace.
41
41
  10. **Snapshot catch-up.** Notifications are idempotent snapshots of run state as of a store sequence number, recomputed from the store, not a stream of one-off messages. The watermark persists per session before sending. A skipped incremental notification is subsumed by the next snapshot.
42
42
  11. **A run-level event feed.** Run lifecycle transitions write rows into a store table, so one watermark covers both controller and run events. Tailing `trace.ndjson` is reserved for the single actively watched run.
43
- 12. **Store-error backoff.** Worker loops treat store errors such as `SQLITE_BUSY` as transient and back off instead of letting a worker die silently. The host's advisory lock guards host-versus-host only; the embedded runner does not take it, and a second host refuses to start.
43
+ 12. **Store-error backoff.** Runner loops treat store errors such as `SQLITE_BUSY` as transient and back off instead of letting a worker die silently. The host's advisory lock guards host-versus-host only; the embedded runner does not take it, and a second host refuses to start.
44
44
  13. **Orphan reaping.** The host spawns `pi --mode rpc` children in their own process group, records child PIDs in the bundle, and reaps known orphans on startup. Consequential actions stay behind guarded effects regardless.
45
45
 
46
46
  ## Requirements
@@ -55,11 +55,11 @@ These points were open in the first draft. External review showed each one is lo
55
55
  ## Work items
56
56
 
57
57
  1. **Run queue and fencing.** Add the `workflow_run_queue` table with claim tokens, lease expiry, and runner affinity. Gate every bundle write on the token inside the run lock. Insert-and-claim interactive starts in one transaction.
58
- 2. **Node-level resume.** Implement the explicit resume protocol from Decision 2, with source pinning from Decision 9. User-started runs resume at the interrupted node; controller child runs are untouched.
58
+ 2. **Node-level resume.** Implement the explicit resume protocol from Decision 2, with source pinning from Decision 9. User-started runs resume at the interrupted node; resource manager child runs are untouched.
59
59
  3. **Close-to-park and capture segments.** Change `session_shutdown` to abort-without-terminal plus claim release for queued runs. Split session capture into per-attempt segments the integrity checker understands.
60
60
  4. **Continuation runs.** Chain an answered checkpoint to a new run ID with a parent link and carried-forward outputs. Render the chain as one logical run in views.
61
61
  5. **Session sync.** Add the run-level event feed, per-session watermarks, snapshot catch-up on `session_start`, and noteworthy-event messages. Live watching tails `trace.ndjson` from a remembered byte offset with `fs.watch`, reusing the TUI viewer's file-tail path.
62
- 6. **Standalone host.** A `pi-workflows` CLI subcommand loads controller definitions, opens the project store, and runs claiming in a loop with store-error backoff. Conversation child nodes run in spawned headless `pi --mode rpc` sessions with orphan reaping. The host takes an advisory lock against other hosts, drains on SIGTERM, and recovers on restart. It is a foreground process the user runs in a terminal; it is not a service.
62
+ 6. **Standalone host.** A `pi-workflows` CLI subcommand loads resource manager definitions, opens the project store, and runs claiming in a loop with store-error backoff. Conversation child nodes run in spawned headless `pi --mode rpc` sessions with orphan reaping. The host takes an advisory lock against other hosts, drains on SIGTERM, and recovers on restart. It is a foreground process the user runs in a terminal; it is not a service.
63
63
 
64
64
  ## Non-goals
65
65
 
@@ -89,7 +89,7 @@ The implementation matches the decisions above with these refinements:
89
89
  - Graph validation now allows outgoing edges from checkpoint nodes. The old
90
90
  rejection encoded terminal-forever checkpoints; continuations make those
91
91
  edges live. This is a deliberate contract change for workflow authors.
92
- - The host command is `pi-workflows host`, chosen over `run` because the
92
+ - The host command is `pi-workflows server`, chosen over `run` because the
93
93
  viewer CLI's vocabulary already uses runs for bundles.
94
94
  - The first capture stays flat at `session/`; only binds from the second
95
95
  recorder onward write segments under `session/segments/`. This keeps the
@@ -118,7 +118,7 @@ The report nodes write a normal assistant message and then submit an acknowledge
118
118
 
119
119
  The sleep node uses the existing pi-workflows shell action to launch the current Node executable with a timer. Set the node timeout above the largest supported interval because the engine default is 15 minutes. Set the shell execution timeout above the requested wait by a small fixed margin. Cancellation aborts the timer process immediately.
120
120
 
121
- If the Pi TUI or standalone workflow host stops during sleep, pi-workflows parks the run and kills the shell child. Resuming the run starts that sleep node again from the beginning. This is existing workflow behavior and is acceptable for this feature. No special timer persistence is added.
121
+ If the Pi TUI or standalone workflow server stops during sleep, pi-workflows parks the run and kills the shell child. Resuming the run starts that sleep node again from the beginning. This is existing workflow behavior and is acceptable for this feature. No special timer persistence is added.
122
122
 
123
123
  The workflow uses a high but finite `maxSteps` value as a second safety guard. Check and report values have explicit size limits so a long run cannot grow its bundle without bound.
124
124
 
@@ -145,7 +145,7 @@ After the upstream change is complete, update the pinned pi-workflows commit in
145
145
 
146
146
  ## Non-goals
147
147
 
148
- This work does not add cron expressions, calendar schedules, a background service, controller resources, OS notifications, concurrent workflows in one session, resumable shell processes, or guaranteed wall-clock wake times across runner shutdowns. It does not let headless child agents recursively start workflows.
148
+ This work does not add cron expressions, calendar schedules, a background service, managed resources, OS notifications, concurrent workflows in one session, resumable shell processes, or guaranteed wall-clock wake times across runner shutdowns. It does not let headless child agents recursively start workflows.
149
149
 
150
150
  ## Acceptance criteria
151
151
 
@@ -23,7 +23,7 @@ pi-workflows must not send one workflow's report into an unrelated conversation.
23
23
 
24
24
  ## Data model
25
25
 
26
- Queue records gain an optional `origin_session_id`. Interactive runs set it from `ctx.sessionManager.getSessionId()`. Controller-created detached runs leave it empty. A session runner can claim a record only when the origin is empty or matches its current session. The standalone host can claim either form.
26
+ Queue records gain an optional `origin_session_id`. Interactive runs set it from `ctx.sessionManager.getSessionId()`. ResourceManager-created detached runs leave it empty. A session runner can claim a record only when the origin is empty or matches its current session. The standalone host can claim either form.
27
27
 
28
28
  A `workflow_notifications` table is the durable outbox:
29
29
 
@@ -108,9 +108,9 @@ New interactive agent-step instructions become `pi-workflows-agent-step` custom
108
108
 
109
109
  Existing user-message entries remain readable and are not rewritten. No private Pi entry type, Pi schema change, or separate persistent store is introduced.
110
110
 
111
- ### Controller storage
111
+ ### ResourceManager storage
112
112
 
113
- The controller database schema does not change for the first implementation. Controllers publish only through a claimed workflow run. Controller-native status remains in controller resources.
113
+ The controller database schema does not change for the first implementation. Controllers publish only through a claimed workflow run. ResourceManager-native status remains in managed resources.
114
114
 
115
115
  ## Public API impact
116
116
 
@@ -177,7 +177,7 @@ Files expected to change:
177
177
  - `src/workflows/shell.ts`
178
178
  - `src/extension/workflow-tool.ts`
179
179
  - `src/extension/index.ts`
180
- - `src/host/rpc-executor.ts`
180
+ - `src/server/rpc-executor.ts`
181
181
  - `test/extension.test.ts`
182
182
  - `test/workflow-args.test.ts`
183
183
  - `test/e2e/workflow.e2e.test.ts`
@@ -282,7 +282,7 @@ Files expected to change:
282
282
  - `src/extension/executor.ts`
283
283
  - `src/extension/index.ts`
284
284
  - `src/extension/` message-renderer module
285
- - `src/host/rpc-executor.ts`
285
+ - `src/server/rpc-executor.ts`
286
286
  - `test/executor.test.ts`
287
287
  - `test/extension.test.ts`
288
288
  - `test/e2e/workflow.e2e.test.ts`
@@ -491,4 +491,4 @@ Before any run publishes an update, rollback is an exact dependency pin to `0.5.
491
491
 
492
492
  ## Follow-up boundary
493
493
 
494
- A truly indefinite monitor belongs in the controller runtime. This plan keeps the finite workflow safety ceiling and does not hide it behind a huge number or automatic restart. A later controller resource may use the same update and progress contracts alongside the notification and viewer contracts.
494
+ A truly indefinite monitor belongs in the resource manager runtime. This plan keeps the finite workflow safety ceiling and does not hide it behind a huge number or automatic restart. A later managed resource may use the same update and progress contracts alongside the notification and viewer contracts.
@@ -60,7 +60,7 @@ Pi and Telegram implement one channel interface. Workflows address a named audie
60
60
  - Reject stale responses by decision ID and canonical request digest.
61
61
  - Rebuild the pending-decision index from immutable records.
62
62
 
63
- ### Host and channels
63
+ ### Server and channels
64
64
 
65
65
  - Add a `HumanDecisionChannel` interface outside the engine layer.
66
66
  - Add a Pi channel using documented TUI APIs.
@@ -63,7 +63,7 @@ The helper does not interpret repository, review, CI, or test results. Autoimple
63
63
 
64
64
  ## Cancellation and interruption
65
65
 
66
- The workflow action passes its abort signal to the helper. An abort stops active process groups through the existing `runShellAction` SIGTERM and bounded SIGKILL path. Workers do not start queued items after the abort.
66
+ The workflow action passes its abort signal to the helper. An abort stops active process groups through the existing `runShellAction` SIGTERM and bounded SIGKILL path. Runners do not start queued items after the abort.
67
67
 
68
68
  Accepted batch outputs use the existing run trace and artifact files. Large strings use normal artifact externalization.
69
69
 
@@ -62,7 +62,7 @@ Fallback eligibility is separate from pending state. An intent can remain pendin
62
62
  | Terminal workflow failure after an active turn abort | Yes | No | Terminal handling updates the existing intent and makes it eligible. |
63
63
  | Workflow reports started, then crashes asynchronously | Yes | Yes, after durable failure | Covers failures before the first workflow prompt, including invalid runtime input discovered after start. |
64
64
  | Queued launch activation fails | Yes | Yes, after durable launch failure | Replaces the `launch_failure` notification trigger. |
65
- | Controller stops an active workflow agent turn | Yes | No | Terminal or handoff policy decides eligibility. |
65
+ | ResourceManager stops an active workflow agent turn | Yes | No | Terminal or handoff policy decides eligibility. |
66
66
  | Queue claim is lost during an active agent turn | Yes | No | Treat as ownership transfer, not failure. |
67
67
  | Completed or waiting run has a presentation | No new intent | Not applicable | The presentation resolves an existing intent when present. |
68
68
  | Direct `/workflow cancel` | No | Not applicable | The user explicitly requested control and no automatic model turn. |
@@ -74,7 +74,7 @@ A later distinct event can create a new intent. Repeated handling of the same so
74
74
 
75
75
  ## Storage
76
76
 
77
- Add `workflow_turn_intents` to the existing `SqliteControllerStore` database. Keep the database path and `pi-workflows.controller-store.v1` schema identifier.
77
+ Add `workflow_turn_intents` to the existing `SqliteResourceManagerStore` database. Keep the database path and `pi-workflows.controller-store.v1` schema identifier.
78
78
 
79
79
  The existing `workflow_notifications` table remains a passive outbox for workflow-authored `progress` and `final` reports. It cannot represent this lifecycle clearly because it has one delivery transition and identifies node notification output. Adding natural resolution, fallback eligibility, and competing claims to that table would mix two different contracts.
80
80
 
@@ -316,7 +316,7 @@ Do not publish a package or create a release without separate authorization.
316
316
  ## Contract impact
317
317
 
318
318
  - **Session state:** internal workflow messages gain an optional `turnIntentId`; fallback uses `pi-workflows-deferred-turn`.
319
- - **Controller storage:** add `workflow_turn_intents`; restrict workflow notifications to passive `progress` and `final` kinds.
319
+ - **ResourceManager storage:** add `workflow_turn_intents`; restrict workflow notifications to passive `progress` and `final` kinds.
320
320
  - **Run bundles:** unchanged.
321
321
  - **Workflow engine:** unchanged.
322
322
  - **Workflow author API:** unchanged.
@@ -138,7 +138,7 @@ Children receive only the built-in read-only tool instances requested by Sanity
138
138
  Children receive no:
139
139
 
140
140
  - `workflow` tool;
141
- - `/workflow`, `/piw`, `/controller`, or workflow-channel command;
141
+ - `/workflow`, `/piw`, `/resource-manager`, or workflow-channel command;
142
142
  - run, node, or attempt identifier;
143
143
  - workflow update, answer, submit, pause, resume, or cancel callback;
144
144
  - child workflow run or parent workflow handle.
@@ -239,7 +239,7 @@ Unit and integration tests must cover:
239
239
  - serial two-session and parallel five-session behavior;
240
240
  - existing progress keys, model labels, throttling, and rendering;
241
241
  - interactive Pi with normal extensions enabled and the local mock provider;
242
- - standalone `WorkflowHost` through the same private runtime path;
242
+ - standalone `WorkflowServer` through the same private runtime path;
243
243
  - no child session files or child workflow runs;
244
244
  - built-in revision 4 and historical terminal run reading;
245
245
  - one full detailed assistant response followed by one short plain-language assistant response;
@@ -300,13 +300,13 @@ Add an executor capability that distinguishes:
300
300
 
301
301
  The interactive Pi executor supports assistant completion.
302
302
 
303
- A detached WorkflowHost must not run such a node in an invisible RPC child. It must:
303
+ A detached WorkflowServer must not run such a node in an invisible RPC child. It must:
304
304
 
305
305
  - park the run before the node;
306
306
  - leave it claimable by the origin Pi session;
307
307
  - resume when that session is available.
308
308
 
309
- A controller child or detached run with no origin session must fail clearly before prompting:
309
+ A resource manager child or detached run with no origin session must fail clearly before prompting:
310
310
 
311
311
  > Assistant completion requires an origin Pi session.
312
312
 
@@ -318,9 +318,9 @@ Direct RPC clients can support assistant completion because RPC exposes `message
318
318
 
319
319
  - `src/workflows/types.ts`
320
320
  - `src/workflows/engine.ts`
321
- - `src/host/runner.ts`
322
- - `src/host/rpc-executor.ts`
323
- - `src/host/rpc-bridge.ts` only if the bridge needs completion metadata
321
+ - `src/server/runner.ts`
322
+ - `src/server/rpc-executor.ts`
323
+ - `src/server/rpc-bridge.ts` only if the bridge needs completion metadata
324
324
  - Queue and host tests
325
325
 
326
326
  ### Verification
@@ -19,7 +19,7 @@ This database becomes the only live source of workflow state. It stores workflow
19
19
 
20
20
  The replacement must also fix the broader ownership problem. Finding shared state never grants permission to change it. Every write checks the actor, current owner when ownership is required, ownership generation, expected resource revision, and requested state transition in the same transaction.
21
21
 
22
- The current formats are specified in [Run bundle format](../SQLITE_STATE.md), [Human decisions](../HUMAN_DECISIONS.md), and [Controller runtime specification](../CONTROLLERS.md). This plan replaces their storage sections. Workflow authoring behavior stays the same unless this plan names a required contract change.
22
+ The current formats are specified in [Run bundle format](../SQLITE_STATE.md), [Human decisions](../HUMAN_DECISIONS.md), and [ResourceManager runtime specification](../RESOURCE_MANAGERS.md). This plan replaces their storage sections. Workflow authoring behavior stays the same unless this plan names a required contract change.
23
23
 
24
24
  ## Boundaries
25
25
 
@@ -43,7 +43,7 @@ Use one SQLite database per user installation. Projects and runs share that data
43
43
 
44
44
  Use four shared records:
45
45
 
46
- - A **resource** is one mutable item, such as a run, decision, controller resource, effect, or channel.
46
+ - A **resource** is one mutable item, such as a run, decision, managed resource, effect, or channel.
47
47
  - A **lease** says which process currently owns a resource. Every ownership change increases a durable generation number.
48
48
  - An **event** is the immutable audit record for one accepted resource change.
49
49
  - An **effect** is follow-up work created by a resource change, such as creating a continuation, delivering a notification, or closing a decision presentation.
@@ -452,26 +452,26 @@ This table records all human answer attempts without granting them authority.
452
452
 
453
453
  `(trigger_type, trigger_id)` is unique.
454
454
 
455
- ## Controller schema
455
+ ## ResourceManager schema
456
456
 
457
457
  ### `controller_resources`
458
458
 
459
- | Field | Type | Rules |
460
- | ------------------------ | --------- | ------------------------------------------- |
461
- | `controller_resource_id` | `TEXT` | Primary key |
462
- | `resource_id` | `TEXT` | Unique foreign key to a controller resource |
463
- | `project_id` | `TEXT` | Foreign key to `projects` |
464
- | `controller_name` | `TEXT` | Controller definition name |
465
- | `resource_key` | `TEXT` | Key within controller and project |
466
- | `resource_uid` | `TEXT` | Unique durable UID |
467
- | `spec_generation` | `INTEGER` | Positive desired-state generation |
468
- | `spec_hash` | `BLOB` | Spec JSON in `blobs` |
469
- | `status_hash` | `BLOB` | Status JSON in `blobs` |
470
- | `deletion_requested_at` | `INTEGER` | Optional deletion time |
471
- | `created_at` | `INTEGER` | Creation time |
472
- | `updated_at` | `INTEGER` | Last accepted change |
473
-
474
- `(project_id, controller_name, resource_key)` is unique. `resources.revision` replaces the separate controller resource version.
459
+ | Field | Type | Rules |
460
+ | ------------------------ | --------- | ---------------------------------------- |
461
+ | `controller_resource_id` | `TEXT` | Primary key |
462
+ | `resource_id` | `TEXT` | Unique foreign key to a managed resource |
463
+ | `project_id` | `TEXT` | Foreign key to `projects` |
464
+ | `controller_name` | `TEXT` | ResourceManager definition name |
465
+ | `resource_key` | `TEXT` | Key within controller and project |
466
+ | `resource_uid` | `TEXT` | Unique durable UID |
467
+ | `spec_generation` | `INTEGER` | Positive desired-state generation |
468
+ | `spec_hash` | `BLOB` | Spec JSON in `blobs` |
469
+ | `status_hash` | `BLOB` | Status JSON in `blobs` |
470
+ | `deletion_requested_at` | `INTEGER` | Optional deletion time |
471
+ | `created_at` | `INTEGER` | Creation time |
472
+ | `updated_at` | `INTEGER` | Last accepted change |
473
+
474
+ `(project_id, controller_name, resource_key)` is unique. `resources.revision` replaces the separate managed resource version.
475
475
 
476
476
  ### `controller_finalizers`
477
477
 
@@ -494,7 +494,7 @@ The primary key is `(controller_resource_id, finalizer)`.
494
494
  | `created_at` | `INTEGER` | Enqueue time |
495
495
  | `updated_at` | `INTEGER` | Last queue change |
496
496
 
497
- Ownership uses the controller resource lease.
497
+ Ownership uses the managed resource lease.
498
498
 
499
499
  ### `controller_workflows`
500
500
 
@@ -502,7 +502,7 @@ Ownership uses the controller resource lease.
502
502
  | ------------------------ | --------- | ------------------------------------------------------------------------ |
503
503
  | `request_id` | `TEXT` | Primary key |
504
504
  | `controller_resource_id` | `TEXT` | Foreign key to `controller_resources` |
505
- | `request_key` | `TEXT` | Stable key from controller code |
505
+ | `request_key` | `TEXT` | Stable key from resource manager code |
506
506
  | `workflow_name` | `TEXT` | Requested workflow |
507
507
  | `input_fingerprint` | `BLOB` | 32-byte digest |
508
508
  | `reserved_run_id` | `TEXT` | Deterministic run ID before the run row exists |
@@ -786,7 +786,7 @@ Keep domain stores with their owners:
786
786
  ```text
787
787
  src/workflows/sqlite-store.ts
788
788
  src/workflows/human-decision.ts
789
- src/controllers/sqlite.ts
789
+ src/resource-managers/sqlite.ts
790
790
  src/extension/decision-channels.ts
791
791
  ```
792
792
 
@@ -836,7 +836,7 @@ Verify all race orders, stale request digests, duplicate submissions, model-answ
836
836
 
837
837
  ### Move controllers
838
838
 
839
- Move the complete controller resource lifecycle into the canonical database, including queue work, finalizers, effects, events, and child workflows. Remove the project controller database path and schema.
839
+ Move the complete managed resource lifecycle into the canonical database, including queue work, finalizers, effects, events, and child workflows. Remove the project controller database path and schema.
840
840
 
841
841
  Verify the complete controller lifecycle, including revision conflicts, generation changes, delayed work, effects, child workflows, deletion, and finalizers.
842
842
 
@@ -876,7 +876,7 @@ After code behavior matches this plan:
876
876
 
877
877
  - replace [Run bundle format](../SQLITE_STATE.md) with the SQLite state specification or retire it in favor of `SQLITE_STATE.md`
878
878
  - update [Human decisions](../HUMAN_DECISIONS.md)
879
- - update [Controller runtime specification](../CONTROLLERS.md)
879
+ - update [ResourceManager runtime specification](../RESOURCE_MANAGERS.md)
880
880
  - update [Workflow authoring reference](../workflows.md)
881
881
  - update [Rust TUI viewer](../tui-viewer.md)
882
882
  - update [Development guide](../development.md)
@@ -930,7 +930,7 @@ Test run creation, node execution, looping, included workflows, progress updates
930
930
 
931
931
  Test human versus timeout, human versus cancellation, timeout versus cancellation, defaulted deadline, no-default deadline, stale digest, duplicate answer, late answer, repeated cancellation, owner-only policy, model-answer rejection, one continuation, parent projection, and stale presentation closure.
932
932
 
933
- ### Controller tests
933
+ ### ResourceManager tests
934
934
 
935
935
  Test the complete controller lifecycle, including resource updates, generations, queue claims, delayed work, effect receipts, uncertain outcomes, child workflows, deletion, finalizers, and owner loss.
936
936
 
@@ -314,7 +314,7 @@ The checkpoint continuation is a new stored run, but it is the same logical work
314
314
  - A final presentation must settle before the first prompt becomes ready.
315
315
  - Workflow failure, timeout, and user cancellation cancel every unsent prompt with a saved reason.
316
316
  - A terminal workflow accepts no new prompt, but a repeated request ID can still return its earlier result.
317
- - A prompt can be removed only before it is sent. A `session` actor can remove only a prompt added by the same session tool source. A verified `human` actor can remove any unsent prompt for that run. Controllers can remove only prompts they added with the same controller resource.
317
+ - A prompt can be removed only before it is sent. A `session` actor can remove only a prompt added by the same session tool source. A verified `human` actor can remove any unsent prompt for that run. Controllers can remove only prompts they added with the same managed resource.
318
318
 
319
319
  ### Presentation and delivery
320
320
 
@@ -404,7 +404,7 @@ Add the three tables described above. Add atomic change, lookup, replay, and ins
404
404
 
405
405
  ### 5. Bind settings to node attempts
406
406
 
407
- Update `src/workflows/engine.ts`, `src/host/runner.ts`, and `src/host/rpc-executor.ts`. Save and expose one fixed settings value for every attempt.
407
+ Update `src/workflows/engine.ts`, `src/server/runner.ts`, and `src/server/rpc-executor.ts`. Save and expose one fixed settings value for every attempt.
408
408
 
409
409
  ### 6. Add safe route changes
410
410
 
@@ -418,8 +418,8 @@ Update:
418
418
  - `src/extension/workflow-tool.ts`
419
419
  - `src/extension/index.ts`
420
420
  - `src/extension/step-message.ts`
421
- - `src/controllers/workflows.ts`
422
- - `src/controllers/types.ts`
421
+ - `src/resource-managers/workflows.ts`
422
+ - `src/resource-managers/types.ts`
423
423
 
424
424
  Add `change-settings`, `queue-follow-up`, and `remove-follow-up`. Keep source data outside model input. Use provider-compatible string action schemas.
425
425
 
@@ -66,7 +66,7 @@ Unit tests must cover completed, failed, timed-out, maxSteps, cancelled, and blo
66
66
 
67
67
  - `finishRun` in `src/extension/index.ts`
68
68
  - `src/extension/deferred-turn-coordinator.ts`
69
- - Existing turn-intent state in `src/controllers/sqlite.ts`
69
+ - Existing turn-intent state in `src/resource-managers/sqlite.ts`
70
70
 
71
71
  **Change**
72
72
 
@@ -77,7 +77,7 @@ Normal presentation and fallback delivery must compete for the same intent. The
77
77
  Do not create this turn for:
78
78
 
79
79
  - waiting checkpoints
80
- - controller child runs
80
+ - resource manager child runs
81
81
  - internal helper runs that already report to an owner
82
82
 
83
83
  **Verification**
@@ -345,7 +345,7 @@ Add regression coverage for:
345
345
  3. Failed, timed-out, and maxSteps runs offer restart.
346
346
  4. Explicit cancellation is not restartable through the shortcut.
347
347
  5. Waiting checkpoints do not produce a terminal turn.
348
- 6. Controller child runs do not produce competing turns.
348
+ 6. ResourceManager child runs do not produce competing turns.
349
349
  7. Presentation and fallback races produce one turn.
350
350
  8. Restart uses the exact workflow reference and input.
351
351
  9. Restart leaves the prior run unchanged.