@vercel/factory 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/README.md +307 -1
  2. package/dist/agent-routes.d.mts +69 -0
  3. package/dist/agent-routes.mjs +64 -0
  4. package/dist/agent-routes.mjs.map +1 -0
  5. package/dist/api-contracts.d.mts +1749 -0
  6. package/dist/api-contracts.mjs +118 -0
  7. package/dist/api-contracts.mjs.map +1 -0
  8. package/dist/api-images.d.mts +30 -0
  9. package/dist/api-images.mjs +28 -0
  10. package/dist/api-images.mjs.map +1 -0
  11. package/dist/api-task-graph.mjs +57 -0
  12. package/dist/api-task-graph.mjs.map +1 -0
  13. package/dist/api.d.mts +77 -0
  14. package/dist/api.mjs +1087 -0
  15. package/dist/api.mjs.map +1 -0
  16. package/dist/approval-access.d.mts +39 -0
  17. package/dist/approval-access.mjs +62 -0
  18. package/dist/approval-access.mjs.map +1 -0
  19. package/dist/approval-contracts.d.mts +692 -0
  20. package/dist/approval-contracts.mjs +27 -0
  21. package/dist/approval-contracts.mjs.map +1 -0
  22. package/dist/approval.d.mts +49 -0
  23. package/dist/approval.mjs +39 -0
  24. package/dist/approval.mjs.map +1 -0
  25. package/dist/blob/artifacts.d.mts +37 -0
  26. package/dist/blob/artifacts.mjs +45 -0
  27. package/dist/blob/artifacts.mjs.map +1 -0
  28. package/dist/blob/index.d.mts +44 -8
  29. package/dist/blob/index.mjs +159 -35
  30. package/dist/blob/index.mjs.map +1 -1
  31. package/dist/budget.d.mts +108 -0
  32. package/dist/budget.mjs +141 -0
  33. package/dist/budget.mjs.map +1 -0
  34. package/dist/budgets.d.mts +4 -0
  35. package/dist/budgets.mjs +4 -0
  36. package/dist/build-factory.d.mts +6 -4
  37. package/dist/build-factory.mjs +2 -1
  38. package/dist/build-factory.mjs.map +1 -1
  39. package/dist/change-verification/brief.d.mts +9 -0
  40. package/dist/change-verification/brief.mjs +13 -0
  41. package/dist/change-verification/brief.mjs.map +1 -0
  42. package/dist/change-verification/dispatch.d.mts +24 -0
  43. package/dist/change-verification/dispatch.mjs +45 -0
  44. package/dist/change-verification/dispatch.mjs.map +1 -0
  45. package/dist/change-verification/eve-tool.d.mts +60 -0
  46. package/dist/change-verification/eve-tool.mjs +101 -0
  47. package/dist/change-verification/eve-tool.mjs.map +1 -0
  48. package/dist/changes/eve-record-change.d.mts +56 -0
  49. package/dist/changes/eve-record-change.mjs +97 -0
  50. package/dist/changes/eve-record-change.mjs.map +1 -0
  51. package/dist/changes/presentation.d.mts +14 -0
  52. package/dist/changes.d.mts +23 -0
  53. package/dist/changes.mjs +29 -0
  54. package/dist/changes.mjs.map +1 -0
  55. package/dist/client-events.d.mts +18 -0
  56. package/dist/client-events.mjs +41 -0
  57. package/dist/client-events.mjs.map +1 -0
  58. package/dist/client-stream.d.mts +28 -0
  59. package/dist/client-stream.mjs +204 -0
  60. package/dist/client-stream.mjs.map +1 -0
  61. package/dist/client-transcript.d.mts +41 -0
  62. package/dist/client-transcript.mjs +229 -0
  63. package/dist/client-transcript.mjs.map +1 -0
  64. package/dist/client.d.mts +234 -0
  65. package/dist/client.mjs +258 -0
  66. package/dist/client.mjs.map +1 -0
  67. package/dist/code-review/contracts.d.mts +26 -0
  68. package/dist/code-review/eve-post-review.d.mts +70 -0
  69. package/dist/code-review/eve-post-review.mjs +183 -0
  70. package/dist/code-review/eve-post-review.mjs.map +1 -0
  71. package/dist/code-review/eve-review-comments.d.mts +64 -0
  72. package/dist/code-review/eve-review-comments.mjs +159 -0
  73. package/dist/code-review/eve-review-comments.mjs.map +1 -0
  74. package/dist/code-review/github-contracts.d.mts +10 -0
  75. package/dist/code-review/github-reporter.d.mts +44 -0
  76. package/dist/code-review/github-reporter.mjs +260 -0
  77. package/dist/code-review/github-reporter.mjs.map +1 -0
  78. package/dist/code-review/preparation.d.mts +34 -0
  79. package/dist/code-review/preparation.mjs +23 -0
  80. package/dist/code-review/preparation.mjs.map +1 -0
  81. package/dist/code-review/stall.d.mts +17 -0
  82. package/dist/code-review/stall.mjs +30 -0
  83. package/dist/code-review/stall.mjs.map +1 -0
  84. package/dist/code-review.d.mts +6 -0
  85. package/dist/code-review.mjs +5 -0
  86. package/dist/communication.d.mts +9 -0
  87. package/dist/communication.mjs +9 -0
  88. package/dist/connectors/github.d.mts +26 -0
  89. package/dist/connectors/github.mjs +55 -0
  90. package/dist/connectors/github.mjs.map +1 -0
  91. package/dist/connectors/index.d.mts +35 -2
  92. package/dist/connectors/index.mjs +4 -26
  93. package/dist/connectors/index.mjs.map +1 -1
  94. package/dist/connectors/outbox.d.mts +34 -0
  95. package/dist/connectors/outbox.mjs +50 -0
  96. package/dist/connectors/outbox.mjs.map +1 -0
  97. package/dist/connectors/slack-approval-blocks.mjs +136 -0
  98. package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
  99. package/dist/connectors/slack-approvals.d.mts +29 -0
  100. package/dist/connectors/slack-approvals.mjs +346 -0
  101. package/dist/connectors/slack-approvals.mjs.map +1 -0
  102. package/dist/connectors/slack.d.mts +35 -41
  103. package/dist/connectors/slack.mjs +13 -69
  104. package/dist/connectors/slack.mjs.map +1 -1
  105. package/dist/deepsec/eve-tool.d.mts +110 -0
  106. package/dist/deepsec/eve-tool.mjs +164 -0
  107. package/dist/deepsec/eve-tool.mjs.map +1 -0
  108. package/dist/deepsec/finding.d.mts +84 -0
  109. package/dist/deepsec/finding.mjs +56 -0
  110. package/dist/deepsec/finding.mjs.map +1 -0
  111. package/dist/deepsec.d.mts +3 -0
  112. package/dist/delivery-metrics/metrics.d.mts +93 -0
  113. package/dist/delivery-metrics/metrics.mjs +200 -0
  114. package/dist/delivery-metrics/metrics.mjs.map +1 -0
  115. package/dist/delivery-metrics.d.mts +2 -0
  116. package/dist/delivery-metrics.mjs +2 -0
  117. package/dist/dispatch.d.mts +81 -0
  118. package/dist/dispatch.mjs +140 -0
  119. package/dist/dispatch.mjs.map +1 -0
  120. package/dist/errors.d.mts +15 -0
  121. package/dist/errors.mjs +38 -0
  122. package/dist/errors.mjs.map +1 -0
  123. package/dist/eve/index.d.mts +143 -1561
  124. package/dist/eve/index.mjs +244 -1063
  125. package/dist/eve/index.mjs.map +1 -1
  126. package/dist/eve/invoke.d.mts +144 -0
  127. package/dist/eve/invoke.mjs +241 -0
  128. package/dist/eve/invoke.mjs.map +1 -0
  129. package/dist/eve/session-client.d.mts +68 -0
  130. package/dist/eve/session-client.mjs +131 -0
  131. package/dist/eve/session-client.mjs.map +1 -0
  132. package/dist/eve/task-execution.mjs +18 -0
  133. package/dist/eve/task-execution.mjs.map +1 -0
  134. package/dist/eve/task-session.d.mts +87 -0
  135. package/dist/eve/task-session.mjs +203 -0
  136. package/dist/eve/task-session.mjs.map +1 -0
  137. package/dist/eve/transcript.d.mts +37 -0
  138. package/dist/eve/transcript.mjs +65 -0
  139. package/dist/eve/transcript.mjs.map +1 -0
  140. package/dist/execution-public.d.mts +8 -0
  141. package/dist/execution-public.mjs +7 -0
  142. package/dist/execution.d.mts +75 -0
  143. package/dist/execution.mjs +153 -0
  144. package/dist/execution.mjs.map +1 -0
  145. package/dist/finding-remediation/admission.d.mts +51 -0
  146. package/dist/finding-remediation/admission.mjs +87 -0
  147. package/dist/finding-remediation/admission.mjs.map +1 -0
  148. package/dist/finding-remediation/brief.d.mts +14 -0
  149. package/dist/finding-remediation/brief.mjs +25 -0
  150. package/dist/finding-remediation/brief.mjs.map +1 -0
  151. package/dist/finding-remediation/eve-tool.d.mts +29 -0
  152. package/dist/finding-remediation/eve-tool.mjs +34 -0
  153. package/dist/finding-remediation/eve-tool.mjs.map +1 -0
  154. package/dist/findings/fingerprint.d.mts +14 -0
  155. package/dist/findings/fingerprint.mjs +28 -0
  156. package/dist/findings/fingerprint.mjs.map +1 -0
  157. package/dist/findings.d.mts +6 -0
  158. package/dist/findings.mjs +6 -0
  159. package/dist/github-app.d.mts +54 -0
  160. package/dist/github-app.mjs +121 -0
  161. package/dist/github-app.mjs.map +1 -0
  162. package/dist/github-publication.d.mts +198 -0
  163. package/dist/github-publication.mjs +429 -0
  164. package/dist/github-publication.mjs.map +1 -0
  165. package/dist/github-transfer.d.mts +72 -0
  166. package/dist/github-transfer.mjs +125 -0
  167. package/dist/github-transfer.mjs.map +1 -0
  168. package/dist/github.d.mts +406 -2
  169. package/dist/github.mjs +250 -37
  170. package/dist/github.mjs.map +1 -1
  171. package/dist/image-input.d.mts +51 -0
  172. package/dist/image-input.mjs +63 -0
  173. package/dist/image-input.mjs.map +1 -0
  174. package/dist/index.d.mts +14 -314
  175. package/dist/index.mjs +14 -1124
  176. package/dist/intake-contracts.d.mts +56 -0
  177. package/dist/intake-contracts.mjs +33 -0
  178. package/dist/intake-contracts.mjs.map +1 -0
  179. package/dist/integrations/deepsec.d.mts +4 -0
  180. package/dist/integrations/deepsec.mjs +3 -0
  181. package/dist/integrations/github.d.mts +11 -0
  182. package/dist/integrations/github.mjs +9 -0
  183. package/dist/integrations/slack.d.mts +3 -0
  184. package/dist/integrations/slack.mjs +3 -0
  185. package/dist/integrations/vercel.d.mts +3 -0
  186. package/dist/integrations/vercel.mjs +3 -0
  187. package/dist/merge-resolution/contracts.d.mts +17 -0
  188. package/dist/merge-resolution/contracts.mjs +19 -0
  189. package/dist/merge-resolution/contracts.mjs.map +1 -0
  190. package/dist/merge-resolution/eve-tools.d.mts +46 -0
  191. package/dist/merge-resolution/eve-tools.mjs +117 -0
  192. package/dist/merge-resolution/eve-tools.mjs.map +1 -0
  193. package/dist/multi-repository-changes/coordination.d.mts +49 -0
  194. package/dist/multi-repository-changes/coordination.mjs +115 -0
  195. package/dist/multi-repository-changes/coordination.mjs.map +1 -0
  196. package/dist/planning/cancellation.mjs +82 -0
  197. package/dist/planning/cancellation.mjs.map +1 -0
  198. package/dist/planning/configuration.d.mts +23 -0
  199. package/dist/planning/configuration.mjs +56 -0
  200. package/dist/planning/configuration.mjs.map +1 -0
  201. package/dist/planning/contracts.d.mts +136 -0
  202. package/dist/planning/contracts.mjs +42 -0
  203. package/dist/planning/contracts.mjs.map +1 -0
  204. package/dist/planning/dependencies.mjs +44 -0
  205. package/dist/planning/dependencies.mjs.map +1 -0
  206. package/dist/planning/effects.mjs +122 -0
  207. package/dist/planning/effects.mjs.map +1 -0
  208. package/dist/planning/reconcile.mjs +273 -0
  209. package/dist/planning/reconcile.mjs.map +1 -0
  210. package/dist/planning/runtime.d.mts +27 -0
  211. package/dist/planning/runtime.mjs +25 -0
  212. package/dist/planning/runtime.mjs.map +1 -0
  213. package/dist/planning/state.mjs +92 -0
  214. package/dist/planning/state.mjs.map +1 -0
  215. package/dist/planning/turns.mjs +262 -0
  216. package/dist/planning/turns.mjs.map +1 -0
  217. package/dist/planning/validation.mjs +106 -0
  218. package/dist/planning/validation.mjs.map +1 -0
  219. package/dist/postgres/index.d.mts +7 -1
  220. package/dist/postgres/index.mjs +7 -3
  221. package/dist/postgres/index.mjs.map +1 -1
  222. package/dist/presets/software-development/approval.d.mts +14 -0
  223. package/dist/presets/software-development/approval.mjs +21 -0
  224. package/dist/presets/software-development/approval.mjs.map +1 -0
  225. package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
  226. package/dist/presets/software-development/deepsec-brief.mjs +14 -0
  227. package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
  228. package/dist/presets/software-development/dispatch.d.mts +53 -0
  229. package/dist/presets/software-development/dispatch.mjs +66 -0
  230. package/dist/presets/software-development/dispatch.mjs.map +1 -0
  231. package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
  232. package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
  233. package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
  234. package/dist/presets/software-development/eve.d.mts +18 -0
  235. package/dist/presets/software-development/eve.mjs +19 -0
  236. package/dist/presets/software-development/eve.mjs.map +1 -0
  237. package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
  238. package/dist/presets/software-development/finish-task-policy.mjs +9 -0
  239. package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
  240. package/dist/presets/software-development/recovery.d.mts +32 -0
  241. package/dist/presets/software-development/recovery.mjs +120 -0
  242. package/dist/presets/software-development/recovery.mjs.map +1 -0
  243. package/dist/presets/software-development/task-communication.d.mts +23 -0
  244. package/dist/presets/software-development/task-communication.mjs +120 -0
  245. package/dist/presets/software-development/task-communication.mjs.map +1 -0
  246. package/dist/presets/software-development.d.mts +9 -0
  247. package/dist/presets/software-development.mjs +9 -0
  248. package/dist/pull-requests/contracts.d.mts +72 -0
  249. package/dist/pull-requests/eve-fetch.d.mts +57 -0
  250. package/dist/pull-requests/eve-fetch.mjs +151 -0
  251. package/dist/pull-requests/eve-fetch.mjs.map +1 -0
  252. package/dist/pull-requests/github-label-manager.d.mts +27 -0
  253. package/dist/pull-requests/github-label-manager.mjs +40 -0
  254. package/dist/pull-requests/github-label-manager.mjs.map +1 -0
  255. package/dist/pull-requests/github-publisher.d.mts +53 -0
  256. package/dist/pull-requests/github-publisher.mjs +345 -0
  257. package/dist/pull-requests/github-publisher.mjs.map +1 -0
  258. package/dist/pull-requests.d.mts +5 -0
  259. package/dist/pull-requests.mjs +4 -0
  260. package/dist/receipts.d.mts +4 -0
  261. package/dist/receipts.mjs +3 -0
  262. package/dist/repositories.d.mts +18 -0
  263. package/dist/repositories.mjs +33 -0
  264. package/dist/repositories.mjs.map +1 -0
  265. package/dist/sandbox/command.d.mts +18 -0
  266. package/dist/sandbox/execution-abort.d.mts +16 -0
  267. package/dist/sandbox/execution-abort.mjs +49 -0
  268. package/dist/sandbox/execution-abort.mjs.map +1 -0
  269. package/dist/sandbox/execution-environment.d.mts +25 -0
  270. package/dist/sandbox/execution-run-ledger.d.mts +115 -0
  271. package/dist/sandbox/execution-run-ledger.mjs +209 -0
  272. package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
  273. package/dist/sandbox/execution.d.mts +54 -0
  274. package/dist/sandbox/execution.mjs +228 -0
  275. package/dist/sandbox/execution.mjs.map +1 -0
  276. package/dist/sandbox/harness-runner.d.mts +79 -0
  277. package/dist/sandbox/harness-runner.mjs +162 -0
  278. package/dist/sandbox/harness-runner.mjs.map +1 -0
  279. package/dist/sandbox/index.d.mts +9 -0
  280. package/dist/sandbox/index.mjs +7 -0
  281. package/dist/sandbox/task-environment.d.mts +50 -0
  282. package/dist/sandbox/task-environment.mjs +140 -0
  283. package/dist/sandbox/task-environment.mjs.map +1 -0
  284. package/dist/sandbox/workspace.d.mts +29 -0
  285. package/dist/sandbox/workspace.mjs +28 -0
  286. package/dist/sandbox/workspace.mjs.map +1 -0
  287. package/dist/schema/agent-route.d.mts +22 -0
  288. package/dist/schema/agent-route.mjs +15 -0
  289. package/dist/schema/agent-route.mjs.map +1 -0
  290. package/dist/schema/answer.d.mts +23 -0
  291. package/dist/schema/answer.mjs +21 -0
  292. package/dist/schema/answer.mjs.map +1 -0
  293. package/dist/schema/budget.d.mts +38 -0
  294. package/dist/schema/budget.mjs +30 -0
  295. package/dist/schema/budget.mjs.map +1 -0
  296. package/dist/schema/catalog.mjs +72 -0
  297. package/dist/schema/catalog.mjs.map +1 -0
  298. package/dist/schema/change.d.mts +117 -0
  299. package/dist/schema/change.mjs +68 -0
  300. package/dist/schema/change.mjs.map +1 -0
  301. package/dist/schema/common.d.mts +33 -0
  302. package/dist/{id-DwCihQr4.mjs → schema/common.mjs} +7 -14
  303. package/dist/schema/common.mjs.map +1 -0
  304. package/dist/schema/communication.d.mts +52 -0
  305. package/dist/schema/communication.mjs +35 -0
  306. package/dist/schema/communication.mjs.map +1 -0
  307. package/dist/schema/execution.d.mts +101 -0
  308. package/dist/schema/execution.mjs +86 -0
  309. package/dist/schema/execution.mjs.map +1 -0
  310. package/dist/schema/factory-config.d.mts +95 -0
  311. package/dist/schema/factory-config.mjs +60 -0
  312. package/dist/schema/factory-config.mjs.map +1 -0
  313. package/dist/schema/finding.d.mts +125 -0
  314. package/dist/schema/finding.mjs +67 -0
  315. package/dist/schema/finding.mjs.map +1 -0
  316. package/dist/schema/id.d.mts +43 -0
  317. package/dist/schema/id.mjs +32 -0
  318. package/dist/schema/id.mjs.map +1 -0
  319. package/dist/schema/outbox.d.mts +240 -0
  320. package/dist/schema/outbox.mjs +53 -0
  321. package/dist/schema/outbox.mjs.map +1 -0
  322. package/dist/schema/question-route.mjs +16 -0
  323. package/dist/schema/question-route.mjs.map +1 -0
  324. package/dist/schema/receipt.d.mts +81 -0
  325. package/dist/schema/receipt.mjs +94 -0
  326. package/dist/schema/receipt.mjs.map +1 -0
  327. package/dist/schema/repository.d.mts +26 -0
  328. package/dist/schema/repository.mjs +25 -0
  329. package/dist/schema/repository.mjs.map +1 -0
  330. package/dist/schema/session.d.mts +135 -0
  331. package/dist/schema/session.mjs +53 -0
  332. package/dist/schema/session.mjs.map +1 -0
  333. package/dist/schema/signal.d.mts +105 -0
  334. package/dist/schema/signal.mjs +81 -0
  335. package/dist/schema/signal.mjs.map +1 -0
  336. package/dist/schema/stored-session.mjs +10 -0
  337. package/dist/schema/stored-session.mjs.map +1 -0
  338. package/dist/schema/stored-task.mjs +20 -0
  339. package/dist/schema/stored-task.mjs.map +1 -0
  340. package/dist/schema/task-effect.d.mts +39 -0
  341. package/dist/schema/task-effect.mjs +29 -0
  342. package/dist/schema/task-effect.mjs.map +1 -0
  343. package/dist/schema/task-graph.d.mts +3134 -0
  344. package/dist/schema/task-graph.mjs +97 -0
  345. package/dist/schema/task-graph.mjs.map +1 -0
  346. package/dist/schema/task-message.d.mts +254 -0
  347. package/dist/schema/task-message.mjs +189 -0
  348. package/dist/schema/task-message.mjs.map +1 -0
  349. package/dist/schema/task.d.mts +272 -0
  350. package/dist/schema/task.mjs +199 -0
  351. package/dist/schema/task.mjs.map +1 -0
  352. package/dist/schema/transcript.d.mts +170 -0
  353. package/dist/schema/transcript.mjs +86 -0
  354. package/dist/schema/transcript.mjs.map +1 -0
  355. package/dist/schema/transitions.d.mts +50 -0
  356. package/dist/schema/transitions.mjs +303 -0
  357. package/dist/schema/transitions.mjs.map +1 -0
  358. package/dist/schema/work.d.mts +101 -0
  359. package/dist/schema/work.mjs +102 -0
  360. package/dist/schema/work.mjs.map +1 -0
  361. package/dist/signal-triage.d.mts +20 -0
  362. package/dist/signal-triage.mjs +85 -0
  363. package/dist/signal-triage.mjs.map +1 -0
  364. package/dist/signals.d.mts +19 -0
  365. package/dist/signals.mjs +19 -0
  366. package/dist/signals.mjs.map +1 -0
  367. package/dist/stall.d.mts +38 -0
  368. package/dist/stall.mjs +79 -0
  369. package/dist/stall.mjs.map +1 -0
  370. package/dist/storage.d.mts +4 -0
  371. package/dist/storage.mjs +4 -0
  372. package/dist/store/driver.d.mts +65 -0
  373. package/dist/store/driver.mjs +42 -0
  374. package/dist/store/driver.mjs.map +1 -0
  375. package/dist/store/engine.d.mts +485 -0
  376. package/dist/store/engine.mjs +2175 -0
  377. package/dist/store/engine.mjs.map +1 -0
  378. package/dist/store/memory.d.mts +7 -0
  379. package/dist/store/memory.mjs +52 -0
  380. package/dist/store/memory.mjs.map +1 -0
  381. package/dist/store/task-effects.d.mts +38 -0
  382. package/dist/store/task-effects.mjs +118 -0
  383. package/dist/store/task-effects.mjs.map +1 -0
  384. package/dist/store/task-graphs.d.mts +60 -0
  385. package/dist/store/task-graphs.mjs +212 -0
  386. package/dist/store/task-graphs.mjs.map +1 -0
  387. package/dist/store/task-messages.d.mts +136 -0
  388. package/dist/store/task-messages.mjs +475 -0
  389. package/dist/store/task-messages.mjs.map +1 -0
  390. package/dist/store/task-work.d.mts +65 -0
  391. package/dist/store/task-work.mjs +134 -0
  392. package/dist/store/task-work.mjs.map +1 -0
  393. package/dist/store/work-notifications.d.mts +19 -0
  394. package/dist/store/work-notifications.mjs +48 -0
  395. package/dist/store/work-notifications.mjs.map +1 -0
  396. package/dist/sweep.d.mts +57 -0
  397. package/dist/sweep.mjs +143 -0
  398. package/dist/sweep.mjs.map +1 -0
  399. package/dist/task-communication.d.mts +35 -0
  400. package/dist/task-communication.mjs +47 -0
  401. package/dist/task-communication.mjs.map +1 -0
  402. package/dist/task-graph-view.d.mts +264 -0
  403. package/dist/task-graph-view.mjs +17 -0
  404. package/dist/task-graph-view.mjs.map +1 -0
  405. package/dist/task-message-processing.d.mts +60 -0
  406. package/dist/task-message-processing.mjs +200 -0
  407. package/dist/task-message-processing.mjs.map +1 -0
  408. package/dist/task-protocols.d.mts +80 -0
  409. package/dist/task-protocols.mjs +47 -0
  410. package/dist/task-protocols.mjs.map +1 -0
  411. package/dist/tasks.d.mts +17 -0
  412. package/dist/tasks.mjs +17 -0
  413. package/dist/vercel-git.d.mts +21 -0
  414. package/dist/vercel-git.mjs +112 -0
  415. package/dist/vercel-git.mjs.map +1 -0
  416. package/dist/vercel.d.mts +33 -2
  417. package/dist/vercel.mjs +48 -3
  418. package/dist/vercel.mjs.map +1 -1
  419. package/dist/work-triage/eve-tool.d.mts +29 -0
  420. package/dist/work-triage/eve-tool.mjs +32 -0
  421. package/dist/work-triage/eve-tool.mjs.map +1 -0
  422. package/dist/work-triage/find-existing-work.d.mts +32 -0
  423. package/dist/work-triage/find-existing-work.mjs +31 -0
  424. package/dist/work-triage/find-existing-work.mjs.map +1 -0
  425. package/dist/work-triage/github.d.mts +15 -0
  426. package/dist/work-triage/github.mjs +14 -0
  427. package/dist/work-triage/github.mjs.map +1 -0
  428. package/dist/work-triage.d.mts +3 -0
  429. package/dist/work-triage.mjs +3 -0
  430. package/dist/workflows.d.mts +48 -0
  431. package/dist/workflows.mjs +86 -0
  432. package/dist/workflows.mjs.map +1 -0
  433. package/dist/workspace-diff-assembly.d.mts +33 -0
  434. package/dist/workspace-diff-assembly.mjs +95 -0
  435. package/dist/workspace-diff-assembly.mjs.map +1 -0
  436. package/dist/workspace-diff.d.mts +90 -0
  437. package/dist/workspace-diff.mjs +61 -0
  438. package/dist/workspace-diff.mjs.map +1 -0
  439. package/dist/workspace-snapshot.d.mts +26 -0
  440. package/dist/workspace-snapshot.mjs +80 -0
  441. package/dist/workspace-snapshot.mjs.map +1 -0
  442. package/package.json +129 -40
  443. package/dist/approval-CwhTP1XB.mjs +0 -269
  444. package/dist/approval-CwhTP1XB.mjs.map +0 -1
  445. package/dist/change-CzEAoFVE.mjs +0 -620
  446. package/dist/change-CzEAoFVE.mjs.map +0 -1
  447. package/dist/dispatch-B77cuPxh.d.mts +0 -713
  448. package/dist/driver-BJutB0PE.d.mts +0 -34
  449. package/dist/driver-Bbd25rNM.mjs +0 -23
  450. package/dist/driver-Bbd25rNM.mjs.map +0 -1
  451. package/dist/factory-config-BJcjsPKl.mjs +0 -86
  452. package/dist/factory-config-BJcjsPKl.mjs.map +0 -1
  453. package/dist/factory-config-D2yU3G0c.d.mts +0 -58
  454. package/dist/github-DXsxboUL.d.mts +0 -271
  455. package/dist/id-DwCihQr4.mjs.map +0 -1
  456. package/dist/index-Cy4jfXh5.d.mts +0 -67
  457. package/dist/index.mjs.map +0 -1
  458. package/dist/signal-CHVEmzvI.d.mts +0 -59
@@ -0,0 +1,42 @@
1
+ //#region src/store/driver.ts
2
+ /** Error raised when an insert targets an already occupied storage key. */
3
+ var RecordExistsError = class extends Error {
4
+ constructor(collection, id) {
5
+ super(`record "${id}" already exists in "${collection}"`);
6
+ this.name = "RecordExistsError";
7
+ }
8
+ };
9
+ /** Error raised when an operation requires a storage record that does not exist. */
10
+ var RecordNotFoundError = class extends Error {
11
+ constructor(collection, id) {
12
+ super(`record "${id}" not found in "${collection}"`);
13
+ this.name = "RecordNotFoundError";
14
+ }
15
+ };
16
+ /** Error raised when atomic update loses its expected-version comparison. */
17
+ var VersionConflictError = class extends Error {
18
+ constructor(collection, id, expectedVersion) {
19
+ super(`record "${id}" in "${collection}" changed since version ${expectedVersion} was read`);
20
+ this.name = "VersionConflictError";
21
+ }
22
+ };
23
+ /**
24
+ * A transient infrastructure failure (network error, 5xx/429 response) that
25
+ * a driver's own bounded, backed-off low-level retries could not resolve.
26
+ * Distinct from VersionConflictError (a concurrent writer legitimately won)
27
+ * and from validation or "already exists" errors (the request itself is
28
+ * rejected): the same operation may still succeed if retried again later,
29
+ * but every caller retrying on this error must keep its own bound so a real
30
+ * outage surfaces as a failure instead of hanging a dispatch cycle.
31
+ */
32
+ var TransientStoreError = class extends Error {
33
+ constructor(collection, id, cause) {
34
+ const reason = cause instanceof Error ? cause.message : String(cause);
35
+ super(`record "${id}" in "${collection}" failed after transient retries were exhausted: ${reason}`, { cause: cause instanceof Error ? cause : void 0 });
36
+ this.name = "TransientStoreError";
37
+ }
38
+ };
39
+ //#endregion
40
+ export { RecordExistsError, RecordNotFoundError, TransientStoreError, VersionConflictError };
41
+
42
+ //# sourceMappingURL=driver.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.mjs","names":[],"sources":["../../src/store/driver.ts"],"sourcesContent":["/** Closed set of persistence collections understood by Factory store drivers. */\nexport type CollectionName =\n | \"repositories\"\n | \"signals\"\n | \"tasks\"\n | \"changes\"\n | \"receipts\"\n | \"budgets\"\n | \"answers\"\n | \"sessions\"\n | \"externalSessions\"\n | \"transcripts\"\n | \"images\"\n | \"questionRoutes\"\n | \"taskCatalogs\"\n | \"changeCatalogs\"\n | \"sessionCatalogs\"\n | \"externalSessionCatalogs\"\n | \"taskRoutes\"\n | \"outboxQueues\"\n | \"outboxDeliveries\"\n | \"taskGraphs\"\n | \"taskMessages\"\n | \"taskEffects\"\n | \"taskInboxes\"\n | \"taskMessageProcessing\"\n | \"taskMessageDecisions\"\n | \"taskMessageDiscards\"\n | \"plannerActivations\"\n | \"plannerCancellations\";\n\n/** Opaque persisted value paired with its compare-and-swap version. */\nexport interface StoredRecord {\n readonly value: unknown;\n readonly version: number;\n}\n\n/** Collection-listing entry containing its storage key and versioned record. */\nexport interface StoredEntry {\n readonly id: string;\n readonly record: StoredRecord;\n}\n\n/** Collection, storage key, and opaque value for one insert-only write. */\nexport interface InsertStoreRecordInput {\n readonly collection: CollectionName;\n readonly id: string;\n readonly value: unknown;\n}\n\n/** Collection, storage key, opaque value, and compare-and-swap version for one update. */\nexport interface UpdateStoreRecordInput extends InsertStoreRecordInput {\n readonly expectedVersion: number;\n}\n\n/** Error raised when an insert targets an already occupied storage key. */\nexport class RecordExistsError extends Error {\n constructor(collection: CollectionName, id: string) {\n super(`record \"${id}\" already exists in \"${collection}\"`);\n this.name = \"RecordExistsError\";\n }\n}\n\n/** Error raised when an operation requires a storage record that does not exist. */\nexport class RecordNotFoundError extends Error {\n constructor(collection: CollectionName, id: string) {\n super(`record \"${id}\" not found in \"${collection}\"`);\n this.name = \"RecordNotFoundError\";\n }\n}\n\n/** Error raised when atomic update loses its expected-version comparison. */\nexport class VersionConflictError extends Error {\n constructor(collection: CollectionName, id: string, expectedVersion: number) {\n super(`record \"${id}\" in \"${collection}\" changed since version ${expectedVersion} was read`);\n this.name = \"VersionConflictError\";\n }\n}\n\n/**\n * A transient infrastructure failure (network error, 5xx/429 response) that\n * a driver's own bounded, backed-off low-level retries could not resolve.\n * Distinct from VersionConflictError (a concurrent writer legitimately won)\n * and from validation or \"already exists\" errors (the request itself is\n * rejected): the same operation may still succeed if retried again later,\n * but every caller retrying on this error must keep its own bound so a real\n * outage surfaces as a failure instead of hanging a dispatch cycle.\n */\nexport class TransientStoreError extends Error {\n constructor(collection: CollectionName, id: string, cause: unknown) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n super(\n `record \"${id}\" in \"${collection}\" failed after transient retries were exhausted: ${reason}`,\n { cause: cause instanceof Error ? cause : undefined },\n );\n this.name = \"TransientStoreError\";\n }\n}\n\n/**\n * Raw persistence contract. Drivers store opaque values and enforce nothing\n * about their content; every invariant lives in the engine above. `update`\n * must be an atomic compare-and-swap on `expectedVersion`. A driver may\n * throw TransientStoreError for a read or write that failed only because of\n * infrastructure trouble (network errors, 5xx/429 responses); it must not\n * use TransientStoreError for version conflicts or malformed input.\n */\nexport interface StoreDriver {\n readonly name: string;\n get(collection: CollectionName, id: string): Promise<StoredRecord | null>;\n insert(input: InsertStoreRecordInput): Promise<void>;\n update(input: UpdateStoreRecordInput): Promise<void>;\n list(collection: CollectionName): Promise<readonly StoredEntry[]>;\n}\n"],"mappings":";;AAwDA,IAAa,oBAAb,cAAuC,MAAM;CAC3C,YAAY,YAA4B,IAAY;EAClD,MAAM,WAAW,GAAG,uBAAuB,WAAW,EAAE;EACxD,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,sBAAb,cAAyC,MAAM;CAC7C,YAAY,YAA4B,IAAY;EAClD,MAAM,WAAW,GAAG,kBAAkB,WAAW,EAAE;EACnD,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,uBAAb,cAA0C,MAAM;CAC9C,YAAY,YAA4B,IAAY,iBAAyB;EAC3E,MAAM,WAAW,GAAG,QAAQ,WAAW,0BAA0B,gBAAgB,UAAU;EAC3F,KAAK,OAAO;CACd;AACF;;;;;;;;;;AAWA,IAAa,sBAAb,cAAyC,MAAM;CAC7C,YAAY,YAA4B,IAAY,OAAgB;EAClE,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACpE,MACE,WAAW,GAAG,QAAQ,WAAW,mDAAmD,UACpF,EAAE,OAAO,iBAAiB,QAAQ,QAAQ,KAAA,EAAU,CACtD;EACA,KAAK,OAAO;CACd;AACF"}
@@ -0,0 +1,485 @@
1
+ import { Signal, SignalOutcome, SignalSource, SignalTriage } from "../schema/signal.mjs";
2
+ import { AnswerId, ChangeId, FactoryId, OutboxId, ReceiptId, RepositoryId, RepositoryIds, SignalId, TaskId } from "../schema/id.mjs";
3
+ import { Repository } from "../schema/repository.mjs";
4
+ import { ExecutionReference, Task, TaskOrigin, TaskQuestion, TaskState } from "../schema/task.mjs";
5
+ import { WorkflowRegistry } from "../workflows.mjs";
6
+ import { TaskMessageProtocols } from "../schema/task-message.mjs";
7
+ import { WorkNotifications } from "./work-notifications.mjs";
8
+ import { IsoDateTimeClock, ReplyTo } from "../schema/common.mjs";
9
+ import { StoreDriver } from "./driver.mjs";
10
+ import { TaskMessageAuthorize, TaskMessageStore } from "./task-messages.mjs";
11
+ import { TaskGraphStore } from "./task-graphs.mjs";
12
+ import { TaskEffectStore } from "./task-effects.mjs";
13
+ import { TaskWorkStore } from "./task-work.mjs";
14
+ import { ImageAttachment, ImageId, imageUploadSchema } from "../image-input.mjs";
15
+ import { AnswerEvent } from "../schema/answer.mjs";
16
+ import { AgentSession, AgentSessionId } from "../schema/session.mjs";
17
+ import { CommunicationEvent } from "../schema/communication.mjs";
18
+ import { Budget, BudgetMonth } from "../schema/budget.mjs";
19
+ import { Change, ChangeInState, ChangeLevel, ChangeState } from "../schema/change.mjs";
20
+ import { OutboxMessage } from "../schema/outbox.mjs";
21
+ import { TranscriptSnapshot } from "../schema/transcript.mjs";
22
+ import { Cost, Receipt, ReceiptDelivery, ReceiptKind, ReceiptPhase, ReceiptState, StandardReceiptKind, StandardReceiptPhase, StandardReceiptState } from "../schema/receipt.mjs";
23
+ import { z } from "zod";
24
+ //#region src/store/engine.d.ts
25
+ declare const storedImageSchema: z.ZodObject<{
26
+ id: z.ZodType<`img_${string}`, string, z.core.$ZodTypeInternals<`img_${string}`, string>>;
27
+ filename: z.ZodString;
28
+ mediaType: z.ZodEnum<{
29
+ "image/png": "image/png";
30
+ "image/jpeg": "image/jpeg";
31
+ "image/webp": "image/webp";
32
+ }>;
33
+ size: z.ZodNumber;
34
+ schemaVersion: z.ZodLiteral<1>;
35
+ owner: z.ZodString;
36
+ base64: z.ZodString;
37
+ createdAt: z.ZodISODateTime;
38
+ }, z.core.$strict>;
39
+ type StoredImage = z.infer<typeof storedImageSchema>;
40
+ /** Error raised when uploaded image bytes, ownership, or attachment metadata is invalid. */
41
+ declare class ImageInputError extends Error {}
42
+ /** An approval decision that does not apply to the task's current approval or state. */
43
+ declare class ApprovalError extends Error {
44
+ readonly taskId: TaskId;
45
+ readonly reason: string;
46
+ constructor(taskId: TaskId, reason: string);
47
+ }
48
+ /** A settlement that does not apply to the task's current state. */
49
+ declare class SettlementError extends Error {
50
+ readonly taskId: TaskId;
51
+ readonly reason: string;
52
+ constructor(taskId: TaskId, reason: string);
53
+ }
54
+ /** Error raised when a Task is not authorized to create or update a requested Change. */
55
+ declare class ChangeAssociationError extends Error {
56
+ readonly taskId: TaskId;
57
+ readonly repositoryId: RepositoryId;
58
+ readonly reason: string;
59
+ constructor(taskId: TaskId, repositoryId: RepositoryId, reason: string);
60
+ }
61
+ /** Error raised when a stable outbox event ID is reused with different content. */
62
+ declare class OutboxEventConflictError extends Error {
63
+ constructor(eventId: string);
64
+ }
65
+ /** Error raised when a QuestionTask already has a different immutable answer event. */
66
+ declare class AnswerEventConflictError extends Error {
67
+ constructor(questionTaskId: TaskId);
68
+ }
69
+ /** Normalized, authenticated input required to persist one inbound Signal. */
70
+ interface CreateSignalInput {
71
+ repositoryId: RepositoryId;
72
+ source: SignalSource;
73
+ deliveryId: string;
74
+ replyTo: ReplyTo;
75
+ payload: unknown;
76
+ }
77
+ /** Outcome and optional human-readable context for one Signal decision. */
78
+ interface DecideSignalInput {
79
+ readonly outcome: SignalOutcome;
80
+ readonly detail?: string;
81
+ readonly reason?: string;
82
+ }
83
+ interface CreateTaskInputBase {
84
+ repositoryIds: RepositoryIds;
85
+ kind: Task["kind"];
86
+ replyTo: ReplyTo;
87
+ /** Same key creates one task and returns it on workflow retries. */
88
+ dedupeKey?: string;
89
+ area?: string;
90
+ changeId?: ChangeId;
91
+ /** Stamp the task as needing a human decision before dispatch. */
92
+ approval?: "required";
93
+ /** Required explicit versioned workflow contract. */
94
+ work: Task["work"];
95
+ /** Graph prerequisites that must succeed before this Task can run. */
96
+ dependencies?: readonly TaskId[];
97
+ }
98
+ /** Provenance required when admitting a root Task with no parent to inherit from. */
99
+ type RootTaskOrigin = {
100
+ signalId: SignalId;
101
+ operator?: string;
102
+ } | {
103
+ signalId?: SignalId;
104
+ operator: string;
105
+ };
106
+ /** Explicit work, graph placement, provenance, and policy input for Task admission. */
107
+ type CreateTaskInput = CreateTaskInputBase & ({
108
+ origin: RootTaskOrigin;
109
+ parentTaskId?: never;
110
+ parentTaskAttempt?: never;
111
+ question?: TaskQuestion;
112
+ } | ({
113
+ origin: TaskOrigin;
114
+ parentTaskId: TaskId;
115
+ } & ({
116
+ question?: undefined;
117
+ parentTaskAttempt?: never;
118
+ } | {
119
+ question: TaskQuestion;
120
+ parentTaskAttempt?: number;
121
+ })));
122
+ /** Authenticated operator and optional rationale for an immutable approval decision. */
123
+ interface ApprovalDecision {
124
+ /** Authenticated operator making the decision. */
125
+ by: string;
126
+ reason?: string;
127
+ }
128
+ /** Authenticated operator and required rationale for denying a Task approval. */
129
+ interface RejectionDecision {
130
+ /** Authenticated operator making the decision. */
131
+ by: string;
132
+ /** Human-readable reason retained on the immutable rejection receipt. */
133
+ reason: string;
134
+ }
135
+ /** Authenticated answer submitted for one open QuestionTask. */
136
+ interface AnswerQuestionInput {
137
+ questionTaskId: TaskId;
138
+ answer: string;
139
+ answeredBy: string;
140
+ }
141
+ /** Persisted answer and affected question/parent Tasks after answering a question. */
142
+ interface AnswerQuestionResult {
143
+ readonly answerEvent: AnswerEvent;
144
+ readonly questionTask: Task;
145
+ readonly parentTask: Task | null;
146
+ }
147
+ /** Exclusive binding of a Factory interaction to a Task or provider execution. */
148
+ type AgentSessionBinding = {
149
+ taskId: TaskId;
150
+ execution?: never;
151
+ } | {
152
+ execution: ExecutionReference;
153
+ taskId?: never;
154
+ };
155
+ /** Continuation Task, prompt context, and optional images cached on one Agent Session. */
156
+ interface CacheContinuationContextInput {
157
+ readonly taskId: TaskId;
158
+ readonly context: string;
159
+ readonly attachments?: readonly ImageAttachment[];
160
+ }
161
+ /** Lifecycle-transition fields that may be changed without bypassing settlement or usage APIs. */
162
+ type TaskPatch = Partial<Pick<Task, "changeId" | "reportRef" | "reservedUsd" | "reservedAt" | "question">>;
163
+ /** One completed model step's usage, as eve's step.completed event carries it. */
164
+ declare const stepUsageSchema: z.ZodObject<{
165
+ turnId: z.ZodString;
166
+ stepIndex: z.ZodNumber;
167
+ costUsd: z.ZodOptional<z.ZodNumber>;
168
+ inputTokens: z.ZodOptional<z.ZodNumber>;
169
+ outputTokens: z.ZodOptional<z.ZodNumber>;
170
+ cacheReadTokens: z.ZodOptional<z.ZodNumber>;
171
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
172
+ }, z.core.$strict>;
173
+ /** Measured usage for one completed provider turn step, used for idempotent accounting. */
174
+ type StepUsage = z.infer<typeof stepUsageSchema>;
175
+ /** Attempt and provider execution that must still own a Task usage observation. */
176
+ interface TaskExecutionFence {
177
+ readonly attempt: number;
178
+ readonly execution: ExecutionReference;
179
+ }
180
+ /** Provider execution and optional attempt fence recorded on one running Task. */
181
+ interface RecordTaskExecutionInput {
182
+ readonly execution: ExecutionReference;
183
+ readonly expectAttempt?: number;
184
+ }
185
+ /** One measured usage step and optional exact-execution fence for a Task. */
186
+ interface RecordTaskUsageInput {
187
+ readonly step: StepUsage;
188
+ readonly fence?: TaskExecutionFence;
189
+ }
190
+ interface TaskTransitionContext {
191
+ patch?: TaskPatch;
192
+ reason?: string;
193
+ /** Classifies the transition receipt for lifecycle communication. */
194
+ phase?: ReceiptPhase;
195
+ /**
196
+ * Refuse unless the task is in this state at write time. Closes
197
+ * check-then-act races where the transition would also be legal from the
198
+ * state a concurrent writer moved the task into.
199
+ */
200
+ expectFrom?: TaskState;
201
+ /** Refuse late events from a previous execution attempt. */
202
+ expectAttempt?: number;
203
+ /** Refuse completion from a provider execution that has been replaced. */
204
+ expectExecution?: ExecutionReference;
205
+ /** Refuse cleanup or answers for a question that no longer blocks this task. */
206
+ expectQuestionTaskId?: TaskId;
207
+ }
208
+ /** Destination-correlated data and concurrency fences for one Task transition. */
209
+ type TaskTransitionOptions<To extends TaskState = TaskState> = To extends "needs_human" ? TaskTransitionContext & {
210
+ /** Actionable description required whenever a Task enters needs_human. */
211
+ needsHumanAction: string;
212
+ /** Open child question required when the Task is not itself a QuestionTask. */
213
+ questionTaskId?: TaskId;
214
+ output?: never;
215
+ reuseRecordedOutput?: never;
216
+ } : To extends "succeeded" ? TaskTransitionContext & ({
217
+ /** Candidate output validated against the Task's exact workflow. */
218
+ output: unknown;
219
+ reuseRecordedOutput?: never;
220
+ } | {
221
+ output?: never;
222
+ /** Explicitly finish with output already persisted by the work store. */
223
+ reuseRecordedOutput: true;
224
+ }) & {
225
+ needsHumanAction?: never;
226
+ questionTaskId?: never;
227
+ } : TaskTransitionContext & {
228
+ output?: never;
229
+ reuseRecordedOutput?: never;
230
+ needsHumanAction?: never;
231
+ questionTaskId?: never;
232
+ };
233
+ /** Argument tuple requiring destination-specific data only for constrained transitions. */
234
+ type TaskTransitionArguments<To extends TaskState> = To extends "needs_human" | "succeeded" ? [options: TaskTransitionOptions<To>] : [options?: TaskTransitionOptions<To>];
235
+ /** Pull-request identity, ownership, and initial trust evidence used to create a Change. */
236
+ interface CreateChangeInput {
237
+ repositoryId: RepositoryId;
238
+ taskId?: TaskId;
239
+ groupId?: TaskId;
240
+ prNumber: number;
241
+ prUrl: string;
242
+ author: string;
243
+ risk: ChangeLevel;
244
+ confidence: ChangeLevel;
245
+ evidence: Change["evidence"];
246
+ }
247
+ /** Verification and merge fields that may accompany a legal Change transition. */
248
+ type ChangePatch = Partial<Pick<Change, "confidence" | "evidence" | "decidedBy" | "mergeSha">>;
249
+ interface ChangeTransitionContext {
250
+ patch?: ChangePatch;
251
+ reason?: string;
252
+ }
253
+ /** Destination-correlated patch and audit reason accompanying a Change transition. */
254
+ type ChangeTransitionOptions<To extends ChangeState = ChangeState> = To extends "merged" ? Omit<ChangeTransitionContext, "patch"> & {
255
+ /** The merge actor must be recorded when a Change first enters its merged lifecycle. */
256
+ patch: ChangePatch & {
257
+ decidedBy: string;
258
+ };
259
+ } : ChangeTransitionContext;
260
+ /** Argument tuple requiring merge attribution for the transition into merged. */
261
+ type ChangeTransitionArguments<To extends ChangeState> = To extends "merged" ? [options: ChangeTransitionOptions<To>] : [options?: ChangeTransitionOptions<To>];
262
+ /** Factory, month, and configured limits used to create or refresh a monthly Budget. */
263
+ interface EnsureBudgetInput {
264
+ factoryId: FactoryId;
265
+ month: BudgetMonth;
266
+ limits: Budget["limits"];
267
+ }
268
+ /** Monthly Budget returned with whether this call durably stamped a notice. */
269
+ interface BudgetNoticeStampResult {
270
+ readonly budget: Budget;
271
+ readonly stamped: boolean;
272
+ }
273
+ /** Measured cost and optional audit reason used to settle one terminal Task. */
274
+ interface SettleTaskInput {
275
+ readonly cost: Cost;
276
+ readonly reason?: string;
277
+ }
278
+ /** Delivery attempt, failure reason, and retry delay for one outbox message. */
279
+ interface RetryOutboxMessageInput {
280
+ readonly attempt: number;
281
+ readonly reason: string;
282
+ readonly delayMs: number;
283
+ }
284
+ interface AppendReceiptInputBase<State extends ReceiptState, Kind extends ReceiptKind> {
285
+ repositoryIds: RepositoryIds;
286
+ taskId?: TaskId;
287
+ changeId?: ChangeId;
288
+ kind: Kind;
289
+ state: State;
290
+ reason?: string;
291
+ attempt?: number;
292
+ execution?: ExecutionReference;
293
+ /** Same key twice appends one receipt and returns the existing one. */
294
+ dedupeKey?: string;
295
+ }
296
+ type AppendReceiptCost<State extends ReceiptState> = State extends "settled" ? {
297
+ cost: Cost;
298
+ } : {
299
+ cost?: never;
300
+ };
301
+ type AppendReceiptDelivery<Phase extends ReceiptPhase | undefined> = Phase extends "communication" ? {
302
+ phase: Phase;
303
+ delivery?: ReceiptDelivery;
304
+ } : {
305
+ phase?: Phase;
306
+ delivery?: never;
307
+ };
308
+ type AppendReceiptDecision<Kind extends ReceiptKind, State extends ReceiptState> = Kind extends "change" ? {
309
+ decidedBy?: string;
310
+ } : State extends "approved" | "rejected" ? {
311
+ decidedBy?: string;
312
+ } : {
313
+ decidedBy?: never;
314
+ };
315
+ type AppendReceiptCallInput<State extends ReceiptState, Kind extends ReceiptKind, Phase extends ReceiptPhase | undefined> = AppendReceiptInputBase<State, Kind> & AppendReceiptCost<State> & AppendReceiptDelivery<Phase> & AppendReceiptDecision<Kind, State>;
316
+ /** Subject, event, cost, and deduplication input for appending immutable audit evidence. */
317
+ type AppendReceiptInput<State extends ReceiptState = StandardReceiptState, Kind extends ReceiptKind = StandardReceiptKind, Phase extends ReceiptPhase | undefined = StandardReceiptPhase | "communication" | "workflow" | undefined> = State extends ReceiptState ? Kind extends ReceiptKind ? Phase extends ReceiptPhase | undefined ? AppendReceiptInputBase<State, Kind> & AppendReceiptCost<State> & AppendReceiptDelivery<Phase> & AppendReceiptDecision<Kind, State> : never : never : never;
318
+ /** Error raised when an idempotent session operation conflicts with its original intent. */
319
+ declare class SessionConflictError extends Error {}
320
+ /** Validating engine API for all canonical Factory state and auxiliary persistence. */
321
+ interface FactoryStores {
322
+ driverName: string;
323
+ /** Trusted workflow records bound to the same persistence backend as every validating store. */
324
+ workflowRecords: Pick<StoreDriver, "get" | "insert" | "update">;
325
+ /** Durable, task-scoped external-effect references and reconciliation stamps. */
326
+ taskEffects: TaskEffectStore;
327
+ /** Trusted workflow capabilities; application transports must authenticate and authorize callers. */
328
+ graphs: TaskGraphStore;
329
+ messages: TaskMessageStore;
330
+ work: TaskWorkStore;
331
+ transcripts: {
332
+ get(execution: ExecutionReference): Promise<TranscriptSnapshot | null>;
333
+ /** Persist only forward progress; safe to repeat from response-boundary hooks. */
334
+ put(execution: ExecutionReference, snapshot: TranscriptSnapshot): Promise<TranscriptSnapshot>;
335
+ };
336
+ images: {
337
+ put(owner: string, input: z.infer<typeof imageUploadSchema>): Promise<ImageAttachment>;
338
+ get(owner: string, id: ImageId): Promise<StoredImage | null>;
339
+ validate(owner: string, attachments: readonly ImageAttachment[]): Promise<readonly ImageAttachment[]>;
340
+ };
341
+ sessions: {
342
+ create(input: Omit<AgentSession, "schemaVersion" | "id" | "createdAt" | "execution" | "taskId" | "notifications" | "attached" | "continuations" | "external"> & {
343
+ operationId: string;
344
+ }): Promise<AgentSession>;
345
+ attachTask(input: {
346
+ owner: string;
347
+ taskId: TaskId;
348
+ agent: string;
349
+ message: string;
350
+ }): Promise<AgentSession>;
351
+ attachConversation(input: {
352
+ owner: string;
353
+ agent: string;
354
+ message: string;
355
+ execution: ExecutionReference;
356
+ external: NonNullable<AgentSession["external"]>;
357
+ createdAt?: string;
358
+ }): Promise<AgentSession>;
359
+ cacheContinuationContext(id: AgentSessionId, input: CacheContinuationContextInput): Promise<string>;
360
+ continue(id: AgentSessionId, input: {
361
+ operationId: string;
362
+ parentTaskId: TaskId;
363
+ agent: string;
364
+ message: string;
365
+ attachments?: readonly ImageAttachment[];
366
+ }): Promise<AgentSession>;
367
+ get(id: AgentSessionId): Promise<AgentSession | null>;
368
+ list(): Promise<readonly AgentSession[]>;
369
+ /** Compact session snapshots from fixed shards for discovery; large cached continuation context is omitted. */
370
+ summaries(): Promise<readonly AgentSession[]>;
371
+ bind(id: AgentSessionId, reference: AgentSessionBinding): Promise<AgentSession>;
372
+ notify(event: CommunicationEvent): Promise<void>;
373
+ };
374
+ repositories: {
375
+ put(repository: Repository): Promise<Repository>;
376
+ get(id: RepositoryId): Promise<Repository | null>;
377
+ list(): Promise<readonly Repository[]>;
378
+ };
379
+ signals: {
380
+ create(input: CreateSignalInput): Promise<Signal>;
381
+ get(id: SignalId): Promise<Signal | null>;
382
+ beginTriage(id: SignalId, options: {
383
+ expectedAttempt: number;
384
+ by: string;
385
+ }): Promise<Signal>;
386
+ updateTriage(id: SignalId, attempt: number, observation: Pick<SignalTriage, "state" | "failure" | "sessionId">): Promise<Signal>;
387
+ decide(id: SignalId, input: DecideSignalInput): Promise<Signal>;
388
+ list(): Promise<readonly Signal[]>;
389
+ };
390
+ tasks: {
391
+ create(input: CreateTaskInput): Promise<Task>;
392
+ get(id: TaskId): Promise<Task | null>;
393
+ findOpenQuestions(replyTo: ReplyTo): Promise<readonly Task[]>;
394
+ transition<To extends TaskState>(id: TaskId, to: To, ...args: TaskTransitionArguments<NoInfer<To>>): Promise<Task>;
395
+ /** Remove a receipt after its CommunicationEvent is durable in the outbox. */
396
+ acknowledgeCommunication(id: TaskId, receiptId: ReceiptId): Promise<Task>;
397
+ answerQuestion(input: AnswerQuestionInput): Promise<AnswerQuestionResult>;
398
+ /** Grant a required approval. The task stays queued; dispatch may now take it. */
399
+ approve(id: TaskId, decision: ApprovalDecision): Promise<Task>;
400
+ /** Immutable human decision, addressed directly by Task ID. */
401
+ approvalReceipt(id: TaskId): Promise<Receipt | null>;
402
+ /** Deny a required approval. The task is cancelled with the reason. */
403
+ reject(id: TaskId, decision: RejectionDecision): Promise<Task>;
404
+ /**
405
+ * Record the provider's handle on the running attempt's execution, so the
406
+ * reconciler can inspect or cancel it. Refused unless the task is running.
407
+ */
408
+ recordExecution(id: TaskId, input: RecordTaskExecutionInput): Promise<Task>;
409
+ /** Add one model step's usage to the task. Idempotent per (turnId, stepIndex). Never settles. */
410
+ recordUsage(id: TaskId, input: RecordTaskUsageInput): Promise<Task>;
411
+ /**
412
+ * Record measured cost on a terminal task. Idempotent: an already settled
413
+ * task returns unchanged and writes no second receipt.
414
+ */
415
+ settle(id: TaskId, input: SettleTaskInput): Promise<Task>;
416
+ /**
417
+ * Stamp a QuestionTask and the parent it currently blocks after Slack delivery.
418
+ * An attempt guard rejects confirmations from an earlier question episode.
419
+ * Retrying repairs either stamp independently; persistence errors propagate.
420
+ */
421
+ recordNeedsHumanDelivery(id: TaskId, options?: {
422
+ at?: string;
423
+ attempt?: number;
424
+ }): Promise<Task>;
425
+ /** Tasks addressed to one connector or operator conversation without a collection scan. */
426
+ forReplyTo(replyTo: ReplyTo): Promise<readonly Task[]>;
427
+ list(): Promise<readonly Task[]>;
428
+ };
429
+ changes: {
430
+ create(input: CreateChangeInput): Promise<Change>;
431
+ get(id: ChangeId): Promise<Change | null>;
432
+ transition<To extends ChangeState>(id: ChangeId, to: To, ...args: ChangeTransitionArguments<NoInfer<To>>): Promise<ChangeInState<To>>;
433
+ list(): Promise<readonly Change[]>;
434
+ };
435
+ receipts: {
436
+ append<const State extends ReceiptState, const Kind extends ReceiptKind, const Phase extends ReceiptPhase | undefined = undefined>(input: AppendReceiptCallInput<State, Kind, Phase> & {
437
+ state: State;
438
+ kind: Kind;
439
+ phase?: Phase;
440
+ }): Promise<Receipt>;
441
+ get(id: ReceiptId): Promise<Receipt | null>;
442
+ list(): Promise<readonly Receipt[]>;
443
+ };
444
+ budgets: {
445
+ /**
446
+ * Insert-once per month; refreshes limits when configuration changed and
447
+ * preserves notices. Safe under concurrent sweeps.
448
+ */
449
+ ensure(input: EnsureBudgetInput): Promise<Budget>;
450
+ get(month: BudgetMonth): Promise<Budget | null>;
451
+ /**
452
+ * Write-once notice stamp. `stamped` is false when the notice was already
453
+ * set or a concurrent stamp won, so callers notify at most once.
454
+ */
455
+ stampNotice(month: BudgetMonth, notice: "warning" | "exhausted"): Promise<BudgetNoticeStampResult>;
456
+ };
457
+ answers: {
458
+ get(id: AnswerId): Promise<AnswerEvent | null>;
459
+ };
460
+ outbox: {
461
+ enqueue(event: CommunicationEvent): Promise<OutboxMessage>;
462
+ get(id: OutboxId): Promise<OutboxMessage | null>;
463
+ claim(id: OutboxId, leaseMs?: number): Promise<OutboxMessage | null>;
464
+ retry(id: OutboxId, input: RetryOutboxMessageInput): Promise<OutboxMessage | null>;
465
+ complete(id: OutboxId, attempt: number): Promise<OutboxMessage | null>;
466
+ pending(limit?: number): Promise<readonly OutboxMessage[]>;
467
+ };
468
+ }
469
+ /** Persistence, workflow, messaging, clock, and wakeup configuration for the Factory engine. */
470
+ interface CreateStoresOptions {
471
+ driver: StoreDriver;
472
+ /** Awaited post-commit wakeups. Canonical work remains recoverable if publishing fails. */
473
+ workNotifications?: WorkNotifications;
474
+ now?: IsoDateTimeClock;
475
+ workflows?: WorkflowRegistry;
476
+ messages?: {
477
+ protocols: TaskMessageProtocols;
478
+ authorize: TaskMessageAuthorize;
479
+ };
480
+ }
481
+ /** Creates the validating Factory store engine over a deliberately policy-free driver. */
482
+ declare function createStores(options: CreateStoresOptions): FactoryStores;
483
+ //#endregion
484
+ export { AgentSessionBinding, AnswerEventConflictError, AnswerQuestionInput, AnswerQuestionResult, AppendReceiptInput, ApprovalDecision, ApprovalError, BudgetNoticeStampResult, CacheContinuationContextInput, ChangeAssociationError, ChangePatch, ChangeTransitionArguments, ChangeTransitionOptions, CreateChangeInput, CreateSignalInput, CreateStoresOptions, CreateTaskInput, DecideSignalInput, EnsureBudgetInput, FactoryStores, ImageInputError, OutboxEventConflictError, RecordTaskExecutionInput, RecordTaskUsageInput, RejectionDecision, RetryOutboxMessageInput, RootTaskOrigin, SessionConflictError, SettleTaskInput, SettlementError, StepUsage, TaskExecutionFence, TaskPatch, TaskTransitionArguments, TaskTransitionOptions, createStores };
485
+ //# sourceMappingURL=engine.d.mts.map