@vercel/factory 0.0.14 → 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 (467) hide show
  1. package/README.md +306 -0
  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 +68 -216
  14. package/dist/api.mjs +872 -97
  15. package/dist/api.mjs.map +1 -1
  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 +41 -6
  29. package/dist/blob/index.mjs +158 -40
  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 -3
  92. package/dist/connectors/index.mjs +3 -52
  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 -52
  103. package/dist/connectors/slack.mjs +13 -85
  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 -1271
  124. package/dist/eve/index.mjs +233 -1065
  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 +239 -40
  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 -484
  175. package/dist/index.mjs +14 -522
  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-BLIkCVue.mjs → schema/common.mjs} +7 -16
  303. package/dist/schema/common.mjs.map +1 -0
  304. package/dist/schema/communication.d.mts +52 -0
  305. package/dist/{communication-Kd9nU5RP.mjs → schema/communication.mjs} +8 -3
  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 -44
  443. package/dist/approval-JX2Px9IC.mjs +0 -132
  444. package/dist/approval-JX2Px9IC.mjs.map +0 -1
  445. package/dist/budget-DzSiIA4t.mjs +0 -42
  446. package/dist/budget-DzSiIA4t.mjs.map +0 -1
  447. package/dist/change-D2U6v7Ek.mjs +0 -554
  448. package/dist/change-D2U6v7Ek.mjs.map +0 -1
  449. package/dist/communication-Kd9nU5RP.mjs.map +0 -1
  450. package/dist/coordination-Cq08hb1l.mjs +0 -76
  451. package/dist/coordination-Cq08hb1l.mjs.map +0 -1
  452. package/dist/dispatch-BaZS3PT8.d.mts +0 -76
  453. package/dist/driver-BC0Mt5KG.d.mts +0 -34
  454. package/dist/driver-Bbd25rNM.mjs +0 -23
  455. package/dist/driver-Bbd25rNM.mjs.map +0 -1
  456. package/dist/engine-DFHU2Pe-.d.mts +0 -781
  457. package/dist/engine-WaUM2cGA.mjs +0 -1068
  458. package/dist/engine-WaUM2cGA.mjs.map +0 -1
  459. package/dist/factory-config-BoRXOw43.mjs +0 -50
  460. package/dist/factory-config-BoRXOw43.mjs.map +0 -1
  461. package/dist/factory-config-D2yU3G0c.d.mts +0 -58
  462. package/dist/github-C5HNBN6p.d.mts +0 -279
  463. package/dist/id-BLIkCVue.mjs.map +0 -1
  464. package/dist/index-Bw6hggoH.d.mts +0 -40
  465. package/dist/index.mjs.map +0 -1
  466. package/dist/task-CcOyOJ3k.mjs +0 -154
  467. package/dist/task-CcOyOJ3k.mjs.map +0 -1
package/dist/github.mjs CHANGED
@@ -1,25 +1,129 @@
1
- import { z } from "zod";
1
+ import { repositorySlugSchema } from "./schema/repository.mjs";
2
+ import { mintGitHubAppInstallationToken } from "./github-app.mjs";
3
+ import { GitHubCheckoutConflictError, GitHubPublicationApiError, checkoutGitHubRepository, createGitHubPublicationClient, factorySessionBranch, factoryTaskBranch, isSafeGitRef, readCommittedGitChange, runSandboxGit } from "./github-publication.mjs";
2
4
  import { createHmac, timingSafeEqual } from "node:crypto";
5
+ import { z } from "zod";
3
6
  //#region src/github.ts
4
7
  const gitHubApiUrl = "https://api.github.com";
5
- const repositorySlugPattern = /^[^/\s]+\/[^/\s]+$/;
8
+ const gitHubRepositorySlugSchema = z.string().min(1).transform((value) => value.toLowerCase()).pipe(repositorySlugSchema);
9
+ const factoryReviewCommentEventSchema = z.looseObject({
10
+ action: z.literal("created"),
11
+ comment: z.looseObject({
12
+ id: z.number().int().positive(),
13
+ body: z.string(),
14
+ html_url: z.url()
15
+ }),
16
+ pull_request: z.looseObject({
17
+ number: z.number().int().positive(),
18
+ html_url: z.url(),
19
+ user: z.looseObject({ login: z.string().min(1) })
20
+ }),
21
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema })
22
+ });
23
+ const factoryQuestionReplyEventSchema = z.looseObject({
24
+ action: z.literal("created"),
25
+ comment: z.looseObject({
26
+ body: z.string(),
27
+ html_url: z.url(),
28
+ id: z.number().int().positive()
29
+ }),
30
+ issue: z.looseObject({
31
+ number: z.number().int().positive(),
32
+ pull_request: z.unknown().optional()
33
+ }),
34
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
35
+ sender: z.looseObject({
36
+ login: z.string().min(1),
37
+ type: z.string().min(1)
38
+ })
39
+ });
40
+ const defaultReviewMentions = ["factory"];
41
+ const defaultQuestionMentions = [
42
+ "agent-factory",
43
+ "agent-factory[bot]",
44
+ "factory"
45
+ ];
46
+ function stripMention(body, mentions) {
47
+ const trimmed = body.trimStart();
48
+ for (const mention of mentions) {
49
+ const prefix = `@${mention.trim()}`;
50
+ if (prefix === "@" || trimmed.slice(0, prefix.length).toLowerCase() !== prefix.toLowerCase()) continue;
51
+ const remainder = trimmed.slice(prefix.length);
52
+ if (!/^[\s,:-]/u.test(remainder)) continue;
53
+ return remainder.replace(/^[\s,:-]*/u, "").trim();
54
+ }
55
+ return null;
56
+ }
57
+ /** Select the one configured repository consistently identified by a provider delivery. */
58
+ function configuredEventRepositorySlug(input) {
59
+ const { configuredSlugs, eventSlugs } = input;
60
+ const distinctEventSlugs = [...new Set(eventSlugs.filter((slug) => slug !== null))];
61
+ const eventSlug = distinctEventSlugs[0];
62
+ return distinctEventSlugs.length === 1 && eventSlug !== void 0 && configuredSlugs.includes(eventSlug) ? eventSlug : null;
63
+ }
64
+ /** Normalize an explicitly addressed inline review comment into trusted routing fields. */
65
+ function normalizeFactoryReviewComment(input) {
66
+ if (input.event !== "pull_request_review_comment") return null;
67
+ const parsed = factoryReviewCommentEventSchema.safeParse(input.payload);
68
+ if (!parsed.success || stripMention(parsed.data.comment.body, input.mentions ?? defaultReviewMentions) === null) return null;
69
+ return {
70
+ repositorySlug: parsed.data.repository.full_name,
71
+ pullRequestNumber: parsed.data.pull_request.number,
72
+ pullRequestUrl: parsed.data.pull_request.html_url,
73
+ pullRequestAuthor: parsed.data.pull_request.user.login,
74
+ commentId: parsed.data.comment.id,
75
+ commentUrl: parsed.data.comment.html_url
76
+ };
77
+ }
78
+ /**
79
+ * Strip the Factory mention from an issue comment body, returning null when the
80
+ * comment does not address Factory. Exported so a caller reconciling a delivery
81
+ * against GitHub's own copy of the comment applies the same rule the normalizer
82
+ * applied to the payload.
83
+ */
84
+ function stripFactoryQuestionMention(body, options = {}) {
85
+ return stripMention(body, options.mentions ?? defaultQuestionMentions);
86
+ }
87
+ /** Normalize a mentioned issue comment that can answer a persisted Factory QuestionTask. */
88
+ function normalizeFactoryQuestionReply(input) {
89
+ if (input.event !== "issue_comment") return null;
90
+ const parsed = factoryQuestionReplyEventSchema.safeParse(input.payload);
91
+ if (!parsed.success || parsed.data.sender.type.toLowerCase() === "bot") return null;
92
+ const answer = stripMention(parsed.data.comment.body, input.mentions ?? defaultQuestionMentions);
93
+ if (answer === null || answer === "") return null;
94
+ if (parsed.data.issue.pull_request !== void 0) return null;
95
+ const repositorySlug = parsed.data.repository.full_name;
96
+ return {
97
+ repositorySlug,
98
+ replyAddress: `${repositorySlug}#${parsed.data.issue.number}`,
99
+ author: parsed.data.sender.login,
100
+ answer,
101
+ commentId: parsed.data.comment.id,
102
+ issueNumber: parsed.data.issue.number,
103
+ commentUrl: parsed.data.comment.html_url
104
+ };
105
+ }
6
106
  const pullRequestSchema = z.object({
7
107
  number: z.number().int().positive(),
8
108
  html_url: z.url()
9
109
  });
10
110
  const readablePullRequestSchema = pullRequestSchema.extend({
11
111
  state: z.enum(["open", "closed"]),
12
- user: z.object({ login: z.string().min(1) })
112
+ user: z.object({
113
+ login: z.string().min(1),
114
+ type: z.string().optional()
115
+ })
13
116
  });
14
117
  const pullRequestHeadSchema = z.object({ head: z.object({
15
118
  ref: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/).refine((value) => !value.includes("..")),
16
119
  sha: z.string().regex(/^[0-9a-f]{40}$/),
17
- repo: z.object({ full_name: z.string().min(1) })
120
+ repo: z.object({ full_name: gitHubRepositorySlugSchema })
18
121
  }) });
19
122
  const reviewCommentSchema = z.object({
20
123
  id: z.number().int().positive(),
21
124
  body: z.string(),
22
125
  html_url: z.url(),
126
+ pull_request_url: z.url(),
23
127
  user: z.object({ login: z.string().min(1) }),
24
128
  in_reply_to_id: z.number().int().positive().nullish()
25
129
  });
@@ -77,7 +181,7 @@ const pullRequestCandidateSchema = z.object({
77
181
  user: z.object({ type: z.string().min(1) }),
78
182
  head: z.object({
79
183
  ref: z.string().min(1),
80
- repo: z.object({ full_name: z.string().min(1) })
184
+ repo: z.object({ full_name: gitHubRepositorySlugSchema })
81
185
  })
82
186
  });
83
187
  const openPullRequestsSchema = z.array(pullRequestCandidateSchema);
@@ -91,6 +195,14 @@ const pullRequestDetailSchema = pullRequestCandidateSchema.extend({
91
195
  sha: z.string().min(1)
92
196
  })
93
197
  });
198
+ const openPullRequestSummarySchema = z.object({
199
+ number: z.number().int().positive(),
200
+ html_url: z.url(),
201
+ title: z.string().min(1),
202
+ user: z.object({ login: z.string().min(1) }),
203
+ head: z.object({ ref: z.string().min(1) }),
204
+ draft: z.boolean()
205
+ });
94
206
  const collaboratorPermissionSchema = z.object({ permission: z.enum([
95
207
  "admin",
96
208
  "maintain",
@@ -104,6 +216,7 @@ const writePermissions = /* @__PURE__ */ new Set([
104
216
  "maintain",
105
217
  "write"
106
218
  ]);
219
+ /** Refusal raised when an inline review-comment author lacks repository write access. */
107
220
  var GitHubReviewCommentAuthorError = class extends Error {
108
221
  author;
109
222
  constructor(author) {
@@ -112,6 +225,28 @@ var GitHubReviewCommentAuthorError = class extends Error {
112
225
  this.author = author;
113
226
  }
114
227
  };
228
+ /**
229
+ * The pull request advanced past the commit a review or fix was prepared
230
+ * against. Callers that reviewed a task keyed to a specific commit (for
231
+ * example `record_post_review`) can use `expectedSha`/`actualSha` to resolve
232
+ * the task as superseded instead of leaving it running for the stall
233
+ * watchdog to eventually -- and misleadingly -- report as "stalled".
234
+ */
235
+ var StalePullRequestHeadError = class extends Error {
236
+ expectedSha;
237
+ actualSha;
238
+ constructor(expectedSha, actualSha) {
239
+ super(`pull request changed after review: expected ${expectedSha}, found ${actualSha}`);
240
+ this.name = "StalePullRequestHeadError";
241
+ this.expectedSha = expectedSha;
242
+ this.actualSha = actualSha;
243
+ }
244
+ };
245
+ /** Whether a GitHub user may make repository-scoped Factory decisions. */
246
+ async function hasGitHubRepositoryWriteAccess(input) {
247
+ const { permission } = collaboratorPermissionSchema.parse(await gitHubRequest(input, `/collaborators/${encodeURIComponent(input.author)}/permission`));
248
+ return writePermissions.has(permission);
249
+ }
115
250
  /** Create a pull request from an existing head branch. */
116
251
  async function createPullRequest(input) {
117
252
  const pull = pullRequestSchema.parse(await gitHubRequest(input, "/pulls", {
@@ -125,14 +260,13 @@ async function createPullRequest(input) {
125
260
  })
126
261
  }));
127
262
  return {
128
- prNumber: pull.number,
129
- prUrl: pull.html_url
263
+ pullRequestNumber: pull.number,
264
+ pullRequestUrl: pull.html_url
130
265
  };
131
266
  }
132
267
  /** Create a check run for one commit. Requires a GitHub App token with checks:write. */
133
268
  async function createCheckRun(input) {
134
- if (input.status === "completed" && input.conclusion === void 0) throw new Error("completed check runs require a conclusion");
135
- if (input.status !== "completed" && input.conclusion !== void 0) throw new Error("creating a check run with a conclusion requires completed status");
269
+ assertCheckRunFields(input);
136
270
  return parseCheckRun(await gitHubRequest(input, "/check-runs", {
137
271
  method: "POST",
138
272
  body: JSON.stringify({
@@ -144,7 +278,7 @@ async function createCheckRun(input) {
144
278
  }
145
279
  /** Update a check run previously created by the authenticated GitHub App. */
146
280
  async function updateCheckRun(input) {
147
- if (input.status !== void 0 && input.status !== "completed" && input.conclusion !== void 0) throw new Error("a check run conclusion conflicts with an incomplete status");
281
+ assertCheckRunFields(input);
148
282
  return parseCheckRun(await gitHubRequest(input, `/check-runs/${positiveInteger(input.checkRunId, "checkRunId")}`, {
149
283
  method: "PATCH",
150
284
  body: JSON.stringify({
@@ -182,25 +316,47 @@ async function updatePullRequestComment(input) {
182
316
  body: JSON.stringify({ body: input.body })
183
317
  }));
184
318
  }
319
+ const readIssueCommentSchema = issueCommentSchema.extend({ issue_url: z.string().min(1) });
320
+ /**
321
+ * Read one issue comment from GitHub. A delivery authenticated as a workload
322
+ * rather than by body signature can name any author and any text, so the
323
+ * comment it refers to has to be read back before either is believed.
324
+ */
325
+ async function readIssueComment(input) {
326
+ const comment = readIssueCommentSchema.parse(await gitHubRequest(input, `/issues/comments/${positiveInteger(input.commentId, "commentId")}`));
327
+ const issueNumber = Number(comment.issue_url.split("/").pop());
328
+ if (!Number.isSafeInteger(issueNumber) || issueNumber < 1) throw new Error("GitHub returned an issue comment without a usable issue reference.");
329
+ return {
330
+ id: comment.id,
331
+ url: comment.html_url,
332
+ author: comment.user.login,
333
+ authorType: comment.user.type,
334
+ body: comment.body,
335
+ issueNumber
336
+ };
337
+ }
185
338
  /** Read one inline review comment after applying the author policy, which requires write access by default. */
186
339
  async function readReviewComment(input) {
187
340
  const comment = parseReviewComment(await gitHubRequest(input, `/pulls/comments/${positiveInteger(input.commentId, "commentId")}`));
341
+ assertReviewCommentPullRequest(input, comment);
188
342
  await assertReviewCommentAuthor(input, comment.author);
189
343
  return comment;
190
344
  }
191
345
  /** Reply to an inline review comment after applying the author policy, which requires write access by default. */
192
346
  async function answerReviewComment(input) {
193
347
  await readReviewComment(input);
194
- return parseReviewComment(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/comments/${positiveInteger(input.commentId, "commentId")}/replies`, {
348
+ const reply = parseReviewComment(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/comments/${positiveInteger(input.commentId, "commentId")}/replies`, {
195
349
  method: "POST",
196
350
  body: JSON.stringify({ body: input.body })
197
351
  }));
352
+ assertReviewCommentPullRequest(input, reply);
353
+ return reply;
198
354
  }
199
355
  /** Submit a summary and optional inline comments against a reviewed pull request commit. */
200
356
  async function submitPullRequestReview(input) {
201
357
  const commitId = z.string().regex(/^[0-9a-f]{40}$/).parse(input.commitId);
202
358
  const head = await readPullRequestHead(input);
203
- if (head.sha !== commitId) throw new Error(`pull request changed after review: expected ${commitId}, found ${head.sha}`);
359
+ if (head.sha !== commitId) throw new StalePullRequestHeadError(commitId, head.sha);
204
360
  const review = submittedReviewSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/reviews`, {
205
361
  method: "POST",
206
362
  body: JSON.stringify({
@@ -227,16 +383,31 @@ async function readPullRequestHead(input) {
227
383
  return {
228
384
  branch: pull.head.ref,
229
385
  sha: pull.head.sha,
230
- repository: pull.head.repo.full_name.toLowerCase()
386
+ repository: pull.head.repo.full_name
231
387
  };
232
388
  }
233
389
  /** Read the provider-owned identity and lifecycle of one pull request. */
234
390
  async function readPullRequest(input) {
235
391
  const pull = readablePullRequestSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}`));
236
392
  return {
237
- number: pull.number,
238
- url: pull.html_url,
393
+ pullRequestNumber: pull.number,
394
+ pullRequestUrl: pull.html_url,
395
+ author: pull.user.login,
396
+ authorType: pull.user.type,
397
+ state: pull.state
398
+ };
399
+ }
400
+ /** Close an open pull request without merging it. */
401
+ async function closePullRequest(input) {
402
+ const pull = readablePullRequestSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}`, {
403
+ method: "PATCH",
404
+ body: JSON.stringify({ state: "closed" })
405
+ }));
406
+ return {
407
+ pullRequestNumber: pull.number,
408
+ pullRequestUrl: pull.html_url,
239
409
  author: pull.user.login,
410
+ authorType: pull.user.type,
240
411
  state: pull.state
241
412
  };
242
413
  }
@@ -247,8 +418,8 @@ async function listConflictedPullRequests(input) {
247
418
  for (const candidate of candidates) {
248
419
  const pull = pullRequestDetailSchema.parse(await gitHubRequest(input, `/pulls/${candidate.number}`));
249
420
  if (pull.mergeable === false || pull.mergeable_state === "dirty") conflicted.push({
250
- prNumber: pull.number,
251
- prUrl: pull.html_url,
421
+ pullRequestNumber: pull.number,
422
+ pullRequestUrl: pull.html_url,
252
423
  headBranch: pull.head.ref,
253
424
  headSha: pull.head.sha,
254
425
  baseBranch: pull.base.ref,
@@ -257,6 +428,17 @@ async function listConflictedPullRequests(input) {
257
428
  }
258
429
  return conflicted;
259
430
  }
431
+ /** List open pull requests in a repository, newest first, to check for existing work before triage. */
432
+ async function listOpenPullRequests(input) {
433
+ return z.array(openPullRequestSummarySchema).parse(await gitHubRequest(input, `/pulls?state=open&per_page=100&sort=created&direction=desc`)).map((pull) => ({
434
+ prNumber: pull.number,
435
+ prUrl: pull.html_url,
436
+ title: pull.title,
437
+ author: pull.user.login,
438
+ headBranch: pull.head.ref,
439
+ draft: pull.draft
440
+ }));
441
+ }
260
442
  /** Add one label to a pull request. */
261
443
  async function addLabel(input) {
262
444
  return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels`, {
@@ -269,8 +451,8 @@ async function removeLabel(input) {
269
451
  return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels/${encodeURIComponent(input.label)}`, { method: "DELETE" }));
270
452
  }
271
453
  async function gitHubRequest(input, path, init = {}) {
272
- if (!repositorySlugPattern.test(input.repository)) throw new Error(`invalid GitHub repository slug: ${input.repository}`);
273
- const response = await (input.fetch ?? globalThis.fetch)(`${gitHubApiUrl}/repos/${input.repository}${path}`, {
454
+ const repository = repositorySlugSchema.parse(input.repository);
455
+ const response = await (input.fetch ?? globalThis.fetch)(`${gitHubApiUrl}/repos/${repository}${path}`, {
274
456
  ...init,
275
457
  headers: {
276
458
  Accept: "application/vnd.github+json",
@@ -289,14 +471,21 @@ async function gitHubRequest(input, path, init = {}) {
289
471
  }
290
472
  function parseReviewComment(value) {
291
473
  const comment = reviewCommentSchema.parse(value);
474
+ const pullRequestMatch = /\/pulls\/([1-9]\d*)\/?$/.exec(new URL(comment.pull_request_url).pathname);
475
+ if (pullRequestMatch?.[1] === void 0) throw new Error("GitHub review comment has an invalid pull request URL");
292
476
  return {
293
477
  id: comment.id,
478
+ pullRequestNumber: positiveInteger(Number(pullRequestMatch[1]), "pullRequestNumber"),
294
479
  body: comment.body,
295
480
  url: comment.html_url,
296
481
  author: comment.user.login,
297
482
  inReplyToId: comment.in_reply_to_id ?? null
298
483
  };
299
484
  }
485
+ function assertReviewCommentPullRequest(input, comment) {
486
+ const expected = positiveInteger(input.pullRequestNumber, "pullRequestNumber");
487
+ if (comment.pullRequestNumber !== expected) throw new Error(`GitHub review comment ${comment.id} does not belong to pull request ${expected}`);
488
+ }
300
489
  function parseIssueComment(value) {
301
490
  const comment = issueCommentSchema.parse(value);
302
491
  return {
@@ -336,6 +525,14 @@ function checkRunFields(input) {
336
525
  ...input.output === void 0 ? {} : { output: checkRunOutput(input.output) }
337
526
  };
338
527
  }
528
+ function assertCheckRunFields(input) {
529
+ if (input.status === "completed") {
530
+ if (input.conclusion === void 0) throw new Error("completed check runs require a conclusion");
531
+ return;
532
+ }
533
+ if (input.conclusion !== void 0) throw new Error("a check run conclusion requires completed status");
534
+ if (input.completedAt !== void 0) throw new Error("a check run completion time requires completed status");
535
+ }
339
536
  function checkRunOutput(output) {
340
537
  return {
341
538
  title: output.title,
@@ -356,8 +553,10 @@ function checkRunOutput(output) {
356
553
  }
357
554
  async function assertReviewCommentAuthor(input, author) {
358
555
  if (input.authorPolicy === "any") return;
359
- const { permission } = collaboratorPermissionSchema.parse(await gitHubRequest(input, `/collaborators/${encodeURIComponent(author)}/permission`));
360
- if (!writePermissions.has(permission)) throw new GitHubReviewCommentAuthorError(author);
556
+ if (!await hasGitHubRepositoryWriteAccess({
557
+ ...input,
558
+ author
559
+ })) throw new GitHubReviewCommentAuthorError(author);
361
560
  }
362
561
  function positiveInteger(value, name) {
363
562
  if (!Number.isInteger(value) || value < 1) throw new Error(`${name} must be a positive integer`);
@@ -383,7 +582,7 @@ const pushEventSchema = z.looseObject({
383
582
  ref: z.string().min(1),
384
583
  repository: z.looseObject({
385
584
  default_branch: z.string().min(1),
386
- full_name: z.string().min(1)
585
+ full_name: gitHubRepositorySlugSchema
387
586
  })
388
587
  });
389
588
  /** Normalize a push to a repository's default branch for deterministic reconciliation. */
@@ -394,7 +593,7 @@ function normalizeGitHubDefaultBranchPush(options) {
394
593
  return {
395
594
  source: "github_default_branch_push",
396
595
  deliveryId: options.deliveryId,
397
- repositorySlug: parsed.data.repository.full_name.toLowerCase(),
596
+ repositorySlug: parsed.data.repository.full_name,
398
597
  defaultBranch: parsed.data.repository.default_branch
399
598
  };
400
599
  }
@@ -408,14 +607,14 @@ const pullRequestEventSchema = z.looseObject({
408
607
  head: z.looseObject({
409
608
  sha: z.string().regex(/^[0-9a-f]{40}$/),
410
609
  ref: z.string().min(1),
411
- repo: z.looseObject({ full_name: z.string().min(1) })
610
+ repo: z.looseObject({ full_name: gitHubRepositorySlugSchema })
412
611
  }),
413
612
  base: z.looseObject({
414
613
  sha: z.string().regex(/^[0-9a-f]{40}$/),
415
614
  ref: z.string().min(1)
416
615
  })
417
616
  }),
418
- repository: z.looseObject({ full_name: z.string().min(1) }),
617
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
419
618
  sender: z.looseObject({ login: z.string().min(1) })
420
619
  });
421
620
  const reviewablePullRequestActions = /* @__PURE__ */ new Set([
@@ -430,7 +629,7 @@ function normalizeGitHubPullRequest(options) {
430
629
  const parsed = pullRequestEventSchema.safeParse(options.payload);
431
630
  if (!parsed.success || !reviewablePullRequestActions.has(parsed.data.action)) return null;
432
631
  if (parsed.data.pull_request.draft && parsed.data.action !== "ready_for_review") return null;
433
- const slug = parsed.data.repository.full_name.toLowerCase();
632
+ const slug = parsed.data.repository.full_name;
434
633
  const pull = parsed.data.pull_request;
435
634
  return {
436
635
  source: "github_pr",
@@ -441,13 +640,13 @@ function normalizeGitHubPullRequest(options) {
441
640
  address: `${slug}/pull/${parsed.data.number}`
442
641
  },
443
642
  pullRequest: {
444
- number: parsed.data.number,
445
- url: pull.html_url,
643
+ pullRequestNumber: parsed.data.number,
644
+ pullRequestUrl: pull.html_url,
446
645
  author: pull.user.login,
447
646
  draft: pull.draft,
448
647
  headSha: pull.head.sha,
449
648
  headBranch: pull.head.ref,
450
- headRepositorySlug: pull.head.repo.full_name.toLowerCase(),
649
+ headRepositorySlug: pull.head.repo.full_name,
451
650
  baseSha: pull.base.sha,
452
651
  baseBranch: pull.base.ref,
453
652
  sender: parsed.data.sender.login
@@ -462,7 +661,7 @@ const issueEventSchema = z.looseObject({
462
661
  title: z.string(),
463
662
  body: z.string().nullable()
464
663
  }),
465
- repository: z.looseObject({ full_name: z.string().min(1) })
664
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema })
466
665
  });
467
666
  const failedWorkflowConclusions = /* @__PURE__ */ new Set([
468
667
  "action_required",
@@ -475,14 +674,14 @@ const workflowRunEventSchema = z.looseObject({
475
674
  action: z.string(),
476
675
  repository: z.looseObject({
477
676
  default_branch: z.string().min(1),
478
- full_name: z.string().min(1)
677
+ full_name: gitHubRepositorySlugSchema
479
678
  }),
480
679
  workflow_run: z.looseObject({
481
680
  id: z.number().int().min(1),
482
681
  name: z.string().min(1),
483
682
  event: z.string().min(1),
484
683
  head_branch: z.string().min(1).nullable(),
485
- head_repository: z.looseObject({ full_name: z.string().min(1) }).nullable(),
684
+ head_repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }).nullable(),
486
685
  head_sha: z.string().min(1),
487
686
  html_url: z.url(),
488
687
  conclusion: z.string().nullable(),
@@ -498,7 +697,7 @@ function normalizeGitHubIssueOpened(options) {
498
697
  if (options.event !== "issues") return null;
499
698
  const parsed = issueEventSchema.safeParse(options.payload);
500
699
  if (!parsed.success || parsed.data.action !== "opened") return null;
501
- const slug = parsed.data.repository.full_name.toLowerCase();
700
+ const slug = parsed.data.repository.full_name;
502
701
  const { number, title, body } = parsed.data.issue;
503
702
  return {
504
703
  source: "github_issue",
@@ -525,7 +724,7 @@ const pullRequestClosedSchema = z.looseObject({
525
724
  merged_by: z.looseObject({ login: z.string().min(1) }).nullable().optional(),
526
725
  merge_commit_sha: z.string().regex(/^[0-9a-f]{40}$/).nullable().optional()
527
726
  }),
528
- repository: z.looseObject({ full_name: z.string().min(1) }),
727
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
529
728
  sender: z.looseObject({ login: z.string().min(1) })
530
729
  });
531
730
  /**
@@ -542,9 +741,9 @@ function normalizeGitHubPullRequestClosed(options) {
542
741
  return {
543
742
  source: "github_pull_request_closed",
544
743
  deliveryId: options.deliveryId,
545
- repositorySlug: parsed.data.repository.full_name.toLowerCase(),
546
- prNumber: pr.number,
547
- prUrl: pr.html_url,
744
+ repositorySlug: parsed.data.repository.full_name,
745
+ pullRequestNumber: pr.number,
746
+ pullRequestUrl: pr.html_url,
548
747
  merged: pr.merged,
549
748
  mergeCommitSha: pr.merged ? pr.merge_commit_sha ?? null : null,
550
749
  decidedBy: pr.merged ? pr.merged_by?.login ?? sender : sender
@@ -558,7 +757,7 @@ function normalizeGitHubWorkflowRunFailure(options) {
558
757
  const run = parsed.data.workflow_run;
559
758
  const conclusion = run.conclusion;
560
759
  if (conclusion === null || !failedWorkflowConclusions.has(conclusion)) return null;
561
- const slug = parsed.data.repository.full_name.toLowerCase();
760
+ const slug = parsed.data.repository.full_name;
562
761
  return {
563
762
  source: "github_ci_failure",
564
763
  deliveryId: options.deliveryId,
@@ -573,7 +772,7 @@ function normalizeGitHubWorkflowRunFailure(options) {
573
772
  name: run.name,
574
773
  trigger: run.event,
575
774
  branch: run.head_branch,
576
- headRepositorySlug: run.head_repository?.full_name.toLowerCase() ?? null,
775
+ headRepositorySlug: run.head_repository?.full_name ?? null,
577
776
  headSha: run.head_sha,
578
777
  url: run.html_url,
579
778
  conclusion,
@@ -583,6 +782,6 @@ function normalizeGitHubWorkflowRunFailure(options) {
583
782
  };
584
783
  }
585
784
  //#endregion
586
- export { GitHubReviewCommentAuthorError, addLabel, answerReviewComment, createCheckRun, createPullRequest, createPullRequestComment, listCheckRunsForRef, listConflictedPullRequests, listPullRequestComments, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
785
+ export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createPullRequest, createPullRequestComment, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
587
786
 
588
787
  //# sourceMappingURL=github.mjs.map