@elie-laloum/outpost 1.1.4 → 3.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 (368) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +12 -6
  3. package/dist/adapters/agents/claude-diagnostics.d.ts +1 -0
  4. package/dist/adapters/agents/claude-diagnostics.js +7 -0
  5. package/dist/adapters/agents/claude-diagnostics.js.map +1 -0
  6. package/dist/adapters/agents/cli-diagnostics.constants.d.ts +12 -0
  7. package/dist/adapters/agents/cli-diagnostics.constants.js +24 -0
  8. package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -0
  9. package/dist/adapters/agents/cli-diagnostics.d.ts +4 -0
  10. package/dist/adapters/agents/cli-diagnostics.js +14 -0
  11. package/dist/adapters/agents/cli-diagnostics.js.map +1 -0
  12. package/dist/adapters/agents/cli-diagnostics.types.d.ts +13 -0
  13. package/dist/adapters/agents/cli-diagnostics.types.js +2 -0
  14. package/dist/adapters/agents/cli-diagnostics.types.js.map +1 -0
  15. package/dist/adapters/agents/codex-diagnostics.d.ts +1 -0
  16. package/dist/adapters/agents/codex-diagnostics.js +7 -0
  17. package/dist/adapters/agents/codex-diagnostics.js.map +1 -0
  18. package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -0
  19. package/dist/adapters/agents/protocol-fixtures.constants.js +68 -0
  20. package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -0
  21. package/dist/adapters/agents/protocol-fixtures.types.d.ts +6 -0
  22. package/dist/adapters/agents/protocol-fixtures.types.js +2 -0
  23. package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -0
  24. package/dist/application/diagnostic-probe.d.ts +3 -0
  25. package/dist/application/diagnostic-probe.js +55 -0
  26. package/dist/application/diagnostic-probe.js.map +1 -0
  27. package/dist/application/doctor-agent.constants.d.ts +9 -0
  28. package/dist/application/doctor-agent.constants.js +8 -0
  29. package/dist/application/doctor-agent.constants.js.map +1 -0
  30. package/dist/application/doctor-agent.d.ts +3 -0
  31. package/dist/application/doctor-agent.js +53 -0
  32. package/dist/application/doctor-agent.js.map +1 -0
  33. package/dist/application/doctor-image.d.ts +3 -0
  34. package/dist/application/doctor-image.js +133 -0
  35. package/dist/application/doctor-image.js.map +1 -0
  36. package/dist/application/doctor-protocol.d.ts +3 -0
  37. package/dist/application/doctor-protocol.js +29 -0
  38. package/dist/application/doctor-protocol.js.map +1 -0
  39. package/dist/application/doctor-protocol.types.d.ts +10 -0
  40. package/dist/application/doctor-protocol.types.js +2 -0
  41. package/dist/application/doctor-protocol.types.js.map +1 -0
  42. package/dist/application/doctor-sandbox.constants.d.ts +5 -0
  43. package/dist/application/doctor-sandbox.constants.js +6 -0
  44. package/dist/application/doctor-sandbox.constants.js.map +1 -0
  45. package/dist/application/doctor-sandbox.d.ts +4 -0
  46. package/dist/application/doctor-sandbox.js +133 -0
  47. package/dist/application/doctor-sandbox.js.map +1 -0
  48. package/dist/application/doctor-sandbox.types.d.ts +23 -0
  49. package/dist/application/doctor-sandbox.types.js +2 -0
  50. package/dist/application/doctor-sandbox.types.js.map +1 -0
  51. package/dist/application/doctor-transfers.constants.d.ts +6 -0
  52. package/dist/application/doctor-transfers.constants.js +7 -0
  53. package/dist/application/doctor-transfers.constants.js.map +1 -0
  54. package/dist/application/doctor-transfers.d.ts +4 -0
  55. package/dist/application/doctor-transfers.js +88 -0
  56. package/dist/application/doctor-transfers.js.map +1 -0
  57. package/dist/application/doctor.constants.d.ts +9 -0
  58. package/dist/application/doctor.constants.js +15 -0
  59. package/dist/application/doctor.constants.js.map +1 -0
  60. package/dist/application/doctor.d.ts +3 -0
  61. package/dist/application/doctor.js +106 -0
  62. package/dist/application/doctor.js.map +1 -0
  63. package/dist/application/doctor.types.d.ts +39 -0
  64. package/dist/application/doctor.types.js +2 -0
  65. package/dist/application/doctor.types.js.map +1 -0
  66. package/dist/application/execution.js +1 -0
  67. package/dist/application/execution.js.map +1 -1
  68. package/dist/application/outpost.types.d.ts +2 -0
  69. package/dist/application/outpost.types.js.map +1 -1
  70. package/dist/application/recovery-checksum-capture.d.ts +2 -0
  71. package/dist/application/recovery-checksum-capture.js +32 -0
  72. package/dist/application/recovery-checksum-capture.js.map +1 -0
  73. package/dist/application/recovery-checksum-paths.d.ts +2 -0
  74. package/dist/application/recovery-checksum-paths.js +11 -0
  75. package/dist/application/recovery-checksum-paths.js.map +1 -0
  76. package/dist/application/recovery-checksums.constants.d.ts +5 -0
  77. package/dist/application/recovery-checksums.constants.js +6 -0
  78. package/dist/application/recovery-checksums.constants.js.map +1 -0
  79. package/dist/application/recovery-checksums.d.ts +3 -0
  80. package/dist/application/recovery-checksums.js +94 -0
  81. package/dist/application/recovery-checksums.js.map +1 -0
  82. package/dist/application/recovery-checksums.types.d.ts +17 -0
  83. package/dist/application/recovery-checksums.types.js +2 -0
  84. package/dist/application/recovery-checksums.types.js.map +1 -0
  85. package/dist/application/recovery-inspection.d.ts +2 -0
  86. package/dist/application/recovery-inspection.js +27 -0
  87. package/dist/application/recovery-inspection.js.map +1 -0
  88. package/dist/application/recovery-inspection.types.d.ts +15 -0
  89. package/dist/application/recovery-inspection.types.js +2 -0
  90. package/dist/application/recovery-inspection.types.js.map +1 -0
  91. package/dist/application/recovery-restorability.d.ts +2 -0
  92. package/dist/application/recovery-restorability.js +137 -0
  93. package/dist/application/recovery-restorability.js.map +1 -0
  94. package/dist/application/recovery-retention-policy.d.ts +2 -0
  95. package/dist/application/recovery-retention-policy.js +21 -0
  96. package/dist/application/recovery-retention-policy.js.map +1 -0
  97. package/dist/application/recovery-retention.constants.d.ts +3 -0
  98. package/dist/application/recovery-retention.constants.js +2 -0
  99. package/dist/application/recovery-retention.constants.js.map +1 -0
  100. package/dist/application/recovery-retention.d.ts +4 -0
  101. package/dist/application/recovery-retention.js +202 -0
  102. package/dist/application/recovery-retention.js.map +1 -0
  103. package/dist/application/recovery-retention.types.d.ts +52 -0
  104. package/dist/application/recovery-retention.types.js +2 -0
  105. package/dist/application/recovery-retention.types.js.map +1 -0
  106. package/dist/application/recovery-verification.constants.d.ts +5 -0
  107. package/dist/application/recovery-verification.constants.js +10 -0
  108. package/dist/application/recovery-verification.constants.js.map +1 -0
  109. package/dist/application/recovery-verification.d.ts +2 -0
  110. package/dist/application/recovery-verification.js +107 -0
  111. package/dist/application/recovery-verification.js.map +1 -0
  112. package/dist/application/recovery-verification.types.d.ts +26 -0
  113. package/dist/application/recovery-verification.types.js +2 -0
  114. package/dist/application/recovery-verification.types.js.map +1 -0
  115. package/dist/application/remote-apply.js +24 -6
  116. package/dist/application/remote-apply.js.map +1 -1
  117. package/dist/application/remote-backup.js +6 -2
  118. package/dist/application/remote-backup.js.map +1 -1
  119. package/dist/application/remote-download.js +36 -4
  120. package/dist/application/remote-download.js.map +1 -1
  121. package/dist/application/remote-validation.js +19 -0
  122. package/dist/application/remote-validation.js.map +1 -1
  123. package/dist/application/remote-workspace.constants.d.ts +3 -0
  124. package/dist/application/remote-workspace.constants.js +2 -0
  125. package/dist/application/remote-workspace.constants.js.map +1 -0
  126. package/dist/application/remote-workspace.js +6 -0
  127. package/dist/application/remote-workspace.js.map +1 -1
  128. package/dist/application/remote-workspace.types.d.ts +3 -1
  129. package/dist/application/remote-workspace.types.js.map +1 -1
  130. package/dist/application/sandbox.js +11 -0
  131. package/dist/application/sandbox.js.map +1 -1
  132. package/dist/application/task-usage.d.ts +4 -0
  133. package/dist/application/task-usage.js +41 -0
  134. package/dist/application/task-usage.js.map +1 -0
  135. package/dist/application/task-usage.types.d.ts +5 -0
  136. package/dist/application/task-usage.types.js +2 -0
  137. package/dist/application/task-usage.types.js.map +1 -0
  138. package/dist/application/tasks.js +23 -2
  139. package/dist/application/tasks.js.map +1 -1
  140. package/dist/cli/commands.js +4 -0
  141. package/dist/cli/commands.js.map +1 -1
  142. package/dist/cli/doctor-command.d.ts +3 -0
  143. package/dist/cli/doctor-command.js +38 -0
  144. package/dist/cli/doctor-command.js.map +1 -0
  145. package/dist/cli/image.js +1 -1
  146. package/dist/cli/image.js.map +1 -1
  147. package/dist/cli/init-command.js +4 -3
  148. package/dist/cli/init-command.js.map +1 -1
  149. package/dist/cli/main.constants.d.ts +29 -8
  150. package/dist/cli/main.constants.js +19 -7
  151. package/dist/cli/main.constants.js.map +1 -1
  152. package/dist/cli/project-settings.js +8 -2
  153. package/dist/cli/project-settings.js.map +1 -1
  154. package/dist/cli/recovery-command.d.ts +2 -0
  155. package/dist/cli/recovery-command.js +69 -0
  156. package/dist/cli/recovery-command.js.map +1 -0
  157. package/dist/cli/recovery-prune-command.d.ts +2 -0
  158. package/dist/cli/recovery-prune-command.js +34 -0
  159. package/dist/cli/recovery-prune-command.js.map +1 -0
  160. package/dist/cli/recovery-verify-command.d.ts +2 -0
  161. package/dist/cli/recovery-verify-command.js +43 -0
  162. package/dist/cli/recovery-verify-command.js.map +1 -0
  163. package/dist/cli/scaffold-files.d.ts +1 -1
  164. package/dist/cli/scaffold-files.js +26 -20
  165. package/dist/cli/scaffold-files.js.map +1 -1
  166. package/dist/cli/scaffold-validation.js +2 -5
  167. package/dist/cli/scaffold-validation.js.map +1 -1
  168. package/dist/cli/scaffold.constants.d.ts +0 -2
  169. package/dist/cli/scaffold.constants.js +1 -13
  170. package/dist/cli/scaffold.constants.js.map +1 -1
  171. package/dist/cli/scaffold.d.ts +1 -1
  172. package/dist/cli/scaffold.js +37 -29
  173. package/dist/cli/scaffold.js.map +1 -1
  174. package/dist/cli/scaffold.types.d.ts +3 -5
  175. package/dist/cli/scaffold.types.js.map +1 -1
  176. package/dist/cli/starters.d.ts +1 -2
  177. package/dist/cli/starters.js +42 -30
  178. package/dist/cli/starters.js.map +1 -1
  179. package/dist/domain/ports.d.ts +1 -1
  180. package/dist/domain/ports.js.map +1 -1
  181. package/dist/domain/sandbox.types.d.ts +12 -0
  182. package/dist/domain/sandbox.types.js.map +1 -1
  183. package/dist/domain/workflow/budget.constants.d.ts +1 -0
  184. package/dist/domain/workflow/budget.constants.js +7 -0
  185. package/dist/domain/workflow/budget.constants.js.map +1 -0
  186. package/dist/domain/workflow/budget.d.ts +9 -0
  187. package/dist/domain/workflow/budget.js +67 -0
  188. package/dist/domain/workflow/budget.js.map +1 -0
  189. package/dist/domain/workflow/budget.types.d.ts +15 -0
  190. package/dist/domain/workflow/budget.types.js +2 -0
  191. package/dist/domain/workflow/budget.types.js.map +1 -0
  192. package/dist/domain/workflow/task-runner.js +8 -1
  193. package/dist/domain/workflow/task-runner.js.map +1 -1
  194. package/dist/domain/workflow/workflow-scheduler.js +4 -2
  195. package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
  196. package/dist/domain/workflow/workflow-state.js +29 -0
  197. package/dist/domain/workflow/workflow-state.js.map +1 -1
  198. package/dist/domain/workflow.d.ts +2 -0
  199. package/dist/domain/workflow.js +1 -0
  200. package/dist/domain/workflow.js.map +1 -1
  201. package/dist/domain/workflow.types.d.ts +10 -1
  202. package/dist/domain/workflow.types.js.map +1 -1
  203. package/dist/index.d.ts +12 -8
  204. package/dist/index.js +5 -3
  205. package/dist/index.js.map +1 -1
  206. package/dist/infrastructure/file-manifest.d.ts +6 -0
  207. package/dist/infrastructure/file-manifest.js +91 -0
  208. package/dist/infrastructure/file-manifest.js.map +1 -0
  209. package/dist/infrastructure/git/lock-inspection.constants.d.ts +4 -0
  210. package/dist/infrastructure/git/lock-inspection.constants.js +5 -0
  211. package/dist/infrastructure/git/lock-inspection.constants.js.map +1 -0
  212. package/dist/infrastructure/git/lock-inspection.d.ts +3 -0
  213. package/dist/infrastructure/git/lock-inspection.js +64 -0
  214. package/dist/infrastructure/git/lock-inspection.js.map +1 -0
  215. package/dist/infrastructure/git/lock-inspection.types.d.ts +27 -0
  216. package/dist/infrastructure/git/lock-inspection.types.js +2 -0
  217. package/dist/infrastructure/git/lock-inspection.types.js.map +1 -0
  218. package/dist/infrastructure/git/lock.d.ts +1 -0
  219. package/dist/infrastructure/git/lock.js +70 -29
  220. package/dist/infrastructure/git/lock.js.map +1 -1
  221. package/dist/infrastructure/git/process-identity.d.ts +3 -0
  222. package/dist/infrastructure/git/process-identity.js +73 -0
  223. package/dist/infrastructure/git/process-identity.js.map +1 -0
  224. package/dist/infrastructure/git/process-identity.types.d.ts +10 -0
  225. package/dist/infrastructure/git/process-identity.types.js +2 -0
  226. package/dist/infrastructure/git/process-identity.types.js.map +1 -0
  227. package/dist/infrastructure/git/verification-command.d.ts +1 -0
  228. package/dist/infrastructure/git/verification-command.js +36 -0
  229. package/dist/infrastructure/git/verification-command.js.map +1 -0
  230. package/dist/infrastructure/git/workspace-lease.js +1 -0
  231. package/dist/infrastructure/git/workspace-lease.js.map +1 -1
  232. package/dist/infrastructure/git/workspace.js +5 -1
  233. package/dist/infrastructure/git/workspace.js.map +1 -1
  234. package/dist/infrastructure/git/worktree-inspection.constants.d.ts +5 -0
  235. package/dist/infrastructure/git/worktree-inspection.constants.js +16 -0
  236. package/dist/infrastructure/git/worktree-inspection.constants.js.map +1 -0
  237. package/dist/infrastructure/git/worktree-inspection.d.ts +3 -0
  238. package/dist/infrastructure/git/worktree-inspection.js +120 -0
  239. package/dist/infrastructure/git/worktree-inspection.js.map +1 -0
  240. package/dist/infrastructure/git/worktree-inspection.types.d.ts +19 -0
  241. package/dist/infrastructure/git/worktree-inspection.types.js +2 -0
  242. package/dist/infrastructure/git/worktree-inspection.types.js.map +1 -0
  243. package/dist/infrastructure/inspection-file.constants.d.ts +1 -0
  244. package/dist/infrastructure/inspection-file.constants.js +5 -0
  245. package/dist/infrastructure/inspection-file.constants.js.map +1 -0
  246. package/dist/infrastructure/inspection-file.d.ts +1 -0
  247. package/dist/infrastructure/inspection-file.js +43 -0
  248. package/dist/infrastructure/inspection-file.js.map +1 -0
  249. package/dist/infrastructure/inspection-hash.constants.d.ts +1 -0
  250. package/dist/infrastructure/inspection-hash.constants.js +2 -0
  251. package/dist/infrastructure/inspection-hash.constants.js.map +1 -0
  252. package/dist/infrastructure/inspection-hash.d.ts +2 -0
  253. package/dist/infrastructure/inspection-hash.js +62 -0
  254. package/dist/infrastructure/inspection-hash.js.map +1 -0
  255. package/dist/infrastructure/inspection-hash.types.d.ts +5 -0
  256. package/dist/infrastructure/inspection-hash.types.js +2 -0
  257. package/dist/infrastructure/inspection-hash.types.js.map +1 -0
  258. package/dist/infrastructure/journal-retention.constants.d.ts +4 -0
  259. package/dist/infrastructure/journal-retention.constants.js +5 -0
  260. package/dist/infrastructure/journal-retention.constants.js.map +1 -0
  261. package/dist/infrastructure/journal-retention.d.ts +2 -0
  262. package/dist/infrastructure/journal-retention.js +51 -0
  263. package/dist/infrastructure/journal-retention.js.map +1 -0
  264. package/dist/infrastructure/journal.js +37 -13
  265. package/dist/infrastructure/journal.js.map +1 -1
  266. package/dist/infrastructure/opentelemetry.constants.d.ts +10 -0
  267. package/dist/infrastructure/opentelemetry.constants.js +11 -0
  268. package/dist/infrastructure/opentelemetry.constants.js.map +1 -0
  269. package/dist/infrastructure/opentelemetry.d.ts +3 -0
  270. package/dist/infrastructure/opentelemetry.js +131 -0
  271. package/dist/infrastructure/opentelemetry.js.map +1 -0
  272. package/dist/infrastructure/opentelemetry.types.d.ts +21 -0
  273. package/dist/infrastructure/opentelemetry.types.js +2 -0
  274. package/dist/infrastructure/opentelemetry.types.js.map +1 -0
  275. package/dist/infrastructure/storage-inventory.constants.d.ts +6 -0
  276. package/dist/infrastructure/storage-inventory.constants.js +11 -0
  277. package/dist/infrastructure/storage-inventory.constants.js.map +1 -0
  278. package/dist/infrastructure/storage-inventory.d.ts +2 -0
  279. package/dist/infrastructure/storage-inventory.js +123 -0
  280. package/dist/infrastructure/storage-inventory.js.map +1 -0
  281. package/dist/infrastructure/storage-inventory.types.d.ts +38 -0
  282. package/dist/infrastructure/storage-inventory.types.js +2 -0
  283. package/dist/infrastructure/storage-inventory.types.js.map +1 -0
  284. package/dist/infrastructure/transfer.js +12 -0
  285. package/dist/infrastructure/transfer.js.map +1 -1
  286. package/dist/providers/cloud.constants.d.ts +1 -0
  287. package/dist/providers/cloud.constants.js +1 -0
  288. package/dist/providers/cloud.constants.js.map +1 -1
  289. package/dist/providers/container-cache.constants.d.ts +11 -0
  290. package/dist/providers/container-cache.constants.js +9 -0
  291. package/dist/providers/container-cache.constants.js.map +1 -0
  292. package/dist/providers/container-cache.d.ts +4 -0
  293. package/dist/providers/container-cache.js +48 -0
  294. package/dist/providers/container-cache.js.map +1 -0
  295. package/dist/providers/container-cache.types.d.ts +8 -0
  296. package/dist/providers/container-cache.types.js +2 -0
  297. package/dist/providers/container-cache.types.js.map +1 -0
  298. package/dist/providers/container-plan.js +3 -1
  299. package/dist/providers/container-plan.js.map +1 -1
  300. package/dist/providers/container.js +31 -1
  301. package/dist/providers/container.js.map +1 -1
  302. package/dist/providers/container.types.d.ts +2 -0
  303. package/dist/providers/container.types.js.map +1 -1
  304. package/dist/providers/daytona-command.js +7 -4
  305. package/dist/providers/daytona-command.js.map +1 -1
  306. package/dist/providers/daytona.js +13 -4
  307. package/dist/providers/daytona.js.map +1 -1
  308. package/dist/providers/diagnostic-container.d.ts +4 -0
  309. package/dist/providers/diagnostic-container.js +15 -0
  310. package/dist/providers/diagnostic-container.js.map +1 -0
  311. package/dist/providers/docker.d.ts +1 -0
  312. package/dist/providers/docker.js.map +1 -1
  313. package/dist/providers/file-batches.constants.d.ts +10 -0
  314. package/dist/providers/file-batches.constants.js +57 -0
  315. package/dist/providers/file-batches.constants.js.map +1 -0
  316. package/dist/providers/file-batches.d.ts +2 -0
  317. package/dist/providers/file-batches.js +151 -0
  318. package/dist/providers/file-batches.js.map +1 -0
  319. package/dist/providers/podman.d.ts +1 -0
  320. package/dist/providers/podman.js.map +1 -1
  321. package/dist/providers/vercel.js +3 -1
  322. package/dist/providers/vercel.js.map +1 -1
  323. package/package.json +12 -1
  324. package/dist/adapters/backlogs/backlog.constants.d.ts +0 -4
  325. package/dist/adapters/backlogs/backlog.constants.js +0 -5
  326. package/dist/adapters/backlogs/backlog.constants.js.map +0 -1
  327. package/dist/adapters/backlogs/beads-adapter.d.ts +0 -4
  328. package/dist/adapters/backlogs/beads-adapter.js +0 -31
  329. package/dist/adapters/backlogs/beads-adapter.js.map +0 -1
  330. package/dist/adapters/backlogs/cli.d.ts +0 -3
  331. package/dist/adapters/backlogs/cli.js +0 -20
  332. package/dist/adapters/backlogs/cli.js.map +0 -1
  333. package/dist/adapters/backlogs/github-adapter.d.ts +0 -4
  334. package/dist/adapters/backlogs/github-adapter.js +0 -28
  335. package/dist/adapters/backlogs/github-adapter.js.map +0 -1
  336. package/dist/adapters/backlogs/issue.d.ts +0 -2
  337. package/dist/adapters/backlogs/issue.js +0 -13
  338. package/dist/adapters/backlogs/issue.js.map +0 -1
  339. package/dist/adapters/backlogs/settings.types.d.ts +0 -5
  340. package/dist/adapters/backlogs/settings.types.js +0 -2
  341. package/dist/adapters/backlogs/settings.types.js.map +0 -1
  342. package/dist/application/campaign-integration.d.ts +0 -2
  343. package/dist/application/campaign-integration.js +0 -44
  344. package/dist/application/campaign-integration.js.map +0 -1
  345. package/dist/application/campaign-planner.d.ts +0 -3
  346. package/dist/application/campaign-planner.js +0 -35
  347. package/dist/application/campaign-planner.js.map +0 -1
  348. package/dist/application/campaign-worker.d.ts +0 -3
  349. package/dist/application/campaign-worker.js +0 -54
  350. package/dist/application/campaign-worker.js.map +0 -1
  351. package/dist/application/campaign.constants.d.ts +0 -7
  352. package/dist/application/campaign.constants.js +0 -8
  353. package/dist/application/campaign.constants.js.map +0 -1
  354. package/dist/application/campaign.d.ts +0 -3
  355. package/dist/application/campaign.js +0 -96
  356. package/dist/application/campaign.js.map +0 -1
  357. package/dist/application/campaign.types.d.ts +0 -43
  358. package/dist/application/campaign.types.js +0 -2
  359. package/dist/application/campaign.types.js.map +0 -1
  360. package/dist/domain/backlog.d.ts +0 -3
  361. package/dist/domain/backlog.js +0 -23
  362. package/dist/domain/backlog.js.map +0 -1
  363. package/dist/domain/backlog.types.d.ts +0 -15
  364. package/dist/domain/backlog.types.js +0 -2
  365. package/dist/domain/backlog.types.js.map +0 -1
  366. package/dist/providers/backlogs.d.ts +0 -3
  367. package/dist/providers/backlogs.js +0 -3
  368. package/dist/providers/backlogs.js.map +0 -1
@@ -0,0 +1,106 @@
1
+ import { invariant } from "../domain/errors.js";
2
+ import { executeProcess } from "../infrastructure/process.js";
3
+ import { agentVersions } from "../providers/versions.constants.js";
4
+ import { diagnoseImage } from "./doctor-image.js";
5
+ import { diagnosticProbe } from "./diagnostic-probe.js";
6
+ import { doctorDefaults, providerDiagnostics } from "./doctor.constants.js";
7
+ export async function diagnose(options, execute = executeProcess) {
8
+ const { provider, agent, image } = options;
9
+ if (image !== undefined) {
10
+ invariant(provider === "docker" || provider === "podman", "--image requires docker or podman.");
11
+ invariant(image.length > 0 &&
12
+ !image.startsWith("-") &&
13
+ !/[\x00-\x20\x7f]/.test(image), "Invalid diagnostic image name.");
14
+ }
15
+ const capabilities = providerDiagnostics[provider];
16
+ const checks = [
17
+ {
18
+ id: "host.node",
19
+ status: Number(process.versions.node.split(".")[0]) >=
20
+ doctorDefaults.minimumNodeMajor
21
+ ? "pass"
22
+ : "fail",
23
+ version: process.versions.node,
24
+ message: `Outpost requires Node.js ${doctorDefaults.minimumNodeMajor}+.`,
25
+ },
26
+ ];
27
+ checks.push(await diagnosticProbe({
28
+ id: "host.git",
29
+ command: { executable: "git", arguments: ["--version"] },
30
+ failureStatus: "fail",
31
+ remedy: "Install Git and make it available on PATH.",
32
+ readVersion: true,
33
+ }, execute));
34
+ if (capabilities.placement === "mounted") {
35
+ const engine = await diagnosticProbe({
36
+ id: "provider.cli",
37
+ command: { executable: provider, arguments: ["--version"] },
38
+ failureStatus: "fail",
39
+ remedy: `Install ${provider} and make it available on PATH.`,
40
+ readVersion: true,
41
+ }, execute);
42
+ checks.push(engine);
43
+ if (engine.status === "pass")
44
+ checks.push(await diagnosticProbe({
45
+ id: "provider.connection",
46
+ command: {
47
+ executable: provider,
48
+ arguments: ["info"],
49
+ },
50
+ failureStatus: "fail",
51
+ remedy: `Check ${provider} is running and accessible to this user; on macOS, start its virtual machine.`,
52
+ }, execute));
53
+ checks.push(await diagnosticProbe({
54
+ id: "host.tar",
55
+ command: { executable: "tar", arguments: ["--version"] },
56
+ failureStatus: "fail",
57
+ remedy: "Install GNU tar or bsdtar for container transfers.",
58
+ }, execute));
59
+ }
60
+ if (capabilities.placement === "remote")
61
+ checks.push({
62
+ id: "provider.cloud",
63
+ status: "skipped",
64
+ message: "Cloud SDK, credentials, account access and allocation are not checked.",
65
+ });
66
+ checks.push(await diagnosticProbe({
67
+ id: "agent.host",
68
+ command: { executable: agent, arguments: ["--version"] },
69
+ failureStatus: "warn",
70
+ remedy: "Host CLI is unavailable or unverified. A sandbox may have its own CLI; dispatch can bootstrap a missing agent.",
71
+ readVersion: true,
72
+ referenceVersion: agentVersions[agent],
73
+ }, execute));
74
+ if (image !== undefined && (provider === "docker" || provider === "podman")) {
75
+ const connected = checks.some((check) => check.id === "provider.connection" && check.status === "pass");
76
+ if (connected)
77
+ checks.push(...(await diagnoseImage({ provider, agent, image }, execute)));
78
+ else
79
+ checks.push({
80
+ id: "image.runtime",
81
+ status: "skipped",
82
+ message: "Image checks require a reachable container engine.",
83
+ });
84
+ }
85
+ if (capabilities.placement !== "host" && image === undefined)
86
+ checks.push({
87
+ id: "agent.sandbox",
88
+ status: "skipped",
89
+ message: "Agent version inside the sandbox is not checked; the host version does not describe the sandbox.",
90
+ });
91
+ checks.push({
92
+ id: "execution",
93
+ status: "skipped",
94
+ message: image === undefined
95
+ ? "Images, mounts, repository state, authentication and model access are not tested. No sandbox is allocated."
96
+ : "Workflow mounts, repository state, authentication and model access are not tested. Image checks use a separate temporary sandbox.",
97
+ });
98
+ return {
99
+ ...options,
100
+ scope: image === undefined ? "host" : "host-and-image",
101
+ ...capabilities,
102
+ checks,
103
+ hasFailures: checks.some((check) => check.status === "fail"),
104
+ };
105
+ }
106
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","source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QACf,MAAM,EAAE,SAAS;QACjB,OAAO,EACL,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,4GAA4G;YAC9G,CAAC,CAAC,mIAAmI;KAC1I,CAAC,CAAC;IACH,OAAO;QACL,GAAG,OAAO;QACV,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB;QACtD,GAAG,YAAY;QACf,MAAM;QACN,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;KAC7D,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../domain/errors.ts\";\nimport { executeProcess } from \"../infrastructure/process.ts\";\nimport type { Executor } from \"../infrastructure/process.types.ts\";\nimport { agentVersions } from \"../providers/versions.constants.ts\";\nimport { diagnoseImage } from \"./doctor-image.ts\";\nimport { diagnosticProbe } from \"./diagnostic-probe.ts\";\nimport { doctorDefaults, providerDiagnostics } from \"./doctor.constants.ts\";\nimport type {\n DiagnosticCheck,\n DoctorOptions,\n DoctorReport,\n} from \"./doctor.types.ts\";\n\nexport async function diagnose(\n options: DoctorOptions,\n execute: Executor = executeProcess,\n): Promise<DoctorReport> {\n const { provider, agent, image } = options;\n if (image !== undefined) {\n invariant(\n provider === \"docker\" || provider === \"podman\",\n \"--image requires docker or podman.\",\n );\n invariant(\n image.length > 0 &&\n !image.startsWith(\"-\") &&\n !/[\\x00-\\x20\\x7f]/.test(image),\n \"Invalid diagnostic image name.\",\n );\n }\n const capabilities = providerDiagnostics[provider];\n const checks: DiagnosticCheck[] = [\n {\n id: \"host.node\",\n status:\n Number(process.versions.node.split(\".\")[0]) >=\n doctorDefaults.minimumNodeMajor\n ? \"pass\"\n : \"fail\",\n version: process.versions.node,\n message: `Outpost requires Node.js ${doctorDefaults.minimumNodeMajor}+.`,\n },\n ];\n checks.push(\n await diagnosticProbe(\n {\n id: \"host.git\",\n command: { executable: \"git\", arguments: [\"--version\"] },\n failureStatus: \"fail\",\n remedy: \"Install Git and make it available on PATH.\",\n readVersion: true,\n },\n execute,\n ),\n );\n if (capabilities.placement === \"mounted\") {\n const engine = await diagnosticProbe(\n {\n id: \"provider.cli\",\n command: { executable: provider, arguments: [\"--version\"] },\n failureStatus: \"fail\",\n remedy: `Install ${provider} and make it available on PATH.`,\n readVersion: true,\n },\n execute,\n );\n checks.push(engine);\n if (engine.status === \"pass\")\n checks.push(\n await diagnosticProbe(\n {\n id: \"provider.connection\",\n command: {\n executable: provider,\n arguments: [\"info\"],\n },\n failureStatus: \"fail\",\n remedy: `Check ${provider} is running and accessible to this user; on macOS, start its virtual machine.`,\n },\n execute,\n ),\n );\n checks.push(\n await diagnosticProbe(\n {\n id: \"host.tar\",\n command: { executable: \"tar\", arguments: [\"--version\"] },\n failureStatus: \"fail\",\n remedy: \"Install GNU tar or bsdtar for container transfers.\",\n },\n execute,\n ),\n );\n }\n if (capabilities.placement === \"remote\")\n checks.push({\n id: \"provider.cloud\",\n status: \"skipped\",\n message:\n \"Cloud SDK, credentials, account access and allocation are not checked.\",\n });\n checks.push(\n await diagnosticProbe(\n {\n id: \"agent.host\",\n command: { executable: agent, arguments: [\"--version\"] },\n failureStatus: \"warn\",\n remedy:\n \"Host CLI is unavailable or unverified. A sandbox may have its own CLI; dispatch can bootstrap a missing agent.\",\n readVersion: true,\n referenceVersion: agentVersions[agent],\n },\n execute,\n ),\n );\n if (image !== undefined && (provider === \"docker\" || provider === \"podman\")) {\n const connected = checks.some(\n (check) => check.id === \"provider.connection\" && check.status === \"pass\",\n );\n if (connected)\n checks.push(\n ...(await diagnoseImage({ provider, agent, image }, execute)),\n );\n else\n checks.push({\n id: \"image.runtime\",\n status: \"skipped\",\n message: \"Image checks require a reachable container engine.\",\n });\n }\n if (capabilities.placement !== \"host\" && image === undefined)\n checks.push({\n id: \"agent.sandbox\",\n status: \"skipped\",\n message:\n \"Agent version inside the sandbox is not checked; the host version does not describe the sandbox.\",\n });\n checks.push({\n id: \"execution\",\n status: \"skipped\",\n message:\n image === undefined\n ? \"Images, mounts, repository state, authentication and model access are not tested. No sandbox is allocated.\"\n : \"Workflow mounts, repository state, authentication and model access are not tested. Image checks use a separate temporary sandbox.\",\n });\n return {\n ...options,\n scope: image === undefined ? \"host\" : \"host-and-image\",\n ...capabilities,\n checks,\n hasFailures: checks.some((check) => check.status === \"fail\"),\n };\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import type { Command } from "../domain/command.types.ts";
2
+ export type DoctorProvider = "docker" | "podman" | "local" | "vercel" | "daytona";
3
+ export type DoctorAgent = "codex" | "claude";
4
+ export type DiagnosticStatus = "pass" | "warn" | "fail" | "skipped";
5
+ export interface DiagnosticCheck {
6
+ readonly id: string;
7
+ readonly status: DiagnosticStatus;
8
+ readonly message: string;
9
+ readonly version?: string;
10
+ readonly referenceVersion?: string;
11
+ }
12
+ export interface DoctorOptions {
13
+ readonly image?: string;
14
+ readonly provider: DoctorProvider;
15
+ readonly agent: DoctorAgent;
16
+ }
17
+ export interface DoctorImageOptions {
18
+ readonly provider: "docker" | "podman";
19
+ readonly agent: DoctorAgent;
20
+ readonly image: string;
21
+ }
22
+ export interface DoctorReport {
23
+ readonly provider: DoctorProvider;
24
+ readonly agent: DoctorAgent;
25
+ readonly scope: "host" | "host-and-image";
26
+ readonly image?: string;
27
+ readonly placement: "mounted" | "host" | "remote";
28
+ readonly interactiveTerminal: boolean;
29
+ readonly checks: readonly DiagnosticCheck[];
30
+ readonly hasFailures: boolean;
31
+ }
32
+ export interface DiagnosticProbe {
33
+ readonly id: string;
34
+ readonly command: Command;
35
+ readonly failureStatus: "fail" | "warn";
36
+ readonly remedy: string;
37
+ readonly readVersion?: boolean;
38
+ readonly referenceVersion?: string;
39
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=doctor.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.types.js","sourceRoot":"","sources":["../../src/application/doctor.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Command } from \"../domain/command.types.ts\";\nexport type DoctorProvider =\n \"docker\" | \"podman\" | \"local\" | \"vercel\" | \"daytona\";\nexport type DoctorAgent = \"codex\" | \"claude\";\nexport type DiagnosticStatus = \"pass\" | \"warn\" | \"fail\" | \"skipped\";\nexport interface DiagnosticCheck {\n readonly id: string;\n readonly status: DiagnosticStatus;\n readonly message: string;\n readonly version?: string;\n readonly referenceVersion?: string;\n}\nexport interface DoctorOptions {\n readonly image?: string;\n readonly provider: DoctorProvider;\n readonly agent: DoctorAgent;\n}\nexport interface DoctorImageOptions {\n readonly provider: \"docker\" | \"podman\";\n readonly agent: DoctorAgent;\n readonly image: string;\n}\nexport interface DoctorReport {\n readonly provider: DoctorProvider;\n readonly agent: DoctorAgent;\n readonly scope: \"host\" | \"host-and-image\";\n readonly image?: string;\n readonly placement: \"mounted\" | \"host\" | \"remote\";\n readonly interactiveTerminal: boolean;\n readonly checks: readonly DiagnosticCheck[];\n readonly hasFailures: boolean;\n}\nexport interface DiagnosticProbe {\n readonly id: string;\n readonly command: Command;\n readonly failureStatus: \"fail\" | \"warn\";\n readonly remedy: string;\n readonly readVersion?: boolean;\n readonly referenceVersion?: string;\n}\n"]}
@@ -23,6 +23,7 @@ export async function execute(workspace, lease, agent, host, options, afterTurn)
23
23
  ? 1 + options.response.repairs
24
24
  : (options.passes ?? executionDefaults.passes);
25
25
  for (let index = 0; index < attempts; index++) {
26
+ options.signal?.throwIfAborted();
26
27
  notify(options.observe, {
27
28
  kind: "phase",
28
29
  name: "preparing prompt",
@@ -1 +1 @@
1
- {"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/application/execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAA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E,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5D,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACD,CAAC;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentAdapter, Usage } from \"../domain/agent.types.ts\";\nimport { invariant } from \"../domain/errors.ts\";\nimport { ResponseError } from \"../domain/response.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport { addUsage } from \"../domain/usage.ts\";\nimport type { WorkspaceRecord } from \"../domain/workspace.types.ts\";\nimport { turn } from \"./agent-turn.ts\";\nimport { renderBrief } from \"./brief-renderer.ts\";\nimport { validateDispatch } from \"./dispatch-validation.ts\";\nimport { executionDefaults } from \"./execution.constants.ts\";\nimport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nimport { notify } from \"./observation.ts\";\n\nexport { renderBrief } from \"./brief-renderer.ts\";\nexport { preflightDispatch, validateDispatch } from \"./dispatch-validation.ts\";\nexport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nexport { notify } from \"./observation.ts\";\n\nexport async function execute<T>(\n workspace: WorkspaceRecord,\n lease: SandboxLease,\n agent: AgentAdapter,\n host: boolean,\n options: DispatchOptions<T>,\n afterTurn?: (turn: Turn) => Promise<Turn>,\n): Promise<Execution<T>> {\n validateDispatch(options);\n const markers =\n options.until === undefined\n ? [executionDefaults.completion]\n : typeof options.until === \"string\"\n ? [options.until]\n : options.until;\n const turns: Turn[] = [];\n let value: T = undefined as T,\n completed = false,\n continuation = options.continuation;\n let repair: string | undefined;\n const attempts = options.response\n ? 1 + options.response.repairs\n : (options.passes ?? executionDefaults.passes);\n for (let index = 0; index < attempts; index++) {\n notify(options.observe, {\n kind: \"phase\",\n name: \"preparing prompt\",\n agent: agent.name,\n branch: workspace.branch,\n directory: workspace.directory,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const prompt =\n repair ??\n (await renderBrief(options.brief, workspace, lease, host, options));\n if (options.response && !repair)\n invariant(\n prompt.includes(`<${options.response.tag}>`),\n `Brief must request an opening <${options.response.tag}> tag`,\n );\n notify(options.observe, {\n kind: \"prompt\",\n text: prompt,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n notify(options.observe, {\n kind: \"phase\",\n name: \"running\",\n agent: agent.name,\n branch: workspace.branch,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const finished = await turn(\n lease,\n agent,\n prompt,\n options,\n continuation,\n markers,\n index + 1,\n );\n const current = afterTurn ? await afterTurn(finished) : finished;\n turns.push(current);\n notify(options.observe, {\n kind: \"summary\",\n durationMs: current.durationMs,\n status: current.status,\n tokens: current.usage,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n completed = markers.some((marker) => current.text.includes(marker));\n if (options.response) {\n try {\n value = await options.response.read(current.text);\n completed = true;\n break;\n } catch (error) {\n if (!(error instanceof ResponseError)) throw error;\n error.recovery = {\n conversation: current.conversation,\n branch: workspace.branch,\n directory: workspace.directory,\n turns,\n };\n if (index + 1 >= attempts || !current.conversation) throw error;\n continuation = { id: current.conversation };\n repair = [\n `Correct the response inside <${options.response.tag}> and </${options.response.tag}>.`,\n `Validation failure: ${error.message}`,\n `Previous content: ${error.raw ?? \"No complete tagged response was returned.\"}`,\n `Cause: ${error.cause instanceof Error ? error.cause.message : (JSON.stringify(error.cause) ?? \"unspecified\")}`,\n `Further repair attempts after this one: ${attempts - index - 2}.`,\n \"Do not edit files, run commands or continue implementation. Only return the corrected response.\",\n ].join(\"\\n\");\n }\n }\n if (!options.response && completed) break;\n }\n const conversation = turns.at(-1)?.conversation;\n const completion = markers.find((marker) =>\n turns.at(-1)?.text.includes(marker),\n );\n return {\n text: turns.map((item) => item.text).join(\"\\n\"),\n turns,\n value,\n completed,\n ...(completion ? { completion } : {}),\n ...(conversation ? { conversation } : {}),\n usage: turns.reduce((sum, item) => addUsage(sum, item.usage), {\n input: 0,\n cached: 0,\n output: 0,\n } as Usage),\n };\n}\n"]}
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/application/execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,SAA0B,EAC1B,KAAmB,EACnB,KAAmB,EACnB,IAAa,EACb,OAA2B,EAC3B,SAAyC;IAEzC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1B,MAAM,OAAO,GACX,OAAO,CAAC,KAAK,KAAK,SAAS;QACzB,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC;QAChC,CAAC,CAAC,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;YACjC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YACjB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtB,MAAM,KAAK,GAAW,EAAE,CAAC;IACzB,IAAI,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EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CACpC,CAAC;IACF,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/C,KAAK;QACL,KAAK;QACL,SAAS;QACT,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5D,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACD,CAAC;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentAdapter, Usage } from \"../domain/agent.types.ts\";\nimport { invariant } from \"../domain/errors.ts\";\nimport { ResponseError } from \"../domain/response.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport { addUsage } from \"../domain/usage.ts\";\nimport type { WorkspaceRecord } from \"../domain/workspace.types.ts\";\nimport { turn } from \"./agent-turn.ts\";\nimport { renderBrief } from \"./brief-renderer.ts\";\nimport { validateDispatch } from \"./dispatch-validation.ts\";\nimport { executionDefaults } from \"./execution.constants.ts\";\nimport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nimport { notify } from \"./observation.ts\";\n\nexport { renderBrief } from \"./brief-renderer.ts\";\nexport { preflightDispatch, validateDispatch } from \"./dispatch-validation.ts\";\nexport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nexport { notify } from \"./observation.ts\";\n\nexport async function execute<T>(\n workspace: WorkspaceRecord,\n lease: SandboxLease,\n agent: AgentAdapter,\n host: boolean,\n options: DispatchOptions<T>,\n afterTurn?: (turn: Turn) => Promise<Turn>,\n): Promise<Execution<T>> {\n validateDispatch(options);\n const markers =\n options.until === undefined\n ? [executionDefaults.completion]\n : typeof options.until === \"string\"\n ? [options.until]\n : options.until;\n const turns: Turn[] = [];\n let value: T = undefined as T,\n completed = false,\n continuation = options.continuation;\n let repair: string | undefined;\n const attempts = options.response\n ? 1 + options.response.repairs\n : (options.passes ?? executionDefaults.passes);\n for (let index = 0; index < attempts; index++) {\n options.signal?.throwIfAborted();\n notify(options.observe, {\n kind: \"phase\",\n name: \"preparing prompt\",\n agent: agent.name,\n branch: workspace.branch,\n directory: workspace.directory,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const prompt =\n repair ??\n (await renderBrief(options.brief, workspace, lease, host, options));\n if (options.response && !repair)\n invariant(\n prompt.includes(`<${options.response.tag}>`),\n `Brief must request an opening <${options.response.tag}> tag`,\n );\n notify(options.observe, {\n kind: \"prompt\",\n text: prompt,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n notify(options.observe, {\n kind: \"phase\",\n name: \"running\",\n agent: agent.name,\n branch: workspace.branch,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const finished = await turn(\n lease,\n agent,\n prompt,\n options,\n continuation,\n markers,\n index + 1,\n );\n const current = afterTurn ? await afterTurn(finished) : finished;\n turns.push(current);\n notify(options.observe, {\n kind: \"summary\",\n durationMs: current.durationMs,\n status: current.status,\n tokens: current.usage,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n completed = markers.some((marker) => current.text.includes(marker));\n if (options.response) {\n try {\n value = await options.response.read(current.text);\n completed = true;\n break;\n } catch (error) {\n if (!(error instanceof ResponseError)) throw error;\n error.recovery = {\n conversation: current.conversation,\n branch: workspace.branch,\n directory: workspace.directory,\n turns,\n };\n if (index + 1 >= attempts || !current.conversation) throw error;\n continuation = { id: current.conversation };\n repair = [\n `Correct the response inside <${options.response.tag}> and </${options.response.tag}>.`,\n `Validation failure: ${error.message}`,\n `Previous content: ${error.raw ?? \"No complete tagged response was returned.\"}`,\n `Cause: ${error.cause instanceof Error ? error.cause.message : (JSON.stringify(error.cause) ?? \"unspecified\")}`,\n `Further repair attempts after this one: ${attempts - index - 2}.`,\n \"Do not edit files, run commands or continue implementation. Only return the corrected response.\",\n ].join(\"\\n\");\n }\n }\n if (!options.response && completed) break;\n }\n const conversation = turns.at(-1)?.conversation;\n const completion = markers.find((marker) =>\n turns.at(-1)?.text.includes(marker),\n );\n return {\n text: turns.map((item) => item.text).join(\"\\n\"),\n turns,\n value,\n completed,\n ...(completion ? { completion } : {}),\n ...(conversation ? { conversation } : {}),\n usage: turns.reduce((sum, item) => addUsage(sum, item.usage), {\n input: 0,\n cached: 0,\n output: 0,\n } as Usage),\n };\n}\n"]}
@@ -4,6 +4,7 @@ import type { Brief } from "../domain/prompts.types.ts";
4
4
  import type { SandboxProvider } from "../domain/sandbox.types.ts";
5
5
  import type { BranchPolicy, Commit, Disposal, LifecycleHooks, StageLimits, WorkspaceRecord } from "../domain/workspace.types.ts";
6
6
  import type { Logging } from "../infrastructure/journal.types.ts";
7
+ import type { SandboxDiagnosticOptions, SandboxDiagnosticReport } from "./doctor-sandbox.types.ts";
7
8
  import type { DispatchOptions, Execution } from "./execution.types.ts";
8
9
  import type { VariableQuestion } from "./interactive-brief.types.ts";
9
10
  export interface WorkspaceOptions {
@@ -72,6 +73,7 @@ export interface WarmDispatchResult<T> extends Omit<DispatchResult<T>, "resume"
72
73
  fork<U = undefined>(options: DispatchOptions<U>): Promise<WarmDispatchResult<U>>;
73
74
  }
74
75
  export interface Sandbox {
76
+ diagnose(options?: SandboxDiagnosticOptions): Promise<SandboxDiagnosticReport>;
75
77
  readonly workspace: Workspace;
76
78
  readonly root: string;
77
79
  dispatch<T = undefined>(options: DispatchOptions<T>): Promise<WarmDispatchResult<T>>;
@@ -1 +1 @@
1
- {"version":3,"file":"outpost.types.js","sourceRoot":"","sources":["../../src/application/outpost.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AgentAdapter } from \"../domain/agent.types.ts\";\nimport type { Command, CommandResult } from \"../domain/command.types.ts\";\nimport type { Brief } from \"../domain/prompts.types.ts\";\nimport type { SandboxProvider } from \"../domain/sandbox.types.ts\";\nimport type {\n BranchPolicy,\n Commit,\n Disposal,\n LifecycleHooks,\n StageLimits,\n WorkspaceRecord,\n} from \"../domain/workspace.types.ts\";\nimport type { Logging } from \"../infrastructure/journal.types.ts\";\nimport type { DispatchOptions, Execution } from \"./execution.types.ts\";\nimport type { VariableQuestion } from \"./interactive-brief.types.ts\";\n\nexport interface WorkspaceOptions {\n readonly signal?: AbortSignal;\n readonly repository?: string;\n readonly branch?: BranchPolicy;\n readonly copies?: readonly string[];\n readonly limits?: StageLimits;\n readonly label?: string;\n readonly hooks?: LifecycleHooks;\n}\n\nexport interface Workspace extends WorkspaceRecord {\n dispatch<T = undefined>(\n options: Omit<\n SandboxOptions,\n Exclude<keyof WorkspaceOptions, \"hooks\" | \"label\"> | \"workspace\"\n > &\n DispatchOptions<T> & { readonly agent: AgentAdapter },\n ): Promise<DispatchResult<T>>;\n sandbox(\n options?: Omit<\n SandboxOptions,\n Exclude<keyof WorkspaceOptions, \"hooks\" | \"label\"> | \"workspace\"\n >,\n ): Promise<Sandbox>;\n attach(\n options: Omit<\n SandboxOptions,\n Exclude<keyof WorkspaceOptions, \"hooks\" | \"label\"> | \"workspace\"\n > &\n AttachOptions & { readonly agent: AgentAdapter },\n ): Promise<AttachResult>;\n close(options?: { readonly preserve?: boolean }): Promise<Disposal>;\n integrate(): Promise<void>;\n [Symbol.asyncDispose](): Promise<void>;\n}\n\nexport interface SandboxOptions extends WorkspaceOptions {\n readonly includeUncommitted?: boolean;\n readonly agent?: AgentAdapter;\n readonly provider?: SandboxProvider;\n readonly workspace?: Workspace;\n readonly hooks?: LifecycleHooks;\n readonly signal?: AbortSignal;\n readonly logging?: Logging;\n readonly bootstrap?: boolean;\n readonly conversationHome?: string;\n}\n\nexport interface AttachOptions {\n readonly ask?: VariableQuestion;\n readonly agent?: AgentAdapter;\n readonly brief?: Brief;\n readonly continuation?: { readonly id: string; readonly fork?: boolean };\n readonly signal?: AbortSignal;\n readonly terminal?: Command[\"terminal\"];\n}\n\nexport interface AttachResult extends CommandResult, Disposal {\n readonly commits: readonly Commit[];\n readonly branch: string;\n readonly directory: string;\n}\n\nexport interface DispatchResult<T> extends Execution<T> {\n readonly branch: string;\n readonly directory: string;\n readonly commits: readonly Commit[];\n readonly transcript?: string;\n readonly log?: string;\n readonly retainedDirectory?: string;\n resume<U = undefined>(\n options: ContinuationOptions<U>,\n ): Promise<DispatchResult<U>>;\n fork<U = undefined>(\n options: ContinuationOptions<U>,\n ): Promise<DispatchResult<U>>;\n}\n\nexport type ContinuationOptions<T = undefined> = DispatchOptions<T> &\n Omit<SandboxOptions, \"agent\">;\n\nexport interface WarmDispatchResult<T> extends Omit<\n DispatchResult<T>,\n \"resume\" | \"fork\"\n> {\n resume<U = undefined>(\n options: DispatchOptions<U>,\n ): Promise<WarmDispatchResult<U>>;\n fork<U = undefined>(\n options: DispatchOptions<U>,\n ): Promise<WarmDispatchResult<U>>;\n}\n\nexport interface Sandbox {\n readonly workspace: Workspace;\n readonly root: string;\n dispatch<T = undefined>(\n options: DispatchOptions<T>,\n ): Promise<WarmDispatchResult<T>>;\n resume<T = undefined>(\n id: string,\n options: DispatchOptions<T>,\n ): Promise<WarmDispatchResult<T>>;\n fork<T = undefined>(\n id: string,\n options: DispatchOptions<T>,\n ): Promise<WarmDispatchResult<T>>;\n attach(options?: AttachOptions): Promise<AttachResult>;\n command(command: Command): Promise<CommandResult>;\n close(options?: { readonly preserve?: boolean }): Promise<Disposal>;\n [Symbol.asyncDispose](): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"outpost.types.js","sourceRoot":"","sources":["../../src/application/outpost.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AgentAdapter } from \"../domain/agent.types.ts\";\nimport type { Command, CommandResult } from \"../domain/command.types.ts\";\nimport type { Brief } from \"../domain/prompts.types.ts\";\nimport type { SandboxProvider } from \"../domain/sandbox.types.ts\";\nimport type {\n BranchPolicy,\n Commit,\n Disposal,\n LifecycleHooks,\n StageLimits,\n WorkspaceRecord,\n} from \"../domain/workspace.types.ts\";\nimport type { Logging } from \"../infrastructure/journal.types.ts\";\nimport type {\n SandboxDiagnosticOptions,\n SandboxDiagnosticReport,\n} from \"./doctor-sandbox.types.ts\";\nimport type { DispatchOptions, Execution } from \"./execution.types.ts\";\nimport type { VariableQuestion } from \"./interactive-brief.types.ts\";\n\nexport interface WorkspaceOptions {\n readonly signal?: AbortSignal;\n readonly repository?: string;\n readonly branch?: BranchPolicy;\n readonly copies?: readonly string[];\n readonly limits?: StageLimits;\n readonly label?: string;\n readonly hooks?: LifecycleHooks;\n}\n\nexport interface Workspace extends WorkspaceRecord {\n dispatch<T = undefined>(\n options: Omit<\n SandboxOptions,\n Exclude<keyof WorkspaceOptions, \"hooks\" | \"label\"> | \"workspace\"\n > &\n DispatchOptions<T> & { readonly agent: AgentAdapter },\n ): Promise<DispatchResult<T>>;\n sandbox(\n options?: Omit<\n SandboxOptions,\n Exclude<keyof WorkspaceOptions, \"hooks\" | \"label\"> | \"workspace\"\n >,\n ): Promise<Sandbox>;\n attach(\n options: Omit<\n SandboxOptions,\n Exclude<keyof WorkspaceOptions, \"hooks\" | \"label\"> | \"workspace\"\n > &\n AttachOptions & { readonly agent: AgentAdapter },\n ): Promise<AttachResult>;\n close(options?: { readonly preserve?: boolean }): Promise<Disposal>;\n integrate(): Promise<void>;\n [Symbol.asyncDispose](): Promise<void>;\n}\n\nexport interface SandboxOptions extends WorkspaceOptions {\n readonly includeUncommitted?: boolean;\n readonly agent?: AgentAdapter;\n readonly provider?: SandboxProvider;\n readonly workspace?: Workspace;\n readonly hooks?: LifecycleHooks;\n readonly signal?: AbortSignal;\n readonly logging?: Logging;\n readonly bootstrap?: boolean;\n readonly conversationHome?: string;\n}\n\nexport interface AttachOptions {\n readonly ask?: VariableQuestion;\n readonly agent?: AgentAdapter;\n readonly brief?: Brief;\n readonly continuation?: { readonly id: string; readonly fork?: boolean };\n readonly signal?: AbortSignal;\n readonly terminal?: Command[\"terminal\"];\n}\n\nexport interface AttachResult extends CommandResult, Disposal {\n readonly commits: readonly Commit[];\n readonly branch: string;\n readonly directory: string;\n}\n\nexport interface DispatchResult<T> extends Execution<T> {\n readonly branch: string;\n readonly directory: string;\n readonly commits: readonly Commit[];\n readonly transcript?: string;\n readonly log?: string;\n readonly retainedDirectory?: string;\n resume<U = undefined>(\n options: ContinuationOptions<U>,\n ): Promise<DispatchResult<U>>;\n fork<U = undefined>(\n options: ContinuationOptions<U>,\n ): Promise<DispatchResult<U>>;\n}\n\nexport type ContinuationOptions<T = undefined> = DispatchOptions<T> &\n Omit<SandboxOptions, \"agent\">;\n\nexport interface WarmDispatchResult<T> extends Omit<\n DispatchResult<T>,\n \"resume\" | \"fork\"\n> {\n resume<U = undefined>(\n options: DispatchOptions<U>,\n ): Promise<WarmDispatchResult<U>>;\n fork<U = undefined>(\n options: DispatchOptions<U>,\n ): Promise<WarmDispatchResult<U>>;\n}\n\nexport interface Sandbox {\n diagnose(\n options?: SandboxDiagnosticOptions,\n ): Promise<SandboxDiagnosticReport>;\n readonly workspace: Workspace;\n readonly root: string;\n dispatch<T = undefined>(\n options: DispatchOptions<T>,\n ): Promise<WarmDispatchResult<T>>;\n resume<T = undefined>(\n id: string,\n options: DispatchOptions<T>,\n ): Promise<WarmDispatchResult<T>>;\n fork<T = undefined>(\n id: string,\n options: DispatchOptions<T>,\n ): Promise<WarmDispatchResult<T>>;\n attach(options?: AttachOptions): Promise<AttachResult>;\n command(command: Command): Promise<CommandResult>;\n close(options?: { readonly preserve?: boolean }): Promise<Disposal>;\n [Symbol.asyncDispose](): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { RecoveryTransferState } from "./recovery-verification.types.ts";
2
+ export declare function captureRecoveryChecksums(root: string, state: RecoveryTransferState): Promise<void>;
@@ -0,0 +1,32 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { rename, rm, writeFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { safeDestination } from "../infrastructure/files.js";
5
+ import { hashInspectionEntry } from "../infrastructure/inspection-hash.js";
6
+ import { recoveryChecksumDefaults } from "./recovery-checksums.constants.js";
7
+ import { recoveryChecksumPaths } from "./recovery-checksum-paths.js";
8
+ export async function captureRecoveryChecksums(root, state) {
9
+ const entries = [];
10
+ for (const path of recoveryChecksumPaths(state))
11
+ entries.push({
12
+ path,
13
+ ...(await hashInspectionEntry(await safeDestination(root, path))),
14
+ });
15
+ const manifest = {
16
+ version: 1,
17
+ algorithm: "sha256",
18
+ entries,
19
+ };
20
+ const temporary = join(root, `.checksums-${randomUUID()}.tmp`);
21
+ try {
22
+ await writeFile(temporary, JSON.stringify(manifest), {
23
+ flag: "wx",
24
+ mode: 0o600,
25
+ });
26
+ await rename(temporary, join(root, recoveryChecksumDefaults.filename));
27
+ }
28
+ finally {
29
+ await rm(temporary, { force: true });
30
+ }
31
+ }
32
+ //# sourceMappingURL=recovery-checksum-capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-checksum-capture.js","sourceRoot":"","sources":["../../src/application/recovery-checksum-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAK7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,IAAY,EACZ,KAA4B;IAE5B,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,qBAAqB,CAAC,KAAK,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,GAAG,CAAC,MAAM,mBAAmB,CAAC,MAAM,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;SAClE,CAAC,CAAC;IACL,MAAM,QAAQ,GAA6B;QACzC,OAAO,EAAE,CAAC;QACV,SAAS,EAAE,QAAQ;QACnB,OAAO;KACR,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/D,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;YACnD,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzE,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;AACH,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { rename, rm, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { safeDestination } from \"../infrastructure/files.ts\";\nimport { hashInspectionEntry } from \"../infrastructure/inspection-hash.ts\";\nimport { recoveryChecksumDefaults } from \"./recovery-checksums.constants.ts\";\nimport type {\n RecoveryChecksumEntry,\n RecoveryChecksumManifest,\n} from \"./recovery-checksums.types.ts\";\nimport { recoveryChecksumPaths } from \"./recovery-checksum-paths.ts\";\nimport type { RecoveryTransferState } from \"./recovery-verification.types.ts\";\n\nexport async function captureRecoveryChecksums(\n root: string,\n state: RecoveryTransferState,\n): Promise<void> {\n const entries: RecoveryChecksumEntry[] = [];\n for (const path of recoveryChecksumPaths(state))\n entries.push({\n path,\n ...(await hashInspectionEntry(await safeDestination(root, path))),\n });\n const manifest: RecoveryChecksumManifest = {\n version: 1,\n algorithm: \"sha256\",\n entries,\n };\n const temporary = join(root, `.checksums-${randomUUID()}.tmp`);\n try {\n await writeFile(temporary, JSON.stringify(manifest), {\n flag: \"wx\",\n mode: 0o600,\n });\n await rename(temporary, join(root, recoveryChecksumDefaults.filename));\n } finally {\n await rm(temporary, { force: true });\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { RecoveryTransferState } from "./recovery-verification.types.ts";
2
+ export declare function recoveryChecksumPaths(state: RecoveryTransferState): string[];
@@ -0,0 +1,11 @@
1
+ import { recoveryTransferPatches } from "./recovery-verification.constants.js";
2
+ export function recoveryChecksumPaths(state) {
3
+ return [
4
+ "state.json",
5
+ ...recoveryTransferPatches,
6
+ ...(state.previous !== state.next ? ["commits.bundle"] : []),
7
+ ...state.previousExtras.map((path) => `previous-files/${path}`),
8
+ ...state.incoming.map((path) => `incoming/${path}`),
9
+ ];
10
+ }
11
+ //# sourceMappingURL=recovery-checksum-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-checksum-paths.js","sourceRoot":"","sources":["../../src/application/recovery-checksum-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,MAAM,UAAU,qBAAqB,CAAC,KAA4B;IAChE,OAAO;QACL,YAAY;QACZ,GAAG,uBAAuB;QAC1B,GAAG,CAAC,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,IAAI,EAAE,CAAC;QAC/D,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC","sourcesContent":["import { recoveryTransferPatches } from \"./recovery-verification.constants.ts\";\nimport type { RecoveryTransferState } from \"./recovery-verification.types.ts\";\n\nexport function recoveryChecksumPaths(state: RecoveryTransferState): string[] {\n return [\n \"state.json\",\n ...recoveryTransferPatches,\n ...(state.previous !== state.next ? [\"commits.bundle\"] : []),\n ...state.previousExtras.map((path) => `previous-files/${path}`),\n ...state.incoming.map((path) => `incoming/${path}`),\n ];\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const recoveryChecksumDefaults: {
2
+ readonly filename: "checksums.json";
3
+ readonly maxManifestBytes: 1048576;
4
+ readonly maxBytes: 1073741824;
5
+ };
@@ -0,0 +1,6 @@
1
+ export const recoveryChecksumDefaults = {
2
+ filename: "checksums.json",
3
+ maxManifestBytes: 1_048_576,
4
+ maxBytes: 1_073_741_824,
5
+ };
6
+ //# sourceMappingURL=recovery-checksums.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-checksums.constants.js","sourceRoot":"","sources":["../../src/application/recovery-checksums.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ,EAAE,gBAAgB;IAC1B,gBAAgB,EAAE,SAAS;IAC3B,QAAQ,EAAE,aAAa;CACf,CAAC","sourcesContent":["export const recoveryChecksumDefaults = {\n filename: \"checksums.json\",\n maxManifestBytes: 1_048_576,\n maxBytes: 1_073_741_824,\n} as const;\n"]}
@@ -0,0 +1,3 @@
1
+ import type { RecoveryChecksumResult } from "./recovery-checksums.types.ts";
2
+ import type { RecoveryTransferState } from "./recovery-verification.types.ts";
3
+ export declare function verifyRecoveryChecksums(root: string, state: RecoveryTransferState, maxBytes?: number): Promise<RecoveryChecksumResult>;
@@ -0,0 +1,94 @@
1
+ import { join } from "node:path";
2
+ import { OutpostError, positive } from "../domain/errors.js";
3
+ import { safeDestination } from "../infrastructure/files.js";
4
+ import { hashInspectionEntry } from "../infrastructure/inspection-hash.js";
5
+ import { readInspectionFile } from "../infrastructure/inspection-file.js";
6
+ import { recoveryChecksumPaths } from "./recovery-checksum-paths.js";
7
+ import { recoveryChecksumDefaults } from "./recovery-checksums.constants.js";
8
+ function validManifest(value, expected) {
9
+ if (!value ||
10
+ typeof value !== "object" ||
11
+ !("version" in value) ||
12
+ value.version !== 1 ||
13
+ !("algorithm" in value) ||
14
+ value.algorithm !== "sha256" ||
15
+ !("entries" in value) ||
16
+ !Array.isArray(value.entries) ||
17
+ value.entries.length !== expected.length)
18
+ return false;
19
+ const remaining = new Set(expected);
20
+ if (remaining.size !== expected.length)
21
+ return false;
22
+ const entries = value.entries;
23
+ for (const entry of entries) {
24
+ if (!entry ||
25
+ typeof entry !== "object" ||
26
+ !("path" in entry) ||
27
+ typeof entry.path !== "string" ||
28
+ !remaining.delete(entry.path) ||
29
+ !("kind" in entry) ||
30
+ (entry.kind !== "file" && entry.kind !== "symlink") ||
31
+ !("bytes" in entry) ||
32
+ typeof entry.bytes !== "number" ||
33
+ !Number.isSafeInteger(entry.bytes) ||
34
+ entry.bytes < 0 ||
35
+ !("sha256" in entry) ||
36
+ typeof entry.sha256 !== "string" ||
37
+ !/^[a-f0-9]{64}$/.test(entry.sha256))
38
+ return false;
39
+ }
40
+ return remaining.size === 0;
41
+ }
42
+ export async function verifyRecoveryChecksums(root, state, maxBytes = recoveryChecksumDefaults.maxBytes) {
43
+ positive(maxBytes, "maxBytes");
44
+ const checks = [];
45
+ let bytesChecked = 0;
46
+ const manifestPath = join(root, recoveryChecksumDefaults.filename);
47
+ const unavailable = (code) => ({
48
+ integrity: "unverified",
49
+ bytesChecked,
50
+ maxBytes,
51
+ checks: [{ path: manifestPath, status: "fail", code }],
52
+ });
53
+ let manifest;
54
+ try {
55
+ manifest = JSON.parse((await readInspectionFile(manifestPath, recoveryChecksumDefaults.maxManifestBytes)).toString("utf8"));
56
+ }
57
+ catch {
58
+ return unavailable("CHECKSUMS_UNAVAILABLE");
59
+ }
60
+ if (!validManifest(manifest, recoveryChecksumPaths(state)))
61
+ return unavailable("INVALID_CHECKSUM_MANIFEST");
62
+ for (const entry of manifest.entries) {
63
+ const path = join(root, entry.path);
64
+ try {
65
+ const actual = await hashInspectionEntry(await safeDestination(root, entry.path), maxBytes - bytesChecked);
66
+ bytesChecked += actual.bytes;
67
+ const matches = actual.kind === entry.kind &&
68
+ actual.bytes === entry.bytes &&
69
+ actual.sha256 === entry.sha256;
70
+ checks.push({
71
+ path,
72
+ status: matches ? "pass" : "fail",
73
+ code: matches ? "CHECKSUM_MATCH" : "CHECKSUM_MISMATCH",
74
+ });
75
+ }
76
+ catch (error) {
77
+ const code = error instanceof OutpostError &&
78
+ error.details.reason === "CHECKSUM_LIMIT"
79
+ ? "CHECKSUM_LIMIT"
80
+ : "CHECKSUM_UNAVAILABLE";
81
+ checks.push({ path, status: "fail", code });
82
+ return { integrity: "unverified", bytesChecked, maxBytes, checks };
83
+ }
84
+ }
85
+ return {
86
+ integrity: checks.every((check) => check.status === "pass")
87
+ ? "checksums-match"
88
+ : "checksums-mismatch",
89
+ bytesChecked,
90
+ maxBytes,
91
+ checks,
92
+ };
93
+ }
94
+ //# sourceMappingURL=recovery-checksums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-checksums.js","sourceRoot":"","sources":["../../src/application/recovery-checksums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCA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E,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;YACzD,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,oBAAoB;QACxB,YAAY;QACZ,QAAQ;QACR,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport { OutpostError, positive } from \"../domain/errors.ts\";\nimport { safeDestination } from \"../infrastructure/files.ts\";\nimport { hashInspectionEntry } from \"../infrastructure/inspection-hash.ts\";\nimport { readInspectionFile } from \"../infrastructure/inspection-file.ts\";\nimport { recoveryChecksumPaths } from \"./recovery-checksum-paths.ts\";\nimport { recoveryChecksumDefaults } from \"./recovery-checksums.constants.ts\";\nimport type {\n RecoveryChecksumManifest,\n RecoveryChecksumResult,\n} from \"./recovery-checksums.types.ts\";\nimport type {\n RecoveryStructureCheck,\n RecoveryTransferState,\n} from \"./recovery-verification.types.ts\";\n\nfunction validManifest(\n value: unknown,\n expected: readonly string[],\n): value is RecoveryChecksumManifest {\n if (\n !value ||\n typeof value !== \"object\" ||\n !(\"version\" in value) ||\n value.version !== 1 ||\n !(\"algorithm\" in value) ||\n value.algorithm !== \"sha256\" ||\n !(\"entries\" in value) ||\n !Array.isArray(value.entries) ||\n value.entries.length !== expected.length\n )\n return false;\n const remaining = new Set(expected);\n if (remaining.size !== expected.length) return false;\n const entries: readonly unknown[] = value.entries;\n for (const entry of entries) {\n if (\n !entry ||\n typeof entry !== \"object\" ||\n !(\"path\" in entry) ||\n typeof entry.path !== \"string\" ||\n !remaining.delete(entry.path) ||\n !(\"kind\" in entry) ||\n (entry.kind !== \"file\" && entry.kind !== \"symlink\") ||\n !(\"bytes\" in entry) ||\n typeof entry.bytes !== \"number\" ||\n !Number.isSafeInteger(entry.bytes) ||\n entry.bytes < 0 ||\n !(\"sha256\" in entry) ||\n typeof entry.sha256 !== \"string\" ||\n !/^[a-f0-9]{64}$/.test(entry.sha256)\n )\n return false;\n }\n return remaining.size === 0;\n}\n\nexport async function verifyRecoveryChecksums(\n root: string,\n state: RecoveryTransferState,\n maxBytes: number = recoveryChecksumDefaults.maxBytes,\n): Promise<RecoveryChecksumResult> {\n positive(maxBytes, \"maxBytes\");\n const checks: RecoveryStructureCheck[] = [];\n let bytesChecked = 0;\n const manifestPath = join(root, recoveryChecksumDefaults.filename);\n const unavailable = (code: string): RecoveryChecksumResult => ({\n integrity: \"unverified\",\n bytesChecked,\n maxBytes,\n checks: [{ path: manifestPath, status: \"fail\", code }],\n });\n let manifest: unknown;\n try {\n manifest = JSON.parse(\n (\n await readInspectionFile(\n manifestPath,\n recoveryChecksumDefaults.maxManifestBytes,\n )\n ).toString(\"utf8\"),\n );\n } catch {\n return unavailable(\"CHECKSUMS_UNAVAILABLE\");\n }\n if (!validManifest(manifest, recoveryChecksumPaths(state)))\n return unavailable(\"INVALID_CHECKSUM_MANIFEST\");\n for (const entry of manifest.entries) {\n const path = join(root, entry.path);\n try {\n const actual = await hashInspectionEntry(\n await safeDestination(root, entry.path),\n maxBytes - bytesChecked,\n );\n bytesChecked += actual.bytes;\n const matches =\n actual.kind === entry.kind &&\n actual.bytes === entry.bytes &&\n actual.sha256 === entry.sha256;\n checks.push({\n path,\n status: matches ? \"pass\" : \"fail\",\n code: matches ? \"CHECKSUM_MATCH\" : \"CHECKSUM_MISMATCH\",\n });\n } catch (error) {\n const code =\n error instanceof OutpostError &&\n error.details.reason === \"CHECKSUM_LIMIT\"\n ? \"CHECKSUM_LIMIT\"\n : \"CHECKSUM_UNAVAILABLE\";\n checks.push({ path, status: \"fail\", code });\n return { integrity: \"unverified\", bytesChecked, maxBytes, checks };\n }\n }\n return {\n integrity: checks.every((check) => check.status === \"pass\")\n ? \"checksums-match\"\n : \"checksums-mismatch\",\n bytesChecked,\n maxBytes,\n checks,\n };\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { InspectionHash } from "../infrastructure/inspection-hash.types.ts";
2
+ import type { RecoveryStructureCheck } from "./recovery-verification.types.ts";
3
+ export interface RecoveryChecksumEntry extends InspectionHash {
4
+ readonly path: string;
5
+ }
6
+ export interface RecoveryChecksumManifest {
7
+ readonly version: 1;
8
+ readonly algorithm: "sha256";
9
+ readonly entries: readonly RecoveryChecksumEntry[];
10
+ }
11
+ export type RecoveryIntegrity = "unverified" | "checksums-match" | "checksums-mismatch";
12
+ export interface RecoveryChecksumResult {
13
+ readonly integrity: RecoveryIntegrity;
14
+ readonly bytesChecked: number;
15
+ readonly maxBytes: number;
16
+ readonly checks: readonly RecoveryStructureCheck[];
17
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=recovery-checksums.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-checksums.types.js","sourceRoot":"","sources":["../../src/application/recovery-checksums.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { InspectionHash } from \"../infrastructure/inspection-hash.types.ts\";\nimport type { RecoveryStructureCheck } from \"./recovery-verification.types.ts\";\n\nexport interface RecoveryChecksumEntry extends InspectionHash {\n readonly path: string;\n}\nexport interface RecoveryChecksumManifest {\n readonly version: 1;\n readonly algorithm: \"sha256\";\n readonly entries: readonly RecoveryChecksumEntry[];\n}\nexport type RecoveryIntegrity =\n \"unverified\" | \"checksums-match\" | \"checksums-mismatch\";\nexport interface RecoveryChecksumResult {\n readonly integrity: RecoveryIntegrity;\n readonly bytesChecked: number;\n readonly maxBytes: number;\n readonly checks: readonly RecoveryStructureCheck[];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { RecoveryInspection, RecoveryInspectionOptions } from "./recovery-inspection.types.ts";
2
+ export declare function inspectRecovery(options?: RecoveryInspectionOptions): Promise<RecoveryInspection>;
@@ -0,0 +1,27 @@
1
+ import { inspectLocks } from "../infrastructure/git/lock-inspection.js";
2
+ import { join } from "node:path";
3
+ import { directory } from "../infrastructure/files.js";
4
+ import { git } from "../infrastructure/git/command.js";
5
+ import { inspectWorktreeGit } from "../infrastructure/git/worktree-inspection.js";
6
+ import { storageInventory } from "../infrastructure/storage-inventory.js";
7
+ export async function inspectRecovery(options = {}) {
8
+ const requested = await directory(options.repository);
9
+ const repository = await directory((await git(requested, ["rev-parse", "--show-toplevel"])).trim());
10
+ const inventory = await storageInventory(join(repository, ".outpost"), options.maxEntries);
11
+ const gitReport = options.git
12
+ ? await inspectWorktreeGit(repository, inventory.categories.find((category) => category.name === "workspaces")
13
+ ?.entries ?? [])
14
+ : undefined;
15
+ const lockReport = options.locks
16
+ ? await inspectLocks(inventory.categories.find((category) => category.name === "locks")
17
+ ?.entries ?? [])
18
+ : undefined;
19
+ return {
20
+ repository,
21
+ activity: "unverified",
22
+ ...inventory,
23
+ ...(gitReport ? { git: gitReport } : {}),
24
+ ...(lockReport ? { locks: lockReport } : {}),
25
+ };
26
+ }
27
+ //# sourceMappingURL=recovery-inspection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-inspection.js","sourceRoot":"","sources":["../../src/application/recovery-inspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,kCAAkC,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAM1E,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,UAAqC,EAAE;IAEvC,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,MAAM,SAAS,CAChC,CAAC,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAChE,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,gBAAgB,CACtC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAC5B,OAAO,CAAC,UAAU,CACnB,CAAC;IACF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG;QAC3B,CAAC,CAAC,MAAM,kBAAkB,CACtB,UAAU,EACV,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC;YACrE,EAAE,OAAO,IAAI,EAAE,CAClB;QACH,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK;QAC9B,CAAC,CAAC,MAAM,YAAY,CAChB,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;YAChE,EAAE,OAAO,IAAI,EAAE,CAClB;QACH,CAAC,CAAC,SAAS,CAAC;IACd,OAAO;QACL,UAAU;QACV,QAAQ,EAAE,YAAY;QACtB,GAAG,SAAS;QACZ,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7C,CAAC;AACJ,CAAC","sourcesContent":["import { inspectLocks } from \"../infrastructure/git/lock-inspection.ts\";\nimport { join } from \"node:path\";\nimport { directory } from \"../infrastructure/files.ts\";\nimport { git } from \"../infrastructure/git/command.ts\";\nimport { inspectWorktreeGit } from \"../infrastructure/git/worktree-inspection.ts\";\nimport { storageInventory } from \"../infrastructure/storage-inventory.ts\";\nimport type {\n RecoveryInspection,\n RecoveryInspectionOptions,\n} from \"./recovery-inspection.types.ts\";\n\nexport async function inspectRecovery(\n options: RecoveryInspectionOptions = {},\n): Promise<RecoveryInspection> {\n const requested = await directory(options.repository);\n const repository = await directory(\n (await git(requested, [\"rev-parse\", \"--show-toplevel\"])).trim(),\n );\n const inventory = await storageInventory(\n join(repository, \".outpost\"),\n options.maxEntries,\n );\n const gitReport = options.git\n ? await inspectWorktreeGit(\n repository,\n inventory.categories.find((category) => category.name === \"workspaces\")\n ?.entries ?? [],\n )\n : undefined;\n const lockReport = options.locks\n ? await inspectLocks(\n inventory.categories.find((category) => category.name === \"locks\")\n ?.entries ?? [],\n )\n : undefined;\n return {\n repository,\n activity: \"unverified\",\n ...inventory,\n ...(gitReport ? { git: gitReport } : {}),\n ...(lockReport ? { locks: lockReport } : {}),\n };\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { LockInspection } from "../infrastructure/git/lock-inspection.types.ts";
2
+ import type { WorkspaceGitInspection } from "../infrastructure/git/worktree-inspection.types.ts";
3
+ import type { StorageInventory } from "../infrastructure/storage-inventory.types.ts";
4
+ export interface RecoveryInspectionOptions {
5
+ readonly repository?: string;
6
+ readonly maxEntries?: number;
7
+ readonly git?: boolean;
8
+ readonly locks?: boolean;
9
+ }
10
+ export interface RecoveryInspection extends StorageInventory {
11
+ readonly repository: string;
12
+ readonly activity: "unverified";
13
+ readonly git?: WorkspaceGitInspection;
14
+ readonly locks?: LockInspection;
15
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=recovery-inspection.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-inspection.types.js","sourceRoot":"","sources":["../../src/application/recovery-inspection.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { LockInspection } from \"../infrastructure/git/lock-inspection.types.ts\";\nimport type { WorkspaceGitInspection } from \"../infrastructure/git/worktree-inspection.types.ts\";\nimport type { StorageInventory } from \"../infrastructure/storage-inventory.types.ts\";\n\nexport interface RecoveryInspectionOptions {\n readonly repository?: string;\n readonly maxEntries?: number;\n readonly git?: boolean;\n readonly locks?: boolean;\n}\nexport interface RecoveryInspection extends StorageInventory {\n readonly repository: string;\n readonly activity: \"unverified\";\n readonly git?: WorkspaceGitInspection;\n readonly locks?: LockInspection;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { RecoveryStructureCheck, RecoveryTransferState } from "./recovery-verification.types.ts";
2
+ export declare function verifyRecoveryRestorability(root: string, state: RecoveryTransferState, repository: string): Promise<readonly RecoveryStructureCheck[]>;