@vercel/factory 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/README.md +307 -1
  2. package/dist/agent-routes.d.mts +69 -0
  3. package/dist/agent-routes.mjs +64 -0
  4. package/dist/agent-routes.mjs.map +1 -0
  5. package/dist/api-contracts.d.mts +1749 -0
  6. package/dist/api-contracts.mjs +118 -0
  7. package/dist/api-contracts.mjs.map +1 -0
  8. package/dist/api-images.d.mts +30 -0
  9. package/dist/api-images.mjs +28 -0
  10. package/dist/api-images.mjs.map +1 -0
  11. package/dist/api-task-graph.mjs +57 -0
  12. package/dist/api-task-graph.mjs.map +1 -0
  13. package/dist/api.d.mts +77 -0
  14. package/dist/api.mjs +1087 -0
  15. package/dist/api.mjs.map +1 -0
  16. package/dist/approval-access.d.mts +39 -0
  17. package/dist/approval-access.mjs +62 -0
  18. package/dist/approval-access.mjs.map +1 -0
  19. package/dist/approval-contracts.d.mts +692 -0
  20. package/dist/approval-contracts.mjs +27 -0
  21. package/dist/approval-contracts.mjs.map +1 -0
  22. package/dist/approval.d.mts +49 -0
  23. package/dist/approval.mjs +39 -0
  24. package/dist/approval.mjs.map +1 -0
  25. package/dist/blob/artifacts.d.mts +37 -0
  26. package/dist/blob/artifacts.mjs +45 -0
  27. package/dist/blob/artifacts.mjs.map +1 -0
  28. package/dist/blob/index.d.mts +44 -8
  29. package/dist/blob/index.mjs +159 -35
  30. package/dist/blob/index.mjs.map +1 -1
  31. package/dist/budget.d.mts +108 -0
  32. package/dist/budget.mjs +141 -0
  33. package/dist/budget.mjs.map +1 -0
  34. package/dist/budgets.d.mts +4 -0
  35. package/dist/budgets.mjs +4 -0
  36. package/dist/build-factory.d.mts +6 -4
  37. package/dist/build-factory.mjs +2 -1
  38. package/dist/build-factory.mjs.map +1 -1
  39. package/dist/change-verification/brief.d.mts +9 -0
  40. package/dist/change-verification/brief.mjs +13 -0
  41. package/dist/change-verification/brief.mjs.map +1 -0
  42. package/dist/change-verification/dispatch.d.mts +24 -0
  43. package/dist/change-verification/dispatch.mjs +45 -0
  44. package/dist/change-verification/dispatch.mjs.map +1 -0
  45. package/dist/change-verification/eve-tool.d.mts +60 -0
  46. package/dist/change-verification/eve-tool.mjs +101 -0
  47. package/dist/change-verification/eve-tool.mjs.map +1 -0
  48. package/dist/changes/eve-record-change.d.mts +56 -0
  49. package/dist/changes/eve-record-change.mjs +97 -0
  50. package/dist/changes/eve-record-change.mjs.map +1 -0
  51. package/dist/changes/presentation.d.mts +14 -0
  52. package/dist/changes.d.mts +23 -0
  53. package/dist/changes.mjs +29 -0
  54. package/dist/changes.mjs.map +1 -0
  55. package/dist/client-events.d.mts +18 -0
  56. package/dist/client-events.mjs +41 -0
  57. package/dist/client-events.mjs.map +1 -0
  58. package/dist/client-stream.d.mts +28 -0
  59. package/dist/client-stream.mjs +204 -0
  60. package/dist/client-stream.mjs.map +1 -0
  61. package/dist/client-transcript.d.mts +41 -0
  62. package/dist/client-transcript.mjs +229 -0
  63. package/dist/client-transcript.mjs.map +1 -0
  64. package/dist/client.d.mts +234 -0
  65. package/dist/client.mjs +258 -0
  66. package/dist/client.mjs.map +1 -0
  67. package/dist/code-review/contracts.d.mts +26 -0
  68. package/dist/code-review/eve-post-review.d.mts +70 -0
  69. package/dist/code-review/eve-post-review.mjs +183 -0
  70. package/dist/code-review/eve-post-review.mjs.map +1 -0
  71. package/dist/code-review/eve-review-comments.d.mts +64 -0
  72. package/dist/code-review/eve-review-comments.mjs +159 -0
  73. package/dist/code-review/eve-review-comments.mjs.map +1 -0
  74. package/dist/code-review/github-contracts.d.mts +10 -0
  75. package/dist/code-review/github-reporter.d.mts +44 -0
  76. package/dist/code-review/github-reporter.mjs +260 -0
  77. package/dist/code-review/github-reporter.mjs.map +1 -0
  78. package/dist/code-review/preparation.d.mts +34 -0
  79. package/dist/code-review/preparation.mjs +23 -0
  80. package/dist/code-review/preparation.mjs.map +1 -0
  81. package/dist/code-review/stall.d.mts +17 -0
  82. package/dist/code-review/stall.mjs +30 -0
  83. package/dist/code-review/stall.mjs.map +1 -0
  84. package/dist/code-review.d.mts +6 -0
  85. package/dist/code-review.mjs +5 -0
  86. package/dist/communication.d.mts +9 -0
  87. package/dist/communication.mjs +9 -0
  88. package/dist/connectors/github.d.mts +26 -0
  89. package/dist/connectors/github.mjs +55 -0
  90. package/dist/connectors/github.mjs.map +1 -0
  91. package/dist/connectors/index.d.mts +35 -2
  92. package/dist/connectors/index.mjs +4 -26
  93. package/dist/connectors/index.mjs.map +1 -1
  94. package/dist/connectors/outbox.d.mts +34 -0
  95. package/dist/connectors/outbox.mjs +50 -0
  96. package/dist/connectors/outbox.mjs.map +1 -0
  97. package/dist/connectors/slack-approval-blocks.mjs +136 -0
  98. package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
  99. package/dist/connectors/slack-approvals.d.mts +29 -0
  100. package/dist/connectors/slack-approvals.mjs +346 -0
  101. package/dist/connectors/slack-approvals.mjs.map +1 -0
  102. package/dist/connectors/slack.d.mts +35 -41
  103. package/dist/connectors/slack.mjs +13 -69
  104. package/dist/connectors/slack.mjs.map +1 -1
  105. package/dist/deepsec/eve-tool.d.mts +110 -0
  106. package/dist/deepsec/eve-tool.mjs +164 -0
  107. package/dist/deepsec/eve-tool.mjs.map +1 -0
  108. package/dist/deepsec/finding.d.mts +84 -0
  109. package/dist/deepsec/finding.mjs +56 -0
  110. package/dist/deepsec/finding.mjs.map +1 -0
  111. package/dist/deepsec.d.mts +3 -0
  112. package/dist/delivery-metrics/metrics.d.mts +93 -0
  113. package/dist/delivery-metrics/metrics.mjs +200 -0
  114. package/dist/delivery-metrics/metrics.mjs.map +1 -0
  115. package/dist/delivery-metrics.d.mts +2 -0
  116. package/dist/delivery-metrics.mjs +2 -0
  117. package/dist/dispatch.d.mts +81 -0
  118. package/dist/dispatch.mjs +140 -0
  119. package/dist/dispatch.mjs.map +1 -0
  120. package/dist/errors.d.mts +15 -0
  121. package/dist/errors.mjs +38 -0
  122. package/dist/errors.mjs.map +1 -0
  123. package/dist/eve/index.d.mts +143 -1561
  124. package/dist/eve/index.mjs +244 -1063
  125. package/dist/eve/index.mjs.map +1 -1
  126. package/dist/eve/invoke.d.mts +144 -0
  127. package/dist/eve/invoke.mjs +241 -0
  128. package/dist/eve/invoke.mjs.map +1 -0
  129. package/dist/eve/session-client.d.mts +68 -0
  130. package/dist/eve/session-client.mjs +131 -0
  131. package/dist/eve/session-client.mjs.map +1 -0
  132. package/dist/eve/task-execution.mjs +18 -0
  133. package/dist/eve/task-execution.mjs.map +1 -0
  134. package/dist/eve/task-session.d.mts +87 -0
  135. package/dist/eve/task-session.mjs +203 -0
  136. package/dist/eve/task-session.mjs.map +1 -0
  137. package/dist/eve/transcript.d.mts +37 -0
  138. package/dist/eve/transcript.mjs +65 -0
  139. package/dist/eve/transcript.mjs.map +1 -0
  140. package/dist/execution-public.d.mts +8 -0
  141. package/dist/execution-public.mjs +7 -0
  142. package/dist/execution.d.mts +75 -0
  143. package/dist/execution.mjs +153 -0
  144. package/dist/execution.mjs.map +1 -0
  145. package/dist/finding-remediation/admission.d.mts +51 -0
  146. package/dist/finding-remediation/admission.mjs +87 -0
  147. package/dist/finding-remediation/admission.mjs.map +1 -0
  148. package/dist/finding-remediation/brief.d.mts +14 -0
  149. package/dist/finding-remediation/brief.mjs +25 -0
  150. package/dist/finding-remediation/brief.mjs.map +1 -0
  151. package/dist/finding-remediation/eve-tool.d.mts +29 -0
  152. package/dist/finding-remediation/eve-tool.mjs +34 -0
  153. package/dist/finding-remediation/eve-tool.mjs.map +1 -0
  154. package/dist/findings/fingerprint.d.mts +14 -0
  155. package/dist/findings/fingerprint.mjs +28 -0
  156. package/dist/findings/fingerprint.mjs.map +1 -0
  157. package/dist/findings.d.mts +6 -0
  158. package/dist/findings.mjs +6 -0
  159. package/dist/github-app.d.mts +54 -0
  160. package/dist/github-app.mjs +121 -0
  161. package/dist/github-app.mjs.map +1 -0
  162. package/dist/github-publication.d.mts +198 -0
  163. package/dist/github-publication.mjs +429 -0
  164. package/dist/github-publication.mjs.map +1 -0
  165. package/dist/github-transfer.d.mts +72 -0
  166. package/dist/github-transfer.mjs +125 -0
  167. package/dist/github-transfer.mjs.map +1 -0
  168. package/dist/github.d.mts +406 -2
  169. package/dist/github.mjs +250 -37
  170. package/dist/github.mjs.map +1 -1
  171. package/dist/image-input.d.mts +51 -0
  172. package/dist/image-input.mjs +63 -0
  173. package/dist/image-input.mjs.map +1 -0
  174. package/dist/index.d.mts +14 -314
  175. package/dist/index.mjs +14 -1124
  176. package/dist/intake-contracts.d.mts +56 -0
  177. package/dist/intake-contracts.mjs +33 -0
  178. package/dist/intake-contracts.mjs.map +1 -0
  179. package/dist/integrations/deepsec.d.mts +4 -0
  180. package/dist/integrations/deepsec.mjs +3 -0
  181. package/dist/integrations/github.d.mts +11 -0
  182. package/dist/integrations/github.mjs +9 -0
  183. package/dist/integrations/slack.d.mts +3 -0
  184. package/dist/integrations/slack.mjs +3 -0
  185. package/dist/integrations/vercel.d.mts +3 -0
  186. package/dist/integrations/vercel.mjs +3 -0
  187. package/dist/merge-resolution/contracts.d.mts +17 -0
  188. package/dist/merge-resolution/contracts.mjs +19 -0
  189. package/dist/merge-resolution/contracts.mjs.map +1 -0
  190. package/dist/merge-resolution/eve-tools.d.mts +46 -0
  191. package/dist/merge-resolution/eve-tools.mjs +117 -0
  192. package/dist/merge-resolution/eve-tools.mjs.map +1 -0
  193. package/dist/multi-repository-changes/coordination.d.mts +49 -0
  194. package/dist/multi-repository-changes/coordination.mjs +115 -0
  195. package/dist/multi-repository-changes/coordination.mjs.map +1 -0
  196. package/dist/planning/cancellation.mjs +82 -0
  197. package/dist/planning/cancellation.mjs.map +1 -0
  198. package/dist/planning/configuration.d.mts +23 -0
  199. package/dist/planning/configuration.mjs +56 -0
  200. package/dist/planning/configuration.mjs.map +1 -0
  201. package/dist/planning/contracts.d.mts +136 -0
  202. package/dist/planning/contracts.mjs +42 -0
  203. package/dist/planning/contracts.mjs.map +1 -0
  204. package/dist/planning/dependencies.mjs +44 -0
  205. package/dist/planning/dependencies.mjs.map +1 -0
  206. package/dist/planning/effects.mjs +122 -0
  207. package/dist/planning/effects.mjs.map +1 -0
  208. package/dist/planning/reconcile.mjs +273 -0
  209. package/dist/planning/reconcile.mjs.map +1 -0
  210. package/dist/planning/runtime.d.mts +27 -0
  211. package/dist/planning/runtime.mjs +25 -0
  212. package/dist/planning/runtime.mjs.map +1 -0
  213. package/dist/planning/state.mjs +92 -0
  214. package/dist/planning/state.mjs.map +1 -0
  215. package/dist/planning/turns.mjs +262 -0
  216. package/dist/planning/turns.mjs.map +1 -0
  217. package/dist/planning/validation.mjs +106 -0
  218. package/dist/planning/validation.mjs.map +1 -0
  219. package/dist/postgres/index.d.mts +7 -1
  220. package/dist/postgres/index.mjs +7 -3
  221. package/dist/postgres/index.mjs.map +1 -1
  222. package/dist/presets/software-development/approval.d.mts +14 -0
  223. package/dist/presets/software-development/approval.mjs +21 -0
  224. package/dist/presets/software-development/approval.mjs.map +1 -0
  225. package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
  226. package/dist/presets/software-development/deepsec-brief.mjs +14 -0
  227. package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
  228. package/dist/presets/software-development/dispatch.d.mts +53 -0
  229. package/dist/presets/software-development/dispatch.mjs +66 -0
  230. package/dist/presets/software-development/dispatch.mjs.map +1 -0
  231. package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
  232. package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
  233. package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
  234. package/dist/presets/software-development/eve.d.mts +18 -0
  235. package/dist/presets/software-development/eve.mjs +19 -0
  236. package/dist/presets/software-development/eve.mjs.map +1 -0
  237. package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
  238. package/dist/presets/software-development/finish-task-policy.mjs +9 -0
  239. package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
  240. package/dist/presets/software-development/recovery.d.mts +32 -0
  241. package/dist/presets/software-development/recovery.mjs +120 -0
  242. package/dist/presets/software-development/recovery.mjs.map +1 -0
  243. package/dist/presets/software-development/task-communication.d.mts +23 -0
  244. package/dist/presets/software-development/task-communication.mjs +120 -0
  245. package/dist/presets/software-development/task-communication.mjs.map +1 -0
  246. package/dist/presets/software-development.d.mts +9 -0
  247. package/dist/presets/software-development.mjs +9 -0
  248. package/dist/pull-requests/contracts.d.mts +72 -0
  249. package/dist/pull-requests/eve-fetch.d.mts +57 -0
  250. package/dist/pull-requests/eve-fetch.mjs +151 -0
  251. package/dist/pull-requests/eve-fetch.mjs.map +1 -0
  252. package/dist/pull-requests/github-label-manager.d.mts +27 -0
  253. package/dist/pull-requests/github-label-manager.mjs +40 -0
  254. package/dist/pull-requests/github-label-manager.mjs.map +1 -0
  255. package/dist/pull-requests/github-publisher.d.mts +53 -0
  256. package/dist/pull-requests/github-publisher.mjs +345 -0
  257. package/dist/pull-requests/github-publisher.mjs.map +1 -0
  258. package/dist/pull-requests.d.mts +5 -0
  259. package/dist/pull-requests.mjs +4 -0
  260. package/dist/receipts.d.mts +4 -0
  261. package/dist/receipts.mjs +3 -0
  262. package/dist/repositories.d.mts +18 -0
  263. package/dist/repositories.mjs +33 -0
  264. package/dist/repositories.mjs.map +1 -0
  265. package/dist/sandbox/command.d.mts +18 -0
  266. package/dist/sandbox/execution-abort.d.mts +16 -0
  267. package/dist/sandbox/execution-abort.mjs +49 -0
  268. package/dist/sandbox/execution-abort.mjs.map +1 -0
  269. package/dist/sandbox/execution-environment.d.mts +25 -0
  270. package/dist/sandbox/execution-run-ledger.d.mts +115 -0
  271. package/dist/sandbox/execution-run-ledger.mjs +209 -0
  272. package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
  273. package/dist/sandbox/execution.d.mts +54 -0
  274. package/dist/sandbox/execution.mjs +228 -0
  275. package/dist/sandbox/execution.mjs.map +1 -0
  276. package/dist/sandbox/harness-runner.d.mts +79 -0
  277. package/dist/sandbox/harness-runner.mjs +162 -0
  278. package/dist/sandbox/harness-runner.mjs.map +1 -0
  279. package/dist/sandbox/index.d.mts +9 -0
  280. package/dist/sandbox/index.mjs +7 -0
  281. package/dist/sandbox/task-environment.d.mts +50 -0
  282. package/dist/sandbox/task-environment.mjs +140 -0
  283. package/dist/sandbox/task-environment.mjs.map +1 -0
  284. package/dist/sandbox/workspace.d.mts +29 -0
  285. package/dist/sandbox/workspace.mjs +28 -0
  286. package/dist/sandbox/workspace.mjs.map +1 -0
  287. package/dist/schema/agent-route.d.mts +22 -0
  288. package/dist/schema/agent-route.mjs +15 -0
  289. package/dist/schema/agent-route.mjs.map +1 -0
  290. package/dist/schema/answer.d.mts +23 -0
  291. package/dist/schema/answer.mjs +21 -0
  292. package/dist/schema/answer.mjs.map +1 -0
  293. package/dist/schema/budget.d.mts +38 -0
  294. package/dist/schema/budget.mjs +30 -0
  295. package/dist/schema/budget.mjs.map +1 -0
  296. package/dist/schema/catalog.mjs +72 -0
  297. package/dist/schema/catalog.mjs.map +1 -0
  298. package/dist/schema/change.d.mts +117 -0
  299. package/dist/schema/change.mjs +68 -0
  300. package/dist/schema/change.mjs.map +1 -0
  301. package/dist/schema/common.d.mts +33 -0
  302. package/dist/{id-DwCihQr4.mjs → schema/common.mjs} +7 -14
  303. package/dist/schema/common.mjs.map +1 -0
  304. package/dist/schema/communication.d.mts +52 -0
  305. package/dist/schema/communication.mjs +35 -0
  306. package/dist/schema/communication.mjs.map +1 -0
  307. package/dist/schema/execution.d.mts +101 -0
  308. package/dist/schema/execution.mjs +86 -0
  309. package/dist/schema/execution.mjs.map +1 -0
  310. package/dist/schema/factory-config.d.mts +95 -0
  311. package/dist/schema/factory-config.mjs +60 -0
  312. package/dist/schema/factory-config.mjs.map +1 -0
  313. package/dist/schema/finding.d.mts +125 -0
  314. package/dist/schema/finding.mjs +67 -0
  315. package/dist/schema/finding.mjs.map +1 -0
  316. package/dist/schema/id.d.mts +43 -0
  317. package/dist/schema/id.mjs +32 -0
  318. package/dist/schema/id.mjs.map +1 -0
  319. package/dist/schema/outbox.d.mts +240 -0
  320. package/dist/schema/outbox.mjs +53 -0
  321. package/dist/schema/outbox.mjs.map +1 -0
  322. package/dist/schema/question-route.mjs +16 -0
  323. package/dist/schema/question-route.mjs.map +1 -0
  324. package/dist/schema/receipt.d.mts +81 -0
  325. package/dist/schema/receipt.mjs +94 -0
  326. package/dist/schema/receipt.mjs.map +1 -0
  327. package/dist/schema/repository.d.mts +26 -0
  328. package/dist/schema/repository.mjs +25 -0
  329. package/dist/schema/repository.mjs.map +1 -0
  330. package/dist/schema/session.d.mts +135 -0
  331. package/dist/schema/session.mjs +53 -0
  332. package/dist/schema/session.mjs.map +1 -0
  333. package/dist/schema/signal.d.mts +105 -0
  334. package/dist/schema/signal.mjs +81 -0
  335. package/dist/schema/signal.mjs.map +1 -0
  336. package/dist/schema/stored-session.mjs +10 -0
  337. package/dist/schema/stored-session.mjs.map +1 -0
  338. package/dist/schema/stored-task.mjs +20 -0
  339. package/dist/schema/stored-task.mjs.map +1 -0
  340. package/dist/schema/task-effect.d.mts +39 -0
  341. package/dist/schema/task-effect.mjs +29 -0
  342. package/dist/schema/task-effect.mjs.map +1 -0
  343. package/dist/schema/task-graph.d.mts +3134 -0
  344. package/dist/schema/task-graph.mjs +97 -0
  345. package/dist/schema/task-graph.mjs.map +1 -0
  346. package/dist/schema/task-message.d.mts +254 -0
  347. package/dist/schema/task-message.mjs +189 -0
  348. package/dist/schema/task-message.mjs.map +1 -0
  349. package/dist/schema/task.d.mts +272 -0
  350. package/dist/schema/task.mjs +199 -0
  351. package/dist/schema/task.mjs.map +1 -0
  352. package/dist/schema/transcript.d.mts +170 -0
  353. package/dist/schema/transcript.mjs +86 -0
  354. package/dist/schema/transcript.mjs.map +1 -0
  355. package/dist/schema/transitions.d.mts +50 -0
  356. package/dist/schema/transitions.mjs +303 -0
  357. package/dist/schema/transitions.mjs.map +1 -0
  358. package/dist/schema/work.d.mts +101 -0
  359. package/dist/schema/work.mjs +102 -0
  360. package/dist/schema/work.mjs.map +1 -0
  361. package/dist/signal-triage.d.mts +20 -0
  362. package/dist/signal-triage.mjs +85 -0
  363. package/dist/signal-triage.mjs.map +1 -0
  364. package/dist/signals.d.mts +19 -0
  365. package/dist/signals.mjs +19 -0
  366. package/dist/signals.mjs.map +1 -0
  367. package/dist/stall.d.mts +38 -0
  368. package/dist/stall.mjs +79 -0
  369. package/dist/stall.mjs.map +1 -0
  370. package/dist/storage.d.mts +4 -0
  371. package/dist/storage.mjs +4 -0
  372. package/dist/store/driver.d.mts +65 -0
  373. package/dist/store/driver.mjs +42 -0
  374. package/dist/store/driver.mjs.map +1 -0
  375. package/dist/store/engine.d.mts +485 -0
  376. package/dist/store/engine.mjs +2175 -0
  377. package/dist/store/engine.mjs.map +1 -0
  378. package/dist/store/memory.d.mts +7 -0
  379. package/dist/store/memory.mjs +52 -0
  380. package/dist/store/memory.mjs.map +1 -0
  381. package/dist/store/task-effects.d.mts +38 -0
  382. package/dist/store/task-effects.mjs +118 -0
  383. package/dist/store/task-effects.mjs.map +1 -0
  384. package/dist/store/task-graphs.d.mts +60 -0
  385. package/dist/store/task-graphs.mjs +212 -0
  386. package/dist/store/task-graphs.mjs.map +1 -0
  387. package/dist/store/task-messages.d.mts +136 -0
  388. package/dist/store/task-messages.mjs +475 -0
  389. package/dist/store/task-messages.mjs.map +1 -0
  390. package/dist/store/task-work.d.mts +65 -0
  391. package/dist/store/task-work.mjs +134 -0
  392. package/dist/store/task-work.mjs.map +1 -0
  393. package/dist/store/work-notifications.d.mts +19 -0
  394. package/dist/store/work-notifications.mjs +48 -0
  395. package/dist/store/work-notifications.mjs.map +1 -0
  396. package/dist/sweep.d.mts +57 -0
  397. package/dist/sweep.mjs +143 -0
  398. package/dist/sweep.mjs.map +1 -0
  399. package/dist/task-communication.d.mts +35 -0
  400. package/dist/task-communication.mjs +47 -0
  401. package/dist/task-communication.mjs.map +1 -0
  402. package/dist/task-graph-view.d.mts +264 -0
  403. package/dist/task-graph-view.mjs +17 -0
  404. package/dist/task-graph-view.mjs.map +1 -0
  405. package/dist/task-message-processing.d.mts +60 -0
  406. package/dist/task-message-processing.mjs +200 -0
  407. package/dist/task-message-processing.mjs.map +1 -0
  408. package/dist/task-protocols.d.mts +80 -0
  409. package/dist/task-protocols.mjs +47 -0
  410. package/dist/task-protocols.mjs.map +1 -0
  411. package/dist/tasks.d.mts +17 -0
  412. package/dist/tasks.mjs +17 -0
  413. package/dist/vercel-git.d.mts +21 -0
  414. package/dist/vercel-git.mjs +112 -0
  415. package/dist/vercel-git.mjs.map +1 -0
  416. package/dist/vercel.d.mts +33 -2
  417. package/dist/vercel.mjs +48 -3
  418. package/dist/vercel.mjs.map +1 -1
  419. package/dist/work-triage/eve-tool.d.mts +29 -0
  420. package/dist/work-triage/eve-tool.mjs +32 -0
  421. package/dist/work-triage/eve-tool.mjs.map +1 -0
  422. package/dist/work-triage/find-existing-work.d.mts +32 -0
  423. package/dist/work-triage/find-existing-work.mjs +31 -0
  424. package/dist/work-triage/find-existing-work.mjs.map +1 -0
  425. package/dist/work-triage/github.d.mts +15 -0
  426. package/dist/work-triage/github.mjs +14 -0
  427. package/dist/work-triage/github.mjs.map +1 -0
  428. package/dist/work-triage.d.mts +3 -0
  429. package/dist/work-triage.mjs +3 -0
  430. package/dist/workflows.d.mts +48 -0
  431. package/dist/workflows.mjs +86 -0
  432. package/dist/workflows.mjs.map +1 -0
  433. package/dist/workspace-diff-assembly.d.mts +33 -0
  434. package/dist/workspace-diff-assembly.mjs +95 -0
  435. package/dist/workspace-diff-assembly.mjs.map +1 -0
  436. package/dist/workspace-diff.d.mts +90 -0
  437. package/dist/workspace-diff.mjs +61 -0
  438. package/dist/workspace-diff.mjs.map +1 -0
  439. package/dist/workspace-snapshot.d.mts +26 -0
  440. package/dist/workspace-snapshot.mjs +80 -0
  441. package/dist/workspace-snapshot.mjs.map +1 -0
  442. package/package.json +129 -40
  443. package/dist/approval-CwhTP1XB.mjs +0 -269
  444. package/dist/approval-CwhTP1XB.mjs.map +0 -1
  445. package/dist/change-CzEAoFVE.mjs +0 -620
  446. package/dist/change-CzEAoFVE.mjs.map +0 -1
  447. package/dist/dispatch-B77cuPxh.d.mts +0 -713
  448. package/dist/driver-BJutB0PE.d.mts +0 -34
  449. package/dist/driver-Bbd25rNM.mjs +0 -23
  450. package/dist/driver-Bbd25rNM.mjs.map +0 -1
  451. package/dist/factory-config-BJcjsPKl.mjs +0 -86
  452. package/dist/factory-config-BJcjsPKl.mjs.map +0 -1
  453. package/dist/factory-config-D2yU3G0c.d.mts +0 -58
  454. package/dist/github-DXsxboUL.d.mts +0 -271
  455. package/dist/id-DwCihQr4.mjs.map +0 -1
  456. package/dist/index-Cy4jfXh5.d.mts +0 -67
  457. package/dist/index.mjs.map +0 -1
  458. package/dist/signal-CHVEmzvI.d.mts +0 -59
package/dist/github.mjs CHANGED
@@ -1,21 +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
  });
110
+ const readablePullRequestSchema = pullRequestSchema.extend({
111
+ state: z.enum(["open", "closed"]),
112
+ user: z.object({
113
+ login: z.string().min(1),
114
+ type: z.string().optional()
115
+ })
116
+ });
10
117
  const pullRequestHeadSchema = z.object({ head: z.object({
11
118
  ref: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/).refine((value) => !value.includes("..")),
12
119
  sha: z.string().regex(/^[0-9a-f]{40}$/),
13
- repo: z.object({ full_name: z.string().min(1) })
120
+ repo: z.object({ full_name: gitHubRepositorySlugSchema })
14
121
  }) });
15
122
  const reviewCommentSchema = z.object({
16
123
  id: z.number().int().positive(),
17
124
  body: z.string(),
18
125
  html_url: z.url(),
126
+ pull_request_url: z.url(),
19
127
  user: z.object({ login: z.string().min(1) }),
20
128
  in_reply_to_id: z.number().int().positive().nullish()
21
129
  });
@@ -73,7 +181,7 @@ const pullRequestCandidateSchema = z.object({
73
181
  user: z.object({ type: z.string().min(1) }),
74
182
  head: z.object({
75
183
  ref: z.string().min(1),
76
- repo: z.object({ full_name: z.string().min(1) })
184
+ repo: z.object({ full_name: gitHubRepositorySlugSchema })
77
185
  })
78
186
  });
79
187
  const openPullRequestsSchema = z.array(pullRequestCandidateSchema);
@@ -87,6 +195,14 @@ const pullRequestDetailSchema = pullRequestCandidateSchema.extend({
87
195
  sha: z.string().min(1)
88
196
  })
89
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
+ });
90
206
  const collaboratorPermissionSchema = z.object({ permission: z.enum([
91
207
  "admin",
92
208
  "maintain",
@@ -100,6 +216,7 @@ const writePermissions = /* @__PURE__ */ new Set([
100
216
  "maintain",
101
217
  "write"
102
218
  ]);
219
+ /** Refusal raised when an inline review-comment author lacks repository write access. */
103
220
  var GitHubReviewCommentAuthorError = class extends Error {
104
221
  author;
105
222
  constructor(author) {
@@ -108,6 +225,28 @@ var GitHubReviewCommentAuthorError = class extends Error {
108
225
  this.author = author;
109
226
  }
110
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
+ }
111
250
  /** Create a pull request from an existing head branch. */
112
251
  async function createPullRequest(input) {
113
252
  const pull = pullRequestSchema.parse(await gitHubRequest(input, "/pulls", {
@@ -121,14 +260,13 @@ async function createPullRequest(input) {
121
260
  })
122
261
  }));
123
262
  return {
124
- prNumber: pull.number,
125
- prUrl: pull.html_url
263
+ pullRequestNumber: pull.number,
264
+ pullRequestUrl: pull.html_url
126
265
  };
127
266
  }
128
267
  /** Create a check run for one commit. Requires a GitHub App token with checks:write. */
129
268
  async function createCheckRun(input) {
130
- if (input.status === "completed" && input.conclusion === void 0) throw new Error("completed check runs require a conclusion");
131
- if (input.status !== "completed" && input.conclusion !== void 0) throw new Error("creating a check run with a conclusion requires completed status");
269
+ assertCheckRunFields(input);
132
270
  return parseCheckRun(await gitHubRequest(input, "/check-runs", {
133
271
  method: "POST",
134
272
  body: JSON.stringify({
@@ -140,7 +278,7 @@ async function createCheckRun(input) {
140
278
  }
141
279
  /** Update a check run previously created by the authenticated GitHub App. */
142
280
  async function updateCheckRun(input) {
143
- 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);
144
282
  return parseCheckRun(await gitHubRequest(input, `/check-runs/${positiveInteger(input.checkRunId, "checkRunId")}`, {
145
283
  method: "PATCH",
146
284
  body: JSON.stringify({
@@ -178,25 +316,47 @@ async function updatePullRequestComment(input) {
178
316
  body: JSON.stringify({ body: input.body })
179
317
  }));
180
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
+ }
181
338
  /** Read one inline review comment after applying the author policy, which requires write access by default. */
182
339
  async function readReviewComment(input) {
183
340
  const comment = parseReviewComment(await gitHubRequest(input, `/pulls/comments/${positiveInteger(input.commentId, "commentId")}`));
341
+ assertReviewCommentPullRequest(input, comment);
184
342
  await assertReviewCommentAuthor(input, comment.author);
185
343
  return comment;
186
344
  }
187
345
  /** Reply to an inline review comment after applying the author policy, which requires write access by default. */
188
346
  async function answerReviewComment(input) {
189
347
  await readReviewComment(input);
190
- 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`, {
191
349
  method: "POST",
192
350
  body: JSON.stringify({ body: input.body })
193
351
  }));
352
+ assertReviewCommentPullRequest(input, reply);
353
+ return reply;
194
354
  }
195
355
  /** Submit a summary and optional inline comments against a reviewed pull request commit. */
196
356
  async function submitPullRequestReview(input) {
197
357
  const commitId = z.string().regex(/^[0-9a-f]{40}$/).parse(input.commitId);
198
358
  const head = await readPullRequestHead(input);
199
- 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);
200
360
  const review = submittedReviewSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/reviews`, {
201
361
  method: "POST",
202
362
  body: JSON.stringify({
@@ -223,7 +383,32 @@ async function readPullRequestHead(input) {
223
383
  return {
224
384
  branch: pull.head.ref,
225
385
  sha: pull.head.sha,
226
- repository: pull.head.repo.full_name.toLowerCase()
386
+ repository: pull.head.repo.full_name
387
+ };
388
+ }
389
+ /** Read the provider-owned identity and lifecycle of one pull request. */
390
+ async function readPullRequest(input) {
391
+ const pull = readablePullRequestSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}`));
392
+ return {
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,
409
+ author: pull.user.login,
410
+ authorType: pull.user.type,
411
+ state: pull.state
227
412
  };
228
413
  }
229
414
  /** List open, same-repository pull requests by one author that GitHub reports as conflicting. */
@@ -233,8 +418,8 @@ async function listConflictedPullRequests(input) {
233
418
  for (const candidate of candidates) {
234
419
  const pull = pullRequestDetailSchema.parse(await gitHubRequest(input, `/pulls/${candidate.number}`));
235
420
  if (pull.mergeable === false || pull.mergeable_state === "dirty") conflicted.push({
236
- prNumber: pull.number,
237
- prUrl: pull.html_url,
421
+ pullRequestNumber: pull.number,
422
+ pullRequestUrl: pull.html_url,
238
423
  headBranch: pull.head.ref,
239
424
  headSha: pull.head.sha,
240
425
  baseBranch: pull.base.ref,
@@ -243,6 +428,17 @@ async function listConflictedPullRequests(input) {
243
428
  }
244
429
  return conflicted;
245
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
+ }
246
442
  /** Add one label to a pull request. */
247
443
  async function addLabel(input) {
248
444
  return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels`, {
@@ -255,8 +451,8 @@ async function removeLabel(input) {
255
451
  return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels/${encodeURIComponent(input.label)}`, { method: "DELETE" }));
256
452
  }
257
453
  async function gitHubRequest(input, path, init = {}) {
258
- if (!repositorySlugPattern.test(input.repository)) throw new Error(`invalid GitHub repository slug: ${input.repository}`);
259
- 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}`, {
260
456
  ...init,
261
457
  headers: {
262
458
  Accept: "application/vnd.github+json",
@@ -275,14 +471,21 @@ async function gitHubRequest(input, path, init = {}) {
275
471
  }
276
472
  function parseReviewComment(value) {
277
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");
278
476
  return {
279
477
  id: comment.id,
478
+ pullRequestNumber: positiveInteger(Number(pullRequestMatch[1]), "pullRequestNumber"),
280
479
  body: comment.body,
281
480
  url: comment.html_url,
282
481
  author: comment.user.login,
283
482
  inReplyToId: comment.in_reply_to_id ?? null
284
483
  };
285
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
+ }
286
489
  function parseIssueComment(value) {
287
490
  const comment = issueCommentSchema.parse(value);
288
491
  return {
@@ -322,6 +525,14 @@ function checkRunFields(input) {
322
525
  ...input.output === void 0 ? {} : { output: checkRunOutput(input.output) }
323
526
  };
324
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
+ }
325
536
  function checkRunOutput(output) {
326
537
  return {
327
538
  title: output.title,
@@ -342,8 +553,10 @@ function checkRunOutput(output) {
342
553
  }
343
554
  async function assertReviewCommentAuthor(input, author) {
344
555
  if (input.authorPolicy === "any") return;
345
- const { permission } = collaboratorPermissionSchema.parse(await gitHubRequest(input, `/collaborators/${encodeURIComponent(author)}/permission`));
346
- if (!writePermissions.has(permission)) throw new GitHubReviewCommentAuthorError(author);
556
+ if (!await hasGitHubRepositoryWriteAccess({
557
+ ...input,
558
+ author
559
+ })) throw new GitHubReviewCommentAuthorError(author);
347
560
  }
348
561
  function positiveInteger(value, name) {
349
562
  if (!Number.isInteger(value) || value < 1) throw new Error(`${name} must be a positive integer`);
@@ -369,7 +582,7 @@ const pushEventSchema = z.looseObject({
369
582
  ref: z.string().min(1),
370
583
  repository: z.looseObject({
371
584
  default_branch: z.string().min(1),
372
- full_name: z.string().min(1)
585
+ full_name: gitHubRepositorySlugSchema
373
586
  })
374
587
  });
375
588
  /** Normalize a push to a repository's default branch for deterministic reconciliation. */
@@ -380,7 +593,7 @@ function normalizeGitHubDefaultBranchPush(options) {
380
593
  return {
381
594
  source: "github_default_branch_push",
382
595
  deliveryId: options.deliveryId,
383
- repositorySlug: parsed.data.repository.full_name.toLowerCase(),
596
+ repositorySlug: parsed.data.repository.full_name,
384
597
  defaultBranch: parsed.data.repository.default_branch
385
598
  };
386
599
  }
@@ -394,14 +607,14 @@ const pullRequestEventSchema = z.looseObject({
394
607
  head: z.looseObject({
395
608
  sha: z.string().regex(/^[0-9a-f]{40}$/),
396
609
  ref: z.string().min(1),
397
- repo: z.looseObject({ full_name: z.string().min(1) })
610
+ repo: z.looseObject({ full_name: gitHubRepositorySlugSchema })
398
611
  }),
399
612
  base: z.looseObject({
400
613
  sha: z.string().regex(/^[0-9a-f]{40}$/),
401
614
  ref: z.string().min(1)
402
615
  })
403
616
  }),
404
- repository: z.looseObject({ full_name: z.string().min(1) }),
617
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
405
618
  sender: z.looseObject({ login: z.string().min(1) })
406
619
  });
407
620
  const reviewablePullRequestActions = /* @__PURE__ */ new Set([
@@ -416,7 +629,7 @@ function normalizeGitHubPullRequest(options) {
416
629
  const parsed = pullRequestEventSchema.safeParse(options.payload);
417
630
  if (!parsed.success || !reviewablePullRequestActions.has(parsed.data.action)) return null;
418
631
  if (parsed.data.pull_request.draft && parsed.data.action !== "ready_for_review") return null;
419
- const slug = parsed.data.repository.full_name.toLowerCase();
632
+ const slug = parsed.data.repository.full_name;
420
633
  const pull = parsed.data.pull_request;
421
634
  return {
422
635
  source: "github_pr",
@@ -427,13 +640,13 @@ function normalizeGitHubPullRequest(options) {
427
640
  address: `${slug}/pull/${parsed.data.number}`
428
641
  },
429
642
  pullRequest: {
430
- number: parsed.data.number,
431
- url: pull.html_url,
643
+ pullRequestNumber: parsed.data.number,
644
+ pullRequestUrl: pull.html_url,
432
645
  author: pull.user.login,
433
646
  draft: pull.draft,
434
647
  headSha: pull.head.sha,
435
648
  headBranch: pull.head.ref,
436
- headRepositorySlug: pull.head.repo.full_name.toLowerCase(),
649
+ headRepositorySlug: pull.head.repo.full_name,
437
650
  baseSha: pull.base.sha,
438
651
  baseBranch: pull.base.ref,
439
652
  sender: parsed.data.sender.login
@@ -448,7 +661,7 @@ const issueEventSchema = z.looseObject({
448
661
  title: z.string(),
449
662
  body: z.string().nullable()
450
663
  }),
451
- repository: z.looseObject({ full_name: z.string().min(1) })
664
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema })
452
665
  });
453
666
  const failedWorkflowConclusions = /* @__PURE__ */ new Set([
454
667
  "action_required",
@@ -461,14 +674,14 @@ const workflowRunEventSchema = z.looseObject({
461
674
  action: z.string(),
462
675
  repository: z.looseObject({
463
676
  default_branch: z.string().min(1),
464
- full_name: z.string().min(1)
677
+ full_name: gitHubRepositorySlugSchema
465
678
  }),
466
679
  workflow_run: z.looseObject({
467
680
  id: z.number().int().min(1),
468
681
  name: z.string().min(1),
469
682
  event: z.string().min(1),
470
683
  head_branch: z.string().min(1).nullable(),
471
- head_repository: z.looseObject({ full_name: z.string().min(1) }).nullable(),
684
+ head_repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }).nullable(),
472
685
  head_sha: z.string().min(1),
473
686
  html_url: z.url(),
474
687
  conclusion: z.string().nullable(),
@@ -484,7 +697,7 @@ function normalizeGitHubIssueOpened(options) {
484
697
  if (options.event !== "issues") return null;
485
698
  const parsed = issueEventSchema.safeParse(options.payload);
486
699
  if (!parsed.success || parsed.data.action !== "opened") return null;
487
- const slug = parsed.data.repository.full_name.toLowerCase();
700
+ const slug = parsed.data.repository.full_name;
488
701
  const { number, title, body } = parsed.data.issue;
489
702
  return {
490
703
  source: "github_issue",
@@ -511,7 +724,7 @@ const pullRequestClosedSchema = z.looseObject({
511
724
  merged_by: z.looseObject({ login: z.string().min(1) }).nullable().optional(),
512
725
  merge_commit_sha: z.string().regex(/^[0-9a-f]{40}$/).nullable().optional()
513
726
  }),
514
- repository: z.looseObject({ full_name: z.string().min(1) }),
727
+ repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
515
728
  sender: z.looseObject({ login: z.string().min(1) })
516
729
  });
517
730
  /**
@@ -528,9 +741,9 @@ function normalizeGitHubPullRequestClosed(options) {
528
741
  return {
529
742
  source: "github_pull_request_closed",
530
743
  deliveryId: options.deliveryId,
531
- repositorySlug: parsed.data.repository.full_name.toLowerCase(),
532
- prNumber: pr.number,
533
- prUrl: pr.html_url,
744
+ repositorySlug: parsed.data.repository.full_name,
745
+ pullRequestNumber: pr.number,
746
+ pullRequestUrl: pr.html_url,
534
747
  merged: pr.merged,
535
748
  mergeCommitSha: pr.merged ? pr.merge_commit_sha ?? null : null,
536
749
  decidedBy: pr.merged ? pr.merged_by?.login ?? sender : sender
@@ -544,7 +757,7 @@ function normalizeGitHubWorkflowRunFailure(options) {
544
757
  const run = parsed.data.workflow_run;
545
758
  const conclusion = run.conclusion;
546
759
  if (conclusion === null || !failedWorkflowConclusions.has(conclusion)) return null;
547
- const slug = parsed.data.repository.full_name.toLowerCase();
760
+ const slug = parsed.data.repository.full_name;
548
761
  return {
549
762
  source: "github_ci_failure",
550
763
  deliveryId: options.deliveryId,
@@ -559,7 +772,7 @@ function normalizeGitHubWorkflowRunFailure(options) {
559
772
  name: run.name,
560
773
  trigger: run.event,
561
774
  branch: run.head_branch,
562
- headRepositorySlug: run.head_repository?.full_name.toLowerCase() ?? null,
775
+ headRepositorySlug: run.head_repository?.full_name ?? null,
563
776
  headSha: run.head_sha,
564
777
  url: run.html_url,
565
778
  conclusion,
@@ -569,6 +782,6 @@ function normalizeGitHubWorkflowRunFailure(options) {
569
782
  };
570
783
  }
571
784
  //#endregion
572
- export { GitHubReviewCommentAuthorError, addLabel, answerReviewComment, createCheckRun, createPullRequest, createPullRequestComment, listCheckRunsForRef, listConflictedPullRequests, listPullRequestComments, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, 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 };
573
786
 
574
787
  //# sourceMappingURL=github.mjs.map