@vercel/factory 0.0.14 → 0.0.16

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 (510) hide show
  1. package/CHANGELOG.md +356 -0
  2. package/README.md +96 -2
  3. package/dist/agent-routes.d.mts +113 -0
  4. package/dist/agent-routes.mjs +91 -0
  5. package/dist/agent-routes.mjs.map +1 -0
  6. package/dist/api-contracts.d.mts +1768 -0
  7. package/dist/api-contracts.mjs +119 -0
  8. package/dist/api-contracts.mjs.map +1 -0
  9. package/dist/api-images.d.mts +30 -0
  10. package/dist/api-images.mjs +28 -0
  11. package/dist/api-images.mjs.map +1 -0
  12. package/dist/api-task-graph.mjs +57 -0
  13. package/dist/api-task-graph.mjs.map +1 -0
  14. package/dist/api.d.mts +111 -216
  15. package/dist/api.mjs +1063 -99
  16. package/dist/api.mjs.map +1 -1
  17. package/dist/approval-access.d.mts +39 -0
  18. package/dist/approval-access.mjs +62 -0
  19. package/dist/approval-access.mjs.map +1 -0
  20. package/dist/approval-contracts.d.mts +698 -0
  21. package/dist/approval-contracts.mjs +27 -0
  22. package/dist/approval-contracts.mjs.map +1 -0
  23. package/dist/approval.d.mts +49 -0
  24. package/dist/approval.mjs +39 -0
  25. package/dist/approval.mjs.map +1 -0
  26. package/dist/blob/artifacts.d.mts +37 -0
  27. package/dist/blob/artifacts.mjs +45 -0
  28. package/dist/blob/artifacts.mjs.map +1 -0
  29. package/dist/blob/index.d.mts +84 -12
  30. package/dist/blob/index.mjs +179 -45
  31. package/dist/blob/index.mjs.map +1 -1
  32. package/dist/budget.d.mts +115 -0
  33. package/dist/budget.mjs +147 -0
  34. package/dist/budget.mjs.map +1 -0
  35. package/dist/budgets.d.mts +4 -0
  36. package/dist/budgets.mjs +4 -0
  37. package/dist/build-factory.d.mts +7 -4
  38. package/dist/build-factory.mjs +2 -1
  39. package/dist/build-factory.mjs.map +1 -1
  40. package/dist/change-verification/brief.d.mts +9 -0
  41. package/dist/change-verification/brief.mjs +13 -0
  42. package/dist/change-verification/brief.mjs.map +1 -0
  43. package/dist/change-verification/dispatch.d.mts +37 -0
  44. package/dist/change-verification/dispatch.mjs +83 -0
  45. package/dist/change-verification/dispatch.mjs.map +1 -0
  46. package/dist/change-verification/eve-tool.d.mts +61 -0
  47. package/dist/change-verification/eve-tool.mjs +89 -0
  48. package/dist/change-verification/eve-tool.mjs.map +1 -0
  49. package/dist/change-verification/result.mjs +130 -0
  50. package/dist/change-verification/result.mjs.map +1 -0
  51. package/dist/changes/eve-record-change.d.mts +56 -0
  52. package/dist/changes/eve-record-change.mjs +131 -0
  53. package/dist/changes/eve-record-change.mjs.map +1 -0
  54. package/dist/changes/presentation.d.mts +14 -0
  55. package/dist/changes.d.mts +24 -0
  56. package/dist/changes.mjs +29 -0
  57. package/dist/changes.mjs.map +1 -0
  58. package/dist/client-events.d.mts +25 -0
  59. package/dist/client-events.mjs +45 -0
  60. package/dist/client-events.mjs.map +1 -0
  61. package/dist/client-stream.d.mts +28 -0
  62. package/dist/client-stream.mjs +210 -0
  63. package/dist/client-stream.mjs.map +1 -0
  64. package/dist/client-transcript.d.mts +41 -0
  65. package/dist/client-transcript.mjs +233 -0
  66. package/dist/client-transcript.mjs.map +1 -0
  67. package/dist/client.d.mts +343 -0
  68. package/dist/client.mjs +366 -0
  69. package/dist/client.mjs.map +1 -0
  70. package/dist/code-review/contracts.d.mts +27 -0
  71. package/dist/code-review/eve-post-review.d.mts +70 -0
  72. package/dist/code-review/eve-post-review.mjs +195 -0
  73. package/dist/code-review/eve-post-review.mjs.map +1 -0
  74. package/dist/code-review/eve-review-comments.d.mts +75 -0
  75. package/dist/code-review/eve-review-comments.mjs +193 -0
  76. package/dist/code-review/eve-review-comments.mjs.map +1 -0
  77. package/dist/code-review/github-contracts.d.mts +10 -0
  78. package/dist/code-review/github-reporter.d.mts +46 -0
  79. package/dist/code-review/github-reporter.mjs +262 -0
  80. package/dist/code-review/github-reporter.mjs.map +1 -0
  81. package/dist/code-review/preparation.d.mts +34 -0
  82. package/dist/code-review/preparation.mjs +23 -0
  83. package/dist/code-review/preparation.mjs.map +1 -0
  84. package/dist/code-review/stall.d.mts +17 -0
  85. package/dist/code-review/stall.mjs +30 -0
  86. package/dist/code-review/stall.mjs.map +1 -0
  87. package/dist/code-review.d.mts +7 -0
  88. package/dist/code-review.mjs +5 -0
  89. package/dist/communication.d.mts +9 -0
  90. package/dist/communication.mjs +9 -0
  91. package/dist/connectors/github.d.mts +26 -0
  92. package/dist/connectors/github.mjs +55 -0
  93. package/dist/connectors/github.mjs.map +1 -0
  94. package/dist/connectors/index.d.mts +35 -3
  95. package/dist/connectors/index.mjs +3 -52
  96. package/dist/connectors/index.mjs.map +1 -1
  97. package/dist/connectors/outbox.d.mts +34 -0
  98. package/dist/connectors/outbox.mjs +50 -0
  99. package/dist/connectors/outbox.mjs.map +1 -0
  100. package/dist/connectors/slack-approval-blocks.mjs +136 -0
  101. package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
  102. package/dist/connectors/slack-approvals.d.mts +29 -0
  103. package/dist/connectors/slack-approvals.mjs +346 -0
  104. package/dist/connectors/slack-approvals.mjs.map +1 -0
  105. package/dist/connectors/slack.d.mts +35 -52
  106. package/dist/connectors/slack.mjs +13 -85
  107. package/dist/connectors/slack.mjs.map +1 -1
  108. package/dist/deepsec/eve-tool.d.mts +110 -0
  109. package/dist/deepsec/eve-tool.mjs +166 -0
  110. package/dist/deepsec/eve-tool.mjs.map +1 -0
  111. package/dist/deepsec/finding.d.mts +84 -0
  112. package/dist/deepsec/finding.mjs +56 -0
  113. package/dist/deepsec/finding.mjs.map +1 -0
  114. package/dist/deepsec.d.mts +3 -0
  115. package/dist/delivery-metrics/metrics.d.mts +93 -0
  116. package/dist/delivery-metrics/metrics.mjs +200 -0
  117. package/dist/delivery-metrics/metrics.mjs.map +1 -0
  118. package/dist/delivery-metrics.d.mts +2 -0
  119. package/dist/delivery-metrics.mjs +2 -0
  120. package/dist/dispatch.d.mts +152 -0
  121. package/dist/dispatch.mjs +199 -0
  122. package/dist/dispatch.mjs.map +1 -0
  123. package/dist/errors.d.mts +15 -0
  124. package/dist/errors.mjs +38 -0
  125. package/dist/errors.mjs.map +1 -0
  126. package/dist/eve/index.d.mts +209 -1277
  127. package/dist/eve/index.mjs +312 -1073
  128. package/dist/eve/index.mjs.map +1 -1
  129. package/dist/eve/invoke.d.mts +144 -0
  130. package/dist/eve/invoke.mjs +254 -0
  131. package/dist/eve/invoke.mjs.map +1 -0
  132. package/dist/eve/session-client.d.mts +186 -0
  133. package/dist/eve/session-client.mjs +245 -0
  134. package/dist/eve/session-client.mjs.map +1 -0
  135. package/dist/eve/task-execution.d.mts +380 -0
  136. package/dist/eve/task-execution.mjs +73 -0
  137. package/dist/eve/task-execution.mjs.map +1 -0
  138. package/dist/eve/task-session.d.mts +129 -0
  139. package/dist/eve/task-session.mjs +245 -0
  140. package/dist/eve/task-session.mjs.map +1 -0
  141. package/dist/eve/transcript.d.mts +37 -0
  142. package/dist/eve/transcript.mjs +69 -0
  143. package/dist/eve/transcript.mjs.map +1 -0
  144. package/dist/execution-public.d.mts +8 -0
  145. package/dist/execution-public.mjs +7 -0
  146. package/dist/execution.d.mts +183 -0
  147. package/dist/execution.mjs +223 -0
  148. package/dist/execution.mjs.map +1 -0
  149. package/dist/finding-remediation/admission.d.mts +53 -0
  150. package/dist/finding-remediation/admission.mjs +90 -0
  151. package/dist/finding-remediation/admission.mjs.map +1 -0
  152. package/dist/finding-remediation/brief.d.mts +14 -0
  153. package/dist/finding-remediation/brief.mjs +25 -0
  154. package/dist/finding-remediation/brief.mjs.map +1 -0
  155. package/dist/finding-remediation/eve-tool.d.mts +29 -0
  156. package/dist/finding-remediation/eve-tool.mjs +34 -0
  157. package/dist/finding-remediation/eve-tool.mjs.map +1 -0
  158. package/dist/findings/fingerprint.d.mts +14 -0
  159. package/dist/findings/fingerprint.mjs +28 -0
  160. package/dist/findings/fingerprint.mjs.map +1 -0
  161. package/dist/findings.d.mts +7 -0
  162. package/dist/findings.mjs +6 -0
  163. package/dist/github-app.d.mts +54 -0
  164. package/dist/github-app.mjs +121 -0
  165. package/dist/github-app.mjs.map +1 -0
  166. package/dist/github-publication.d.mts +199 -0
  167. package/dist/github-publication.mjs +442 -0
  168. package/dist/github-publication.mjs.map +1 -0
  169. package/dist/github-transfer.d.mts +81 -0
  170. package/dist/github-transfer.mjs +273 -0
  171. package/dist/github-transfer.mjs.map +1 -0
  172. package/dist/github.d.mts +446 -2
  173. package/dist/github.mjs +357 -56
  174. package/dist/github.mjs.map +1 -1
  175. package/dist/image-input.d.mts +51 -0
  176. package/dist/image-input.mjs +63 -0
  177. package/dist/image-input.mjs.map +1 -0
  178. package/dist/inbox-activity.d.mts +53 -0
  179. package/dist/inbox-activity.mjs +41 -0
  180. package/dist/inbox-activity.mjs.map +1 -0
  181. package/dist/index.d.mts +16 -484
  182. package/dist/index.mjs +15 -522
  183. package/dist/intake-contracts.d.mts +55 -0
  184. package/dist/intake-contracts.mjs +33 -0
  185. package/dist/intake-contracts.mjs.map +1 -0
  186. package/dist/integrations/deepsec.d.mts +5 -0
  187. package/dist/integrations/deepsec.mjs +3 -0
  188. package/dist/integrations/github.d.mts +11 -0
  189. package/dist/integrations/github.mjs +9 -0
  190. package/dist/integrations/slack.d.mts +5 -0
  191. package/dist/integrations/slack.mjs +5 -0
  192. package/dist/integrations/vercel.d.mts +5 -0
  193. package/dist/integrations/vercel.mjs +4 -0
  194. package/dist/merge-resolution/contracts.d.mts +17 -0
  195. package/dist/merge-resolution/contracts.mjs +19 -0
  196. package/dist/merge-resolution/contracts.mjs.map +1 -0
  197. package/dist/merge-resolution/eve-tools.d.mts +47 -0
  198. package/dist/merge-resolution/eve-tools.mjs +122 -0
  199. package/dist/merge-resolution/eve-tools.mjs.map +1 -0
  200. package/dist/model-settings.d.mts +41 -0
  201. package/dist/model-settings.mjs +35 -0
  202. package/dist/model-settings.mjs.map +1 -0
  203. package/dist/multi-repository-changes/coordination.d.mts +49 -0
  204. package/dist/multi-repository-changes/coordination.mjs +115 -0
  205. package/dist/multi-repository-changes/coordination.mjs.map +1 -0
  206. package/dist/planning/cancellation.mjs +82 -0
  207. package/dist/planning/cancellation.mjs.map +1 -0
  208. package/dist/planning/configuration.d.mts +23 -0
  209. package/dist/planning/configuration.mjs +56 -0
  210. package/dist/planning/configuration.mjs.map +1 -0
  211. package/dist/planning/contracts.d.mts +136 -0
  212. package/dist/planning/contracts.mjs +42 -0
  213. package/dist/planning/contracts.mjs.map +1 -0
  214. package/dist/planning/dependencies.mjs +44 -0
  215. package/dist/planning/dependencies.mjs.map +1 -0
  216. package/dist/planning/effects.mjs +122 -0
  217. package/dist/planning/effects.mjs.map +1 -0
  218. package/dist/planning/reconcile.mjs +279 -0
  219. package/dist/planning/reconcile.mjs.map +1 -0
  220. package/dist/planning/runtime.d.mts +27 -0
  221. package/dist/planning/runtime.mjs +25 -0
  222. package/dist/planning/runtime.mjs.map +1 -0
  223. package/dist/planning/state.mjs +92 -0
  224. package/dist/planning/state.mjs.map +1 -0
  225. package/dist/planning/turns.mjs +262 -0
  226. package/dist/planning/turns.mjs.map +1 -0
  227. package/dist/planning/validation.mjs +106 -0
  228. package/dist/planning/validation.mjs.map +1 -0
  229. package/dist/postgres/index.d.mts +48 -1
  230. package/dist/postgres/index.mjs +45 -3
  231. package/dist/postgres/index.mjs.map +1 -1
  232. package/dist/presets/software-development/approval.d.mts +14 -0
  233. package/dist/presets/software-development/approval.mjs +21 -0
  234. package/dist/presets/software-development/approval.mjs.map +1 -0
  235. package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
  236. package/dist/presets/software-development/deepsec-brief.mjs +14 -0
  237. package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
  238. package/dist/presets/software-development/dispatch.d.mts +56 -0
  239. package/dist/presets/software-development/dispatch.mjs +67 -0
  240. package/dist/presets/software-development/dispatch.mjs.map +1 -0
  241. package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
  242. package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
  243. package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
  244. package/dist/presets/software-development/eve.d.mts +18 -0
  245. package/dist/presets/software-development/eve.mjs +19 -0
  246. package/dist/presets/software-development/eve.mjs.map +1 -0
  247. package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
  248. package/dist/presets/software-development/finish-task-policy.mjs +9 -0
  249. package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
  250. package/dist/presets/software-development/recovery.d.mts +32 -0
  251. package/dist/presets/software-development/recovery.mjs +120 -0
  252. package/dist/presets/software-development/recovery.mjs.map +1 -0
  253. package/dist/presets/software-development/task-communication.d.mts +24 -0
  254. package/dist/presets/software-development/task-communication.mjs +157 -0
  255. package/dist/presets/software-development/task-communication.mjs.map +1 -0
  256. package/dist/presets/software-development.d.mts +10 -0
  257. package/dist/presets/software-development.mjs +9 -0
  258. package/dist/pull-requests/contracts.d.mts +72 -0
  259. package/dist/pull-requests/eve-fetch.d.mts +57 -0
  260. package/dist/pull-requests/eve-fetch.mjs +151 -0
  261. package/dist/pull-requests/eve-fetch.mjs.map +1 -0
  262. package/dist/pull-requests/github-label-manager.d.mts +27 -0
  263. package/dist/pull-requests/github-label-manager.mjs +40 -0
  264. package/dist/pull-requests/github-label-manager.mjs.map +1 -0
  265. package/dist/pull-requests/github-publisher.d.mts +67 -0
  266. package/dist/pull-requests/github-publisher.mjs +405 -0
  267. package/dist/pull-requests/github-publisher.mjs.map +1 -0
  268. package/dist/pull-requests.d.mts +6 -0
  269. package/dist/pull-requests.mjs +4 -0
  270. package/dist/receipts.d.mts +4 -0
  271. package/dist/receipts.mjs +3 -0
  272. package/dist/repositories.d.mts +18 -0
  273. package/dist/repositories.mjs +33 -0
  274. package/dist/repositories.mjs.map +1 -0
  275. package/dist/sandbox/command.d.mts +18 -0
  276. package/dist/sandbox/execution-abort.d.mts +16 -0
  277. package/dist/sandbox/execution-abort.mjs +49 -0
  278. package/dist/sandbox/execution-abort.mjs.map +1 -0
  279. package/dist/sandbox/execution-environment.d.mts +25 -0
  280. package/dist/sandbox/execution-run-ledger.d.mts +115 -0
  281. package/dist/sandbox/execution-run-ledger.mjs +209 -0
  282. package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
  283. package/dist/sandbox/execution.d.mts +54 -0
  284. package/dist/sandbox/execution.mjs +228 -0
  285. package/dist/sandbox/execution.mjs.map +1 -0
  286. package/dist/sandbox/harness-runner.d.mts +79 -0
  287. package/dist/sandbox/harness-runner.mjs +162 -0
  288. package/dist/sandbox/harness-runner.mjs.map +1 -0
  289. package/dist/sandbox/index.d.mts +10 -0
  290. package/dist/sandbox/index.mjs +7 -0
  291. package/dist/sandbox/task-environment.d.mts +50 -0
  292. package/dist/sandbox/task-environment.mjs +140 -0
  293. package/dist/sandbox/task-environment.mjs.map +1 -0
  294. package/dist/sandbox/workspace.d.mts +29 -0
  295. package/dist/sandbox/workspace.mjs +28 -0
  296. package/dist/sandbox/workspace.mjs.map +1 -0
  297. package/dist/schema/agent-route.d.mts +40 -0
  298. package/dist/schema/agent-route.mjs +33 -0
  299. package/dist/schema/agent-route.mjs.map +1 -0
  300. package/dist/schema/answer.d.mts +23 -0
  301. package/dist/schema/answer.mjs +21 -0
  302. package/dist/schema/answer.mjs.map +1 -0
  303. package/dist/schema/budget.d.mts +38 -0
  304. package/dist/schema/budget.mjs +30 -0
  305. package/dist/schema/budget.mjs.map +1 -0
  306. package/dist/schema/catalog.mjs +72 -0
  307. package/dist/schema/catalog.mjs.map +1 -0
  308. package/dist/schema/change.d.mts +117 -0
  309. package/dist/schema/change.mjs +68 -0
  310. package/dist/schema/change.mjs.map +1 -0
  311. package/dist/schema/common.d.mts +33 -0
  312. package/dist/{id-BLIkCVue.mjs → schema/common.mjs} +7 -16
  313. package/dist/schema/common.mjs.map +1 -0
  314. package/dist/schema/communication.d.mts +52 -0
  315. package/dist/{communication-Kd9nU5RP.mjs → schema/communication.mjs} +8 -3
  316. package/dist/schema/communication.mjs.map +1 -0
  317. package/dist/schema/execution.d.mts +101 -0
  318. package/dist/schema/execution.mjs +86 -0
  319. package/dist/schema/execution.mjs.map +1 -0
  320. package/dist/schema/factory-config.d.mts +122 -0
  321. package/dist/schema/factory-config.mjs +90 -0
  322. package/dist/schema/factory-config.mjs.map +1 -0
  323. package/dist/schema/finding.d.mts +125 -0
  324. package/dist/schema/finding.mjs +67 -0
  325. package/dist/schema/finding.mjs.map +1 -0
  326. package/dist/schema/id.d.mts +43 -0
  327. package/dist/schema/id.mjs +32 -0
  328. package/dist/schema/id.mjs.map +1 -0
  329. package/dist/schema/outbox.d.mts +240 -0
  330. package/dist/schema/outbox.mjs +53 -0
  331. package/dist/schema/outbox.mjs.map +1 -0
  332. package/dist/schema/question-route.mjs +16 -0
  333. package/dist/schema/question-route.mjs.map +1 -0
  334. package/dist/schema/receipt.d.mts +81 -0
  335. package/dist/schema/receipt.mjs +94 -0
  336. package/dist/schema/receipt.mjs.map +1 -0
  337. package/dist/schema/repository.d.mts +30 -0
  338. package/dist/schema/repository.mjs +29 -0
  339. package/dist/schema/repository.mjs.map +1 -0
  340. package/dist/schema/session.d.mts +136 -0
  341. package/dist/schema/session.mjs +54 -0
  342. package/dist/schema/session.mjs.map +1 -0
  343. package/dist/schema/signal.d.mts +105 -0
  344. package/dist/schema/signal.mjs +81 -0
  345. package/dist/schema/signal.mjs.map +1 -0
  346. package/dist/schema/slack-pr-notifications.d.mts +12 -0
  347. package/dist/schema/slack-pr-notifications.mjs +11 -0
  348. package/dist/schema/slack-pr-notifications.mjs.map +1 -0
  349. package/dist/schema/stored-session.mjs +10 -0
  350. package/dist/schema/stored-session.mjs.map +1 -0
  351. package/dist/schema/stored-task.mjs +20 -0
  352. package/dist/schema/stored-task.mjs.map +1 -0
  353. package/dist/schema/task-effect.d.mts +39 -0
  354. package/dist/schema/task-effect.mjs +29 -0
  355. package/dist/schema/task-effect.mjs.map +1 -0
  356. package/dist/schema/task-graph.d.mts +3173 -0
  357. package/dist/schema/task-graph.mjs +97 -0
  358. package/dist/schema/task-graph.mjs.map +1 -0
  359. package/dist/schema/task-message.d.mts +254 -0
  360. package/dist/schema/task-message.mjs +189 -0
  361. package/dist/schema/task-message.mjs.map +1 -0
  362. package/dist/schema/task.d.mts +273 -0
  363. package/dist/schema/task.mjs +200 -0
  364. package/dist/schema/task.mjs.map +1 -0
  365. package/dist/schema/transcript.d.mts +176 -0
  366. package/dist/schema/transcript.mjs +87 -0
  367. package/dist/schema/transcript.mjs.map +1 -0
  368. package/dist/schema/transitions.d.mts +50 -0
  369. package/dist/schema/transitions.mjs +303 -0
  370. package/dist/schema/transitions.mjs.map +1 -0
  371. package/dist/schema/work.d.mts +150 -0
  372. package/dist/schema/work.mjs +102 -0
  373. package/dist/schema/work.mjs.map +1 -0
  374. package/dist/session-previews.d.mts +76 -0
  375. package/dist/session-previews.mjs +55 -0
  376. package/dist/session-previews.mjs.map +1 -0
  377. package/dist/session-review.d.mts +120 -0
  378. package/dist/session-review.mjs +79 -0
  379. package/dist/session-review.mjs.map +1 -0
  380. package/dist/signal-triage.d.mts +20 -0
  381. package/dist/signal-triage.mjs +85 -0
  382. package/dist/signal-triage.mjs.map +1 -0
  383. package/dist/signals.d.mts +20 -0
  384. package/dist/signals.mjs +19 -0
  385. package/dist/signals.mjs.map +1 -0
  386. package/dist/stall.d.mts +41 -0
  387. package/dist/stall.mjs +83 -0
  388. package/dist/stall.mjs.map +1 -0
  389. package/dist/storage.d.mts +4 -0
  390. package/dist/storage.mjs +4 -0
  391. package/dist/store/driver.d.mts +65 -0
  392. package/dist/store/driver.mjs +42 -0
  393. package/dist/store/driver.mjs.map +1 -0
  394. package/dist/store/engine.d.mts +683 -0
  395. package/dist/store/engine.mjs +2309 -0
  396. package/dist/store/engine.mjs.map +1 -0
  397. package/dist/store/memory.d.mts +24 -0
  398. package/dist/store/memory.mjs +69 -0
  399. package/dist/store/memory.mjs.map +1 -0
  400. package/dist/store/slack-pr-notifications.d.mts +44 -0
  401. package/dist/store/slack-pr-notifications.mjs +121 -0
  402. package/dist/store/slack-pr-notifications.mjs.map +1 -0
  403. package/dist/store/task-effects.d.mts +38 -0
  404. package/dist/store/task-effects.mjs +118 -0
  405. package/dist/store/task-effects.mjs.map +1 -0
  406. package/dist/store/task-graphs.d.mts +60 -0
  407. package/dist/store/task-graphs.mjs +212 -0
  408. package/dist/store/task-graphs.mjs.map +1 -0
  409. package/dist/store/task-messages.d.mts +136 -0
  410. package/dist/store/task-messages.mjs +475 -0
  411. package/dist/store/task-messages.mjs.map +1 -0
  412. package/dist/store/task-work.d.mts +180 -0
  413. package/dist/store/task-work.mjs +137 -0
  414. package/dist/store/task-work.mjs.map +1 -0
  415. package/dist/store/work-notifications.d.mts +19 -0
  416. package/dist/store/work-notifications.mjs +48 -0
  417. package/dist/store/work-notifications.mjs.map +1 -0
  418. package/dist/sweep.d.mts +79 -0
  419. package/dist/sweep.mjs +171 -0
  420. package/dist/sweep.mjs.map +1 -0
  421. package/dist/task-communication.d.mts +35 -0
  422. package/dist/task-communication.mjs +47 -0
  423. package/dist/task-communication.mjs.map +1 -0
  424. package/dist/task-graph-view.d.mts +267 -0
  425. package/dist/task-graph-view.mjs +17 -0
  426. package/dist/task-graph-view.mjs.map +1 -0
  427. package/dist/task-message-processing.d.mts +60 -0
  428. package/dist/task-message-processing.mjs +200 -0
  429. package/dist/task-message-processing.mjs.map +1 -0
  430. package/dist/task-protocols.d.mts +80 -0
  431. package/dist/task-protocols.mjs +47 -0
  432. package/dist/task-protocols.mjs.map +1 -0
  433. package/dist/tasks.d.mts +17 -0
  434. package/dist/tasks.mjs +17 -0
  435. package/dist/vercel-git.d.mts +53 -0
  436. package/dist/vercel-git.mjs +344 -0
  437. package/dist/vercel-git.mjs.map +1 -0
  438. package/dist/vercel-github-api.d.mts +103 -0
  439. package/dist/vercel-github-api.mjs +363 -0
  440. package/dist/vercel-github-api.mjs.map +1 -0
  441. package/dist/vercel.d.mts +34 -2
  442. package/dist/vercel.mjs +49 -3
  443. package/dist/vercel.mjs.map +1 -1
  444. package/dist/work-triage/eve-tool.d.mts +29 -0
  445. package/dist/work-triage/eve-tool.mjs +32 -0
  446. package/dist/work-triage/eve-tool.mjs.map +1 -0
  447. package/dist/work-triage/find-existing-work.d.mts +32 -0
  448. package/dist/work-triage/find-existing-work.mjs +31 -0
  449. package/dist/work-triage/find-existing-work.mjs.map +1 -0
  450. package/dist/work-triage/github.d.mts +15 -0
  451. package/dist/work-triage/github.mjs +14 -0
  452. package/dist/work-triage/github.mjs.map +1 -0
  453. package/dist/work-triage.d.mts +4 -0
  454. package/dist/work-triage.mjs +3 -0
  455. package/dist/workflows.d.mts +146 -0
  456. package/dist/workflows.mjs +139 -0
  457. package/dist/workflows.mjs.map +1 -0
  458. package/dist/workspace-diff-assembly.d.mts +33 -0
  459. package/dist/workspace-diff-assembly.mjs +95 -0
  460. package/dist/workspace-diff-assembly.mjs.map +1 -0
  461. package/dist/workspace-diff.d.mts +90 -0
  462. package/dist/workspace-diff.mjs +61 -0
  463. package/dist/workspace-diff.mjs.map +1 -0
  464. package/dist/workspace-files-git.d.mts +15 -0
  465. package/dist/workspace-files-git.mjs +61 -0
  466. package/dist/workspace-files-git.mjs.map +1 -0
  467. package/dist/workspace-files.d.mts +107 -0
  468. package/dist/workspace-files.mjs +74 -0
  469. package/dist/workspace-files.mjs.map +1 -0
  470. package/dist/workspace-snapshot.d.mts +26 -0
  471. package/dist/workspace-snapshot.mjs +80 -0
  472. package/dist/workspace-snapshot.mjs.map +1 -0
  473. package/docs/getting-started.md +104 -0
  474. package/docs/index.md +100 -0
  475. package/docs/recipes/cancellation.md +215 -0
  476. package/docs/recipes/custom-workflow.md +153 -0
  477. package/docs/recipes/dependent-tasks.md +207 -0
  478. package/docs/recipes/eve-agent.md +277 -0
  479. package/docs/recipes/human-input.md +204 -0
  480. package/docs/recipes/persistence-recovery.md +268 -0
  481. package/docs/recipes/retry-recovery.md +241 -0
  482. package/docs/recipes/task-messaging.md +215 -0
  483. package/docs/recipes/typed-eve-result.md +161 -0
  484. package/docs/runtime-integration.md +137 -0
  485. package/package.json +142 -46
  486. package/dist/approval-JX2Px9IC.mjs +0 -132
  487. package/dist/approval-JX2Px9IC.mjs.map +0 -1
  488. package/dist/budget-DzSiIA4t.mjs +0 -42
  489. package/dist/budget-DzSiIA4t.mjs.map +0 -1
  490. package/dist/change-D2U6v7Ek.mjs +0 -554
  491. package/dist/change-D2U6v7Ek.mjs.map +0 -1
  492. package/dist/communication-Kd9nU5RP.mjs.map +0 -1
  493. package/dist/coordination-Cq08hb1l.mjs +0 -76
  494. package/dist/coordination-Cq08hb1l.mjs.map +0 -1
  495. package/dist/dispatch-BaZS3PT8.d.mts +0 -76
  496. package/dist/driver-BC0Mt5KG.d.mts +0 -34
  497. package/dist/driver-Bbd25rNM.mjs +0 -23
  498. package/dist/driver-Bbd25rNM.mjs.map +0 -1
  499. package/dist/engine-DFHU2Pe-.d.mts +0 -781
  500. package/dist/engine-WaUM2cGA.mjs +0 -1068
  501. package/dist/engine-WaUM2cGA.mjs.map +0 -1
  502. package/dist/factory-config-BoRXOw43.mjs +0 -50
  503. package/dist/factory-config-BoRXOw43.mjs.map +0 -1
  504. package/dist/factory-config-D2yU3G0c.d.mts +0 -58
  505. package/dist/github-C5HNBN6p.d.mts +0 -279
  506. package/dist/id-BLIkCVue.mjs.map +0 -1
  507. package/dist/index-Bw6hggoH.d.mts +0 -40
  508. package/dist/index.mjs.map +0 -1
  509. package/dist/task-CcOyOJ3k.mjs +0 -154
  510. package/dist/task-CcOyOJ3k.mjs.map +0 -1
@@ -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, EnsureGitHubLabelInput, FactoryMentionOptions, FactoryQuestionReply, FactoryReviewComment, GitHubCheckRun, GitHubCiFailureSignal, GitHubDefaultBranchPush, GitHubIssueComment, GitHubIssueCommentRecord, GitHubIssueSignal, GitHubPullRequest, GitHubPullRequestClosed, GitHubPullRequestDiscussionComment, GitHubPullRequestDiscussionPage, GitHubPullRequestDiscussionReview, GitHubPullRequestHead, GitHubPullRequestReference, GitHubPullRequestSignal, GitHubPullRequestTarget, GitHubRepositoryAuthorRequest, GitHubRepositoryRequest, GitHubReviewComment, GitHubReviewCommentAuthorError, IncompleteCheckRunFields, ListCheckRunsForRefInput, ListConflictedPullRequestsInput, ListOpenPullRequestsInput, ListPullRequestCommentsInput, ListPullRequestDiscussionInput, NormalizeFactoryCommentInput, NormalizeFactoryReviewCommentInput, ObservedCheckRunStatus, PullRequestLabelInput, PullRequestReviewComment, PullRequestReviewEvent, ReadReviewCommentInput, ReviewCommentAuthorPolicy, StalePullRequestHeadError, SubmitPullRequestReviewInput, SubmittedPullRequestReview, UpdateCheckRunInput, UpdatePullRequestCommentInput, VerifyGitHubSignatureInput, addLabel, answerReviewComment, closePullRequest, configuredEventRepositorySlug, createCheckRun, createPullRequest, createPullRequestComment, ensureGitHubLabel, hasGitHubRepositoryWriteAccess, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, 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 EnsureGitHubLabelInput, 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 GitHubPullRequestDiscussionComment, type GitHubPullRequestDiscussionPage, type GitHubPullRequestDiscussionReview, 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 ListPullRequestDiscussionInput, type ManageGitHubPullRequestLabelInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, type NormalizeFactoryCommentInput, type NormalizeFactoryReviewCommentInput, 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, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, 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, ensureGitHubLabel, hasGitHubRepositoryWriteAccess, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, 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, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, 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,5 @@
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
+ import { SlackPrNotifications, slackPrNotificationsSchema } from "../schema/slack-pr-notifications.mjs";
4
+ import { SlackPrNotificationSnapshot, SlackPrNotificationStore, SlackPrNotificationStoreOptions, UpdateSlackPrNotificationsInput, createSlackPrNotificationStore } from "../store/slack-pr-notifications.mjs";
5
+ export { type SlackApprovals, type SlackApprovalsOptions, type SlackApprovalsStores, type SlackCommunicationAdapter, type SlackCommunicationAdapterOptions, type SlackCommunicationDelivery, type SlackMessageEvent, type SlackMessageSignal, type SlackPrNotificationSnapshot, type SlackPrNotificationStore, type SlackPrNotificationStoreOptions, type SlackPrNotifications, type SlackReplyTarget, type UpdateSlackPrNotificationsInput, createSlackApprovals, createSlackCommunicationAdapter, createSlackPrNotificationStore, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent, slackPrNotificationsSchema };
@@ -0,0 +1,5 @@
1
+ import { slackPrNotificationsSchema } from "../schema/slack-pr-notifications.mjs";
2
+ import { createSlackApprovals } from "../connectors/slack-approvals.mjs";
3
+ import { createSlackCommunicationAdapter, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent } from "../connectors/slack.mjs";
4
+ import { createSlackPrNotificationStore } from "../store/slack-pr-notifications.mjs";
5
+ export { createSlackApprovals, createSlackCommunicationAdapter, createSlackPrNotificationStore, normalizeSlackMessage, parseSlackReplyAddress, renderSlackCommunicationEvent, slackPrNotificationsSchema };
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { VercelManagedGitHubApi, VercelManagedGitHubApiAction, VercelManagedGitHubApiError, VercelManagedGitHubApiOptions, VercelManagedGitHubApiSandboxCreateInput, VercelManagedGitHubIssue, VercelManagedGitHubIssueInput, VercelManagedGitHubPublication, VercelManagedGitHubPublicationInput, VercelManagedGitHubPullRequest, VercelManagedGitHubPullRequestInput, createVercelManagedGitHubApi } from "../vercel-github-api.mjs";
3
+ import { VercelGitHubGitTransportOptions, VercelGitHubTokenInput, VercelManagedGitHubGitTransportOptions, VercelManagedGitHubSandboxCreateInput, createVercelGitHubGitTransport, createVercelManagedGitHubGitTransport } from "../vercel-git.mjs";
4
+ import { VercelProductionDeployment, VercelQueueSend, VercelQueueSendOptions, VercelWorkQueue, VercelWorkQueueOptions, authenticateVercelUserToken, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature } from "../vercel.mjs";
5
+ export { type VercelGitHubGitTransportOptions, type VercelGitHubTokenInput, type VercelManagedGitHubApi, type VercelManagedGitHubApiAction, VercelManagedGitHubApiError, type VercelManagedGitHubApiOptions, type VercelManagedGitHubApiSandboxCreateInput, type VercelManagedGitHubGitTransportOptions, type VercelManagedGitHubIssue, type VercelManagedGitHubIssueInput, type VercelManagedGitHubPublication, type VercelManagedGitHubPublicationInput, type VercelManagedGitHubPullRequest, type VercelManagedGitHubPullRequestInput, type VercelManagedGitHubSandboxCreateInput, type VercelProductionDeployment, type VercelQueueSend, type VercelQueueSendOptions, type VercelWorkQueue, type VercelWorkQueueOptions, authenticateVercelUserToken, createVercelGitHubGitTransport, createVercelManagedGitHubApi, createVercelManagedGitHubGitTransport, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature };
@@ -0,0 +1,4 @@
1
+ import { VercelManagedGitHubApiError, createVercelManagedGitHubApi } from "../vercel-github-api.mjs";
2
+ import { createVercelGitHubGitTransport, createVercelManagedGitHubGitTransport } from "../vercel-git.mjs";
3
+ import { authenticateVercelUserToken, createVercelWorkQueue, normalizeVercelProductionDeployment, verifyVercelSignature } from "../vercel.mjs";
4
+ export { VercelManagedGitHubApiError, authenticateVercelUserToken, createVercelGitHubGitTransport, createVercelManagedGitHubApi, createVercelManagedGitHubGitTransport, 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,47 @@
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
+ readonly headSha: string;
33
+ }
34
+ /** Tools that reproduce and publish an exact GitHub pull-request conflict resolution. */
35
+ interface GitHubMergeConflictTools {
36
+ readonly fetch_merge_conflict: ToolDefinition<GitHubFetchMergeConflictInput, GitHubFetchMergeConflictResult> & {
37
+ execute(input: GitHubFetchMergeConflictInput, ctx: ToolContext): Promise<GitHubFetchMergeConflictResult>;
38
+ };
39
+ readonly publish_merge_resolution: ToolDefinition<GitHubPublishMergeResolutionInput, GitHubPublishMergeResolutionResult> & {
40
+ execute(input: GitHubPublishMergeResolutionInput, ctx: ToolContext): Promise<GitHubPublishMergeResolutionResult>;
41
+ };
42
+ }
43
+ /** Create tools that reproduce an exact pull-request conflict and publish its tested resolution. */
44
+ declare function createGitHubMergeConflictTools(stores: GitHubMergeConflictToolsStores, options: GitHubMergeConflictToolsOptions): GitHubMergeConflictTools;
45
+ //#endregion
46
+ export { GitHubFetchMergeConflictInput, GitHubFetchMergeConflictResult, GitHubMergeConflictTools, GitHubMergeConflictToolsOptions, GitHubMergeConflictToolsStores, GitHubPublishMergeResolutionInput, GitHubPublishMergeResolutionResult, createGitHubMergeConflictTools };
47
+ //# sourceMappingURL=eve-tools.d.mts.map
@@ -0,0 +1,122 @@
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
+ const headSha = await pushGitHubHead({
81
+ sandbox,
82
+ transport: options.git,
83
+ repository: conflict.repository,
84
+ branch: conflict.headBranch,
85
+ expectedHead: conflict.headSha,
86
+ authorize: async () => {
87
+ const current = await context(taskId, ctx);
88
+ if (current.task.attempt !== task.attempt || current.task.execution?.sessionId !== task.execution?.sessionId || current.conflict.prNumber !== conflict.prNumber || current.conflict.headSha !== conflict.headSha || current.conflict.headBranch !== conflict.headBranch) throw new Error("Merge-conflict publication authority changed during preparation");
89
+ },
90
+ repositoryPath: repoPath
91
+ });
92
+ const verifying = await stores.tasks.transition(taskId, "verifying", {
93
+ expectFrom: "running",
94
+ expectAttempt: task.attempt,
95
+ expectExecution: task.execution,
96
+ reason: summary
97
+ });
98
+ const result = {
99
+ updated: true,
100
+ prNumber: conflict.prNumber,
101
+ prUrl: conflict.prUrl,
102
+ headSha
103
+ };
104
+ await stores.tasks.transition(taskId, "succeeded", {
105
+ expectFrom: "verifying",
106
+ expectAttempt: verifying.attempt,
107
+ expectExecution: verifying.execution,
108
+ reason: summary,
109
+ output: {
110
+ ...result,
111
+ summary
112
+ }
113
+ });
114
+ return result;
115
+ }
116
+ })
117
+ };
118
+ }
119
+ //#endregion
120
+ export { createGitHubMergeConflictTools };
121
+
122
+ //# 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 readonly headSha: 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 const headSha = await pushGitHubHead({\n sandbox,\n transport: options.git,\n repository: conflict.repository,\n branch: conflict.headBranch,\n expectedHead: conflict.headSha,\n authorize: async () => {\n const current = await context(taskId, ctx);\n if (\n current.task.attempt !== task.attempt ||\n current.task.execution?.sessionId !== task.execution?.sessionId ||\n current.conflict.prNumber !== conflict.prNumber ||\n current.conflict.headSha !== conflict.headSha ||\n current.conflict.headBranch !== conflict.headBranch\n ) {\n throw new Error(\"Merge-conflict publication authority changed during preparation\");\n }\n },\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 headSha,\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,41 @@
1
+ import { z } from "zod";
2
+ //#region src/model-settings.d.ts
3
+ /** Validates the available models and application default for one agent. */
4
+ declare const agentModelConfigSchema: z.ZodObject<{
5
+ agent: z.ZodString;
6
+ defaultModel: z.ZodString;
7
+ models: z.ZodReadonly<z.ZodArray<z.ZodObject<{
8
+ id: z.ZodString;
9
+ label: z.ZodString;
10
+ }, z.core.$strict>>>;
11
+ }, z.core.$strict>;
12
+ /** Validates the discovered model catalog and one repository's saved defaults. */
13
+ declare const modelSettingsSchema: z.ZodObject<{
14
+ agents: z.ZodReadonly<z.ZodArray<z.ZodObject<{
15
+ agent: z.ZodString;
16
+ defaultModel: z.ZodString;
17
+ models: z.ZodReadonly<z.ZodArray<z.ZodObject<{
18
+ id: z.ZodString;
19
+ label: z.ZodString;
20
+ }, z.core.$strict>>>;
21
+ }, z.core.$strict>>>;
22
+ repository: z.ZodNullable<z.ZodType<`${string}/${string}`, string, z.core.$ZodTypeInternals<`${string}/${string}`, string>>>;
23
+ defaults: z.ZodRecord<z.ZodString, z.ZodString>;
24
+ revision: z.ZodNumber;
25
+ canEdit: z.ZodBoolean;
26
+ }, z.core.$strict>;
27
+ /** Validates an optimistic update of repository model defaults. */
28
+ declare const updateModelDefaultsSchema: z.ZodObject<{
29
+ repository: z.ZodType<`${string}/${string}`, string, z.core.$ZodTypeInternals<`${string}/${string}`, string>>;
30
+ defaults: z.ZodRecord<z.ZodString, z.ZodString>;
31
+ expectedRevision: z.ZodNumber;
32
+ }, z.core.$strict>;
33
+ /** Application-owned model choices for an agent. */
34
+ type AgentModelConfig = z.infer<typeof agentModelConfigSchema>;
35
+ /** Model discovery and repository preference response. */
36
+ type ModelSettings = z.infer<typeof modelSettingsSchema>;
37
+ /** Compare-and-swap request for repository model preferences. */
38
+ type UpdateModelDefaults = z.infer<typeof updateModelDefaultsSchema>;
39
+ //#endregion
40
+ export { AgentModelConfig, ModelSettings, UpdateModelDefaults, agentModelConfigSchema, modelSettingsSchema, updateModelDefaultsSchema };
41
+ //# sourceMappingURL=model-settings.d.mts.map
@@ -0,0 +1,35 @@
1
+ import { repositorySlugSchema } from "./schema/repository.mjs";
2
+ import { z } from "zod";
3
+ //#region src/model-settings.ts
4
+ /** Validates an opaque application-supported model identifier. */
5
+ const modelIdSchema = z.string().trim().min(1).max(200).describe("Application-owned model identifier.");
6
+ const agentId = z.string().regex(/^[a-z][a-z0-9-]{0,31}$/u);
7
+ /** Validates the available models and application default for one agent. */
8
+ const agentModelConfigSchema = z.strictObject({
9
+ agent: agentId.describe("Agent whose executions use these models."),
10
+ defaultModel: modelIdSchema.describe("Application default when the repository has no override."),
11
+ models: z.array(z.strictObject({
12
+ id: modelIdSchema,
13
+ label: z.string().trim().min(1).describe("Human-readable model name.")
14
+ })).min(1).readonly().describe("Models supported by this agent's execution adapter.")
15
+ }).refine((value) => new Set(value.models.map((model) => model.id)).size === value.models.length && value.models.some((model) => model.id === value.defaultModel), "Models must be unique and include the default");
16
+ /** Validates per-agent repository model overrides; omitted agents inherit their application default. */
17
+ const modelDefaultsSchema = z.record(agentId, modelIdSchema);
18
+ /** Validates the discovered model catalog and one repository's saved defaults. */
19
+ const modelSettingsSchema = z.strictObject({
20
+ agents: z.array(agentModelConfigSchema).readonly().describe("Application-supplied agent catalogs; empty disables model selection."),
21
+ repository: repositorySlugSchema.nullable().describe("Selected repository, or null for application defaults."),
22
+ defaults: modelDefaultsSchema.describe("Saved repository overrides."),
23
+ revision: z.number().int().nonnegative().describe("Repository model settings revision used to reject concurrent edits."),
24
+ canEdit: z.boolean().describe("Whether the authenticated caller can save defaults for this repository.")
25
+ });
26
+ /** Validates an optimistic update of repository model defaults. */
27
+ const updateModelDefaultsSchema = z.strictObject({
28
+ repository: repositorySlugSchema.describe("Configured repository to update."),
29
+ defaults: modelDefaultsSchema.describe("Replacement per-agent overrides; empty restores application defaults."),
30
+ expectedRevision: z.number().int().nonnegative().describe("Revision observed before editing.")
31
+ });
32
+ //#endregion
33
+ export { agentModelConfigSchema, modelSettingsSchema, updateModelDefaultsSchema };
34
+
35
+ //# sourceMappingURL=model-settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-settings.mjs","names":[],"sources":["../src/model-settings.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { repositorySlugSchema } from \"./schema/repository\";\n\n/** Validates an opaque application-supported model identifier. */\nconst modelIdSchema = z\n .string()\n .trim()\n .min(1)\n .max(200)\n .describe(\"Application-owned model identifier.\");\nconst agentId = z.string().regex(/^[a-z][a-z0-9-]{0,31}$/u);\n\n/** Validates the available models and application default for one agent. */\nexport const agentModelConfigSchema = z\n .strictObject({\n agent: agentId.describe(\"Agent whose executions use these models.\"),\n defaultModel: modelIdSchema.describe(\n \"Application default when the repository has no override.\",\n ),\n models: z\n .array(\n z.strictObject({\n id: modelIdSchema,\n label: z.string().trim().min(1).describe(\"Human-readable model name.\"),\n }),\n )\n .min(1)\n .readonly()\n .describe(\"Models supported by this agent's execution adapter.\"),\n })\n .refine(\n (value) =>\n new Set(value.models.map((model) => model.id)).size === value.models.length &&\n value.models.some((model) => model.id === value.defaultModel),\n \"Models must be unique and include the default\",\n );\n\n/** Validates per-agent repository model overrides; omitted agents inherit their application default. */\nconst modelDefaultsSchema = z.record(agentId, modelIdSchema);\n\n/** Validates the discovered model catalog and one repository's saved defaults. */\nexport const modelSettingsSchema = z.strictObject({\n agents: z\n .array(agentModelConfigSchema)\n .readonly()\n .describe(\"Application-supplied agent catalogs; empty disables model selection.\"),\n repository: repositorySlugSchema\n .nullable()\n .describe(\"Selected repository, or null for application defaults.\"),\n defaults: modelDefaultsSchema.describe(\"Saved repository overrides.\"),\n revision: z\n .number()\n .int()\n .nonnegative()\n .describe(\"Repository model settings revision used to reject concurrent edits.\"),\n canEdit: z\n .boolean()\n .describe(\"Whether the authenticated caller can save defaults for this repository.\"),\n});\n\n/** Validates an optimistic update of repository model defaults. */\nexport const updateModelDefaultsSchema = z.strictObject({\n repository: repositorySlugSchema.describe(\"Configured repository to update.\"),\n defaults: modelDefaultsSchema.describe(\n \"Replacement per-agent overrides; empty restores application defaults.\",\n ),\n expectedRevision: z.number().int().nonnegative().describe(\"Revision observed before editing.\"),\n});\n\n/** Application-owned model choices for an agent. */\nexport type AgentModelConfig = z.infer<typeof agentModelConfigSchema>;\n/** Model discovery and repository preference response. */\nexport type ModelSettings = z.infer<typeof modelSettingsSchema>;\n/** Compare-and-swap request for repository model preferences. */\nexport type UpdateModelDefaults = z.infer<typeof updateModelDefaultsSchema>;\n"],"mappings":";;;;AAIA,MAAM,gBAAgB,EACnB,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,SAAS,qCAAqC;AACjD,MAAM,UAAU,EAAE,OAAO,CAAC,CAAC,MAAM,yBAAyB;;AAG1D,MAAa,yBAAyB,EACnC,aAAa;CACZ,OAAO,QAAQ,SAAS,0CAA0C;CAClE,cAAc,cAAc,SAC1B,0DACF;CACA,QAAQ,EACL,MACC,EAAE,aAAa;EACb,IAAI;EACJ,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,4BAA4B;CACvE,CAAC,CACH,CAAC,CACA,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,qDAAqD;AACnE,CAAC,CAAC,CACD,QACE,UACC,IAAI,IAAI,MAAM,OAAO,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,MAAM,OAAO,UACrE,MAAM,OAAO,MAAM,UAAU,MAAM,OAAO,MAAM,YAAY,GAC9D,+CACF;;AAGF,MAAM,sBAAsB,EAAE,OAAO,SAAS,aAAa;;AAG3D,MAAa,sBAAsB,EAAE,aAAa;CAChD,QAAQ,EACL,MAAM,sBAAsB,CAAC,CAC7B,SAAS,CAAC,CACV,SAAS,sEAAsE;CAClF,YAAY,qBACT,SAAS,CAAC,CACV,SAAS,wDAAwD;CACpE,UAAU,oBAAoB,SAAS,6BAA6B;CACpE,UAAU,EACP,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,qEAAqE;CACjF,SAAS,EACN,QAAQ,CAAC,CACT,SAAS,yEAAyE;AACvF,CAAC;;AAGD,MAAa,4BAA4B,EAAE,aAAa;CACtD,YAAY,qBAAqB,SAAS,kCAAkC;CAC5E,UAAU,oBAAoB,SAC5B,uEACF;CACA,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,mCAAmC;AAC/F,CAAC"}
@@ -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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"}