reeval 0.16.1 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/THIRD_PARTY_NOTICES.md +14 -14
- package/dist/{adapter-CRKYPkRt.js → adapter-BIlJWXff.js} +9 -13
- package/dist/adapter-BIlJWXff.js.map +1 -0
- package/dist/{agent-BgH4-kFc.js → agent-CE-qdvmh.js} +49 -25
- package/dist/agent-CE-qdvmh.js.map +1 -0
- package/dist/{analysis-C2-aEbr7.js → analysis-CTBb_C0Z.js} +2 -3
- package/dist/{analysis-C2-aEbr7.js.map → analysis-CTBb_C0Z.js.map} +1 -1
- package/dist/app-files-YMmDAHA8.js +10 -0
- package/dist/app-files-YMmDAHA8.js.map +1 -0
- package/dist/{assemble-BVbI6NW-.js → assemble-7RI7Nuhz.js} +38 -23
- package/dist/assemble-7RI7Nuhz.js.map +1 -0
- package/dist/assemble-CANqwtwD.js +1 -0
- package/dist/{attempt-CpbZ9arV.js → attempt-CtKGvaQR.js} +4 -5
- package/dist/{attempt-CpbZ9arV.js.map → attempt-CtKGvaQR.js.map} +1 -1
- package/dist/{attempt-host-CIxjs2Be.js → attempt-host-CJM_wEA4.js} +13 -13
- package/dist/attempt-host-CJM_wEA4.js.map +1 -0
- package/dist/{budget-DBUrH4jX.js → budget-BcxLYY5L.js} +2 -3
- package/dist/budget-BcxLYY5L.js.map +1 -0
- package/dist/{capture-iQ6kYJV0.js → capture-DF8cHsJh.js} +583 -125
- package/dist/capture-DF8cHsJh.js.map +1 -0
- package/dist/capture-DMBZE9cs.js +14 -0
- package/dist/capture-DMBZE9cs.js.map +1 -0
- package/dist/capture-DagM1npp.js +1 -0
- package/dist/{cli-1YQU-66F.js → cli-Bm9ntSxz.js} +342 -101
- package/dist/cli-Bm9ntSxz.js.map +1 -0
- package/dist/{cli-spec-CPWT1mAG.js → cli-spec-ChkleEVm.js} +2 -3
- package/dist/{cli-spec-CPWT1mAG.js.map → cli-spec-ChkleEVm.js.map} +1 -1
- package/dist/cli.js +3 -4
- package/dist/{client-DMmOkbRA.js → client-CF-DOjOU.js} +6 -8
- package/dist/{client-DMmOkbRA.js.map → client-CF-DOjOU.js.map} +1 -1
- package/dist/{colors-QV9dFVhN.js → colors-DcXBvAlU.js} +21 -4
- package/dist/colors-DcXBvAlU.js.map +1 -0
- package/dist/{command-Cr1zjRvl.js → command-B7MslY_w.js} +22 -24
- package/dist/command-B7MslY_w.js.map +1 -0
- package/dist/{command-C-HeGlap.js → command-DDkz6jsD.js} +25 -29
- package/dist/{command-C-HeGlap.js.map → command-DDkz6jsD.js.map} +1 -1
- package/dist/{command-BlYCAqu-.js → command-DPF8hnWS.js} +17 -21
- package/dist/command-DPF8hnWS.js.map +1 -0
- package/dist/{command-8_Cg5v6b.js → command-Dk6wggV-.js} +22 -27
- package/dist/command-Dk6wggV-.js.map +1 -0
- package/dist/{commands-BvTNZ2-b.js → commands-DHT-nhEJ.js} +60 -23
- package/dist/commands-DHT-nhEJ.js.map +1 -0
- package/dist/{commands-Bj9NbmsO.js → commands-DQBayPCV.js} +1 -1
- package/dist/{config-CneBZB84.js → config-BLL5JqeX.js} +118 -81
- package/dist/config-BLL5JqeX.js.map +1 -0
- package/dist/{context-Dgn48BqT.js → context-I6nq3uS7.js} +2 -3
- package/dist/{context-Dgn48BqT.js.map → context-I6nq3uS7.js.map} +1 -1
- package/dist/{contrasts-lhFsekco.js → contrasts-CjOU_pfD.js} +4 -5
- package/dist/{contrasts-lhFsekco.js.map → contrasts-CjOU_pfD.js.map} +1 -1
- package/dist/{core-tLN-z1Be.js → core-CxY40JAs.js} +2 -3
- package/dist/{core-tLN-z1Be.js.map → core-CxY40JAs.js.map} +1 -1
- package/dist/cost-CMzY9VXv.js +1 -0
- package/dist/{cost-ChPa8-Fp.js → cost-e4IppZpJ.js} +5 -6
- package/dist/{cost-ChPa8-Fp.js.map → cost-e4IppZpJ.js.map} +1 -1
- package/dist/cursor-catalog-BeBJTk6A.js +142 -0
- package/dist/cursor-catalog-BeBJTk6A.js.map +1 -0
- package/dist/{db-Cnh3jIv_.js → db-DPiWC7Br.js} +22 -24
- package/dist/db-DPiWC7Br.js.map +1 -0
- package/dist/db-DysoTexX.js +2 -0
- package/dist/{debug-CgG3T071.js → debug-B5jDImcW.js} +5 -6
- package/dist/{debug-CgG3T071.js.map → debug-B5jDImcW.js.map} +1 -1
- package/dist/debug-BnXV7JbX.js +1 -0
- package/dist/default-effort-B7c4V9Qd.js +1 -0
- package/dist/default-effort-ciIXMA7h.js +94 -0
- package/dist/default-effort-ciIXMA7h.js.map +1 -0
- package/dist/{dist-CYrBwyHA.js → dist-CGwueB0T.js} +3 -4
- package/dist/{dist-CYrBwyHA.js.map → dist-CGwueB0T.js.map} +1 -1
- package/dist/{docker-Cqq03H72.js → docker-BUZOxh62.js} +20 -11
- package/dist/docker-BUZOxh62.js.map +1 -0
- package/dist/{docker-BihzJwbV.js → docker-Bcrc39Z8.js} +5 -6
- package/dist/{docker-BihzJwbV.js.map → docker-Bcrc39Z8.js.map} +1 -1
- package/dist/{docker-DCAtFMo9.js → docker-D83s_ADn.js} +1 -1
- package/dist/{doctor-Dl4vMeqt.js → doctor-CIhEAzbw.js} +26 -27
- package/dist/{doctor-Dl4vMeqt.js.map → doctor-CIhEAzbw.js.map} +1 -1
- package/dist/{env-CARj5Axq.js → env-T86lAqUD.js} +3 -4
- package/dist/{env-CARj5Axq.js.map → env-T86lAqUD.js.map} +1 -1
- package/dist/{environment-Cf5HMjib.js → environment-Ccytlpgf.js} +10 -13
- package/dist/environment-Ccytlpgf.js.map +1 -0
- package/dist/{errors-CHebohjc.js → errors-BQV__TzH.js} +9 -5
- package/dist/errors-BQV__TzH.js.map +1 -0
- package/dist/{errors-B6BSMs03.js → errors-ttMTnIYX.js} +2 -3
- package/dist/{errors-B6BSMs03.js.map → errors-ttMTnIYX.js.map} +1 -1
- package/dist/{eval-source-CAE4y2Sr.js → eval-source-D4xqc0iO.js} +8 -9
- package/dist/{eval-source-CAE4y2Sr.js.map → eval-source-D4xqc0iO.js.map} +1 -1
- package/dist/{evaluate-D35T51AC.d.ts → evaluate-BEGAQQuo.d.ts} +2 -4
- package/dist/{evaluate-CUtgyr43.js → evaluate-DNzyRQFe.js} +118 -89
- package/dist/evaluate-DNzyRQFe.js.map +1 -0
- package/dist/{files-CNiJ_fZf.js → files-3ZqUBbwg.js} +6 -7
- package/dist/{files-CNiJ_fZf.js.map → files-3ZqUBbwg.js.map} +1 -1
- package/dist/{files-BSqA2sZE.js → files-B2U5RezT.js} +7 -8
- package/dist/{files-BSqA2sZE.js.map → files-B2U5RezT.js.map} +1 -1
- package/dist/{files-Bk1mC3AN.js → files-BGlHnC46.js} +3 -4
- package/dist/{files-Bk1mC3AN.js.map → files-BGlHnC46.js.map} +1 -1
- package/dist/files-Bw2NQecs.js +1 -0
- package/dist/files-COW5JBJM.js +1 -0
- package/dist/files-Cp1jp0Nq.js +1 -0
- package/dist/{files-BRViE7m-.js → files-D_CBK9Zo.js} +17 -18
- package/dist/files-D_CBK9Zo.js.map +1 -0
- package/dist/{files-D1y8Pg4Z.js → files-p-uTdOjA.js} +4 -5
- package/dist/{files-D1y8Pg4Z.js.map → files-p-uTdOjA.js.map} +1 -1
- package/dist/{gate-BC6SdQZs.js → gate-BoDKeuJu.js} +4 -6
- package/dist/{gate-BC6SdQZs.js.map → gate-BoDKeuJu.js.map} +1 -1
- package/dist/gateway.d.ts +1 -3
- package/dist/gateway.js +1 -2
- package/dist/{git-UNxT_3z0.js → git-s-qf-vww.js} +4 -5
- package/dist/{git-UNxT_3z0.js.map → git-s-qf-vww.js.map} +1 -1
- package/dist/{harness-3NVyTSGK.js → harness-Ch2P81sx.js} +49 -16
- package/dist/harness-Ch2P81sx.js.map +1 -0
- package/dist/harness.d.ts +1 -3
- package/dist/harness.js +1 -1
- package/dist/{ids-Bp6ut7ZD.js → ids-DuK6xl4w.js} +2 -3
- package/dist/{ids-Bp6ut7ZD.js.map → ids-DuK6xl4w.js.map} +1 -1
- package/dist/{images-8A_LzVfw.js → images-h1VBM7TP.js} +9 -10
- package/dist/{images-8A_LzVfw.js.map → images-h1VBM7TP.js.map} +1 -1
- package/dist/index.d.ts +11 -13
- package/dist/index.js +5 -5
- package/dist/init-DJ3WFUt8.js +1 -0
- package/dist/{init-sFBgODhu.js → init-Z1cRnE3E.js} +8 -9
- package/dist/{init-sFBgODhu.js.map → init-Z1cRnE3E.js.map} +1 -1
- package/dist/{invocations-C9ejlOYl.js → invocations-z6hUD15n.js} +6 -8
- package/dist/{invocations-C9ejlOYl.js.map → invocations-z6hUD15n.js.map} +1 -1
- package/dist/{judge-Bg4v4e_K.js → judge-ByEUlzOM.js} +10 -15
- package/dist/judge-ByEUlzOM.js.map +1 -0
- package/dist/judge.d.ts +1 -5
- package/dist/judge.js +2 -3
- package/dist/{live-DeMvnDD5.js → live-D22qY6S_.js} +4 -5
- package/dist/{live-DeMvnDD5.js.map → live-D22qY6S_.js.map} +1 -1
- package/dist/live-DUpitP_9.js +1 -0
- package/dist/live-DpfJfc33.js +120 -0
- package/dist/live-DpfJfc33.js.map +1 -0
- package/dist/{matchers-BKPuaXlj.js → matchers-B4ZtlJyP.js} +33 -5
- package/dist/matchers-B4ZtlJyP.js.map +1 -0
- package/dist/{model-2rBZrdZA.js → model-BL_10Neu.js} +8 -10
- package/dist/model-BL_10Neu.js.map +1 -0
- package/dist/{model-Bz7-j71_.js → model-Bn7ndUQZ.js} +11 -15
- package/dist/model-Bn7ndUQZ.js.map +1 -0
- package/dist/{model-3MJtpho8.js → model-CFSjV-HJ.js} +6 -7
- package/dist/{model-3MJtpho8.js.map → model-CFSjV-HJ.js.map} +1 -1
- package/dist/model-CR3-qY-z.js +1 -0
- package/dist/{model-DkPwypN4.js → model-D1TBKeZj.js} +1 -1
- package/dist/{node-fP-H2uxn.js → node-CwP1G178.js} +11 -13
- package/dist/node-CwP1G178.js.map +1 -0
- package/dist/{object-BkXGPKWY.js → object-CeQ8dgUC.js} +2 -3
- package/dist/{object-BkXGPKWY.js.map → object-CeQ8dgUC.js.map} +1 -1
- package/dist/{opencode-providers-Bz0l7OZI.js → opencode-providers-yNKyXD49.js} +80 -20
- package/dist/opencode-providers-yNKyXD49.js.map +1 -0
- package/dist/{openrouter-models-Bo8PZ4Ew.js → openrouter-models-C8nzPKG2.js} +3 -4
- package/dist/{openrouter-models-Bo8PZ4Ew.js.map → openrouter-models-C8nzPKG2.js.map} +1 -1
- package/dist/{patch-CquGAGX5.js → patch-C7yBztZj.js} +2 -3
- package/dist/{patch-CquGAGX5.js.map → patch-C7yBztZj.js.map} +1 -1
- package/dist/{patch-6T9XAipm.js → patch-LFunkZ-L.js} +5 -6
- package/dist/{patch-6T9XAipm.js.map → patch-LFunkZ-L.js.map} +1 -1
- package/dist/{paths-BmR-7tx3.js → paths-Dwmi7L4X.js} +2 -3
- package/dist/{paths-BmR-7tx3.js.map → paths-Dwmi7L4X.js.map} +1 -1
- package/dist/{plan-Dw2BjafJ.js → plan-BrfiMcHh.js} +66 -12
- package/dist/plan-BrfiMcHh.js.map +1 -0
- package/dist/{plugins-ngQEJBjJ.js → plugins-CW-sQMg3.js} +8 -10
- package/dist/plugins-CW-sQMg3.js.map +1 -0
- package/dist/{preflight-CDRpog9o.js → preflight-BnFpd3Kv.js} +4 -5
- package/dist/{preflight-CDRpog9o.js.map → preflight-BnFpd3Kv.js.map} +1 -1
- package/dist/{preflight-BYXkweNN.js → preflight-CH-7KyhS.js} +1 -1
- package/dist/{prepare-PkARUGoF.js → prepare-0cA77eFD.js} +10 -11
- package/dist/{prepare-PkARUGoF.js.map → prepare-0cA77eFD.js.map} +1 -1
- package/dist/{prepare-B3btUlT6.js → prepare-CRyEwb5q.js} +2 -2
- package/dist/{prices-QaS-kjSQ.js → prices-C4BRuSe8.js} +5 -6
- package/dist/{prices-QaS-kjSQ.js.map → prices-C4BRuSe8.js.map} +1 -1
- package/dist/{provenance-7Hzg88f4.js → provenance-CKIG_1LB.js} +6 -7
- package/dist/{provenance-7Hzg88f4.js.map → provenance-CKIG_1LB.js.map} +1 -1
- package/dist/provider-DCdTHQpk.js +1 -0
- package/dist/{provider-CmAYTQQs.js → provider-DZd8t_XW.js} +3 -4
- package/dist/{provider-CmAYTQQs.js.map → provider-DZd8t_XW.js.map} +1 -1
- package/dist/{providers-DDNMbv1T.js → providers-CCl8ElNW.js} +1 -1
- package/dist/{providers-PKoJtGK0.js → providers-Dt6BEN_1.js} +8 -9
- package/dist/{providers-PKoJtGK0.js.map → providers-Dt6BEN_1.js.map} +1 -1
- package/dist/{query-nBXrgEwl.js → query-BV-zcw2t.js} +5 -6
- package/dist/{query-nBXrgEwl.js.map → query-BV-zcw2t.js.map} +1 -1
- package/dist/query-DSSMxkmw.js +1 -0
- package/dist/{questions-CkAwePPR.js → questions-AyLUMHYX.js} +14 -13
- package/dist/{questions-CkAwePPR.js.map → questions-AyLUMHYX.js.map} +1 -1
- package/dist/{record-DZBCjuwm.js → record-J45gJise.js} +13 -6
- package/dist/record-J45gJise.js.map +1 -0
- package/dist/{redact-DVIaahLv.js → redact-BEEGc37e.js} +8 -7
- package/dist/{redact-DVIaahLv.js.map → redact-BEEGc37e.js.map} +1 -1
- package/dist/{remarks-eBcrIZRu.js → remarks-0EXMh6AD.js} +2 -3
- package/dist/{remarks-eBcrIZRu.js.map → remarks-0EXMh6AD.js.map} +1 -1
- package/dist/remarks-BL18Id09.js +1 -0
- package/dist/{remarks-IFFe_oty.js → remarks-CgO1nIoG.js} +4 -6
- package/dist/{remarks-IFFe_oty.js.map → remarks-CgO1nIoG.js.map} +1 -1
- package/dist/{remarks-Bt0zwiQB.js → remarks-UIZTSIhd.js} +16 -17
- package/dist/remarks-UIZTSIhd.js.map +1 -0
- package/dist/{remote-DfJYiP-R.js → remote-BA9-hhgB.js} +10 -13
- package/dist/remote-BA9-hhgB.js.map +1 -0
- package/dist/resolve-C56s8_EF.js +1 -0
- package/dist/{resolve-D_cLa4tW.js → resolve-FHjE-dN3.js} +11 -12
- package/dist/{resolve-D_cLa4tW.js.map → resolve-FHjE-dN3.js.map} +1 -1
- package/dist/{results-DrKJuIQF.js → results-CFE6Nwb0.js} +8 -9
- package/dist/{results-DrKJuIQF.js.map → results-CFE6Nwb0.js.map} +1 -1
- package/dist/{resume-BmIM52MJ.js → resume-iaTxWRew.js} +8 -10
- package/dist/resume-iaTxWRew.js.map +1 -0
- package/dist/{root-Dlff-zp8.js → root-Co0jhOT5.js} +2 -3
- package/dist/{root-Dlff-zp8.js.map → root-Co0jhOT5.js.map} +1 -1
- package/dist/{runtime-CZVpkr04.js → runtime-SEkGS1Rx.js} +8 -10
- package/dist/{runtime-CZVpkr04.js.map → runtime-SEkGS1Rx.js.map} +1 -1
- package/dist/{sandbox-Cmi6IQML.js → sandbox-CAsXlGro.js} +4 -5
- package/dist/{sandbox-Cmi6IQML.js.map → sandbox-CAsXlGro.js.map} +1 -1
- package/dist/sandbox.d.ts +1 -5
- package/dist/sandbox.js +1 -1
- package/dist/server-BYfqpMD0.js +1 -0
- package/dist/{server-DS8BGhGU.js → server-C9_kV1IP.js} +17 -126
- package/dist/server-C9_kV1IP.js.map +1 -0
- package/dist/{shared-B_lvGqWz.js → shared-ogqPJ0uo.js} +4 -6
- package/dist/shared-ogqPJ0uo.js.map +1 -0
- package/dist/{source-DcXv4de-.js → source-BszY6yAC.js} +3 -4
- package/dist/{source-DcXv4de-.js.map → source-BszY6yAC.js.map} +1 -1
- package/dist/source-C4Q5psjD.js +1 -0
- package/dist/{src-BO8AYqJ5.js → src-8fy4nSWU.js} +67 -13
- package/dist/src-8fy4nSWU.js.map +1 -0
- package/dist/{src-DSZyg0Uq.js → src-B-L8O1Ld.js} +38 -9
- package/dist/src-B-L8O1Ld.js.map +1 -0
- package/dist/src-BBmCEE-M.js +3 -0
- package/dist/{src-1lpTocbd.js → src-BWcgyARO.js} +32 -45
- package/dist/src-BWcgyARO.js.map +1 -0
- package/dist/src-BYpY_vXK.js +2 -0
- package/dist/{src-A8HLtO0a.js → src-B_igzM1O.js} +3 -5
- package/dist/src-B_igzM1O.js.map +1 -0
- package/dist/{src-gn7YlnRg.js → src-CWrKJO92.js} +4 -7
- package/dist/src-CWrKJO92.js.map +1 -0
- package/dist/src-CZANB4pb.js +1 -0
- package/dist/src-CnrLy_r_.js +2 -0
- package/dist/{src-8yTF251P.js → src-DMiwtprP.js} +65 -15
- package/dist/src-DMiwtprP.js.map +1 -0
- package/dist/src-DVGVWOAB.js +2 -0
- package/dist/{src-C0ySiej5.js → src-DaYQ1O9Y.js} +94 -68
- package/dist/src-DaYQ1O9Y.js.map +1 -0
- package/dist/src-DoxUxkU3.js +2 -0
- package/dist/src-DqIQQTu1.js +2 -0
- package/dist/{src-BkiComGh.js → src-Dt6BWDcJ.js} +2 -2
- package/dist/{src-BYLM3hEz.js → src-HTG2SoNz.js} +89 -38
- package/dist/src-HTG2SoNz.js.map +1 -0
- package/dist/{src-BYDOXw_Y.js → src-uluei5nU.js} +40 -17
- package/dist/src-uluei5nU.js.map +1 -0
- package/dist/{src-Cp-2Hdib.js → src-umdk2alV.js} +2 -2
- package/dist/{state-C_kdhp5v.js → state-DfcikRK3.js} +26 -35
- package/dist/state-DfcikRK3.js.map +1 -0
- package/dist/state-haxTOljN.js +1 -0
- package/dist/{stats-hfpuYsAM.js → stats-D-Gqwqt0.js} +2 -3
- package/dist/{stats-hfpuYsAM.js.map → stats-D-Gqwqt0.js.map} +1 -1
- package/dist/{suite-DieLXvCT.js → suite-BVcBo_ua.js} +12 -8
- package/dist/suite-BVcBo_ua.js.map +1 -0
- package/dist/suite-CmeXyn66.js +2 -0
- package/dist/{summary-CSzyBVsF.js → summary-BmooCwQv.js} +29 -15
- package/dist/{summary-CSzyBVsF.js.map → summary-BmooCwQv.js.map} +1 -1
- package/dist/{tarball-CHcahyNK.js → tarball-CESxtK4X.js} +2 -3
- package/dist/{tarball-CHcahyNK.js.map → tarball-CESxtK4X.js.map} +1 -1
- package/dist/testing.d.ts +49 -11
- package/dist/testing.js +5 -6
- package/dist/{text-DTigcA64.js → text-D--Q5KsA.js} +2 -3
- package/dist/{text-DTigcA64.js.map → text-D--Q5KsA.js.map} +1 -1
- package/dist/{tool-target-CKWkd6QI.js → tool-target-DS5d72eH.js} +3 -4
- package/dist/{tool-target-CKWkd6QI.js.map → tool-target-DS5d72eH.js.map} +1 -1
- package/dist/{transcript-BJrKfgRW.js → transcript-C_IpYMRk.js} +8 -8
- package/dist/transcript-C_IpYMRk.js.map +1 -0
- package/dist/{types-DVvW66ci.d.ts → types-BlM-aN9_.d.ts} +168 -33
- package/dist/{types-C5vI3g1C.js → types-C4OkYhZg.js} +2 -3
- package/dist/types-C4OkYhZg.js.map +1 -0
- package/dist/{usage-BNY1ABrU.js → usage-DJiDnh2D.js} +2 -3
- package/dist/{usage-BNY1ABrU.js.map → usage-DJiDnh2D.js.map} +1 -1
- package/dist/{vertex-DypYjx71.js → vertex-6uSpZ5L8.js} +8 -8
- package/dist/vertex-6uSpZ5L8.js.map +1 -0
- package/dist/vertex-BaAz44YN.js +1 -0
- package/dist/view/index.d.ts +21 -32
- package/dist/view/index.js +12 -11
- package/dist/views-CBAsDkCB.js +2 -0
- package/dist/{views-B9STsLB4.js → views-DPng-2-z.js} +7 -8
- package/dist/{views-B9STsLB4.js.map → views-DPng-2-z.js.map} +1 -1
- package/dist/{worker-entry-C5bLCv6s.js → worker-entry-lt5otEb5.js} +12 -17
- package/dist/worker-entry-lt5otEb5.js.map +1 -0
- package/dist/{workspace-CBuI9Uds.js → workspace-1O8x4oDc.js} +8 -9
- package/dist/{workspace-CBuI9Uds.js.map → workspace-1O8x4oDc.js.map} +1 -1
- package/dist/workspace-It7dvpbg.js +1 -0
- package/package.json +1 -1
- package/skills/eval-rubric/SKILL.md +1 -1
- package/dist/adapter-CRKYPkRt.js.map +0 -1
- package/dist/agent-BgH4-kFc.js.map +0 -1
- package/dist/app-files-BMVBr079.js +0 -11
- package/dist/app-files-BMVBr079.js.map +0 -1
- package/dist/assemble-BVbI6NW-.js.map +0 -1
- package/dist/assemble-SiHa4__F.js +0 -1
- package/dist/attempt-host-CIxjs2Be.js.map +0 -1
- package/dist/budget-DBUrH4jX.js.map +0 -1
- package/dist/capture-iQ6kYJV0.js.map +0 -1
- package/dist/capture-px7Ey95_.js +0 -1
- package/dist/cli-1YQU-66F.js.map +0 -1
- package/dist/colors-QV9dFVhN.js.map +0 -1
- package/dist/command-8_Cg5v6b.js.map +0 -1
- package/dist/command-BlYCAqu-.js.map +0 -1
- package/dist/command-Cr1zjRvl.js.map +0 -1
- package/dist/commands-BvTNZ2-b.js.map +0 -1
- package/dist/config-CneBZB84.js.map +0 -1
- package/dist/cost-C5RBTTJr.js +0 -1
- package/dist/db-BnXyamuj.js +0 -2
- package/dist/db-Cnh3jIv_.js.map +0 -1
- package/dist/debug-CAx3qcaP.js +0 -1
- package/dist/docker-Cqq03H72.js.map +0 -1
- package/dist/environment-Cf5HMjib.js.map +0 -1
- package/dist/errors-CHebohjc.js.map +0 -1
- package/dist/evaluate-CUtgyr43.js.map +0 -1
- package/dist/files-BEnUJW1e.js +0 -1
- package/dist/files-BRViE7m-.js.map +0 -1
- package/dist/files-C3tQtD26.js +0 -1
- package/dist/files-Dts7EY3H.js +0 -1
- package/dist/harness-3NVyTSGK.js.map +0 -1
- package/dist/init-okoALIah.js +0 -1
- package/dist/judge-Bg4v4e_K.js.map +0 -1
- package/dist/matchers-BKPuaXlj.js.map +0 -1
- package/dist/model-2rBZrdZA.js.map +0 -1
- package/dist/model-Bz7-j71_.js.map +0 -1
- package/dist/model-bREXVXwT.js +0 -1
- package/dist/node-fP-H2uxn.js.map +0 -1
- package/dist/opencode-providers-Bz0l7OZI.js.map +0 -1
- package/dist/plan-Dw2BjafJ.js.map +0 -1
- package/dist/plugins-ngQEJBjJ.js.map +0 -1
- package/dist/provider-DehR4CMN.js +0 -1
- package/dist/query-Bt6vLJ3m.js +0 -1
- package/dist/record-DZBCjuwm.js.map +0 -1
- package/dist/remarks-Bp6AwPgb.js +0 -1
- package/dist/remarks-Bt0zwiQB.js.map +0 -1
- package/dist/remote-DfJYiP-R.js.map +0 -1
- package/dist/resolve-CT4XZIfV.js +0 -1
- package/dist/resume-BmIM52MJ.js.map +0 -1
- package/dist/server-CKJOnIB0.js +0 -1
- package/dist/server-DS8BGhGU.js.map +0 -1
- package/dist/shared-B_lvGqWz.js.map +0 -1
- package/dist/source-CgUqpumI.js +0 -1
- package/dist/src-1lpTocbd.js.map +0 -1
- package/dist/src-8yTF251P.js.map +0 -1
- package/dist/src-A8HLtO0a.js.map +0 -1
- package/dist/src-BO8AYqJ5.js.map +0 -1
- package/dist/src-BTqJbvj6.js +0 -2
- package/dist/src-BYDOXw_Y.js.map +0 -1
- package/dist/src-BYLM3hEz.js.map +0 -1
- package/dist/src-BvgeZ4tS.js +0 -2
- package/dist/src-C0ySiej5.js.map +0 -1
- package/dist/src-CgJrz5p0.js +0 -3
- package/dist/src-DMo2eCOJ.js +0 -2
- package/dist/src-DSZyg0Uq.js.map +0 -1
- package/dist/src-Dk2Na0b-.js +0 -2
- package/dist/src-OESRtvOi.js +0 -2
- package/dist/src-gn7YlnRg.js.map +0 -1
- package/dist/src-h5uDlk3m.js +0 -1
- package/dist/state-C97udoh3.js +0 -1
- package/dist/state-C_kdhp5v.js.map +0 -1
- package/dist/suite-ByT1lsdD.js +0 -2
- package/dist/suite-DieLXvCT.js.map +0 -1
- package/dist/transcript-BJrKfgRW.js.map +0 -1
- package/dist/types-C5vI3g1C.js.map +0 -1
- package/dist/vertex-Bv7vhMgs.js +0 -1
- package/dist/vertex-DypYjx71.js.map +0 -1
- package/dist/views-Ca-rTixp.js +0 -2
- package/dist/worker-entry-C5bLCv6s.js.map +0 -1
- package/dist/workspace-8uHtBSve.js +0 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { n as isOneOf } from "./object-
|
|
2
|
-
import { n as UsageError } from "./errors-
|
|
3
|
-
import { c as jsonValueSchema, h as parseDuration, i as durationSchema, m as TIMER_LIMIT, n as dataProblem, p as MAX_TIMER_MS } from "./shared-
|
|
4
|
-
import {
|
|
5
|
-
import { l as sha256 } from "./ids-
|
|
6
|
-
import {
|
|
7
|
-
import { y as vertexSettingsIn } from "./vertex-
|
|
8
|
-
import { m as redactSecrets } from "./redact-
|
|
9
|
-
import { a as plural, i as formatDuration, n as clip } from "./text-
|
|
10
|
-
import { s as cacheDir } from "./root-
|
|
11
|
-
import {
|
|
12
|
-
import { t as InfraError } from "./types-
|
|
13
|
-
import { r as getRunContext, s as SUBJECT } from "./runtime-
|
|
14
|
-
import { i as debugTrace, r as debugLog } from "./attempt-
|
|
15
|
-
import { r as openRouterFallbacks } from "./openrouter-models-
|
|
16
|
-
import { i as hostModel } from "./model-
|
|
17
|
-
import { t as addUsage } from "./usage-
|
|
18
|
-
import { t as untraced } from "./docker-
|
|
1
|
+
import { n as isOneOf } from "./object-CeQ8dgUC.js";
|
|
2
|
+
import { n as UsageError } from "./errors-ttMTnIYX.js";
|
|
3
|
+
import { c as jsonValueSchema, h as parseDuration, i as durationSchema, m as TIMER_LIMIT, n as dataProblem, p as MAX_TIMER_MS } from "./shared-ogqPJ0uo.js";
|
|
4
|
+
import { x as gatewayNameSchema } from "./harness-Ch2P81sx.js";
|
|
5
|
+
import { l as sha256 } from "./ids-DuK6xl4w.js";
|
|
6
|
+
import { Ht as turnsSchema, It as fakeJudgeDataSchema, Nt as captureWindowSchema, Rt as judgeFields, Vt as sharedInputFields, b as resolveModelGateway, ct as awaitListening, lt as parseProbe, ut as probeScript, v as gatewayScope, zt as judgeModelNameSchema } from "./config-BLL5JqeX.js";
|
|
7
|
+
import { y as vertexSettingsIn } from "./vertex-6uSpZ5L8.js";
|
|
8
|
+
import { d as redactJson, m as redactSecrets } from "./redact-BEEGc37e.js";
|
|
9
|
+
import { a as plural, i as formatDuration, n as clip } from "./text-D--Q5KsA.js";
|
|
10
|
+
import { s as cacheDir } from "./root-Co0jhOT5.js";
|
|
11
|
+
import { mt as shellQuote } from "./src-DaYQ1O9Y.js";
|
|
12
|
+
import { t as InfraError } from "./types-C4OkYhZg.js";
|
|
13
|
+
import { r as getRunContext, s as SUBJECT } from "./runtime-SEkGS1Rx.js";
|
|
14
|
+
import { i as debugTrace, r as debugLog } from "./attempt-CtKGvaQR.js";
|
|
15
|
+
import { r as openRouterFallbacks } from "./openrouter-models-C8nzPKG2.js";
|
|
16
|
+
import { i as hostModel } from "./model-BL_10Neu.js";
|
|
17
|
+
import { t as addUsage } from "./usage-DJiDnh2D.js";
|
|
18
|
+
import { t as untraced } from "./docker-Bcrc39Z8.js";
|
|
19
|
+
import { n as pageLines } from "./capture-DMBZE9cs.js";
|
|
19
20
|
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
20
21
|
import { homedir, tmpdir } from "node:os";
|
|
21
22
|
import { join, posix } from "node:path";
|
|
@@ -28,7 +29,7 @@ import http from "node:http";
|
|
|
28
29
|
import { crc32, deflateSync, inflateRawSync, inflateSync } from "node:zlib";
|
|
29
30
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
30
31
|
import { generateText, stepCountIs, tool } from "ai";
|
|
31
|
-
|
|
32
|
+
// src/contract/attempt.ts
|
|
32
33
|
const nullableNumber = z.number().nullable();
|
|
33
34
|
const tokenUsageSchema = z.strictObject({
|
|
34
35
|
input: z.number(),
|
|
@@ -88,7 +89,7 @@ const transcriptEventSchema = z.discriminatedUnion("type", [
|
|
|
88
89
|
toolCallId: z.string(),
|
|
89
90
|
query: z.string(),
|
|
90
91
|
references: nullableNumber,
|
|
91
|
-
ok: z.boolean().optional(),
|
|
92
|
+
ok: z.boolean().nullable().optional(),
|
|
92
93
|
durationMs: nullableNumber,
|
|
93
94
|
stalled: z.boolean().optional()
|
|
94
95
|
}),
|
|
@@ -97,7 +98,7 @@ const transcriptEventSchema = z.discriminatedUnion("type", [
|
|
|
97
98
|
type: z.literal("web-fetch"),
|
|
98
99
|
toolCallId: z.string(),
|
|
99
100
|
url: z.string(),
|
|
100
|
-
ok: z.boolean(),
|
|
101
|
+
ok: z.boolean().nullable(),
|
|
101
102
|
durationMs: nullableNumber,
|
|
102
103
|
stalled: z.boolean().optional()
|
|
103
104
|
}),
|
|
@@ -108,7 +109,7 @@ const transcriptEventSchema = z.discriminatedUnion("type", [
|
|
|
108
109
|
tool: z.string(),
|
|
109
110
|
input: z.unknown(),
|
|
110
111
|
output: z.unknown(),
|
|
111
|
-
ok: z.boolean(),
|
|
112
|
+
ok: z.boolean().nullable(),
|
|
112
113
|
durationMs: nullableNumber,
|
|
113
114
|
stalled: z.boolean().optional()
|
|
114
115
|
}),
|
|
@@ -177,6 +178,33 @@ const assertionRecordSchema = z.strictObject({
|
|
|
177
178
|
durationMs: z.number().optional()
|
|
178
179
|
});
|
|
179
180
|
const turnIndex = z.number().int("must be a turn index, from 0").min(0, "must be a turn index, from 0").describe("The turn's index, from 0.");
|
|
181
|
+
const captureConsoleMessageSchema = z.strictObject({
|
|
182
|
+
level: z.enum([
|
|
183
|
+
"error",
|
|
184
|
+
"warning",
|
|
185
|
+
"info",
|
|
186
|
+
"log",
|
|
187
|
+
"debug"
|
|
188
|
+
]),
|
|
189
|
+
text: z.string(),
|
|
190
|
+
source: z.string(),
|
|
191
|
+
url: z.string().optional()
|
|
192
|
+
});
|
|
193
|
+
const captureFailedRequestSchema = z.strictObject({
|
|
194
|
+
method: z.string(),
|
|
195
|
+
url: z.string(),
|
|
196
|
+
status: z.number().optional(),
|
|
197
|
+
error: z.string().optional()
|
|
198
|
+
});
|
|
199
|
+
const capturePageFields = {
|
|
200
|
+
status: z.number().optional(),
|
|
201
|
+
finalUrl: z.string(),
|
|
202
|
+
console: z.array(captureConsoleMessageSchema),
|
|
203
|
+
errors: z.array(z.string()),
|
|
204
|
+
failedRequests: z.array(captureFailedRequestSchema),
|
|
205
|
+
dropped: z.number().optional()
|
|
206
|
+
};
|
|
207
|
+
z.strictObject(capturePageFields);
|
|
180
208
|
const captureSchema = z.strictObject({
|
|
181
209
|
name: z.string(),
|
|
182
210
|
port: z.number(),
|
|
@@ -186,7 +214,8 @@ const captureSchema = z.strictObject({
|
|
|
186
214
|
path: z.string(),
|
|
187
215
|
sha256: z.string(),
|
|
188
216
|
bytes: z.number()
|
|
189
|
-
})
|
|
217
|
+
}),
|
|
218
|
+
...capturePageFields
|
|
190
219
|
});
|
|
191
220
|
const judgeArtifactRefSchema = z.strictObject({
|
|
192
221
|
name: z.string(),
|
|
@@ -511,8 +540,7 @@ const OTHER_KEYS = [
|
|
|
511
540
|
];
|
|
512
541
|
/** What's wrong with an attempt request a runner sent, by the field's path, or undefined. */
|
|
513
542
|
const attemptRequestProblem = (value) => dataProblem(attemptRequestSchema, value, "The attempt request", (object) => typeof object.op === "string" ? CALL_KEYS[object.op] ?? [] : OTHER_KEYS);
|
|
514
|
-
|
|
515
|
-
//#region src/capture/fake-instructions.ts
|
|
543
|
+
// src/capture/fake-instructions.ts
|
|
516
544
|
const FAKE_INSTRUCTIONS = Symbol.for("reeval.capture.fakeInstructions");
|
|
517
545
|
function isWaitStep(step) {
|
|
518
546
|
return typeof step === "object" && step !== null && !Array.isArray(step) && "wait" in step;
|
|
@@ -540,8 +568,171 @@ function fakeInstructions(steps) {
|
|
|
540
568
|
function fakeInstructionSteps(value) {
|
|
541
569
|
if (typeof value === "object" && value !== null && FAKE_INSTRUCTIONS in value) return value[FAKE_INSTRUCTIONS];
|
|
542
570
|
}
|
|
543
|
-
|
|
544
|
-
|
|
571
|
+
const TEXT_MAX = 2e3;
|
|
572
|
+
const params = (msg) => msg.params ?? msg;
|
|
573
|
+
function argText(arg) {
|
|
574
|
+
if (arg.type === "string") return String(arg.value);
|
|
575
|
+
if (arg.unserializableValue !== void 0) return arg.unserializableValue;
|
|
576
|
+
if (arg.description !== void 0) return arg.description;
|
|
577
|
+
if (arg.value !== void 0) return JSON.stringify(arg.value);
|
|
578
|
+
return String(arg.type ?? "");
|
|
579
|
+
}
|
|
580
|
+
/** `console.*` call types that print nothing of their own. */
|
|
581
|
+
const SILENT = /* @__PURE__ */ new Set([
|
|
582
|
+
"clear",
|
|
583
|
+
"endGroup",
|
|
584
|
+
"profile",
|
|
585
|
+
"profileEnd"
|
|
586
|
+
]);
|
|
587
|
+
function consoleLevel(type) {
|
|
588
|
+
if (type === "error" || type === "assert") return "error";
|
|
589
|
+
if (type === "warning") return "warning";
|
|
590
|
+
if (type === "info") return "info";
|
|
591
|
+
if (type === "debug") return "debug";
|
|
592
|
+
return "log";
|
|
593
|
+
}
|
|
594
|
+
function logLevel(level) {
|
|
595
|
+
if (level === "error" || level === "warning" || level === "info") return level;
|
|
596
|
+
return "debug";
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Collects what the tab reports from the moment it's called: its console, its page errors
|
|
600
|
+
* (uncaught exceptions and unhandled rejections), its failed requests and its main frame's
|
|
601
|
+
* document status. Needs `Runtime.enable`, `Log.enable` and `Network.enable` sent after it, and
|
|
602
|
+
* the main frame's id once it's known.
|
|
603
|
+
*/
|
|
604
|
+
function watchPage(cdp) {
|
|
605
|
+
const consoleLines = [];
|
|
606
|
+
const errors = [];
|
|
607
|
+
const droppedErrors = /* @__PURE__ */ new Set();
|
|
608
|
+
const failed = [];
|
|
609
|
+
const requests = /* @__PURE__ */ new Map();
|
|
610
|
+
let frame;
|
|
611
|
+
let status;
|
|
612
|
+
let frameUrl = "";
|
|
613
|
+
let dropped = 0;
|
|
614
|
+
const keep = (list, item, count = list.length) => {
|
|
615
|
+
if (count < 100) list.push(item);
|
|
616
|
+
else dropped++;
|
|
617
|
+
return count < 100;
|
|
618
|
+
};
|
|
619
|
+
const held = (text) => clip(text, TEXT_MAX * 2);
|
|
620
|
+
const keepConsole = (line) => keep(consoleLines, line, consoleLines.filter((l) => l.level === line.level).length);
|
|
621
|
+
cdp.on("Runtime.consoleAPICalled", (msg) => {
|
|
622
|
+
const p = params(msg);
|
|
623
|
+
const type = p.type ?? "log";
|
|
624
|
+
if (SILENT.has(type)) return;
|
|
625
|
+
const url = p.stackTrace?.callFrames?.[0]?.url;
|
|
626
|
+
keepConsole({
|
|
627
|
+
level: consoleLevel(type),
|
|
628
|
+
text: held((p.args ?? []).map(argText).join(" ")),
|
|
629
|
+
source: "console-api",
|
|
630
|
+
...url ? { url } : {}
|
|
631
|
+
});
|
|
632
|
+
});
|
|
633
|
+
cdp.on("Log.entryAdded", (msg) => {
|
|
634
|
+
const { entry } = params(msg);
|
|
635
|
+
if (!entry) return;
|
|
636
|
+
keepConsole({
|
|
637
|
+
level: logLevel(entry.level),
|
|
638
|
+
text: held(entry.text ?? ""),
|
|
639
|
+
source: entry.source ?? "other",
|
|
640
|
+
...entry.url ? { url: entry.url } : {}
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
cdp.on("Runtime.exceptionThrown", (msg) => {
|
|
644
|
+
const { exceptionDetails: d } = params(msg);
|
|
645
|
+
if (!d) return;
|
|
646
|
+
const thrown = d.exception ? argText(d.exception) : "";
|
|
647
|
+
const text = held(thrown ? `${d.text ?? "Uncaught"} ${thrown}`.trim() : d.text ?? "Uncaught");
|
|
648
|
+
if (!keep(errors, {
|
|
649
|
+
id: d.exceptionId,
|
|
650
|
+
text
|
|
651
|
+
}) && d.exceptionId !== void 0) droppedErrors.add(d.exceptionId);
|
|
652
|
+
});
|
|
653
|
+
cdp.on("Runtime.exceptionRevoked", (msg) => {
|
|
654
|
+
const { exceptionId: id } = params(msg);
|
|
655
|
+
if (id === void 0) return;
|
|
656
|
+
if (droppedErrors.delete(id)) {
|
|
657
|
+
dropped--;
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const at = errors.findIndex((e) => e.id === id);
|
|
661
|
+
if (at >= 0) errors.splice(at, 1);
|
|
662
|
+
});
|
|
663
|
+
cdp.on("Page.frameNavigated", (msg) => {
|
|
664
|
+
const { frame: f } = params(msg);
|
|
665
|
+
if (f?.id && f.id === frame && f.url) frameUrl = f.url + (f.urlFragment ?? "");
|
|
666
|
+
});
|
|
667
|
+
cdp.on("Page.navigatedWithinDocument", (msg) => {
|
|
668
|
+
const p = params(msg);
|
|
669
|
+
if (p.frameId && p.frameId === frame && p.url) frameUrl = p.url;
|
|
670
|
+
});
|
|
671
|
+
cdp.on("Network.requestWillBeSent", (msg) => {
|
|
672
|
+
const p = params(msg);
|
|
673
|
+
if (p.requestId && p.request?.url) requests.set(p.requestId, {
|
|
674
|
+
url: p.request.url,
|
|
675
|
+
method: p.request.method ?? "GET"
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
cdp.on("Network.responseReceived", (msg) => {
|
|
679
|
+
const p = params(msg);
|
|
680
|
+
const code = p.response?.status ?? 0;
|
|
681
|
+
if (p.type === "Document" && p.frameId && p.frameId === frame) status = p.response?.status;
|
|
682
|
+
if (code < 400) return;
|
|
683
|
+
const req = p.requestId ? requests.get(p.requestId) : void 0;
|
|
684
|
+
keep(failed, {
|
|
685
|
+
method: req?.method ?? "GET",
|
|
686
|
+
url: p.response?.url ?? req?.url ?? "",
|
|
687
|
+
status: code
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
cdp.on("Network.loadingFinished", (msg) => {
|
|
691
|
+
const { requestId } = params(msg);
|
|
692
|
+
if (requestId) requests.delete(requestId);
|
|
693
|
+
});
|
|
694
|
+
cdp.on("Network.loadingFailed", (msg) => {
|
|
695
|
+
const p = params(msg);
|
|
696
|
+
const req = p.requestId ? requests.get(p.requestId) : void 0;
|
|
697
|
+
if (p.requestId) requests.delete(p.requestId);
|
|
698
|
+
if (p.canceled || !req) return;
|
|
699
|
+
const cors = p.corsErrorStatus?.corsError;
|
|
700
|
+
const error = `${p.errorText ?? "failed"}${cors ? ` (CORS ${cors})` : ""}`;
|
|
701
|
+
keep(failed, {
|
|
702
|
+
method: req.method,
|
|
703
|
+
url: req.url,
|
|
704
|
+
error
|
|
705
|
+
});
|
|
706
|
+
});
|
|
707
|
+
return {
|
|
708
|
+
mainFrame(id) {
|
|
709
|
+
frame = id;
|
|
710
|
+
},
|
|
711
|
+
facts(url, origin) {
|
|
712
|
+
url ||= frameUrl;
|
|
713
|
+
const base = origin.replace(/\/$/, "");
|
|
714
|
+
const at = base ? new RegExp(`${base.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?!\\d)`, "g") : void 0;
|
|
715
|
+
const local = (text) => clip(at ? text.replace(at, "") : text, TEXT_MAX);
|
|
716
|
+
const path = (u) => local(u) || "/";
|
|
717
|
+
return {
|
|
718
|
+
...status ? { status } : {},
|
|
719
|
+
finalUrl: path(url),
|
|
720
|
+
console: consoleLines.map((l) => ({
|
|
721
|
+
...l,
|
|
722
|
+
text: local(l.text),
|
|
723
|
+
...l.url ? { url: path(l.url) } : {}
|
|
724
|
+
})),
|
|
725
|
+
errors: errors.map((e) => local(e.text)),
|
|
726
|
+
failedRequests: failed.map((r) => ({
|
|
727
|
+
...r,
|
|
728
|
+
url: path(r.url)
|
|
729
|
+
})),
|
|
730
|
+
...dropped ? { dropped } : {}
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
// src/capture/zip.ts
|
|
545
736
|
const LOCAL = 67324752;
|
|
546
737
|
/** Extracts a zip (store or deflate) into `files` keyed by posix path. */
|
|
547
738
|
function unzip(bytes) {
|
|
@@ -568,8 +759,7 @@ function unzip(bytes) {
|
|
|
568
759
|
}
|
|
569
760
|
return files;
|
|
570
761
|
}
|
|
571
|
-
|
|
572
|
-
//#region src/capture/browser.ts
|
|
762
|
+
// src/capture/browser.ts
|
|
573
763
|
const isMs = (wait) => typeof wait === "object" && wait !== null;
|
|
574
764
|
/** The CDP event `'idle'` waits for; `'load'` is `Page.loadEventFired`. */
|
|
575
765
|
function captureWaitLabel(wait) {
|
|
@@ -980,25 +1170,36 @@ async function ensureChrome(cacheRoot, options = { cacheLabel: cacheRoot }) {
|
|
|
980
1170
|
}
|
|
981
1171
|
return bin;
|
|
982
1172
|
}
|
|
1173
|
+
/** The least time a CDP call gets, so the page facts still come after a screenshot near the deadline. */
|
|
1174
|
+
const CDP_CALL_MIN_MS = 1e3;
|
|
1175
|
+
/**
|
|
1176
|
+
* A CDP connection whose every call settles: with the reply, at `callMs()` (at least
|
|
1177
|
+
* `CDP_CALL_MIN_MS`), or when the socket closes. A blocked browser can't hold a capture past its
|
|
1178
|
+
* budget.
|
|
1179
|
+
*/
|
|
983
1180
|
var Cdp = class {
|
|
984
1181
|
#ws;
|
|
985
1182
|
#next = 0;
|
|
986
1183
|
#pending = /* @__PURE__ */ new Map();
|
|
987
1184
|
#events = /* @__PURE__ */ new Map();
|
|
1185
|
+
#closed;
|
|
1186
|
+
callMs = () => 3e4;
|
|
988
1187
|
constructor(ws) {
|
|
989
1188
|
this.#ws = ws;
|
|
990
1189
|
ws.addEventListener("message", (ev) => {
|
|
991
1190
|
const msg = JSON.parse(String(ev.data));
|
|
992
1191
|
if (msg.id !== void 0) {
|
|
993
|
-
|
|
994
|
-
if (!p) return;
|
|
995
|
-
this.#pending.delete(msg.id);
|
|
996
|
-
if (msg.error) p.reject(new Error(msg.error.message));
|
|
997
|
-
else p.resolve(msg.result);
|
|
1192
|
+
this.#pending.get(msg.id)?.settle(msg);
|
|
998
1193
|
return;
|
|
999
1194
|
}
|
|
1000
1195
|
if (msg.method) for (const fn of this.#events.get(msg.method) ?? []) fn(msg);
|
|
1001
1196
|
});
|
|
1197
|
+
ws.addEventListener("close", () => this.#fail(/* @__PURE__ */ new Error("the browser closed its DevTools connection")));
|
|
1198
|
+
ws.addEventListener("error", () => this.#fail(/* @__PURE__ */ new Error("the browser closed its DevTools connection")));
|
|
1199
|
+
}
|
|
1200
|
+
#fail(error) {
|
|
1201
|
+
this.#closed ??= error;
|
|
1202
|
+
for (const p of [...this.#pending.values()]) p.reject(this.#closed);
|
|
1002
1203
|
}
|
|
1003
1204
|
on(method, fn) {
|
|
1004
1205
|
const list = this.#events.get(method) ?? [];
|
|
@@ -1006,22 +1207,43 @@ var Cdp = class {
|
|
|
1006
1207
|
this.#events.set(method, list);
|
|
1007
1208
|
}
|
|
1008
1209
|
send(method, params) {
|
|
1210
|
+
if (this.#closed) return Promise.reject(this.#closed);
|
|
1009
1211
|
const id = ++this.#next;
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1212
|
+
return new Promise((resolve, reject) => {
|
|
1213
|
+
const done = () => {
|
|
1214
|
+
clearTimeout(timer);
|
|
1215
|
+
this.#pending.delete(id);
|
|
1216
|
+
};
|
|
1217
|
+
const ms = Math.max(CDP_CALL_MIN_MS, this.callMs());
|
|
1218
|
+
const timer = setTimeout(() => {
|
|
1219
|
+
done();
|
|
1220
|
+
reject(/* @__PURE__ */ new Error(`c.capture() timed out after ${ms}ms waiting for the browser (${method})`));
|
|
1221
|
+
}, ms);
|
|
1222
|
+
this.#pending.set(id, {
|
|
1223
|
+
reject: (e) => {
|
|
1224
|
+
done();
|
|
1225
|
+
reject(e);
|
|
1226
|
+
},
|
|
1227
|
+
settle: (msg) => {
|
|
1228
|
+
done();
|
|
1229
|
+
if (msg.error) reject(new Error(msg.error.message));
|
|
1230
|
+
else resolve(msg.result);
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
this.#ws.send(JSON.stringify({
|
|
1234
|
+
id,
|
|
1235
|
+
method,
|
|
1236
|
+
params
|
|
1237
|
+
}));
|
|
1238
|
+
});
|
|
1019
1239
|
}
|
|
1020
1240
|
close() {
|
|
1241
|
+
this.#fail(/* @__PURE__ */ new Error("the capture closed its DevTools connection"));
|
|
1021
1242
|
this.#ws.close();
|
|
1022
1243
|
}
|
|
1023
1244
|
};
|
|
1024
|
-
|
|
1245
|
+
/** Canceling stops the wait: a browser killed before it wrote the file never will. */
|
|
1246
|
+
function waitForPortFile(file, timeoutMs, signal) {
|
|
1025
1247
|
const deadline = Date.now() + timeoutMs;
|
|
1026
1248
|
return new Promise((resolve, reject) => {
|
|
1027
1249
|
const tick = () => {
|
|
@@ -1033,6 +1255,10 @@ function waitForPortFile(file, timeoutMs) {
|
|
|
1033
1255
|
return;
|
|
1034
1256
|
}
|
|
1035
1257
|
}
|
|
1258
|
+
if (signal?.aborted) {
|
|
1259
|
+
reject(signal.reason);
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1036
1262
|
if (Date.now() > deadline) {
|
|
1037
1263
|
reject(/* @__PURE__ */ new Error("chrome-headless-shell did not open a DevTools port"));
|
|
1038
1264
|
return;
|
|
@@ -1141,7 +1367,9 @@ function proxyArgs(proxy) {
|
|
|
1141
1367
|
return proxy ? [`--proxy-server=http://${proxy}`, "--proxy-bypass-list=<-loopback>"] : [];
|
|
1142
1368
|
}
|
|
1143
1369
|
/** One Chrome process, one tab. `fn` must not keep the session after it returns. */
|
|
1144
|
-
async function withChrome(bin, window, timeoutMs, options, fn) {
|
|
1370
|
+
async function withChrome(bin, window, timeoutMs, options, fn, signal) {
|
|
1371
|
+
signal?.throwIfAborted();
|
|
1372
|
+
const deadline = Date.now() + timeoutMs;
|
|
1145
1373
|
const userData = mkdtempSync(join(tmpdir(), `reeval-chrome-${process.pid}-`));
|
|
1146
1374
|
const child = spawn(bin, [
|
|
1147
1375
|
"--headless",
|
|
@@ -1155,16 +1383,24 @@ async function withChrome(bin, window, timeoutMs, options, fn) {
|
|
|
1155
1383
|
"--remote-debugging-port=0",
|
|
1156
1384
|
...proxyArgs(options.proxy),
|
|
1157
1385
|
"about:blank"
|
|
1158
|
-
], { stdio:
|
|
1159
|
-
|
|
1160
|
-
"
|
|
1161
|
-
|
|
1162
|
-
|
|
1386
|
+
], { stdio: "ignore" });
|
|
1387
|
+
const kill = () => {
|
|
1388
|
+
if (child.exitCode === null && child.signalCode === null) child.kill("SIGKILL");
|
|
1389
|
+
};
|
|
1390
|
+
signal?.addEventListener("abort", kill, { once: true });
|
|
1163
1391
|
try {
|
|
1164
|
-
const cdp = await cdpConnect(await pageDebuggerUrl(await waitForPortFile(join(userData, "DevToolsActivePort"), timeoutMs), timeoutMs), timeoutMs);
|
|
1392
|
+
const cdp = await cdpConnect(await pageDebuggerUrl(await waitForPortFile(join(userData, "DevToolsActivePort"), timeoutMs, signal), timeoutMs), timeoutMs);
|
|
1393
|
+
cdp.callMs = () => deadline - Date.now();
|
|
1394
|
+
const abort = () => cdp.close();
|
|
1395
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
1165
1396
|
try {
|
|
1166
1397
|
await cdp.send("Page.enable");
|
|
1167
1398
|
await cdp.send("Page.setLifecycleEventsEnabled", { enabled: true });
|
|
1399
|
+
const watched = watchPage(cdp);
|
|
1400
|
+
const mainFrame = (await cdp.send("Page.getFrameTree"))?.frameTree?.frame?.id;
|
|
1401
|
+
if (mainFrame) watched.mainFrame(mainFrame);
|
|
1402
|
+
await cdp.send("Runtime.enable");
|
|
1403
|
+
await cdp.send("Log.enable");
|
|
1168
1404
|
const network = trackNetwork(cdp);
|
|
1169
1405
|
const loading = /* @__PURE__ */ new Set();
|
|
1170
1406
|
const frame = (msg) => {
|
|
@@ -1192,7 +1428,7 @@ async function withChrome(bin, window, timeoutMs, options, fn) {
|
|
|
1192
1428
|
mobile: false
|
|
1193
1429
|
});
|
|
1194
1430
|
let scrollY = 0;
|
|
1195
|
-
|
|
1431
|
+
const run = fn({
|
|
1196
1432
|
cdp,
|
|
1197
1433
|
window,
|
|
1198
1434
|
async navigate(url) {
|
|
@@ -1226,12 +1462,32 @@ async function withChrome(bin, window, timeoutMs, options, fn) {
|
|
|
1226
1462
|
},
|
|
1227
1463
|
dialogs() {
|
|
1228
1464
|
return opened.splice(0);
|
|
1465
|
+
},
|
|
1466
|
+
async page(origin) {
|
|
1467
|
+
const history = await cdp.send("Page.getNavigationHistory").catch(() => void 0);
|
|
1468
|
+
const url = history?.entries?.[history.currentIndex ?? -1]?.url ?? "";
|
|
1469
|
+
return watched.facts(url, origin);
|
|
1229
1470
|
}
|
|
1230
1471
|
});
|
|
1472
|
+
if (!signal) return await run;
|
|
1473
|
+
run.catch(() => {});
|
|
1474
|
+
let stop = () => {};
|
|
1475
|
+
const canceled = new Promise((_, reject) => {
|
|
1476
|
+
stop = () => reject(signal.reason);
|
|
1477
|
+
if (signal.aborted) stop();
|
|
1478
|
+
else signal.addEventListener("abort", stop, { once: true });
|
|
1479
|
+
});
|
|
1480
|
+
try {
|
|
1481
|
+
return await Promise.race([run, canceled]);
|
|
1482
|
+
} finally {
|
|
1483
|
+
signal.removeEventListener("abort", stop);
|
|
1484
|
+
}
|
|
1231
1485
|
} finally {
|
|
1486
|
+
signal?.removeEventListener("abort", abort);
|
|
1232
1487
|
cdp.close();
|
|
1233
1488
|
}
|
|
1234
1489
|
} finally {
|
|
1490
|
+
signal?.removeEventListener("abort", kill);
|
|
1235
1491
|
await disposeChrome(child, userData);
|
|
1236
1492
|
}
|
|
1237
1493
|
}
|
|
@@ -1247,8 +1503,7 @@ async function navigateAndWait(session, url, wait, timeoutMs) {
|
|
|
1247
1503
|
const nav = await session.navigate(url);
|
|
1248
1504
|
await page.ready(nav, timeoutMs);
|
|
1249
1505
|
}
|
|
1250
|
-
|
|
1251
|
-
//#region src/capture/poll.ts
|
|
1506
|
+
// src/capture/poll.ts
|
|
1252
1507
|
/** A dev server still starting (Nuxt's loading page) or a proxy whose upstream isn't up yet. */
|
|
1253
1508
|
const STARTING = /* @__PURE__ */ new Set([
|
|
1254
1509
|
502,
|
|
@@ -1280,8 +1535,7 @@ async function pollHttp(url, timeoutMs, signal) {
|
|
|
1280
1535
|
if (answered) return;
|
|
1281
1536
|
throw last instanceof Error ? last : /* @__PURE__ */ new Error("poll timed out");
|
|
1282
1537
|
}
|
|
1283
|
-
|
|
1284
|
-
//#region src/capture/stub.ts
|
|
1538
|
+
// src/capture/stub.ts
|
|
1285
1539
|
const PNG_SIG = Buffer.from([
|
|
1286
1540
|
137,
|
|
1287
1541
|
80,
|
|
@@ -1333,8 +1587,7 @@ function pngSize(bytes) {
|
|
|
1333
1587
|
height: view.readUInt32BE(4)
|
|
1334
1588
|
};
|
|
1335
1589
|
}
|
|
1336
|
-
|
|
1337
|
-
//#region src/capture/index.ts
|
|
1590
|
+
// src/capture/index.ts
|
|
1338
1591
|
/** Default CSS pixels when the call and cascade omit `viewport`. */
|
|
1339
1592
|
const DEFAULT_VIEWPORT = {
|
|
1340
1593
|
width: 1280,
|
|
@@ -1464,8 +1717,7 @@ function pageUrl(origin, path) {
|
|
|
1464
1717
|
const rel = path.startsWith("/") ? path.slice(1) : path;
|
|
1465
1718
|
return new URL(rel, base).href;
|
|
1466
1719
|
}
|
|
1467
|
-
|
|
1468
|
-
//#region src/capture/loopback.ts
|
|
1720
|
+
// src/capture/loopback.ts
|
|
1469
1721
|
/**
|
|
1470
1722
|
* `localhost`, `*.localhost`, `127.0.0.0/8`, `::1`, their IPv4-mapped IPv6 form and the
|
|
1471
1723
|
* unspecified addresses, with or without a trailing dot: the names a page means the sandbox by.
|
|
@@ -1654,8 +1906,7 @@ async function startLoopbackProxy(options) {
|
|
|
1654
1906
|
})
|
|
1655
1907
|
};
|
|
1656
1908
|
}
|
|
1657
|
-
|
|
1658
|
-
//#region src/capture/png.ts
|
|
1909
|
+
// src/capture/png.ts
|
|
1659
1910
|
const CHANNELS = {
|
|
1660
1911
|
0: 1,
|
|
1661
1912
|
2: 3,
|
|
@@ -1744,8 +1995,7 @@ function pageChanged(before, after) {
|
|
|
1744
1995
|
}
|
|
1745
1996
|
return differ > sampled * VIEW_CHANGE;
|
|
1746
1997
|
}
|
|
1747
|
-
|
|
1748
|
-
//#region src/capture/page-state.ts
|
|
1998
|
+
// src/capture/page-state.ts
|
|
1749
1999
|
const FIELDS = [
|
|
1750
2000
|
"url",
|
|
1751
2001
|
"focus",
|
|
@@ -1853,14 +2103,43 @@ async function settledState(session, volatile, left) {
|
|
|
1853
2103
|
prev = next;
|
|
1854
2104
|
}
|
|
1855
2105
|
}
|
|
2106
|
+
/** How long a settled page is watched for a change still to come after a move that ends its instruction. */
|
|
2107
|
+
const LATE_CHANGE_MS = 1e3;
|
|
2108
|
+
/**
|
|
2109
|
+
* The page once a change that starts within `LATE_CHANGE_MS` of `settled` has settled too, or
|
|
2110
|
+
* `settled`: an auth callback's redirect or a save's message often comes a beat after the
|
|
2111
|
+
* request that made it, and the next instruction's first look must not be the page before it.
|
|
2112
|
+
*/
|
|
2113
|
+
async function lateSettledState(session, settled, volatile, left) {
|
|
2114
|
+
const until = Date.now() + Math.min(LATE_CHANGE_MS, left());
|
|
2115
|
+
while (Date.now() < until) {
|
|
2116
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(100, left())));
|
|
2117
|
+
if (differing(settled, await probePage(session), volatile).length || session.busy()) return settledState(session, volatile, left);
|
|
2118
|
+
}
|
|
2119
|
+
return settled;
|
|
2120
|
+
}
|
|
1856
2121
|
/** Points within this many CSS pixels of each other are the same move. */
|
|
1857
2122
|
const SAME_POINT = 8;
|
|
1858
2123
|
/** Model turns in a row thrown away because the page changed while the model chose. */
|
|
1859
2124
|
const STALE_ASKS = 2;
|
|
2125
|
+
/** How long a stopped instruction's screenshot may take once the budget is spent. */
|
|
2126
|
+
const STOPPED_SHOT_MS = 5e3;
|
|
1860
2127
|
function timedOut(clock) {
|
|
1861
2128
|
const { step } = clock;
|
|
1862
2129
|
const where = step ? ` (instruction ${step.index} of ${step.total}, after ${plural(step.moves, "move")})` : "";
|
|
1863
|
-
return /* @__PURE__ */ new Error(`c.capture() timed out on ${clock.detail}${where}: it used all of its ${formatDuration(clock.budgetMs)} timeout. Raise timeout on the call or capture.timeout.`);
|
|
2130
|
+
return /* @__PURE__ */ new Error(`c.capture() timed out on ${clock.detail}${where}: it used all of its ${formatDuration(clock.budgetMs)} timeout${stallReason(clock)}. Raise timeout on the call or capture.timeout.`);
|
|
2131
|
+
}
|
|
2132
|
+
/** Why the instruction's moves never finished it, as a clause; empty when nothing says. */
|
|
2133
|
+
function stallReason({ step, trail }) {
|
|
2134
|
+
if (!step || !trail) return "";
|
|
2135
|
+
const paths = [trail.start, ...trail.made.map((m) => m.after)].flatMap((s) => s ? [pathOf(s.url, trail.origin) ?? s.url] : []);
|
|
2136
|
+
for (let k = 2; k < paths.length; k++) {
|
|
2137
|
+
const path = paths[k];
|
|
2138
|
+
const first = paths.indexOf(path);
|
|
2139
|
+
if (first < k && paths.slice(first + 1, k).some((p) => p !== path)) return `; its moves left ${path} and came back to it, so the model may be undoing what it did`;
|
|
2140
|
+
}
|
|
2141
|
+
if (trail.choosing) return `; the model was still choosing move ${step.moves + 1}`;
|
|
2142
|
+
return "";
|
|
1864
2143
|
}
|
|
1865
2144
|
function check(clock) {
|
|
1866
2145
|
const left = clock.remaining();
|
|
@@ -1893,7 +2172,8 @@ function onClock(session, clock) {
|
|
|
1893
2172
|
screenshot: (fullPage) => race(clock, () => session.screenshot(fullPage)),
|
|
1894
2173
|
dispatch: (action, page) => race(clock, () => session.dispatch(action, page)),
|
|
1895
2174
|
busy: () => session.busy(),
|
|
1896
|
-
dialogs: () => session.dialogs()
|
|
2175
|
+
dialogs: () => session.dialogs(),
|
|
2176
|
+
page: (origin) => session.page(origin)
|
|
1897
2177
|
};
|
|
1898
2178
|
}
|
|
1899
2179
|
function asUsage(value) {
|
|
@@ -1906,19 +2186,33 @@ function asUsage(value) {
|
|
|
1906
2186
|
};
|
|
1907
2187
|
}
|
|
1908
2188
|
const finite = (value) => {
|
|
1909
|
-
const n = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
2189
|
+
const n = typeof value === "number" ? value : typeof value === "string" && value.trim() ? Number(value) : NaN;
|
|
1910
2190
|
return Number.isFinite(n) ? n : void 0;
|
|
1911
2191
|
};
|
|
1912
|
-
/**
|
|
2192
|
+
/**
|
|
2193
|
+
* The point at `x`/`y`, or both packed into one as `"217,163"`, which models sometimes send. A
|
|
2194
|
+
* half missing from the packed form (`"217,"`) is read from its own field.
|
|
2195
|
+
*/
|
|
1913
2196
|
function point(input, x, y) {
|
|
1914
2197
|
const packed = typeof input[x] === "string" ? input[x].split(",") : [];
|
|
1915
|
-
const px =
|
|
1916
|
-
const py =
|
|
2198
|
+
const px = packed.length === 2 ? finite(packed[0]) ?? finite(input[x]) : finite(input[x]);
|
|
2199
|
+
const py = packed.length === 2 ? finite(packed[1]) ?? finite(input[y]) : finite(input[y]);
|
|
1917
2200
|
return px === void 0 || py === void 0 ? void 0 : [px, py];
|
|
1918
2201
|
}
|
|
1919
|
-
/**
|
|
2202
|
+
/**
|
|
2203
|
+
* The action a tool call asks for, or why it can't be made. Only a click or a key press can
|
|
2204
|
+
* complete its goal: offered on `type`, models mark the text as final, not the goal.
|
|
2205
|
+
*/
|
|
1920
2206
|
function actionFromTool(name, input) {
|
|
1921
2207
|
if (name === "done") return { type: "done" };
|
|
2208
|
+
const move = moveFromTool(name, input);
|
|
2209
|
+
if ("refused" in move || move.type !== "click" && move.type !== "key") return move;
|
|
2210
|
+
return input.completesGoal === true || input.completesGoal === "true" ? {
|
|
2211
|
+
...move,
|
|
2212
|
+
final: true
|
|
2213
|
+
} : move;
|
|
2214
|
+
}
|
|
2215
|
+
function moveFromTool(name, input) {
|
|
1922
2216
|
if (name === "type") {
|
|
1923
2217
|
if (typeof input.text !== "string") return { refused: "it had no text" };
|
|
1924
2218
|
return {
|
|
@@ -1997,13 +2291,15 @@ function scalePoints(action, page) {
|
|
|
1997
2291
|
default: return action;
|
|
1998
2292
|
}
|
|
1999
2293
|
}
|
|
2000
|
-
const systemPrompt = (normalized) => `You drive a web page from screenshots. Call one tool. ${normalized ? `Coordinates are normalized to 0-${NORMALIZED} on the full-page image: x and toX across its width, y and toY down its height. A scroll's dy is in CSS pixels.` : "Coordinates are CSS pixels on the full-page image."} Each turn you get the goal, what has focus, your earlier moves with what each did, and a fresh screenshot. Click a field before typing into it, and do not repeat a move that already worked. A dropdown (select) never opens in the screenshot: click it once, press ArrowDown or ArrowUp until it shows the option you want, then press Enter to choose it. Call done when the goal is met. Do not mention CDP.`;
|
|
2294
|
+
const systemPrompt = (normalized) => `You drive a web page from screenshots. Call one tool. ${normalized ? `Coordinates are normalized to 0-${NORMALIZED} on the full-page image: x and toX across its width, y and toY down its height. A scroll's dy is in CSS pixels.` : "Coordinates are CSS pixels on the full-page image."} Each turn you get the goal, what has focus, your earlier moves with what each did, and a fresh screenshot. Click a field before typing into it, and do not repeat a move that already worked. A dropdown (select) never opens in the screenshot: click it once, press ArrowDown or ArrowUp until it shows the option you want, then press Enter to choose it. On a click or key press after which nothing of the goal is left, such as the click that submits a form you have filled in, set completesGoal to true: reeval makes it and goes on to the next goal without asking you again. Call done when the goal is met. Do not mention CDP.`;
|
|
2295
|
+
const completesGoal = z.boolean().optional().describe("True only on the last move the goal needs: nothing of the goal is left after it.");
|
|
2001
2296
|
const useTools = {
|
|
2002
2297
|
click: tool({
|
|
2003
2298
|
description: "Click at (x, y) on the screenshot.",
|
|
2004
2299
|
inputSchema: z.object({
|
|
2005
2300
|
x: z.number(),
|
|
2006
|
-
y: z.number()
|
|
2301
|
+
y: z.number(),
|
|
2302
|
+
completesGoal
|
|
2007
2303
|
})
|
|
2008
2304
|
}),
|
|
2009
2305
|
type: tool({
|
|
@@ -2015,7 +2311,10 @@ const useTools = {
|
|
|
2015
2311
|
}),
|
|
2016
2312
|
key: tool({
|
|
2017
2313
|
description: "Press a key in the focused element. In a dropdown (select), click it, press ArrowDown or ArrowUp to the option, then Enter to choose it. Space toggles a focused checkbox.",
|
|
2018
|
-
inputSchema: z.object({
|
|
2314
|
+
inputSchema: z.object({
|
|
2315
|
+
key: z.enum(CAPTURE_KEYS),
|
|
2316
|
+
completesGoal
|
|
2317
|
+
})
|
|
2019
2318
|
}),
|
|
2020
2319
|
scroll: tool({
|
|
2021
2320
|
description: "Wheel-scroll a constrained scroller at (x, y).",
|
|
@@ -2055,8 +2354,11 @@ async function runFakeScript(session, script, step, clock, volatile) {
|
|
|
2055
2354
|
moves
|
|
2056
2355
|
};
|
|
2057
2356
|
check(clock);
|
|
2058
|
-
if (action.type === "done") return
|
|
2059
|
-
|
|
2357
|
+
if (action.type === "done") return {
|
|
2358
|
+
moves,
|
|
2359
|
+
ended: "done"
|
|
2360
|
+
};
|
|
2361
|
+
if (moves >= 32) throw unfinished(step, clock);
|
|
2060
2362
|
const page = pngSize(await session.screenshot(true));
|
|
2061
2363
|
debugTrace("check", "capture-use", {
|
|
2062
2364
|
goal,
|
|
@@ -2065,7 +2367,14 @@ async function runFakeScript(session, script, step, clock, volatile) {
|
|
|
2065
2367
|
}, `capture use ${action.type}`);
|
|
2066
2368
|
await session.dispatch(action, page);
|
|
2067
2369
|
moves++;
|
|
2068
|
-
await settledState(session, volatile, clock.remaining);
|
|
2370
|
+
const settled = await settledState(session, volatile, clock.remaining);
|
|
2371
|
+
if (action.final) {
|
|
2372
|
+
await lateSettledState(session, settled, volatile, clock.remaining);
|
|
2373
|
+
return {
|
|
2374
|
+
moves,
|
|
2375
|
+
ended: "final"
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2069
2378
|
}
|
|
2070
2379
|
clock.step = {
|
|
2071
2380
|
...step,
|
|
@@ -2074,9 +2383,9 @@ async function runFakeScript(session, script, step, clock, volatile) {
|
|
|
2074
2383
|
while (clock.remaining() > 0) await new Promise((resolve) => setTimeout(resolve, Math.min(100, clock.remaining())));
|
|
2075
2384
|
throw timedOut(clock);
|
|
2076
2385
|
}
|
|
2077
|
-
const unfinished = (step) => /* @__PURE__ */ new Error(`c.capture() instruction ${step.index} of ${step.total} ${JSON.stringify(step.goal)} did not finish in 32 moves`);
|
|
2386
|
+
const unfinished = (step, clock) => /* @__PURE__ */ new Error(`c.capture() instruction ${step.index} of ${step.total} ${JSON.stringify(step.goal)} did not finish in 32 moves${stallReason(clock)}`);
|
|
2078
2387
|
const grid = (n) => Math.round(n / SAME_POINT);
|
|
2079
|
-
function moveKey(action) {
|
|
2388
|
+
function moveKey({ final: _, ...action }) {
|
|
2080
2389
|
switch (action.type) {
|
|
2081
2390
|
case "click":
|
|
2082
2391
|
case "hover": return JSON.stringify([
|
|
@@ -2148,6 +2457,9 @@ function goalPrompt(step, earlier, now, moves, origin, volatile = /* @__PURE__ *
|
|
|
2148
2457
|
lines.push(`${i + 1}. ${m.said}${effect ? ` → ${effect}` : ""}`);
|
|
2149
2458
|
});
|
|
2150
2459
|
if (stuckMoves(moves) >= 2) lines.push("Your last moves repeated the same action and nothing changed. Do not repeat it: if the goal is met, call done; otherwise try a different action.");
|
|
2460
|
+
const from = pathOf(moves.find((m) => m.before)?.before?.url, origin);
|
|
2461
|
+
const at = pathOf(now.url, origin);
|
|
2462
|
+
if (from && at && from !== at) lines.push(`Your moves took the page from ${from} to ${at}. If they did what the goal asks, call done: a goal's "once", "if" or "when" says where it starts, so do not undo them to get back there.`);
|
|
2151
2463
|
return lines.join("\n");
|
|
2152
2464
|
}
|
|
2153
2465
|
async function runModelGoal(session, { step, earlier, origin, modelName, clock, volatile, pristine, loadModel }) {
|
|
@@ -2159,6 +2471,13 @@ async function runModelGoal(session, { step, earlier, origin, modelName, clock,
|
|
|
2159
2471
|
let usage = null;
|
|
2160
2472
|
let now = await probePage(session);
|
|
2161
2473
|
let stale = 0;
|
|
2474
|
+
const trail = {
|
|
2475
|
+
origin,
|
|
2476
|
+
start: now,
|
|
2477
|
+
made,
|
|
2478
|
+
choosing: false
|
|
2479
|
+
};
|
|
2480
|
+
clock.trail = trail;
|
|
2162
2481
|
while (made.length < 32) {
|
|
2163
2482
|
clock.step = {
|
|
2164
2483
|
...step,
|
|
@@ -2183,6 +2502,7 @@ async function runModelGoal(session, { step, earlier, origin, modelName, clock,
|
|
|
2183
2502
|
}, false);
|
|
2184
2503
|
const signal = AbortSignal.timeout(check(clock));
|
|
2185
2504
|
const asked = Date.now();
|
|
2505
|
+
trail.choosing = true;
|
|
2186
2506
|
const result = await race(clock, () => generateText({
|
|
2187
2507
|
model,
|
|
2188
2508
|
system: systemPrompt(normalized),
|
|
@@ -2204,6 +2524,7 @@ async function runModelGoal(session, { step, earlier, origin, modelName, clock,
|
|
|
2204
2524
|
})).catch((error) => {
|
|
2205
2525
|
throw signal.aborted ? timedOut(clock) : error;
|
|
2206
2526
|
});
|
|
2527
|
+
trail.choosing = false;
|
|
2207
2528
|
usage = addUsage(usage, asUsage(result.usage ?? {}));
|
|
2208
2529
|
const call = result.toolCalls?.[0];
|
|
2209
2530
|
if (!call) throw new Error(`c.capture() instruction ${JSON.stringify(goal)} returned no action`);
|
|
@@ -2212,13 +2533,11 @@ async function runModelGoal(session, { step, earlier, origin, modelName, clock,
|
|
|
2212
2533
|
const fresh = await probePage(session);
|
|
2213
2534
|
const opened = session.dialogs();
|
|
2214
2535
|
const moved = differing(now, fresh, volatile);
|
|
2215
|
-
if (!last) {
|
|
2216
|
-
if (
|
|
2217
|
-
for (const f of moved) if (f !== "url" && f !== "focus") volatile.add(f);
|
|
2218
|
-
}
|
|
2536
|
+
if (!last && pristine) {
|
|
2537
|
+
for (const f of moved) if (f !== "url" && f !== "focus") volatile.add(f);
|
|
2219
2538
|
} else if ((moved.length || opened.length) && stale < STALE_ASKS) {
|
|
2220
2539
|
stale++;
|
|
2221
|
-
if (!last.refused) {
|
|
2540
|
+
if (last && !last.refused) {
|
|
2222
2541
|
last.dialogs.push(...opened);
|
|
2223
2542
|
settleMove(last, fresh, origin, volatile);
|
|
2224
2543
|
}
|
|
@@ -2251,9 +2570,10 @@ async function runModelGoal(session, { step, earlier, origin, modelName, clock,
|
|
|
2251
2570
|
action: chosen,
|
|
2252
2571
|
page
|
|
2253
2572
|
}, `capture use ${chosen.type}`);
|
|
2254
|
-
if (
|
|
2573
|
+
if (asks.type === "done") return {
|
|
2255
2574
|
moves: dispatched,
|
|
2256
|
-
usage
|
|
2575
|
+
usage,
|
|
2576
|
+
ended: "done"
|
|
2257
2577
|
};
|
|
2258
2578
|
const move = {
|
|
2259
2579
|
said,
|
|
@@ -2267,8 +2587,28 @@ async function runModelGoal(session, { step, earlier, origin, modelName, clock,
|
|
|
2267
2587
|
now = await settledState(session, volatile, clock.remaining);
|
|
2268
2588
|
move.dialogs.push(...session.dialogs());
|
|
2269
2589
|
settleMove(move, now, origin, volatile);
|
|
2590
|
+
if (asks.final && move.changed) {
|
|
2591
|
+
await lateSettledState(session, now, volatile, clock.remaining);
|
|
2592
|
+
return {
|
|
2593
|
+
moves: dispatched,
|
|
2594
|
+
usage,
|
|
2595
|
+
ended: "final"
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2270
2598
|
}
|
|
2271
|
-
|
|
2599
|
+
clock.step = {
|
|
2600
|
+
...step,
|
|
2601
|
+
moves: dispatched
|
|
2602
|
+
};
|
|
2603
|
+
throw unfinished(step, clock);
|
|
2604
|
+
}
|
|
2605
|
+
/** The page once an instruction stopped the capture, unless the screenshot takes too long. */
|
|
2606
|
+
async function stoppedShot(raw, fullPage) {
|
|
2607
|
+
let timer;
|
|
2608
|
+
const late = new Promise((resolve) => {
|
|
2609
|
+
timer = setTimeout(() => resolve(void 0), STOPPED_SHOT_MS);
|
|
2610
|
+
});
|
|
2611
|
+
return Promise.race([raw.screenshot(fullPage).catch(() => void 0), late]).finally(() => clearTimeout(timer));
|
|
2272
2612
|
}
|
|
2273
2613
|
/**
|
|
2274
2614
|
* Top-level wait, then the instruction loop, then the saved PNG.
|
|
@@ -2310,23 +2650,56 @@ async function runJourney(raw, url, options) {
|
|
|
2310
2650
|
clock.step = step;
|
|
2311
2651
|
check(clock);
|
|
2312
2652
|
debugLog("check", `capture instruction ${step.index} of ${step.total} ${JSON.stringify(instruction)}`);
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2653
|
+
const began = Date.now();
|
|
2654
|
+
const shot = (png, ran) => {
|
|
2655
|
+
const ms = Date.now() - began;
|
|
2656
|
+
debugLog("check", `capture instruction ${step.index} of ${step.total} ${ran.ended} after ${plural(ran.moves, "move")} in ${formatDuration(ms)}`);
|
|
2657
|
+
return options.onStep?.({
|
|
2658
|
+
index: step.index,
|
|
2659
|
+
instruction,
|
|
2660
|
+
moves: ran.moves,
|
|
2661
|
+
ms,
|
|
2662
|
+
ended: ran.ended,
|
|
2663
|
+
png
|
|
2664
|
+
});
|
|
2665
|
+
};
|
|
2666
|
+
try {
|
|
2667
|
+
let ran;
|
|
2668
|
+
if (use && "fake" in use) ran = await runFakeScript(session, use.fake[stringIndex] ?? [], step, clock, volatile);
|
|
2669
|
+
else if (use && "model" in use) {
|
|
2670
|
+
if (!options.loadModel) throw new Error("c.capture() instructions need a model loader");
|
|
2671
|
+
const goal = await runModelGoal(session, {
|
|
2672
|
+
step,
|
|
2673
|
+
earlier: goals.slice(0, stringIndex),
|
|
2674
|
+
origin,
|
|
2675
|
+
modelName: use.model,
|
|
2676
|
+
clock,
|
|
2677
|
+
volatile,
|
|
2678
|
+
pristine: moves === 0,
|
|
2679
|
+
loadModel: options.loadModel
|
|
2680
|
+
});
|
|
2681
|
+
usage = addUsage(usage, goal.usage);
|
|
2682
|
+
ran = goal;
|
|
2683
|
+
}
|
|
2684
|
+
if (ran) {
|
|
2685
|
+
moves += ran.moves;
|
|
2686
|
+
clock.step = {
|
|
2687
|
+
...step,
|
|
2688
|
+
moves: ran.moves
|
|
2689
|
+
};
|
|
2690
|
+
clock.trail = void 0;
|
|
2691
|
+
shot(await session.screenshot(fullPage), ran);
|
|
2692
|
+
}
|
|
2693
|
+
} catch (error) {
|
|
2694
|
+
clock.trail = void 0;
|
|
2695
|
+
const png = options.onStep && await stoppedShot(raw, fullPage);
|
|
2696
|
+
const saved = png && shot(png, {
|
|
2697
|
+
moves: clock.step?.moves ?? 0,
|
|
2698
|
+
ended: "stopped"
|
|
2327
2699
|
});
|
|
2328
|
-
|
|
2329
|
-
|
|
2700
|
+
if (!saved || !(error instanceof Error)) throw error;
|
|
2701
|
+
const sentence = error.message.endsWith(".") ? error.message : `${error.message}.`;
|
|
2702
|
+
throw new Error(`${sentence} The page as it stopped: ${saved}.`);
|
|
2330
2703
|
}
|
|
2331
2704
|
stringIndex++;
|
|
2332
2705
|
}
|
|
@@ -2348,8 +2721,7 @@ function captureUseSpend(result) {
|
|
|
2348
2721
|
usage: result.usage
|
|
2349
2722
|
};
|
|
2350
2723
|
}
|
|
2351
|
-
|
|
2352
|
-
//#region src/diff.ts
|
|
2724
|
+
// src/diff.ts
|
|
2353
2725
|
const GIT = "git -c user.name=reeval -c user.email=reeval@localhost -c core.hooksPath=/dev/null -c core.logAllRefUpdates=false -c gc.auto=0 -c core.quotePath=false";
|
|
2354
2726
|
const snapshotEnv = (sandbox) => `export GIT_DIR=${shellQuote(`${sandbox.stateDir}/workspace.git`)} GIT_WORK_TREE=${shellQuote(sandbox.workdir)} GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null`;
|
|
2355
2727
|
/** Points HEAD at a commit of `$tree` with no parent, then drops every object nothing reaches. */
|
|
@@ -2405,8 +2777,7 @@ async function workspaceFiles(sandbox, signal) {
|
|
|
2405
2777
|
if (r.exitCode !== 0) throw new InfraError(`Failed to list the workspace's files: ${r.stderr.trim()}`);
|
|
2406
2778
|
return r.stdout.split("\0").filter(Boolean).sort();
|
|
2407
2779
|
}
|
|
2408
|
-
|
|
2409
|
-
//#region src/attempt/checks.ts
|
|
2780
|
+
// src/attempt/checks.ts
|
|
2410
2781
|
/** Runs a check or setup step with the checks' brokered secrets swapped in (see brokerPhases). */
|
|
2411
2782
|
const asCheck = (a, fn) => a.phases ? a.phases.checks(fn) : fn();
|
|
2412
2783
|
/** The attempt's sandbox, started (with its session) by the first call that needs it. */
|
|
@@ -2476,7 +2847,7 @@ function createChecks(a) {
|
|
|
2476
2847
|
function exec(command, options) {
|
|
2477
2848
|
const problem = options === void 0 ? void 0 : execOptionsProblem(options);
|
|
2478
2849
|
if (problem) return Promise.reject(new UsageError(problem));
|
|
2479
|
-
if (options?.background) return import("./capture-
|
|
2850
|
+
if (options?.background) return import("./capture-DagM1npp.js").then(({ startBackground }) => startBackground(a, command, "c.exec({ background: true })"));
|
|
2480
2851
|
const run = execForeground(command, options?.retries ?? 0, options?.interval ?? 1e3);
|
|
2481
2852
|
return Object.defineProperty(run, SUBJECT, { value: command });
|
|
2482
2853
|
}
|
|
@@ -2498,8 +2869,7 @@ function createChecks(a) {
|
|
|
2498
2869
|
writeFile
|
|
2499
2870
|
};
|
|
2500
2871
|
}
|
|
2501
|
-
|
|
2502
|
-
//#region src/attempt/capture.ts
|
|
2872
|
+
// src/attempt/capture.ts
|
|
2503
2873
|
const BG_LOG = "/tmp/reeval-bg";
|
|
2504
2874
|
const BG_TAG = "REEVAL_BACKGROUND";
|
|
2505
2875
|
const isEvaluationModel = (model) => model.startsWith("typesafe-ai/");
|
|
@@ -2645,7 +3015,34 @@ async function capturePage(a, target, call) {
|
|
|
2645
3015
|
const started = Date.now();
|
|
2646
3016
|
const remaining = () => Math.max(0, resolved.timeoutMs - (Date.now() - started));
|
|
2647
3017
|
let moves = 0;
|
|
2648
|
-
const
|
|
3018
|
+
const camera = {
|
|
3019
|
+
port: resolved.port,
|
|
3020
|
+
path: resolved.path,
|
|
3021
|
+
viewport: resolved.window,
|
|
3022
|
+
...resolved.fullPage ? { fullPage: true } : {}
|
|
3023
|
+
};
|
|
3024
|
+
const steps = [];
|
|
3025
|
+
const keepSteps = () => {
|
|
3026
|
+
for (const { name, png, step } of steps) {
|
|
3027
|
+
a.record.artifacts = a.record.artifacts ?? [];
|
|
3028
|
+
a.record.artifacts.push({
|
|
3029
|
+
name,
|
|
3030
|
+
mediaType: "image/png",
|
|
3031
|
+
sha256: sha256(png),
|
|
3032
|
+
bytes: png.length,
|
|
3033
|
+
capture: {
|
|
3034
|
+
...camera,
|
|
3035
|
+
step
|
|
3036
|
+
}
|
|
3037
|
+
});
|
|
3038
|
+
a.stepBlobs.set(name, png);
|
|
3039
|
+
}
|
|
3040
|
+
};
|
|
3041
|
+
const url = pageUrl(origin, resolved.path);
|
|
3042
|
+
const { png, page } = fake ? {
|
|
3043
|
+
png: stubPng(resolved.name, resolved.port, resolved.path, resolved.viewport),
|
|
3044
|
+
page: await fetchedPage(url, origin, remaining(), a.signal)
|
|
3045
|
+
} : await shot(a, origin, url, {
|
|
2649
3046
|
...resolved,
|
|
2650
3047
|
use
|
|
2651
3048
|
}, remaining, (n) => {
|
|
@@ -2653,7 +3050,28 @@ async function capturePage(a, target, call) {
|
|
|
2653
3050
|
}, (port) => tunnel({
|
|
2654
3051
|
port,
|
|
2655
3052
|
protocol: "http"
|
|
2656
|
-
}).then((t) => t.url))
|
|
3053
|
+
}).then((t) => t.url), ({ png, ...step }) => {
|
|
3054
|
+
const name = `${resolved.name}.step-${step.index}`;
|
|
3055
|
+
steps.push({
|
|
3056
|
+
name,
|
|
3057
|
+
png,
|
|
3058
|
+
step: {
|
|
3059
|
+
of: resolved.name,
|
|
3060
|
+
...step
|
|
3061
|
+
}
|
|
3062
|
+
});
|
|
3063
|
+
return `artifacts/${name}.png`;
|
|
3064
|
+
}).catch((error) => {
|
|
3065
|
+
keepSteps();
|
|
3066
|
+
throw error;
|
|
3067
|
+
});
|
|
3068
|
+
tracePage(resolved.name, page);
|
|
3069
|
+
const facts = {
|
|
3070
|
+
schemaVersion: 1,
|
|
3071
|
+
...page
|
|
3072
|
+
};
|
|
3073
|
+
const pageJson = `${redactJson(facts, 2)}\n`;
|
|
3074
|
+
a.capturePages.set(resolved.name, pageJson);
|
|
2657
3075
|
const digest = sha256(png);
|
|
2658
3076
|
const file = {
|
|
2659
3077
|
path: `artifacts/${resolved.name}.png`,
|
|
@@ -2662,15 +3080,19 @@ async function capturePage(a, target, call) {
|
|
|
2662
3080
|
};
|
|
2663
3081
|
const goals = instructionGoals(resolved.instructions);
|
|
2664
3082
|
const capture = {
|
|
2665
|
-
|
|
2666
|
-
path: resolved.path,
|
|
2667
|
-
viewport: resolved.window,
|
|
2668
|
-
...resolved.fullPage ? { fullPage: true } : {},
|
|
3083
|
+
...camera,
|
|
2669
3084
|
...goals.length ? { instructions: goals } : {},
|
|
2670
3085
|
...use ? { use: {
|
|
2671
3086
|
model: "model" in use ? use.model : "fake",
|
|
2672
3087
|
moves
|
|
2673
|
-
} } : {}
|
|
3088
|
+
} } : {},
|
|
3089
|
+
...page.status ? { status: page.status } : {},
|
|
3090
|
+
...page.errors.length ? { pageErrors: page.errors.length } : {},
|
|
3091
|
+
page: {
|
|
3092
|
+
path: `artifacts/${resolved.name}.capture.json`,
|
|
3093
|
+
sha256: sha256(pageJson),
|
|
3094
|
+
bytes: Buffer.byteLength(pageJson)
|
|
3095
|
+
}
|
|
2674
3096
|
};
|
|
2675
3097
|
a.record.artifacts = a.record.artifacts ?? [];
|
|
2676
3098
|
a.record.artifacts.push({
|
|
@@ -2681,15 +3103,43 @@ async function capturePage(a, target, call) {
|
|
|
2681
3103
|
capture
|
|
2682
3104
|
});
|
|
2683
3105
|
a.artifactBlobs.set(resolved.name, png);
|
|
2684
|
-
|
|
3106
|
+
keepSteps();
|
|
3107
|
+
const taken = {
|
|
2685
3108
|
name: resolved.name,
|
|
2686
3109
|
port: resolved.port,
|
|
2687
3110
|
path: resolved.path,
|
|
2688
3111
|
viewport: resolved.viewport,
|
|
2689
|
-
file
|
|
3112
|
+
file,
|
|
3113
|
+
...structuredClone(page)
|
|
3114
|
+
};
|
|
3115
|
+
return Object.defineProperty(taken, SUBJECT, { value: resolved.name });
|
|
3116
|
+
}
|
|
3117
|
+
/** The fake sandbox has no browser: the page's status and final URL from a GET, and no more. */
|
|
3118
|
+
async function fetchedPage(url, origin, timeoutMs, signal) {
|
|
3119
|
+
const res = await fetch(url, { signal: AbortSignal.any([AbortSignal.timeout(Math.max(1, timeoutMs)), signal]) }).catch(() => void 0);
|
|
3120
|
+
await res?.body?.cancel();
|
|
3121
|
+
const base = origin.replace(/\/$/, "");
|
|
3122
|
+
const final = res?.url || url;
|
|
3123
|
+
return {
|
|
3124
|
+
...res ? { status: res.status } : {},
|
|
3125
|
+
finalUrl: final.startsWith(base) ? final.slice(base.length) || "/" : final,
|
|
3126
|
+
console: [],
|
|
3127
|
+
errors: [],
|
|
3128
|
+
failedRequests: []
|
|
2690
3129
|
};
|
|
2691
3130
|
}
|
|
2692
|
-
|
|
3131
|
+
/** The page's facts in the debug log, which `-v` prints: a summary, then a line each. */
|
|
3132
|
+
function tracePage(name, page) {
|
|
3133
|
+
const counts = [
|
|
3134
|
+
plural(page.errors.length, "page error"),
|
|
3135
|
+
plural(page.console.length, "console message"),
|
|
3136
|
+
plural(page.failedRequests.length, "failed request")
|
|
3137
|
+
];
|
|
3138
|
+
const status = page.status ? ` (${page.status})` : "";
|
|
3139
|
+
debugLog("check", `capture "${name}" at ${page.finalUrl}${status}: ${counts.join(" · ")}`);
|
|
3140
|
+
for (const line of pageLines(page)) debugLog("check", `capture "${name}" ${line}`);
|
|
3141
|
+
}
|
|
3142
|
+
async function shot(a, origin, url, resolved, remaining, onMoves, tunnel, onStep) {
|
|
2693
3143
|
const cache = cacheDir();
|
|
2694
3144
|
const bin = await ensureChrome(cache, {
|
|
2695
3145
|
cacheLabel: cacheLabel(cache),
|
|
@@ -2713,6 +3163,7 @@ async function shot(a, url, resolved, remaining, onMoves, tunnel) {
|
|
|
2713
3163
|
instructions: resolved.instructions,
|
|
2714
3164
|
use: resolved.use,
|
|
2715
3165
|
remaining,
|
|
3166
|
+
onStep,
|
|
2716
3167
|
loadModel: async (name) => {
|
|
2717
3168
|
const { config, profile } = getRunContext();
|
|
2718
3169
|
const scope = gatewayScope(config, profile);
|
|
@@ -2722,6 +3173,10 @@ async function shot(a, url, resolved, remaining, onMoves, tunnel) {
|
|
|
2722
3173
|
...gateway === "vertex" ? { vertex: vertexSettingsIn(scope.gateways) } : {}
|
|
2723
3174
|
});
|
|
2724
3175
|
}
|
|
3176
|
+
}).catch(async (error) => {
|
|
3177
|
+
const page = await session.page(origin).catch(() => void 0);
|
|
3178
|
+
if (page) tracePage(resolved.name, page);
|
|
3179
|
+
throw error;
|
|
2725
3180
|
});
|
|
2726
3181
|
onMoves(result.moves);
|
|
2727
3182
|
const spend = captureUseSpend(result);
|
|
@@ -2733,20 +3188,23 @@ async function shot(a, url, resolved, remaining, onMoves, tunnel) {
|
|
|
2733
3188
|
usage: addUsage(prev.usage, spend.usage)
|
|
2734
3189
|
} : spend;
|
|
2735
3190
|
}
|
|
2736
|
-
return
|
|
2737
|
-
|
|
3191
|
+
return {
|
|
3192
|
+
png: result.png,
|
|
3193
|
+
page: await session.page(origin)
|
|
3194
|
+
};
|
|
3195
|
+
}, a.signal).finally(async () => {
|
|
2738
3196
|
await proxy.close();
|
|
2739
3197
|
if (proxy.reached.length) debugLog("check", `c.capture ${resolved.name}: sandbox port ${proxy.reached.join(", ")} answered the page through its tunnel`);
|
|
2740
3198
|
});
|
|
2741
3199
|
}
|
|
2742
3200
|
/** Writes PNG sidecars next to the staging eval JSON so redact never sees the bytes. */
|
|
2743
|
-
async function writeCaptureSidecars(stagingDir, recordFile, blobs) {
|
|
3201
|
+
async function writeCaptureSidecars(stagingDir, recordFile, blobs, pages) {
|
|
2744
3202
|
if (blobs.size === 0) return;
|
|
2745
3203
|
const dir = join(stagingDir, "evals", recordFile.replace(/\.json$/, ".artifacts"));
|
|
2746
3204
|
await mkdir(dir, { recursive: true });
|
|
2747
3205
|
for (const [name, png] of blobs) await writeFile(join(dir, `${name}.png`), png);
|
|
3206
|
+
for (const [name, json] of pages) await writeFile(join(dir, `${name}.capture.json`), json);
|
|
2748
3207
|
}
|
|
2749
|
-
//#endregion
|
|
2750
3208
|
export { writeCaptureSidecars as a, sandboxFor as c, workspaceFiles as d, fakeInstructions as f, startBackground as i, diffSinceSnapshot as l, msysTreeKill as n, asCheck as o, attemptRequestProblem as p, serveCommand as r, createChecks as s, capturePage as t, snapshot as u };
|
|
2751
3209
|
|
|
2752
|
-
//# sourceMappingURL=capture-
|
|
3210
|
+
//# sourceMappingURL=capture-DF8cHsJh.js.map
|