@tangle-network/agent-eval 0.144.11 → 0.144.13
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 +11 -0
- package/dist/agent-profile-B9_GGsG8.d.ts +84 -0
- package/dist/agent-profile-B9_GGsG8.d.ts.map +1 -0
- package/dist/{agent-profile-cell-BOP-iA9Q.d.ts → agent-profile-cell-BkcRDikH.d.ts} +2 -2
- package/dist/{agent-profile-cell-BOP-iA9Q.d.ts.map → agent-profile-cell-BkcRDikH.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +134 -16
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +364 -10
- package/dist/analyst/index.js.map +1 -1
- package/dist/backend-integrity-CsVin_Wb.d.ts +280 -0
- package/dist/backend-integrity-CsVin_Wb.d.ts.map +1 -0
- package/dist/{baseline-C-GocmIW.js → baseline-BhPRQBVn.js} +3 -2
- package/dist/{baseline-C-GocmIW.js.map → baseline-BhPRQBVn.js.map} +1 -1
- package/dist/{benchmark-CWeqGl7x.js → benchmark-BhT16ep9.js} +2 -2
- package/dist/{benchmark-CWeqGl7x.js.map → benchmark-BhT16ep9.js.map} +1 -1
- package/dist/{agent-profile-DPi7IZg7.d.ts → benchmark-Ceoan7vk.d.ts} +4 -91
- package/dist/benchmark-Ceoan7vk.d.ts.map +1 -0
- package/dist/{benchmark-command-BteMFN62.js → benchmark-command-CY6cbhOB.js} +36 -79
- package/dist/benchmark-command-CY6cbhOB.js.map +1 -0
- package/dist/benchmarks/index.d.ts +244 -2
- package/dist/benchmarks/index.d.ts.map +1 -0
- package/dist/benchmarks/index.js +733 -1
- package/dist/benchmarks/index.js.map +1 -0
- package/dist/builder-eval/index.d.ts +23 -2
- package/dist/builder-eval/index.d.ts.map +1 -1
- package/dist/builder-eval/index.js +227 -3
- package/dist/builder-eval/index.js.map +1 -1
- package/dist/campaign/index.d.ts +10 -8
- package/dist/campaign/index.js +9 -6
- package/dist/{campaign-C2TTzQII.js → campaign-BYjBAypg.js} +21 -634
- package/dist/campaign-BYjBAypg.js.map +1 -0
- package/dist/{canonical-D011XM8r.js → canonical-D-XsTQ6_.js} +2 -2
- package/dist/{canonical-D011XM8r.js.map → canonical-D-XsTQ6_.js.map} +1 -1
- package/dist/{index-CQTZ-4XN.d.ts → capture-fetch-DDvpjVRU.d.ts} +3 -3
- package/dist/capture-fetch-DDvpjVRU.d.ts.map +1 -0
- package/dist/{default-registry-BmktKy8r.js → chat-client-Bp4Ebuuc.js} +1276 -1276
- package/dist/chat-client-Bp4Ebuuc.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{client-C9gzZE59.d.ts → client-KUbGulm_.d.ts} +4 -4
- package/dist/{client-C9gzZE59.d.ts.map → client-KUbGulm_.d.ts.map} +1 -1
- package/dist/contract/index.d.ts +13 -390
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +18 -542
- package/dist/contract/index.js.map +1 -1
- package/dist/{cost-ledger-DMFxsLKr.js → cost-ledger-BSe92yAV.js} +3 -3
- package/dist/{cost-ledger-DMFxsLKr.js.map → cost-ledger-BSe92yAV.js.map} +1 -1
- package/dist/{cost-ledger-Bv_e8XHY.d.ts → cost-ledger-DbQdN3nO.d.ts} +2 -2
- package/dist/{cost-ledger-Bv_e8XHY.d.ts.map → cost-ledger-DbQdN3nO.d.ts.map} +1 -1
- package/dist/{counterfactual-CxmxAONP.d.ts → counterfactual--bpysZF0.d.ts} +2 -14
- package/dist/{counterfactual-CxmxAONP.d.ts.map → counterfactual--bpysZF0.d.ts.map} +1 -1
- package/dist/{counterfactual-CWPTrMH7.js → counterfactual-lDfCx0Uz.js} +3 -31
- package/dist/{counterfactual-CWPTrMH7.js.map → counterfactual-lDfCx0Uz.js.map} +1 -1
- package/dist/{dataset-C8xaLXdY.d.ts → dataset-CJjKqQfA.d.ts} +2 -8
- package/dist/dataset-CJjKqQfA.d.ts.map +1 -0
- package/dist/{default-registry-Bf8Woqmq.d.ts → default-registry-Di6HP6pG.d.ts} +7 -12
- package/dist/default-registry-Di6HP6pG.d.ts.map +1 -0
- package/dist/{analyze-runs-C30yljDJ.js → define-agent-eval-iqjT--ZZ.js} +542 -130
- package/dist/define-agent-eval-iqjT--ZZ.js.map +1 -0
- package/dist/define-agent-eval-sH24zBfM.d.ts +388 -0
- package/dist/define-agent-eval-sH24zBfM.d.ts.map +1 -0
- package/dist/descriptive-B5MwKfbf.js +144 -0
- package/dist/descriptive-B5MwKfbf.js.map +1 -0
- package/dist/{dspy-rlm-engine-DbTk4JdR.js → dspy-rlm-engine-B_qhSc21.js} +4 -4
- package/dist/{dspy-rlm-engine-DbTk4JdR.js.map → dspy-rlm-engine-B_qhSc21.js.map} +1 -1
- package/dist/effect-sizes-DiH8MGOH.js +82 -0
- package/dist/effect-sizes-DiH8MGOH.js.map +1 -0
- package/dist/{engine-3hL-XqwJ.d.ts → engine-otFpE2gF.d.ts} +10 -38
- package/dist/engine-otFpE2gF.d.ts.map +1 -0
- package/dist/{errors-CKPfb2aH.d.ts → errors-DEE6u6ot.d.ts} +2 -14
- package/dist/{errors-CKPfb2aH.d.ts.map → errors-DEE6u6ot.d.ts.map} +1 -1
- package/dist/{errors-D-LKuDhb.js → errors-Dngq5h35.js} +2 -8
- package/dist/{errors-D-LKuDhb.js.map → errors-Dngq5h35.js.map} +1 -1
- package/dist/{eval-campaign-B_7wcnav.js → eval-campaign-UB-usSQ2.js} +6 -6
- package/dist/{eval-campaign-B_7wcnav.js.map → eval-campaign-UB-usSQ2.js.map} +1 -1
- package/dist/{exact-types-DSFFpLLI.d.ts → exact-types-BH1twmAJ.d.ts} +2 -2
- package/dist/{exact-types-DSFFpLLI.d.ts.map → exact-types-BH1twmAJ.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +9 -6
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +11 -7
- package/dist/experiment/index.js.map +1 -1
- package/dist/experiment-tracker-C29gXM4B.js +269 -0
- package/dist/experiment-tracker-C29gXM4B.js.map +1 -0
- package/dist/{experiment-tracker-IMntXr6J.d.ts → experiment-tracker-DWHZBAYL.d.ts} +77 -121
- package/dist/experiment-tracker-DWHZBAYL.d.ts.map +1 -0
- package/dist/{external-optimizer-contracts-CZuJNcT5.d.ts → external-optimizer-contracts-lixrOZdX.d.ts} +3 -3
- package/dist/{external-optimizer-contracts-CZuJNcT5.d.ts.map → external-optimizer-contracts-lixrOZdX.d.ts.map} +1 -1
- package/dist/external-optimizer-process-BTiNB-RH.js +301 -0
- package/dist/external-optimizer-process-BTiNB-RH.js.map +1 -0
- package/dist/{single-run-lock-DFWHEB09.js → external-optimizer-subprocess-DrJ9hR8u.js} +144 -438
- package/dist/external-optimizer-subprocess-DrJ9hR8u.js.map +1 -0
- package/dist/extract-usage-BrQ8mCLX.js +155 -0
- package/dist/extract-usage-BrQ8mCLX.js.map +1 -0
- package/dist/{failure-cluster-CqcvCcdR.d.ts → failure-cluster-BLURuWG4.d.ts} +2 -3
- package/dist/failure-cluster-BLURuWG4.d.ts.map +1 -0
- package/dist/{feedback-trajectory-CacHpxsp.d.ts → feedback-trajectory-juOozjAc.d.ts} +5 -36
- package/dist/feedback-trajectory-juOozjAc.d.ts.map +1 -0
- package/dist/fuzz.d.ts +2 -2
- package/dist/fuzz.js +2 -2
- package/dist/hosted/index.d.ts +3 -3
- package/dist/{index-CvSN3IG1.d.ts → index-B8Ui1mr1.d.ts} +2 -2
- package/dist/{index-CvSN3IG1.d.ts.map → index-B8Ui1mr1.d.ts.map} +1 -1
- package/dist/{skill-usage-CO9OLRBx.d.ts → index-BWDrSVfw.d.ts} +11 -136
- package/dist/index-BWDrSVfw.d.ts.map +1 -0
- package/dist/index-Ba3YrbAL.d.ts +1 -0
- package/dist/{index-BnEuDAK2.d.ts → index-COQYtuRF.d.ts} +3 -3
- package/dist/{index-BnEuDAK2.d.ts.map → index-COQYtuRF.d.ts.map} +1 -1
- package/dist/{index-C3ssXVLv.d.ts → index-CvjYbU0D.d.ts} +2 -2
- package/dist/{index-C3ssXVLv.d.ts.map → index-CvjYbU0D.d.ts.map} +1 -1
- package/dist/{index-DPPGNJ_R.d.ts → index-DSmEylT9.d.ts} +17 -115
- package/dist/index-DSmEylT9.d.ts.map +1 -0
- package/dist/index.d.ts +2397 -5308
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5914 -10496
- package/dist/index.js.map +1 -1
- package/dist/{insight-report-CgX_s0Ez.d.ts → insight-report-CRi-Ufrj.d.ts} +4 -4
- package/dist/{insight-report-CgX_s0Ez.d.ts.map → insight-report-CRi-Ufrj.d.ts.map} +1 -1
- package/dist/{integrity-MLzHOfV9.js → integrity-Cy9WHAtb.js} +2 -2
- package/dist/{integrity-MLzHOfV9.js.map → integrity-Cy9WHAtb.js.map} +1 -1
- package/dist/{integrity-DY6tIbl0.js → integrity-DysDBWDu.js} +2 -2
- package/dist/{integrity-DY6tIbl0.js.map → integrity-DysDBWDu.js.map} +1 -1
- package/dist/{integrity-BuqEKu-x.d.ts → integrity-OrcI9Nau.d.ts} +3 -3
- package/dist/{integrity-BuqEKu-x.d.ts.map → integrity-OrcI9Nau.d.ts.map} +1 -1
- package/dist/internal-BDHPCnjk.js +230 -0
- package/dist/internal-BDHPCnjk.js.map +1 -0
- package/dist/judge-calibration-C5CbMYce.d.ts +117 -0
- package/dist/judge-calibration-C5CbMYce.d.ts.map +1 -0
- package/dist/judge-calibration-DZkWrm5H.js +317 -0
- package/dist/judge-calibration-DZkWrm5H.js.map +1 -0
- package/dist/{kind-factory-B8-r8-y8.js → kind-factory-CPmSd58s.js} +208 -208
- package/dist/{kind-factory-B8-r8-y8.js.map → kind-factory-CPmSd58s.js.map} +1 -1
- package/dist/ledger-core/index.d.ts +1 -1
- package/dist/ledger-core/index.js +2 -2
- package/dist/{ledger-core-DXZIqu17.js → ledger-core-BmZt19oQ.js} +110 -110
- package/dist/{ledger-core-DXZIqu17.js.map → ledger-core-BmZt19oQ.js.map} +1 -1
- package/dist/{llm-client-DzvMUsS_.js → llm-client-d0-2TT1g.js} +4 -64
- package/dist/{llm-client-DzvMUsS_.js.map → llm-client-d0-2TT1g.js.map} +1 -1
- package/dist/{skillopt-optimization-method-CQdVeM8k.js → llm-judge-dZ8P6nGI.js} +3349 -5401
- package/dist/llm-judge-dZ8P6nGI.js.map +1 -0
- package/dist/matrix/index.d.ts +2 -2
- package/dist/meta-eval/index.d.ts +3 -3
- package/dist/meta-eval/index.js +3 -3
- package/dist/{metrics-C9YY1OcL.js → metrics-Cl0L1KUy.js} +2 -108
- package/dist/{metrics-C9YY1OcL.js.map → metrics-Cl0L1KUy.js.map} +1 -1
- package/dist/{mint-B2O60ACG.js → mint-Dj9Ww_3I.js} +4 -4
- package/dist/{mint-B2O60ACG.js.map → mint-Dj9Ww_3I.js.map} +1 -1
- package/dist/{multi-layer-verifier-DnAqwl0h.d.ts → multi-layer-verifier-DIguZc8Z.d.ts} +3 -3
- package/dist/{multi-layer-verifier-DnAqwl0h.d.ts.map → multi-layer-verifier-DIguZc8Z.d.ts.map} +1 -1
- package/dist/multiplicity-DIWHvysC.d.ts +43 -0
- package/dist/multiplicity-DIWHvysC.d.ts.map +1 -0
- package/dist/multishot/index.d.ts +3 -3
- package/dist/multishot/index.js +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{opencode-sqlite-8r6WUfHc.js → opencode-sqlite-DJWAXLms.js} +2 -2
- package/dist/{opencode-sqlite-8r6WUfHc.js.map → opencode-sqlite-DJWAXLms.js.map} +1 -1
- package/dist/package-version-D7lQHt_-.js +34 -0
- package/dist/package-version-D7lQHt_-.js.map +1 -0
- package/dist/paired-arms-D-XRF_fy.js +1045 -0
- package/dist/paired-arms-D-XRF_fy.js.map +1 -0
- package/dist/paired-promotion-decision-CGzg0cI_.d.ts +251 -0
- package/dist/paired-promotion-decision-CGzg0cI_.d.ts.map +1 -0
- package/dist/paired-tests-BHIhYVdu.js +213 -0
- package/dist/paired-tests-BHIhYVdu.js.map +1 -0
- package/dist/pareto-BqNW3LJR.d.ts +117 -0
- package/dist/pareto-BqNW3LJR.d.ts.map +1 -0
- package/dist/pipelines/index.d.ts +3 -64
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +4 -284
- package/dist/pipelines/index.js.map +1 -1
- package/dist/power-and-mde-CHIrXJll.js +195 -0
- package/dist/power-and-mde-CHIrXJll.js.map +1 -0
- package/dist/{promotion-policy-CrLrmys8.js → power-preflight-DEw-uC7q.js} +4 -184
- package/dist/power-preflight-DEw-uC7q.js.map +1 -0
- package/dist/pre-registration-CZwSFQS4.d.ts +577 -0
- package/dist/pre-registration-CZwSFQS4.d.ts.map +1 -0
- package/dist/{prime-protocol-BfSalTfR.js → prime-protocol-6tZTVsWm.js} +72 -21
- package/dist/prime-protocol-6tZTVsWm.js.map +1 -0
- package/dist/produced-state-DU79a81m.js +586 -0
- package/dist/produced-state-DU79a81m.js.map +1 -0
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +1 -1
- package/dist/promotion-policy-D0nPhkSy.d.ts +134 -0
- package/dist/promotion-policy-D0nPhkSy.d.ts.map +1 -0
- package/dist/promotion-policy-xzA40Evo.js +186 -0
- package/dist/promotion-policy-xzA40Evo.js.map +1 -0
- package/dist/{skillopt-optimization-method-USDKhxSA.d.ts → provenance-CCdxgLDT.d.ts} +57 -478
- package/dist/provenance-CCdxgLDT.d.ts.map +1 -0
- package/dist/registry-oJeeI4-a.d.ts +178 -0
- package/dist/registry-oJeeI4-a.d.ts.map +1 -0
- package/dist/{release-report-DA2BCu5a.d.ts → release-confidence-BFRE5WSp.d.ts} +180 -112
- package/dist/release-confidence-BFRE5WSp.d.ts.map +1 -0
- package/dist/{release-report-BUYmoKo2.js → release-confidence-CxDuiAev.js} +125 -217
- package/dist/release-confidence-CxDuiAev.js.map +1 -0
- package/dist/reporting.d.ts +6 -5
- package/dist/reporting.js +7 -5
- package/dist/{researcher-BchpD55R.d.ts → researcher-DaN4GST-.d.ts} +7 -40
- package/dist/{researcher-BchpD55R.d.ts.map → researcher-DaN4GST-.d.ts.map} +1 -1
- package/dist/{reward-hacking-BDToousL.js → reward-hacking-DNgjilrV.js} +3 -3
- package/dist/reward-hacking-DNgjilrV.js.map +1 -0
- package/dist/{reward-hacking-BI0OMAlo.d.ts → reward-hacking-DSSTuI9r.d.ts} +5 -5
- package/dist/{reward-hacking-BI0OMAlo.d.ts.map → reward-hacking-DSSTuI9r.d.ts.map} +1 -1
- package/dist/rl.d.ts +7 -7
- package/dist/rl.js +11 -10
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +2 -2
- package/dist/rollout/index.js +4 -4
- package/dist/{rollout-DRrksrcV.js → rollout-BWtw0I_6.js} +3 -3
- package/dist/{rollout-DRrksrcV.js.map → rollout-BWtw0I_6.js.map} +1 -1
- package/dist/{rubric-predictive-validity-DvkjPYCe.d.ts → rubric-predictive-validity-BgxtKe4G.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-DvkjPYCe.d.ts.map → rubric-predictive-validity-BgxtKe4G.d.ts.map} +1 -1
- package/dist/{rubric-predictive-validity-BRR632r1.js → rubric-predictive-validity-Cwwyd7ah.js} +2 -2
- package/dist/{rubric-predictive-validity-BRR632r1.js.map → rubric-predictive-validity-Cwwyd7ah.js.map} +1 -1
- package/dist/{run-record-BmSPWXJR.js → run-record-BvHPVS-i.js} +3 -3
- package/dist/{run-record-BmSPWXJR.js.map → run-record-BvHPVS-i.js.map} +1 -1
- package/dist/{run-record-CF4Dwpxr.d.ts → run-record-CKiihE6f.d.ts} +4 -4
- package/dist/{run-record-CF4Dwpxr.d.ts.map → run-record-CKiihE6f.d.ts.map} +1 -1
- package/dist/{proposal-findings-2GIUo1et.js → run-score-lDzV0X8j.js} +31 -31
- package/dist/run-score-lDzV0X8j.js.map +1 -0
- package/dist/sandbox-harness-BlSOu4LX.d.ts +70 -0
- package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -0
- package/dist/{schema-Cef2cFmb2.d.ts → schema-Cef2cFmb.d.ts} +1 -1
- package/dist/schema-Cef2cFmb.d.ts.map +1 -0
- package/dist/semantic-concept-judge-BiJxScqe.js +406 -0
- package/dist/semantic-concept-judge-BiJxScqe.js.map +1 -0
- package/dist/{sequential-D-BLJBKU.js → sequential-C458DXNf.js} +4 -3
- package/dist/{sequential-D-BLJBKU.js.map → sequential-C458DXNf.js.map} +1 -1
- package/dist/sequential-eprocess-CbUt2htw.js +83 -0
- package/dist/sequential-eprocess-CbUt2htw.js.map +1 -0
- package/dist/series-convergence-D1cL1f-4.d.ts +129 -0
- package/dist/series-convergence-D1cL1f-4.d.ts.map +1 -0
- package/dist/{server-iu0ede49.js → server-ulsOdrTI.js} +5 -21
- package/dist/server-ulsOdrTI.js.map +1 -0
- package/dist/skillopt-optimization-method-C5cotF4E.d.ts +427 -0
- package/dist/skillopt-optimization-method-C5cotF4E.d.ts.map +1 -0
- package/dist/skillopt-optimization-method-jjdnc3YK.js +1999 -0
- package/dist/skillopt-optimization-method-jjdnc3YK.js.map +1 -0
- package/dist/{statistical-heldout-TQ-4CYiN.d.ts → statistical-heldout-DoFF5KJX.d.ts} +5 -278
- package/dist/statistical-heldout-DoFF5KJX.d.ts.map +1 -0
- package/dist/{store-otlp-Dw8PPIlL.js → store-otlp-CsptLYpN.js} +3 -3
- package/dist/{store-otlp-Dw8PPIlL.js.map → store-otlp-CsptLYpN.js.map} +1 -1
- package/dist/store-tool-spans-Cq9mFd-q.js +667 -0
- package/dist/store-tool-spans-Cq9mFd-q.js.map +1 -0
- package/dist/store-tool-spans-DbDLOBOb.d.ts +342 -0
- package/dist/store-tool-spans-DbDLOBOb.d.ts.map +1 -0
- package/dist/student-t-CvBq2mve.js +38 -0
- package/dist/student-t-CvBq2mve.js.map +1 -0
- package/dist/{summary-report-Lf-5I7xh.js → summary-report-Blysd6Z2.js} +6 -3
- package/dist/{summary-report-Lf-5I7xh.js.map → summary-report-Blysd6Z2.js.map} +1 -1
- package/dist/{summary-report-BNR7DWTj.d.ts → summary-report-CaL-Hnxt.d.ts} +5 -5
- package/dist/{summary-report-BNR7DWTj.d.ts.map → summary-report-CaL-Hnxt.d.ts.map} +1 -1
- package/dist/supervisor-run/index.d.ts +391 -3
- package/dist/supervisor-run/index.d.ts.map +1 -0
- package/dist/supervisor-run/index.js +1689 -2
- package/dist/{supervisor-run-D_sokXcO.js.map → supervisor-run/index.js.map} +1 -1
- package/dist/{extract-usage-CdZdoj1s.js → task-failure-attributes-CpQ4y5RD.js} +5 -157
- package/dist/task-failure-attributes-CpQ4y5RD.js.map +1 -0
- package/dist/{tool-groups-CZPGGlHf.d.ts → tool-groups-Cteb03Ps.d.ts} +3 -3
- package/dist/tool-groups-Cteb03Ps.d.ts.map +1 -0
- package/dist/tool-waste-BDdBZG1F.js +803 -0
- package/dist/tool-waste-BDdBZG1F.js.map +1 -0
- package/dist/tool-waste-DjRDEsuI.d.ts +128 -0
- package/dist/tool-waste-DjRDEsuI.d.ts.map +1 -0
- package/dist/trace-repair/index.d.ts +14 -5
- package/dist/trace-repair/index.d.ts.map +1 -1
- package/dist/trace-repair/index.js +35 -7
- package/dist/trace-repair/index.js.map +1 -1
- package/dist/traces.d.ts +406 -7
- package/dist/traces.d.ts.map +1 -0
- package/dist/traces.js +1011 -10
- package/dist/traces.js.map +1 -0
- package/dist/trajectory-replay/index.d.ts +16 -3
- package/dist/trajectory-replay/index.d.ts.map +1 -1
- package/dist/trajectory-replay/index.js +52 -5
- package/dist/trajectory-replay/index.js.map +1 -1
- package/dist/types-BEPZc6eo.d.ts +93 -0
- package/dist/types-BEPZc6eo.d.ts.map +1 -0
- package/dist/{usage-receipt-t7vAzCRQ.js → types-BI4fT3HN.js} +67 -67
- package/dist/types-BI4fT3HN.js.map +1 -0
- package/dist/{types-BnjdJ70P.d.ts → types-BZ59Ahr8.d.ts} +5 -5
- package/dist/{types-BnjdJ70P.d.ts.map → types-BZ59Ahr8.d.ts.map} +1 -1
- package/dist/{types-D216SgwM.d.ts → types-Cx3YUh2r.d.ts} +4 -241
- package/dist/types-Cx3YUh2r.d.ts.map +1 -0
- package/dist/{types-BvDKaULh.d.ts → types-DLQx4mKU.d.ts} +4 -4
- package/dist/{types-BvDKaULh.d.ts.map → types-DLQx4mKU.d.ts.map} +1 -1
- package/dist/{types-D4mog56g.d.ts → types-yLK8gXE9.d.ts} +2 -2
- package/dist/{types-D4mog56g.d.ts.map → types-yLK8gXE9.d.ts.map} +1 -1
- package/dist/verdict-BndeTAh_.js +61 -0
- package/dist/verdict-BndeTAh_.js.map +1 -0
- package/dist/verdict-E4eRNf7-.d.ts +392 -0
- package/dist/verdict-E4eRNf7-.d.ts.map +1 -0
- package/dist/{verdict-cache-BCcOh0kF.js → verdict-cache-mZf5FEiY.js} +3 -55
- package/dist/{verdict-cache-BCcOh0kF.js.map → verdict-cache-mZf5FEiY.js.map} +1 -1
- package/dist/wire/index.d.ts +3 -3
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +1 -1
- package/docs/charter.md +3 -3
- package/docs/control-runtime.md +3 -42
- package/docs/experiment.md +0 -1
- package/docs/feature-guide.md +2 -2
- package/docs/trace-repair-grader.md +1 -0
- package/docs/trajectory-replay.md +1 -0
- package/docs/verdicts.md +43 -0
- package/docs/verification-strategies.md +3 -2
- package/package.json +6 -11
- package/dist/agent-profile-DPi7IZg7.d.ts.map +0 -1
- package/dist/analyze-runs-C30yljDJ.js.map +0 -1
- package/dist/baseline-CavEbRyH.d.ts +0 -136
- package/dist/baseline-CavEbRyH.d.ts.map +0 -1
- package/dist/benchmark-command-BteMFN62.js.map +0 -1
- package/dist/benchmarks-Dzs8CKb1.js +0 -755
- package/dist/benchmarks-Dzs8CKb1.js.map +0 -1
- package/dist/campaign-C2TTzQII.js.map +0 -1
- package/dist/completion-verifier-DJA5BhPb.d.ts +0 -414
- package/dist/completion-verifier-DJA5BhPb.d.ts.map +0 -1
- package/dist/control.d.ts +0 -3
- package/dist/control.js +0 -2
- package/dist/dataset-C8xaLXdY.d.ts.map +0 -1
- package/dist/default-registry-Bf8Woqmq.d.ts.map +0 -1
- package/dist/default-registry-BmktKy8r.js.map +0 -1
- package/dist/engine-3hL-XqwJ.d.ts.map +0 -1
- package/dist/experiment-tracker-CnRICnMl.js +0 -500
- package/dist/experiment-tracker-CnRICnMl.js.map +0 -1
- package/dist/experiment-tracker-IMntXr6J.d.ts.map +0 -1
- package/dist/extract-usage-CdZdoj1s.js.map +0 -1
- package/dist/failure-cluster-CqcvCcdR.d.ts.map +0 -1
- package/dist/feedback-trajectory-CacHpxsp.d.ts.map +0 -1
- package/dist/index-BZ3-y4YL.d.ts +0 -391
- package/dist/index-BZ3-y4YL.d.ts.map +0 -1
- package/dist/index-CQTZ-4XN.d.ts.map +0 -1
- package/dist/index-DPPGNJ_R.d.ts.map +0 -1
- package/dist/index-YE4KdKbO2.d.ts +0 -335
- package/dist/index-YE4KdKbO2.d.ts.map +0 -1
- package/dist/paired-arms-iZ08VFMN.js +0 -260
- package/dist/paired-arms-iZ08VFMN.js.map +0 -1
- package/dist/paired-promotion-decision-B6zJ3gYM.d.ts +0 -114
- package/dist/paired-promotion-decision-B6zJ3gYM.d.ts.map +0 -1
- package/dist/prime-protocol-BfSalTfR.js.map +0 -1
- package/dist/promotion-policy-Ckjhzg_4.d.ts +0 -289
- package/dist/promotion-policy-Ckjhzg_4.d.ts.map +0 -1
- package/dist/promotion-policy-CrLrmys8.js.map +0 -1
- package/dist/proposal-findings-2GIUo1et.js.map +0 -1
- package/dist/propose-review-control-dSNPjFUH.js +0 -1458
- package/dist/propose-review-control-dSNPjFUH.js.map +0 -1
- package/dist/release-report-BUYmoKo2.js.map +0 -1
- package/dist/release-report-DA2BCu5a.d.ts.map +0 -1
- package/dist/replay-CohS93nE.js +0 -1859
- package/dist/replay-CohS93nE.js.map +0 -1
- package/dist/replay-DbhZ4Ked.d.ts +0 -834
- package/dist/replay-DbhZ4Ked.d.ts.map +0 -1
- package/dist/reward-hacking-BDToousL.js.map +0 -1
- package/dist/run-evidence-Dhi3C81V.d.ts +0 -225
- package/dist/run-evidence-Dhi3C81V.d.ts.map +0 -1
- package/dist/schema-Cef2cFmb2.d.ts.map +0 -1
- package/dist/semantic-concept-judge-D1z-KepS.js +0 -767
- package/dist/semantic-concept-judge-D1z-KepS.js.map +0 -1
- package/dist/series-convergence-ofsqPWhs.d.ts +0 -35
- package/dist/series-convergence-ofsqPWhs.d.ts.map +0 -1
- package/dist/server-iu0ede49.js.map +0 -1
- package/dist/single-run-lock-DFWHEB09.js.map +0 -1
- package/dist/skill-usage-CO9OLRBx.d.ts.map +0 -1
- package/dist/skillopt-optimization-method-CQdVeM8k.js.map +0 -1
- package/dist/skillopt-optimization-method-USDKhxSA.d.ts.map +0 -1
- package/dist/statistical-heldout-TQ-4CYiN.d.ts.map +0 -1
- package/dist/statistics-ByxzSiOM.js +0 -2212
- package/dist/statistics-ByxzSiOM.js.map +0 -1
- package/dist/statistics-D6Uebe_4.d.ts +0 -968
- package/dist/statistics-D6Uebe_4.d.ts.map +0 -1
- package/dist/supervisor-run-D_sokXcO.js +0 -1690
- package/dist/test-graded-scenario-D1TaI2va.d.ts +0 -141
- package/dist/test-graded-scenario-D1TaI2va.d.ts.map +0 -1
- package/dist/test-graded-scenario-JHcKQNpq.js +0 -318
- package/dist/test-graded-scenario-JHcKQNpq.js.map +0 -1
- package/dist/tool-groups-CZPGGlHf.d.ts.map +0 -1
- package/dist/tool-use-metrics-DEGMKycK.js +0 -370
- package/dist/tool-use-metrics-DEGMKycK.js.map +0 -1
- package/dist/types-D216SgwM.d.ts.map +0 -1
- package/dist/usage-receipt-t7vAzCRQ.js.map +0 -1
- package/dist/verdict-DExhxfgR.d.ts +0 -201
- package/dist/verdict-DExhxfgR.d.ts.map +0 -1
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { s as ValidationError } from "./errors-Dngq5h35.js";
|
|
2
|
+
import { a as spearmanR, r as pearsonR } from "./descriptive-B5MwKfbf.js";
|
|
3
|
+
import { r as continuousAgreement } from "./judge-calibration-DZkWrm5H.js";
|
|
4
|
+
import { i as pairedCohensDz } from "./effect-sizes-DiH8MGOH.js";
|
|
5
|
+
import { i as requiredPairedSampleSize, r as pairedMde } from "./power-and-mde-CHIrXJll.js";
|
|
6
|
+
import { r as pairRunRecords } from "./paired-arms-D-XRF_fy.js";
|
|
7
|
+
import { o as pairedTTest, r as pairedBootstrap } from "./paired-tests-BHIhYVdu.js";
|
|
8
|
+
import { r as welchsTTest } from "./baseline-BhPRQBVn.js";
|
|
1
9
|
import { r as observedSplitScore } from "./reward-nw2xZGZG.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { s as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
10
|
+
import { r as modelHasSnapshot, s as validateRunRecord } from "./run-record-BvHPVS-i.js";
|
|
11
|
+
import { r as paretoChart } from "./summary-report-Blysd6Z2.js";
|
|
12
|
+
import { A as surfaceHash, G as runEval, J as resolveRunDir, f as runImprovementLoop, k as surfaceContentHash, o as emitLoopProvenance, s as loopProvenanceArgsFromResult, y as assertOptimizationResult, z as defaultProductionGate } from "./llm-judge-dZ8P6nGI.js";
|
|
13
|
+
import { c as campaignCellTaskScore, l as campaignCellToRunRecord, o as campaignCellExecutionEvidence, s as campaignCellJudgeDimensions } from "./reward-hacking-DNgjilrV.js";
|
|
14
|
+
import { S as inMemoryCampaignStorage, b as createRunCostLedger, x as fsCampaignStorage } from "./external-optimizer-subprocess-DrJ9hR8u.js";
|
|
15
|
+
import { t as powerPreflight } from "./power-preflight-DEw-uC7q.js";
|
|
16
|
+
import { t as createHostedClient } from "./client-LIuo-KPv.js";
|
|
8
17
|
//#region src/contamination-guard.ts
|
|
9
18
|
function checkCanaries(output, scenarios) {
|
|
10
19
|
const leaks = [];
|
|
@@ -18,128 +27,6 @@ function checkCanaries(output, scenarios) {
|
|
|
18
27
|
}
|
|
19
28
|
return leaks;
|
|
20
29
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Behavioral canary: tests the AGENT, not the eval grep.
|
|
23
|
-
*
|
|
24
|
-
* - `forbiddenPattern` PRESENT in output ⇒ AGENT EMITTED BAD CONTENT ⇒ LEAK.
|
|
25
|
-
* - `forbiddenPattern` ABSENT from output ⇒ AGENT HELD THE LINE ⇒ PASS.
|
|
26
|
-
*
|
|
27
|
-
* Use when running known-bad-prompt scenarios against the agent under
|
|
28
|
-
* test and you want to know if the agent misbehaved. The classical
|
|
29
|
-
* {@link checkCanaries} / {@link import('./canary').runCanaries | runCanaries}
|
|
30
|
-
* test whether the eval check fires when the bad output is forced
|
|
31
|
-
* into the eval flow — different question, different answer.
|
|
32
|
-
*
|
|
33
|
-
* Pattern resolution order (first match wins):
|
|
34
|
-
* 1. `scenario.forbiddenPattern` — if it parses as `/body/flags`,
|
|
35
|
-
* treated as a regex; otherwise a literal substring.
|
|
36
|
-
* 2. `scenario.canary` — literal substring fallback so the helper
|
|
37
|
-
* works on existing scenario fixtures.
|
|
38
|
-
*
|
|
39
|
-
* Returns `null` when nothing forbidden was found OR the scenario
|
|
40
|
-
* declared no pattern.
|
|
41
|
-
*/
|
|
42
|
-
function checkBehavioralCanary(output, scenario) {
|
|
43
|
-
const pattern = scenario.forbiddenPattern ?? scenario.canary;
|
|
44
|
-
if (!pattern) return null;
|
|
45
|
-
const hit = matchForbidden(output, pattern);
|
|
46
|
-
if (!hit) return null;
|
|
47
|
-
return {
|
|
48
|
-
scenarioId: scenario.id,
|
|
49
|
-
canary: pattern,
|
|
50
|
-
evidence: excerpt(output, hit)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Behavioral canary over many (scenario, output) pairs. Sibling to
|
|
55
|
-
* {@link import('./canary').runCanaries | runCanaries} — same idea
|
|
56
|
-
* (run-many → report) but the question being answered is "did the
|
|
57
|
-
* AGENT misbehave?" rather than "did the EVAL grep fire?".
|
|
58
|
-
*
|
|
59
|
-
* Returns one `CanaryLeak` per pair where the agent's output
|
|
60
|
-
* contained its scenario's `forbiddenPattern` (or `canary` fallback).
|
|
61
|
-
*/
|
|
62
|
-
function runBehavioralCanaries(cases) {
|
|
63
|
-
const leaks = [];
|
|
64
|
-
for (const c of cases) {
|
|
65
|
-
const leak = checkBehavioralCanary(c.output, c.scenario);
|
|
66
|
-
if (leak) leaks.push({
|
|
67
|
-
...leak,
|
|
68
|
-
runId: c.runId ?? leak.runId
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return leaks;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Resolve a forbidden-pattern string to the matched substring inside
|
|
75
|
-
* `output`. `/body/flags` notation is interpreted as a regex; anything
|
|
76
|
-
* else is a literal substring.
|
|
77
|
-
*/
|
|
78
|
-
function matchForbidden(output, pattern) {
|
|
79
|
-
const re = tryParseRegex(pattern);
|
|
80
|
-
if (re) {
|
|
81
|
-
const m = output.match(re);
|
|
82
|
-
return m && m[0].length > 0 ? m[0] : null;
|
|
83
|
-
}
|
|
84
|
-
return output.includes(pattern) ? pattern : null;
|
|
85
|
-
}
|
|
86
|
-
function tryParseRegex(pattern) {
|
|
87
|
-
if (pattern.length < 2 || pattern[0] !== "/") return null;
|
|
88
|
-
const last = pattern.lastIndexOf("/");
|
|
89
|
-
if (last <= 0) return null;
|
|
90
|
-
const body = pattern.slice(1, last);
|
|
91
|
-
const flags = pattern.slice(last + 1);
|
|
92
|
-
if (!/^[gimsuy]*$/.test(flags)) return null;
|
|
93
|
-
try {
|
|
94
|
-
return new RegExp(body, flags);
|
|
95
|
-
} catch {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Scan the LLM-output history in a corpus; returns every case where a
|
|
101
|
-
* canary from a known scenario appeared in agent output. Pass the full
|
|
102
|
-
* set of scenarios whose canaries you care about (typically the whole
|
|
103
|
-
* held-out slice).
|
|
104
|
-
*/
|
|
105
|
-
async function canaryLeakView(store, scenarios) {
|
|
106
|
-
const targets = scenarios.filter((s) => !!s.canary);
|
|
107
|
-
if (targets.length === 0) return [];
|
|
108
|
-
const spans = await llmSpans(store);
|
|
109
|
-
const leaks = [];
|
|
110
|
-
for (const span of spans) {
|
|
111
|
-
const output = span.output ?? "";
|
|
112
|
-
for (const s of targets) if (s.canary && output.includes(s.canary)) leaks.push({
|
|
113
|
-
scenarioId: s.id,
|
|
114
|
-
canary: s.canary,
|
|
115
|
-
runId: span.runId,
|
|
116
|
-
evidence: excerpt(output, s.canary)
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return leaks;
|
|
120
|
-
}
|
|
121
|
-
var HoldoutAuditor = class {
|
|
122
|
-
scenarios;
|
|
123
|
-
accessLog = [];
|
|
124
|
-
constructor(scenarios) {
|
|
125
|
-
this.scenarios = scenarios;
|
|
126
|
-
}
|
|
127
|
-
/** Retrieve a holdout scenario for a declared purpose. Non-'evaluation' throws. */
|
|
128
|
-
get(scenarioId, purpose) {
|
|
129
|
-
if (purpose !== "evaluation" && purpose !== "debugging") throw new Error(`HoldoutAuditor.get: purpose must be 'evaluation' or 'debugging', got ${purpose}`);
|
|
130
|
-
const s = this.scenarios.find((x) => x.id === scenarioId);
|
|
131
|
-
if (!s) throw new Error(`holdout scenario "${scenarioId}" not found`);
|
|
132
|
-
this.accessLog.push({
|
|
133
|
-
scenarioId,
|
|
134
|
-
purpose,
|
|
135
|
-
at: Date.now()
|
|
136
|
-
});
|
|
137
|
-
return s;
|
|
138
|
-
}
|
|
139
|
-
getAccessLog() {
|
|
140
|
-
return this.accessLog;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
30
|
function excerpt(source, needle) {
|
|
144
31
|
const at = source.indexOf(needle);
|
|
145
32
|
if (at < 0) return "";
|
|
@@ -1077,6 +964,531 @@ function buildRecommendations(ctx) {
|
|
|
1077
964
|
return out;
|
|
1078
965
|
}
|
|
1079
966
|
//#endregion
|
|
1080
|
-
|
|
967
|
+
//#region src/contract/self-improve.ts
|
|
968
|
+
/** Failed self-improvement run with an immutable receipt snapshot. */
|
|
969
|
+
var SelfImproveRunError = class extends Error {
|
|
970
|
+
cost;
|
|
971
|
+
receipts;
|
|
972
|
+
constructor(cause, ledger) {
|
|
973
|
+
const original = cause instanceof Error ? cause : new Error(String(cause));
|
|
974
|
+
super(original.message, { cause: original });
|
|
975
|
+
this.name = "SelfImproveRunError";
|
|
976
|
+
this.cost = ledger.summary();
|
|
977
|
+
this.receipts = ledger.list();
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
function assertSelfImproveSearchMode(opts) {
|
|
981
|
+
if (opts.method && opts.proposer) throw new Error("selfImprove: method and proposer are mutually exclusive");
|
|
982
|
+
if (!opts.method) {
|
|
983
|
+
if (opts.selectionScenarios !== void 0) throw new Error("selfImprove: selectionScenarios requires method");
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
if (typeof opts.method.name !== "string" || !opts.method.name.trim() || opts.method.name.trim() !== opts.method.name || typeof opts.method.optimize !== "function") throw new Error("selfImprove: method must have a trimmed name and optimize(input)");
|
|
987
|
+
const budget = opts.budget;
|
|
988
|
+
if (budget?.generations !== void 0 && budget.generations !== 1) throw new Error("selfImprove: method owns its rounds; budget.generations must be 1 when set");
|
|
989
|
+
if (budget?.populationSize !== void 0 && budget.populationSize !== 1) throw new Error("selfImprove: method owns its candidates; budget.populationSize must be 1 when set");
|
|
990
|
+
if (budget?.candidateConcurrency !== void 0 || budget?.maxImprovementShots !== void 0 || opts.analyzeGeneration !== void 0 || opts.findings !== void 0) throw new Error("selfImprove: candidateConcurrency, maxImprovementShots, analyzeGeneration, and findings apply only to proposer mode");
|
|
991
|
+
}
|
|
992
|
+
function splitMethodPartitions(searchScenarios, explicitSelection, fraction) {
|
|
993
|
+
if (!Number.isFinite(fraction) || fraction <= 0 || fraction >= 1) throw new Error("selfImprove: budget.selectionFraction must be in (0, 1)");
|
|
994
|
+
const byId = /* @__PURE__ */ new Map();
|
|
995
|
+
for (const scenario of searchScenarios) {
|
|
996
|
+
if (byId.has(scenario.id)) throw new Error(`selfImprove: duplicate scenario id '${scenario.id}'`);
|
|
997
|
+
byId.set(scenario.id, scenario);
|
|
998
|
+
}
|
|
999
|
+
if (explicitSelection) {
|
|
1000
|
+
if (explicitSelection.length === 0) throw new Error("selfImprove: selectionScenarios must not be empty");
|
|
1001
|
+
const selectionIds = /* @__PURE__ */ new Set();
|
|
1002
|
+
for (const scenario of explicitSelection) {
|
|
1003
|
+
if (!byId.has(scenario.id)) throw new Error(`selfImprove: selection scenario '${scenario.id}' is absent from the non-final cases`);
|
|
1004
|
+
if (selectionIds.has(scenario.id)) throw new Error(`selfImprove: duplicate selection scenario id '${scenario.id}'`);
|
|
1005
|
+
selectionIds.add(scenario.id);
|
|
1006
|
+
}
|
|
1007
|
+
const train = searchScenarios.filter((scenario) => !selectionIds.has(scenario.id));
|
|
1008
|
+
if (train.length === 0) throw new Error("selfImprove: method train split is empty");
|
|
1009
|
+
return {
|
|
1010
|
+
train,
|
|
1011
|
+
selection: explicitSelection.map((scenario) => byId.get(scenario.id))
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
if (searchScenarios.length < 2) throw new Error("selfImprove: method requires at least two non-final scenarios");
|
|
1015
|
+
const sorted = [...searchScenarios].sort((a, b) => stableScenarioHash(a.id) - stableScenarioHash(b.id));
|
|
1016
|
+
const count = Math.max(1, Math.min(sorted.length - 1, Math.round(sorted.length * fraction)));
|
|
1017
|
+
return {
|
|
1018
|
+
selection: sorted.slice(0, count),
|
|
1019
|
+
train: sorted.slice(count)
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
function safeRunComponent(value) {
|
|
1023
|
+
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
1024
|
+
}
|
|
1025
|
+
function stableScenarioHash(value) {
|
|
1026
|
+
let hash = 2166136261;
|
|
1027
|
+
for (let index = 0; index < value.length; index++) {
|
|
1028
|
+
hash ^= value.charCodeAt(index);
|
|
1029
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
1030
|
+
}
|
|
1031
|
+
return hash;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Deterministic train/holdout split by a stable hash of `scenario.id`,
|
|
1035
|
+
* so the same scenario set always splits the same way across runs.
|
|
1036
|
+
*/
|
|
1037
|
+
function splitTrainHoldout(scenarios, fraction) {
|
|
1038
|
+
const sorted = [...scenarios].sort((a, b) => stableScenarioHash(a.id) - stableScenarioHash(b.id));
|
|
1039
|
+
const nHoldout = Math.max(1, Math.min(sorted.length - 1, Math.round(sorted.length * fraction)));
|
|
1040
|
+
return {
|
|
1041
|
+
holdout: sorted.slice(0, nHoldout),
|
|
1042
|
+
train: sorted.slice(nHoldout)
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
function meanComposite(byScenario) {
|
|
1046
|
+
const perScenario = {};
|
|
1047
|
+
const values = [];
|
|
1048
|
+
for (const [id, agg] of Object.entries(byScenario)) {
|
|
1049
|
+
perScenario[id] = agg.meanComposite;
|
|
1050
|
+
values.push(agg.meanComposite);
|
|
1051
|
+
}
|
|
1052
|
+
return {
|
|
1053
|
+
compositeMean: values.length === 0 ? 0 : values.reduce((s, v) => s + v, 0) / values.length,
|
|
1054
|
+
perScenario
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Latest search campaign measured for the winner surface; the baseline search
|
|
1059
|
+
* campaign when the winner IS the baseline. Used by the deferred-holdout
|
|
1060
|
+
* summary, where no holdout campaign exists to summarize.
|
|
1061
|
+
*/
|
|
1062
|
+
function winnerSearchCampaign(result) {
|
|
1063
|
+
for (let i = result.generations.length - 1; i >= 0; i--) {
|
|
1064
|
+
const measured = result.generations[i]?.surfaces.find((s) => s.surfaceHash === result.winnerSurfaceHash);
|
|
1065
|
+
if (measured) return measured.campaign;
|
|
1066
|
+
}
|
|
1067
|
+
return result.baselineCampaign;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* One-shot self-improvement loop. See module docstring for defaults +
|
|
1071
|
+
* extension points.
|
|
1072
|
+
*
|
|
1073
|
+
* @example Minimum:
|
|
1074
|
+
*
|
|
1075
|
+
* const result = await selfImprove({
|
|
1076
|
+
* agent: (surface, scenario, ctx) => myAgent(surface, scenario, ctx.signal),
|
|
1077
|
+
* scenarios,
|
|
1078
|
+
* judge,
|
|
1079
|
+
* baselineSurface: DEFAULT_PROMPT,
|
|
1080
|
+
* proposer,
|
|
1081
|
+
* })
|
|
1082
|
+
* console.log(`lift: ${result.lift.toFixed(3)} (${result.gateDecision})`)
|
|
1083
|
+
*
|
|
1084
|
+
* @example Distributed (workers in three regions):
|
|
1085
|
+
*
|
|
1086
|
+
* await selfImprove({
|
|
1087
|
+
* agent: httpDispatch({ resolveUrl: ({ placement }) => REGION_URLS[placement!] }),
|
|
1088
|
+
* scenarios,
|
|
1089
|
+
* judge,
|
|
1090
|
+
* baselineSurface: DEFAULT_PROMPT,
|
|
1091
|
+
* cellPlacement: ({ scenario }) => scenario.region,
|
|
1092
|
+
* budget: { maxConcurrency: 12 },
|
|
1093
|
+
* })
|
|
1094
|
+
*/
|
|
1095
|
+
async function selfImprove(opts) {
|
|
1096
|
+
const startedAt = Date.now();
|
|
1097
|
+
const runDir = resolveRunDir(opts.runDir ?? (opts.method ? `.agent-eval/runs/self-improve-${startedAt}` : `mem://selfImprove-${startedAt}`));
|
|
1098
|
+
const storage = opts.storage ?? (runDir.startsWith("mem://") ? inMemoryCampaignStorage() : fsCampaignStorage());
|
|
1099
|
+
const costLedger = createRunCostLedger({
|
|
1100
|
+
storage,
|
|
1101
|
+
runDir,
|
|
1102
|
+
costCeilingUsd: opts.budget?.dollars
|
|
1103
|
+
});
|
|
1104
|
+
try {
|
|
1105
|
+
return await runSelfImprove(opts, costLedger, startedAt, runDir, storage);
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
throw new SelfImproveRunError(error, costLedger);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
async function runSelfImprove(opts, costLedger, startedAt, runDir, storage) {
|
|
1111
|
+
const budget = opts.budget ?? {};
|
|
1112
|
+
assertSelfImproveSearchMode(opts);
|
|
1113
|
+
const generations = opts.method ? 1 : budget.generations ?? 3;
|
|
1114
|
+
const populationSize = opts.method ? 1 : budget.populationSize ?? 2;
|
|
1115
|
+
const maxConcurrency = budget.maxConcurrency ?? 2;
|
|
1116
|
+
const holdoutFraction = budget.holdoutFraction ?? .25;
|
|
1117
|
+
const holdoutMode = budget.holdout ?? "measured";
|
|
1118
|
+
const holdoutDeferred = holdoutMode === "deferred";
|
|
1119
|
+
const expectUsage = opts.expectUsage ?? "assert";
|
|
1120
|
+
const explicitHoldout = budget.holdoutScenarios;
|
|
1121
|
+
const { train, holdout } = explicitHoldout ? {
|
|
1122
|
+
train: opts.scenarios.filter((s) => !explicitHoldout.some((h) => h.id === s.id)),
|
|
1123
|
+
holdout: explicitHoldout
|
|
1124
|
+
} : holdoutDeferred ? {
|
|
1125
|
+
train: opts.scenarios,
|
|
1126
|
+
holdout: []
|
|
1127
|
+
} : splitTrainHoldout(opts.scenarios, holdoutFraction);
|
|
1128
|
+
if (train.length === 0) throw new Error("selfImprove: train split is empty. Reduce holdoutFraction or pass more scenarios.");
|
|
1129
|
+
if (holdout.length === 0 && !holdoutDeferred) throw new Error("selfImprove: holdout split is empty. Pass more scenarios.");
|
|
1130
|
+
if (generations > 0 && !opts.proposer && !opts.method) throw new Error("selfImprove: method or proposer is required when budget.generations is greater than zero");
|
|
1131
|
+
let optimizationResult;
|
|
1132
|
+
const methodPartitions = opts.method ? splitMethodPartitions(train, opts.selectionScenarios, budget.selectionFraction ?? .25) : void 0;
|
|
1133
|
+
const proposer = opts.method ? {
|
|
1134
|
+
kind: `method:${opts.method.name}`,
|
|
1135
|
+
propose: async (context) => {
|
|
1136
|
+
if (context.generation > 0) return [];
|
|
1137
|
+
const result = await opts.method.optimize(Object.freeze({
|
|
1138
|
+
baselineSurface: structuredClone(context.currentSurface),
|
|
1139
|
+
trainScenarios: Object.freeze(methodPartitions.train.map((scenario) => structuredClone(scenario))),
|
|
1140
|
+
selectionScenarios: Object.freeze(methodPartitions.selection.map((scenario) => structuredClone(scenario))),
|
|
1141
|
+
dispatchWithSurface: opts.agent,
|
|
1142
|
+
judges: Object.freeze([opts.judge]),
|
|
1143
|
+
runDir: `${runDir}/optimization/${safeRunComponent(opts.method.name)}`,
|
|
1144
|
+
seed: 42,
|
|
1145
|
+
runOptions: Object.freeze({
|
|
1146
|
+
storage,
|
|
1147
|
+
maxConcurrency,
|
|
1148
|
+
reps: budget.reps,
|
|
1149
|
+
dispatchTimeoutMs: opts.dispatchTimeoutMs,
|
|
1150
|
+
expectUsage,
|
|
1151
|
+
costCeiling: budget.dollars
|
|
1152
|
+
}),
|
|
1153
|
+
costLedger
|
|
1154
|
+
}));
|
|
1155
|
+
assertOptimizationResult(opts.method.name, result);
|
|
1156
|
+
optimizationResult = structuredClone(result);
|
|
1157
|
+
return [{
|
|
1158
|
+
surface: structuredClone(result.winnerSurface),
|
|
1159
|
+
label: opts.method.name,
|
|
1160
|
+
rationale: `${opts.method.name} selected this surface without final cases.`
|
|
1161
|
+
}];
|
|
1162
|
+
}
|
|
1163
|
+
} : opts.proposer ?? {
|
|
1164
|
+
kind: "baseline-only",
|
|
1165
|
+
propose: async () => []
|
|
1166
|
+
};
|
|
1167
|
+
const gate = opts.gate ?? defaultProductionGate({
|
|
1168
|
+
holdoutScenarios: holdout,
|
|
1169
|
+
deltaThreshold: .05
|
|
1170
|
+
});
|
|
1171
|
+
if (opts.onProgress) opts.onProgress({
|
|
1172
|
+
kind: "baseline.started",
|
|
1173
|
+
scenarios: opts.scenarios.length
|
|
1174
|
+
});
|
|
1175
|
+
const result = await runImprovementLoop({
|
|
1176
|
+
scenarios: train,
|
|
1177
|
+
baselineSurface: opts.baselineSurface,
|
|
1178
|
+
premeasuredBaseline: opts.premeasuredBaseline,
|
|
1179
|
+
dispatchWithSurface: opts.agent,
|
|
1180
|
+
proposer,
|
|
1181
|
+
judges: [opts.judge],
|
|
1182
|
+
populationSize,
|
|
1183
|
+
maxGenerations: generations,
|
|
1184
|
+
candidateConcurrency: budget.candidateConcurrency,
|
|
1185
|
+
reps: budget.reps,
|
|
1186
|
+
maxImprovementShots: budget.maxImprovementShots,
|
|
1187
|
+
holdoutScenarios: holdout,
|
|
1188
|
+
holdout: holdoutMode,
|
|
1189
|
+
gate,
|
|
1190
|
+
neutralize: opts.neutralize,
|
|
1191
|
+
autoOnPromote: opts.autoOnPromote ?? "none",
|
|
1192
|
+
ghOwner: opts.ghOwner,
|
|
1193
|
+
ghRepo: opts.ghRepo,
|
|
1194
|
+
storage,
|
|
1195
|
+
runDir,
|
|
1196
|
+
maxConcurrency,
|
|
1197
|
+
cellPlacement: opts.cellPlacement,
|
|
1198
|
+
dispatchTimeoutMs: opts.dispatchTimeoutMs,
|
|
1199
|
+
costLedger,
|
|
1200
|
+
expectUsage,
|
|
1201
|
+
labeledStore: opts.labeledStore,
|
|
1202
|
+
captureSource: opts.captureSource,
|
|
1203
|
+
analyzeGeneration: opts.analyzeGeneration,
|
|
1204
|
+
findings: opts.findings,
|
|
1205
|
+
selectionRankKey: opts.selectionRankKey
|
|
1206
|
+
});
|
|
1207
|
+
const reportSplit = holdoutDeferred ? "search" : "holdout";
|
|
1208
|
+
const reportBaselineCampaign = holdoutDeferred ? result.baselineCampaign : result.baselineOnHoldout;
|
|
1209
|
+
const reportWinnerCampaign = holdoutDeferred ? winnerSearchCampaign(result) : result.winnerOnHoldout;
|
|
1210
|
+
const baseline = meanComposite(reportBaselineCampaign.aggregates.byScenario);
|
|
1211
|
+
const winnerStats = meanComposite(reportWinnerCampaign.aggregates.byScenario);
|
|
1212
|
+
let power;
|
|
1213
|
+
const baselineHoldoutComposites = result.baselineOnHoldout.cells.filter((cell) => !cell.error).map((cell) => {
|
|
1214
|
+
const scores = Object.values(cell.judgeScores);
|
|
1215
|
+
return scores.length === 0 ? NaN : scores.reduce((sum, s) => sum + s.composite, 0) / scores.length;
|
|
1216
|
+
}).filter((v) => Number.isFinite(v));
|
|
1217
|
+
if (baselineHoldoutComposites.length >= 3) {
|
|
1218
|
+
power = powerPreflight({
|
|
1219
|
+
baselineComposites: baselineHoldoutComposites,
|
|
1220
|
+
sharedScorerChannel: true
|
|
1221
|
+
});
|
|
1222
|
+
if (opts.onProgress) opts.onProgress({
|
|
1223
|
+
kind: "power.estimated",
|
|
1224
|
+
n: power.n,
|
|
1225
|
+
sd: power.sd,
|
|
1226
|
+
mde: power.mde,
|
|
1227
|
+
underpowered: power.underpowered
|
|
1228
|
+
});
|
|
1229
|
+
if (power.underpowered && generations > 0) console.warn(`[selfImprove] ${power.recommendation}`);
|
|
1230
|
+
}
|
|
1231
|
+
if (opts.onProgress) {
|
|
1232
|
+
opts.onProgress({
|
|
1233
|
+
kind: "baseline.completed",
|
|
1234
|
+
compositeMean: baseline.compositeMean,
|
|
1235
|
+
durationMs: Date.now() - startedAt
|
|
1236
|
+
});
|
|
1237
|
+
opts.onProgress({
|
|
1238
|
+
kind: "gate.decided",
|
|
1239
|
+
decision: result.gateResult.decision,
|
|
1240
|
+
...holdoutDeferred ? {} : { lift: winnerStats.compositeMean - baseline.compositeMean }
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
const cost = result.cost;
|
|
1244
|
+
const totalCost = cost.totalCostUsd;
|
|
1245
|
+
const insight = await analyzeRuns({
|
|
1246
|
+
runs: [...cellsToRunRecords(reportBaselineCampaign.cells, "baseline", runDir, opts.baselineSurface, reportSplit, opts.model), ...cellsToRunRecords(reportWinnerCampaign.cells, "winner", runDir, result.winnerSurface, reportSplit, opts.model)],
|
|
1247
|
+
baselineCandidateId: "baseline",
|
|
1248
|
+
candidateCandidateId: "winner"
|
|
1249
|
+
});
|
|
1250
|
+
const durationMs = Date.now() - startedAt;
|
|
1251
|
+
const { record: provenance } = await emitLoopProvenance({
|
|
1252
|
+
...loopProvenanceArgsFromResult({
|
|
1253
|
+
runId: `${runDir}#${startedAt}`,
|
|
1254
|
+
runDir,
|
|
1255
|
+
timestamp: new Date(startedAt).toISOString(),
|
|
1256
|
+
baselineSurface: opts.baselineSurface,
|
|
1257
|
+
result,
|
|
1258
|
+
costReceipts: costLedger.list(),
|
|
1259
|
+
totalCostUsd: totalCost,
|
|
1260
|
+
totalDurationMs: durationMs
|
|
1261
|
+
}),
|
|
1262
|
+
...optimizationResult ? { optimizationMethod: {
|
|
1263
|
+
name: opts.method.name,
|
|
1264
|
+
cost: structuredClone(optimizationResult.cost),
|
|
1265
|
+
...optimizationResult.durationMs === void 0 ? {} : { durationMs: optimizationResult.durationMs },
|
|
1266
|
+
...optimizationResult.provenance === void 0 ? {} : { provenance: structuredClone(optimizationResult.provenance) }
|
|
1267
|
+
} } : {},
|
|
1268
|
+
storage,
|
|
1269
|
+
hostedClient: opts.hostedTenant ? createHostedClient(opts.hostedTenant) : void 0
|
|
1270
|
+
});
|
|
1271
|
+
if (opts.onProvenance) opts.onProvenance(provenance);
|
|
1272
|
+
const summary = {
|
|
1273
|
+
baseline,
|
|
1274
|
+
winner: {
|
|
1275
|
+
...winnerStats,
|
|
1276
|
+
surface: result.winnerSurface,
|
|
1277
|
+
...result.winnerLabel ? { label: result.winnerLabel } : {},
|
|
1278
|
+
...result.winnerRationale ? { rationale: result.winnerRationale } : {}
|
|
1279
|
+
},
|
|
1280
|
+
...holdoutDeferred ? {} : { lift: winnerStats.compositeMean - baseline.compositeMean },
|
|
1281
|
+
diff: result.promotedDiff,
|
|
1282
|
+
provenance,
|
|
1283
|
+
gateDecision: result.gateResult.decision,
|
|
1284
|
+
generationsExplored: result.generations.length,
|
|
1285
|
+
durationMs,
|
|
1286
|
+
totalCostUsd: totalCost,
|
|
1287
|
+
cost,
|
|
1288
|
+
receipts: costLedger.list(),
|
|
1289
|
+
...optimizationResult ? { optimization: {
|
|
1290
|
+
name: opts.method.name,
|
|
1291
|
+
cost: structuredClone(optimizationResult.cost),
|
|
1292
|
+
...optimizationResult.durationMs === void 0 ? {} : { durationMs: optimizationResult.durationMs },
|
|
1293
|
+
...optimizationResult.provenance === void 0 ? {} : { provenance: structuredClone(optimizationResult.provenance) }
|
|
1294
|
+
} } : {},
|
|
1295
|
+
insight,
|
|
1296
|
+
...power ? { power } : {},
|
|
1297
|
+
raw: result
|
|
1298
|
+
};
|
|
1299
|
+
if (opts.hostedTenant) try {
|
|
1300
|
+
await shipEvalRunToHosted(opts.hostedTenant, opts, summary, result, runDir);
|
|
1301
|
+
} catch (err) {
|
|
1302
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1303
|
+
console.warn(`[agent-eval] hosted ingest failed (continuing): ${msg}`);
|
|
1304
|
+
}
|
|
1305
|
+
return summary;
|
|
1306
|
+
}
|
|
1307
|
+
async function shipEvalRunToHosted(tenant, opts, summary, raw, runDir) {
|
|
1308
|
+
const client = createHostedClient(tenant);
|
|
1309
|
+
function snapshotFromCampaign(index, surface, campaign, durationMs) {
|
|
1310
|
+
const cells = campaign.cells.map((cell) => {
|
|
1311
|
+
const execution = campaignCellExecutionEvidence(cell);
|
|
1312
|
+
return {
|
|
1313
|
+
scenarioId: cell.scenarioId,
|
|
1314
|
+
rep: cell.rep,
|
|
1315
|
+
compositeMean: campaignCellTaskScore(cell) ?? null,
|
|
1316
|
+
dimensions: campaignCellJudgeDimensions(cell),
|
|
1317
|
+
terminalOutcome: execution.terminalOutcome,
|
|
1318
|
+
executionErrorCount: execution.executionErrorCount ?? null,
|
|
1319
|
+
errorMessage: cell.error ?? void 0
|
|
1320
|
+
};
|
|
1321
|
+
});
|
|
1322
|
+
const scoredCells = cells.flatMap((cell) => cell.compositeMean === null ? [] : [cell.compositeMean]);
|
|
1323
|
+
const compositeMean = scoredCells.length === 0 ? null : scoredCells.reduce((sum, score) => sum + score, 0) / scoredCells.length;
|
|
1324
|
+
return {
|
|
1325
|
+
index,
|
|
1326
|
+
surfaceHash: surfaceHash(surface),
|
|
1327
|
+
surface,
|
|
1328
|
+
cells,
|
|
1329
|
+
compositeMean,
|
|
1330
|
+
costUsd: campaign.aggregates.cost.totalCostUsd,
|
|
1331
|
+
durationMs
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
const generations = [];
|
|
1335
|
+
generations.push(snapshotFromCampaign(0, opts.baselineSurface, raw.baselineCampaign, 0));
|
|
1336
|
+
for (const gen of raw.generations) {
|
|
1337
|
+
const winner = gen.surfaces.reduce((best, s) => s.campaign.aggregates.cellsExecuted > 0 && (best === void 0 || averageComposite(s.campaign) > averageComposite(best.campaign)) ? s : best, gen.surfaces[0]);
|
|
1338
|
+
if (!winner) continue;
|
|
1339
|
+
generations.push(snapshotFromCampaign(gen.record.generationIndex + 1, winner.surface, winner.campaign, 0));
|
|
1340
|
+
}
|
|
1341
|
+
const event = {
|
|
1342
|
+
runId: `${runDir}#${Date.now()}`,
|
|
1343
|
+
runDir,
|
|
1344
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1345
|
+
status: "finished",
|
|
1346
|
+
labels: opts.hostedLabels ?? {},
|
|
1347
|
+
baseline: generations[0],
|
|
1348
|
+
generations,
|
|
1349
|
+
gateDecision: summary.gateDecision,
|
|
1350
|
+
holdoutLift: summary.lift,
|
|
1351
|
+
totalCostUsd: summary.totalCostUsd,
|
|
1352
|
+
totalDurationMs: summary.durationMs,
|
|
1353
|
+
insightReport: summary.insight
|
|
1354
|
+
};
|
|
1355
|
+
await client.ingestEvalRun(event);
|
|
1356
|
+
}
|
|
1357
|
+
function averageComposite(campaign) {
|
|
1358
|
+
const aggs = Object.values(campaign.aggregates.byScenario);
|
|
1359
|
+
return aggs.length === 0 ? 0 : aggs.reduce((s, a) => s + a.meanComposite, 0) / aggs.length;
|
|
1360
|
+
}
|
|
1361
|
+
function hashString(s) {
|
|
1362
|
+
let h = 2166136261;
|
|
1363
|
+
for (let i = 0; i < s.length; i++) {
|
|
1364
|
+
h ^= s.charCodeAt(i);
|
|
1365
|
+
h = Math.imul(h, 16777619) >>> 0;
|
|
1366
|
+
}
|
|
1367
|
+
return h.toString(16).padStart(8, "0");
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Adapt campaign cells into the `RunRecord` shape `analyzeRuns()` consumes.
|
|
1371
|
+
* Each cell becomes one run; `candidateId` is the caller-supplied label so
|
|
1372
|
+
* baseline + winner pair cleanly on `(experimentId, scenarioId, seed)`.
|
|
1373
|
+
*
|
|
1374
|
+
* `promptHash` is the REAL sha256 content hash of the surface this cell ran
|
|
1375
|
+
* (baseline vs winner are byte-distinguishable + byte-identical-verifiable);
|
|
1376
|
+
* `configHash` is the sha256 of the candidate label so the two candidates'
|
|
1377
|
+
* config rows differ. Both were previously the literal `'sha256:cell'`, which
|
|
1378
|
+
* made baseline and winner indistinguishable in every downstream record.
|
|
1379
|
+
*/
|
|
1380
|
+
function cellsToRunRecords(cells, candidateId, runId, surface, splitTag, fallbackModel) {
|
|
1381
|
+
const promptHash = surfaceContentHash(surface);
|
|
1382
|
+
const configHash = surfaceContentHash(candidateId);
|
|
1383
|
+
return cells.map((cell) => {
|
|
1384
|
+
const receiptModels = cell.resolvedModels ?? (cell.resolvedModel ? [cell.resolvedModel] : []);
|
|
1385
|
+
if (receiptModels.length > 1) throw new ValidationError(`selfImprove cell ${cell.cellId} used multiple agent models: ${receiptModels.join(", ")}`);
|
|
1386
|
+
const model = receiptModels[0] ?? fallbackModel;
|
|
1387
|
+
if (!model) throw new ValidationError(`selfImprove.model is required when cell ${cell.cellId} has no paid-call model receipt`);
|
|
1388
|
+
if (!modelHasSnapshot(model)) throw new ValidationError(`selfImprove model "${model}" lacks a snapshot version for cell ${cell.cellId}`);
|
|
1389
|
+
return campaignCellToRunRecord(cell, {
|
|
1390
|
+
runId: `${runId}::${candidateId}::${cell.cellId}`,
|
|
1391
|
+
experimentId: runId,
|
|
1392
|
+
candidateId,
|
|
1393
|
+
seed: cell.rep * 1e6 + hashString(cell.scenarioId).slice(0, 6).split("").reduce((a, c) => a * 31 + c.charCodeAt(0) >>> 0, 0),
|
|
1394
|
+
model,
|
|
1395
|
+
promptHash,
|
|
1396
|
+
configHash,
|
|
1397
|
+
commitSha: "cell",
|
|
1398
|
+
splitTag
|
|
1399
|
+
});
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/contract/define-agent-eval.ts
|
|
1404
|
+
/**
|
|
1405
|
+
* Define an agent eval once, then either score a surface with `evaluate()` or
|
|
1406
|
+
* run the closed loop with `improve()`.
|
|
1407
|
+
*
|
|
1408
|
+
* This is a DX wrapper only: it delegates to `runEval()` and `selfImprove()` and
|
|
1409
|
+
* returns their native result shapes.
|
|
1410
|
+
*/
|
|
1411
|
+
function defineAgentEval(defaults) {
|
|
1412
|
+
const defaultEvaluateOptions = evaluateDefaults(defaults);
|
|
1413
|
+
return {
|
|
1414
|
+
scenarios: defaults.scenarios,
|
|
1415
|
+
baselineSurface: defaults.baselineSurface,
|
|
1416
|
+
async evaluate(opts = {}) {
|
|
1417
|
+
const { agent, judge, judges, runDir, scenarios, surface, ...campaignOpts } = opts;
|
|
1418
|
+
const selectedAgent = agent ?? defaults.agent;
|
|
1419
|
+
const selectedSurface = surface ?? defaults.baselineSurface;
|
|
1420
|
+
const selectedRunDir = runDir ?? defaults.runDir ?? `mem://defineAgentEval-${Date.now()}`;
|
|
1421
|
+
const selectedStorage = campaignOpts.storage ?? defaultEvaluateOptions.storage ?? (selectedRunDir.startsWith("mem://") ? inMemoryCampaignStorage() : void 0);
|
|
1422
|
+
const evalOptions = {
|
|
1423
|
+
...defaultEvaluateOptions,
|
|
1424
|
+
...campaignOpts,
|
|
1425
|
+
...selectedStorage ? { storage: selectedStorage } : {},
|
|
1426
|
+
runDir: selectedRunDir,
|
|
1427
|
+
scenarios: scenarios ?? defaults.scenarios,
|
|
1428
|
+
dispatch: (scenario, ctx) => selectedAgent(selectedSurface, scenario, ctx),
|
|
1429
|
+
judges: evaluateJudges(judges, judge ?? defaults.judge)
|
|
1430
|
+
};
|
|
1431
|
+
if (evalOptions.reps !== void 0) evalOptions.reps = requirePositiveInteger(evalOptions.reps, "reps");
|
|
1432
|
+
return runEval(evalOptions);
|
|
1433
|
+
},
|
|
1434
|
+
async improve(opts = {}) {
|
|
1435
|
+
const { budget: budgetOverride, hostedTenant: hostedTenantOverride, ...topLevelOverrides } = opts;
|
|
1436
|
+
const merged = mergeDefined(defaults, topLevelOverrides);
|
|
1437
|
+
const budget = mergeBudget(defaults.budget, budgetOverride);
|
|
1438
|
+
const hostedTenant = mergeHostedTenant(defaults.hostedTenant, hostedTenantOverride);
|
|
1439
|
+
return selfImprove({
|
|
1440
|
+
...merged,
|
|
1441
|
+
...budget ? { budget } : {},
|
|
1442
|
+
...hostedTenant ? { hostedTenant } : {}
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
function evaluateDefaults(defaults) {
|
|
1448
|
+
const out = {};
|
|
1449
|
+
if (defaults.storage) out.storage = defaults.storage;
|
|
1450
|
+
if (defaults.labeledStore) out.labeledStore = defaults.labeledStore;
|
|
1451
|
+
if (defaults.captureSource) out.captureSource = defaults.captureSource;
|
|
1452
|
+
if (defaults.cellPlacement) out.cellPlacement = defaults.cellPlacement;
|
|
1453
|
+
if (defaults.expectUsage) out.expectUsage = defaults.expectUsage;
|
|
1454
|
+
if (defaults.budget?.dollars !== void 0) out.costCeiling = defaults.budget.dollars;
|
|
1455
|
+
if (defaults.budget?.maxConcurrency !== void 0) out.maxConcurrency = defaults.budget.maxConcurrency;
|
|
1456
|
+
if (defaults.budget?.reps !== void 0) out.reps = requirePositiveInteger(defaults.budget.reps, "budget.reps");
|
|
1457
|
+
return out;
|
|
1458
|
+
}
|
|
1459
|
+
function mergeBudget(defaults, overrides) {
|
|
1460
|
+
const merged = mergeOptionalObject(defaults, overrides);
|
|
1461
|
+
if (merged?.reps !== void 0) merged.reps = requirePositiveInteger(merged.reps, "budget.reps");
|
|
1462
|
+
return merged;
|
|
1463
|
+
}
|
|
1464
|
+
function mergeHostedTenant(defaults, overrides) {
|
|
1465
|
+
const merged = mergeOptionalObject(defaults, overrides);
|
|
1466
|
+
if (!merged) return void 0;
|
|
1467
|
+
if (!merged.endpoint?.trim() || !merged.apiKey?.trim() || !merged.tenantId?.trim()) throw new Error("defineAgentEval.improve: hostedTenant requires endpoint, apiKey, and tenantId after merging defaults and overrides");
|
|
1468
|
+
return merged;
|
|
1469
|
+
}
|
|
1470
|
+
function mergeDefined(defaults, overrides) {
|
|
1471
|
+
if (!overrides) return defaults;
|
|
1472
|
+
const merged = { ...defaults };
|
|
1473
|
+
for (const [key, value] of Object.entries(overrides)) if (value !== void 0) merged[key] = value;
|
|
1474
|
+
return merged;
|
|
1475
|
+
}
|
|
1476
|
+
function mergeOptionalObject(defaults, overrides) {
|
|
1477
|
+
if (!defaults && !overrides) return void 0;
|
|
1478
|
+
return mergeDefined(defaults ?? {}, overrides);
|
|
1479
|
+
}
|
|
1480
|
+
function evaluateJudges(judges, defaultJudge) {
|
|
1481
|
+
if (judges !== void 0) {
|
|
1482
|
+
if (judges.length === 0) throw new Error("defineAgentEval.evaluate: judges must not be empty");
|
|
1483
|
+
return judges;
|
|
1484
|
+
}
|
|
1485
|
+
return [defaultJudge];
|
|
1486
|
+
}
|
|
1487
|
+
function requirePositiveInteger(value, field) {
|
|
1488
|
+
if (!Number.isInteger(value) || value < 1) throw new Error(`defineAgentEval: ${field} must be a positive integer`);
|
|
1489
|
+
return value;
|
|
1490
|
+
}
|
|
1491
|
+
//#endregion
|
|
1492
|
+
export { summarizeExecution as a, analyzeRuns as i, SelfImproveRunError as n, checkCanaries as o, selfImprove as r, defineAgentEval as t };
|
|
1081
1493
|
|
|
1082
|
-
//# sourceMappingURL=
|
|
1494
|
+
//# sourceMappingURL=define-agent-eval-iqjT--ZZ.js.map
|