@vercel/factory 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (510) hide show
  1. package/CHANGELOG.md +356 -0
  2. package/README.md +96 -2
  3. package/dist/agent-routes.d.mts +113 -0
  4. package/dist/agent-routes.mjs +91 -0
  5. package/dist/agent-routes.mjs.map +1 -0
  6. package/dist/api-contracts.d.mts +1768 -0
  7. package/dist/api-contracts.mjs +119 -0
  8. package/dist/api-contracts.mjs.map +1 -0
  9. package/dist/api-images.d.mts +30 -0
  10. package/dist/api-images.mjs +28 -0
  11. package/dist/api-images.mjs.map +1 -0
  12. package/dist/api-task-graph.mjs +57 -0
  13. package/dist/api-task-graph.mjs.map +1 -0
  14. package/dist/api.d.mts +111 -216
  15. package/dist/api.mjs +1063 -99
  16. package/dist/api.mjs.map +1 -1
  17. package/dist/approval-access.d.mts +39 -0
  18. package/dist/approval-access.mjs +62 -0
  19. package/dist/approval-access.mjs.map +1 -0
  20. package/dist/approval-contracts.d.mts +698 -0
  21. package/dist/approval-contracts.mjs +27 -0
  22. package/dist/approval-contracts.mjs.map +1 -0
  23. package/dist/approval.d.mts +49 -0
  24. package/dist/approval.mjs +39 -0
  25. package/dist/approval.mjs.map +1 -0
  26. package/dist/blob/artifacts.d.mts +37 -0
  27. package/dist/blob/artifacts.mjs +45 -0
  28. package/dist/blob/artifacts.mjs.map +1 -0
  29. package/dist/blob/index.d.mts +84 -12
  30. package/dist/blob/index.mjs +179 -45
  31. package/dist/blob/index.mjs.map +1 -1
  32. package/dist/budget.d.mts +115 -0
  33. package/dist/budget.mjs +147 -0
  34. package/dist/budget.mjs.map +1 -0
  35. package/dist/budgets.d.mts +4 -0
  36. package/dist/budgets.mjs +4 -0
  37. package/dist/build-factory.d.mts +7 -4
  38. package/dist/build-factory.mjs +2 -1
  39. package/dist/build-factory.mjs.map +1 -1
  40. package/dist/change-verification/brief.d.mts +9 -0
  41. package/dist/change-verification/brief.mjs +13 -0
  42. package/dist/change-verification/brief.mjs.map +1 -0
  43. package/dist/change-verification/dispatch.d.mts +37 -0
  44. package/dist/change-verification/dispatch.mjs +83 -0
  45. package/dist/change-verification/dispatch.mjs.map +1 -0
  46. package/dist/change-verification/eve-tool.d.mts +61 -0
  47. package/dist/change-verification/eve-tool.mjs +89 -0
  48. package/dist/change-verification/eve-tool.mjs.map +1 -0
  49. package/dist/change-verification/result.mjs +130 -0
  50. package/dist/change-verification/result.mjs.map +1 -0
  51. package/dist/changes/eve-record-change.d.mts +56 -0
  52. package/dist/changes/eve-record-change.mjs +131 -0
  53. package/dist/changes/eve-record-change.mjs.map +1 -0
  54. package/dist/changes/presentation.d.mts +14 -0
  55. package/dist/changes.d.mts +24 -0
  56. package/dist/changes.mjs +29 -0
  57. package/dist/changes.mjs.map +1 -0
  58. package/dist/client-events.d.mts +25 -0
  59. package/dist/client-events.mjs +45 -0
  60. package/dist/client-events.mjs.map +1 -0
  61. package/dist/client-stream.d.mts +28 -0
  62. package/dist/client-stream.mjs +210 -0
  63. package/dist/client-stream.mjs.map +1 -0
  64. package/dist/client-transcript.d.mts +41 -0
  65. package/dist/client-transcript.mjs +233 -0
  66. package/dist/client-transcript.mjs.map +1 -0
  67. package/dist/client.d.mts +343 -0
  68. package/dist/client.mjs +366 -0
  69. package/dist/client.mjs.map +1 -0
  70. package/dist/code-review/contracts.d.mts +27 -0
  71. package/dist/code-review/eve-post-review.d.mts +70 -0
  72. package/dist/code-review/eve-post-review.mjs +195 -0
  73. package/dist/code-review/eve-post-review.mjs.map +1 -0
  74. package/dist/code-review/eve-review-comments.d.mts +75 -0
  75. package/dist/code-review/eve-review-comments.mjs +193 -0
  76. package/dist/code-review/eve-review-comments.mjs.map +1 -0
  77. package/dist/code-review/github-contracts.d.mts +10 -0
  78. package/dist/code-review/github-reporter.d.mts +46 -0
  79. package/dist/code-review/github-reporter.mjs +262 -0
  80. package/dist/code-review/github-reporter.mjs.map +1 -0
  81. package/dist/code-review/preparation.d.mts +34 -0
  82. package/dist/code-review/preparation.mjs +23 -0
  83. package/dist/code-review/preparation.mjs.map +1 -0
  84. package/dist/code-review/stall.d.mts +17 -0
  85. package/dist/code-review/stall.mjs +30 -0
  86. package/dist/code-review/stall.mjs.map +1 -0
  87. package/dist/code-review.d.mts +7 -0
  88. package/dist/code-review.mjs +5 -0
  89. package/dist/communication.d.mts +9 -0
  90. package/dist/communication.mjs +9 -0
  91. package/dist/connectors/github.d.mts +26 -0
  92. package/dist/connectors/github.mjs +55 -0
  93. package/dist/connectors/github.mjs.map +1 -0
  94. package/dist/connectors/index.d.mts +35 -3
  95. package/dist/connectors/index.mjs +3 -52
  96. package/dist/connectors/index.mjs.map +1 -1
  97. package/dist/connectors/outbox.d.mts +34 -0
  98. package/dist/connectors/outbox.mjs +50 -0
  99. package/dist/connectors/outbox.mjs.map +1 -0
  100. package/dist/connectors/slack-approval-blocks.mjs +136 -0
  101. package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
  102. package/dist/connectors/slack-approvals.d.mts +29 -0
  103. package/dist/connectors/slack-approvals.mjs +346 -0
  104. package/dist/connectors/slack-approvals.mjs.map +1 -0
  105. package/dist/connectors/slack.d.mts +35 -52
  106. package/dist/connectors/slack.mjs +13 -85
  107. package/dist/connectors/slack.mjs.map +1 -1
  108. package/dist/deepsec/eve-tool.d.mts +110 -0
  109. package/dist/deepsec/eve-tool.mjs +166 -0
  110. package/dist/deepsec/eve-tool.mjs.map +1 -0
  111. package/dist/deepsec/finding.d.mts +84 -0
  112. package/dist/deepsec/finding.mjs +56 -0
  113. package/dist/deepsec/finding.mjs.map +1 -0
  114. package/dist/deepsec.d.mts +3 -0
  115. package/dist/delivery-metrics/metrics.d.mts +93 -0
  116. package/dist/delivery-metrics/metrics.mjs +200 -0
  117. package/dist/delivery-metrics/metrics.mjs.map +1 -0
  118. package/dist/delivery-metrics.d.mts +2 -0
  119. package/dist/delivery-metrics.mjs +2 -0
  120. package/dist/dispatch.d.mts +152 -0
  121. package/dist/dispatch.mjs +199 -0
  122. package/dist/dispatch.mjs.map +1 -0
  123. package/dist/errors.d.mts +15 -0
  124. package/dist/errors.mjs +38 -0
  125. package/dist/errors.mjs.map +1 -0
  126. package/dist/eve/index.d.mts +209 -1277
  127. package/dist/eve/index.mjs +312 -1073
  128. package/dist/eve/index.mjs.map +1 -1
  129. package/dist/eve/invoke.d.mts +144 -0
  130. package/dist/eve/invoke.mjs +254 -0
  131. package/dist/eve/invoke.mjs.map +1 -0
  132. package/dist/eve/session-client.d.mts +186 -0
  133. package/dist/eve/session-client.mjs +245 -0
  134. package/dist/eve/session-client.mjs.map +1 -0
  135. package/dist/eve/task-execution.d.mts +380 -0
  136. package/dist/eve/task-execution.mjs +73 -0
  137. package/dist/eve/task-execution.mjs.map +1 -0
  138. package/dist/eve/task-session.d.mts +129 -0
  139. package/dist/eve/task-session.mjs +245 -0
  140. package/dist/eve/task-session.mjs.map +1 -0
  141. package/dist/eve/transcript.d.mts +37 -0
  142. package/dist/eve/transcript.mjs +69 -0
  143. package/dist/eve/transcript.mjs.map +1 -0
  144. package/dist/execution-public.d.mts +8 -0
  145. package/dist/execution-public.mjs +7 -0
  146. package/dist/execution.d.mts +183 -0
  147. package/dist/execution.mjs +223 -0
  148. package/dist/execution.mjs.map +1 -0
  149. package/dist/finding-remediation/admission.d.mts +53 -0
  150. package/dist/finding-remediation/admission.mjs +90 -0
  151. package/dist/finding-remediation/admission.mjs.map +1 -0
  152. package/dist/finding-remediation/brief.d.mts +14 -0
  153. package/dist/finding-remediation/brief.mjs +25 -0
  154. package/dist/finding-remediation/brief.mjs.map +1 -0
  155. package/dist/finding-remediation/eve-tool.d.mts +29 -0
  156. package/dist/finding-remediation/eve-tool.mjs +34 -0
  157. package/dist/finding-remediation/eve-tool.mjs.map +1 -0
  158. package/dist/findings/fingerprint.d.mts +14 -0
  159. package/dist/findings/fingerprint.mjs +28 -0
  160. package/dist/findings/fingerprint.mjs.map +1 -0
  161. package/dist/findings.d.mts +7 -0
  162. package/dist/findings.mjs +6 -0
  163. package/dist/github-app.d.mts +54 -0
  164. package/dist/github-app.mjs +121 -0
  165. package/dist/github-app.mjs.map +1 -0
  166. package/dist/github-publication.d.mts +199 -0
  167. package/dist/github-publication.mjs +442 -0
  168. package/dist/github-publication.mjs.map +1 -0
  169. package/dist/github-transfer.d.mts +81 -0
  170. package/dist/github-transfer.mjs +273 -0
  171. package/dist/github-transfer.mjs.map +1 -0
  172. package/dist/github.d.mts +446 -2
  173. package/dist/github.mjs +357 -56
  174. package/dist/github.mjs.map +1 -1
  175. package/dist/image-input.d.mts +51 -0
  176. package/dist/image-input.mjs +63 -0
  177. package/dist/image-input.mjs.map +1 -0
  178. package/dist/inbox-activity.d.mts +53 -0
  179. package/dist/inbox-activity.mjs +41 -0
  180. package/dist/inbox-activity.mjs.map +1 -0
  181. package/dist/index.d.mts +16 -484
  182. package/dist/index.mjs +15 -522
  183. package/dist/intake-contracts.d.mts +55 -0
  184. package/dist/intake-contracts.mjs +33 -0
  185. package/dist/intake-contracts.mjs.map +1 -0
  186. package/dist/integrations/deepsec.d.mts +5 -0
  187. package/dist/integrations/deepsec.mjs +3 -0
  188. package/dist/integrations/github.d.mts +11 -0
  189. package/dist/integrations/github.mjs +9 -0
  190. package/dist/integrations/slack.d.mts +5 -0
  191. package/dist/integrations/slack.mjs +5 -0
  192. package/dist/integrations/vercel.d.mts +5 -0
  193. package/dist/integrations/vercel.mjs +4 -0
  194. package/dist/merge-resolution/contracts.d.mts +17 -0
  195. package/dist/merge-resolution/contracts.mjs +19 -0
  196. package/dist/merge-resolution/contracts.mjs.map +1 -0
  197. package/dist/merge-resolution/eve-tools.d.mts +47 -0
  198. package/dist/merge-resolution/eve-tools.mjs +122 -0
  199. package/dist/merge-resolution/eve-tools.mjs.map +1 -0
  200. package/dist/model-settings.d.mts +41 -0
  201. package/dist/model-settings.mjs +35 -0
  202. package/dist/model-settings.mjs.map +1 -0
  203. package/dist/multi-repository-changes/coordination.d.mts +49 -0
  204. package/dist/multi-repository-changes/coordination.mjs +115 -0
  205. package/dist/multi-repository-changes/coordination.mjs.map +1 -0
  206. package/dist/planning/cancellation.mjs +82 -0
  207. package/dist/planning/cancellation.mjs.map +1 -0
  208. package/dist/planning/configuration.d.mts +23 -0
  209. package/dist/planning/configuration.mjs +56 -0
  210. package/dist/planning/configuration.mjs.map +1 -0
  211. package/dist/planning/contracts.d.mts +136 -0
  212. package/dist/planning/contracts.mjs +42 -0
  213. package/dist/planning/contracts.mjs.map +1 -0
  214. package/dist/planning/dependencies.mjs +44 -0
  215. package/dist/planning/dependencies.mjs.map +1 -0
  216. package/dist/planning/effects.mjs +122 -0
  217. package/dist/planning/effects.mjs.map +1 -0
  218. package/dist/planning/reconcile.mjs +279 -0
  219. package/dist/planning/reconcile.mjs.map +1 -0
  220. package/dist/planning/runtime.d.mts +27 -0
  221. package/dist/planning/runtime.mjs +25 -0
  222. package/dist/planning/runtime.mjs.map +1 -0
  223. package/dist/planning/state.mjs +92 -0
  224. package/dist/planning/state.mjs.map +1 -0
  225. package/dist/planning/turns.mjs +262 -0
  226. package/dist/planning/turns.mjs.map +1 -0
  227. package/dist/planning/validation.mjs +106 -0
  228. package/dist/planning/validation.mjs.map +1 -0
  229. package/dist/postgres/index.d.mts +48 -1
  230. package/dist/postgres/index.mjs +45 -3
  231. package/dist/postgres/index.mjs.map +1 -1
  232. package/dist/presets/software-development/approval.d.mts +14 -0
  233. package/dist/presets/software-development/approval.mjs +21 -0
  234. package/dist/presets/software-development/approval.mjs.map +1 -0
  235. package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
  236. package/dist/presets/software-development/deepsec-brief.mjs +14 -0
  237. package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
  238. package/dist/presets/software-development/dispatch.d.mts +56 -0
  239. package/dist/presets/software-development/dispatch.mjs +67 -0
  240. package/dist/presets/software-development/dispatch.mjs.map +1 -0
  241. package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
  242. package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
  243. package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
  244. package/dist/presets/software-development/eve.d.mts +18 -0
  245. package/dist/presets/software-development/eve.mjs +19 -0
  246. package/dist/presets/software-development/eve.mjs.map +1 -0
  247. package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
  248. package/dist/presets/software-development/finish-task-policy.mjs +9 -0
  249. package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
  250. package/dist/presets/software-development/recovery.d.mts +32 -0
  251. package/dist/presets/software-development/recovery.mjs +120 -0
  252. package/dist/presets/software-development/recovery.mjs.map +1 -0
  253. package/dist/presets/software-development/task-communication.d.mts +24 -0
  254. package/dist/presets/software-development/task-communication.mjs +157 -0
  255. package/dist/presets/software-development/task-communication.mjs.map +1 -0
  256. package/dist/presets/software-development.d.mts +10 -0
  257. package/dist/presets/software-development.mjs +9 -0
  258. package/dist/pull-requests/contracts.d.mts +72 -0
  259. package/dist/pull-requests/eve-fetch.d.mts +57 -0
  260. package/dist/pull-requests/eve-fetch.mjs +151 -0
  261. package/dist/pull-requests/eve-fetch.mjs.map +1 -0
  262. package/dist/pull-requests/github-label-manager.d.mts +27 -0
  263. package/dist/pull-requests/github-label-manager.mjs +40 -0
  264. package/dist/pull-requests/github-label-manager.mjs.map +1 -0
  265. package/dist/pull-requests/github-publisher.d.mts +67 -0
  266. package/dist/pull-requests/github-publisher.mjs +405 -0
  267. package/dist/pull-requests/github-publisher.mjs.map +1 -0
  268. package/dist/pull-requests.d.mts +6 -0
  269. package/dist/pull-requests.mjs +4 -0
  270. package/dist/receipts.d.mts +4 -0
  271. package/dist/receipts.mjs +3 -0
  272. package/dist/repositories.d.mts +18 -0
  273. package/dist/repositories.mjs +33 -0
  274. package/dist/repositories.mjs.map +1 -0
  275. package/dist/sandbox/command.d.mts +18 -0
  276. package/dist/sandbox/execution-abort.d.mts +16 -0
  277. package/dist/sandbox/execution-abort.mjs +49 -0
  278. package/dist/sandbox/execution-abort.mjs.map +1 -0
  279. package/dist/sandbox/execution-environment.d.mts +25 -0
  280. package/dist/sandbox/execution-run-ledger.d.mts +115 -0
  281. package/dist/sandbox/execution-run-ledger.mjs +209 -0
  282. package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
  283. package/dist/sandbox/execution.d.mts +54 -0
  284. package/dist/sandbox/execution.mjs +228 -0
  285. package/dist/sandbox/execution.mjs.map +1 -0
  286. package/dist/sandbox/harness-runner.d.mts +79 -0
  287. package/dist/sandbox/harness-runner.mjs +162 -0
  288. package/dist/sandbox/harness-runner.mjs.map +1 -0
  289. package/dist/sandbox/index.d.mts +10 -0
  290. package/dist/sandbox/index.mjs +7 -0
  291. package/dist/sandbox/task-environment.d.mts +50 -0
  292. package/dist/sandbox/task-environment.mjs +140 -0
  293. package/dist/sandbox/task-environment.mjs.map +1 -0
  294. package/dist/sandbox/workspace.d.mts +29 -0
  295. package/dist/sandbox/workspace.mjs +28 -0
  296. package/dist/sandbox/workspace.mjs.map +1 -0
  297. package/dist/schema/agent-route.d.mts +40 -0
  298. package/dist/schema/agent-route.mjs +33 -0
  299. package/dist/schema/agent-route.mjs.map +1 -0
  300. package/dist/schema/answer.d.mts +23 -0
  301. package/dist/schema/answer.mjs +21 -0
  302. package/dist/schema/answer.mjs.map +1 -0
  303. package/dist/schema/budget.d.mts +38 -0
  304. package/dist/schema/budget.mjs +30 -0
  305. package/dist/schema/budget.mjs.map +1 -0
  306. package/dist/schema/catalog.mjs +72 -0
  307. package/dist/schema/catalog.mjs.map +1 -0
  308. package/dist/schema/change.d.mts +117 -0
  309. package/dist/schema/change.mjs +68 -0
  310. package/dist/schema/change.mjs.map +1 -0
  311. package/dist/schema/common.d.mts +33 -0
  312. package/dist/{id-BLIkCVue.mjs → schema/common.mjs} +7 -16
  313. package/dist/schema/common.mjs.map +1 -0
  314. package/dist/schema/communication.d.mts +52 -0
  315. package/dist/{communication-Kd9nU5RP.mjs → schema/communication.mjs} +8 -3
  316. package/dist/schema/communication.mjs.map +1 -0
  317. package/dist/schema/execution.d.mts +101 -0
  318. package/dist/schema/execution.mjs +86 -0
  319. package/dist/schema/execution.mjs.map +1 -0
  320. package/dist/schema/factory-config.d.mts +122 -0
  321. package/dist/schema/factory-config.mjs +90 -0
  322. package/dist/schema/factory-config.mjs.map +1 -0
  323. package/dist/schema/finding.d.mts +125 -0
  324. package/dist/schema/finding.mjs +67 -0
  325. package/dist/schema/finding.mjs.map +1 -0
  326. package/dist/schema/id.d.mts +43 -0
  327. package/dist/schema/id.mjs +32 -0
  328. package/dist/schema/id.mjs.map +1 -0
  329. package/dist/schema/outbox.d.mts +240 -0
  330. package/dist/schema/outbox.mjs +53 -0
  331. package/dist/schema/outbox.mjs.map +1 -0
  332. package/dist/schema/question-route.mjs +16 -0
  333. package/dist/schema/question-route.mjs.map +1 -0
  334. package/dist/schema/receipt.d.mts +81 -0
  335. package/dist/schema/receipt.mjs +94 -0
  336. package/dist/schema/receipt.mjs.map +1 -0
  337. package/dist/schema/repository.d.mts +30 -0
  338. package/dist/schema/repository.mjs +29 -0
  339. package/dist/schema/repository.mjs.map +1 -0
  340. package/dist/schema/session.d.mts +136 -0
  341. package/dist/schema/session.mjs +54 -0
  342. package/dist/schema/session.mjs.map +1 -0
  343. package/dist/schema/signal.d.mts +105 -0
  344. package/dist/schema/signal.mjs +81 -0
  345. package/dist/schema/signal.mjs.map +1 -0
  346. package/dist/schema/slack-pr-notifications.d.mts +12 -0
  347. package/dist/schema/slack-pr-notifications.mjs +11 -0
  348. package/dist/schema/slack-pr-notifications.mjs.map +1 -0
  349. package/dist/schema/stored-session.mjs +10 -0
  350. package/dist/schema/stored-session.mjs.map +1 -0
  351. package/dist/schema/stored-task.mjs +20 -0
  352. package/dist/schema/stored-task.mjs.map +1 -0
  353. package/dist/schema/task-effect.d.mts +39 -0
  354. package/dist/schema/task-effect.mjs +29 -0
  355. package/dist/schema/task-effect.mjs.map +1 -0
  356. package/dist/schema/task-graph.d.mts +3173 -0
  357. package/dist/schema/task-graph.mjs +97 -0
  358. package/dist/schema/task-graph.mjs.map +1 -0
  359. package/dist/schema/task-message.d.mts +254 -0
  360. package/dist/schema/task-message.mjs +189 -0
  361. package/dist/schema/task-message.mjs.map +1 -0
  362. package/dist/schema/task.d.mts +273 -0
  363. package/dist/schema/task.mjs +200 -0
  364. package/dist/schema/task.mjs.map +1 -0
  365. package/dist/schema/transcript.d.mts +176 -0
  366. package/dist/schema/transcript.mjs +87 -0
  367. package/dist/schema/transcript.mjs.map +1 -0
  368. package/dist/schema/transitions.d.mts +50 -0
  369. package/dist/schema/transitions.mjs +303 -0
  370. package/dist/schema/transitions.mjs.map +1 -0
  371. package/dist/schema/work.d.mts +150 -0
  372. package/dist/schema/work.mjs +102 -0
  373. package/dist/schema/work.mjs.map +1 -0
  374. package/dist/session-previews.d.mts +76 -0
  375. package/dist/session-previews.mjs +55 -0
  376. package/dist/session-previews.mjs.map +1 -0
  377. package/dist/session-review.d.mts +120 -0
  378. package/dist/session-review.mjs +79 -0
  379. package/dist/session-review.mjs.map +1 -0
  380. package/dist/signal-triage.d.mts +20 -0
  381. package/dist/signal-triage.mjs +85 -0
  382. package/dist/signal-triage.mjs.map +1 -0
  383. package/dist/signals.d.mts +20 -0
  384. package/dist/signals.mjs +19 -0
  385. package/dist/signals.mjs.map +1 -0
  386. package/dist/stall.d.mts +41 -0
  387. package/dist/stall.mjs +83 -0
  388. package/dist/stall.mjs.map +1 -0
  389. package/dist/storage.d.mts +4 -0
  390. package/dist/storage.mjs +4 -0
  391. package/dist/store/driver.d.mts +65 -0
  392. package/dist/store/driver.mjs +42 -0
  393. package/dist/store/driver.mjs.map +1 -0
  394. package/dist/store/engine.d.mts +683 -0
  395. package/dist/store/engine.mjs +2309 -0
  396. package/dist/store/engine.mjs.map +1 -0
  397. package/dist/store/memory.d.mts +24 -0
  398. package/dist/store/memory.mjs +69 -0
  399. package/dist/store/memory.mjs.map +1 -0
  400. package/dist/store/slack-pr-notifications.d.mts +44 -0
  401. package/dist/store/slack-pr-notifications.mjs +121 -0
  402. package/dist/store/slack-pr-notifications.mjs.map +1 -0
  403. package/dist/store/task-effects.d.mts +38 -0
  404. package/dist/store/task-effects.mjs +118 -0
  405. package/dist/store/task-effects.mjs.map +1 -0
  406. package/dist/store/task-graphs.d.mts +60 -0
  407. package/dist/store/task-graphs.mjs +212 -0
  408. package/dist/store/task-graphs.mjs.map +1 -0
  409. package/dist/store/task-messages.d.mts +136 -0
  410. package/dist/store/task-messages.mjs +475 -0
  411. package/dist/store/task-messages.mjs.map +1 -0
  412. package/dist/store/task-work.d.mts +180 -0
  413. package/dist/store/task-work.mjs +137 -0
  414. package/dist/store/task-work.mjs.map +1 -0
  415. package/dist/store/work-notifications.d.mts +19 -0
  416. package/dist/store/work-notifications.mjs +48 -0
  417. package/dist/store/work-notifications.mjs.map +1 -0
  418. package/dist/sweep.d.mts +79 -0
  419. package/dist/sweep.mjs +171 -0
  420. package/dist/sweep.mjs.map +1 -0
  421. package/dist/task-communication.d.mts +35 -0
  422. package/dist/task-communication.mjs +47 -0
  423. package/dist/task-communication.mjs.map +1 -0
  424. package/dist/task-graph-view.d.mts +267 -0
  425. package/dist/task-graph-view.mjs +17 -0
  426. package/dist/task-graph-view.mjs.map +1 -0
  427. package/dist/task-message-processing.d.mts +60 -0
  428. package/dist/task-message-processing.mjs +200 -0
  429. package/dist/task-message-processing.mjs.map +1 -0
  430. package/dist/task-protocols.d.mts +80 -0
  431. package/dist/task-protocols.mjs +47 -0
  432. package/dist/task-protocols.mjs.map +1 -0
  433. package/dist/tasks.d.mts +17 -0
  434. package/dist/tasks.mjs +17 -0
  435. package/dist/vercel-git.d.mts +53 -0
  436. package/dist/vercel-git.mjs +344 -0
  437. package/dist/vercel-git.mjs.map +1 -0
  438. package/dist/vercel-github-api.d.mts +103 -0
  439. package/dist/vercel-github-api.mjs +363 -0
  440. package/dist/vercel-github-api.mjs.map +1 -0
  441. package/dist/vercel.d.mts +34 -2
  442. package/dist/vercel.mjs +49 -3
  443. package/dist/vercel.mjs.map +1 -1
  444. package/dist/work-triage/eve-tool.d.mts +29 -0
  445. package/dist/work-triage/eve-tool.mjs +32 -0
  446. package/dist/work-triage/eve-tool.mjs.map +1 -0
  447. package/dist/work-triage/find-existing-work.d.mts +32 -0
  448. package/dist/work-triage/find-existing-work.mjs +31 -0
  449. package/dist/work-triage/find-existing-work.mjs.map +1 -0
  450. package/dist/work-triage/github.d.mts +15 -0
  451. package/dist/work-triage/github.mjs +14 -0
  452. package/dist/work-triage/github.mjs.map +1 -0
  453. package/dist/work-triage.d.mts +4 -0
  454. package/dist/work-triage.mjs +3 -0
  455. package/dist/workflows.d.mts +146 -0
  456. package/dist/workflows.mjs +139 -0
  457. package/dist/workflows.mjs.map +1 -0
  458. package/dist/workspace-diff-assembly.d.mts +33 -0
  459. package/dist/workspace-diff-assembly.mjs +95 -0
  460. package/dist/workspace-diff-assembly.mjs.map +1 -0
  461. package/dist/workspace-diff.d.mts +90 -0
  462. package/dist/workspace-diff.mjs +61 -0
  463. package/dist/workspace-diff.mjs.map +1 -0
  464. package/dist/workspace-files-git.d.mts +15 -0
  465. package/dist/workspace-files-git.mjs +61 -0
  466. package/dist/workspace-files-git.mjs.map +1 -0
  467. package/dist/workspace-files.d.mts +107 -0
  468. package/dist/workspace-files.mjs +74 -0
  469. package/dist/workspace-files.mjs.map +1 -0
  470. package/dist/workspace-snapshot.d.mts +26 -0
  471. package/dist/workspace-snapshot.mjs +80 -0
  472. package/dist/workspace-snapshot.mjs.map +1 -0
  473. package/docs/getting-started.md +104 -0
  474. package/docs/index.md +100 -0
  475. package/docs/recipes/cancellation.md +215 -0
  476. package/docs/recipes/custom-workflow.md +153 -0
  477. package/docs/recipes/dependent-tasks.md +207 -0
  478. package/docs/recipes/eve-agent.md +277 -0
  479. package/docs/recipes/human-input.md +204 -0
  480. package/docs/recipes/persistence-recovery.md +268 -0
  481. package/docs/recipes/retry-recovery.md +241 -0
  482. package/docs/recipes/task-messaging.md +215 -0
  483. package/docs/recipes/typed-eve-result.md +161 -0
  484. package/docs/runtime-integration.md +137 -0
  485. package/package.json +142 -46
  486. package/dist/approval-JX2Px9IC.mjs +0 -132
  487. package/dist/approval-JX2Px9IC.mjs.map +0 -1
  488. package/dist/budget-DzSiIA4t.mjs +0 -42
  489. package/dist/budget-DzSiIA4t.mjs.map +0 -1
  490. package/dist/change-D2U6v7Ek.mjs +0 -554
  491. package/dist/change-D2U6v7Ek.mjs.map +0 -1
  492. package/dist/communication-Kd9nU5RP.mjs.map +0 -1
  493. package/dist/coordination-Cq08hb1l.mjs +0 -76
  494. package/dist/coordination-Cq08hb1l.mjs.map +0 -1
  495. package/dist/dispatch-BaZS3PT8.d.mts +0 -76
  496. package/dist/driver-BC0Mt5KG.d.mts +0 -34
  497. package/dist/driver-Bbd25rNM.mjs +0 -23
  498. package/dist/driver-Bbd25rNM.mjs.map +0 -1
  499. package/dist/engine-DFHU2Pe-.d.mts +0 -781
  500. package/dist/engine-WaUM2cGA.mjs +0 -1068
  501. package/dist/engine-WaUM2cGA.mjs.map +0 -1
  502. package/dist/factory-config-BoRXOw43.mjs +0 -50
  503. package/dist/factory-config-BoRXOw43.mjs.map +0 -1
  504. package/dist/factory-config-D2yU3G0c.d.mts +0 -58
  505. package/dist/github-C5HNBN6p.d.mts +0 -279
  506. package/dist/id-BLIkCVue.mjs.map +0 -1
  507. package/dist/index-Bw6hggoH.d.mts +0 -40
  508. package/dist/index.mjs.map +0 -1
  509. package/dist/task-CcOyOJ3k.mjs +0 -154
  510. package/dist/task-CcOyOJ3k.mjs.map +0 -1
@@ -0,0 +1,104 @@
1
+ # Getting started with `@vercel/factory`
2
+
3
+ This guide isolates Factory's durable Task state with process-local storage. It calls no model,
4
+ Eve agent, provider, sandbox, HTTP endpoint, or planner, so it is safe to run as a local smoke
5
+ test. For the primary agent path, continue with
6
+ [Run an Eve agent as a Factory Task](recipes/eve-agent.md).
7
+
8
+ ## Requirements
9
+
10
+ - Node.js 24 or newer
11
+ - An ESM project (`"type": "module"` in `package.json`) or an `.mts` file
12
+ - `@vercel/factory` and its required `eve` and `zod` peers
13
+
14
+ Install them with your package manager:
15
+
16
+ ```sh
17
+ pnpm add @vercel/factory eve zod
18
+ ```
19
+
20
+ Optional storage, sandbox, and harness integrations have additional peer dependencies. Install
21
+ those only when you import the corresponding capability path; the package manifest declares their
22
+ supported ranges.
23
+
24
+ ## Run a local task
25
+
26
+ Save this as `factory-quickstart.mts`. The example uses only public capability entry points from
27
+ the installed package.
28
+
29
+ <!-- runnable-example:start -->
30
+
31
+ ```ts
32
+ import { repositoryIdSchema, repositoryScope } from "@vercel/factory";
33
+ import { createInMemoryDriver, createStores } from "@vercel/factory/storage";
34
+ import { taskWork } from "@vercel/factory/workflows";
35
+
36
+ const repositoryId = repositoryIdSchema.parse("repo_example");
37
+ const stores = createStores({ driver: createInMemoryDriver() });
38
+
39
+ const task = await stores.tasks.create({
40
+ repositoryIds: repositoryScope(repositoryId),
41
+ kind: "analysis",
42
+ origin: { operator: "local:quickstart" },
43
+ replyTo: { channel: "local", address: "quickstart" },
44
+ work: {
45
+ ...taskWork({
46
+ title: "Return a greeting",
47
+ input: { name: "Factory" },
48
+ }),
49
+ completionCriteria: ["Return a greeting for the supplied name"],
50
+ },
51
+ dedupeKey: "quickstart:greeting",
52
+ });
53
+
54
+ const running = await stores.tasks.transition(task.id, "running");
55
+ const completed = await stores.work.complete({
56
+ task: { taskId: running.id, attempt: running.attempt },
57
+ output: { greeting: "Hello, Factory!" },
58
+ });
59
+ const stored = await stores.tasks.get(task.id);
60
+
61
+ if (
62
+ completed.state !== "succeeded" ||
63
+ stored === null ||
64
+ stored.state !== "succeeded" ||
65
+ stored.workResult === undefined
66
+ ) {
67
+ throw new Error("Expected the Task to succeed");
68
+ }
69
+ if (JSON.stringify(stored.workResult.output) !== '{"greeting":"Hello, Factory!"}') {
70
+ throw new Error("Expected the completed greeting");
71
+ }
72
+
73
+ console.log(
74
+ JSON.stringify({ taskId: stored.id, state: stored.state, output: stored.workResult.output }),
75
+ );
76
+ ```
77
+
78
+ <!-- runnable-example:end -->
79
+
80
+ Run it directly with Node.js 24:
81
+
82
+ ```sh
83
+ node factory-quickstart.mts
84
+ ```
85
+
86
+ The command prints a generated Task ID, the `succeeded` state, and the validated output:
87
+
88
+ ```json
89
+ { "taskId": "task_<generated>", "state": "succeeded", "output": { "greeting": "Hello, Factory!" } }
90
+ ```
91
+
92
+ `createInMemoryDriver` is non-durable and intended for development and tests. A production factory
93
+ supplies a persistent driver and owns its authorization, workflow policy, credentials, and
94
+ provider configuration.
95
+
96
+ ## What happened
97
+
98
+ `taskWork` selected the built-in `task@1` workflow, which accepts bounded JSON input and output.
99
+ Task creation persisted a queued Task and its graph root. The explicit transition started the
100
+ Task, and `stores.work.complete` validated and recorded its output before moving it to `succeeded`.
101
+
102
+ Task kinds are descriptive. Workflow bindings select input and output contracts, and exact agent
103
+ routes select Eve agent execution. See the [documentation index](index.md) for typed workflows,
104
+ persistent storage, execution providers, Task messages, and operator clients.
package/docs/index.md ADDED
@@ -0,0 +1,100 @@
1
+ # `@vercel/factory` consumer documentation
2
+
3
+ These guides and declaration files ship with the installed package. They describe the same version
4
+ of `@vercel/factory` that your project resolves.
5
+
6
+ Start with [Run an Eve agent as a Factory Task](recipes/eve-agent.md) for the primary integration
7
+ path. The [local Task quickstart](getting-started.md) isolates the durable state model without
8
+ running an agent. Read [runtime composition](runtime-integration.md) when assembling a complete
9
+ factory.
10
+
11
+ ## Runnable recipes
12
+
13
+ Each recipe contains a complete, self-checking TypeScript program. The programs use local storage
14
+ or injected local boundaries, require no credentials, and are compiled and executed against both
15
+ the built package and the packed release artifact.
16
+
17
+ | Goal | Recipe | Main APIs |
18
+ | ------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------- |
19
+ | Run and complete an Eve agent in one durable attempt | [Eve agent integration](recipes/eve-agent.md) | `startEveSession`, `withFactoryTask`, Task tools and hooks |
20
+ | Submit a schema-specific result from an Eve tool | [Typed Eve result](recipes/typed-eve-result.md) | `defineWorkflow`, `requireTaskExecution`, `completeWorkflow` |
21
+ | Pause for an authenticated answer and resume Eve | [Human input](recipes/human-input.md) | `request_human_input`, `answer_question`, `sweepQueued` |
22
+ | Enforce execution order and hand results between agents | [Dependent Eve agents](recipes/dependent-tasks.md) | dependencies, `sweepQueued`, authenticated Task tools |
23
+ | Define typed work and connect a non-Eve provider | [Custom workflow and local execution](recipes/custom-workflow.md) | `defineWorkflow`, `dispatchTask`, `launchExecution`, `completeWorkflow` |
24
+ | Reopen durable storage and recover workflow-owned work | [Persistence and restart recovery](recipes/persistence-recovery.md) | `applyFactoryMigrations`, `createPostgresDriver`, `recover` |
25
+ | Stop provider or Eve work and fence late output | [Cancellation](recipes/cancellation.md) | `cancelExecution`, `cancelEveSession`, attempt fences |
26
+ | Recover Eve failures and exhaust bounded retries | [Retry and recovery](recipes/retry-recovery.md) | `createFactoryHooks`, `sweepQueued`, authenticated completion |
27
+ | Send and process an authenticated typed message | [Task messaging](recipes/task-messaging.md) | `requireTaskExecution`, message protocols, `processTaskMessage` |
28
+
29
+ Read them in table order when building an Eve-based factory. They progress from one authenticated
30
+ session through typed results, human pauses, graph ordering, alternative execution, persistence,
31
+ lifecycle recovery, and inter-Task communication.
32
+
33
+ ## Behavioral contracts
34
+
35
+ The installed declarations are the source of truth for operation semantics. In particular:
36
+
37
+ - `createStores` and `FactoryStores.tasks` document persistence, deduplication, transition fences,
38
+ and when a mutation is durable.
39
+ - `dispatchTask` and `sweepQueued` distinguish accepted execution, completed work, retryable gates,
40
+ terminal routing failures, and provider acceptance that remains ambiguous.
41
+ - `FactoryClient` documents idempotency keys, optimistic execution matching, request completion,
42
+ redirects, timeouts, and validated responses.
43
+ - `createBlobDriver` and `createPostgresDriver` document concurrency, retry, migration, and
44
+ compare-and-swap responsibilities.
45
+
46
+ Search the linked declaration files below for the exact installed signatures and JSDoc. Full
47
+ recipes remain the preferred starting point when several operations must be composed.
48
+
49
+ ## Find the right capability
50
+
51
+ | Goal | Import path | Start with | Version-matched declarations |
52
+ | ------------------------------------------------------ | ------------------------------------------------------------------ | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53
+ | Configure a factory and validate repository identity | `@vercel/factory` | `defineFactory`, `repositoryIdSchema`, `repositoryIdForSlug` | [root declarations](../dist/index.d.mts) |
54
+ | Create Tasks, graphs, messages, approvals, and effects | `@vercel/factory/tasks` | `Task`, `createDefaultTaskMessageProtocols`, `taskBoundMessagePolicy` | [Task declarations](../dist/tasks.d.mts) |
55
+ | Define versioned work and exact agent routes | `@vercel/factory/workflows` | `defineWorkflow`, `defineWorkflows`, `taskWork`, `defineAgentRoutes` | [workflow declarations](../dist/workflows.d.mts) |
56
+ | Create a store engine or local in-memory store | `@vercel/factory/storage` | `createStores`, `createInMemoryDriver`, `StoreDriver` | [storage declarations](../dist/storage.d.mts) |
57
+ | Use Blob or Postgres persistence | `@vercel/factory/storage/blob`, `@vercel/factory/storage/postgres` | `createBlobDriver`, `createPostgresDriver` | [Blob](../dist/blob/index.d.mts), [Postgres](../dist/postgres/index.d.mts) |
58
+ | Dispatch work through execution providers | `@vercel/factory/execution` | `dispatchTask`, `ExecutionAdapter` | [execution declarations](../dist/execution-public.d.mts) |
59
+ | Run bounded recursive planning | `@vercel/factory/planning` | `createPlannerRuntime`, `createPlannerMessageProtocols` | [planning declarations](../dist/planning/runtime.d.mts) |
60
+ | Apply budgets and inspect immutable receipts | `@vercel/factory/budgets`, `@vercel/factory/receipts` | `canReserve`, `sweepBudget`, `receiptSchema` | [budgets](../dist/budgets.d.mts), [receipts](../dist/receipts.d.mts) |
61
+ | Normalize intake and deliver replies | `@vercel/factory/signals`, `@vercel/factory/communication` | `signalSchema`, `createTaskCommunicationReconciler` | [signals](../dist/signals.d.mts), [communication](../dist/communication.d.mts) |
62
+ | Build browser or terminal operator clients | `@vercel/factory/client` | `FactoryClient`, `followSessionStream`, `Transcript` | [client declarations](../dist/client.d.mts) |
63
+ | Mount server handlers or a Next.js factory | `@vercel/factory/api`, `@vercel/factory/next` | `createFactoryApi`, `buildFactory` | [API](../dist/api.d.mts), [Next.js](../dist/build-factory.d.mts) |
64
+ | Compose the supplied software-development policy | `@vercel/factory/presets/software-development` | `createSoftwareDevelopmentTools`, `dispatchSoftwareDevelopmentWork` | [preset declarations](../dist/presets/software-development.d.mts) |
65
+ | Add sandbox execution | `@vercel/factory/sandbox` | `createSandboxExecutionAdapter`, `createTaskSandboxEnvironment` | [sandbox declarations](../dist/sandbox/index.d.mts) |
66
+ | Add provider adapters | `@vercel/factory/integrations/<provider>` | Select GitHub, Slack, DeepSec, or Vercel explicitly | [GitHub](../dist/integrations/github.d.mts), [Slack](../dist/integrations/slack.d.mts), [DeepSec](../dist/integrations/deepsec.d.mts), [Vercel](../dist/integrations/vercel.d.mts) |
67
+
68
+ Use the narrowest capability path that owns the API. This avoids loading server-only or optional
69
+ integrations accidentally and gives each declaration one stable import path.
70
+
71
+ ## Domain capabilities
72
+
73
+ Software-development records and operations are available from:
74
+
75
+ - `@vercel/factory/changes` for Change lifecycle and verification
76
+ - `@vercel/factory/findings` for findings and remediation
77
+ - `@vercel/factory/code-review` for review policy and tools
78
+ - `@vercel/factory/pull-requests` for publication and merge-conflict operations
79
+ - `@vercel/factory/work-triage` for existing-work lookup
80
+ - `@vercel/factory/delivery-metrics` for delivery ledger metrics
81
+
82
+ Each path has a matching declaration entry under `dist/`. Provider-specific implementations remain
83
+ under `@vercel/factory/integrations/<provider>`.
84
+
85
+ ## Reading the API
86
+
87
+ Public declarations carry concise JSDoc summaries, and public schemas expose field descriptions at
88
+ runtime. Search the linked `.d.mts` files for a symbol to inspect the exact installed signature.
89
+ Configuration inputs use `*Options`, operation results use `*Result`, and errors use `*Error`.
90
+ Factories use `create*`; declarative validators and registries use `define*`.
91
+
92
+ The package is pre-1.0. Replaced names and import paths can be removed in a patch release. Review
93
+ the [installed changelog](../CHANGELOG.md) before upgrading, and pin a version when a deployment
94
+ requires a stable contract.
95
+
96
+ The declarations are validated with TypeScript 5.9.3 and 7.0.2. Core workflows and the Blob adapter
97
+ use `nodeNext` module resolution with library checking enabled. The `/client` entry point uses
98
+ `bundler` resolution in a browser-only fixture that does not load Node or server-integration types.
99
+ The Postgres adapter is checked with its Drizzle peer and `skipLibCheck` because Drizzle's
100
+ declaration graph includes declarations for optional database drivers.
@@ -0,0 +1,215 @@
1
+ # Cancel an execution safely
2
+
3
+ Cancellation records canonical Task state before asking the provider to stop. A provider stop may
4
+ be retried, and any final measured usage is retained and settled once.
5
+
6
+ The program covers both the provider-neutral `ExecutionAdapter` contract and the Eve session
7
+ boundary. In both cases the application records canonical cancellation before asking the provider
8
+ to stop.
9
+
10
+ ## Run the recipe
11
+
12
+ Save this as `cancellation.mts` in an ESM project with `@vercel/factory`, `eve`, and `zod`
13
+ installed.
14
+
15
+ <!-- runnable-example:start -->
16
+
17
+ ```ts
18
+ import type { ToolContext } from "eve/tools";
19
+ import {
20
+ cancelEveSession,
21
+ createTaskTools,
22
+ factoryTaskAttemptAttribute,
23
+ factoryTaskAttribute,
24
+ startEveSession,
25
+ taskHeaders,
26
+ } from "@vercel/factory";
27
+ import {
28
+ cancelExecution,
29
+ dispatchTask,
30
+ ExecutionFenceError,
31
+ inspectExecution,
32
+ launchExecution,
33
+ type ExecutionAdapter,
34
+ type ExecutionResult,
35
+ } from "@vercel/factory/execution";
36
+ import { createInMemoryDriver, createStores } from "@vercel/factory/storage";
37
+ import { parseAgentRouteBinding, taskWork } from "@vercel/factory/workflows";
38
+
39
+ const stores = createStores({ driver: createInMemoryDriver() });
40
+ const repository = await stores.repositories.put({
41
+ schemaVersion: 1,
42
+ id: "repo_recipe03",
43
+ slug: "example/project",
44
+ defaultBranch: "main",
45
+ enabled: true,
46
+ dependsOn: [],
47
+ connectedAt: new Date().toISOString(),
48
+ });
49
+ const task = await stores.tasks.create({
50
+ repositoryIds: [repository.id],
51
+ kind: "example",
52
+ origin: { operator: "local:recipe" },
53
+ replyTo: { channel: "local", address: "cancellation" },
54
+ work: taskWork({ title: "Run cancellable work" }),
55
+ });
56
+ const running = await stores.tasks.transition(task.id, "running");
57
+ const execution = { provider: "local", sessionId: "cancel-1" };
58
+ const cancelledResult: ExecutionResult = {
59
+ status: "cancelled",
60
+ execution,
61
+ artifacts: [],
62
+ usage: { computeMs: 5, costUsd: 0.05 },
63
+ reason: "Stopped by the operator",
64
+ };
65
+ let providerObservedCancellation = false;
66
+ const adapter: ExecutionAdapter = {
67
+ async start() {
68
+ return execution;
69
+ },
70
+ async inspect() {
71
+ return { status: "finished", result: cancelledResult };
72
+ },
73
+ async stop() {
74
+ providerObservedCancellation = (await stores.tasks.get(task.id))?.state === "cancelled";
75
+ return cancelledResult;
76
+ },
77
+ };
78
+ await launchExecution({
79
+ stores,
80
+ adapter,
81
+ request: {
82
+ taskId: running.id,
83
+ attempt: running.attempt,
84
+ repository: { slug: repository.slug, baseSha: "b".repeat(40) },
85
+ harness: "codex",
86
+ prompt: "Perform cancellable work",
87
+ allowedConstructs: [],
88
+ environment: { timeoutMs: 1_000 },
89
+ limits: { maxCostUsd: 1 },
90
+ },
91
+ });
92
+
93
+ const cancelled = await cancelExecution({
94
+ stores,
95
+ task: { taskId: running.id, attempt: running.attempt },
96
+ adapter,
97
+ reason: "Operator cancelled the example",
98
+ });
99
+ let lateResultRejected = false;
100
+ try {
101
+ await inspectExecution({
102
+ stores,
103
+ task: { taskId: running.id, attempt: running.attempt },
104
+ adapter,
105
+ });
106
+ } catch (error) {
107
+ lateResultRejected = error instanceof ExecutionFenceError;
108
+ }
109
+ if (
110
+ cancelled.state !== "cancelled" ||
111
+ cancelled.settledUsd !== 0.05 ||
112
+ !providerObservedCancellation ||
113
+ !lateResultRejected ||
114
+ cancelled.workResult !== undefined
115
+ ) {
116
+ throw new Error("Expected cancellation, settlement, and late-result fencing");
117
+ }
118
+
119
+ const eveRoute = parseAgentRouteBinding({ id: "worker", version: 1 });
120
+ const eveTask = await stores.tasks.create({
121
+ repositoryIds: [repository.id],
122
+ kind: "example",
123
+ origin: { operator: "local:recipe" },
124
+ replyTo: { channel: "local", address: "cancellation" },
125
+ work: { ...taskWork({ title: "Cancel an Eve agent" }), route: eveRoute },
126
+ });
127
+ const runningEve = await dispatchTask(stores, {
128
+ taskId: eveTask.id,
129
+ route: eveRoute,
130
+ launch: (claimed) =>
131
+ startEveSession({
132
+ agentUrl: "https://factory.example/eve/agents/worker",
133
+ message: `Work Task ${claimed.id}`,
134
+ operationId: `factory-task:${claimed.id}:${claimed.attempt}`,
135
+ headers: taskHeaders({ taskId: claimed.id, attempt: claimed.attempt }),
136
+ fetch: async () => Response.json({ sessionId: "ses_cancel_eve" }),
137
+ }),
138
+ });
139
+ if (runningEve.execution?.provider !== "eve") throw new Error("Expected an Eve execution");
140
+ const eveContext = {
141
+ session: {
142
+ id: runningEve.execution.sessionId,
143
+ auth: {
144
+ initiator: {
145
+ attributes: {
146
+ [factoryTaskAttribute]: runningEve.id,
147
+ [factoryTaskAttemptAttribute]: String(runningEve.attempt),
148
+ },
149
+ },
150
+ },
151
+ },
152
+ } as unknown as ToolContext;
153
+
154
+ await stores.tasks.transition(runningEve.id, "cancelled", {
155
+ expectFrom: "running",
156
+ expectAttempt: runningEve.attempt,
157
+ expectExecution: runningEve.execution,
158
+ reason: "Operator cancelled the Eve Task",
159
+ });
160
+ let eveObservedCancellation = false;
161
+ let confirmedSession = "";
162
+ await cancelEveSession({
163
+ agentUrl: "https://factory.example/eve/agents/worker",
164
+ sessionId: runningEve.execution.sessionId,
165
+ headers: taskHeaders({ taskId: runningEve.id, attempt: runningEve.attempt }),
166
+ fetch: async (input, init) => {
167
+ const request = new Request(input, init);
168
+ eveObservedCancellation =
169
+ request.url.endsWith("/eve/v1/session/ses_cancel_eve/cancel") &&
170
+ (await stores.tasks.get(runningEve.id))?.state === "cancelled";
171
+ return Response.json({ status: "cancelling" });
172
+ },
173
+ stream: async function* (input) {
174
+ confirmedSession = input.sessionId;
175
+ yield { type: "session.waiting" };
176
+ },
177
+ });
178
+ let lateEveCompletionRejected = false;
179
+ try {
180
+ await createTaskTools(stores).finish_task.execute(
181
+ { taskId: runningEve.id, summary: "Late agent output" },
182
+ eveContext,
183
+ );
184
+ } catch {
185
+ lateEveCompletionRejected = true;
186
+ }
187
+ if (
188
+ !eveObservedCancellation ||
189
+ confirmedSession !== runningEve.execution.sessionId ||
190
+ !lateEveCompletionRejected
191
+ ) {
192
+ throw new Error("Expected task-first Eve cancellation and late-tool fencing");
193
+ }
194
+
195
+ console.log(
196
+ JSON.stringify({
197
+ adapter: { state: cancelled.state, settledUsd: cancelled.settledUsd },
198
+ eve: { state: (await stores.tasks.get(runningEve.id))?.state, confirmedSession },
199
+ }),
200
+ );
201
+ ```
202
+
203
+ <!-- runnable-example:end -->
204
+
205
+ ## What it proves
206
+
207
+ `cancelExecution` persists cancellation before invoking `adapter.stop`. It records the provider's
208
+ final usage and settles measured cost, while the attempt fence prevents a late inspection from
209
+ completing cancelled work. If stopping is ambiguous, retry `cancelExecution` with the same Task and
210
+ attempt; adapters must make `stop` idempotent.
211
+
212
+ For Eve, transition the Task with its attempt and execution fences, then pass the persisted session
213
+ ID to `cancelEveSession`. The client waits for Eve's stream to confirm that the session is no longer
214
+ running. A late tool call fails because the Task is already terminal. Provider cancellation and
215
+ Task persistence are separate writes, so recovery should retry the idempotent provider request.
@@ -0,0 +1,153 @@
1
+ # Custom workflow with a local execution adapter
2
+
3
+ Use this recipe when a Task needs typed input and output plus an execution provider. The local
4
+ adapter stands in for a model or sandbox provider, so the complete dispatch, inspection, and
5
+ completion path runs without credentials or network access.
6
+
7
+ This is the provider-adapter path used for coding harnesses, sandboxes, and other execution systems
8
+ that return bounded evidence. It is not the usual Eve-agent setup. For an Eve agent, start with
9
+ [Run an Eve agent as a Factory Task](./eve-agent.md), then expose the workflow output through an
10
+ [authenticated typed result tool](./typed-eve-result.md).
11
+
12
+ ## Run the recipe
13
+
14
+ Save this as `custom-workflow.mts` in an ESM project with `@vercel/factory`, `eve`, and `zod`
15
+ installed.
16
+
17
+ <!-- runnable-example:start -->
18
+
19
+ ```ts
20
+ import { z } from "zod";
21
+ import {
22
+ dispatchTask,
23
+ inspectExecution,
24
+ launchExecution,
25
+ type ExecutionAdapter,
26
+ type ExecutionResult,
27
+ } from "@vercel/factory/execution";
28
+ import { createInMemoryDriver, createStores } from "@vercel/factory/storage";
29
+ import {
30
+ defineWorkflow,
31
+ defineWorkflows,
32
+ parseAgentRouteBinding,
33
+ taskWork,
34
+ } from "@vercel/factory/workflows";
35
+
36
+ const greetingWorkflow = defineWorkflow({
37
+ id: "greeting",
38
+ version: 1,
39
+ input: z.strictObject({ name: z.string().min(1) }),
40
+ output: z.strictObject({ greeting: z.string().min(1) }),
41
+ });
42
+ const route = parseAgentRouteBinding({ id: "local-worker", version: 1 });
43
+ const stores = createStores({
44
+ driver: createInMemoryDriver(),
45
+ workflows: defineWorkflows([greetingWorkflow]),
46
+ });
47
+ const repository = await stores.repositories.put({
48
+ schemaVersion: 1,
49
+ id: "repo_recipe01",
50
+ slug: "example/project",
51
+ defaultBranch: "main",
52
+ enabled: true,
53
+ dependsOn: [],
54
+ connectedAt: new Date().toISOString(),
55
+ });
56
+ const task = await stores.tasks.create({
57
+ repositoryIds: [repository.id],
58
+ kind: "example",
59
+ origin: { operator: "local:recipe" },
60
+ replyTo: { channel: "local", address: "custom-workflow" },
61
+ work: {
62
+ ...taskWork({
63
+ title: "Create a greeting",
64
+ input: { name: "Factory" },
65
+ workflow: greetingWorkflow,
66
+ }),
67
+ route,
68
+ completionCriteria: ["Return a greeting for the supplied name"],
69
+ },
70
+ });
71
+
72
+ const execution = { provider: "local", sessionId: "greeting-1" };
73
+ const result: ExecutionResult = {
74
+ status: "completed",
75
+ execution,
76
+ artifacts: [{ kind: "report", ref: "memory:greeting-1" }],
77
+ usage: { computeMs: 1, costUsd: 0 },
78
+ };
79
+ const adapter: ExecutionAdapter = {
80
+ async start({ launchKey }) {
81
+ if (launchKey !== `factory-task:${task.id}:1`) throw new Error("Unexpected launch key");
82
+ return execution;
83
+ },
84
+ async inspect() {
85
+ return { status: "finished", result };
86
+ },
87
+ async stop() {
88
+ return { ...result, status: "cancelled" };
89
+ },
90
+ };
91
+
92
+ const dispatched = await dispatchTask(stores, {
93
+ taskId: task.id,
94
+ route,
95
+ launch: (running) =>
96
+ launchExecution({
97
+ stores,
98
+ adapter,
99
+ request: {
100
+ taskId: running.id,
101
+ attempt: running.attempt,
102
+ repository: { slug: repository.slug, baseSha: "a".repeat(40) },
103
+ harness: "codex",
104
+ prompt: `Greet ${greetingWorkflow.input.parse(running.work.input).name}`,
105
+ allowedConstructs: [],
106
+ environment: { timeoutMs: 1_000 },
107
+ limits: { maxCostUsd: 1 },
108
+ },
109
+ }),
110
+ });
111
+ const observed = await inspectExecution({
112
+ stores,
113
+ task: { taskId: dispatched.id, attempt: dispatched.attempt },
114
+ adapter,
115
+ });
116
+ if (observed.status !== "finished" || observed.result.status !== "completed") {
117
+ throw new Error("Expected a completed local execution");
118
+ }
119
+
120
+ let invalidOutputRejected = false;
121
+ try {
122
+ await stores.work.complete({
123
+ task: { taskId: dispatched.id, attempt: dispatched.attempt },
124
+ output: { greeting: 42 },
125
+ });
126
+ } catch {
127
+ invalidOutputRejected = true;
128
+ }
129
+ if (!invalidOutputRejected) throw new Error("Expected invalid workflow output to be rejected");
130
+
131
+ const completed = await stores.work.completeWorkflow({
132
+ task: { taskId: dispatched.id, attempt: dispatched.attempt },
133
+ workflow: greetingWorkflow.binding,
134
+ output: { greeting: "Hello, Factory!" },
135
+ });
136
+ const output = greetingWorkflow.output.parse(completed.workResult?.output);
137
+ if (completed.state !== "succeeded" || output.greeting !== "Hello, Factory!") {
138
+ throw new Error("Expected validated workflow completion");
139
+ }
140
+
141
+ console.log(JSON.stringify({ state: completed.state, output }));
142
+ ```
143
+
144
+ <!-- runnable-example:end -->
145
+
146
+ ## What it proves
147
+
148
+ `dispatchTask` owns the queued-to-running admission and exact route check. `launchExecution` gives
149
+ the adapter a stable per-attempt key and records its provider reference. Inspection returns
150
+ evidence but does not complete the Task; workflow code explicitly validates and records the output.
151
+
152
+ Replace the local adapter with a provider adapter in production. Keep the workflow definition and
153
+ its exact version registered anywhere stored Tasks from that version may be read or completed.