reeval 0.19.0 → 0.21.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 (436) hide show
  1. package/CHANGELOG.md +803 -0
  2. package/README.md +15 -15
  3. package/THIRD_PARTY_NOTICES.md +5 -5
  4. package/assets/gateway-models.mjs +65 -31
  5. package/dist/{adapter-C8xPuXYq.js → adapter-BdzhdRYo.js} +8 -6
  6. package/dist/adapter-BdzhdRYo.js.map +1 -0
  7. package/dist/{agent-CBoLndM7.js → agent-Dx-bDmlV.js} +179 -31
  8. package/dist/agent-Dx-bDmlV.js.map +1 -0
  9. package/dist/{agents-C6zhkxp3.js → agents-l0-k7vw3.js} +362 -102
  10. package/dist/agents-l0-k7vw3.js.map +1 -0
  11. package/dist/{app-files-DT5mJyV4.js → app-files-B-CQYB0c.js} +3 -3
  12. package/dist/app-files-B-CQYB0c.js.map +1 -0
  13. package/dist/{assemble-UPCRrtOz.js → assemble-CYMpN8LC.js} +1 -1
  14. package/dist/{assemble-t6h018An.js → assemble-CsZIcJo8.js} +171 -18
  15. package/dist/assemble-CsZIcJo8.js.map +1 -0
  16. package/dist/{attempt-CAdlwlNu.js → attempt-CKfKsqqw.js} +2 -2
  17. package/dist/{attempt-CAdlwlNu.js.map → attempt-CKfKsqqw.js.map} +1 -1
  18. package/dist/{attempt-host-CIm1-11m.js → attempt-host-BwSmNYkX.js} +17 -8
  19. package/dist/attempt-host-BwSmNYkX.js.map +1 -0
  20. package/dist/{boat-BjLqFJIZ.js → boat-CZpAreTB.js} +3 -3
  21. package/dist/{boat-BjLqFJIZ.js.map → boat-CZpAreTB.js.map} +1 -1
  22. package/dist/{boat-CJCtzfB1.js → boat-su1Y7LPd.js} +17 -14
  23. package/dist/boat-su1Y7LPd.js.map +1 -0
  24. package/dist/bridge/index.mjs +113 -8
  25. package/dist/{capture-iBzFiC0j.js → capture-BqIAeFyC.js} +55 -29
  26. package/dist/{capture-iBzFiC0j.js.map → capture-BqIAeFyC.js.map} +1 -1
  27. package/dist/capture-D0Ln5aCP.js +1 -0
  28. package/dist/{cases-z9E6DCd5.js → cases-CM-MQRQp.js} +133 -19
  29. package/dist/cases-CM-MQRQp.js.map +1 -0
  30. package/dist/cases-FvhbM8M5.js +1 -0
  31. package/dist/{cli-20Fpvs5H.js → cli-s_3opn_I.js} +219 -109
  32. package/dist/cli-s_3opn_I.js.map +1 -0
  33. package/dist/{cli-spec-Dsr79Qy1.js → cli-spec-DxzIjmq_.js} +109 -26
  34. package/dist/cli-spec-DxzIjmq_.js.map +1 -0
  35. package/dist/cli.js +2 -2
  36. package/dist/client-C5fIzHQa.js +803 -0
  37. package/dist/client-C5fIzHQa.js.map +1 -0
  38. package/dist/{command-CRh-cb6Z.js → command-B5OAIjp7.js} +25 -21
  39. package/dist/command-B5OAIjp7.js.map +1 -0
  40. package/dist/{command-BLNVDiIg.js → command-BJ7KqczP.js} +10 -10
  41. package/dist/{command-BLNVDiIg.js.map → command-BJ7KqczP.js.map} +1 -1
  42. package/dist/{command-aUJvENwy.js → command-BXLZsEwQ.js} +16 -16
  43. package/dist/{command-aUJvENwy.js.map → command-BXLZsEwQ.js.map} +1 -1
  44. package/dist/{command-B5OyHpOu.js → command-DA_SHQUQ.js} +16 -16
  45. package/dist/{command-B5OyHpOu.js.map → command-DA_SHQUQ.js.map} +1 -1
  46. package/dist/{commands-CWy-WndG.js → commands-BKBamOcX.js} +174 -40
  47. package/dist/commands-BKBamOcX.js.map +1 -0
  48. package/dist/{commands-CfdBX-mc.js → commands-BPvAOEmb.js} +1 -1
  49. package/dist/{config-B9mB1kF5.js → config-C0URar0t.js} +255 -89
  50. package/dist/config-C0URar0t.js.map +1 -0
  51. package/dist/{context-Bkv3ndjq.js → context-Sj58aJEu.js} +2 -2
  52. package/dist/{context-Bkv3ndjq.js.map → context-Sj58aJEu.js.map} +1 -1
  53. package/dist/{cost-BdRgySQl.js → cost-C21gGrju.js} +19 -9
  54. package/dist/cost-C21gGrju.js.map +1 -0
  55. package/dist/cost-IM80LyGD.js +1 -0
  56. package/dist/{cursor-catalog-BSn9xjmo.js → cursor-catalog-FWgSo-T1.js} +4 -4
  57. package/dist/{cursor-catalog-BSn9xjmo.js.map → cursor-catalog-FWgSo-T1.js.map} +1 -1
  58. package/dist/db-Bc4L-Wcr.js +2 -0
  59. package/dist/{db-zgC1tvKB.js → db-BjAWxVAG.js} +142 -248
  60. package/dist/db-BjAWxVAG.js.map +1 -0
  61. package/dist/debug-CIXzB4wK.js.map +1 -1
  62. package/dist/{default-effort-BAy8ixd1.js → default-effort-CWlhZ6U1.js} +1 -1
  63. package/dist/{default-effort-DGhQmu95.js → default-effort-Ck2GYIxX.js} +4 -4
  64. package/dist/{default-effort-DGhQmu95.js.map → default-effort-Ck2GYIxX.js.map} +1 -1
  65. package/dist/{dist-CAFD1yfv.js → dist-DeqeCUZe.js} +15 -8
  66. package/dist/dist-DeqeCUZe.js.map +1 -0
  67. package/dist/{docker-DAMnm3L9.js → docker-CDdK6Ity.js} +49 -22
  68. package/dist/docker-CDdK6Ity.js.map +1 -0
  69. package/dist/{docker-Cqw-CyWz.js → docker-D74l67k8.js} +4 -4
  70. package/dist/{docker-Cqw-CyWz.js.map → docker-D74l67k8.js.map} +1 -1
  71. package/dist/{docker-Dr4XeDc8.js → docker-DMug3l-a.js} +1 -1
  72. package/dist/{doctor-B2PohneB.js → doctor-eFxyn6at.js} +85 -46
  73. package/dist/doctor-eFxyn6at.js.map +1 -0
  74. package/dist/{environment-DB8o3hGi.js → environment-CJIKz-Ud.js} +49 -11
  75. package/dist/environment-CJIKz-Ud.js.map +1 -0
  76. package/dist/{errors-BZgLSZtV.js → errors-C1GBcWE2.js} +2 -2
  77. package/dist/{errors-BZgLSZtV.js.map → errors-C1GBcWE2.js.map} +1 -1
  78. package/dist/{eval-source-D3sbAzt-.js → eval-source-CXIRJ91v.js} +24 -12
  79. package/dist/eval-source-CXIRJ91v.js.map +1 -0
  80. package/dist/{evaluate-CwKeN_fo.js → evaluate-DA4QsrHO.js} +792 -281
  81. package/dist/evaluate-DA4QsrHO.js.map +1 -0
  82. package/dist/{evaluate-COdzf7Hl.d.ts → evaluate-DHrU4Wld.d.ts} +2 -2
  83. package/dist/fake-bootstrap-CnwWG3kP.js +15 -0
  84. package/dist/fake-bootstrap-CnwWG3kP.js.map +1 -0
  85. package/dist/{files-BiFU16BW.js → files-BVVWAS0A.js} +6 -6
  86. package/dist/{files-BiFU16BW.js.map → files-BVVWAS0A.js.map} +1 -1
  87. package/dist/files-BaqXvB88.js +1 -0
  88. package/dist/{files-BEwfjD8J.js → files-Bey1VAex.js} +3 -3
  89. package/dist/{files-BEwfjD8J.js.map → files-Bey1VAex.js.map} +1 -1
  90. package/dist/files-BjOJw4sn.js +1 -0
  91. package/dist/{files-DgXyaAg6.js → files-BrGVs4gY.js} +2 -2
  92. package/dist/{files-DgXyaAg6.js.map → files-BrGVs4gY.js.map} +1 -1
  93. package/dist/files-CNHhSyb3.js +1 -0
  94. package/dist/files-CW1lChNh.js +1 -0
  95. package/dist/{files-BRzV7aPh.js → files-D6j-XpaK.js} +5 -5
  96. package/dist/{files-BRzV7aPh.js.map → files-D6j-XpaK.js.map} +1 -1
  97. package/dist/{files-Cl7BQ5gE.js → files-F44NRCN0.js} +143 -20
  98. package/dist/files-F44NRCN0.js.map +1 -0
  99. package/dist/{files-DlQshsks.js → files-g1watgRC.js} +2 -2
  100. package/dist/{files-DlQshsks.js.map → files-g1watgRC.js.map} +1 -1
  101. package/dist/gateway.d.ts +1 -1
  102. package/dist/{git-fDiJ8UIV.js → git-Jqkf9SBa.js} +3 -3
  103. package/dist/{git-fDiJ8UIV.js.map → git-Jqkf9SBa.js.map} +1 -1
  104. package/dist/{harness-DXv2gnaT.js → harness-FcTyyPco.js} +17 -8
  105. package/dist/harness-FcTyyPco.js.map +1 -0
  106. package/dist/{harness-C2berMiM.js → harness-nwnyghJZ.js} +14 -11
  107. package/dist/{harness-C2berMiM.js.map → harness-nwnyghJZ.js.map} +1 -1
  108. package/dist/harness.d.ts +11 -8
  109. package/dist/harness.js +1 -1
  110. package/dist/{ids-C_advdJA.js → ids-B-JKTCP8.js} +2 -2
  111. package/dist/{ids-C_advdJA.js.map → ids-B-JKTCP8.js.map} +1 -1
  112. package/dist/{images-BNgcR77K.js → images-Dsc4Wi-F.js} +65 -30
  113. package/dist/images-Dsc4Wi-F.js.map +1 -0
  114. package/dist/index.d.ts +46 -7
  115. package/dist/index.js +6 -6
  116. package/dist/init-C0oUG3jh.js +1 -0
  117. package/dist/{init-DbuZVRrW.js → init-QB5ecPDA.js} +33 -14
  118. package/dist/init-QB5ecPDA.js.map +1 -0
  119. package/dist/{ink-list-BpfidQ1h.js → ink-list-mCJypk3d.js} +2 -2
  120. package/dist/{ink-list-BpfidQ1h.js.map → ink-list-mCJypk3d.js.map} +1 -1
  121. package/dist/{invocations-CxGNOlh0.js → invocations-BSr4lRzI.js} +5 -5
  122. package/dist/{invocations-CxGNOlh0.js.map → invocations-BSr4lRzI.js.map} +1 -1
  123. package/dist/{judge-COMXT1Hx.js → judge-eGH39PaP.js} +12 -10
  124. package/dist/{judge-COMXT1Hx.js.map → judge-eGH39PaP.js.map} +1 -1
  125. package/dist/judge.d.ts +3 -1
  126. package/dist/judge.js +1 -1
  127. package/dist/{judgments-CzgpsTqv.js → judgments-Cj8bFaDG.js} +2 -2
  128. package/dist/{judgments-CzgpsTqv.js.map → judgments-Cj8bFaDG.js.map} +1 -1
  129. package/dist/{layout-Cm85tQYk.js → layout-DfQa4mJs.js} +14 -11
  130. package/dist/layout-DfQa4mJs.js.map +1 -0
  131. package/dist/{list-DuThsE28.js → list-Dh6T0kdr.js} +23 -12
  132. package/dist/{list-DuThsE28.js.map → list-Dh6T0kdr.js.map} +1 -1
  133. package/dist/live-DwjWJTdn.js +1 -0
  134. package/dist/{live-CgYbO4Te.js → live-xTZs0c61.js} +2 -2
  135. package/dist/{live-CgYbO4Te.js.map → live-xTZs0c61.js.map} +1 -1
  136. package/dist/{live-CnGrRM6j.js → live-y1p3oNXH.js} +9 -9
  137. package/dist/{live-CnGrRM6j.js.map → live-y1p3oNXH.js.map} +1 -1
  138. package/dist/{model-CwwkrCb7.js → model-3pZZzloU.js} +7 -5
  139. package/dist/model-3pZZzloU.js.map +1 -0
  140. package/dist/{model-047Dcd-a.js → model-DEjwetkJ.js} +1 -1
  141. package/dist/{model-V3mMXp6x.js → model-DNpKiHqO.js} +6 -6
  142. package/dist/{model-V3mMXp6x.js.map → model-DNpKiHqO.js.map} +1 -1
  143. package/dist/model-calls-B0BoQfJ4.js +95 -0
  144. package/dist/model-calls-B0BoQfJ4.js.map +1 -0
  145. package/dist/{model-DJjLw-0r.js → model-jRKSQBg6.js} +5 -5
  146. package/dist/{model-DJjLw-0r.js.map → model-jRKSQBg6.js.map} +1 -1
  147. package/dist/model-nfewGTzB.js +1 -0
  148. package/dist/{node-D7pAU--0.js → node-DM-mLGdX.js} +7 -7
  149. package/dist/{node-D7pAU--0.js.map → node-DM-mLGdX.js.map} +1 -1
  150. package/dist/{opencode-providers-BGiXt8_B.js → opencode-providers-ChJTQRmz.js} +5 -2
  151. package/dist/{opencode-providers-BGiXt8_B.js.map → opencode-providers-ChJTQRmz.js.map} +1 -1
  152. package/dist/{openrouter-models-Cw1z8-sq.js → openrouter-models-C0aRo633.js} +2 -2
  153. package/dist/{openrouter-models-Cw1z8-sq.js.map → openrouter-models-C0aRo633.js.map} +1 -1
  154. package/dist/options-DpsJ_5CU.js +1 -0
  155. package/dist/{patch-DH4e_Gkd.js → patch-Bx-qp8Li.js} +2 -2
  156. package/dist/{patch-DH4e_Gkd.js.map → patch-Bx-qp8Li.js.map} +1 -1
  157. package/dist/pi-providers-HygmL1y-.js +552 -0
  158. package/dist/pi-providers-HygmL1y-.js.map +1 -0
  159. package/dist/{plain-BYUf_fUV.js → plain-Ctn8oUdp.js} +44 -10
  160. package/dist/plain-Ctn8oUdp.js.map +1 -0
  161. package/dist/{plan-Cgq9NCEX.js → plan-ChO0A-xn.js} +63 -12
  162. package/dist/plan-ChO0A-xn.js.map +1 -0
  163. package/dist/{plugins-BkmPxDiY.js → plugins-BioMWncI.js} +636 -9
  164. package/dist/plugins-BioMWncI.js.map +1 -0
  165. package/dist/{preflight-R-InZCQb.js → preflight-BUjk_6wT.js} +1 -1
  166. package/dist/{preflight-CtlloeOQ.js → preflight-CJSGzMzc.js} +8 -9
  167. package/dist/preflight-CJSGzMzc.js.map +1 -0
  168. package/dist/preflight-DD3fI4Hz.js +1 -0
  169. package/dist/{preflight-BElE_q0u.js → preflight-qFCXmxha.js} +4 -4
  170. package/dist/{preflight-BElE_q0u.js.map → preflight-qFCXmxha.js.map} +1 -1
  171. package/dist/{prepare-C7f5mPl5.js → prepare-D7oSSFNm.js} +9 -9
  172. package/dist/{prepare-C7f5mPl5.js.map → prepare-D7oSSFNm.js.map} +1 -1
  173. package/dist/{prepare-CzkAdbXm.js → prepare-xHU2BpN-.js} +2 -2
  174. package/dist/prices-B1vm_lPk.js +1 -0
  175. package/dist/{prices-5m3SzMZ3.js → prices-BrY_ihLs.js} +80 -22
  176. package/dist/prices-BrY_ihLs.js.map +1 -0
  177. package/dist/{provenance-zsc4--dP.js → provenance-B-flBAzR.js} +5 -5
  178. package/dist/{provenance-zsc4--dP.js.map → provenance-B-flBAzR.js.map} +1 -1
  179. package/dist/provider-DHT20Gl8.js +1 -0
  180. package/dist/{provider-BxzZq3Th.js → provider-ieWOn4YS.js} +2 -2
  181. package/dist/{provider-BxzZq3Th.js.map → provider-ieWOn4YS.js.map} +1 -1
  182. package/dist/provider-stop-CxzWW7Ft.js +69 -0
  183. package/dist/provider-stop-CxzWW7Ft.js.map +1 -0
  184. package/dist/{providers-B8xYMeah.js → providers-B6StVyfG.js} +215 -48
  185. package/dist/providers-B6StVyfG.js.map +1 -0
  186. package/dist/providers-Dljf6al6.js +1 -0
  187. package/dist/query-BAc2tQZj.js +1 -0
  188. package/dist/{query-Bb3SYICk.js → query-CkLmJv7R.js} +2 -2
  189. package/dist/{query-Bb3SYICk.js.map → query-CkLmJv7R.js.map} +1 -1
  190. package/dist/{questions-CWlR9ffu.js → questions-CJIh2FSX.js} +7 -7
  191. package/dist/{questions-CWlR9ffu.js.map → questions-CJIh2FSX.js.map} +1 -1
  192. package/dist/{record-6IUzwP9K.js → record-nVVujCW7.js} +2 -2
  193. package/dist/{record-6IUzwP9K.js.map → record-nVVujCW7.js.map} +1 -1
  194. package/dist/{redact-BhjtnjrU.js → redact-DL2BTykw.js} +17 -2
  195. package/dist/redact-DL2BTykw.js.map +1 -0
  196. package/dist/{remarks-vtkPmQb9.js → remarks-B3wjKscW.js} +46 -11
  197. package/dist/remarks-B3wjKscW.js.map +1 -0
  198. package/dist/{remarks-D9Lcd1fF.js → remarks-BpdM_2RC.js} +2 -1
  199. package/dist/remarks-BpdM_2RC.js.map +1 -0
  200. package/dist/remarks-CleoDlYw.js +1 -0
  201. package/dist/{remarks-DPCONFxZ.js → remarks-DqriPKxm.js} +3 -2
  202. package/dist/{remarks-DPCONFxZ.js.map → remarks-DqriPKxm.js.map} +1 -1
  203. package/dist/{remote-BgYWqogI.js → remote-C88amFRN.js} +6 -6
  204. package/dist/{remote-BgYWqogI.js.map → remote-C88amFRN.js.map} +1 -1
  205. package/dist/resolve-Bul8lHaa.js +205 -0
  206. package/dist/resolve-Bul8lHaa.js.map +1 -0
  207. package/dist/resolve-DW92wpIZ.js +1 -0
  208. package/dist/{resolve-Do0ZaYH6.js → resolve-G576PiFJ.js} +14 -11
  209. package/dist/resolve-G576PiFJ.js.map +1 -0
  210. package/dist/{results-JyuM64gy.js → results-zVHIW6xw.js} +9 -22
  211. package/dist/results-zVHIW6xw.js.map +1 -0
  212. package/dist/{resume-AW5oXzUc.js → resume-D_PcUXfG.js} +94 -16
  213. package/dist/resume-D_PcUXfG.js.map +1 -0
  214. package/dist/{retry-ChzISxmy.js → retry-BvTzCxdc.js} +4 -4
  215. package/dist/{retry-ChzISxmy.js.map → retry-BvTzCxdc.js.map} +1 -1
  216. package/dist/{root-Co0jhOT5.js → root-BzeoyfGd.js} +2 -2
  217. package/dist/{root-Co0jhOT5.js.map → root-BzeoyfGd.js.map} +1 -1
  218. package/dist/{vercel-CGlSBv63.js → routes-B0F2R-K7.js} +91 -56
  219. package/dist/routes-B0F2R-K7.js.map +1 -0
  220. package/dist/{runtime-BpW1f1Mx.js → runtime-B3r_pAq6.js} +4 -4
  221. package/dist/{runtime-BpW1f1Mx.js.map → runtime-B3r_pAq6.js.map} +1 -1
  222. package/dist/sandbox/boat.d.ts +1 -1
  223. package/dist/sandbox/boat.js +1 -1
  224. package/dist/{sandbox-kSgr7vo5.js → sandbox-Duh3z1TV.js} +3 -3
  225. package/dist/{sandbox-kSgr7vo5.js.map → sandbox-Duh3z1TV.js.map} +1 -1
  226. package/dist/sandbox.d.ts +1 -1
  227. package/dist/sandbox.js +1 -1
  228. package/dist/server-CGEsvVRG.js +1 -0
  229. package/dist/{server-Cn8VqO9S.js → server-DUWMRKik.js} +8 -8
  230. package/dist/{server-Cn8VqO9S.js.map → server-DUWMRKik.js.map} +1 -1
  231. package/dist/{shared-Cfi45Bvy.js → shared-DtZwIAfy.js} +7 -1
  232. package/dist/shared-DtZwIAfy.js.map +1 -0
  233. package/dist/{source-CYOhR98B.js → source-CHuN4Nfg.js} +2 -2
  234. package/dist/{source-CYOhR98B.js.map → source-CHuN4Nfg.js.map} +1 -1
  235. package/dist/source-Wz1Nrfue.js +1 -0
  236. package/dist/src--yl1OypK.js +2 -0
  237. package/dist/{src-Cb2MWozp.js → src-B-HuDqpH.js} +276 -41
  238. package/dist/src-B-HuDqpH.js.map +1 -0
  239. package/dist/{src-DAzaCTcN.js → src-B5r1d23Y.js} +176 -18
  240. package/dist/src-B5r1d23Y.js.map +1 -0
  241. package/dist/{src-Ck2r_EMT.js → src-BHJ4MWvY.js} +504 -119
  242. package/dist/src-BHJ4MWvY.js.map +1 -0
  243. package/dist/{src-Dw79VLa3.js → src-BI0v8qlZ.js} +202 -56
  244. package/dist/src-BI0v8qlZ.js.map +1 -0
  245. package/dist/src-BL-_0QoE.js +1 -0
  246. package/dist/{src-YvblOrBU.js → src-BqNzHHWn.js} +87 -13
  247. package/dist/src-BqNzHHWn.js.map +1 -0
  248. package/dist/{src-CV_7DkPa.js → src-C-ChdnG6.js} +102 -13
  249. package/dist/src-C-ChdnG6.js.map +1 -0
  250. package/dist/src-C-mOSczH.js +2 -0
  251. package/dist/src-CZaYu6ER.js +3 -0
  252. package/dist/src-CeBhwD8k.js +2 -0
  253. package/dist/src-CkEiiyON.js +2 -0
  254. package/dist/{src-KxS91P7L.js → src-CmA5Yev6.js} +79 -11
  255. package/dist/src-CmA5Yev6.js.map +1 -0
  256. package/dist/src-CwH_nEaw.js +2 -0
  257. package/dist/src-DA95rM6v.js +4 -0
  258. package/dist/{src-DvGns8cz.js → src-DL-EE4DU.js} +299 -17
  259. package/dist/src-DL-EE4DU.js.map +1 -0
  260. package/dist/src-De0KY5S_.js +2 -0
  261. package/dist/{src-BNQznj4z.js → src-boB6D-5T.js} +124 -45
  262. package/dist/src-boB6D-5T.js.map +1 -0
  263. package/dist/state-B3jex5KU.js +1 -0
  264. package/dist/{state-BOLt8pJg.js → state-DUBRDyMk.js} +22 -22
  265. package/dist/{state-BOLt8pJg.js.map → state-DUBRDyMk.js.map} +1 -1
  266. package/dist/store/local.d.ts +8 -0
  267. package/dist/store/local.js +16 -0
  268. package/dist/store/local.js.map +1 -0
  269. package/dist/store/s3.d.ts +10 -0
  270. package/dist/store/s3.js +18 -0
  271. package/dist/store/s3.js.map +1 -0
  272. package/dist/{suite-COglUhPd.js → suite-B9J6Afg6.js} +6 -5
  273. package/dist/{suite-COglUhPd.js.map → suite-B9J6Afg6.js.map} +1 -1
  274. package/dist/suite-Bhs9-Z7O.js +2 -0
  275. package/dist/{summary-DU5zaibx.js → summary-CSp4cfnr.js} +25 -7
  276. package/dist/{summary-DU5zaibx.js.map → summary-CSp4cfnr.js.map} +1 -1
  277. package/dist/sync-CxAY6Dki.js +559 -0
  278. package/dist/sync-CxAY6Dki.js.map +1 -0
  279. package/dist/tart-CcrrtSrp.js +704 -0
  280. package/dist/tart-CcrrtSrp.js.map +1 -0
  281. package/dist/tart-CzViW3WZ.js +186 -0
  282. package/dist/tart-CzViW3WZ.js.map +1 -0
  283. package/dist/tart-DmVuVsmX.js +1 -0
  284. package/dist/tart-bake-F-6seRC9.js +192 -0
  285. package/dist/tart-bake-F-6seRC9.js.map +1 -0
  286. package/dist/tart-bake-RK7RaT9E.js +1 -0
  287. package/dist/tart-cli-B86Jqo1t.js +89 -0
  288. package/dist/tart-cli-B86Jqo1t.js.map +1 -0
  289. package/dist/tart-cli-ClvRniLQ.js +1 -0
  290. package/dist/tart-hosts-Brii7zHM.js +1 -0
  291. package/dist/tart-hosts-DPyZsg-1.js +313 -0
  292. package/dist/tart-hosts-DPyZsg-1.js.map +1 -0
  293. package/dist/{tart-images-DZ_Mbh-g.js → tart-images-CWSf03w8.js} +64 -6
  294. package/dist/tart-images-CWSf03w8.js.map +1 -0
  295. package/dist/testing.d.ts +36 -2
  296. package/dist/testing.js +4 -4
  297. package/dist/tool-class-CVDdJy0H.js +433 -0
  298. package/dist/tool-class-CVDdJy0H.js.map +1 -0
  299. package/dist/{trace-Dx2NBE1O.js → trace-BpXByD7W.js} +13 -2
  300. package/dist/{trace-Dx2NBE1O.js.map → trace-BpXByD7W.js.map} +1 -1
  301. package/dist/{traits-DKnYkqeK.js → traits-CCD8XsmI.js} +2 -2
  302. package/dist/{traits-DKnYkqeK.js.map → traits-CCD8XsmI.js.map} +1 -1
  303. package/dist/{transcript-CCf07UmU.js → transcript-BP_2hji-.js} +3 -3
  304. package/dist/{transcript-CCf07UmU.js.map → transcript-BP_2hji-.js.map} +1 -1
  305. package/dist/{types-DBwFsGem.d.ts → types-BJ0wh8wC.d.ts} +408 -44
  306. package/dist/{types-C2mLpph3.js → types-CbcnJxCy.js} +7 -1
  307. package/dist/types-CbcnJxCy.js.map +1 -0
  308. package/dist/{usage-DJiDnh2D.js → usage-CwIRPPZ9.js} +16 -3
  309. package/dist/usage-CwIRPPZ9.js.map +1 -0
  310. package/dist/{vertex-Eb2wqahk.js → vertex-BEWxHoxH.js} +22 -6
  311. package/dist/{vertex-Eb2wqahk.js.map → vertex-BEWxHoxH.js.map} +1 -1
  312. package/dist/vertex-DXfcXYKn.js +1 -0
  313. package/dist/view/index.d.ts +27 -3
  314. package/dist/view/index.js +8 -8
  315. package/dist/{views-DAIiLiV3.js → views-DRxXCyIH.js} +6 -6
  316. package/dist/{views-DAIiLiV3.js.map → views-DRxXCyIH.js.map} +1 -1
  317. package/dist/views-i67V1ly3.js +2 -0
  318. package/dist/{worker-entry-BIROTPX1.js → worker-entry-C3Q4U63F.js} +12 -9
  319. package/dist/worker-entry-C3Q4U63F.js.map +1 -0
  320. package/dist/workspace-DhUOW8if.js +1 -0
  321. package/dist/{workspace-uuE51x35.js → workspace-P72SXLXr.js} +7 -7
  322. package/dist/{workspace-uuE51x35.js.map → workspace-P72SXLXr.js.map} +1 -1
  323. package/package.json +21 -10
  324. package/skills/eval-rubric/SKILL.md +10 -0
  325. package/skills/reeval/SKILL.md +370 -0
  326. package/skills/reeval/references/capture.md +48 -0
  327. package/skills/reeval/references/cli.md +162 -0
  328. package/skills/reeval/references/compare.md +180 -0
  329. package/skills/reeval/references/config.md +147 -0
  330. package/skills/reeval/references/environments.md +218 -0
  331. package/skills/reeval/references/evals.md +241 -0
  332. package/skills/reeval/references/mistakes.md +39 -0
  333. package/skills/reeval/references/vocabulary.md +19 -0
  334. package/skills/setup/SKILL.md +219 -0
  335. package/skills/setup/references/templates.md +258 -0
  336. package/dist/adapter-C8xPuXYq.js.map +0 -1
  337. package/dist/agent-CBoLndM7.js.map +0 -1
  338. package/dist/agents-C6zhkxp3.js.map +0 -1
  339. package/dist/app-files-DT5mJyV4.js.map +0 -1
  340. package/dist/assemble-t6h018An.js.map +0 -1
  341. package/dist/attempt-host-CIm1-11m.js.map +0 -1
  342. package/dist/boat-CJCtzfB1.js.map +0 -1
  343. package/dist/capture-DoxFUN3J.js +0 -1
  344. package/dist/cases-Dy0mifal.js +0 -1
  345. package/dist/cases-z9E6DCd5.js.map +0 -1
  346. package/dist/cli-20Fpvs5H.js.map +0 -1
  347. package/dist/cli-spec-Dsr79Qy1.js.map +0 -1
  348. package/dist/client-KM4C5r5_.js +0 -387
  349. package/dist/client-KM4C5r5_.js.map +0 -1
  350. package/dist/command-CRh-cb6Z.js.map +0 -1
  351. package/dist/commands-CWy-WndG.js.map +0 -1
  352. package/dist/config-B9mB1kF5.js.map +0 -1
  353. package/dist/cost-BdRgySQl.js.map +0 -1
  354. package/dist/cost-Cr26Alhq.js +0 -1
  355. package/dist/db-P2fXw4nx.js +0 -2
  356. package/dist/db-zgC1tvKB.js.map +0 -1
  357. package/dist/dist-CAFD1yfv.js.map +0 -1
  358. package/dist/docker-DAMnm3L9.js.map +0 -1
  359. package/dist/doctor-B2PohneB.js.map +0 -1
  360. package/dist/environment-DB8o3hGi.js.map +0 -1
  361. package/dist/eval-source-D3sbAzt-.js.map +0 -1
  362. package/dist/evaluate-CwKeN_fo.js.map +0 -1
  363. package/dist/files-B4KQUiM7.js +0 -1
  364. package/dist/files-C1Rk9FYA.js +0 -1
  365. package/dist/files-C3mCC8Mn.js +0 -1
  366. package/dist/files-Cl7BQ5gE.js.map +0 -1
  367. package/dist/files-DnlA1A7N.js +0 -1
  368. package/dist/harness-DXv2gnaT.js.map +0 -1
  369. package/dist/images-BNgcR77K.js.map +0 -1
  370. package/dist/init-4RPeD-K-.js +0 -1
  371. package/dist/init-DbuZVRrW.js.map +0 -1
  372. package/dist/kinds-C1oY3qyC.js +0 -697
  373. package/dist/kinds-C1oY3qyC.js.map +0 -1
  374. package/dist/layout-Cm85tQYk.js.map +0 -1
  375. package/dist/live-CJCK11nh.js +0 -1
  376. package/dist/matchers-CXLn-1jm.js +0 -148
  377. package/dist/matchers-CXLn-1jm.js.map +0 -1
  378. package/dist/model-Cv4GuTsZ.js +0 -1
  379. package/dist/model-CwwkrCb7.js.map +0 -1
  380. package/dist/options-CHubslQf.js +0 -1
  381. package/dist/plain-BYUf_fUV.js.map +0 -1
  382. package/dist/plan-Cgq9NCEX.js.map +0 -1
  383. package/dist/plugins-BkmPxDiY.js.map +0 -1
  384. package/dist/preflight-4gWSy0Pe.js +0 -1
  385. package/dist/preflight-CtlloeOQ.js.map +0 -1
  386. package/dist/prices-5m3SzMZ3.js.map +0 -1
  387. package/dist/provider-BnUoz4KB.js +0 -1
  388. package/dist/providers-B8xYMeah.js.map +0 -1
  389. package/dist/providers-CVu8e0xS.js +0 -1
  390. package/dist/query-DIfkUcPh.js +0 -1
  391. package/dist/redact-BhjtnjrU.js.map +0 -1
  392. package/dist/remarks-CAvTSq16.js +0 -1
  393. package/dist/remarks-D9Lcd1fF.js.map +0 -1
  394. package/dist/remarks-vtkPmQb9.js.map +0 -1
  395. package/dist/resolve-Do0ZaYH6.js.map +0 -1
  396. package/dist/resolve-amw_2Odz.js +0 -1
  397. package/dist/results-JyuM64gy.js.map +0 -1
  398. package/dist/resume-AW5oXzUc.js.map +0 -1
  399. package/dist/server-2_gUnVvf.js +0 -1
  400. package/dist/shared-Cfi45Bvy.js.map +0 -1
  401. package/dist/source-CY3etKzw.js +0 -1
  402. package/dist/src-6Zzyg4Qd.js +0 -2
  403. package/dist/src-BDhcPtnI.js +0 -2
  404. package/dist/src-BNQznj4z.js.map +0 -1
  405. package/dist/src-BRMsk9nh.js +0 -2
  406. package/dist/src-CV_7DkPa.js.map +0 -1
  407. package/dist/src-Cb2MWozp.js.map +0 -1
  408. package/dist/src-Ck2r_EMT.js.map +0 -1
  409. package/dist/src-DAzaCTcN.js.map +0 -1
  410. package/dist/src-DB7N8TYJ.js +0 -2
  411. package/dist/src-DPDaAYwh.js +0 -2
  412. package/dist/src-Dbk19BiP.js +0 -2
  413. package/dist/src-DtodMT59.js +0 -1
  414. package/dist/src-DvGns8cz.js.map +0 -1
  415. package/dist/src-Dw79VLa3.js.map +0 -1
  416. package/dist/src-KxS91P7L.js.map +0 -1
  417. package/dist/src-T-OeuJLr.js +0 -2
  418. package/dist/src-YvblOrBU.js.map +0 -1
  419. package/dist/src-zntEDlnx.js +0 -3
  420. package/dist/state-kimtIhBP.js +0 -1
  421. package/dist/suite-CKBa6MKt.js +0 -2
  422. package/dist/tart-BTVXp8rz.js +0 -373
  423. package/dist/tart-BTVXp8rz.js.map +0 -1
  424. package/dist/tart-cli-BIC9HqPg.js +0 -37
  425. package/dist/tart-cli-BIC9HqPg.js.map +0 -1
  426. package/dist/tart-cli-BMrkmBjI.js +0 -1
  427. package/dist/tart-images-DZ_Mbh-g.js.map +0 -1
  428. package/dist/tool-target-DS5d72eH.js +0 -40
  429. package/dist/tool-target-DS5d72eH.js.map +0 -1
  430. package/dist/types-C2mLpph3.js.map +0 -1
  431. package/dist/usage-DJiDnh2D.js.map +0 -1
  432. package/dist/vercel-CGlSBv63.js.map +0 -1
  433. package/dist/vertex-O88TCwgY.js +0 -1
  434. package/dist/views-DtRhj2Tn.js +0 -2
  435. package/dist/worker-entry-BIROTPX1.js.map +0 -1
  436. package/dist/workspace-CcQRT31C.js +0 -1
@@ -0,0 +1,704 @@
1
+ import { I as startGateway, N as pathOperations, P as CA_PATH, dt as WORKSPACE_DIR, jt as shellQuote, kt as traceDocker, rt as BRIDGE_PORT } from "./src-BHJ4MWvY.js";
2
+ import { t as InfraError } from "./types-CbcnJxCy.js";
3
+ import { n as attemptDebug } from "./attempt-CKfKsqqw.js";
4
+ import { t as untraced } from "./docker-D74l67k8.js";
5
+ import { a as tartOk, c as tracedRunBytes, i as tartNames, n as runArgv, r as tartCli, s as tracedRun, t as LOCAL_TART } from "./tart-cli-B86Jqo1t.js";
6
+ import { i as sessionSandbox, n as gatewayGlue } from "./docker-CDdK6Ity.js";
7
+ import { c as TartBusyError, d as hostLoad, f as hostSlots, g as withHostClaim, l as claimHost, n as BUSY_COOLDOWN_MS, s as HostTaken, t as AT_VM_LIMIT, u as freeSlots } from "./tart-hosts-DPyZsg-1.js";
8
+ import { posix } from "node:path";
9
+ import { spawn } from "node:child_process";
10
+ import { randomBytes } from "node:crypto";
11
+ import { Readable } from "node:stream";
12
+ // src/sandbox/tart.ts
13
+ /** How long a clone has to boot until a command runs in it. */
14
+ const BOOT_TIMEOUT_MS = 18e4;
15
+ /**
16
+ * How long one boot probe waits: `tart exec` blocks, about 30s without the Guest Agent, until the
17
+ * agent answers. With an SSH key, `tart exec` gets less, so SSH is tried soon.
18
+ */
19
+ const PROBE_TIMEOUT_MS = 15e3;
20
+ /** The user an SSH image is reached as when `ssh.user` is unset: Cirrus Labs' images'. */
21
+ const DEFAULT_SSH_USER = "admin";
22
+ /** Before the image's own PATH in every command, so Homebrew's tools (Node among them) are found. */
23
+ const GUEST_PATH = "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin";
24
+ /** Where a baked image has reeval's pinned pnpm, relative to the image user's home; first on PATH. */
25
+ const PNPM_DIR = ".reeval-state/pnpm";
26
+ const SSH_OPTIONS = [
27
+ "-o",
28
+ "BatchMode=yes",
29
+ "-o",
30
+ "StrictHostKeyChecking=no",
31
+ "-o",
32
+ "UserKnownHostsFile=/dev/null",
33
+ "-o",
34
+ "LogLevel=ERROR",
35
+ "-T"
36
+ ];
37
+ const NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
38
+ const UNITS = {
39
+ b: 1,
40
+ k: 1024,
41
+ m: 1024 ** 2,
42
+ g: 1024 ** 3
43
+ };
44
+ /**
45
+ * Deletes the VM `$1` on a host once no `tart clone` is still making it, in the background: killing
46
+ * the local ssh leaves the remote clone running, and it would leave its VM behind. `[t]art` keeps
47
+ * the pattern from matching this shell's own command line.
48
+ */
49
+ const DELETE_AFTER_CLONE = `( i=0; while [ $i -lt 600 ] && pgrep -f "[t]art clone .* $1\\$" >/dev/null; do sleep 1; i=$((i+1)); done; tart delete "$1" ) </dev/null >/dev/null 2>&1 &`;
50
+ /** The prefix of every VM a run clones, so a canceled run's VMs can be found and deleted. */
51
+ const vmPrefix = (runId) => `reeval-${runId}-`;
52
+ /** `tart set --memory` takes megabytes; `memory` is bytes, or a number with `b`, `k`, `m` or `g`. */
53
+ function memoryMb(memory) {
54
+ if (typeof memory === "number") return Math.max(1, Math.round(memory / UNITS.m));
55
+ const m = /^(\d+(?:\.\d+)?)([bkmg])?$/i.exec(memory.trim());
56
+ const unit = m?.[2]?.toLowerCase() ?? "b";
57
+ return Math.max(1, Math.round(Number(m?.[1] ?? 0) * UNITS[unit] / UNITS.m));
58
+ }
59
+ const tartGuest = (vm, on = LOCAL_TART) => ({ argv: (argv) => on.tart([
60
+ "exec",
61
+ "-i",
62
+ vm,
63
+ ...argv
64
+ ]) });
65
+ /**
66
+ * SSH joins its arguments into one command line for the remote shell, so each is quoted. A VM on
67
+ * another Mac is reached through that Mac: `proxy` is the `ProxyCommand` that gets there.
68
+ */
69
+ const sshGuest = (host, key, user = DEFAULT_SSH_USER, proxy) => ({ argv: (argv) => [
70
+ "ssh",
71
+ "-i",
72
+ key,
73
+ ...SSH_OPTIONS,
74
+ ...proxy ? ["-o", `ProxyCommand=${proxy}`] : [],
75
+ `${user}@${host}`,
76
+ argv.map(shellQuote).join(" ")
77
+ ] });
78
+ const runIn = (guest, argv, options = {}) => {
79
+ const [bin = "", ...args] = guest.argv(argv);
80
+ return tracedRun(bin, args, {
81
+ input: options.input ?? "",
82
+ signal: options.signal
83
+ });
84
+ };
85
+ /**
86
+ * The gateway's commands run as root through `sudo -n`, which the image's user needs without a
87
+ * password. The agent runs as that same user, so it could stop or replace the forwarder: only
88
+ * the real credentials, which never leave the host, are out of its reach. Killing `tart exec` or
89
+ * `ssh` can leave them running in the VM, so the gateway stops its forwarder itself.
90
+ */
91
+ const rootTransport = (guest) => ({
92
+ argv: (command) => guest.argv([
93
+ "sudo",
94
+ "-n",
95
+ "/bin/sh",
96
+ "-c",
97
+ `PATH=${GUEST_PATH}:$PATH; exec "$@"`,
98
+ "sh",
99
+ ...command
100
+ ]),
101
+ orphans: true
102
+ });
103
+ /**
104
+ * A command as one script on stdin, so variables (and what a secret holds) never reach a
105
+ * command line on the host or in the VM. The shell records its pid for {@link killTree}.
106
+ */
107
+ function execScript(o) {
108
+ const exports = Object.entries(o.env).filter(([k]) => NAME.test(k)).map(([k, v]) => `export ${k}=${shellQuote(v)}`);
109
+ return [[
110
+ `echo $$ > ${shellQuote(o.pidFile)}`,
111
+ `export PATH=${shellQuote(o.path ?? "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin")}:"$PATH"`,
112
+ ...exports,
113
+ "umask 022",
114
+ `cd ${shellQuote(o.cwd)} || exit 1`
115
+ ].join("; "), o.command].join("\n");
116
+ }
117
+ /** Reads the script {@link execScript} wrote from stdin and runs it, with stdin then empty. */
118
+ const RUN_SCRIPT = [
119
+ "/bin/bash",
120
+ "-c",
121
+ "s=$(cat); eval \"$s\" </dev/null"
122
+ ];
123
+ /**
124
+ * Kills the command whose shell wrote `pidFile` and everything it started: macOS has no
125
+ * `/proc` to find them by a marker, so it walks the tree from that shell, stopping each first.
126
+ */
127
+ const killTree = (pidFile) => `f=${shellQuote(pidFile)}; [ -f "$f" ] || exit 0
128
+ tree() { kill -STOP "$1" 2>/dev/null; for c in $(pgrep -P "$1"); do tree "$c"; done; kill -9 "$1" 2>/dev/null; }
129
+ tree "$(cat "$f")"; rm -f "$f"; true`;
130
+ const sleep = (ms, signal) => new Promise((resolve, reject) => {
131
+ if (signal.aborted) return reject(signal.reason);
132
+ const timer = setTimeout(resolve, ms);
133
+ signal.addEventListener("abort", () => {
134
+ clearTimeout(timer);
135
+ reject(signal.reason);
136
+ }, { once: true });
137
+ });
138
+ /** Stops and deletes a VM, never throwing: one already gone is done. */
139
+ async function removeVm(vm, on) {
140
+ await tartCli([
141
+ "stop",
142
+ "--timeout",
143
+ "5",
144
+ vm
145
+ ], { on }).catch(() => {});
146
+ await tartCli(["delete", vm], { on }).catch(() => {});
147
+ }
148
+ /**
149
+ * Deletes every VM a run cloned and didn't delete, on this machine or each of `targets`: a worker
150
+ * killed mid-attempt leaves its own.
151
+ */
152
+ async function removeRunVms(runId, targets = [LOCAL_TART]) {
153
+ const prefix = vmPrefix(runId);
154
+ await Promise.all(targets.map(async (on) => {
155
+ const names = await tartNames(void 0, on).catch(() => /* @__PURE__ */ new Set());
156
+ for (const vm of names) if (vm.startsWith(prefix)) await removeVm(vm, on);
157
+ }));
158
+ }
159
+ /**
160
+ * Clones `image` as `vm` on `on`, sizes and boots it headless, and waits until `tart exec` (or
161
+ * SSH, with the eval's key) runs a command in it. A clone that doesn't boot is stopped and
162
+ * deleted; one its host refuses for being at its VM limit throws {@link TartBusyError}.
163
+ */
164
+ async function bootTartVm(descriptor, image, vm, signal, on = LOCAL_TART, o = {}) {
165
+ const debug = attemptDebug();
166
+ const started = performance.now();
167
+ let booted;
168
+ let ended = Promise.resolve();
169
+ let halted;
170
+ const halt = (timeoutS = 5) => {
171
+ halted ??= (async () => {
172
+ await tartCli([
173
+ "stop",
174
+ "--timeout",
175
+ String(timeoutS),
176
+ vm
177
+ ], { on }).catch(() => {});
178
+ booted?.kill("SIGKILL");
179
+ await ended;
180
+ })();
181
+ return halted;
182
+ };
183
+ const fail = async (error) => {
184
+ await halt();
185
+ await tartCli(["delete", vm], { on }).catch(() => {});
186
+ if (signal.aborted) throw signal.reason;
187
+ throw error instanceof InfraError ? error : new InfraError(error.message);
188
+ };
189
+ try {
190
+ const clone = async () => {
191
+ await tartOk([
192
+ "clone",
193
+ image,
194
+ vm
195
+ ], {
196
+ signal,
197
+ on
198
+ });
199
+ };
200
+ await (o.claim ? o.claim(clone) : clone());
201
+ } catch (error) {
202
+ if (error instanceof HostTaken) throw error;
203
+ await tartCli(["delete", vm], { on }).catch(() => {});
204
+ if (signal.aborted) {
205
+ if (on.remote) await runArgv(on.sh(DELETE_AFTER_CLONE, [vm])).catch(() => {});
206
+ throw signal.reason;
207
+ }
208
+ throw new InfraError(`Couldn't clone ${image}: ${error.message}`);
209
+ }
210
+ let guest = tartGuest(vm, on);
211
+ try {
212
+ const set = [...descriptor.cpus !== void 0 ? ["--cpu", String(descriptor.cpus)] : [], ...descriptor.memory !== void 0 ? ["--memory", String(memoryMb(descriptor.memory))] : []];
213
+ if (set.length) await tartOk([
214
+ "set",
215
+ vm,
216
+ ...set
217
+ ], {
218
+ signal,
219
+ on
220
+ });
221
+ let exited;
222
+ let busy = false;
223
+ let stderr = "";
224
+ const [bin = "", ...args] = on.tart([
225
+ "run",
226
+ vm,
227
+ "--no-graphics"
228
+ ]);
229
+ booted = spawn(bin, args, {
230
+ stdio: [
231
+ "ignore",
232
+ "ignore",
233
+ "pipe"
234
+ ],
235
+ detached: true
236
+ });
237
+ const run = booted;
238
+ ended = new Promise((resolve) => {
239
+ run.once("exit", resolve);
240
+ run.once("error", resolve);
241
+ });
242
+ booted.stderr?.on("data", (d) => {
243
+ stderr = `${stderr}${d}`.slice(-2e3);
244
+ });
245
+ booted.once("error", (error) => {
246
+ exited = error.message;
247
+ });
248
+ booted.once("close", (code) => {
249
+ const why = stderr.trim();
250
+ exited = `tart run exited (${code})${why ? `: ${why}` : ""}`;
251
+ busy = on.remote && AT_VM_LIMIT.test(why);
252
+ if (AT_VM_LIMIT.test(why) && !on.remote) exited += `. macOS runs two macOS VMs at a time, and VMs outside this run hold the slots. Stop them (tart stop <name>), or run fewer: tart({ maxConcurrent: 1 })`;
253
+ });
254
+ const deadline = Date.now() + BOOT_TIMEOUT_MS;
255
+ /** Whether `g` runs a command within `ms`, and the boot deadline. */
256
+ const answers = async (g, ms = PROBE_TIMEOUT_MS) => {
257
+ const wait = Math.max(1, Math.min(ms, deadline - Date.now()));
258
+ const probe = AbortSignal.any([signal, AbortSignal.timeout(wait)]);
259
+ try {
260
+ return (await runIn(g, ["true"], { signal: probe })).exitCode === 0;
261
+ } catch (error) {
262
+ if (signal.aborted) throw error;
263
+ return false;
264
+ }
265
+ };
266
+ const ssh = descriptor.ssh;
267
+ /** `tart exec` when the image's Guest Agent answers, else SSH when the eval gave a key. */
268
+ const reach = async () => {
269
+ if (await answers(tartGuest(vm, on), ssh ? 5e3 : 15e3)) return tartGuest(vm, on);
270
+ if (!ssh) return void 0;
271
+ const ip = await tartCli([
272
+ "ip",
273
+ vm,
274
+ "--wait",
275
+ "5"
276
+ ], {
277
+ signal,
278
+ on
279
+ });
280
+ const host = ip.stdout.trim();
281
+ if (ip.exitCode !== 0 || !host) return void 0;
282
+ const viaSsh = sshGuest(host, ssh.key, ssh.user, on.proxy);
283
+ return await answers(viaSsh) ? viaSsh : void 0;
284
+ };
285
+ for (;;) {
286
+ if (busy) throw new TartBusyError(`${on.label} is at its VM limit: ${exited}`);
287
+ if (exited) throw new InfraError(`${vm} didn't boot${on.remote ? ` on ${on.label}` : ""}: ${exited}`);
288
+ const reached = await untraced(reach);
289
+ if (reached) {
290
+ guest = reached;
291
+ break;
292
+ }
293
+ if (Date.now() > deadline) throw new InfraError(`${vm} answered neither tart exec${ssh ? " nor SSH" : ""} within ${BOOT_TIMEOUT_MS / 1e3}s of booting${ssh ? "" : ": an image without the Tart Guest Agent needs tart({ ssh: { key } })"}`);
294
+ await sleep(1e3, signal);
295
+ }
296
+ } catch (error) {
297
+ return fail(error);
298
+ }
299
+ debug?.log("container", `booted ${vm} from ${image}${on.remote ? ` on ${on.label}` : ""} in ${Math.round(performance.now() - started)}ms, reached over ${guest.argv([])[0] === "ssh" ? "SSH" : "tart exec"}`);
300
+ let home;
301
+ try {
302
+ home = (await runIn(guest, [
303
+ "/bin/sh",
304
+ "-c",
305
+ "printf %s \"$HOME\""
306
+ ], { signal })).stdout;
307
+ if (!home.startsWith("/")) throw new InfraError(`${vm} has no home directory for its user`);
308
+ } catch (error) {
309
+ return fail(error);
310
+ }
311
+ return {
312
+ guest,
313
+ home,
314
+ halt
315
+ };
316
+ }
317
+ /**
318
+ * Boots the attempt's VM: on this machine, or with `tart({ hosts })` on the host with the most room,
319
+ * passing over one whose `tart run` says it's at its VM limit for a while and trying the next. The
320
+ * host's slot is claimed under its lock: counted again, then cloned into.
321
+ */
322
+ async function bootOnHost(descriptor, image, vm, options, o = {}) {
323
+ const { signal } = options;
324
+ if (!descriptor.hosts) return {
325
+ ...await bootTartVm(descriptor, image, vm, signal),
326
+ on: LOCAL_TART
327
+ };
328
+ const debug = attemptDebug();
329
+ const slots = hostSlots(descriptor, options.hosts, image);
330
+ if (!slots.length) throw new InfraError("tart() has no host left to run on: preflight skipped every one");
331
+ const busy = /* @__PURE__ */ new Map();
332
+ const deadline = { at: Date.now() + (o.waitMs ?? 12e5) };
333
+ const prefix = vmPrefix(options.runId);
334
+ const log = (line) => debug?.log("container", line);
335
+ for (;;) {
336
+ const slot = await claimHost(slots, {
337
+ signal,
338
+ busy,
339
+ prefix,
340
+ deadline,
341
+ log
342
+ });
343
+ const claim = (clone) => withHostClaim(slot.target, signal, async () => {
344
+ if (freeSlots(slot.vms, await hostLoad(slot.target, prefix, signal)) < 1) throw new HostTaken(`${slot.target.label} filled up`);
345
+ await clone();
346
+ });
347
+ try {
348
+ return {
349
+ ...await bootTartVm(descriptor, slot.image, vm, signal, slot.target, { claim }),
350
+ on: slot.target
351
+ };
352
+ } catch (error) {
353
+ if (error instanceof HostTaken) {
354
+ log(`${error.message} before this attempt cloned there: picking again`);
355
+ continue;
356
+ }
357
+ if (!(error instanceof TartBusyError)) throw error;
358
+ log(`${error.message}: trying another host`);
359
+ busy.set(slot.target.label, Date.now() + BUSY_COOLDOWN_MS);
360
+ }
361
+ }
362
+ }
363
+ async function createTartSandbox(descriptor, options) {
364
+ const { signal } = options;
365
+ if (options.egress.policy !== "allow-all") throw new InfraError(`tart() runs under egress 'allow-all' only, and this attempt asked for ${JSON.stringify(options.egress.policy)}`);
366
+ const debug = attemptDebug();
367
+ const vm = `${vmPrefix(options.runId)}${randomBytes(3).toString("hex")}`;
368
+ let gateway;
369
+ let removed;
370
+ const { guest, home, halt, on } = await bootOnHost(descriptor, options.image ?? descriptor.image, vm, options);
371
+ const destroy = () => {
372
+ removed ??= (async () => {
373
+ await gateway?.close();
374
+ await halt();
375
+ await tartCli(["delete", vm], { on }).catch(() => {});
376
+ debug?.log("container", `deleted ${vm}${on.remote ? ` on ${on.label}` : ""}`);
377
+ })();
378
+ return removed;
379
+ };
380
+ const fail = async (error) => {
381
+ await destroy();
382
+ if (signal.aborted) throw signal.reason;
383
+ throw error instanceof InfraError ? error : new InfraError(error.message);
384
+ };
385
+ const workdir = posix.join(home, WORKSPACE_DIR);
386
+ const stateDir = posix.join(home, ".reeval-state");
387
+ const made = await runIn(guest, [
388
+ "/bin/sh",
389
+ "-c",
390
+ `umask 022 && mkdir -p ${shellQuote(workdir)} ${shellQuote(stateDir)} && chmod 700 ${shellQuote(stateDir)}`
391
+ ]).catch((error) => ({
392
+ exitCode: 1,
393
+ stderr: error.message
394
+ }));
395
+ if (made.exitCode !== 0) return fail(/* @__PURE__ */ new Error(`Couldn't set up ${vm}: ${made.stderr.trim()}`));
396
+ const glue = gatewayGlue(options);
397
+ const { brokered } = glue;
398
+ let noGateway;
399
+ let caBundle;
400
+ try {
401
+ gateway = await startGateway(rootTransport(guest), glue.egress, signal);
402
+ debug?.log("container", `egress gateway started · brokers ${brokered.join(", ") || "nothing"}`);
403
+ } catch (error) {
404
+ if (signal.aborted) return fail(signal.reason);
405
+ noGateway = error.message;
406
+ if (brokered.length) return fail(new InfraError(`Can't keep ${brokered.join(", ")} out of the sandbox: credential brokering could not start (${noGateway}). The egress gateway needs Node in the image (brew install node) and passwordless sudo for its user.`));
407
+ debug?.log("container", `egress gateway not running: ${noGateway}`);
408
+ }
409
+ if (gateway) {
410
+ const trustStarted = Date.now();
411
+ const trusted = await runIn(guest, [
412
+ "sudo",
413
+ "-n",
414
+ ...TRUST_CA
415
+ ], { signal: AbortSignal.any([signal, AbortSignal.timeout(TRUST_TIMEOUT_MS)]) }).catch((error) => ({
416
+ exitCode: 1,
417
+ stderr: error.message
418
+ }));
419
+ debug?.log("container", trusted.exitCode === 0 ? "the gateway CA is trusted in the System keychain" : `the gateway CA isn't in the System keychain after ${((Date.now() - trustStarted) / 1e3).toFixed(1)}s (${trusted.stderr.trim().slice(-300) || `exit ${trusted.exitCode}`}): clients that read only the keychain don't trust the proxy`);
420
+ if (signal.aborted) return fail(signal.reason);
421
+ if (trusted.exitCode !== 0 && options.keychainTrust) return fail(new InfraError(`This harness's CLI trusts only the macOS keychain, and sudo security add-trusted-cert couldn't add the egress gateway's CA to ${vm}'s System keychain (${trusted.stderr.trim().slice(-300) || `exit ${trusted.exitCode}`}). In the image, allow it without a prompt: sudo security authorizationdb write com.apple.trust-settings.admin allow`));
422
+ const bundle = posix.join(stateDir, "ca-bundle.pem");
423
+ const bundled = await runIn(guest, [
424
+ "/bin/sh",
425
+ "-c",
426
+ CA_BUNDLE_SCRIPT,
427
+ "sh",
428
+ bundle
429
+ ], { signal }).catch((error) => ({
430
+ exitCode: 1,
431
+ stderr: error.message
432
+ }));
433
+ if (signal.aborted) return fail(signal.reason);
434
+ if (bundled.exitCode === 0) caBundle = bundle;
435
+ else debug?.log("container", `no CA bundle for the gateway: ${bundled.stderr.trim() || `exit ${bundled.exitCode}`}`);
436
+ }
437
+ try {
438
+ const network = tartSession({
439
+ vm,
440
+ guest,
441
+ home,
442
+ stateDir,
443
+ env: options.env,
444
+ gateway,
445
+ noGateway,
446
+ caBundle,
447
+ destroy,
448
+ on
449
+ });
450
+ return await sessionSandbox(network, glue, {
451
+ stateDir,
452
+ oomKills: async () => null
453
+ });
454
+ } catch (error) {
455
+ return fail(error);
456
+ }
457
+ }
458
+ /** How long adding the gateway's CA to the keychain may take: a prompt would never be answered. */
459
+ const TRUST_TIMEOUT_MS = 15e3;
460
+ /**
461
+ * Trusts the gateway's CA for clients on macOS's own TLS (`curl`, `git`, Swift), which read the
462
+ * keychain; Node reads `NODE_EXTRA_CA_CERTS`. The VM is a fresh clone, so nothing removes it.
463
+ */
464
+ const TRUST_CA = [
465
+ "/usr/bin/security",
466
+ "add-trusted-cert",
467
+ "-d",
468
+ "-r",
469
+ "trustRoot",
470
+ "-k",
471
+ "/Library/Keychains/System.keychain",
472
+ CA_PATH
473
+ ];
474
+ /**
475
+ * Writes `$1`: the system's CA bundle (macOS's `/etc/ssl/cert.pem`) with the gateway's CA after
476
+ * it, for clients that read a bundle file rather than the keychain (Homebrew's `curl` and `git`,
477
+ * Python). The CA is root's, so it's read with `sudo`.
478
+ */
479
+ const CA_BUNDLE_SCRIPT = `s=
480
+ for f in /etc/ssl/cert.pem /etc/ssl/certs/ca-certificates.crt; do [ -s "$f" ] && { s=$f; break; }; done
481
+ [ -n "$s" ] || { echo "no system CA bundle" >&2; exit 1; }
482
+ umask 022
483
+ { cat "$s" && echo && sudo -n /bin/cat ${CA_PATH}; } > "$1.tmp" && mv "$1.tmp" "$1"`;
484
+ /**
485
+ * The VM as an AI SDK harness session. Every process, reeval's own included, runs as the image's
486
+ * user: macOS has no `useradd`, and the gateway's forwarder needs that user's `sudo`. Each gets
487
+ * its variables in a script on stdin ({@link execScript}), and a relative path is under the home
488
+ * directory, so the session's workspace is `~/workspace`.
489
+ */
490
+ function tartSession(o) {
491
+ const { vm, guest, home, stateDir, gateway } = o;
492
+ const description = `tart VM ${vm}`;
493
+ const path = `${posix.join(home, PNPM_DIR, "bin")}:${GUEST_PATH}`;
494
+ let execs = 0;
495
+ const nextPidFile = () => posix.join(stateDir, `exec-${++execs}.pid`);
496
+ const at = (path) => path ? posix.resolve(home, path) : home;
497
+ const envFor = (env) => ({
498
+ NPM_CONFIG_UPDATE_NOTIFIER: "false",
499
+ ...o.env,
500
+ ...gateway?.env,
501
+ ...o.caBundle && {
502
+ SSL_CERT_FILE: o.caBundle,
503
+ REQUESTS_CA_BUNDLE: o.caBundle,
504
+ CURL_CA_BUNDLE: o.caBundle,
505
+ GIT_SSL_CAINFO: o.caBundle
506
+ },
507
+ ...env
508
+ });
509
+ const killExec = (pidFile) => runIn(guest, [
510
+ "/bin/sh",
511
+ "-c",
512
+ killTree(pidFile)
513
+ ]).then(() => {}, () => {});
514
+ const execIn = async (command, cwd, env, signal) => {
515
+ const pidFile = nextPidFile();
516
+ try {
517
+ const r = await runIn(guest, RUN_SCRIPT, {
518
+ input: execScript({
519
+ command,
520
+ cwd,
521
+ env,
522
+ pidFile,
523
+ path
524
+ }),
525
+ ...signal && { signal }
526
+ });
527
+ return {
528
+ exitCode: r.exitCode,
529
+ stdout: r.stdout,
530
+ stderr: r.stderr
531
+ };
532
+ } catch (error) {
533
+ if (signal?.aborted) await killExec(pidFile);
534
+ throw error;
535
+ }
536
+ };
537
+ const readBinaryFile = async (r) => {
538
+ const [bin = "", ...args] = guest.argv([
539
+ "/bin/cat",
540
+ "--",
541
+ at(r.path)
542
+ ]);
543
+ const read = await tracedRunBytes(bin, args, { ...r.abortSignal && { signal: r.abortSignal } }).catch(() => null);
544
+ return read?.exitCode === 0 ? new Uint8Array(read.stdout) : null;
545
+ };
546
+ const writeBinaryFile = async (w) => {
547
+ const target = at(w.path);
548
+ const r = await runIn(guest, [
549
+ "/bin/sh",
550
+ "-c",
551
+ "umask 022 && mkdir -p \"$(dirname \"$1\")\" && cat > \"$1\"",
552
+ "sh",
553
+ target
554
+ ], {
555
+ input: w.content,
556
+ ...w.abortSignal && { signal: w.abortSignal }
557
+ });
558
+ if (r.exitCode !== 0) throw new Error(`Couldn't write ${target} in ${vm}: ${r.stderr.trim()}`);
559
+ };
560
+ const paths = pathOperations((script, path, abortSignal) => runIn(guest, [
561
+ "/bin/sh",
562
+ "-c",
563
+ script,
564
+ "sh",
565
+ path
566
+ ], { ...abortSignal && { signal: abortSignal } }), home);
567
+ const session = {
568
+ id: vm,
569
+ description,
570
+ defaultWorkingDirectory: home,
571
+ ports: [BRIDGE_PORT],
572
+ get egress() {
573
+ if (!gateway) return o.noGateway ? {
574
+ active: false,
575
+ reason: o.noGateway
576
+ } : void 0;
577
+ return gateway.stopped ? {
578
+ active: false,
579
+ reason: gateway.stopped
580
+ } : { active: true };
581
+ },
582
+ ...gateway ? {
583
+ async setNetworkPolicy(policy) {
584
+ gateway.setPolicy(policy);
585
+ },
586
+ async addRequestTransformations(rules) {
587
+ gateway.addTransformations(rules);
588
+ },
589
+ async setRequestTransformations(rules) {
590
+ gateway.setTransformations(rules);
591
+ },
592
+ async setSubstitutions(subs) {
593
+ gateway.setSubstitutions(subs);
594
+ },
595
+ traffic: () => gateway.traffic()
596
+ } : {},
597
+ oomKills: async () => null,
598
+ run: (r) => execIn(r.command, at(r.workingDirectory), envFor(r.env), r.abortSignal),
599
+ runPrivileged: (r) => execIn(r.command, stateDir, {}, r.abortSignal),
600
+ spawn: (async (s) => {
601
+ if (s.stdin) throw new Error(`A process in ${description} has no writable stdin`);
602
+ const pidFile = nextPidFile();
603
+ const [bin = "", ...args] = guest.argv(RUN_SCRIPT);
604
+ const startedAt = Date.now();
605
+ const child = spawn(bin, args, {
606
+ stdio: [
607
+ "pipe",
608
+ "pipe",
609
+ "pipe"
610
+ ],
611
+ detached: true
612
+ });
613
+ child.stdin.on("error", () => {});
614
+ child.stdin.end(execScript({
615
+ command: s.command,
616
+ cwd: at(s.workingDirectory),
617
+ env: envFor(s.env),
618
+ pidFile,
619
+ path
620
+ }));
621
+ const exited = new Promise((resolve) => {
622
+ child.once("error", () => resolve({ exitCode: 127 }));
623
+ child.once("close", (code) => {
624
+ traceDocker(args, startedAt, {
625
+ exitCode: code,
626
+ stdout: "<streamed>"
627
+ }, bin);
628
+ resolve({ exitCode: code ?? 1 });
629
+ });
630
+ });
631
+ const kill = async () => {
632
+ child.kill("SIGKILL");
633
+ await killExec(pidFile);
634
+ };
635
+ s.abortSignal?.addEventListener("abort", () => void kill(), { once: true });
636
+ return {
637
+ pid: child.pid,
638
+ stdout: Readable.toWeb(child.stdout),
639
+ stderr: Readable.toWeb(child.stderr),
640
+ wait: () => exited,
641
+ kill
642
+ };
643
+ }),
644
+ readBinaryFile,
645
+ async readFile(r) {
646
+ const bytes = await readBinaryFile(r);
647
+ return bytes === null ? null : Readable.toWeb(Readable.from([bytes]));
648
+ },
649
+ async readTextFile(r) {
650
+ const bytes = await readBinaryFile(r);
651
+ if (bytes === null) return null;
652
+ const text = Buffer.from(bytes).toString("utf8");
653
+ if (r.startLine === void 0 && r.endLine === void 0) return text;
654
+ return text.split("\n").slice((r.startLine ?? 1) - 1, r.endLine).join("\n");
655
+ },
656
+ ...paths,
657
+ writeBinaryFile,
658
+ writeTextFile: (w) => writeBinaryFile({
659
+ ...w,
660
+ content: Buffer.from(w.content, "utf8")
661
+ }),
662
+ async writeFile(w) {
663
+ const chunks = [];
664
+ for await (const chunk of w.content) chunks.push(chunk);
665
+ await writeBinaryFile({
666
+ ...w,
667
+ content: Buffer.concat(chunks)
668
+ });
669
+ },
670
+ async getPortEndpoint({ port, protocol = "ws" }) {
671
+ const scheme = protocol === "ws" ? "ws" : "http";
672
+ if (gateway) return { url: await gateway.portUrl(port, scheme) };
673
+ if (o.on?.remote) throw new Error(`A port in ${description} on ${o.on.label} is reached through the egress gateway, which isn't running: ${o.noGateway ?? "it stopped"}`);
674
+ return { url: `${scheme}://${(await tartOk(["ip", vm])).trim()}:${port}` };
675
+ },
676
+ async getPortUrl(p) {
677
+ return (await session.getPortEndpoint(p)).url;
678
+ },
679
+ stop: o.destroy,
680
+ destroy: o.destroy,
681
+ restricted: () => {
682
+ const { readFile, readTextFile, writeFile, writeTextFile, stat, listDirectory } = session;
683
+ const { deleteFile, run } = session;
684
+ return {
685
+ description,
686
+ readFile,
687
+ readBinaryFile,
688
+ readTextFile,
689
+ writeFile,
690
+ writeBinaryFile,
691
+ writeTextFile,
692
+ stat,
693
+ listDirectory,
694
+ deleteFile,
695
+ spawn: session.spawn,
696
+ run
697
+ };
698
+ }
699
+ };
700
+ return session;
701
+ }
702
+ export { PNPM_DIR, bootTartVm, createTartSandbox, removeRunVms, tartSession };
703
+
704
+ //# sourceMappingURL=tart-CcrrtSrp.js.map