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