reeval 0.21.0 → 0.23.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 (397) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +15 -15
  3. package/dist/{adapter-BdzhdRYo.js → adapter-Dlq3-4OS.js} +7 -50
  4. package/dist/adapter-Dlq3-4OS.js.map +1 -0
  5. package/dist/{agent-Dx-bDmlV.js → agent-OsAfayRf.js} +11 -12
  6. package/dist/agent-OsAfayRf.js.map +1 -0
  7. package/dist/{agents-l0-k7vw3.js → agents-BztvTkfM.js} +46 -37
  8. package/dist/agents-BztvTkfM.js.map +1 -0
  9. package/dist/{app-files-B-CQYB0c.js → app-files-6NHzghym.js} +3 -3
  10. package/dist/app-files-6NHzghym.js.map +1 -0
  11. package/dist/{assemble-CsZIcJo8.js → assemble-Doa1m-HW.js} +17 -15
  12. package/dist/{assemble-CsZIcJo8.js.map → assemble-Doa1m-HW.js.map} +1 -1
  13. package/dist/{assemble-CYMpN8LC.js → assemble-XrZskSNj.js} +1 -1
  14. package/dist/attach-BH2HdwH_.js +219 -0
  15. package/dist/attach-BH2HdwH_.js.map +1 -0
  16. package/dist/{attempt-CKfKsqqw.js → attempt-_dUsblVx.js} +2 -2
  17. package/dist/{attempt-CKfKsqqw.js.map → attempt-_dUsblVx.js.map} +1 -1
  18. package/dist/{attempt-host-BwSmNYkX.js → attempt-host-8mQV8Uee.js} +7 -7
  19. package/dist/{attempt-host-BwSmNYkX.js.map → attempt-host-8mQV8Uee.js.map} +1 -1
  20. package/dist/boat-DKRH0Gv7.js +1 -0
  21. package/dist/boat-DKjqo_ie.js +704 -0
  22. package/dist/boat-DKjqo_ie.js.map +1 -0
  23. package/dist/boat-images-CRN_U_eG.js +366 -0
  24. package/dist/boat-images-CRN_U_eG.js.map +1 -0
  25. package/dist/bundle-DU2aQVeq.js +780 -0
  26. package/dist/bundle-DU2aQVeq.js.map +1 -0
  27. package/dist/{capture-BqIAeFyC.js → capture-By1byHaX.js} +52 -27
  28. package/dist/capture-By1byHaX.js.map +1 -0
  29. package/dist/capture-BzjNv0qP.js +1 -0
  30. package/dist/{cli-s_3opn_I.js → cli-DMHOwdVr.js} +560 -1049
  31. package/dist/cli-DMHOwdVr.js.map +1 -0
  32. package/dist/{cli-spec-DxzIjmq_.js → cli-spec-D0wuUaj9.js} +179 -42
  33. package/dist/cli-spec-D0wuUaj9.js.map +1 -0
  34. package/dist/cli.js +2 -2
  35. package/dist/{client-C5fIzHQa.js → client-B41UK150.js} +8 -4
  36. package/dist/client-B41UK150.js.map +1 -0
  37. package/dist/{command-BJ7KqczP.js → command-8GIHYGZf.js} +9 -9
  38. package/dist/{command-BJ7KqczP.js.map → command-8GIHYGZf.js.map} +1 -1
  39. package/dist/{command-B5OAIjp7.js → command-CAmnWLFL.js} +14 -14
  40. package/dist/{command-B5OAIjp7.js.map → command-CAmnWLFL.js.map} +1 -1
  41. package/dist/{command-BXLZsEwQ.js → command-CXxckfsq.js} +13 -13
  42. package/dist/{command-BXLZsEwQ.js.map → command-CXxckfsq.js.map} +1 -1
  43. package/dist/{command-DA_SHQUQ.js → command-ao0NZ8h0.js} +16 -15
  44. package/dist/command-ao0NZ8h0.js.map +1 -0
  45. package/dist/{commands-BPvAOEmb.js → commands-B3lnIPj5.js} +1 -1
  46. package/dist/{commands-BKBamOcX.js → commands-ttChCsAy.js} +15 -15
  47. package/dist/{commands-BKBamOcX.js.map → commands-ttChCsAy.js.map} +1 -1
  48. package/dist/{config-C0URar0t.js → config-myJT1Qjc.js} +62 -37
  49. package/dist/config-myJT1Qjc.js.map +1 -0
  50. package/dist/{context-Sj58aJEu.js → context-DnzR9TNK.js} +2 -2
  51. package/dist/{context-Sj58aJEu.js.map → context-DnzR9TNK.js.map} +1 -1
  52. package/dist/cost-CdRX1s2p.js +1 -0
  53. package/dist/{cursor-catalog-FWgSo-T1.js → cursor-catalog-CUQrabJ_.js} +2 -2
  54. package/dist/{cursor-catalog-FWgSo-T1.js.map → cursor-catalog-CUQrabJ_.js.map} +1 -1
  55. package/dist/daytona-Dfhwtr9P.js +677 -0
  56. package/dist/daytona-Dfhwtr9P.js.map +1 -0
  57. package/dist/daytona-image-CnG6G00x.js +183 -0
  58. package/dist/daytona-image-CnG6G00x.js.map +1 -0
  59. package/dist/daytona-image-yJK3c4EV.js +1 -0
  60. package/dist/{db-BjAWxVAG.js → db-5H95sFii.js} +35 -9
  61. package/dist/{db-BjAWxVAG.js.map → db-5H95sFii.js.map} +1 -1
  62. package/dist/db-Bbg1n_2M.js +2 -0
  63. package/dist/{default-effort-CWlhZ6U1.js → default-effort-CtNY9CGW.js} +1 -1
  64. package/dist/{default-effort-Ck2GYIxX.js → default-effort-DYpCkJRk.js} +2 -2
  65. package/dist/{default-effort-Ck2GYIxX.js.map → default-effort-DYpCkJRk.js.map} +1 -1
  66. package/dist/{docker-D74l67k8.js → docker-CR0JZ1FE.js} +4 -4
  67. package/dist/{docker-D74l67k8.js.map → docker-CR0JZ1FE.js.map} +1 -1
  68. package/dist/docker-kpudeSxV.js +1 -0
  69. package/dist/{doctor-eFxyn6at.js → doctor-aE-RMbB_.js} +63 -76
  70. package/dist/doctor-aE-RMbB_.js.map +1 -0
  71. package/dist/{environment-CJIKz-Ud.js → environment-C8pUCD_A.js} +138 -53
  72. package/dist/environment-C8pUCD_A.js.map +1 -0
  73. package/dist/{errors-C1GBcWE2.js → errors-DPUoUTdK.js} +2 -2
  74. package/dist/{errors-C1GBcWE2.js.map → errors-DPUoUTdK.js.map} +1 -1
  75. package/dist/{eval-source-CXIRJ91v.js → eval-source-CaLIGH3U.js} +6 -6
  76. package/dist/{eval-source-CXIRJ91v.js.map → eval-source-CaLIGH3U.js.map} +1 -1
  77. package/dist/{evaluate-DA4QsrHO.js → evaluate-4kBVtwZZ.js} +250 -215
  78. package/dist/evaluate-4kBVtwZZ.js.map +1 -0
  79. package/dist/{evaluate-DHrU4Wld.d.ts → evaluate-DHaNtgVf.d.ts} +2 -2
  80. package/dist/events-CXxFvVMK.js +475 -0
  81. package/dist/events-CXxFvVMK.js.map +1 -0
  82. package/dist/{fake-bootstrap-CnwWG3kP.js → fake-bootstrap-CzxrCqO3.js} +2 -2
  83. package/dist/{fake-bootstrap-CnwWG3kP.js.map → fake-bootstrap-CzxrCqO3.js.map} +1 -1
  84. package/dist/files-BFnkOAhn.js +1 -0
  85. package/dist/files-BgQxoDlN.js +1 -0
  86. package/dist/{files-D6j-XpaK.js → files-BkvxIqfI.js} +4 -4
  87. package/dist/{files-D6j-XpaK.js.map → files-BkvxIqfI.js.map} +1 -1
  88. package/dist/{files-g1watgRC.js → files-CDfG8swM.js} +2 -2
  89. package/dist/{files-g1watgRC.js.map → files-CDfG8swM.js.map} +1 -1
  90. package/dist/files-CSe4VaMj.js +1 -0
  91. package/dist/{files-F44NRCN0.js → files-CX_mmvCc.js} +8 -8
  92. package/dist/{files-F44NRCN0.js.map → files-CX_mmvCc.js.map} +1 -1
  93. package/dist/{files-BrGVs4gY.js → files-Cs2dtb7-.js} +2 -2
  94. package/dist/{files-BrGVs4gY.js.map → files-Cs2dtb7-.js.map} +1 -1
  95. package/dist/{files-BaqXvB88.js → files-D6M7J3iX.js} +1 -1
  96. package/dist/{files-BVVWAS0A.js → files-DgHeTdCZ.js} +6 -6
  97. package/dist/{files-BVVWAS0A.js.map → files-DgHeTdCZ.js.map} +1 -1
  98. package/dist/{files-Bey1VAex.js → files-DpwJW3w6.js} +3 -3
  99. package/dist/{files-Bey1VAex.js.map → files-DpwJW3w6.js.map} +1 -1
  100. package/dist/gateway.d.ts +1 -1
  101. package/dist/{git-Jqkf9SBa.js → git-BnnNEXqh.js} +3 -3
  102. package/dist/{git-Jqkf9SBa.js.map → git-BnnNEXqh.js.map} +1 -1
  103. package/dist/harness-install-BfMBYDfP.js +53 -0
  104. package/dist/harness-install-BfMBYDfP.js.map +1 -0
  105. package/dist/harness.d.ts +1 -1
  106. package/dist/hosted-5Zz2peTR.js +260 -0
  107. package/dist/hosted-5Zz2peTR.js.map +1 -0
  108. package/dist/hosted-Co-waHe0.js +131 -0
  109. package/dist/hosted-Co-waHe0.js.map +1 -0
  110. package/dist/hosted-run-202QicZ-.js +1 -0
  111. package/dist/hosted-run-BfAPIMyT.js +230 -0
  112. package/dist/hosted-run-BfAPIMyT.js.map +1 -0
  113. package/dist/{ids-B-JKTCP8.js → ids-a6cr243_.js} +17 -12
  114. package/dist/ids-a6cr243_.js.map +1 -0
  115. package/dist/{images-Dsc4Wi-F.js → images-DtXwj2wL.js} +70 -55
  116. package/dist/images-DtXwj2wL.js.map +1 -0
  117. package/dist/index.d.ts +2 -2
  118. package/dist/index.js +5 -5
  119. package/dist/init-BiL6B3S4.js +1 -0
  120. package/dist/{init-QB5ecPDA.js → init-Ci_IAp8p.js} +5 -5
  121. package/dist/{init-QB5ecPDA.js.map → init-Ci_IAp8p.js.map} +1 -1
  122. package/dist/{ink-list-mCJypk3d.js → ink-list-Dnh6XD3C.js} +54 -15
  123. package/dist/ink-list-Dnh6XD3C.js.map +1 -0
  124. package/dist/inputs-load-DPUP_IFL.js +95 -0
  125. package/dist/inputs-load-DPUP_IFL.js.map +1 -0
  126. package/dist/inputs-load-M-BGe7gd.js +1 -0
  127. package/dist/inputs-z4JqnQ5g.js +190 -0
  128. package/dist/inputs-z4JqnQ5g.js.map +1 -0
  129. package/dist/internal/vm.d.ts +16 -0
  130. package/dist/internal/vm.js +22 -0
  131. package/dist/internal/vm.js.map +1 -0
  132. package/dist/{invocations-BSr4lRzI.js → invocations-C1gY3E0J.js} +4 -4
  133. package/dist/{invocations-BSr4lRzI.js.map → invocations-C1gY3E0J.js.map} +1 -1
  134. package/dist/jiti-ILwyxt93.js +54 -0
  135. package/dist/jiti-ILwyxt93.js.map +1 -0
  136. package/dist/{judge-eGH39PaP.js → judge-DwzqucLS.js} +9 -6
  137. package/dist/{judge-eGH39PaP.js.map → judge-DwzqucLS.js.map} +1 -1
  138. package/dist/judge.d.ts +1 -1
  139. package/dist/judge.js +1 -1
  140. package/dist/kinds-DEKXOWVJ.js +592 -0
  141. package/dist/kinds-DEKXOWVJ.js.map +1 -0
  142. package/dist/{layout-DfQa4mJs.js → layout-nCnU9Vu2.js} +2 -2
  143. package/dist/{layout-DfQa4mJs.js.map → layout-nCnU9Vu2.js.map} +1 -1
  144. package/dist/{list-Dh6T0kdr.js → list-MK4L8tfW.js} +14 -11
  145. package/dist/{list-Dh6T0kdr.js.map → list-MK4L8tfW.js.map} +1 -1
  146. package/dist/{live-y1p3oNXH.js → live-BkPNXVmN.js} +8 -8
  147. package/dist/{live-y1p3oNXH.js.map → live-BkPNXVmN.js.map} +1 -1
  148. package/dist/{live-xTZs0c61.js → live-Dlq-S2yy.js} +7 -5
  149. package/dist/live-Dlq-S2yy.js.map +1 -0
  150. package/dist/live-gZtkBwuo.js +1 -0
  151. package/dist/machine-service-Byl0BlcT.js +1 -0
  152. package/dist/machine-service-CZiXiVsS.js +709 -0
  153. package/dist/machine-service-CZiXiVsS.js.map +1 -0
  154. package/dist/machines-Ch5bhgvk.js +279 -0
  155. package/dist/machines-Ch5bhgvk.js.map +1 -0
  156. package/dist/model-C6aoJLg_.js +1 -0
  157. package/dist/{model-jRKSQBg6.js → model-CRh8aiYS.js} +6 -5
  158. package/dist/model-CRh8aiYS.js.map +1 -0
  159. package/dist/{model-3pZZzloU.js → model-DRa7yv6K.js} +6 -5
  160. package/dist/model-DRa7yv6K.js.map +1 -0
  161. package/dist/{model-DNpKiHqO.js → model-LoLnq9y1.js} +2 -2
  162. package/dist/{model-DNpKiHqO.js.map → model-LoLnq9y1.js.map} +1 -1
  163. package/dist/{model-DEjwetkJ.js → model-lLaUxxno.js} +1 -1
  164. package/dist/{node-DM-mLGdX.js → node-BQjSQw0d.js} +19 -8
  165. package/dist/node-BQjSQw0d.js.map +1 -0
  166. package/dist/{openrouter-models-C0aRo633.js → openrouter-models-B1sIOTD2.js} +2 -2
  167. package/dist/{openrouter-models-C0aRo633.js.map → openrouter-models-B1sIOTD2.js.map} +1 -1
  168. package/dist/options-I9I3FwMl.js +1 -0
  169. package/dist/own-reads-CYmBlrHK.js +15 -0
  170. package/dist/own-reads-CYmBlrHK.js.map +1 -0
  171. package/dist/{patch-Bx-qp8Li.js → patch-D8X6VB-e.js} +2 -2
  172. package/dist/{patch-Bx-qp8Li.js.map → patch-D8X6VB-e.js.map} +1 -1
  173. package/dist/{plan-ChO0A-xn.js → plan-DgIVIrXJ.js} +47 -9
  174. package/dist/plan-DgIVIrXJ.js.map +1 -0
  175. package/dist/{plugins-BioMWncI.js → plugins-DvEbow6a.js} +17 -637
  176. package/dist/plugins-DvEbow6a.js.map +1 -0
  177. package/dist/{preflight-CJSGzMzc.js → preflight-BKGbxN67.js} +9 -8
  178. package/dist/preflight-BKGbxN67.js.map +1 -0
  179. package/dist/{preflight-qFCXmxha.js → preflight-Qm4wE094.js} +9 -4
  180. package/dist/preflight-Qm4wE094.js.map +1 -0
  181. package/dist/preflight-dJqs5x3r.js +1 -0
  182. package/dist/preflight-fyV5nnea.js +1 -0
  183. package/dist/prepare-BAjRSoku.js +389 -0
  184. package/dist/prepare-BAjRSoku.js.map +1 -0
  185. package/dist/prepare-CRPPfRJf.js +2 -0
  186. package/dist/prices-C0gKS_8G.js +1 -0
  187. package/dist/{prices-BrY_ihLs.js → prices-DCokI_Ka.js} +3 -3
  188. package/dist/{prices-BrY_ihLs.js.map → prices-DCokI_Ka.js.map} +1 -1
  189. package/dist/{provenance-B-flBAzR.js → provenance-CSyRCc9B.js} +4 -4
  190. package/dist/{provenance-B-flBAzR.js.map → provenance-CSyRCc9B.js.map} +1 -1
  191. package/dist/{providers-B6StVyfG.js → providers-DkaEJvF5.js} +185 -35
  192. package/dist/providers-DkaEJvF5.js.map +1 -0
  193. package/dist/providers-DxZ26YoG.js +1 -0
  194. package/dist/{query-CkLmJv7R.js → query-BL66BOqL.js} +2 -2
  195. package/dist/{query-CkLmJv7R.js.map → query-BL66BOqL.js.map} +1 -1
  196. package/dist/query-C9OKU1Vz.js +1 -0
  197. package/dist/{questions-CJIh2FSX.js → questions-boVPzGoC.js} +7 -7
  198. package/dist/{questions-CJIh2FSX.js.map → questions-boVPzGoC.js.map} +1 -1
  199. package/dist/recipe-qyIpP96r.js +128 -0
  200. package/dist/recipe-qyIpP96r.js.map +1 -0
  201. package/dist/{record-nVVujCW7.js → record-D1_D1KFY.js} +12 -4
  202. package/dist/record-D1_D1KFY.js.map +1 -0
  203. package/dist/{redact-DL2BTykw.js → redact-t-L3VGy8.js} +91 -2
  204. package/dist/redact-t-L3VGy8.js.map +1 -0
  205. package/dist/{remarks-B3wjKscW.js → remarks-DEvk5f8v.js} +7 -7
  206. package/dist/{remarks-B3wjKscW.js.map → remarks-DEvk5f8v.js.map} +1 -1
  207. package/dist/{remote-C88amFRN.js → remote-CQoBRpOv.js} +5 -5
  208. package/dist/{remote-C88amFRN.js.map → remote-CQoBRpOv.js.map} +1 -1
  209. package/dist/resolve-BdpO8BN1.js +1 -0
  210. package/dist/{resolve-Bul8lHaa.js → resolve-Bfo8sjd-.js} +2 -2
  211. package/dist/{resolve-Bul8lHaa.js.map → resolve-Bfo8sjd-.js.map} +1 -1
  212. package/dist/{resolve-G576PiFJ.js → resolve-D2RqmybX.js} +9 -9
  213. package/dist/{resolve-G576PiFJ.js.map → resolve-D2RqmybX.js.map} +1 -1
  214. package/dist/resources-DqdwihhT.js +62 -0
  215. package/dist/resources-DqdwihhT.js.map +1 -0
  216. package/dist/{results-zVHIW6xw.js → results-BpxzyoMd.js} +5 -5
  217. package/dist/{results-zVHIW6xw.js.map → results-BpxzyoMd.js.map} +1 -1
  218. package/dist/{resume-D_PcUXfG.js → resume-2ekm_9OB.js} +78 -7
  219. package/dist/resume-2ekm_9OB.js.map +1 -0
  220. package/dist/{retry-BvTzCxdc.js → retry-CAhpW1hH.js} +4 -4
  221. package/dist/{retry-BvTzCxdc.js.map → retry-CAhpW1hH.js.map} +1 -1
  222. package/dist/{routes-B0F2R-K7.js → routes-Cp4gAjBZ.js} +118 -70
  223. package/dist/routes-Cp4gAjBZ.js.map +1 -0
  224. package/dist/{runtime-B3r_pAq6.js → runtime-C5fKSFCz.js} +46 -5
  225. package/dist/runtime-C5fKSFCz.js.map +1 -0
  226. package/dist/sandbox/boat.d.ts +11 -3
  227. package/dist/sandbox/boat.js +18 -4
  228. package/dist/sandbox/boat.js.map +1 -1
  229. package/dist/sandbox/daytona.d.ts +30 -0
  230. package/dist/sandbox/daytona.js +49 -0
  231. package/dist/sandbox/daytona.js.map +1 -0
  232. package/dist/{sandbox-Duh3z1TV.js → sandbox-t-Q-8lA_.js} +2 -2
  233. package/dist/{sandbox-Duh3z1TV.js.map → sandbox-t-Q-8lA_.js.map} +1 -1
  234. package/dist/sandbox.d.ts +1 -1
  235. package/dist/sandbox.js +1 -1
  236. package/dist/{server-DUWMRKik.js → server-BcLg9WzE.js} +10 -10
  237. package/dist/{server-DUWMRKik.js.map → server-BcLg9WzE.js.map} +1 -1
  238. package/dist/server-Buav2-CG.js +1 -0
  239. package/dist/services-BG8xuU82.js +39 -0
  240. package/dist/services-BG8xuU82.js.map +1 -0
  241. package/dist/{source-CHuN4Nfg.js → source-CrXM19HD.js} +2 -2
  242. package/dist/{source-CHuN4Nfg.js.map → source-CrXM19HD.js.map} +1 -1
  243. package/dist/source-dvxkqYvk.js +1 -0
  244. package/dist/src-5dCrqbFd.js +2 -0
  245. package/dist/{src-BI0v8qlZ.js → src-Bb3k9Kn_.js} +8 -5
  246. package/dist/{src-BI0v8qlZ.js.map → src-Bb3k9Kn_.js.map} +1 -1
  247. package/dist/{src-boB6D-5T.js → src-Bf5RZlPi.js} +2 -2
  248. package/dist/{src-boB6D-5T.js.map → src-Bf5RZlPi.js.map} +1 -1
  249. package/dist/{src-BqNzHHWn.js → src-C3OhA5pw.js} +2 -2
  250. package/dist/{src-BqNzHHWn.js.map → src-C3OhA5pw.js.map} +1 -1
  251. package/dist/{src-BHJ4MWvY.js → src-C5rrQlt8.js} +2199 -771
  252. package/dist/src-C5rrQlt8.js.map +1 -0
  253. package/dist/{src-CeBhwD8k.js → src-C6MsGyD6.js} +1 -1
  254. package/dist/{src-De0KY5S_.js → src-Cf4vRyea.js} +2 -2
  255. package/dist/src-DEbNp-rx.js +1 -0
  256. package/dist/{src-B-HuDqpH.js → src-DNWiU__5.js} +2 -2
  257. package/dist/{src-B-HuDqpH.js.map → src-DNWiU__5.js.map} +1 -1
  258. package/dist/src-DrLbG1HM.js +2 -0
  259. package/dist/{src--yl1OypK.js → src-Ds1pmXTg.js} +2 -2
  260. package/dist/{src-DA95rM6v.js → src-DwcCKsV0.js} +2 -2
  261. package/dist/{src-CmA5Yev6.js → src-DwcTn4JY.js} +2 -2
  262. package/dist/{src-CmA5Yev6.js.map → src-DwcTn4JY.js.map} +1 -1
  263. package/dist/{src-CZaYu6ER.js → src-VG2IRoT4.js} +1 -1
  264. package/dist/{src-DL-EE4DU.js → src-c3ZQu7Uu.js} +2 -2
  265. package/dist/{src-DL-EE4DU.js.map → src-c3ZQu7Uu.js.map} +1 -1
  266. package/dist/{src-CkEiiyON.js → src-io_SKoZ5.js} +2 -2
  267. package/dist/ssh-pool-BorCizYw.js +1 -0
  268. package/dist/ssh-pool-Dvfx5GuV.js +174 -0
  269. package/dist/ssh-pool-Dvfx5GuV.js.map +1 -0
  270. package/dist/start-COB07NpH.js +718 -0
  271. package/dist/start-COB07NpH.js.map +1 -0
  272. package/dist/{state-DUBRDyMk.js → state-B319V1p8.js} +16 -16
  273. package/dist/{state-DUBRDyMk.js.map → state-B319V1p8.js.map} +1 -1
  274. package/dist/state-C5oBvmoZ.js +1 -0
  275. package/dist/store/local.d.ts +1 -1
  276. package/dist/store/s3.d.ts +1 -1
  277. package/dist/suite-BwJGOhCZ.js +2 -0
  278. package/dist/{suite-B9J6Afg6.js → suite-D1tgXZxM.js} +2 -2
  279. package/dist/{suite-B9J6Afg6.js.map → suite-D1tgXZxM.js.map} +1 -1
  280. package/dist/{summary-CSp4cfnr.js → summary-ClLns_wv.js} +8 -5
  281. package/dist/summary-ClLns_wv.js.map +1 -0
  282. package/dist/{sync-CxAY6Dki.js → sync-mOG74RXH.js} +5 -5
  283. package/dist/{sync-CxAY6Dki.js.map → sync-mOG74RXH.js.map} +1 -1
  284. package/dist/{tart-CcrrtSrp.js → tart-DMppfbEm.js} +100 -295
  285. package/dist/tart-DMppfbEm.js.map +1 -0
  286. package/dist/{tart-bake-F-6seRC9.js → tart-bake-Cva_qdir.js} +18 -62
  287. package/dist/tart-bake-Cva_qdir.js.map +1 -0
  288. package/dist/{tart-bake-RK7RaT9E.js → tart-bake-DVIoXWr_.js} +1 -1
  289. package/dist/{tart-cli-ClvRniLQ.js → tart-cli-D88c5YYJ.js} +1 -1
  290. package/dist/{tart-cli-B86Jqo1t.js → tart-cli-LzDud2Z6.js} +2 -2
  291. package/dist/{tart-cli-B86Jqo1t.js.map → tart-cli-LzDud2Z6.js.map} +1 -1
  292. package/dist/{tart-hosts-Brii7zHM.js → tart-hosts-8N6Tt7Yb.js} +1 -1
  293. package/dist/{tart-hosts-DPyZsg-1.js → tart-hosts-CTRY5kQ2.js} +3 -3
  294. package/dist/{tart-hosts-DPyZsg-1.js.map → tart-hosts-CTRY5kQ2.js.map} +1 -1
  295. package/dist/{tart-images-CWSf03w8.js → tart-images-JfHirU8W.js} +2 -2
  296. package/dist/{tart-images-CWSf03w8.js.map → tart-images-JfHirU8W.js.map} +1 -1
  297. package/dist/testing.d.ts +2 -2
  298. package/dist/testing.js +4 -4
  299. package/dist/{tool-class-CVDdJy0H.js → tool-class-CncfCw03.js} +2 -2
  300. package/dist/{tool-class-CVDdJy0H.js.map → tool-class-CncfCw03.js.map} +1 -1
  301. package/dist/{transcript-BP_2hji-.js → transcript-BXWZiMuC.js} +2 -2
  302. package/dist/{transcript-BP_2hji-.js.map → transcript-BXWZiMuC.js.map} +1 -1
  303. package/dist/{types-BJ0wh8wC.d.ts → types-BDo8ttQo.d.ts} +253 -5
  304. package/dist/types-CbcnJxCy.js.map +1 -1
  305. package/dist/ui-DUiVPbQ2.js +1024 -0
  306. package/dist/ui-DUiVPbQ2.js.map +1 -0
  307. package/dist/vercel-models-Ci33llXz.js +21 -0
  308. package/dist/vercel-models-Ci33llXz.js.map +1 -0
  309. package/dist/view/index.d.ts +6 -1
  310. package/dist/view/index.js +4 -4
  311. package/dist/views-B0qZR5Ef.js +2 -0
  312. package/dist/{views-DRxXCyIH.js → views-CiZGh3ws.js} +6 -6
  313. package/dist/{views-DRxXCyIH.js.map → views-CiZGh3ws.js.map} +1 -1
  314. package/dist/vm-container-BVn7pXfD.js +148 -0
  315. package/dist/vm-container-BVn7pXfD.js.map +1 -0
  316. package/dist/vm-images-CNk-Zl2a.js +375 -0
  317. package/dist/vm-images-CNk-Zl2a.js.map +1 -0
  318. package/dist/{worker-entry-C3Q4U63F.js → worker-entry-DmXQ2Znu.js} +31 -11
  319. package/dist/worker-entry-DmXQ2Znu.js.map +1 -0
  320. package/dist/workspace-CRgFdmgW.js +1 -0
  321. package/dist/{workspace-P72SXLXr.js → workspace-wwvwEHzP.js} +6 -6
  322. package/dist/{workspace-P72SXLXr.js.map → workspace-wwvwEHzP.js.map} +1 -1
  323. package/docker/Dockerfile +1 -1
  324. package/package.json +17 -2
  325. package/skills/reeval/references/environments.md +4 -3
  326. package/dist/adapter-BdzhdRYo.js.map +0 -1
  327. package/dist/agent-Dx-bDmlV.js.map +0 -1
  328. package/dist/agents-l0-k7vw3.js.map +0 -1
  329. package/dist/app-files-B-CQYB0c.js.map +0 -1
  330. package/dist/boat-CZpAreTB.js +0 -108
  331. package/dist/boat-CZpAreTB.js.map +0 -1
  332. package/dist/boat-su1Y7LPd.js +0 -325
  333. package/dist/boat-su1Y7LPd.js.map +0 -1
  334. package/dist/capture-BqIAeFyC.js.map +0 -1
  335. package/dist/capture-D0Ln5aCP.js +0 -1
  336. package/dist/cli-s_3opn_I.js.map +0 -1
  337. package/dist/cli-spec-DxzIjmq_.js.map +0 -1
  338. package/dist/client-C5fIzHQa.js.map +0 -1
  339. package/dist/command-DA_SHQUQ.js.map +0 -1
  340. package/dist/config-C0URar0t.js.map +0 -1
  341. package/dist/cost-IM80LyGD.js +0 -1
  342. package/dist/db-Bc4L-Wcr.js +0 -2
  343. package/dist/docker-CDdK6Ity.js +0 -271
  344. package/dist/docker-CDdK6Ity.js.map +0 -1
  345. package/dist/docker-DMug3l-a.js +0 -1
  346. package/dist/doctor-eFxyn6at.js.map +0 -1
  347. package/dist/environment-CJIKz-Ud.js.map +0 -1
  348. package/dist/evaluate-DA4QsrHO.js.map +0 -1
  349. package/dist/files-BjOJw4sn.js +0 -1
  350. package/dist/files-CNHhSyb3.js +0 -1
  351. package/dist/files-CW1lChNh.js +0 -1
  352. package/dist/ids-B-JKTCP8.js.map +0 -1
  353. package/dist/images-Dsc4Wi-F.js.map +0 -1
  354. package/dist/init-C0oUG3jh.js +0 -1
  355. package/dist/ink-list-mCJypk3d.js.map +0 -1
  356. package/dist/live-DwjWJTdn.js +0 -1
  357. package/dist/live-xTZs0c61.js.map +0 -1
  358. package/dist/model-3pZZzloU.js.map +0 -1
  359. package/dist/model-jRKSQBg6.js.map +0 -1
  360. package/dist/model-nfewGTzB.js +0 -1
  361. package/dist/node-DM-mLGdX.js.map +0 -1
  362. package/dist/options-DpsJ_5CU.js +0 -1
  363. package/dist/plan-ChO0A-xn.js.map +0 -1
  364. package/dist/plugins-BioMWncI.js.map +0 -1
  365. package/dist/preflight-BUjk_6wT.js +0 -1
  366. package/dist/preflight-CJSGzMzc.js.map +0 -1
  367. package/dist/preflight-DD3fI4Hz.js +0 -1
  368. package/dist/preflight-qFCXmxha.js.map +0 -1
  369. package/dist/prepare-D7oSSFNm.js +0 -268
  370. package/dist/prepare-D7oSSFNm.js.map +0 -1
  371. package/dist/prepare-xHU2BpN-.js +0 -2
  372. package/dist/prices-B1vm_lPk.js +0 -1
  373. package/dist/providers-B6StVyfG.js.map +0 -1
  374. package/dist/providers-Dljf6al6.js +0 -1
  375. package/dist/query-BAc2tQZj.js +0 -1
  376. package/dist/record-nVVujCW7.js.map +0 -1
  377. package/dist/redact-DL2BTykw.js.map +0 -1
  378. package/dist/resolve-DW92wpIZ.js +0 -1
  379. package/dist/resume-D_PcUXfG.js.map +0 -1
  380. package/dist/routes-B0F2R-K7.js.map +0 -1
  381. package/dist/runtime-B3r_pAq6.js.map +0 -1
  382. package/dist/server-CGEsvVRG.js +0 -1
  383. package/dist/source-Wz1Nrfue.js +0 -1
  384. package/dist/src-BHJ4MWvY.js.map +0 -1
  385. package/dist/src-BL-_0QoE.js +0 -1
  386. package/dist/src-C-mOSczH.js +0 -2
  387. package/dist/src-CwH_nEaw.js +0 -2
  388. package/dist/state-B3jex5KU.js +0 -1
  389. package/dist/suite-Bhs9-Z7O.js +0 -2
  390. package/dist/summary-CSp4cfnr.js.map +0 -1
  391. package/dist/tarball-CESxtK4X.js +0 -257
  392. package/dist/tarball-CESxtK4X.js.map +0 -1
  393. package/dist/tart-CcrrtSrp.js.map +0 -1
  394. package/dist/tart-bake-F-6seRC9.js.map +0 -1
  395. package/dist/views-i67V1ly3.js +0 -2
  396. package/dist/worker-entry-C3Q4U63F.js.map +0 -1
  397. package/dist/workspace-DhUOW8if.js +0 -1
@@ -0,0 +1,718 @@
1
+ import { Bt as imageInfo, Ft as docker, Q as EgressUnavailableError, Sn as isRemoteEngine, St as DEFAULT_IMAGE, Z as DEFAULT_LIMITS, dn as shellQuote, kt as WORKSPACE_DIR, ot as startGateway, tt as createDockerSession, wt as LABEL, xn as engineSpec, yn as ENGINES } from "./src-C5rrQlt8.js";
2
+ import { t as InfraError } from "./types-CbcnJxCy.js";
3
+ import { Ct as isRestricted, Ot as setupEgress, bt as gatewayPolicy, xt as isDirect, yt as egressLabel } from "./config-myJT1Qjc.js";
4
+ import { n as attemptDebug } from "./attempt-_dUsblVx.js";
5
+ import "./docker-CR0JZ1FE.js";
6
+ import { t as callUsage } from "./model-calls-B0BoQfJ4.js";
7
+ import { n as installHarness, t as harnessBake } from "./harness-install-BfMBYDfP.js";
8
+ import { posix } from "node:path";
9
+ // src/sandbox/resources.ts
10
+ /** Milliseconds between readings. */
11
+ const SAMPLE_MS = 1e3;
12
+ /** How long teardown's last reading may take. */
13
+ const FINAL_TIMEOUT_MS = 15e3;
14
+ /** How long an attempt waits for its sampler to start. */
15
+ const START_TIMEOUT_MS = 15e3;
16
+ /**
17
+ * `$1` is the mode, `$2` the seconds between readings or `once`, `$3` the container whose cgroup
18
+ * to find from the host's cgroup namespace, when the script runs outside it. First a line
19
+ * `limits <cpu quota> <cpu period> <memory bytes> <cpus> <clock ticks>`, then a line
20
+ * `s <uptime> <cpu> <memory bytes> <disk read bytes> <disk written bytes> <memory peak bytes>
21
+ * <cpu periods> <throttled periods> <throttled usec>` per reading, `-` where there's nothing to
22
+ * read. The uptime times each reading in the sandbox, so a late line on the host doesn't skew the
23
+ * cores between two. A container's CPU is cgroup v2's `usage_usec`, its memory `memory.current`
24
+ * less `inactive_file`, its memory peak `memory.peak` and its throttling `cpu.stat`'s
25
+ * `nr_periods`, `nr_throttled` and `throttled_usec`; a VM's CPU is `/proc/stat`'s busy ticks
26
+ * (steal is the hypervisor's, not the VM's), its memory `MemTotal` less `MemAvailable`, and its
27
+ * disks every block device but loop, RAM, CD and stacked ones. A VM whose cgroup root sets a memory
28
+ * limit, which a VM's never does, is a container in a cgroup namespace of its own (a `daytona()`
29
+ * sandbox), where `/proc` is the host's: it reads that cgroup as a container's, with its CPU in
30
+ * microseconds. A macOS VM has neither, so it prints its `sysctl` sizes and stops. An uptime the
31
+ * shell can't read (Daytona's) is `-`. From outside, the container's cgroup is the directory
32
+ * beside the script's own cgroup, or up to two levels up, named for its id, but not Podman's
33
+ * `libpod-conmon-<id>.scope`, which holds the container's monitor under systemd. A container's
34
+ * cgroup the script can't find, or that's
35
+ * gone, ends it. Its stderr goes nowhere: nothing reads it, and a full pipe would stop the
36
+ * readings.
37
+ */
38
+ const SCRIPT = `exec 2>/dev/null
39
+ c=/sys/fs/cgroup
40
+ if [ "$1" = darwin ]; then
41
+ echo "limits - - $(sysctl -n hw.memsize || echo -) $(sysctl -n hw.ncpu || echo -) -"
42
+ exit 0
43
+ fi
44
+ cg= tk=-
45
+ if [ "$1" = machine ] && [ -r $c/memory.max ] && read -r m < $c/memory.max && [ "$m" != max ]; then
46
+ cg=1 tk=1000000
47
+ fi
48
+ if [ "$1" = container ] || [ -n "$cg" ]; then
49
+ if [ -n "$3" ]; then
50
+ own=
51
+ while IFS= read -r l; do case $l in 0::*) own=\${l#0::} ;; esac; done < /proc/self/cgroup
52
+ d=\${own%/*} t=
53
+ for _ in 1 2 3; do
54
+ for x in "$c$d"/*"$3"*; do
55
+ case \${x##*/} in *conmon*) continue ;; esac
56
+ [ -d "$x" ] && t=$x && break
57
+ done
58
+ [ -n "$t" ] || [ -z "$d" ] && break
59
+ d=\${d%/*}
60
+ done
61
+ [ -n "$t" ] || exit 0
62
+ c=$t
63
+ fi
64
+ [ -r $c/cpu.stat ] && [ -r $c/memory.current ] && [ -r $c/memory.stat ] || exit 0
65
+ q=- p=- m=-
66
+ [ -r $c/cpu.max ] && read -r q p < $c/cpu.max
67
+ [ -r $c/memory.max ] && read -r m < $c/memory.max
68
+ echo "limits $q $p $m $(nproc 2>/dev/null || echo -) $tk"
69
+ else
70
+ [ -r /proc/stat ] && [ -r /proc/meminfo ] || exit 0
71
+ while read -r k v _; do [ "$k" = MemTotal: ] && t=$v; done < /proc/meminfo
72
+ echo "limits - - $((t * 1024)) $(nproc 2>/dev/null || echo -) $(getconf CLK_TCK 2>/dev/null || echo 100)"
73
+ fi
74
+ sample() {
75
+ up=-
76
+ [ -r /proc/uptime ] && read -r up _ < /proc/uptime
77
+ [ -n "$up" ] || up=-
78
+ if [ "$1" = container ] || [ -n "$cg" ]; then
79
+ u=0 i=0 np=- nt=- tu=- pk=-
80
+ read -r cur < $c/memory.current || exit 0
81
+ while read -r k v; do
82
+ case $k in usage_usec) u=$v ;; nr_periods) np=$v ;; nr_throttled) nt=$v ;; throttled_usec) tu=$v ;; esac
83
+ done < $c/cpu.stat
84
+ while read -r k v; do [ "$k" = inactive_file ] && i=$v; done < $c/memory.stat
85
+ [ -r $c/memory.peak ] && read -r pk < $c/memory.peak
86
+ echo "s $up $u $((cur - i)) - - $pk $np $nt $tu"
87
+ else
88
+ read -r _ us ni sy _ _ ir so _ < /proc/stat
89
+ t=0 a=0
90
+ while read -r k v _; do
91
+ case $k in MemTotal:) t=$v ;; MemAvailable:) a=$v ;; esac
92
+ done < /proc/meminfo
93
+ r=0 w=0
94
+ for d in /sys/block/*; do
95
+ case \${d##*/} in loop*|ram*|zram*|sr*|dm-*|md*) continue ;; esac
96
+ [ -r "$d/stat" ] && read -r _ _ rs _ _ _ ws _ < "$d/stat" && r=$((r + rs)) && w=$((w + ws))
97
+ done
98
+ echo "s $up $((us + ni + sy + ir + so)) $(((t - a) * 1024)) $((r * 512)) $((w * 512)) - - - -"
99
+ fi
100
+ }
101
+ sample "$1"
102
+ [ "$2" = once ] && exit 0
103
+ while sleep "$2"; do sample "$1"; done`;
104
+ const command = (mode, every, target) => `sh -c ${shellQuote(SCRIPT)} sh ${mode} ${every}${target ? ` ${shellQuote(target)}` : ""}`;
105
+ const num = (s) => {
106
+ if (s === void 0 || !/^\d+$/.test(s)) return null;
107
+ return Number(s);
108
+ };
109
+ /** A line the script printed, or null for anything else. */
110
+ function parseLine(line, at) {
111
+ const [tag, ...f] = line.trim().split(/\s+/);
112
+ if (tag === "limits" && f.length === 5) {
113
+ const [quota, period, memory, cpus, ticks] = f.map(num);
114
+ return { limits: {
115
+ quota: quota ?? null,
116
+ period: period ?? null,
117
+ memory: memory ?? null,
118
+ cpus: cpus ?? null,
119
+ ticks: ticks ?? null
120
+ } };
121
+ }
122
+ const cpu = num(f[1]);
123
+ if (tag !== "s" || f.length !== 9 || cpu === null) return null;
124
+ return { reading: {
125
+ at: f[0] !== void 0 && /^\d+(\.\d+)?$/.test(f[0]) ? Number(f[0]) * 1e3 : at,
126
+ cpu,
127
+ memory: num(f[2]),
128
+ read: num(f[3]),
129
+ written: num(f[4]),
130
+ memoryPeak: num(f[5]),
131
+ periods: num(f[6]),
132
+ throttled: num(f[7]),
133
+ throttledUsec: num(f[8])
134
+ } };
135
+ }
136
+ const round = (n, places = 3) => Math.round(n * 10 ** places) / 10 ** places;
137
+ /** The nearest-rank `p` quantile of `values`, which it sorts. */
138
+ const quantile = (values, p) => values.sort((x, y) => x - y)[Math.max(0, Math.ceil(p * values.length) - 1)];
139
+ const delta = (first, last) => first === null || last === null ? null : Math.max(0, last - first);
140
+ /**
141
+ * The resources from the readings, in order: what the sandbox gave from `limits`, and what it used
142
+ * between the first reading and the last. Without two readings there's no usage.
143
+ */
144
+ function summarize(scope, machine, limits, readings, o) {
145
+ const vcpus = (limits?.quota && limits.period ? round(limits.quota / limits.period, 2) : null) ?? limits?.cpus ?? null;
146
+ const resources = {
147
+ scope,
148
+ machine: {
149
+ ...machine,
150
+ ...vcpus !== null && { vcpus },
151
+ ...limits?.memory != null && { memoryBytes: limits.memory }
152
+ }
153
+ };
154
+ const first = readings[0];
155
+ const last = readings.at(-1);
156
+ const perSecond = scope === "container" ? 1e6 : limits?.ticks;
157
+ if (!first || !last || first === last || !perSecond || last.at <= first.at) return resources;
158
+ const durationMs = last.at - first.at;
159
+ const cpuSeconds = Math.max(0, last.cpu - first.cpu) / perSecond;
160
+ const cores = [];
161
+ for (let i = 1; i < readings.length; i++) {
162
+ const [a, b] = [readings[i - 1], readings[i]];
163
+ if (b.at - a.at < o.sampleMs / 2) continue;
164
+ cores.push(Math.max(0, b.cpu - a.cpu) / perSecond / ((b.at - a.at) / 1e3));
165
+ }
166
+ const memory = readings.flatMap((r) => r.memory === null ? [] : [r.memory]);
167
+ const memoryPeak = readings.flatMap((r) => r.memoryPeak === null ? [] : [r.memoryPeak]);
168
+ const disk = scope === "machine" && first.read !== null && last.read !== null && first.written !== null && last.written !== null;
169
+ const periods = delta(first.periods, last.periods);
170
+ const throttled = delta(first.throttled, last.throttled);
171
+ const throttledUsec = delta(first.throttledUsec, last.throttledUsec);
172
+ resources.usage = {
173
+ durationMs: Math.round(durationMs),
174
+ sampleMs: o.sampleMs,
175
+ cpuSeconds: round(cpuSeconds),
176
+ avgCores: round(cpuSeconds / (durationMs / 1e3)),
177
+ ...cores.length && {
178
+ peakCores: round(cores.reduce((x, y) => Math.max(x, y))),
179
+ p95Cores: round(quantile(cores, .95))
180
+ },
181
+ ...memory.length && { peakMemoryBytes: memory.reduce((x, y) => Math.max(x, y)) },
182
+ ...memoryPeak.length && { cgroupPeakMemoryBytes: memoryPeak.reduce((x, y) => Math.max(x, y)) },
183
+ ...periods !== null && throttled !== null && throttledUsec !== null && { throttling: {
184
+ periods,
185
+ throttledPeriods: throttled,
186
+ throttledSeconds: round(throttledUsec / 1e6)
187
+ } },
188
+ ...disk && {
189
+ diskReadBytes: Math.max(0, (last.read ?? 0) - (first.read ?? 0)),
190
+ diskWriteBytes: Math.max(0, (last.written ?? 0) - (first.written ?? 0))
191
+ },
192
+ ...o.partial && { partial: true }
193
+ };
194
+ return resources;
195
+ }
196
+ /**
197
+ * Where a session's sampler runs, in order of preference: a container's observer, then root in
198
+ * the sandbox, where a sandbox user without root can't signal it.
199
+ */
200
+ function samplerHosts(session) {
201
+ const privileged = {
202
+ spawn: (o) => session.spawnPrivileged(o),
203
+ run: (o) => session.runPrivileged(o)
204
+ };
205
+ return session.observer ? [session.observer, privileged] : [privileged];
206
+ }
207
+ const killHost = (pid) => {
208
+ if (pid === void 0) return;
209
+ try {
210
+ process.kill(pid, "SIGKILL");
211
+ } catch {}
212
+ };
213
+ /**
214
+ * Starts reading what a sandbox uses, on the first of `hosts` whose script prints its limits: one
215
+ * that ends without them (no observer, no cgroup to find there) hands over to the next.
216
+ */
217
+ function startMeter(hosts, mode, machine, sampleMs = SAMPLE_MS) {
218
+ const scope = mode === "container" ? "container" : "machine";
219
+ let limits = null;
220
+ const readings = [];
221
+ let stopping = false;
222
+ let current;
223
+ let measuring;
224
+ let begin = () => {};
225
+ const started = new Promise((resolve) => {
226
+ begin = resolve;
227
+ });
228
+ const take = (line, host, at = performance.now()) => {
229
+ const parsed = parseLine(line, at);
230
+ if (!parsed) return;
231
+ if ("limits" in parsed) {
232
+ limits ??= parsed.limits;
233
+ measuring ??= host;
234
+ begin();
235
+ } else readings.push(parsed.reading);
236
+ };
237
+ const read = (async () => {
238
+ for (const host of hosts) {
239
+ if (stopping) return;
240
+ const proc = await Promise.resolve().then(() => host.spawn({ command: command(mode, String(sampleMs / 1e3), host.target) })).catch(() => null);
241
+ if (!proc) continue;
242
+ current = {
243
+ host,
244
+ proc
245
+ };
246
+ let rest = "";
247
+ const decoder = new TextDecoder();
248
+ try {
249
+ for await (const chunk of proc.stdout) {
250
+ const lines = (rest + decoder.decode(chunk, { stream: true })).split("\n");
251
+ rest = lines.pop() ?? "";
252
+ for (const line of lines) take(line, host);
253
+ }
254
+ } catch {}
255
+ if (measuring || stopping) return;
256
+ await Promise.resolve(proc.kill()).catch(() => {});
257
+ }
258
+ })();
259
+ const ready = async (signal) => {
260
+ let end = () => {};
261
+ const ended = new Promise((resolve) => {
262
+ end = resolve;
263
+ });
264
+ const timer = setTimeout(end, START_TIMEOUT_MS);
265
+ signal?.addEventListener("abort", end, { once: true });
266
+ if (signal?.aborted) end();
267
+ await Promise.race([
268
+ started,
269
+ read,
270
+ ended
271
+ ]);
272
+ clearTimeout(timer);
273
+ signal?.removeEventListener("abort", end);
274
+ };
275
+ return {
276
+ ready,
277
+ async stop({ gone }) {
278
+ if (!gone) await ready();
279
+ stopping = true;
280
+ let final = false;
281
+ const host = measuring ?? current?.host;
282
+ if (!gone && host) {
283
+ const r = await Promise.resolve(host.run({
284
+ command: command(mode, "once", host.target),
285
+ abortSignal: AbortSignal.timeout(FINAL_TIMEOUT_MS)
286
+ })).catch(() => null);
287
+ const at = performance.now();
288
+ for (const line of r?.exitCode === 0 ? r.stdout.split("\n") : []) {
289
+ const parsed = parseLine(line, at);
290
+ if (parsed && "reading" in parsed) {
291
+ readings.push(parsed.reading);
292
+ final = true;
293
+ } else if (parsed) limits ??= parsed.limits;
294
+ }
295
+ }
296
+ const proc = current?.proc;
297
+ if (gone) killHost(proc?.pid);
298
+ else await Promise.resolve(proc?.kill()).catch(() => {});
299
+ await Promise.race([read, new Promise((resolve) => setTimeout(resolve, 1e3))]);
300
+ readings.sort((x, y) => x.at - y.at);
301
+ return summarize(scope, machine, limits, readings, {
302
+ sampleMs,
303
+ partial: !final
304
+ });
305
+ }
306
+ };
307
+ }
308
+ /**
309
+ * A meter for a machine other attempts run on at the same time: no readings, whose whole-VM
310
+ * usage would count theirs too, only the machine's sizes from one reading at teardown.
311
+ */
312
+ function sharedMeter(hosts, mode, machine) {
313
+ return {
314
+ ready: async () => {},
315
+ async stop({ gone }) {
316
+ let limits = null;
317
+ const host = hosts.at(-1);
318
+ if (!gone && host) {
319
+ const r = await Promise.resolve(host.run({
320
+ command: command(mode, "once", host.target),
321
+ abortSignal: AbortSignal.timeout(FINAL_TIMEOUT_MS)
322
+ })).catch(() => null);
323
+ for (const line of r?.exitCode === 0 ? r.stdout.split("\n") : []) {
324
+ const parsed = parseLine(line, performance.now());
325
+ if (parsed && "limits" in parsed) limits ??= parsed.limits;
326
+ }
327
+ }
328
+ return {
329
+ ...summarize("machine", machine, limits, [], {
330
+ sampleMs: SAMPLE_MS,
331
+ partial: false
332
+ }),
333
+ shared: true
334
+ };
335
+ }
336
+ };
337
+ }
338
+ // src/sandbox/docker.ts
339
+ /**
340
+ * Removes every container still labeled with the run: a worker killed by the signal that
341
+ * canceled the run (SIGTERM to the process group) never destroys its sandboxes.
342
+ */
343
+ async function removeRunContainers(runId, engines = ["docker"]) {
344
+ for (const engine of engines) {
345
+ const r = await docker([
346
+ "ps",
347
+ "-aq",
348
+ "--filter",
349
+ `label=${LABEL.run}=${runId}`
350
+ ], { engine }).catch(() => null);
351
+ const ids = r?.exitCode === 0 ? r.stdout.toString("utf8").split(/\s+/).filter(Boolean) : [];
352
+ if (ids.length) await docker([...ENGINES[engine].rmForce, ...ids], { engine }).catch(() => {});
353
+ }
354
+ }
355
+ /** Distinct gateway warnings an attempt prints before one line says there are more. */
356
+ const GATEWAY_WARNINGS = 5;
357
+ /**
358
+ * The gateway's events as debug lines: one per request, with DNS decisions and headers traced.
359
+ * Refused requests to the harness's expected hosts are traced only; teardown summarizes them.
360
+ */
361
+ function gatewayEvents(debug, credential, expected) {
362
+ if (!debug) return void 0;
363
+ return (event) => {
364
+ if (event.type === "dns") {
365
+ debug.trace("gateway", "dns", event, `dns ${event.host} ${event.allowed ? `→ ${event.addresses?.join(", ")}` : `${event.unresolved ? "unresolved" : "refused"}: ${event.reason}`}`);
366
+ return;
367
+ }
368
+ const { requestHeaders, responseHeaders, type: _, credentials, ...rest } = event;
369
+ const substituted = [...rest.substituted, ...credentials.length && credential ? [`${credential} (${credentials.join(", ")})`] : []];
370
+ debug.request({
371
+ at: new Date(Date.now() - event.ms).toISOString(),
372
+ ...rest,
373
+ substituted
374
+ }, {
375
+ request: requestHeaders,
376
+ response: responseHeaders
377
+ }, !rest.allowed && expected.includes(rest.host));
378
+ for (const name of substituted) debug.log("broker", `substituted ${name} for ${event.host} (${event.method} ${event.url})`);
379
+ };
380
+ }
381
+ /**
382
+ * What every sandbox behind the egress gateway shares: the gateway's options (policy, brokering,
383
+ * event and warning glue) and the record fields its events fill in.
384
+ */
385
+ function gatewayGlue(options) {
386
+ const { brokering, substitutions = [] } = options;
387
+ const brokered = [.../* @__PURE__ */ new Set([...brokering ? [brokering.credential] : [], ...substitutions.map((s) => s.name)])];
388
+ const debug = attemptDebug();
389
+ const policy = gatewayPolicy(setupEgress(options.egress));
390
+ const served = [];
391
+ const asked = [];
392
+ const brokeredStatuses = [];
393
+ const servedModel = brokering?.servedModel;
394
+ const askedModel = brokering?.askedModel;
395
+ const upstream = brokering?.upstream;
396
+ const upstreams = /* @__PURE__ */ new Map();
397
+ const calls = [];
398
+ let cost;
399
+ const logEvent = gatewayEvents(debug, brokering?.credential, options.expectedBlocked ?? []);
400
+ const onEvent = (event) => {
401
+ logEvent?.(event);
402
+ if (event.type === "dns") return;
403
+ const ok = event.status === void 0 || event.status >= 200 && event.status <= 299;
404
+ const request = {
405
+ method: event.method,
406
+ host: event.host,
407
+ path: URL.canParse(event.url) ? new URL(event.url).pathname : event.url,
408
+ ...event.status !== void 0 ? { status: event.status } : {},
409
+ ...event.responseModel ? { responseModel: event.responseModel } : {},
410
+ ...event.responseEffort ? { responseEffort: event.responseEffort } : {},
411
+ ...event.responseProvider ? { responseProvider: event.responseProvider } : {},
412
+ ...event.responseCost !== void 0 ? { responseCost: event.responseCost } : {},
413
+ ...event.requestHeaders ? { headers: event.requestHeaders } : {}
414
+ };
415
+ const model = ok ? servedModel?.(request) : void 0;
416
+ if (event.modelCall) calls.push({
417
+ startedAt: Date.now() - event.ms,
418
+ ms: event.ms,
419
+ firstByteMs: event.firstByteMs ?? null,
420
+ request: `${request.method} ${request.host}${request.path}`,
421
+ status: event.status ?? null,
422
+ usage: callUsage(event.responseUsage),
423
+ model: model ?? (ok ? event.usageModel : void 0) ?? null,
424
+ tools: event.requestTools ?? null,
425
+ ...brokering?.modelStream ? { stream: true } : {}
426
+ });
427
+ if (event.credentials.length === 0) return;
428
+ if (event.status !== void 0) brokeredStatuses.push(event.status);
429
+ if (!ok) return;
430
+ if (model) served.push(model);
431
+ const wanted = askedModel?.(request);
432
+ if (wanted) asked.push(wanted);
433
+ const by = upstream?.(request);
434
+ if (by) {
435
+ upstreams.set(by.provider, (upstreams.get(by.provider) ?? 0) + 1);
436
+ if (by.costUsd !== void 0) cost = (cost ?? 0) + by.costUsd;
437
+ }
438
+ };
439
+ const warned = /* @__PURE__ */ new Set();
440
+ const warn = (text) => {
441
+ if (warned.has(text) || warned.size > GATEWAY_WARNINGS) return;
442
+ warned.add(text);
443
+ const shown = warned.size > GATEWAY_WARNINGS ? "the egress gateway has more warnings for this attempt, not shown; its egress.blocked lists the requests it refused" : text;
444
+ if (options.onWarning) options.onWarning(shown);
445
+ else console.warn(`warning: ${shown}`);
446
+ };
447
+ const egress = {
448
+ policy,
449
+ log: process.env.REEVAL_DEBUG ? (line) => console.error(line) : void 0,
450
+ onEvent,
451
+ onUnsubstituted: ({ name, where, in: places, method, url }) => warn(`the egress gateway sent ${method} ${url} with ${name}'s placeholder in the ${where}, where it isn't substituted: add '${where}' to its in (now ${JSON.stringify(places)}) if the API takes it there`),
452
+ ...brokering && {
453
+ endpoints: brokering.endpoints,
454
+ ...brokering.modelResponses ? { modelResponses: brokering.modelResponses } : {},
455
+ ...brokering.modelCalls ? { modelCalls: brokering.modelCalls } : {},
456
+ ...brokering.tokens ? { derivedTokens: [brokering.tokens] } : {},
457
+ ...brokering.localResponses ? { localResponses: brokering.localResponses } : {},
458
+ onRefused: ({ method, url }) => warn(`the egress gateway refused ${method} ${url}: it carries ${brokering.credential}'s placeholder and isn't one of the endpoints reeval brokers it for`)
459
+ }
460
+ };
461
+ /** The record fields the gateway's events fill in, for a sandbox on `network`. */
462
+ const recorded = (network) => ({
463
+ ...network.traffic && network.egress?.active && { traffic: network.traffic },
464
+ ...servedModel && {
465
+ servedModels: () => [...new Set(served)],
466
+ servedRequests: () => [...served]
467
+ },
468
+ ...askedModel && { askedModels: () => [...new Set(asked)] },
469
+ ...upstream && {
470
+ upstreams: () => [...upstreams].map(([provider, calls]) => ({
471
+ provider,
472
+ calls
473
+ })),
474
+ reportedCostUsd: () => cost
475
+ },
476
+ ...brokering && { brokeredStatuses: () => [...brokeredStatuses] },
477
+ ...brokering?.modelCalls && { modelCalls: () => [...calls] },
478
+ ...network.setSubstitutions && { setSubstitutions: (subs) => network.setSubstitutions?.(subs) ?? Promise.resolve() },
479
+ ...network.setEgress && network.egress?.active && { setEgress: async (o) => {
480
+ debug?.log("container", o.direct ? `the ${o.phase} phase keeps the container's network` : `the ${o.phase} phase has the gateway as its only way out`);
481
+ await network.setEgress?.(o).catch((error) => {
482
+ throw new InfraError(`Couldn't start the ${o.phase} phase's egress: ${error.message}`);
483
+ });
484
+ } }
485
+ });
486
+ return {
487
+ brokered,
488
+ debug,
489
+ egress,
490
+ recorded
491
+ };
492
+ }
493
+ /**
494
+ * A sandbox on a harness session: the workspace under the session's default working directory
495
+ * ({@link SANDBOX_ROOT} in a container), the agent's home, and reeval's own privileged execs in
496
+ * `stateDir` ({@link SANDBOX_STATE} unless set).
497
+ */
498
+ async function sessionSandbox(network, glue, options) {
499
+ const workdir = posix.join(network.defaultWorkingDirectory, WORKSPACE_DIR);
500
+ const stateDir = options.stateDir ?? "/var/lib/reeval";
501
+ await network.run({ command: `mkdir -p ${shellQuote(workdir)}` });
502
+ const home = (await network.run({ command: "printf %s \"$HOME\"" })).stdout || "/home/reeval";
503
+ const resolve = (path) => path.startsWith("~/") ? posix.join(home, path.slice(2)) : posix.resolve(workdir, path);
504
+ const execOwn = async (command, opts) => options.root ? network.run({
505
+ command,
506
+ workingDirectory: stateDir,
507
+ abortSignal: opts?.signal
508
+ }) : network.runPrivileged({
509
+ command,
510
+ abortSignal: opts?.signal
511
+ });
512
+ return {
513
+ workdir,
514
+ home,
515
+ stateDir,
516
+ execOwn,
517
+ network,
518
+ exec: async (command, opts) => network.run({
519
+ command,
520
+ workingDirectory: opts?.cwd ? posix.resolve(workdir, opts.cwd) : workdir,
521
+ ...opts?.env ? { env: opts.env } : {},
522
+ abortSignal: opts?.signal
523
+ }),
524
+ readFile: async (path) => await network.readTextFile({ path: resolve(path) }) ?? null,
525
+ ...glue.recorded(network),
526
+ writeFile: async (path, content) => typeof content === "string" ? network.writeTextFile({
527
+ path: resolve(path),
528
+ content
529
+ }) : network.writeBinaryFile({
530
+ path: resolve(path),
531
+ content
532
+ }),
533
+ getPortEndpoint: async ({ port, protocol = "http" }) => network.getPortEndpoint({
534
+ port,
535
+ protocol
536
+ }),
537
+ oomKills: options.oomKills,
538
+ meter: () => (options.resources.shared ? sharedMeter : startMeter)(samplerHosts(network), options.resources.mode, options.resources.machine),
539
+ destroy: async () => {
540
+ await Promise.resolve(network.destroy()).catch(() => {});
541
+ }
542
+ };
543
+ }
544
+ async function createDockerSandbox(descriptor, options) {
545
+ const image = options.image ?? descriptor.image ?? DEFAULT_IMAGE;
546
+ const engine = descriptor.engine ?? "docker";
547
+ const spec = engineSpec(engine);
548
+ if (!await imageInfo(image, engine)) throw new InfraError(`${spec.name} image ${image} not found. Build it with: reeval image build`);
549
+ const { root, capabilities, memory, swap, cpus, pids } = descriptor;
550
+ return containerSandbox(options, {
551
+ image,
552
+ engine,
553
+ fn: spec.fn,
554
+ ...root !== void 0 && { root },
555
+ ...capabilities && { capabilities },
556
+ limits: {
557
+ ...memory !== void 0 && { memory },
558
+ ...swap !== void 0 && { swap },
559
+ ...cpus !== void 0 && { cpus },
560
+ ...pids !== void 0 && { pids }
561
+ },
562
+ machine: { sandbox: engine }
563
+ });
564
+ }
565
+ /**
566
+ * The attempt in a new container of `image` on `engine`, the local CLI or a machine's over SSH,
567
+ * with the egress gateway as its way out: always started, so every attempt's egress is recorded.
568
+ */
569
+ async function containerSandbox(options, o) {
570
+ const { image, engine, root, limits } = o;
571
+ const spec = engineSpec(engine);
572
+ const glue = gatewayGlue(options);
573
+ const { brokered, debug } = glue;
574
+ const started = performance.now();
575
+ const nodeHint = `The egress gateway needs Node in the image: start from a Debian or Ubuntu image with ${o.fn}({ from: '${image}' }) or ${o.fn}({ dockerfile }), and reeval adds it.`;
576
+ const needsNode = (reason) => brokered.length > 0 ? brokeringRefusal(`${o.fn}()`, brokered, reason, nodeHint) : new InfraError(`Can't enforce egress ${egressLabel(options.egress) || "proxy"}: the egress gateway, the sandbox's only way out, could not start (${reason}). ${nodeHint}`);
577
+ const network = await createDockerSession({
578
+ image,
579
+ engine,
580
+ env: options.env,
581
+ ...root !== void 0 && { root },
582
+ ...o.capabilities && { capabilities: o.capabilities },
583
+ limits,
584
+ labels: { [LABEL.run]: options.runId },
585
+ lifetimeMs: options.timeoutMs,
586
+ abortSignal: options.signal,
587
+ egress: {
588
+ ...glue.egress,
589
+ direct: isDirect(setupEgress(options.egress).policy),
590
+ detachLater: !isDirect(options.egress.policy)
591
+ }
592
+ }).catch((error) => {
593
+ if (!(error instanceof EgressUnavailableError)) throw error;
594
+ throw error.network ? new InfraError(`Can't enforce egress ${egressLabel(options.egress) || "proxy"}: ${error.reason}.`) : needsNode(error.reason);
595
+ });
596
+ debug?.log("container", `created ${network.id.slice(0, 12)} from ${image}${isRemoteEngine(engine) ? ` on ${engine.description}` : ""} in ${Math.round(performance.now() - started)}ms`);
597
+ debug?.log("container", `network policy ${egressLabel(options.egress) || "proxy"}${isDirect(setupEgress(options.egress).policy) ? ` · keeps its ${spec.name} network, so traffic that ignores the proxy goes out directly, unrecorded` : ` · detached from every ${spec.name} network, the gateway is its only way out`}`);
598
+ logGateway(debug, network.egress, brokered);
599
+ if (network.egress?.active === false && brokered.length > 0) {
600
+ await Promise.resolve(network.destroy()).catch(() => {});
601
+ throw needsNode(network.egress.reason);
602
+ }
603
+ return sessionSandbox(network, glue, {
604
+ ...root !== void 0 && { root },
605
+ resources: {
606
+ mode: "container",
607
+ machine: o.machine
608
+ },
609
+ oomKills: async () => {
610
+ const kills = await network.oomKills();
611
+ if (kills === null) return null;
612
+ const limit = String(limits.memory ?? DEFAULT_LIMITS.memory);
613
+ const onTop = limits.swap === void 0 ? limit : String(limits.swap);
614
+ return {
615
+ kills,
616
+ limit,
617
+ swap: /^0+(\.0+)?[bkmg]?$/i.test(onTop) ? null : onTop
618
+ };
619
+ }
620
+ });
621
+ }
622
+ // src/sandbox/start.ts
623
+ /** How long installing the harness's CLI in a new machine may take. */
624
+ const INSTALL_TIMEOUT_MS = 6e5;
625
+ /**
626
+ * Brokered values never enter the sandbox: with no gateway to swap them in, the attempt can't
627
+ * start. `helper` names the sandbox (`boat()`), `hint` says what the gateway needs there.
628
+ */
629
+ const brokeringRefusal = (helper, brokered, reason, hint) => new InfraError(`Can't keep ${brokered.join(", ")} out of the ${helper} sandbox: credential brokering could not start (${reason})${hint ? `. ${hint}` : ""}`);
630
+ /** The debug line saying whether the gateway runs and what it brokers. */
631
+ function logGateway(debug, egress, brokered) {
632
+ debug?.log("container", egress?.active ? `egress gateway started · brokers ${brokered.join(", ") || "nothing"}` : `egress gateway not running: ${egress?.reason ?? "not asked for"}`);
633
+ }
634
+ /**
635
+ * The start of a machine sandbox: boot it, start the egress gateway on it, refuse brokered values
636
+ * the gateway can't keep out, install the harness under a deadline of its own, and hand back the
637
+ * sandbox. Anything that fails after the boot removes the machine.
638
+ */
639
+ async function startSandbox(options, start) {
640
+ const { signal } = options;
641
+ const glue = gatewayGlue(options);
642
+ const { brokered, debug } = glue;
643
+ const machine = await start.boot();
644
+ let gateway;
645
+ let destroyed;
646
+ const destroy = () => {
647
+ destroyed ??= (async () => {
648
+ await gateway?.close();
649
+ await machine.destroy();
650
+ })();
651
+ return destroyed;
652
+ };
653
+ try {
654
+ let noGateway;
655
+ try {
656
+ gateway = await startGateway(machine.root, machine.proxyPort === void 0 ? glue.egress : {
657
+ ...glue.egress,
658
+ port: machine.proxyPort
659
+ }, signal);
660
+ } catch (error) {
661
+ if (signal.aborted) throw signal.reason;
662
+ noGateway = error.message;
663
+ }
664
+ if (!gateway && [options.egress, setupEgress(options.egress)].some((e) => isRestricted(e.policy))) throw new InfraError(`Can't enforce egress ${egressLabel(options.egress)}: the egress gateway could not start in the ${start.helper} sandbox (${noGateway})`);
665
+ if (start.networkNote) debug?.log("container", start.networkNote);
666
+ logGateway(debug, gateway ? { active: true } : {
667
+ active: false,
668
+ reason: noGateway ?? ""
669
+ }, brokered);
670
+ if (!gateway && brokered.length) throw brokeringRefusal(start.helper, brokered, noGateway ?? "", start.hint);
671
+ if (gateway) await machine.onGateway?.(gateway, signal);
672
+ if (signal.aborted) throw signal.reason;
673
+ const network = machine.session({
674
+ gateway,
675
+ noGateway,
676
+ destroy
677
+ });
678
+ const needed = start.install && !machine.installed && options.harness ? harnessBake(options.harness) : null;
679
+ const bake = needed && !await machine.installedElsewhere?.() ? needed : null;
680
+ if (bake) {
681
+ const installing = performance.now();
682
+ const deadline = AbortSignal.timeout(INSTALL_TIMEOUT_MS);
683
+ const stop = AbortSignal.any([signal, deadline]);
684
+ const install = installHarness(network, bake, { signal: stop });
685
+ install.catch(() => {});
686
+ const stopped = new Promise((_, reject) => {
687
+ if (stop.aborted) reject(stop.reason);
688
+ stop.addEventListener("abort", () => reject(stop.reason), { once: true });
689
+ });
690
+ stopped.catch(() => {});
691
+ const version = await Promise.race([install, stopped]).catch((error) => {
692
+ if (signal.aborted) throw error;
693
+ throw new InfraError(deadline.aborted ? `Installing ${bake.name} in ${start.helper} sandbox ${network.id} didn't finish within ${INSTALL_TIMEOUT_MS / 6e4} minutes` : `Installing ${bake.name} in ${start.helper} sandbox ${network.id} failed: ${error.message}`);
694
+ });
695
+ debug?.log("container", `installed ${bake.name} ${version} in ${Math.round(performance.now() - installing)}ms`);
696
+ await machine.onInstalled?.();
697
+ }
698
+ return await sessionSandbox(network, glue, {
699
+ ...machine.stateDir && { stateDir: machine.stateDir },
700
+ oomKills: async () => null,
701
+ resources: {
702
+ mode: start.darwin ? "darwin" : "machine",
703
+ machine: {
704
+ ...start.machine,
705
+ ...machine.vm
706
+ },
707
+ ...start.shared && { shared: true }
708
+ }
709
+ });
710
+ } catch (error) {
711
+ machine.failed?.();
712
+ await destroy().catch(() => {});
713
+ throw error;
714
+ }
715
+ }
716
+ export { removeRunContainers as a, gatewayGlue as i, containerSandbox as n, sessionSandbox as o, createDockerSandbox as r, startSandbox as t };
717
+
718
+ //# sourceMappingURL=start-COB07NpH.js.map