@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,123 @@
1
+ import { lstat, opendir } from "node:fs/promises";
2
+ import { basename, join } from "node:path";
3
+ import { positive } from "../domain/errors.js";
4
+ import { storageCategories, storageInventoryDefaults, } from "./storage-inventory.constants.js";
5
+ function usage() {
6
+ return { bytes: 0, files: 0, directories: 0, symlinks: 0, other: 0 };
7
+ }
8
+ function addUsage(target, incoming) {
9
+ target.bytes += incoming.bytes;
10
+ target.files += incoming.files;
11
+ target.directories += incoming.directories;
12
+ target.symlinks += incoming.symlinks;
13
+ target.other += incoming.other;
14
+ }
15
+ function errorCode(error) {
16
+ if (error &&
17
+ typeof error === "object" &&
18
+ "code" in error &&
19
+ typeof error.code === "string")
20
+ return error.code;
21
+ return "UNAVAILABLE";
22
+ }
23
+ async function availableDirectory(path, scan) {
24
+ try {
25
+ const info = await lstat(path);
26
+ if (info.isDirectory() && !info.isSymbolicLink())
27
+ return true;
28
+ scan.issues.push({
29
+ path,
30
+ code: info.isSymbolicLink() ? "SYMLINK_ROOT" : "NOT_DIRECTORY",
31
+ });
32
+ }
33
+ catch (error) {
34
+ if (errorCode(error) !== "ENOENT")
35
+ scan.issues.push({ path, code: errorCode(error) });
36
+ }
37
+ return false;
38
+ }
39
+ async function measure(path, scan, depth) {
40
+ const startIssues = scan.issues.length;
41
+ const entry = {
42
+ ...usage(),
43
+ name: basename(path),
44
+ path,
45
+ kind: "unknown",
46
+ complete: true,
47
+ };
48
+ if (scan.remaining === 0) {
49
+ scan.issues.push({ path, code: "ENTRY_LIMIT" });
50
+ return { ...entry, complete: false };
51
+ }
52
+ scan.remaining--;
53
+ try {
54
+ const info = await lstat(path);
55
+ entry.modifiedAt = info.mtime.toISOString();
56
+ if (info.isSymbolicLink())
57
+ return { ...entry, kind: "symlink", symlinks: 1 };
58
+ if (info.isFile())
59
+ return { ...entry, kind: "file", files: 1, bytes: info.size };
60
+ if (!info.isDirectory()) {
61
+ scan.issues.push({ path, code: "UNSUPPORTED_TYPE" });
62
+ return { ...entry, kind: "other", other: 1, complete: false };
63
+ }
64
+ entry.kind = "directory";
65
+ entry.directories = 1;
66
+ if (depth >= storageInventoryDefaults.maxDepth) {
67
+ scan.issues.push({ path, code: "DEPTH_LIMIT" });
68
+ return { ...entry, complete: false };
69
+ }
70
+ for await (const child of await opendir(path)) {
71
+ const nested = await measure(join(path, child.name), scan, depth + 1);
72
+ addUsage(entry, nested);
73
+ if (nested.modifiedAt && nested.modifiedAt > entry.modifiedAt)
74
+ entry.modifiedAt = nested.modifiedAt;
75
+ if (!nested.complete)
76
+ entry.complete = false;
77
+ if (scan.remaining === 0 && !nested.complete)
78
+ break;
79
+ }
80
+ }
81
+ catch (error) {
82
+ scan.issues.push({ path, code: errorCode(error) });
83
+ }
84
+ entry.complete = entry.complete && scan.issues.length === startIssues;
85
+ return entry;
86
+ }
87
+ export async function storageInventory(root, maxEntries = storageInventoryDefaults.maxEntries) {
88
+ positive(maxEntries, "maxEntries");
89
+ const scan = { remaining: maxEntries, issues: [] };
90
+ const categories = [];
91
+ const total = usage();
92
+ const available = await availableDirectory(root, scan);
93
+ for (const name of storageCategories) {
94
+ const path = join(root, name);
95
+ const entries = [];
96
+ if (available && (await availableDirectory(path, scan))) {
97
+ try {
98
+ for await (const child of await opendir(path)) {
99
+ const entry = await measure(join(path, child.name), scan, 0);
100
+ entries.push(entry);
101
+ addUsage(total, entry);
102
+ if (scan.remaining === 0 && !entry.complete)
103
+ break;
104
+ }
105
+ }
106
+ catch (error) {
107
+ scan.issues.push({ path, code: errorCode(error) });
108
+ }
109
+ }
110
+ entries.sort((left, right) => left.name < right.name ? -1 : Number(left.name > right.name));
111
+ categories.push({ name, path, entries });
112
+ }
113
+ return {
114
+ root,
115
+ categories,
116
+ usage: total,
117
+ issues: scan.issues,
118
+ complete: scan.issues.length === 0,
119
+ scannedEntries: maxEntries - scan.remaining,
120
+ maxEntries,
121
+ };
122
+ }
123
+ //# sourceMappingURL=storage-inventory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-inventory.js","sourceRoot":"","sources":["../../src/infrastructure/storage-inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAS1C,SAAS,KAAK;IACZ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACvE,CAAC;AACD,SAAS,QAAQ,CACf,MAAoB,EACpB,QAAgC;IAEhC,MAAM,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;IAC/B,MAAM,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;IAC/B,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC;IAC3C,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;IACrC,MAAM,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;AACjC,CAAC;AACD,SAAS,SAAS,CAAC,KAAc;IAC/B,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAE9B,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,OAAO,aAAa,CAAC;AACvB,CAAC;AACD,KAA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, opendir } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\nimport { positive } from \"../domain/errors.ts\";\nimport {\n storageCategories,\n storageInventoryDefaults,\n} from \"./storage-inventory.constants.ts\";\nimport type {\n StorageCategory,\n StorageEntry,\n StorageInventory,\n StorageScan,\n StorageUsage,\n} from \"./storage-inventory.types.ts\";\n\nfunction usage(): StorageUsage {\n return { bytes: 0, files: 0, directories: 0, symlinks: 0, other: 0 };\n}\nfunction addUsage(\n target: StorageUsage,\n incoming: Readonly<StorageUsage>,\n): void {\n target.bytes += incoming.bytes;\n target.files += incoming.files;\n target.directories += incoming.directories;\n target.symlinks += incoming.symlinks;\n target.other += incoming.other;\n}\nfunction errorCode(error: unknown): string {\n if (\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n typeof error.code === \"string\"\n )\n return error.code;\n return \"UNAVAILABLE\";\n}\nasync function availableDirectory(\n path: string,\n scan: StorageScan,\n): Promise<boolean> {\n try {\n const info = await lstat(path);\n if (info.isDirectory() && !info.isSymbolicLink()) return true;\n scan.issues.push({\n path,\n code: info.isSymbolicLink() ? \"SYMLINK_ROOT\" : \"NOT_DIRECTORY\",\n });\n } catch (error) {\n if (errorCode(error) !== \"ENOENT\")\n scan.issues.push({ path, code: errorCode(error) });\n }\n return false;\n}\nasync function measure(\n path: string,\n scan: StorageScan,\n depth: number,\n): Promise<StorageEntry> {\n const startIssues = scan.issues.length;\n const entry: StorageEntry = {\n ...usage(),\n name: basename(path),\n path,\n kind: \"unknown\",\n complete: true,\n };\n if (scan.remaining === 0) {\n scan.issues.push({ path, code: \"ENTRY_LIMIT\" });\n return { ...entry, complete: false };\n }\n scan.remaining--;\n try {\n const info = await lstat(path);\n entry.modifiedAt = info.mtime.toISOString();\n if (info.isSymbolicLink())\n return { ...entry, kind: \"symlink\", symlinks: 1 };\n if (info.isFile())\n return { ...entry, kind: \"file\", files: 1, bytes: info.size };\n if (!info.isDirectory()) {\n scan.issues.push({ path, code: \"UNSUPPORTED_TYPE\" });\n return { ...entry, kind: \"other\", other: 1, complete: false };\n }\n entry.kind = \"directory\";\n entry.directories = 1;\n if (depth >= storageInventoryDefaults.maxDepth) {\n scan.issues.push({ path, code: \"DEPTH_LIMIT\" });\n return { ...entry, complete: false };\n }\n for await (const child of await opendir(path)) {\n const nested = await measure(join(path, child.name), scan, depth + 1);\n addUsage(entry, nested);\n if (nested.modifiedAt && nested.modifiedAt > entry.modifiedAt)\n entry.modifiedAt = nested.modifiedAt;\n if (!nested.complete) entry.complete = false;\n if (scan.remaining === 0 && !nested.complete) break;\n }\n } catch (error) {\n scan.issues.push({ path, code: errorCode(error) });\n }\n entry.complete = entry.complete && scan.issues.length === startIssues;\n return entry;\n}\n\nexport async function storageInventory(\n root: string,\n maxEntries: number = storageInventoryDefaults.maxEntries,\n): Promise<StorageInventory> {\n positive(maxEntries, \"maxEntries\");\n const scan: StorageScan = { remaining: maxEntries, issues: [] };\n const categories: StorageCategory[] = [];\n const total = usage();\n const available = await availableDirectory(root, scan);\n for (const name of storageCategories) {\n const path = join(root, name);\n const entries: StorageEntry[] = [];\n if (available && (await availableDirectory(path, scan))) {\n try {\n for await (const child of await opendir(path)) {\n const entry = await measure(join(path, child.name), scan, 0);\n entries.push(entry);\n addUsage(total, entry);\n if (scan.remaining === 0 && !entry.complete) break;\n }\n } catch (error) {\n scan.issues.push({ path, code: errorCode(error) });\n }\n }\n entries.sort((left, right) =>\n left.name < right.name ? -1 : Number(left.name > right.name),\n );\n categories.push({ name, path, entries });\n }\n return {\n root,\n categories,\n usage: total,\n issues: scan.issues,\n complete: scan.issues.length === 0,\n scannedEntries: maxEntries - scan.remaining,\n maxEntries,\n };\n}\n"]}
@@ -0,0 +1,38 @@
1
+ export type StorageCategoryName = "recovery" | "logs" | "locks" | "workspaces";
2
+ export type StorageEntryKind = "file" | "directory" | "symlink" | "other" | "unknown";
3
+ export interface StorageIssue {
4
+ readonly path: string;
5
+ readonly code: string;
6
+ }
7
+ export interface StorageUsage {
8
+ bytes: number;
9
+ files: number;
10
+ directories: number;
11
+ symlinks: number;
12
+ other: number;
13
+ }
14
+ export interface StorageEntry extends StorageUsage {
15
+ readonly name: string;
16
+ readonly path: string;
17
+ kind: StorageEntryKind;
18
+ modifiedAt?: string;
19
+ complete: boolean;
20
+ }
21
+ export interface StorageCategory {
22
+ readonly name: StorageCategoryName;
23
+ readonly path: string;
24
+ readonly entries: readonly StorageEntry[];
25
+ }
26
+ export interface StorageInventory {
27
+ readonly root: string;
28
+ readonly categories: readonly StorageCategory[];
29
+ readonly usage: Readonly<StorageUsage>;
30
+ readonly issues: readonly StorageIssue[];
31
+ readonly complete: boolean;
32
+ readonly scannedEntries: number;
33
+ readonly maxEntries: number;
34
+ }
35
+ export interface StorageScan {
36
+ remaining: number;
37
+ readonly issues: StorageIssue[];
38
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage-inventory.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-inventory.types.js","sourceRoot":"","sources":["../../src/infrastructure/storage-inventory.types.ts"],"names":[],"mappings":"","sourcesContent":["export type StorageCategoryName = \"recovery\" | \"logs\" | \"locks\" | \"workspaces\";\nexport type StorageEntryKind =\n \"file\" | \"directory\" | \"symlink\" | \"other\" | \"unknown\";\n\nexport interface StorageIssue {\n readonly path: string;\n readonly code: string;\n}\nexport interface StorageUsage {\n bytes: number;\n files: number;\n directories: number;\n symlinks: number;\n other: number;\n}\nexport interface StorageEntry extends StorageUsage {\n readonly name: string;\n readonly path: string;\n kind: StorageEntryKind;\n modifiedAt?: string;\n complete: boolean;\n}\nexport interface StorageCategory {\n readonly name: StorageCategoryName;\n readonly path: string;\n readonly entries: readonly StorageEntry[];\n}\nexport interface StorageInventory {\n readonly root: string;\n readonly categories: readonly StorageCategory[];\n readonly usage: Readonly<StorageUsage>;\n readonly issues: readonly StorageIssue[];\n readonly complete: boolean;\n readonly scannedEntries: number;\n readonly maxEntries: number;\n}\nexport interface StorageScan {\n remaining: number;\n readonly issues: StorageIssue[];\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const storageMutationLockDefaults: {
2
+ readonly lockKey: "storage-reservations:v1";
3
+ readonly lockWaitMs: 5000;
4
+ readonly lockPollMs: 20;
5
+ };
@@ -0,0 +1,6 @@
1
+ export const storageMutationLockDefaults = {
2
+ lockKey: "storage-reservations:v1",
3
+ lockWaitMs: 5_000,
4
+ lockPollMs: 20,
5
+ };
6
+ //# sourceMappingURL=storage-mutation-lock.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-mutation-lock.constants.js","sourceRoot":"","sources":["../../src/infrastructure/storage-mutation-lock.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,OAAO,EAAE,yBAAyB;IAClC,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,EAAE;CACN,CAAC","sourcesContent":["export const storageMutationLockDefaults = {\n lockKey: \"storage-reservations:v1\",\n lockWaitMs: 5_000,\n lockPollMs: 20,\n} as const;\n"]}
@@ -0,0 +1 @@
1
+ export declare function lockStorageMutation(root: string, signal?: AbortSignal): Promise<() => Promise<void>>;
@@ -0,0 +1,21 @@
1
+ import { setTimeout } from "node:timers/promises";
2
+ import { OutpostError } from "../domain/errors.js";
3
+ import { lock } from "./git/lock.js";
4
+ import { storageMutationLockDefaults as defaults } from "./storage-mutation-lock.constants.js";
5
+ export async function lockStorageMutation(root, signal) {
6
+ const deadline = Date.now() + defaults.lockWaitMs;
7
+ while (true) {
8
+ signal?.throwIfAborted();
9
+ try {
10
+ return await lock(root, defaults.lockKey);
11
+ }
12
+ catch (error) {
13
+ if (!(error instanceof OutpostError) ||
14
+ error.code !== "conflict" ||
15
+ Date.now() >= deadline)
16
+ throw error;
17
+ await setTimeout(defaults.lockPollMs, undefined, { signal });
18
+ }
19
+ }
20
+ }
21
+ //# sourceMappingURL=storage-mutation-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-mutation-lock.js","sourceRoot":"","sources":["../../src/infrastructure/storage-mutation-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,2BAA2B,IAAI,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAE/F,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAY,EAAE,MAAoB;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC;IAClD,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IACE,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC;gBAChC,KAAK,CAAC,IAAI,KAAK,UAAU;gBACzB,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ;gBAEtB,MAAM,KAAK,CAAC;YACd,MAAM,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { setTimeout } from \"node:timers/promises\";\nimport { OutpostError } from \"../domain/errors.ts\";\nimport { lock } from \"./git/lock.ts\";\nimport { storageMutationLockDefaults as defaults } from \"./storage-mutation-lock.constants.ts\";\n\nexport async function lockStorageMutation(root: string, signal?: AbortSignal) {\n const deadline = Date.now() + defaults.lockWaitMs;\n while (true) {\n signal?.throwIfAborted();\n try {\n return await lock(root, defaults.lockKey);\n } catch (error) {\n if (\n !(error instanceof OutpostError) ||\n error.code !== \"conflict\" ||\n Date.now() >= deadline\n )\n throw error;\n await setTimeout(defaults.lockPollMs, undefined, { signal });\n }\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const storageReservationDefaults: {
2
+ readonly maxRecordBytes: 4096;
3
+ readonly maxRecords: 10000;
4
+ };
@@ -0,0 +1,5 @@
1
+ export const storageReservationDefaults = {
2
+ maxRecordBytes: 4_096,
3
+ maxRecords: 10_000,
4
+ };
5
+ //# sourceMappingURL=storage-reservations.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-reservations.constants.js","sourceRoot":"","sources":["../../src/infrastructure/storage-reservations.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,cAAc,EAAE,KAAK;IACrB,UAAU,EAAE,MAAM;CACV,CAAC","sourcesContent":["export const storageReservationDefaults = {\n maxRecordBytes: 4_096,\n maxRecords: 10_000,\n} as const;\n"]}
@@ -0,0 +1,2 @@
1
+ import type { StorageReservation, StorageReservationOptions } from "./storage-reservations.types.ts";
2
+ export declare function reserveStorage(repository: string, options: StorageReservationOptions): Promise<StorageReservation>;
@@ -0,0 +1,150 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { mkdir, open, readdir, realpath, rm } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { invariant, OutpostError } from "../domain/errors.js";
5
+ import { lockStorageMutation } from "./storage-mutation-lock.js";
6
+ import { localProcessIdentity, observeOwnership, } from "./git/process-identity.js";
7
+ import { readInspectionFile } from "./inspection-file.js";
8
+ import { storageInventory } from "./storage-inventory.js";
9
+ import { storageReservationDefaults as defaults } from "./storage-reservations.constants.js";
10
+ async function reservationDirectory(root) {
11
+ const paths = [
12
+ join(root, ".outpost"),
13
+ join(root, ".outpost", "locks"),
14
+ join(root, ".outpost", "locks", "storage-reservations"),
15
+ ];
16
+ for (const path of paths) {
17
+ await mkdir(path, { recursive: true, mode: 0o700 });
18
+ invariant((await realpath(path)) === path, "Storage reservation directory must not use symlinks");
19
+ }
20
+ return paths[2];
21
+ }
22
+ function validRecord(value) {
23
+ if (!value || typeof value !== "object")
24
+ return false;
25
+ return ("version" in value &&
26
+ value.version === 1 &&
27
+ "id" in value &&
28
+ typeof value.id === "string" &&
29
+ "pid" in value &&
30
+ typeof value.pid === "number" &&
31
+ Number.isSafeInteger(value.pid) &&
32
+ value.pid > 0 &&
33
+ value.pid <= 2_147_483_647 &&
34
+ "reserveBytes" in value &&
35
+ typeof value.reserveBytes === "number" &&
36
+ Number.isSafeInteger(value.reserveBytes) &&
37
+ value.reserveBytes >= 0 &&
38
+ "createdAt" in value &&
39
+ typeof value.createdAt === "string" &&
40
+ Number.isFinite(Date.parse(value.createdAt)));
41
+ }
42
+ async function readRecord(path) {
43
+ try {
44
+ const value = JSON.parse((await readInspectionFile(path, defaults.maxRecordBytes)).toString("utf8"));
45
+ if (validRecord(value))
46
+ return value;
47
+ }
48
+ catch (cause) {
49
+ throw new OutpostError("workspace", "Storage reservation record is unreadable; admission refused", { path }, cause);
50
+ }
51
+ throw new OutpostError("workspace", "Storage reservation record is invalid; admission refused", { path });
52
+ }
53
+ async function reservedBytes(directory) {
54
+ const names = await readdir(directory);
55
+ invariant(names.length <= defaults.maxRecords, "Too many storage reservation records");
56
+ let reserved = 0;
57
+ for (const name of names) {
58
+ const path = join(directory, name);
59
+ const record = await readRecord(path);
60
+ invariant(name === `${record.id}.json`, "Storage reservation identity mismatch");
61
+ const owner = await observeOwnership(record.pid, record.identity);
62
+ if (owner.status === "inactive") {
63
+ await rm(path);
64
+ continue;
65
+ }
66
+ reserved += record.reserveBytes;
67
+ invariant(Number.isSafeInteger(reserved), "Storage reservation total exceeds safe integer range");
68
+ }
69
+ return reserved;
70
+ }
71
+ async function releaseRecord(root, path, id) {
72
+ await reservationDirectory(root);
73
+ const unlock = await lockStorageMutation(root);
74
+ try {
75
+ const names = await readdir(join(root, ".outpost", "locks", "storage-reservations"));
76
+ if (!names.includes(`${id}.json`))
77
+ return;
78
+ const record = await readRecord(path);
79
+ invariant(record.id === id, "Storage reservation identity changed; refusing release");
80
+ await rm(path);
81
+ }
82
+ finally {
83
+ await unlock();
84
+ }
85
+ }
86
+ export async function reserveStorage(repository, options) {
87
+ invariant(Number.isSafeInteger(options.maxBytes) && options.maxBytes >= 0, "maxBytes must be a nonnegative integer");
88
+ invariant(Number.isSafeInteger(options.reserveBytes) && options.reserveBytes >= 0, "reserveBytes must be a nonnegative integer");
89
+ options.signal?.throwIfAborted();
90
+ const directory = await reservationDirectory(repository);
91
+ const unlock = await lockStorageMutation(repository, options.signal);
92
+ const id = randomUUID();
93
+ const path = join(directory, `${id}.json`);
94
+ try {
95
+ const reserved = await reservedBytes(directory);
96
+ const inventory = await storageInventory(join(repository, ".outpost"), options.maxEntries);
97
+ const record = {
98
+ version: 1,
99
+ id,
100
+ pid: process.pid,
101
+ identity: await localProcessIdentity(),
102
+ reserveBytes: options.reserveBytes,
103
+ createdAt: new Date().toISOString(),
104
+ };
105
+ const data = JSON.stringify(record);
106
+ if (!inventory.complete ||
107
+ inventory.usage.bytes +
108
+ reserved +
109
+ options.reserveBytes +
110
+ Buffer.byteLength(data) >
111
+ options.maxBytes)
112
+ throw new OutpostError("workspace", "Outpost storage reservation admission refused", {
113
+ usageBytes: inventory.usage.bytes,
114
+ reservedBytes: reserved,
115
+ reserveBytes: options.reserveBytes,
116
+ maxBytes: options.maxBytes,
117
+ complete: inventory.complete,
118
+ });
119
+ options.signal?.throwIfAborted();
120
+ const file = await open(path, "wx", 0o600);
121
+ try {
122
+ await file.writeFile(data);
123
+ await file.sync();
124
+ }
125
+ catch (error) {
126
+ await file.close();
127
+ await rm(path, { force: true });
128
+ throw error;
129
+ }
130
+ await file.close();
131
+ }
132
+ finally {
133
+ await unlock();
134
+ }
135
+ let released = false;
136
+ const release = async () => {
137
+ if (released)
138
+ return;
139
+ await releaseRecord(repository, path, id);
140
+ released = true;
141
+ };
142
+ return {
143
+ id,
144
+ repository,
145
+ reserveBytes: options.reserveBytes,
146
+ release,
147
+ [Symbol.asyncDispose]: release,
148
+ };
149
+ }
150
+ //# sourceMappingURL=storage-reservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-reservations.js","sourceRoot":"","sources":["../../src/infrastructure/storage-reservations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAO7F,KAAK,UAAU,oBAAoB,CAAC,IAAY;IAC9C,MAAM,KAAK,GAAG;QACZ,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;QACtB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;QAC/B,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,sBAAsB,CAAC;KACxD,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,SAAS,CACP,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAC/B,qDAAqD,CACtD,CAAC;IACJ,CAAC;IACD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,CAAC;QACT,MAAM,MAAM,EAAE,CAAC;IACjB,CAAC;IACD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;QACzB,IAAI,QAAQ;YAAE,OAAO;QACrB,MAAM,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1C,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC;IACF,OAAO;QACL,EAAE;QACF,UAAU;QACV,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO;QACP,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO;KAC/B,CAAC;AACJ,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { mkdir, open, readdir, realpath, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { invariant, OutpostError } from \"../domain/errors.ts\";\nimport { lockStorageMutation } from \"./storage-mutation-lock.ts\";\nimport {\n localProcessIdentity,\n observeOwnership,\n} from \"./git/process-identity.ts\";\nimport { readInspectionFile } from \"./inspection-file.ts\";\nimport { storageInventory } from \"./storage-inventory.ts\";\nimport { storageReservationDefaults as defaults } from \"./storage-reservations.constants.ts\";\nimport type {\n StorageReservation,\n StorageReservationOptions,\n StorageReservationRecord,\n} from \"./storage-reservations.types.ts\";\n\nasync function reservationDirectory(root: string): Promise<string> {\n const paths = [\n join(root, \".outpost\"),\n join(root, \".outpost\", \"locks\"),\n join(root, \".outpost\", \"locks\", \"storage-reservations\"),\n ];\n for (const path of paths) {\n await mkdir(path, { recursive: true, mode: 0o700 });\n invariant(\n (await realpath(path)) === path,\n \"Storage reservation directory must not use symlinks\",\n );\n }\n return paths[2]!;\n}\n\nfunction validRecord(value: unknown): value is StorageReservationRecord {\n if (!value || typeof value !== \"object\") return false;\n return (\n \"version\" in value &&\n value.version === 1 &&\n \"id\" in value &&\n typeof value.id === \"string\" &&\n \"pid\" in value &&\n typeof value.pid === \"number\" &&\n Number.isSafeInteger(value.pid) &&\n value.pid > 0 &&\n value.pid <= 2_147_483_647 &&\n \"reserveBytes\" in value &&\n typeof value.reserveBytes === \"number\" &&\n Number.isSafeInteger(value.reserveBytes) &&\n value.reserveBytes >= 0 &&\n \"createdAt\" in value &&\n typeof value.createdAt === \"string\" &&\n Number.isFinite(Date.parse(value.createdAt))\n );\n}\n\nasync function readRecord(path: string): Promise<StorageReservationRecord> {\n try {\n const value: unknown = JSON.parse(\n (await readInspectionFile(path, defaults.maxRecordBytes)).toString(\n \"utf8\",\n ),\n );\n if (validRecord(value)) return value;\n } catch (cause) {\n throw new OutpostError(\n \"workspace\",\n \"Storage reservation record is unreadable; admission refused\",\n { path },\n cause,\n );\n }\n throw new OutpostError(\n \"workspace\",\n \"Storage reservation record is invalid; admission refused\",\n { path },\n );\n}\n\nasync function reservedBytes(directory: string): Promise<number> {\n const names = await readdir(directory);\n invariant(\n names.length <= defaults.maxRecords,\n \"Too many storage reservation records\",\n );\n let reserved = 0;\n for (const name of names) {\n const path = join(directory, name);\n const record = await readRecord(path);\n invariant(\n name === `${record.id}.json`,\n \"Storage reservation identity mismatch\",\n );\n const owner = await observeOwnership(record.pid, record.identity);\n if (owner.status === \"inactive\") {\n await rm(path);\n continue;\n }\n reserved += record.reserveBytes;\n invariant(\n Number.isSafeInteger(reserved),\n \"Storage reservation total exceeds safe integer range\",\n );\n }\n return reserved;\n}\n\nasync function releaseRecord(\n root: string,\n path: string,\n id: string,\n): Promise<void> {\n await reservationDirectory(root);\n const unlock = await lockStorageMutation(root);\n try {\n const names = await readdir(\n join(root, \".outpost\", \"locks\", \"storage-reservations\"),\n );\n if (!names.includes(`${id}.json`)) return;\n const record = await readRecord(path);\n invariant(\n record.id === id,\n \"Storage reservation identity changed; refusing release\",\n );\n await rm(path);\n } finally {\n await unlock();\n }\n}\n\nexport async function reserveStorage(\n repository: string,\n options: StorageReservationOptions,\n): Promise<StorageReservation> {\n invariant(\n Number.isSafeInteger(options.maxBytes) && options.maxBytes >= 0,\n \"maxBytes must be a nonnegative integer\",\n );\n invariant(\n Number.isSafeInteger(options.reserveBytes) && options.reserveBytes >= 0,\n \"reserveBytes must be a nonnegative integer\",\n );\n options.signal?.throwIfAborted();\n const directory = await reservationDirectory(repository);\n const unlock = await lockStorageMutation(repository, options.signal);\n const id = randomUUID();\n const path = join(directory, `${id}.json`);\n try {\n const reserved = await reservedBytes(directory);\n const inventory = await storageInventory(\n join(repository, \".outpost\"),\n options.maxEntries,\n );\n const record: StorageReservationRecord = {\n version: 1,\n id,\n pid: process.pid,\n identity: await localProcessIdentity(),\n reserveBytes: options.reserveBytes,\n createdAt: new Date().toISOString(),\n };\n const data = JSON.stringify(record);\n if (\n !inventory.complete ||\n inventory.usage.bytes +\n reserved +\n options.reserveBytes +\n Buffer.byteLength(data) >\n options.maxBytes\n )\n throw new OutpostError(\n \"workspace\",\n \"Outpost storage reservation admission refused\",\n {\n usageBytes: inventory.usage.bytes,\n reservedBytes: reserved,\n reserveBytes: options.reserveBytes,\n maxBytes: options.maxBytes,\n complete: inventory.complete,\n },\n );\n options.signal?.throwIfAborted();\n const file = await open(path, \"wx\", 0o600);\n try {\n await file.writeFile(data);\n await file.sync();\n } catch (error) {\n await file.close();\n await rm(path, { force: true });\n throw error;\n }\n await file.close();\n } finally {\n await unlock();\n }\n let released = false;\n const release = async () => {\n if (released) return;\n await releaseRecord(repository, path, id);\n released = true;\n };\n return {\n id,\n repository,\n reserveBytes: options.reserveBytes,\n release,\n [Symbol.asyncDispose]: release,\n };\n}\n"]}
@@ -0,0 +1,21 @@
1
+ export interface StorageReservationOptions {
2
+ readonly maxBytes: number;
3
+ readonly reserveBytes: number;
4
+ readonly maxEntries?: number;
5
+ readonly signal?: AbortSignal;
6
+ }
7
+ export interface StorageReservation {
8
+ readonly id: string;
9
+ readonly repository: string;
10
+ readonly reserveBytes: number;
11
+ release(): Promise<void>;
12
+ [Symbol.asyncDispose](): Promise<void>;
13
+ }
14
+ export interface StorageReservationRecord {
15
+ readonly version: 1;
16
+ readonly id: string;
17
+ readonly pid: number;
18
+ readonly identity?: unknown;
19
+ readonly reserveBytes: number;
20
+ readonly createdAt: string;
21
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage-reservations.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-reservations.types.js","sourceRoot":"","sources":["../../src/infrastructure/storage-reservations.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface StorageReservationOptions {\n readonly maxBytes: number;\n readonly reserveBytes: number;\n readonly maxEntries?: number;\n readonly signal?: AbortSignal;\n}\n\nexport interface StorageReservation {\n readonly id: string;\n readonly repository: string;\n readonly reserveBytes: number;\n release(): Promise<void>;\n [Symbol.asyncDispose](): Promise<void>;\n}\n\nexport interface StorageReservationRecord {\n readonly version: 1;\n readonly id: string;\n readonly pid: number;\n readonly identity?: unknown;\n readonly reserveBytes: number;\n readonly createdAt: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const queueHttpTimeoutMs = 10000;
2
+ export declare const queueHttpMaxHeaderBytes = 8192;
@@ -0,0 +1,3 @@
1
+ export const queueHttpTimeoutMs = 10_000;
2
+ export const queueHttpMaxHeaderBytes = 8192;
3
+ //# sourceMappingURL=task-queue-http.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-queue-http.constants.js","sourceRoot":"","sources":["../../src/infrastructure/task-queue-http.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC","sourcesContent":["export const queueHttpTimeoutMs = 10_000;\nexport const queueHttpMaxHeaderBytes = 8192;\n"]}
@@ -0,0 +1,4 @@
1
+ import type { TaskQueue } from "../domain/task-queue.types.ts";
2
+ import type { QueueClientOptions, QueueServer, QueueServerOptions } from "./task-queue-http.types.ts";
3
+ export declare function serveTaskQueue(options: QueueServerOptions): Promise<QueueServer>;
4
+ export declare function httpTaskQueue(options: QueueClientOptions): TaskQueue;