reeval 0.13.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/README.md +5 -3
  2. package/THIRD_PARTY_NOTICES.md +190 -190
  3. package/assets/gateway-models.mjs +74 -0
  4. package/dist/{adapter-IKKo4sZj.js → adapter-CbqbMR7y.js} +55 -14
  5. package/dist/adapter-CbqbMR7y.js.map +1 -0
  6. package/dist/{agent-ClE-g9VL.js → agent-Zgn-kiqq.js} +105 -35
  7. package/dist/agent-Zgn-kiqq.js.map +1 -0
  8. package/dist/{analysis-B0nOfAzA.js → analysis-C2-aEbr7.js} +4 -4
  9. package/dist/{analysis-B0nOfAzA.js.map → analysis-C2-aEbr7.js.map} +1 -1
  10. package/dist/app-files-ChbvRx3P.js +11 -0
  11. package/dist/app-files-ChbvRx3P.js.map +1 -0
  12. package/dist/{assemble-BO93VAk1.js → assemble-SKQGW_QF.js} +213 -136
  13. package/dist/assemble-SKQGW_QF.js.map +1 -0
  14. package/dist/assemble-XBWuK3Ed.js +1 -0
  15. package/dist/{attempt-jI0OWxlz.js → attempt-Ba2QerOK.js} +10 -10
  16. package/dist/{attempt-jI0OWxlz.js.map → attempt-Ba2QerOK.js.map} +1 -1
  17. package/dist/attempt-host-BOp8JklD.js +295 -0
  18. package/dist/attempt-host-BOp8JklD.js.map +1 -0
  19. package/dist/{capture-dn2hjSLj.js → capture-BM_3100g.js} +600 -53
  20. package/dist/capture-BM_3100g.js.map +1 -0
  21. package/dist/capture-DSK8O5bA.js +1 -0
  22. package/dist/{cli-BCE1xlm4.js → cli-PdYrcoKM.js} +177 -249
  23. package/dist/cli-PdYrcoKM.js.map +1 -0
  24. package/dist/{cli-spec-BXIBUlaK.js → cli-spec-D0qyrPZi.js} +9 -21
  25. package/dist/cli-spec-D0qyrPZi.js.map +1 -0
  26. package/dist/cli.js +2 -2
  27. package/dist/{assert-EUIoRdIt.js → client-Ct6s6OnF.js} +106 -3
  28. package/dist/client-Ct6s6OnF.js.map +1 -0
  29. package/dist/{command-CANun0m0.js → command-4pJYVCT4.js} +34 -21
  30. package/dist/command-4pJYVCT4.js.map +1 -0
  31. package/dist/{validate-DWjkshl1.js → command-9xm5ImqI.js} +420 -60
  32. package/dist/command-9xm5ImqI.js.map +1 -0
  33. package/dist/{command-D_kEnYcX.js → command-BqBxLgTc.js} +33 -31
  34. package/dist/command-BqBxLgTc.js.map +1 -0
  35. package/dist/{command-Bh3yhN_b.js → command-DbSMcxZL.js} +35 -15
  36. package/dist/command-DbSMcxZL.js.map +1 -0
  37. package/dist/{commands-7tH3EsVu.js → commands-BU6YJCz9.js} +183 -71
  38. package/dist/commands-BU6YJCz9.js.map +1 -0
  39. package/dist/{commands-BKGzBMgb.js → commands-Bi2SEQtr.js} +1 -1
  40. package/dist/config-k6m7XbAz.js +3777 -0
  41. package/dist/config-k6m7XbAz.js.map +1 -0
  42. package/dist/{contrasts-B4nOhn0Z.js → contrasts-DLZF4dGF.js} +3 -2
  43. package/dist/contrasts-DLZF4dGF.js.map +1 -0
  44. package/dist/cost-C5RBTTJr.js +1 -0
  45. package/dist/cost-ChPa8-Fp.js +359 -0
  46. package/dist/cost-ChPa8-Fp.js.map +1 -0
  47. package/dist/db-CpsifVln.js +1530 -0
  48. package/dist/db-CpsifVln.js.map +1 -0
  49. package/dist/db-DkD-F-X-.js +2 -0
  50. package/dist/{debug-D24NOQH1.js → debug-BhizgAsU.js} +2 -1
  51. package/dist/{debug-D24NOQH1.js.map → debug-BhizgAsU.js.map} +1 -1
  52. package/dist/debug-DeM5pswK.js +1 -0
  53. package/dist/{dist-Dp_AJgYN.js → dist-CYrBwyHA.js} +2 -2
  54. package/dist/{dist-Dp_AJgYN.js.map → dist-CYrBwyHA.js.map} +1 -1
  55. package/dist/{docker-DuHcQidD.js → docker-51WvhN_X.js} +5 -4
  56. package/dist/docker-51WvhN_X.js.map +1 -0
  57. package/dist/{docker-CQxucRPe.js → docker-B4-rx4dA.js} +48 -14
  58. package/dist/docker-B4-rx4dA.js.map +1 -0
  59. package/dist/{docker-Dac6Zalz.js → docker-YFj4H1Cr.js} +1 -1
  60. package/dist/{doctor-De_QlOTM.js → doctor-BuQnfz4e.js} +390 -53
  61. package/dist/doctor-BuQnfz4e.js.map +1 -0
  62. package/dist/{env-BQqj93gu.js → env-CARj5Axq.js} +6 -3
  63. package/dist/env-CARj5Axq.js.map +1 -0
  64. package/dist/{environment-B4IuURK1.js → environment-BOFgzFDg.js} +117 -297
  65. package/dist/environment-BOFgzFDg.js.map +1 -0
  66. package/dist/{errors-r025B0Zb.js → errors-UjcLWelF.js} +2 -2
  67. package/dist/{errors-r025B0Zb.js.map → errors-UjcLWelF.js.map} +1 -1
  68. package/dist/eval-source-Dje3rERU.js +145 -0
  69. package/dist/eval-source-Dje3rERU.js.map +1 -0
  70. package/dist/{evaluate-Djk1YPFL.js → evaluate-BPP9s3s6.js} +406 -130
  71. package/dist/evaluate-BPP9s3s6.js.map +1 -0
  72. package/dist/evaluate-dqXccn4k.d.ts +44 -0
  73. package/dist/{files-CN1QfenC.js → files-Bi461Be2.js} +202 -91
  74. package/dist/files-Bi461Be2.js.map +1 -0
  75. package/dist/files-C2h2Cw4F.js +1 -0
  76. package/dist/files-Clipx4OW.js +37 -0
  77. package/dist/files-Clipx4OW.js.map +1 -0
  78. package/dist/files-DmUrRmmL.js +1 -0
  79. package/dist/{files-D27nUk0K.js → files-H24pz0hL.js} +20 -9
  80. package/dist/files-H24pz0hL.js.map +1 -0
  81. package/dist/gateway.d.ts +30 -0
  82. package/dist/gateway.js +39 -0
  83. package/dist/gateway.js.map +1 -0
  84. package/dist/{git-rPfl7AD1.js → git-CsVZkNNL.js} +3 -3
  85. package/dist/{git-rPfl7AD1.js.map → git-CsVZkNNL.js.map} +1 -1
  86. package/dist/harness-3NVyTSGK.js +392 -0
  87. package/dist/harness-3NVyTSGK.js.map +1 -0
  88. package/dist/harness.d.ts +33 -21
  89. package/dist/harness.js +1 -1
  90. package/dist/{images-m784ueGK.js → images-4mwhNkvh.js} +8 -8
  91. package/dist/{images-m784ueGK.js.map → images-4mwhNkvh.js.map} +1 -1
  92. package/dist/index.d.ts +34 -35
  93. package/dist/index.js +5 -6
  94. package/dist/init-BDEOopK7.js +1 -0
  95. package/dist/{init-hiTkiM4L.js → init-cOk3D44b.js} +12 -15
  96. package/dist/init-cOk3D44b.js.map +1 -0
  97. package/dist/{invocations-D_ePcwyL.js → invocations-DW-lTk2f.js} +10 -6
  98. package/dist/invocations-DW-lTk2f.js.map +1 -0
  99. package/dist/judge-CKdgEXN7.js +575 -0
  100. package/dist/judge-CKdgEXN7.js.map +1 -0
  101. package/dist/judge.d.ts +8 -9
  102. package/dist/judge.js +7 -9
  103. package/dist/judge.js.map +1 -1
  104. package/dist/{live-DYd2QEyR.js → live-XJQ6nqK4.js} +2 -2
  105. package/dist/{live-DYd2QEyR.js.map → live-XJQ6nqK4.js.map} +1 -1
  106. package/dist/{matchers-Ddmc2z7H.js → matchers-DT2TaGix.js} +2 -2
  107. package/dist/{matchers-Ddmc2z7H.js.map → matchers-DT2TaGix.js.map} +1 -1
  108. package/dist/{model-DpkclE4r.js → model-Bq3G0OG1.js} +52 -45
  109. package/dist/model-Bq3G0OG1.js.map +1 -0
  110. package/dist/{model-UgHDMhI1.js → model-CTnyvh7H.js} +345 -382
  111. package/dist/model-CTnyvh7H.js.map +1 -0
  112. package/dist/model-D-SWrLZG.js +1 -0
  113. package/dist/model-g3XnzUv0.js +1 -0
  114. package/dist/model-vRiUycWh.js +77 -0
  115. package/dist/model-vRiUycWh.js.map +1 -0
  116. package/dist/{node-CGZYh4Fj.js → node-BVbbnFtv.js} +80 -51
  117. package/dist/node-BVbbnFtv.js.map +1 -0
  118. package/dist/opencode-providers-Bz0l7OZI.js +3276 -0
  119. package/dist/opencode-providers-Bz0l7OZI.js.map +1 -0
  120. package/dist/openrouter-models-CWRwLX-G.js +34 -0
  121. package/dist/openrouter-models-CWRwLX-G.js.map +1 -0
  122. package/dist/{pairs-DP6XOJby.js → pairs-puYi-zj2.js} +17 -9
  123. package/dist/pairs-puYi-zj2.js.map +1 -0
  124. package/dist/patch-CquGAGX5.js +76 -0
  125. package/dist/patch-CquGAGX5.js.map +1 -0
  126. package/dist/{patch-uMq9rCl_.js → patch-DKJiC5Sq.js} +5 -7
  127. package/dist/patch-DKJiC5Sq.js.map +1 -0
  128. package/dist/{plan-CZYgXnZh.js → plan-DdWkM6SW.js} +118 -46
  129. package/dist/plan-DdWkM6SW.js.map +1 -0
  130. package/dist/{plugins-P-uh54VF.js → plugins-D-CP6mMd.js} +254 -18
  131. package/dist/plugins-D-CP6mMd.js.map +1 -0
  132. package/dist/{preflight-D3HvKeAx.js → preflight-9ixuXzsx.js} +3 -3
  133. package/dist/{preflight-D3HvKeAx.js.map → preflight-9ixuXzsx.js.map} +1 -1
  134. package/dist/{preflight-BQlPTHVu.js → preflight-DTiVv0gY.js} +1 -1
  135. package/dist/{prepare-Dx7dOnJB.js → prepare-BfyikQit.js} +8 -8
  136. package/dist/{prepare-Dx7dOnJB.js.map → prepare-BfyikQit.js.map} +1 -1
  137. package/dist/{prepare-DCwM2KKD.js → prepare-tmBBf4W8.js} +2 -2
  138. package/dist/prices-QaS-kjSQ.js +253 -0
  139. package/dist/prices-QaS-kjSQ.js.map +1 -0
  140. package/dist/{provenance-C_-8y-x3.js → provenance-BizwUn3h.js} +4 -4
  141. package/dist/{provenance-C_-8y-x3.js.map → provenance-BizwUn3h.js.map} +1 -1
  142. package/dist/{providers-CF5UEaP8.js → providers-B6b9Tnyi.js} +5 -5
  143. package/dist/{providers-CF5UEaP8.js.map → providers-B6b9Tnyi.js.map} +1 -1
  144. package/dist/{providers-CTBYvMxu.js → providers-DkOupEBl.js} +1 -1
  145. package/dist/query-Clm2mNSm.js +1 -0
  146. package/dist/{query-DXthKmq0.js → query-DyM-VExS.js} +3 -3
  147. package/dist/{query-DXthKmq0.js.map → query-DyM-VExS.js.map} +1 -1
  148. package/dist/questions-BRhU8MzB.js +861 -0
  149. package/dist/questions-BRhU8MzB.js.map +1 -0
  150. package/dist/{record-kk9M1hj-.js → record-DZBCjuwm.js} +6 -6
  151. package/dist/{record-kk9M1hj-.js.map → record-DZBCjuwm.js.map} +1 -1
  152. package/dist/redact-DVIaahLv.js +658 -0
  153. package/dist/redact-DVIaahLv.js.map +1 -0
  154. package/dist/remarks-BwJ8pcTQ.js +1 -0
  155. package/dist/remarks-C7i2LMRb.js +596 -0
  156. package/dist/remarks-C7i2LMRb.js.map +1 -0
  157. package/dist/{header-BVzbRnNv.js → remarks-D_3qhBWU.js} +34 -9
  158. package/dist/remarks-D_3qhBWU.js.map +1 -0
  159. package/dist/{remarks-1521zwfW.js → remarks-dA8LyoPc.js} +12 -6
  160. package/dist/remarks-dA8LyoPc.js.map +1 -0
  161. package/dist/remote-DFIzcx_6.js +273 -0
  162. package/dist/remote-DFIzcx_6.js.map +1 -0
  163. package/dist/resolve--rQZ8u6Z.js +1 -0
  164. package/dist/{resolve-DzdWcIL6.js → resolve-DWSJpKHX.js} +48 -33
  165. package/dist/resolve-DWSJpKHX.js.map +1 -0
  166. package/dist/{results-D-naai_Q.js → results-BC3pcG_Z.js} +15 -30
  167. package/dist/results-BC3pcG_Z.js.map +1 -0
  168. package/dist/{resume-8-nnW8iO.js → resume-j-rcIryi.js} +47 -17
  169. package/dist/resume-j-rcIryi.js.map +1 -0
  170. package/dist/{root-DNuLhaA5.js → root-Dlff-zp8.js} +4 -4
  171. package/dist/{root-DNuLhaA5.js.map → root-Dlff-zp8.js.map} +1 -1
  172. package/dist/{runtime-PX_oXiCS.js → runtime-d56Gg3J5.js} +42 -13
  173. package/dist/runtime-d56Gg3J5.js.map +1 -0
  174. package/dist/{sandbox-YLbk9mO7.js → sandbox-Cmln11gU.js} +2 -2
  175. package/dist/{sandbox-YLbk9mO7.js.map → sandbox-Cmln11gU.js.map} +1 -1
  176. package/dist/sandbox.d.ts +2 -1
  177. package/dist/sandbox.js +1 -1
  178. package/dist/{server-De8oH3bt.js → server-BOoH10J8.js} +69 -52
  179. package/dist/server-BOoH10J8.js.map +1 -0
  180. package/dist/server-DpuVAbrO.js +1 -0
  181. package/dist/{shared-CA61BuPJ.js → shared-B_lvGqWz.js} +20 -12
  182. package/dist/shared-B_lvGqWz.js.map +1 -0
  183. package/dist/shared-CHvO7eLi.d.ts +1 -0
  184. package/dist/source-BFd6f0-R.js +1 -0
  185. package/dist/{source-C686eZpY.js → source-wD04-rRG.js} +15 -10
  186. package/dist/source-wD04-rRG.js.map +1 -0
  187. package/dist/{src-CzQrAcF8.js → src-1lpTocbd.js} +152 -75
  188. package/dist/src-1lpTocbd.js.map +1 -0
  189. package/dist/{src-DrJSnoMR.js → src-6_zz7oJs.js} +1 -1
  190. package/dist/{src-cbCb-MPy.js → src-8yTF251P.js} +68 -22
  191. package/dist/{src-cbCb-MPy.js.map → src-8yTF251P.js.map} +1 -1
  192. package/dist/{src-Xj_BZKbq.js → src-BO8AYqJ5.js} +45 -18
  193. package/dist/src-BO8AYqJ5.js.map +1 -0
  194. package/dist/{src-DeY52Gyf.js → src-BYDOXw_Y.js} +26 -10
  195. package/dist/{src-DeY52Gyf.js.map → src-BYDOXw_Y.js.map} +1 -1
  196. package/dist/src-BYPMM1x7.js +2 -0
  197. package/dist/src-Bp4aN3rA.js +2 -0
  198. package/dist/src-C7upnZSd.js +2 -0
  199. package/dist/{src-CIpKL45U.js → src-D91Hd6hT.js} +566 -1070
  200. package/dist/src-D91Hd6hT.js.map +1 -0
  201. package/dist/src-DH-9IO7f.js +1 -0
  202. package/dist/{src-djNNYIdP.js → src-DSZyg0Uq.js} +178 -29
  203. package/dist/src-DSZyg0Uq.js.map +1 -0
  204. package/dist/{src-DIL0jST0.js → src-DgHuStEi.js} +159 -31
  205. package/dist/src-DgHuStEi.js.map +1 -0
  206. package/dist/src-HSxBazcg.js +3 -0
  207. package/dist/src-LD1BAJFa.js +2 -0
  208. package/dist/src-dlX-Lmxg.js +2 -0
  209. package/dist/{src-C7W6kg81.js → src-gn7YlnRg.js} +64 -17
  210. package/dist/{src-C7W6kg81.js.map → src-gn7YlnRg.js.map} +1 -1
  211. package/dist/src-kYeaJJrl.js +2 -0
  212. package/dist/state-B5PLm5qY.js +1 -0
  213. package/dist/{state-C0i_ujQZ.js → state-DrJ687ut.js} +18 -18
  214. package/dist/{state-C0i_ujQZ.js.map → state-DrJ687ut.js.map} +1 -1
  215. package/dist/stats-hfpuYsAM.js +315 -0
  216. package/dist/stats-hfpuYsAM.js.map +1 -0
  217. package/dist/suite-22Kt9Grx.js +2 -0
  218. package/dist/{suite-DmuF_ApO.js → suite-Co8cwelb.js} +92 -42
  219. package/dist/suite-Co8cwelb.js.map +1 -0
  220. package/dist/{summary-BFMHMTz2.js → summary-DLFHVoux.js} +131 -280
  221. package/dist/summary-DLFHVoux.js.map +1 -0
  222. package/dist/testing.d.ts +449 -2
  223. package/dist/testing.js +16 -3
  224. package/dist/testing.js.map +1 -0
  225. package/dist/{text-CrVy5ioL.js → text-DTigcA64.js} +9 -5
  226. package/dist/text-DTigcA64.js.map +1 -0
  227. package/dist/{transcript-BTxJpW4R.js → transcript-DxPaWHTZ.js} +12 -4
  228. package/dist/transcript-DxPaWHTZ.js.map +1 -0
  229. package/dist/types-C5vI3g1C.js.map +1 -1
  230. package/dist/{types-B-9b1MDV.d.ts → types-coMWHaU2.d.ts} +493 -745
  231. package/dist/{usage-CleNKkly.js → usage-BNY1ABrU.js} +3 -3
  232. package/dist/{usage-CleNKkly.js.map → usage-BNY1ABrU.js.map} +1 -1
  233. package/dist/vertex-Bv7vhMgs.js +1 -0
  234. package/dist/vertex-C7PI-WPc.d.ts +3 -0
  235. package/dist/vertex-DypYjx71.js +456 -0
  236. package/dist/vertex-DypYjx71.js.map +1 -0
  237. package/dist/view/index.d.ts +505 -43
  238. package/dist/view/index.js +10 -9
  239. package/dist/{views-Dk8MCQKr.js → views-BFO1BLKu.js} +14 -13
  240. package/dist/views-BFO1BLKu.js.map +1 -0
  241. package/dist/views-BOf8qEL8.js +2 -0
  242. package/dist/{worker-entry-CqrzGPF4.js → worker-entry-CJtdsKBP.js} +21 -14
  243. package/dist/worker-entry-CJtdsKBP.js.map +1 -0
  244. package/dist/{workspace-CLeOybkr.js → workspace-BRxjfa8N.js} +5 -5
  245. package/dist/{workspace-CLeOybkr.js.map → workspace-BRxjfa8N.js.map} +1 -1
  246. package/dist/workspace-DDHzkMjm.js +1 -0
  247. package/docker/seccomp-default.json +1 -0
  248. package/package.json +10 -2
  249. package/skills/eval-rubric/SKILL.md +43 -103
  250. package/dist/adapter-IKKo4sZj.js.map +0 -1
  251. package/dist/agent-ClE-g9VL.js.map +0 -1
  252. package/dist/assemble-BO93VAk1.js.map +0 -1
  253. package/dist/assemble-VQxyoDxK.js +0 -1
  254. package/dist/assert-EUIoRdIt.js.map +0 -1
  255. package/dist/capture-dn2hjSLj.js.map +0 -1
  256. package/dist/capture-nIJ-7kUE.js +0 -1
  257. package/dist/cli-BCE1xlm4.js.map +0 -1
  258. package/dist/cli-spec-BXIBUlaK.js.map +0 -1
  259. package/dist/client-fcwgwOAD.js +0 -106
  260. package/dist/client-fcwgwOAD.js.map +0 -1
  261. package/dist/command-Bh3yhN_b.js.map +0 -1
  262. package/dist/command-C6vwmjS7.js +0 -91
  263. package/dist/command-C6vwmjS7.js.map +0 -1
  264. package/dist/command-CANun0m0.js.map +0 -1
  265. package/dist/command-CBaHukyl.js +0 -335
  266. package/dist/command-CBaHukyl.js.map +0 -1
  267. package/dist/command-D_kEnYcX.js.map +0 -1
  268. package/dist/commands-7tH3EsVu.js.map +0 -1
  269. package/dist/config-D7TFvUpL.js +0 -759
  270. package/dist/config-D7TFvUpL.js.map +0 -1
  271. package/dist/contrasts-B4nOhn0Z.js.map +0 -1
  272. package/dist/db-DJUuFoWQ.js +0 -602
  273. package/dist/db-DJUuFoWQ.js.map +0 -1
  274. package/dist/db-W9EFlXnn.js +0 -2
  275. package/dist/debug-D7bEv_UV.js +0 -1
  276. package/dist/docker-CQxucRPe.js.map +0 -1
  277. package/dist/docker-DuHcQidD.js.map +0 -1
  278. package/dist/doctor-De_QlOTM.js.map +0 -1
  279. package/dist/egress-DEAvq8Fl.js +0 -1258
  280. package/dist/egress-DEAvq8Fl.js.map +0 -1
  281. package/dist/env-BQqj93gu.js.map +0 -1
  282. package/dist/environment-B4IuURK1.js.map +0 -1
  283. package/dist/evaluate-C9-ritA5.d.ts +0 -92
  284. package/dist/evaluate-Djk1YPFL.js.map +0 -1
  285. package/dist/facts-Cfx1H70y.js +0 -898
  286. package/dist/facts-Cfx1H70y.js.map +0 -1
  287. package/dist/files-Bs6H3HiG.js +0 -65
  288. package/dist/files-Bs6H3HiG.js.map +0 -1
  289. package/dist/files-CN1QfenC.js.map +0 -1
  290. package/dist/files-CtjEXWXm.js +0 -1
  291. package/dist/files-D27nUk0K.js.map +0 -1
  292. package/dist/files-D3gJa91B.js +0 -1
  293. package/dist/generate-BnrvBAzF.js +0 -1646
  294. package/dist/generate-BnrvBAzF.js.map +0 -1
  295. package/dist/harness-1OkumOAm.js +0 -323
  296. package/dist/harness-1OkumOAm.js.map +0 -1
  297. package/dist/header-BVzbRnNv.js.map +0 -1
  298. package/dist/init-hiTkiM4L.js.map +0 -1
  299. package/dist/init-kMkTgTZc.js +0 -1
  300. package/dist/insights-B2Xmhz9o.js +0 -64
  301. package/dist/insights-B2Xmhz9o.js.map +0 -1
  302. package/dist/invocations-D_ePcwyL.js.map +0 -1
  303. package/dist/judge-CEDIfRiU.js +0 -186
  304. package/dist/judge-CEDIfRiU.js.map +0 -1
  305. package/dist/model-B8H3gL69.js +0 -1
  306. package/dist/model-CTiuzkWw.js +0 -46
  307. package/dist/model-CTiuzkWw.js.map +0 -1
  308. package/dist/model-DcIbmggK.js +0 -1
  309. package/dist/model-DpkclE4r.js.map +0 -1
  310. package/dist/model-UgHDMhI1.js.map +0 -1
  311. package/dist/node-CGZYh4Fj.js.map +0 -1
  312. package/dist/opencode-providers-snfeWd6Z.js +0 -3305
  313. package/dist/opencode-providers-snfeWd6Z.js.map +0 -1
  314. package/dist/options-CyAyLjgJ.js +0 -1129
  315. package/dist/options-CyAyLjgJ.js.map +0 -1
  316. package/dist/pairs-DP6XOJby.js.map +0 -1
  317. package/dist/patch-uMq9rCl_.js.map +0 -1
  318. package/dist/plan-CZYgXnZh.js.map +0 -1
  319. package/dist/plugins-P-uh54VF.js.map +0 -1
  320. package/dist/query-D_1ARx5q.js +0 -1
  321. package/dist/questions-KENpWnfV.js +0 -523
  322. package/dist/questions-KENpWnfV.js.map +0 -1
  323. package/dist/redact-CRGdfV2s.js +0 -240
  324. package/dist/redact-CRGdfV2s.js.map +0 -1
  325. package/dist/remarks-1521zwfW.js.map +0 -1
  326. package/dist/remarks-BhAV1H4V.js +0 -1
  327. package/dist/remarks-Ml6bcSdV.js +0 -278
  328. package/dist/remarks-Ml6bcSdV.js.map +0 -1
  329. package/dist/remote-Dkeghk8k.js +0 -378
  330. package/dist/remote-Dkeghk8k.js.map +0 -1
  331. package/dist/resolve-CMmhACr6.js +0 -1
  332. package/dist/resolve-DzdWcIL6.js.map +0 -1
  333. package/dist/results-D-naai_Q.js.map +0 -1
  334. package/dist/resume-8-nnW8iO.js.map +0 -1
  335. package/dist/rules-CcV3zLDR.js +0 -318
  336. package/dist/rules-CcV3zLDR.js.map +0 -1
  337. package/dist/run-Bel7Vde4.js +0 -88
  338. package/dist/run-Bel7Vde4.js.map +0 -1
  339. package/dist/runtime-PX_oXiCS.js.map +0 -1
  340. package/dist/server-C-ysqkLv.js +0 -1
  341. package/dist/server-De8oH3bt.js.map +0 -1
  342. package/dist/shared-CA61BuPJ.js.map +0 -1
  343. package/dist/source-C686eZpY.js.map +0 -1
  344. package/dist/source-DjgypUHW.js +0 -1
  345. package/dist/src-3mP821Pt.js +0 -2
  346. package/dist/src-B3KCLZVk.js +0 -3
  347. package/dist/src-BAyg6CtQ.js +0 -2
  348. package/dist/src-BezgGX4X.js +0 -2
  349. package/dist/src-CIpKL45U.js.map +0 -1
  350. package/dist/src-ChBhk06Q.js +0 -2
  351. package/dist/src-CoqZYspK.js +0 -2
  352. package/dist/src-CzQrAcF8.js.map +0 -1
  353. package/dist/src-D9fSTxlc.js +0 -1
  354. package/dist/src-DIL0jST0.js.map +0 -1
  355. package/dist/src-Xj_BZKbq.js.map +0 -1
  356. package/dist/src-dhSTRN50.js +0 -2
  357. package/dist/src-djNNYIdP.js.map +0 -1
  358. package/dist/state-BGWGAwdo.js +0 -1
  359. package/dist/state-CeR6oz0k.js +0 -66
  360. package/dist/state-CeR6oz0k.js.map +0 -1
  361. package/dist/studio-app/assets/index-Bb_cid9k.js +0 -58
  362. package/dist/studio-app/assets/index-CwQN3f_h.css +0 -2
  363. package/dist/studio-app/favicon.svg +0 -1
  364. package/dist/studio-app/index.html +0 -15
  365. package/dist/suite-DmuF_ApO.js.map +0 -1
  366. package/dist/suite-mn9g4veR.js +0 -2
  367. package/dist/summary-BFMHMTz2.js.map +0 -1
  368. package/dist/text-CrVy5ioL.js.map +0 -1
  369. package/dist/transcript-BTxJpW4R.js.map +0 -1
  370. package/dist/usage-BDo2q_yu.js +0 -1
  371. package/dist/validate-DWjkshl1.js.map +0 -1
  372. package/dist/views-DE2A1jEX.js +0 -2
  373. package/dist/views-Dk8MCQKr.js.map +0 -1
  374. package/dist/worker-entry-CqrzGPF4.js.map +0 -1
  375. package/dist/workspace-B1eGO46M.js +0 -1
@@ -1,1258 +0,0 @@
1
- import { n as UsageError } from "./errors-B6BSMs03.js";
2
- import { w as plannedSecrets } from "./environment-B4IuURK1.js";
3
- import { F as HARNESS_HOSTS, I as PACKAGE_HOSTS, P as DOCKER_EGRESS, dt as shellQuote, ut as run } from "./src-CIpKL45U.js";
4
- import { D as pluginServerName, a as PLUGIN_PARTS, n as PLUGIN_DIR, r as PLUGIN_MANIFEST, t as PART_PATHS, y as localPluginServers } from "./plugins-P-uh54VF.js";
5
- import { a as providerServedModel, i as providerModelResponses, n as providerEndpoints, r as providerHosts, s as resolveOpenCodeProvider } from "./opencode-providers-snfeWd6Z.js";
6
- import { t as InfraError } from "./types-C5vI3g1C.js";
7
- import { existsSync } from "node:fs";
8
- import { tmpdir } from "node:os";
9
- import { dirname, join, win32 } from "node:path";
10
- import { isIP } from "node:net";
11
- import { randomUUID } from "node:crypto";
12
- import { spawn } from "node:child_process";
13
- import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
14
- //#region src/harness/agents.ts
15
- const WEB_EVENTS = {
16
- webSearch: "web-search",
17
- webFetch: "web-fetch"
18
- };
19
- /** `harnessMetadata.cursorSdk.unreportedTools` as transcript event types. */
20
- function cursorUnreported(harnessMetadata) {
21
- const tools = harnessMetadata?.cursorSdk?.unreportedTools;
22
- return Array.isArray(tools) ? tools.flatMap((t) => WEB_EVENTS[t] ? [WEB_EVENTS[t]] : []) : [];
23
- }
24
- /** A Gemini API key's only request: `POST /v1beta/models/<model>:streamGenerateContent`. */
25
- const GEMINI_ENDPOINTS = [{
26
- host: "generativelanguage.googleapis.com",
27
- path: { regex: "^/v1beta/models/[^/]+:streamGenerateContent$" },
28
- method: ["POST"]
29
- }];
30
- /** Goose's: the model call, and the model list it fetches with the key at the start of a turn. */
31
- const GOOSE_ENDPOINTS = [...GEMINI_ENDPOINTS, {
32
- host: "generativelanguage.googleapis.com",
33
- path: { regex: "^/v1beta/models$" },
34
- method: ["GET"]
35
- }];
36
- /**
37
- * What Grok Build sends the key on: the model list and the key's status as a session starts, and
38
- * its model calls (Chat Completions, and the Responses API for a model or tool that takes it).
39
- */
40
- const XAI_ENDPOINTS = [
41
- {
42
- host: "api.x.ai",
43
- path: { exact: "/v1/models" },
44
- method: ["GET"]
45
- },
46
- {
47
- host: "api.x.ai",
48
- path: { exact: "/v1/api-key" },
49
- method: ["GET"]
50
- },
51
- {
52
- host: "api.x.ai",
53
- path: { exact: "/v1/chat/completions" },
54
- method: ["POST"]
55
- },
56
- {
57
- host: "api.x.ai",
58
- path: { exact: "/v1/responses" },
59
- method: ["POST"]
60
- }
61
- ];
62
- /** xAI's model calls, whose responses name the model that served them. */
63
- const XAI_MODEL_RESPONSES = XAI_ENDPOINTS.filter((e) => e.path.exact === "/v1/chat/completions" || e.path.exact === "/v1/responses");
64
- /** The model an xAI response says served it. */
65
- const xaiServedModel = ({ host, responseModel }) => host === "api.x.ai" ? responseModel : void 0;
66
- /** The model a Gemini API request names in its URL. */
67
- const geminiServedModel = ({ host, path }) => host === "generativelanguage.googleapis.com" ? /^\/v1beta\/models\/([^/:]+):streamGenerateContent$/.exec(path)?.[1] : void 0;
68
- /** Cursor's key exchange: the only request the Cursor SDK sends the API key on. */
69
- const CURSOR_EXCHANGE = {
70
- host: "api2.cursor.sh",
71
- path: { exact: "/auth/exchange_user_api_key" },
72
- method: ["POST"]
73
- };
74
- /** What Codex sends the key on: the Responses API. */
75
- const OPENAI_ENDPOINTS = [{
76
- host: "api.openai.com",
77
- path: { exact: "/v1/responses" },
78
- method: ["POST"]
79
- }];
80
- /**
81
- * The model the Responses API says served a request, from its response (a dated snapshot for some
82
- * models), and the reasoning effort Codex resolved for it, e.g. `gpt-5.6-luna[effort=medium]`.
83
- */
84
- const openaiServedModel = ({ host, path, responseModel, responseEffort }) => host === "api.openai.com" && path === "/v1/responses" && responseModel ? `${responseModel}${responseEffort ? `[effort=${responseEffort}]` : ""}` : void 0;
85
- /**
86
- * OpenCode on the model's provider (`anthropic/claude-haiku-4-5` is Anthropic's): its key, the
87
- * requests OpenCode sends it on, its hosts plus Exa's for web search, and the served model from
88
- * the URL (Gemini's API, Bedrock's) or the response body. Bedrock's hosts are its `AWS_REGION`'s.
89
- */
90
- function opencodeForModel(model, env = process.env) {
91
- const resolved = resolveOpenCodeProvider(model, env);
92
- if ("error" in resolved) throw new InfraError(`opencode(): ${resolved.error}`);
93
- const { provider } = resolved;
94
- const modelResponses = providerModelResponses(provider);
95
- return {
96
- credential: provider.env,
97
- endpoints: providerEndpoints(provider),
98
- ...modelResponses.length ? { modelResponses } : {},
99
- servedModel: (request) => providerServedModel(provider, request),
100
- hosts: [...providerHosts(provider), "mcp.exa.ai"]
101
- };
102
- }
103
- /**
104
- * The variables besides its key that OpenCode's provider takes from the host, as they are:
105
- * Bedrock's `AWS_REGION` (default `us-east-1`); none for most providers.
106
- */
107
- function opencodeVars(model, env = process.env) {
108
- const resolved = resolveOpenCodeProvider(model, env);
109
- if ("error" in resolved) throw new InfraError(`opencode(): ${resolved.error}`);
110
- return resolved.vars;
111
- }
112
- /** Codex's `config.toml` `[mcp_servers]` shape. */
113
- function codexMcpServers(servers) {
114
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => {
115
- if (s.transport === "sse") throw new InfraError(`Codex has no SSE MCP transport, so it can't use the ${name} server (mcp.sse): use mcp.http or mcp.stdio`);
116
- return s.transport === "stdio" ? [name, {
117
- command: s.command,
118
- args: s.args,
119
- env: s.env ?? {}
120
- }] : [name, {
121
- url: s.url,
122
- http_headers: s.headers ?? {}
123
- }];
124
- }));
125
- }
126
- /** The `.mcp.json` shape. */
127
- function claudeMcpServers(servers) {
128
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, {
129
- type: "stdio",
130
- command: s.command,
131
- args: s.args,
132
- env: s.env
133
- }] : [name, {
134
- type: s.transport,
135
- url: s.url,
136
- headers: s.headers
137
- }]));
138
- }
139
- /** The Antigravity CLI's `mcp_config.json` shape: remote servers take `serverUrl`, not `url`. */
140
- function antigravityMcpServers(servers) {
141
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, {
142
- command: s.command,
143
- args: s.args,
144
- env: s.env
145
- }] : [name, {
146
- serverUrl: s.url,
147
- headers: s.headers
148
- }]));
149
- }
150
- /**
151
- * OpenCode's config shape (its `mcp.servers`), which the adapter sets `codemode: false` on.
152
- * OpenCode has no SSE transport.
153
- */
154
- function opencodeMcpServers(servers) {
155
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => {
156
- if (s.transport === "sse") throw new InfraError(`OpenCode has no SSE MCP transport, so it can't use the ${name} server (mcp.sse): use mcp.http or mcp.stdio`);
157
- return s.transport === "stdio" ? [name, {
158
- type: "local",
159
- command: [s.command, ...s.args],
160
- environment: s.env ?? {}
161
- }] : [name, {
162
- type: "remote",
163
- url: s.url,
164
- headers: s.headers ?? {},
165
- oauth: false
166
- }];
167
- }));
168
- }
169
- /**
170
- * The key Goose keeps an extension by (its `name_to_key`): whitespace dropped, anything but ASCII
171
- * letters, digits, `_` and `-` made `_`, lower-cased. Of two extensions with one key it keeps one.
172
- */
173
- const gooseKey = (name) => name.replace(/\s/g, "").replace(/[^A-Za-z0-9_-]/g, "_").toLowerCase();
174
- /** Goose's extension shape (its `config.yaml`); it has no SSE transport. */
175
- function gooseMcpServers(servers) {
176
- const byKey = /* @__PURE__ */ new Map();
177
- for (const name of Object.keys(servers)) {
178
- const key = gooseKey(name);
179
- const other = byKey.get(key);
180
- if (other !== void 0) throw new InfraError(`Goose keys the ${other} and ${name} MCP servers both as ${key}, and keeps only one: rename one`);
181
- byKey.set(key, name);
182
- }
183
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => {
184
- if (s.transport === "sse") throw new InfraError(`Goose has no SSE MCP transport, so it can't use the ${name} server (mcp.sse): use mcp.http or mcp.stdio`);
185
- return s.transport === "stdio" ? [name, {
186
- type: "stdio",
187
- cmd: s.command,
188
- args: s.args,
189
- envs: s.env ?? {}
190
- }] : [name, {
191
- type: "streamable_http",
192
- uri: s.url,
193
- headers: s.headers ?? {}
194
- }];
195
- }));
196
- }
197
- /**
198
- * pi's `mcp.json` shape, which the adapter escapes and sets `"exposure": "direct"` on. pi
199
- * skips a server whose name isn't letters, digits, `_` and `-`, so the plan refuses it instead.
200
- * A plugin's server, `<plugin>:<server>`, is named `<plugin>_<server>`, so its tools are
201
- * `mcp__<plugin>_<server>__<tool>`.
202
- */
203
- function piMcpServers(servers) {
204
- const named = /* @__PURE__ */ new Map();
205
- return Object.fromEntries(Object.entries(servers).map(([key, s]) => {
206
- const name = /^[a-z0-9-]+:[^:]+$/.test(key) ? key.replace(":", "_") : key;
207
- if (!/^[A-Za-z0-9_-]+$/.test(name)) throw new InfraError(`pi takes MCP server names of letters, digits, "_" and "-" only, so it can't use the ${key} server: rename it`);
208
- const other = named.get(name);
209
- if (other) throw new InfraError(`pi names the ${key} MCP server ${name}, as it does the ${other} server, and keeps only one: rename one`);
210
- named.set(name, key);
211
- if (s.transport === "sse") throw new InfraError(`pi has no SSE MCP transport, so it can't use the ${key} server (mcp.sse): use mcp.http or mcp.stdio`);
212
- return s.transport === "stdio" ? [name, {
213
- command: s.command,
214
- args: s.args,
215
- env: s.env ?? {}
216
- }] : [name, {
217
- url: s.url,
218
- headers: s.headers ?? {}
219
- }];
220
- }));
221
- }
222
- /**
223
- * ACP's `McpServer` shape, which fx and Grok Build take on `session/new`: `env` and `headers` as
224
- * name-value lists.
225
- */
226
- function acpMcpServers(servers) {
227
- const pairs = (values = {}) => Object.entries(values).map(([name, value]) => ({
228
- name,
229
- value
230
- }));
231
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, s.command.startsWith("/") ? {
232
- command: s.command,
233
- args: s.args,
234
- env: pairs(s.env)
235
- } : {
236
- command: "/usr/bin/env",
237
- args: [s.command, ...s.args],
238
- env: pairs(s.env)
239
- }] : [name, {
240
- type: s.transport,
241
- url: s.url,
242
- headers: pairs(s.headers)
243
- }]));
244
- }
245
- /**
246
- * fx on the model's provider: Vercel AI Gateway for a gateway id, OpenAI's Chat Completions API
247
- * for a bare OpenAI id. Each response's first `model` names the model that served it.
248
- */
249
- function fxForModel(model) {
250
- if (!model.includes("/")) {
251
- const endpoints = [{
252
- host: "api.openai.com",
253
- path: { exact: "/v1/chat/completions" },
254
- method: ["POST"]
255
- }];
256
- return {
257
- credential: "OPENAI_API_KEY",
258
- endpoints,
259
- modelResponses: endpoints,
260
- servedModel: ({ host, responseModel }) => host === "api.openai.com" ? responseModel : void 0,
261
- hosts: ["api.openai.com"]
262
- };
263
- }
264
- const call = {
265
- host: "ai-gateway.vercel.sh",
266
- path: { regex: "^/v\\d+/ai/language-model$" },
267
- method: ["POST"]
268
- };
269
- return {
270
- credential: "AI_GATEWAY_API_KEY",
271
- endpoints: [{
272
- host: "ai-gateway.vercel.sh",
273
- path: { regex: "^/coding-agent/v1/" },
274
- method: ["GET"]
275
- }, call],
276
- modelResponses: [call],
277
- servedModel: ({ host, responseModel }) => host === "ai-gateway.vercel.sh" ? responseModel : void 0,
278
- hosts: ["ai-gateway.vercel.sh"]
279
- };
280
- }
281
- /** The Cursor SDK's `McpServerConfig` shape. */
282
- function cursorMcpServers(servers) {
283
- return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, {
284
- type: "stdio",
285
- command: s.command,
286
- args: s.args,
287
- env: s.env
288
- }] : [name, {
289
- type: s.transport,
290
- url: s.url,
291
- headers: s.headers
292
- }]));
293
- }
294
- /** Claude Code's hook events as Cursor names them, as the Cursor SDK converts Claude Code's own. */
295
- const CURSOR_HOOK_EVENTS = {
296
- SessionStart: "sessionStart",
297
- SessionEnd: "sessionEnd",
298
- UserPromptSubmit: "beforeSubmitPrompt",
299
- PreToolUse: "preToolUse",
300
- PostToolUse: "postToolUse",
301
- SubagentStop: "subagentStop",
302
- PreCompact: "preCompact",
303
- Stop: "stop"
304
- };
305
- /** Claude Code's tool names as Cursor's hooks match them; null for one Cursor has no tool for. */
306
- const CURSOR_HOOK_TOOLS = {
307
- Bash: "Shell",
308
- Read: "Read",
309
- Write: "Write",
310
- Edit: "Write",
311
- Glob: null,
312
- Grep: "Grep",
313
- WebFetch: "WebFetch",
314
- WebSearch: "WebSearch",
315
- Task: "Task"
316
- };
317
- /**
318
- * A Claude Code hook group's tool matcher as Cursor's, on the tool events only: each name mapped,
319
- * `mcp__<server>__<tool>` as `MCP:<tool>`; null when it names only tools Cursor lacks.
320
- */
321
- function cursorHookMatcher(event, matcher) {
322
- if (event !== "PreToolUse" && event !== "PostToolUse") return void 0;
323
- if (!matcher || matcher === "*") return void 0;
324
- const out = [];
325
- for (const raw of matcher.split("|")) {
326
- const name = raw.trim();
327
- const parts = name.split("__");
328
- const tool = name.startsWith("mcp__") && parts.length >= 3 ? `MCP:${parts.slice(2).join("__")}` : CURSOR_HOOK_TOOLS[name] === void 0 ? name : CURSOR_HOOK_TOOLS[name];
329
- if (tool && !out.includes(tool)) out.push(tool);
330
- }
331
- return out.length ? out.join("|") : null;
332
- }
333
- /** Where Cursor reads what reeval unpacks from a plugin, in the workspace (settingSources `project`). */
334
- const CURSOR_PLUGIN_UNPACK = {
335
- rules: ".cursor/rules",
336
- agents: ".cursor/agents",
337
- commands: ".cursor/commands",
338
- hooks: {
339
- file: ".cursor/hooks.json",
340
- events: CURSOR_HOOK_EVENTS,
341
- matcher: cursorHookMatcher
342
- }
343
- };
344
- /**
345
- * A plugin subagent's or command's frontmatter as OpenCode 2 takes it: the description, and a
346
- * subagent's `mode`. OpenCode skips a file whose frontmatter its schema refuses, without saying,
347
- * and Claude Code's `tools: Read, Grep`, `model: sonnet` and `allowed-tools` are such keys.
348
- */
349
- function opencodeFrontmatter(part, front) {
350
- const d = front.description;
351
- const description = typeof d === "string" || typeof d === "number" || typeof d === "boolean" ? String(d) : void 0;
352
- return {
353
- ...description ? { description } : {},
354
- ...part === "agents" ? { mode: "subagent" } : {}
355
- };
356
- }
357
- /** Where OpenCode reads plugin subagents and commands, in the workspace's config directory. */
358
- const OPENCODE_PLUGIN_UNPACK = {
359
- agents: ".opencode/agents",
360
- commands: ".opencode/commands",
361
- frontmatter: opencodeFrontmatter
362
- };
363
- /**
364
- * Where pi reads plugin commands, as prompt templates (`/<name>`), in the workspace, which its
365
- * `--approve` trusts. Its frontmatter takes `description` and `argument-hint`, and ignores the
366
- * rest of Claude Code's.
367
- */
368
- const PI_PLUGIN_UNPACK = { commands: ".pi/prompts" };
369
- /**
370
- * What Claude Code's plugin format bundles, which Grok Build reads too: every part but rules,
371
- * which neither loads from a plugin.
372
- */
373
- const CLAUDE_FORMAT_PARTS = PLUGIN_PARTS.filter((p) => p !== "rules");
374
- /** The marketplace Claude Code's settings name for the session's plugins. */
375
- const CLAUDE_PLUGIN_MARKETPLACE = "reeval";
376
- /**
377
- * Claude Code's settings for the session's plugins: a `directory` marketplace at the directory
378
- * they were copied to, listing each, and each enabled as `<plugin>@reeval`. Claude Code installs
379
- * and loads them as it starts, since the bridge leaves every settings source on.
380
- */
381
- function claudePluginFiles(plugins) {
382
- const [first] = plugins;
383
- if (!first) return [];
384
- const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
385
- const marketplace = {
386
- name: CLAUDE_PLUGIN_MARKETPLACE,
387
- owner: { name: "reeval" },
388
- plugins: plugins.map((p) => ({
389
- name: p.name,
390
- source: `./${p.name}`
391
- }))
392
- };
393
- const settings = {
394
- extraKnownMarketplaces: { [CLAUDE_PLUGIN_MARKETPLACE]: { source: {
395
- source: "directory",
396
- path: first.dir.slice(0, first.dir.lastIndexOf("/"))
397
- } } },
398
- enabledPlugins: Object.fromEntries(plugins.map((p) => [`${p.name}@${CLAUDE_PLUGIN_MARKETPLACE}`, true]))
399
- };
400
- return [{
401
- path: `${PLUGIN_DIR}/.claude-plugin/marketplace.json`,
402
- content: json(marketplace)
403
- }, {
404
- path: "~/.claude/settings.json",
405
- content: json(settings),
406
- merge: true
407
- }];
408
- }
409
- const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
410
- /**
411
- * Writes the layout's plugin files into the sandbox and returns their paths. A `merge` file's keys
412
- * go into the JSON object already at its path (an object-valued key merged one level down), so
413
- * settings an environment's `files` wrote there stay.
414
- */
415
- async function writePluginFiles(sandbox, layout, plugins) {
416
- const written = [];
417
- for (const f of layout.pluginFiles?.(plugins) ?? []) {
418
- const existing = f.merge ? await sandbox.readFile(f.path) : null;
419
- let content = f.content;
420
- if (existing?.trim()) {
421
- let base;
422
- try {
423
- base = JSON.parse(existing);
424
- } catch {}
425
- if (!isObject(base)) throw new InfraError(`${f.path} isn't a JSON object, so reeval can't enable the session's plugins in it: write it as one in files, or leave it out`);
426
- const ours = JSON.parse(f.content);
427
- const merged = { ...base };
428
- for (const [k, v] of Object.entries(ours)) {
429
- const was = base[k];
430
- merged[k] = isObject(v) && isObject(was) ? {
431
- ...was,
432
- ...v
433
- } : v;
434
- }
435
- content = `${JSON.stringify(merged, null, 2)}\n`;
436
- }
437
- await sandbox.writeFile(f.path, content);
438
- written.push(f.path);
439
- }
440
- return written;
441
- }
442
- /**
443
- * The MCP servers the agent is given: all of them, less the plugins' own where it takes plugin
444
- * items namespaced, since it loads those from the plugin and would otherwise start each twice.
445
- */
446
- function agentMcp(layout, mcp, plugins) {
447
- if (layout.pluginPlacement !== "namespaced") return mcp;
448
- const own = new Set(plugins.flatMap((p) => p.servers));
449
- return Object.fromEntries(Object.entries(mcp).filter(([name]) => !own.has(name)));
450
- }
451
- /** Where each agent with an image reads rules and skills. */
452
- const LAYOUTS = {
453
- cursor: {
454
- rulesFile: "AGENTS.md",
455
- workspaceSkillDir: ".cursor/skills",
456
- harnessSkillDir: ".agents/skills",
457
- pluginPlacement: "flat",
458
- pluginUnpack: CURSOR_PLUGIN_UNPACK,
459
- pluginHookEvents: Object.keys(CURSOR_HOOK_EVENTS)
460
- },
461
- "claude-code": {
462
- rulesFile: "CLAUDE.md",
463
- workspaceSkillDir: ".claude/skills",
464
- harnessSkillDir: ".claude/skills",
465
- pluginPlacement: "namespaced",
466
- pluginFiles: claudePluginFiles
467
- },
468
- antigravity: {
469
- rulesFile: "AGENTS.md",
470
- workspaceSkillDir: ".agents/skills",
471
- harnessSkillDir: ".gemini/config/skills",
472
- pluginPlacement: "namespaced",
473
- pluginHookEvents: [
474
- "SessionStart",
475
- "PreToolUse",
476
- "PostToolUse",
477
- "Stop"
478
- ]
479
- },
480
- opencode: {
481
- rulesFile: "AGENTS.md",
482
- workspaceSkillDir: ".opencode/skills",
483
- harnessSkillDir: ".config/opencode/skills",
484
- pluginPlacement: "flat",
485
- pluginUnpack: OPENCODE_PLUGIN_UNPACK
486
- },
487
- goose: {
488
- rulesFile: "AGENTS.md",
489
- workspaceSkillDir: ".goose/skills",
490
- harnessSkillDir: ".ai-sdk-harness/.harness-bootstrap/goose/implementation/home/.config/goose/skills",
491
- pluginPlacement: "flat"
492
- },
493
- pi: {
494
- rulesFile: "AGENTS.md",
495
- workspaceSkillDir: ".pi/skills",
496
- harnessSkillDir: ".pi/agent/skills",
497
- pluginPlacement: "flat",
498
- pluginUnpack: PI_PLUGIN_UNPACK
499
- },
500
- codex: {
501
- rulesFile: "AGENTS.md",
502
- workspaceSkillDir: ".agents/skills",
503
- harnessSkillDir: ".agents/skills",
504
- pluginPlacement: "namespaced"
505
- },
506
- fx: {
507
- rulesFile: "AGENTS.md",
508
- workspaceSkillDir: ".fx/skills",
509
- harnessSkillDir: ".ai-sdk-harness/.harness-bootstrap/fx/implementation/home/.fx/skills",
510
- pluginPlacement: "flat"
511
- },
512
- "grok-build": {
513
- rulesFile: "AGENTS.md",
514
- workspaceSkillDir: ".grok/skills",
515
- harnessSkillDir: ".ai-sdk-harness/.harness-bootstrap/grok-build/implementation/home/.grok/skills",
516
- pluginPlacement: "namespaced"
517
- }
518
- };
519
- /** Every real agent reeval can drive, by harness kind. */
520
- const AGENTS = {
521
- cursor: {
522
- ...LAYOUTS.cursor,
523
- pluginParts: PLUGIN_PARTS,
524
- name: "Cursor",
525
- factory: "cursor",
526
- credential: "CURSOR_API_KEY",
527
- endpoints: [CURSOR_EXCHANGE],
528
- tokens: {
529
- endpoint: CURSOR_EXCHANGE,
530
- fields: ["accessToken", "refreshToken"],
531
- hosts: ["cursor.sh", "*.cursor.sh"]
532
- },
533
- unreported: cursorUnreported,
534
- mcpServers: cursorMcpServers,
535
- adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-DrJSnoMR.js")).createCursorSdk({
536
- auth,
537
- ...mcpServers ? { mcpServers } : {},
538
- ...descriptor.kind === "cursor" && descriptor.params ? { modelParams: descriptor.params } : {},
539
- ...descriptor.kind === "cursor" && descriptor.effort ? { effort: descriptor.effort } : {},
540
- requireCredentialBrokering: true
541
- })
542
- },
543
- "claude-code": {
544
- ...LAYOUTS["claude-code"],
545
- pluginParts: CLAUDE_FORMAT_PARTS,
546
- name: "Claude Code",
547
- factory: "claudeCode",
548
- credential: "ANTHROPIC_API_KEY",
549
- endpoints: [
550
- {
551
- host: "api.anthropic.com",
552
- path: { exact: "/v1/messages" },
553
- method: ["POST"]
554
- },
555
- {
556
- host: "api.anthropic.com",
557
- path: { exact: "/v1/messages/count_tokens" },
558
- method: ["POST"]
559
- },
560
- {
561
- host: "api.anthropic.com",
562
- path: { exact: "/api/claude_code/settings" },
563
- method: ["GET"]
564
- },
565
- {
566
- host: "api.anthropic.com",
567
- path: { exact: "/api/claude_code/policy_limits" },
568
- method: ["GET"]
569
- }
570
- ],
571
- mcpServers: claudeMcpServers,
572
- adapter: async ({ auth, mcpServers, descriptor }) => (await import("./dist-Dp_AJgYN.js")).createClaudeCode({
573
- auth,
574
- ...mcpServers ? { mcpServers } : {},
575
- ...descriptor.kind === "claude-code" && descriptor.effort ? { effort: descriptor.effort } : {},
576
- env: {
577
- IS_SANDBOX: "1",
578
- CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"
579
- }
580
- })
581
- },
582
- antigravity: {
583
- ...LAYOUTS.antigravity,
584
- pluginParts: PLUGIN_PARTS,
585
- pluginManifestsFirst: [
586
- "plugin.json",
587
- ".antigravity-plugin/plugin.json",
588
- ".gemini-plugin/plugin.json",
589
- "gemini-extension.json"
590
- ],
591
- name: "Antigravity",
592
- factory: "antigravity",
593
- credential: "GEMINI_API_KEY",
594
- endpoints: GEMINI_ENDPOINTS,
595
- expectedBlocked: {
596
- hosts: ["play.googleapis.com", "antigravity-unleash.goog"],
597
- why: "Antigravity's telemetry and feature flags, which its CLI sends even with telemetry off"
598
- },
599
- servedModel: geminiServedModel,
600
- mcpServers: antigravityMcpServers,
601
- adapter: async ({ auth, mcpServers, descriptor, plugins }) => (await import("./src-BAyg6CtQ.js")).createAntigravity({
602
- auth,
603
- ...mcpServers ? { mcpServers } : {},
604
- ...plugins.length ? { plugins: plugins.map(({ name, dir }) => ({
605
- name,
606
- dir
607
- })) } : {},
608
- ...descriptor.kind === "antigravity" && descriptor.effort ? { effort: descriptor.effort } : {},
609
- requireCredentialBrokering: true
610
- })
611
- },
612
- opencode: {
613
- ...LAYOUTS.opencode,
614
- pluginParts: [
615
- "skills",
616
- "agents",
617
- "commands",
618
- "mcp"
619
- ],
620
- name: "OpenCode",
621
- factory: "opencode",
622
- credential: "GOOGLE_GENERATIVE_AI_API_KEY",
623
- endpoints: GEMINI_ENDPOINTS,
624
- servedModel: geminiServedModel,
625
- forModel: opencodeForModel,
626
- mcpServers: opencodeMcpServers,
627
- adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-B3KCLZVk.js")).createOpenCode({
628
- auth,
629
- model: descriptor.model,
630
- vars: opencodeVars(descriptor.model),
631
- ...descriptor.kind === "opencode" && descriptor.effort ? { effort: descriptor.effort } : {},
632
- ...mcpServers ? { mcpServers } : {},
633
- requireCredentialBrokering: true
634
- })
635
- },
636
- goose: {
637
- ...LAYOUTS.goose,
638
- pluginParts: ["skills", "mcp"],
639
- name: "Goose",
640
- factory: "goose",
641
- credential: "GOOGLE_GENERATIVE_AI_API_KEY",
642
- endpoints: GOOSE_ENDPOINTS,
643
- expectedBlocked: {
644
- hosts: ["models.dev"],
645
- why: "Goose's model catalogue refresh, which no setting turns off"
646
- },
647
- servedModel: geminiServedModel,
648
- mcpServers: gooseMcpServers,
649
- adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-dhSTRN50.js")).createGoose({
650
- auth: { GOOGLE_API_KEY: auth.GOOGLE_GENERATIVE_AI_API_KEY ?? "" },
651
- model: descriptor.model,
652
- ...descriptor.kind === "goose" && descriptor.effort ? { effort: descriptor.effort } : {},
653
- ...mcpServers ? { mcpServers } : {},
654
- requireCredentialBrokering: true
655
- })
656
- },
657
- pi: {
658
- ...LAYOUTS.pi,
659
- pluginParts: [
660
- "skills",
661
- "commands",
662
- "mcp"
663
- ],
664
- name: "pi",
665
- factory: "pi",
666
- credential: "GOOGLE_GENERATIVE_AI_API_KEY",
667
- endpoints: GEMINI_ENDPOINTS,
668
- servedModel: geminiServedModel,
669
- mcpServers: piMcpServers,
670
- adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-BezgGX4X.js")).createPi({
671
- auth: { GEMINI_API_KEY: auth.GOOGLE_GENERATIVE_AI_API_KEY ?? "" },
672
- ...descriptor.kind === "pi" && descriptor.effort ? { effort: descriptor.effort } : {},
673
- ...mcpServers ? { mcpServers } : {},
674
- requireCredentialBrokering: true
675
- })
676
- },
677
- codex: {
678
- ...LAYOUTS.codex,
679
- pluginParts: ["skills", "mcp"],
680
- pluginApps: "they need a ChatGPT login",
681
- pluginManifestsFirst: ["plugin.json", ".codex-plugin/plugin.json"],
682
- pluginRootManifestNeedsSchema: true,
683
- pluginServersByName: true,
684
- name: "Codex",
685
- factory: "codex",
686
- credential: "OPENAI_API_KEY",
687
- endpoints: OPENAI_ENDPOINTS,
688
- modelResponses: OPENAI_ENDPOINTS,
689
- expectedBlocked: {
690
- hosts: [
691
- "github.com",
692
- "api.github.com",
693
- "chatgpt.com"
694
- ],
695
- why: "Codex's plugin sync, which it runs on every turn once plugins are on",
696
- withPlugins: true
697
- },
698
- servedModel: openaiServedModel,
699
- mcpServers: codexMcpServers,
700
- adapter: async ({ auth, mcpServers, descriptor, plugins }) => (await import("./src-ChBhk06Q.js")).createCodex({
701
- auth,
702
- ...descriptor.kind === "codex" && descriptor.effort ? { effort: descriptor.effort } : {},
703
- ...mcpServers ? { mcpServers } : {},
704
- ...plugins.length ? { plugins: plugins.map(({ name, dir }) => ({
705
- name,
706
- dir
707
- })) } : {},
708
- requireCredentialBrokering: true
709
- })
710
- },
711
- fx: {
712
- ...LAYOUTS.fx,
713
- pluginParts: ["skills", "mcp"],
714
- name: "fx",
715
- factory: "fx",
716
- ...fxForModel("provider/model"),
717
- forModel: fxForModel,
718
- mcpServers: acpMcpServers,
719
- adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-CoqZYspK.js")).createFx({
720
- auth,
721
- model: descriptor.model,
722
- ...mcpServers ? { mcpServers } : {},
723
- requireCredentialBrokering: true
724
- })
725
- },
726
- "grok-build": {
727
- ...LAYOUTS["grok-build"],
728
- pluginParts: CLAUDE_FORMAT_PARTS,
729
- pluginServersByName: true,
730
- name: "Grok Build",
731
- factory: "grokBuild",
732
- credential: "XAI_API_KEY",
733
- endpoints: XAI_ENDPOINTS,
734
- modelResponses: XAI_MODEL_RESPONSES,
735
- servedModel: xaiServedModel,
736
- mcpServers: acpMcpServers,
737
- adapter: async ({ auth, mcpServers, descriptor, plugins }) => (await import("./src-3mP821Pt.js")).createGrokBuild({
738
- auth,
739
- model: descriptor.model,
740
- ...plugins.length ? {
741
- pluginDirs: plugins.map((p) => p.dir),
742
- pluginMcpServers: plugins.flatMap((p) => p.servers.map((s) => s.slice(p.name.length + 1)))
743
- } : {},
744
- ...descriptor.kind === "grok-build" && descriptor.effort ? { effort: descriptor.effort } : {},
745
- ...mcpServers ? { mcpServers } : {},
746
- requireCredentialBrokering: true
747
- })
748
- }
749
- };
750
- /** The harness of a config that names none: Cursor, on Cursor's own model. */
751
- const DEFAULT_HARNESS = {
752
- kind: "cursor",
753
- model: "composer-2.5"
754
- };
755
- /** A harness to name in messages that ask for one. */
756
- const HARNESS_EXAMPLE = "cursor({ model: 'composer-2.5' })";
757
- const isAgentKind = (kind) => typeof kind === "string" && Object.hasOwn(AGENTS, kind);
758
- /**
759
- * Why a harness's agent can't take the environment's MCP servers (Goose, OpenCode, pi and Codex
760
- * take no `mcp.sse`), in the agent's own words, so the plan refuses them before any attempt
761
- * starts; undefined when it can.
762
- */
763
- function refusedMcp(harness, layers) {
764
- if (!isAgentKind(harness.kind)) return void 0;
765
- const servers = /* @__PURE__ */ new Map();
766
- for (const { spec } of layers) for (const [name, server] of Object.entries(spec.mcp ?? {})) servers.set(name, server.transport === "stdio" ? {
767
- ...server,
768
- env: {}
769
- } : {
770
- ...server,
771
- headers: {}
772
- });
773
- if (servers.size === 0) return void 0;
774
- try {
775
- AGENTS[harness.kind].mcpServers(Object.fromEntries(servers));
776
- return;
777
- } catch (error) {
778
- if (error instanceof InfraError) return error.message;
779
- throw error;
780
- }
781
- }
782
- /** The first host variable a plugin MCP server reads (`${VAR}`), as `VAR`; undefined for none. */
783
- function hostVariable(s) {
784
- const values = Object.entries(s.transport === "stdio" ? s.env : s.headers);
785
- for (const [key, v] of values) {
786
- if (typeof v === "string") continue;
787
- if (v.kind === "secret") return v.from ?? key;
788
- return /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/.exec(v.template)?.[1] ?? key;
789
- }
790
- }
791
- const quoted = (parts) => parts.map((p) => `'${p}'`).join(", ");
792
- /**
793
- * Why a harness's agent can't take the plugins, in the agent's own words: a part it doesn't
794
- * load, apps it can't take (`pluginApps`), a hook event or type it doesn't run, a plugin MCP
795
- * server it refuses (named `<plugin>:<server>`) or whose `<plugin>:<server>` key `mcp` already has,
796
- * or, where it takes plugin items flat, a skill or MCP server whose name another already has, or a
797
- * subagent, command or rule another unpacks to the same file. `own` names the
798
- * environment's own skills and MCP servers, and `unread` the plugins not fetched yet (git and
799
- * npm ones, at plan time) by their call. Undefined when it can take them.
800
- */
801
- function refusedPlugins(harness, plugins, own, unread = []) {
802
- if (plugins.length === 0 && unread.length === 0) return void 0;
803
- const agent = isAgentKind(harness.kind) ? AGENTS[harness.kind] : void 0;
804
- const mimics = harness.kind === "fake" && harness.layout ? AGENTS[harness.layout] : void 0;
805
- const loads = (agent ?? mimics)?.pluginParts ?? PLUGIN_PARTS;
806
- const name = agent?.name ?? (mimics ? `The fake agent with ${mimics.name}'s layout` : "The fake agent");
807
- if (loads.length === 0) return `${name} can't load plugins yet: leave ${plugins[0] ? `the ${plugins[0].name} plugin` : unread[0]} out of this cell`;
808
- for (const p of plugins) {
809
- const refused = p.kept.filter((part) => !loads.includes(part));
810
- if (refused.length === 0) continue;
811
- const can = p.kept.filter((part) => loads.includes(part));
812
- const what = refused.map((part) => `${part} (${PART_PATHS[part]})`).join(" and ");
813
- const fix = can.length ? `use only: [${quoted(can)}], or leave` : "leave";
814
- return `${name} can't load the ${p.name} plugin's ${what}: ${fix} the plugin out of this cell`;
815
- }
816
- const reads = agent ?? mimics;
817
- const first = reads?.pluginManifestsFirst ?? [];
818
- for (const p of plugins) {
819
- const other = p.manifests.find((m) => first.includes(m) && (m !== "plugin.json" || !reads?.pluginRootManifestNeedsSchema || p.rootSchema));
820
- if (other) return `${name} reads the ${p.name} plugin's ${other} in place of its ${PLUGIN_MANIFEST}, so reeval can't hold it to the parts it places: remove ${other} from the plugin, or leave the plugin out of this cell`;
821
- }
822
- const apps = (agent ?? mimics)?.pluginApps;
823
- const withApps = apps ? plugins.find((p) => p.apps) : void 0;
824
- if (withApps) return `${name} can't load the ${withApps.name} plugin's apps: ${apps}`;
825
- const layout = layoutOf(harness);
826
- const runs = layout.pluginHookEvents;
827
- for (const p of runs ? plugins : []) {
828
- const event = p.hooks.events.find((e) => !runs?.includes(e));
829
- const type = p.hooks.otherTypes[0];
830
- if (!event && !type) continue;
831
- const rest = p.kept.filter((part) => part !== "hooks");
832
- const fix = rest.length ? `use only: [${quoted(rest)}], or leave` : "leave";
833
- return event ? `${name} can't run the ${p.name} plugin's ${event} hooks (hooks/hooks.json): it runs ${runs?.join(", ")} hooks; ${fix} the plugin out of this cell` : `${name} can't run the ${p.name} plugin's ${type} hooks (hooks/hooks.json): it runs only command hooks; ${fix} the plugin out of this cell`;
834
- }
835
- const servers = Object.fromEntries(plugins.flatMap((p) => Object.entries(p.mcp).map(([server, s]) => [pluginServerName(p.name, server), s.transport === "stdio" ? {
836
- ...s,
837
- env: {}
838
- } : {
839
- ...s,
840
- headers: {}
841
- }])));
842
- if (agent && Object.keys(servers).length) {
843
- const alongside = agent.pluginPlacement === "flat" ? Object.fromEntries(own.mcp.map((n) => [n, {
844
- transport: "stdio",
845
- command: "true",
846
- args: [],
847
- env: {}
848
- }])) : {};
849
- try {
850
- agent.mcpServers({
851
- ...alongside,
852
- ...servers
853
- });
854
- } catch (error) {
855
- if (error instanceof InfraError) return error.message;
856
- throw error;
857
- }
858
- }
859
- for (const p of plugins) for (const server of Object.keys(p.mcp)) {
860
- const key = pluginServerName(p.name, server);
861
- if (own.mcp.includes(key)) return `the ${p.name} plugin's MCP server "${server}" would join mcp as ${key}, which mcp already names: rename mcp["${key}"]`;
862
- }
863
- if (layout.pluginPlacement === "namespaced") {
864
- for (const p of plugins) {
865
- if (!p.kept.includes("mcp")) continue;
866
- for (const [server, s] of Object.entries(p.mcp)) {
867
- const secret = hostVariable(s);
868
- if (!secret) continue;
869
- const rest = p.kept.filter((part) => part !== "mcp");
870
- return `${name} loads the ${p.name} plugin's MCP server "${server}" itself, so reeval can't give it ${secret} from the host: use only: [${quoted(rest)}] and declare the server in mcp, where reeval fills it in`;
871
- }
872
- }
873
- if (!(agent ?? mimics)?.pluginServersByName) return void 0;
874
- const byName = new Map(own.mcp.map((n) => [n, `mcp.${n}`]));
875
- for (const p of plugins) for (const server of Object.keys(p.mcp)) {
876
- const other = byName.get(server);
877
- if (other) return `${name} names the ${p.name} plugin's MCP server "${server}" by its own name, as it does ${other}, and keeps only one: rename one, or leave mcp out of the plugin with only`;
878
- byName.set(server, `the ${p.name} plugin's MCP server "${server}"`);
879
- }
880
- return;
881
- }
882
- const serverOwner = new Map(own.mcp.map((n) => [n, `mcp.${n}`]));
883
- for (const p of plugins) for (const server of Object.keys(p.mcp)) {
884
- const other = serverOwner.get(server);
885
- if (other) return `the ${p.name} plugin's MCP server "${server}" clashes with ${other}`;
886
- serverOwner.set(server, `the ${p.name} plugin's MCP server "${server}"`);
887
- }
888
- const skillOwner = new Map(own.skills.map((s) => [s.name, `${s.call}'s "${s.name}"`]));
889
- for (const p of plugins) for (const { name: skill } of p.skills) {
890
- const other = skillOwner.get(skill);
891
- if (other) return `the ${p.name} plugin's skill "${skill}" and ${other} would both be placed at ~/${layout.harnessSkillDir}/${skill}: rename one, or narrow it with only or exclude`;
892
- skillOwner.set(skill, `the ${p.name} plugin's skill "${skill}"`);
893
- }
894
- for (const part of ["agents", "commands"]) {
895
- const dir = layout.pluginUnpack?.[part];
896
- if (!dir) continue;
897
- const owner = /* @__PURE__ */ new Map();
898
- for (const p of plugins) for (const item of p[part]) {
899
- const other = owner.get(item);
900
- const what = part === "agents" ? "subagent" : "command";
901
- if (other) return `the ${p.name} plugin's ${what} "${item}" and the ${other} plugin's would both be placed at ${dir}/${item}.md: rename one, or narrow one with only`;
902
- owner.set(item, p.name);
903
- }
904
- }
905
- const rules = layout.pluginUnpack?.rules;
906
- const ruleOwner = /* @__PURE__ */ new Map();
907
- for (const p of rules ? plugins : []) for (const rule of p.rules) {
908
- const file = `${p.name}-${rule.replace(/\.mdc?$/, "")}.mdc`;
909
- const what = `the ${p.name} plugin's rule "${rule}"`;
910
- const other = ruleOwner.get(file);
911
- if (other) return `${what} and ${other} would both be placed at ${rules}/${file}: rename one, or narrow one with only`;
912
- ruleOwner.set(file, what);
913
- }
914
- }
915
- /** A real agent's catalog entry, with what its model's provider decides. */
916
- function agentFor(h) {
917
- const agent = AGENTS[h.kind];
918
- return agent.forModel ? {
919
- ...agent,
920
- ...agent.forModel(h.model)
921
- } : agent;
922
- }
923
- /** The catalog entry for a harness's agent; undefined for the fake harness. */
924
- const agentOf = (h) => h.kind === "fake" ? void 0 : agentFor(h);
925
- /** The host variable a harness authenticates with; undefined for the fake harness. */
926
- const credentialOf = (h) => agentOf(h)?.credential;
927
- /** The fake agent's own layout. */
928
- const FAKE_LAYOUT = {
929
- rulesFile: "AGENTS.md",
930
- workspaceSkillDir: ".agents/skills",
931
- harnessSkillDir: ".agents/skills",
932
- pluginPlacement: "flat"
933
- };
934
- /** Where a harness's agent reads rules and skills; a fake one with `layout` mimics that agent. */
935
- function layoutOf(descriptor) {
936
- if (descriptor.kind !== "fake") return LAYOUTS[descriptor.kind];
937
- return descriptor.layout ? LAYOUTS[descriptor.layout] : FAKE_LAYOUT;
938
- }
939
- /**
940
- * The hosts a harness's agent is known to try in a session with or without plugins; a fake agent
941
- * with `layout` expects that agent's.
942
- */
943
- function expectedBlockedFor(descriptor, plugins) {
944
- const kind = descriptor.kind === "fake" ? descriptor.layout : descriptor.kind;
945
- const expected = kind ? AGENTS[kind].expectedBlocked : void 0;
946
- return expected?.withPlugins && !plugins ? void 0 : expected;
947
- }
948
- /**
949
- * How the APIs behind the harnesses say they refused a key: an HTTP 401, Anthropic's and OpenAI's
950
- * wording, Google's (which answers 400), and OpenCode's for any provider's 401 or 403. A bare 403 isn't here: the gateway and MCP servers send
951
- * those for reasons that have nothing to do with the harness's key. Grok Build checks its key as
952
- * it starts and, when xAI refuses it (a 400 or 401, not an outage), offers no `xai.api_key`
953
- * sign-in, which is all `@ai-sdk/harness-acp` reports.
954
- */
955
- const REFUSED_KEY = /\bHTTP 401\b|\b401\b.{0,40}\bunauthori[sz]ed\b|\bunauthori[sz]ed\b.{0,40}\b401\b|\b(?:invalid|incorrect) (?:x-)?api[ _-]?key\b|\bapi key not valid\b|\bAPI_KEY_INVALID\b|\bauthentication_error\b|\bprovider authentication required\b|\bauthentication method "xai\.api_key" is not advertised\b/i;
956
- /** What to do when a harness error says its API refused the key, naming the variable; else undefined. */
957
- function authHint(agent, message) {
958
- if (!REFUSED_KEY.test(message)) return void 0;
959
- return `The API rejected ${agent.credential}: set a valid key in the environment or .env.local`;
960
- }
961
- /** The agent's credential from the host, as the adapter's explicit `auth`. Fails closed. */
962
- function agentAuth(agent, env = process.env) {
963
- const value = env[agent.credential];
964
- if (!value) throw new InfraError(`${agent.credential} isn't set, so the ${agent.name} harness can't authenticate. Set it in the environment or .env.local.`);
965
- return { [agent.credential]: value };
966
- }
967
- function brokeringFor(h) {
968
- const agent = agentOf(h);
969
- if (!agent) return void 0;
970
- const { credential, endpoints, tokens, servedModel, modelResponses } = agent;
971
- return {
972
- credential,
973
- endpoints,
974
- ...tokens ? { tokens: {
975
- name: credential,
976
- ...tokens
977
- } } : {},
978
- ...servedModel ? { servedModel } : {},
979
- ...modelResponses ? { modelResponses } : {}
980
- };
981
- }
982
- //#endregion
983
- //#region src/sandbox/fake.ts
984
- /** Commands run on the host's own network, so the fake sandbox can neither restrict nor see it. */
985
- const FAKE_EGRESS = {
986
- enforce: "none",
987
- record: false
988
- };
989
- /**
990
- * The POSIX shell commands run in: `sh`, which Windows lacks, so there the `sh.exe` on PATH or
991
- * Git for Windows'.
992
- */
993
- function posixShell(platform = process.platform, env = process.env, exists = existsSync) {
994
- if (platform !== "win32") return "sh";
995
- const onPath = (env.PATH ?? env.Path ?? "").split(win32.delimiter).filter(Boolean);
996
- const git = [
997
- env.ProgramFiles,
998
- env["ProgramFiles(x86)"],
999
- env.LOCALAPPDATA && win32.join(env.LOCALAPPDATA, "Programs")
1000
- ].filter((dir) => !!dir).map((dir) => win32.join(dir, "Git", "bin"));
1001
- const found = [...onPath, ...git].map((dir) => win32.join(dir, "sh.exe")).find(exists);
1002
- if (found) return found;
1003
- throw new UsageError("The fake sandbox runs commands with a POSIX sh, and there's none on this machine. Install Git for Windows (https://git-scm.com/download/win), which brings sh.exe, or run the evals in docker().");
1004
- }
1005
- const EXEC_TAG = "REEVAL_FAKE_EXEC";
1006
- const KILL_TAGGED = `for pass in 1 2 3 4 5; do
1007
- found=
1008
- for f in $(grep -lzx "${EXEC_TAG}=$1" /proc/[0-9]*/environ 2>/dev/null); do
1009
- p=\${f#/proc/}; kill -9 "\${p%/environ}" 2>/dev/null; found=1
1010
- done
1011
- [ -n "$found" ] || break
1012
- done`;
1013
- /**
1014
- * Stops a command's MSYS processes on Windows. `taskkill /t` doesn't reach them: Git's `sh.exe`
1015
- * starts bash, whose fork and exec leave each new process's Windows parent gone, so a timed-out
1016
- * `sleep 30` would run on, holding the command's pipes and working directory.
1017
- */
1018
- function killTagged(sh, tag) {
1019
- runSh(sh, KILL_TAGGED, tag);
1020
- }
1021
- /**
1022
- * Kills host processes whose cwd is the sandbox, including native `node.exe` `c.serve` starts.
1023
- * Match only the unique `reeval-sandbox-*` folder name: Git Bash `pwd` and node.exe's
1024
- * `/proc/cwd` disagree (`/tmp/...` vs `D:\\Users\\...\\Temp\\...`), and an empty
1025
- * `"$prefix"/*` is `/*`, which SIGKILLs the Windows runner (exit 2304).
1026
- */
1027
- const KILL_UNDER = `cd "$1" || exit 0
1028
- base=$(pwd -P 2>/dev/null || pwd)
1029
- name=\${base##*/}
1030
- case "$name" in
1031
- reeval-sandbox-?*) ;;
1032
- *) exit 0 ;;
1033
- esac
1034
- for f in /proc/[0-9]*/cwd; do
1035
- t=$(readlink "$f" 2>/dev/null) || continue
1036
- case "$t" in
1037
- *"$name"*) ;;
1038
- *) continue ;;
1039
- esac
1040
- p=\${f#/proc/}; p=\${p%/cwd}
1041
- [ -n "$p" ] || continue
1042
- kill -9 "$p" 2>/dev/null
1043
- wp=$(tr -d '\\r\\n' < /proc/$p/winpid 2>/dev/null)
1044
- [ -n "$wp" ] && taskkill /F /PID "$wp" >/dev/null 2>&1
1045
- done`;
1046
- function runSh(sh, script, arg) {
1047
- return new Promise((resolve) => {
1048
- const child = spawn(sh, [
1049
- "-c",
1050
- script,
1051
- "sh",
1052
- arg
1053
- ], {
1054
- stdio: "ignore",
1055
- windowsHide: true
1056
- });
1057
- const done = () => resolve();
1058
- child.on("error", done);
1059
- child.on("close", done);
1060
- });
1061
- }
1062
- /** Windows refuses to delete a directory a live process still has as cwd; retry after kills. */
1063
- async function removeTree(path) {
1064
- const deadline = Date.now() + 8e3;
1065
- for (;;) {
1066
- try {
1067
- await rm(path, {
1068
- recursive: true,
1069
- force: true
1070
- });
1071
- if (!existsSync(path)) return;
1072
- } catch {}
1073
- if (Date.now() >= deadline) {
1074
- await rm(path, {
1075
- recursive: true,
1076
- force: true
1077
- }).catch(() => {});
1078
- return;
1079
- }
1080
- await new Promise((r) => setTimeout(r, 50));
1081
- }
1082
- }
1083
- /**
1084
- * A temp directory on the host. Commands run unisolated on the host shell, so this is
1085
- * only meant for tests and for the fake harness.
1086
- */
1087
- async function createFakeSandbox(descriptor, env = {}) {
1088
- const sh = posixShell();
1089
- const parent = descriptor.dir ?? tmpdir();
1090
- await mkdir(parent, { recursive: true });
1091
- const base = await mkdtemp(join(parent, "reeval-sandbox-"));
1092
- const workdir = join(base, "work");
1093
- await mkdir(workdir);
1094
- const stateDir = `${base}.state`;
1095
- await mkdir(stateDir);
1096
- let destroyed;
1097
- const resolve = (path) => path.startsWith("~/") ? join(base, path.slice(2)) : join(workdir, path);
1098
- return {
1099
- workdir,
1100
- stateDir,
1101
- execOwn: (command, { signal } = {}) => run(sh, ["-c", command], {
1102
- cwd: workdir,
1103
- env: {
1104
- HOME: base,
1105
- ...env
1106
- },
1107
- signal
1108
- }),
1109
- exec: (command, { cwd, env: extra, signal } = {}) => {
1110
- const tag = process.platform === "win32" && signal ? randomUUID() : void 0;
1111
- const stop = () => killTagged(sh, tag);
1112
- if (tag) signal?.addEventListener("abort", stop, { once: true });
1113
- return run(sh, ["-c", cwd ? `cd ${shellQuote(cwd)} && ${command}` : command], {
1114
- cwd: workdir,
1115
- env: {
1116
- HOME: base,
1117
- ...env,
1118
- ...extra,
1119
- ...tag ? { [EXEC_TAG]: tag } : {}
1120
- },
1121
- signal
1122
- }).finally(() => signal?.removeEventListener("abort", stop));
1123
- },
1124
- home: base,
1125
- readFile: (path) => readFile(resolve(path), "utf8").catch(() => null),
1126
- getPortEndpoint: async ({ port, protocol = "http" }) => ({ url: `${protocol === "ws" ? "ws" : "http"}://127.0.0.1:${port}` }),
1127
- async writeFile(path, content) {
1128
- const target = resolve(path);
1129
- await mkdir(dirname(target), { recursive: true });
1130
- await writeFile(target, content);
1131
- },
1132
- destroy: () => {
1133
- destroyed ??= (async () => {
1134
- await rm(stateDir, {
1135
- recursive: true,
1136
- force: true
1137
- }).catch(() => {});
1138
- if (process.platform === "win32") {
1139
- if (existsSync(base)) await runSh(sh, KILL_UNDER, base);
1140
- await removeTree(base);
1141
- return;
1142
- }
1143
- await rm(base, {
1144
- recursive: true,
1145
- force: true
1146
- }).catch(() => {});
1147
- })().finally(() => {
1148
- destroyed = void 0;
1149
- });
1150
- return destroyed;
1151
- }
1152
- };
1153
- }
1154
- //#endregion
1155
- //#region src/egress.ts
1156
- /**
1157
- * The package registries and GitHub, to spread into an allowlist that still installs:
1158
- * `egress: { allow: [...DEFAULT_EGRESS_ALLOW, 'api.example.com'] }`.
1159
- */
1160
- const DEFAULT_EGRESS_ALLOW = PACKAGE_HOSTS;
1161
- /** What each sandbox kind can do about egress, as its provider declares it. */
1162
- const SANDBOX_EGRESS = {
1163
- docker: DOCKER_EGRESS,
1164
- fake: FAKE_EGRESS
1165
- };
1166
- const isRestricted = (policy) => policy !== "allow-all";
1167
- /**
1168
- * The hosts the harness needs: a real agent's own API (its model's provider's, for OpenCode), or
1169
- * a fake agent's with `layout` (it behaves like that agent). A plain fake agent talks to nothing.
1170
- */
1171
- function harnessHosts(harness) {
1172
- if (harness.kind !== "fake" && isAgentKind(harness.kind)) return agentFor(harness).hosts ?? HARNESS_HOSTS[harness.kind];
1173
- return harness.kind === "fake" && harness.layout ? HARNESS_HOSTS[harness.layout] : [];
1174
- }
1175
- /** MCP `http`/`sse` servers' hosts, local plugins' included: the agent connects to them from the sandbox. */
1176
- function mcpServerHosts(layers) {
1177
- const urls = /* @__PURE__ */ new Map();
1178
- for (const { spec } of layers) for (const [name, server] of Object.entries(spec.mcp ?? {})) if (server.transport === "stdio") urls.delete(name);
1179
- else urls.set(name, server.url);
1180
- for (const [name, server] of localPluginServers(layers)) if (server.transport !== "stdio") urls.set(name, server.url);
1181
- return [...urls.values()].flatMap((url) => URL.parse(url)?.hostname ?? []);
1182
- }
1183
- /**
1184
- * The policy an attempt runs under, and the hosts a restricted one allows on its own: the
1185
- * harness's, the brokered secrets' `hosts` and the MCP servers'. The cascade is config and
1186
- * profile defaults (`inherited`), then the environment's layers, then groups and the eval (`own`).
1187
- */
1188
- function plannedEgress(egress, harness, env, layers) {
1189
- const fromLayers = layers.findLast((l) => l.spec.egress !== void 0)?.spec.egress;
1190
- const policy = egress.own ?? fromLayers ?? egress.inherited ?? "allow-all";
1191
- if (!isRestricted(policy)) return {
1192
- policy,
1193
- auto: []
1194
- };
1195
- const own = policy === "deny-all" ? [] : policy.allow;
1196
- const auto = [
1197
- ...harnessHosts(harness),
1198
- ...plannedSecrets(env, layers).flatMap((s) => s.hosts ?? []),
1199
- ...mcpServerHosts(layers)
1200
- ];
1201
- return {
1202
- policy,
1203
- auto: [...new Set(auto)].filter((h) => !own.includes(h))
1204
- };
1205
- }
1206
- /** Every host a restricted policy lets through, or null under `allow-all`. */
1207
- function allowedHosts({ policy, auto }) {
1208
- if (!isRestricted(policy)) return null;
1209
- return [.../* @__PURE__ */ new Set([...policy === "deny-all" ? [] : policy.allow, ...auto])];
1210
- }
1211
- /**
1212
- * The policy the Docker sandbox's gateway enforces: `deny-all` when a restricted policy allows no
1213
- * host at all, else an allowlist. A listed IP address is an allowed range too, since the gateway
1214
- * reaches a private address only through one.
1215
- */
1216
- function gatewayPolicy(planned) {
1217
- const hosts = allowedHosts(planned);
1218
- if (hosts === null) return { mode: "allow-all" };
1219
- if (!hosts.length) return { mode: "deny-all" };
1220
- const cidrs = hosts.filter((h) => isIP(h)).map((h) => `${h}/${isIP(h) === 6 ? 128 : 32}`);
1221
- return {
1222
- mode: "custom",
1223
- allowedHosts: hosts,
1224
- ...cidrs.length ? { allowedCIDRs: cidrs } : {}
1225
- };
1226
- }
1227
- /** What enforcing the policy takes: nothing, turning egress off, or a host allowlist. */
1228
- function egressNeeds(planned) {
1229
- if (!isRestricted(planned.policy)) return "none";
1230
- return allowedHosts(planned)?.length ? "allowlist" : "all-or-nothing";
1231
- }
1232
- const LEVELS = [
1233
- "none",
1234
- "all-or-nothing",
1235
- "allowlist"
1236
- ];
1237
- /** Why the sandbox can't enforce the attempt's policy, or undefined when it can. */
1238
- function unenforceable(planned, sandbox, where) {
1239
- const needs = egressNeeds(planned);
1240
- const can = SANDBOX_EGRESS[sandbox.kind].enforce;
1241
- if (LEVELS.indexOf(can) >= LEVELS.indexOf(needs)) return void 0;
1242
- const hosts = allowedHosts(planned)?.join(", ");
1243
- const what = needs !== "allowlist" ? "turning egress off" : planned.policy === "deny-all" ? `a host allowlist for its automatic hosts (${hosts})` : `a host allowlist (${hosts})`;
1244
- const enforces = can === "none" ? "enforces no egress policy" : `only enforces ${can === "all-or-nothing" ? "'allow-all' or 'deny-all'" : can}`;
1245
- const hint = sandbox.kind === "fake" ? " (its commands run on the host). Run it in docker(), or set egress: 'allow-all'" : "";
1246
- return `${where} runs under egress ${describeEgress(planned.policy)}, which needs ${what}, but the ${sandbox.kind} sandbox ${enforces}${hint}.`;
1247
- }
1248
- const describeEgress = (policy) => typeof policy === "string" ? `'${policy}'` : `{ allow: [${policy.allow.map((h) => `'${h}'`).join(", ")}] }`;
1249
- /** `deny-all + auto: api2.cursor.sh, …` for the plan; '' under `allow-all`. */
1250
- function egressLabel({ policy, auto }) {
1251
- if (!isRestricted(policy)) return "";
1252
- const own = policy === "deny-all" ? "deny-all" : policy.allow.length ? `allow ${policy.allow.join(", ")}` : "allow none";
1253
- return auto.length ? `${own} + auto: ${auto.join(", ")}` : own;
1254
- }
1255
- //#endregion
1256
- export { writePluginFiles as C, refusedPlugins as S, credentialOf as _, plannedEgress as a, layoutOf as b, AGENTS as c, agentAuth as d, agentFor as f, claudeMcpServers as g, brokeringFor as h, gatewayPolicy as i, DEFAULT_HARNESS as l, authHint as m, allowedHosts as n, unenforceable as o, agentMcp as p, egressLabel as r, createFakeSandbox as s, DEFAULT_EGRESS_ALLOW as t, HARNESS_EXAMPLE as u, expectedBlockedFor as v, refusedMcp as x, isAgentKind as y };
1257
-
1258
- //# sourceMappingURL=egress-DEAvq8Fl.js.map