@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
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Host daemon runtime file (`host.json`) — the tracked identity of the long-lived Revo/NestJS
3
+ * host daemon, the single DBOS owner (ADR 0006). It lives beside the standalone `runtime.json`
4
+ * in the profile data dir but is a SEPARATE file: the standalone daemon and the host daemon have
5
+ * independent lifecycles, so conflating them would let one's stale pid mask the other's state.
6
+ *
7
+ * Shape is intentionally minimal — only what `ensureHost`/`status`/clients need: the pid to prove
8
+ * liveness, the GraphQL port that is the client transport, and the profile/startedAt for display
9
+ * and compare-and-delete identity. Standalone HTTP/pg ports stay in `runtime.json` (readRuntime).
10
+ */
11
+ import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
12
+ import { join } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+ import { getConfig, isAlive, profileDataDir, PROFILES } from '../config.js';
15
+ let cachedCodeVersion;
16
+ /**
17
+ * This build's package version (e.g. `0.1.0-alpha.7`). Recorded in host.json so `ensureHost`/`doctor`
18
+ * can detect a stale daemon running a DIFFERENT build than the current install (slice 139). A `0.0.0`
19
+ * dev checkout does not change across rebuilds, so dev relies on `revo restart`; released builds differ.
20
+ */
21
+ export function hostCodeVersion() {
22
+ if (cachedCodeVersion === undefined) {
23
+ try {
24
+ const pkgPath = fileURLToPath(new URL('../../package.json', import.meta.url));
25
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
26
+ cachedCodeVersion = typeof pkg.version === 'string' ? pkg.version : 'unknown';
27
+ }
28
+ catch {
29
+ cachedCodeVersion = 'unknown';
30
+ }
31
+ }
32
+ return cachedCodeVersion;
33
+ }
34
+ export function hostRuntimeFile() {
35
+ return join(getConfig().dataDir, 'host.json');
36
+ }
37
+ export function readHostRuntime() {
38
+ return readHostRuntimeAt(hostRuntimeFile());
39
+ }
40
+ /** Read+parse a host.json at an ARBITRARY path (a sibling profile's). Null when absent/corrupt. */
41
+ export function readHostRuntimeAt(file) {
42
+ if (!existsSync(file))
43
+ return null;
44
+ try {
45
+ return JSON.parse(readFileSync(file, 'utf8'));
46
+ }
47
+ catch {
48
+ return null;
49
+ }
50
+ }
51
+ /**
52
+ * Live tracked daemon pids across ALL profiles (slice 140 Phase 2). The rogue reaper must protect
53
+ * EVERY profile's daemon tree, not just the active one — else `revo stop --all --profile default`
54
+ * would SIGKILL a live `dev` daemon (and its bridges), aborting that profile's in-flight DBOS work.
55
+ * Band-default dirs only (a custom REVO_DATA_DIR layout isn't enumerable; documented in profileDataDir).
56
+ */
57
+ export function allTrackedHostPids() {
58
+ const pids = [];
59
+ for (const profile of Object.keys(PROFILES)) {
60
+ const runtime = readHostRuntimeAt(join(profileDataDir(profile), 'host.json'));
61
+ if (runtime && isAlive(runtime.pid))
62
+ pids.push(runtime.pid);
63
+ }
64
+ return pids;
65
+ }
66
+ export function writeHostRuntime(state) {
67
+ writeFileSync(hostRuntimeFile(), JSON.stringify(state, null, 2));
68
+ }
69
+ export function removeHostRuntime() {
70
+ const file = hostRuntimeFile();
71
+ if (existsSync(file))
72
+ rmSync(file);
73
+ }
74
+ /**
75
+ * Remove `host.json` ONLY if the file on disk still matches the snapshot (same pid AND startedAt).
76
+ * A replaced file (a concurrently-started daemon) or an already-removed file is a safe no-op — so
77
+ * cleanup can never delete a runtime that belongs to another daemon (compare-and-delete).
78
+ */
79
+ export function removeHostRuntimeIfMatches(snapshot) {
80
+ const current = readHostRuntime();
81
+ if (current?.pid === snapshot.pid && current?.startedAt === snapshot.startedAt) {
82
+ removeHostRuntime();
83
+ }
84
+ }
85
+ /** True when `host.json` records a daemon whose pid is still alive (liveness, not health). */
86
+ export function isHostRunning() {
87
+ const runtime = readHostRuntime();
88
+ return runtime !== null && isAlive(runtime.pid);
89
+ }
90
+ //# sourceMappingURL=host-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-runtime.js","sourceRoot":"","sources":["../../src/host/host-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAa9F,IAAI,iBAAqC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9E,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAA0B,CAAC;YAC/E,iBAAiB,GAAG,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAChF,CAAC;QAAC,MAAM,CAAC;YACP,iBAAiB,GAAG,SAAS,CAAC;QAChC,CAAC;IAC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CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAA6B;IACtE,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,IAAI,OAAO,EAAE,GAAG,KAAK,QAAQ,CAAC,GAAG,IAAI,OAAO,EAAE,SAAS,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;QAC/E,iBAAiB,EAAE,CAAC;IACtB,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC"}
@@ -7,6 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
10
13
  /**
11
14
  * HostLifecycle — OnApplicationBootstrap / OnApplicationShutdown.
12
15
  *
@@ -23,17 +26,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
23
26
  * the daemon is detached+unref'd and is a shared, long-lived process; subsequent
24
27
  * `revo dev:status <id>` invocations must find the same daemon + embedded Postgres.
25
28
  */
26
- import { Injectable } from '@nestjs/common';
29
+ import { Inject, Injectable, Optional } from '@nestjs/common';
27
30
  import { DbosService } from '../engine/dbos.service.js';
28
31
  import { ensureRevisium, readPostmasterPgPort } from './ensure-revisium.js';
29
32
  import { dbosSystemDatabaseUrl, ensurePostgres } from '../engine/ensure-postgres.js';
33
+ import { TaskControlPlaneApiService } from '../task-control-plane/task-control-plane-api.service.js';
30
34
  function isMcpStdioHost() {
31
35
  return process.env.REVO_MCP_STDIO === '1';
32
36
  }
37
+ function keepControlPlaneBootstrapDependency(_api) {
38
+ // The constructor dependency forces the control-plane provider graph to instantiate
39
+ // before DBOS.launch(); pipeline registration must precede launch.
40
+ }
33
41
  let HostLifecycle = class HostLifecycle {
34
42
  dbosService;
35
- constructor(dbosService) {
43
+ constructor(dbosService, taskControlPlaneApi) {
36
44
  this.dbosService = dbosService;
45
+ keepControlPlaneBootstrapDependency(taskControlPlaneApi);
37
46
  }
38
47
  async onApplicationBootstrap() {
39
48
  // Step 1: Ensure Revisium daemon is running (auto-start if absent).
@@ -69,7 +78,11 @@ let HostLifecycle = class HostLifecycle {
69
78
  };
70
79
  HostLifecycle = __decorate([
71
80
  Injectable(),
72
- __metadata("design:paramtypes", [DbosService])
81
+ __param(0, Inject(DbosService)),
82
+ __param(1, Optional()),
83
+ __param(1, Inject(TaskControlPlaneApiService)),
84
+ __metadata("design:paramtypes", [DbosService,
85
+ TaskControlPlaneApiService])
73
86
  ], HostLifecycle);
74
87
  export { HostLifecycle };
75
88
  //# sourceMappingURL=host.lifecycle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"host.lifecycle.js","sourceRoot":"","sources":["../../src/host/host.lifecycle.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAiD,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAErF,SAAS,cAAc;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC;AAC5C,CAAC;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;IACK;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEzD,K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QACD,2FAA2F;QAE3F,6CAA6C;QAC7C,MAAM,cAAc,CAAC,YAAY,CAAC,CAAC;QAEnC,qCAAqC;QACrC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,qBAAqB,CAAC,YAAY,CAAC,EAAE;YAC9D,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SAChD,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,qBAAqB;QACzB,gEAAgE;QAChE,qCAAqC;QACrC,6EAA6E;QAC7E,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAhDY,aAAa;IADzB,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,WAAW,CAAC,CAAA;IACnB,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,0BAA0B,CAAC,CAAA;qCAFgB,WAAW;QAGxC,0BAA0B;GALvC,aAAa,CAgDzB"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Daemon singleton gate (slice 139, hardened slice 140). Exactly ONE host daemon per profile may own —
3
+ * and therefore poll — the `dev-tasks` WorkflowQueue. Ownership is a connection-scoped Postgres
4
+ * ADVISORY LOCK:
5
+ *
6
+ * - Advisory locks are DATABASE-scoped, NOT cluster-global (PG: "Advisory locks are local to each
7
+ * database"). The gate works only because every contending daemon connects to the SAME fixed
8
+ * maintenance `postgres` database, so they all contend in one shared per-database lock namespace.
9
+ * We use `postgres` because it exists right after `ensureRevisium` — before the per-profile `dbos`
10
+ * database is created — letting the daemon decide "am I the owner?" BEFORE DBOS.launch() and before
11
+ * the queue worker starts polling. INVARIANT: all contenders MUST take this lock on the identical
12
+ * database. NEVER probe this lock key from another database (e.g. `dbos`) expecting a conflict — it
13
+ * would silently NOT conflict and could mint a second owner.
14
+ * - The key is a FULL 64-bit value derived from the lock name via md5 (`('x'||substr(md5(name),1,16))
15
+ * ::bit(64)::bigint`), not `hashtext(...)::bigint` — `hashtext` is only 32 bits, so distinct
16
+ * profile names could hash-collide and wrongly block a different profile's daemon. md5's 64 bits
17
+ * make a cross-profile collision negligible.
18
+ * - The lock is held on a DEDICATED, long-lived connection for the daemon's whole life. It
19
+ * auto-releases when that connection ends — on graceful shutdown OR on a hard crash — so a dead
20
+ * owner never blocks a successor. (Verified by experiment: a second connection's
21
+ * `pg_try_advisory_lock` returns false while held, and true again once the holder disconnects.)
22
+ *
23
+ * A daemon that does NOT win the lock lost a concurrent cold-start race (e.g. several `revo mcp`
24
+ * bridges spawning at once) and exits; ensureHost then attaches to the winner via host.json. This
25
+ * closes the "concurrent cold-start spawns multiple daemons" hole that let stale daemons accumulate.
26
+ * It does NOT, however, coordinate LEGACY hosts that predate the lock — those are detected by the
27
+ * `pg_stat_activity` census (queue-poller-census.ts) and evicted by `revo doctor`/`stop` (slice 140).
28
+ */
29
+ import pg from 'pg';
30
+ /**
31
+ * SQL expression that turns the text lock name (bound as `$1`) into a full 64-bit advisory-lock key.
32
+ * `md5` yields 128 bits of hex; the first 16 hex chars are reinterpreted as a signed bigint. Shared by
33
+ * lock + unlock so they always target the identical key.
34
+ */
35
+ const LOCK_KEY_EXPR = `('x' || substr(md5($1), 1, 16))::bit(64)::bigint`;
36
+ /** Stable advisory-lock identity for a profile's dev-tasks queue ownership. */
37
+ export function ownershipLockName(profile) {
38
+ return `revo:dev-tasks:${profile}`;
39
+ }
40
+ /**
41
+ * Try to become the sole dev-tasks owner for `profile`. Returns `{owned:false}` (and closes its probe
42
+ * connection) when another live daemon already holds it. When `{owned:true}`, the returned connection
43
+ * stays open holding the lock until `release()` (or process death) frees it.
44
+ */
45
+ export async function acquireQueueOwnership(profile, pgPort, deps = {}) {
46
+ const url = `postgresql://revisium:password@localhost:${pgPort}/postgres`;
47
+ const name = ownershipLockName(profile);
48
+ const createClient = deps.createClient ?? ((u) => new pg.Client(u));
49
+ const client = createClient(url);
50
+ await client.connect();
51
+ const res = await client.query(`SELECT pg_try_advisory_lock(${LOCK_KEY_EXPR}) AS owned`, [name]);
52
+ const owned = res.rows[0]?.owned === true;
53
+ if (!owned) {
54
+ await client.end().catch(() => undefined);
55
+ return { owned: false, release: async () => undefined };
56
+ }
57
+ // Keep `client` reachable (via this closure) so its socket — and the lock — is held for the daemon's
58
+ // life. The OS frees the connection (and thus the lock) on crash; release() does it gracefully.
59
+ const release = async () => {
60
+ try {
61
+ await client.query(`SELECT pg_advisory_unlock(${LOCK_KEY_EXPR})`, [name]);
62
+ }
63
+ catch {
64
+ // best-effort; ending the connection releases the lock regardless
65
+ }
66
+ await client.end().catch(() => undefined);
67
+ };
68
+ return { owned: true, release };
69
+ }
70
+ //# sourceMappingURL=queue-ownership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-ownership.js","sourceRoot":"","sources":["../../src/host/queue-ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB;;;;GAIG;AACH,MAAM,aAAa,GAAG,kDAAkD,CAAC;AAqBzE,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,kBAAkB,OAAO,EAAE,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAe,EACf,MAAc,EACd,OAA6B,EAAE;IAE/B,MAAM,GAAG,GAAG,4CAA4C,MAAM,WAAW,CAAC;IAC1E,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAA+B,CAAC,CAAC;IAC1G,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IAEvB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,+BAA+B,aAAa,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAE1C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;IAC1D,CAAC;IAED,qGAAqG;IACrG,gGAAgG;IAChG,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,CAAC,6BAA6B,aAAa,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,kEAAkE;QACpE,CAAC;QACD,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Queue-poller census (slice 140, Part A Layer 3 — detection half, pure).
3
+ *
4
+ * The advisory lock (queue-ownership.ts) only coordinates daemons that CALL it. A legacy/old-version
5
+ * host that predates the lock — or a `revo mcp` from before the thin-bridge era that is itself a full
6
+ * DBOS host — still connects to the `dbos` database and polls the `dev-tasks` queue, ignoring the lock.
7
+ * It has no inbound listening port, so the port-based `revo stop`/`doctor` cannot see it. The ONE
8
+ * control plane shared with code we do not control is the database itself: every DBOS system-DB
9
+ * connection is stamped `application_name = dbos_transact_<executorID>_<appVersion>` (visible in
10
+ * `pg_stat_activity`). A connection whose executor id is NOT this profile's pinned owner is a rogue.
11
+ *
12
+ * This module is the pure classifier (unit-tested); the live `pg_stat_activity` query lives in the IO
13
+ * layer (lifecycle.ts). Classification keys on the executor-id segment ONLY: `application_name` is
14
+ * capped at 63 bytes by Postgres, so a long suffix can truncate the appVersion — we therefore never
15
+ * trust the parsed version for identity (the owner's true version comes from host.json elsewhere).
16
+ */
17
+ const STAMP_PREFIX = 'dbos_transact_';
18
+ /**
19
+ * Parse the executor id out of `dbos_transact_<executorID>_<appVersion>` — the segment between the
20
+ * fixed prefix and the LAST underscore (the appVersion separator). Returns null when the string is not
21
+ * a DBOS stamp. Robust to a truncated/empty appVersion segment (we only need the executor id); pinned
22
+ * revo executor ids (`revo-<profile>`) and `local` contain no underscore, so the last-underscore split
23
+ * is unambiguous for the identities we classify.
24
+ */
25
+ export function parseExecutorId(applicationName) {
26
+ if (!applicationName.startsWith(STAMP_PREFIX))
27
+ return null;
28
+ const rest = applicationName.slice(STAMP_PREFIX.length); // <executorID>_<appVersion>
29
+ const sep = rest.lastIndexOf('_');
30
+ const executorId = sep < 0 ? rest : rest.slice(0, sep);
31
+ return executorId.length > 0 ? executorId : null;
32
+ }
33
+ /**
34
+ * Foreign DBOS pollers among `backends` — any connection whose parsed executor id differs from the
35
+ * profile's pinned owner. Report-only data; the caller decides how to surface or evict it.
36
+ */
37
+ export function classifyQueuePollerRogues(backends, ownerExecutorId) {
38
+ const rogues = [];
39
+ for (const b of backends) {
40
+ const executorId = parseExecutorId(b.applicationName);
41
+ if (executorId === null || executorId === ownerExecutorId)
42
+ continue;
43
+ rogues.push({ pid: b.pid, executorId, applicationName: b.applicationName, backendStart: b.backendStart });
44
+ }
45
+ return rogues;
46
+ }
47
+ //# sourceMappingURL=queue-poller-census.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-poller-census.js","sourceRoot":"","sources":["../../src/host/queue-poller-census.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAmBtC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,eAAuB;IACrD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;IACrF,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAsC,EACtC,eAAuB;IAEvB,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QACtD,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,eAAe;YAAE,SAAS;QACpE,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { ValidationPipe } from '@nestjs/common';
2
+ import { NestFactory } from '@nestjs/core';
3
+ import { addWsServer } from '../api/graphql-api/graphql-ws/ws.js';
4
+ import { isPortFree, resolveDefaultGraphqlPort } from '../config.js';
5
+ import { GraphqlHostModule } from './graphql-host.module.js';
6
+ export const DEFAULT_GRAPHQL_HOST = '127.0.0.1';
7
+ const defaultDeps = {
8
+ isPortFree,
9
+ };
10
+ function parsePort(raw) {
11
+ if (!raw)
12
+ return resolveDefaultGraphqlPort();
13
+ const candidate = raw.trim();
14
+ if (!/^\d+$/.test(candidate)) {
15
+ throw new TypeError(`Invalid GraphQL port: ${raw}`);
16
+ }
17
+ const port = Number(candidate);
18
+ if (!Number.isInteger(port) || port <= 0 || port > 65_535) {
19
+ throw new TypeError(`Invalid GraphQL port: ${raw}`);
20
+ }
21
+ return port;
22
+ }
23
+ export function resolveGraphqlHostOptions(options = {}) {
24
+ const host = options.host ?? process.env.REVO_GRAPHQL_HOST ?? DEFAULT_GRAPHQL_HOST;
25
+ if (host !== DEFAULT_GRAPHQL_HOST) {
26
+ throw new TypeError(`GraphQL host must bind ${DEFAULT_GRAPHQL_HOST} in v1; received ${host}`);
27
+ }
28
+ return {
29
+ host,
30
+ port: options.port ?? parsePort(process.env.REVO_GRAPHQL_PORT),
31
+ };
32
+ }
33
+ export async function startGraphqlHost(options = {}, deps = defaultDeps) {
34
+ const resolved = resolveGraphqlHostOptions(options);
35
+ if (resolved.host !== DEFAULT_GRAPHQL_HOST) {
36
+ throw new Error(`GraphQL host must bind ${DEFAULT_GRAPHQL_HOST} in v1; received ${resolved.host}`);
37
+ }
38
+ if (!(await deps.isPortFree(resolved.port))) {
39
+ throw new Error(`GraphQL port ${resolved.port} is already in use; set REVO_GRAPHQL_PORT or --port to a free isolated port.`);
40
+ }
41
+ const app = await NestFactory.create(GraphqlHostModule, { logger: ['error', 'warn'] });
42
+ app.useGlobalPipes(new ValidationPipe({ transform: true }));
43
+ await app.listen(resolved.port, resolved.host);
44
+ const ws = addWsServer(app);
45
+ const close = app.close.bind(app);
46
+ app.close = async () => {
47
+ await ws.dispose();
48
+ await close();
49
+ };
50
+ return {
51
+ app,
52
+ ...resolved,
53
+ url: `http://${resolved.host}:${resolved.port}/graphql`,
54
+ };
55
+ }
56
+ //# sourceMappingURL=graphql-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-host.js","sourceRoot":"","sources":["../../src/http/graphql-host.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAkBhD,MAAM,WAAW,GAAoB;IACnC,UAAU;CACX,CAAC;AAEF,SAAS,SAAS,CAAC,GAAuB;IACxC,IAAI,CAAC,GAAG;QAAE,OAAO,yBAAyB,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC;QAC1D,MAAM,IAAI,SAAS,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,UAA8B,EAAE;IACxE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI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CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,GAAG,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;QACrB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,KAAK,EAAE,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG;QACH,GAAG,QAAQ;QACX,GAAG,EAAE,UAAU,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,UAAU;KACxD,CAAC;AACJ,CAAC"}
@@ -5,17 +5,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { Module } from '@nestjs/common';
8
+ import { GraphqlApiModule } from '../api/graphql-api/graphql-api.module.js';
9
+ import { HostLifecycle } from '../host/host.lifecycle.js';
8
10
  import { TaskControlPlaneModule } from '../task-control-plane/task-control-plane.module.js';
9
- import { McpFacadeService } from './mcp-facade.service.js';
10
- import { McpStdioService } from './mcp-stdio.service.js';
11
- let McpModule = class McpModule {
11
+ // The daemon serves BOTH front doors (ADR 0006): GraphQL (frontend) + MCP (agents), over one host
12
+ // process that is the single DBOS owner. The MCP server is built directly from TaskControlPlaneApi-
13
+ // Service (see daemon.ts) — no separate McpModule in the graph.
14
+ let GraphqlHostModule = class GraphqlHostModule {
12
15
  };
13
- McpModule = __decorate([
16
+ GraphqlHostModule = __decorate([
14
17
  Module({
15
- imports: [TaskControlPlaneModule],
16
- providers: [McpFacadeService, McpStdioService],
17
- exports: [McpFacadeService, McpStdioService],
18
+ imports: [TaskControlPlaneModule, GraphqlApiModule],
19
+ providers: [HostLifecycle],
18
20
  })
19
- ], McpModule);
20
- export { McpModule };
21
- //# sourceMappingURL=mcp.module.js.map
21
+ ], GraphqlHostModule);
22
+ export { GraphqlHostModule };
23
+ //# sourceMappingURL=graphql-host.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-host.module.js","sourceRoot":"","sources":["../../src/http/graphql-host.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,kGAAkG;AAClG,oGAAoG;AACpG,gEAAgE;AAKzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,iBAAiB;IAJ7B,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;QACnD,SAAS,EAAE,CAAC,aAAa,CAAC;KAC3B,CAAC;GACW,iBAAiB,CAAG"}
@@ -0,0 +1,91 @@
1
+ import { getOperationAST, parse } from 'graphql';
2
+ const ANONYMOUS_OPERATION = 'anonymous';
3
+ const OVERFLOW_OPERATION_LABEL = { operationName: 'other', operationType: 'unknown' };
4
+ export const MAX_GRAPHQL_OPERATION_LABELS = 256;
5
+ function key(label) {
6
+ return `${label.operationType}:${label.operationName}`;
7
+ }
8
+ function isExecutionResult(value) {
9
+ return typeof value === 'object' && value !== null && ('data' in value || 'errors' in value);
10
+ }
11
+ function resultHasErrors(result) {
12
+ return isExecutionResult(result) && Array.isArray(result.errors) && result.errors.length > 0;
13
+ }
14
+ export function identifyGraphqlOperation(params) {
15
+ const query = params.query;
16
+ if (!query) {
17
+ return { operationName: params.operationName ?? ANONYMOUS_OPERATION, operationType: 'unknown' };
18
+ }
19
+ try {
20
+ const document = parse(query);
21
+ const operation = getOperationAST(document, params.operationName);
22
+ return {
23
+ operationName: params.operationName ?? operation?.name?.value ?? ANONYMOUS_OPERATION,
24
+ operationType: operation?.operation ?? 'unknown',
25
+ };
26
+ }
27
+ catch {
28
+ return { operationName: params.operationName ?? ANONYMOUS_OPERATION, operationType: 'unknown' };
29
+ }
30
+ }
31
+ export class GraphqlOperationMetrics {
32
+ records = new Map();
33
+ record(input) {
34
+ let label = { operationName: input.operationName, operationType: input.operationType };
35
+ const labelKey = key(label);
36
+ const overflowKey = key(OVERFLOW_OPERATION_LABEL);
37
+ const leavesRoomForOverflow = this.records.size < MAX_GRAPHQL_OPERATION_LABELS - (this.records.has(overflowKey) ? 0 : 1);
38
+ if (!this.records.has(labelKey) && !leavesRoomForOverflow) {
39
+ label = OVERFLOW_OPERATION_LABEL;
40
+ }
41
+ const current = this.records.get(key(label)) ?? {
42
+ ...label,
43
+ count: 0,
44
+ errorCount: 0,
45
+ totalDurationMs: 0,
46
+ maxDurationMs: 0,
47
+ };
48
+ current.count += 1;
49
+ current.errorCount += input.errored ? 1 : 0;
50
+ current.totalDurationMs += input.durationMs;
51
+ current.maxDurationMs = Math.max(current.maxDurationMs, input.durationMs);
52
+ this.records.set(key(label), current);
53
+ }
54
+ snapshot() {
55
+ return [...this.records.values()]
56
+ .map((record) => ({ ...record }))
57
+ .sort((a, b) => `${a.operationType}:${a.operationName}`.localeCompare(`${b.operationType}:${b.operationName}`));
58
+ }
59
+ reset() {
60
+ this.records.clear();
61
+ }
62
+ }
63
+ export const graphqlOperationMetrics = new GraphqlOperationMetrics();
64
+ export function createGraphqlMetricsPlugin(metrics = graphqlOperationMetrics, now = () => performance.now()) {
65
+ return {
66
+ onParams({ params, paramsHandler, setParamsHandler }) {
67
+ const operation = identifyGraphqlOperation(params);
68
+ setParamsHandler(async (payload) => {
69
+ const startedAt = now();
70
+ try {
71
+ const result = await paramsHandler(payload);
72
+ metrics.record({
73
+ ...operation,
74
+ durationMs: Math.max(0, now() - startedAt),
75
+ errored: resultHasErrors(result),
76
+ });
77
+ return result;
78
+ }
79
+ catch (error) {
80
+ metrics.record({
81
+ ...operation,
82
+ durationMs: Math.max(0, now() - startedAt),
83
+ errored: true,
84
+ });
85
+ throw error;
86
+ }
87
+ });
88
+ },
89
+ };
90
+ }
91
+ //# sourceMappingURL=graphql-met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oBACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;oBAC5C,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,SAAS;wBACZ,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;wBAC1C,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC;qBACjC,CAAC,CAAC;oBACH,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,SAAS;wBACZ,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;wBAC1C,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC;oBACH,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -13,7 +13,15 @@ export const MCP_TOOL_NAMES = [
13
13
  'get_run',
14
14
  'get_run_events',
15
15
  'get_run_log',
16
+ 'get_agent_activity',
17
+ 'get_agent_attempts',
18
+ 'get_agent_log',
19
+ 'tail_agent_log',
20
+ 'read_agent_output_events',
16
21
  'get_run_digest',
22
+ 'wait_for_run',
23
+ 'wait_for_any_gate',
24
+ 'watch_runs',
17
25
  'list_inbox',
18
26
  'get_inbox_item',
19
27
  'get_pending_decisions',
@@ -36,7 +44,7 @@ export const MCP_INSTRUCTIONS = `Revo is a local-first software-development task
36
44
 
37
45
  Use these tools to manage tasks end-to-end from your coding agent:
38
46
  - create and start runs;
39
- - inspect run status, events, attempts, and digests;
47
+ - inspect run status, events, attempts, agent activity, bounded logs, and digests;
40
48
  - resolve human inbox gates and questions;
41
49
  - inspect installed playbooks, roles, and pipelines;
42
50
  - inspect PR readiness and actionable review feedback before resuming work;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-capabilities.js","sourceRoot":"","sources":["../../src/mcp/mcp-capabilities.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY;IACZ,QAAQ;IACR,kBAAkB;IAClB,qBAAqB;IACrB,wBAAwB;IACxB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,uBAAuB;IACvB,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;qDAWqB,CAAC"}
1
+ {"version":3,"file":"mcp-capabilities.js","sourceRoot":"","sources":["../../src/mcp/mcp-capabilities.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY;IACZ,QAAQ;IACR,kBAAkB;IAClB,qBAAqB;IACrB,wBAAwB;IACxB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,0BAA0B;IAC1B,gBAAgB;IAChB,cAAc;IACd,mBAAmB;IACnB,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,uBAAuB;IACvB,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;qDAWqB,CAAC"}
@@ -9,22 +9,52 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { Injectable } from '@nestjs/common';
11
11
  import { TaskControlPlaneApiService, } from '../task-control-plane/task-control-plane-api.service.js';
12
+ import { ControlPlaneError } from '../control-plane/errors.js';
13
+ import { AgentObservabilityError } from '../observability/types.js';
14
+ import { CreateRunWorkflowError } from '../run/create-run.js';
15
+ import { RunWatchService } from '../task-control-plane/run-watch.service.js';
12
16
  import { MCP_TOOL_NAMES } from './mcp-capabilities.js';
17
+ function formatCause(error) {
18
+ if (error instanceof ControlPlaneError) {
19
+ const status = error.status === undefined ? '' : ` status=${error.status}`;
20
+ return `${error.code}${status}: ${error.message}`;
21
+ }
22
+ if (error instanceof Error)
23
+ return error.message;
24
+ return String(error);
25
+ }
26
+ function exposeApplicationError(promise) {
27
+ return promise.catch((error) => {
28
+ if (error instanceof AgentObservabilityError) {
29
+ throw new Error(`${error.code}: ${error.message}`);
30
+ }
31
+ throw error;
32
+ });
33
+ }
13
34
  let McpFacadeService = class McpFacadeService {
14
35
  api;
15
- constructor(api) {
36
+ /**
37
+ * `runWatch` is injected by the daemon with a pubSub-backed instance (slice 141 D2, option A). When
38
+ * absent (e2e/stdio/tests construct the facade with only the api), we lazily build a poll-fallback
39
+ * watch (option B) — equivalent correctness, slightly higher latency.
40
+ */
41
+ runWatchInstance;
42
+ constructor(api, runWatch) {
16
43
  this.api = api;
44
+ this.runWatchInstance = runWatch;
45
+ }
46
+ get runWatch() {
47
+ return (this.runWatchInstance ??= new RunWatchService(this.api));
17
48
  }
18
49
  getCapabilities() {
19
50
  return {
20
51
  transport: 'stdio',
21
52
  auth: 'none',
22
53
  tools: [...MCP_TOOL_NAMES],
23
- runnerModes: ['script', 'live'],
24
54
  notes: [
25
55
  'Local stdio MCP server; no remote HTTP listener.',
26
56
  'Tools expose product operations, not generic Revisium row CRUD.',
27
- 'Live runs use the real Claude runner and git/GitHub integrator.',
57
+ 'Runs are driven by installed playbooks, pipeline catalogs, and execution profiles.',
28
58
  ],
29
59
  };
30
60
  }
@@ -44,7 +74,15 @@ let McpFacadeService = class McpFacadeService {
44
74
  return this.api.getRepositoryContext(input);
45
75
  }
46
76
  createRun(input) {
47
- return this.api.createRun(input);
77
+ return this.api.createRun(input).catch((error) => {
78
+ if (error instanceof CreateRunWorkflowError) {
79
+ const created = Object.keys(error.createdIds).length > 0
80
+ ? `; createdBeforeFailure=${JSON.stringify(error.createdIds)}`
81
+ : '';
82
+ throw new Error(`${error.message}: ${formatCause(error.cause)}${created}`);
83
+ }
84
+ throw error;
85
+ });
48
86
  }
49
87
  startRun(input) {
50
88
  return this.api.startRun(input);
@@ -67,9 +105,33 @@ let McpFacadeService = class McpFacadeService {
67
105
  getRunLog(input) {
68
106
  return this.api.getRunLog(input);
69
107
  }
108
+ getAgentActivity(runId) {
109
+ return exposeApplicationError(this.api.getAgentActivity(runId));
110
+ }
111
+ getAgentAttempts(runId) {
112
+ return exposeApplicationError(this.api.getAgentAttempts(runId));
113
+ }
114
+ getAgentLog(input) {
115
+ return exposeApplicationError(this.api.getAgentLog(input));
116
+ }
117
+ tailAgentLog(input) {
118
+ return exposeApplicationError(this.api.readAgentOutputEvents(input));
119
+ }
120
+ readAgentOutputEvents(input) {
121
+ return exposeApplicationError(this.api.readAgentOutputEvents(input));
122
+ }
70
123
  getRunDigest(runId) {
71
124
  return this.api.getRunDigest(runId);
72
125
  }
126
+ waitForRun(input) {
127
+ return this.api.waitForRun(input);
128
+ }
129
+ waitForAnyGate(input) {
130
+ return this.runWatch.waitForAnyGate(input);
131
+ }
132
+ watchRuns(input) {
133
+ return this.runWatch.watchRuns(input);
134
+ }
73
135
  listInbox(filter) {
74
136
  return this.api.listInbox(filter);
75
137
  }
@@ -124,7 +186,8 @@ let McpFacadeService = class McpFacadeService {
124
186
  };
125
187
  McpFacadeService = __decorate([
126
188
  Injectable(),
127
- __metadata("design:paramtypes", [TaskControlPlaneApiService])
189
+ __metadata("design:paramtypes", [TaskControlPlaneApiService,
190
+ RunWatchService])
128
191
  ], McpFacadeService);
129
192
  export { McpFacadeService };
130
193
  //# sourceMappingURL=mcp-facade.service.js.map