reeval 0.21.0 → 0.22.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 (336) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +15 -15
  3. package/dist/{adapter-BdzhdRYo.js → adapter-Di9H2etg.js} +5 -48
  4. package/dist/adapter-Di9H2etg.js.map +1 -0
  5. package/dist/{agent-Dx-bDmlV.js → agent-B-6GFDqA.js} +11 -12
  6. package/dist/agent-B-6GFDqA.js.map +1 -0
  7. package/dist/{agents-l0-k7vw3.js → agents-KBTYhSSh.js} +45 -36
  8. package/dist/agents-KBTYhSSh.js.map +1 -0
  9. package/dist/{app-files-B-CQYB0c.js → app-files-Cmh9FGr5.js} +3 -3
  10. package/dist/app-files-Cmh9FGr5.js.map +1 -0
  11. package/dist/{assemble-CYMpN8LC.js → assemble-CBMRIhso.js} +1 -1
  12. package/dist/{assemble-CsZIcJo8.js → assemble-DNVBTBp_.js} +11 -10
  13. package/dist/{assemble-CsZIcJo8.js.map → assemble-DNVBTBp_.js.map} +1 -1
  14. package/dist/attach-EbDGKGTO.js +152 -0
  15. package/dist/attach-EbDGKGTO.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-DQvynDHk.js} +6 -6
  19. package/dist/{attempt-host-BwSmNYkX.js.map → attempt-host-DQvynDHk.js.map} +1 -1
  20. package/dist/boat-Bzz8L-KQ.js +701 -0
  21. package/dist/boat-Bzz8L-KQ.js.map +1 -0
  22. package/dist/{boat-CZpAreTB.js → boat-Dek8ftIt.js} +18 -6
  23. package/dist/boat-Dek8ftIt.js.map +1 -0
  24. package/dist/bundle-DZstHDeW.js +718 -0
  25. package/dist/bundle-DZstHDeW.js.map +1 -0
  26. package/dist/{capture-BqIAeFyC.js → capture-BkbPsfej.js} +17 -14
  27. package/dist/capture-BkbPsfej.js.map +1 -0
  28. package/dist/capture-CUAvk9KM.js +1 -0
  29. package/dist/{cli-s_3opn_I.js → cli-BgBBuxxJ.js} +276 -1018
  30. package/dist/cli-BgBBuxxJ.js.map +1 -0
  31. package/dist/{cli-spec-DxzIjmq_.js → cli-spec-B5L9n-DV.js} +93 -12
  32. package/dist/cli-spec-B5L9n-DV.js.map +1 -0
  33. package/dist/cli.js +2 -2
  34. package/dist/{client-C5fIzHQa.js → client-DMEYR3MA.js} +8 -4
  35. package/dist/client-DMEYR3MA.js.map +1 -0
  36. package/dist/{command-BJ7KqczP.js → command-BKb8eN_X.js} +8 -8
  37. package/dist/{command-BJ7KqczP.js.map → command-BKb8eN_X.js.map} +1 -1
  38. package/dist/{command-B5OAIjp7.js → command-D_w_kDpI.js} +13 -13
  39. package/dist/{command-B5OAIjp7.js.map → command-D_w_kDpI.js.map} +1 -1
  40. package/dist/{command-DA_SHQUQ.js → command-Dwlh0Vhu.js} +15 -14
  41. package/dist/command-Dwlh0Vhu.js.map +1 -0
  42. package/dist/{command-BXLZsEwQ.js → command-loXH2jHr.js} +11 -11
  43. package/dist/{command-BXLZsEwQ.js.map → command-loXH2jHr.js.map} +1 -1
  44. package/dist/{commands-BKBamOcX.js → commands-Cuf57OYb.js} +13 -13
  45. package/dist/{commands-BKBamOcX.js.map → commands-Cuf57OYb.js.map} +1 -1
  46. package/dist/{commands-BPvAOEmb.js → commands-Dqli45sR.js} +1 -1
  47. package/dist/{config-C0URar0t.js → config-C0RKt00M.js} +46 -30
  48. package/dist/config-C0RKt00M.js.map +1 -0
  49. package/dist/{context-Sj58aJEu.js → context-DrEAtUyg.js} +2 -2
  50. package/dist/{context-Sj58aJEu.js.map → context-DrEAtUyg.js.map} +1 -1
  51. package/dist/{cursor-catalog-FWgSo-T1.js → cursor-catalog-CRsFxorF.js} +2 -2
  52. package/dist/{cursor-catalog-FWgSo-T1.js.map → cursor-catalog-CRsFxorF.js.map} +1 -1
  53. package/dist/db-3o8s2EyD.js +2 -0
  54. package/dist/{db-BjAWxVAG.js → db-ErnJ-gMD.js} +34 -8
  55. package/dist/{db-BjAWxVAG.js.map → db-ErnJ-gMD.js.map} +1 -1
  56. package/dist/{default-effort-Ck2GYIxX.js → default-effort-D70cTG00.js} +2 -2
  57. package/dist/{default-effort-Ck2GYIxX.js.map → default-effort-D70cTG00.js.map} +1 -1
  58. package/dist/{default-effort-CWlhZ6U1.js → default-effort-DHzj84dD.js} +1 -1
  59. package/dist/{docker-D74l67k8.js → docker-CFWzZOEk.js} +4 -4
  60. package/dist/{docker-D74l67k8.js.map → docker-CFWzZOEk.js.map} +1 -1
  61. package/dist/docker-DrMnpL84.js +1 -0
  62. package/dist/{doctor-eFxyn6at.js → doctor-B7utCSdh.js} +56 -74
  63. package/dist/doctor-B7utCSdh.js.map +1 -0
  64. package/dist/{environment-CJIKz-Ud.js → environment-C0Gg8kyN.js} +5 -5
  65. package/dist/{environment-CJIKz-Ud.js.map → environment-C0Gg8kyN.js.map} +1 -1
  66. package/dist/{eval-source-CXIRJ91v.js → eval-source-CsW5VIXS.js} +5 -5
  67. package/dist/{eval-source-CXIRJ91v.js.map → eval-source-CsW5VIXS.js.map} +1 -1
  68. package/dist/{evaluate-DA4QsrHO.js → evaluate-BHQyAszQ.js} +238 -212
  69. package/dist/evaluate-BHQyAszQ.js.map +1 -0
  70. package/dist/{evaluate-DHrU4Wld.d.ts → evaluate-DzHq4EsU.d.ts} +2 -2
  71. package/dist/{fake-bootstrap-CnwWG3kP.js → fake-bootstrap-VpisF1WE.js} +2 -2
  72. package/dist/{fake-bootstrap-CnwWG3kP.js.map → fake-bootstrap-VpisF1WE.js.map} +1 -1
  73. package/dist/{files-Bey1VAex.js → files-BCraBodb.js} +3 -3
  74. package/dist/{files-Bey1VAex.js.map → files-BCraBodb.js.map} +1 -1
  75. package/dist/{files-BVVWAS0A.js → files-BuKWZCzY.js} +5 -5
  76. package/dist/{files-BVVWAS0A.js.map → files-BuKWZCzY.js.map} +1 -1
  77. package/dist/{files-BaqXvB88.js → files-CAzVG3Rr.js} +1 -1
  78. package/dist/{files-D6j-XpaK.js → files-Cv856jLN.js} +3 -3
  79. package/dist/{files-D6j-XpaK.js.map → files-Cv856jLN.js.map} +1 -1
  80. package/dist/files-D-Lir4aE.js +1 -0
  81. package/dist/files-DRlJ0Xr2.js +1 -0
  82. package/dist/{files-F44NRCN0.js → files-qjeqXnfE.js} +6 -6
  83. package/dist/{files-F44NRCN0.js.map → files-qjeqXnfE.js.map} +1 -1
  84. package/dist/gateway.d.ts +1 -1
  85. package/dist/{git-Jqkf9SBa.js → git-DOrOtAiD.js} +3 -3
  86. package/dist/{git-Jqkf9SBa.js.map → git-DOrOtAiD.js.map} +1 -1
  87. package/dist/harness-install-Dxho1yaU.js +53 -0
  88. package/dist/harness-install-Dxho1yaU.js.map +1 -0
  89. package/dist/harness.d.ts +1 -1
  90. package/dist/{images-Dsc4Wi-F.js → images-Ch1y1t6_.js} +69 -55
  91. package/dist/images-Ch1y1t6_.js.map +1 -0
  92. package/dist/index.d.ts +2 -2
  93. package/dist/index.js +5 -5
  94. package/dist/{init-QB5ecPDA.js → init-C2HqCwnt.js} +5 -5
  95. package/dist/{init-QB5ecPDA.js.map → init-C2HqCwnt.js.map} +1 -1
  96. package/dist/init-CM9xwyre.js +1 -0
  97. package/dist/{ink-list-mCJypk3d.js → ink-list-BbKXElcQ.js} +54 -15
  98. package/dist/ink-list-BbKXElcQ.js.map +1 -0
  99. package/dist/inputs-5UIDpjz-.js +190 -0
  100. package/dist/inputs-5UIDpjz-.js.map +1 -0
  101. package/dist/inputs-load-C82HOKnb.js +1 -0
  102. package/dist/inputs-load-CGPyigMC.js +95 -0
  103. package/dist/inputs-load-CGPyigMC.js.map +1 -0
  104. package/dist/{invocations-BSr4lRzI.js → invocations-BrZAMuTb.js} +4 -4
  105. package/dist/{invocations-BSr4lRzI.js.map → invocations-BrZAMuTb.js.map} +1 -1
  106. package/dist/jiti-radm1Soi.js +52 -0
  107. package/dist/jiti-radm1Soi.js.map +1 -0
  108. package/dist/{judge-eGH39PaP.js → judge-DwzqucLS.js} +9 -6
  109. package/dist/{judge-eGH39PaP.js.map → judge-DwzqucLS.js.map} +1 -1
  110. package/dist/judge.d.ts +1 -1
  111. package/dist/judge.js +1 -1
  112. package/dist/{layout-DfQa4mJs.js → layout-Czh5wOpz.js} +2 -2
  113. package/dist/{layout-DfQa4mJs.js.map → layout-Czh5wOpz.js.map} +1 -1
  114. package/dist/{list-Dh6T0kdr.js → list-B_C0k5ex.js} +14 -11
  115. package/dist/{list-Dh6T0kdr.js.map → list-B_C0k5ex.js.map} +1 -1
  116. package/dist/live-C9Et_BVT.js +1 -0
  117. package/dist/{live-xTZs0c61.js → live-DGgIrVw0.js} +7 -5
  118. package/dist/live-DGgIrVw0.js.map +1 -0
  119. package/dist/{live-y1p3oNXH.js → live-DgFm0H90.js} +7 -7
  120. package/dist/{live-y1p3oNXH.js.map → live-DgFm0H90.js.map} +1 -1
  121. package/dist/machine-service-2lIv5UWF.js +1 -0
  122. package/dist/machine-service-Ct_1XMMi.js +520 -0
  123. package/dist/machine-service-Ct_1XMMi.js.map +1 -0
  124. package/dist/machines-BnquHcBZ.js +120 -0
  125. package/dist/machines-BnquHcBZ.js.map +1 -0
  126. package/dist/{model-DEjwetkJ.js → model-B1tdv9-d.js} +1 -1
  127. package/dist/model-Bcy4Qjmm.js +1 -0
  128. package/dist/{model-DNpKiHqO.js → model-DF77SgZv.js} +2 -2
  129. package/dist/{model-DNpKiHqO.js.map → model-DF77SgZv.js.map} +1 -1
  130. package/dist/{model-3pZZzloU.js → model-DRa7yv6K.js} +6 -5
  131. package/dist/model-DRa7yv6K.js.map +1 -0
  132. package/dist/{model-jRKSQBg6.js → model-E5X8YBJM.js} +6 -5
  133. package/dist/model-E5X8YBJM.js.map +1 -0
  134. package/dist/{node-DM-mLGdX.js → node-BjuhqQwa.js} +16 -5
  135. package/dist/node-BjuhqQwa.js.map +1 -0
  136. package/dist/{openrouter-models-C0aRo633.js → openrouter-models-B1sIOTD2.js} +2 -2
  137. package/dist/{openrouter-models-C0aRo633.js.map → openrouter-models-B1sIOTD2.js.map} +1 -1
  138. package/dist/options-C989kuVE.js +1 -0
  139. package/dist/own-reads-CYmBlrHK.js +15 -0
  140. package/dist/own-reads-CYmBlrHK.js.map +1 -0
  141. package/dist/{patch-Bx-qp8Li.js → patch-BR8rdl7r.js} +2 -2
  142. package/dist/{patch-Bx-qp8Li.js.map → patch-BR8rdl7r.js.map} +1 -1
  143. package/dist/{plan-ChO0A-xn.js → plan-BcT4G5jj.js} +47 -9
  144. package/dist/plan-BcT4G5jj.js.map +1 -0
  145. package/dist/{plugins-BioMWncI.js → plugins-cC0sqoDA.js} +91 -122
  146. package/dist/plugins-cC0sqoDA.js.map +1 -0
  147. package/dist/preflight-BMVDBcux.js +1 -0
  148. package/dist/{preflight-qFCXmxha.js → preflight-C9OtTb7k.js} +3 -3
  149. package/dist/{preflight-qFCXmxha.js.map → preflight-C9OtTb7k.js.map} +1 -1
  150. package/dist/{preflight-CJSGzMzc.js → preflight-DySHXeFJ.js} +8 -8
  151. package/dist/preflight-DySHXeFJ.js.map +1 -0
  152. package/dist/{preflight-BUjk_6wT.js → preflight-zsAn3heN.js} +1 -1
  153. package/dist/{prepare-xHU2BpN-.js → prepare-MaRWRhNT.js} +2 -2
  154. package/dist/{prepare-D7oSSFNm.js → prepare-nbX1CXXg.js} +195 -54
  155. package/dist/prepare-nbX1CXXg.js.map +1 -0
  156. package/dist/{provenance-B-flBAzR.js → provenance-CkykifD9.js} +3 -3
  157. package/dist/{provenance-B-flBAzR.js.map → provenance-CkykifD9.js.map} +1 -1
  158. package/dist/{providers-Dljf6al6.js → providers-BkLGzaSY.js} +1 -1
  159. package/dist/{providers-B6StVyfG.js → providers-bNgfKa6m.js} +31 -23
  160. package/dist/providers-bNgfKa6m.js.map +1 -0
  161. package/dist/query-B2SQddoV.js +1 -0
  162. package/dist/{query-CkLmJv7R.js → query-DhV3a8lM.js} +2 -2
  163. package/dist/{query-CkLmJv7R.js.map → query-DhV3a8lM.js.map} +1 -1
  164. package/dist/{questions-CJIh2FSX.js → questions-Csv64WCb.js} +6 -6
  165. package/dist/{questions-CJIh2FSX.js.map → questions-Csv64WCb.js.map} +1 -1
  166. package/dist/{record-nVVujCW7.js → record--vHreTLk.js} +10 -4
  167. package/dist/record--vHreTLk.js.map +1 -0
  168. package/dist/{redact-DL2BTykw.js → redact-t-L3VGy8.js} +91 -2
  169. package/dist/redact-t-L3VGy8.js.map +1 -0
  170. package/dist/{remarks-B3wjKscW.js → remarks-CYFOsnz5.js} +6 -6
  171. package/dist/{remarks-B3wjKscW.js.map → remarks-CYFOsnz5.js.map} +1 -1
  172. package/dist/{remote-C88amFRN.js → remote-0CHog7Oq.js} +5 -5
  173. package/dist/{remote-C88amFRN.js.map → remote-0CHog7Oq.js.map} +1 -1
  174. package/dist/resolve-Bm9ZyFR-.js +1 -0
  175. package/dist/{resolve-G576PiFJ.js → resolve-DorSHDBs.js} +7 -7
  176. package/dist/{resolve-G576PiFJ.js.map → resolve-DorSHDBs.js.map} +1 -1
  177. package/dist/resources-DqdwihhT.js +62 -0
  178. package/dist/resources-DqdwihhT.js.map +1 -0
  179. package/dist/{results-zVHIW6xw.js → results-DhMgRkR0.js} +5 -5
  180. package/dist/{results-zVHIW6xw.js.map → results-DhMgRkR0.js.map} +1 -1
  181. package/dist/{resume-D_PcUXfG.js → resume-C8Ihfy-C.js} +77 -6
  182. package/dist/resume-C8Ihfy-C.js.map +1 -0
  183. package/dist/{retry-BvTzCxdc.js → retry-Bfk7pDti.js} +3 -3
  184. package/dist/{retry-BvTzCxdc.js.map → retry-Bfk7pDti.js.map} +1 -1
  185. package/dist/{routes-B0F2R-K7.js → routes-Cp4gAjBZ.js} +118 -70
  186. package/dist/routes-Cp4gAjBZ.js.map +1 -0
  187. package/dist/{runtime-B3r_pAq6.js → runtime-CPUH0Vk5.js} +44 -3
  188. package/dist/runtime-CPUH0Vk5.js.map +1 -0
  189. package/dist/sandbox/boat.d.ts +1 -1
  190. package/dist/sandbox/boat.js +1 -1
  191. package/dist/{sandbox-Duh3z1TV.js → sandbox-z8q_4Ywn.js} +2 -2
  192. package/dist/{sandbox-Duh3z1TV.js.map → sandbox-z8q_4Ywn.js.map} +1 -1
  193. package/dist/sandbox.d.ts +1 -1
  194. package/dist/sandbox.js +1 -1
  195. package/dist/{server-DUWMRKik.js → server-BsQZtuF9.js} +8 -8
  196. package/dist/{server-DUWMRKik.js.map → server-BsQZtuF9.js.map} +1 -1
  197. package/dist/server-ZaMzUNmV.js +1 -0
  198. package/dist/services-BG8xuU82.js +39 -0
  199. package/dist/services-BG8xuU82.js.map +1 -0
  200. package/dist/{source-CHuN4Nfg.js → source-9HWaTEgV.js} +2 -2
  201. package/dist/{source-CHuN4Nfg.js.map → source-9HWaTEgV.js.map} +1 -1
  202. package/dist/source-BcBDj-R0.js +1 -0
  203. package/dist/{src-CZaYu6ER.js → src-B2eHTCnp.js} +1 -1
  204. package/dist/{src-BI0v8qlZ.js → src-Bb3k9Kn_.js} +8 -5
  205. package/dist/{src-BI0v8qlZ.js.map → src-Bb3k9Kn_.js.map} +1 -1
  206. package/dist/{src-CkEiiyON.js → src-BfOlH_Bu.js} +2 -2
  207. package/dist/{src-CeBhwD8k.js → src-BuGc40IF.js} +1 -1
  208. package/dist/{src-De0KY5S_.js → src-C2K5_afU.js} +2 -2
  209. package/dist/{src-BqNzHHWn.js → src-C3OhA5pw.js} +2 -2
  210. package/dist/{src-BqNzHHWn.js.map → src-C3OhA5pw.js.map} +1 -1
  211. package/dist/{src-DA95rM6v.js → src-CSVJjghq.js} +1 -1
  212. package/dist/{src-BHJ4MWvY.js → src-CWfy8ct8.js} +1114 -411
  213. package/dist/src-CWfy8ct8.js.map +1 -0
  214. package/dist/{src--yl1OypK.js → src-CcrQQB0_.js} +2 -2
  215. package/dist/src-CotUxxQV.js +2 -0
  216. package/dist/src-D-PwBaBB.js +2 -0
  217. package/dist/{src-B-HuDqpH.js → src-DNWiU__5.js} +2 -2
  218. package/dist/{src-B-HuDqpH.js.map → src-DNWiU__5.js.map} +1 -1
  219. package/dist/{src-CmA5Yev6.js → src-DwcTn4JY.js} +2 -2
  220. package/dist/{src-CmA5Yev6.js.map → src-DwcTn4JY.js.map} +1 -1
  221. package/dist/{src-DL-EE4DU.js → src-c3ZQu7Uu.js} +2 -2
  222. package/dist/{src-DL-EE4DU.js.map → src-c3ZQu7Uu.js.map} +1 -1
  223. package/dist/src-jYqNkT-F.js +1 -0
  224. package/dist/start-Db5VRcRZ.js +660 -0
  225. package/dist/start-Db5VRcRZ.js.map +1 -0
  226. package/dist/state-CKIjZZRK.js +1 -0
  227. package/dist/{state-DUBRDyMk.js → state-DUYdzNA7.js} +14 -14
  228. package/dist/{state-DUBRDyMk.js.map → state-DUYdzNA7.js.map} +1 -1
  229. package/dist/store/local.d.ts +1 -1
  230. package/dist/store/s3.d.ts +1 -1
  231. package/dist/suite-CH1aaAbs.js +2 -0
  232. package/dist/{suite-B9J6Afg6.js → suite-DjGxmDSY.js} +2 -2
  233. package/dist/{suite-B9J6Afg6.js.map → suite-DjGxmDSY.js.map} +1 -1
  234. package/dist/{summary-CSp4cfnr.js → summary-BK5Sa_N0.js} +8 -5
  235. package/dist/summary-BK5Sa_N0.js.map +1 -0
  236. package/dist/{sync-CxAY6Dki.js → sync-DUi_P2UJ.js} +2 -2
  237. package/dist/{sync-CxAY6Dki.js.map → sync-DUi_P2UJ.js.map} +1 -1
  238. package/dist/{tarball-CESxtK4X.js → tarball-C8BSTAMk.js} +2 -2
  239. package/dist/{tarball-CESxtK4X.js.map → tarball-C8BSTAMk.js.map} +1 -1
  240. package/dist/{tart-CcrrtSrp.js → tart-BQ_Ap0l4.js} +99 -295
  241. package/dist/tart-BQ_Ap0l4.js.map +1 -0
  242. package/dist/{tart-bake-F-6seRC9.js → tart-bake-D1RttYfM.js} +18 -62
  243. package/dist/tart-bake-D1RttYfM.js.map +1 -0
  244. package/dist/{tart-bake-RK7RaT9E.js → tart-bake-DjFcsG3N.js} +1 -1
  245. package/dist/{tart-cli-ClvRniLQ.js → tart-cli-BOcluha1.js} +1 -1
  246. package/dist/{tart-cli-B86Jqo1t.js → tart-cli-gA9xEaQL.js} +2 -2
  247. package/dist/{tart-cli-B86Jqo1t.js.map → tart-cli-gA9xEaQL.js.map} +1 -1
  248. package/dist/{tart-hosts-DPyZsg-1.js → tart-hosts-CHNrfV6u.js} +3 -3
  249. package/dist/{tart-hosts-DPyZsg-1.js.map → tart-hosts-CHNrfV6u.js.map} +1 -1
  250. package/dist/{tart-hosts-Brii7zHM.js → tart-hosts-CWse-ASo.js} +1 -1
  251. package/dist/{tart-images-CWSf03w8.js → tart-images-CLBjfF9u.js} +2 -2
  252. package/dist/{tart-images-CWSf03w8.js.map → tart-images-CLBjfF9u.js.map} +1 -1
  253. package/dist/testing.d.ts +2 -2
  254. package/dist/testing.js +4 -4
  255. package/dist/{tool-class-CVDdJy0H.js → tool-class-krsmEo44.js} +2 -2
  256. package/dist/{tool-class-CVDdJy0H.js.map → tool-class-krsmEo44.js.map} +1 -1
  257. package/dist/{transcript-BP_2hji-.js → transcript-BXWZiMuC.js} +2 -2
  258. package/dist/{transcript-BP_2hji-.js.map → transcript-BXWZiMuC.js.map} +1 -1
  259. package/dist/types-CbcnJxCy.js.map +1 -1
  260. package/dist/{types-BJ0wh8wC.d.ts → types-DKK8jj--.d.ts} +110 -2
  261. package/dist/ui-DKYjTVpn.js +1455 -0
  262. package/dist/ui-DKYjTVpn.js.map +1 -0
  263. package/dist/vercel-models-Ci33llXz.js +21 -0
  264. package/dist/vercel-models-Ci33llXz.js.map +1 -0
  265. package/dist/view/index.d.ts +6 -1
  266. package/dist/view/index.js +4 -4
  267. package/dist/{views-DRxXCyIH.js → views-B1zVLJsF.js} +6 -6
  268. package/dist/{views-DRxXCyIH.js.map → views-B1zVLJsF.js.map} +1 -1
  269. package/dist/views-DCjtw1jF.js +2 -0
  270. package/dist/{worker-entry-C3Q4U63F.js → worker-entry-DrAYYt0M.js} +31 -11
  271. package/dist/worker-entry-DrAYYt0M.js.map +1 -0
  272. package/dist/workspace-CnRbV8cM.js +1 -0
  273. package/dist/{workspace-P72SXLXr.js → workspace-DwTe1zo6.js} +5 -5
  274. package/dist/{workspace-P72SXLXr.js.map → workspace-DwTe1zo6.js.map} +1 -1
  275. package/docker/Dockerfile +1 -1
  276. package/package.json +4 -1
  277. package/skills/reeval/references/environments.md +2 -2
  278. package/dist/adapter-BdzhdRYo.js.map +0 -1
  279. package/dist/agent-Dx-bDmlV.js.map +0 -1
  280. package/dist/agents-l0-k7vw3.js.map +0 -1
  281. package/dist/app-files-B-CQYB0c.js.map +0 -1
  282. package/dist/boat-CZpAreTB.js.map +0 -1
  283. package/dist/boat-su1Y7LPd.js +0 -325
  284. package/dist/boat-su1Y7LPd.js.map +0 -1
  285. package/dist/capture-BqIAeFyC.js.map +0 -1
  286. package/dist/capture-D0Ln5aCP.js +0 -1
  287. package/dist/cli-s_3opn_I.js.map +0 -1
  288. package/dist/cli-spec-DxzIjmq_.js.map +0 -1
  289. package/dist/client-C5fIzHQa.js.map +0 -1
  290. package/dist/command-DA_SHQUQ.js.map +0 -1
  291. package/dist/config-C0URar0t.js.map +0 -1
  292. package/dist/db-Bc4L-Wcr.js +0 -2
  293. package/dist/docker-CDdK6Ity.js +0 -271
  294. package/dist/docker-CDdK6Ity.js.map +0 -1
  295. package/dist/docker-DMug3l-a.js +0 -1
  296. package/dist/doctor-eFxyn6at.js.map +0 -1
  297. package/dist/evaluate-DA4QsrHO.js.map +0 -1
  298. package/dist/files-CNHhSyb3.js +0 -1
  299. package/dist/files-CW1lChNh.js +0 -1
  300. package/dist/images-Dsc4Wi-F.js.map +0 -1
  301. package/dist/init-C0oUG3jh.js +0 -1
  302. package/dist/ink-list-mCJypk3d.js.map +0 -1
  303. package/dist/live-DwjWJTdn.js +0 -1
  304. package/dist/live-xTZs0c61.js.map +0 -1
  305. package/dist/model-3pZZzloU.js.map +0 -1
  306. package/dist/model-jRKSQBg6.js.map +0 -1
  307. package/dist/model-nfewGTzB.js +0 -1
  308. package/dist/node-DM-mLGdX.js.map +0 -1
  309. package/dist/options-DpsJ_5CU.js +0 -1
  310. package/dist/plan-ChO0A-xn.js.map +0 -1
  311. package/dist/plugins-BioMWncI.js.map +0 -1
  312. package/dist/preflight-CJSGzMzc.js.map +0 -1
  313. package/dist/preflight-DD3fI4Hz.js +0 -1
  314. package/dist/prepare-D7oSSFNm.js.map +0 -1
  315. package/dist/providers-B6StVyfG.js.map +0 -1
  316. package/dist/query-BAc2tQZj.js +0 -1
  317. package/dist/record-nVVujCW7.js.map +0 -1
  318. package/dist/redact-DL2BTykw.js.map +0 -1
  319. package/dist/resolve-DW92wpIZ.js +0 -1
  320. package/dist/resume-D_PcUXfG.js.map +0 -1
  321. package/dist/routes-B0F2R-K7.js.map +0 -1
  322. package/dist/runtime-B3r_pAq6.js.map +0 -1
  323. package/dist/server-CGEsvVRG.js +0 -1
  324. package/dist/source-Wz1Nrfue.js +0 -1
  325. package/dist/src-BHJ4MWvY.js.map +0 -1
  326. package/dist/src-BL-_0QoE.js +0 -1
  327. package/dist/src-C-mOSczH.js +0 -2
  328. package/dist/src-CwH_nEaw.js +0 -2
  329. package/dist/state-B3jex5KU.js +0 -1
  330. package/dist/suite-Bhs9-Z7O.js +0 -2
  331. package/dist/summary-CSp4cfnr.js.map +0 -1
  332. package/dist/tart-CcrrtSrp.js.map +0 -1
  333. package/dist/tart-bake-F-6seRC9.js.map +0 -1
  334. package/dist/views-i67V1ly3.js +0 -2
  335. package/dist/worker-entry-C3Q4U63F.js.map +0 -1
  336. package/dist/workspace-DhUOW8if.js +0 -1
@@ -0,0 +1,1455 @@
1
+ import { S as stripCredentials, g as redactSecrets, p as redactJson } from "./redact-t-L3VGy8.js";
2
+ import { a as plural, i as formatDuration } from "./text-B8-W3Cvn.js";
3
+ import "./config-C0RKt00M.js";
4
+ import { n as SCHEMA_VERSIONS, r as fillDefaults, t as NewerSchemaError } from "./record--vHreTLk.js";
5
+ import { u as suiteResult } from "./suite-DjGxmDSY.js";
6
+ import { n as stripAnsi, t as colors } from "./colors-DcXBvAlU.js";
7
+ import { g as processAlive } from "./resume-C8Ihfy-C.js";
8
+ import { _ as outcomeOf, b as tailLines, c as onHost, d as statusList, f as attemptAxes, g as offset, h as failureLines, i as listLines, l as pointerLine, m as errorCheck, n as SPINNER, p as debugLines, s as progressText, t as LiveList, v as phaseOf, y as progressLine } from "./list-B_C0k5ex.js";
9
+ import { closeSync, fstatSync, mkdirSync, openSync, readSync, writeSync } from "node:fs";
10
+ import { dirname } from "node:path";
11
+ import { hostname } from "node:os";
12
+ import { setTimeout } from "node:timers/promises";
13
+ import stringWidth from "string-width";
14
+ // src/view/events.ts
15
+ /**
16
+ * A stream line as `reeval attach` reads it. A header from a newer reeval throws a
17
+ * `NewerSchemaError`; an event type this reeval doesn't know is passed on, and the renderers
18
+ * ignore it.
19
+ */
20
+ function readableEventLine(line) {
21
+ if (line.type === "header") {
22
+ const newest = SCHEMA_VERSIONS["run-events"];
23
+ if (line.schemaVersion > newest) throw new NewerSchemaError(`run ${line.runId}'s event stream`, line.schemaVersion, newest);
24
+ }
25
+ return fillDefaults("run-events", line);
26
+ }
27
+ // src/events.ts
28
+ const isEventsUrl = (target) => /^https?:\/\//i.test(target);
29
+ /** A run `reeval attach` follows over a WebSocket, at a `ws:` or `wss:` URL or its `http(s):` form. */
30
+ const isAttachUrl = (target) => /^(?:wss?|https?):\/\//i.test(target);
31
+ /** The stream ended, or its writer died, before the run's exit line. Exits 3. */
32
+ var EventStreamError = class extends Error {
33
+ name = "EventStreamError";
34
+ };
35
+ /** How long a run waits at exit for its last POSTs. */
36
+ const POST_DRAIN_MS = 1e4;
37
+ const POST_TIMEOUT_MS = 1e4;
38
+ /** How long `reeval attach` hears nothing from a run that writes heartbeats before it says so. */
39
+ const STALL_MS = 2e4;
40
+ /** How long it hears nothing before it stops following the run as lost. */
41
+ const LOST_MS = 12e4;
42
+ const targetView = (t) => ({
43
+ kind: t.kind,
44
+ key: t.key,
45
+ label: t.label,
46
+ setBy: t.setBy,
47
+ runWide: t.runWide
48
+ });
49
+ /**
50
+ * The event as the stream carries it: a prepare event without its prepared handles or a failure's
51
+ * full log, which the renderers don't draw.
52
+ */
53
+ function wire(e) {
54
+ if (e.type !== "prepare") return e;
55
+ if (e.state === "start") return {
56
+ ...e,
57
+ targets: e.targets.map(targetView)
58
+ };
59
+ const { outcome } = e;
60
+ return {
61
+ ...e,
62
+ outcome: outcome.ok ? {
63
+ target: targetView(outcome.target),
64
+ ok: true,
65
+ ms: outcome.ms
66
+ } : {
67
+ target: targetView(outcome.target),
68
+ ok: false,
69
+ failure: {
70
+ ...outcome.failure,
71
+ log: null
72
+ },
73
+ ms: outcome.ms
74
+ }
75
+ };
76
+ }
77
+ const line = (value) => `${redactJson(value)}\n`;
78
+ /**
79
+ * Why `file` can't take a run's event stream, or null when it can: it's missing, empty, or starts
80
+ * with a stream's header line. Anything else is someone's file, which the run would overwrite.
81
+ */
82
+ function notEventStream(file) {
83
+ let fd;
84
+ try {
85
+ fd = openSync(file, "r");
86
+ } catch {
87
+ return null;
88
+ }
89
+ try {
90
+ const buffer = Buffer.alloc(256);
91
+ const n = readSync(fd, buffer, 0, buffer.length, 0);
92
+ if (n === 0 || buffer.subarray(0, n).toString().startsWith("{\"type\":\"header\"")) return null;
93
+ return `${file} isn't a reeval event stream, so reeval run won't overwrite it`;
94
+ } finally {
95
+ closeSync(fd);
96
+ }
97
+ }
98
+ /**
99
+ * Opens a run's stream: writes `file` (a resume adds its lines after the run's) and POSTs
100
+ * batches of lines to `url`, in order, one request at a time. A failing target is dropped with one
101
+ * warning; the run goes on. Until the exit line, a quiet stream gets a heartbeat line.
102
+ */
103
+ function openEventStream(options) {
104
+ let fd = null;
105
+ const refused = options.file ? notEventStream(options.file) : null;
106
+ if (refused) options.warn(`not writing the event stream: ${refused}`);
107
+ if (options.file && !refused) try {
108
+ mkdirSync(dirname(options.file), { recursive: true });
109
+ fd = openSync(options.file, options.append ? "a" : "w");
110
+ } catch (error) {
111
+ options.warn(`can't write the event stream to ${options.file}: ${error.message}`);
112
+ }
113
+ const post = options.fetch ?? fetch;
114
+ let url = options.url;
115
+ const queue = [];
116
+ let sending = null;
117
+ const pump = () => {
118
+ if (sending || !url || !queue.length) return;
119
+ const body = queue.splice(0).join("");
120
+ const to = url;
121
+ sending = post(to, {
122
+ method: "POST",
123
+ headers: { "content-type": "application/x-ndjson" },
124
+ body,
125
+ signal: AbortSignal.timeout(POST_TIMEOUT_MS)
126
+ }).then(async (res) => {
127
+ if (res.ok) return;
128
+ const said = await serverMessage(res);
129
+ if (res.status === 413) throw new Error(`HTTP 413: the server refused a batch as too large, likely a line over its size limit${said}`);
130
+ throw new Error(`HTTP ${res.status}${said}`);
131
+ }).catch((error) => {
132
+ url = void 0;
133
+ queue.length = 0;
134
+ options.warn(redactSecrets(`stopped posting the event stream to ${displayUrl(to)}: ${error.message}`));
135
+ }).finally(() => {
136
+ sending = null;
137
+ pump();
138
+ });
139
+ };
140
+ let quiet = true;
141
+ const emit = (value) => {
142
+ quiet = false;
143
+ const text = line(value);
144
+ if (fd !== null) try {
145
+ writeSync(fd, text);
146
+ } catch (error) {
147
+ options.warn(`stopped writing the event stream: ${error.message}`);
148
+ closeSync(fd);
149
+ fd = null;
150
+ }
151
+ if (url) {
152
+ queue.push(text);
153
+ pump();
154
+ }
155
+ };
156
+ const heartbeatMs = options.heartbeatMs ?? 5e3;
157
+ emit({
158
+ type: "header",
159
+ schemaVersion: 1,
160
+ pid: process.pid,
161
+ host: hostname(),
162
+ ...options.header,
163
+ ...heartbeatMs > 0 ? { heartbeatMs } : {}
164
+ });
165
+ let ended = false;
166
+ const beating = heartbeatMs > 0 && (fd !== null || url) ? setInterval(() => {
167
+ if (quiet) emit({
168
+ type: "heartbeat",
169
+ at: Date.now()
170
+ });
171
+ quiet = true;
172
+ }, heartbeatMs) : void 0;
173
+ beating?.unref();
174
+ return {
175
+ write: (event) => {
176
+ if (!ended) emit(wire(event));
177
+ },
178
+ async end(code) {
179
+ if (ended) return;
180
+ clearInterval(beating);
181
+ emit({
182
+ type: "exit",
183
+ at: Date.now(),
184
+ code
185
+ });
186
+ ended = true;
187
+ if (fd !== null) closeSync(fd);
188
+ fd = null;
189
+ const deadline = Date.now() + POST_DRAIN_MS;
190
+ while ((sending || queue.length) && url && Date.now() < deadline) await (sending ?? setTimeout(10));
191
+ }
192
+ };
193
+ }
194
+ /** The message in an error response's `{ error: { message } }` body, as ` (message)`, or ''. */
195
+ async function serverMessage(res) {
196
+ try {
197
+ const message = (await res.json())?.error?.message;
198
+ return typeof message === "string" && message ? ` (${message.slice(0, 200)})` : "";
199
+ } catch {
200
+ return "";
201
+ }
202
+ }
203
+ /** A renderer that also sends every event it draws to `stream`. */
204
+ const teeRenderer = (renderer, stream) => ({
205
+ onEvent(event) {
206
+ stream.write(event);
207
+ renderer.onEvent(event);
208
+ },
209
+ close: () => renderer.close(),
210
+ ...renderer.wait ? { wait: () => renderer.wait?.() ?? Promise.resolve() } : {}
211
+ });
212
+ function parse(text, where) {
213
+ let value;
214
+ try {
215
+ value = JSON.parse(text);
216
+ } catch {
217
+ throw new EventStreamError(`${where} has a line that isn't JSON: ${text.slice(0, 80)}`);
218
+ }
219
+ return readableEventLine(value);
220
+ }
221
+ /** Splits text into whole lines, keeping a trailing partial line for the next chunk. */
222
+ function* lines(state, chunk) {
223
+ const parts = (state.rest + chunk).split("\n");
224
+ state.rest = parts.pop() ?? "";
225
+ for (const part of parts) if (part.trim()) yield part;
226
+ }
227
+ /**
228
+ * Every line of a stream file from its start, then each one as it's appended, until the run's exit
229
+ * line is the last one: an exit line a resume's header follows is passed on, and following goes on.
230
+ * Throws an `EventStreamError` when the run's process on this host is gone without an exit line.
231
+ */
232
+ async function* followFile(file, options) {
233
+ const alive = options.alive ?? processAlive;
234
+ const pollMs = options.pollMs ?? 100;
235
+ const fd = openSync(file, "r");
236
+ const buffer = Buffer.alloc(65536);
237
+ const state = { rest: "" };
238
+ let position = 0;
239
+ let last;
240
+ let header;
241
+ const decoder = new TextDecoder();
242
+ const read = () => {
243
+ if (fstatSync(fd).size < position) throw new EventStreamError(`${file} was cut short while reeval attach read it: another run may have started writing it`);
244
+ const out = [];
245
+ for (;;) {
246
+ const n = readSync(fd, buffer, 0, buffer.length, position);
247
+ if (n === 0) return out;
248
+ position += n;
249
+ for (const text of lines(state, decoder.decode(buffer.subarray(0, n), { stream: true }))) out.push(parse(text, file));
250
+ }
251
+ };
252
+ try {
253
+ for (;;) {
254
+ const got = read();
255
+ for (const l of got) {
256
+ if (l.type === "header") header = l;
257
+ last = l;
258
+ yield l;
259
+ }
260
+ if (got.length) continue;
261
+ if (last?.type === "exit") return;
262
+ if (header && header.host === hostname() && !alive(header.pid, header.host)) {
263
+ const tail = read();
264
+ if (!tail.length) throw new EventStreamError(`run ${header.runId}'s reeval run (pid ${header.pid}) ended without finishing its event stream`);
265
+ for (const l of tail) {
266
+ if (l.type === "header") header = l;
267
+ last = l;
268
+ yield l;
269
+ }
270
+ continue;
271
+ }
272
+ if (options.signal?.aborted) return;
273
+ await setTimeout(pollMs, void 0, { signal: options.signal }).catch(() => {});
274
+ }
275
+ } finally {
276
+ closeSync(fd);
277
+ }
278
+ }
279
+ /**
280
+ * How a run's event socket closes. The server closes with `done` once it has sent the run's last
281
+ * line and the run is over; any code from 4000 on, or 1008, refuses this viewer for good, and every
282
+ * other close is a dropped connection that `reeval attach` reconnects after, 1001 included, which
283
+ * the server sends a viewer it evicts as stale.
284
+ */
285
+ const SOCKET_CLOSE = {
286
+ done: 1e3,
287
+ unauthorized: 4401,
288
+ forbidden: 4403,
289
+ notFound: 4404,
290
+ /** The run already has as many viewers as it takes. */
291
+ tooManyViewers: 4429
292
+ };
293
+ /** The waits between reconnects to a run's event socket, the last repeated. */
294
+ const RECONNECT_MS = [
295
+ 250,
296
+ 500,
297
+ 1e3,
298
+ 2e3,
299
+ 5e3
300
+ ];
301
+ /**
302
+ * A viewer sends `PING` this often, and the server answers `PONG` (Durable Object hibernation's
303
+ * auto-response, text frames, since Node's WebSocket can't send protocol pings). At its viewer cap
304
+ * the server closes, with 1001, a viewer that has pinged before but not lately.
305
+ */
306
+ const PING_MS = 3e4;
307
+ const PING = "ping";
308
+ const PONG = "pong";
309
+ /** How long a connection stays up, with no frame, before the backoff starts over. */
310
+ const STABLE_MS = 5e3;
311
+ /** A URL as messages show it: no user name or password, and every query value masked. */
312
+ function displayUrl(source) {
313
+ let url;
314
+ try {
315
+ url = new URL(stripCredentials(source));
316
+ } catch {
317
+ return stripCredentials(source);
318
+ }
319
+ for (const key of new Set(url.searchParams.keys())) url.searchParams.set(key, "***");
320
+ return url.href.replace(/%2A/g, "*");
321
+ }
322
+ /** One connection's open, its frames, then its close. */
323
+ async function* socketEvents(url, connect, signal, pingMs) {
324
+ const socket = connect(url);
325
+ socket.binaryType = "arraybuffer";
326
+ const queue = [];
327
+ let wake;
328
+ let opened = false;
329
+ const push = (event) => {
330
+ queue.push(event);
331
+ wake?.();
332
+ };
333
+ const decoder = new TextDecoder();
334
+ let pinging;
335
+ socket.onopen = () => {
336
+ opened = true;
337
+ pinging = setInterval(() => {
338
+ if (socket.readyState === socket.OPEN) socket.send(PING);
339
+ }, pingMs);
340
+ pinging.unref();
341
+ push({ type: "open" });
342
+ };
343
+ socket.onmessage = (e) => push({
344
+ type: "frame",
345
+ data: typeof e.data === "string" ? e.data : decoder.decode(e.data)
346
+ });
347
+ let closed = false;
348
+ const close = (code, reason) => {
349
+ clearInterval(pinging);
350
+ if (closed) return;
351
+ closed = true;
352
+ push({
353
+ type: "close",
354
+ code,
355
+ reason,
356
+ opened
357
+ });
358
+ };
359
+ socket.onclose = (e) => close(e.code, e.reason);
360
+ socket.onerror = () => close(1006, "");
361
+ const abort = () => socket.close(SOCKET_CLOSE.done);
362
+ signal?.addEventListener("abort", abort, { once: true });
363
+ try {
364
+ for (;;) {
365
+ const next = queue.shift();
366
+ if (!next) {
367
+ await new Promise((resolve) => wake = resolve);
368
+ wake = void 0;
369
+ continue;
370
+ }
371
+ yield next;
372
+ if (next.type === "close") return;
373
+ }
374
+ } finally {
375
+ clearInterval(pinging);
376
+ signal?.removeEventListener("abort", abort);
377
+ if (socket.readyState === socket.CONNECTING || socket.readyState === socket.OPEN) socket.close(SOCKET_CLOSE.done);
378
+ }
379
+ }
380
+ /** The run's socket URL, from a `ws:`, `wss:`, `http:` or `https:` one. */
381
+ const socketUrl = (source) => {
382
+ const url = new URL(source);
383
+ url.protocol = url.protocol.replace(/^http/, "ws");
384
+ return url;
385
+ };
386
+ function refusal(source, code, reason) {
387
+ const why = reason ? ` (${reason})` : "";
388
+ if (code === SOCKET_CLOSE.tooManyViewers) return `the run at ${source} has as many viewers as it takes${why}: detach one and attach again`;
389
+ if (code === SOCKET_CLOSE.unauthorized) return `the run at ${source} refused the token${why}`;
390
+ if (code === SOCKET_CLOSE.forbidden) return `the run at ${source} refused this viewer${why}`;
391
+ if (code === SOCKET_CLOSE.notFound) return `there's no run at ${source}${why}`;
392
+ if (code === 1008 || code >= 4e3) return `the run at ${source} closed with ${code}${why}`;
393
+ return null;
394
+ }
395
+ /**
396
+ * A run's stream over a WebSocket: each frame is `{"seq":n,"line":<RunEventLine>}`, `seq` counting
397
+ * the run's lines from 1. It connects with `?after=<seq>`, so the server replays the lines after it
398
+ * and then sends each new one, and closes with 1000 once the run is over: a resume's lines can
399
+ * follow an exit line. A dropped connection reconnects after the last line it got; going `LOST_MS`
400
+ * without one that opens gives up.
401
+ */
402
+ async function* followSocket(source, options) {
403
+ const connect = options.connect ?? ((url) => new WebSocket(url));
404
+ const giveUpMs = options.reconnectMs ?? 12e4;
405
+ const stableMs = options.stableMs ?? STABLE_MS;
406
+ const pingMs = options.pingMs ?? PING_MS;
407
+ const shown = displayUrl(source);
408
+ const base = socketUrl(source);
409
+ let seq = 0;
410
+ let everOpened = false;
411
+ let failures = 0;
412
+ /** Since when no connection has opened, while reconnecting. */
413
+ let droppedAt;
414
+ /** Reconnecting, which ends with a frame or a connection that stays up. */
415
+ let reconnecting = false;
416
+ for (;;) {
417
+ const url = new URL(base);
418
+ url.searchParams.set("after", String(seq));
419
+ let closed;
420
+ let openedAt;
421
+ for await (const event of socketEvents(url.href, connect, options.signal, pingMs)) {
422
+ if (event.type === "open") {
423
+ openedAt = Date.now();
424
+ droppedAt = void 0;
425
+ continue;
426
+ }
427
+ if (event.type === "close") {
428
+ closed = event;
429
+ break;
430
+ }
431
+ if (event.data === PONG) continue;
432
+ let frame;
433
+ try {
434
+ frame = JSON.parse(event.data);
435
+ } catch {
436
+ throw new EventStreamError(`${shown} sent a frame that isn't JSON: ${event.data.slice(0, 80)}`);
437
+ }
438
+ if (typeof frame !== "object" || !frame || typeof frame.seq !== "number" || typeof frame.line !== "object" || !frame.line) throw new EventStreamError(`${shown} sent a frame without a seq and line: ${event.data.slice(0, 80)}`);
439
+ failures = 0;
440
+ reconnecting = false;
441
+ if (frame.seq <= seq) continue;
442
+ if (frame.seq !== seq + 1) throw new EventStreamError(`${shown} skipped from line ${seq} to line ${frame.seq}`);
443
+ seq = frame.seq;
444
+ yield readableEventLine(frame.line);
445
+ }
446
+ if (options.signal?.aborted || !closed) return;
447
+ if (closed.opened) everOpened = true;
448
+ if (closed.code === SOCKET_CLOSE.done) return;
449
+ const refused = refusal(shown, closed.code, closed.reason);
450
+ if (refused) throw new EventStreamError(refused);
451
+ if (!everOpened) throw new EventStreamError(`can't connect to the event stream at ${shown}`);
452
+ if (openedAt !== void 0 && Date.now() - openedAt >= stableMs) {
453
+ failures = 0;
454
+ reconnecting = false;
455
+ }
456
+ if (!reconnecting) {
457
+ reconnecting = true;
458
+ options.onDrop?.();
459
+ }
460
+ droppedAt ??= Date.now();
461
+ if (Date.now() - droppedAt > giveUpMs) throw new EventStreamError(`lost the connection to ${shown} and couldn't reconnect for ${formatDuration(giveUpMs)}`);
462
+ const wait = RECONNECT_MS[Math.min(failures, RECONNECT_MS.length - 1)] ?? 0;
463
+ failures++;
464
+ await setTimeout(wait, void 0, { signal: options.signal }).catch(() => {});
465
+ if (options.signal?.aborted) return;
466
+ }
467
+ }
468
+ /** A run's stream, from a file or a run's socket URL, from its first line on. */
469
+ const followEvents = (source, options = {}) => isAttachUrl(source) ? followSocket(source, options) : followFile(source, options);
470
+ // src/ui/header.ts
471
+ /** ` ➜ `, ` ⚠ `: the glyph column every line of the block starts with. */
472
+ const GLYPH = 5;
473
+ /** `Est. Time: `, the longest key. */
474
+ const KEY = 11;
475
+ /** `Warning: `, the longer note label. */
476
+ const LABEL = 9;
477
+ /**
478
+ * `text` broken at spaces into lines of at most `width` columns, not counting color codes; a
479
+ * longer word keeps a line. A `·` stays with the word before it, so no line starts with one.
480
+ */
481
+ function wrap(text, width) {
482
+ const words = [];
483
+ for (const word of text.split(/\s+/).filter(Boolean)) if (word === "·" && words.length) words[words.length - 1] += " ·";
484
+ else words.push(word);
485
+ const lines = [];
486
+ let line = "";
487
+ for (const word of words) if (line && stripAnsi(line).length + 1 + stripAnsi(word).length > width) {
488
+ lines.push(line);
489
+ line = word;
490
+ } else line = line ? `${line} ${word}` : word;
491
+ return line ? [...lines, line] : lines;
492
+ }
493
+ const indent = (n) => " ".repeat(n);
494
+ /** `REEVAL v0.16.1`, then the run's facts, one `➜ Key: value` line each. */
495
+ function headerLines(c, h, width) {
496
+ const name = `REEVAL v${h.version}`;
497
+ const title = c.bold(c.depth === 4 ? name : c.teal(name));
498
+ const valueWidth = width - GLYPH - KEY;
499
+ const row = (key, value) => {
500
+ const values = typeof value === "string" ? [value] : value;
501
+ const joined = values.join(", ");
502
+ return (values.length > 1 && stripAnsi(joined).length > valueWidth ? values : wrap(joined, valueWidth)).map((v, i) => i === 0 ? ` ${c.teal("➜")} ${c.dim(`${key}:`)}${indent(KEY - key.length - 1)}${v}` : `${indent(16)}${v}`);
503
+ };
504
+ const many = (one, n, many = `${one}s`) => n === 1 ? one : many;
505
+ const continued = [h.resumed ? `${plural(h.resumed, "attempt")} done` : "", h.retried ? `${plural(h.retried, "error")} to retry` : ""].filter(Boolean);
506
+ const resumed = continued.length ? c.dim(` (resumed, ${continued.join(", ")})`) : "";
507
+ const reason = h.profile && h.profile.reason !== "--profile" ? c.dim(` (${h.profile.reason})`) : "";
508
+ return [
509
+ h.dryRun ? `${title} ${c.dim("dry run")}` : title,
510
+ "",
511
+ ...row("Run", `${h.runId}${resumed}`),
512
+ ...h.config ? row("Config", h.config) : [],
513
+ ...h.profile ? row("Profile", `${h.profile.name}${reason}`) : [],
514
+ ...row(many("Harness", h.harnesses.length, "Harnesses"), h.harnesses.map((id) => harness(c, h, id))),
515
+ ...row(many("Sandbox", h.sandboxes.length, "Sandboxes"), h.sandboxes),
516
+ ...h.judges.length ? row(many("Judge", h.judges.length), h.judges) : [],
517
+ ...row("Scope", scope(c, h)),
518
+ ...row("Est. Time", estimate(c, h)),
519
+ ...h.record && !h.dryRun ? row("Record", h.record) : []
520
+ ];
521
+ }
522
+ /** A harness id, with the effort it runs at when the id doesn't name it. */
523
+ function harness(c, h, id) {
524
+ const effort = h.efforts?.[id];
525
+ if (effort === void 0 || id.includes("[effort=")) return id;
526
+ return `${id} ${`(effort: ${effort})`.split(" ").map((w) => c.dim(w)).join(" ")}`;
527
+ }
528
+ function scope(c, h) {
529
+ const attempts = h.fewest < h.attempts ? `${h.fewest}–${h.attempts} attempts` : plural(h.attempts, "attempt");
530
+ const parts = [
531
+ plural(h.files, "eval file"),
532
+ plural(h.evals, "eval") + (h.skipped ? ` (${h.skipped} skipped)` : ""),
533
+ plural(h.cells, "cell"),
534
+ attempts
535
+ ];
536
+ const caps = [h.budget.attempts !== void 0 ? `${h.budget.attempts} ${h.attempts <= h.budget.attempts ? c.green("✓") : c.red("✗")}` : "", h.budget.duration ?? ""].filter(Boolean);
537
+ return `${parts.join(" · ")}${caps.length ? ` (budget: ${caps.join(", ")})` : ""}`;
538
+ }
539
+ function estimate(c, h) {
540
+ const serial = `~${formatDuration(h.estimateMs)} ${c.dim("(serial)")}`;
541
+ const most = Math.min(h.concurrency, h.attempts);
542
+ const parallel = h.parallel ?? most;
543
+ if (parallel <= 1) return serial;
544
+ const capped = parallel < most ? `, ${parallel} at once` : "";
545
+ return `${`~${formatDuration(h.estimateMs / parallel)} ${c.dim(`(concurrency: ${h.concurrency}${capped})`)}`} · ${serial}`;
546
+ }
547
+ /** `⚠ Warning: …` or `ℹ Hint: …`, wrapped under its first word. */
548
+ function noteLines(c, kind, text, width) {
549
+ const [glyph, label, paint] = kind === "hint" ? [
550
+ "ℹ",
551
+ "Hint:",
552
+ c.blue
553
+ ] : [
554
+ "⚠",
555
+ "Warning:",
556
+ kind === "root" ? c.red : c.orange
557
+ ];
558
+ const basic = {
559
+ warning: c.yellow,
560
+ hint: c.teal,
561
+ root: c.red
562
+ }[kind];
563
+ const lead = c.depth === 4 && kind !== "root" ? `${basic(glyph)} ${c.bold(label)}` : c.bold(paint(`${glyph} ${label}`));
564
+ const at = 14;
565
+ return wrap(text, Math.max(20, width - at)).map((line, i) => i === 0 ? ` ${lead}${indent(LABEL - label.length)}${line}` : `${indent(at)}${line}`);
566
+ }
567
+ /** A step line, `◆ Preparing 1 sandbox (docker)...`, its text wrapped under itself. */
568
+ function stepLines(glyph, text, width) {
569
+ return wrap(text, Math.max(20, width - GLYPH)).map((line, i) => i === 0 ? ` ${glyph} ${line}` : `${indent(GLYPH)}${line}`);
570
+ }
571
+ /** A run-level notice (a prepared workspace, the Ctrl-C one) as a step line. */
572
+ function noticeLines(c, e, width) {
573
+ const glyph = {
574
+ info: c.dim("ℹ"),
575
+ warn: c.orange("⚠"),
576
+ error: c.red("✗")
577
+ }[e.level];
578
+ const lines = stepLines(glyph, e.text, width);
579
+ return e.level === "info" ? lines.map((l) => c.dim(l)) : lines;
580
+ }
581
+ /** Preflight: which sandboxes it prepares, each one ready, and each failure. */
582
+ function prepareStepLines(c, e, width, max) {
583
+ if (e.state === "start") {
584
+ const n = e.targets.length;
585
+ const names = e.targets.map((t) => t.label).join(", ");
586
+ return stepLines(c.teal("◆"), `Preparing ${plural(n, "sandbox", "sandboxes")} (${names})...`, width);
587
+ }
588
+ const { outcome } = e;
589
+ if (outcome.ok) {
590
+ const took = outcome.ms >= 1e3 ? ` ${c.dim(formatDuration(outcome.ms))}` : "";
591
+ return [` ${c.green("✓")} ${outcome.target.label} ready${took}`];
592
+ }
593
+ const who = outcome.target.setBy.join(", ");
594
+ return [` ${c.red("✗")} ${outcome.target.label} failed to prepare ${c.dim(`(set by ${who}; only its attempts fail)`)}`, ...tailLines(outcome.failure.message, max).map((l) => `${indent(GLYPH)}${c.orange(l)}`)];
595
+ }
596
+ /** The start line's text: how the attempts' logs will print. */
597
+ function startText(output) {
598
+ return output.outputLogs === "none" ? "Running..." : output.outputLogs === "errors-only" ? "Running; logs print for failed attempts only..." : output.logOrder === "stream" ? "Streaming logs..." : "Running; each attempt's logs print as it ends...";
599
+ }
600
+ /** The last line before the attempts' own: how their logs will print. */
601
+ function startLine(c, output) {
602
+ return ` ${c.teal("◆")} ${startText(output)}`;
603
+ }
604
+ /** What the start line's text becomes once the run ends, on a terminal that redraws it. */
605
+ function endText(status) {
606
+ return status === "interrupted" ? "Canceled." : status === "budget" ? "Stopped at the budget." : "Finished.";
607
+ }
608
+ /** The plan as the header block: its facts, `--dry-run`'s table, then each kind of note. */
609
+ function planLines(c, e, width) {
610
+ const sections = [
611
+ e.details,
612
+ [...e.warnings.flatMap((w) => noteLines(c, "warning", w, width)), ...(e.sandboxWarnings ?? []).flatMap((w) => noteLines(c, w.kind === "root" ? "root" : "warning", w.message, width))],
613
+ e.hints.flatMap((h) => noteLines(c, "hint", h, width))
614
+ ];
615
+ const out = headerLines(c, e.header, width);
616
+ for (const lines of sections) if (lines.length) out.push("", ...lines);
617
+ out.push("");
618
+ return out;
619
+ }
620
+ // src/ui/tags.ts
621
+ const STOPWORDS = new Set("a an the and or of to in on for with without from by at as is are be it its that this when than then into via not no".split(" "));
622
+ const MAX_WORDS = 3;
623
+ const MAX_LENGTH = 24;
624
+ const words = (name) => name.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((w) => w && !STOPWORDS.has(w));
625
+ /**
626
+ * Short handles for the evals of one file, e.g. `greet`: the first distinctive words of each
627
+ * name, where words shared by most of the file's evals ("recommends Genkit over …") don't
628
+ * count. Depends only on the file's evals, so a tag stays the same across runs and filters.
629
+ */
630
+ function fileTags(evals, taken) {
631
+ const lists = evals.map((e) => words(e.name));
632
+ const df = /* @__PURE__ */ new Map();
633
+ for (const list of lists) for (const w of new Set(list)) df.set(w, (df.get(w) ?? 0) + 1);
634
+ const common = (w) => evals.length > 1 && (df.get(w) ?? 0) > evals.length / 2;
635
+ const candidates = lists.map((list) => {
636
+ const rare = list.filter((w) => !common(w));
637
+ return rare.length ? rare : list.length ? list : ["eval"];
638
+ });
639
+ const tags = /* @__PURE__ */ new Map();
640
+ const clip = (tag) => tag.slice(0, MAX_LENGTH).replace(/-+$/, "");
641
+ const prefix = (list, n) => clip(list.slice(0, n).join("-"));
642
+ evals.forEach((e, i) => {
643
+ const own = candidates[i] ?? ["eval"];
644
+ let tag = prefix(own, 1);
645
+ for (let n = 1; n <= MAX_WORDS; n++) {
646
+ tag = prefix(own, n);
647
+ if (!candidates.some((other, j) => j !== i && prefix(other, n) === tag) && !taken.has(tag)) break;
648
+ }
649
+ let unique = tag;
650
+ for (let k = 2; taken.has(unique); k++) unique = `${tag}-${k}`;
651
+ taken.add(unique);
652
+ tags.set(e.id, unique);
653
+ });
654
+ return tags;
655
+ }
656
+ /** Tags evals as their files are collected; later files never rename earlier tags. */
657
+ var Tagger = class {
658
+ #tags = /* @__PURE__ */ new Map();
659
+ #taken = /* @__PURE__ */ new Set();
660
+ addFile(attempts) {
661
+ const fresh = [...new Map(attempts.map((a) => [a.id, a])).values()].filter((e) => !this.#tags.has(e.id));
662
+ for (const [id, tag] of fileTags(fresh, this.#taken)) this.#tags.set(id, tag);
663
+ }
664
+ /** `greet#1`: the eval's tag and run number. */
665
+ label(id, attempt) {
666
+ let tag = this.#tags.get(id);
667
+ if (!tag) {
668
+ this.addFile([{
669
+ id,
670
+ name: id.split(" › ").at(-1) ?? id
671
+ }]);
672
+ tag = this.#tags.get(id) ?? "eval";
673
+ }
674
+ return `${tag}#${attempt}`;
675
+ }
676
+ };
677
+ // src/ui/agent.ts
678
+ const MAX_LINES = 12;
679
+ /** Agents read whole lines, so the header's notes don't wrap. */
680
+ const WIDTH = Number.POSITIVE_INFINITY;
681
+ var AgentRenderer = class {
682
+ #o;
683
+ #c = colors(false);
684
+ /** `[key]` prefixes for `-v` lines, from each attempt's start. */
685
+ #labels = /* @__PURE__ */ new Map();
686
+ #tags = new Tagger();
687
+ constructor(options) {
688
+ this.#o = options;
689
+ }
690
+ #write(text) {
691
+ this.#o.out.write(`${text.trimEnd()}\n`);
692
+ }
693
+ onEvent(e) {
694
+ switch (e.type) {
695
+ case "plan":
696
+ for (const line of planLines(this.#c, e, WIDTH)) this.#write(line);
697
+ return;
698
+ case "run-start":
699
+ this.#write(startLine(this.#c, {
700
+ ...this.#o.output,
701
+ outputLogs: "none"
702
+ }));
703
+ return;
704
+ case "collected":
705
+ this.#tags.addFile(e.evals);
706
+ return;
707
+ case "eval-start": {
708
+ const tag = this.#tags.label(e.id, e.attempt?.n ?? 1);
709
+ this.#labels.set(e.key, `[${tag} ${attemptAxes(e.attempt, "agent")}]`);
710
+ return;
711
+ }
712
+ case "debug": {
713
+ const label = this.#labels.get(e.key) ?? `[${e.key}]`;
714
+ for (const line of debugLines(this.#c, e.line, this.#o.verbosity === 2)) this.#write(`${label} ${line}`);
715
+ return;
716
+ }
717
+ case "eval-progress": {
718
+ if (e.progress.kind !== "browser-download" && e.progress.kind !== "warning") return;
719
+ const label = this.#labels.get(e.key) ?? `[${e.key}]`;
720
+ this.#write(`${label} ${progressLine(this.#c, e.progress)}`);
721
+ return;
722
+ }
723
+ case "prepare":
724
+ for (const line of prepareStepLines(this.#c, e, WIDTH, MAX_LINES)) this.#write(line);
725
+ return;
726
+ case "notice":
727
+ for (const line of noticeLines(this.#c, e, WIDTH)) this.#write(line);
728
+ return;
729
+ case "run-end": {
730
+ this.#write("");
731
+ const verbose = (this.#o.verbosity ?? 0) > 0;
732
+ const list = statusList({
733
+ record: e.record,
734
+ suite: suiteResult(e.record),
735
+ remarks: e.remarks ?? null,
736
+ verbose,
737
+ ...e.notRun ? { notRun: e.notRun } : {}
738
+ });
739
+ const pointer = pointerLine(e.summaryPath);
740
+ for (const line of listLines(list, this.#c, false, pointer, verbose, true)) this.#write(line);
741
+ return;
742
+ }
743
+ default: return;
744
+ }
745
+ }
746
+ close() {}
747
+ };
748
+ // src/ui/plain.ts
749
+ /** In a grouped block, an end line replaces its start line and keeps its start time. */
750
+ const STARTS = {
751
+ "sandbox-ready": "sandbox",
752
+ "turn-end": "turn-start",
753
+ "check-end": "check-start",
754
+ "judge-end": "judge-start",
755
+ "browser-download": "browser-download"
756
+ };
757
+ const ERROR_LINES = 12;
758
+ /** Back to the start of the line and clear it, for the live status line. */
759
+ const CLEAR = "\r\x1B[2K";
760
+ /** GitHub Actions workflow-command escaping. */
761
+ const ghEscape = (s, property = false) => {
762
+ const out = s.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
763
+ return property ? out.replace(/:/g, "%3A").replace(/,/g, "%2C") : out;
764
+ };
765
+ /** The eval file's line in Vitest's formatted error (`❯ evals/a.eval.ts:7:33`), if any. */
766
+ function locate(result) {
767
+ const text = stripAnsi(result.formattedErrors[0] ?? "");
768
+ const file = result.file.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
769
+ const match = new RegExp(`❯ ${file}:(\\d+):(\\d+)`).exec(text);
770
+ return match?.[1] && match[2] ? {
771
+ line: match[1],
772
+ col: match[2]
773
+ } : void 0;
774
+ }
775
+ /** `evals/a.eval.ts:7` as its file and line. */
776
+ const splitAt = (at) => {
777
+ const i = at.lastIndexOf(":");
778
+ return [at.slice(0, i), at.slice(i + 1)];
779
+ };
780
+ var PlainRenderer = class {
781
+ #o;
782
+ #c;
783
+ #tags = new Tagger();
784
+ #running = /* @__PURE__ */ new Map();
785
+ #now;
786
+ #queued = /* @__PURE__ */ new Set();
787
+ #runStartedAt = 0;
788
+ #lastWrite = 0;
789
+ /** The last line written was blank, so the list needs no gap above it. */
790
+ #blank = false;
791
+ #timer;
792
+ /** On a TTY: the status line is drawn under everything else, and redrawn after each write. */
793
+ #live;
794
+ #status = "";
795
+ /** Tries collected (not skipped), as many as the plan has, and the tries that ended. */
796
+ #tries = /* @__PURE__ */ new Set();
797
+ #plannedTries = 0;
798
+ #ended = /* @__PURE__ */ new Set();
799
+ #list;
800
+ #lastProgress = 0;
801
+ constructor(options) {
802
+ this.#o = options;
803
+ this.#list = new LiveList(options.harness);
804
+ this.#c = options.colors;
805
+ this.#now = options.now ?? Date.now;
806
+ this.#live = options.output.statusLine;
807
+ const { heartbeatMs } = options.output;
808
+ if (options.timers !== false && heartbeatMs > 0) {
809
+ this.#timer = setInterval(() => this.tick(), Math.min(heartbeatMs, 5e3));
810
+ this.#timer.unref();
811
+ }
812
+ }
813
+ #write(text) {
814
+ const line = `${text.trimEnd()}\n`;
815
+ this.#o.out.write(this.#status ? `${CLEAR}${line}${this.#status}` : line);
816
+ this.#lastWrite = this.#now();
817
+ this.#blank = line === "\n";
818
+ }
819
+ /**
820
+ * `7 evals · 12/28 tries`: what the plan runs (or what's collected, when that's more) and how
821
+ * many tries ended.
822
+ */
823
+ #drawStatus() {
824
+ if (!this.#live || !this.#tries.size) return;
825
+ const { total } = this.#list.counts();
826
+ const tries = Math.max(this.#plannedTries, this.#tries.size);
827
+ const status = this.#c.dim(`${plural(total, "eval")} · ${this.#ended.size}/${tries} tries`);
828
+ if (status === this.#status) return;
829
+ this.#o.out.write(`${CLEAR}${status}`);
830
+ this.#status = status;
831
+ }
832
+ #clearStatus() {
833
+ if (!this.#status) return;
834
+ this.#o.out.write(CLEAR);
835
+ this.#status = "";
836
+ }
837
+ #attempt(ref, startedAt) {
838
+ const n = ref.attempt?.n ?? 1;
839
+ const label = `[${this.#tags.label(ref.id, n)} ${attemptAxes(ref.attempt, this.#o.harness)}]`;
840
+ const ungated = ref.attempt?.gate === "none";
841
+ return {
842
+ key: ref.key,
843
+ id: ref.id,
844
+ label,
845
+ startedAt,
846
+ lines: [],
847
+ last: void 0,
848
+ ungated
849
+ };
850
+ }
851
+ #prefix(a) {
852
+ return this.#c.tag(a.label)(a.label);
853
+ }
854
+ #detail(a, line, prefixed) {
855
+ const body = line.debug ? ` ${line.text}` : ` ${this.#c.dim(offset(line.at - a.startedAt))} ${line.text}`;
856
+ return prefixed ? `${this.#prefix(a)}${body}` : body.slice(1);
857
+ }
858
+ get #streaming() {
859
+ return this.#o.output.logOrder === "stream" && this.#o.output.outputLogs === "full";
860
+ }
861
+ #add(a, line) {
862
+ if (line.kind === "warning" && !this.#streaming) {
863
+ this.#write(this.#detail(a, line, true));
864
+ return;
865
+ }
866
+ a.lines.push(line);
867
+ if (this.#streaming) this.#write(this.#detail(a, line, true));
868
+ }
869
+ onEvent(e) {
870
+ const c = this.#c;
871
+ switch (e.type) {
872
+ case "run-start":
873
+ this.#runStartedAt = e.at;
874
+ this.#write(startLine(c, this.#o.output));
875
+ this.#write("");
876
+ return;
877
+ case "plan":
878
+ this.#list.planned(e.header.evals);
879
+ this.#plannedTries = e.header.attempts;
880
+ for (const line of planLines(c, e, this.#columns)) this.#write(line);
881
+ if (this.#o.output.githubActions) for (const w of e.sandboxWarnings ?? []) this.#annotate(w);
882
+ return;
883
+ case "collected":
884
+ this.#list.collected(e.file, e.evals);
885
+ this.#tags.addFile(e.evals);
886
+ for (const x of e.evals) {
887
+ if (x.skipped) continue;
888
+ this.#queued.add(x.key);
889
+ this.#tries.add(x.key);
890
+ }
891
+ this.#drawStatus();
892
+ return;
893
+ case "eval-start": {
894
+ const a = this.#attempt(e, e.at);
895
+ this.#list.start(e);
896
+ a.last = e;
897
+ this.#queued.delete(e.key);
898
+ this.#running.set(e.key, a);
899
+ if (this.#streaming) this.#write(`${this.#prefix(a)} ${c.dim("▶")} ${e.id}`);
900
+ return;
901
+ }
902
+ case "eval-progress": {
903
+ const a = this.#running.get(e.key);
904
+ if (!a) return;
905
+ this.#list.progress(e.key, e.progress);
906
+ if (e.progress.kind !== "warning") a.last = e;
907
+ const { progress } = e;
908
+ const paint = a.ungated ? {
909
+ ...c,
910
+ red: c.dim
911
+ } : c;
912
+ const line = {
913
+ at: progress.at,
914
+ text: progressLine(paint, progress),
915
+ kind: progress.kind
916
+ };
917
+ const start = STARTS[progress.kind];
918
+ const open = start && a.lines.findLastIndex((l) => l.kind === start);
919
+ if (!this.#streaming && open !== void 0 && open >= 0) {
920
+ line.at = a.lines[open]?.at ?? line.at;
921
+ a.lines.splice(open, 1);
922
+ }
923
+ this.#add(a, line);
924
+ return;
925
+ }
926
+ case "debug": {
927
+ const a = this.#running.get(e.key);
928
+ if (!a) return;
929
+ for (const text of debugLines(c, e.line, this.#o.verbosity === 2)) this.#add(a, {
930
+ at: e.line.at,
931
+ text,
932
+ debug: true
933
+ });
934
+ return;
935
+ }
936
+ case "log": {
937
+ const a = e.key ? this.#running.get(e.key) : void 0;
938
+ const label = e.stream === "stderr" ? c.yellow("stderr |") : c.dim("stdout |");
939
+ for (const text of e.text.replace(/\n$/, "").split("\n")) if (a) this.#add(a, {
940
+ at: e.at,
941
+ text: `${label} ${text}`
942
+ });
943
+ else this.#write(`${label} ${text}`);
944
+ return;
945
+ }
946
+ case "eval-end":
947
+ this.#list.end(e.result);
948
+ this.#end(e.result, e.at);
949
+ if (this.#tries.has(e.result.key)) this.#ended.add(e.result.key);
950
+ this.#drawStatus();
951
+ return;
952
+ case "prepare":
953
+ for (const line of prepareStepLines(c, e, this.#columns, ERROR_LINES)) this.#write(line);
954
+ if (e.state === "failed" && this.#o.output.githubActions) {
955
+ const { target, failure } = e.outcome;
956
+ const what = target.kind === "workspace" ? "The" : "Sandbox";
957
+ const title = ghEscape(`${what} ${target.label} failed to prepare`, true);
958
+ this.#write(`::error title=${title}::${ghEscape(failure.message)}`);
959
+ }
960
+ return;
961
+ case "notice":
962
+ for (const line of noticeLines(c, e, this.#columns)) this.#write(line);
963
+ return;
964
+ case "run-end": {
965
+ this.#clearStatus();
966
+ if (!this.#blank) this.#write("");
967
+ const verbose = (this.#o.verbosity ?? 0) > 0;
968
+ const list = statusList({
969
+ record: e.record,
970
+ suite: suiteResult(e.record),
971
+ remarks: e.remarks ?? null,
972
+ verbose,
973
+ ...e.notRun ? { notRun: e.notRun } : {}
974
+ });
975
+ for (const line of listLines(list, c, true, pointerLine(e.summaryPath), verbose)) this.#write(line);
976
+ return;
977
+ }
978
+ }
979
+ }
980
+ get #columns() {
981
+ return this.#o.columns || Number.POSITIVE_INFINITY;
982
+ }
983
+ /** The header block names a sandbox warning; GitHub Actions also annotates it. */
984
+ #annotate(w) {
985
+ const file = w.file ? `file=${ghEscape(w.file, true)},` : "";
986
+ const title = w.kind === "root" ? "Sandbox runs as root" : "Sandbox has extra capabilities";
987
+ this.#write(`::warning ${file}title=${ghEscape(title, true)}::${ghEscape(w.message)}`);
988
+ }
989
+ /**
990
+ * An ended attempt's logs, as `--output-logs` picks: grouped, its block under a `▶` header;
991
+ * streamed, only its error lines, since the rest already printed. A sandbox that failed to
992
+ * prepare was annotated once, for all its attempts.
993
+ */
994
+ #end(result, at) {
995
+ const c = this.#c;
996
+ const a = this.#running.get(result.key) ?? this.#attempt(result, at - result.durationMs);
997
+ this.#running.delete(result.key);
998
+ this.#queued.delete(result.key);
999
+ const outcome = outcomeOf(result);
1000
+ const failed = outcome !== "pass" && outcome !== "skipped";
1001
+ const ungated = failed && result.attempt?.gate === "none";
1002
+ const missed = ungated && outcome === "fail";
1003
+ const { outputLogs, githubActions, logPrefix } = this.#o.output;
1004
+ const showDetail = !this.#streaming && a.lines.length > 0 && (outputLogs === "full" || outputLogs === "errors-only" && failed);
1005
+ const judged = result.meta?.errorKind === "judge" && (showDetail || this.#streaming);
1006
+ const errors = failed && outputLogs !== "none" && !judged ? missed ? failureLines(colors(false), result, { max: 1 }).filter((l) => l.trim()).slice(0, 1).map((l) => c.dim(l)) : failureLines(c, result, { max: ERROR_LINES }) : [];
1007
+ const lines = a.lines.filter((l) => l.kind !== "cleanup").sort((x, y) => x.at - y.at);
1008
+ const prefixed = logPrefix === "task";
1009
+ const head = `${this.#prefix(a)} ${c.dim("▶")} ${result.id}`;
1010
+ const group = githubActions && showDetail && (!failed || missed);
1011
+ if (showDetail || !this.#streaming && errors.length) this.#write(group ? `::group::${stripAnsi(head)}` : head);
1012
+ if (showDetail) for (const line of lines) this.#write(this.#detail(a, line, prefixed));
1013
+ for (const line of errors) this.#write(prefixed ? `${this.#prefix(a)} ${line}` : ` ${line}`);
1014
+ if (group) this.#write("::endgroup::");
1015
+ if (githubActions && failed && !ungated && !result.meta?.prepare) {
1016
+ const which = result.attempt?.label ? ` [${result.attempt.label}]` : "";
1017
+ const title = ghEscape(`${result.id}${which}`, true);
1018
+ const checks = (result.meta?.failedChecks ?? []).filter((x) => x.at);
1019
+ for (const x of checks) {
1020
+ const [file, line] = splitAt(x.at);
1021
+ const label = ghEscape(`${result.id}${which}: ${x.label}`, true);
1022
+ this.#write(`::error file=${ghEscape(file, true)},line=${line},title=${label}::${ghEscape(x.message)}`);
1023
+ }
1024
+ if (!errorCheck(result)?.at) {
1025
+ const message = ghEscape(failureLines(colors(false), result, { max: ERROR_LINES }).join("\n").replace(/^✗ failed {2}/, ""));
1026
+ const at = locate(result);
1027
+ const where = at ? `,line=${at.line},col=${at.col}` : "";
1028
+ this.#write(`::error file=${ghEscape(result.file, true)}${where},title=${title}::${message}`);
1029
+ }
1030
+ }
1031
+ }
1032
+ /**
1033
+ * Every `heartbeatMs` while attempts run. Without attempt logs, how many evals are done; with
1034
+ * them, each running attempt's phase, when nothing printed for that long.
1035
+ */
1036
+ tick(now = this.#now()) {
1037
+ const { heartbeatMs, outputLogs } = this.#o.output;
1038
+ if (this.#live || heartbeatMs <= 0) return;
1039
+ if (this.#running.size === 0) return;
1040
+ const c = this.#c;
1041
+ if (outputLogs === "none") {
1042
+ if (now - Math.max(this.#lastProgress, this.#runStartedAt) < heartbeatMs) return;
1043
+ const { done, total } = this.#list.counts();
1044
+ this.#write(c.dim(progressText(done, total, now - this.#runStartedAt)));
1045
+ this.#lastProgress = now;
1046
+ return;
1047
+ }
1048
+ if (now - this.#lastWrite < heartbeatMs) return;
1049
+ const running = [...this.#running.values()].map((a) => {
1050
+ const progress = a.last?.type === "eval-progress" ? a.last.progress : void 0;
1051
+ return `${this.#prefix(a)} ${phaseOf(progress)} ${c.dim(formatDuration(now - a.startedAt))}`;
1052
+ });
1053
+ const queued = this.#queued.size ? `, ${this.#queued.size} queued` : "";
1054
+ const elapsed = formatDuration(now - this.#runStartedAt);
1055
+ this.#write(`${c.dim(`… ${this.#running.size} running${queued} after ${elapsed}:`)} ${running.join(c.dim(", "))}`);
1056
+ }
1057
+ close() {
1058
+ clearInterval(this.#timer);
1059
+ this.#clearStatus();
1060
+ }
1061
+ };
1062
+ // src/ui/tty.ts
1063
+ /** The list's state, which the Ink app reads with `useSyncExternalStore`. */
1064
+ var ListStore = class {
1065
+ #state = {
1066
+ files: [],
1067
+ logs: [],
1068
+ counts: {
1069
+ done: 0,
1070
+ total: 0
1071
+ },
1072
+ phase: null,
1073
+ finished: null
1074
+ };
1075
+ #listeners = /* @__PURE__ */ new Set();
1076
+ get = () => this.#state;
1077
+ subscribe = (listener) => {
1078
+ this.#listeners.add(listener);
1079
+ return () => this.#listeners.delete(listener);
1080
+ };
1081
+ set(next) {
1082
+ this.#state = {
1083
+ ...this.#state,
1084
+ ...next
1085
+ };
1086
+ for (const l of this.#listeners) l();
1087
+ }
1088
+ };
1089
+ const FRAME_MS = 80;
1090
+ const CANCELABLE_MS = 1e3;
1091
+ const ESC = String.fromCharCode(27);
1092
+ const BEL = String.fromCharCode(7);
1093
+ /** A CSI sequence (colors, cursor moves) or an OSC one (a hyperlink), which take no columns. */
1094
+ const ESCAPE = new RegExp(`${ESC}(?:\\[[0-9;?]*[ -/]*[@-~]|\\][^${BEL}${ESC}]*(?:${BEL}|${ESC}\\\\))`, "g");
1095
+ const graphemes = new Intl.Segmenter();
1096
+ /**
1097
+ * Terminal rows one line takes at `columns`, placed as a terminal places it: a wide character that
1098
+ * doesn't fit in the row's last column moves to the next row, `\r` returns to the row's start and
1099
+ * `\t` goes to the next stop of eight without wrapping.
1100
+ */
1101
+ function rowsOf(line, columns) {
1102
+ let rows = 1;
1103
+ let column = 0;
1104
+ for (const { segment } of graphemes.segment(line.replace(ESCAPE, ""))) if (segment === "\r") column = 0;
1105
+ else if (segment === " ") column = Math.min(columns - 1, (Math.floor(column / 8) + 1) * 8);
1106
+ else if (segment === "\b") column = Math.max(0, column - 1);
1107
+ else {
1108
+ const width = stringWidth(segment);
1109
+ if (!width) continue;
1110
+ if (column + width > columns) {
1111
+ rows += 1;
1112
+ column = 0;
1113
+ }
1114
+ column += width;
1115
+ }
1116
+ return rows;
1117
+ }
1118
+ /**
1119
+ * Before the list is up, the sandbox prepare step: the glyph of its `◆ Preparing…` line spins in
1120
+ * place (the cursor goes up to it and back) until each sandbox is ready or failed, then settles to
1121
+ * `◆`. What prints under it is kept and measured in rows as the terminal placed it, so a wide
1122
+ * character still finds the step line. Once the step line would be out of reach, or the width
1123
+ * changes (some terminals reflow what they show, some don't, so its row is unknown), it stops
1124
+ * without drawing.
1125
+ */
1126
+ var StepSpinner = class {
1127
+ #write;
1128
+ #c;
1129
+ #size;
1130
+ #timer;
1131
+ #frame = 0;
1132
+ /** The step line and everything printed under it since. */
1133
+ #text = "";
1134
+ /** The width `#text` was printed at. */
1135
+ #columns = 0;
1136
+ #pending = 0;
1137
+ constructor(write, c, size) {
1138
+ this.#write = write;
1139
+ this.#c = c;
1140
+ this.#size = size;
1141
+ }
1142
+ /** Terminal lines from the step line down to the cursor after `text`. */
1143
+ #up(text = this.#text) {
1144
+ const columns = Math.max(1, this.#columns);
1145
+ const lines = text.split("\n");
1146
+ if (lines.at(-1) === "") lines.pop();
1147
+ return lines.reduce((n, l) => n + rowsOf(l, columns), 0);
1148
+ }
1149
+ /** The step line was just written as `text`; it spins until `targets` have reported. */
1150
+ start(text, targets) {
1151
+ this.settle();
1152
+ this.#text = text;
1153
+ this.#columns = this.#size().columns;
1154
+ this.#pending = targets;
1155
+ this.#timer = setInterval(() => this.#draw(), FRAME_MS);
1156
+ this.#timer.unref();
1157
+ this.#draw();
1158
+ }
1159
+ /** Before `text` prints under it; settles first if the step line would scroll out of reach. */
1160
+ before(text) {
1161
+ if (!this.#timer) return;
1162
+ const next = this.#text + text;
1163
+ if (!this.#reachable(next)) this.settle();
1164
+ this.#text = next;
1165
+ }
1166
+ /** One sandbox reported; the last settles it. */
1167
+ reported() {
1168
+ this.#pending -= 1;
1169
+ if (this.#pending <= 0) this.settle();
1170
+ }
1171
+ #reachable(text = this.#text) {
1172
+ const { rows, columns } = this.#size();
1173
+ return columns === this.#columns && this.#up(text) < rows - 1;
1174
+ }
1175
+ #draw(glyph = SPINNER[this.#frame++ % SPINNER.length] ?? "◆") {
1176
+ if (!this.#reachable()) {
1177
+ clearInterval(this.#timer);
1178
+ this.#timer = void 0;
1179
+ return;
1180
+ }
1181
+ const up = this.#up();
1182
+ this.#write(`\x1b[${up}A\r\x1b[2C${this.#c.teal(glyph)}\r\x1b[${up}B`);
1183
+ }
1184
+ settle() {
1185
+ if (!this.#timer) return;
1186
+ this.#draw("◆");
1187
+ clearInterval(this.#timer);
1188
+ this.#timer = void 0;
1189
+ }
1190
+ };
1191
+ var InteractiveRenderer = class {
1192
+ #o;
1193
+ #c;
1194
+ #store = new ListStore();
1195
+ #list;
1196
+ /** The header and run-level lines, as every terminal prints them. */
1197
+ #plain;
1198
+ #app;
1199
+ /** Set once the list couldn't load: from then on, the run prints as a pipe's does. */
1200
+ #fallback;
1201
+ #ended;
1202
+ #closed = false;
1203
+ #detached = false;
1204
+ #pending;
1205
+ #polling;
1206
+ #spinner;
1207
+ /** What the plain renderer wrote since `#written` was reset, while the list isn't up. */
1208
+ #written = "";
1209
+ constructor(options) {
1210
+ this.#o = options;
1211
+ this.#c = options.colors;
1212
+ this.#list = new LiveList(options.harness);
1213
+ this.#spinner = new StepSpinner((text) => options.out.write(text), options.colors, () => sizeOf(options.stdout));
1214
+ const out = { write: (text) => {
1215
+ if (!this.#app || this.#fallback) {
1216
+ this.#spinner.before(redactSecrets(String(text)));
1217
+ this.#written += String(text);
1218
+ return options.out.write(text);
1219
+ }
1220
+ const lines = String(text).replace(/\n$/, "").split("\n");
1221
+ this.#store.set({ logs: [...this.#store.get().logs, ...lines] });
1222
+ return true;
1223
+ } };
1224
+ this.#plain = new PlainRenderer({
1225
+ ...options,
1226
+ out,
1227
+ timers: false,
1228
+ output: {
1229
+ ...options.output,
1230
+ statusLine: false,
1231
+ interactive: false,
1232
+ outputLogs: "none"
1233
+ }
1234
+ });
1235
+ }
1236
+ #mount() {
1237
+ if (this.#app || this.#closed) return;
1238
+ const { attached } = this.#o;
1239
+ const cancel = attached ? this.#o.cancel : this.#o.cancel ?? (() => process.kill(process.pid, "SIGINT"));
1240
+ const load = this.#o.load ?? (() => import("./ink-list-BbKXElcQ.js"));
1241
+ const asked = attached?.cancelable;
1242
+ if (asked) {
1243
+ const poll = () => {
1244
+ const cancelable = asked();
1245
+ if (cancelable !== this.#store.get().cancelable) this.#store.set({ cancelable });
1246
+ };
1247
+ poll();
1248
+ this.#polling = setInterval(poll, CANCELABLE_MS);
1249
+ this.#polling.unref();
1250
+ }
1251
+ this.#app = load().then((m) => m.mountList({
1252
+ store: this.#store,
1253
+ colors: this.#c,
1254
+ ...cancel ? { cancel } : {},
1255
+ ...attached ? { detach: () => {
1256
+ this.#detached = true;
1257
+ attached.detach();
1258
+ } } : {},
1259
+ stdout: this.#o.stdout,
1260
+ stdin: this.#o.stdin
1261
+ })).catch((error) => {
1262
+ this.#fallBack(error);
1263
+ });
1264
+ }
1265
+ #fallBack(error) {
1266
+ const out = this.#o.out;
1267
+ const { logs, phase } = this.#store.get();
1268
+ for (const line of logs) out.write(`${line}\n`);
1269
+ const reason = error instanceof Error ? error.message : String(error);
1270
+ out.write(`${this.#c.yellow(`Couldn't draw the interactive list (${reason}).`)}\n`);
1271
+ if (phase) out.write(` ${this.#c.teal("◆")} ${phase}\n`);
1272
+ this.#fallback = new PlainRenderer({
1273
+ ...this.#o,
1274
+ timers: false,
1275
+ output: {
1276
+ ...this.#o.output,
1277
+ statusLine: false,
1278
+ interactive: false
1279
+ }
1280
+ });
1281
+ if (this.#ended) this.#fallback.onEvent(this.#ended.event);
1282
+ }
1283
+ #update() {
1284
+ this.#pending ??= setImmediate(() => this.#flush());
1285
+ }
1286
+ #flush() {
1287
+ if (this.#pending) clearImmediate(this.#pending);
1288
+ this.#pending = void 0;
1289
+ const { done, total, failed, failing } = this.#list.counts();
1290
+ this.#store.set({
1291
+ files: this.#list.files(),
1292
+ counts: {
1293
+ done,
1294
+ total,
1295
+ failed,
1296
+ failing
1297
+ }
1298
+ });
1299
+ }
1300
+ onEvent(e) {
1301
+ if (this.#fallback) {
1302
+ if (e.type !== "run-start") this.#fallback.onEvent(e);
1303
+ return;
1304
+ }
1305
+ switch (e.type) {
1306
+ case "run-start":
1307
+ this.#spinner.settle();
1308
+ this.#store.set({ phase: startText(this.#o.output) });
1309
+ return;
1310
+ case "prepare":
1311
+ this.#written = "";
1312
+ this.#plain.onEvent(e);
1313
+ if (this.#app || this.#o.timers === false || process.env.REEVAL_DEBUG) return;
1314
+ if (e.state === "start") this.#spinner.start(this.#written, e.targets.length);
1315
+ else this.#spinner.reported();
1316
+ return;
1317
+ case "plan": {
1318
+ this.#list.planned(e.header.evals);
1319
+ const { record } = e.header;
1320
+ const host = this.#o.attached?.host;
1321
+ this.#plain.onEvent(record && host ? {
1322
+ ...e,
1323
+ header: {
1324
+ ...e.header,
1325
+ record: onHost(record, host)
1326
+ }
1327
+ } : e);
1328
+ return;
1329
+ }
1330
+ case "collected":
1331
+ this.#spinner.settle();
1332
+ this.#list.collected(e.file, e.evals);
1333
+ this.#mount();
1334
+ this.#update();
1335
+ return;
1336
+ case "eval-start":
1337
+ this.#list.start(e);
1338
+ this.#update();
1339
+ return;
1340
+ case "eval-progress":
1341
+ if (e.progress.kind === "warning" || e.progress.kind === "browser-download") this.#plain.onEvent(e);
1342
+ this.#list.progress(e.key, e.progress);
1343
+ this.#update();
1344
+ return;
1345
+ case "eval-end":
1346
+ this.#list.end(e.result);
1347
+ this.#update();
1348
+ return;
1349
+ case "debug": return;
1350
+ case "run-end": {
1351
+ const host = this.#o.attached?.host;
1352
+ const listOf = (verbose) => statusList({
1353
+ record: e.record,
1354
+ suite: suiteResult(e.record),
1355
+ remarks: e.remarks ?? null,
1356
+ verbose,
1357
+ ...e.notRun ? { notRun: e.notRun } : {},
1358
+ ...host ? { host } : {}
1359
+ });
1360
+ const list = listOf(false);
1361
+ const verbose = (this.#o.verbosity ?? 0) > 0;
1362
+ if (!this.#app) {
1363
+ this.#plain.onEvent(e);
1364
+ return;
1365
+ }
1366
+ this.#flush();
1367
+ this.#stopPolling();
1368
+ const pointer = pointerLine(e.summaryPath, host);
1369
+ this.#ended = {
1370
+ scrollback: verbose ? listOf(true) : list,
1371
+ verbose,
1372
+ pointer,
1373
+ event: e
1374
+ };
1375
+ this.#store.set({
1376
+ files: list.files,
1377
+ ...this.#store.get().phase ? { phase: endText(e.record.status) } : {},
1378
+ finished: {
1379
+ done: list.done,
1380
+ notes: list.notes,
1381
+ pointer,
1382
+ errors: list.errors
1383
+ }
1384
+ });
1385
+ return;
1386
+ }
1387
+ default: this.#plain.onEvent(e);
1388
+ }
1389
+ }
1390
+ #stopPolling() {
1391
+ clearInterval(this.#polling);
1392
+ this.#polling = void 0;
1393
+ }
1394
+ close() {
1395
+ this.#stopPolling();
1396
+ if (this.#pending) this.#flush();
1397
+ this.#spinner.settle();
1398
+ this.#plain.close();
1399
+ this.#fallback?.close();
1400
+ if (!this.#store.get().finished && !this.#detached) {
1401
+ this.#closed = true;
1402
+ this.#app?.then((a) => a?.unmount());
1403
+ }
1404
+ }
1405
+ /**
1406
+ * Until the user quits the list, then the whole list into the scrollback; at once when there's
1407
+ * none. Detached from a run that goes on, until the list is down, with nothing printed.
1408
+ */
1409
+ async wait() {
1410
+ const app = await this.#app;
1411
+ if (!app || !(this.#ended || this.#detached)) return;
1412
+ await app.waitUntilExit();
1413
+ if (!this.#ended) return;
1414
+ const { phase } = this.#store.get();
1415
+ const { scrollback, verbose, pointer } = this.#ended;
1416
+ const text = [...phase ? [` ${this.#c.teal("◆")} ${phase}`, ""] : [], ...listLines(scrollback, this.#c, true, pointer, verbose)];
1417
+ this.#o.out.write(`${text.join("\n")}\n`);
1418
+ }
1419
+ /** Takes a finished list down without a key, then prints it as `wait` does. */
1420
+ async dismiss() {
1421
+ if (this.#ended) this.#store.set({ quit: true });
1422
+ await this.wait();
1423
+ }
1424
+ };
1425
+ const sizeOf = (stdout) => {
1426
+ const { rows, columns } = stdout ?? {};
1427
+ return {
1428
+ rows: rows || 24,
1429
+ columns: columns || 80
1430
+ };
1431
+ };
1432
+ // src/ui/index.ts
1433
+ const depthOf = (bits = 4) => bits >= 24 ? 24 : bits >= 8 ? 8 : 4;
1434
+ function createRenderer(options) {
1435
+ const out = { write: (text) => options.out.write(redactSecrets(text)) };
1436
+ if (options.output.mode === "agent") return new AgentRenderer({
1437
+ ...options,
1438
+ out
1439
+ });
1440
+ const paint = colors(options.output.color, depthOf(options.colorDepth));
1441
+ if (options.output.interactive && options.tty) return new InteractiveRenderer({
1442
+ ...options,
1443
+ ...options.tty,
1444
+ out,
1445
+ colors: paint
1446
+ });
1447
+ return new PlainRenderer({
1448
+ ...options,
1449
+ out,
1450
+ colors: paint
1451
+ });
1452
+ }
1453
+ export { displayUrl as a, isEventsUrl as c, teeRenderer as d, STALL_MS as i, notEventStream as l, EventStreamError as n, followEvents as o, LOST_MS as r, isAttachUrl as s, createRenderer as t, openEventStream as u };
1454
+
1455
+ //# sourceMappingURL=ui-DKYjTVpn.js.map