@vercel/factory 0.0.13 → 0.0.15

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 (458) hide show
  1. package/README.md +307 -1
  2. package/dist/agent-routes.d.mts +69 -0
  3. package/dist/agent-routes.mjs +64 -0
  4. package/dist/agent-routes.mjs.map +1 -0
  5. package/dist/api-contracts.d.mts +1749 -0
  6. package/dist/api-contracts.mjs +118 -0
  7. package/dist/api-contracts.mjs.map +1 -0
  8. package/dist/api-images.d.mts +30 -0
  9. package/dist/api-images.mjs +28 -0
  10. package/dist/api-images.mjs.map +1 -0
  11. package/dist/api-task-graph.mjs +57 -0
  12. package/dist/api-task-graph.mjs.map +1 -0
  13. package/dist/api.d.mts +77 -0
  14. package/dist/api.mjs +1087 -0
  15. package/dist/api.mjs.map +1 -0
  16. package/dist/approval-access.d.mts +39 -0
  17. package/dist/approval-access.mjs +62 -0
  18. package/dist/approval-access.mjs.map +1 -0
  19. package/dist/approval-contracts.d.mts +692 -0
  20. package/dist/approval-contracts.mjs +27 -0
  21. package/dist/approval-contracts.mjs.map +1 -0
  22. package/dist/approval.d.mts +49 -0
  23. package/dist/approval.mjs +39 -0
  24. package/dist/approval.mjs.map +1 -0
  25. package/dist/blob/artifacts.d.mts +37 -0
  26. package/dist/blob/artifacts.mjs +45 -0
  27. package/dist/blob/artifacts.mjs.map +1 -0
  28. package/dist/blob/index.d.mts +44 -8
  29. package/dist/blob/index.mjs +159 -35
  30. package/dist/blob/index.mjs.map +1 -1
  31. package/dist/budget.d.mts +108 -0
  32. package/dist/budget.mjs +141 -0
  33. package/dist/budget.mjs.map +1 -0
  34. package/dist/budgets.d.mts +4 -0
  35. package/dist/budgets.mjs +4 -0
  36. package/dist/build-factory.d.mts +6 -4
  37. package/dist/build-factory.mjs +2 -1
  38. package/dist/build-factory.mjs.map +1 -1
  39. package/dist/change-verification/brief.d.mts +9 -0
  40. package/dist/change-verification/brief.mjs +13 -0
  41. package/dist/change-verification/brief.mjs.map +1 -0
  42. package/dist/change-verification/dispatch.d.mts +24 -0
  43. package/dist/change-verification/dispatch.mjs +45 -0
  44. package/dist/change-verification/dispatch.mjs.map +1 -0
  45. package/dist/change-verification/eve-tool.d.mts +60 -0
  46. package/dist/change-verification/eve-tool.mjs +101 -0
  47. package/dist/change-verification/eve-tool.mjs.map +1 -0
  48. package/dist/changes/eve-record-change.d.mts +56 -0
  49. package/dist/changes/eve-record-change.mjs +97 -0
  50. package/dist/changes/eve-record-change.mjs.map +1 -0
  51. package/dist/changes/presentation.d.mts +14 -0
  52. package/dist/changes.d.mts +23 -0
  53. package/dist/changes.mjs +29 -0
  54. package/dist/changes.mjs.map +1 -0
  55. package/dist/client-events.d.mts +18 -0
  56. package/dist/client-events.mjs +41 -0
  57. package/dist/client-events.mjs.map +1 -0
  58. package/dist/client-stream.d.mts +28 -0
  59. package/dist/client-stream.mjs +204 -0
  60. package/dist/client-stream.mjs.map +1 -0
  61. package/dist/client-transcript.d.mts +41 -0
  62. package/dist/client-transcript.mjs +229 -0
  63. package/dist/client-transcript.mjs.map +1 -0
  64. package/dist/client.d.mts +234 -0
  65. package/dist/client.mjs +258 -0
  66. package/dist/client.mjs.map +1 -0
  67. package/dist/code-review/contracts.d.mts +26 -0
  68. package/dist/code-review/eve-post-review.d.mts +70 -0
  69. package/dist/code-review/eve-post-review.mjs +183 -0
  70. package/dist/code-review/eve-post-review.mjs.map +1 -0
  71. package/dist/code-review/eve-review-comments.d.mts +64 -0
  72. package/dist/code-review/eve-review-comments.mjs +159 -0
  73. package/dist/code-review/eve-review-comments.mjs.map +1 -0
  74. package/dist/code-review/github-contracts.d.mts +10 -0
  75. package/dist/code-review/github-reporter.d.mts +44 -0
  76. package/dist/code-review/github-reporter.mjs +260 -0
  77. package/dist/code-review/github-reporter.mjs.map +1 -0
  78. package/dist/code-review/preparation.d.mts +34 -0
  79. package/dist/code-review/preparation.mjs +23 -0
  80. package/dist/code-review/preparation.mjs.map +1 -0
  81. package/dist/code-review/stall.d.mts +17 -0
  82. package/dist/code-review/stall.mjs +30 -0
  83. package/dist/code-review/stall.mjs.map +1 -0
  84. package/dist/code-review.d.mts +6 -0
  85. package/dist/code-review.mjs +5 -0
  86. package/dist/communication.d.mts +9 -0
  87. package/dist/communication.mjs +9 -0
  88. package/dist/connectors/github.d.mts +26 -0
  89. package/dist/connectors/github.mjs +55 -0
  90. package/dist/connectors/github.mjs.map +1 -0
  91. package/dist/connectors/index.d.mts +35 -2
  92. package/dist/connectors/index.mjs +4 -26
  93. package/dist/connectors/index.mjs.map +1 -1
  94. package/dist/connectors/outbox.d.mts +34 -0
  95. package/dist/connectors/outbox.mjs +50 -0
  96. package/dist/connectors/outbox.mjs.map +1 -0
  97. package/dist/connectors/slack-approval-blocks.mjs +136 -0
  98. package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
  99. package/dist/connectors/slack-approvals.d.mts +29 -0
  100. package/dist/connectors/slack-approvals.mjs +346 -0
  101. package/dist/connectors/slack-approvals.mjs.map +1 -0
  102. package/dist/connectors/slack.d.mts +35 -41
  103. package/dist/connectors/slack.mjs +13 -69
  104. package/dist/connectors/slack.mjs.map +1 -1
  105. package/dist/deepsec/eve-tool.d.mts +110 -0
  106. package/dist/deepsec/eve-tool.mjs +164 -0
  107. package/dist/deepsec/eve-tool.mjs.map +1 -0
  108. package/dist/deepsec/finding.d.mts +84 -0
  109. package/dist/deepsec/finding.mjs +56 -0
  110. package/dist/deepsec/finding.mjs.map +1 -0
  111. package/dist/deepsec.d.mts +3 -0
  112. package/dist/delivery-metrics/metrics.d.mts +93 -0
  113. package/dist/delivery-metrics/metrics.mjs +200 -0
  114. package/dist/delivery-metrics/metrics.mjs.map +1 -0
  115. package/dist/delivery-metrics.d.mts +2 -0
  116. package/dist/delivery-metrics.mjs +2 -0
  117. package/dist/dispatch.d.mts +81 -0
  118. package/dist/dispatch.mjs +140 -0
  119. package/dist/dispatch.mjs.map +1 -0
  120. package/dist/errors.d.mts +15 -0
  121. package/dist/errors.mjs +38 -0
  122. package/dist/errors.mjs.map +1 -0
  123. package/dist/eve/index.d.mts +143 -1561
  124. package/dist/eve/index.mjs +244 -1063
  125. package/dist/eve/index.mjs.map +1 -1
  126. package/dist/eve/invoke.d.mts +144 -0
  127. package/dist/eve/invoke.mjs +241 -0
  128. package/dist/eve/invoke.mjs.map +1 -0
  129. package/dist/eve/session-client.d.mts +68 -0
  130. package/dist/eve/session-client.mjs +131 -0
  131. package/dist/eve/session-client.mjs.map +1 -0
  132. package/dist/eve/task-execution.mjs +18 -0
  133. package/dist/eve/task-execution.mjs.map +1 -0
  134. package/dist/eve/task-session.d.mts +87 -0
  135. package/dist/eve/task-session.mjs +203 -0
  136. package/dist/eve/task-session.mjs.map +1 -0
  137. package/dist/eve/transcript.d.mts +37 -0
  138. package/dist/eve/transcript.mjs +65 -0
  139. package/dist/eve/transcript.mjs.map +1 -0
  140. package/dist/execution-public.d.mts +8 -0
  141. package/dist/execution-public.mjs +7 -0
  142. package/dist/execution.d.mts +75 -0
  143. package/dist/execution.mjs +153 -0
  144. package/dist/execution.mjs.map +1 -0
  145. package/dist/finding-remediation/admission.d.mts +51 -0
  146. package/dist/finding-remediation/admission.mjs +87 -0
  147. package/dist/finding-remediation/admission.mjs.map +1 -0
  148. package/dist/finding-remediation/brief.d.mts +14 -0
  149. package/dist/finding-remediation/brief.mjs +25 -0
  150. package/dist/finding-remediation/brief.mjs.map +1 -0
  151. package/dist/finding-remediation/eve-tool.d.mts +29 -0
  152. package/dist/finding-remediation/eve-tool.mjs +34 -0
  153. package/dist/finding-remediation/eve-tool.mjs.map +1 -0
  154. package/dist/findings/fingerprint.d.mts +14 -0
  155. package/dist/findings/fingerprint.mjs +28 -0
  156. package/dist/findings/fingerprint.mjs.map +1 -0
  157. package/dist/findings.d.mts +6 -0
  158. package/dist/findings.mjs +6 -0
  159. package/dist/github-app.d.mts +54 -0
  160. package/dist/github-app.mjs +121 -0
  161. package/dist/github-app.mjs.map +1 -0
  162. package/dist/github-publication.d.mts +198 -0
  163. package/dist/github-publication.mjs +429 -0
  164. package/dist/github-publication.mjs.map +1 -0
  165. package/dist/github-transfer.d.mts +72 -0
  166. package/dist/github-transfer.mjs +125 -0
  167. package/dist/github-transfer.mjs.map +1 -0
  168. package/dist/github.d.mts +406 -2
  169. package/dist/github.mjs +250 -37
  170. package/dist/github.mjs.map +1 -1
  171. package/dist/image-input.d.mts +51 -0
  172. package/dist/image-input.mjs +63 -0
  173. package/dist/image-input.mjs.map +1 -0
  174. package/dist/index.d.mts +14 -314
  175. package/dist/index.mjs +14 -1124
  176. package/dist/intake-contracts.d.mts +56 -0
  177. package/dist/intake-contracts.mjs +33 -0
  178. package/dist/intake-contracts.mjs.map +1 -0
  179. package/dist/integrations/deepsec.d.mts +4 -0
  180. package/dist/integrations/deepsec.mjs +3 -0
  181. package/dist/integrations/github.d.mts +11 -0
  182. package/dist/integrations/github.mjs +9 -0
  183. package/dist/integrations/slack.d.mts +3 -0
  184. package/dist/integrations/slack.mjs +3 -0
  185. package/dist/integrations/vercel.d.mts +3 -0
  186. package/dist/integrations/vercel.mjs +3 -0
  187. package/dist/merge-resolution/contracts.d.mts +17 -0
  188. package/dist/merge-resolution/contracts.mjs +19 -0
  189. package/dist/merge-resolution/contracts.mjs.map +1 -0
  190. package/dist/merge-resolution/eve-tools.d.mts +46 -0
  191. package/dist/merge-resolution/eve-tools.mjs +117 -0
  192. package/dist/merge-resolution/eve-tools.mjs.map +1 -0
  193. package/dist/multi-repository-changes/coordination.d.mts +49 -0
  194. package/dist/multi-repository-changes/coordination.mjs +115 -0
  195. package/dist/multi-repository-changes/coordination.mjs.map +1 -0
  196. package/dist/planning/cancellation.mjs +82 -0
  197. package/dist/planning/cancellation.mjs.map +1 -0
  198. package/dist/planning/configuration.d.mts +23 -0
  199. package/dist/planning/configuration.mjs +56 -0
  200. package/dist/planning/configuration.mjs.map +1 -0
  201. package/dist/planning/contracts.d.mts +136 -0
  202. package/dist/planning/contracts.mjs +42 -0
  203. package/dist/planning/contracts.mjs.map +1 -0
  204. package/dist/planning/dependencies.mjs +44 -0
  205. package/dist/planning/dependencies.mjs.map +1 -0
  206. package/dist/planning/effects.mjs +122 -0
  207. package/dist/planning/effects.mjs.map +1 -0
  208. package/dist/planning/reconcile.mjs +273 -0
  209. package/dist/planning/reconcile.mjs.map +1 -0
  210. package/dist/planning/runtime.d.mts +27 -0
  211. package/dist/planning/runtime.mjs +25 -0
  212. package/dist/planning/runtime.mjs.map +1 -0
  213. package/dist/planning/state.mjs +92 -0
  214. package/dist/planning/state.mjs.map +1 -0
  215. package/dist/planning/turns.mjs +262 -0
  216. package/dist/planning/turns.mjs.map +1 -0
  217. package/dist/planning/validation.mjs +106 -0
  218. package/dist/planning/validation.mjs.map +1 -0
  219. package/dist/postgres/index.d.mts +7 -1
  220. package/dist/postgres/index.mjs +7 -3
  221. package/dist/postgres/index.mjs.map +1 -1
  222. package/dist/presets/software-development/approval.d.mts +14 -0
  223. package/dist/presets/software-development/approval.mjs +21 -0
  224. package/dist/presets/software-development/approval.mjs.map +1 -0
  225. package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
  226. package/dist/presets/software-development/deepsec-brief.mjs +14 -0
  227. package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
  228. package/dist/presets/software-development/dispatch.d.mts +53 -0
  229. package/dist/presets/software-development/dispatch.mjs +66 -0
  230. package/dist/presets/software-development/dispatch.mjs.map +1 -0
  231. package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
  232. package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
  233. package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
  234. package/dist/presets/software-development/eve.d.mts +18 -0
  235. package/dist/presets/software-development/eve.mjs +19 -0
  236. package/dist/presets/software-development/eve.mjs.map +1 -0
  237. package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
  238. package/dist/presets/software-development/finish-task-policy.mjs +9 -0
  239. package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
  240. package/dist/presets/software-development/recovery.d.mts +32 -0
  241. package/dist/presets/software-development/recovery.mjs +120 -0
  242. package/dist/presets/software-development/recovery.mjs.map +1 -0
  243. package/dist/presets/software-development/task-communication.d.mts +23 -0
  244. package/dist/presets/software-development/task-communication.mjs +120 -0
  245. package/dist/presets/software-development/task-communication.mjs.map +1 -0
  246. package/dist/presets/software-development.d.mts +9 -0
  247. package/dist/presets/software-development.mjs +9 -0
  248. package/dist/pull-requests/contracts.d.mts +72 -0
  249. package/dist/pull-requests/eve-fetch.d.mts +57 -0
  250. package/dist/pull-requests/eve-fetch.mjs +151 -0
  251. package/dist/pull-requests/eve-fetch.mjs.map +1 -0
  252. package/dist/pull-requests/github-label-manager.d.mts +27 -0
  253. package/dist/pull-requests/github-label-manager.mjs +40 -0
  254. package/dist/pull-requests/github-label-manager.mjs.map +1 -0
  255. package/dist/pull-requests/github-publisher.d.mts +53 -0
  256. package/dist/pull-requests/github-publisher.mjs +345 -0
  257. package/dist/pull-requests/github-publisher.mjs.map +1 -0
  258. package/dist/pull-requests.d.mts +5 -0
  259. package/dist/pull-requests.mjs +4 -0
  260. package/dist/receipts.d.mts +4 -0
  261. package/dist/receipts.mjs +3 -0
  262. package/dist/repositories.d.mts +18 -0
  263. package/dist/repositories.mjs +33 -0
  264. package/dist/repositories.mjs.map +1 -0
  265. package/dist/sandbox/command.d.mts +18 -0
  266. package/dist/sandbox/execution-abort.d.mts +16 -0
  267. package/dist/sandbox/execution-abort.mjs +49 -0
  268. package/dist/sandbox/execution-abort.mjs.map +1 -0
  269. package/dist/sandbox/execution-environment.d.mts +25 -0
  270. package/dist/sandbox/execution-run-ledger.d.mts +115 -0
  271. package/dist/sandbox/execution-run-ledger.mjs +209 -0
  272. package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
  273. package/dist/sandbox/execution.d.mts +54 -0
  274. package/dist/sandbox/execution.mjs +228 -0
  275. package/dist/sandbox/execution.mjs.map +1 -0
  276. package/dist/sandbox/harness-runner.d.mts +79 -0
  277. package/dist/sandbox/harness-runner.mjs +162 -0
  278. package/dist/sandbox/harness-runner.mjs.map +1 -0
  279. package/dist/sandbox/index.d.mts +9 -0
  280. package/dist/sandbox/index.mjs +7 -0
  281. package/dist/sandbox/task-environment.d.mts +50 -0
  282. package/dist/sandbox/task-environment.mjs +140 -0
  283. package/dist/sandbox/task-environment.mjs.map +1 -0
  284. package/dist/sandbox/workspace.d.mts +29 -0
  285. package/dist/sandbox/workspace.mjs +28 -0
  286. package/dist/sandbox/workspace.mjs.map +1 -0
  287. package/dist/schema/agent-route.d.mts +22 -0
  288. package/dist/schema/agent-route.mjs +15 -0
  289. package/dist/schema/agent-route.mjs.map +1 -0
  290. package/dist/schema/answer.d.mts +23 -0
  291. package/dist/schema/answer.mjs +21 -0
  292. package/dist/schema/answer.mjs.map +1 -0
  293. package/dist/schema/budget.d.mts +38 -0
  294. package/dist/schema/budget.mjs +30 -0
  295. package/dist/schema/budget.mjs.map +1 -0
  296. package/dist/schema/catalog.mjs +72 -0
  297. package/dist/schema/catalog.mjs.map +1 -0
  298. package/dist/schema/change.d.mts +117 -0
  299. package/dist/schema/change.mjs +68 -0
  300. package/dist/schema/change.mjs.map +1 -0
  301. package/dist/schema/common.d.mts +33 -0
  302. package/dist/{id-DwCihQr4.mjs → schema/common.mjs} +7 -14
  303. package/dist/schema/common.mjs.map +1 -0
  304. package/dist/schema/communication.d.mts +52 -0
  305. package/dist/schema/communication.mjs +35 -0
  306. package/dist/schema/communication.mjs.map +1 -0
  307. package/dist/schema/execution.d.mts +101 -0
  308. package/dist/schema/execution.mjs +86 -0
  309. package/dist/schema/execution.mjs.map +1 -0
  310. package/dist/schema/factory-config.d.mts +95 -0
  311. package/dist/schema/factory-config.mjs +60 -0
  312. package/dist/schema/factory-config.mjs.map +1 -0
  313. package/dist/schema/finding.d.mts +125 -0
  314. package/dist/schema/finding.mjs +67 -0
  315. package/dist/schema/finding.mjs.map +1 -0
  316. package/dist/schema/id.d.mts +43 -0
  317. package/dist/schema/id.mjs +32 -0
  318. package/dist/schema/id.mjs.map +1 -0
  319. package/dist/schema/outbox.d.mts +240 -0
  320. package/dist/schema/outbox.mjs +53 -0
  321. package/dist/schema/outbox.mjs.map +1 -0
  322. package/dist/schema/question-route.mjs +16 -0
  323. package/dist/schema/question-route.mjs.map +1 -0
  324. package/dist/schema/receipt.d.mts +81 -0
  325. package/dist/schema/receipt.mjs +94 -0
  326. package/dist/schema/receipt.mjs.map +1 -0
  327. package/dist/schema/repository.d.mts +26 -0
  328. package/dist/schema/repository.mjs +25 -0
  329. package/dist/schema/repository.mjs.map +1 -0
  330. package/dist/schema/session.d.mts +135 -0
  331. package/dist/schema/session.mjs +53 -0
  332. package/dist/schema/session.mjs.map +1 -0
  333. package/dist/schema/signal.d.mts +105 -0
  334. package/dist/schema/signal.mjs +81 -0
  335. package/dist/schema/signal.mjs.map +1 -0
  336. package/dist/schema/stored-session.mjs +10 -0
  337. package/dist/schema/stored-session.mjs.map +1 -0
  338. package/dist/schema/stored-task.mjs +20 -0
  339. package/dist/schema/stored-task.mjs.map +1 -0
  340. package/dist/schema/task-effect.d.mts +39 -0
  341. package/dist/schema/task-effect.mjs +29 -0
  342. package/dist/schema/task-effect.mjs.map +1 -0
  343. package/dist/schema/task-graph.d.mts +3134 -0
  344. package/dist/schema/task-graph.mjs +97 -0
  345. package/dist/schema/task-graph.mjs.map +1 -0
  346. package/dist/schema/task-message.d.mts +254 -0
  347. package/dist/schema/task-message.mjs +189 -0
  348. package/dist/schema/task-message.mjs.map +1 -0
  349. package/dist/schema/task.d.mts +272 -0
  350. package/dist/schema/task.mjs +199 -0
  351. package/dist/schema/task.mjs.map +1 -0
  352. package/dist/schema/transcript.d.mts +170 -0
  353. package/dist/schema/transcript.mjs +86 -0
  354. package/dist/schema/transcript.mjs.map +1 -0
  355. package/dist/schema/transitions.d.mts +50 -0
  356. package/dist/schema/transitions.mjs +303 -0
  357. package/dist/schema/transitions.mjs.map +1 -0
  358. package/dist/schema/work.d.mts +101 -0
  359. package/dist/schema/work.mjs +102 -0
  360. package/dist/schema/work.mjs.map +1 -0
  361. package/dist/signal-triage.d.mts +20 -0
  362. package/dist/signal-triage.mjs +85 -0
  363. package/dist/signal-triage.mjs.map +1 -0
  364. package/dist/signals.d.mts +19 -0
  365. package/dist/signals.mjs +19 -0
  366. package/dist/signals.mjs.map +1 -0
  367. package/dist/stall.d.mts +38 -0
  368. package/dist/stall.mjs +79 -0
  369. package/dist/stall.mjs.map +1 -0
  370. package/dist/storage.d.mts +4 -0
  371. package/dist/storage.mjs +4 -0
  372. package/dist/store/driver.d.mts +65 -0
  373. package/dist/store/driver.mjs +42 -0
  374. package/dist/store/driver.mjs.map +1 -0
  375. package/dist/store/engine.d.mts +485 -0
  376. package/dist/store/engine.mjs +2175 -0
  377. package/dist/store/engine.mjs.map +1 -0
  378. package/dist/store/memory.d.mts +7 -0
  379. package/dist/store/memory.mjs +52 -0
  380. package/dist/store/memory.mjs.map +1 -0
  381. package/dist/store/task-effects.d.mts +38 -0
  382. package/dist/store/task-effects.mjs +118 -0
  383. package/dist/store/task-effects.mjs.map +1 -0
  384. package/dist/store/task-graphs.d.mts +60 -0
  385. package/dist/store/task-graphs.mjs +212 -0
  386. package/dist/store/task-graphs.mjs.map +1 -0
  387. package/dist/store/task-messages.d.mts +136 -0
  388. package/dist/store/task-messages.mjs +475 -0
  389. package/dist/store/task-messages.mjs.map +1 -0
  390. package/dist/store/task-work.d.mts +65 -0
  391. package/dist/store/task-work.mjs +134 -0
  392. package/dist/store/task-work.mjs.map +1 -0
  393. package/dist/store/work-notifications.d.mts +19 -0
  394. package/dist/store/work-notifications.mjs +48 -0
  395. package/dist/store/work-notifications.mjs.map +1 -0
  396. package/dist/sweep.d.mts +57 -0
  397. package/dist/sweep.mjs +143 -0
  398. package/dist/sweep.mjs.map +1 -0
  399. package/dist/task-communication.d.mts +35 -0
  400. package/dist/task-communication.mjs +47 -0
  401. package/dist/task-communication.mjs.map +1 -0
  402. package/dist/task-graph-view.d.mts +264 -0
  403. package/dist/task-graph-view.mjs +17 -0
  404. package/dist/task-graph-view.mjs.map +1 -0
  405. package/dist/task-message-processing.d.mts +60 -0
  406. package/dist/task-message-processing.mjs +200 -0
  407. package/dist/task-message-processing.mjs.map +1 -0
  408. package/dist/task-protocols.d.mts +80 -0
  409. package/dist/task-protocols.mjs +47 -0
  410. package/dist/task-protocols.mjs.map +1 -0
  411. package/dist/tasks.d.mts +17 -0
  412. package/dist/tasks.mjs +17 -0
  413. package/dist/vercel-git.d.mts +21 -0
  414. package/dist/vercel-git.mjs +112 -0
  415. package/dist/vercel-git.mjs.map +1 -0
  416. package/dist/vercel.d.mts +33 -2
  417. package/dist/vercel.mjs +48 -3
  418. package/dist/vercel.mjs.map +1 -1
  419. package/dist/work-triage/eve-tool.d.mts +29 -0
  420. package/dist/work-triage/eve-tool.mjs +32 -0
  421. package/dist/work-triage/eve-tool.mjs.map +1 -0
  422. package/dist/work-triage/find-existing-work.d.mts +32 -0
  423. package/dist/work-triage/find-existing-work.mjs +31 -0
  424. package/dist/work-triage/find-existing-work.mjs.map +1 -0
  425. package/dist/work-triage/github.d.mts +15 -0
  426. package/dist/work-triage/github.mjs +14 -0
  427. package/dist/work-triage/github.mjs.map +1 -0
  428. package/dist/work-triage.d.mts +3 -0
  429. package/dist/work-triage.mjs +3 -0
  430. package/dist/workflows.d.mts +48 -0
  431. package/dist/workflows.mjs +86 -0
  432. package/dist/workflows.mjs.map +1 -0
  433. package/dist/workspace-diff-assembly.d.mts +33 -0
  434. package/dist/workspace-diff-assembly.mjs +95 -0
  435. package/dist/workspace-diff-assembly.mjs.map +1 -0
  436. package/dist/workspace-diff.d.mts +90 -0
  437. package/dist/workspace-diff.mjs +61 -0
  438. package/dist/workspace-diff.mjs.map +1 -0
  439. package/dist/workspace-snapshot.d.mts +26 -0
  440. package/dist/workspace-snapshot.mjs +80 -0
  441. package/dist/workspace-snapshot.mjs.map +1 -0
  442. package/package.json +129 -40
  443. package/dist/approval-CwhTP1XB.mjs +0 -269
  444. package/dist/approval-CwhTP1XB.mjs.map +0 -1
  445. package/dist/change-CzEAoFVE.mjs +0 -620
  446. package/dist/change-CzEAoFVE.mjs.map +0 -1
  447. package/dist/dispatch-B77cuPxh.d.mts +0 -713
  448. package/dist/driver-BJutB0PE.d.mts +0 -34
  449. package/dist/driver-Bbd25rNM.mjs +0 -23
  450. package/dist/driver-Bbd25rNM.mjs.map +0 -1
  451. package/dist/factory-config-BJcjsPKl.mjs +0 -86
  452. package/dist/factory-config-BJcjsPKl.mjs.map +0 -1
  453. package/dist/factory-config-D2yU3G0c.d.mts +0 -58
  454. package/dist/github-DXsxboUL.d.mts +0 -271
  455. package/dist/id-DwCihQr4.mjs.map +0 -1
  456. package/dist/index-Cy4jfXh5.d.mts +0 -67
  457. package/dist/index.mjs.map +0 -1
  458. package/dist/signal-CHVEmzvI.d.mts +0 -59
@@ -0,0 +1,56 @@
1
+ import { SignalSource } from "./schema/signal.mjs";
2
+ import "./signals.mjs";
3
+ import { z } from "zod";
4
+ //#region src/intake-contracts.d.ts
5
+ /** Validates the operator projection of intake, excluding the untrusted provider payload. */
6
+ declare const intakeViewSchema: z.ZodObject<{
7
+ id: z.ZodType<`sig_${string}`, string, z.core.$ZodTypeInternals<`sig_${string}`, string>>;
8
+ schemaVersion: z.ZodLiteral<1>;
9
+ repositoryId: z.ZodType<`repo_${string}`, string, z.core.$ZodTypeInternals<`repo_${string}`, string>>;
10
+ source: z.ZodType<SignalSource, unknown, z.core.$ZodTypeInternals<SignalSource, unknown>>;
11
+ deliveryId: z.ZodString;
12
+ replyTo: z.ZodObject<{
13
+ channel: z.ZodString;
14
+ address: z.ZodString;
15
+ }, z.core.$strict>;
16
+ receivedAt: z.ZodISODateTime;
17
+ outcome: z.ZodEnum<{
18
+ pending: "pending";
19
+ accepted: "accepted";
20
+ duplicate: "duplicate";
21
+ unactionable: "unactionable";
22
+ low_confidence: "low_confidence";
23
+ ignored: "ignored";
24
+ }>;
25
+ triage: z.ZodOptional<z.ZodObject<{
26
+ attempt: z.ZodNumber;
27
+ state: z.ZodEnum<{
28
+ running: "running";
29
+ blocked: "blocked";
30
+ uncertain: "uncertain";
31
+ }>;
32
+ by: z.ZodString;
33
+ startedAt: z.ZodISODateTime;
34
+ updatedAt: z.ZodISODateTime;
35
+ sessionId: z.ZodOptional<z.ZodString>;
36
+ failure: z.ZodOptional<z.ZodEnum<{
37
+ cancelled: "cancelled";
38
+ billing_verification_required: "billing_verification_required";
39
+ provider_failed: "provider_failed";
40
+ no_decision: "no_decision";
41
+ launch_unconfirmed: "launch_unconfirmed";
42
+ }>>;
43
+ }, z.core.$strict>>;
44
+ detail: z.ZodOptional<z.ZodString>;
45
+ reason: z.ZodOptional<z.ZodString>;
46
+ decidedAt: z.ZodOptional<z.ZodISODateTime>;
47
+ repository: z.ZodString;
48
+ taskIds: z.ZodArray<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>;
49
+ }, z.core.$strip>;
50
+ /** Operator-visible intake record and its linked work. */
51
+ type IntakeView = z.infer<typeof intakeViewSchema>;
52
+ /** Describe a safe failure category without exposing provider error text or credentials. */
53
+ declare function describeIntake(item: Pick<IntakeView, "outcome" | "triage">): string;
54
+ //#endregion
55
+ export { IntakeView, describeIntake, intakeViewSchema };
56
+ //# sourceMappingURL=intake-contracts.d.mts.map
@@ -0,0 +1,33 @@
1
+ import { taskIdSchema } from "./schema/id.mjs";
2
+ import { signalSchema } from "./schema/signal.mjs";
3
+ import { z } from "zod";
4
+ //#region src/intake-contracts.ts
5
+ /** Validates the operator projection of intake, excluding the untrusted provider payload. */
6
+ const intakeViewSchema = z.object(signalSchema.shape).omit({ payload: true }).extend({
7
+ repository: z.string().describe("Configured repository slug."),
8
+ taskIds: z.array(taskIdSchema).describe("Tasks already linked to this signal.")
9
+ });
10
+ /** Validates a bounded page of intake records. */
11
+ const intakePageSchema = z.strictObject({
12
+ items: z.array(intakeViewSchema).describe("Authorized intake records."),
13
+ nextCursor: z.string().nullable().describe("Last signal ID, or null at the end.")
14
+ });
15
+ /** Validates an explicit retry of the observed stopped attempt. */
16
+ const retryIntakeSchema = z.strictObject({ expectedAttempt: z.number().int().positive().describe("Observed blocked attempt; stale requests conflict.") });
17
+ /** Describe a safe failure category without exposing provider error text or credentials. */
18
+ function describeIntake(item) {
19
+ if (item.outcome !== "pending") return item.outcome;
20
+ if (!item.triage) return "pending — triage status unknown; inspect runtime logs";
21
+ switch (item.triage.failure) {
22
+ case "billing_verification_required": return "blocked — AI Gateway billing verification required; complete verification, then retry";
23
+ case "provider_failed": return "blocked — Foreman provider failed; inspect runtime logs, resolve the cause, then retry";
24
+ case "cancelled": return "blocked — Foreman was cancelled; retry when ready";
25
+ case "no_decision": return "blocked — Foreman stopped without a triage decision; inspect the session, then retry";
26
+ case "launch_unconfirmed": return "uncertain — session launch could not be confirmed; inspect runtime logs before further action";
27
+ default: return "running — awaiting a Foreman triage decision";
28
+ }
29
+ }
30
+ //#endregion
31
+ export { describeIntake, intakePageSchema, intakeViewSchema, retryIntakeSchema };
32
+
33
+ //# sourceMappingURL=intake-contracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake-contracts.mjs","names":[],"sources":["../src/intake-contracts.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { signalSchema } from \"./schema/signal\";\nimport { taskIdSchema } from \"./schema/id\";\n\n/** Validates the operator projection of intake, excluding the untrusted provider payload. */\nexport const intakeViewSchema = z\n .object(signalSchema.shape)\n .omit({ payload: true })\n .extend({\n repository: z.string().describe(\"Configured repository slug.\"),\n taskIds: z.array(taskIdSchema).describe(\"Tasks already linked to this signal.\"),\n });\n/** Operator-visible intake record and its linked work. */\nexport type IntakeView = z.infer<typeof intakeViewSchema>;\n/** Validates a bounded page of intake records. */\nexport const intakePageSchema = z.strictObject({\n items: z.array(intakeViewSchema).describe(\"Authorized intake records.\"),\n nextCursor: z.string().nullable().describe(\"Last signal ID, or null at the end.\"),\n});\n/** Validates an explicit retry of the observed stopped attempt. */\nexport const retryIntakeSchema = z.strictObject({\n expectedAttempt: z\n .number()\n .int()\n .positive()\n .describe(\"Observed blocked attempt; stale requests conflict.\"),\n});\n\n/** Describe a safe failure category without exposing provider error text or credentials. */\nexport function describeIntake(item: Pick<IntakeView, \"outcome\" | \"triage\">): string {\n if (item.outcome !== \"pending\") return item.outcome;\n if (!item.triage) return \"pending — triage status unknown; inspect runtime logs\";\n switch (item.triage.failure) {\n case \"billing_verification_required\":\n return \"blocked — AI Gateway billing verification required; complete verification, then retry\";\n case \"provider_failed\":\n return \"blocked — Foreman provider failed; inspect runtime logs, resolve the cause, then retry\";\n case \"cancelled\":\n return \"blocked — Foreman was cancelled; retry when ready\";\n case \"no_decision\":\n return \"blocked — Foreman stopped without a triage decision; inspect the session, then retry\";\n case \"launch_unconfirmed\":\n return \"uncertain — session launch could not be confirmed; inspect runtime logs before further action\";\n default:\n return \"running — awaiting a Foreman triage decision\";\n }\n}\n"],"mappings":";;;;;AAKA,MAAa,mBAAmB,EAC7B,OAAO,aAAa,KAAK,CAAC,CAC1B,KAAK,EAAE,SAAS,KAAK,CAAC,CAAC,CACvB,OAAO;CACN,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS,6BAA6B;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,sCAAsC;AAChF,CAAC;;AAIH,MAAa,mBAAmB,EAAE,aAAa;CAC7C,OAAO,EAAE,MAAM,gBAAgB,CAAC,CAAC,SAAS,4BAA4B;CACtE,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qCAAqC;AAClF,CAAC;;AAED,MAAa,oBAAoB,EAAE,aAAa,EAC9C,iBAAiB,EACd,OAAO,CAAC,CACR,IAAI,CAAC,CACL,SAAS,CAAC,CACV,SAAS,oDAAoD,EAClE,CAAC;;AAGD,SAAgB,eAAe,MAAsD;CACnF,IAAI,KAAK,YAAY,WAAW,OAAO,KAAK;CAC5C,IAAI,CAAC,KAAK,QAAQ,OAAO;CACzB,QAAQ,KAAK,OAAO,SAApB;EACE,KAAK,iCACH,OAAO;EACT,KAAK,mBACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,eACH,OAAO;EACT,KAAK,sBACH,OAAO;EACT,SACE,OAAO;CACX;AACF"}
@@ -0,0 +1,4 @@
1
+ import { DeepsecExport, DeepsecExportInput, DeepsecFinding, DeepsecFindingInput, deepsecExportSchema, deepsecFindingSchema, findingFromDeepsec } from "../deepsec/finding.mjs";
2
+ import { DeepsecAgent, DeepsecCommandResult, DeepsecCredentialCommandInput, DeepsecScanFailure, DeepsecScanFailureCode, DeepsecScanFinding, DeepsecScanInput, DeepsecScanResult, DeepsecScanSuccess, DeepsecScanTool, DeepsecScanToolOptions, DeepsecScanToolStores, DeepsecThinkingLevel, createDeepsecScanTool, deepsecScanInputSchema } from "../deepsec/eve-tool.mjs";
3
+ import "../deepsec.mjs";
4
+ export { type DeepsecAgent, type DeepsecCommandResult, type DeepsecCredentialCommandInput, type DeepsecExport, type DeepsecExportInput, type DeepsecFinding, type DeepsecFindingInput, type DeepsecScanFailure, type DeepsecScanFailureCode, type DeepsecScanFinding, type DeepsecScanInput, type DeepsecScanResult, type DeepsecScanSuccess, type DeepsecScanTool, type DeepsecScanToolOptions, type DeepsecScanToolStores, type DeepsecThinkingLevel, createDeepsecScanTool, deepsecExportSchema, deepsecFindingSchema, deepsecScanInputSchema, findingFromDeepsec };
@@ -0,0 +1,3 @@
1
+ import { deepsecExportSchema, deepsecFindingSchema, findingFromDeepsec } from "../deepsec/finding.mjs";
2
+ import { createDeepsecScanTool, deepsecScanInputSchema } from "../deepsec/eve-tool.mjs";
3
+ export { createDeepsecScanTool, deepsecExportSchema, deepsecFindingSchema, deepsecScanInputSchema, findingFromDeepsec };
@@ -0,0 +1,11 @@
1
+ import { GitHubAppFactoryInput, GitHubAppInstallationToken, GitHubAppLike, GitHubAppPermissions, MintGitHubAppInstallationTokenInput, mintGitHubAppInstallationToken } from "../github-app.mjs";
2
+ import { FetchGitHubBundleInput, FetchGitHubRefsInput, GitHubGitTransport, GitHubRefMapping, GitHubRepositoryBundle, GitTransferSandbox, PushGitHubBundleInput, PushGitHubHeadInput, ReadGitTransferFileInput, WithSandboxGitBundleInput, WriteGitTransferFileInput } from "../github-transfer.mjs";
3
+ import { CheckoutGitHubRepositoryInput, CommittedGitChange, CreateGitHubBranchInput, CreateGitHubCommitInput, CreateGitHubPublicationPullRequestInput, CreateGitHubTreeInput, CreatedGitHubPublicationPullRequest, GitHubCheckoutConflictError, GitHubCommit, GitHubPublicationApiError, GitHubPublicationClient, GitHubPublicationClientOptions, GitHubPublicationLimits, GitHubPublicationPullRequest, GitHubTreeDeletion, GitHubTreeEntry, GitHubTreeUpsert, ListGitHubPublicationPullRequestsInput, MarkGitHubPullRequestReadyInput, ReadCommittedGitChangeInput, ReadGitHubBranchHeadInput, ReadGitHubCommitInput, ReadGitHubPullRequestInput, RunSandboxGitInput, SandboxGit, SandboxGitCommandInput, SandboxGitCommandResult, UpdateGitHubBranchInput, checkoutGitHubRepository, createGitHubPublicationClient, factorySessionBranch, factoryTaskBranch, isSafeGitRef, readCommittedGitChange, runSandboxGit } from "../github-publication.mjs";
4
+ import { AnswerReviewCommentInput, CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunFields, CheckRunOutput, CheckRunProgressStatus, CompletedCheckRunFields, ConfiguredEventRepositoryInput, ConflictedGitHubPullRequest, CreateCheckRunInput, CreatePullRequestCommentInput, CreatePullRequestInput, CreatedGitHubPullRequest, FactoryMentionOptions, FactoryQuestionReply, FactoryReviewComment, GitHubCheckRun, GitHubCiFailureSignal, GitHubDefaultBranchPush, GitHubIssueComment, GitHubIssueCommentRecord, GitHubIssueSignal, GitHubPullRequest, GitHubPullRequestClosed, GitHubPullRequestHead, GitHubPullRequestReference, GitHubPullRequestSignal, GitHubPullRequestTarget, GitHubRepositoryAuthorRequest, GitHubRepositoryRequest, GitHubReviewComment, GitHubReviewCommentAuthorError, IncompleteCheckRunFields, ListCheckRunsForRefInput, ListConflictedPullRequestsInput, ListOpenPullRequestsInput, ListPullRequestCommentsInput, NormalizeFactoryCommentInput, ObservedCheckRunStatus, PullRequestLabelInput, PullRequestReviewComment, PullRequestReviewEvent, ReadReviewCommentInput, ReviewCommentAuthorPolicy, StalePullRequestHeadError, SubmitPullRequestReviewInput, SubmittedPullRequestReview, UpdateCheckRunInput, UpdatePullRequestCommentInput, VerifyGitHubSignatureInput, addLabel, answerReviewComment, closePullRequest, configuredEventRepositorySlug, createCheckRun, createPullRequest, createPullRequestComment, hasGitHubRepositoryWriteAccess, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature } from "../github.mjs";
5
+ import { PublishedGitHubReview } from "../code-review/github-contracts.mjs";
6
+ import { GitHubCommunicationAdapterOptions, GitHubReplyTarget, createGitHubCommunicationAdapter, parseGitHubReplyAddress, renderGitHubCommunicationEvent } from "../connectors/github.mjs";
7
+ import { GitHubReviewReporter, GitHubReviewReporterOptions, ReconcileReviewChecksInput, ReconcileReviewChecksOptions, ReconcileReviewChecksResult, createGitHubReviewReporter } from "../code-review/github-reporter.mjs";
8
+ import { GitHubPullRequestPublicationGate, GitHubPullRequestPublicationGateOptions, GitHubPullRequestPublisher, GitHubPullRequestPublisherOptions, PublishGitHubPullRequestInput, PushGitHubCheckpointInput, RequireTaskPullRequestInput, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher } from "../pull-requests/github-publisher.mjs";
9
+ import { GitHubPullRequestLabelManager, GitHubPullRequestLabelManagerOptions, ManageGitHubPullRequestLabelInput, createGitHubPullRequestLabelManager } from "../pull-requests/github-label-manager.mjs";
10
+ import { GitHubOpenPullRequestLister, GitHubOpenPullRequestListerOptions, createGitHubOpenPullRequestLister } from "../work-triage/github.mjs";
11
+ export { type AnswerReviewCommentInput, type CheckRunAnnotation, type CheckRunAnnotationLevel, type CheckRunConclusion, type CheckRunFields, type CheckRunOutput, type CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, type CompletedCheckRunFields, type ConfiguredEventRepositoryInput, type ConflictedGitHubPullRequest, type CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, type CreatePullRequestCommentInput, type CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, type CreatedGitHubPullRequest, type FactoryMentionOptions, type FactoryQuestionReply, type FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, type GitHubCheckRun, GitHubCheckoutConflictError, type GitHubCiFailureSignal, type GitHubCommit, type GitHubCommunicationAdapterOptions, type GitHubDefaultBranchPush, type GitHubGitTransport, type GitHubIssueComment, type GitHubIssueCommentRecord, type GitHubIssueSignal, type GitHubOpenPullRequestLister, type GitHubOpenPullRequestListerOptions, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, type GitHubPullRequest, type GitHubPullRequestClosed, type GitHubPullRequestHead, type GitHubPullRequestLabelManager, type GitHubPullRequestLabelManagerOptions, type GitHubPullRequestPublicationGate, type GitHubPullRequestPublicationGateOptions, type GitHubPullRequestPublisher, type GitHubPullRequestPublisherOptions, type GitHubPullRequestReference, type GitHubPullRequestSignal, type GitHubPullRequestTarget, type GitHubRefMapping, type GitHubReplyTarget, type GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, type GitHubRepositoryRequest, type GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubReviewReporter, type GitHubReviewReporterOptions, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, type IncompleteCheckRunFields, type ListCheckRunsForRefInput, type ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, type ListOpenPullRequestsInput, type ListPullRequestCommentsInput, type ManageGitHubPullRequestLabelInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, type NormalizeFactoryCommentInput, type ObservedCheckRunStatus, type PublishGitHubPullRequestInput, type PublishedGitHubReview, type PullRequestLabelInput, type PullRequestReviewComment, type PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubCheckpointInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, type ReadReviewCommentInput, type ReconcileReviewChecksInput, type ReconcileReviewChecksOptions, type ReconcileReviewChecksResult, type RequireTaskPullRequestInput, type ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, type SubmitPullRequestReviewInput, type SubmittedPullRequestReview, type UpdateCheckRunInput, type UpdateGitHubBranchInput, type UpdatePullRequestCommentInput, type VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubCommunicationAdapter, createGitHubOpenPullRequestLister, createGitHubPublicationClient, createGitHubPullRequestLabelManager, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher, createGitHubReviewReporter, createPullRequest, createPullRequestComment, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, parseGitHubReplyAddress, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, renderGitHubCommunicationEvent, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
@@ -0,0 +1,9 @@
1
+ import { mintGitHubAppInstallationToken } from "../github-app.mjs";
2
+ import { GitHubCheckoutConflictError, GitHubPublicationApiError, checkoutGitHubRepository, createGitHubPublicationClient, factorySessionBranch, factoryTaskBranch, isSafeGitRef, readCommittedGitChange, runSandboxGit } from "../github-publication.mjs";
3
+ import { GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, closePullRequest, configuredEventRepositorySlug, createCheckRun, createPullRequest, createPullRequestComment, hasGitHubRepositoryWriteAccess, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature } from "../github.mjs";
4
+ import { createGitHubCommunicationAdapter, parseGitHubReplyAddress, renderGitHubCommunicationEvent } from "../connectors/github.mjs";
5
+ import { createGitHubReviewReporter } from "../code-review/github-reporter.mjs";
6
+ import { createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher } from "../pull-requests/github-publisher.mjs";
7
+ import { createGitHubPullRequestLabelManager } from "../pull-requests/github-label-manager.mjs";
8
+ import { createGitHubOpenPullRequestLister } from "../work-triage/github.mjs";
9
+ export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubCommunicationAdapter, createGitHubOpenPullRequestLister, createGitHubPublicationClient, createGitHubPullRequestLabelManager, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher, createGitHubReviewReporter, createPullRequest, createPullRequestComment, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, parseGitHubReplyAddress, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, renderGitHubCommunicationEvent, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
@@ -0,0 +1,3 @@
1
+ import { SlackApprovals, SlackApprovalsOptions, SlackApprovalsStores, createSlackApprovals } from "../connectors/slack-approvals.mjs";
2
+ import { SlackCommunicationAdapter, SlackCommunicationAdapterOptions, SlackCommunicationDelivery, SlackMessageEvent, SlackMessageSignal, SlackReplyTarget, createSlackCommunicationAdapter, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent } from "../connectors/slack.mjs";
3
+ export { type SlackApprovals, type SlackApprovalsOptions, type SlackApprovalsStores, type SlackCommunicationAdapter, type SlackCommunicationAdapterOptions, type SlackCommunicationDelivery, type SlackMessageEvent, type SlackMessageSignal, type SlackReplyTarget, createSlackApprovals, createSlackCommunicationAdapter, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent };
@@ -0,0 +1,3 @@
1
+ import { createSlackApprovals } from "../connectors/slack-approvals.mjs";
2
+ import { createSlackCommunicationAdapter, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent } from "../connectors/slack.mjs";
3
+ export { createSlackApprovals, createSlackCommunicationAdapter, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent };
@@ -0,0 +1,3 @@
1
+ import { VercelGitHubGitTransportOptions, VercelGitHubTokenInput, createVercelGitHubGitTransport } from "../vercel-git.mjs";
2
+ import { VercelProductionDeployment, VercelQueueSend, VercelQueueSendOptions, VercelWorkQueue, VercelWorkQueueOptions, authenticateVercelUserToken, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature } from "../vercel.mjs";
3
+ export { type VercelGitHubGitTransportOptions, type VercelGitHubTokenInput, type VercelProductionDeployment, type VercelQueueSend, type VercelQueueSendOptions, type VercelWorkQueue, type VercelWorkQueueOptions, authenticateVercelUserToken, createVercelGitHubGitTransport, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature };
@@ -0,0 +1,3 @@
1
+ import { createVercelGitHubGitTransport } from "../vercel-git.mjs";
2
+ import { authenticateVercelUserToken, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature } from "../vercel.mjs";
3
+ export { authenticateVercelUserToken, createVercelGitHubGitTransport, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature };
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ //#region src/merge-resolution/contracts.d.ts
3
+ /** Validates the exact pull-request heads used to recover a merge conflict. */
4
+ declare const mergeConflictPayloadSchema: z.ZodObject<{
5
+ repository: z.ZodType<`${string}/${string}`, string, z.core.$ZodTypeInternals<`${string}/${string}`, string>>;
6
+ prNumber: z.ZodNumber;
7
+ prUrl: z.ZodURL;
8
+ headBranch: z.ZodString;
9
+ headSha: z.ZodString;
10
+ baseBranch: z.ZodString;
11
+ baseSha: z.ZodString;
12
+ }, z.core.$strict>;
13
+ /** Commit-fenced context supplied to a merge-conflict recovery Task. */
14
+ type MergeConflictPayload = z.infer<typeof mergeConflictPayloadSchema>;
15
+ //#endregion
16
+ export { MergeConflictPayload, mergeConflictPayloadSchema };
17
+ //# sourceMappingURL=contracts.d.mts.map
@@ -0,0 +1,19 @@
1
+ import { repositorySlugSchema } from "../schema/repository.mjs";
2
+ import { z } from "zod";
3
+ //#region src/merge-resolution/contracts.ts
4
+ const gitShaSchema = z.string().regex(/^[0-9a-f]{40}$/u);
5
+ const gitBranchSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/u).refine((value) => !value.includes(".."));
6
+ /** Validates the exact pull-request heads used to recover a merge conflict. */
7
+ const mergeConflictPayloadSchema = z.strictObject({
8
+ repository: repositorySlugSchema,
9
+ prNumber: z.number().int().positive(),
10
+ prUrl: z.url(),
11
+ headBranch: gitBranchSchema.refine((value) => value.startsWith("factory/")),
12
+ headSha: gitShaSchema,
13
+ baseBranch: gitBranchSchema,
14
+ baseSha: gitShaSchema
15
+ });
16
+ //#endregion
17
+ export { mergeConflictPayloadSchema };
18
+
19
+ //# sourceMappingURL=contracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.mjs","names":[],"sources":["../../src/merge-resolution/contracts.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { repositorySlugSchema } from \"../schema/repository\";\n\nconst gitShaSchema = z.string().regex(/^[0-9a-f]{40}$/u);\nconst gitBranchSchema = z\n .string()\n .regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/u)\n .refine((value) => !value.includes(\"..\"));\n\n/** Validates the exact pull-request heads used to recover a merge conflict. */\nexport const mergeConflictPayloadSchema = z.strictObject({\n repository: repositorySlugSchema,\n prNumber: z.number().int().positive(),\n prUrl: z.url(),\n headBranch: gitBranchSchema.refine((value) => value.startsWith(\"factory/\")),\n headSha: gitShaSchema,\n baseBranch: gitBranchSchema,\n baseSha: gitShaSchema,\n});\n\n/** Commit-fenced context supplied to a merge-conflict recovery Task. */\nexport type MergeConflictPayload = z.infer<typeof mergeConflictPayloadSchema>;\n"],"mappings":";;;AAGA,MAAM,eAAe,EAAE,OAAO,CAAC,CAAC,MAAM,iBAAiB;AACvD,MAAM,kBAAkB,EACrB,OAAO,CAAC,CACR,MAAM,gCAAgC,CAAC,CACvC,QAAQ,UAAU,CAAC,MAAM,SAAS,IAAI,CAAC;;AAG1C,MAAa,6BAA6B,EAAE,aAAa;CACvD,YAAY;CACZ,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACpC,OAAO,EAAE,IAAI;CACb,YAAY,gBAAgB,QAAQ,UAAU,MAAM,WAAW,UAAU,CAAC;CAC1E,SAAS;CACT,YAAY;CACZ,SAAS;AACX,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { TaskId } from "../schema/id.mjs";
2
+ import { FactoryStores } from "../store/engine.mjs";
3
+ import { GitHubGitTransport } from "../github-transfer.mjs";
4
+ import { MergeConflictPayload } from "./contracts.mjs";
5
+ import { ToolContext, ToolDefinition } from "eve/tools";
6
+ //#region src/merge-resolution/eve-tools.d.ts
7
+ /** Repository, Signal, and Task capabilities required by merge-conflict tools. */
8
+ type GitHubMergeConflictToolsStores = Pick<FactoryStores, "repositories" | "signals" | "tasks">;
9
+ /** Configures the credential boundary and checkout location used by merge-conflict tools. */
10
+ interface GitHubMergeConflictToolsOptions {
11
+ git: GitHubGitTransport;
12
+ repoPath?: string;
13
+ }
14
+ /** Merge-conflict Task selected for trusted pull-request reproduction. */
15
+ interface GitHubFetchMergeConflictInput {
16
+ taskId: TaskId;
17
+ }
18
+ /** Exact pull-request conflict context and files reproduced in the sandbox. */
19
+ type GitHubFetchMergeConflictResult = Readonly<MergeConflictPayload> & {
20
+ readonly conflictedFiles: readonly string[];
21
+ };
22
+ /** Tested conflict resolution and summary supplied for trusted publication. */
23
+ interface GitHubPublishMergeResolutionInput {
24
+ taskId: TaskId;
25
+ summary: string;
26
+ }
27
+ /** Existing pull request updated after a conflict resolution is published. */
28
+ interface GitHubPublishMergeResolutionResult {
29
+ readonly updated: true;
30
+ readonly prNumber: number;
31
+ readonly prUrl: string;
32
+ }
33
+ /** Tools that reproduce and publish an exact GitHub pull-request conflict resolution. */
34
+ interface GitHubMergeConflictTools {
35
+ readonly fetch_merge_conflict: ToolDefinition<GitHubFetchMergeConflictInput, GitHubFetchMergeConflictResult> & {
36
+ execute(input: GitHubFetchMergeConflictInput, ctx: ToolContext): Promise<GitHubFetchMergeConflictResult>;
37
+ };
38
+ readonly publish_merge_resolution: ToolDefinition<GitHubPublishMergeResolutionInput, GitHubPublishMergeResolutionResult> & {
39
+ execute(input: GitHubPublishMergeResolutionInput, ctx: ToolContext): Promise<GitHubPublishMergeResolutionResult>;
40
+ };
41
+ }
42
+ /** Create tools that reproduce an exact pull-request conflict and publish its tested resolution. */
43
+ declare function createGitHubMergeConflictTools(stores: GitHubMergeConflictToolsStores, options: GitHubMergeConflictToolsOptions): GitHubMergeConflictTools;
44
+ //#endregion
45
+ export { GitHubFetchMergeConflictInput, GitHubFetchMergeConflictResult, GitHubMergeConflictTools, GitHubMergeConflictToolsOptions, GitHubMergeConflictToolsStores, GitHubPublishMergeResolutionInput, GitHubPublishMergeResolutionResult, createGitHubMergeConflictTools };
46
+ //# sourceMappingURL=eve-tools.d.mts.map
@@ -0,0 +1,117 @@
1
+ import { taskIdSchema } from "../schema/id.mjs";
2
+ import { requireTaskExecution } from "../eve/task-execution.mjs";
3
+ import { fetchGitHubRefs, pushGitHubHead } from "../github-transfer.mjs";
4
+ import { mergeConflictPayloadSchema } from "./contracts.mjs";
5
+ import { z } from "zod";
6
+ import { defineTool } from "eve/tools";
7
+ //#region src/merge-resolution/eve-tools.ts
8
+ /** Create tools that reproduce an exact pull-request conflict and publish its tested resolution. */
9
+ function createGitHubMergeConflictTools(stores, options) {
10
+ const repoPath = options.repoPath ?? "repo";
11
+ async function context(taskId, ctx) {
12
+ const task = await requireTaskExecution(stores, ctx, taskId);
13
+ if (task.kind !== "merge_conflict") throw new Error(`task ${taskId} is ${task.kind}, not merge_conflict`);
14
+ if (task.state !== "running") throw new Error(`task ${taskId} is ${task.state}, not running`);
15
+ if (task.origin.signalId === void 0) throw new Error(`task ${taskId} has no conflict signal`);
16
+ const signal = await stores.signals.get(task.origin.signalId);
17
+ if (signal === null || signal.source !== "github_merge_conflict" || signal.outcome !== "accepted") throw new Error(`task ${taskId} has no GitHub merge conflict signal`);
18
+ if (task.replyTo.channel !== signal.replyTo.channel || task.replyTo.address !== signal.replyTo.address) throw new Error(`task ${taskId} reply destination does not match its conflict signal`);
19
+ if (task.repositoryIds.length !== 1 || task.repositoryIds[0] !== signal.repositoryId) throw new Error(`task ${taskId} repository does not match its conflict signal`);
20
+ const repository = await stores.repositories.get(signal.repositoryId);
21
+ const conflict = mergeConflictPayloadSchema.parse(signal.payload);
22
+ if (!repository?.enabled || repository.slug !== conflict.repository.toLowerCase()) throw new Error(`task ${taskId} conflict repository is not enabled or does not match`);
23
+ return {
24
+ task,
25
+ conflict: {
26
+ ...conflict,
27
+ repository: repository.slug
28
+ }
29
+ };
30
+ }
31
+ return {
32
+ fetch_merge_conflict: defineTool({
33
+ description: "Fetch the conflicted factory pull request and its current base, check out the PR head, and start the merge. Resolve every file returned in conflictedFiles, then test and commit the merge.",
34
+ inputSchema: z.object({ taskId: taskIdSchema }),
35
+ async execute({ taskId }, ctx) {
36
+ await context(taskId, ctx);
37
+ const sandbox = await ctx.getSandbox();
38
+ const { conflict } = await context(taskId, ctx);
39
+ const git = `git -C ${repoPath}`;
40
+ const headRef = `refs/remotes/origin/conflict-pr-${conflict.prNumber}`;
41
+ const baseRef = `refs/remotes/origin/conflict-base-${conflict.prNumber}`;
42
+ await fetchGitHubRefs({
43
+ sandbox,
44
+ transport: options.git,
45
+ repository: conflict.repository,
46
+ refs: [{
47
+ remote: `refs/pull/${conflict.prNumber}/head`,
48
+ local: headRef
49
+ }, {
50
+ remote: `refs/heads/${conflict.baseBranch}`,
51
+ local: baseRef
52
+ }],
53
+ repositoryPath: repoPath
54
+ });
55
+ const [headSha, baseSha] = (await sandbox.run({ command: `${git} rev-parse ${headRef} && ${git} rev-parse ${baseRef}` })).stdout.trim().split("\n");
56
+ if (headSha !== conflict.headSha || baseSha !== conflict.baseSha) throw new Error("pull request or base changed while conflict resolution was starting; retry from a new task");
57
+ await sandbox.run({ command: `${git} checkout -B conflict-pr ${headRef}` });
58
+ const merge = await sandbox.run({ command: `${git} merge --no-commit --no-ff ${baseRef}` });
59
+ const conflictedFiles = (await sandbox.run({ command: `${git} diff --name-only --diff-filter=U` })).stdout.trim().split("\n").filter(Boolean);
60
+ if (conflictedFiles.length === 0) throw new Error(typeof merge.exitCode === "number" && merge.exitCode !== 0 ? `merge failed without file conflicts: ${(merge.stderr ?? "").trim()}` : "pull request no longer has merge conflicts");
61
+ return {
62
+ ...conflict,
63
+ conflictedFiles
64
+ };
65
+ }
66
+ }),
67
+ publish_merge_resolution: defineTool({
68
+ description: "Publish a tested, committed conflict resolution to the existing pull request branch. Fails if the remote branch changed since this task started.",
69
+ inputSchema: z.object({
70
+ taskId: taskIdSchema,
71
+ summary: z.string().min(1).max(2e3)
72
+ }),
73
+ async execute({ taskId, summary }, ctx) {
74
+ await context(taskId, ctx);
75
+ const sandbox = await ctx.getSandbox();
76
+ const git = `git -C ${repoPath}`;
77
+ if ((await sandbox.run({ command: `${git} status --porcelain` })).stdout.trim() !== "") throw new Error("commit the conflict resolution before publishing");
78
+ if ((await sandbox.run({ command: `${git} diff --name-only --diff-filter=U` })).stdout.trim() !== "") throw new Error("merge conflicts remain unresolved");
79
+ const { task, conflict } = await context(taskId, ctx);
80
+ await pushGitHubHead({
81
+ sandbox,
82
+ transport: options.git,
83
+ repository: conflict.repository,
84
+ branch: conflict.headBranch,
85
+ expectedHead: conflict.headSha,
86
+ repositoryPath: repoPath
87
+ });
88
+ const verifying = await stores.tasks.transition(taskId, "verifying", {
89
+ expectFrom: "running",
90
+ expectAttempt: task.attempt,
91
+ expectExecution: task.execution,
92
+ reason: summary
93
+ });
94
+ const result = {
95
+ updated: true,
96
+ prNumber: conflict.prNumber,
97
+ prUrl: conflict.prUrl
98
+ };
99
+ await stores.tasks.transition(taskId, "succeeded", {
100
+ expectFrom: "verifying",
101
+ expectAttempt: verifying.attempt,
102
+ expectExecution: verifying.execution,
103
+ reason: summary,
104
+ output: {
105
+ ...result,
106
+ summary
107
+ }
108
+ });
109
+ return result;
110
+ }
111
+ })
112
+ };
113
+ }
114
+ //#endregion
115
+ export { createGitHubMergeConflictTools };
116
+
117
+ //# sourceMappingURL=eve-tools.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eve-tools.mjs","names":[],"sources":["../../src/merge-resolution/eve-tools.ts"],"sourcesContent":["import { fetchGitHubRefs, pushGitHubHead, type GitHubGitTransport } from \"../github-transfer\";\nimport { z } from \"zod\";\nimport { requireTaskExecution } from \"../eve/task-execution\";\nimport { taskIdSchema, type TaskId } from \"../schema/id\";\nimport type { FactoryStores } from \"../store/engine\";\nimport { defineTool, type ToolContext, type ToolDefinition } from \"eve/tools\";\nimport { mergeConflictPayloadSchema, type MergeConflictPayload } from \"./contracts\";\n\n/** Repository, Signal, and Task capabilities required by merge-conflict tools. */\nexport type GitHubMergeConflictToolsStores = Pick<\n FactoryStores,\n \"repositories\" | \"signals\" | \"tasks\"\n>;\n\n/** Configures the credential boundary and checkout location used by merge-conflict tools. */\nexport interface GitHubMergeConflictToolsOptions {\n git: GitHubGitTransport;\n repoPath?: string;\n}\n\n/** Merge-conflict Task selected for trusted pull-request reproduction. */\nexport interface GitHubFetchMergeConflictInput {\n taskId: TaskId;\n}\n\n/** Exact pull-request conflict context and files reproduced in the sandbox. */\nexport type GitHubFetchMergeConflictResult = Readonly<MergeConflictPayload> & {\n readonly conflictedFiles: readonly string[];\n};\n\n/** Tested conflict resolution and summary supplied for trusted publication. */\nexport interface GitHubPublishMergeResolutionInput {\n taskId: TaskId;\n summary: string;\n}\n\n/** Existing pull request updated after a conflict resolution is published. */\nexport interface GitHubPublishMergeResolutionResult {\n readonly updated: true;\n readonly prNumber: number;\n readonly prUrl: string;\n}\n\n/** Tools that reproduce and publish an exact GitHub pull-request conflict resolution. */\nexport interface GitHubMergeConflictTools {\n readonly fetch_merge_conflict: ToolDefinition<\n GitHubFetchMergeConflictInput,\n GitHubFetchMergeConflictResult\n > & {\n execute(\n input: GitHubFetchMergeConflictInput,\n ctx: ToolContext,\n ): Promise<GitHubFetchMergeConflictResult>;\n };\n readonly publish_merge_resolution: ToolDefinition<\n GitHubPublishMergeResolutionInput,\n GitHubPublishMergeResolutionResult\n > & {\n execute(\n input: GitHubPublishMergeResolutionInput,\n ctx: ToolContext,\n ): Promise<GitHubPublishMergeResolutionResult>;\n };\n}\n\n/** Create tools that reproduce an exact pull-request conflict and publish its tested resolution. */\nexport function createGitHubMergeConflictTools(\n stores: GitHubMergeConflictToolsStores,\n options: GitHubMergeConflictToolsOptions,\n): GitHubMergeConflictTools {\n const repoPath = options.repoPath ?? \"repo\";\n\n async function context(\n taskId: z.infer<typeof taskIdSchema>,\n ctx: Parameters<typeof requireTaskExecution>[1],\n ) {\n const task = await requireTaskExecution(stores, ctx, taskId);\n if (task.kind !== \"merge_conflict\")\n throw new Error(`task ${taskId} is ${task.kind}, not merge_conflict`);\n if (task.state !== \"running\") throw new Error(`task ${taskId} is ${task.state}, not running`);\n if (task.origin.signalId === undefined)\n throw new Error(`task ${taskId} has no conflict signal`);\n const signal = await stores.signals.get(task.origin.signalId);\n if (\n signal === null ||\n signal.source !== \"github_merge_conflict\" ||\n signal.outcome !== \"accepted\"\n ) {\n throw new Error(`task ${taskId} has no GitHub merge conflict signal`);\n }\n if (\n task.replyTo.channel !== signal.replyTo.channel ||\n task.replyTo.address !== signal.replyTo.address\n ) {\n throw new Error(`task ${taskId} reply destination does not match its conflict signal`);\n }\n if (task.repositoryIds.length !== 1 || task.repositoryIds[0] !== signal.repositoryId) {\n throw new Error(`task ${taskId} repository does not match its conflict signal`);\n }\n const repository = await stores.repositories.get(signal.repositoryId);\n const conflict = mergeConflictPayloadSchema.parse(signal.payload);\n if (!repository?.enabled || repository.slug !== conflict.repository.toLowerCase()) {\n throw new Error(`task ${taskId} conflict repository is not enabled or does not match`);\n }\n return { task, conflict: { ...conflict, repository: repository.slug } };\n }\n\n return {\n fetch_merge_conflict: defineTool({\n description:\n \"Fetch the conflicted factory pull request and its current base, check out the PR head, and start the merge. Resolve every file returned in conflictedFiles, then test and commit the merge.\",\n inputSchema: z.object({ taskId: taskIdSchema }),\n async execute({ taskId }, ctx): Promise<GitHubFetchMergeConflictResult> {\n await context(taskId, ctx);\n const sandbox = await ctx.getSandbox();\n const { conflict } = await context(taskId, ctx);\n const git = `git -C ${repoPath}`;\n const headRef = `refs/remotes/origin/conflict-pr-${conflict.prNumber}`;\n const baseRef = `refs/remotes/origin/conflict-base-${conflict.prNumber}`;\n await fetchGitHubRefs({\n sandbox,\n transport: options.git,\n repository: conflict.repository,\n refs: [\n { remote: `refs/pull/${conflict.prNumber}/head`, local: headRef },\n { remote: `refs/heads/${conflict.baseBranch}`, local: baseRef },\n ],\n repositoryPath: repoPath,\n });\n const fetched = await sandbox.run({\n command: `${git} rev-parse ${headRef} && ${git} rev-parse ${baseRef}`,\n });\n const [headSha, baseSha] = fetched.stdout.trim().split(\"\\n\");\n if (headSha !== conflict.headSha || baseSha !== conflict.baseSha) {\n throw new Error(\n \"pull request or base changed while conflict resolution was starting; retry from a new task\",\n );\n }\n await sandbox.run({ command: `${git} checkout -B conflict-pr ${headRef}` });\n const merge = await sandbox.run({ command: `${git} merge --no-commit --no-ff ${baseRef}` });\n const conflicts = await sandbox.run({ command: `${git} diff --name-only --diff-filter=U` });\n const conflictedFiles = conflicts.stdout.trim().split(\"\\n\").filter(Boolean);\n if (conflictedFiles.length === 0) {\n throw new Error(\n typeof merge.exitCode === \"number\" && merge.exitCode !== 0\n ? `merge failed without file conflicts: ${(merge.stderr ?? \"\").trim()}`\n : \"pull request no longer has merge conflicts\",\n );\n }\n return { ...conflict, conflictedFiles };\n },\n }),\n publish_merge_resolution: defineTool({\n description:\n \"Publish a tested, committed conflict resolution to the existing pull request branch. Fails if the remote branch changed since this task started.\",\n inputSchema: z.object({\n taskId: taskIdSchema,\n summary: z.string().min(1).max(2000),\n }),\n async execute({ taskId, summary }, ctx): Promise<GitHubPublishMergeResolutionResult> {\n await context(taskId, ctx);\n const sandbox = await ctx.getSandbox();\n const git = `git -C ${repoPath}`;\n const clean = await sandbox.run({ command: `${git} status --porcelain` });\n if (clean.stdout.trim() !== \"\")\n throw new Error(\"commit the conflict resolution before publishing\");\n const unresolved = await sandbox.run({\n command: `${git} diff --name-only --diff-filter=U`,\n });\n if (unresolved.stdout.trim() !== \"\") throw new Error(\"merge conflicts remain unresolved\");\n const { task, conflict } = await context(taskId, ctx);\n await pushGitHubHead({\n sandbox,\n transport: options.git,\n repository: conflict.repository,\n branch: conflict.headBranch,\n expectedHead: conflict.headSha,\n repositoryPath: repoPath,\n });\n const verifying = await stores.tasks.transition(taskId, \"verifying\", {\n expectFrom: \"running\",\n expectAttempt: task.attempt,\n expectExecution: task.execution,\n reason: summary,\n });\n const result = {\n updated: true as const,\n prNumber: conflict.prNumber,\n prUrl: conflict.prUrl,\n };\n await stores.tasks.transition(taskId, \"succeeded\", {\n expectFrom: \"verifying\",\n expectAttempt: verifying.attempt,\n expectExecution: verifying.execution,\n reason: summary,\n output: { ...result, summary },\n });\n return result;\n },\n }),\n };\n}\n"],"mappings":"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"}
@@ -0,0 +1,49 @@
1
+ import { RepositoryId, SignalId, TaskId } from "../schema/id.mjs";
2
+ import { AgentRouteBinding } from "../schema/agent-route.mjs";
3
+ import { Task } from "../schema/task.mjs";
4
+ import "../agent-routes.mjs";
5
+ import { ReplyTo } from "../schema/common.mjs";
6
+ import { FactoryStores } from "../store/engine.mjs";
7
+ //#region src/multi-repository-changes/coordination.d.ts
8
+ /** Task and workflow capabilities required to create a multi-repository change plan. */
9
+ type CreateMultiRepositoryChangeTasksStores = Pick<FactoryStores, "tasks" | "work">;
10
+ /** Task graph and Task capabilities required to reconcile a multi-repository change plan. */
11
+ type ReconcileMultiRepositoryChangeTasksStores = Pick<FactoryStores, "graphs" | "tasks">;
12
+ interface CreateMultiRepositoryChangeTasksInputBase {
13
+ repositoryIds: readonly [RepositoryId, ...RepositoryId[]];
14
+ replyTo: ReplyTo;
15
+ childRoute?: AgentRouteBinding;
16
+ /** Same key recreates neither the parent nor its repository-scoped children. */
17
+ dedupeKey?: string;
18
+ }
19
+ /** Repository scope and exclusive Signal or operator provenance for coordination admission. */
20
+ type CreateMultiRepositoryChangeTasksInput = CreateMultiRepositoryChangeTasksInputBase & ({
21
+ signalId: SignalId;
22
+ operator?: never;
23
+ } | {
24
+ operator: string;
25
+ signalId?: never;
26
+ });
27
+ /** A coordination parent and its repository-scoped child Tasks. */
28
+ interface MultiRepositoryChangePlan {
29
+ parent: Task;
30
+ children: readonly Task[];
31
+ }
32
+ /** Current aggregate state and any parent transition performed by reconciliation. */
33
+ type ReconcileMultiRepositoryChangeTasksResult = {
34
+ status: "pending";
35
+ parent: Task;
36
+ children: readonly Task[];
37
+ } | {
38
+ status: "succeeded" | "failed";
39
+ transitioned: boolean;
40
+ parent: Task;
41
+ children: readonly Task[];
42
+ };
43
+ /** Supplied workflow: one waiting parent and one routed child per distinct repository. */
44
+ declare function createMultiRepositoryChangeTasks(stores: CreateMultiRepositoryChangeTasksStores, input: CreateMultiRepositoryChangeTasksInput): Promise<MultiRepositoryChangePlan>;
45
+ /** All direct children succeeding is this supplied workflow's policy, not a core Task invariant. */
46
+ declare function reconcileMultiRepositoryChangeTasks(stores: ReconcileMultiRepositoryChangeTasksStores, parentTaskId: TaskId): Promise<ReconcileMultiRepositoryChangeTasksResult>;
47
+ //#endregion
48
+ export { CreateMultiRepositoryChangeTasksInput, CreateMultiRepositoryChangeTasksStores, MultiRepositoryChangePlan, ReconcileMultiRepositoryChangeTasksResult, ReconcileMultiRepositoryChangeTasksStores, createMultiRepositoryChangeTasks, reconcileMultiRepositoryChangeTasks };
49
+ //# sourceMappingURL=coordination.d.mts.map
@@ -0,0 +1,115 @@
1
+ import { repositoryScope } from "../schema/id.mjs";
2
+ import { parseAgentRouteBinding } from "../schema/agent-route.mjs";
3
+ import { taskWork } from "../schema/work.mjs";
4
+ import { routeTaskWork } from "../agent-routes.mjs";
5
+ import { RecordNotFoundError } from "../store/driver.mjs";
6
+ //#region src/multi-repository-changes/coordination.ts
7
+ /** Supplied workflow: one waiting parent and one routed child per distinct repository. */
8
+ async function createMultiRepositoryChangeTasks(stores, input) {
9
+ const repositoryIds = [...new Set(input.repositoryIds)];
10
+ const firstRepositoryId = repositoryIds[0];
11
+ if (firstRepositoryId === void 0) throw new Error("coordination requires at least one repository");
12
+ const scope = repositoryScope(firstRepositoryId, ...repositoryIds.slice(1));
13
+ const childRoute = input.childRoute ?? parseAgentRouteBinding({
14
+ id: "code-change",
15
+ version: 1
16
+ });
17
+ const childBinding = {
18
+ id: childRoute.id,
19
+ version: childRoute.version
20
+ };
21
+ const parent = await stores.tasks.create({
22
+ repositoryIds: scope,
23
+ kind: "coordination",
24
+ work: taskWork({
25
+ title: "Coordinate repository work",
26
+ input: {
27
+ repositoryIds: scope,
28
+ childRoute: childBinding
29
+ }
30
+ }),
31
+ origin: input.signalId === void 0 ? { operator: input.operator } : { signalId: input.signalId },
32
+ replyTo: input.replyTo,
33
+ dedupeKey: input.dedupeKey
34
+ });
35
+ const children = await Promise.all(repositoryIds.map((repositoryId) => stores.tasks.create({
36
+ repositoryIds: [repositoryId],
37
+ kind: "code_change",
38
+ work: routeTaskWork({
39
+ route: childRoute,
40
+ title: `Coordinate changes in ${repositoryId}`
41
+ }),
42
+ origin: {},
43
+ parentTaskId: parent.id,
44
+ replyTo: input.replyTo,
45
+ dedupeKey: input.dedupeKey === void 0 ? void 0 : `${input.dedupeKey}:${repositoryId}`
46
+ })));
47
+ const running = parent.state === "queued" ? await stores.tasks.transition(parent.id, "running", { reason: "repository-scoped child tasks created" }) : parent;
48
+ return {
49
+ parent: running.state === "running" ? await stores.work.waitForMessages({
50
+ task: {
51
+ taskId: running.id,
52
+ attempt: running.attempt
53
+ },
54
+ phase: "children"
55
+ }) : running,
56
+ children
57
+ };
58
+ }
59
+ /** All direct children succeeding is this supplied workflow's policy, not a core Task invariant. */
60
+ async function reconcileMultiRepositoryChangeTasks(stores, parentTaskId) {
61
+ const parent = await stores.tasks.get(parentTaskId);
62
+ if (parent === null) throw new RecordNotFoundError("tasks", parentTaskId);
63
+ if (parent.kind !== "coordination") throw new Error(`task ${parentTaskId} is ${parent.kind}, not coordination`);
64
+ const graph = await stores.graphs.get(parent.rootTaskId);
65
+ if (graph === null) throw new RecordNotFoundError("taskGraphs", parent.rootTaskId);
66
+ const nodes = graph.nodes.filter((node) => node.parentTaskId === parentTaskId);
67
+ const children = (await Promise.all(nodes.map((node) => stores.tasks.get(node.taskId)))).filter((task) => task !== null);
68
+ if (parent.state === "succeeded" || parent.state === "failed") return {
69
+ status: parent.state,
70
+ transitioned: false,
71
+ parent,
72
+ children
73
+ };
74
+ if (parent.state !== "running" || !parent.waitingForMessages || children.length !== nodes.length || children.length < parent.repositoryIds.length) return {
75
+ status: "pending",
76
+ parent,
77
+ children
78
+ };
79
+ if (children.some((child) => child.state === "failed" || child.state === "cancelled")) return {
80
+ status: "failed",
81
+ transitioned: true,
82
+ parent: await stores.tasks.transition(parent.id, "failed", {
83
+ reason: "one or more repository tasks failed",
84
+ expectFrom: "running",
85
+ expectAttempt: parent.attempt
86
+ }),
87
+ children
88
+ };
89
+ if (!children.every((child) => child.state === "succeeded")) return {
90
+ status: "pending",
91
+ parent,
92
+ children
93
+ };
94
+ return {
95
+ status: "succeeded",
96
+ transitioned: true,
97
+ parent: await stores.tasks.transition(parent.id, "succeeded", {
98
+ reason: "aggregate repository work is complete",
99
+ expectFrom: "running",
100
+ expectAttempt: parent.attempt,
101
+ output: {
102
+ summary: "All direct child tasks succeeded.",
103
+ children: children.map((child) => ({
104
+ taskId: child.id,
105
+ output: child.workResult.output
106
+ }))
107
+ }
108
+ }),
109
+ children
110
+ };
111
+ }
112
+ //#endregion
113
+ export { createMultiRepositoryChangeTasks, reconcileMultiRepositoryChangeTasks };
114
+
115
+ //# sourceMappingURL=coordination.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordination.mjs","names":[],"sources":["../../src/multi-repository-changes/coordination.ts"],"sourcesContent":["import { parseAgentRouteBinding, routeTaskWork, type AgentRouteBinding } from \"../agent-routes\";\nimport type { ReplyTo } from \"../schema/common\";\nimport { repositoryScope, type RepositoryId, type SignalId, type TaskId } from \"../schema/id\";\nimport type { Task } from \"../schema/task\";\nimport { taskWork } from \"../schema/work\";\nimport { RecordNotFoundError } from \"../store/driver\";\nimport type { FactoryStores } from \"../store/engine\";\n\n/** Task and workflow capabilities required to create a multi-repository change plan. */\nexport type CreateMultiRepositoryChangeTasksStores = Pick<FactoryStores, \"tasks\" | \"work\">;\n\n/** Task graph and Task capabilities required to reconcile a multi-repository change plan. */\nexport type ReconcileMultiRepositoryChangeTasksStores = Pick<FactoryStores, \"graphs\" | \"tasks\">;\n\ninterface CreateMultiRepositoryChangeTasksInputBase {\n repositoryIds: readonly [RepositoryId, ...RepositoryId[]];\n replyTo: ReplyTo;\n childRoute?: AgentRouteBinding;\n /** Same key recreates neither the parent nor its repository-scoped children. */\n dedupeKey?: string;\n}\n\n/** Repository scope and exclusive Signal or operator provenance for coordination admission. */\nexport type CreateMultiRepositoryChangeTasksInput = CreateMultiRepositoryChangeTasksInputBase &\n ({ signalId: SignalId; operator?: never } | { operator: string; signalId?: never });\n\n/** A coordination parent and its repository-scoped child Tasks. */\nexport interface MultiRepositoryChangePlan {\n parent: Task;\n children: readonly Task[];\n}\n\n/** Current aggregate state and any parent transition performed by reconciliation. */\nexport type ReconcileMultiRepositoryChangeTasksResult =\n | { status: \"pending\"; parent: Task; children: readonly Task[] }\n | {\n status: \"succeeded\" | \"failed\";\n transitioned: boolean;\n parent: Task;\n children: readonly Task[];\n };\n\n/** Supplied workflow: one waiting parent and one routed child per distinct repository. */\nexport async function createMultiRepositoryChangeTasks(\n stores: CreateMultiRepositoryChangeTasksStores,\n input: CreateMultiRepositoryChangeTasksInput,\n): Promise<MultiRepositoryChangePlan> {\n const repositoryIds = [...new Set(input.repositoryIds)];\n const firstRepositoryId = repositoryIds[0];\n if (firstRepositoryId === undefined)\n throw new Error(\"coordination requires at least one repository\");\n const scope = repositoryScope(firstRepositoryId, ...repositoryIds.slice(1));\n const childRoute = input.childRoute ?? parseAgentRouteBinding({ id: \"code-change\", version: 1 });\n const childBinding = { id: childRoute.id, version: childRoute.version };\n const parent = await stores.tasks.create({\n repositoryIds: scope,\n kind: \"coordination\",\n work: taskWork({\n title: \"Coordinate repository work\",\n input: {\n repositoryIds: scope,\n childRoute: childBinding,\n },\n }),\n origin:\n input.signalId === undefined ? { operator: input.operator } : { signalId: input.signalId },\n replyTo: input.replyTo,\n dedupeKey: input.dedupeKey,\n });\n const children = await Promise.all(\n repositoryIds.map((repositoryId) =>\n stores.tasks.create({\n repositoryIds: [repositoryId],\n kind: \"code_change\",\n work: routeTaskWork({ route: childRoute, title: `Coordinate changes in ${repositoryId}` }),\n origin: {},\n parentTaskId: parent.id,\n replyTo: input.replyTo,\n dedupeKey: input.dedupeKey === undefined ? undefined : `${input.dedupeKey}:${repositoryId}`,\n }),\n ),\n );\n const running =\n parent.state === \"queued\"\n ? await stores.tasks.transition(parent.id, \"running\", {\n reason: \"repository-scoped child tasks created\",\n })\n : parent;\n const waiting =\n running.state === \"running\"\n ? await stores.work.waitForMessages({\n task: { taskId: running.id, attempt: running.attempt },\n phase: \"children\",\n })\n : running;\n return { parent: waiting, children };\n}\n\n/** All direct children succeeding is this supplied workflow's policy, not a core Task invariant. */\nexport async function reconcileMultiRepositoryChangeTasks(\n stores: ReconcileMultiRepositoryChangeTasksStores,\n parentTaskId: TaskId,\n): Promise<ReconcileMultiRepositoryChangeTasksResult> {\n const parent = await stores.tasks.get(parentTaskId);\n if (parent === null) throw new RecordNotFoundError(\"tasks\", parentTaskId);\n if (parent.kind !== \"coordination\") {\n throw new Error(`task ${parentTaskId} is ${parent.kind}, not coordination`);\n }\n const graph = await stores.graphs.get(parent.rootTaskId);\n if (graph === null) throw new RecordNotFoundError(\"taskGraphs\", parent.rootTaskId);\n const nodes = graph.nodes.filter((node) => node.parentTaskId === parentTaskId);\n const rows = await Promise.all(nodes.map((node) => stores.tasks.get(node.taskId)));\n const children = rows.filter((task): task is Task => task !== null);\n if (parent.state === \"succeeded\" || parent.state === \"failed\") {\n return { status: parent.state, transitioned: false, parent, children };\n }\n if (\n parent.state !== \"running\" ||\n !parent.waitingForMessages ||\n children.length !== nodes.length ||\n children.length < parent.repositoryIds.length\n ) {\n return { status: \"pending\", parent, children };\n }\n if (children.some((child) => child.state === \"failed\" || child.state === \"cancelled\")) {\n const failed = await stores.tasks.transition(parent.id, \"failed\", {\n reason: \"one or more repository tasks failed\",\n expectFrom: \"running\",\n expectAttempt: parent.attempt,\n });\n return { status: \"failed\", transitioned: true, parent: failed, children };\n }\n if (!children.every((child) => child.state === \"succeeded\")) {\n return { status: \"pending\", parent, children };\n }\n const succeeded = await stores.tasks.transition(parent.id, \"succeeded\", {\n reason: \"aggregate repository work is complete\",\n expectFrom: \"running\",\n expectAttempt: parent.attempt,\n output: {\n summary: \"All direct child tasks succeeded.\",\n children: children.map((child) => ({ taskId: child.id, output: child.workResult!.output })),\n },\n });\n return { status: \"succeeded\", transitioned: true, parent: succeeded, children };\n}\n"],"mappings":"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"}