@elie-laloum/outpost 4.2.0 → 6.0.1

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 (642) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +13 -11
  3. package/SECURITY.md +2 -0
  4. package/dist/adapters/agents/antigravity-adapter.d.ts +3 -0
  5. package/dist/adapters/agents/antigravity-adapter.js +39 -0
  6. package/dist/adapters/agents/antigravity-adapter.js.map +1 -0
  7. package/dist/adapters/agents/antigravity-authentication.d.ts +2 -0
  8. package/dist/adapters/agents/antigravity-authentication.js +27 -0
  9. package/dist/adapters/agents/antigravity-authentication.js.map +1 -0
  10. package/dist/adapters/agents/antigravity-diagnostics.d.ts +1 -0
  11. package/dist/adapters/agents/antigravity-diagnostics.js +6 -0
  12. package/dist/adapters/agents/antigravity-diagnostics.js.map +1 -0
  13. package/dist/adapters/agents/antigravity-events.d.ts +2 -0
  14. package/dist/adapters/agents/antigravity-events.js +66 -0
  15. package/dist/adapters/agents/antigravity-events.js.map +1 -0
  16. package/dist/adapters/agents/antigravity-request.d.ts +5 -0
  17. package/dist/adapters/agents/antigravity-request.js +29 -0
  18. package/dist/adapters/agents/antigravity-request.js.map +1 -0
  19. package/dist/adapters/agents/antigravity.types.d.ts +7 -0
  20. package/dist/adapters/agents/antigravity.types.js +2 -0
  21. package/dist/adapters/agents/antigravity.types.js.map +1 -0
  22. package/dist/adapters/agents/authentication.constants.d.ts +23 -0
  23. package/dist/adapters/agents/authentication.constants.js +13 -0
  24. package/dist/adapters/agents/authentication.constants.js.map +1 -0
  25. package/dist/adapters/agents/authentication.d.ts +11 -0
  26. package/dist/adapters/agents/authentication.js +75 -0
  27. package/dist/adapters/agents/authentication.js.map +1 -0
  28. package/dist/adapters/agents/authentication.types.d.ts +20 -0
  29. package/dist/adapters/agents/authentication.types.js +2 -0
  30. package/dist/adapters/agents/authentication.types.js.map +1 -0
  31. package/dist/adapters/agents/claude-adapter.d.ts +2 -2
  32. package/dist/adapters/agents/claude-adapter.js +32 -2
  33. package/dist/adapters/agents/claude-adapter.js.map +1 -1
  34. package/dist/adapters/agents/claude-authentication.d.ts +2 -0
  35. package/dist/adapters/agents/claude-authentication.js +34 -0
  36. package/dist/adapters/agents/claude-authentication.js.map +1 -0
  37. package/dist/adapters/agents/claude-request.d.ts +2 -2
  38. package/dist/adapters/agents/claude-request.js +3 -3
  39. package/dist/adapters/agents/claude-request.js.map +1 -1
  40. package/dist/adapters/agents/cli-diagnostics.constants.d.ts +6 -6
  41. package/dist/adapters/agents/cli-diagnostics.constants.js +6 -6
  42. package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -1
  43. package/dist/adapters/agents/cli-diagnostics.d.ts +1 -0
  44. package/dist/adapters/agents/cli-diagnostics.js +11 -0
  45. package/dist/adapters/agents/cli-diagnostics.js.map +1 -1
  46. package/dist/adapters/agents/codex-adapter.d.ts +2 -2
  47. package/dist/adapters/agents/codex-adapter.js +19 -1
  48. package/dist/adapters/agents/codex-adapter.js.map +1 -1
  49. package/dist/adapters/agents/codex-authentication.d.ts +3 -0
  50. package/dist/adapters/agents/codex-authentication.js +47 -0
  51. package/dist/adapters/agents/codex-authentication.js.map +1 -0
  52. package/dist/adapters/agents/codex-provider.d.ts +2 -2
  53. package/dist/adapters/agents/codex-provider.js +1 -1
  54. package/dist/adapters/agents/codex-provider.js.map +1 -1
  55. package/dist/adapters/agents/codex-request.d.ts +2 -2
  56. package/dist/adapters/agents/codex-request.js +3 -3
  57. package/dist/adapters/agents/codex-request.js.map +1 -1
  58. package/dist/adapters/agents/copilot-adapter.d.ts +3 -0
  59. package/dist/adapters/agents/copilot-adapter.js +39 -0
  60. package/dist/adapters/agents/copilot-adapter.js.map +1 -0
  61. package/dist/adapters/agents/copilot-authentication.d.ts +2 -0
  62. package/dist/adapters/agents/copilot-authentication.js +45 -0
  63. package/dist/adapters/agents/copilot-authentication.js.map +1 -0
  64. package/dist/adapters/agents/copilot-diagnostics.d.ts +1 -0
  65. package/dist/adapters/agents/copilot-diagnostics.js +6 -0
  66. package/dist/adapters/agents/copilot-diagnostics.js.map +1 -0
  67. package/dist/adapters/agents/copilot-events.d.ts +2 -0
  68. package/dist/adapters/agents/copilot-events.js +50 -0
  69. package/dist/adapters/agents/copilot-events.js.map +1 -0
  70. package/dist/adapters/agents/copilot-request.d.ts +5 -0
  71. package/dist/adapters/agents/copilot-request.js +19 -0
  72. package/dist/adapters/agents/copilot-request.js.map +1 -0
  73. package/dist/adapters/agents/copilot.types.d.ts +6 -0
  74. package/dist/adapters/agents/copilot.types.js +2 -0
  75. package/dist/adapters/agents/copilot.types.js.map +1 -0
  76. package/dist/adapters/agents/event-decoder.d.ts +2 -2
  77. package/dist/adapters/agents/event-decoder.js +6 -5
  78. package/dist/adapters/agents/event-decoder.js.map +1 -1
  79. package/dist/adapters/agents/kimi-adapter.d.ts +3 -0
  80. package/dist/adapters/agents/kimi-adapter.js +35 -0
  81. package/dist/adapters/agents/kimi-adapter.js.map +1 -0
  82. package/dist/adapters/agents/kimi-authentication.d.ts +2 -0
  83. package/dist/adapters/agents/kimi-authentication.js +48 -0
  84. package/dist/adapters/agents/kimi-authentication.js.map +1 -0
  85. package/dist/adapters/agents/kimi-diagnostics.d.ts +1 -0
  86. package/dist/adapters/agents/kimi-diagnostics.js +6 -0
  87. package/dist/adapters/agents/kimi-diagnostics.js.map +1 -0
  88. package/dist/adapters/agents/kimi-events.d.ts +2 -0
  89. package/dist/adapters/agents/kimi-events.js +51 -0
  90. package/dist/adapters/agents/kimi-events.js.map +1 -0
  91. package/dist/adapters/agents/kimi-request.d.ts +5 -0
  92. package/dist/adapters/agents/kimi-request.js +28 -0
  93. package/dist/adapters/agents/kimi-request.js.map +1 -0
  94. package/dist/adapters/agents/kimi.types.d.ts +6 -0
  95. package/dist/adapters/agents/kimi.types.js +2 -0
  96. package/dist/adapters/agents/kimi.types.js.map +1 -0
  97. package/dist/adapters/agents/model-support.constants.d.ts +8 -0
  98. package/dist/adapters/agents/model-support.constants.js +28 -0
  99. package/dist/adapters/agents/model-support.constants.js.map +1 -0
  100. package/dist/adapters/agents/model-support.d.ts +4 -0
  101. package/dist/adapters/agents/model-support.js +11 -0
  102. package/dist/adapters/agents/model-support.js.map +1 -0
  103. package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -2
  104. package/dist/adapters/agents/protocol-fixtures.constants.js +135 -9
  105. package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
  106. package/dist/adapters/agents/protocol-fixtures.types.d.ts +1 -0
  107. package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -1
  108. package/dist/adapters/agents/protocol.d.ts +1 -0
  109. package/dist/adapters/agents/protocol.js +9 -0
  110. package/dist/adapters/agents/protocol.js.map +1 -1
  111. package/dist/adapters/agents/settings.types.d.ts +11 -3
  112. package/dist/adapters/agents/settings.types.js.map +1 -1
  113. package/dist/adapters/models/anthropic-model-provider.constants.d.ts +3 -0
  114. package/dist/adapters/models/anthropic-model-provider.constants.js +17 -0
  115. package/dist/adapters/models/anthropic-model-provider.constants.js.map +1 -0
  116. package/dist/adapters/models/anthropic-model-provider.d.ts +3 -0
  117. package/dist/adapters/models/anthropic-model-provider.js +31 -0
  118. package/dist/adapters/models/anthropic-model-provider.js.map +1 -0
  119. package/dist/adapters/models/anthropic-model-provider.types.d.ts +7 -0
  120. package/dist/adapters/models/anthropic-model-provider.types.js +2 -0
  121. package/dist/adapters/models/anthropic-model-provider.types.js.map +1 -0
  122. package/dist/adapters/models/anthropic-request.d.ts +4 -0
  123. package/dist/adapters/models/anthropic-request.js +81 -0
  124. package/dist/adapters/models/anthropic-request.js.map +1 -0
  125. package/dist/adapters/models/anthropic-response.d.ts +3 -0
  126. package/dist/adapters/models/anthropic-response.js +55 -0
  127. package/dist/adapters/models/anthropic-response.js.map +1 -0
  128. package/dist/adapters/models/anthropic-stream.d.ts +2 -0
  129. package/dist/adapters/models/anthropic-stream.js +96 -0
  130. package/dist/adapters/models/anthropic-stream.js.map +1 -0
  131. package/dist/adapters/models/http-provider.d.ts +3 -0
  132. package/dist/adapters/models/http-provider.js +113 -0
  133. package/dist/adapters/models/http-provider.js.map +1 -0
  134. package/dist/adapters/models/{openai-http.js → model-http.js} +1 -1
  135. package/dist/adapters/models/model-http.js.map +1 -0
  136. package/dist/adapters/models/model-protocol.types.d.ts +41 -0
  137. package/dist/adapters/models/model-protocol.types.js +2 -0
  138. package/dist/adapters/models/model-protocol.types.js.map +1 -0
  139. package/dist/adapters/models/model-request.d.ts +2 -0
  140. package/dist/adapters/models/model-request.js +18 -0
  141. package/dist/adapters/models/model-request.js.map +1 -0
  142. package/dist/adapters/models/model-response.d.ts +7 -0
  143. package/dist/adapters/models/model-response.js +41 -0
  144. package/dist/adapters/models/model-response.js.map +1 -0
  145. package/dist/adapters/models/{openai-compatible.constants.js → model.constants.js} +6 -1
  146. package/dist/adapters/models/model.constants.js.map +1 -0
  147. package/dist/adapters/models/openai-chat-stream.d.ts +2 -0
  148. package/dist/adapters/models/openai-chat-stream.js +66 -0
  149. package/dist/adapters/models/openai-chat-stream.js.map +1 -0
  150. package/dist/adapters/models/openai-chat.d.ts +4 -0
  151. package/dist/adapters/models/openai-chat.js +108 -0
  152. package/dist/adapters/models/openai-chat.js.map +1 -0
  153. package/dist/adapters/models/openai-model-provider.d.ts +3 -0
  154. package/dist/adapters/models/openai-model-provider.js +13 -0
  155. package/dist/adapters/models/openai-model-provider.js.map +1 -0
  156. package/dist/adapters/models/openai-model-provider.types.d.ts +4 -0
  157. package/dist/adapters/models/openai-model-provider.types.js +2 -0
  158. package/dist/adapters/models/openai-model-provider.types.js.map +1 -0
  159. package/dist/adapters/models/openai-protocols.d.ts +2 -0
  160. package/dist/adapters/models/openai-protocols.js +22 -0
  161. package/dist/adapters/models/openai-protocols.js.map +1 -0
  162. package/dist/adapters/models/openai-responses-stream.d.ts +2 -0
  163. package/dist/adapters/models/openai-responses-stream.js +35 -0
  164. package/dist/adapters/models/openai-responses-stream.js.map +1 -0
  165. package/dist/adapters/models/openai-responses.d.ts +4 -0
  166. package/dist/adapters/models/openai-responses.js +107 -0
  167. package/dist/adapters/models/openai-responses.js.map +1 -0
  168. package/dist/adapters/models/openai-usage.d.ts +3 -0
  169. package/dist/adapters/models/openai-usage.js +20 -0
  170. package/dist/adapters/models/openai-usage.js.map +1 -0
  171. package/dist/adapters/models/stop-reasons.constants.d.ts +4 -0
  172. package/dist/adapters/models/stop-reasons.constants.js +19 -0
  173. package/dist/adapters/models/stop-reasons.constants.js.map +1 -0
  174. package/dist/adapters/models/stream-events.d.ts +3 -0
  175. package/dist/adapters/models/stream-events.js +22 -0
  176. package/dist/adapters/models/stream-events.js.map +1 -0
  177. package/dist/adapters/tools/edit-tools.d.ts +2 -0
  178. package/dist/adapters/tools/edit-tools.js +84 -0
  179. package/dist/adapters/tools/edit-tools.js.map +1 -0
  180. package/dist/adapters/tools/file-tools.d.ts +2 -0
  181. package/dist/adapters/tools/file-tools.js +97 -0
  182. package/dist/adapters/tools/file-tools.js.map +1 -0
  183. package/dist/adapters/tools/git-tools.d.ts +2 -0
  184. package/dist/adapters/tools/git-tools.js +54 -0
  185. package/dist/adapters/tools/git-tools.js.map +1 -0
  186. package/dist/adapters/tools/sandbox-files.d.ts +10 -0
  187. package/dist/adapters/tools/sandbox-files.js +60 -0
  188. package/dist/adapters/tools/sandbox-files.js.map +1 -0
  189. package/dist/adapters/tools/search-tools.d.ts +2 -0
  190. package/dist/adapters/tools/search-tools.js +65 -0
  191. package/dist/adapters/tools/search-tools.js.map +1 -0
  192. package/dist/adapters/tools/shell-tools.d.ts +3 -0
  193. package/dist/adapters/tools/shell-tools.js +38 -0
  194. package/dist/adapters/tools/shell-tools.js.map +1 -0
  195. package/dist/adapters/tools/tools.constants.d.ts +11 -0
  196. package/dist/adapters/tools/tools.constants.js +17 -0
  197. package/dist/adapters/tools/tools.constants.js.map +1 -0
  198. package/dist/adapters/tools/tools.types.d.ts +41 -0
  199. package/dist/adapters/tools/tools.types.js +2 -0
  200. package/dist/adapters/tools/tools.types.js.map +1 -0
  201. package/dist/application/activity-watchdog.js +15 -2
  202. package/dist/application/activity-watchdog.js.map +1 -1
  203. package/dist/application/agent-authentication.d.ts +4 -0
  204. package/dist/application/agent-authentication.js +32 -0
  205. package/dist/application/agent-authentication.js.map +1 -0
  206. package/dist/application/agent-bootstrap.constants.d.ts +2 -5
  207. package/dist/application/agent-bootstrap.constants.js +29 -4
  208. package/dist/application/agent-bootstrap.constants.js.map +1 -1
  209. package/dist/application/agent-bootstrap.d.ts +2 -2
  210. package/dist/application/agent-bootstrap.js +35 -12
  211. package/dist/application/agent-bootstrap.js.map +1 -1
  212. package/dist/application/agent-bootstrap.types.d.ts +20 -0
  213. package/dist/application/agent-bootstrap.types.js +2 -0
  214. package/dist/application/agent-bootstrap.types.js.map +1 -0
  215. package/dist/application/agent-storage.d.ts +3 -2
  216. package/dist/application/agent-storage.js +9 -2
  217. package/dist/application/agent-storage.js.map +1 -1
  218. package/dist/application/agent-turn.d.ts +3 -3
  219. package/dist/application/agent-turn.js +7 -1
  220. package/dist/application/agent-turn.js.map +1 -1
  221. package/dist/application/attach.js +1 -0
  222. package/dist/application/attach.js.map +1 -1
  223. package/dist/application/credential-installer.constants.d.ts +1 -0
  224. package/dist/application/credential-installer.constants.js +22 -0
  225. package/dist/application/credential-installer.constants.js.map +1 -0
  226. package/dist/application/custom-turn.d.ts +5 -0
  227. package/dist/application/custom-turn.js +190 -0
  228. package/dist/application/custom-turn.js.map +1 -0
  229. package/dist/application/dispatch-observation.d.ts +3 -0
  230. package/dist/application/dispatch-observation.js +51 -0
  231. package/dist/application/dispatch-observation.js.map +1 -0
  232. package/dist/application/dispatch-observation.types.d.ts +5 -0
  233. package/dist/application/dispatch-observation.types.js +2 -0
  234. package/dist/application/dispatch-observation.types.js.map +1 -0
  235. package/dist/application/dispatch-validation.d.ts +2 -2
  236. package/dist/application/dispatch-validation.js.map +1 -1
  237. package/dist/application/dispatch.js +8 -3
  238. package/dist/application/dispatch.js.map +1 -1
  239. package/dist/application/doctor-agent.constants.d.ts +2 -8
  240. package/dist/application/doctor-agent.constants.js +40 -6
  241. package/dist/application/doctor-agent.constants.js.map +1 -1
  242. package/dist/application/doctor-agent.d.ts +2 -1
  243. package/dist/application/doctor-agent.js +11 -3
  244. package/dist/application/doctor-agent.js.map +1 -1
  245. package/dist/application/doctor-image.js +7 -9
  246. package/dist/application/doctor-image.js.map +1 -1
  247. package/dist/application/doctor-protocol.js +6 -6
  248. package/dist/application/doctor-protocol.js.map +1 -1
  249. package/dist/application/doctor-protocol.types.d.ts +1 -1
  250. package/dist/application/doctor-protocol.types.js.map +1 -1
  251. package/dist/application/doctor-sandbox.js +6 -9
  252. package/dist/application/doctor-sandbox.js.map +1 -1
  253. package/dist/application/doctor-sandbox.types.d.ts +2 -2
  254. package/dist/application/doctor-sandbox.types.js.map +1 -1
  255. package/dist/application/doctor.constants.d.ts +1 -1
  256. package/dist/application/doctor.constants.js +1 -1
  257. package/dist/application/doctor.constants.js.map +1 -1
  258. package/dist/application/doctor.js +12 -13
  259. package/dist/application/doctor.js.map +1 -1
  260. package/dist/application/doctor.types.d.ts +12 -4
  261. package/dist/application/doctor.types.js.map +1 -1
  262. package/dist/application/execution.d.ts +2 -2
  263. package/dist/application/execution.js +1 -1
  264. package/dist/application/execution.js.map +1 -1
  265. package/dist/application/execution.types.d.ts +9 -2
  266. package/dist/application/execution.types.js.map +1 -1
  267. package/dist/application/harness-context.d.ts +2 -0
  268. package/dist/application/harness-context.js +54 -0
  269. package/dist/application/harness-context.js.map +1 -0
  270. package/dist/application/harness-history.d.ts +3 -0
  271. package/dist/application/harness-history.js +17 -0
  272. package/dist/application/harness-history.js.map +1 -0
  273. package/dist/application/harness-hooks.d.ts +9 -0
  274. package/dist/application/harness-hooks.js +90 -0
  275. package/dist/application/harness-hooks.js.map +1 -0
  276. package/dist/application/harness-loop.d.ts +2 -0
  277. package/dist/application/harness-loop.js +132 -0
  278. package/dist/application/harness-loop.js.map +1 -0
  279. package/dist/application/harness.types.d.ts +55 -0
  280. package/dist/application/harness.types.js +2 -0
  281. package/dist/application/harness.types.js.map +1 -0
  282. package/dist/application/lifecycle.constants.d.ts +1 -1
  283. package/dist/application/lifecycle.constants.js +1 -1
  284. package/dist/application/lifecycle.constants.js.map +1 -1
  285. package/dist/application/outpost.types.d.ts +6 -7
  286. package/dist/application/outpost.types.js.map +1 -1
  287. package/dist/application/recovery-retention.js +65 -24
  288. package/dist/application/recovery-retention.js.map +1 -1
  289. package/dist/application/remote-download.js +1 -1
  290. package/dist/application/remote-download.js.map +1 -1
  291. package/dist/application/sandbox-agents.js +14 -5
  292. package/dist/application/sandbox-agents.js.map +1 -1
  293. package/dist/application/sandbox-attach.js +5 -2
  294. package/dist/application/sandbox-attach.js.map +1 -1
  295. package/dist/application/sandbox-dispatch.js +3 -5
  296. package/dist/application/sandbox-dispatch.js.map +1 -1
  297. package/dist/application/sandbox-provision.js +13 -10
  298. package/dist/application/sandbox-provision.js.map +1 -1
  299. package/dist/application/sandbox-session.types.d.ts +13 -8
  300. package/dist/application/sandbox-session.types.js.map +1 -1
  301. package/dist/application/sandbox.js +6 -3
  302. package/dist/application/sandbox.js.map +1 -1
  303. package/dist/application/speculation.js +1 -1
  304. package/dist/application/speculation.js.map +1 -1
  305. package/dist/application/speculation.types.d.ts +3 -3
  306. package/dist/application/speculation.types.js.map +1 -1
  307. package/dist/application/startup-recovery.js +1 -1
  308. package/dist/application/startup-recovery.js.map +1 -1
  309. package/dist/application/storage-reservation.js +9 -2
  310. package/dist/application/storage-reservation.js.map +1 -1
  311. package/dist/application/tasks.types.d.ts +2 -2
  312. package/dist/application/tasks.types.js.map +1 -1
  313. package/dist/application/tool-execution.d.ts +3 -0
  314. package/dist/application/tool-execution.js +211 -0
  315. package/dist/application/tool-execution.js.map +1 -0
  316. package/dist/cli/commands.js +4 -2
  317. package/dist/cli/commands.js.map +1 -1
  318. package/dist/cli/doctor-command.js +11 -7
  319. package/dist/cli/doctor-command.js.map +1 -1
  320. package/dist/cli/init-authentication.d.ts +4 -1
  321. package/dist/cli/init-authentication.js +28 -34
  322. package/dist/cli/init-authentication.js.map +1 -1
  323. package/dist/cli/init-command.js +6 -6
  324. package/dist/cli/init-command.js.map +1 -1
  325. package/dist/cli/main.constants.d.ts +54 -17
  326. package/dist/cli/main.constants.js +74 -12
  327. package/dist/cli/main.constants.js.map +1 -1
  328. package/dist/cli/recovery-command.js +1 -1
  329. package/dist/cli/recovery-command.js.map +1 -1
  330. package/dist/cli/scaffold-files.js +6 -5
  331. package/dist/cli/scaffold-files.js.map +1 -1
  332. package/dist/cli/scaffold-validation.js +26 -16
  333. package/dist/cli/scaffold-validation.js.map +1 -1
  334. package/dist/cli/scaffold.constants.d.ts +0 -1
  335. package/dist/cli/scaffold.constants.js +5 -2
  336. package/dist/cli/scaffold.constants.js.map +1 -1
  337. package/dist/cli/scaffold.js +8 -4
  338. package/dist/cli/scaffold.js.map +1 -1
  339. package/dist/cli/scaffold.types.d.ts +9 -3
  340. package/dist/cli/scaffold.types.js.map +1 -1
  341. package/dist/cli/starters.js +8 -10
  342. package/dist/cli/starters.js.map +1 -1
  343. package/dist/domain/agent-model.d.ts +3 -0
  344. package/dist/domain/agent-model.js +22 -0
  345. package/dist/domain/agent-model.js.map +1 -0
  346. package/dist/domain/agent.d.ts +4 -0
  347. package/dist/domain/agent.js +32 -0
  348. package/dist/domain/agent.js.map +1 -0
  349. package/dist/domain/agent.types.d.ts +105 -2
  350. package/dist/domain/agent.types.js.map +1 -1
  351. package/dist/domain/authentication.constants.d.ts +3 -0
  352. package/dist/domain/authentication.constants.js +11 -0
  353. package/dist/domain/authentication.constants.js.map +1 -0
  354. package/dist/domain/authentication.d.ts +3 -0
  355. package/dist/domain/authentication.js +22 -0
  356. package/dist/domain/authentication.js.map +1 -0
  357. package/dist/domain/authentication.types.d.ts +5 -0
  358. package/dist/domain/authentication.types.js +2 -0
  359. package/dist/domain/authentication.types.js.map +1 -0
  360. package/dist/domain/context.constants.d.ts +7 -0
  361. package/dist/domain/context.constants.js +8 -0
  362. package/dist/domain/context.constants.js.map +1 -0
  363. package/dist/domain/context.d.ts +4 -0
  364. package/dist/domain/context.js +81 -0
  365. package/dist/domain/context.js.map +1 -0
  366. package/dist/domain/context.types.d.ts +26 -0
  367. package/dist/domain/context.types.js +2 -0
  368. package/dist/domain/context.types.js.map +1 -0
  369. package/dist/domain/dispatch-telemetry.types.d.ts +12 -0
  370. package/dist/domain/dispatch-telemetry.types.js +2 -0
  371. package/dist/domain/dispatch-telemetry.types.js.map +1 -0
  372. package/dist/domain/errors.types.d.ts +1 -1
  373. package/dist/domain/errors.types.js.map +1 -1
  374. package/dist/domain/glob.d.ts +2 -0
  375. package/dist/domain/glob.js +25 -0
  376. package/dist/domain/glob.js.map +1 -0
  377. package/dist/domain/glob.types.d.ts +1 -0
  378. package/dist/domain/glob.types.js +2 -0
  379. package/dist/domain/glob.types.js.map +1 -0
  380. package/dist/domain/harness.constants.d.ts +11 -0
  381. package/dist/domain/harness.constants.js +24 -0
  382. package/dist/domain/harness.constants.js.map +1 -0
  383. package/dist/domain/harness.d.ts +2 -0
  384. package/dist/domain/harness.js +89 -0
  385. package/dist/domain/harness.js.map +1 -0
  386. package/dist/domain/harness.types.d.ts +60 -0
  387. package/dist/domain/harness.types.js +2 -0
  388. package/dist/domain/harness.types.js.map +1 -0
  389. package/dist/domain/hook.constants.d.ts +3 -0
  390. package/dist/domain/hook.constants.js +10 -0
  391. package/dist/domain/hook.constants.js.map +1 -0
  392. package/dist/domain/hook.d.ts +3 -0
  393. package/dist/domain/hook.js +25 -0
  394. package/dist/domain/hook.js.map +1 -0
  395. package/dist/domain/hook.types.d.ts +66 -0
  396. package/dist/domain/hook.types.js +2 -0
  397. package/dist/domain/hook.types.js.map +1 -0
  398. package/dist/domain/instructions.d.ts +3 -0
  399. package/dist/domain/instructions.js +25 -0
  400. package/dist/domain/instructions.js.map +1 -0
  401. package/dist/domain/model-messages.d.ts +5 -0
  402. package/dist/domain/model-messages.js +81 -0
  403. package/dist/domain/model-messages.js.map +1 -0
  404. package/dist/domain/model-messages.types.d.ts +6 -0
  405. package/dist/domain/model-messages.types.js +2 -0
  406. package/dist/domain/model-messages.types.js.map +1 -0
  407. package/dist/domain/model.constants.d.ts +4 -0
  408. package/dist/domain/model.constants.js +16 -0
  409. package/dist/domain/model.constants.js.map +1 -0
  410. package/dist/domain/model.types.d.ts +59 -2
  411. package/dist/domain/model.types.js.map +1 -1
  412. package/dist/domain/permissions.d.ts +3 -0
  413. package/dist/domain/permissions.js +92 -0
  414. package/dist/domain/permissions.js.map +1 -0
  415. package/dist/domain/permissions.types.d.ts +34 -0
  416. package/dist/domain/permissions.types.js +2 -0
  417. package/dist/domain/permissions.types.js.map +1 -0
  418. package/dist/domain/response.js +3 -2
  419. package/dist/domain/response.js.map +1 -1
  420. package/dist/domain/response.types.d.ts +12 -0
  421. package/dist/domain/response.types.js.map +1 -1
  422. package/dist/domain/skill.constants.d.ts +2 -0
  423. package/dist/domain/skill.constants.js +8 -0
  424. package/dist/domain/skill.constants.js.map +1 -0
  425. package/dist/domain/skill.d.ts +8 -0
  426. package/dist/domain/skill.js +79 -0
  427. package/dist/domain/skill.js.map +1 -0
  428. package/dist/domain/skill.types.d.ts +18 -0
  429. package/dist/domain/skill.types.js +2 -0
  430. package/dist/domain/skill.types.js.map +1 -0
  431. package/dist/domain/standard-schema.d.ts +6 -0
  432. package/dist/domain/standard-schema.js +45 -0
  433. package/dist/domain/standard-schema.js.map +1 -0
  434. package/dist/domain/tool-schema.d.ts +3 -0
  435. package/dist/domain/tool-schema.js +109 -0
  436. package/dist/domain/tool-schema.js.map +1 -0
  437. package/dist/domain/tool.constants.d.ts +4 -0
  438. package/dist/domain/tool.constants.js +36 -0
  439. package/dist/domain/tool.constants.js.map +1 -0
  440. package/dist/domain/tool.d.ts +4 -0
  441. package/dist/domain/tool.js +66 -0
  442. package/dist/domain/tool.js.map +1 -0
  443. package/dist/domain/tool.types.d.ts +62 -0
  444. package/dist/domain/tool.types.js +2 -0
  445. package/dist/domain/tool.types.js.map +1 -0
  446. package/dist/domain/transcript.d.ts +4 -0
  447. package/dist/domain/transcript.js +48 -0
  448. package/dist/domain/transcript.js.map +1 -0
  449. package/dist/domain/transcript.types.d.ts +15 -0
  450. package/dist/domain/transcript.types.js +2 -0
  451. package/dist/domain/transcript.types.js.map +1 -0
  452. package/dist/domain/workflow/workflow-state.js +13 -6
  453. package/dist/domain/workflow/workflow-state.js.map +1 -1
  454. package/dist/domain/workflow.d.ts +1 -1
  455. package/dist/domain/workflow.js.map +1 -1
  456. package/dist/domain/workflow.types.d.ts +4 -0
  457. package/dist/domain/workflow.types.js.map +1 -1
  458. package/dist/index.d.ts +35 -13
  459. package/dist/index.js +19 -6
  460. package/dist/index.js.map +1 -1
  461. package/dist/infrastructure/conversations/harness-store.d.ts +3 -0
  462. package/dist/infrastructure/conversations/harness-store.js +27 -0
  463. package/dist/infrastructure/conversations/harness-store.js.map +1 -0
  464. package/dist/infrastructure/conversations/harness-transcript.d.ts +2 -0
  465. package/dist/infrastructure/conversations/harness-transcript.js +50 -0
  466. package/dist/infrastructure/conversations/harness-transcript.js.map +1 -0
  467. package/dist/infrastructure/conversations/harness-transcript.types.d.ts +18 -0
  468. package/dist/infrastructure/conversations/harness-transcript.types.js +2 -0
  469. package/dist/infrastructure/conversations/harness-transcript.types.js.map +1 -0
  470. package/dist/infrastructure/conversations.d.ts +4 -1
  471. package/dist/infrastructure/conversations.js +3 -0
  472. package/dist/infrastructure/conversations.js.map +1 -1
  473. package/dist/infrastructure/conversations.types.d.ts +1 -0
  474. package/dist/infrastructure/conversations.types.js.map +1 -1
  475. package/dist/infrastructure/custom-reporter.d.ts +2 -0
  476. package/dist/infrastructure/custom-reporter.js +33 -0
  477. package/dist/infrastructure/custom-reporter.js.map +1 -0
  478. package/dist/infrastructure/custom-reporter.types.d.ts +13 -0
  479. package/dist/infrastructure/custom-reporter.types.js +2 -0
  480. package/dist/infrastructure/custom-reporter.types.js.map +1 -0
  481. package/dist/infrastructure/git/git.constants.d.ts +1 -1
  482. package/dist/infrastructure/git/git.constants.js +2 -0
  483. package/dist/infrastructure/git/git.constants.js.map +1 -1
  484. package/dist/infrastructure/host-credentials.constants.d.ts +1 -0
  485. package/dist/infrastructure/host-credentials.constants.js +2 -0
  486. package/dist/infrastructure/host-credentials.constants.js.map +1 -0
  487. package/dist/infrastructure/host-credentials.d.ts +4 -0
  488. package/dist/infrastructure/host-credentials.js +89 -0
  489. package/dist/infrastructure/host-credentials.js.map +1 -0
  490. package/dist/infrastructure/inspection-path.js +4 -3
  491. package/dist/infrastructure/inspection-path.js.map +1 -1
  492. package/dist/infrastructure/journal.constants.d.ts +1 -0
  493. package/dist/infrastructure/journal.constants.js +2 -0
  494. package/dist/infrastructure/journal.constants.js.map +1 -0
  495. package/dist/infrastructure/journal.js +7 -71
  496. package/dist/infrastructure/journal.js.map +1 -1
  497. package/dist/infrastructure/journal.types.d.ts +0 -2
  498. package/dist/infrastructure/journal.types.js.map +1 -1
  499. package/dist/infrastructure/local-transport.js +9 -4
  500. package/dist/infrastructure/local-transport.js.map +1 -1
  501. package/dist/infrastructure/opentelemetry-dispatch.d.ts +6 -0
  502. package/dist/infrastructure/opentelemetry-dispatch.js +70 -0
  503. package/dist/infrastructure/opentelemetry-dispatch.js.map +1 -0
  504. package/dist/infrastructure/opentelemetry.constants.d.ts +3 -0
  505. package/dist/infrastructure/opentelemetry.constants.js +3 -0
  506. package/dist/infrastructure/opentelemetry.constants.js.map +1 -1
  507. package/dist/infrastructure/opentelemetry.js +4 -0
  508. package/dist/infrastructure/opentelemetry.js.map +1 -1
  509. package/dist/infrastructure/opentelemetry.types.d.ts +3 -3
  510. package/dist/infrastructure/opentelemetry.types.js.map +1 -1
  511. package/dist/infrastructure/reporter.js +27 -2
  512. package/dist/infrastructure/reporter.js.map +1 -1
  513. package/dist/infrastructure/repository-transport.constants.d.ts +1 -0
  514. package/dist/infrastructure/repository-transport.constants.js +2 -0
  515. package/dist/infrastructure/repository-transport.constants.js.map +1 -0
  516. package/dist/infrastructure/repository-transport.d.ts +2 -0
  517. package/dist/infrastructure/repository-transport.js +9 -0
  518. package/dist/infrastructure/repository-transport.js.map +1 -0
  519. package/dist/infrastructure/resource-activity-inspection.js +22 -26
  520. package/dist/infrastructure/resource-activity-inspection.js.map +1 -1
  521. package/dist/infrastructure/resource-activity.constants.d.ts +0 -1
  522. package/dist/infrastructure/resource-activity.constants.js +0 -1
  523. package/dist/infrastructure/resource-activity.constants.js.map +1 -1
  524. package/dist/infrastructure/resource-activity.js +22 -85
  525. package/dist/infrastructure/resource-activity.js.map +1 -1
  526. package/dist/infrastructure/resource-activity.types.d.ts +2 -2
  527. package/dist/infrastructure/resource-activity.types.js.map +1 -1
  528. package/dist/infrastructure/settings.d.ts +1 -1
  529. package/dist/infrastructure/settings.js +3 -3
  530. package/dist/infrastructure/settings.js.map +1 -1
  531. package/dist/infrastructure/sse.d.ts +2 -0
  532. package/dist/infrastructure/sse.js +64 -0
  533. package/dist/infrastructure/sse.js.map +1 -0
  534. package/dist/infrastructure/sse.types.d.ts +4 -0
  535. package/dist/infrastructure/sse.types.js +2 -0
  536. package/dist/infrastructure/sse.types.js.map +1 -0
  537. package/dist/infrastructure/storage-inventory.constants.js +1 -0
  538. package/dist/infrastructure/storage-inventory.constants.js.map +1 -1
  539. package/dist/infrastructure/storage-inventory.types.d.ts +1 -1
  540. package/dist/infrastructure/storage-inventory.types.js.map +1 -1
  541. package/dist/infrastructure/storage-reservations.types.d.ts +0 -8
  542. package/dist/infrastructure/storage-reservations.types.js.map +1 -1
  543. package/dist/infrastructure/transport-conversations.d.ts +2 -2
  544. package/dist/infrastructure/transport-conversations.js +8 -1
  545. package/dist/infrastructure/transport-conversations.js.map +1 -1
  546. package/dist/infrastructure/transport-journal.js +2 -1
  547. package/dist/infrastructure/transport-journal.js.map +1 -1
  548. package/dist/infrastructure/transport-reservations.d.ts +1 -1
  549. package/dist/infrastructure/transport-reservations.js +14 -8
  550. package/dist/infrastructure/transport-reservations.js.map +1 -1
  551. package/dist/providers/agents.d.ts +9 -4
  552. package/dist/providers/agents.js +6 -3
  553. package/dist/providers/agents.js.map +1 -1
  554. package/dist/providers/daytona.d.ts +1 -1
  555. package/dist/providers/daytona.js +1 -1
  556. package/dist/providers/daytona.js.map +1 -1
  557. package/dist/providers/docker.d.ts +1 -1
  558. package/dist/providers/docker.js +1 -1
  559. package/dist/providers/docker.js.map +1 -1
  560. package/dist/providers/factories.d.ts +2 -2
  561. package/dist/providers/factories.js +3 -3
  562. package/dist/providers/factories.js.map +1 -1
  563. package/dist/providers/firecracker.d.ts +1 -1
  564. package/dist/providers/firecracker.js +1 -1
  565. package/dist/providers/firecracker.js.map +1 -1
  566. package/dist/providers/local.d.ts +1 -1
  567. package/dist/providers/local.js +1 -1
  568. package/dist/providers/local.js.map +1 -1
  569. package/dist/providers/podman.d.ts +1 -1
  570. package/dist/providers/podman.js +1 -1
  571. package/dist/providers/podman.js.map +1 -1
  572. package/dist/providers/vercel.d.ts +1 -1
  573. package/dist/providers/vercel.js +1 -1
  574. package/dist/providers/vercel.js.map +1 -1
  575. package/dist/providers/versions.constants.d.ts +3 -1
  576. package/dist/providers/versions.constants.js +3 -1
  577. package/dist/providers/versions.constants.js.map +1 -1
  578. package/package.json +3 -3
  579. package/dist/adapters/agents/gemini-adapter.d.ts +0 -3
  580. package/dist/adapters/agents/gemini-adapter.js +0 -15
  581. package/dist/adapters/agents/gemini-adapter.js.map +0 -1
  582. package/dist/adapters/agents/gemini-diagnostics.d.ts +0 -2
  583. package/dist/adapters/agents/gemini-diagnostics.js +0 -15
  584. package/dist/adapters/agents/gemini-diagnostics.js.map +0 -1
  585. package/dist/adapters/agents/gemini-events.d.ts +0 -2
  586. package/dist/adapters/agents/gemini-events.js +0 -50
  587. package/dist/adapters/agents/gemini-events.js.map +0 -1
  588. package/dist/adapters/agents/gemini-request.d.ts +0 -4
  589. package/dist/adapters/agents/gemini-request.js +0 -23
  590. package/dist/adapters/agents/gemini-request.js.map +0 -1
  591. package/dist/adapters/agents/gemini.types.d.ts +0 -6
  592. package/dist/adapters/agents/gemini.types.js +0 -2
  593. package/dist/adapters/agents/gemini.types.js.map +0 -1
  594. package/dist/adapters/models/openai-compatible.constants.js.map +0 -1
  595. package/dist/adapters/models/openai-compatible.d.ts +0 -3
  596. package/dist/adapters/models/openai-compatible.js +0 -78
  597. package/dist/adapters/models/openai-compatible.js.map +0 -1
  598. package/dist/adapters/models/openai-compatible.types.d.ts +0 -14
  599. package/dist/adapters/models/openai-compatible.types.js +0 -2
  600. package/dist/adapters/models/openai-compatible.types.js.map +0 -1
  601. package/dist/adapters/models/openai-http.js.map +0 -1
  602. package/dist/adapters/models/openai-request.d.ts +0 -4
  603. package/dist/adapters/models/openai-request.js +0 -46
  604. package/dist/adapters/models/openai-request.js.map +0 -1
  605. package/dist/adapters/models/openai-response.d.ts +0 -3
  606. package/dist/adapters/models/openai-response.js +0 -65
  607. package/dist/adapters/models/openai-response.js.map +0 -1
  608. package/dist/cli/init-authentication.constants.d.ts +0 -13
  609. package/dist/cli/init-authentication.constants.js +0 -10
  610. package/dist/cli/init-authentication.constants.js.map +0 -1
  611. package/dist/infrastructure/artifact-store.d.ts +0 -3
  612. package/dist/infrastructure/artifact-store.js +0 -110
  613. package/dist/infrastructure/artifact-store.js.map +0 -1
  614. package/dist/infrastructure/artifact-store.types.d.ts +0 -6
  615. package/dist/infrastructure/artifact-store.types.js +0 -2
  616. package/dist/infrastructure/artifact-store.types.js.map +0 -1
  617. package/dist/infrastructure/journal-retention.constants.d.ts +0 -4
  618. package/dist/infrastructure/journal-retention.constants.js +0 -5
  619. package/dist/infrastructure/journal-retention.constants.js.map +0 -1
  620. package/dist/infrastructure/journal-retention.d.ts +0 -2
  621. package/dist/infrastructure/journal-retention.js +0 -51
  622. package/dist/infrastructure/journal-retention.js.map +0 -1
  623. package/dist/infrastructure/storage-mutation-lock.constants.d.ts +0 -5
  624. package/dist/infrastructure/storage-mutation-lock.constants.js +0 -6
  625. package/dist/infrastructure/storage-mutation-lock.constants.js.map +0 -1
  626. package/dist/infrastructure/storage-mutation-lock.d.ts +0 -1
  627. package/dist/infrastructure/storage-mutation-lock.js +0 -21
  628. package/dist/infrastructure/storage-mutation-lock.js.map +0 -1
  629. package/dist/infrastructure/storage-reservations.constants.d.ts +0 -4
  630. package/dist/infrastructure/storage-reservations.constants.js +0 -5
  631. package/dist/infrastructure/storage-reservations.constants.js.map +0 -1
  632. package/dist/infrastructure/storage-reservations.d.ts +0 -2
  633. package/dist/infrastructure/storage-reservations.js +0 -150
  634. package/dist/infrastructure/storage-reservations.js.map +0 -1
  635. package/dist/infrastructure/workflow-checkpoint.d.ts +0 -3
  636. package/dist/infrastructure/workflow-checkpoint.js +0 -84
  637. package/dist/infrastructure/workflow-checkpoint.js.map +0 -1
  638. package/dist/infrastructure/workflow-checkpoint.types.d.ts +0 -6
  639. package/dist/infrastructure/workflow-checkpoint.types.js +0 -2
  640. package/dist/infrastructure/workflow-checkpoint.types.js.map +0 -1
  641. /package/dist/adapters/models/{openai-http.d.ts → model-http.d.ts} +0 -0
  642. /package/dist/adapters/models/{openai-compatible.constants.d.ts → model.constants.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"openai-response.js","sourceRoot":"","sources":["../../../src/adapters/models/openai-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAItD,SAAS,eAAe,CAAC,SAAkB;IACzC,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,YAAY,CAAC,UAAU,EAAE,uCAAuC,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,eAAe,CACb,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CACrE,CAAC;IACF,OAA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,SAAS;YACrB,IAAI,CAAC,IAAI,KAAK,WAAW;YACzB,IAAI,CAAC,MAAM,KAAK,WAAW,CAC9B,CAAC;QACF,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3B,eAAe,CACb,IAAI,CAAC,IAAI,KAAK,aAAa,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAC7D,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,KAAK,CACpB,IAAI,CAAC,KAAK,EACV,cAAc,EACd,eAAe,EACf,sBAAsB,CACvB,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import { OutpostError } from \"../../domain/errors.ts\";\nimport type { ModelResult } from \"../../domain/model.types.ts\";\nimport type { Usage } from \"../../domain/agent.types.ts\";\n\nfunction requireResponse(condition: unknown): asserts condition {\n if (!condition)\n throw new OutpostError(\"response\", \"Invalid or unsupported model response\");\n}\n\nfunction object(value: unknown): Record<string, unknown> {\n requireResponse(\n value !== null && typeof value === \"object\" && !Array.isArray(value),\n );\n return value as Record<string, unknown>;\n}\n\nfunction tokens(value: unknown): number {\n requireResponse(\n typeof value === \"number\" && Number.isSafeInteger(value) && value >= 0,\n );\n return value;\n}\n\nfunction usage(\n value: unknown,\n input: string,\n output: string,\n details: string,\n): Usage | undefined {\n if (value === undefined || value === null) return undefined;\n const data = object(value);\n const cached =\n data[details] == null\n ? 0\n : tokens(object(data[details]).cached_tokens ?? 0);\n const result = {\n input: tokens(data[input]),\n output: tokens(data[output]),\n cached,\n };\n requireResponse(cached <= result.input);\n return result;\n}\n\nexport function readChatCompletion(value: unknown): ModelResult {\n const data = object(value);\n requireResponse(Array.isArray(data.choices) && data.choices.length === 1);\n const choice = object(data.choices[0]);\n requireResponse(choice.finish_reason === \"stop\");\n const message = object(choice.message);\n requireResponse(\n message.role === \"assistant\" && typeof message.content === \"string\",\n );\n requireResponse(message.refusal == null && message.function_call == null);\n requireResponse(\n message.tool_calls == null ||\n (Array.isArray(message.tool_calls) && message.tool_calls.length === 0),\n );\n const reported = usage(\n data.usage,\n \"prompt_tokens\",\n \"completion_tokens\",\n \"prompt_tokens_details\",\n );\n return { text: message.content, ...(reported ? { usage: reported } : {}) };\n}\n\nexport function readModelResponse(value: unknown): ModelResult {\n const data = object(value);\n requireResponse(data.status === \"completed\" && data.error == null);\n requireResponse(Array.isArray(data.output));\n const texts: string[] = [];\n for (const value of data.output) {\n const item = object(value);\n if (item.type === \"reasoning\") continue;\n requireResponse(\n item.type === \"message\" &&\n item.role === \"assistant\" &&\n item.status === \"completed\",\n );\n requireResponse(Array.isArray(item.content));\n for (const value of item.content) {\n const part = object(value);\n requireResponse(\n part.type === \"output_text\" && typeof part.text === \"string\",\n );\n texts.push(part.text);\n }\n }\n requireResponse(texts.length > 0);\n const reported = usage(\n data.usage,\n \"input_tokens\",\n \"output_tokens\",\n \"input_tokens_details\",\n );\n return { text: texts.join(\"\"), ...(reported ? { usage: reported } : {}) };\n}\n"]}
@@ -1,13 +0,0 @@
1
- export declare const authenticationRecipes: {
2
- readonly codex: {
3
- readonly environment: "OPENAI_API_KEY=\n";
4
- readonly login: "const {spawnSync}=require(\"node:child_process\"); const {existsSync}=require(\"node:fs\"); const {join}=require(\"node:path\"); const {homedir}=require(\"node:os\"); const installed=join(homedir(),\".outpost-tools\",\"bin\",\"codex\"); const result=spawnSync(existsSync(installed)?installed:\"codex\",[\"login\",\"--with-api-key\"],{stdio:\"inherit\",shell:process.platform===\"win32\"}); process.exit(result.status ?? 1);";
5
- readonly seed: "const {mkdirSync,writeFileSync,readFileSync,chmodSync}=require(\"node:fs\"); const {join}=require(\"node:path\"); const {homedir}=require(\"node:os\"); const directory=join(homedir(),\".codex\"); mkdirSync(directory,{recursive:true,mode:0o700}); const target=join(directory,\"auth.json\"); writeFileSync(target,readFileSync(0),{mode:0o600}); chmodSync(target,0o600);";
6
- };
7
- readonly claude: {
8
- readonly environment: "ANTHROPIC_API_KEY=\n";
9
- };
10
- readonly gemini: {
11
- readonly environment: "GEMINI_API_KEY=\n";
12
- };
13
- };
@@ -1,10 +0,0 @@
1
- export const authenticationRecipes = {
2
- codex: {
3
- environment: "OPENAI_API_KEY=\n",
4
- login: 'const {spawnSync}=require("node:child_process"); const {existsSync}=require("node:fs"); const {join}=require("node:path"); const {homedir}=require("node:os"); const installed=join(homedir(),".outpost-tools","bin","codex"); const result=spawnSync(existsSync(installed)?installed:"codex",["login","--with-api-key"],{stdio:"inherit",shell:process.platform==="win32"}); process.exit(result.status ?? 1);',
5
- seed: 'const {mkdirSync,writeFileSync,readFileSync,chmodSync}=require("node:fs"); const {join}=require("node:path"); const {homedir}=require("node:os"); const directory=join(homedir(),".codex"); mkdirSync(directory,{recursive:true,mode:0o700}); const target=join(directory,"auth.json"); writeFileSync(target,readFileSync(0),{mode:0o600}); chmodSync(target,0o600);',
6
- },
7
- claude: { environment: "ANTHROPIC_API_KEY=\n" },
8
- gemini: { environment: "GEMINI_API_KEY=\n" },
9
- };
10
- //# sourceMappingURL=init-authentication.constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-authentication.constants.js","sourceRoot":"","sources":["../../src/cli/init-authentication.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE;QACL,WAAW,EAAE,mBAAmB;QAChC,KAAK,EACH,iZAAiZ;QACnZ,IAAI,EAAE,sWAAsW;KAC7W;IACD,MAAM,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE;IAC/C,MAAM,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE;CACpC,CAAC","sourcesContent":["export const authenticationRecipes = {\n codex: {\n environment: \"OPENAI_API_KEY=\\n\",\n login:\n 'const {spawnSync}=require(\"node:child_process\"); const {existsSync}=require(\"node:fs\"); const {join}=require(\"node:path\"); const {homedir}=require(\"node:os\"); const installed=join(homedir(),\".outpost-tools\",\"bin\",\"codex\"); const result=spawnSync(existsSync(installed)?installed:\"codex\",[\"login\",\"--with-api-key\"],{stdio:\"inherit\",shell:process.platform===\"win32\"}); process.exit(result.status ?? 1);',\n seed: 'const {mkdirSync,writeFileSync,readFileSync,chmodSync}=require(\"node:fs\"); const {join}=require(\"node:path\"); const {homedir}=require(\"node:os\"); const directory=join(homedir(),\".codex\"); mkdirSync(directory,{recursive:true,mode:0o700}); const target=join(directory,\"auth.json\"); writeFileSync(target,readFileSync(0),{mode:0o600}); chmodSync(target,0o600);',\n },\n claude: { environment: \"ANTHROPIC_API_KEY=\\n\" },\n gemini: { environment: \"GEMINI_API_KEY=\\n\" },\n} as const;\n"]}
@@ -1,3 +0,0 @@
1
- import type { ArtifactStore } from "../domain/artifact.types.ts";
2
- import type { FileArtifactStoreOptions } from "./artifact-store.types.ts";
3
- export declare function fileArtifactStore(options: FileArtifactStoreOptions): ArtifactStore;
@@ -1,110 +0,0 @@
1
- import { artifactStore } from "./transport-artifact-store.js";
2
- import { artifactDigestPattern } from "../domain/artifact.constants.js";
3
- import { randomUUID } from "node:crypto";
4
- import { link, lstat, mkdir, open, rm } from "node:fs/promises";
5
- import { dirname, join, resolve } from "node:path";
6
- import { readInspectionFile } from "./inspection-file.js";
7
- import { artifactMaxBytes } from "./artifact-store.constants.js";
8
- async function directory(path) {
9
- const parent = dirname(path);
10
- if (parent !== path) {
11
- await directory(parent);
12
- try {
13
- await mkdir(path, { mode: 0o700 });
14
- }
15
- catch (error) {
16
- if (!code(error, "EEXIST"))
17
- throw error;
18
- }
19
- }
20
- if (!(await lstat(path)).isDirectory())
21
- throw new Error("Artifact directory must not contain symlinks");
22
- }
23
- function code(error, expected) {
24
- return (!!error &&
25
- typeof error === "object" &&
26
- "code" in error &&
27
- error.code === expected);
28
- }
29
- async function readArtifactFile(path, maxBytes) {
30
- try {
31
- return await readInspectionFile(path, maxBytes);
32
- }
33
- catch (error) {
34
- if (!(error instanceof Error) ||
35
- error.message !== "Inspection file changed")
36
- throw error;
37
- // Removing the staging hard link can change ctime once after publication.
38
- return readInspectionFile(path, maxBytes);
39
- }
40
- }
41
- export function fileArtifactStore(options) {
42
- if ((options.directory === undefined) === (options.transporter === undefined))
43
- throw new Error("Provide exactly one artifact directory or transporter");
44
- if (options.transporter)
45
- return artifactStore({
46
- transporter: options.transporter,
47
- ...(options.maxBytes === undefined ? {} : { maxBytes: options.maxBytes }),
48
- });
49
- if (options.directory === undefined)
50
- throw new Error("Artifact directory is required");
51
- const root = resolve(options.directory), maxBytes = options.maxBytes ?? artifactMaxBytes;
52
- if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
53
- throw new Error("Artifact maxBytes must be a positive safe integer");
54
- const path = (id) => {
55
- if (!artifactDigestPattern.test(id))
56
- throw new Error("Invalid artifact storage ID");
57
- return join(root, `${id}.blob`);
58
- };
59
- return {
60
- async put(id, input, signal) {
61
- signal?.throwIfAborted();
62
- const target = path(id);
63
- if (input.byteLength > maxBytes)
64
- throw new Error("Artifact exceeds maxBytes");
65
- const bytes = Buffer.from(input);
66
- await directory(root);
67
- const temporary = join(root, `.${randomUUID()}.tmp`);
68
- try {
69
- const file = await open(temporary, "wx", 0o600);
70
- try {
71
- await file.writeFile(bytes, signal ? { signal } : {});
72
- await file.sync();
73
- }
74
- finally {
75
- await file.close();
76
- }
77
- signal?.throwIfAborted();
78
- try {
79
- await link(temporary, target);
80
- }
81
- catch (error) {
82
- if (!code(error, "EEXIST"))
83
- throw error;
84
- if (!bytes.equals(await readArtifactFile(target, maxBytes)))
85
- throw new Error("Existing artifact content integrity mismatch");
86
- }
87
- if (process.platform !== "win32") {
88
- const parent = await open(root, "r");
89
- try {
90
- await parent.sync();
91
- }
92
- finally {
93
- await parent.close();
94
- }
95
- }
96
- }
97
- finally {
98
- await rm(temporary, { force: true });
99
- }
100
- },
101
- async get(id, signal) {
102
- signal?.throwIfAborted();
103
- const target = path(id);
104
- const bytes = await readArtifactFile(target, maxBytes);
105
- signal?.throwIfAborted();
106
- return bytes;
107
- },
108
- };
109
- }
110
- //# sourceMappingURL=artifact-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-store.js","sourceRoot":"","sources":["../../src/infrastructure/artifact-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CA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AgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACvD,MAAM,EAAE,cAAc,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { artifactStore } from \"./transport-artifact-store.ts\";\nimport { artifactDigestPattern } from \"../domain/artifact.constants.ts\";\nimport { randomUUID } from \"node:crypto\";\nimport { link, lstat, mkdir, open, rm } from \"node:fs/promises\";\nimport { dirname, join, resolve } from \"node:path\";\nimport type { ArtifactStore } from \"../domain/artifact.types.ts\";\nimport { readInspectionFile } from \"./inspection-file.ts\";\nimport { artifactMaxBytes } from \"./artifact-store.constants.ts\";\nimport type { FileArtifactStoreOptions } from \"./artifact-store.types.ts\";\n\nasync function directory(path: string): Promise<void> {\n const parent = dirname(path);\n if (parent !== path) {\n await directory(parent);\n try {\n await mkdir(path, { mode: 0o700 });\n } catch (error) {\n if (!code(error, \"EEXIST\")) throw error;\n }\n }\n if (!(await lstat(path)).isDirectory())\n throw new Error(\"Artifact directory must not contain symlinks\");\n}\n\nfunction code(error: unknown, expected: string): boolean {\n return (\n !!error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n error.code === expected\n );\n}\n\nasync function readArtifactFile(\n path: string,\n maxBytes: number,\n): Promise<Buffer> {\n try {\n return await readInspectionFile(path, maxBytes);\n } catch (error) {\n if (\n !(error instanceof Error) ||\n error.message !== \"Inspection file changed\"\n )\n throw error;\n // Removing the staging hard link can change ctime once after publication.\n return readInspectionFile(path, maxBytes);\n }\n}\n\nexport function fileArtifactStore(\n options: FileArtifactStoreOptions,\n): ArtifactStore {\n if ((options.directory === undefined) === (options.transporter === undefined))\n throw new Error(\"Provide exactly one artifact directory or transporter\");\n if (options.transporter)\n return artifactStore({\n transporter: options.transporter,\n ...(options.maxBytes === undefined ? {} : { maxBytes: options.maxBytes }),\n });\n if (options.directory === undefined)\n throw new Error(\"Artifact directory is required\");\n const root = resolve(options.directory),\n maxBytes = options.maxBytes ?? artifactMaxBytes;\n if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)\n throw new Error(\"Artifact maxBytes must be a positive safe integer\");\n const path = (id: string) => {\n if (!artifactDigestPattern.test(id))\n throw new Error(\"Invalid artifact storage ID\");\n return join(root, `${id}.blob`);\n };\n return {\n async put(id, input, signal) {\n signal?.throwIfAborted();\n const target = path(id);\n if (input.byteLength > maxBytes)\n throw new Error(\"Artifact exceeds maxBytes\");\n const bytes = Buffer.from(input);\n await directory(root);\n const temporary = join(root, `.${randomUUID()}.tmp`);\n try {\n const file = await open(temporary, \"wx\", 0o600);\n try {\n await file.writeFile(bytes, signal ? { signal } : {});\n await file.sync();\n } finally {\n await file.close();\n }\n signal?.throwIfAborted();\n try {\n await link(temporary, target);\n } catch (error) {\n if (!code(error, \"EEXIST\")) throw error;\n if (!bytes.equals(await readArtifactFile(target, maxBytes)))\n throw new Error(\"Existing artifact content integrity mismatch\");\n }\n if (process.platform !== \"win32\") {\n const parent = await open(root, \"r\");\n try {\n await parent.sync();\n } finally {\n await parent.close();\n }\n }\n } finally {\n await rm(temporary, { force: true });\n }\n },\n async get(id, signal) {\n signal?.throwIfAborted();\n const target = path(id);\n const bytes = await readArtifactFile(target, maxBytes);\n signal?.throwIfAborted();\n return bytes;\n },\n };\n}\n"]}
@@ -1,6 +0,0 @@
1
- import type { Transport } from "../domain/transport.types.ts";
2
- export interface FileArtifactStoreOptions {
3
- readonly directory?: string;
4
- readonly transporter?: Transport;
5
- readonly maxBytes?: number;
6
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=artifact-store.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-store.types.js","sourceRoot":"","sources":["../../src/infrastructure/artifact-store.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Transport } from \"../domain/transport.types.ts\";\n\nexport interface FileArtifactStoreOptions {\n readonly directory?: string;\n readonly transporter?: Transport;\n readonly maxBytes?: number;\n}\n"]}
@@ -1,4 +0,0 @@
1
- export declare const journalRetentionLimits: {
2
- readonly maxMarkerBytes: 4096;
3
- readonly maxLogBytes: 1073741824;
4
- };
@@ -1,5 +0,0 @@
1
- export const journalRetentionLimits = {
2
- maxMarkerBytes: 4096,
3
- maxLogBytes: 1_073_741_824,
4
- };
5
- //# sourceMappingURL=journal-retention.constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-retention.constants.js","sourceRoot":"","sources":["../../src/infrastructure/journal-retention.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,aAAa;CAClB,CAAC","sourcesContent":["export const journalRetentionLimits = {\n maxMarkerBytes: 4096,\n maxLogBytes: 1_073_741_824,\n} as const;\n"]}
@@ -1,2 +0,0 @@
1
- export declare function markJournalClosed(file: string): Promise<void>;
2
- export declare function closedJournal(file: string): Promise<boolean>;
@@ -1,51 +0,0 @@
1
- import { journalRetentionLimits } from "./journal-retention.constants.js";
2
- import { lstat, writeFile } from "node:fs/promises";
3
- import { hashInspectionEntry } from "./inspection-hash.js";
4
- import { readInspectionFile } from "./inspection-file.js";
5
- export async function markJournalClosed(file) {
6
- const info = await lstat(file);
7
- const fingerprint = await hashInspectionEntry(file);
8
- await writeFile(`${file}.closed.json`, JSON.stringify({
9
- version: 1,
10
- closedAt: new Date().toISOString(),
11
- dev: info.dev,
12
- ino: info.ino,
13
- mtimeMs: info.mtimeMs,
14
- ctimeMs: info.ctimeMs,
15
- ...fingerprint,
16
- }), { flag: "wx", mode: 0o600 });
17
- }
18
- export async function closedJournal(file) {
19
- try {
20
- const record = JSON.parse((await readInspectionFile(`${file}.closed.json`, journalRetentionLimits.maxMarkerBytes)).toString("utf8"));
21
- if (!record ||
22
- typeof record !== "object" ||
23
- !("version" in record) ||
24
- record.version !== 1 ||
25
- !("closedAt" in record) ||
26
- typeof record.closedAt !== "string" ||
27
- !Number.isFinite(Date.parse(record.closedAt)) ||
28
- !("kind" in record) ||
29
- record.kind !== "file" ||
30
- !("bytes" in record) ||
31
- typeof record.bytes !== "number" ||
32
- !Number.isSafeInteger(record.bytes) ||
33
- record.bytes < 0 ||
34
- !("sha256" in record) ||
35
- typeof record.sha256 !== "string" ||
36
- !/^[a-f0-9]{64}$/.test(record.sha256))
37
- return false;
38
- const info = await lstat(file);
39
- for (const key of ["dev", "ino", "mtimeMs", "ctimeMs"])
40
- if (Object.getOwnPropertyDescriptor(record, key)?.value !== info[key])
41
- return false;
42
- const current = await hashInspectionEntry(file, journalRetentionLimits.maxLogBytes);
43
- return (current.kind === "file" &&
44
- current.bytes === record.bytes &&
45
- current.sha256 === record.sha256);
46
- }
47
- catch {
48
- return false;
49
- }
50
- }
51
- //# sourceMappingURL=journal-retention.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-retention.js","sourceRoot":"","sources":["../../src/infrastructure/journal-retention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAClD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,SAAS,CACb,GAAG,IAAI,cAAc,EACrB,IAAI,CAAC,SAAS,CAAC;QACb,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAClC,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;QACr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AE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAU;YAC7D,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC;gBACnE,OAAO,KAAK,CAAC;QACjB,MAAM,OAAO,GAAG,MAAM,mBAAmB,CACvC,IAAI,EACJ,sBAAsB,CAAC,WAAW,CACnC,CAAC;QACF,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,MAAM;YACvB,OAAO,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK;YAC9B,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CACjC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import { journalRetentionLimits } from \"./journal-retention.constants.ts\";\nimport { lstat, writeFile } from \"node:fs/promises\";\nimport { hashInspectionEntry } from \"./inspection-hash.ts\";\nimport { readInspectionFile } from \"./inspection-file.ts\";\n\nexport async function markJournalClosed(file: string): Promise<void> {\n const info = await lstat(file);\n const fingerprint = await hashInspectionEntry(file);\n await writeFile(\n `${file}.closed.json`,\n JSON.stringify({\n version: 1,\n closedAt: new Date().toISOString(),\n dev: info.dev,\n ino: info.ino,\n mtimeMs: info.mtimeMs,\n ctimeMs: info.ctimeMs,\n ...fingerprint,\n }),\n { flag: \"wx\", mode: 0o600 },\n );\n}\n\nexport async function closedJournal(file: string): Promise<boolean> {\n try {\n const record: unknown = JSON.parse(\n (\n await readInspectionFile(\n `${file}.closed.json`,\n journalRetentionLimits.maxMarkerBytes,\n )\n ).toString(\"utf8\"),\n );\n if (\n !record ||\n typeof record !== \"object\" ||\n !(\"version\" in record) ||\n record.version !== 1 ||\n !(\"closedAt\" in record) ||\n typeof record.closedAt !== \"string\" ||\n !Number.isFinite(Date.parse(record.closedAt)) ||\n !(\"kind\" in record) ||\n record.kind !== \"file\" ||\n !(\"bytes\" in record) ||\n typeof record.bytes !== \"number\" ||\n !Number.isSafeInteger(record.bytes) ||\n record.bytes < 0 ||\n !(\"sha256\" in record) ||\n typeof record.sha256 !== \"string\" ||\n !/^[a-f0-9]{64}$/.test(record.sha256)\n )\n return false;\n const info = await lstat(file);\n for (const key of [\"dev\", \"ino\", \"mtimeMs\", \"ctimeMs\"] as const)\n if (Object.getOwnPropertyDescriptor(record, key)?.value !== info[key])\n return false;\n const current = await hashInspectionEntry(\n file,\n journalRetentionLimits.maxLogBytes,\n );\n return (\n current.kind === \"file\" &&\n current.bytes === record.bytes &&\n current.sha256 === record.sha256\n );\n } catch {\n return false;\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare const storageMutationLockDefaults: {
2
- readonly lockKey: "storage-reservations:v1";
3
- readonly lockWaitMs: 5000;
4
- readonly lockPollMs: 20;
5
- };
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- export declare function lockStorageMutation(root: string, signal?: AbortSignal): Promise<() => Promise<void>>;
@@ -1,21 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,4 +0,0 @@
1
- export declare const storageReservationDefaults: {
2
- readonly maxRecordBytes: 4096;
3
- readonly maxRecords: 10000;
4
- };
@@ -1,5 +0,0 @@
1
- export const storageReservationDefaults = {
2
- maxRecordBytes: 4_096,
3
- maxRecords: 10_000,
4
- };
5
- //# sourceMappingURL=storage-reservations.constants.js.map
@@ -1 +0,0 @@
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"]}
@@ -1,2 +0,0 @@
1
- import type { StorageReservation, StorageReservationOptions } from "./storage-reservations.types.ts";
2
- export declare function reserveStorage(repository: string, options: StorageReservationOptions): Promise<StorageReservation>;
@@ -1,150 +0,0 @@
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
@@ -1 +0,0 @@
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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KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAChC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;YAAS,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"]}
@@ -1,3 +0,0 @@
1
- import type { WorkflowCheckpointStore } from "../domain/workflow/checkpoint.types.ts";
2
- import type { FileWorkflowCheckpointOptions } from "./workflow-checkpoint.types.ts";
3
- export declare function fileWorkflowCheckpointStore(options: FileWorkflowCheckpointOptions): WorkflowCheckpointStore;
@@ -1,84 +0,0 @@
1
- import { workflowCheckpointStore } from "./transport-checkpoint.js";
2
- import { readInspectionFile } from "./inspection-file.js";
3
- import { workflowCheckpointMaxBytes } from "./workflow-checkpoint.constants.js";
4
- import { createHash, randomUUID } from "node:crypto";
5
- import { mkdir, open, realpath, rename, rm } from "node:fs/promises";
6
- import { join, resolve } from "node:path";
7
- import { lock } from "./git/lock.js";
8
- export function fileWorkflowCheckpointStore(options) {
9
- if ((options.directory === undefined) === (options.transporter === undefined))
10
- throw new Error("Provide exactly one checkpoint directory or transporter");
11
- if (options.transporter)
12
- return workflowCheckpointStore({ transporter: options.transporter });
13
- if (options.directory === undefined)
14
- throw new Error("Checkpoint directory is required");
15
- const configuredDirectory = resolve(options.directory);
16
- return {
17
- async acquire(runId) {
18
- if (!runId.trim())
19
- throw new Error("Checkpoint runId must not be empty");
20
- await mkdir(configuredDirectory, { recursive: true, mode: 0o700 });
21
- const directory = await realpath(configuredDirectory);
22
- const release = await lock(directory, `workflow:${runId}`);
23
- const path = join(directory, `${createHash("sha256").update(runId).digest("hex")}.json`);
24
- let released = false;
25
- const assertOwned = () => {
26
- if (released)
27
- throw new Error("Checkpoint lease has been released");
28
- };
29
- return {
30
- async read() {
31
- assertOwned();
32
- try {
33
- return JSON.parse((await readInspectionFile(path, workflowCheckpointMaxBytes)).toString("utf8"));
34
- }
35
- catch (error) {
36
- if (error &&
37
- typeof error === "object" &&
38
- "code" in error &&
39
- error.code === "ENOENT")
40
- return undefined;
41
- throw error;
42
- }
43
- },
44
- async write(checkpoint) {
45
- assertOwned();
46
- const data = JSON.stringify(checkpoint);
47
- if (Buffer.byteLength(data) > workflowCheckpointMaxBytes)
48
- throw new Error("Workflow checkpoint exceeds 16 MiB; store large artifacts separately");
49
- const temporary = `${path}.${randomUUID()}.tmp`;
50
- try {
51
- const file = await open(temporary, "wx", 0o600);
52
- try {
53
- await file.writeFile(data);
54
- await file.sync();
55
- }
56
- finally {
57
- await file.close();
58
- }
59
- await rename(temporary, path);
60
- if (process.platform !== "win32") {
61
- const parent = await open(directory, "r");
62
- try {
63
- await parent.sync();
64
- }
65
- finally {
66
- await parent.close();
67
- }
68
- }
69
- }
70
- finally {
71
- await rm(temporary, { force: true });
72
- }
73
- },
74
- async release() {
75
- if (released)
76
- return;
77
- released = true;
78
- await release();
79
- },
80
- };
81
- },
82
- };
83
- }
84
- //# sourceMappingURL=workflow-checkpoint.js.map