reeval 0.12.0 → 0.14.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.
- package/README.md +117 -259
- package/THIRD_PARTY_NOTICES.md +121 -121
- package/assets/package.json +1 -1
- package/assets/pnpm-lock.yaml +41 -30
- package/dist/{adapter-DigeVFWC.js → adapter-BloGVZ_a.js} +20 -8
- package/dist/adapter-BloGVZ_a.js.map +1 -0
- package/dist/{agent-CatUEo5h.js → agent-m-_t-IuW.js} +54 -26
- package/dist/{agent-CatUEo5h.js.map → agent-m-_t-IuW.js.map} +1 -1
- package/dist/{analysis-Bxub9LMT.js → analysis-C2-aEbr7.js} +4 -4
- package/dist/{analysis-Bxub9LMT.js.map → analysis-C2-aEbr7.js.map} +1 -1
- package/dist/app-files-C-jwhRDt.js +11 -0
- package/dist/app-files-C-jwhRDt.js.map +1 -0
- package/dist/{assemble-CF063ms6.js → assemble-BDEpelpi.js} +95 -38
- package/dist/assemble-BDEpelpi.js.map +1 -0
- package/dist/assemble-C5bfncHU.js +1 -0
- package/dist/{attempt-CGPV3BZY.js → attempt-jI0OWxlz.js} +2 -2
- package/dist/{attempt-CGPV3BZY.js.map → attempt-jI0OWxlz.js.map} +1 -1
- package/dist/{capture-BiD7lVaM.js → capture-CVRwRTnb.js} +574 -38
- package/dist/capture-CVRwRTnb.js.map +1 -0
- package/dist/capture-CherbjzB.js +1 -0
- package/dist/{cli-B5zQCR2r.js → cli-C_4gaJ50.js} +145 -142
- package/dist/cli-C_4gaJ50.js.map +1 -0
- package/dist/{cli-spec-BXIBUlaK.js → cli-spec-CpnbATtI.js} +2 -2
- package/dist/{cli-spec-BXIBUlaK.js.map → cli-spec-CpnbATtI.js.map} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{assert-EUIoRdIt.js → client-D5hNjpEx.js} +105 -2
- package/dist/client-D5hNjpEx.js.map +1 -0
- package/dist/{command-C94CQNh8.js → command-BWAuwQNk.js} +12 -12
- package/dist/{command-C94CQNh8.js.map → command-BWAuwQNk.js.map} +1 -1
- package/dist/{command-CaZgCTIw.js → command-BXLUfw4h.js} +14 -14
- package/dist/command-BXLUfw4h.js.map +1 -0
- package/dist/{command-CVtgyqlM.js → command-Be6BSE2L.js} +12 -12
- package/dist/{command-CVtgyqlM.js.map → command-Be6BSE2L.js.map} +1 -1
- package/dist/{command-BMHXHqMT.js → command-Bxdy62dW.js} +15 -14
- package/dist/command-Bxdy62dW.js.map +1 -0
- package/dist/{command-DTgBZR0k.js → command-I1euLLio.js} +35 -15
- package/dist/command-I1euLLio.js.map +1 -0
- package/dist/{commands-CjpGBUWr.js → commands-jzigbNFb.js} +23 -14
- package/dist/commands-jzigbNFb.js.map +1 -0
- package/dist/{commands-BXzIDB3X.js → commands-p1S4nw_H.js} +1 -1
- package/dist/config-BrdHA9bJ.js +3549 -0
- package/dist/config-BrdHA9bJ.js.map +1 -0
- package/dist/{contrasts-CcoMLC_y.js → contrasts-DRxMQQTC.js} +3 -2
- package/dist/contrasts-DRxMQQTC.js.map +1 -0
- package/dist/cost-D4elx933.js +359 -0
- package/dist/cost-D4elx933.js.map +1 -0
- package/dist/cost-DmnAod9x.js +1 -0
- package/dist/db-CAfksinX.js +2 -0
- package/dist/{db-BeqRiWLl.js → db-DO0p7xgP.js} +25 -8
- package/dist/db-DO0p7xgP.js.map +1 -0
- package/dist/{dist-CMjp3qqF.js → dist-CYrBwyHA.js} +2 -2
- package/dist/{dist-CMjp3qqF.js.map → dist-CYrBwyHA.js.map} +1 -1
- package/dist/{docker-BbTlMmYi.js → docker-BnRlTpZA.js} +3 -3
- package/dist/{docker-BbTlMmYi.js.map → docker-BnRlTpZA.js.map} +1 -1
- package/dist/{docker-CCXdbREk.js → docker-D01slDF3.js} +29 -28
- package/dist/docker-D01slDF3.js.map +1 -0
- package/dist/{docker-DC69dKxB.js → docker-DivfZl2u.js} +1 -1
- package/dist/{doctor-CqttrZcs.js → doctor-DQ2p0euG.js} +136 -38
- package/dist/doctor-DQ2p0euG.js.map +1 -0
- package/dist/{environment-BBz1Yes9.js → environment-CO0P0soF.js} +31 -11
- package/dist/environment-CO0P0soF.js.map +1 -0
- package/dist/{evaluate-CXQ1o-pd.js → evaluate-BUmsN7yG.js} +68 -29
- package/dist/evaluate-BUmsN7yG.js.map +1 -0
- package/dist/{evaluate-yjZKUexW.d.ts → evaluate-C_sgRA-V.d.ts} +45 -3
- package/dist/{facts-DtENlf9s.js → facts-DzOUTreB.js} +13 -5
- package/dist/facts-DzOUTreB.js.map +1 -0
- package/dist/{files-B-eUpCZ1.js → files-B-CJeeEh.js} +14 -9
- package/dist/{files-B-eUpCZ1.js.map → files-B-CJeeEh.js.map} +1 -1
- package/dist/files-Bp5j5BqI.js +1 -0
- package/dist/files-C2sjmXhk.js +1 -0
- package/dist/{files-BsQbYz2i.js → files-C_gQNVB-.js} +4 -4
- package/dist/{files-BsQbYz2i.js.map → files-C_gQNVB-.js.map} +1 -1
- package/dist/{files-COHQLEHE.js → files-kUCrswI6.js} +3 -3
- package/dist/{files-COHQLEHE.js.map → files-kUCrswI6.js.map} +1 -1
- package/dist/gateway.d.ts +17 -0
- package/dist/gateway.js +17 -0
- package/dist/gateway.js.map +1 -0
- package/dist/{generate-Cs2TMH_k.js → generate-DZ7vp69F.js} +18 -18
- package/dist/generate-DZ7vp69F.js.map +1 -0
- package/dist/{git-DhykwgKF.js → git-Bk8DSwHy.js} +3 -3
- package/dist/{git-DhykwgKF.js.map → git-Bk8DSwHy.js.map} +1 -1
- package/dist/{harness-BAjw1fcr.js → harness-COVXSwJ6.js} +46 -15
- package/dist/harness-COVXSwJ6.js.map +1 -0
- package/dist/harness.d.ts +26 -18
- package/dist/harness.js +1 -1
- package/dist/{header-kSmWatcO.js → header-BLPP6aCU.js} +2 -2
- package/dist/{header-kSmWatcO.js.map → header-BLPP6aCU.js.map} +1 -1
- package/dist/{images-BmJRuTpm.js → images-DzLeFjLx.js} +8 -8
- package/dist/{images-BmJRuTpm.js.map → images-DzLeFjLx.js.map} +1 -1
- package/dist/index.d.ts +3 -45
- package/dist/index.js +5 -6
- package/dist/init-RgCQXZhb.js +1 -0
- package/dist/{init-Bwc9byQr.js → init-SRalM5xF.js} +6 -8
- package/dist/init-SRalM5xF.js.map +1 -0
- package/dist/{insights-B2Xmhz9o.js → insights-TyAvz9aV.js} +5 -1
- package/dist/{insights-B2Xmhz9o.js.map → insights-TyAvz9aV.js.map} +1 -1
- package/dist/{invocations-CQTbP092.js → invocations-DzyKSJBa.js} +3 -3
- package/dist/{invocations-CQTbP092.js.map → invocations-DzyKSJBa.js.map} +1 -1
- package/dist/judge-yLvjC5A3.js +385 -0
- package/dist/judge-yLvjC5A3.js.map +1 -0
- package/dist/judge.d.ts +7 -6
- package/dist/judge.js +7 -5
- package/dist/judge.js.map +1 -1
- package/dist/match-Bz0nSdzN.js +204 -0
- package/dist/match-Bz0nSdzN.js.map +1 -0
- package/dist/{matchers-Ddmc2z7H.js → matchers-D4eUqx4j.js} +2 -2
- package/dist/{matchers-Ddmc2z7H.js.map → matchers-D4eUqx4j.js.map} +1 -1
- package/dist/{model-B-mel-Gv.js → model-1ZLr9Dcv.js} +59 -35
- package/dist/model-1ZLr9Dcv.js.map +1 -0
- package/dist/model-B45lDUV1.js +68 -0
- package/dist/model-B45lDUV1.js.map +1 -0
- package/dist/model-BTZq8HIZ.js +1 -0
- package/dist/{model-CWlAqmbU.js → model-CgnOpss4.js} +58 -316
- package/dist/model-CgnOpss4.js.map +1 -0
- package/dist/model-Ch8kX87u.js +1 -0
- package/dist/{node-D0mtjRAO.js → node-BSq5qHnQ.js} +12 -5
- package/dist/node-BSq5qHnQ.js.map +1 -0
- package/dist/{opencode-providers-J9colP0-.js → opencode-providers-klkqgzvb.js} +72 -62
- package/dist/opencode-providers-klkqgzvb.js.map +1 -0
- package/dist/{pairs-DP6XOJby.js → pairs-CHfZNRT6.js} +8 -7
- package/dist/pairs-CHfZNRT6.js.map +1 -0
- package/dist/{patch-D4oluWzH.js → patch-DWf-I_Q_.js} +2 -2
- package/dist/{patch-D4oluWzH.js.map → patch-DWf-I_Q_.js.map} +1 -1
- package/dist/{plan-OkwUcJQ9.js → plan-BIwUzlB8.js} +63 -26
- package/dist/plan-BIwUzlB8.js.map +1 -0
- package/dist/{plugins-CUWMnSNb.js → plugins-Dkp_H3pB.js} +5 -5
- package/dist/{plugins-CUWMnSNb.js.map → plugins-Dkp_H3pB.js.map} +1 -1
- package/dist/{preflight-B6pY89bF.js → preflight-D9y-HvZQ.js} +1 -1
- package/dist/{preflight-Bjm7_ylE.js → preflight-DJCD_BDn.js} +3 -3
- package/dist/{preflight-Bjm7_ylE.js.map → preflight-DJCD_BDn.js.map} +1 -1
- package/dist/{prepare-DbdgtZKe.js → prepare-BJG_pD54.js} +2 -2
- package/dist/{prepare-CQmK3SBn.js → prepare-CIxCGG0M.js} +8 -8
- package/dist/{prepare-CQmK3SBn.js.map → prepare-CIxCGG0M.js.map} +1 -1
- package/dist/prices-BcLEXvdY.js +250 -0
- package/dist/prices-BcLEXvdY.js.map +1 -0
- package/dist/{provenance-B3Y17oCC.js → provenance-CfZpFpAh.js} +3 -3
- package/dist/{provenance-B3Y17oCC.js.map → provenance-CfZpFpAh.js.map} +1 -1
- package/dist/{providers-CXN2RFz-.js → providers-D1Zxp2he.js} +1 -1
- package/dist/{providers-eoniqK6w.js → providers-DFk_6W4K.js} +5 -5
- package/dist/{providers-eoniqK6w.js.map → providers-DFk_6W4K.js.map} +1 -1
- package/dist/{query-CLRZmWBT.js → query-CemclveB.js} +2 -2
- package/dist/{query-CLRZmWBT.js.map → query-CemclveB.js.map} +1 -1
- package/dist/query-Cvbwl804.js +1 -0
- package/dist/{questions-1XOulevV.js → questions-bAudIc04.js} +309 -47
- package/dist/questions-bAudIc04.js.map +1 -0
- package/dist/{redact-DJ9JCShu.js → redact-CRGdfV2s.js} +4 -2
- package/dist/redact-CRGdfV2s.js.map +1 -0
- package/dist/{remarks-DlJCqWRs.js → remarks-CXwSnSjR.js} +9 -9
- package/dist/{remarks-DlJCqWRs.js.map → remarks-CXwSnSjR.js.map} +1 -1
- package/dist/remarks-CyAu2DiB.js +1 -0
- package/dist/{remarks-1521zwfW.js → remarks-mujJv1Ey.js} +5 -3
- package/dist/remarks-mujJv1Ey.js.map +1 -0
- package/dist/{remote-cE2VWfkJ.js → remote-CKcEKja4.js} +129 -174
- package/dist/remote-CKcEKja4.js.map +1 -0
- package/dist/resolve-B5-uqmJ6.js +1 -0
- package/dist/{resolve-C4zeccCH.js → resolve-CBoKzQMP.js} +9 -10
- package/dist/resolve-CBoKzQMP.js.map +1 -0
- package/dist/{results-Drtt0uFl.js → results-CMgZEANy.js} +8 -8
- package/dist/{results-Drtt0uFl.js.map → results-CMgZEANy.js.map} +1 -1
- package/dist/{resume-BEFazUfy.js → resume-B9SOSnK9.js} +3 -3
- package/dist/{resume-BEFazUfy.js.map → resume-B9SOSnK9.js.map} +1 -1
- package/dist/{root-DICDHCtp.js → root-Dlff-zp8.js} +5 -5
- package/dist/root-Dlff-zp8.js.map +1 -0
- package/dist/{rules-BFzQqPIm.js → rules-VhftPOOT.js} +53 -4
- package/dist/rules-VhftPOOT.js.map +1 -0
- package/dist/{run-BeMy92Us.js → run-CwIEK16q.js} +12 -12
- package/dist/run-CwIEK16q.js.map +1 -0
- package/dist/{runtime-PX_oXiCS.js → runtime-BgQRyCLl.js} +14 -2
- package/dist/runtime-BgQRyCLl.js.map +1 -0
- package/dist/{sandbox-CQaJj7n9.js → sandbox-BOYZ0hlo.js} +2 -2
- package/dist/{sandbox-CQaJj7n9.js.map → sandbox-BOYZ0hlo.js.map} +1 -1
- package/dist/sandbox.d.ts +2 -1
- package/dist/sandbox.js +1 -1
- package/dist/server-CHRSgKRp.js +1 -0
- package/dist/{server-xK0les4f.js → server-TGW4WyAz.js} +26 -27
- package/dist/{server-xK0les4f.js.map → server-TGW4WyAz.js.map} +1 -1
- package/dist/{shared-CA61BuPJ.js → shared-BDUzStad.js} +2 -2
- package/dist/shared-BDUzStad.js.map +1 -0
- package/dist/shared-CHvO7eLi.d.ts +1 -0
- package/dist/{source-Q1hEKbCs.js → source-B1WvBIQt.js} +2 -2
- package/dist/{source-Q1hEKbCs.js.map → source-B1WvBIQt.js.map} +1 -1
- package/dist/source-DAzztZwU.js +1 -0
- package/dist/src-1jHbFaGW.js +1 -0
- package/dist/{src-LekQrr_S.js → src-8zoX_qrb.js} +614 -171
- package/dist/src-8zoX_qrb.js.map +1 -0
- package/dist/{src-C0CeKiLU.js → src-BYLM3hEz.js} +4 -3
- package/dist/src-BYLM3hEz.js.map +1 -0
- package/dist/{src-CFp86GtV.js → src-CHIwOy0o.js} +87 -55
- package/dist/{src-CFp86GtV.js.map → src-CHIwOy0o.js.map} +1 -1
- package/dist/src-C_9wgowC.js +2 -0
- package/dist/{src-C7_1SqDP.js → src-ChhtI6BP.js} +2 -2
- package/dist/{src-C7_1SqDP.js.map → src-ChhtI6BP.js.map} +1 -1
- package/dist/src-CyaDNG9r.js +2 -0
- package/dist/src-D005Cbqz.js +2 -0
- package/dist/src-DIfRbp5a.js +3 -0
- package/dist/{src-BhmaorOU.js → src-DKPVX2Us.js} +43 -17
- package/dist/{src-BhmaorOU.js.map → src-DKPVX2Us.js.map} +1 -1
- package/dist/src-Dg8121Xy.js +2 -0
- package/dist/{src-cbCb-MPy.js → src-DjF_M8_f.js} +44 -20
- package/dist/{src-cbCb-MPy.js.map → src-DjF_M8_f.js.map} +1 -1
- package/dist/{src-DIL0jST0.js → src-DjRI-IeE.js} +42 -14
- package/dist/src-DjRI-IeE.js.map +1 -0
- package/dist/{src-DiLMkIr9.js → src-DmUgeTlE.js} +47 -17
- package/dist/src-DmUgeTlE.js.map +1 -0
- package/dist/src-ElBqEN-S.js +2 -0
- package/dist/{src-qGoFkuJF.js → src-NSdQ9zI6.js} +88 -23
- package/dist/src-NSdQ9zI6.js.map +1 -0
- package/dist/src-YHGaUrGE.js +2 -0
- package/dist/src-mJVxw1Jm.js +2 -0
- package/dist/{state-BmZ8QVZ8.js → state-B1t143wG.js} +22 -20
- package/dist/{state-BmZ8QVZ8.js.map → state-B1t143wG.js.map} +1 -1
- package/dist/state-vznMh2wl.js +1 -0
- package/dist/stats-DSy5HfOv.js +315 -0
- package/dist/stats-DSy5HfOv.js.map +1 -0
- package/dist/suite-BsWGHzlG.js +2 -0
- package/dist/{suite-C8sw2pox.js → suite-WgT7m6Vs.js} +76 -13
- package/dist/suite-WgT7m6Vs.js.map +1 -0
- package/dist/{summary-0oQNGskv.js → summary-DIGEVr08.js} +58 -17
- package/dist/summary-DIGEVr08.js.map +1 -0
- package/dist/testing.d.ts +174 -2
- package/dist/testing.js +14 -3
- package/dist/testing.js.map +1 -0
- package/dist/types-C5vI3g1C.js.map +1 -1
- package/dist/{types-GraZtfHN.d.ts → types-DXBbP9Mk.d.ts} +302 -72
- package/dist/{usage-CleNKkly.js → usage-BNY1ABrU.js} +3 -3
- package/dist/{usage-CleNKkly.js.map → usage-BNY1ABrU.js.map} +1 -1
- package/dist/usage-DF3_p5pE.js +1 -0
- package/dist/{validate-BdoXUuL_.js → validate-BhwqrVsm.js} +48 -16
- package/dist/validate-BhwqrVsm.js.map +1 -0
- package/dist/view/index.d.ts +143 -91
- package/dist/view/index.js +7 -6
- package/dist/views-BW_C5eVH.js +2 -0
- package/dist/{views-BoUoX4_A.js → views-sXpGE6a2.js} +10 -8
- package/dist/views-sXpGE6a2.js.map +1 -0
- package/dist/{worker-entry-D0-GErmU.js → worker-entry-Duo9oAeT.js} +8 -8
- package/dist/{worker-entry-D0-GErmU.js.map → worker-entry-Duo9oAeT.js.map} +1 -1
- package/dist/{workspace-tjZFkjxC.js → workspace-CDI68wtX.js} +45 -11
- package/dist/workspace-CDI68wtX.js.map +1 -0
- package/dist/workspace-QZCacP8A.js +1 -0
- package/package.json +8 -2
- package/skills/eval-rubric/SKILL.md +9 -0
- package/dist/adapter-DigeVFWC.js.map +0 -1
- package/dist/assemble-CF063ms6.js.map +0 -1
- package/dist/assemble-CJoD_Rzr.js +0 -1
- package/dist/assert-EUIoRdIt.js.map +0 -1
- package/dist/capture-BiD7lVaM.js.map +0 -1
- package/dist/capture-Dp3q7K7Y.js +0 -1
- package/dist/cli-B5zQCR2r.js.map +0 -1
- package/dist/client-fcwgwOAD.js +0 -106
- package/dist/client-fcwgwOAD.js.map +0 -1
- package/dist/command-BMHXHqMT.js.map +0 -1
- package/dist/command-CaZgCTIw.js.map +0 -1
- package/dist/command-DTgBZR0k.js.map +0 -1
- package/dist/commands-CjpGBUWr.js.map +0 -1
- package/dist/config-Dv5MG7Rp.js +0 -753
- package/dist/config-Dv5MG7Rp.js.map +0 -1
- package/dist/contrasts-CcoMLC_y.js.map +0 -1
- package/dist/db-BeqRiWLl.js.map +0 -1
- package/dist/db-CJDRVQal.js +0 -2
- package/dist/docker-CCXdbREk.js.map +0 -1
- package/dist/doctor-CqttrZcs.js.map +0 -1
- package/dist/egress-BfK_O9ce.js +0 -1241
- package/dist/egress-BfK_O9ce.js.map +0 -1
- package/dist/environment-BBz1Yes9.js.map +0 -1
- package/dist/evaluate-CXQ1o-pd.js.map +0 -1
- package/dist/facts-DtENlf9s.js.map +0 -1
- package/dist/files-DqCBW7i8.js +0 -1
- package/dist/files-Ha-jsQXf.js +0 -1
- package/dist/generate-Cs2TMH_k.js.map +0 -1
- package/dist/harness-BAjw1fcr.js.map +0 -1
- package/dist/init-Bwc9byQr.js.map +0 -1
- package/dist/init-D7Y1ny1z.js +0 -1
- package/dist/judge-Dt6KW6_O.js +0 -153
- package/dist/judge-Dt6KW6_O.js.map +0 -1
- package/dist/model-B-mel-Gv.js.map +0 -1
- package/dist/model-BGKYVpoj.js +0 -1
- package/dist/model-C7tSwT7f.js +0 -44
- package/dist/model-C7tSwT7f.js.map +0 -1
- package/dist/model-CWlAqmbU.js.map +0 -1
- package/dist/model-DHY-dfoO.js +0 -1
- package/dist/node-D0mtjRAO.js.map +0 -1
- package/dist/opencode-providers-J9colP0-.js.map +0 -1
- package/dist/options-CPUW97_7.js +0 -1116
- package/dist/options-CPUW97_7.js.map +0 -1
- package/dist/pairs-DP6XOJby.js.map +0 -1
- package/dist/plan-OkwUcJQ9.js.map +0 -1
- package/dist/query-CmBDYt0_.js +0 -1
- package/dist/questions-1XOulevV.js.map +0 -1
- package/dist/redact-DJ9JCShu.js.map +0 -1
- package/dist/remarks-1521zwfW.js.map +0 -1
- package/dist/remarks-BhAV1H4V.js +0 -1
- package/dist/remote-cE2VWfkJ.js.map +0 -1
- package/dist/resolve-C4zeccCH.js.map +0 -1
- package/dist/resolve-D30yZYmB.js +0 -1
- package/dist/root-DICDHCtp.js.map +0 -1
- package/dist/rules-BFzQqPIm.js.map +0 -1
- package/dist/run-BeMy92Us.js.map +0 -1
- package/dist/runtime-PX_oXiCS.js.map +0 -1
- package/dist/server-V4-2w0l8.js +0 -1
- package/dist/shared-CA61BuPJ.js.map +0 -1
- package/dist/source-BDow_oW8.js +0 -1
- package/dist/src-B9L9yGKI.js +0 -1
- package/dist/src-Bcah6ZkT.js +0 -3
- package/dist/src-C0CeKiLU.js.map +0 -1
- package/dist/src-C0xowZ3C.js +0 -2
- package/dist/src-CHIfIKUu.js +0 -2
- package/dist/src-DIL0jST0.js.map +0 -1
- package/dist/src-DLtyz4w5.js +0 -2
- package/dist/src-DPIjmReZ.js +0 -2
- package/dist/src-DXNh5mTr.js +0 -2
- package/dist/src-DiLMkIr9.js.map +0 -1
- package/dist/src-LekQrr_S.js.map +0 -1
- package/dist/src-bCnsA6Vp.js +0 -2
- package/dist/src-qGoFkuJF.js.map +0 -1
- package/dist/src-ynBVosfX.js +0 -2
- package/dist/state-BQR_BCm4.js +0 -1
- package/dist/state-CeR6oz0k.js +0 -66
- package/dist/state-CeR6oz0k.js.map +0 -1
- package/dist/studio-app/assets/index-CnYJijyI.js +0 -58
- package/dist/studio-app/assets/index-CwQN3f_h.css +0 -2
- package/dist/studio-app/favicon.svg +0 -1
- package/dist/studio-app/index.html +0 -15
- package/dist/suite-BaHPmAGy.js +0 -1
- package/dist/suite-C8sw2pox.js.map +0 -1
- package/dist/summary-0oQNGskv.js.map +0 -1
- package/dist/usage-BDo2q_yu.js +0 -1
- package/dist/validate-BdoXUuL_.js.map +0 -1
- package/dist/views-BoUoX4_A.js.map +0 -1
- package/dist/views-noVQNCUP.js +0 -2
- package/dist/workspace-B90YDU_a.js +0 -1
- package/dist/workspace-tjZFkjxC.js.map +0 -1
package/dist/egress-BfK_O9ce.js
DELETED
|
@@ -1,1241 +0,0 @@
|
|
|
1
|
-
import { n as UsageError } from "./errors-B6BSMs03.js";
|
|
2
|
-
import { w as plannedSecrets } from "./environment-BBz1Yes9.js";
|
|
3
|
-
import { F as PACKAGE_HOSTS, N as DOCKER_EGRESS, P as HARNESS_HOSTS, lt as run, ut as shellQuote } from "./src-LekQrr_S.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-CUWMnSNb.js";
|
|
5
|
-
import { a as providerServedModel, i as providerModelResponses, n as providerEndpoints, r as providerHosts, s as resolveOpenCodeProvider } from "./opencode-providers-J9colP0-.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 { randomUUID } from "node:crypto";
|
|
11
|
-
import { spawn } from "node:child_process";
|
|
12
|
-
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
13
|
-
//#region src/harness/agents.ts
|
|
14
|
-
const WEB_EVENTS = {
|
|
15
|
-
webSearch: "web-search",
|
|
16
|
-
webFetch: "web-fetch"
|
|
17
|
-
};
|
|
18
|
-
/** `harnessMetadata.cursorSdk.unreportedTools` as transcript event types. */
|
|
19
|
-
function cursorUnreported(harnessMetadata) {
|
|
20
|
-
const tools = harnessMetadata?.cursorSdk?.unreportedTools;
|
|
21
|
-
return Array.isArray(tools) ? tools.flatMap((t) => WEB_EVENTS[t] ? [WEB_EVENTS[t]] : []) : [];
|
|
22
|
-
}
|
|
23
|
-
/** A Gemini API key's only request: `POST /v1beta/models/<model>:streamGenerateContent`. */
|
|
24
|
-
const GEMINI_ENDPOINTS = [{
|
|
25
|
-
host: "generativelanguage.googleapis.com",
|
|
26
|
-
path: { regex: "^/v1beta/models/[^/]+:streamGenerateContent$" },
|
|
27
|
-
method: ["POST"]
|
|
28
|
-
}];
|
|
29
|
-
/** Goose's: the model call, and the model list it fetches with the key at the start of a turn. */
|
|
30
|
-
const GOOSE_ENDPOINTS = [...GEMINI_ENDPOINTS, {
|
|
31
|
-
host: "generativelanguage.googleapis.com",
|
|
32
|
-
path: { regex: "^/v1beta/models$" },
|
|
33
|
-
method: ["GET"]
|
|
34
|
-
}];
|
|
35
|
-
/**
|
|
36
|
-
* What Grok Build sends the key on: the model list and the key's status as a session starts, and
|
|
37
|
-
* its model calls (Chat Completions, and the Responses API for a model or tool that takes it).
|
|
38
|
-
*/
|
|
39
|
-
const XAI_ENDPOINTS = [
|
|
40
|
-
{
|
|
41
|
-
host: "api.x.ai",
|
|
42
|
-
path: { exact: "/v1/models" },
|
|
43
|
-
method: ["GET"]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
host: "api.x.ai",
|
|
47
|
-
path: { exact: "/v1/api-key" },
|
|
48
|
-
method: ["GET"]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
host: "api.x.ai",
|
|
52
|
-
path: { exact: "/v1/chat/completions" },
|
|
53
|
-
method: ["POST"]
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
host: "api.x.ai",
|
|
57
|
-
path: { exact: "/v1/responses" },
|
|
58
|
-
method: ["POST"]
|
|
59
|
-
}
|
|
60
|
-
];
|
|
61
|
-
/** xAI's model calls, whose responses name the model that served them. */
|
|
62
|
-
const XAI_MODEL_RESPONSES = XAI_ENDPOINTS.filter((e) => e.path.exact === "/v1/chat/completions" || e.path.exact === "/v1/responses");
|
|
63
|
-
/** The model an xAI response says served it. */
|
|
64
|
-
const xaiServedModel = ({ host, responseModel }) => host === "api.x.ai" ? responseModel : void 0;
|
|
65
|
-
/** The model a Gemini API request names in its URL. */
|
|
66
|
-
const geminiServedModel = ({ host, path }) => host === "generativelanguage.googleapis.com" ? /^\/v1beta\/models\/([^/:]+):streamGenerateContent$/.exec(path)?.[1] : void 0;
|
|
67
|
-
/** Cursor's key exchange: the only request the Cursor SDK sends the API key on. */
|
|
68
|
-
const CURSOR_EXCHANGE = {
|
|
69
|
-
host: "api2.cursor.sh",
|
|
70
|
-
path: { exact: "/auth/exchange_user_api_key" },
|
|
71
|
-
method: ["POST"]
|
|
72
|
-
};
|
|
73
|
-
/** What Codex sends the key on: the Responses API. */
|
|
74
|
-
const OPENAI_ENDPOINTS = [{
|
|
75
|
-
host: "api.openai.com",
|
|
76
|
-
path: { exact: "/v1/responses" },
|
|
77
|
-
method: ["POST"]
|
|
78
|
-
}];
|
|
79
|
-
/**
|
|
80
|
-
* The model the Responses API says served a request, from its response (a dated snapshot for some
|
|
81
|
-
* models), and the reasoning effort Codex resolved for it, e.g. `gpt-5.6-luna[effort=medium]`.
|
|
82
|
-
*/
|
|
83
|
-
const openaiServedModel = ({ host, path, responseModel, responseEffort }) => host === "api.openai.com" && path === "/v1/responses" && responseModel ? `${responseModel}${responseEffort ? `[effort=${responseEffort}]` : ""}` : void 0;
|
|
84
|
-
/**
|
|
85
|
-
* OpenCode on the model's provider (`anthropic/claude-haiku-4-5` is Anthropic's): its key, the
|
|
86
|
-
* requests OpenCode sends it on, its hosts plus Exa's for web search, and the served model from
|
|
87
|
-
* the URL (Gemini's API, Bedrock's) or the response body. Bedrock's hosts are its `AWS_REGION`'s.
|
|
88
|
-
*/
|
|
89
|
-
function opencodeForModel(model, env = process.env) {
|
|
90
|
-
const resolved = resolveOpenCodeProvider(model, env);
|
|
91
|
-
if ("error" in resolved) throw new InfraError(`opencode(): ${resolved.error}`);
|
|
92
|
-
const { provider } = resolved;
|
|
93
|
-
const modelResponses = providerModelResponses(provider);
|
|
94
|
-
return {
|
|
95
|
-
credential: provider.env,
|
|
96
|
-
endpoints: providerEndpoints(provider),
|
|
97
|
-
...modelResponses.length ? { modelResponses } : {},
|
|
98
|
-
servedModel: (request) => providerServedModel(provider, request),
|
|
99
|
-
hosts: [...providerHosts(provider), "mcp.exa.ai"]
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* The variables besides its key that OpenCode's provider takes from the host, as they are:
|
|
104
|
-
* Bedrock's `AWS_REGION` (default `us-east-1`); none for most providers.
|
|
105
|
-
*/
|
|
106
|
-
function opencodeVars(model, env = process.env) {
|
|
107
|
-
const resolved = resolveOpenCodeProvider(model, env);
|
|
108
|
-
if ("error" in resolved) throw new InfraError(`opencode(): ${resolved.error}`);
|
|
109
|
-
return resolved.vars;
|
|
110
|
-
}
|
|
111
|
-
/** Codex's `config.toml` `[mcp_servers]` shape. */
|
|
112
|
-
function codexMcpServers(servers) {
|
|
113
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => {
|
|
114
|
-
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`);
|
|
115
|
-
return s.transport === "stdio" ? [name, {
|
|
116
|
-
command: s.command,
|
|
117
|
-
args: s.args,
|
|
118
|
-
env: s.env ?? {}
|
|
119
|
-
}] : [name, {
|
|
120
|
-
url: s.url,
|
|
121
|
-
http_headers: s.headers ?? {}
|
|
122
|
-
}];
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
/** The `.mcp.json` shape. */
|
|
126
|
-
function claudeMcpServers(servers) {
|
|
127
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, {
|
|
128
|
-
type: "stdio",
|
|
129
|
-
command: s.command,
|
|
130
|
-
args: s.args,
|
|
131
|
-
env: s.env
|
|
132
|
-
}] : [name, {
|
|
133
|
-
type: s.transport,
|
|
134
|
-
url: s.url,
|
|
135
|
-
headers: s.headers
|
|
136
|
-
}]));
|
|
137
|
-
}
|
|
138
|
-
/** The Antigravity CLI's `mcp_config.json` shape: remote servers take `serverUrl`, not `url`. */
|
|
139
|
-
function antigravityMcpServers(servers) {
|
|
140
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, {
|
|
141
|
-
command: s.command,
|
|
142
|
-
args: s.args,
|
|
143
|
-
env: s.env
|
|
144
|
-
}] : [name, {
|
|
145
|
-
serverUrl: s.url,
|
|
146
|
-
headers: s.headers
|
|
147
|
-
}]));
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* OpenCode's config shape (its `mcp.servers`), which the adapter sets `codemode: false` on.
|
|
151
|
-
* OpenCode has no SSE transport.
|
|
152
|
-
*/
|
|
153
|
-
function opencodeMcpServers(servers) {
|
|
154
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => {
|
|
155
|
-
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`);
|
|
156
|
-
return s.transport === "stdio" ? [name, {
|
|
157
|
-
type: "local",
|
|
158
|
-
command: [s.command, ...s.args],
|
|
159
|
-
environment: s.env ?? {}
|
|
160
|
-
}] : [name, {
|
|
161
|
-
type: "remote",
|
|
162
|
-
url: s.url,
|
|
163
|
-
headers: s.headers ?? {},
|
|
164
|
-
oauth: false
|
|
165
|
-
}];
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* The key Goose keeps an extension by (its `name_to_key`): whitespace dropped, anything but ASCII
|
|
170
|
-
* letters, digits, `_` and `-` made `_`, lower-cased. Of two extensions with one key it keeps one.
|
|
171
|
-
*/
|
|
172
|
-
const gooseKey = (name) => name.replace(/\s/g, "").replace(/[^A-Za-z0-9_-]/g, "_").toLowerCase();
|
|
173
|
-
/** Goose's extension shape (its `config.yaml`); it has no SSE transport. */
|
|
174
|
-
function gooseMcpServers(servers) {
|
|
175
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
176
|
-
for (const name of Object.keys(servers)) {
|
|
177
|
-
const key = gooseKey(name);
|
|
178
|
-
const other = byKey.get(key);
|
|
179
|
-
if (other !== void 0) throw new InfraError(`Goose keys the ${other} and ${name} MCP servers both as ${key}, and keeps only one: rename one`);
|
|
180
|
-
byKey.set(key, name);
|
|
181
|
-
}
|
|
182
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => {
|
|
183
|
-
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`);
|
|
184
|
-
return s.transport === "stdio" ? [name, {
|
|
185
|
-
type: "stdio",
|
|
186
|
-
cmd: s.command,
|
|
187
|
-
args: s.args,
|
|
188
|
-
envs: s.env ?? {}
|
|
189
|
-
}] : [name, {
|
|
190
|
-
type: "streamable_http",
|
|
191
|
-
uri: s.url,
|
|
192
|
-
headers: s.headers ?? {}
|
|
193
|
-
}];
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* pi's `mcp.json` shape, which the adapter escapes and sets `"exposure": "direct"` on. pi
|
|
198
|
-
* skips a server whose name isn't letters, digits, `_` and `-`, so the plan refuses it instead.
|
|
199
|
-
* A plugin's server, `<plugin>:<server>`, is named `<plugin>_<server>`, so its tools are
|
|
200
|
-
* `mcp__<plugin>_<server>__<tool>`.
|
|
201
|
-
*/
|
|
202
|
-
function piMcpServers(servers) {
|
|
203
|
-
const named = /* @__PURE__ */ new Map();
|
|
204
|
-
return Object.fromEntries(Object.entries(servers).map(([key, s]) => {
|
|
205
|
-
const name = /^[a-z0-9-]+:[^:]+$/.test(key) ? key.replace(":", "_") : key;
|
|
206
|
-
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`);
|
|
207
|
-
const other = named.get(name);
|
|
208
|
-
if (other) throw new InfraError(`pi names the ${key} MCP server ${name}, as it does the ${other} server, and keeps only one: rename one`);
|
|
209
|
-
named.set(name, key);
|
|
210
|
-
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`);
|
|
211
|
-
return s.transport === "stdio" ? [name, {
|
|
212
|
-
command: s.command,
|
|
213
|
-
args: s.args,
|
|
214
|
-
env: s.env ?? {}
|
|
215
|
-
}] : [name, {
|
|
216
|
-
url: s.url,
|
|
217
|
-
headers: s.headers ?? {}
|
|
218
|
-
}];
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* ACP's `McpServer` shape, which fx and Grok Build take on `session/new`: `env` and `headers` as
|
|
223
|
-
* name-value lists.
|
|
224
|
-
*/
|
|
225
|
-
function acpMcpServers(servers) {
|
|
226
|
-
const pairs = (values = {}) => Object.entries(values).map(([name, value]) => ({
|
|
227
|
-
name,
|
|
228
|
-
value
|
|
229
|
-
}));
|
|
230
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, s.command.startsWith("/") ? {
|
|
231
|
-
command: s.command,
|
|
232
|
-
args: s.args,
|
|
233
|
-
env: pairs(s.env)
|
|
234
|
-
} : {
|
|
235
|
-
command: "/usr/bin/env",
|
|
236
|
-
args: [s.command, ...s.args],
|
|
237
|
-
env: pairs(s.env)
|
|
238
|
-
}] : [name, {
|
|
239
|
-
type: s.transport,
|
|
240
|
-
url: s.url,
|
|
241
|
-
headers: pairs(s.headers)
|
|
242
|
-
}]));
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* fx on the model's provider: Vercel AI Gateway for a gateway id, OpenAI's Chat Completions API
|
|
246
|
-
* for a bare OpenAI id. Each response's first `model` names the model that served it.
|
|
247
|
-
*/
|
|
248
|
-
function fxForModel(model) {
|
|
249
|
-
if (!model.includes("/")) {
|
|
250
|
-
const endpoints = [{
|
|
251
|
-
host: "api.openai.com",
|
|
252
|
-
path: { exact: "/v1/chat/completions" },
|
|
253
|
-
method: ["POST"]
|
|
254
|
-
}];
|
|
255
|
-
return {
|
|
256
|
-
credential: "OPENAI_API_KEY",
|
|
257
|
-
endpoints,
|
|
258
|
-
modelResponses: endpoints,
|
|
259
|
-
servedModel: ({ host, responseModel }) => host === "api.openai.com" ? responseModel : void 0,
|
|
260
|
-
hosts: ["api.openai.com"]
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
const call = {
|
|
264
|
-
host: "ai-gateway.vercel.sh",
|
|
265
|
-
path: { regex: "^/v\\d+/ai/language-model$" },
|
|
266
|
-
method: ["POST"]
|
|
267
|
-
};
|
|
268
|
-
return {
|
|
269
|
-
credential: "AI_GATEWAY_API_KEY",
|
|
270
|
-
endpoints: [{
|
|
271
|
-
host: "ai-gateway.vercel.sh",
|
|
272
|
-
path: { regex: "^/coding-agent/v1/" },
|
|
273
|
-
method: ["GET"]
|
|
274
|
-
}, call],
|
|
275
|
-
modelResponses: [call],
|
|
276
|
-
servedModel: ({ host, responseModel }) => host === "ai-gateway.vercel.sh" ? responseModel : void 0,
|
|
277
|
-
hosts: ["ai-gateway.vercel.sh"]
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
/** The Cursor SDK's `McpServerConfig` shape. */
|
|
281
|
-
function cursorMcpServers(servers) {
|
|
282
|
-
return Object.fromEntries(Object.entries(servers).map(([name, s]) => s.transport === "stdio" ? [name, {
|
|
283
|
-
type: "stdio",
|
|
284
|
-
command: s.command,
|
|
285
|
-
args: s.args,
|
|
286
|
-
env: s.env
|
|
287
|
-
}] : [name, {
|
|
288
|
-
type: s.transport,
|
|
289
|
-
url: s.url,
|
|
290
|
-
headers: s.headers
|
|
291
|
-
}]));
|
|
292
|
-
}
|
|
293
|
-
/** Claude Code's hook events as Cursor names them, as the Cursor SDK converts Claude Code's own. */
|
|
294
|
-
const CURSOR_HOOK_EVENTS = {
|
|
295
|
-
SessionStart: "sessionStart",
|
|
296
|
-
SessionEnd: "sessionEnd",
|
|
297
|
-
UserPromptSubmit: "beforeSubmitPrompt",
|
|
298
|
-
PreToolUse: "preToolUse",
|
|
299
|
-
PostToolUse: "postToolUse",
|
|
300
|
-
SubagentStop: "subagentStop",
|
|
301
|
-
PreCompact: "preCompact",
|
|
302
|
-
Stop: "stop"
|
|
303
|
-
};
|
|
304
|
-
/** Claude Code's tool names as Cursor's hooks match them; null for one Cursor has no tool for. */
|
|
305
|
-
const CURSOR_HOOK_TOOLS = {
|
|
306
|
-
Bash: "Shell",
|
|
307
|
-
Read: "Read",
|
|
308
|
-
Write: "Write",
|
|
309
|
-
Edit: "Write",
|
|
310
|
-
Glob: null,
|
|
311
|
-
Grep: "Grep",
|
|
312
|
-
WebFetch: "WebFetch",
|
|
313
|
-
WebSearch: "WebSearch",
|
|
314
|
-
Task: "Task"
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* A Claude Code hook group's tool matcher as Cursor's, on the tool events only: each name mapped,
|
|
318
|
-
* `mcp__<server>__<tool>` as `MCP:<tool>`; null when it names only tools Cursor lacks.
|
|
319
|
-
*/
|
|
320
|
-
function cursorHookMatcher(event, matcher) {
|
|
321
|
-
if (event !== "PreToolUse" && event !== "PostToolUse") return void 0;
|
|
322
|
-
if (!matcher || matcher === "*") return void 0;
|
|
323
|
-
const out = [];
|
|
324
|
-
for (const raw of matcher.split("|")) {
|
|
325
|
-
const name = raw.trim();
|
|
326
|
-
const parts = name.split("__");
|
|
327
|
-
const tool = name.startsWith("mcp__") && parts.length >= 3 ? `MCP:${parts.slice(2).join("__")}` : CURSOR_HOOK_TOOLS[name] === void 0 ? name : CURSOR_HOOK_TOOLS[name];
|
|
328
|
-
if (tool && !out.includes(tool)) out.push(tool);
|
|
329
|
-
}
|
|
330
|
-
return out.length ? out.join("|") : null;
|
|
331
|
-
}
|
|
332
|
-
/** Where Cursor reads what reeval unpacks from a plugin, in the workspace (settingSources `project`). */
|
|
333
|
-
const CURSOR_PLUGIN_UNPACK = {
|
|
334
|
-
rules: ".cursor/rules",
|
|
335
|
-
agents: ".cursor/agents",
|
|
336
|
-
commands: ".cursor/commands",
|
|
337
|
-
hooks: {
|
|
338
|
-
file: ".cursor/hooks.json",
|
|
339
|
-
events: CURSOR_HOOK_EVENTS,
|
|
340
|
-
matcher: cursorHookMatcher
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* A plugin subagent's or command's frontmatter as OpenCode 2 takes it: the description, and a
|
|
345
|
-
* subagent's `mode`. OpenCode skips a file whose frontmatter its schema refuses, without saying,
|
|
346
|
-
* and Claude Code's `tools: Read, Grep`, `model: sonnet` and `allowed-tools` are such keys.
|
|
347
|
-
*/
|
|
348
|
-
function opencodeFrontmatter(part, front) {
|
|
349
|
-
const d = front.description;
|
|
350
|
-
const description = typeof d === "string" || typeof d === "number" || typeof d === "boolean" ? String(d) : void 0;
|
|
351
|
-
return {
|
|
352
|
-
...description ? { description } : {},
|
|
353
|
-
...part === "agents" ? { mode: "subagent" } : {}
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
/** Where OpenCode reads plugin subagents and commands, in the workspace's config directory. */
|
|
357
|
-
const OPENCODE_PLUGIN_UNPACK = {
|
|
358
|
-
agents: ".opencode/agents",
|
|
359
|
-
commands: ".opencode/commands",
|
|
360
|
-
frontmatter: opencodeFrontmatter
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
363
|
-
* Where pi reads plugin commands, as prompt templates (`/<name>`), in the workspace, which its
|
|
364
|
-
* `--approve` trusts. Its frontmatter takes `description` and `argument-hint`, and ignores the
|
|
365
|
-
* rest of Claude Code's.
|
|
366
|
-
*/
|
|
367
|
-
const PI_PLUGIN_UNPACK = { commands: ".pi/prompts" };
|
|
368
|
-
/**
|
|
369
|
-
* What Claude Code's plugin format bundles, which Grok Build reads too: every part but rules,
|
|
370
|
-
* which neither loads from a plugin.
|
|
371
|
-
*/
|
|
372
|
-
const CLAUDE_FORMAT_PARTS = PLUGIN_PARTS.filter((p) => p !== "rules");
|
|
373
|
-
/** The marketplace Claude Code's settings name for the session's plugins. */
|
|
374
|
-
const CLAUDE_PLUGIN_MARKETPLACE = "reeval";
|
|
375
|
-
/**
|
|
376
|
-
* Claude Code's settings for the session's plugins: a `directory` marketplace at the directory
|
|
377
|
-
* they were copied to, listing each, and each enabled as `<plugin>@reeval`. Claude Code installs
|
|
378
|
-
* and loads them as it starts, since the bridge leaves every settings source on.
|
|
379
|
-
*/
|
|
380
|
-
function claudePluginFiles(plugins) {
|
|
381
|
-
const [first] = plugins;
|
|
382
|
-
if (!first) return [];
|
|
383
|
-
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
384
|
-
const marketplace = {
|
|
385
|
-
name: CLAUDE_PLUGIN_MARKETPLACE,
|
|
386
|
-
owner: { name: "reeval" },
|
|
387
|
-
plugins: plugins.map((p) => ({
|
|
388
|
-
name: p.name,
|
|
389
|
-
source: `./${p.name}`
|
|
390
|
-
}))
|
|
391
|
-
};
|
|
392
|
-
const settings = {
|
|
393
|
-
extraKnownMarketplaces: { [CLAUDE_PLUGIN_MARKETPLACE]: { source: {
|
|
394
|
-
source: "directory",
|
|
395
|
-
path: first.dir.slice(0, first.dir.lastIndexOf("/"))
|
|
396
|
-
} } },
|
|
397
|
-
enabledPlugins: Object.fromEntries(plugins.map((p) => [`${p.name}@${CLAUDE_PLUGIN_MARKETPLACE}`, true]))
|
|
398
|
-
};
|
|
399
|
-
return [{
|
|
400
|
-
path: `${PLUGIN_DIR}/.claude-plugin/marketplace.json`,
|
|
401
|
-
content: json(marketplace)
|
|
402
|
-
}, {
|
|
403
|
-
path: "~/.claude/settings.json",
|
|
404
|
-
content: json(settings),
|
|
405
|
-
merge: true
|
|
406
|
-
}];
|
|
407
|
-
}
|
|
408
|
-
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
409
|
-
/**
|
|
410
|
-
* Writes the layout's plugin files into the sandbox and returns their paths. A `merge` file's keys
|
|
411
|
-
* go into the JSON object already at its path (an object-valued key merged one level down), so
|
|
412
|
-
* settings an environment's `files` wrote there stay.
|
|
413
|
-
*/
|
|
414
|
-
async function writePluginFiles(sandbox, layout, plugins) {
|
|
415
|
-
const written = [];
|
|
416
|
-
for (const f of layout.pluginFiles?.(plugins) ?? []) {
|
|
417
|
-
const existing = f.merge ? await sandbox.readFile(f.path) : null;
|
|
418
|
-
let content = f.content;
|
|
419
|
-
if (existing?.trim()) {
|
|
420
|
-
let base;
|
|
421
|
-
try {
|
|
422
|
-
base = JSON.parse(existing);
|
|
423
|
-
} catch {}
|
|
424
|
-
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`);
|
|
425
|
-
const ours = JSON.parse(f.content);
|
|
426
|
-
const merged = { ...base };
|
|
427
|
-
for (const [k, v] of Object.entries(ours)) {
|
|
428
|
-
const was = base[k];
|
|
429
|
-
merged[k] = isObject(v) && isObject(was) ? {
|
|
430
|
-
...was,
|
|
431
|
-
...v
|
|
432
|
-
} : v;
|
|
433
|
-
}
|
|
434
|
-
content = `${JSON.stringify(merged, null, 2)}\n`;
|
|
435
|
-
}
|
|
436
|
-
await sandbox.writeFile(f.path, content);
|
|
437
|
-
written.push(f.path);
|
|
438
|
-
}
|
|
439
|
-
return written;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* The MCP servers the agent is given: all of them, less the plugins' own where it takes plugin
|
|
443
|
-
* items namespaced, since it loads those from the plugin and would otherwise start each twice.
|
|
444
|
-
*/
|
|
445
|
-
function agentMcp(layout, mcp, plugins) {
|
|
446
|
-
if (layout.pluginPlacement !== "namespaced") return mcp;
|
|
447
|
-
const own = new Set(plugins.flatMap((p) => p.servers));
|
|
448
|
-
return Object.fromEntries(Object.entries(mcp).filter(([name]) => !own.has(name)));
|
|
449
|
-
}
|
|
450
|
-
/** Where each agent with an image reads rules and skills. */
|
|
451
|
-
const LAYOUTS = {
|
|
452
|
-
cursor: {
|
|
453
|
-
rulesFile: "AGENTS.md",
|
|
454
|
-
workspaceSkillDir: ".cursor/skills",
|
|
455
|
-
harnessSkillDir: ".agents/skills",
|
|
456
|
-
pluginPlacement: "flat",
|
|
457
|
-
pluginUnpack: CURSOR_PLUGIN_UNPACK,
|
|
458
|
-
pluginHookEvents: Object.keys(CURSOR_HOOK_EVENTS)
|
|
459
|
-
},
|
|
460
|
-
"claude-code": {
|
|
461
|
-
rulesFile: "CLAUDE.md",
|
|
462
|
-
workspaceSkillDir: ".claude/skills",
|
|
463
|
-
harnessSkillDir: ".claude/skills",
|
|
464
|
-
pluginPlacement: "namespaced",
|
|
465
|
-
pluginFiles: claudePluginFiles
|
|
466
|
-
},
|
|
467
|
-
antigravity: {
|
|
468
|
-
rulesFile: "AGENTS.md",
|
|
469
|
-
workspaceSkillDir: ".agents/skills",
|
|
470
|
-
harnessSkillDir: ".gemini/config/skills",
|
|
471
|
-
pluginPlacement: "namespaced",
|
|
472
|
-
pluginHookEvents: [
|
|
473
|
-
"SessionStart",
|
|
474
|
-
"PreToolUse",
|
|
475
|
-
"PostToolUse",
|
|
476
|
-
"Stop"
|
|
477
|
-
]
|
|
478
|
-
},
|
|
479
|
-
opencode: {
|
|
480
|
-
rulesFile: "AGENTS.md",
|
|
481
|
-
workspaceSkillDir: ".opencode/skills",
|
|
482
|
-
harnessSkillDir: ".config/opencode/skills",
|
|
483
|
-
pluginPlacement: "flat",
|
|
484
|
-
pluginUnpack: OPENCODE_PLUGIN_UNPACK
|
|
485
|
-
},
|
|
486
|
-
goose: {
|
|
487
|
-
rulesFile: "AGENTS.md",
|
|
488
|
-
workspaceSkillDir: ".goose/skills",
|
|
489
|
-
harnessSkillDir: ".ai-sdk-harness/.harness-bootstrap/goose/implementation/home/.config/goose/skills",
|
|
490
|
-
pluginPlacement: "flat"
|
|
491
|
-
},
|
|
492
|
-
pi: {
|
|
493
|
-
rulesFile: "AGENTS.md",
|
|
494
|
-
workspaceSkillDir: ".pi/skills",
|
|
495
|
-
harnessSkillDir: ".pi/agent/skills",
|
|
496
|
-
pluginPlacement: "flat",
|
|
497
|
-
pluginUnpack: PI_PLUGIN_UNPACK
|
|
498
|
-
},
|
|
499
|
-
codex: {
|
|
500
|
-
rulesFile: "AGENTS.md",
|
|
501
|
-
workspaceSkillDir: ".agents/skills",
|
|
502
|
-
harnessSkillDir: ".agents/skills",
|
|
503
|
-
pluginPlacement: "namespaced"
|
|
504
|
-
},
|
|
505
|
-
fx: {
|
|
506
|
-
rulesFile: "AGENTS.md",
|
|
507
|
-
workspaceSkillDir: ".fx/skills",
|
|
508
|
-
harnessSkillDir: ".ai-sdk-harness/.harness-bootstrap/fx/implementation/home/.fx/skills",
|
|
509
|
-
pluginPlacement: "flat"
|
|
510
|
-
},
|
|
511
|
-
"grok-build": {
|
|
512
|
-
rulesFile: "AGENTS.md",
|
|
513
|
-
workspaceSkillDir: ".grok/skills",
|
|
514
|
-
harnessSkillDir: ".ai-sdk-harness/.harness-bootstrap/grok-build/implementation/home/.grok/skills",
|
|
515
|
-
pluginPlacement: "namespaced"
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
/** Every real agent reeval can drive, by harness kind. */
|
|
519
|
-
const AGENTS = {
|
|
520
|
-
cursor: {
|
|
521
|
-
...LAYOUTS.cursor,
|
|
522
|
-
pluginParts: PLUGIN_PARTS,
|
|
523
|
-
name: "Cursor",
|
|
524
|
-
factory: "cursor",
|
|
525
|
-
credential: "CURSOR_API_KEY",
|
|
526
|
-
endpoints: [CURSOR_EXCHANGE],
|
|
527
|
-
tokens: {
|
|
528
|
-
endpoint: CURSOR_EXCHANGE,
|
|
529
|
-
fields: ["accessToken", "refreshToken"],
|
|
530
|
-
hosts: ["cursor.sh", "*.cursor.sh"]
|
|
531
|
-
},
|
|
532
|
-
unreported: cursorUnreported,
|
|
533
|
-
mcpServers: cursorMcpServers,
|
|
534
|
-
adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-C0xowZ3C.js")).createCursorSdk({
|
|
535
|
-
auth,
|
|
536
|
-
...mcpServers ? { mcpServers } : {},
|
|
537
|
-
...descriptor.kind === "cursor" && descriptor.params ? { modelParams: descriptor.params } : {},
|
|
538
|
-
...descriptor.kind === "cursor" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
539
|
-
requireCredentialBrokering: true
|
|
540
|
-
})
|
|
541
|
-
},
|
|
542
|
-
"claude-code": {
|
|
543
|
-
...LAYOUTS["claude-code"],
|
|
544
|
-
pluginParts: CLAUDE_FORMAT_PARTS,
|
|
545
|
-
name: "Claude Code",
|
|
546
|
-
factory: "claudeCode",
|
|
547
|
-
credential: "ANTHROPIC_API_KEY",
|
|
548
|
-
endpoints: [
|
|
549
|
-
{
|
|
550
|
-
host: "api.anthropic.com",
|
|
551
|
-
path: { exact: "/v1/messages" },
|
|
552
|
-
method: ["POST"]
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
host: "api.anthropic.com",
|
|
556
|
-
path: { exact: "/v1/messages/count_tokens" },
|
|
557
|
-
method: ["POST"]
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
host: "api.anthropic.com",
|
|
561
|
-
path: { exact: "/api/claude_code/settings" },
|
|
562
|
-
method: ["GET"]
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
host: "api.anthropic.com",
|
|
566
|
-
path: { exact: "/api/claude_code/policy_limits" },
|
|
567
|
-
method: ["GET"]
|
|
568
|
-
}
|
|
569
|
-
],
|
|
570
|
-
mcpServers: claudeMcpServers,
|
|
571
|
-
adapter: async ({ auth, mcpServers, descriptor }) => (await import("./dist-CMjp3qqF.js")).createClaudeCode({
|
|
572
|
-
auth,
|
|
573
|
-
...mcpServers ? { mcpServers } : {},
|
|
574
|
-
...descriptor.kind === "claude-code" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
575
|
-
env: {
|
|
576
|
-
IS_SANDBOX: "1",
|
|
577
|
-
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"
|
|
578
|
-
}
|
|
579
|
-
})
|
|
580
|
-
},
|
|
581
|
-
antigravity: {
|
|
582
|
-
...LAYOUTS.antigravity,
|
|
583
|
-
pluginParts: PLUGIN_PARTS,
|
|
584
|
-
pluginManifestsFirst: [
|
|
585
|
-
"plugin.json",
|
|
586
|
-
".antigravity-plugin/plugin.json",
|
|
587
|
-
".gemini-plugin/plugin.json",
|
|
588
|
-
"gemini-extension.json"
|
|
589
|
-
],
|
|
590
|
-
name: "Antigravity",
|
|
591
|
-
factory: "antigravity",
|
|
592
|
-
credential: "GEMINI_API_KEY",
|
|
593
|
-
endpoints: GEMINI_ENDPOINTS,
|
|
594
|
-
expectedBlocked: {
|
|
595
|
-
hosts: ["play.googleapis.com", "antigravity-unleash.goog"],
|
|
596
|
-
why: "Antigravity's telemetry and feature flags, which its CLI sends even with telemetry off"
|
|
597
|
-
},
|
|
598
|
-
servedModel: geminiServedModel,
|
|
599
|
-
mcpServers: antigravityMcpServers,
|
|
600
|
-
adapter: async ({ auth, mcpServers, descriptor, plugins }) => (await import("./src-bCnsA6Vp.js")).createAntigravity({
|
|
601
|
-
auth,
|
|
602
|
-
...mcpServers ? { mcpServers } : {},
|
|
603
|
-
...plugins.length ? { plugins: plugins.map(({ name, dir }) => ({
|
|
604
|
-
name,
|
|
605
|
-
dir
|
|
606
|
-
})) } : {},
|
|
607
|
-
...descriptor.kind === "antigravity" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
608
|
-
requireCredentialBrokering: true
|
|
609
|
-
})
|
|
610
|
-
},
|
|
611
|
-
opencode: {
|
|
612
|
-
...LAYOUTS.opencode,
|
|
613
|
-
pluginParts: [
|
|
614
|
-
"skills",
|
|
615
|
-
"agents",
|
|
616
|
-
"commands",
|
|
617
|
-
"mcp"
|
|
618
|
-
],
|
|
619
|
-
name: "OpenCode",
|
|
620
|
-
factory: "opencode",
|
|
621
|
-
credential: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
622
|
-
endpoints: GEMINI_ENDPOINTS,
|
|
623
|
-
servedModel: geminiServedModel,
|
|
624
|
-
forModel: opencodeForModel,
|
|
625
|
-
mcpServers: opencodeMcpServers,
|
|
626
|
-
adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-Bcah6ZkT.js")).createOpenCode({
|
|
627
|
-
auth,
|
|
628
|
-
model: descriptor.model,
|
|
629
|
-
vars: opencodeVars(descriptor.model),
|
|
630
|
-
...descriptor.kind === "opencode" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
631
|
-
...mcpServers ? { mcpServers } : {},
|
|
632
|
-
requireCredentialBrokering: true
|
|
633
|
-
})
|
|
634
|
-
},
|
|
635
|
-
goose: {
|
|
636
|
-
...LAYOUTS.goose,
|
|
637
|
-
pluginParts: ["skills", "mcp"],
|
|
638
|
-
name: "Goose",
|
|
639
|
-
factory: "goose",
|
|
640
|
-
credential: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
641
|
-
endpoints: GOOSE_ENDPOINTS,
|
|
642
|
-
expectedBlocked: {
|
|
643
|
-
hosts: ["models.dev"],
|
|
644
|
-
why: "Goose's model catalogue refresh, which no setting turns off"
|
|
645
|
-
},
|
|
646
|
-
servedModel: geminiServedModel,
|
|
647
|
-
mcpServers: gooseMcpServers,
|
|
648
|
-
adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-DPIjmReZ.js")).createGoose({
|
|
649
|
-
auth: { GOOGLE_API_KEY: auth.GOOGLE_GENERATIVE_AI_API_KEY ?? "" },
|
|
650
|
-
model: descriptor.model,
|
|
651
|
-
...descriptor.kind === "goose" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
652
|
-
...mcpServers ? { mcpServers } : {},
|
|
653
|
-
requireCredentialBrokering: true
|
|
654
|
-
})
|
|
655
|
-
},
|
|
656
|
-
pi: {
|
|
657
|
-
...LAYOUTS.pi,
|
|
658
|
-
pluginParts: [
|
|
659
|
-
"skills",
|
|
660
|
-
"commands",
|
|
661
|
-
"mcp"
|
|
662
|
-
],
|
|
663
|
-
name: "pi",
|
|
664
|
-
factory: "pi",
|
|
665
|
-
credential: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
666
|
-
endpoints: GEMINI_ENDPOINTS,
|
|
667
|
-
servedModel: geminiServedModel,
|
|
668
|
-
mcpServers: piMcpServers,
|
|
669
|
-
adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-ynBVosfX.js")).createPi({
|
|
670
|
-
auth: { GEMINI_API_KEY: auth.GOOGLE_GENERATIVE_AI_API_KEY ?? "" },
|
|
671
|
-
...descriptor.kind === "pi" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
672
|
-
...mcpServers ? { mcpServers } : {},
|
|
673
|
-
requireCredentialBrokering: true
|
|
674
|
-
})
|
|
675
|
-
},
|
|
676
|
-
codex: {
|
|
677
|
-
...LAYOUTS.codex,
|
|
678
|
-
pluginParts: ["skills", "mcp"],
|
|
679
|
-
pluginApps: "they need a ChatGPT login",
|
|
680
|
-
pluginManifestsFirst: ["plugin.json", ".codex-plugin/plugin.json"],
|
|
681
|
-
pluginRootManifestNeedsSchema: true,
|
|
682
|
-
pluginServersByName: true,
|
|
683
|
-
name: "Codex",
|
|
684
|
-
factory: "codex",
|
|
685
|
-
credential: "OPENAI_API_KEY",
|
|
686
|
-
endpoints: OPENAI_ENDPOINTS,
|
|
687
|
-
modelResponses: OPENAI_ENDPOINTS,
|
|
688
|
-
expectedBlocked: {
|
|
689
|
-
hosts: [
|
|
690
|
-
"github.com",
|
|
691
|
-
"api.github.com",
|
|
692
|
-
"chatgpt.com"
|
|
693
|
-
],
|
|
694
|
-
why: "Codex's plugin sync, which it runs on every turn once plugins are on",
|
|
695
|
-
withPlugins: true
|
|
696
|
-
},
|
|
697
|
-
servedModel: openaiServedModel,
|
|
698
|
-
mcpServers: codexMcpServers,
|
|
699
|
-
adapter: async ({ auth, mcpServers, descriptor, plugins }) => (await import("./src-DLtyz4w5.js")).createCodex({
|
|
700
|
-
auth,
|
|
701
|
-
...descriptor.kind === "codex" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
702
|
-
...mcpServers ? { mcpServers } : {},
|
|
703
|
-
...plugins.length ? { plugins: plugins.map(({ name, dir }) => ({
|
|
704
|
-
name,
|
|
705
|
-
dir
|
|
706
|
-
})) } : {},
|
|
707
|
-
requireCredentialBrokering: true
|
|
708
|
-
})
|
|
709
|
-
},
|
|
710
|
-
fx: {
|
|
711
|
-
...LAYOUTS.fx,
|
|
712
|
-
pluginParts: ["skills", "mcp"],
|
|
713
|
-
name: "fx",
|
|
714
|
-
factory: "fx",
|
|
715
|
-
...fxForModel("provider/model"),
|
|
716
|
-
forModel: fxForModel,
|
|
717
|
-
mcpServers: acpMcpServers,
|
|
718
|
-
adapter: async ({ auth, mcpServers, descriptor }) => (await import("./src-DXNh5mTr.js")).createFx({
|
|
719
|
-
auth,
|
|
720
|
-
model: descriptor.model,
|
|
721
|
-
...mcpServers ? { mcpServers } : {},
|
|
722
|
-
requireCredentialBrokering: true
|
|
723
|
-
})
|
|
724
|
-
},
|
|
725
|
-
"grok-build": {
|
|
726
|
-
...LAYOUTS["grok-build"],
|
|
727
|
-
pluginParts: CLAUDE_FORMAT_PARTS,
|
|
728
|
-
pluginServersByName: true,
|
|
729
|
-
name: "Grok Build",
|
|
730
|
-
factory: "grokBuild",
|
|
731
|
-
credential: "XAI_API_KEY",
|
|
732
|
-
endpoints: XAI_ENDPOINTS,
|
|
733
|
-
modelResponses: XAI_MODEL_RESPONSES,
|
|
734
|
-
servedModel: xaiServedModel,
|
|
735
|
-
mcpServers: acpMcpServers,
|
|
736
|
-
adapter: async ({ auth, mcpServers, descriptor, plugins }) => (await import("./src-CHIfIKUu.js")).createGrokBuild({
|
|
737
|
-
auth,
|
|
738
|
-
model: descriptor.model,
|
|
739
|
-
...plugins.length ? {
|
|
740
|
-
pluginDirs: plugins.map((p) => p.dir),
|
|
741
|
-
pluginMcpServers: plugins.flatMap((p) => p.servers.map((s) => s.slice(p.name.length + 1)))
|
|
742
|
-
} : {},
|
|
743
|
-
...descriptor.kind === "grok-build" && descriptor.effort ? { effort: descriptor.effort } : {},
|
|
744
|
-
...mcpServers ? { mcpServers } : {},
|
|
745
|
-
requireCredentialBrokering: true
|
|
746
|
-
})
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
/** The harness of a config that names none: Cursor, on Cursor's own model. */
|
|
750
|
-
const DEFAULT_HARNESS = {
|
|
751
|
-
kind: "cursor",
|
|
752
|
-
model: "composer-2.5"
|
|
753
|
-
};
|
|
754
|
-
/** A harness to name in messages that ask for one. */
|
|
755
|
-
const HARNESS_EXAMPLE = "cursor({ model: 'composer-2.5' })";
|
|
756
|
-
const isAgentKind = (kind) => typeof kind === "string" && Object.hasOwn(AGENTS, kind);
|
|
757
|
-
/**
|
|
758
|
-
* Why a harness's agent can't take the environment's MCP servers (Goose, OpenCode, pi and Codex
|
|
759
|
-
* take no `mcp.sse`), in the agent's own words, so the plan refuses them before any attempt
|
|
760
|
-
* starts; undefined when it can.
|
|
761
|
-
*/
|
|
762
|
-
function refusedMcp(harness, layers) {
|
|
763
|
-
if (!isAgentKind(harness.kind)) return void 0;
|
|
764
|
-
const servers = /* @__PURE__ */ new Map();
|
|
765
|
-
for (const { spec } of layers) for (const [name, server] of Object.entries(spec.mcp ?? {})) servers.set(name, server.transport === "stdio" ? {
|
|
766
|
-
...server,
|
|
767
|
-
env: {}
|
|
768
|
-
} : {
|
|
769
|
-
...server,
|
|
770
|
-
headers: {}
|
|
771
|
-
});
|
|
772
|
-
if (servers.size === 0) return void 0;
|
|
773
|
-
try {
|
|
774
|
-
AGENTS[harness.kind].mcpServers(Object.fromEntries(servers));
|
|
775
|
-
return;
|
|
776
|
-
} catch (error) {
|
|
777
|
-
if (error instanceof InfraError) return error.message;
|
|
778
|
-
throw error;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
/** The first host variable a plugin MCP server reads (`${VAR}`), as `VAR`; undefined for none. */
|
|
782
|
-
function hostVariable(s) {
|
|
783
|
-
const values = Object.entries(s.transport === "stdio" ? s.env : s.headers);
|
|
784
|
-
for (const [key, v] of values) {
|
|
785
|
-
if (typeof v === "string") continue;
|
|
786
|
-
if (v.kind === "secret") return v.from ?? key;
|
|
787
|
-
return /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/.exec(v.template)?.[1] ?? key;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
const quoted = (parts) => parts.map((p) => `'${p}'`).join(", ");
|
|
791
|
-
/**
|
|
792
|
-
* Why a harness's agent can't take the plugins, in the agent's own words: a part it doesn't
|
|
793
|
-
* load, apps it can't take (`pluginApps`), a hook event or type it doesn't run, a plugin MCP
|
|
794
|
-
* server it refuses (named `<plugin>:<server>`) or whose `<plugin>:<server>` key `mcp` already has,
|
|
795
|
-
* or, where it takes plugin items flat, a skill or MCP server whose name another already has, or a
|
|
796
|
-
* subagent, command or rule another unpacks to the same file. `own` names the
|
|
797
|
-
* environment's own skills and MCP servers, and `unread` the plugins not fetched yet (git and
|
|
798
|
-
* npm ones, at plan time) by their call. Undefined when it can take them.
|
|
799
|
-
*/
|
|
800
|
-
function refusedPlugins(harness, plugins, own, unread = []) {
|
|
801
|
-
if (plugins.length === 0 && unread.length === 0) return void 0;
|
|
802
|
-
const agent = isAgentKind(harness.kind) ? AGENTS[harness.kind] : void 0;
|
|
803
|
-
const mimics = harness.kind === "fake" && harness.layout ? AGENTS[harness.layout] : void 0;
|
|
804
|
-
const loads = (agent ?? mimics)?.pluginParts ?? PLUGIN_PARTS;
|
|
805
|
-
const name = agent?.name ?? (mimics ? `The fake agent with ${mimics.name}'s layout` : "The fake agent");
|
|
806
|
-
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`;
|
|
807
|
-
for (const p of plugins) {
|
|
808
|
-
const refused = p.kept.filter((part) => !loads.includes(part));
|
|
809
|
-
if (refused.length === 0) continue;
|
|
810
|
-
const can = p.kept.filter((part) => loads.includes(part));
|
|
811
|
-
const what = refused.map((part) => `${part} (${PART_PATHS[part]})`).join(" and ");
|
|
812
|
-
const fix = can.length ? `use only: [${quoted(can)}], or leave` : "leave";
|
|
813
|
-
return `${name} can't load the ${p.name} plugin's ${what}: ${fix} the plugin out of this cell`;
|
|
814
|
-
}
|
|
815
|
-
const reads = agent ?? mimics;
|
|
816
|
-
const first = reads?.pluginManifestsFirst ?? [];
|
|
817
|
-
for (const p of plugins) {
|
|
818
|
-
const other = p.manifests.find((m) => first.includes(m) && (m !== "plugin.json" || !reads?.pluginRootManifestNeedsSchema || p.rootSchema));
|
|
819
|
-
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`;
|
|
820
|
-
}
|
|
821
|
-
const apps = (agent ?? mimics)?.pluginApps;
|
|
822
|
-
const withApps = apps ? plugins.find((p) => p.apps) : void 0;
|
|
823
|
-
if (withApps) return `${name} can't load the ${withApps.name} plugin's apps: ${apps}`;
|
|
824
|
-
const layout = layoutOf(harness);
|
|
825
|
-
const runs = layout.pluginHookEvents;
|
|
826
|
-
for (const p of runs ? plugins : []) {
|
|
827
|
-
const event = p.hooks.events.find((e) => !runs?.includes(e));
|
|
828
|
-
const type = p.hooks.otherTypes[0];
|
|
829
|
-
if (!event && !type) continue;
|
|
830
|
-
const rest = p.kept.filter((part) => part !== "hooks");
|
|
831
|
-
const fix = rest.length ? `use only: [${quoted(rest)}], or leave` : "leave";
|
|
832
|
-
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`;
|
|
833
|
-
}
|
|
834
|
-
const servers = Object.fromEntries(plugins.flatMap((p) => Object.entries(p.mcp).map(([server, s]) => [pluginServerName(p.name, server), s.transport === "stdio" ? {
|
|
835
|
-
...s,
|
|
836
|
-
env: {}
|
|
837
|
-
} : {
|
|
838
|
-
...s,
|
|
839
|
-
headers: {}
|
|
840
|
-
}])));
|
|
841
|
-
if (agent && Object.keys(servers).length) {
|
|
842
|
-
const alongside = agent.pluginPlacement === "flat" ? Object.fromEntries(own.mcp.map((n) => [n, {
|
|
843
|
-
transport: "stdio",
|
|
844
|
-
command: "true",
|
|
845
|
-
args: [],
|
|
846
|
-
env: {}
|
|
847
|
-
}])) : {};
|
|
848
|
-
try {
|
|
849
|
-
agent.mcpServers({
|
|
850
|
-
...alongside,
|
|
851
|
-
...servers
|
|
852
|
-
});
|
|
853
|
-
} catch (error) {
|
|
854
|
-
if (error instanceof InfraError) return error.message;
|
|
855
|
-
throw error;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
for (const p of plugins) for (const server of Object.keys(p.mcp)) {
|
|
859
|
-
const key = pluginServerName(p.name, server);
|
|
860
|
-
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}"]`;
|
|
861
|
-
}
|
|
862
|
-
if (layout.pluginPlacement === "namespaced") {
|
|
863
|
-
for (const p of plugins) {
|
|
864
|
-
if (!p.kept.includes("mcp")) continue;
|
|
865
|
-
for (const [server, s] of Object.entries(p.mcp)) {
|
|
866
|
-
const secret = hostVariable(s);
|
|
867
|
-
if (!secret) continue;
|
|
868
|
-
const rest = p.kept.filter((part) => part !== "mcp");
|
|
869
|
-
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`;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
if (!(agent ?? mimics)?.pluginServersByName) return void 0;
|
|
873
|
-
const byName = new Map(own.mcp.map((n) => [n, `mcp.${n}`]));
|
|
874
|
-
for (const p of plugins) for (const server of Object.keys(p.mcp)) {
|
|
875
|
-
const other = byName.get(server);
|
|
876
|
-
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`;
|
|
877
|
-
byName.set(server, `the ${p.name} plugin's MCP server "${server}"`);
|
|
878
|
-
}
|
|
879
|
-
return;
|
|
880
|
-
}
|
|
881
|
-
const serverOwner = new Map(own.mcp.map((n) => [n, `mcp.${n}`]));
|
|
882
|
-
for (const p of plugins) for (const server of Object.keys(p.mcp)) {
|
|
883
|
-
const other = serverOwner.get(server);
|
|
884
|
-
if (other) return `the ${p.name} plugin's MCP server "${server}" clashes with ${other}`;
|
|
885
|
-
serverOwner.set(server, `the ${p.name} plugin's MCP server "${server}"`);
|
|
886
|
-
}
|
|
887
|
-
const skillOwner = new Map(own.skills.map((s) => [s.name, `${s.call}'s "${s.name}"`]));
|
|
888
|
-
for (const p of plugins) for (const { name: skill } of p.skills) {
|
|
889
|
-
const other = skillOwner.get(skill);
|
|
890
|
-
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`;
|
|
891
|
-
skillOwner.set(skill, `the ${p.name} plugin's skill "${skill}"`);
|
|
892
|
-
}
|
|
893
|
-
for (const part of ["agents", "commands"]) {
|
|
894
|
-
const dir = layout.pluginUnpack?.[part];
|
|
895
|
-
if (!dir) continue;
|
|
896
|
-
const owner = /* @__PURE__ */ new Map();
|
|
897
|
-
for (const p of plugins) for (const item of p[part]) {
|
|
898
|
-
const other = owner.get(item);
|
|
899
|
-
const what = part === "agents" ? "subagent" : "command";
|
|
900
|
-
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`;
|
|
901
|
-
owner.set(item, p.name);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
const rules = layout.pluginUnpack?.rules;
|
|
905
|
-
const ruleOwner = /* @__PURE__ */ new Map();
|
|
906
|
-
for (const p of rules ? plugins : []) for (const rule of p.rules) {
|
|
907
|
-
const file = `${p.name}-${rule.replace(/\.mdc?$/, "")}.mdc`;
|
|
908
|
-
const what = `the ${p.name} plugin's rule "${rule}"`;
|
|
909
|
-
const other = ruleOwner.get(file);
|
|
910
|
-
if (other) return `${what} and ${other} would both be placed at ${rules}/${file}: rename one, or narrow one with only`;
|
|
911
|
-
ruleOwner.set(file, what);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
/** A real agent's catalog entry, with what its model's provider decides. */
|
|
915
|
-
function agentFor(h) {
|
|
916
|
-
const agent = AGENTS[h.kind];
|
|
917
|
-
return agent.forModel ? {
|
|
918
|
-
...agent,
|
|
919
|
-
...agent.forModel(h.model)
|
|
920
|
-
} : agent;
|
|
921
|
-
}
|
|
922
|
-
/** The catalog entry for a harness's agent; undefined for the fake harness. */
|
|
923
|
-
const agentOf = (h) => h.kind === "fake" ? void 0 : agentFor(h);
|
|
924
|
-
/** The host variable a harness authenticates with; undefined for the fake harness. */
|
|
925
|
-
const credentialOf = (h) => agentOf(h)?.credential;
|
|
926
|
-
/** The fake agent's own layout. */
|
|
927
|
-
const FAKE_LAYOUT = {
|
|
928
|
-
rulesFile: "AGENTS.md",
|
|
929
|
-
workspaceSkillDir: ".agents/skills",
|
|
930
|
-
harnessSkillDir: ".agents/skills",
|
|
931
|
-
pluginPlacement: "flat"
|
|
932
|
-
};
|
|
933
|
-
/** Where a harness's agent reads rules and skills; a fake one with `layout` mimics that agent. */
|
|
934
|
-
function layoutOf(descriptor) {
|
|
935
|
-
if (descriptor.kind !== "fake") return LAYOUTS[descriptor.kind];
|
|
936
|
-
return descriptor.layout ? LAYOUTS[descriptor.layout] : FAKE_LAYOUT;
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
|
-
* The hosts a harness's agent is known to try in a session with or without plugins; a fake agent
|
|
940
|
-
* with `layout` expects that agent's.
|
|
941
|
-
*/
|
|
942
|
-
function expectedBlockedFor(descriptor, plugins) {
|
|
943
|
-
const kind = descriptor.kind === "fake" ? descriptor.layout : descriptor.kind;
|
|
944
|
-
const expected = kind ? AGENTS[kind].expectedBlocked : void 0;
|
|
945
|
-
return expected?.withPlugins && !plugins ? void 0 : expected;
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* How the APIs behind the harnesses say they refused a key: an HTTP 401, Anthropic's and OpenAI's
|
|
949
|
-
* 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
|
|
950
|
-
* those for reasons that have nothing to do with the harness's key. Grok Build checks its key as
|
|
951
|
-
* it starts and, when xAI refuses it (a 400 or 401, not an outage), offers no `xai.api_key`
|
|
952
|
-
* sign-in, which is all `@ai-sdk/harness-acp` reports.
|
|
953
|
-
*/
|
|
954
|
-
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;
|
|
955
|
-
/** What to do when a harness error says its API refused the key, naming the variable; else undefined. */
|
|
956
|
-
function authHint(agent, message) {
|
|
957
|
-
if (!REFUSED_KEY.test(message)) return void 0;
|
|
958
|
-
return `The API rejected ${agent.credential}: set a valid key in the environment or .env.local`;
|
|
959
|
-
}
|
|
960
|
-
/** The agent's credential from the host, as the adapter's explicit `auth`. Fails closed. */
|
|
961
|
-
function agentAuth(agent, env = process.env) {
|
|
962
|
-
const value = env[agent.credential];
|
|
963
|
-
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.`);
|
|
964
|
-
return { [agent.credential]: value };
|
|
965
|
-
}
|
|
966
|
-
function brokeringFor(h) {
|
|
967
|
-
const agent = agentOf(h);
|
|
968
|
-
if (!agent) return void 0;
|
|
969
|
-
const { credential, endpoints, tokens, servedModel, modelResponses } = agent;
|
|
970
|
-
return {
|
|
971
|
-
credential,
|
|
972
|
-
endpoints,
|
|
973
|
-
...tokens ? { tokens: {
|
|
974
|
-
name: credential,
|
|
975
|
-
...tokens
|
|
976
|
-
} } : {},
|
|
977
|
-
...servedModel ? { servedModel } : {},
|
|
978
|
-
...modelResponses ? { modelResponses } : {}
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
//#endregion
|
|
982
|
-
//#region src/sandbox/fake.ts
|
|
983
|
-
/** Commands run on the host's own network, so the fake sandbox can neither restrict nor see it. */
|
|
984
|
-
const FAKE_EGRESS = {
|
|
985
|
-
enforce: "none",
|
|
986
|
-
record: false
|
|
987
|
-
};
|
|
988
|
-
/**
|
|
989
|
-
* The POSIX shell commands run in: `sh`, which Windows lacks, so there the `sh.exe` on PATH or
|
|
990
|
-
* Git for Windows'.
|
|
991
|
-
*/
|
|
992
|
-
function posixShell(platform = process.platform, env = process.env, exists = existsSync) {
|
|
993
|
-
if (platform !== "win32") return "sh";
|
|
994
|
-
const onPath = (env.PATH ?? env.Path ?? "").split(win32.delimiter).filter(Boolean);
|
|
995
|
-
const git = [
|
|
996
|
-
env.ProgramFiles,
|
|
997
|
-
env["ProgramFiles(x86)"],
|
|
998
|
-
env.LOCALAPPDATA && win32.join(env.LOCALAPPDATA, "Programs")
|
|
999
|
-
].filter((dir) => !!dir).map((dir) => win32.join(dir, "Git", "bin"));
|
|
1000
|
-
const found = [...onPath, ...git].map((dir) => win32.join(dir, "sh.exe")).find(exists);
|
|
1001
|
-
if (found) return found;
|
|
1002
|
-
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().");
|
|
1003
|
-
}
|
|
1004
|
-
const EXEC_TAG = "REEVAL_FAKE_EXEC";
|
|
1005
|
-
const KILL_TAGGED = `for pass in 1 2 3 4 5; do
|
|
1006
|
-
found=
|
|
1007
|
-
for f in $(grep -lzx "${EXEC_TAG}=$1" /proc/[0-9]*/environ 2>/dev/null); do
|
|
1008
|
-
p=\${f#/proc/}; kill -9 "\${p%/environ}" 2>/dev/null; found=1
|
|
1009
|
-
done
|
|
1010
|
-
[ -n "$found" ] || break
|
|
1011
|
-
done`;
|
|
1012
|
-
/**
|
|
1013
|
-
* Stops a command's MSYS processes on Windows. `taskkill /t` doesn't reach them: Git's `sh.exe`
|
|
1014
|
-
* starts bash, whose fork and exec leave each new process's Windows parent gone, so a timed-out
|
|
1015
|
-
* `sleep 30` would run on, holding the command's pipes and working directory.
|
|
1016
|
-
*/
|
|
1017
|
-
function killTagged(sh, tag) {
|
|
1018
|
-
runSh(sh, KILL_TAGGED, tag);
|
|
1019
|
-
}
|
|
1020
|
-
/**
|
|
1021
|
-
* Kills host processes whose cwd is the sandbox, including native `node.exe` `c.serve` starts.
|
|
1022
|
-
* Match only the unique `reeval-sandbox-*` folder name: Git Bash `pwd` and node.exe's
|
|
1023
|
-
* `/proc/cwd` disagree (`/tmp/...` vs `D:\\Users\\...\\Temp\\...`), and an empty
|
|
1024
|
-
* `"$prefix"/*` is `/*`, which SIGKILLs the Windows runner (exit 2304).
|
|
1025
|
-
*/
|
|
1026
|
-
const KILL_UNDER = `cd "$1" || exit 0
|
|
1027
|
-
base=$(pwd -P 2>/dev/null || pwd)
|
|
1028
|
-
name=\${base##*/}
|
|
1029
|
-
case "$name" in
|
|
1030
|
-
reeval-sandbox-?*) ;;
|
|
1031
|
-
*) exit 0 ;;
|
|
1032
|
-
esac
|
|
1033
|
-
for f in /proc/[0-9]*/cwd; do
|
|
1034
|
-
t=$(readlink "$f" 2>/dev/null) || continue
|
|
1035
|
-
case "$t" in
|
|
1036
|
-
*"$name"*) ;;
|
|
1037
|
-
*) continue ;;
|
|
1038
|
-
esac
|
|
1039
|
-
p=\${f#/proc/}; p=\${p%/cwd}
|
|
1040
|
-
[ -n "$p" ] || continue
|
|
1041
|
-
kill -9 "$p" 2>/dev/null
|
|
1042
|
-
wp=$(tr -d '\\r\\n' < /proc/$p/winpid 2>/dev/null)
|
|
1043
|
-
[ -n "$wp" ] && taskkill /F /PID "$wp" >/dev/null 2>&1
|
|
1044
|
-
done`;
|
|
1045
|
-
function runSh(sh, script, arg) {
|
|
1046
|
-
return new Promise((resolve) => {
|
|
1047
|
-
const child = spawn(sh, [
|
|
1048
|
-
"-c",
|
|
1049
|
-
script,
|
|
1050
|
-
"sh",
|
|
1051
|
-
arg
|
|
1052
|
-
], {
|
|
1053
|
-
stdio: "ignore",
|
|
1054
|
-
windowsHide: true
|
|
1055
|
-
});
|
|
1056
|
-
const done = () => resolve();
|
|
1057
|
-
child.on("error", done);
|
|
1058
|
-
child.on("close", done);
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
/** Windows refuses to delete a directory a live process still has as cwd; retry after kills. */
|
|
1062
|
-
async function removeTree(path) {
|
|
1063
|
-
const deadline = Date.now() + 8e3;
|
|
1064
|
-
for (;;) {
|
|
1065
|
-
try {
|
|
1066
|
-
await rm(path, {
|
|
1067
|
-
recursive: true,
|
|
1068
|
-
force: true
|
|
1069
|
-
});
|
|
1070
|
-
if (!existsSync(path)) return;
|
|
1071
|
-
} catch {}
|
|
1072
|
-
if (Date.now() >= deadline) {
|
|
1073
|
-
await rm(path, {
|
|
1074
|
-
recursive: true,
|
|
1075
|
-
force: true
|
|
1076
|
-
}).catch(() => {});
|
|
1077
|
-
return;
|
|
1078
|
-
}
|
|
1079
|
-
await new Promise((r) => setTimeout(r, 50));
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
/**
|
|
1083
|
-
* A temp directory on the host. Commands run unisolated on the host shell, so this is
|
|
1084
|
-
* only meant for tests and for the fake harness.
|
|
1085
|
-
*/
|
|
1086
|
-
async function createFakeSandbox(descriptor, env = {}) {
|
|
1087
|
-
const sh = posixShell();
|
|
1088
|
-
const parent = descriptor.dir ?? tmpdir();
|
|
1089
|
-
await mkdir(parent, { recursive: true });
|
|
1090
|
-
const base = await mkdtemp(join(parent, "reeval-sandbox-"));
|
|
1091
|
-
const workdir = join(base, "work");
|
|
1092
|
-
await mkdir(workdir);
|
|
1093
|
-
const stateDir = `${base}.state`;
|
|
1094
|
-
await mkdir(stateDir);
|
|
1095
|
-
let destroyed;
|
|
1096
|
-
const resolve = (path) => path.startsWith("~/") ? join(base, path.slice(2)) : join(workdir, path);
|
|
1097
|
-
return {
|
|
1098
|
-
workdir,
|
|
1099
|
-
stateDir,
|
|
1100
|
-
execOwn: (command, { signal } = {}) => run(sh, ["-c", command], {
|
|
1101
|
-
cwd: workdir,
|
|
1102
|
-
env: {
|
|
1103
|
-
HOME: base,
|
|
1104
|
-
...env
|
|
1105
|
-
},
|
|
1106
|
-
signal
|
|
1107
|
-
}),
|
|
1108
|
-
exec: (command, { cwd, env: extra, signal } = {}) => {
|
|
1109
|
-
const tag = process.platform === "win32" && signal ? randomUUID() : void 0;
|
|
1110
|
-
const stop = () => killTagged(sh, tag);
|
|
1111
|
-
if (tag) signal?.addEventListener("abort", stop, { once: true });
|
|
1112
|
-
return run(sh, ["-c", cwd ? `cd ${shellQuote(cwd)} && ${command}` : command], {
|
|
1113
|
-
cwd: workdir,
|
|
1114
|
-
env: {
|
|
1115
|
-
HOME: base,
|
|
1116
|
-
...env,
|
|
1117
|
-
...extra,
|
|
1118
|
-
...tag ? { [EXEC_TAG]: tag } : {}
|
|
1119
|
-
},
|
|
1120
|
-
signal
|
|
1121
|
-
}).finally(() => signal?.removeEventListener("abort", stop));
|
|
1122
|
-
},
|
|
1123
|
-
home: base,
|
|
1124
|
-
readFile: (path) => readFile(resolve(path), "utf8").catch(() => null),
|
|
1125
|
-
getPortEndpoint: async ({ port, protocol = "http" }) => ({ url: `${protocol === "ws" ? "ws" : "http"}://127.0.0.1:${port}` }),
|
|
1126
|
-
async writeFile(path, content) {
|
|
1127
|
-
const target = resolve(path);
|
|
1128
|
-
await mkdir(dirname(target), { recursive: true });
|
|
1129
|
-
await writeFile(target, content);
|
|
1130
|
-
},
|
|
1131
|
-
destroy: () => {
|
|
1132
|
-
destroyed ??= (async () => {
|
|
1133
|
-
await rm(stateDir, {
|
|
1134
|
-
recursive: true,
|
|
1135
|
-
force: true
|
|
1136
|
-
}).catch(() => {});
|
|
1137
|
-
if (process.platform === "win32") {
|
|
1138
|
-
if (existsSync(base)) await runSh(sh, KILL_UNDER, base);
|
|
1139
|
-
await removeTree(base);
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
await rm(base, {
|
|
1143
|
-
recursive: true,
|
|
1144
|
-
force: true
|
|
1145
|
-
}).catch(() => {});
|
|
1146
|
-
})().finally(() => {
|
|
1147
|
-
destroyed = void 0;
|
|
1148
|
-
});
|
|
1149
|
-
return destroyed;
|
|
1150
|
-
}
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
//#endregion
|
|
1154
|
-
//#region src/egress.ts
|
|
1155
|
-
/**
|
|
1156
|
-
* The package registries and GitHub, to spread into an allowlist that still installs:
|
|
1157
|
-
* `egress: { allow: [...DEFAULT_EGRESS_ALLOW, 'api.example.com'] }`.
|
|
1158
|
-
*/
|
|
1159
|
-
const DEFAULT_EGRESS_ALLOW = PACKAGE_HOSTS;
|
|
1160
|
-
/** What each sandbox kind can do about egress, as its provider declares it. */
|
|
1161
|
-
const SANDBOX_EGRESS = {
|
|
1162
|
-
docker: DOCKER_EGRESS,
|
|
1163
|
-
fake: FAKE_EGRESS
|
|
1164
|
-
};
|
|
1165
|
-
const isRestricted = (policy) => policy !== "allow-all";
|
|
1166
|
-
/**
|
|
1167
|
-
* The hosts the harness needs: a real agent's own API (its model's provider's, for OpenCode), or
|
|
1168
|
-
* a fake agent's with `layout` (it behaves like that agent). A plain fake agent talks to nothing.
|
|
1169
|
-
*/
|
|
1170
|
-
function harnessHosts(harness) {
|
|
1171
|
-
if (harness.kind !== "fake" && isAgentKind(harness.kind)) return agentFor(harness).hosts ?? HARNESS_HOSTS[harness.kind];
|
|
1172
|
-
return harness.kind === "fake" && harness.layout ? HARNESS_HOSTS[harness.layout] : [];
|
|
1173
|
-
}
|
|
1174
|
-
/** MCP `http`/`sse` servers' hosts, local plugins' included: the agent connects to them from the sandbox. */
|
|
1175
|
-
function mcpServerHosts(layers) {
|
|
1176
|
-
const urls = /* @__PURE__ */ new Map();
|
|
1177
|
-
for (const { spec } of layers) for (const [name, server] of Object.entries(spec.mcp ?? {})) if (server.transport === "stdio") urls.delete(name);
|
|
1178
|
-
else urls.set(name, server.url);
|
|
1179
|
-
for (const [name, server] of localPluginServers(layers)) if (server.transport !== "stdio") urls.set(name, server.url);
|
|
1180
|
-
return [...urls.values()].flatMap((url) => URL.parse(url)?.hostname ?? []);
|
|
1181
|
-
}
|
|
1182
|
-
/**
|
|
1183
|
-
* The policy an attempt runs under, and the hosts a restricted one allows on its own: the
|
|
1184
|
-
* harness's, the brokered secrets' `hosts` and the MCP servers'. The cascade is config and
|
|
1185
|
-
* profile defaults (`inherited`), then the environment's layers, then groups and the eval (`own`).
|
|
1186
|
-
*/
|
|
1187
|
-
function plannedEgress(egress, harness, env, layers) {
|
|
1188
|
-
const fromLayers = layers.findLast((l) => l.spec.egress !== void 0)?.spec.egress;
|
|
1189
|
-
const policy = egress.own ?? fromLayers ?? egress.inherited ?? "allow-all";
|
|
1190
|
-
if (!isRestricted(policy)) return {
|
|
1191
|
-
policy,
|
|
1192
|
-
auto: []
|
|
1193
|
-
};
|
|
1194
|
-
const own = policy === "deny-all" ? [] : policy.allow;
|
|
1195
|
-
const auto = [
|
|
1196
|
-
...harnessHosts(harness),
|
|
1197
|
-
...plannedSecrets(env, layers).flatMap((s) => s.hosts ?? []),
|
|
1198
|
-
...mcpServerHosts(layers)
|
|
1199
|
-
];
|
|
1200
|
-
return {
|
|
1201
|
-
policy,
|
|
1202
|
-
auto: [...new Set(auto)].filter((h) => !own.includes(h))
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
/** Every host a restricted policy lets through, or null under `allow-all`. */
|
|
1206
|
-
function allowedHosts({ policy, auto }) {
|
|
1207
|
-
if (!isRestricted(policy)) return null;
|
|
1208
|
-
return [.../* @__PURE__ */ new Set([...policy === "deny-all" ? [] : policy.allow, ...auto])];
|
|
1209
|
-
}
|
|
1210
|
-
/** What enforcing the policy takes: nothing, turning egress off, or a host allowlist. */
|
|
1211
|
-
function egressNeeds(planned) {
|
|
1212
|
-
if (!isRestricted(planned.policy)) return "none";
|
|
1213
|
-
return allowedHosts(planned)?.length ? "allowlist" : "all-or-nothing";
|
|
1214
|
-
}
|
|
1215
|
-
const LEVELS = [
|
|
1216
|
-
"none",
|
|
1217
|
-
"all-or-nothing",
|
|
1218
|
-
"allowlist"
|
|
1219
|
-
];
|
|
1220
|
-
/** Why the sandbox can't enforce the attempt's policy, or undefined when it can. */
|
|
1221
|
-
function unenforceable(planned, sandbox, where) {
|
|
1222
|
-
const needs = egressNeeds(planned);
|
|
1223
|
-
const can = SANDBOX_EGRESS[sandbox.kind].enforce;
|
|
1224
|
-
if (LEVELS.indexOf(can) >= LEVELS.indexOf(needs)) return void 0;
|
|
1225
|
-
const hosts = allowedHosts(planned)?.join(", ");
|
|
1226
|
-
const what = needs !== "allowlist" ? "turning egress off" : planned.policy === "deny-all" ? `a host allowlist for its automatic hosts (${hosts})` : `a host allowlist (${hosts})`;
|
|
1227
|
-
const enforces = can === "none" ? "enforces no egress policy" : `only enforces ${can === "all-or-nothing" ? "'allow-all' or 'deny-all'" : can}`;
|
|
1228
|
-
const hint = sandbox.kind === "fake" ? " (its commands run on the host). Run it in docker(), or set egress: 'allow-all'" : "";
|
|
1229
|
-
return `${where} runs under egress ${describeEgress(planned.policy)}, which needs ${what}, but the ${sandbox.kind} sandbox ${enforces}${hint}.`;
|
|
1230
|
-
}
|
|
1231
|
-
const describeEgress = (policy) => typeof policy === "string" ? `'${policy}'` : `{ allow: [${policy.allow.map((h) => `'${h}'`).join(", ")}] }`;
|
|
1232
|
-
/** `deny-all + auto: api2.cursor.sh, …` for the plan; '' under `allow-all`. */
|
|
1233
|
-
function egressLabel({ policy, auto }) {
|
|
1234
|
-
if (!isRestricted(policy)) return "";
|
|
1235
|
-
const own = policy === "deny-all" ? "deny-all" : policy.allow.length ? `allow ${policy.allow.join(", ")}` : "allow none";
|
|
1236
|
-
return auto.length ? `${own} + auto: ${auto.join(", ")}` : own;
|
|
1237
|
-
}
|
|
1238
|
-
//#endregion
|
|
1239
|
-
export { writePluginFiles as S, expectedBlockedFor as _, unenforceable as a, refusedMcp as b, DEFAULT_HARNESS as c, agentFor as d, agentMcp as f, credentialOf as g, claudeMcpServers as h, plannedEgress as i, HARNESS_EXAMPLE as l, brokeringFor as m, allowedHosts as n, createFakeSandbox as o, authHint as p, egressLabel as r, AGENTS as s, DEFAULT_EGRESS_ALLOW as t, agentAuth as u, isAgentKind as v, refusedPlugins as x, layoutOf as y };
|
|
1240
|
-
|
|
1241
|
-
//# sourceMappingURL=egress-BfK_O9ce.js.map
|