@tangle-network/agent-eval 1.0.19 → 1.0.20
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 +15 -21
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-CPv4tENR.d.ts → agent-profile-BO8ruI6R.d.ts} +3 -3
- package/dist/{agent-profile-CPv4tENR.d.ts.map → agent-profile-BO8ruI6R.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +14 -14
- package/dist/analyst/index.js +11 -12
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-pJ4fhnYg.d.ts → analyze-runs-DicleUI_.d.ts} +4 -4
- package/dist/{analyze-runs-pJ4fhnYg.d.ts.map → analyze-runs-DicleUI_.d.ts.map} +1 -1
- package/dist/{analyze-runs-C7vWBDhl.js → analyze-runs-e9vfXY--.js} +6 -110
- package/dist/analyze-runs-e9vfXY--.js.map +1 -0
- package/dist/app-grade/index.d.ts +4 -4
- package/dist/app-grade/index.js +3 -3
- package/dist/{benchmark-command-DSJQeYom.js → benchmark-command-BGZD77Un.js} +13 -14
- package/dist/benchmark-command-BGZD77Un.js.map +1 -0
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +4 -5
- package/dist/benchmarks/index.js.map +1 -1
- package/dist/builder-eval/index.js +1 -1
- package/dist/{calibration-CbZPApIO.js → calibration-Ze7SjhT9.js} +2 -2
- package/dist/{calibration-CbZPApIO.js.map → calibration-Ze7SjhT9.js.map} +1 -1
- package/dist/campaign/index.d.ts +7 -7
- package/dist/campaign/index.js +10 -10
- package/dist/{campaign-BABipFel.js → campaign-BfDMncQN.js} +14 -15
- package/dist/{campaign-BABipFel.js.map → campaign-BfDMncQN.js.map} +1 -1
- package/dist/{campaign-evidence-DONEWvVY.js → campaign-evidence-BuKlRzSA.js} +3 -3
- package/dist/{campaign-evidence-DONEWvVY.js.map → campaign-evidence-BuKlRzSA.js.map} +1 -1
- package/dist/{chat-client-D0me8iwq.js → chat-client-Zz97O3NB.js} +2 -2
- package/dist/{chat-client-D0me8iwq.js.map → chat-client-Zz97O3NB.js.map} +1 -1
- package/dist/{chat-json-call-C473CwTt.js → chat-json-call-Dgi7-RH-.js} +2 -2
- package/dist/{chat-json-call-C473CwTt.js.map → chat-json-call-Dgi7-RH-.js.map} +1 -1
- package/dist/cli.js +7 -7
- package/dist/{types-0KglnQ9o.d.ts → cluster-Cd0MRbr9.d.ts} +44 -2
- package/dist/cluster-Cd0MRbr9.d.ts.map +1 -0
- package/dist/cluster-bootstrap-BYIW7QJ4.js +24 -0
- package/dist/cluster-bootstrap-BYIW7QJ4.js.map +1 -0
- package/dist/{completion-verifier-7KEfroqx.d.ts → completion-verifier-BEpsr3N4.d.ts} +2 -2
- package/dist/{completion-verifier-7KEfroqx.d.ts.map → completion-verifier-BEpsr3N4.d.ts.map} +1 -1
- package/dist/{completion-verifier-ClmJV_Yc.js → completion-verifier-DFyYFezn.js} +3 -3
- package/dist/{completion-verifier-ClmJV_Yc.js.map → completion-verifier-DFyYFezn.js.map} +1 -1
- package/dist/contract/index.d.ts +10 -10
- package/dist/contract/index.js +14 -15
- package/dist/contract/index.js.map +1 -1
- package/dist/{cost-ledger-CS8R3IZj.js → cost-ledger-DfhStGcZ.js} +2 -2
- package/dist/{cost-ledger-CS8R3IZj.js.map → cost-ledger-DfhStGcZ.js.map} +1 -1
- package/dist/{decision-point-CNyoKOkz.js → decision-point-DJWievVw.js} +4 -4
- package/dist/{decision-point-CNyoKOkz.js.map → decision-point-DJWievVw.js.map} +1 -1
- package/dist/{default-registry-BbXr18AT.d.ts → default-registry-BpGFsSpZ.d.ts} +7 -7
- package/dist/{default-registry-BbXr18AT.d.ts.map → default-registry-BpGFsSpZ.d.ts.map} +1 -1
- package/dist/{default-registry-BB9_jzyH.js → default-registry-CdMtoY-s.js} +5 -5
- package/dist/{default-registry-BB9_jzyH.js.map → default-registry-CdMtoY-s.js.map} +1 -1
- package/dist/{define-agent-eval-D_DQMH04.d.ts → define-agent-eval-DcK8mg63.d.ts} +7 -7
- package/dist/{define-agent-eval-D_DQMH04.d.ts.map → define-agent-eval-DcK8mg63.d.ts.map} +1 -1
- package/dist/{define-agent-eval-Q4FdXGj7.js → define-agent-eval-DuQNZajG.js} +6 -6
- package/dist/{define-agent-eval-Q4FdXGj7.js.map → define-agent-eval-DuQNZajG.js.map} +1 -1
- package/dist/diagnosis/index.d.ts +2 -2
- package/dist/diagnosis/index.js +1 -1
- package/dist/{dspy-rlm-engine-CqQc0R2l.js → dspy-rlm-engine-cWyn8G1a.js} +4 -4
- package/dist/{dspy-rlm-engine-CqQc0R2l.js.map → dspy-rlm-engine-cWyn8G1a.js.map} +1 -1
- package/dist/{engine-rfV8Ff8V.d.ts → engine-BF8naBn7.d.ts} +2 -2
- package/dist/{engine-rfV8Ff8V.d.ts.map → engine-BF8naBn7.d.ts.map} +1 -1
- package/dist/{eval-campaign-CZSCjxVb.js → eval-campaign-LmpC_5fm.js} +2 -2
- package/dist/{eval-campaign-CZSCjxVb.js.map → eval-campaign-LmpC_5fm.js.map} +1 -1
- package/dist/{evaluation-SDXKL6Fx.d.ts → evaluation-BCejQgkV.d.ts} +4 -4
- package/dist/{evaluation-SDXKL6Fx.d.ts.map → evaluation-BCejQgkV.d.ts.map} +1 -1
- package/dist/{evaluation-BBI37mRe.js → evaluation-bU_bhlv-.js} +2 -2
- package/dist/{evaluation-BBI37mRe.js.map → evaluation-bU_bhlv-.js.map} +1 -1
- package/dist/evaluation.d.ts +1 -1
- package/dist/evaluation.js +1 -1
- package/dist/{exact-types-CaLLU1Pz.d.ts → exact-types-VAFjtOQN.d.ts} +2 -2
- package/dist/{exact-types-CaLLU1Pz.d.ts.map → exact-types-VAFjtOQN.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +3 -5
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +7 -12
- package/dist/experiment/index.js.map +1 -1
- package/dist/{exporters-BYBG9b1n.d.ts → exporters-dQKYD_Zo.d.ts} +2 -2
- package/dist/{exporters-BYBG9b1n.d.ts.map → exporters-dQKYD_Zo.d.ts.map} +1 -1
- package/dist/{external-optimizer-process-CfrY-nJT.js → external-optimizer-process-2ImGH_LR.js} +2 -2
- package/dist/{external-optimizer-process-CfrY-nJT.js.map → external-optimizer-process-2ImGH_LR.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-BtJk8UcU.js → external-optimizer-subprocess-_C_2yriN.js} +3 -3
- package/dist/{external-optimizer-subprocess-BtJk8UcU.js.map → external-optimizer-subprocess-_C_2yriN.js.map} +1 -1
- package/dist/{feedback-trajectory-P37ju-gW.d.ts → feedback-trajectory-DTj8eVTR.d.ts} +3 -3
- package/dist/{feedback-trajectory-P37ju-gW.d.ts.map → feedback-trajectory-DTj8eVTR.d.ts.map} +1 -1
- package/dist/{findings-store-BnYN57-h.js → findings-store-BSuaV3dN.js} +7 -24
- package/dist/findings-store-BSuaV3dN.js.map +1 -0
- package/dist/fuzz.js +2 -2
- package/dist/{index-BPmj-_ta.d.ts → index-Bc8BZfzb.d.ts} +10 -9
- package/dist/index-Bc8BZfzb.d.ts.map +1 -0
- package/dist/index-BdLmBInV.d.ts +1099 -0
- package/dist/index-BdLmBInV.d.ts.map +1 -0
- package/dist/{index-D4lT7aFu.d.ts → index-CeYLLnfi.d.ts} +28 -128
- package/dist/index-CeYLLnfi.d.ts.map +1 -0
- package/dist/{index-C3t17kHu.d.ts → index-CzfdjM6o.d.ts} +7 -100
- package/dist/index-CzfdjM6o.d.ts.map +1 -0
- package/dist/{index-HuSMvqR2.d.ts → index-DYNHOTTB.d.ts} +5 -5
- package/dist/{index-HuSMvqR2.d.ts.map → index-DYNHOTTB.d.ts.map} +1 -1
- package/dist/{index-AmfM3usI.d.ts → index-D_eAFB3T.d.ts} +8 -8
- package/dist/{index-AmfM3usI.d.ts.map → index-D_eAFB3T.d.ts.map} +1 -1
- package/dist/{index-DLVbfss9.d.ts → index-gSu9DUiw.d.ts} +8 -8
- package/dist/{index-DLVbfss9.d.ts.map → index-gSu9DUiw.d.ts.map} +1 -1
- package/dist/index.d.ts +29 -31
- package/dist/index.js +28 -164
- package/dist/index.js.map +1 -1
- package/dist/{integrity-BAdVzT8u.d.ts → integrity-CrmnGB2T.d.ts} +2 -2
- package/dist/{integrity-BAdVzT8u.d.ts.map → integrity-CrmnGB2T.d.ts.map} +1 -1
- package/dist/{judge-gate-CIlBrn6q.js → judge-gate-BliY81A0.js} +3 -3
- package/dist/{judge-gate-CIlBrn6q.js.map → judge-gate-BliY81A0.js.map} +1 -1
- package/dist/{kind-factory-Cfz8DUCc.js → kind-factory-CV0FNCMM.js} +2 -2
- package/dist/{kind-factory-Cfz8DUCc.js.map → kind-factory-CV0FNCMM.js.map} +1 -1
- package/dist/{llm-client-BdSiZ4qz.js → llm-client-DMMSg-Ro.js} +2 -2
- package/dist/{llm-client-BdSiZ4qz.js.map → llm-client-DMMSg-Ro.js.map} +1 -1
- package/dist/{llm-judge-VD_MI6kd.js → llm-judge-Bnxuwjxl.js} +13 -14
- package/dist/{llm-judge-VD_MI6kd.js.map → llm-judge-Bnxuwjxl.js.map} +1 -1
- package/dist/{matrix-Yg1lHIGI.d.ts → matrix-D6zEwLvE.d.ts} +2 -2
- package/dist/{matrix-Yg1lHIGI.d.ts.map → matrix-D6zEwLvE.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +2 -2
- package/dist/meta-eval/index.js +7 -7
- package/dist/{metrics-DNCAUtuB.js → metrics-zALlR17s.js} +16 -17
- package/dist/metrics-zALlR17s.js.map +1 -0
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/multishot/index.js +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{outcome-observations-DZu5hLYF.js → outcome-observations-BpicIVQi.js} +2 -3
- package/dist/{outcome-observations-DZu5hLYF.js.map → outcome-observations-BpicIVQi.js.map} +1 -1
- package/dist/paired-arms-Dep5tbsw.js +338 -0
- package/dist/paired-arms-Dep5tbsw.js.map +1 -0
- package/dist/{paired-promotion-decision-BDnqepZ1.d.ts → paired-promotion-decision-BNzPfXDw.d.ts} +3 -113
- package/dist/paired-promotion-decision-BNzPfXDw.d.ts.map +1 -0
- package/dist/{paired-promotion-decision-CiueaTTj.js → paired-promotion-decision-Nt4CkkOT.js} +2 -3
- package/dist/{paired-promotion-decision-CiueaTTj.js.map → paired-promotion-decision-Nt4CkkOT.js.map} +1 -1
- package/dist/{pareto-a3EOmjfe.js → pareto-C445lnEH.js} +3 -6
- package/dist/{pareto-a3EOmjfe.js.map → pareto-C445lnEH.js.map} +1 -1
- package/dist/pipelines/index.js +1 -1
- package/dist/{prime-protocol-DKRk4l4U.d.ts → prime-protocol-D1NkJRuD.d.ts} +2 -2
- package/dist/{prime-protocol-DKRk4l4U.d.ts.map → prime-protocol-D1NkJRuD.d.ts.map} +1 -1
- package/dist/{promotion-gate-DOkgJcLW.d.ts → promotion-gate-DjAsmBSZ.d.ts} +3 -67
- package/dist/promotion-gate-DjAsmBSZ.d.ts.map +1 -0
- package/dist/{promotion-policy-DLPcEnCf.js → promotion-policy-CUWOv01m.js} +4 -4
- package/dist/{promotion-policy-DLPcEnCf.js.map → promotion-policy-CUWOv01m.js.map} +1 -1
- package/dist/{proposal-findings-BfzzZ_lN.js → proposal-findings-DWs94yT8.js} +2 -2
- package/dist/{proposal-findings-BfzzZ_lN.js.map → proposal-findings-DWs94yT8.js.map} +1 -1
- package/dist/{registry-Ck7w-rr5.d.ts → registry-BAcEbzKm.d.ts} +4 -4
- package/dist/{registry-Ck7w-rr5.d.ts.map → registry-BAcEbzKm.d.ts.map} +1 -1
- package/dist/{release-confidence-nfQNh3eb.js → release-confidence-DDrkmWxT.js} +2 -2
- package/dist/{release-confidence-nfQNh3eb.js.map → release-confidence-DDrkmWxT.js.map} +1 -1
- package/dist/reporting.d.ts +4 -5
- package/dist/reporting.d.ts.map +1 -1
- package/dist/reporting.js +5 -7
- package/dist/reporting.js.map +1 -1
- package/dist/{researcher-CLnNJ7Or.d.ts → researcher-D35yo0B8.d.ts} +4 -4
- package/dist/{researcher-CLnNJ7Or.d.ts.map → researcher-D35yo0B8.d.ts.map} +1 -1
- package/dist/{reward-hacking-B88f-Kh7.js → reward-hacking-DRb8K6N1.js} +2 -3
- package/dist/{reward-hacking-B88f-Kh7.js.map → reward-hacking-DRb8K6N1.js.map} +1 -1
- package/dist/rl.d.ts +9 -8
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +8 -10
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +4 -4
- package/dist/rollout/index.js +1 -1
- package/dist/{rollout-Cu7kHGIe.js → rollout-DKa54qer.js} +2 -2
- package/dist/{rollout-Cu7kHGIe.js.map → rollout-DKa54qer.js.map} +1 -1
- package/dist/{rubric-predictive-validity-D_6ZPTNR.js → rubric-predictive-validity-BMS7SUyh.js} +2 -2
- package/dist/{rubric-predictive-validity-D_6ZPTNR.js.map → rubric-predictive-validity-BMS7SUyh.js.map} +1 -1
- package/dist/{run-record-CbUi2adH.js → run-record-CIflWk6i.js} +2 -2
- package/dist/{run-record-CbUi2adH.js.map → run-record-CIflWk6i.js.map} +1 -1
- package/dist/{runtime-rollouts-kGn1K5ut.js → runtime-rollouts-CfRyjk60.js} +2 -2
- package/dist/{runtime-rollouts-kGn1K5ut.js.map → runtime-rollouts-CfRyjk60.js.map} +1 -1
- package/dist/{schema-CfoA9U_U.d.ts → schema-PDKQ_iNE.d.ts} +2 -131
- package/dist/schema-PDKQ_iNE.d.ts.map +1 -0
- package/dist/search/index.d.ts +2 -2
- package/dist/search/index.js +2 -2
- package/dist/{search-kernel-DjqaPJqL.d.ts → search-kernel-Ds2zILpY.d.ts} +3 -3
- package/dist/{search-kernel-DjqaPJqL.d.ts.map → search-kernel-Ds2zILpY.d.ts.map} +1 -1
- package/dist/{search-summary-RJ5zXjHN.js → search-summary-BSftVrGY.js} +4 -4
- package/dist/{search-summary-RJ5zXjHN.js.map → search-summary-BSftVrGY.js.map} +1 -1
- package/dist/{sequential-Bb_pdTqG.d.ts → sequential-B9p6uoV8.d.ts} +9 -2
- package/dist/{sequential-Bb_pdTqG.d.ts.map → sequential-B9p6uoV8.d.ts.map} +1 -1
- package/dist/{sequential-Bjs5roiK.js → sequential-CAksw6EU.js} +32 -2
- package/dist/{sequential-Bjs5roiK.js.map → sequential-CAksw6EU.js.map} +1 -1
- package/dist/{sequential-BPbvgzfe.js → sequential-CqG6aLWS.js} +3 -3
- package/dist/{sequential-BPbvgzfe.js.map → sequential-CqG6aLWS.js.map} +1 -1
- package/dist/{server-CPKyf3bz.js → server-DFVwfoZq.js} +3 -3
- package/dist/{server-CPKyf3bz.js.map → server-DFVwfoZq.js.map} +1 -1
- package/dist/{skillopt-optimization-method-D9Hlmhjg.js → skillopt-optimization-method-DYwEndON.js} +9 -9
- package/dist/{skillopt-optimization-method-D9Hlmhjg.js.map → skillopt-optimization-method-DYwEndON.js.map} +1 -1
- package/dist/{statistical-heldout-C-tgpUuu.d.ts → statistical-heldout--0b1lgx4.d.ts} +6 -282
- package/dist/statistical-heldout--0b1lgx4.d.ts.map +1 -0
- package/dist/{statistical-heldout-NBxC7jGo.js → statistical-heldout-D6i58CJ5.js} +3 -3
- package/dist/{statistical-heldout-NBxC7jGo.js.map → statistical-heldout-D6i58CJ5.js.map} +1 -1
- package/dist/statistics-DCZIC-qT.js +2627 -0
- package/dist/statistics-DCZIC-qT.js.map +1 -0
- package/dist/statistics.d.ts +3 -0
- package/dist/statistics.js +3 -0
- package/dist/{store-otlp-BfPRa2p8.js → store-otlp-C-jyj3WX.js} +2 -2
- package/dist/{store-otlp-BfPRa2p8.js.map → store-otlp-C-jyj3WX.js.map} +1 -1
- package/dist/{store-tool-spans-BgwVHXma.d.ts → store-tool-spans-B3z_Qb5u.d.ts} +5 -5
- package/dist/{store-tool-spans-BgwVHXma.d.ts.map → store-tool-spans-B3z_Qb5u.d.ts.map} +1 -1
- package/dist/{store-tool-spans-BrSWHB9O.js → store-tool-spans-DalWlKY8.js} +3 -3
- package/dist/{store-tool-spans-BrSWHB9O.js.map → store-tool-spans-DalWlKY8.js.map} +1 -1
- package/dist/{summary-report-0La5vejY.d.ts → summary-report-Cv1AC-iv.d.ts} +2 -2
- package/dist/{summary-report-0La5vejY.d.ts.map → summary-report-Cv1AC-iv.d.ts.map} +1 -1
- package/dist/{summary-report-C3IJvp0i.js → summary-report-D_uussI3.js} +4 -52
- package/dist/summary-report-D_uussI3.js.map +1 -0
- package/dist/supervisor-run/index.d.ts +2 -2
- package/dist/supervisor-run/index.js +1 -1
- package/dist/{systemone-CpDppX8s.d.ts → systemone-C3xyEKvG.d.ts} +7 -7
- package/dist/{systemone-CpDppX8s.d.ts.map → systemone-C3xyEKvG.d.ts.map} +1 -1
- package/dist/{systemone-review-nbuMxxmi.d.ts → systemone-review-CToBl1oa.d.ts} +2 -2
- package/dist/{systemone-review-nbuMxxmi.d.ts.map → systemone-review-CToBl1oa.d.ts.map} +1 -1
- package/dist/systemone.d.ts +3 -3
- package/dist/systemone.js +2 -2
- package/dist/{tool-groups-BQsjZD9F.d.ts → tool-groups-R5RO9OHn.d.ts} +3 -3
- package/dist/tool-groups-R5RO9OHn.d.ts.map +1 -0
- package/dist/{tool-waste-Czt3aWID.js → tool-waste-DEhKfiIE.js} +2 -3
- package/dist/{tool-waste-Czt3aWID.js.map → tool-waste-DEhKfiIE.js.map} +1 -1
- package/dist/{trace-questions-CpTrtEcm.d.ts → trace-questions-BY6taxnl.d.ts} +3 -3
- package/dist/{trace-questions-CpTrtEcm.d.ts.map → trace-questions-BY6taxnl.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +1 -1
- package/dist/trace-repair/index.js +1 -2
- package/dist/trace-repair/index.js.map +1 -1
- package/dist/traces.d.ts +5 -5
- package/dist/traces.js +3 -3
- package/dist/{tree-DIHp6UQ0.js → tree-B2y1UR8o.js} +4 -6
- package/dist/{tree-DIHp6UQ0.js.map → tree-B2y1UR8o.js.map} +1 -1
- package/dist/{types-DNB9hIXa.d.ts → types-BAJ2Hb-d.d.ts} +3 -2
- package/dist/types-BAJ2Hb-d.d.ts.map +1 -0
- package/dist/{types-DsuOcYsE.d.ts → types-BwF--ZRz.d.ts} +2 -2
- package/dist/{types-DsuOcYsE.d.ts.map → types-BwF--ZRz.d.ts.map} +1 -1
- package/dist/{types-wDBk14lj.d.ts → types-CeMZYsNF.d.ts} +5 -4
- package/dist/types-CeMZYsNF.d.ts.map +1 -0
- package/dist/{types-B9s9Xo5_.d.ts → types-kBMNdo1X.d.ts} +3 -9
- package/dist/types-kBMNdo1X.d.ts.map +1 -0
- package/dist/wire/index.d.ts +6 -6
- package/dist/wire/index.js +1 -1
- package/docs/design/statistics-decisions.md +38 -364
- package/docs/design.md +1 -1
- package/docs/research-report-methodology.md +1 -1
- package/package.json +6 -1
- package/dist/agreement-irr-DXcXEt4I.js +0 -182
- package/dist/agreement-irr-DXcXEt4I.js.map +0 -1
- package/dist/analyze-runs-C7vWBDhl.js.map +0 -1
- package/dist/benchmark-command-DSJQeYom.js.map +0 -1
- package/dist/cluster-bootstrap-BteuR1hg.js +0 -65
- package/dist/cluster-bootstrap-BteuR1hg.js.map +0 -1
- package/dist/descriptive-B3Eb7tX0.js +0 -229
- package/dist/descriptive-B3Eb7tX0.js.map +0 -1
- package/dist/findings-store-BnYN57-h.js.map +0 -1
- package/dist/index-BPmj-_ta.d.ts.map +0 -1
- package/dist/index-C3t17kHu.d.ts.map +0 -1
- package/dist/index-D4lT7aFu.d.ts.map +0 -1
- package/dist/judge-calibration-DKR6Xi-w.js +0 -319
- package/dist/judge-calibration-DKR6Xi-w.js.map +0 -1
- package/dist/judge-calibration-DnrbQaXI.d.ts +0 -144
- package/dist/judge-calibration-DnrbQaXI.d.ts.map +0 -1
- package/dist/mean-D1d6gedE.js +0 -284
- package/dist/mean-D1d6gedE.js.map +0 -1
- package/dist/metrics-DNCAUtuB.js.map +0 -1
- package/dist/multiplicity-DAd4xaDC.js +0 -100
- package/dist/multiplicity-DAd4xaDC.js.map +0 -1
- package/dist/multiplicity-D_SEsc5j.d.ts +0 -41
- package/dist/multiplicity-D_SEsc5j.d.ts.map +0 -1
- package/dist/paired-arms-3-tsXvvC.js +0 -740
- package/dist/paired-arms-3-tsXvvC.js.map +0 -1
- package/dist/paired-binary-CMzmSSd5.js +0 -372
- package/dist/paired-binary-CMzmSSd5.js.map +0 -1
- package/dist/paired-promotion-decision-BDnqepZ1.d.ts.map +0 -1
- package/dist/paired-tests-Buh6feJ4.js +0 -211
- package/dist/paired-tests-Buh6feJ4.js.map +0 -1
- package/dist/power-and-mde-g3vOn0XK.js +0 -99
- package/dist/power-and-mde-g3vOn0XK.js.map +0 -1
- package/dist/promotion-gate-DOkgJcLW.d.ts.map +0 -1
- package/dist/random-BN150Q_X.d.ts +0 -79
- package/dist/random-BN150Q_X.d.ts.map +0 -1
- package/dist/schema-CfoA9U_U.d.ts.map +0 -1
- package/dist/sequential-eprocess-C1YLwFaz.js +0 -129
- package/dist/sequential-eprocess-C1YLwFaz.js.map +0 -1
- package/dist/statistical-heldout-C-tgpUuu.d.ts.map +0 -1
- package/dist/summary-report-C3IJvp0i.js.map +0 -1
- package/dist/tool-groups-BQsjZD9F.d.ts.map +0 -1
- package/dist/types-0KglnQ9o.d.ts.map +0 -1
- package/dist/types-B9s9Xo5_.d.ts.map +0 -1
- package/dist/types-DNB9hIXa.d.ts.map +0 -1
- package/dist/types-wDBk14lj.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as CostProvenance } from "./cost-ledger-Czro9wmo.js";
|
|
2
|
-
import { C as JudgeDimension, w as JudgeScore } from "./types-
|
|
2
|
+
import { C as JudgeDimension, w as JudgeScore } from "./types-CeMZYsNF.js";
|
|
3
3
|
import { o as MatrixResult } from "./index-DwUGehqX.js";
|
|
4
4
|
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
5
5
|
interface MultishotMessage {
|
|
@@ -381,4 +381,4 @@ interface RunMultishotMatrixResult {
|
|
|
381
381
|
}
|
|
382
382
|
declare function runMultishotMatrix<TPersona extends MultishotPersona>(opts: RunMultishotMatrixOptions<TPersona>): Promise<RunMultishotMatrixResult>;
|
|
383
383
|
export { MultishotTransportRequest as A, MultishotMessage as C, MultishotToolDefinition as D, MultishotShape as E, MultishotTransportToolCall as M, assertMultishotShotResult as N, MultishotToolExecutor as O, MultishotFatalToolError as S, MultishotResult as T, renderDimensions as _, MultishotCellOutput as a, MultishotArtifact as b, RunMultishotMatrixResult as c, MultishotShot as d, RunMultishotOptions as f, MultishotJudgeConfig as g, JudgeRunResult as h, ConversationJudgeInput as i, MultishotTransportResponse as j, MultishotTransport as k, computeCellComposite as l, DEFAULT_JUDGE_MODEL as m, CellCompositeInput as n, MultishotJudges as o, runMultishot as p, CellCompositeScore as r, RunMultishotMatrixOptions as s, ArtifactJudgeInput as t, runMultishotMatrix as u, renderJsonFooter as v, MultishotPersona as w, MultishotDriverEmptyError as x, runJudge as y };
|
|
384
|
-
//# sourceMappingURL=matrix-
|
|
384
|
+
//# sourceMappingURL=matrix-D6zEwLvE.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix-
|
|
1
|
+
{"version":3,"file":"matrix-D6zEwLvE.d.ts","names":[],"sources":["../src/multishot/types.ts","../src/multishot/judges.ts","../src/multishot/multishot.ts","../src/multishot/matrix.ts"],"mappings":";;;;UAIiB;EACf;EACA;EACA;EACA,YAAY;IAAQ;IAAY;IAAc,MAAM;;;UAGrC;EACf;EACA;EACA;IAAc;IAAc,MAAM;;EAClC;;UAGe;EACf,YAAY;EACZ,WAAW;EACX;EACA;;;EAGA;;;;;;;;EAQA,iBAAiB;;UAGF;EACf;EACA;IACE;IACA;IACA,YAAY;;;;;;UAOC;EACf;EACA,UAAU,MAAM;EAChB,QAAQ;EACR;EACA;EACA,SAAS;;UAGM;EACf;EACA;EACA;IAAY;IAAc;;;UAGX;EACf;IAAW;IAAyB,aAAa;;EACjD;IAAU;IAAwB;;;;EAGlC;;;;EAIA;;;;;;;;KASU,sBACV,KAAK,8BACF,QAAQ;KAED,yBACV,MAAM,yBACN;;EAEE,WAAW;EACX,SAAS;MAER;EAAU;EAAiB;;UAEf;;EAEf;;GAEC;;;;;;;;UASc,eAAe,iBAAiB;;EAE/C,eAAe,SAAS;;;EAGxB,2BAA2B,SAAS;;cAGzB,kCAAkC;WACjB;EAAA,YAAA;;cAMjB,gCAAgC;EAC/B,YAAA;;;;;;;;;;;;;;;;;;;iBAgCE,0BAA0B,yBAAyB,SAAS;cCvI/D;UAEI,qBAAqB;;EAEpC;;;EAGA,WAAW;;EAEX;;EAEA,YAAY;;EAEZ;;;EAGA,cAAc,OAAO;;EAErB;;UAGe;;EAEf,OAAO;;EAEP,MAAM;;iBAGc,SAAS,QAC7B,OAAO,qBAAqB,SAC5B,OAAO,SACN,QAAQ;;;iBAsIK,iBAAiB,eAAe;;iBAKhC,iBAAiB,eAAe;UCxK/B,oBAAoB,iBAAiB;EACpD,SAAS;EACT,SAAS;;;EAGT,QAAQ,eAAe;;EAEvB,QAAQ;;EAER,gBAAgB,eAAe;;;;EAI/B,mBAAmB;EACnB;EACA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,gBAAgB;;;;EAIhB,iBAAiB;;;EAGjB,gBAAgB;EAChB,SAAS;;;;;;;;;;;KAYC,cAAc,iBAAiB,qBACzC,MAAM,oBAAoB,cACvB,QAAQ;;;;;;;;;;;;;;;;;iBAkBS,aAAa,iBAAiB,kBAClD,MAAM,oBAAoB,YACzB,QAAQ;UClEM,uBAAuB,iBAAiB;EACvD,YAAY;EACZ,SAAS;;UAGM,mBAAmB,iBAAiB;EACnD,UAAU;EACV,SAAS;;UAGM,gBAAgB,iBAAiB;;EAEhD,cAAc,qBAAqB,uBAAuB;;EAE1D,aAAa,qBAAqB,mBAAmB;;EAErD,iBAAiB,qBAAqB,mBAAmB;;EAEzD;;EAEA;;UAGe;EACf;EACA,cAAc;EACd;IACE,aAAa,MAAM;MAAe;MAAc;;IAChD;;EAEF;IACE,aAAa,MAAM;MAAe;MAAc;;IAChD;;;UAIa,0BAA0B,iBAAiB;;EAE1D,UAAU;IAAQ;IAAY,OAAO;;;EAErC,UAAU;;;EAGV,QAAQ,eAAe;;EAEvB,QAAQ,gBAAgB;;EAExB,QAAQ;;EAER,gBAAgB,eAAe;;EAE/B,mBAAmB;;EAEnB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;EAIA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;EAIA,gBAAgB;;EAEhB,iBAAiB;;;EAGjB,gBAAgB;;;;;;;;;;;;;;;EAehB,UAAU,cAAc;;;;;UAMT;EACf;EACA;EACA;;UAoBe;EACf,cAAc;;EAEd,cAAc,cAAc;;EAE5B,iBAAiB,cAAc;;;;;;;iBAQjB,qBAAqB,OAAO;EAC1C;EACA;EACA;EACA;;UAuBe;EACf,QAAQ,aAAa;;iBAGD,mBAAmB,iBAAiB,kBACxD,MAAM,0BAA0B,YAC/B,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as measureJudgeAgreement, $t as CorrelationStudyOptions, A as JudgePanelOutput, At as ProbabilityPolicyAuditInput, B as JudgeConfusion, Bt as clusterBootstrapMean, C as JudgeCalibrationCellVerdict, Ct as EvaluatorAdmissionPolicy, D as JudgeCalibrationGoldItem, Dt as EvaluatorAuditPlan, E as JudgeCalibrationGateConfig, Et as EvaluatorAuditObservation, F as CalibrationExample, Ft as evaluatorAuditObservationSchema, G as JudgeGateRefusedError, Gt as CategoricalForecast, H as JudgeGateDecision, Ht as CalibrationOptions, I as CalibrationMerge, It as planEvaluatorAudit, J as JudgeRunMeta, Jt as calibrationCurve, K as JudgeGateStatus, Kt as OrdinalForecast, L as DEFAULT_JUDGE_GATE_POLICY, Lt as ClusterBootstrapOptions, M as RubricDimensionGuide, Mt as auditEvaluator, N as calibrateJudgePanel, Nt as auditProbabilityPolicy, O as JudgeDimensionCalibration, Ot as EvaluatorAuditPlanInput, P as gateJudgeCalibration, Pt as evaluatorAdmissionPolicySchema, Q as judgeGateDecision, Qt as CorrelationResult, R as JudgeAgreement, Rt as ClusterBootstrapResult, S as CalibrateJudgePanelInput, T as JudgeCalibrationGateCell, Tt as EvaluatorAuditInput, U as JudgeGateInput, Ut as CalibrationPair, V as JudgeExampleAgreement, Vt as CalibrationBin, W as JudgeGatePolicy, Wt as CalibrationReport, X as addCalibrationVerdicts, Xt as multiclassBrierScore, Y as OwnerVerdict, Yt as calibrationFromPairs, Z as assertJudgeMayGate, Zt as rankedProbabilityScore, _ as catchRate, _t as snapshotFromCalibration, a as PerturbedField, at as SentinelMetrics, b as plantByPerturbation, c as PlantEvidence, ct as SentinelSnapshot, d as PlantKindCounts, dt as SentinelTrend, en as CorrelationStudyResult, et as registerCalibrationSet, f as PlantManifest, ft as SnapshotMeta, g as UnseededRejection, gt as snapshotFromAgreement, h as SeededGradingSet, ht as judgeSentinelReport, i as PerturbationKind, it as SentinelMetricName, j as JudgePanelPrompt, jt as ProbabilityPolicyAuditReport, k as JudgePanelCalibration, kt as EvaluatorErrorRate, l as PlantExpectation, lt as SentinelStore, m as SeedPlantsOptions, mt as fileSentinelStore, n as CatchRateStatus, nn as OutcomePair, nt as EvalHealthStamp, o as PerturbedPlant, ot as SentinelReport, p as PlantOutcome, pt as evalHealthStamp, q as JudgeRun, qt as brierScore, r as EvidencePerturbation, rn as correlationStudy, rt as JudgeSentinelOptions, s as Plant, st as SentinelSetOptions, t as CatchRateReport, tn as EvalMetricSpec, tt as snapshotFromJudgeAgreement, u as PlantKind, ut as SentinelThresholds, v as definePlant, vt as snapshotFromSentinelSet, w as JudgeCalibrationGate, wt as EvaluatorAdmissionReport, x as seedPlants, y as perturbEvidence, yt as validateSentinelSnapshot, z as JudgeCalibrationSet, zt as ClusteredObservation } from "../index-C3t17kHu.js";
|
|
1
|
+
import { Bt as ContinuousAgreement, Gt as SelfPreferenceResult, Ht as ContinuousCalibrationResult, Jt as calibrateJudgeContinuous, Kt as VerbosityBiasResult, Qt as verbosityBias, Rt as CalibrationResult, Ut as GoldenItem, Vt as ContinuousAgreementOptions, Wt as PositionalBiasResult, Xt as positionalBias, Yt as continuousAgreement, Zt as selfPreference, qt as calibrateJudge, zt as CandidateScore } from "../index-BdLmBInV.js";
|
|
3
2
|
import { a as RubricPredictiveValidityReport, c as CorrelationInterval, d as FileSystemOutcomeStore, f as FileSystemOutcomeStoreOptions, g as OutcomeStoreError, h as OutcomeStore, i as RubricPredictiveValidityInput, l as OutcomeReduction, m as OutcomeFilter, n as RubricOutcomeExclusion, o as RubricRanking, p as InMemoryOutcomeStore, r as RubricOutcomePair, s as rubricPredictiveValidity, t as OutcomeMetricSpec, u as DeploymentOutcome } from "../rubric-predictive-validity-B3RzbwOx.js";
|
|
3
|
+
import { $ as measureJudgeAgreement, $t as CorrelationStudyOptions, A as JudgePanelOutput, At as ProbabilityPolicyAuditInput, B as JudgeConfusion, Bt as clusterBootstrapMean, C as JudgeCalibrationCellVerdict, Ct as EvaluatorAdmissionPolicy, D as JudgeCalibrationGoldItem, Dt as EvaluatorAuditPlan, E as JudgeCalibrationGateConfig, Et as EvaluatorAuditObservation, F as CalibrationExample, Ft as evaluatorAuditObservationSchema, G as JudgeGateRefusedError, Gt as CategoricalForecast, H as JudgeGateDecision, Ht as CalibrationOptions, I as CalibrationMerge, It as planEvaluatorAudit, J as JudgeRunMeta, Jt as calibrationCurve, K as JudgeGateStatus, Kt as OrdinalForecast, L as DEFAULT_JUDGE_GATE_POLICY, Lt as ClusterBootstrapOptions, M as RubricDimensionGuide, Mt as auditEvaluator, N as calibrateJudgePanel, Nt as auditProbabilityPolicy, O as JudgeDimensionCalibration, Ot as EvaluatorAuditPlanInput, P as gateJudgeCalibration, Pt as evaluatorAdmissionPolicySchema, Q as judgeGateDecision, Qt as CorrelationResult, R as JudgeAgreement, Rt as ClusterBootstrapResult, S as CalibrateJudgePanelInput, T as JudgeCalibrationGateCell, Tt as EvaluatorAuditInput, U as JudgeGateInput, Ut as CalibrationPair, V as JudgeExampleAgreement, Vt as CalibrationBin, W as JudgeGatePolicy, Wt as CalibrationReport, X as addCalibrationVerdicts, Xt as multiclassBrierScore, Y as OwnerVerdict, Yt as calibrationFromPairs, Z as assertJudgeMayGate, Zt as rankedProbabilityScore, _ as catchRate, _t as snapshotFromCalibration, a as PerturbedField, at as SentinelMetrics, b as plantByPerturbation, c as PlantEvidence, ct as SentinelSnapshot, d as PlantKindCounts, dt as SentinelTrend, en as CorrelationStudyResult, et as registerCalibrationSet, f as PlantManifest, ft as SnapshotMeta, g as UnseededRejection, gt as snapshotFromAgreement, h as SeededGradingSet, ht as judgeSentinelReport, i as PerturbationKind, it as SentinelMetricName, j as JudgePanelPrompt, jt as ProbabilityPolicyAuditReport, k as JudgePanelCalibration, kt as EvaluatorErrorRate, l as PlantExpectation, lt as SentinelStore, m as SeedPlantsOptions, mt as fileSentinelStore, n as CatchRateStatus, nn as OutcomePair, nt as EvalHealthStamp, o as PerturbedPlant, ot as SentinelReport, p as PlantOutcome, pt as evalHealthStamp, q as JudgeRun, qt as brierScore, r as EvidencePerturbation, rn as correlationStudy, rt as JudgeSentinelOptions, s as Plant, st as SentinelSetOptions, t as CatchRateReport, tn as EvalMetricSpec, tt as snapshotFromJudgeAgreement, u as PlantKind, ut as SentinelThresholds, v as definePlant, vt as snapshotFromSentinelSet, w as JudgeCalibrationGate, wt as EvaluatorAdmissionReport, x as seedPlants, y as perturbEvidence, yt as validateSentinelSnapshot, z as JudgeCalibrationSet, zt as ClusteredObservation } from "../index-CzfdjM6o.js";
|
|
4
4
|
export { type CalibrateJudgePanelInput, CalibrationBin, CalibrationExample, CalibrationMerge, CalibrationOptions, CalibrationPair, CalibrationReport, type CalibrationResult, type CandidateScore, CatchRateReport, CatchRateStatus, CategoricalForecast, ClusterBootstrapOptions, ClusterBootstrapResult, ClusteredObservation, type ContinuousAgreement, type ContinuousAgreementOptions, type ContinuousCalibrationResult, type CorrelationInterval, CorrelationResult, CorrelationStudyOptions, CorrelationStudyResult, DEFAULT_JUDGE_GATE_POLICY, DeploymentOutcome, type EvalHealthStamp, EvalMetricSpec, type EvaluatorAdmissionPolicy, type EvaluatorAdmissionReport, type EvaluatorAuditInput, type EvaluatorAuditObservation, type EvaluatorAuditPlan, type EvaluatorAuditPlanInput, type EvaluatorErrorRate, EvidencePerturbation, FileSystemOutcomeStore, FileSystemOutcomeStoreOptions, type GoldenItem, InMemoryOutcomeStore, JudgeAgreement, type JudgeCalibrationCellVerdict, type JudgeCalibrationGate, type JudgeCalibrationGateCell, type JudgeCalibrationGateConfig, type JudgeCalibrationGoldItem, JudgeCalibrationSet, JudgeConfusion, type JudgeDimensionCalibration, JudgeExampleAgreement, JudgeGateDecision, JudgeGateInput, JudgeGatePolicy, JudgeGateRefusedError, JudgeGateStatus, type JudgePanelCalibration, type JudgePanelOutput, type JudgePanelPrompt, JudgeRun, JudgeRunMeta, type JudgeSentinelOptions, OrdinalForecast, OutcomeFilter, OutcomeMetricSpec, OutcomePair, type OutcomeReduction, OutcomeStore, OutcomeStoreError, OwnerVerdict, PerturbationKind, PerturbedField, PerturbedPlant, Plant, PlantEvidence, PlantExpectation, PlantKind, PlantKindCounts, PlantManifest, PlantOutcome, type PositionalBiasResult, type ProbabilityPolicyAuditInput, type ProbabilityPolicyAuditReport, type RubricDimensionGuide, RubricOutcomeExclusion, RubricOutcomePair, RubricPredictiveValidityInput, RubricPredictiveValidityReport, RubricRanking, SeedPlantsOptions, SeededGradingSet, type SelfPreferenceResult, type SentinelMetricName, type SentinelMetrics, type SentinelReport, type SentinelSetOptions, type SentinelSnapshot, type SentinelStore, type SentinelThresholds, type SentinelTrend, type SnapshotMeta, UnseededRejection, type VerbosityBiasResult, addCalibrationVerdicts, assertJudgeMayGate, auditEvaluator, auditProbabilityPolicy, brierScore, calibrateJudge, calibrateJudgeContinuous, calibrateJudgePanel, calibrationCurve, calibrationFromPairs, catchRate, clusterBootstrapMean, continuousAgreement, correlationStudy, definePlant, evalHealthStamp, evaluatorAdmissionPolicySchema, evaluatorAuditObservationSchema, fileSentinelStore, gateJudgeCalibration, judgeGateDecision, judgeSentinelReport, measureJudgeAgreement, multiclassBrierScore, perturbEvidence, planEvaluatorAudit, plantByPerturbation, positionalBias, rankedProbabilityScore, registerCalibrationSet, rubricPredictiveValidity, seedPlants, selfPreference, snapshotFromAgreement, snapshotFromCalibration, snapshotFromJudgeAgreement, snapshotFromSentinelSet, validateSentinelSnapshot, verbosityBias };
|
package/dist/meta-eval/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as CaptureIntegrityError, s as ValidationError } from "../errors-DeEEV9Vx.js";
|
|
2
2
|
import { a as hashCanonical, i as compareCodeUnits } from "../canonical-CicJlINA.js";
|
|
3
|
+
import { G as calibrateJudge, J as positionalBias, K as calibrateJudgeContinuous, X as verbosityBias, Y as selfPreference, q as continuousAgreement } from "../statistics-DCZIC-qT.js";
|
|
3
4
|
import { t as mulberry32 } from "../random-DrzcgC7F.js";
|
|
4
|
-
import { a as selfPreference, i as positionalBias, n as calibrateJudgeContinuous, o as verbosityBias, r as continuousAgreement, t as calibrateJudge } from "../judge-calibration-DKR6Xi-w.js";
|
|
5
5
|
import { s as runMetricExtractor } from "../query-CGXzO9d4.js";
|
|
6
|
-
import { n as callLlmJson } from "../llm-client-
|
|
7
|
-
import { a as validateObservationOptions, i as reduceOutcomeMetric, n as correlationSummary, r as hasVariation, t as assertUniqueObservationIds } from "../outcome-observations-
|
|
8
|
-
import { a as rankedProbabilityScore, i as multiclassBrierScore, n as calibrationCurve, r as calibrationFromPairs, t as brierScore } from "../calibration-
|
|
9
|
-
import { a as judgeGateDecision, c as snapshotFromJudgeAgreement, d as judgeSentinelReport, f as snapshotFromAgreement, g as withJudgeRetry, h as validateSentinelSnapshot, i as assertJudgeMayGate, l as evalHealthStamp, m as snapshotFromSentinelSet, n as JudgeGateRefusedError, o as measureJudgeAgreement, p as snapshotFromCalibration, r as addCalibrationVerdicts, s as registerCalibrationSet, t as DEFAULT_JUDGE_GATE_POLICY, u as fileSentinelStore } from "../judge-gate-
|
|
6
|
+
import { n as callLlmJson } from "../llm-client-DMMSg-Ro.js";
|
|
7
|
+
import { a as validateObservationOptions, i as reduceOutcomeMetric, n as correlationSummary, r as hasVariation, t as assertUniqueObservationIds } from "../outcome-observations-BpicIVQi.js";
|
|
8
|
+
import { a as rankedProbabilityScore, i as multiclassBrierScore, n as calibrationCurve, r as calibrationFromPairs, t as brierScore } from "../calibration-Ze7SjhT9.js";
|
|
9
|
+
import { a as judgeGateDecision, c as snapshotFromJudgeAgreement, d as judgeSentinelReport, f as snapshotFromAgreement, g as withJudgeRetry, h as validateSentinelSnapshot, i as assertJudgeMayGate, l as evalHealthStamp, m as snapshotFromSentinelSet, n as JudgeGateRefusedError, o as measureJudgeAgreement, p as snapshotFromCalibration, r as addCalibrationVerdicts, s as registerCalibrationSet, t as DEFAULT_JUDGE_GATE_POLICY, u as fileSentinelStore } from "../judge-gate-BliY81A0.js";
|
|
10
10
|
import { t as computeInterval } from "../interval-Bd2f4CRT.js";
|
|
11
|
-
import { t as clusterBootstrapMean } from "../cluster-bootstrap-
|
|
12
|
-
import { t as rubricPredictiveValidity } from "../rubric-predictive-validity-
|
|
11
|
+
import { t as clusterBootstrapMean } from "../cluster-bootstrap-BYIW7QJ4.js";
|
|
12
|
+
import { t as rubricPredictiveValidity } from "../rubric-predictive-validity-BMS7SUyh.js";
|
|
13
13
|
import { n as InMemoryOutcomeStore, r as OutcomeStoreError, t as FileSystemOutcomeStore } from "../outcome-store-TarrcfHG.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
// src/meta-eval/correlation-study.ts
|
|
@@ -32,15 +32,17 @@ const MODEL_PRICING = {
|
|
|
32
32
|
"gpt-6-luna": {
|
|
33
33
|
input: 1e-4,
|
|
34
34
|
output: 5e-4
|
|
35
|
+
},
|
|
36
|
+
"gpt-5-mini": {
|
|
37
|
+
input: 25e-5,
|
|
38
|
+
output: .002
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
41
|
/** Family-level pricing fallbacks (per-1K), matched against a normalized id
|
|
38
42
|
* after exact lookup misses. Ordered — first match wins. Covers the model
|
|
39
|
-
* ids actually used through the Tangle router + cli-bridge harnesses
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* none of which appear in the exact table above — without this they priced
|
|
43
|
-
* to a silent $0, blanking every cost/Pareto axis downstream. */
|
|
43
|
+
* ids actually used through the Tangle router + cli-bridge harnesses, none
|
|
44
|
+
* of which appear in the exact table above — without this they priced to a
|
|
45
|
+
* silent $0, blanking every cost/Pareto axis downstream. */
|
|
44
46
|
const FAMILY_PRICING = [
|
|
45
47
|
[/^stealth\//, {
|
|
46
48
|
input: 0,
|
|
@@ -99,12 +101,11 @@ const FAMILY_PRICING = [
|
|
|
99
101
|
output: 6e-4
|
|
100
102
|
}]
|
|
101
103
|
];
|
|
102
|
-
/** Normalize a model id for pricing: drop
|
|
103
|
-
* and return
|
|
104
|
-
* served-model segment
|
|
105
|
-
* `glm-5.3`). Exact rows are checked against both before family fallback. */
|
|
104
|
+
/** Normalize a model id for pricing: drop `@snapshot` and trailing
|
|
105
|
+
* `-YYYY-MM-DD` dated-snapshot suffixes, lowercase, and return the complete
|
|
106
|
+
* id plus its final served-model segment for exact-row lookup. */
|
|
106
107
|
function normalizedModelIds(model) {
|
|
107
|
-
const id = (model.split("@")[0] ?? model).trim().toLowerCase();
|
|
108
|
+
const id = (model.split("@")[0] ?? model).trim().toLowerCase().replace(/-(?:19|20)\d{2}-\d{2}-\d{2}$/, "");
|
|
108
109
|
const finalSegment = id.slice(id.lastIndexOf("/") + 1);
|
|
109
110
|
return finalSegment === id ? [id] : [id, finalSegment];
|
|
110
111
|
}
|
|
@@ -118,8 +119,7 @@ function resolveModelPricing(model) {
|
|
|
118
119
|
for (const [pattern, price] of FAMILY_PRICING) if (ids.some((id) => pattern.test(id))) return price;
|
|
119
120
|
return null;
|
|
120
121
|
}
|
|
121
|
-
/** True when `model` has known pricing
|
|
122
|
-
* callers distinguish a real $0 from an unpriced model. */
|
|
122
|
+
/** True when `model` has known pricing: distinguishes a real $0 from unpriced. */
|
|
123
123
|
function isModelPriced(model) {
|
|
124
124
|
return resolveModelPricing(model) !== null;
|
|
125
125
|
}
|
|
@@ -128,15 +128,14 @@ const warnedUnpricedModels = /* @__PURE__ */ new Set();
|
|
|
128
128
|
function estimateTokens(text) {
|
|
129
129
|
return Math.ceil(text.length / 4);
|
|
130
130
|
}
|
|
131
|
-
/** Calculate cost in USD from token counts and model. Unknown models warn
|
|
132
|
-
*
|
|
133
|
-
* working; cost-sensitive callers should gate on {@link isModelPriced}. */
|
|
131
|
+
/** Calculate cost in USD from token counts and model. Unknown models warn once
|
|
132
|
+
* (not a silent zero) and return 0; cost-sensitive callers gate on {@link isModelPriced}. */
|
|
134
133
|
function estimateCost(inputTokens, outputTokens, model) {
|
|
135
134
|
const pricing = resolveModelPricing(model);
|
|
136
135
|
if (!pricing) {
|
|
137
136
|
if (!warnedUnpricedModels.has(model)) {
|
|
138
137
|
warnedUnpricedModels.add(model);
|
|
139
|
-
console.warn(`estimateCost: no pricing for
|
|
138
|
+
console.warn(`estimateCost: no pricing for "${model}" — returning 0; add it to MODEL_PRICING`);
|
|
140
139
|
}
|
|
141
140
|
return 0;
|
|
142
141
|
}
|
|
@@ -144,4 +143,4 @@ function estimateCost(inputTokens, outputTokens, model) {
|
|
|
144
143
|
}
|
|
145
144
|
export { resolveModelPricing as a, isModelPriced as i, estimateCost as n, estimateTokens as r, MODEL_PRICING as t };
|
|
146
145
|
|
|
147
|
-
//# sourceMappingURL=metrics-
|
|
146
|
+
//# sourceMappingURL=metrics-zALlR17s.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-zALlR17s.js","names":[],"sources":["../src/metrics.ts"],"sourcesContent":["interface TokenPrice {\n input: number\n output: number\n}\n\n/** Per-1K token pricing for exact model ids. */\nexport const MODEL_PRICING: Record<string, TokenPrice> = {\n 'gpt-4o': { input: 0.0025, output: 0.01 },\n 'gpt-4o-mini': { input: 0.00015, output: 0.0006 },\n 'gpt-4-turbo': { input: 0.01, output: 0.03 },\n 'claude-sonnet-4-20250514': { input: 0.003, output: 0.015 },\n 'claude-opus-4-20250514': { input: 0.015, output: 0.075 },\n 'claude-3-haiku-20240307': { input: 0.00025, output: 0.00125 },\n // Router response-header rates observed for the exact served model on\n // 2026-08-15. Keep this exact row ahead of the deliberately coarse family\n // fallback so glm-5.3 campaign costs are not understated by ~2.5x.\n 'glm-5.3': { input: 0.00168, output: 0.00528 },\n // Tangle Router's published rate (`GET /v1/models`) on 2026-10-09:\n // $0.10 / $0.50 per Mtok. Exact, because the coarse gpt-5 family row would\n // overstate it 12x on input and 20x on output.\n 'gpt-6-luna': { input: 0.0001, output: 0.0005 },\n // Router receipts for the served id `gpt-5-mini-2025-08-07` solve exactly\n // to $0.25 / $2 per Mtok; the gpt-5 family row is 5x too high.\n 'gpt-5-mini': { input: 0.00025, output: 0.002 },\n}\n\n/** Family-level pricing fallbacks (per-1K), matched against a normalized id\n * after exact lookup misses. Ordered — first match wins. Covers the model\n * ids actually used through the Tangle router + cli-bridge harnesses, none\n * of which appear in the exact table above — without this they priced to a\n * silent $0, blanking every cost/Pareto axis downstream. */\nconst FAMILY_PRICING: Array<[RegExp, TokenPrice]> = [\n // OpenRouter stealth previews (`stealth/union-alpha`, …) bill $0 during\n // their preview window. A real zero row lets the budget ledger admit them;\n // an unpriced id is refused before the first call.\n [/^stealth\\//, { input: 0, output: 0 }],\n [/claude.*opus/, { input: 0.015, output: 0.075 }],\n [/claude.*haiku/, { input: 0.0008, output: 0.004 }],\n [/claude.*sonnet|claude-code|claude-sonnet/, { input: 0.003, output: 0.015 }],\n [/gpt-4o-mini/, { input: 0.00015, output: 0.0006 }],\n [/gpt-5|gpt-4\\.1|o[134]\\b/, { input: 0.00125, output: 0.01 }],\n [/gpt-4o|gpt-4/, { input: 0.0025, output: 0.01 }],\n [/deepseek/, { input: 0.0003, output: 0.0011 }],\n [/glm|zhipu|zai/, { input: 0.0006, output: 0.0022 }],\n [/kimi|moonshot/, { input: 0.0006, output: 0.0025 }],\n [/qwen/, { input: 0.0004, output: 0.0012 }],\n [/gemini.*flash/, { input: 0.0001, output: 0.0004 }],\n [/gemini/, { input: 0.00125, output: 0.005 }],\n [/llama/, { input: 0.0002, output: 0.0006 }],\n]\n\n/** Normalize a model id for pricing: drop `@snapshot` and trailing\n * `-YYYY-MM-DD` dated-snapshot suffixes, lowercase, and return the complete\n * id plus its final served-model segment for exact-row lookup. */\nfunction normalizedModelIds(model: string): string[] {\n const stripped = (model.split('@')[0] ?? model).trim().toLowerCase()\n const id = stripped.replace(/-(?:19|20)\\d{2}-\\d{2}-\\d{2}$/, '')\n const finalSegment = id.slice(id.lastIndexOf('/') + 1)\n return finalSegment === id ? [id] : [id, finalSegment]\n}\n\n/** Resolve pricing for a model id: exact table, then family fallback.\n * Returns null when the id matches nothing (caller decides — never a\n * silent-zero masquerading as a real $0 cost). */\nexport function resolveModelPricing(model: string): TokenPrice | null {\n if (MODEL_PRICING[model]) return MODEL_PRICING[model]\n const ids = normalizedModelIds(model)\n for (const id of ids) {\n if (MODEL_PRICING[id]) return MODEL_PRICING[id]\n }\n for (const [pattern, price] of FAMILY_PRICING) {\n if (ids.some((id) => pattern.test(id))) return price\n }\n return null\n}\n\n/** True when `model` has known pricing: distinguishes a real $0 from unpriced. */\nexport function isModelPriced(model: string): boolean {\n return resolveModelPricing(model) !== null\n}\n\nconst warnedUnpricedModels = new Set<string>()\n\n/** Estimate token count from string length (chars / 4 approximation) */\nexport function estimateTokens(text: string): number {\n return Math.ceil(text.length / 4)\n}\n\n/** Calculate cost in USD from token counts and model. Unknown models warn once\n * (not a silent zero) and return 0; cost-sensitive callers gate on {@link isModelPriced}. */\nexport function estimateCost(inputTokens: number, outputTokens: number, model: string): number {\n const pricing = resolveModelPricing(model)\n if (!pricing) {\n if (!warnedUnpricedModels.has(model)) {\n warnedUnpricedModels.add(model)\n console.warn(`estimateCost: no pricing for \"${model}\" — returning 0; add it to MODEL_PRICING`)\n }\n return 0\n }\n return (inputTokens / 1000) * pricing.input + (outputTokens / 1000) * pricing.output\n}\n"],"mappings":";;AAMA,MAAa,gBAA4C;CACvD,UAAU;EAAE,OAAO;EAAQ,QAAQ;CAAK;CACxC,eAAe;EAAE,OAAO;EAAS,QAAQ;CAAO;CAChD,eAAe;EAAE,OAAO;EAAM,QAAQ;CAAK;CAC3C,4BAA4B;EAAE,OAAO;EAAO,QAAQ;CAAM;CAC1D,0BAA0B;EAAE,OAAO;EAAO,QAAQ;CAAM;CACxD,2BAA2B;EAAE,OAAO;EAAS,QAAQ;CAAQ;CAI7D,WAAW;EAAE,OAAO;EAAS,QAAQ;CAAQ;CAI7C,cAAc;EAAE,OAAO;EAAQ,QAAQ;CAAO;CAG9C,cAAc;EAAE,OAAO;EAAS,QAAQ;CAAM;AAChD;;;;;;AAOA,MAAM,iBAA8C;CAIlD,CAAC,cAAc;EAAE,OAAO;EAAG,QAAQ;CAAE,CAAC;CACtC,CAAC,gBAAgB;EAAE,OAAO;EAAO,QAAQ;CAAM,CAAC;CAChD,CAAC,iBAAiB;EAAE,OAAO;EAAQ,QAAQ;CAAM,CAAC;CAClD,CAAC,4CAA4C;EAAE,OAAO;EAAO,QAAQ;CAAM,CAAC;CAC5E,CAAC,eAAe;EAAE,OAAO;EAAS,QAAQ;CAAO,CAAC;CAClD,CAAC,2BAA2B;EAAE,OAAO;EAAS,QAAQ;CAAK,CAAC;CAC5D,CAAC,gBAAgB;EAAE,OAAO;EAAQ,QAAQ;CAAK,CAAC;CAChD,CAAC,YAAY;EAAE,OAAO;EAAQ,QAAQ;CAAO,CAAC;CAC9C,CAAC,iBAAiB;EAAE,OAAO;EAAQ,QAAQ;CAAO,CAAC;CACnD,CAAC,iBAAiB;EAAE,OAAO;EAAQ,QAAQ;CAAO,CAAC;CACnD,CAAC,QAAQ;EAAE,OAAO;EAAQ,QAAQ;CAAO,CAAC;CAC1C,CAAC,iBAAiB;EAAE,OAAO;EAAQ,QAAQ;CAAO,CAAC;CACnD,CAAC,UAAU;EAAE,OAAO;EAAS,QAAQ;CAAM,CAAC;CAC5C,CAAC,SAAS;EAAE,OAAO;EAAQ,QAAQ;CAAO,CAAC;AAC7C;;;;AAKA,SAAS,mBAAmB,OAAyB;CAEnD,MAAM,MADY,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,MAAA,CAAO,KAAK,CAAC,CAAC,YACrC,CAAC,CAAC,QAAQ,gCAAgC,EAAE;CAC9D,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;CACrD,OAAO,iBAAiB,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,YAAY;AACvD;;;;AAKA,SAAgB,oBAAoB,OAAkC;CACpE,IAAI,cAAc,QAAQ,OAAO,cAAc;CAC/C,MAAM,MAAM,mBAAmB,KAAK;CACpC,KAAK,MAAM,MAAM,KACf,IAAI,cAAc,KAAK,OAAO,cAAc;CAE9C,KAAK,MAAM,CAAC,SAAS,UAAU,gBAC7B,IAAI,IAAI,MAAM,OAAO,QAAQ,KAAK,EAAE,CAAC,GAAG,OAAO;CAEjD,OAAO;AACT;;AAGA,SAAgB,cAAc,OAAwB;CACpD,OAAO,oBAAoB,KAAK,MAAM;AACxC;AAEA,MAAM,uCAAuB,IAAI,IAAY;;AAG7C,SAAgB,eAAe,MAAsB;CACnD,OAAO,KAAK,KAAK,KAAK,SAAS,CAAC;AAClC;;;AAIA,SAAgB,aAAa,aAAqB,cAAsB,OAAuB;CAC7F,MAAM,UAAU,oBAAoB,KAAK;CACzC,IAAI,CAAC,SAAS;EACZ,IAAI,CAAC,qBAAqB,IAAI,KAAK,GAAG;GACpC,qBAAqB,IAAI,KAAK;GAC9B,QAAQ,KAAK,iCAAiC,MAAM,yCAAyC;EAC/F;EACA,OAAO;CACT;CACA,OAAQ,cAAc,MAAQ,QAAQ,QAAS,eAAe,MAAQ,QAAQ;AAChF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MultishotTransportRequest, D as MultishotToolDefinition, T as MultishotResult, c as RunMultishotMatrixResult, f as RunMultishotOptions, s as RunMultishotMatrixOptions, w as MultishotPersona } from "../../matrix-
|
|
1
|
+
import { A as MultishotTransportRequest, D as MultishotToolDefinition, T as MultishotResult, c as RunMultishotMatrixResult, f as RunMultishotOptions, s as RunMultishotMatrixOptions, w as MultishotPersona } from "../../matrix-D6zEwLvE.js";
|
|
2
2
|
interface CompareOptions {
|
|
3
3
|
/** Stop after this many mismatches. A structural divergence high in the
|
|
4
4
|
* tree would otherwise report every leaf below it. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as JudgeDimension, w as JudgeScore } from "../types-
|
|
2
|
-
import { A as MultishotTransportRequest, C as MultishotMessage, D as MultishotToolDefinition, E as MultishotShape, M as MultishotTransportToolCall, N as assertMultishotShotResult, O as MultishotToolExecutor, S as MultishotFatalToolError, T as MultishotResult, _ as renderDimensions, a as MultishotCellOutput, b as MultishotArtifact, c as RunMultishotMatrixResult, d as MultishotShot, f as RunMultishotOptions, g as MultishotJudgeConfig, h as JudgeRunResult, i as ConversationJudgeInput, j as MultishotTransportResponse, k as MultishotTransport, l as computeCellComposite, m as DEFAULT_JUDGE_MODEL, n as CellCompositeInput, o as MultishotJudges, p as runMultishot, r as CellCompositeScore, s as RunMultishotMatrixOptions, t as ArtifactJudgeInput, u as runMultishotMatrix, v as renderJsonFooter, w as MultishotPersona, x as MultishotDriverEmptyError, y as runJudge } from "../matrix-
|
|
1
|
+
import { C as JudgeDimension, w as JudgeScore } from "../types-CeMZYsNF.js";
|
|
2
|
+
import { A as MultishotTransportRequest, C as MultishotMessage, D as MultishotToolDefinition, E as MultishotShape, M as MultishotTransportToolCall, N as assertMultishotShotResult, O as MultishotToolExecutor, S as MultishotFatalToolError, T as MultishotResult, _ as renderDimensions, a as MultishotCellOutput, b as MultishotArtifact, c as RunMultishotMatrixResult, d as MultishotShot, f as RunMultishotOptions, g as MultishotJudgeConfig, h as JudgeRunResult, i as ConversationJudgeInput, j as MultishotTransportResponse, k as MultishotTransport, l as computeCellComposite, m as DEFAULT_JUDGE_MODEL, n as CellCompositeInput, o as MultishotJudges, p as runMultishot, r as CellCompositeScore, s as RunMultishotMatrixOptions, t as ArtifactJudgeInput, u as runMultishotMatrix, v as renderJsonFooter, w as MultishotPersona, x as MultishotDriverEmptyError, y as runJudge } from "../matrix-D6zEwLvE.js";
|
|
3
3
|
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
4
4
|
/** Prompt and completion tokens one leg reported. */
|
|
5
5
|
interface MultishotLegTokens {
|
package/dist/multishot/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isModelPriced, n as estimateCost } from "../metrics-
|
|
1
|
+
import { i as isModelPriced, n as estimateCost } from "../metrics-zALlR17s.js";
|
|
2
2
|
import { n as withCellSpend } from "../cell-spend-zxmzg4GH.js";
|
|
3
3
|
import { t as runAgentMatrix } from "../matrix-CgpX8wdm.js";
|
|
4
4
|
import { n as MultishotFatalToolError, r as assertMultishotShotResult, t as MultishotDriverEmptyError } from "../types-DK4vNv5q.js";
|
package/dist/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "@tangle-network/agent-eval — wire protocol",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.20",
|
|
6
6
|
"description": "HTTP and stdio RPC interface to agent-eval. The TypeScript runtime is the source of truth; this spec is the contract that cross-language clients (Python, Rust, Go) generate from.\n\nWire-protocol version: 1.1.0. Bumps on breaking changes to request/response schemas.",
|
|
7
7
|
"contact": {
|
|
8
8
|
"name": "Tangle Network",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as pearsonR, o as spearmanR } from "./descriptive-B3Eb7tX0.js";
|
|
1
|
+
import { et as pearsonR, nt as spearmanR, ut as makeRng } from "./statistics-DCZIC-qT.js";
|
|
3
2
|
// src/meta-eval/outcome-observations.ts
|
|
4
3
|
/** Reduce observations of one named metric; unrelated keys cannot supply a value. */
|
|
5
4
|
function reduceOutcomeMetric(outcomes, metric, reduction) {
|
|
@@ -74,4 +73,4 @@ function interval(values) {
|
|
|
74
73
|
}
|
|
75
74
|
export { validateObservationOptions as a, reduceOutcomeMetric as i, correlationSummary as n, validateOutcomeMetricSpecifications as o, hasVariation as r, assertUniqueObservationIds as t };
|
|
76
75
|
|
|
77
|
-
//# sourceMappingURL=outcome-observations-
|
|
76
|
+
//# sourceMappingURL=outcome-observations-BpicIVQi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome-observations-
|
|
1
|
+
{"version":3,"file":"outcome-observations-BpicIVQi.js","names":[],"sources":["../src/meta-eval/outcome-observations.ts"],"sourcesContent":["import { pearsonR, spearmanR } from '../statistics'\nimport { makeRng } from '../statistics/internal'\nimport type { DeploymentOutcome } from './outcome-store'\n\nexport type OutcomeReduction = 'latest' | 'mean' | 'max'\n\nexport interface CorrelationInterval {\n lower: number\n upper: number\n}\n\n/** Reduce observations of one named metric; unrelated keys cannot supply a value. */\nexport function reduceOutcomeMetric(\n outcomes: readonly DeploymentOutcome[],\n metric: string,\n reduction: OutcomeReduction,\n): number | null {\n const observations = outcomes.flatMap((outcome) => {\n const value = outcome.metrics[metric]\n return Number.isFinite(outcome.capturedAt) &&\n typeof value === 'number' &&\n Number.isFinite(value)\n ? [{ capturedAt: outcome.capturedAt, value }]\n : []\n })\n if (observations.length === 0) return null\n if (reduction === 'mean') {\n return observations.reduce(\n (sum, observation) => sum + observation.value / observations.length,\n 0,\n )\n }\n if (reduction === 'max') return Math.max(...observations.map((observation) => observation.value))\n return observations.reduce((a, b) => (b.capturedAt > a.capturedAt ? b : a)).value\n}\n\nexport function hasVariation(values: readonly number[]): boolean {\n return values.some((value) => value !== values[0])\n}\n\nexport function correlationSummary(\n xs: number[],\n ys: number[],\n iterations: number,\n seed: number | undefined,\n): {\n pearson: number\n spearman: number\n pearsonCi95: CorrelationInterval | null\n spearmanCi95: CorrelationInterval | null\n} {\n const rng = makeRng(seed, xs, ys)\n const pearsons: number[] = []\n const spearmans: number[] = []\n for (let b = 0; b < iterations; b++) {\n const rx: number[] = []\n const ry: number[] = []\n for (let i = 0; i < xs.length; i++) {\n const index = Math.floor(rng() * xs.length)\n rx.push(xs[index]!)\n ry.push(ys[index]!)\n }\n // A constant resample has no estimable correlation, even when both sides agree.\n if (!hasVariation(rx) || !hasVariation(ry)) continue\n const pearson = pearsonR(rx, ry)\n const spearman = spearmanR(rx, ry)\n if (Number.isFinite(pearson)) pearsons.push(pearson)\n if (Number.isFinite(spearman)) spearmans.push(spearman)\n }\n return {\n pearson: pearsonR(xs, ys),\n spearman: spearmanR(xs, ys),\n pearsonCi95: interval(pearsons),\n spearmanCi95: interval(spearmans),\n }\n}\n\nexport function validateObservationOptions(\n reduction: OutcomeReduction,\n iterations: number,\n seed: number | undefined,\n): void {\n if (!['latest', 'mean', 'max'].includes(reduction)) {\n throw new Error('outcome reduction must be latest, mean, or max')\n }\n if (!Number.isSafeInteger(iterations) || iterations < 1) {\n throw new Error('bootstrap iterations must be a positive safe integer')\n }\n if (seed !== undefined && !Number.isFinite(seed)) {\n throw new Error('bootstrap seed must be finite')\n }\n}\n\nexport function assertUniqueObservationIds(ids: readonly string[], name: string): void {\n if (ids.some((id) => typeof id !== 'string' || id.trim().length === 0)) {\n throw new Error(`${name} must be a nonempty string`)\n }\n if (new Set(ids).size !== ids.length) throw new Error(`duplicate ${name} in outcome study`)\n}\n\nexport function validateOutcomeMetricSpecifications(\n metrics: readonly { id: string; direction: string }[],\n): void {\n if (!Array.isArray(metrics) || metrics.length === 0) {\n throw new Error('outcomeMetrics must declare at least one outcome metric and direction')\n }\n for (const metric of metrics) {\n if (!metric || typeof metric.id !== 'string' || metric.id.trim().length === 0) {\n throw new Error('each outcome metric must have a nonempty id and explicit direction')\n }\n if (metric.direction !== 'higher-is-better' && metric.direction !== 'lower-is-better') {\n throw new Error(\n `outcome metric ${metric.id} must declare higher-is-better or lower-is-better`,\n )\n }\n }\n assertUniqueObservationIds(\n metrics.map((metric) => metric.id),\n 'outcome metric',\n )\n}\n\nfunction interval(values: number[]): CorrelationInterval | null {\n if (values.length === 0) return null\n values.sort((a, b) => a - b)\n return {\n lower: Math.max(-1, values[Math.floor(0.025 * values.length)]!),\n upper: Math.min(1, values[Math.min(values.length - 1, Math.floor(0.975 * values.length))]!),\n }\n}\n"],"mappings":";;;AAYA,SAAgB,oBACd,UACA,QACA,WACe;CACf,MAAM,eAAe,SAAS,SAAS,YAAY;EACjD,MAAM,QAAQ,QAAQ,QAAQ;EAC9B,OAAO,OAAO,SAAS,QAAQ,UAAU,KACvC,OAAO,UAAU,YACjB,OAAO,SAAS,KAAK,IACnB,CAAC;GAAE,YAAY,QAAQ;GAAY;EAAM,CAAC,IAC1C,CAAC;CACP,CAAC;CACD,IAAI,aAAa,WAAW,GAAG,OAAO;CACtC,IAAI,cAAc,QAChB,OAAO,aAAa,QACjB,KAAK,gBAAgB,MAAM,YAAY,QAAQ,aAAa,QAC7D,CACF;CAEF,IAAI,cAAc,OAAO,OAAO,KAAK,IAAI,GAAG,aAAa,KAAK,gBAAgB,YAAY,KAAK,CAAC;CAChG,OAAO,aAAa,QAAQ,GAAG,MAAO,EAAE,aAAa,EAAE,aAAa,IAAI,CAAE,CAAC,CAAC;AAC9E;AAEA,SAAgB,aAAa,QAAoC;CAC/D,OAAO,OAAO,MAAM,UAAU,UAAU,OAAO,EAAE;AACnD;AAEA,SAAgB,mBACd,IACA,IACA,YACA,MAMA;CACA,MAAM,MAAM,QAAQ,MAAM,IAAI,EAAE;CAChC,MAAM,WAAqB,CAAC;CAC5B,MAAM,YAAsB,CAAC;CAC7B,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK;EACnC,MAAM,KAAe,CAAC;EACtB,MAAM,KAAe,CAAC;EACtB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,QAAQ,KAAK;GAClC,MAAM,QAAQ,KAAK,MAAM,IAAI,IAAI,GAAG,MAAM;GAC1C,GAAG,KAAK,GAAG,MAAO;GAClB,GAAG,KAAK,GAAG,MAAO;EACpB;EAEA,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,GAAG;EAC5C,MAAM,UAAU,SAAS,IAAI,EAAE;EAC/B,MAAM,WAAW,UAAU,IAAI,EAAE;EACjC,IAAI,OAAO,SAAS,OAAO,GAAG,SAAS,KAAK,OAAO;EACnD,IAAI,OAAO,SAAS,QAAQ,GAAG,UAAU,KAAK,QAAQ;CACxD;CACA,OAAO;EACL,SAAS,SAAS,IAAI,EAAE;EACxB,UAAU,UAAU,IAAI,EAAE;EAC1B,aAAa,SAAS,QAAQ;EAC9B,cAAc,SAAS,SAAS;CAClC;AACF;AAEA,SAAgB,2BACd,WACA,YACA,MACM;CACN,IAAI,CAAC;EAAC;EAAU;EAAQ;CAAK,CAAC,CAAC,SAAS,SAAS,GAC/C,MAAM,IAAI,MAAM,gDAAgD;CAElE,IAAI,CAAC,OAAO,cAAc,UAAU,KAAK,aAAa,GACpD,MAAM,IAAI,MAAM,sDAAsD;CAExE,IAAI,SAAS,KAAA,KAAa,CAAC,OAAO,SAAS,IAAI,GAC7C,MAAM,IAAI,MAAM,+BAA+B;AAEnD;AAEA,SAAgB,2BAA2B,KAAwB,MAAoB;CACrF,IAAI,IAAI,MAAM,OAAO,OAAO,OAAO,YAAY,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC,GACnE,MAAM,IAAI,MAAM,GAAG,KAAK,2BAA2B;CAErD,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,QAAQ,MAAM,IAAI,MAAM,aAAa,KAAK,kBAAkB;AAC5F;AAEA,SAAgB,oCACd,SACM;CACN,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW,GAChD,MAAM,IAAI,MAAM,uEAAuE;CAEzF,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,CAAC,UAAU,OAAO,OAAO,OAAO,YAAY,OAAO,GAAG,KAAK,CAAC,CAAC,WAAW,GAC1E,MAAM,IAAI,MAAM,oEAAoE;EAEtF,IAAI,OAAO,cAAc,sBAAsB,OAAO,cAAc,mBAClE,MAAM,IAAI,MACR,kBAAkB,OAAO,GAAG,kDAC9B;CAEJ;CACA,2BACE,QAAQ,KAAK,WAAW,OAAO,EAAE,GACjC,gBACF;AACF;AAEA,SAAS,SAAS,QAA8C;CAC9D,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC;CAC3B,OAAO;EACL,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,MAAM,OAAQ,OAAO,MAAM,EAAG;EAC9D,OAAO,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,OAAO,SAAS,GAAG,KAAK,MAAM,OAAQ,OAAO,MAAM,CAAC,EAAG;CAC5F;AACF"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { s as ValidationError } from "./errors-DeEEV9Vx.js";
|
|
2
|
+
import { a as findingTreatmentSchema } from "./finding-composition-Belh_qU3.js";
|
|
3
|
+
import { _ as mcnemar, a as wilcoxonSignedRank, p as pairedBootstrap, y as pairedRiskDifference } from "./statistics-DCZIC-qT.js";
|
|
4
|
+
// src/arm-populations.ts
|
|
5
|
+
const keyOf = (row) => JSON.stringify([
|
|
6
|
+
row.arm,
|
|
7
|
+
row.pairKey,
|
|
8
|
+
row.repKey ?? null
|
|
9
|
+
]);
|
|
10
|
+
function checkIdentity(row) {
|
|
11
|
+
for (const value of [
|
|
12
|
+
row.arm,
|
|
13
|
+
row.pairKey,
|
|
14
|
+
...row.repKey === void 0 ? [] : [row.repKey]
|
|
15
|
+
]) if (typeof value !== "string" || !value.trim()) throw new TypeError("Arm assignments require nonempty identities");
|
|
16
|
+
if (row.treatment !== void 0) {
|
|
17
|
+
if (!Array.isArray(row.treatment)) throw new TypeError("Arm treatment must be an array");
|
|
18
|
+
for (const value of row.treatment) findingTreatmentSchema.parse(value);
|
|
19
|
+
if (new Set(row.treatment.map((t) => t.id)).size !== row.treatment.length) throw new TypeError("Duplicate arm treatment id");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function checkObservation(row) {
|
|
23
|
+
checkIdentity(row);
|
|
24
|
+
if (row.pass != null && typeof row.pass !== "boolean") throw new TypeError("Invalid arm pass value");
|
|
25
|
+
if (row.formation !== void 0) {
|
|
26
|
+
if (row.formation === null || typeof row.formation !== "object") throw new TypeError("Invalid formation verdict");
|
|
27
|
+
if (row.formation.formed !== null && typeof row.formation.formed !== "boolean") throw new TypeError("Invalid formation state");
|
|
28
|
+
if (row.formation.reason !== void 0 && typeof row.formation.reason !== "string") throw new TypeError("Invalid formation reason");
|
|
29
|
+
}
|
|
30
|
+
for (const value of Object.values(row.metrics ?? {})) if (value !== null && !Number.isFinite(value)) throw new TypeError("Non-finite arm metric");
|
|
31
|
+
}
|
|
32
|
+
/** One roster join serves comparison and both denominators; no outcomes are inferred from formation. */
|
|
33
|
+
function prepareArmPopulations(observations, assignments, options) {
|
|
34
|
+
const arms = [options.baselineArm, options.treatmentArm];
|
|
35
|
+
const roster = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const entry of assignments) {
|
|
37
|
+
if (!arms.includes(entry.arm)) continue;
|
|
38
|
+
checkIdentity(entry);
|
|
39
|
+
const key = keyOf(entry);
|
|
40
|
+
if (roster.has(key)) throw new TypeError("Duplicate arm assignment");
|
|
41
|
+
roster.set(key, structuredClone(entry));
|
|
42
|
+
}
|
|
43
|
+
for (const arm of arms) if (![...roster.values()].some((r) => r.arm === arm)) throw new TypeError(`No assignment roster for arm '${arm}'`);
|
|
44
|
+
const actual = /* @__PURE__ */ new Map();
|
|
45
|
+
for (const row of observations) {
|
|
46
|
+
if (!arms.includes(row.arm)) continue;
|
|
47
|
+
checkObservation(row);
|
|
48
|
+
const key = keyOf(row);
|
|
49
|
+
if (!roster.has(key)) throw new TypeError("Observed seed is outside the assignment roster");
|
|
50
|
+
if (actual.has(key)) throw new TypeError("Duplicate arm observation");
|
|
51
|
+
actual.set(key, row);
|
|
52
|
+
}
|
|
53
|
+
const ordered = [...roster.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
54
|
+
const rows = ordered.map(([key, entry]) => actual.get(key) ?? entry);
|
|
55
|
+
const metricNames = options.metricNames ?? [...new Set([...actual.values()].flatMap((r) => Object.keys(r.metrics ?? {})))].sort();
|
|
56
|
+
return {
|
|
57
|
+
rows,
|
|
58
|
+
readings: arms.map((arm) => {
|
|
59
|
+
const declared = ordered.filter(([, r]) => r.arm === arm);
|
|
60
|
+
const asAssigned = declared.map(([key]) => actual.get(key));
|
|
61
|
+
const asFormed = asAssigned.filter((row) => row?.formation?.formed === true);
|
|
62
|
+
return {
|
|
63
|
+
arm,
|
|
64
|
+
assignments: declared.map(([, r]) => r),
|
|
65
|
+
missingObservations: asAssigned.filter((r) => r === void 0).length,
|
|
66
|
+
formation: {
|
|
67
|
+
formed: asFormed.length,
|
|
68
|
+
notFormed: asAssigned.filter((r) => r?.formation?.formed === false).length,
|
|
69
|
+
unknown: asAssigned.filter((r) => r?.formation?.formed == null).length
|
|
70
|
+
},
|
|
71
|
+
asAssigned: summarize(asAssigned, metricNames),
|
|
72
|
+
asFormed: summarize(asFormed, metricNames)
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function summarize(rows, names) {
|
|
78
|
+
const passed = rows.filter((r) => r?.pass === true).length;
|
|
79
|
+
const failed = rows.filter((r) => r?.pass === false).length;
|
|
80
|
+
const missingOutcomes = rows.length - passed - failed;
|
|
81
|
+
const metrics = Object.fromEntries(names.map((name) => {
|
|
82
|
+
const values = rows.map((r) => r?.metrics?.[name]).filter((x) => x != null);
|
|
83
|
+
const sum = values.length ? values.reduce((s, v) => s + v, 0) : null;
|
|
84
|
+
return [name, {
|
|
85
|
+
n: values.length,
|
|
86
|
+
missing: rows.length - values.length,
|
|
87
|
+
sum,
|
|
88
|
+
mean: sum === null ? null : sum / values.length
|
|
89
|
+
}];
|
|
90
|
+
}));
|
|
91
|
+
return {
|
|
92
|
+
n: rows.length,
|
|
93
|
+
passed,
|
|
94
|
+
failed,
|
|
95
|
+
missingOutcomes,
|
|
96
|
+
passRate: rows.length && !missingOutcomes ? passed / rows.length : null,
|
|
97
|
+
metrics
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// src/paired-arms.ts
|
|
101
|
+
/**
|
|
102
|
+
* Match rows across two arms into (baseline, treatment) pairs by `pairKey`.
|
|
103
|
+
*
|
|
104
|
+
* A `pairKey` with at most one row per arm pairs directly, no `repKey`
|
|
105
|
+
* needed. A `pairKey` with multiple reps in either arm requires `repKey` on
|
|
106
|
+
* every one of its rows, and reps pair only on exact (`pairKey`, `repKey`)
|
|
107
|
+
* match — pairing is keyed purely on row identity, never on outcome content
|
|
108
|
+
* (outcome-keyed matching deflates discordant counts and biases McNemar), and
|
|
109
|
+
* is therefore independent of input order. Reps whose `repKey` has no
|
|
110
|
+
* counterpart in the other arm, and items present in only one arm, land in
|
|
111
|
+
* the unpaired lists — reported, never truncated.
|
|
112
|
+
*
|
|
113
|
+
* Fail-loud: throws when either named arm has zero rows (an unknown arm
|
|
114
|
+
* name would otherwise read as "everything unpaired"), when the two arm
|
|
115
|
+
* names are equal, when a multi-rep `pairKey` has a row without `repKey`, or
|
|
116
|
+
* when a (`pairKey`, arm) group repeats a `repKey` (the match would be
|
|
117
|
+
* ambiguous).
|
|
118
|
+
*/
|
|
119
|
+
function pairArms(rows, opts) {
|
|
120
|
+
const { baselineArm, treatmentArm } = opts;
|
|
121
|
+
if (baselineArm === treatmentArm) throw new ValidationError(`pairArms: baselineArm and treatmentArm are both '${baselineArm}' — an arm cannot be compared to itself`);
|
|
122
|
+
const byArm = /* @__PURE__ */ new Map();
|
|
123
|
+
const armsSeen = /* @__PURE__ */ new Set();
|
|
124
|
+
for (const row of rows) {
|
|
125
|
+
armsSeen.add(row.arm);
|
|
126
|
+
if (row.arm !== baselineArm && row.arm !== treatmentArm) continue;
|
|
127
|
+
const byKey = byArm.get(row.arm) ?? /* @__PURE__ */ new Map();
|
|
128
|
+
const group = byKey.get(row.pairKey) ?? [];
|
|
129
|
+
group.push(row);
|
|
130
|
+
byKey.set(row.pairKey, group);
|
|
131
|
+
byArm.set(row.arm, byKey);
|
|
132
|
+
}
|
|
133
|
+
for (const arm of [baselineArm, treatmentArm]) if (!byArm.has(arm)) {
|
|
134
|
+
const seen = [...armsSeen].sort().join(", ") || "<none>";
|
|
135
|
+
throw new ValidationError(`pairArms: no rows for arm '${arm}' (arms present: ${seen})`);
|
|
136
|
+
}
|
|
137
|
+
const baselineByKey = byArm.get(baselineArm);
|
|
138
|
+
const treatmentByKey = byArm.get(treatmentArm);
|
|
139
|
+
const allKeys = [.../* @__PURE__ */ new Set([...baselineByKey.keys(), ...treatmentByKey.keys()])].sort();
|
|
140
|
+
const pairs = [];
|
|
141
|
+
const unpairedBaseline = [];
|
|
142
|
+
const unpairedTreatment = [];
|
|
143
|
+
for (const pairKey of allKeys) {
|
|
144
|
+
const b = baselineByKey.get(pairKey) ?? [];
|
|
145
|
+
const t = treatmentByKey.get(pairKey) ?? [];
|
|
146
|
+
if (b.length <= 1 && t.length <= 1) {
|
|
147
|
+
if (b.length === 1 && t.length === 1) {
|
|
148
|
+
const baseline = b[0];
|
|
149
|
+
const treatment = t[0];
|
|
150
|
+
if (baseline.repKey !== void 0 || treatment.repKey !== void 0) {
|
|
151
|
+
if (baseline.repKey === void 0 || treatment.repKey === void 0 || baseline.repKey !== treatment.repKey) {
|
|
152
|
+
unpairedBaseline.push(baseline);
|
|
153
|
+
unpairedTreatment.push(treatment);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
pairs.push({
|
|
158
|
+
pairKey,
|
|
159
|
+
repIndex: 0,
|
|
160
|
+
baseline,
|
|
161
|
+
treatment
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
unpairedBaseline.push(...b);
|
|
165
|
+
unpairedTreatment.push(...t);
|
|
166
|
+
}
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
const bByRep = indexByRepKey(b, pairKey, baselineArm);
|
|
170
|
+
const tByRep = indexByRepKey(t, pairKey, treatmentArm);
|
|
171
|
+
const repKeys = [.../* @__PURE__ */ new Set([...bByRep.keys(), ...tByRep.keys()])].sort();
|
|
172
|
+
let repIndex = 0;
|
|
173
|
+
for (const repKey of repKeys) {
|
|
174
|
+
const baseline = bByRep.get(repKey);
|
|
175
|
+
const treatment = tByRep.get(repKey);
|
|
176
|
+
if (baseline !== void 0 && treatment !== void 0) pairs.push({
|
|
177
|
+
pairKey,
|
|
178
|
+
repIndex: repIndex++,
|
|
179
|
+
baseline,
|
|
180
|
+
treatment
|
|
181
|
+
});
|
|
182
|
+
else if (baseline !== void 0) unpairedBaseline.push(baseline);
|
|
183
|
+
else if (treatment !== void 0) unpairedTreatment.push(treatment);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
pairs,
|
|
188
|
+
unpairedBaseline,
|
|
189
|
+
unpairedTreatment
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/** Index a multi-rep (pairKey, arm) group by `repKey`, enforcing that every
|
|
193
|
+
* row carries one and that no repKey repeats within the group. */
|
|
194
|
+
function indexByRepKey(group, pairKey, arm) {
|
|
195
|
+
const byRep = /* @__PURE__ */ new Map();
|
|
196
|
+
for (const row of group) {
|
|
197
|
+
if (row.repKey === void 0) throw new ValidationError(`pairArms: pairKey '${pairKey}' has multiple reps in an arm, but a row in arm '${arm}' is missing repKey — multi-rep items require an explicit repKey on every row so reps pair by identity (pairing reps by outcome or by index would bias the paired statistics)`);
|
|
198
|
+
if (byRep.has(row.repKey)) throw new ValidationError(`pairArms: duplicate repKey '${row.repKey}' for pairKey '${pairKey}' in arm '${arm}' — (pairKey, repKey) must uniquely identify a rep within an arm`);
|
|
199
|
+
byRep.set(row.repKey, row);
|
|
200
|
+
}
|
|
201
|
+
return byRep;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Full matched-pair arm comparison: pair via {@link pairArms}, then compose
|
|
205
|
+
* the paired estimators from `statistics` over the matched pairs.
|
|
206
|
+
*
|
|
207
|
+
* Correctness uses only the pairs where both sides carry `pass` (`mcnemar.n`
|
|
208
|
+
* is that subset's size); each metric uses only the pairs where both sides
|
|
209
|
+
* carry a finite value for it, with the remainder counted in `nMissing`.
|
|
210
|
+
* Deltas are treatment − baseline throughout. With an assignment roster, pairing
|
|
211
|
+
* covers declared seed identities; missing observations remain identity-only rows
|
|
212
|
+
* and never contribute fabricated outcomes or metrics. Per-arm summaries report
|
|
213
|
+
* every assignment and the explicitly formed subset separately.
|
|
214
|
+
*
|
|
215
|
+
* Fail-loud: inherits {@link pairArms}'s unknown-arm throw, and throws on a
|
|
216
|
+
* non-finite metric value — silently treating corrupt telemetry as "metric
|
|
217
|
+
* absent" would misreport it as missing coverage.
|
|
218
|
+
*/
|
|
219
|
+
function comparePairedArms(rows, opts) {
|
|
220
|
+
const populations = opts.assignments === void 0 ? void 0 : prepareArmPopulations(rows, opts.assignments, opts);
|
|
221
|
+
const { pairs, unpairedBaseline, unpairedTreatment } = pairArms(populations?.rows ?? rows, opts);
|
|
222
|
+
let correctness = null;
|
|
223
|
+
const baselinePass = [];
|
|
224
|
+
const treatmentPass = [];
|
|
225
|
+
for (const pair of pairs) {
|
|
226
|
+
if (pair.baseline.pass == null || pair.treatment.pass == null) continue;
|
|
227
|
+
baselinePass.push(pair.baseline.pass ? 1 : 0);
|
|
228
|
+
treatmentPass.push(pair.treatment.pass ? 1 : 0);
|
|
229
|
+
}
|
|
230
|
+
if (baselinePass.length > 0) {
|
|
231
|
+
const mc = mcnemar(baselinePass, treatmentPass);
|
|
232
|
+
correctness = {
|
|
233
|
+
b10: mc.b,
|
|
234
|
+
b01: mc.c,
|
|
235
|
+
mcnemar: mc,
|
|
236
|
+
riskDifference: pairedRiskDifference(baselinePass, treatmentPass)
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const metricDeltas = (opts.metricNames ?? [...new Set(pairs.flatMap((p) => [...Object.keys(p.baseline.metrics ?? {}), ...Object.keys(p.treatment.metrics ?? {})]))].sort()).map((name) => {
|
|
240
|
+
const before = [];
|
|
241
|
+
const after = [];
|
|
242
|
+
let nMissing = 0;
|
|
243
|
+
for (const pair of pairs) {
|
|
244
|
+
const b = metricValue(pair.baseline, name);
|
|
245
|
+
const t = metricValue(pair.treatment, name);
|
|
246
|
+
if (b === void 0 || t === void 0) {
|
|
247
|
+
nMissing++;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
before.push(b);
|
|
251
|
+
after.push(t);
|
|
252
|
+
}
|
|
253
|
+
const bootstrapCi = before.length === 0 ? null : pairedBootstrap(before, after, opts.bootstrap);
|
|
254
|
+
return {
|
|
255
|
+
name,
|
|
256
|
+
n: before.length,
|
|
257
|
+
nMissing,
|
|
258
|
+
medianDelta: bootstrapCi?.median ?? null,
|
|
259
|
+
meanDelta: bootstrapCi?.mean ?? null,
|
|
260
|
+
bootstrapCi,
|
|
261
|
+
wilcoxon: before.length === 0 ? null : wilcoxonSignedRank(before, after)
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
return {
|
|
265
|
+
...populations ? { armPopulations: populations.readings } : {},
|
|
266
|
+
nPairs: pairs.length,
|
|
267
|
+
nUnpairedBaseline: unpairedBaseline.length,
|
|
268
|
+
nUnpairedTreatment: unpairedTreatment.length,
|
|
269
|
+
correctness,
|
|
270
|
+
metricDeltas
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Pair two RunRecord arms by the identity of the evaluated work:
|
|
275
|
+
* `(experimentId, scenarioId, seed)`.
|
|
276
|
+
*
|
|
277
|
+
* Falling back to array order, candidate id, or experiment id can compare
|
|
278
|
+
* different tasks and fabricate lift. Duplicate identities throw.
|
|
279
|
+
*/
|
|
280
|
+
function pairRunRecords(baselineRuns, treatmentRuns) {
|
|
281
|
+
const baselineRows = runRecordArmRows(baselineRuns, "baseline");
|
|
282
|
+
const treatmentRows = runRecordArmRows(treatmentRuns, "treatment");
|
|
283
|
+
validateRunRecordArmRows(baselineRows, "baseline");
|
|
284
|
+
validateRunRecordArmRows(treatmentRows, "treatment");
|
|
285
|
+
if (baselineRows.length === 0 || treatmentRows.length === 0) return {
|
|
286
|
+
pairs: [],
|
|
287
|
+
unpairedBaseline: baselineRows.map((row) => row.run),
|
|
288
|
+
unpairedTreatment: treatmentRows.map((row) => row.run)
|
|
289
|
+
};
|
|
290
|
+
const result = pairArms([...baselineRows, ...treatmentRows], {
|
|
291
|
+
baselineArm: "baseline",
|
|
292
|
+
treatmentArm: "treatment"
|
|
293
|
+
});
|
|
294
|
+
return {
|
|
295
|
+
pairs: result.pairs.map((pair) => {
|
|
296
|
+
const baseline = pair.baseline;
|
|
297
|
+
const treatment = pair.treatment;
|
|
298
|
+
return {
|
|
299
|
+
pairKey: pair.pairKey,
|
|
300
|
+
repKey: baseline.repKey,
|
|
301
|
+
baseline: baseline.run,
|
|
302
|
+
treatment: treatment.run
|
|
303
|
+
};
|
|
304
|
+
}),
|
|
305
|
+
unpairedBaseline: result.unpairedBaseline.map((row) => row.run),
|
|
306
|
+
unpairedTreatment: result.unpairedTreatment.map((row) => row.run)
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function runRecordArmRows(runs, arm) {
|
|
310
|
+
return runs.map((run) => {
|
|
311
|
+
const scenarioId = run.scenarioId.trim();
|
|
312
|
+
if (!scenarioId) throw new ValidationError(`pairRunRecords: run '${run.runId}' is missing scenarioId; paired comparisons require explicit scenario identity`);
|
|
313
|
+
return {
|
|
314
|
+
pairKey: JSON.stringify([run.experimentId, scenarioId]),
|
|
315
|
+
repKey: String(run.seed),
|
|
316
|
+
arm,
|
|
317
|
+
run
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function validateRunRecordArmRows(rows, arm) {
|
|
322
|
+
const byPairKey = /* @__PURE__ */ new Map();
|
|
323
|
+
for (const row of rows) {
|
|
324
|
+
const group = byPairKey.get(row.pairKey) ?? [];
|
|
325
|
+
group.push(row);
|
|
326
|
+
byPairKey.set(row.pairKey, group);
|
|
327
|
+
}
|
|
328
|
+
for (const [pairKey, group] of byPairKey) if (group.length > 1) indexByRepKey(group, pairKey, arm);
|
|
329
|
+
}
|
|
330
|
+
function metricValue(row, name) {
|
|
331
|
+
const v = row.metrics?.[name];
|
|
332
|
+
if (v == null) return void 0;
|
|
333
|
+
if (!Number.isFinite(v)) throw new ValidationError(`comparePairedArms: non-finite value for metric '${name}' on pairKey '${row.pairKey}' (arm '${row.arm}'): ${v}`);
|
|
334
|
+
return v;
|
|
335
|
+
}
|
|
336
|
+
export { pairArms as n, pairRunRecords as r, comparePairedArms as t };
|
|
337
|
+
|
|
338
|
+
//# sourceMappingURL=paired-arms-Dep5tbsw.js.map
|