@elie-laloum/outpost 2.0.0 → 4.0.0

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 (588) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +3 -1
  3. package/SECURITY.md +3 -1
  4. package/dist/adapters/agents/claude-diagnostics.d.ts +1 -0
  5. package/dist/adapters/agents/claude-diagnostics.js +7 -0
  6. package/dist/adapters/agents/claude-diagnostics.js.map +1 -0
  7. package/dist/adapters/agents/cli-diagnostics.constants.d.ts +12 -0
  8. package/dist/adapters/agents/cli-diagnostics.constants.js +24 -0
  9. package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -0
  10. package/dist/adapters/agents/cli-diagnostics.d.ts +4 -0
  11. package/dist/adapters/agents/cli-diagnostics.js +14 -0
  12. package/dist/adapters/agents/cli-diagnostics.js.map +1 -0
  13. package/dist/adapters/agents/cli-diagnostics.types.d.ts +13 -0
  14. package/dist/adapters/agents/cli-diagnostics.types.js +2 -0
  15. package/dist/adapters/agents/cli-diagnostics.types.js.map +1 -0
  16. package/dist/adapters/agents/codex-diagnostics.d.ts +1 -0
  17. package/dist/adapters/agents/codex-diagnostics.js +7 -0
  18. package/dist/adapters/agents/codex-diagnostics.js.map +1 -0
  19. package/dist/adapters/agents/gemini-adapter.d.ts +3 -0
  20. package/dist/adapters/agents/gemini-adapter.js +15 -0
  21. package/dist/adapters/agents/gemini-adapter.js.map +1 -0
  22. package/dist/adapters/agents/gemini-diagnostics.d.ts +2 -0
  23. package/dist/adapters/agents/gemini-diagnostics.js +15 -0
  24. package/dist/adapters/agents/gemini-diagnostics.js.map +1 -0
  25. package/dist/adapters/agents/gemini-events.d.ts +2 -0
  26. package/dist/adapters/agents/gemini-events.js +50 -0
  27. package/dist/adapters/agents/gemini-events.js.map +1 -0
  28. package/dist/adapters/agents/gemini-request.d.ts +4 -0
  29. package/dist/adapters/agents/gemini-request.js +21 -0
  30. package/dist/adapters/agents/gemini-request.js.map +1 -0
  31. package/dist/adapters/agents/gemini.types.d.ts +6 -0
  32. package/dist/adapters/agents/gemini.types.js +2 -0
  33. package/dist/adapters/agents/gemini.types.js.map +1 -0
  34. package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -0
  35. package/dist/adapters/agents/protocol-fixtures.constants.js +105 -0
  36. package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -0
  37. package/dist/adapters/agents/protocol-fixtures.types.d.ts +6 -0
  38. package/dist/adapters/agents/protocol-fixtures.types.js +2 -0
  39. package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -0
  40. package/dist/application/agent-bootstrap.constants.d.ts +1 -0
  41. package/dist/application/agent-bootstrap.constants.js +1 -0
  42. package/dist/application/agent-bootstrap.constants.js.map +1 -1
  43. package/dist/application/agent-bootstrap.js +6 -2
  44. package/dist/application/agent-bootstrap.js.map +1 -1
  45. package/dist/application/agent-output.js +9 -2
  46. package/dist/application/agent-output.js.map +1 -1
  47. package/dist/application/artifact-tasks.d.ts +5 -0
  48. package/dist/application/artifact-tasks.js +31 -0
  49. package/dist/application/artifact-tasks.js.map +1 -0
  50. package/dist/application/artifact-tasks.types.d.ts +8 -0
  51. package/dist/application/artifact-tasks.types.js +2 -0
  52. package/dist/application/artifact-tasks.types.js.map +1 -0
  53. package/dist/application/diagnostic-probe.d.ts +3 -0
  54. package/dist/application/diagnostic-probe.js +55 -0
  55. package/dist/application/diagnostic-probe.js.map +1 -0
  56. package/dist/application/dispatch-validation.js +2 -0
  57. package/dist/application/dispatch-validation.js.map +1 -1
  58. package/dist/application/doctor-agent.constants.d.ts +11 -0
  59. package/dist/application/doctor-agent.constants.js +10 -0
  60. package/dist/application/doctor-agent.constants.js.map +1 -0
  61. package/dist/application/doctor-agent.d.ts +3 -0
  62. package/dist/application/doctor-agent.js +53 -0
  63. package/dist/application/doctor-agent.js.map +1 -0
  64. package/dist/application/doctor-image.d.ts +3 -0
  65. package/dist/application/doctor-image.js +133 -0
  66. package/dist/application/doctor-image.js.map +1 -0
  67. package/dist/application/doctor-protocol.d.ts +3 -0
  68. package/dist/application/doctor-protocol.js +30 -0
  69. package/dist/application/doctor-protocol.js.map +1 -0
  70. package/dist/application/doctor-protocol.types.d.ts +10 -0
  71. package/dist/application/doctor-protocol.types.js +2 -0
  72. package/dist/application/doctor-protocol.types.js.map +1 -0
  73. package/dist/application/doctor-sandbox.constants.d.ts +5 -0
  74. package/dist/application/doctor-sandbox.constants.js +6 -0
  75. package/dist/application/doctor-sandbox.constants.js.map +1 -0
  76. package/dist/application/doctor-sandbox.d.ts +4 -0
  77. package/dist/application/doctor-sandbox.js +133 -0
  78. package/dist/application/doctor-sandbox.js.map +1 -0
  79. package/dist/application/doctor-sandbox.types.d.ts +23 -0
  80. package/dist/application/doctor-sandbox.types.js +2 -0
  81. package/dist/application/doctor-sandbox.types.js.map +1 -0
  82. package/dist/application/doctor-transfers.constants.d.ts +6 -0
  83. package/dist/application/doctor-transfers.constants.js +7 -0
  84. package/dist/application/doctor-transfers.constants.js.map +1 -0
  85. package/dist/application/doctor-transfers.d.ts +4 -0
  86. package/dist/application/doctor-transfers.js +88 -0
  87. package/dist/application/doctor-transfers.js.map +1 -0
  88. package/dist/application/doctor.constants.d.ts +9 -0
  89. package/dist/application/doctor.constants.js +15 -0
  90. package/dist/application/doctor.constants.js.map +1 -0
  91. package/dist/application/doctor.d.ts +3 -0
  92. package/dist/application/doctor.js +106 -0
  93. package/dist/application/doctor.js.map +1 -0
  94. package/dist/application/doctor.types.d.ts +39 -0
  95. package/dist/application/doctor.types.js +2 -0
  96. package/dist/application/doctor.types.js.map +1 -0
  97. package/dist/application/execution.js +1 -0
  98. package/dist/application/execution.js.map +1 -1
  99. package/dist/application/outpost.types.d.ts +4 -0
  100. package/dist/application/outpost.types.js.map +1 -1
  101. package/dist/application/queue-worker.d.ts +2 -0
  102. package/dist/application/queue-worker.js +75 -0
  103. package/dist/application/queue-worker.js.map +1 -0
  104. package/dist/application/queue-worker.types.d.ts +15 -0
  105. package/dist/application/queue-worker.types.js +2 -0
  106. package/dist/application/queue-worker.types.js.map +1 -0
  107. package/dist/application/queued-task.d.ts +3 -0
  108. package/dist/application/queued-task.js +56 -0
  109. package/dist/application/queued-task.js.map +1 -0
  110. package/dist/application/queued-task.types.d.ts +11 -0
  111. package/dist/application/queued-task.types.js +2 -0
  112. package/dist/application/queued-task.types.js.map +1 -0
  113. package/dist/application/recovery-checksum-capture.d.ts +2 -0
  114. package/dist/application/recovery-checksum-capture.js +32 -0
  115. package/dist/application/recovery-checksum-capture.js.map +1 -0
  116. package/dist/application/recovery-checksum-paths.d.ts +2 -0
  117. package/dist/application/recovery-checksum-paths.js +11 -0
  118. package/dist/application/recovery-checksum-paths.js.map +1 -0
  119. package/dist/application/recovery-checksums.constants.d.ts +5 -0
  120. package/dist/application/recovery-checksums.constants.js +6 -0
  121. package/dist/application/recovery-checksums.constants.js.map +1 -0
  122. package/dist/application/recovery-checksums.d.ts +3 -0
  123. package/dist/application/recovery-checksums.js +94 -0
  124. package/dist/application/recovery-checksums.js.map +1 -0
  125. package/dist/application/recovery-checksums.types.d.ts +17 -0
  126. package/dist/application/recovery-checksums.types.js +2 -0
  127. package/dist/application/recovery-checksums.types.js.map +1 -0
  128. package/dist/application/recovery-inspection.d.ts +2 -0
  129. package/dist/application/recovery-inspection.js +32 -0
  130. package/dist/application/recovery-inspection.js.map +1 -0
  131. package/dist/application/recovery-inspection.types.d.ts +18 -0
  132. package/dist/application/recovery-inspection.types.js +2 -0
  133. package/dist/application/recovery-inspection.types.js.map +1 -0
  134. package/dist/application/recovery-restorability.d.ts +2 -0
  135. package/dist/application/recovery-restorability.js +137 -0
  136. package/dist/application/recovery-restorability.js.map +1 -0
  137. package/dist/application/recovery-restore-snapshot.d.ts +2 -0
  138. package/dist/application/recovery-restore-snapshot.js +57 -0
  139. package/dist/application/recovery-restore-snapshot.js.map +1 -0
  140. package/dist/application/recovery-restore.d.ts +3 -0
  141. package/dist/application/recovery-restore.js +161 -0
  142. package/dist/application/recovery-restore.js.map +1 -0
  143. package/dist/application/recovery-restore.types.d.ts +28 -0
  144. package/dist/application/recovery-restore.types.js +2 -0
  145. package/dist/application/recovery-restore.types.js.map +1 -0
  146. package/dist/application/recovery-retention-policy.d.ts +2 -0
  147. package/dist/application/recovery-retention-policy.js +21 -0
  148. package/dist/application/recovery-retention-policy.js.map +1 -0
  149. package/dist/application/recovery-retention.constants.d.ts +3 -0
  150. package/dist/application/recovery-retention.constants.js +2 -0
  151. package/dist/application/recovery-retention.constants.js.map +1 -0
  152. package/dist/application/recovery-retention.d.ts +4 -0
  153. package/dist/application/recovery-retention.js +207 -0
  154. package/dist/application/recovery-retention.js.map +1 -0
  155. package/dist/application/recovery-retention.types.d.ts +52 -0
  156. package/dist/application/recovery-retention.types.js +2 -0
  157. package/dist/application/recovery-retention.types.js.map +1 -0
  158. package/dist/application/recovery-verification.constants.d.ts +5 -0
  159. package/dist/application/recovery-verification.constants.js +10 -0
  160. package/dist/application/recovery-verification.constants.js.map +1 -0
  161. package/dist/application/recovery-verification.d.ts +3 -0
  162. package/dist/application/recovery-verification.js +107 -0
  163. package/dist/application/recovery-verification.js.map +1 -0
  164. package/dist/application/recovery-verification.types.d.ts +26 -0
  165. package/dist/application/recovery-verification.types.js +2 -0
  166. package/dist/application/recovery-verification.types.js.map +1 -0
  167. package/dist/application/remote-apply.js +30 -6
  168. package/dist/application/remote-apply.js.map +1 -1
  169. package/dist/application/remote-backup.js +6 -2
  170. package/dist/application/remote-backup.js.map +1 -1
  171. package/dist/application/remote-download.js +38 -6
  172. package/dist/application/remote-download.js.map +1 -1
  173. package/dist/application/remote-history.d.ts +6 -0
  174. package/dist/application/remote-history.js +114 -0
  175. package/dist/application/remote-history.js.map +1 -0
  176. package/dist/application/remote-upload.d.ts +2 -0
  177. package/dist/application/remote-upload.js +17 -0
  178. package/dist/application/remote-upload.js.map +1 -0
  179. package/dist/application/remote-validation.js +39 -28
  180. package/dist/application/remote-validation.js.map +1 -1
  181. package/dist/application/remote-workspace.constants.d.ts +3 -0
  182. package/dist/application/remote-workspace.constants.js +2 -0
  183. package/dist/application/remote-workspace.constants.js.map +1 -0
  184. package/dist/application/remote-workspace.js +10 -10
  185. package/dist/application/remote-workspace.js.map +1 -1
  186. package/dist/application/remote-workspace.types.d.ts +3 -1
  187. package/dist/application/remote-workspace.types.js.map +1 -1
  188. package/dist/application/sandbox-activity.d.ts +3 -0
  189. package/dist/application/sandbox-activity.js +25 -0
  190. package/dist/application/sandbox-activity.js.map +1 -0
  191. package/dist/application/sandbox-provision.js +55 -10
  192. package/dist/application/sandbox-provision.js.map +1 -1
  193. package/dist/application/sandbox-session.types.d.ts +2 -0
  194. package/dist/application/sandbox-session.types.js.map +1 -1
  195. package/dist/application/sandbox.js +33 -10
  196. package/dist/application/sandbox.js.map +1 -1
  197. package/dist/application/speculation-host.d.ts +2 -0
  198. package/dist/application/speculation-host.js +30 -0
  199. package/dist/application/speculation-host.js.map +1 -0
  200. package/dist/application/speculation.constants.d.ts +4 -0
  201. package/dist/application/speculation.constants.js +2 -0
  202. package/dist/application/speculation.constants.js.map +1 -0
  203. package/dist/application/speculation.d.ts +2 -0
  204. package/dist/application/speculation.js +166 -0
  205. package/dist/application/speculation.js.map +1 -0
  206. package/dist/application/speculation.types.d.ts +56 -0
  207. package/dist/application/speculation.types.js +2 -0
  208. package/dist/application/speculation.types.js.map +1 -0
  209. package/dist/application/storage-reservation.d.ts +3 -0
  210. package/dist/application/storage-reservation.js +10 -0
  211. package/dist/application/storage-reservation.js.map +1 -0
  212. package/dist/application/storage-reservation.types.d.ts +4 -0
  213. package/dist/application/storage-reservation.types.js +2 -0
  214. package/dist/application/storage-reservation.types.js.map +1 -0
  215. package/dist/application/task-usage.d.ts +4 -0
  216. package/dist/application/task-usage.js +41 -0
  217. package/dist/application/task-usage.js.map +1 -0
  218. package/dist/application/task-usage.types.d.ts +5 -0
  219. package/dist/application/task-usage.types.js +2 -0
  220. package/dist/application/task-usage.types.js.map +1 -0
  221. package/dist/application/tasks.js +23 -2
  222. package/dist/application/tasks.js.map +1 -1
  223. package/dist/application/tasks.types.d.ts +4 -3
  224. package/dist/application/tasks.types.js.map +1 -1
  225. package/dist/application/workspace-allocation.d.ts +3 -0
  226. package/dist/application/workspace-allocation.js +34 -0
  227. package/dist/application/workspace-allocation.js.map +1 -0
  228. package/dist/application/workspace.js +2 -2
  229. package/dist/application/workspace.js.map +1 -1
  230. package/dist/cli/commands.js +4 -0
  231. package/dist/cli/commands.js.map +1 -1
  232. package/dist/cli/doctor-command.d.ts +3 -0
  233. package/dist/cli/doctor-command.js +38 -0
  234. package/dist/cli/doctor-command.js.map +1 -0
  235. package/dist/cli/main.constants.d.ts +38 -2
  236. package/dist/cli/main.constants.js +21 -2
  237. package/dist/cli/main.constants.js.map +1 -1
  238. package/dist/cli/recovery-command.d.ts +2 -0
  239. package/dist/cli/recovery-command.js +93 -0
  240. package/dist/cli/recovery-command.js.map +1 -0
  241. package/dist/cli/recovery-prune-command.d.ts +2 -0
  242. package/dist/cli/recovery-prune-command.js +34 -0
  243. package/dist/cli/recovery-prune-command.js.map +1 -0
  244. package/dist/cli/recovery-restore-command.d.ts +2 -0
  245. package/dist/cli/recovery-restore-command.js +34 -0
  246. package/dist/cli/recovery-restore-command.js.map +1 -0
  247. package/dist/cli/recovery-verify-command.d.ts +2 -0
  248. package/dist/cli/recovery-verify-command.js +43 -0
  249. package/dist/cli/recovery-verify-command.js.map +1 -0
  250. package/dist/cli/scaffold-files.js +2 -2
  251. package/dist/cli/scaffold-files.js.map +1 -1
  252. package/dist/cli/scaffold-validation.js +1 -1
  253. package/dist/cli/scaffold-validation.js.map +1 -1
  254. package/dist/cli/scaffold.constants.d.ts +5 -0
  255. package/dist/cli/scaffold.constants.js +7 -2
  256. package/dist/cli/scaffold.constants.js.map +1 -1
  257. package/dist/cli/scaffold.types.d.ts +1 -1
  258. package/dist/cli/scaffold.types.js.map +1 -1
  259. package/dist/domain/agent.types.d.ts +2 -0
  260. package/dist/domain/agent.types.js.map +1 -1
  261. package/dist/domain/artifact-reference.d.ts +4 -0
  262. package/dist/domain/artifact-reference.js +90 -0
  263. package/dist/domain/artifact-reference.js.map +1 -0
  264. package/dist/domain/artifact.constants.d.ts +2 -0
  265. package/dist/domain/artifact.constants.js +3 -0
  266. package/dist/domain/artifact.constants.js.map +1 -0
  267. package/dist/domain/artifact.d.ts +7 -0
  268. package/dist/domain/artifact.js +104 -0
  269. package/dist/domain/artifact.js.map +1 -0
  270. package/dist/domain/artifact.types.d.ts +44 -0
  271. package/dist/domain/artifact.types.js +2 -0
  272. package/dist/domain/artifact.types.js.map +1 -0
  273. package/dist/domain/egress.constants.d.ts +1 -0
  274. package/dist/domain/egress.constants.js +7 -0
  275. package/dist/domain/egress.constants.js.map +1 -0
  276. package/dist/domain/egress.d.ts +2 -0
  277. package/dist/domain/egress.js +48 -0
  278. package/dist/domain/egress.js.map +1 -0
  279. package/dist/domain/egress.types.d.ts +8 -0
  280. package/dist/domain/egress.types.js +2 -0
  281. package/dist/domain/egress.types.js.map +1 -0
  282. package/dist/domain/ports.d.ts +1 -1
  283. package/dist/domain/ports.js.map +1 -1
  284. package/dist/domain/sandbox.types.d.ts +13 -0
  285. package/dist/domain/sandbox.types.js.map +1 -1
  286. package/dist/domain/task-queue.constants.d.ts +8 -0
  287. package/dist/domain/task-queue.constants.js +9 -0
  288. package/dist/domain/task-queue.constants.js.map +1 -0
  289. package/dist/domain/task-queue.d.ts +11 -0
  290. package/dist/domain/task-queue.js +105 -0
  291. package/dist/domain/task-queue.js.map +1 -0
  292. package/dist/domain/task-queue.types.d.ts +41 -0
  293. package/dist/domain/task-queue.types.js +2 -0
  294. package/dist/domain/task-queue.types.js.map +1 -0
  295. package/dist/domain/workflow/budget.constants.d.ts +1 -0
  296. package/dist/domain/workflow/budget.constants.js +7 -0
  297. package/dist/domain/workflow/budget.constants.js.map +1 -0
  298. package/dist/domain/workflow/budget.d.ts +9 -0
  299. package/dist/domain/workflow/budget.js +69 -0
  300. package/dist/domain/workflow/budget.js.map +1 -0
  301. package/dist/domain/workflow/budget.types.d.ts +15 -0
  302. package/dist/domain/workflow/budget.types.js +2 -0
  303. package/dist/domain/workflow/budget.types.js.map +1 -0
  304. package/dist/domain/workflow/checkpoint-validation.d.ts +3 -0
  305. package/dist/domain/workflow/checkpoint-validation.js +81 -0
  306. package/dist/domain/workflow/checkpoint-validation.js.map +1 -0
  307. package/dist/domain/workflow/checkpoint-value.d.ts +2 -0
  308. package/dist/domain/workflow/checkpoint-value.js +49 -0
  309. package/dist/domain/workflow/checkpoint-value.js.map +1 -0
  310. package/dist/domain/workflow/checkpoint.d.ts +3 -0
  311. package/dist/domain/workflow/checkpoint.js +70 -0
  312. package/dist/domain/workflow/checkpoint.js.map +1 -0
  313. package/dist/domain/workflow/checkpoint.types.d.ts +40 -0
  314. package/dist/domain/workflow/checkpoint.types.js +2 -0
  315. package/dist/domain/workflow/checkpoint.types.js.map +1 -0
  316. package/dist/domain/workflow/gate-validation.d.ts +4 -0
  317. package/dist/domain/workflow/gate-validation.js +71 -0
  318. package/dist/domain/workflow/gate-validation.js.map +1 -0
  319. package/dist/domain/workflow/gates.constants.d.ts +4 -0
  320. package/dist/domain/workflow/gates.constants.js +5 -0
  321. package/dist/domain/workflow/gates.constants.js.map +1 -0
  322. package/dist/domain/workflow/gates.d.ts +7 -0
  323. package/dist/domain/workflow/gates.js +85 -0
  324. package/dist/domain/workflow/gates.js.map +1 -0
  325. package/dist/domain/workflow/gates.types.d.ts +27 -0
  326. package/dist/domain/workflow/gates.types.js +2 -0
  327. package/dist/domain/workflow/gates.types.js.map +1 -0
  328. package/dist/domain/workflow/task-runner.js +22 -3
  329. package/dist/domain/workflow/task-runner.js.map +1 -1
  330. package/dist/domain/workflow/usage-receipt.constants.d.ts +2 -0
  331. package/dist/domain/workflow/usage-receipt.constants.js +3 -0
  332. package/dist/domain/workflow/usage-receipt.constants.js.map +1 -0
  333. package/dist/domain/workflow/usage-receipt.d.ts +2 -0
  334. package/dist/domain/workflow/usage-receipt.js +18 -0
  335. package/dist/domain/workflow/usage-receipt.js.map +1 -0
  336. package/dist/domain/workflow/validation.js +6 -0
  337. package/dist/domain/workflow/validation.js.map +1 -1
  338. package/dist/domain/workflow/workflow-scheduler.js +68 -33
  339. package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
  340. package/dist/domain/workflow/workflow-state.d.ts +2 -1
  341. package/dist/domain/workflow/workflow-state.js +107 -3
  342. package/dist/domain/workflow/workflow-state.js.map +1 -1
  343. package/dist/domain/workflow.d.ts +2 -0
  344. package/dist/domain/workflow.js +1 -0
  345. package/dist/domain/workflow.js.map +1 -1
  346. package/dist/domain/workflow.types.d.ts +23 -3
  347. package/dist/domain/workflow.types.js.map +1 -1
  348. package/dist/index.d.ts +44 -5
  349. package/dist/index.js +19 -2
  350. package/dist/index.js.map +1 -1
  351. package/dist/infrastructure/artifact-store.constants.d.ts +1 -0
  352. package/dist/infrastructure/artifact-store.constants.js +2 -0
  353. package/dist/infrastructure/artifact-store.constants.js.map +1 -0
  354. package/dist/infrastructure/artifact-store.d.ts +3 -0
  355. package/dist/infrastructure/artifact-store.js +100 -0
  356. package/dist/infrastructure/artifact-store.js.map +1 -0
  357. package/dist/infrastructure/artifact-store.types.d.ts +4 -0
  358. package/dist/infrastructure/artifact-store.types.js +2 -0
  359. package/dist/infrastructure/artifact-store.types.js.map +1 -0
  360. package/dist/infrastructure/file-manifest.d.ts +6 -0
  361. package/dist/infrastructure/file-manifest.js +92 -0
  362. package/dist/infrastructure/file-manifest.js.map +1 -0
  363. package/dist/infrastructure/git/lock-inspection.constants.d.ts +4 -0
  364. package/dist/infrastructure/git/lock-inspection.constants.js +5 -0
  365. package/dist/infrastructure/git/lock-inspection.constants.js.map +1 -0
  366. package/dist/infrastructure/git/lock-inspection.d.ts +3 -0
  367. package/dist/infrastructure/git/lock-inspection.js +64 -0
  368. package/dist/infrastructure/git/lock-inspection.js.map +1 -0
  369. package/dist/infrastructure/git/lock-inspection.types.d.ts +27 -0
  370. package/dist/infrastructure/git/lock-inspection.types.js +2 -0
  371. package/dist/infrastructure/git/lock-inspection.types.js.map +1 -0
  372. package/dist/infrastructure/git/lock.d.ts +1 -0
  373. package/dist/infrastructure/git/lock.js +70 -29
  374. package/dist/infrastructure/git/lock.js.map +1 -1
  375. package/dist/infrastructure/git/process-identity.d.ts +3 -0
  376. package/dist/infrastructure/git/process-identity.js +73 -0
  377. package/dist/infrastructure/git/process-identity.js.map +1 -0
  378. package/dist/infrastructure/git/process-identity.types.d.ts +10 -0
  379. package/dist/infrastructure/git/process-identity.types.js +2 -0
  380. package/dist/infrastructure/git/process-identity.types.js.map +1 -0
  381. package/dist/infrastructure/git/verification-command.d.ts +1 -0
  382. package/dist/infrastructure/git/verification-command.js +37 -0
  383. package/dist/infrastructure/git/verification-command.js.map +1 -0
  384. package/dist/infrastructure/git/workspace-lease.js +1 -0
  385. package/dist/infrastructure/git/workspace-lease.js.map +1 -1
  386. package/dist/infrastructure/git/workspace.js +5 -1
  387. package/dist/infrastructure/git/workspace.js.map +1 -1
  388. package/dist/infrastructure/git/worktree-inspection.constants.d.ts +5 -0
  389. package/dist/infrastructure/git/worktree-inspection.constants.js +16 -0
  390. package/dist/infrastructure/git/worktree-inspection.constants.js.map +1 -0
  391. package/dist/infrastructure/git/worktree-inspection.d.ts +3 -0
  392. package/dist/infrastructure/git/worktree-inspection.js +120 -0
  393. package/dist/infrastructure/git/worktree-inspection.js.map +1 -0
  394. package/dist/infrastructure/git/worktree-inspection.types.d.ts +19 -0
  395. package/dist/infrastructure/git/worktree-inspection.types.js +2 -0
  396. package/dist/infrastructure/git/worktree-inspection.types.js.map +1 -0
  397. package/dist/infrastructure/inspection-file.constants.d.ts +1 -0
  398. package/dist/infrastructure/inspection-file.constants.js +5 -0
  399. package/dist/infrastructure/inspection-file.constants.js.map +1 -0
  400. package/dist/infrastructure/inspection-file.d.ts +1 -0
  401. package/dist/infrastructure/inspection-file.js +43 -0
  402. package/dist/infrastructure/inspection-file.js.map +1 -0
  403. package/dist/infrastructure/inspection-hash.constants.d.ts +1 -0
  404. package/dist/infrastructure/inspection-hash.constants.js +2 -0
  405. package/dist/infrastructure/inspection-hash.constants.js.map +1 -0
  406. package/dist/infrastructure/inspection-hash.d.ts +2 -0
  407. package/dist/infrastructure/inspection-hash.js +62 -0
  408. package/dist/infrastructure/inspection-hash.js.map +1 -0
  409. package/dist/infrastructure/inspection-hash.types.d.ts +5 -0
  410. package/dist/infrastructure/inspection-hash.types.js +2 -0
  411. package/dist/infrastructure/inspection-hash.types.js.map +1 -0
  412. package/dist/infrastructure/journal-retention.constants.d.ts +4 -0
  413. package/dist/infrastructure/journal-retention.constants.js +5 -0
  414. package/dist/infrastructure/journal-retention.constants.js.map +1 -0
  415. package/dist/infrastructure/journal-retention.d.ts +2 -0
  416. package/dist/infrastructure/journal-retention.js +51 -0
  417. package/dist/infrastructure/journal-retention.js.map +1 -0
  418. package/dist/infrastructure/journal.js +37 -13
  419. package/dist/infrastructure/journal.js.map +1 -1
  420. package/dist/infrastructure/opentelemetry.constants.d.ts +10 -0
  421. package/dist/infrastructure/opentelemetry.constants.js +11 -0
  422. package/dist/infrastructure/opentelemetry.constants.js.map +1 -0
  423. package/dist/infrastructure/opentelemetry.d.ts +3 -0
  424. package/dist/infrastructure/opentelemetry.js +131 -0
  425. package/dist/infrastructure/opentelemetry.js.map +1 -0
  426. package/dist/infrastructure/opentelemetry.types.d.ts +21 -0
  427. package/dist/infrastructure/opentelemetry.types.js +2 -0
  428. package/dist/infrastructure/opentelemetry.types.js.map +1 -0
  429. package/dist/infrastructure/resource-activity-inspection.d.ts +2 -0
  430. package/dist/infrastructure/resource-activity-inspection.js +152 -0
  431. package/dist/infrastructure/resource-activity-inspection.js.map +1 -0
  432. package/dist/infrastructure/resource-activity.constants.d.ts +8 -0
  433. package/dist/infrastructure/resource-activity.constants.js +26 -0
  434. package/dist/infrastructure/resource-activity.constants.js.map +1 -0
  435. package/dist/infrastructure/resource-activity.d.ts +2 -0
  436. package/dist/infrastructure/resource-activity.js +166 -0
  437. package/dist/infrastructure/resource-activity.js.map +1 -0
  438. package/dist/infrastructure/resource-activity.types.d.ts +53 -0
  439. package/dist/infrastructure/resource-activity.types.js +2 -0
  440. package/dist/infrastructure/resource-activity.types.js.map +1 -0
  441. package/dist/infrastructure/storage-inventory.constants.d.ts +6 -0
  442. package/dist/infrastructure/storage-inventory.constants.js +11 -0
  443. package/dist/infrastructure/storage-inventory.constants.js.map +1 -0
  444. package/dist/infrastructure/storage-inventory.d.ts +2 -0
  445. package/dist/infrastructure/storage-inventory.js +123 -0
  446. package/dist/infrastructure/storage-inventory.js.map +1 -0
  447. package/dist/infrastructure/storage-inventory.types.d.ts +38 -0
  448. package/dist/infrastructure/storage-inventory.types.js +2 -0
  449. package/dist/infrastructure/storage-inventory.types.js.map +1 -0
  450. package/dist/infrastructure/storage-mutation-lock.constants.d.ts +5 -0
  451. package/dist/infrastructure/storage-mutation-lock.constants.js +6 -0
  452. package/dist/infrastructure/storage-mutation-lock.constants.js.map +1 -0
  453. package/dist/infrastructure/storage-mutation-lock.d.ts +1 -0
  454. package/dist/infrastructure/storage-mutation-lock.js +21 -0
  455. package/dist/infrastructure/storage-mutation-lock.js.map +1 -0
  456. package/dist/infrastructure/storage-reservations.constants.d.ts +4 -0
  457. package/dist/infrastructure/storage-reservations.constants.js +5 -0
  458. package/dist/infrastructure/storage-reservations.constants.js.map +1 -0
  459. package/dist/infrastructure/storage-reservations.d.ts +2 -0
  460. package/dist/infrastructure/storage-reservations.js +150 -0
  461. package/dist/infrastructure/storage-reservations.js.map +1 -0
  462. package/dist/infrastructure/storage-reservations.types.d.ts +21 -0
  463. package/dist/infrastructure/storage-reservations.types.js +2 -0
  464. package/dist/infrastructure/storage-reservations.types.js.map +1 -0
  465. package/dist/infrastructure/task-queue-http.constants.d.ts +2 -0
  466. package/dist/infrastructure/task-queue-http.constants.js +3 -0
  467. package/dist/infrastructure/task-queue-http.constants.js.map +1 -0
  468. package/dist/infrastructure/task-queue-http.d.ts +4 -0
  469. package/dist/infrastructure/task-queue-http.js +158 -0
  470. package/dist/infrastructure/task-queue-http.js.map +1 -0
  471. package/dist/infrastructure/task-queue-http.types.d.ts +16 -0
  472. package/dist/infrastructure/task-queue-http.types.js +2 -0
  473. package/dist/infrastructure/task-queue-http.types.js.map +1 -0
  474. package/dist/infrastructure/task-queue.d.ts +2 -0
  475. package/dist/infrastructure/task-queue.js +134 -0
  476. package/dist/infrastructure/task-queue.js.map +1 -0
  477. package/dist/infrastructure/transfer.js +17 -0
  478. package/dist/infrastructure/transfer.js.map +1 -1
  479. package/dist/infrastructure/workflow-checkpoint.constants.d.ts +1 -0
  480. package/dist/infrastructure/workflow-checkpoint.constants.js +2 -0
  481. package/dist/infrastructure/workflow-checkpoint.constants.js.map +1 -0
  482. package/dist/infrastructure/workflow-checkpoint.d.ts +3 -0
  483. package/dist/infrastructure/workflow-checkpoint.js +77 -0
  484. package/dist/infrastructure/workflow-checkpoint.js.map +1 -0
  485. package/dist/infrastructure/workflow-checkpoint.types.d.ts +4 -0
  486. package/dist/infrastructure/workflow-checkpoint.types.js +2 -0
  487. package/dist/infrastructure/workflow-checkpoint.types.js.map +1 -0
  488. package/dist/providers/agents.d.ts +2 -0
  489. package/dist/providers/agents.js +1 -0
  490. package/dist/providers/agents.js.map +1 -1
  491. package/dist/providers/cloud.constants.d.ts +1 -0
  492. package/dist/providers/cloud.constants.js +1 -0
  493. package/dist/providers/cloud.constants.js.map +1 -1
  494. package/dist/providers/container-cache.constants.d.ts +11 -0
  495. package/dist/providers/container-cache.constants.js +9 -0
  496. package/dist/providers/container-cache.constants.js.map +1 -0
  497. package/dist/providers/container-cache.d.ts +4 -0
  498. package/dist/providers/container-cache.js +48 -0
  499. package/dist/providers/container-cache.js.map +1 -0
  500. package/dist/providers/container-cache.types.d.ts +8 -0
  501. package/dist/providers/container-cache.types.js +2 -0
  502. package/dist/providers/container-cache.types.js.map +1 -0
  503. package/dist/providers/container-isolation.d.ts +2 -0
  504. package/dist/providers/container-isolation.js +29 -0
  505. package/dist/providers/container-isolation.js.map +1 -0
  506. package/dist/providers/container-mounts.js +7 -2
  507. package/dist/providers/container-mounts.js.map +1 -1
  508. package/dist/providers/container-network.d.ts +2 -0
  509. package/dist/providers/container-network.js +14 -0
  510. package/dist/providers/container-network.js.map +1 -0
  511. package/dist/providers/container-plan.js +6 -2
  512. package/dist/providers/container-plan.js.map +1 -1
  513. package/dist/providers/container.constants.d.ts +1 -0
  514. package/dist/providers/container.constants.js +1 -0
  515. package/dist/providers/container.constants.js.map +1 -1
  516. package/dist/providers/container.js +50 -3
  517. package/dist/providers/container.js.map +1 -1
  518. package/dist/providers/container.types.d.ts +5 -0
  519. package/dist/providers/container.types.js.map +1 -1
  520. package/dist/providers/daytona-command.js +10 -6
  521. package/dist/providers/daytona-command.js.map +1 -1
  522. package/dist/providers/daytona-terminal.d.ts +3 -0
  523. package/dist/providers/daytona-terminal.js +128 -0
  524. package/dist/providers/daytona-terminal.js.map +1 -0
  525. package/dist/providers/daytona.js +15 -4
  526. package/dist/providers/daytona.js.map +1 -1
  527. package/dist/providers/diagnostic-container.d.ts +4 -0
  528. package/dist/providers/diagnostic-container.js +15 -0
  529. package/dist/providers/diagnostic-container.js.map +1 -0
  530. package/dist/providers/docker.d.ts +2 -0
  531. package/dist/providers/docker.js.map +1 -1
  532. package/dist/providers/file-batches.constants.d.ts +10 -0
  533. package/dist/providers/file-batches.constants.js +57 -0
  534. package/dist/providers/file-batches.constants.js.map +1 -0
  535. package/dist/providers/file-batches.d.ts +2 -0
  536. package/dist/providers/file-batches.js +160 -0
  537. package/dist/providers/file-batches.js.map +1 -0
  538. package/dist/providers/file-upload.constants.d.ts +1 -0
  539. package/dist/providers/file-upload.constants.js +68 -0
  540. package/dist/providers/file-upload.constants.js.map +1 -0
  541. package/dist/providers/file-upload.d.ts +2 -0
  542. package/dist/providers/file-upload.js +146 -0
  543. package/dist/providers/file-upload.js.map +1 -0
  544. package/dist/providers/firecracker-command.d.ts +5 -0
  545. package/dist/providers/firecracker-command.js +114 -0
  546. package/dist/providers/firecracker-command.js.map +1 -0
  547. package/dist/providers/firecracker-files.constants.d.ts +1 -0
  548. package/dist/providers/firecracker-files.constants.js +21 -0
  549. package/dist/providers/firecracker-files.constants.js.map +1 -0
  550. package/dist/providers/firecracker-files.d.ts +3 -0
  551. package/dist/providers/firecracker-files.js +110 -0
  552. package/dist/providers/firecracker-files.js.map +1 -0
  553. package/dist/providers/firecracker-machine.d.ts +3 -0
  554. package/dist/providers/firecracker-machine.js +155 -0
  555. package/dist/providers/firecracker-machine.js.map +1 -0
  556. package/dist/providers/firecracker.constants.d.ts +10 -0
  557. package/dist/providers/firecracker.constants.js +11 -0
  558. package/dist/providers/firecracker.constants.js.map +1 -0
  559. package/dist/providers/firecracker.d.ts +4 -0
  560. package/dist/providers/firecracker.js +103 -0
  561. package/dist/providers/firecracker.js.map +1 -0
  562. package/dist/providers/firecracker.types.d.ts +36 -0
  563. package/dist/providers/firecracker.types.js +2 -0
  564. package/dist/providers/firecracker.types.js.map +1 -0
  565. package/dist/providers/local.js +2 -1
  566. package/dist/providers/local.js.map +1 -1
  567. package/dist/providers/podman.d.ts +2 -0
  568. package/dist/providers/podman.js.map +1 -1
  569. package/dist/providers/terminal-bridge.d.ts +14 -0
  570. package/dist/providers/terminal-bridge.js +100 -0
  571. package/dist/providers/terminal-bridge.js.map +1 -0
  572. package/dist/providers/vercel-directory.d.ts +2 -0
  573. package/dist/providers/vercel-directory.js +7 -0
  574. package/dist/providers/vercel-directory.js.map +1 -0
  575. package/dist/providers/vercel-files.js +3 -2
  576. package/dist/providers/vercel-files.js.map +1 -1
  577. package/dist/providers/vercel-network.d.ts +2 -0
  578. package/dist/providers/vercel-network.js +18 -0
  579. package/dist/providers/vercel-network.js.map +1 -0
  580. package/dist/providers/vercel.d.ts +1 -0
  581. package/dist/providers/vercel.js +8 -2
  582. package/dist/providers/vercel.js.map +1 -1
  583. package/dist/providers/vercel.types.d.ts +2 -0
  584. package/dist/providers/vercel.types.js.map +1 -1
  585. package/dist/providers/versions.constants.d.ts +1 -0
  586. package/dist/providers/versions.constants.js +1 -0
  587. package/dist/providers/versions.constants.js.map +1 -1
  588. package/package.json +16 -1
@@ -0,0 +1,158 @@
1
+ import { queueHttpTimeoutMs, queueHttpMaxHeaderBytes, } from "./task-queue-http.constants.js";
2
+ import { createServer } from "node:http";
3
+ import { timingSafeEqual } from "node:crypto";
4
+ import { queueMaxBytes } from "../domain/task-queue.constants.js";
5
+ import { queueClaim, queueJob, queueLease, queueLeaseMs, queueNumber, queueObject, queueRequest, queueResult, queueString, } from "../domain/task-queue.js";
6
+ function tokenValue(token) {
7
+ if (typeof token !== "string" ||
8
+ token.length < 32 ||
9
+ token.length > 512 ||
10
+ /\s/.test(token))
11
+ throw new Error("Queue bearer token must contain 32 to 512 non-whitespace characters");
12
+ return `Bearer ${token}`;
13
+ }
14
+ async function message(stream) {
15
+ const chunks = [];
16
+ let size = 0;
17
+ for await (const chunk of stream) {
18
+ size += chunk.byteLength;
19
+ if (size > queueMaxBytes)
20
+ throw new Error("Queue message exceeds size limit");
21
+ chunks.push(chunk);
22
+ }
23
+ return JSON.parse(Buffer.concat(chunks).toString("utf8"));
24
+ }
25
+ export async function serveTaskQueue(options) {
26
+ const expected = Buffer.from(tokenValue(options.token));
27
+ const queue = options.queue;
28
+ const server = createServer({
29
+ requestTimeout: queueHttpTimeoutMs,
30
+ headersTimeout: queueHttpTimeoutMs,
31
+ maxHeaderSize: queueHttpMaxHeaderBytes,
32
+ }, async (request, response) => {
33
+ const supplied = Buffer.from(request.headers.authorization ?? "");
34
+ if (supplied.length !== expected.length ||
35
+ !timingSafeEqual(supplied, expected)) {
36
+ response.writeHead(401).end();
37
+ request.resume();
38
+ return;
39
+ }
40
+ if (request.method !== "POST" || request.url !== "/queue") {
41
+ response.writeHead(404).end();
42
+ request.resume();
43
+ return;
44
+ }
45
+ try {
46
+ const data = queueObject(await message(request));
47
+ const operations = new Map([
48
+ ["enqueue", () => queue.enqueue(queueRequest(data.request))],
49
+ ["get", () => queue.get(queueString(data.id))],
50
+ ["claim", () => queue.claim(queueClaim(data.request))],
51
+ [
52
+ "renew",
53
+ () => queue.renew(queueLease(data.lease), queueLeaseMs(data.leaseMs)),
54
+ ],
55
+ [
56
+ "complete",
57
+ () => queue.complete(queueLease(data.lease), queueResult(data.result)),
58
+ ],
59
+ [
60
+ "cancel",
61
+ () => queue.cancel(queueString(data.id), queueNumber(data.fence)),
62
+ ],
63
+ ]);
64
+ const operation = operations.get(queueString(data.operation));
65
+ if (!operation)
66
+ throw new Error("Unknown queue operation");
67
+ const body = JSON.stringify((await operation()) ?? null);
68
+ if (Buffer.byteLength(body) > queueMaxBytes)
69
+ throw new Error("Queue response exceeds size limit");
70
+ response
71
+ .writeHead(200, {
72
+ "content-type": "application/json",
73
+ "cache-control": "no-store",
74
+ })
75
+ .end(body);
76
+ }
77
+ catch {
78
+ response.writeHead(400).end("Queue request rejected");
79
+ }
80
+ });
81
+ server.setTimeout(queueHttpTimeoutMs, (socket) => socket.destroy());
82
+ await new Promise((resolve, reject) => {
83
+ server.once("error", reject);
84
+ server.listen(options.port ?? 0, options.host ?? "127.0.0.1", resolve);
85
+ });
86
+ const address = server.address();
87
+ if (!address || typeof address === "string")
88
+ throw new Error("Queue server address unavailable");
89
+ const host = address.family === "IPv6" ? `[${address.address}]` : address.address;
90
+ return {
91
+ url: `http://${host}:${address.port}`,
92
+ close: () => new Promise((resolve, reject) => {
93
+ server.close((error) => (error ? reject(error) : resolve()));
94
+ server.closeIdleConnections();
95
+ }),
96
+ };
97
+ }
98
+ export function httpTaskQueue(options) {
99
+ const authorization = tokenValue(options.token);
100
+ const url = new URL(options.url);
101
+ if (!["http:", "https:"].includes(url.protocol) ||
102
+ url.username ||
103
+ url.password ||
104
+ url.search ||
105
+ url.hash)
106
+ throw new Error("Invalid queue URL");
107
+ const endpoint = new URL("queue", `${url.href.replace(/\/$/, "")}/`);
108
+ const timeoutMs = options.timeoutMs ?? queueHttpTimeoutMs;
109
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0)
110
+ throw new Error("Invalid queue request timeout");
111
+ async function call(data) {
112
+ const body = JSON.stringify(data);
113
+ if (Buffer.byteLength(body) > queueMaxBytes)
114
+ throw new Error("Queue message exceeds size limit");
115
+ const response = await fetch(endpoint, {
116
+ method: "POST",
117
+ headers: { authorization, "content-type": "application/json" },
118
+ body,
119
+ signal: AbortSignal.timeout(timeoutMs),
120
+ redirect: "error",
121
+ });
122
+ if (!response.ok) {
123
+ await response.body?.cancel();
124
+ throw new Error(`Queue request rejected (${response.status})`);
125
+ }
126
+ if (!response.body)
127
+ throw new Error("Missing queue response");
128
+ const value = await message(response.body);
129
+ return value === null ? undefined : queueJob(value);
130
+ }
131
+ async function required(data) {
132
+ const job = await call(data);
133
+ if (!job)
134
+ throw new Error("Missing queue job");
135
+ return job;
136
+ }
137
+ return {
138
+ enqueue: (request) => required({ operation: "enqueue", request: queueRequest(request) }),
139
+ get: (id) => call({ operation: "get", id: queueString(id) }),
140
+ claim: (request) => call({ operation: "claim", request: queueClaim(request) }),
141
+ renew: (lease, leaseMs) => required({
142
+ operation: "renew",
143
+ lease: queueLease(lease),
144
+ leaseMs: queueLeaseMs(leaseMs),
145
+ }),
146
+ complete: (lease, result) => required({
147
+ operation: "complete",
148
+ lease: queueLease(lease),
149
+ result: queueResult(result),
150
+ }),
151
+ cancel: (id, fence) => required({
152
+ operation: "cancel",
153
+ id: queueString(id),
154
+ fence: queueNumber(fence),
155
+ }),
156
+ };
157
+ }
158
+ //# sourceMappingURL=task-queue-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-queue-http.js","sourceRoot":"","sources":["../../src/infrastructure/task-queue-http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAA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AAM,CAAC;SAC5B,CAAC;QACJ,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CACpB,QAAQ,CAAC;YACP,SAAS,EAAE,QAAQ;YACnB,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC;YACnB,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;SAC1B,CAAC;KACL,CAAC;AACJ,CAAC","sourcesContent":["import {\n queueHttpTimeoutMs,\n queueHttpMaxHeaderBytes,\n} from \"./task-queue-http.constants.ts\";\nimport { createServer } from \"node:http\";\nimport { timingSafeEqual } from \"node:crypto\";\nimport { queueMaxBytes } from \"../domain/task-queue.constants.ts\";\nimport {\n queueClaim,\n queueJob,\n queueLease,\n queueLeaseMs,\n queueNumber,\n queueObject,\n queueRequest,\n queueResult,\n queueString,\n} from \"../domain/task-queue.ts\";\nimport type { TaskQueue } from \"../domain/task-queue.types.ts\";\nimport type {\n QueueClientOptions,\n QueueServer,\n QueueServerOptions,\n} from \"./task-queue-http.types.ts\";\n\nfunction tokenValue(token: string): string {\n if (\n typeof token !== \"string\" ||\n token.length < 32 ||\n token.length > 512 ||\n /\\s/.test(token)\n )\n throw new Error(\n \"Queue bearer token must contain 32 to 512 non-whitespace characters\",\n );\n return `Bearer ${token}`;\n}\nasync function message(stream: AsyncIterable<Uint8Array>): Promise<unknown> {\n const chunks: Uint8Array[] = [];\n let size = 0;\n for await (const chunk of stream) {\n size += chunk.byteLength;\n if (size > queueMaxBytes)\n throw new Error(\"Queue message exceeds size limit\");\n chunks.push(chunk);\n }\n return JSON.parse(Buffer.concat(chunks).toString(\"utf8\"));\n}\nexport async function serveTaskQueue(\n options: QueueServerOptions,\n): Promise<QueueServer> {\n const expected = Buffer.from(tokenValue(options.token));\n const queue = options.queue;\n const server = createServer(\n {\n requestTimeout: queueHttpTimeoutMs,\n headersTimeout: queueHttpTimeoutMs,\n maxHeaderSize: queueHttpMaxHeaderBytes,\n },\n async (request, response) => {\n const supplied = Buffer.from(request.headers.authorization ?? \"\");\n if (\n supplied.length !== expected.length ||\n !timingSafeEqual(supplied, expected)\n ) {\n response.writeHead(401).end();\n request.resume();\n return;\n }\n if (request.method !== \"POST\" || request.url !== \"/queue\") {\n response.writeHead(404).end();\n request.resume();\n return;\n }\n try {\n const data = queueObject(await message(request));\n const operations = new Map<string, () => Promise<unknown>>([\n [\"enqueue\", () => queue.enqueue(queueRequest(data.request))],\n [\"get\", () => queue.get(queueString(data.id))],\n [\"claim\", () => queue.claim(queueClaim(data.request))],\n [\n \"renew\",\n () =>\n queue.renew(queueLease(data.lease), queueLeaseMs(data.leaseMs)),\n ],\n [\n \"complete\",\n () =>\n queue.complete(queueLease(data.lease), queueResult(data.result)),\n ],\n [\n \"cancel\",\n () => queue.cancel(queueString(data.id), queueNumber(data.fence)),\n ],\n ]);\n const operation = operations.get(queueString(data.operation));\n if (!operation) throw new Error(\"Unknown queue operation\");\n const body = JSON.stringify((await operation()) ?? null);\n if (Buffer.byteLength(body) > queueMaxBytes)\n throw new Error(\"Queue response exceeds size limit\");\n response\n .writeHead(200, {\n \"content-type\": \"application/json\",\n \"cache-control\": \"no-store\",\n })\n .end(body);\n } catch {\n response.writeHead(400).end(\"Queue request rejected\");\n }\n },\n );\n server.setTimeout(queueHttpTimeoutMs, (socket) => socket.destroy());\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(options.port ?? 0, options.host ?? \"127.0.0.1\", resolve);\n });\n const address = server.address();\n if (!address || typeof address === \"string\")\n throw new Error(\"Queue server address unavailable\");\n const host =\n address.family === \"IPv6\" ? `[${address.address}]` : address.address;\n return {\n url: `http://${host}:${address.port}`,\n close: () =>\n new Promise<void>((resolve, reject) => {\n server.close((error) => (error ? reject(error) : resolve()));\n server.closeIdleConnections();\n }),\n };\n}\nexport function httpTaskQueue(options: QueueClientOptions): TaskQueue {\n const authorization = tokenValue(options.token);\n const url = new URL(options.url);\n if (\n ![\"http:\", \"https:\"].includes(url.protocol) ||\n url.username ||\n url.password ||\n url.search ||\n url.hash\n )\n throw new Error(\"Invalid queue URL\");\n const endpoint = new URL(\"queue\", `${url.href.replace(/\\/$/, \"\")}/`);\n const timeoutMs = options.timeoutMs ?? queueHttpTimeoutMs;\n if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0)\n throw new Error(\"Invalid queue request timeout\");\n async function call(data: unknown) {\n const body = JSON.stringify(data);\n if (Buffer.byteLength(body) > queueMaxBytes)\n throw new Error(\"Queue message exceeds size limit\");\n const response = await fetch(endpoint, {\n method: \"POST\",\n headers: { authorization, \"content-type\": \"application/json\" },\n body,\n signal: AbortSignal.timeout(timeoutMs),\n redirect: \"error\",\n });\n if (!response.ok) {\n await response.body?.cancel();\n throw new Error(`Queue request rejected (${response.status})`);\n }\n if (!response.body) throw new Error(\"Missing queue response\");\n const value = await message(response.body);\n return value === null ? undefined : queueJob(value);\n }\n async function required(data: unknown) {\n const job = await call(data);\n if (!job) throw new Error(\"Missing queue job\");\n return job;\n }\n return {\n enqueue: (request) =>\n required({ operation: \"enqueue\", request: queueRequest(request) }),\n get: (id) => call({ operation: \"get\", id: queueString(id) }),\n claim: (request) =>\n call({ operation: \"claim\", request: queueClaim(request) }),\n renew: (lease, leaseMs) =>\n required({\n operation: \"renew\",\n lease: queueLease(lease),\n leaseMs: queueLeaseMs(leaseMs),\n }),\n complete: (lease, result) =>\n required({\n operation: \"complete\",\n lease: queueLease(lease),\n result: queueResult(result),\n }),\n cancel: (id, fence) =>\n required({\n operation: \"cancel\",\n id: queueString(id),\n fence: queueNumber(fence),\n }),\n };\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { TaskQueue } from "../domain/task-queue.types.ts";
2
+ export interface QueueServerOptions {
3
+ readonly queue: TaskQueue;
4
+ readonly token: string;
5
+ readonly host?: string;
6
+ readonly port?: number;
7
+ }
8
+ export interface QueueServer {
9
+ readonly url: string;
10
+ close(): Promise<void>;
11
+ }
12
+ export interface QueueClientOptions {
13
+ readonly url: string;
14
+ readonly token: string;
15
+ readonly timeoutMs?: number;
16
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=task-queue-http.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-queue-http.types.js","sourceRoot":"","sources":["../../src/infrastructure/task-queue-http.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskQueue } from \"../domain/task-queue.types.ts\";\nexport interface QueueServerOptions {\n readonly queue: TaskQueue;\n readonly token: string;\n readonly host?: string;\n readonly port?: number;\n}\nexport interface QueueServer {\n readonly url: string;\n close(): Promise<void>;\n}\nexport interface QueueClientOptions {\n readonly url: string;\n readonly token: string;\n readonly timeoutMs?: number;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { DurableTaskQueue } from "../domain/task-queue.types.ts";
2
+ export declare function sqliteTaskQueue(path: string): Promise<DurableTaskQueue>;
@@ -0,0 +1,134 @@
1
+ import { mkdirSync, chmodSync } from "node:fs";
2
+ import { dirname, resolve } from "node:path";
3
+ import { queueClaim, queueJob, queueLease, queueLeaseMs, queueNumber, queueRequest, queueResult, queueString, } from "../domain/task-queue.js";
4
+ export async function sqliteTaskQueue(path) {
5
+ const { DatabaseSync } = await import("node:sqlite");
6
+ const file = resolve(path);
7
+ mkdirSync(dirname(file), { recursive: true, mode: 0o700 });
8
+ const db = new DatabaseSync(file);
9
+ chmodSync(file, 0o600);
10
+ db.exec("PRAGMA busy_timeout=5000; PRAGMA synchronous=FULL; CREATE TABLE IF NOT EXISTS queue_jobs (id TEXT PRIMARY KEY, body TEXT NOT NULL, status TEXT NOT NULL, handler TEXT NOT NULL, expires INTEGER, deadline INTEGER); CREATE INDEX IF NOT EXISTS queue_eligible ON queue_jobs(status, handler, expires, deadline, id)");
11
+ function read(id) {
12
+ const row = db.prepare("SELECT body FROM queue_jobs WHERE id = ?").get(id);
13
+ return row ? queueJob(JSON.parse(String(row.body))) : undefined;
14
+ }
15
+ function save(job) {
16
+ db.prepare("INSERT INTO queue_jobs(id, body, status, handler, expires, deadline) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET body=excluded.body, status=excluded.status, handler=excluded.handler, expires=excluded.expires, deadline=excluded.deadline").run(job.id, JSON.stringify(job), job.status, job.handler, job.expires ?? null, job.deadline ?? null);
17
+ return job;
18
+ }
19
+ function transaction(operation) {
20
+ db.exec("BEGIN IMMEDIATE");
21
+ try {
22
+ const result = operation();
23
+ db.exec("COMMIT");
24
+ return result;
25
+ }
26
+ catch (error) {
27
+ db.exec("ROLLBACK");
28
+ throw error;
29
+ }
30
+ }
31
+ function expire(job) {
32
+ if ((job.status === "pending" || job.status === "active") &&
33
+ job.deadline !== undefined &&
34
+ job.deadline <= Date.now())
35
+ return save({ ...job, status: "cancelled", fence: job.fence + 1 });
36
+ return job;
37
+ }
38
+ function required(id) {
39
+ const job = read(queueString(id));
40
+ if (!job)
41
+ throw new Error("Queue job does not exist");
42
+ return expire(job);
43
+ }
44
+ function owned(input) {
45
+ const lease = queueLease(input);
46
+ const job = required(lease.id);
47
+ if (job.status !== "active" ||
48
+ job.worker !== lease.worker ||
49
+ job.fence !== lease.fence ||
50
+ (job.expires ?? 0) <= Date.now())
51
+ throw new Error("Stale queue lease");
52
+ return job;
53
+ }
54
+ return {
55
+ async enqueue(input) {
56
+ return transaction(() => {
57
+ const request = queueRequest(input);
58
+ const existing = read(request.id);
59
+ if (existing) {
60
+ if (JSON.stringify(queueRequest(existing)) !== JSON.stringify(request))
61
+ throw new Error("Queue identity already has a different request");
62
+ return expire(existing);
63
+ }
64
+ return expire(save({ ...request, status: "pending", fence: 0 }));
65
+ });
66
+ },
67
+ async get(id) {
68
+ return transaction(() => {
69
+ const job = read(queueString(id));
70
+ return job ? expire(job) : undefined;
71
+ });
72
+ },
73
+ async claim(input) {
74
+ return transaction(() => {
75
+ const claim = queueClaim(input);
76
+ const now = Date.now();
77
+ const placeholders = claim.handlers.map(() => "?").join(",");
78
+ const selected = db
79
+ .prepare(`SELECT id FROM queue_jobs INDEXED BY queue_eligible
80
+ WHERE status IN ('pending', 'active') AND handler IN (${placeholders})
81
+ AND (status = 'pending' OR expires <= ?)
82
+ AND (deadline IS NULL OR deadline > ?)
83
+ ORDER BY rowid LIMIT 1`)
84
+ .get(...claim.handlers, now, now);
85
+ if (!selected)
86
+ return undefined;
87
+ const job = required(String(selected.id));
88
+ if (job.status === "cancelled")
89
+ return undefined;
90
+ return save({
91
+ ...job,
92
+ status: "active",
93
+ worker: claim.worker,
94
+ fence: job.fence + 1,
95
+ expires: Math.min(now + claim.leaseMs, job.deadline ?? Infinity),
96
+ });
97
+ });
98
+ },
99
+ async renew(lease, ms) {
100
+ return transaction(() => {
101
+ const job = owned(lease);
102
+ return save({
103
+ ...job,
104
+ expires: Math.min(Date.now() + queueLeaseMs(ms), job.deadline ?? Infinity),
105
+ });
106
+ });
107
+ },
108
+ async complete(lease, input) {
109
+ return transaction(() => {
110
+ const job = owned(lease);
111
+ const result = queueResult(input);
112
+ return save({
113
+ ...job,
114
+ status: result.error === undefined ? "done" : "failed",
115
+ result,
116
+ });
117
+ });
118
+ },
119
+ async cancel(id, fence) {
120
+ return transaction(() => {
121
+ const job = required(id);
122
+ if (job.fence !== queueNumber(fence))
123
+ throw new Error("Stale queue fence");
124
+ if (job.status !== "pending" && job.status !== "active")
125
+ return job;
126
+ return save({ ...job, status: "cancelled", fence: job.fence + 1 });
127
+ });
128
+ },
129
+ close() {
130
+ db.close();
131
+ },
132
+ };
133
+ }
134
+ //# sourceMappingURL=task-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-queue.js","sourceRoot":"","sources":["../../src/infrastructure/task-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,E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,CAAC;gBACzB,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;gBAClC,OAAO,IAAI,CAAC;oBACV,GAAG,GAAG;oBACN,MAAM,EAAE,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;oBACtD,MAAM;iBACP,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;YACpB,OAAO,WAAW,CAAC,GAAG,EAAE;gBACtB,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACzB,IAAI,GAAG,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK,CAAC;oBAClC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBACvC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ;oBAAE,OAAO,GAAG,CAAC;gBACpE,OAAO,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,KAAK;YACH,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { mkdirSync, chmodSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport {\n queueClaim,\n queueJob,\n queueLease,\n queueLeaseMs,\n queueNumber,\n queueRequest,\n queueResult,\n queueString,\n} from \"../domain/task-queue.ts\";\nimport type {\n DurableTaskQueue,\n QueueJob,\n QueueLease,\n} from \"../domain/task-queue.types.ts\";\n\nexport async function sqliteTaskQueue(path: string): Promise<DurableTaskQueue> {\n const { DatabaseSync } = await import(\"node:sqlite\");\n const file = resolve(path);\n mkdirSync(dirname(file), { recursive: true, mode: 0o700 });\n const db = new DatabaseSync(file);\n chmodSync(file, 0o600);\n db.exec(\n \"PRAGMA busy_timeout=5000; PRAGMA synchronous=FULL; CREATE TABLE IF NOT EXISTS queue_jobs (id TEXT PRIMARY KEY, body TEXT NOT NULL, status TEXT NOT NULL, handler TEXT NOT NULL, expires INTEGER, deadline INTEGER); CREATE INDEX IF NOT EXISTS queue_eligible ON queue_jobs(status, handler, expires, deadline, id)\",\n );\n function read(id: string): QueueJob | undefined {\n const row = db.prepare(\"SELECT body FROM queue_jobs WHERE id = ?\").get(id);\n return row ? queueJob(JSON.parse(String(row.body))) : undefined;\n }\n function save(job: QueueJob): QueueJob {\n db.prepare(\n \"INSERT INTO queue_jobs(id, body, status, handler, expires, deadline) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET body=excluded.body, status=excluded.status, handler=excluded.handler, expires=excluded.expires, deadline=excluded.deadline\",\n ).run(\n job.id,\n JSON.stringify(job),\n job.status,\n job.handler,\n job.expires ?? null,\n job.deadline ?? null,\n );\n return job;\n }\n function transaction<T>(operation: () => T): T {\n db.exec(\"BEGIN IMMEDIATE\");\n try {\n const result = operation();\n db.exec(\"COMMIT\");\n return result;\n } catch (error) {\n db.exec(\"ROLLBACK\");\n throw error;\n }\n }\n function expire(job: QueueJob): QueueJob {\n if (\n (job.status === \"pending\" || job.status === \"active\") &&\n job.deadline !== undefined &&\n job.deadline <= Date.now()\n )\n return save({ ...job, status: \"cancelled\", fence: job.fence + 1 });\n return job;\n }\n function required(id: string): QueueJob {\n const job = read(queueString(id));\n if (!job) throw new Error(\"Queue job does not exist\");\n return expire(job);\n }\n function owned(input: QueueLease): QueueJob {\n const lease = queueLease(input);\n const job = required(lease.id);\n if (\n job.status !== \"active\" ||\n job.worker !== lease.worker ||\n job.fence !== lease.fence ||\n (job.expires ?? 0) <= Date.now()\n )\n throw new Error(\"Stale queue lease\");\n return job;\n }\n return {\n async enqueue(input) {\n return transaction(() => {\n const request = queueRequest(input);\n const existing = read(request.id);\n if (existing) {\n if (\n JSON.stringify(queueRequest(existing)) !== JSON.stringify(request)\n )\n throw new Error(\"Queue identity already has a different request\");\n return expire(existing);\n }\n return expire(save({ ...request, status: \"pending\", fence: 0 }));\n });\n },\n async get(id) {\n return transaction(() => {\n const job = read(queueString(id));\n return job ? expire(job) : undefined;\n });\n },\n async claim(input) {\n return transaction(() => {\n const claim = queueClaim(input);\n const now = Date.now();\n const placeholders = claim.handlers.map(() => \"?\").join(\",\");\n const selected = db\n .prepare(\n `SELECT id FROM queue_jobs INDEXED BY queue_eligible\n WHERE status IN ('pending', 'active') AND handler IN (${placeholders})\n AND (status = 'pending' OR expires <= ?)\n AND (deadline IS NULL OR deadline > ?)\n ORDER BY rowid LIMIT 1`,\n )\n .get(...claim.handlers, now, now);\n if (!selected) return undefined;\n const job = required(String(selected.id));\n if (job.status === \"cancelled\") return undefined;\n return save({\n ...job,\n status: \"active\",\n worker: claim.worker,\n fence: job.fence + 1,\n expires: Math.min(now + claim.leaseMs, job.deadline ?? Infinity),\n });\n });\n },\n async renew(lease, ms) {\n return transaction(() => {\n const job = owned(lease);\n return save({\n ...job,\n expires: Math.min(\n Date.now() + queueLeaseMs(ms),\n job.deadline ?? Infinity,\n ),\n });\n });\n },\n async complete(lease, input) {\n return transaction(() => {\n const job = owned(lease);\n const result = queueResult(input);\n return save({\n ...job,\n status: result.error === undefined ? \"done\" : \"failed\",\n result,\n });\n });\n },\n async cancel(id, fence) {\n return transaction(() => {\n const job = required(id);\n if (job.fence !== queueNumber(fence))\n throw new Error(\"Stale queue fence\");\n if (job.status !== \"pending\" && job.status !== \"active\") return job;\n return save({ ...job, status: \"cancelled\", fence: job.fence + 1 });\n });\n },\n close() {\n db.close();\n },\n };\n}\n"]}
@@ -25,6 +25,23 @@ export function boundedTransfers(lease, defaults) {
25
25
  release: lease.release.bind(lease),
26
26
  upload: copy("upload"),
27
27
  download: copy("download"),
28
+ ...(lease.fileTransfers
29
+ ? {
30
+ fileTransfers: {
31
+ ...(lease.fileTransfers.uploadBatch
32
+ ? {
33
+ uploadBatch: (source, entries, destination, options = {}) => transfer({ ...defaults, ...options }, (signal) => lease.fileTransfers.uploadBatch(source, entries, destination, { ...defaults, ...options, signal })),
34
+ }
35
+ : {}),
36
+ manifest: (source, paths, options = {}) => transfer({ ...defaults, ...options }, (signal) => lease.fileTransfers.manifest(source, paths, {
37
+ ...defaults,
38
+ ...options,
39
+ signal,
40
+ })),
41
+ downloadBatch: (source, entries, destination, options = {}) => transfer({ ...defaults, ...options }, (signal) => lease.fileTransfers.downloadBatch(source, entries, destination, { ...defaults, ...options, signal })),
42
+ },
43
+ }
44
+ : {}),
28
45
  };
29
46
  }
30
47
  //# sourceMappingURL=transfer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../src/infrastructure/transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAwB,EACxB,OAA4C;IAE5C,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAgB,CAAC,UAAU,CAAC;IACrE,SAAS,CACP,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAC7C,oCAAoC,CACrC,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;QAC3B,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAChB,MAAM,KAAK,GAAG,UAAU,CACtB,GAAG,EAAE,CACH,IAAI,CAAC,KAAK,CACR,IAAI,YAAY,CAAC,SAAS,EAAE,yBAAyB,EAAE,EAAE,UAAU,EAAE,CAAC,CACvE,EACH,UAAU,CACX,CAAC;IACF,IAAI,CAAC;QACH,OAAO,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,KAAmB,EACnB,QAAyB;IAEzB,MAAM,IAAI,GACR,CAAC,MAA6B,EAAE,EAAE,CAClC,CAAC,MAAc,EAAE,WAAmB,EAAE,UAA2B,EAAE,EAAE,EAAE,CACrE,QAAQ,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/C,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,CACxE,CAAC;IACN,OAAO;QACL,GAAG,KAAK;QACR,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAChC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;QACtB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import { invariant, OutpostError } from \"../domain/errors.ts\";\nimport type { SandboxLease, TransferOptions } from \"../domain/sandbox.types.ts\";\nimport { interruptible } from \"./abort.ts\";\nimport { transferDefaults } from \"./transfer.constants.ts\";\n\nexport async function transfer<T>(\n options: TransferOptions,\n perform: (signal: AbortSignal) => Promise<T>,\n): Promise<T> {\n options.signal?.throwIfAborted();\n const deadlineMs = options.deadlineMs ?? transferDefaults.deadlineMs;\n invariant(\n Number.isFinite(deadlineMs) && deadlineMs > 0,\n \"Transfer deadline must be positive\",\n );\n const stop = new AbortController();\n const signal = options.signal\n ? AbortSignal.any([options.signal, stop.signal])\n : stop.signal;\n const timer = setTimeout(\n () =>\n stop.abort(\n new OutpostError(\"timeout\", \"File transfer timed out\", { deadlineMs }),\n ),\n deadlineMs,\n );\n try {\n return await interruptible(perform(signal), signal);\n } finally {\n clearTimeout(timer);\n }\n}\n\nexport function boundedTransfers(\n lease: SandboxLease,\n defaults: TransferOptions,\n): SandboxLease {\n const copy =\n (method: \"upload\" | \"download\") =>\n (source: string, destination: string, options: TransferOptions = {}) =>\n transfer({ ...defaults, ...options }, (signal) =>\n lease[method](source, destination, { ...defaults, ...options, signal }),\n );\n return {\n ...lease,\n invoke: lease.invoke.bind(lease),\n release: lease.release.bind(lease),\n upload: copy(\"upload\"),\n download: copy(\"download\"),\n };\n}\n"]}
1
+ {"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../src/infrastructure/transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAM9D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAwB,EACxB,OAA4C;IAE5C,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAgB,CAAC,UAAU,CAAC;IACrE,SAAS,CACP,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAC7C,oCAAoC,CACrC,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;IACnC,MAAM,MAAM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ACb,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW;wBACjC,CAAC,CAAC;4BACE,WAAW,EAAE,CACX,MAAc,EACd,OAAqC,EACrC,WAAmB,EACnB,UAA2B,EAAE,EAC7B,EAAE,CACF,QAAQ,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/C,KAAK,CAAC,aAAc,CAAC,WAAY,CAC/B,MAAM,EACN,OAAO,EACP,WAAW,EACX,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CACpC,CACF;yBACJ;wBACH,CAAC,CAAC,EAAE,CAAC;oBACP,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,CACxC,QAAQ,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/C,KAAK,CAAC,aAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE;wBAC3C,GAAG,QAAQ;wBACX,GAAG,OAAO;wBACV,MAAM;qBACP,CAAC,CACH;oBACH,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,CAC5D,QAAQ,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/C,KAAK,CAAC,aAAc,CAAC,aAAa,CAChC,MAAM,EACN,OAAO,EACP,WAAW,EACX,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CACpC,CACF;iBACJ;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC","sourcesContent":["import { invariant, OutpostError } from \"../domain/errors.ts\";\nimport type {\n FileManifestEntry,\n SandboxLease,\n TransferOptions,\n} from \"../domain/sandbox.types.ts\";\nimport { interruptible } from \"./abort.ts\";\nimport { transferDefaults } from \"./transfer.constants.ts\";\n\nexport async function transfer<T>(\n options: TransferOptions,\n perform: (signal: AbortSignal) => Promise<T>,\n): Promise<T> {\n options.signal?.throwIfAborted();\n const deadlineMs = options.deadlineMs ?? transferDefaults.deadlineMs;\n invariant(\n Number.isFinite(deadlineMs) && deadlineMs > 0,\n \"Transfer deadline must be positive\",\n );\n const stop = new AbortController();\n const signal = options.signal\n ? AbortSignal.any([options.signal, stop.signal])\n : stop.signal;\n const timer = setTimeout(\n () =>\n stop.abort(\n new OutpostError(\"timeout\", \"File transfer timed out\", { deadlineMs }),\n ),\n deadlineMs,\n );\n try {\n return await interruptible(perform(signal), signal);\n } finally {\n clearTimeout(timer);\n }\n}\n\nexport function boundedTransfers(\n lease: SandboxLease,\n defaults: TransferOptions,\n): SandboxLease {\n const copy =\n (method: \"upload\" | \"download\") =>\n (source: string, destination: string, options: TransferOptions = {}) =>\n transfer({ ...defaults, ...options }, (signal) =>\n lease[method](source, destination, { ...defaults, ...options, signal }),\n );\n return {\n ...lease,\n invoke: lease.invoke.bind(lease),\n release: lease.release.bind(lease),\n upload: copy(\"upload\"),\n download: copy(\"download\"),\n ...(lease.fileTransfers\n ? {\n fileTransfers: {\n ...(lease.fileTransfers.uploadBatch\n ? {\n uploadBatch: (\n source: string,\n entries: readonly FileManifestEntry[],\n destination: string,\n options: TransferOptions = {},\n ) =>\n transfer({ ...defaults, ...options }, (signal) =>\n lease.fileTransfers!.uploadBatch!(\n source,\n entries,\n destination,\n { ...defaults, ...options, signal },\n ),\n ),\n }\n : {}),\n manifest: (source, paths, options = {}) =>\n transfer({ ...defaults, ...options }, (signal) =>\n lease.fileTransfers!.manifest(source, paths, {\n ...defaults,\n ...options,\n signal,\n }),\n ),\n downloadBatch: (source, entries, destination, options = {}) =>\n transfer({ ...defaults, ...options }, (signal) =>\n lease.fileTransfers!.downloadBatch(\n source,\n entries,\n destination,\n { ...defaults, ...options, signal },\n ),\n ),\n },\n }\n : {}),\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const workflowCheckpointMaxBytes: number;
@@ -0,0 +1,2 @@
1
+ export const workflowCheckpointMaxBytes = 16 * 1024 * 1024;
2
+ //# sourceMappingURL=workflow-checkpoint.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-checkpoint.constants.js","sourceRoot":"","sources":["../../src/infrastructure/workflow-checkpoint.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC","sourcesContent":["export const workflowCheckpointMaxBytes = 16 * 1024 * 1024;\n"]}
@@ -0,0 +1,3 @@
1
+ import type { WorkflowCheckpointStore } from "../domain/workflow/checkpoint.types.ts";
2
+ import type { FileWorkflowCheckpointOptions } from "./workflow-checkpoint.types.ts";
3
+ export declare function fileWorkflowCheckpointStore(options: FileWorkflowCheckpointOptions): WorkflowCheckpointStore;
@@ -0,0 +1,77 @@
1
+ import { readInspectionFile } from "./inspection-file.js";
2
+ import { workflowCheckpointMaxBytes } from "./workflow-checkpoint.constants.js";
3
+ import { createHash, randomUUID } from "node:crypto";
4
+ import { mkdir, open, realpath, rename, rm } from "node:fs/promises";
5
+ import { join, resolve } from "node:path";
6
+ import { lock } from "./git/lock.js";
7
+ export function fileWorkflowCheckpointStore(options) {
8
+ const configuredDirectory = resolve(options.directory);
9
+ return {
10
+ async acquire(runId) {
11
+ if (!runId.trim())
12
+ throw new Error("Checkpoint runId must not be empty");
13
+ await mkdir(configuredDirectory, { recursive: true, mode: 0o700 });
14
+ const directory = await realpath(configuredDirectory);
15
+ const release = await lock(directory, `workflow:${runId}`);
16
+ const path = join(directory, `${createHash("sha256").update(runId).digest("hex")}.json`);
17
+ let released = false;
18
+ const assertOwned = () => {
19
+ if (released)
20
+ throw new Error("Checkpoint lease has been released");
21
+ };
22
+ return {
23
+ async read() {
24
+ assertOwned();
25
+ try {
26
+ return JSON.parse((await readInspectionFile(path, workflowCheckpointMaxBytes)).toString("utf8"));
27
+ }
28
+ catch (error) {
29
+ if (error &&
30
+ typeof error === "object" &&
31
+ "code" in error &&
32
+ error.code === "ENOENT")
33
+ return undefined;
34
+ throw error;
35
+ }
36
+ },
37
+ async write(checkpoint) {
38
+ assertOwned();
39
+ const data = JSON.stringify(checkpoint);
40
+ if (Buffer.byteLength(data) > workflowCheckpointMaxBytes)
41
+ throw new Error("Workflow checkpoint exceeds 16 MiB; store large artifacts separately");
42
+ const temporary = `${path}.${randomUUID()}.tmp`;
43
+ try {
44
+ const file = await open(temporary, "wx", 0o600);
45
+ try {
46
+ await file.writeFile(data);
47
+ await file.sync();
48
+ }
49
+ finally {
50
+ await file.close();
51
+ }
52
+ await rename(temporary, path);
53
+ if (process.platform !== "win32") {
54
+ const parent = await open(directory, "r");
55
+ try {
56
+ await parent.sync();
57
+ }
58
+ finally {
59
+ await parent.close();
60
+ }
61
+ }
62
+ }
63
+ finally {
64
+ await rm(temporary, { force: true });
65
+ }
66
+ },
67
+ async release() {
68
+ if (released)
69
+ return;
70
+ released = true;
71
+ await release();
72
+ },
73
+ };
74
+ },
75
+ };
76
+ }
77
+ //# sourceMappingURL=workflow-checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-checkpoint.js","sourceRoot":"","sources":["../../src/infrastructure/workflow-checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,IAAI,EAAE,MAAM,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AAO,EAAE,CAAC;gBAClB,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { readInspectionFile } from \"./inspection-file.ts\";\nimport { workflowCheckpointMaxBytes } from \"./workflow-checkpoint.constants.ts\";\nimport { createHash, randomUUID } from \"node:crypto\";\nimport { mkdir, open, realpath, rename, rm } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport type { WorkflowCheckpointStore } from \"../domain/workflow/checkpoint.types.ts\";\nimport type { FileWorkflowCheckpointOptions } from \"./workflow-checkpoint.types.ts\";\nimport { lock } from \"./git/lock.ts\";\n\nexport function fileWorkflowCheckpointStore(\n options: FileWorkflowCheckpointOptions,\n): WorkflowCheckpointStore {\n const configuredDirectory = resolve(options.directory);\n return {\n async acquire(runId) {\n if (!runId.trim()) throw new Error(\"Checkpoint runId must not be empty\");\n await mkdir(configuredDirectory, { recursive: true, mode: 0o700 });\n const directory = await realpath(configuredDirectory);\n const release = await lock(directory, `workflow:${runId}`);\n const path = join(\n directory,\n `${createHash(\"sha256\").update(runId).digest(\"hex\")}.json`,\n );\n let released = false;\n const assertOwned = () => {\n if (released) throw new Error(\"Checkpoint lease has been released\");\n };\n return {\n async read() {\n assertOwned();\n try {\n return JSON.parse(\n (\n await readInspectionFile(path, workflowCheckpointMaxBytes)\n ).toString(\"utf8\"),\n ) as unknown;\n } catch (error) {\n if (\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n error.code === \"ENOENT\"\n )\n return undefined;\n throw error;\n }\n },\n async write(checkpoint) {\n assertOwned();\n const data = JSON.stringify(checkpoint);\n if (Buffer.byteLength(data) > workflowCheckpointMaxBytes)\n throw new Error(\n \"Workflow checkpoint exceeds 16 MiB; store large artifacts separately\",\n );\n const temporary = `${path}.${randomUUID()}.tmp`;\n try {\n const file = await open(temporary, \"wx\", 0o600);\n try {\n await file.writeFile(data);\n await file.sync();\n } finally {\n await file.close();\n }\n await rename(temporary, path);\n if (process.platform !== \"win32\") {\n const parent = await open(directory, \"r\");\n try {\n await parent.sync();\n } finally {\n await parent.close();\n }\n }\n } finally {\n await rm(temporary, { force: true });\n }\n },\n async release() {\n if (released) return;\n released = true;\n await release();\n },\n };\n },\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export interface FileWorkflowCheckpointOptions {
2
+ /** Private directory for checkpoint data and local process ownership locks. */
3
+ readonly directory: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=workflow-checkpoint.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-checkpoint.types.js","sourceRoot":"","sources":["../../src/infrastructure/workflow-checkpoint.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface FileWorkflowCheckpointOptions {\n /** Private directory for checkpoint data and local process ownership locks. */\n readonly directory: string;\n}\n"]}
@@ -1,3 +1,5 @@
1
1
  export { claude } from "../adapters/agents/claude-adapter.ts";
2
2
  export { codex } from "../adapters/agents/codex-adapter.ts";
3
+ export { gemini } from "../adapters/agents/gemini-adapter.ts";
4
+ export type { GeminiSettings } from "../adapters/agents/gemini.types.ts";
3
5
  export type { ClaudeSettings, CodexSettings, } from "../adapters/agents/settings.types.ts";
@@ -1,3 +1,4 @@
1
1
  export { claude } from "../adapters/agents/claude-adapter.js";
2
2
  export { codex } from "../adapters/agents/codex-adapter.js";
3
+ export { gemini } from "../adapters/agents/gemini-adapter.js";
3
4
  //# sourceMappingURL=agents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/providers/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC","sourcesContent":["export { claude } from \"../adapters/agents/claude-adapter.ts\";\nexport { codex } from \"../adapters/agents/codex-adapter.ts\";\nexport type {\n ClaudeSettings,\n CodexSettings,\n} from \"../adapters/agents/settings.types.ts\";\n"]}
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/providers/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC","sourcesContent":["export { claude } from \"../adapters/agents/claude-adapter.ts\";\nexport { codex } from \"../adapters/agents/codex-adapter.ts\";\nexport { gemini } from \"../adapters/agents/gemini-adapter.ts\";\nexport type { GeminiSettings } from \"../adapters/agents/gemini.types.ts\";\nexport type {\n ClaudeSettings,\n CodexSettings,\n} from \"../adapters/agents/settings.types.ts\";\n"]}
@@ -1,6 +1,7 @@
1
1
  export declare const cloudDefaults: Readonly<{
2
2
  deadlineMs: 600000;
3
3
  retainBytes: 65536;
4
+ pollMs: 100;
4
5
  cancellationMs: 15000;
5
6
  }>;
6
7
  export declare const cloudRoots: Readonly<{
@@ -1,6 +1,7 @@
1
1
  export const cloudDefaults = Object.freeze({
2
2
  deadlineMs: 600_000,
3
3
  retainBytes: 65_536,
4
+ pollMs: 100,
4
5
  cancellationMs: 15_000,
5
6
  });
6
7
  export const cloudRoots = Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"cloud.constants.js","sourceRoot":"","sources":["../../src/providers/cloud.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,MAAM;CACvB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,yBAAyB;IACjC,WAAW,EAAE,eAAe;CAC7B,CAAC,CAAC","sourcesContent":["export const cloudDefaults = Object.freeze({\n deadlineMs: 600_000,\n retainBytes: 65_536,\n cancellationMs: 15_000,\n});\nexport const cloudRoots = Object.freeze({\n vercel: \"/vercel/sandbox/outpost\",\n daytonaHome: \"/home/daytona\",\n});\n"]}
1
+ {"version":3,"file":"cloud.constants.js","sourceRoot":"","sources":["../../src/providers/cloud.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,GAAG;IACX,cAAc,EAAE,MAAM;CACvB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,yBAAyB;IACjC,WAAW,EAAE,eAAe;CAC7B,CAAC,CAAC","sourcesContent":["export const cloudDefaults = Object.freeze({\n deadlineMs: 600_000,\n retainBytes: 65_536,\n pollMs: 100,\n cancellationMs: 15_000,\n});\nexport const cloudRoots = Object.freeze({\n vercel: \"/vercel/sandbox/outpost\",\n daytonaHome: \"/home/daytona\",\n});\n"]}
@@ -0,0 +1,11 @@
1
+ export declare const cacheDefaults: Readonly<{
2
+ root: "/outpost/cache";
3
+ label: "io.outpost.cache";
4
+ version: 1;
5
+ namePattern: RegExp;
6
+ maximumKeyLength: 1024;
7
+ }>;
8
+ export declare const cacheCreateOptions: {
9
+ readonly docker: readonly [];
10
+ readonly podman: readonly ["--ignore"];
11
+ };
@@ -0,0 +1,9 @@
1
+ export const cacheDefaults = Object.freeze({
2
+ root: "/outpost/cache",
3
+ label: "io.outpost.cache",
4
+ version: 1,
5
+ namePattern: /^[a-z][a-z0-9-]{0,47}$/,
6
+ maximumKeyLength: 1024,
7
+ });
8
+ export const cacheCreateOptions = { docker: [], podman: ["--ignore"] };
9
+ //# sourceMappingURL=container-cache.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-cache.constants.js","sourceRoot":"","sources":["../../src/providers/container-cache.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,kBAAkB;IACzB,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,wBAAwB;IACrC,gBAAgB,EAAE,IAAI;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,EAAW,CAAC","sourcesContent":["export const cacheDefaults = Object.freeze({\n root: \"/outpost/cache\",\n label: \"io.outpost.cache\",\n version: 1,\n namePattern: /^[a-z][a-z0-9-]{0,47}$/,\n maximumKeyLength: 1024,\n});\n\nexport const cacheCreateOptions = { docker: [], podman: [\"--ignore\"] } as const;\n"]}
@@ -0,0 +1,4 @@
1
+ import type { DependencyCache, ContainerCacheMount } from "./container-cache.types.ts";
2
+ import type { ContainerOptions, ContainerUser } from "./container.types.ts";
3
+ export declare function validateCaches(config: ContainerOptions): void;
4
+ export declare function cacheMounts(caches: readonly DependencyCache[], repository: string, image: string, user: ContainerUser): Promise<ContainerCacheMount[]>;