@revisium/orchestrator 0.0.0 → 0.1.0-alpha.10

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 (547) hide show
  1. package/README.md +202 -1
  2. package/control-plane/bootstrap.config.json +104 -2
  3. package/control-plane/default-playbook/catalog/pipelines.json +657 -0
  4. package/control-plane/default-playbook/catalog/roles.json +65 -0
  5. package/control-plane/default-playbook/package.json +5 -0
  6. package/control-plane/default-playbook/playbook.json +13 -0
  7. package/control-plane/default-playbook/prompts/analyst.md +29 -0
  8. package/control-plane/default-playbook/prompts/developer.md +26 -0
  9. package/control-plane/default-playbook/prompts/integrator.md +20 -0
  10. package/control-plane/default-playbook/prompts/orchestrator.md +23 -0
  11. package/control-plane/default-playbook/prompts/reviewer.md +28 -0
  12. package/control-plane/default-playbook/prompts/triager.md +51 -0
  13. package/control-plane/default-playbook/prompts/watcher.md +24 -0
  14. package/dist/api/graphql-api/filters/agent-observability-exception.filter.js +24 -0
  15. package/dist/api/graphql-api/filters/agent-observability-exception.filter.js.map +1 -0
  16. package/dist/api/graphql-api/filters/graphql-validation-exception.filter.js +36 -0
  17. package/dist/api/graphql-api/filters/graphql-validation-exception.filter.js.map +1 -0
  18. package/dist/api/graphql-api/graphql-api.module.js +77 -0
  19. package/dist/api/graphql-api/graphql-api.module.js.map +1 -0
  20. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js +296 -0
  21. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js.map +1 -0
  22. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js +64 -0
  23. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js.map +1 -0
  24. package/dist/api/graphql-api/graphql-ws/constants.js +11 -0
  25. package/dist/api/graphql-api/graphql-ws/constants.js.map +1 -0
  26. package/dist/api/graphql-api/graphql-ws/pubsub.module.js +32 -0
  27. package/dist/api/graphql-api/graphql-ws/pubsub.module.js.map +1 -0
  28. package/dist/api/graphql-api/graphql-ws/run-progress-subscription-poller.service.js +101 -0
  29. package/dist/api/graphql-api/graphql-ws/run-progress-subscription-poller.service.js.map +1 -0
  30. package/dist/api/graphql-api/graphql-ws/subscription-bridge.service.js +115 -0
  31. package/dist/api/graphql-api/graphql-ws/subscription-bridge.service.js.map +1 -0
  32. package/dist/api/graphql-api/graphql-ws/subscription-mappers.js +85 -0
  33. package/dist/api/graphql-api/graphql-ws/subscription-mappers.js.map +1 -0
  34. package/dist/api/graphql-api/graphql-ws/ws.js +22 -0
  35. package/dist/api/graphql-api/graphql-ws/ws.js.map +1 -0
  36. package/dist/api/graphql-api/inbox/inbox-subscription.resolver.js +56 -0
  37. package/dist/api/graphql-api/inbox/inbox-subscription.resolver.js.map +1 -0
  38. package/dist/api/graphql-api/inbox/inbox.resolver.js +125 -0
  39. package/dist/api/graphql-api/inbox/inbox.resolver.js.map +1 -0
  40. package/dist/api/graphql-api/inbox/inputs/answer-question.input.js +33 -0
  41. package/dist/api/graphql-api/inbox/inputs/answer-question.input.js.map +1 -0
  42. package/dist/api/graphql-api/inbox/inputs/gate-decision.input.js +27 -0
  43. package/dist/api/graphql-api/inbox/inputs/gate-decision.input.js.map +1 -0
  44. package/dist/api/graphql-api/inbox/inputs/list-inbox.input.js +28 -0
  45. package/dist/api/graphql-api/inbox/inputs/list-inbox.input.js.map +1 -0
  46. package/dist/api/graphql-api/inbox/inputs/resolve-inbox-item.input.js +38 -0
  47. package/dist/api/graphql-api/inbox/inputs/resolve-inbox-item.input.js.map +1 -0
  48. package/dist/api/graphql-api/inbox/model/gate-risk.model.js +53 -0
  49. package/dist/api/graphql-api/inbox/model/gate-risk.model.js.map +1 -0
  50. package/dist/api/graphql-api/inbox/model/inbox-connection.model.js +16 -0
  51. package/dist/api/graphql-api/inbox/model/inbox-connection.model.js.map +1 -0
  52. package/dist/api/graphql-api/inbox/model/inbox-item.model.js +88 -0
  53. package/dist/api/graphql-api/inbox/model/inbox-item.model.js.map +1 -0
  54. package/dist/api/graphql-api/inbox/model/inbox-resolution.model.js +48 -0
  55. package/dist/api/graphql-api/inbox/model/inbox-resolution.model.js.map +1 -0
  56. package/dist/api/graphql-api/method/inputs/list-method.input.js +15 -0
  57. package/dist/api/graphql-api/method/inputs/list-method.input.js.map +1 -0
  58. package/dist/api/graphql-api/method/method.resolver.js +90 -0
  59. package/dist/api/graphql-api/method/method.resolver.js.map +1 -0
  60. package/dist/api/graphql-api/method/model/alternative-role-group.model.js +32 -0
  61. package/dist/api/graphql-api/method/model/alternative-role-group.model.js.map +1 -0
  62. package/dist/api/graphql-api/method/model/pipeline-connection.model.js +16 -0
  63. package/dist/api/graphql-api/method/model/pipeline-connection.model.js.map +1 -0
  64. package/dist/api/graphql-api/method/model/pipeline.model.js +69 -0
  65. package/dist/api/graphql-api/method/model/pipeline.model.js.map +1 -0
  66. package/dist/api/graphql-api/method/model/playbook-connection.model.js +16 -0
  67. package/dist/api/graphql-api/method/model/playbook-connection.model.js.map +1 -0
  68. package/dist/api/graphql-api/method/model/playbook.model.js +47 -0
  69. package/dist/api/graphql-api/method/model/playbook.model.js.map +1 -0
  70. package/dist/api/graphql-api/method/model/role-connection.model.js +16 -0
  71. package/dist/api/graphql-api/method/model/role-connection.model.js.map +1 -0
  72. package/dist/api/graphql-api/method/model/role.model.js +98 -0
  73. package/dist/api/graphql-api/method/model/role.model.js.map +1 -0
  74. package/dist/api/graphql-api/pr/inputs/pr-readiness.input.js +52 -0
  75. package/dist/api/graphql-api/pr/inputs/pr-readiness.input.js.map +1 -0
  76. package/dist/api/graphql-api/pr/model/pr-readiness.model.js +403 -0
  77. package/dist/api/graphql-api/pr/model/pr-readiness.model.js.map +1 -0
  78. package/dist/api/graphql-api/pr/pr.resolver.js +76 -0
  79. package/dist/api/graphql-api/pr/pr.resolver.js.map +1 -0
  80. package/dist/api/graphql-api/registerGraphqlEnums.js +9 -0
  81. package/dist/api/graphql-api/registerGraphqlEnums.js.map +1 -0
  82. package/dist/api/graphql-api/runs/inputs/create-run.input.js +63 -0
  83. package/dist/api/graphql-api/runs/inputs/create-run.input.js.map +1 -0
  84. package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js +48 -0
  85. package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js.map +1 -0
  86. package/dist/api/graphql-api/runs/inputs/get-run-attempts.input.js +32 -0
  87. package/dist/api/graphql-api/runs/inputs/get-run-attempts.input.js.map +1 -0
  88. package/dist/api/graphql-api/runs/inputs/get-run-events.input.js +28 -0
  89. package/dist/api/graphql-api/runs/inputs/get-run-events.input.js.map +1 -0
  90. package/dist/api/graphql-api/runs/inputs/list-runs.input.js +23 -0
  91. package/dist/api/graphql-api/runs/inputs/list-runs.input.js.map +1 -0
  92. package/dist/api/graphql-api/runs/inputs/simulate-route.input.js +43 -0
  93. package/dist/api/graphql-api/runs/inputs/simulate-route.input.js.map +1 -0
  94. package/dist/api/graphql-api/runs/model/agent-activity.model.js +367 -0
  95. package/dist/api/graphql-api/runs/model/agent-activity.model.js.map +1 -0
  96. package/dist/api/graphql-api/runs/model/create-run-result.model.js +53 -0
  97. package/dist/api/graphql-api/runs/model/create-run-result.model.js.map +1 -0
  98. package/dist/api/graphql-api/runs/model/run-attempt.model.js +114 -0
  99. package/dist/api/graphql-api/runs/model/run-attempt.model.js.map +1 -0
  100. package/dist/api/graphql-api/runs/model/run-connection.model.js +16 -0
  101. package/dist/api/graphql-api/runs/model/run-connection.model.js.map +1 -0
  102. package/dist/api/graphql-api/runs/model/run-cost.model.js +67 -0
  103. package/dist/api/graphql-api/runs/model/run-cost.model.js.map +1 -0
  104. package/dist/api/graphql-api/runs/model/run-digest.model.js +41 -0
  105. package/dist/api/graphql-api/runs/model/run-digest.model.js.map +1 -0
  106. package/dist/api/graphql-api/runs/model/run-event-connection.model.js +16 -0
  107. package/dist/api/graphql-api/runs/model/run-event-connection.model.js.map +1 -0
  108. package/dist/api/graphql-api/runs/model/run-event.model.js +58 -0
  109. package/dist/api/graphql-api/runs/model/run-event.model.js.map +1 -0
  110. package/dist/api/graphql-api/runs/model/run-progress.model.js +33 -0
  111. package/dist/api/graphql-api/runs/model/run-progress.model.js.map +1 -0
  112. package/dist/api/graphql-api/runs/model/run-workflow.model.js +287 -0
  113. package/dist/api/graphql-api/runs/model/run-workflow.model.js.map +1 -0
  114. package/dist/api/graphql-api/runs/model/run.model.js +57 -0
  115. package/dist/api/graphql-api/runs/model/run.model.js.map +1 -0
  116. package/dist/api/graphql-api/runs/model/usage.model.js +32 -0
  117. package/dist/api/graphql-api/runs/model/usage.model.js.map +1 -0
  118. package/dist/api/graphql-api/runs/run-digest.resolver.js +40 -0
  119. package/dist/api/graphql-api/runs/run-digest.resolver.js.map +1 -0
  120. package/dist/api/graphql-api/runs/run-events.resolver.js +45 -0
  121. package/dist/api/graphql-api/runs/run-events.resolver.js.map +1 -0
  122. package/dist/api/graphql-api/runs/run-progress.resolver.js +53 -0
  123. package/dist/api/graphql-api/runs/run-progress.resolver.js.map +1 -0
  124. package/dist/api/graphql-api/runs/runs-subscription.resolver.js +124 -0
  125. package/dist/api/graphql-api/runs/runs-subscription.resolver.js.map +1 -0
  126. package/dist/api/graphql-api/runs/runs.resolver.js +165 -0
  127. package/dist/api/graphql-api/runs/runs.resolver.js.map +1 -0
  128. package/dist/api/graphql-api/share/graphql-param-types.js +6 -0
  129. package/dist/api/graphql-api/share/graphql-param-types.js.map +1 -0
  130. package/dist/api/graphql-api/share/inputs/connection.input.js +27 -0
  131. package/dist/api/graphql-api/share/inputs/connection.input.js.map +1 -0
  132. package/dist/api/graphql-api/share/inputs/run-subscription.input.js +22 -0
  133. package/dist/api/graphql-api/share/inputs/run-subscription.input.js.map +1 -0
  134. package/dist/api/graphql-api/share/model/paginated.model.js +75 -0
  135. package/dist/api/graphql-api/share/model/paginated.model.js.map +1 -0
  136. package/dist/api/graphql-api/system/model/daemon-status.model.js +47 -0
  137. package/dist/api/graphql-api/system/model/daemon-status.model.js.map +1 -0
  138. package/dist/api/graphql-api/system/model/doctor-result.model.js +33 -0
  139. package/dist/api/graphql-api/system/model/doctor-result.model.js.map +1 -0
  140. package/dist/api/graphql-api/system/model/project.model.js +37 -0
  141. package/dist/api/graphql-api/system/model/project.model.js.map +1 -0
  142. package/dist/api/graphql-api/system/model/repository-context.model.js +70 -0
  143. package/dist/api/graphql-api/system/model/repository-context.model.js.map +1 -0
  144. package/dist/api/graphql-api/system/model/repository-validation.model.js +62 -0
  145. package/dist/api/graphql-api/system/model/repository-validation.model.js.map +1 -0
  146. package/dist/api/graphql-api/system/model/system-status.model.js +29 -0
  147. package/dist/api/graphql-api/system/model/system-status.model.js.map +1 -0
  148. package/dist/api/graphql-api/system/system.resolver.js +83 -0
  149. package/dist/api/graphql-api/system/system.resolver.js.map +1 -0
  150. package/dist/cli/commands/doctor-report.js +70 -0
  151. package/dist/cli/commands/doctor-report.js.map +1 -0
  152. package/dist/cli/commands/lifecycle.js +463 -0
  153. package/dist/cli/commands/lifecycle.js.map +1 -0
  154. package/dist/cli/commands/mcp.js +53 -8
  155. package/dist/cli/commands/mcp.js.map +1 -1
  156. package/dist/cli/commands/process-tree.js +87 -0
  157. package/dist/cli/commands/process-tree.js.map +1 -0
  158. package/dist/cli/commands/revisium-helpers.js +2 -2
  159. package/dist/cli/commands/rogue-reaper.js +63 -0
  160. package/dist/cli/commands/rogue-reaper.js.map +1 -0
  161. package/dist/cli/index.js +5 -29
  162. package/dist/cli/index.js.map +1 -1
  163. package/dist/cli/program.js +7 -23
  164. package/dist/cli/program.js.map +1 -1
  165. package/dist/config.js +79 -1
  166. package/dist/config.js.map +1 -1
  167. package/dist/control-plane/bootstrap.js +101 -0
  168. package/dist/control-plane/bootstrap.js.map +1 -0
  169. package/dist/control-plane/change-notifications.js +35 -0
  170. package/dist/control-plane/change-notifications.js.map +1 -0
  171. package/dist/control-plane/client-transport.js +74 -41
  172. package/dist/control-plane/client-transport.js.map +1 -1
  173. package/dist/control-plane/data-access.js +13 -5
  174. package/dist/control-plane/data-access.js.map +1 -1
  175. package/dist/control-plane/definitions.js +1 -1
  176. package/dist/control-plane/definitions.js.map +1 -1
  177. package/dist/control-plane/inbox.js +5 -31
  178. package/dist/control-plane/inbox.js.map +1 -1
  179. package/dist/control-plane/index.js +1 -1
  180. package/dist/control-plane/index.js.map +1 -1
  181. package/dist/control-plane/json-fields.js +2 -0
  182. package/dist/control-plane/json-fields.js.map +1 -1
  183. package/dist/control-plane/resolve-cwd.js +76 -8
  184. package/dist/control-plane/resolve-cwd.js.map +1 -1
  185. package/dist/control-plane/schema-migration.js +82 -0
  186. package/dist/control-plane/schema-migration.js.map +1 -0
  187. package/dist/control-plane/seed-default-playbook.js +141 -0
  188. package/dist/control-plane/seed-default-playbook.js.map +1 -0
  189. package/dist/control-plane/steps.js +15 -349
  190. package/dist/control-plane/steps.js.map +1 -1
  191. package/dist/control-plane/tables.js +1 -0
  192. package/dist/control-plane/tables.js.map +1 -1
  193. package/dist/e2e/kit/agents.js +148 -0
  194. package/dist/e2e/kit/agents.js.map +1 -0
  195. package/dist/e2e/kit/assertions.js +163 -0
  196. package/dist/e2e/kit/assertions.js.map +1 -0
  197. package/dist/e2e/kit/crash.js +44 -0
  198. package/dist/e2e/kit/crash.js.map +1 -0
  199. package/dist/e2e/kit/drive.js +45 -0
  200. package/dist/e2e/kit/drive.js.map +1 -0
  201. package/dist/e2e/kit/env.js +16 -0
  202. package/dist/e2e/kit/env.js.map +1 -0
  203. package/dist/e2e/kit/fake-integrator.js +57 -0
  204. package/dist/e2e/kit/fake-integrator.js.map +1 -0
  205. package/dist/e2e/kit/gh-emulator.js +213 -0
  206. package/dist/e2e/kit/gh-emulator.js.map +1 -0
  207. package/dist/e2e/kit/git-target-repo.js +115 -0
  208. package/dist/e2e/kit/git-target-repo.js.map +1 -0
  209. package/dist/e2e/kit/harness.js +72 -0
  210. package/dist/e2e/kit/harness.js.map +1 -0
  211. package/dist/e2e/kit/index.js +14 -0
  212. package/dist/e2e/kit/index.js.map +1 -0
  213. package/dist/e2e/kit/mcp.js +32 -0
  214. package/dist/e2e/kit/mcp.js.map +1 -0
  215. package/dist/e2e/kit/scenarios.js +196 -0
  216. package/dist/e2e/kit/scenarios.js.map +1 -0
  217. package/dist/e2e/recovery-crash-child.js +29 -0
  218. package/dist/e2e/recovery-crash-child.js.map +1 -0
  219. package/dist/e2e/recovery-dd-crash-child.js +43 -0
  220. package/dist/e2e/recovery-dd-crash-child.js.map +1 -0
  221. package/dist/engine/dbos.module.js +2 -1
  222. package/dist/engine/dbos.module.js.map +1 -1
  223. package/dist/engine/dbos.service.js +89 -18
  224. package/dist/engine/dbos.service.js.map +1 -1
  225. package/dist/engine/ensure-postgres.js +18 -4
  226. package/dist/engine/ensure-postgres.js.map +1 -1
  227. package/dist/features/inbox/commands/handlers/inbox-command.handlers.js +80 -0
  228. package/dist/features/inbox/commands/handlers/inbox-command.handlers.js.map +1 -0
  229. package/dist/features/inbox/commands/impl/answer-question.command.js +7 -0
  230. package/dist/features/inbox/commands/impl/answer-question.command.js.map +1 -0
  231. package/dist/features/inbox/commands/impl/approve-gate.command.js +7 -0
  232. package/dist/features/inbox/commands/impl/approve-gate.command.js.map +1 -0
  233. package/dist/features/inbox/commands/impl/reject-gate.command.js +7 -0
  234. package/dist/features/inbox/commands/impl/reject-gate.command.js.map +1 -0
  235. package/dist/features/inbox/commands/impl/resolve-inbox-item.command.js +7 -0
  236. package/dist/features/inbox/commands/impl/resolve-inbox-item.command.js.map +1 -0
  237. package/dist/features/inbox/commands/index.js +8 -0
  238. package/dist/features/inbox/commands/index.js.map +1 -0
  239. package/dist/features/inbox/inbox-api.module.js +23 -0
  240. package/dist/features/inbox/inbox-api.module.js.map +1 -0
  241. package/dist/features/inbox/inbox-api.service.js +63 -0
  242. package/dist/features/inbox/inbox-api.service.js.map +1 -0
  243. package/dist/features/inbox/queries/handlers/inbox-query.handlers.js +111 -0
  244. package/dist/features/inbox/queries/handlers/inbox-query.handlers.js.map +1 -0
  245. package/dist/features/inbox/queries/impl/get-inbox-item.query.js +7 -0
  246. package/dist/features/inbox/queries/impl/get-inbox-item.query.js.map +1 -0
  247. package/dist/features/inbox/queries/impl/get-pending-decisions.query.js +7 -0
  248. package/dist/features/inbox/queries/impl/get-pending-decisions.query.js.map +1 -0
  249. package/dist/features/inbox/queries/impl/list-inbox.query.js +7 -0
  250. package/dist/features/inbox/queries/impl/list-inbox.query.js.map +1 -0
  251. package/dist/features/inbox/queries/impl/summarize-gate-risk.query.js +7 -0
  252. package/dist/features/inbox/queries/impl/summarize-gate-risk.query.js.map +1 -0
  253. package/dist/features/inbox/queries/index.js +8 -0
  254. package/dist/features/inbox/queries/index.js.map +1 -0
  255. package/dist/features/method/commands/index.js +2 -0
  256. package/dist/features/method/commands/index.js.map +1 -0
  257. package/dist/features/method/method-api.module.js +23 -0
  258. package/dist/features/method/method-api.module.js.map +1 -0
  259. package/dist/features/method/method-api.service.js +47 -0
  260. package/dist/features/method/method-api.service.js.map +1 -0
  261. package/dist/features/method/queries/handlers/method-query.handlers.js +115 -0
  262. package/dist/features/method/queries/handlers/method-query.handlers.js.map +1 -0
  263. package/dist/features/method/queries/impl/get-pipeline.query.js +7 -0
  264. package/dist/features/method/queries/impl/get-pipeline.query.js.map +1 -0
  265. package/dist/features/method/queries/impl/get-role.query.js +7 -0
  266. package/dist/features/method/queries/impl/get-role.query.js.map +1 -0
  267. package/dist/features/method/queries/impl/list-pipelines.query.js +7 -0
  268. package/dist/features/method/queries/impl/list-pipelines.query.js.map +1 -0
  269. package/dist/features/method/queries/impl/list-playbooks.query.js +7 -0
  270. package/dist/features/method/queries/impl/list-playbooks.query.js.map +1 -0
  271. package/dist/features/method/queries/impl/list-roles.query.js +7 -0
  272. package/dist/features/method/queries/impl/list-roles.query.js.map +1 -0
  273. package/dist/features/method/queries/index.js +9 -0
  274. package/dist/features/method/queries/index.js.map +1 -0
  275. package/dist/features/pr/commands/index.js +2 -0
  276. package/dist/features/pr/commands/index.js.map +1 -0
  277. package/dist/features/pr/pr-api.module.js +23 -0
  278. package/dist/features/pr/pr-api.module.js.map +1 -0
  279. package/dist/features/pr/pr-api.service.js +35 -0
  280. package/dist/features/pr/pr-api.service.js.map +1 -0
  281. package/dist/features/pr/queries/handlers/pr-query.handlers.js +48 -0
  282. package/dist/features/pr/queries/handlers/pr-query.handlers.js.map +1 -0
  283. package/dist/features/pr/queries/impl/get-pr-readiness.query.js +7 -0
  284. package/dist/features/pr/queries/impl/get-pr-readiness.query.js.map +1 -0
  285. package/dist/features/pr/queries/impl/list-pr-feedback.query.js +7 -0
  286. package/dist/features/pr/queries/impl/list-pr-feedback.query.js.map +1 -0
  287. package/dist/features/pr/queries/index.js +3 -0
  288. package/dist/features/pr/queries/index.js.map +1 -0
  289. package/dist/features/runs/commands/handlers/runs-command.handlers.js +32 -0
  290. package/dist/features/runs/commands/handlers/runs-command.handlers.js.map +1 -0
  291. package/dist/features/runs/commands/impl/create-run.command.js +7 -0
  292. package/dist/features/runs/commands/impl/create-run.command.js.map +1 -0
  293. package/dist/features/runs/commands/index.js +3 -0
  294. package/dist/features/runs/commands/index.js.map +1 -0
  295. package/dist/features/runs/queries/handlers/runs-query.handlers.js +359 -0
  296. package/dist/features/runs/queries/handlers/runs-query.handlers.js.map +1 -0
  297. package/dist/features/runs/queries/impl/get-agent-activity.query.js +7 -0
  298. package/dist/features/runs/queries/impl/get-agent-activity.query.js.map +1 -0
  299. package/dist/features/runs/queries/impl/get-agent-attempts.query.js +7 -0
  300. package/dist/features/runs/queries/impl/get-agent-attempts.query.js.map +1 -0
  301. package/dist/features/runs/queries/impl/get-agent-log.query.js +7 -0
  302. package/dist/features/runs/queries/impl/get-agent-log.query.js.map +1 -0
  303. package/dist/features/runs/queries/impl/get-run-attempts.query.js +7 -0
  304. package/dist/features/runs/queries/impl/get-run-attempts.query.js.map +1 -0
  305. package/dist/features/runs/queries/impl/get-run-digest.query.js +7 -0
  306. package/dist/features/runs/queries/impl/get-run-digest.query.js.map +1 -0
  307. package/dist/features/runs/queries/impl/get-run-events.query.js +7 -0
  308. package/dist/features/runs/queries/impl/get-run-events.query.js.map +1 -0
  309. package/dist/features/runs/queries/impl/get-run-progress.query.js +7 -0
  310. package/dist/features/runs/queries/impl/get-run-progress.query.js.map +1 -0
  311. package/dist/features/runs/queries/impl/get-run-workflow.query.js +7 -0
  312. package/dist/features/runs/queries/impl/get-run-workflow.query.js.map +1 -0
  313. package/dist/features/runs/queries/impl/get-run.query.js +7 -0
  314. package/dist/features/runs/queries/impl/get-run.query.js.map +1 -0
  315. package/dist/features/runs/queries/impl/list-runs.query.js +7 -0
  316. package/dist/features/runs/queries/impl/list-runs.query.js.map +1 -0
  317. package/dist/features/runs/queries/impl/simulate-route.query.js +7 -0
  318. package/dist/features/runs/queries/impl/simulate-route.query.js.map +1 -0
  319. package/dist/features/runs/queries/index.js +15 -0
  320. package/dist/features/runs/queries/index.js.map +1 -0
  321. package/dist/features/runs/runs-api.module.js +23 -0
  322. package/dist/features/runs/runs-api.module.js.map +1 -0
  323. package/dist/features/runs/runs-api.service.js +79 -0
  324. package/dist/features/runs/runs-api.service.js.map +1 -0
  325. package/dist/features/shared/connection.js +39 -0
  326. package/dist/features/shared/connection.js.map +1 -0
  327. package/dist/features/system/commands/index.js +2 -0
  328. package/dist/features/system/commands/index.js.map +1 -0
  329. package/dist/features/system/queries/handlers/system-query.handlers.js +96 -0
  330. package/dist/features/system/queries/handlers/system-query.handlers.js.map +1 -0
  331. package/dist/features/system/queries/impl/doctor.query.js +4 -0
  332. package/dist/features/system/queries/impl/doctor.query.js.map +1 -0
  333. package/dist/features/system/queries/impl/get-project.query.js +4 -0
  334. package/dist/features/system/queries/impl/get-project.query.js.map +1 -0
  335. package/dist/features/system/queries/impl/get-repository-context.query.js +7 -0
  336. package/dist/features/system/queries/impl/get-repository-context.query.js.map +1 -0
  337. package/dist/features/system/queries/impl/get-status.query.js +4 -0
  338. package/dist/features/system/queries/impl/get-status.query.js.map +1 -0
  339. package/dist/features/system/queries/impl/validate-repository.query.js +7 -0
  340. package/dist/features/system/queries/impl/validate-repository.query.js.map +1 -0
  341. package/dist/features/system/queries/index.js +9 -0
  342. package/dist/features/system/queries/index.js.map +1 -0
  343. package/dist/features/system/system-api.module.js +23 -0
  344. package/dist/features/system/system-api.module.js.map +1 -0
  345. package/dist/features/system/system-api.service.js +47 -0
  346. package/dist/features/system/system-api.service.js.map +1 -0
  347. package/dist/host/daemon.js +99 -0
  348. package/dist/host/daemon.js.map +1 -0
  349. package/dist/host/dbos-identity.js +42 -0
  350. package/dist/host/dbos-identity.js.map +1 -0
  351. package/dist/host/ensure-host.js +120 -0
  352. package/dist/host/ensure-host.js.map +1 -0
  353. package/dist/host/host-runtime.js +90 -0
  354. package/dist/host/host-runtime.js.map +1 -0
  355. package/dist/host/host.lifecycle.js +16 -3
  356. package/dist/host/host.lifecycle.js.map +1 -1
  357. package/dist/host/queue-ownership.js +70 -0
  358. package/dist/host/queue-ownership.js.map +1 -0
  359. package/dist/host/queue-poller-census.js +47 -0
  360. package/dist/host/queue-poller-census.js.map +1 -0
  361. package/dist/http/graphql-host.js +56 -0
  362. package/dist/http/graphql-host.js.map +1 -0
  363. package/dist/{mcp/mcp.module.js → http/graphql-host.module.js} +12 -10
  364. package/dist/http/graphql-host.module.js.map +1 -0
  365. package/dist/infrastructure/metrics/graphql/graphql-metrics.js +91 -0
  366. package/dist/infrastructure/metrics/graphql/graphql-metrics.js.map +1 -0
  367. package/dist/mcp/mcp-capabilities.js +9 -1
  368. package/dist/mcp/mcp-capabilities.js.map +1 -1
  369. package/dist/mcp/mcp-facade.service.js +68 -5
  370. package/dist/mcp/mcp-facade.service.js.map +1 -1
  371. package/dist/mcp/mcp-http.service.js +95 -0
  372. package/dist/mcp/mcp-http.service.js.map +1 -0
  373. package/dist/mcp/mcp-tools.js +93 -7
  374. package/dist/mcp/mcp-tools.js.map +1 -1
  375. package/dist/observability/agent-activity-reporter.js +185 -0
  376. package/dist/observability/agent-activity-reporter.js.map +1 -0
  377. package/dist/observability/agent-observability.service.js +1142 -0
  378. package/dist/observability/agent-observability.service.js.map +1 -0
  379. package/dist/observability/index.js +4 -0
  380. package/dist/observability/index.js.map +1 -0
  381. package/dist/observability/types.js +11 -0
  382. package/dist/observability/types.js.map +1 -0
  383. package/dist/pipeline/await-human.js +8 -4
  384. package/dist/pipeline/await-human.js.map +1 -1
  385. package/dist/pipeline/data-driven-task.workflow.js +667 -0
  386. package/dist/pipeline/data-driven-task.workflow.js.map +1 -0
  387. package/dist/pipeline/data-driven-template.js +57 -0
  388. package/dist/pipeline/data-driven-template.js.map +1 -0
  389. package/dist/pipeline/pipeline.module.js +2 -2
  390. package/dist/pipeline/pipeline.module.js.map +1 -1
  391. package/dist/pipeline/pipeline.service.js +412 -0
  392. package/dist/pipeline/pipeline.service.js.map +1 -0
  393. package/dist/pipeline/route-contract.js +82 -0
  394. package/dist/pipeline/route-contract.js.map +1 -0
  395. package/dist/pipeline-core/index.js +16 -0
  396. package/dist/pipeline-core/index.js.map +1 -0
  397. package/dist/pipeline-core/interpret.js +353 -0
  398. package/dist/pipeline-core/interpret.js.map +1 -0
  399. package/dist/pipeline-core/kit/assertions.js +61 -0
  400. package/dist/pipeline-core/kit/assertions.js.map +1 -0
  401. package/dist/pipeline-core/kit/builders.js +138 -0
  402. package/dist/pipeline-core/kit/builders.js.map +1 -0
  403. package/dist/pipeline-core/kit/drive.js +96 -0
  404. package/dist/pipeline-core/kit/drive.js.map +1 -0
  405. package/dist/pipeline-core/kit/fixtures.js +342 -0
  406. package/dist/pipeline-core/kit/fixtures.js.map +1 -0
  407. package/dist/pipeline-core/kit/index.js +13 -0
  408. package/dist/pipeline-core/kit/index.js.map +1 -0
  409. package/dist/pipeline-core/types.js +134 -0
  410. package/dist/pipeline-core/types.js.map +1 -0
  411. package/dist/pipeline-core/validate-capability.js +23 -0
  412. package/dist/pipeline-core/validate-capability.js.map +1 -0
  413. package/dist/pipeline-core/validate-conflicts.js +37 -0
  414. package/dist/pipeline-core/validate-conflicts.js.map +1 -0
  415. package/dist/pipeline-core/validate-dataflow.js +212 -0
  416. package/dist/pipeline-core/validate-dataflow.js.map +1 -0
  417. package/dist/pipeline-core/validate-diff.js +158 -0
  418. package/dist/pipeline-core/validate-diff.js.map +1 -0
  419. package/dist/pipeline-core/validate-edges.js +44 -0
  420. package/dist/pipeline-core/validate-edges.js.map +1 -0
  421. package/dist/pipeline-core/validate-graph.js +123 -0
  422. package/dist/pipeline-core/validate-graph.js.map +1 -0
  423. package/dist/pipeline-core/validate-loops.js +226 -0
  424. package/dist/pipeline-core/validate-loops.js.map +1 -0
  425. package/dist/pipeline-core/validate-parallel.js +132 -0
  426. package/dist/pipeline-core/validate-parallel.js.map +1 -0
  427. package/dist/pipeline-core/validate-sink.js +27 -0
  428. package/dist/pipeline-core/validate-sink.js.map +1 -0
  429. package/dist/pipeline-core/validate-topology.js +140 -0
  430. package/dist/pipeline-core/validate-topology.js.map +1 -0
  431. package/dist/pipeline-core/validate-verdict.js +72 -0
  432. package/dist/pipeline-core/validate-verdict.js.map +1 -0
  433. package/dist/pipeline-core/validate.js +119 -0
  434. package/dist/pipeline-core/validate.js.map +1 -0
  435. package/dist/playbook/catalog-loader.js +14 -1
  436. package/dist/playbook/catalog-loader.js.map +1 -1
  437. package/dist/playbook/import-mapper.js +14 -38
  438. package/dist/playbook/import-mapper.js.map +1 -1
  439. package/dist/playbook/manifest.js +1 -1
  440. package/dist/revisium/playbooks.service.js +107 -19
  441. package/dist/revisium/playbooks.service.js.map +1 -1
  442. package/dist/revisium/roles.service.js +1 -1
  443. package/dist/revisium/roles.service.js.map +1 -1
  444. package/dist/revisium/run.service.js +55 -8
  445. package/dist/revisium/run.service.js.map +1 -1
  446. package/dist/run/append-event.js +24 -1
  447. package/dist/run/append-event.js.map +1 -1
  448. package/dist/run/block-run.js +17 -0
  449. package/dist/run/block-run.js.map +1 -0
  450. package/dist/run/complete-run.js +18 -0
  451. package/dist/run/complete-run.js.map +1 -0
  452. package/dist/run/create-run.js +33 -36
  453. package/dist/run/create-run.js.map +1 -1
  454. package/dist/run/inspect-run.js +31 -30
  455. package/dist/run/inspect-run.js.map +1 -1
  456. package/dist/run/run-outputs.js +88 -0
  457. package/dist/run/run-outputs.js.map +1 -0
  458. package/dist/run/terminal-run-status.js +66 -7
  459. package/dist/run/terminal-run-status.js.map +1 -1
  460. package/dist/runners/claude-code.service.js +5 -0
  461. package/dist/runners/claude-code.service.js.map +1 -1
  462. package/dist/runners/codex.service.js +51 -0
  463. package/dist/runners/codex.service.js.map +1 -0
  464. package/dist/runners/integrator-branch-naming.js +39 -0
  465. package/dist/runners/integrator-branch-naming.js.map +1 -0
  466. package/dist/runners/integrator-git.js +84 -0
  467. package/dist/runners/integrator-git.js.map +1 -0
  468. package/dist/runners/integrator-remote.js +34 -0
  469. package/dist/runners/integrator-remote.js.map +1 -0
  470. package/dist/runners/integrator-types.js +9 -0
  471. package/dist/runners/integrator-types.js.map +1 -0
  472. package/dist/runners/integrator.js +327 -147
  473. package/dist/runners/integrator.js.map +1 -1
  474. package/dist/runners/runner.module.js +7 -3
  475. package/dist/runners/runner.module.js.map +1 -1
  476. package/dist/runners/worktree.service.js +63 -0
  477. package/dist/runners/worktree.service.js.map +1 -0
  478. package/dist/smoke/cli.js +47 -0
  479. package/dist/smoke/cli.js.map +1 -0
  480. package/dist/smoke/isolation.js +113 -0
  481. package/dist/smoke/isolation.js.map +1 -0
  482. package/dist/task-control-plane/run-watch.service.js +281 -0
  483. package/dist/task-control-plane/run-watch.service.js.map +1 -0
  484. package/dist/task-control-plane/task-control-plane-api.service.js +569 -23
  485. package/dist/task-control-plane/task-control-plane-api.service.js.map +1 -1
  486. package/dist/task-control-plane/task-control-plane.module.js +22 -3
  487. package/dist/task-control-plane/task-control-plane.module.js.map +1 -1
  488. package/dist/worker/artifact-store.js +116 -0
  489. package/dist/worker/artifact-store.js.map +1 -0
  490. package/dist/worker/build-context.js +169 -2
  491. package/dist/worker/build-context.js.map +1 -1
  492. package/dist/worker/claude-code-runner.js +159 -68
  493. package/dist/worker/claude-code-runner.js.map +1 -1
  494. package/dist/worker/codex-runner.js +474 -0
  495. package/dist/worker/codex-runner.js.map +1 -0
  496. package/dist/worker/git-worktree-manager.js +129 -65
  497. package/dist/worker/git-worktree-manager.js.map +1 -1
  498. package/dist/worker/process-executor.js +23 -2
  499. package/dist/worker/process-executor.js.map +1 -1
  500. package/dist/worker/result-envelope.js +115 -57
  501. package/dist/worker/result-envelope.js.map +1 -1
  502. package/dist/worker/runner-common.js +106 -0
  503. package/dist/worker/runner-common.js.map +1 -0
  504. package/dist/worker/runner-dispatch.js +4 -1
  505. package/dist/worker/runner-dispatch.js.map +1 -1
  506. package/dist/worker/runner.js +11 -1
  507. package/dist/worker/runner.js.map +1 -1
  508. package/dist/worker/stub-runner.js +7 -45
  509. package/dist/worker/stub-runner.js.map +1 -1
  510. package/package.json +32 -7
  511. package/dist/app.module.js +0 -28
  512. package/dist/app.module.js.map +0 -1
  513. package/dist/cli/commands/bootstrap.js +0 -39
  514. package/dist/cli/commands/bootstrap.js.map +0 -1
  515. package/dist/cli/commands/dev.js +0 -143
  516. package/dist/cli/commands/dev.js.map +0 -1
  517. package/dist/cli/commands/inbox.js +0 -288
  518. package/dist/cli/commands/inbox.js.map +0 -1
  519. package/dist/cli/commands/playbook.js +0 -74
  520. package/dist/cli/commands/playbook.js.map +0 -1
  521. package/dist/cli/commands/poll-workflow-state.js +0 -144
  522. package/dist/cli/commands/poll-workflow-state.js.map +0 -1
  523. package/dist/cli/commands/revisium-context.js +0 -23
  524. package/dist/cli/commands/revisium-context.js.map +0 -1
  525. package/dist/cli/commands/revisium.js +0 -89
  526. package/dist/cli/commands/revisium.js.map +0 -1
  527. package/dist/cli/commands/run.js +0 -426
  528. package/dist/cli/commands/run.js.map +0 -1
  529. package/dist/cli/commands/work.js +0 -149
  530. package/dist/cli/commands/work.js.map +0 -1
  531. package/dist/cli/live-guard.js +0 -49
  532. package/dist/cli/live-guard.js.map +0 -1
  533. package/dist/cli/needs-host.js +0 -78
  534. package/dist/cli/needs-host.js.map +0 -1
  535. package/dist/mcp/mcp-stdio.service.js +0 -48
  536. package/dist/mcp/mcp-stdio.service.js.map +0 -1
  537. package/dist/mcp/mcp.module.js.map +0 -1
  538. package/dist/pipeline/develop-task.workflow.js +0 -497
  539. package/dist/pipeline/develop-task.workflow.js.map +0 -1
  540. package/dist/worker/loop.js +0 -122
  541. package/dist/worker/loop.js.map +0 -1
  542. package/dist/worker/script-runner.js +0 -28
  543. package/dist/worker/script-runner.js.map +0 -1
  544. package/dist/worker/worker-id.js +0 -18
  545. package/dist/worker/worker-id.js.map +0 -1
  546. package/dist/worker/worktree-manager.js +0 -7
  547. package/dist/worker/worktree-manager.js.map +0 -1
@@ -1,84 +1,148 @@
1
+ /**
2
+ * git-worktree-manager.ts — per-RUN git worktree lifecycle (plan 0017).
3
+ *
4
+ * DBOS-SEALED: zero @dbos-inc imports. Create/release are registered as memoized DBOS steps in
5
+ * PipelineService; this module is pure git side effects + deterministic paths.
6
+ *
7
+ * Each LIVE run gets ONE isolated worktree at `<dataDir>/worktrees/<runId>`, checked out on the run's
8
+ * feature branch (the SAME `feat/<taskId>-<slug>` the integrator computes) off a freshly-fetched
9
+ * `origin/<base>`. The developer (and rework) steps + the integrator all resolve their cwd to it
10
+ * (see resolveRunCwd), so the user's base checkout is never mutated and concurrent runs on one repo
11
+ * cannot collide. The durable artifact is the pushed branch; the worktree is execution scratch.
12
+ *
13
+ * Replay-safety: `createRunWorktree` is create-IF-ABSENT (a no-op returning the existing path when the
14
+ * worktree is already valid), so a DBOS replay / crash-recovery re-entry never errors and preserves
15
+ * in-flight uncommitted developer work. `releaseRunWorktree` is best-effort and no-ops if absent.
16
+ */
1
17
  import { execFileSync } from 'node:child_process';
2
- import { existsSync, lstatSync, rmSync, symlinkSync } from 'node:fs';
3
- import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
4
- function git(args, cwd) {
5
- return execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
18
+ import { existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync, } from 'node:fs';
19
+ import { dirname, join } from 'node:path';
20
+ import { worktreePathFor, worktreeMarkerFor, isWorktreeDir, } from '../control-plane/resolve-cwd.js';
21
+ import { resolveExecutable } from '../runners/integrator.js';
22
+ const GIT_TIMEOUT_MS = 60_000;
23
+ // Resolve `git` to an ABSOLUTE path once (mirrors the integrator's defaultExecGit): execFileSync is
24
+ // never handed a bare command name resolved against a mutable PATH at spawn time.
25
+ let _gitAbsPath;
26
+ function gitAbsPath() {
27
+ if (_gitAbsPath === undefined)
28
+ _gitAbsPath = resolveExecutable('git');
29
+ return _gitAbsPath;
6
30
  }
7
- function branchName(stepId) {
8
- return `run/${stepId}`;
31
+ /** Default git executor — runs the absolute `git` binary in `cwd`. */
32
+ function defaultExecGit(args, cwd) {
33
+ return execFileSync(gitAbsPath(), args, { encoding: 'utf8', cwd, timeout: GIT_TIMEOUT_MS });
9
34
  }
10
- function stepIdFromWorktreePath(worktreePath) {
11
- return basename(worktreePath);
35
+ const INSTALL_TIMEOUT_MS = 300_000;
36
+ /** Default pnpm install executor — runs the absolute `pnpm` binary. Throws if pnpm is unavailable
37
+ * (the caller treats a throw as "fall back to the node_modules symlink"). */
38
+ function defaultExecInstall(args, cwd) {
39
+ execFileSync(resolveExecutable('pnpm'), args, { cwd, timeout: INSTALL_TIMEOUT_MS, stdio: 'ignore' });
12
40
  }
13
- function gitRootFromExistingPath(path) {
14
- return git(['rev-parse', '--show-toplevel'], path);
15
- }
16
- function gitCommonRootFromExistingPath(path) {
17
- const commonDir = git(['rev-parse', '--git-common-dir'], path);
18
- const absoluteCommonDir = isAbsolute(commonDir) ? commonDir : resolve(path, commonDir);
19
- return dirname(absoluteCommonDir);
41
+ /**
42
+ * Provision the worktree's dependencies so the developer/tests can build & run.
43
+ *
44
+ * Why pnpm gets a real install (not the symlink): pnpm's `node_modules` is a virtual store of symlinks
45
+ * into `node_modules/.pnpm` wired to the project layout; symlinking the base's `node_modules` into a
46
+ * worktree at a different path shares a MUTABLE tree across runs (one install/postinstall leaks into
47
+ * the base and parallel runs). A `pnpm install --frozen-lockfile` in the worktree is cheap (hard-links
48
+ * from the global content-addressed store, no re-download) and yields a correct, ISOLATED tree from the
49
+ * committed `pnpm-lock.yaml`. Non-pnpm repos keep the best-effort base-`node_modules` symlink.
50
+ */
51
+ function provisionDeps(worktreePath, baseRepoCwd, execInstall) {
52
+ if (existsSync(join(worktreePath, 'pnpm-lock.yaml'))) {
53
+ try {
54
+ execInstall(['install', '--frozen-lockfile'], worktreePath);
55
+ return; // isolated install succeeded — do NOT also symlink
56
+ }
57
+ catch {
58
+ // pnpm unavailable / install failed — fall through to the symlink fallback below
59
+ }
60
+ }
61
+ try {
62
+ const baseModules = join(baseRepoCwd, 'node_modules');
63
+ const wtModules = join(worktreePath, 'node_modules');
64
+ if (existsSync(baseModules) && !existsSync(wtModules)) {
65
+ symlinkSync(baseModules, wtModules, 'dir');
66
+ }
67
+ }
68
+ catch {
69
+ // ignore — the developer simply runs without provisioned node_modules
70
+ }
20
71
  }
21
- function gitRootFromWorktreePath(worktreePath) {
22
- if (existsSync(worktreePath)) {
23
- return gitCommonRootFromExistingPath(worktreePath);
72
+ /**
73
+ * Create the run's isolated worktree if absent (idempotent). Returns its path.
74
+ *
75
+ * 1. If a valid worktree already exists at the deterministic path → write the live marker and return
76
+ * it (replay / recovery: never clobber in-flight developer work).
77
+ * 2. Else: fetch `origin/<base>`, then `git worktree add -B <branch> <path> origin/<base>` (create-or-
78
+ * reset the feature branch and check it out in the new worktree).
79
+ * 3. Provision deps (provisionDeps): `pnpm install --frozen-lockfile` for a pnpm repo, else a
80
+ * best-effort base-`node_modules` symlink — so the developer can build/test in the isolated tree.
81
+ * 4. Write the `<runId>.live` marker (fail-loud signal for the resolver).
82
+ */
83
+ export function createRunWorktree(opts) {
84
+ const { runId, baseRepoCwd, base, branch, dataDir } = opts;
85
+ const execGit = opts.execGit ?? defaultExecGit;
86
+ const execInstall = opts.execInstall ?? defaultExecInstall;
87
+ const worktreePath = worktreePathFor(dataDir, runId);
88
+ if (isWorktreeDir(worktreePath)) {
89
+ writeMarker(dataDir, runId);
90
+ return { worktreePath };
24
91
  }
25
- const worktreesDir = dirname(worktreePath);
26
- if (basename(worktreesDir) !== '.worktrees')
27
- return null;
28
- const candidate = dirname(worktreesDir);
29
- return existsSync(join(candidate, '.git')) ? candidate : null;
92
+ mkdirSync(dirname(worktreePath), { recursive: true });
93
+ // Fetch the base so the worktree is cut from fresh origin/<base>.
94
+ execGit(['fetch', 'origin', base], baseRepoCwd);
95
+ // -B: create-or-reset <branch> at origin/<base> and check it out in the new linked worktree.
96
+ execGit(['worktree', 'add', '-B', branch, worktreePath, `origin/${base}`], baseRepoCwd);
97
+ // Provision dependencies (pnpm install for a pnpm repo, else node_modules symlink) — best-effort.
98
+ provisionDeps(worktreePath, baseRepoCwd, execInstall);
99
+ writeMarker(dataDir, runId);
100
+ return { worktreePath };
30
101
  }
31
- function deleteBranchIfPresent(gitRoot, stepId) {
102
+ /**
103
+ * Release the run's worktree (best-effort, idempotent). Removes the linked worktree + prunes stale
104
+ * administrative entries + drops the live marker. No-ops if the worktree is already gone. Called only
105
+ * at a TERMINAL state — never while parked at a gate (the workflow stays alive across `recv`, so the
106
+ * lifecycle `finally` does not run during a park).
107
+ */
108
+ export function releaseRunWorktree(opts) {
109
+ const { runId, baseRepoCwd, dataDir } = opts;
110
+ const execGit = opts.execGit ?? defaultExecGit;
111
+ const worktreePath = worktreePathFor(dataDir, runId);
32
112
  try {
33
- git(['branch', '-D', branchName(stepId)], gitRoot);
113
+ if (existsSync(worktreePath)) {
114
+ execGit(['worktree', 'remove', '--force', worktreePath], baseRepoCwd);
115
+ }
34
116
  }
35
117
  catch {
36
- // Missing branches are expected after partial cleanup or manual recovery.
118
+ // ignore fall through to a best-effort dir removal, then prune the admin entry
37
119
  }
38
- }
39
- function pruneWorktrees(gitRoot) {
40
120
  try {
41
- git(['worktree', 'prune'], gitRoot);
121
+ if (existsSync(worktreePath))
122
+ rmSync(worktreePath, { recursive: true, force: true });
42
123
  }
43
124
  catch {
44
- console.warn(`Warning: git worktree prune failed in ${gitRoot}`);
125
+ // ignore
45
126
  }
46
- }
47
- export class GitWorktreeManager {
48
- async create(stepId, baseDir) {
49
- const gitRoot = gitRootFromExistingPath(baseDir);
50
- const worktreePath = join(gitRoot, '.worktrees', stepId);
51
- await this.release(worktreePath);
52
- git(['worktree', 'add', '-b', branchName(stepId), worktreePath, 'HEAD'], gitRoot);
53
- const sourceNodeModules = join(gitRoot, 'node_modules');
54
- const targetNodeModules = join(worktreePath, 'node_modules');
55
- if (existsSync(sourceNodeModules)) {
56
- if (existsSync(targetNodeModules) || lstatSync(targetNodeModules, { throwIfNoEntry: false }) !== undefined) {
57
- rmSync(targetNodeModules, { recursive: true, force: true });
58
- }
59
- symlinkSync(sourceNodeModules, targetNodeModules, 'dir');
60
- }
61
- return worktreePath;
127
+ // Prune AFTER any manual removal so the `.git/worktrees/<id>` admin entry is cleaned in both the
128
+ // `git worktree remove` path and the manual-rm fallback path.
129
+ try {
130
+ execGit(['worktree', 'prune'], baseRepoCwd);
62
131
  }
63
- async release(worktreePath) {
64
- const gitRoot = gitRootFromWorktreePath(worktreePath);
65
- if (gitRoot === null)
66
- return;
67
- if (existsSync(worktreePath)) {
68
- try {
69
- git(['worktree', 'remove', '--force', worktreePath], gitRoot);
70
- }
71
- catch {
72
- console.warn(`Warning: git worktree remove failed for ${worktreePath}; deleting directory directly`);
73
- rmSync(worktreePath, { recursive: true, force: true });
74
- }
75
- }
76
- if (existsSync(worktreePath)) {
77
- console.warn(`Warning: worktree path still exists after git removal: ${worktreePath}; deleting directory directly`);
78
- rmSync(worktreePath, { recursive: true, force: true });
79
- }
80
- pruneWorktrees(gitRoot);
81
- deleteBranchIfPresent(gitRoot, stepIdFromWorktreePath(worktreePath));
132
+ catch {
133
+ // ignore prune is housekeeping only
134
+ }
135
+ try {
136
+ rmSync(worktreeMarkerFor(dataDir, runId), { force: true });
82
137
  }
138
+ catch {
139
+ // ignore
140
+ }
141
+ }
142
+ // The live marker is the signal that makes resolveRunCwd FAIL LOUD on a lost worktree. If it cannot be
143
+ // written we must NOT proceed silently (a later lost worktree would then fall back to the shared base
144
+ // checkout, masking the isolation failure) — throw so the create step fails and the run surfaces it.
145
+ function writeMarker(dataDir, runId) {
146
+ writeFileSync(worktreeMarkerFor(dataDir, runId), `${runId}\n`, 'utf8');
83
147
  }
84
148
  //# sourceMappingURL=git-worktree-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-worktree-manager.js","sourceRoot":"","sources":["../../src/worker/git-worktree-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzE,SAAS,GAAG,CAAC,IAAc,EAAE,GAAW;IACtC,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACxG,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,OAAO,MAAM,EAAE,CAAC;AACzB,CAAC;AAED,SAAS,sBAAsB,CAAC,YAAoB;IAClD,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAY;IAC3C,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,SA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,CAAC,CAAC;YAChE,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,CAAC,IAAI,CAAC,2CAA2C,YAAY,+BAA+B,CAAC,CAAC;gBACrG,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAED,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,0DAA0D,YAAY,+BAA+B,CAAC,CAAC;YACpH,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,cAAc,CAAC,OAAO,CAAC,CAAC;QACxB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC;IACvE,CAAC;CACF"}
1
+ {"version":3,"file":"git-worktree-manager.js","sourceRoot":"","sources":["../../src/worker/git-worktree-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,oGAAoG;AACpG,kFAAkF;AAClF,IAAI,WAA+B,CAAC;AACpC,SAAS,UAAU;IACjB,IAAI,WAAW,KAAK,SAAS;QAAE,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtE,OAAO,WAAW,CAAC;AACr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QACH,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;IACnF,CAAC;IACD,IAAI,CAAC;QACH,IAAI,UAAU,CAAC,YAAY,CAAC;YAAE,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvF,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;IACD,iGAAiG;IACjG,8DAA8D;IAC9D,IAAI,CAAC;QACH,OAAO,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;IACD,IAAI,CAAC;QACH,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;AACH,CAAC;AAED,uGAAuG;AACvG,sGAAsG;AACtG,qGAAqG;AACrG,SAAS,WAAW,CAAC,OAAe,EAAE,KAAa;IACjD,aAAa,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,EAAE,MAAM,CAAC,CAAC;AACzE,CAAC"}
@@ -29,10 +29,31 @@ export const spawnExecutor = (req) => new Promise((resolve, reject) => {
29
29
  let stderr = '';
30
30
  let timedOut = false;
31
31
  let settled = false;
32
+ if (child.pid !== undefined)
33
+ req.onSpawn?.(child.pid);
32
34
  child.stdout?.setEncoding('utf8');
33
35
  child.stderr?.setEncoding('utf8');
34
- child.stdout?.on('data', (chunk) => { stdout += chunk; });
35
- child.stderr?.on('data', (chunk) => { stderr += chunk; });
36
+ // Guard the sink callbacks: a throw here (e.g. a failed artifact write) would otherwise
37
+ // escape the stream 'data' handler as an uncaughtException and crash the worker. The
38
+ // in-memory capture above is unaffected, so the result envelope is still collected.
39
+ child.stdout?.on('data', (chunk) => {
40
+ stdout += chunk;
41
+ try {
42
+ req.onStdoutChunk?.(chunk);
43
+ }
44
+ catch (err) {
45
+ console.warn(`Warning: onStdoutChunk sink failed: ${String(err)}`);
46
+ }
47
+ });
48
+ child.stderr?.on('data', (chunk) => {
49
+ stderr += chunk;
50
+ try {
51
+ req.onStderrChunk?.(chunk);
52
+ }
53
+ catch (err) {
54
+ console.warn(`Warning: onStderrChunk sink failed: ${String(err)}`);
55
+ }
56
+ });
36
57
  const timer = setTimeout(() => {
37
58
  timedOut = true;
38
59
  killGroup(child);
@@ -1 +1 @@
1
- {"version":3,"file":"process-executor.js","sourceRoot":"","sources":["../../src/worker/process-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAwB9D,8FAA8F;AAC9F,kGAAkG;AAClG,gGAAgG;AAChG,SAAS,SAAS,CAAC,KAAmB;IACpC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACtB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAoB,CAAC,GAAG,EAAE,EAAE,CACpD,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC1C,MAAM,KAAK,GAAG,KAAK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,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3D,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;AACrB,CAAC,CAAC,CAAC"}
@@ -1,35 +1,68 @@
1
- // The EXACT contract between the agent and the runner. Two layers:
2
- // A. transport envelope `claude -p --output-format json` stdout (final text + cost/usage)
3
- // B. agent result envelope a sentineled REVO_RESULT block the agent emits inside that final text
4
- //
5
- // The instruction below is the SINGLE SOURCE OF TRUTH. The runner (claude-code-runner.ts) appends it
6
- // to EVERY prompt so the agent is always told how to emit; the parser here keys on the same markers.
7
- // It lives next to the parser — not in build-context.ts (the stub shares that), not in role prompts.
8
- export const REVO_RESULT_CONTRACT = `
9
- You MUST end your reply with a single result block in EXACTLY this form — the markers on their own lines,
10
- valid JSON between them, and NOTHING after the closing marker:
11
-
12
- <<<REVO_RESULT
13
- {
14
- "output": <any JSON a short human-readable summary or structured result>,
15
- "artifacts": <any JSON, optional — e.g. { "planPath": "docs/plans/00xx.md" }; omit if none>,
16
- "nextSteps": [
17
- { "role": "developer", "kind": "implement", "input": { "from": "<this step>" },
18
- "modelProfile"?: "standard", "taskId"?: "<defaults to the current step's task>",
19
- "priority"?: 0, "maxAttempts"?: 3, "dependsOn"?: [], "runAfter"?: "" }
20
- ],
21
- "needsHuman": false,
22
- "lesson": null
23
- }
24
- REVO_RESULT>>>
25
-
26
- If you have no follow-up work, return "nextSteps": []. If you are blocked and need a human, set
27
- "needsHuman": true and "nextSteps": []. Emit the block exactly once.
1
+ // The only supported agent result channel: the Claude CLI `--json-schema` constrains the final
2
+ // message and returns it as the transport `structured_output` field. The engine routes only on the
3
+ // top-level `verdict` from that structured object; prose output is never parsed for routing.
4
+ export const AGENT_RESULT_SCHEMA = JSON.stringify({
5
+ type: 'object',
6
+ additionalProperties: false,
7
+ properties: {
8
+ verdict: {
9
+ type: 'string',
10
+ minLength: 1,
11
+ description: 'the single routing token, lowercase, e.g. approved | changes_requested | blocker | clean | dirty',
12
+ },
13
+ output: { type: 'string', description: 'a short summary, or the artifact (e.g. the plan) the next step consumes' },
14
+ artifacts: { description: 'optional JSON artifacts, e.g. { "planPath": "docs/plans/00xx.md" }' },
15
+ nextSteps: {
16
+ type: 'array',
17
+ description: 'optional follow-up work items; use [] when there is no follow-up work',
18
+ items: { type: 'object' },
19
+ },
20
+ needsHuman: { type: 'boolean', description: 'true only if you are blocked and a human must intervene' },
21
+ lesson: { type: 'string', description: 'optional one-line note for a future attempt' },
22
+ },
23
+ required: ['verdict', 'output'],
24
+ });
25
+ /** Short prompt note paired with `--json-schema`; the CLI returns the result as `structured_output`. */
26
+ export const STRUCTURED_RESULT_NOTE = `
27
+ Return your final answer as JSON matching the provided output schema:
28
+ - "verdict": the single routing token for your role (lowercase; e.g. approved | changes_requested | blocker | clean | dirty).
29
+ - "output": a short summary, or — if you produce an artifact for a later step (e.g. an implementation plan) — that artifact.
30
+ - "nextSteps": [] unless you are explicitly creating legacy follow-up steps.
31
+ Set "needsHuman": true only if you are blocked and a human must intervene.
28
32
  `;
29
- // Markers the parser keys on must stay identical to those embedded in REVO_RESULT_CONTRACT.
30
- // The marker-sync unit test guards that invariant.
31
- const OPEN_MARKER = '<<<REVO_RESULT';
32
- const CLOSE_MARKER = 'REVO_RESULT>>>';
33
+ /** Build the AgentResult from the required structured_output object (the --json-schema path). */
34
+ export function agentResultFromStructured(structured) {
35
+ if (structured === undefined) {
36
+ throw new TypeError('agent structured result missing structured_output');
37
+ }
38
+ if (structured === null || typeof structured !== 'object' || Array.isArray(structured)) {
39
+ throw new TypeError('agent structured result must be an object');
40
+ }
41
+ const o = structured;
42
+ if (typeof o.verdict !== 'string' || o.verdict.trim().length === 0) {
43
+ throw new TypeError('agent structured result missing required top-level verdict');
44
+ }
45
+ if (typeof o.output !== 'string') {
46
+ throw new TypeError('agent structured result missing required string output');
47
+ }
48
+ if ('needsHuman' in o && typeof o.needsHuman !== 'boolean') {
49
+ throw new TypeError('agent structured result needsHuman must be a boolean when present');
50
+ }
51
+ if ('lesson' in o && o.lesson !== null && typeof o.lesson !== 'string') {
52
+ throw new TypeError('agent structured result lesson must be a string when present');
53
+ }
54
+ if ('nextSteps' in o && !Array.isArray(o.nextSteps)) {
55
+ throw new TypeError('agent structured result nextSteps must be an array when present');
56
+ }
57
+ return {
58
+ output: o.output,
59
+ verdict: o.verdict,
60
+ artifacts: o.artifacts,
61
+ nextSteps: Array.isArray(o.nextSteps) ? o.nextSteps : [],
62
+ needsHuman: o.needsHuman === true,
63
+ lesson: typeof o.lesson === 'string' ? o.lesson : undefined,
64
+ };
65
+ }
33
66
  function readNumber(value) {
34
67
  return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
35
68
  }
@@ -40,6 +73,9 @@ function readFinalText(obj) {
40
73
  return obj.text;
41
74
  return '';
42
75
  }
76
+ function readNonEmptyString(value) {
77
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
78
+ }
43
79
  // Layer A. Parse defensively; field names are read only inside this module, so a CLI drift is a
44
80
  // one-file change. Throws only when stdout is not parseable JSON.
45
81
  export function parseTransportEnvelope(stdout) {
@@ -60,38 +96,60 @@ export function parseTransportEnvelope(stdout) {
60
96
  return {
61
97
  text: readFinalText(obj),
62
98
  isError: Boolean(obj.is_error),
99
+ permissionDenials: obj.permission_denials,
100
+ terminalReason: readNonEmptyString(obj.terminal_reason),
101
+ sessionId: readNonEmptyString(obj.session_id),
63
102
  costUsd: readNumber(obj.total_cost_usd) ?? readNumber(obj.cost_usd),
64
103
  inputTokens: readNumber(usage?.input_tokens),
65
104
  outputTokens: readNumber(usage?.output_tokens),
105
+ structuredOutput: obj.structured_output,
66
106
  };
67
107
  }
68
- // Layer B. Extract the substring between the markers and JSON.parse it. Absent or unparseable →
69
- // the documented lesson-bearing error (the corrective is the contract the runner re-appends, not this).
70
- export function extractAgentResult(text) {
71
- const start = text.indexOf(OPEN_MARKER);
72
- const end = start === -1 ? -1 : text.indexOf(CLOSE_MARKER, start + OPEN_MARKER.length);
73
- if (start === -1 || end === -1) {
74
- throw new Error('agent did not emit a parseable REVO_RESULT envelope');
75
- }
76
- const jsonSlice = text.slice(start + OPEN_MARKER.length, end);
77
- let parsed;
108
+ /**
109
+ * Reduce the runner's stdout to the single terminal `result` JSON object, then hand it to
110
+ * parseTransportEnvelope. Handles BOTH shapes:
111
+ * - legacy `--output-format json` → the whole stdout is one `{...}` object;
112
+ * - `--output-format stream-json` → a JSONL stream (system/assistant/user/… lines) whose LAST
113
+ * line is `{"type":"result",...}`.
114
+ * Confirmed by experiment (2026-06-23): under stream-json the terminal result still carries
115
+ * `structured_output`, `usage`, and `total_cost_usd`, so verdict/cost extraction is unchanged.
116
+ * Throws when no result object is present (the runner maps that to a lesson-bearing failure).
117
+ */
118
+ export function extractTerminalResult(stdout) {
119
+ const trimmed = stdout.trim();
120
+ if (trimmed === '')
121
+ throw new Error('claude -p produced no output (no result envelope)');
122
+ // Legacy single-object form: the whole stdout parses as one object. Accept only a terminal
123
+ // result (`type` 'result' or absent — the legacy `--output-format json` blob is `type:'result'`);
124
+ // a lone non-result stream event (e.g. `{"type":"assistant",…}`) must fall through so the JSONL
125
+ // scan reports the clear "no result event" error rather than failing later on a missing result.
78
126
  try {
79
- parsed = JSON.parse(jsonSlice);
127
+ const whole = JSON.parse(trimmed);
128
+ if (whole !== null && typeof whole === 'object' && !Array.isArray(whole)) {
129
+ const type = whole.type;
130
+ if (type === undefined || type === 'result')
131
+ return trimmed;
132
+ }
80
133
  }
81
134
  catch {
82
- throw new Error('agent did not emit a parseable REVO_RESULT envelope');
135
+ // Not a single object fall through to the JSONL scan.
83
136
  }
84
- if (parsed === null || typeof parsed !== 'object') {
85
- throw new Error('agent did not emit a parseable REVO_RESULT envelope');
137
+ // stream-json: the terminal result is the LAST line with `"type":"result"`.
138
+ const lines = trimmed.split(/\r?\n/);
139
+ for (let i = lines.length - 1; i >= 0; i--) {
140
+ const line = lines[i].trim();
141
+ if (line === '')
142
+ continue;
143
+ try {
144
+ const obj = JSON.parse(line);
145
+ if (obj !== null && typeof obj === 'object' && obj.type === 'result')
146
+ return line;
147
+ }
148
+ catch {
149
+ // skip a partial/non-JSON line
150
+ }
86
151
  }
87
- const obj = parsed;
88
- return {
89
- output: obj.output,
90
- artifacts: obj.artifacts,
91
- nextSteps: Array.isArray(obj.nextSteps) ? obj.nextSteps : [],
92
- needsHuman: Boolean(obj.needsHuman),
93
- lesson: typeof obj.lesson === 'string' ? obj.lesson : undefined,
94
- };
152
+ throw new Error('claude -p stream contained no result event (transport envelope)');
95
153
  }
96
154
  // Map each raw nextSteps entry to NewStepSpec. Require role/kind/input; default taskId and
97
155
  // modelProfile from the current step so the agent never needs to know IDs. Throw a lesson-bearing
@@ -99,17 +157,17 @@ export function extractAgentResult(text) {
99
157
  export function normalizeNextSteps(raw, step) {
100
158
  return raw.map((entry, i) => {
101
159
  if (entry === null || typeof entry !== 'object') {
102
- throw new Error(`REVO_RESULT nextSteps[${i}] is not an object`);
160
+ throw new Error(`agent result nextSteps[${i}] is not an object`);
103
161
  }
104
162
  const e = entry;
105
163
  if (typeof e.role !== 'string' || e.role.length === 0) {
106
- throw new Error(`REVO_RESULT nextSteps[${i}] missing required "role"`);
164
+ throw new Error(`agent result nextSteps[${i}] missing required "role"`);
107
165
  }
108
166
  if (typeof e.kind !== 'string' || e.kind.length === 0) {
109
- throw new Error(`REVO_RESULT nextSteps[${i}] missing required "kind"`);
167
+ throw new Error(`agent result nextSteps[${i}] missing required "kind"`);
110
168
  }
111
169
  if (!('input' in e)) {
112
- throw new Error(`REVO_RESULT nextSteps[${i}] missing required "input"`);
170
+ throw new Error(`agent result nextSteps[${i}] missing required "input"`);
113
171
  }
114
172
  const spec = {
115
173
  taskId: typeof e.taskId === 'string' && e.taskId.length > 0 ? e.taskId : step.taskId,
@@ -1 +1 @@
1
- {"version":3,"file":"result-envelope.js","sourceRoot":"","sources":["../../src/worker/result-envelope.ts"],"names":[],"mappings":"AAGA,mEAAmE;AACnE,8FAA8F;A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