@tangle-network/agent-eval 1.0.11 → 1.0.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 +58 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-CoD1Dotf.d.ts → agent-profile-CPv4tENR.d.ts} +2 -2
- package/dist/{agent-profile-CoD1Dotf.d.ts.map → agent-profile-CPv4tENR.d.ts.map} +1 -1
- package/dist/{agreement-irr-w-t3XUTD.js → agreement-irr-DXcXEt4I.js} +20 -23
- package/dist/agreement-irr-DXcXEt4I.js.map +1 -0
- package/dist/analyst/index.d.ts +59 -13
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +144 -57
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-dGYmYNtb.js → analyze-runs-C7vWBDhl.js} +11 -11
- package/dist/{analyze-runs-dGYmYNtb.js.map → analyze-runs-C7vWBDhl.js.map} +1 -1
- package/dist/{analyze-runs-BYyMShsj.d.ts → analyze-runs-pJ4fhnYg.d.ts} +2 -2
- package/dist/{analyze-runs-BYyMShsj.d.ts.map → analyze-runs-pJ4fhnYg.d.ts.map} +1 -1
- package/dist/{benchmark-command-Did8Of2O.js → benchmark-command-BRRhjX2k.js} +12 -14
- package/dist/benchmark-command-BRRhjX2k.js.map +1 -0
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +5 -5
- package/dist/builder-eval/index.js +1 -1
- package/dist/{calibration-DLzckXnn.js → calibration-CbZPApIO.js} +2 -2
- package/dist/{calibration-DLzckXnn.js.map → calibration-CbZPApIO.js.map} +1 -1
- package/dist/campaign/index.d.ts +6 -6
- package/dist/campaign/index.js +12 -12
- package/dist/{campaign-VKtf8HRr.js → campaign-DzLlT0So.js} +17 -17
- package/dist/{campaign-VKtf8HRr.js.map → campaign-DzLlT0So.js.map} +1 -1
- package/dist/{campaign-evidence-BICB3a9Z.js → campaign-evidence-CcA7a67m.js} +3 -3
- package/dist/{campaign-evidence-BICB3a9Z.js.map → campaign-evidence-CcA7a67m.js.map} +1 -1
- package/dist/cli.js +16 -10
- package/dist/cli.js.map +1 -1
- package/dist/{cluster-bootstrap-hNXESoc1.js → cluster-bootstrap-BteuR1hg.js} +2 -2
- package/dist/{cluster-bootstrap-hNXESoc1.js.map → cluster-bootstrap-BteuR1hg.js.map} +1 -1
- package/dist/contract/index.d.ts +9 -9
- package/dist/contract/index.js +14 -14
- package/dist/{decision-point-CErE7GnP.js → decision-point-CNyoKOkz.js} +13 -7
- package/dist/{decision-point-CErE7GnP.js.map → decision-point-CNyoKOkz.js.map} +1 -1
- package/dist/{default-registry-DKlKVXMx.d.ts → default-registry-BNv7eB1C.d.ts} +10 -7
- package/dist/default-registry-BNv7eB1C.d.ts.map +1 -0
- package/dist/{default-registry-gmDeN0KT.js → default-registry-eCkZFfuF.js} +6 -6
- package/dist/default-registry-eCkZFfuF.js.map +1 -0
- package/dist/{define-agent-eval-DyzJ0wOo.js → define-agent-eval-CjF2nTA3.js} +8 -8
- package/dist/{define-agent-eval-DyzJ0wOo.js.map → define-agent-eval-CjF2nTA3.js.map} +1 -1
- package/dist/{define-agent-eval-B9zPWFSK.d.ts → define-agent-eval-DKVYlm-T.d.ts} +7 -7
- package/dist/{define-agent-eval-B9zPWFSK.d.ts.map → define-agent-eval-DKVYlm-T.d.ts.map} +1 -1
- package/dist/{descriptive-BTzLL-aj.js → descriptive-B3Eb7tX0.js} +2 -2
- package/dist/{descriptive-BTzLL-aj.js.map → descriptive-B3Eb7tX0.js.map} +1 -1
- package/dist/diagnosis/index.d.ts +2 -2
- package/dist/diagnosis/index.js +1 -1
- package/dist/{dspy-rlm-engine-Xt3znknf.js → dspy-rlm-engine-_MEe2jIO.js} +3 -3
- package/dist/{dspy-rlm-engine-Xt3znknf.js.map → dspy-rlm-engine-_MEe2jIO.js.map} +1 -1
- package/dist/{engine-CaHaCc3W.d.ts → engine-rfV8Ff8V.d.ts} +2 -2
- package/dist/{engine-CaHaCc3W.d.ts.map → engine-rfV8Ff8V.d.ts.map} +1 -1
- package/dist/{eval-campaign-B-dQl_lA.js → eval-campaign-CZSCjxVb.js} +3 -3
- package/dist/{eval-campaign-B-dQl_lA.js.map → eval-campaign-CZSCjxVb.js.map} +1 -1
- package/dist/{evaluation-B0-KVXaV.d.ts → evaluation-DYAIkPQB.d.ts} +4 -4
- package/dist/{evaluation-B0-KVXaV.d.ts.map → evaluation-DYAIkPQB.d.ts.map} +1 -1
- package/dist/evaluation.d.ts +1 -1
- package/dist/{exact-types-CIViGj98.d.ts → exact-types-CaLLU1Pz.d.ts} +2 -2
- package/dist/{exact-types-CIViGj98.d.ts.map → exact-types-CaLLU1Pz.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +1 -1
- package/dist/experiment/index.js +9 -9
- package/dist/{external-optimizer-process-BgitfZ-Q.js → external-optimizer-process-za-SsIap.js} +2 -2
- package/dist/{external-optimizer-process-BgitfZ-Q.js.map → external-optimizer-process-za-SsIap.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-CeHuAaMJ.js → external-optimizer-subprocess-B44kOfZb.js} +3 -3
- package/dist/external-optimizer-subprocess-B44kOfZb.js.map +1 -0
- package/dist/{feedback-trajectory-BgomnFOe.d.ts → feedback-trajectory-P37ju-gW.d.ts} +3 -3
- package/dist/{feedback-trajectory-BgomnFOe.d.ts.map → feedback-trajectory-P37ju-gW.d.ts.map} +1 -1
- package/dist/{finding-composition-DlvE1Qul.js → finding-composition-Belh_qU3.js} +12 -3
- package/dist/finding-composition-Belh_qU3.js.map +1 -0
- package/dist/{findings-store-Bp-0Guuv.js → findings-store-DWiBvJVM.js} +22 -5
- package/dist/findings-store-DWiBvJVM.js.map +1 -0
- package/dist/fuzz.js +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/{index-BwutH5i7.d.ts → index-BJM4rwP2.d.ts} +6 -6
- package/dist/{index-BwutH5i7.d.ts.map → index-BJM4rwP2.d.ts.map} +1 -1
- package/dist/{index-DAk2quYu.d.ts → index-C3t17kHu.d.ts} +16 -21
- package/dist/index-C3t17kHu.d.ts.map +1 -0
- package/dist/{index-Bn-P_XAl.d.ts → index-Dt6E4BHX.d.ts} +6 -6
- package/dist/{index-Bn-P_XAl.d.ts.map → index-Dt6E4BHX.d.ts.map} +1 -1
- package/dist/{index-ByJ20lyu.d.ts → index-chNyKroE.d.ts} +8 -8
- package/dist/{index-ByJ20lyu.d.ts.map → index-chNyKroE.d.ts.map} +1 -1
- package/dist/{index-CtcCSO1Y.d.ts → index-f09MX_H_.d.ts} +2 -2
- package/dist/{index-CtcCSO1Y.d.ts.map → index-f09MX_H_.d.ts.map} +1 -1
- package/dist/index.d.ts +52 -146
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -193
- package/dist/index.js.map +1 -1
- package/dist/{integrity-B1V6klyO.js → integrity-Vx5xgn3s.js} +2 -2
- package/dist/{integrity-B1V6klyO.js.map → integrity-Vx5xgn3s.js.map} +1 -1
- package/dist/{judge-calibration-D93UCm1k.js → judge-calibration-DKR6Xi-w.js} +13 -36
- package/dist/judge-calibration-DKR6Xi-w.js.map +1 -0
- package/dist/judge-calibration-DnrbQaXI.d.ts.map +1 -1
- package/dist/{judge-gate-DMlX38B7.js → judge-gate-CIlBrn6q.js} +2 -2
- package/dist/{judge-gate-DMlX38B7.js.map → judge-gate-CIlBrn6q.js.map} +1 -1
- package/dist/{kind-factory-VKysp1ds.js → kind-factory-Cfz8DUCc.js} +2 -2
- package/dist/{kind-factory-VKysp1ds.js.map → kind-factory-Cfz8DUCc.js.map} +1 -1
- package/dist/{llm-judge-CyDyqb6V.js → llm-judge-CHLvjbVR.js} +14 -14
- package/dist/{llm-judge-CyDyqb6V.js.map → llm-judge-CHLvjbVR.js.map} +1 -1
- package/dist/{matrix-4DcRFJ7Q.d.ts → matrix-Cy3oy7Rq.d.ts} +2 -2
- package/dist/{matrix-4DcRFJ7Q.d.ts.map → matrix-Cy3oy7Rq.d.ts.map} +1 -1
- package/dist/{mean-DDFhslBt.js → mean-D1d6gedE.js} +28 -2
- package/dist/{mean-DDFhslBt.js.map → mean-D1d6gedE.js.map} +1 -1
- package/dist/meta-eval/index.d.ts +1 -1
- package/dist/meta-eval/index.js +6 -6
- package/dist/{mint-D9ZysYtY.js → mint-BH_3Ak2x.js} +3 -3
- package/dist/{mint-D9ZysYtY.js.map → mint-BH_3Ak2x.js.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{outcome-observations-ahbNtxuP.js → outcome-observations-DZu5hLYF.js} +3 -3
- package/dist/{outcome-observations-ahbNtxuP.js.map → outcome-observations-DZu5hLYF.js.map} +1 -1
- package/dist/{paired-arms-C0Vd9bGG.js → paired-arms-3-tsXvvC.js} +5 -5
- package/dist/{paired-arms-C0Vd9bGG.js.map → paired-arms-3-tsXvvC.js.map} +1 -1
- package/dist/{paired-binary-B477lksS.js → paired-binary-CMzmSSd5.js} +2 -2
- package/dist/{paired-binary-B477lksS.js.map → paired-binary-CMzmSSd5.js.map} +1 -1
- package/dist/{paired-promotion-decision-5Pl_qJLX.js → paired-promotion-decision-CiueaTTj.js} +3 -3
- package/dist/{paired-promotion-decision-5Pl_qJLX.js.map → paired-promotion-decision-CiueaTTj.js.map} +1 -1
- package/dist/{paired-tests-kASEKpc-.js → paired-tests-Buh6feJ4.js} +2 -2
- package/dist/{paired-tests-kASEKpc-.js.map → paired-tests-Buh6feJ4.js.map} +1 -1
- package/dist/{pareto-DY_x3HHg.js → pareto-B34N-vnn.js} +7 -7
- package/dist/{pareto-DY_x3HHg.js.map → pareto-B34N-vnn.js.map} +1 -1
- package/dist/pipelines/index.js +1 -1
- package/dist/{power-and-mde-CRxepy8y.js → power-and-mde-g3vOn0XK.js} +3 -3
- package/dist/{power-and-mde-CRxepy8y.js.map → power-and-mde-g3vOn0XK.js.map} +1 -1
- package/dist/{prime-protocol-COFkxas6.d.ts → prime-protocol-DKRk4l4U.d.ts} +2 -2
- package/dist/{prime-protocol-COFkxas6.d.ts.map → prime-protocol-DKRk4l4U.d.ts.map} +1 -1
- package/dist/{promotion-policy-f79oklG_.js → promotion-policy-DLPcEnCf.js} +4 -4
- package/dist/{promotion-policy-f79oklG_.js.map → promotion-policy-DLPcEnCf.js.map} +1 -1
- package/dist/{proposal-findings-BclX0PFh.js → proposal-findings-CZJkS_GY.js} +2 -2
- package/dist/{proposal-findings-BclX0PFh.js.map → proposal-findings-CZJkS_GY.js.map} +1 -1
- package/dist/{registry-CMtGAxOw.d.ts → registry-Ck7w-rr5.d.ts} +3 -3
- package/dist/{registry-CMtGAxOw.d.ts.map → registry-Ck7w-rr5.d.ts.map} +1 -1
- package/dist/{release-confidence--1iP-d3x.js → release-confidence-nfQNh3eb.js} +4 -4
- package/dist/{release-confidence--1iP-d3x.js.map → release-confidence-nfQNh3eb.js.map} +1 -1
- package/dist/{render-CFrJ7M0o.js → render-BVPfP7dc.js} +52 -36
- package/dist/{render-CFrJ7M0o.js.map → render-BVPfP7dc.js.map} +1 -1
- package/dist/reporting.js +5 -5
- package/dist/{reward-P0VD_Aft.js → reward-DqMfaEax.js} +10 -2
- package/dist/{reward-P0VD_Aft.js.map → reward-DqMfaEax.js.map} +1 -1
- package/dist/{reward-hacking-D-Vi9-fE.js → reward-hacking-B88f-Kh7.js} +4 -4
- package/dist/{reward-hacking-D-Vi9-fE.js.map → reward-hacking-B88f-Kh7.js.map} +1 -1
- package/dist/rl.d.ts +3 -3
- package/dist/rl.js +12 -12
- package/dist/rollout/index.d.ts +2 -2
- package/dist/rollout/index.js +3 -3
- package/dist/{rollout-BC4u-d_I.js → rollout-CbOGxuHl.js} +2 -2
- package/dist/{rollout-BC4u-d_I.js.map → rollout-CbOGxuHl.js.map} +1 -1
- package/dist/{rollout-nodes-BHR9Q5jP.js → rollout-nodes-DKZ3vAYY.js} +2 -2
- package/dist/{rollout-nodes-BHR9Q5jP.js.map → rollout-nodes-DKZ3vAYY.js.map} +1 -1
- package/dist/{rubric-predictive-validity-BdxXDN6h.js → rubric-predictive-validity-D_6ZPTNR.js} +2 -2
- package/dist/{rubric-predictive-validity-BdxXDN6h.js.map → rubric-predictive-validity-D_6ZPTNR.js.map} +1 -1
- package/dist/{run-record-B-G2Tu11.js → run-record-CbUi2adH.js} +3 -3
- package/dist/{run-record-B-G2Tu11.js.map → run-record-CbUi2adH.js.map} +1 -1
- package/dist/{run-record-DEjx43cI.js → run-record-CpLS4Uid.js} +2 -2
- package/dist/{run-record-DEjx43cI.js.map → run-record-CpLS4Uid.js.map} +1 -1
- package/dist/search/index.d.ts +2 -2
- package/dist/search/index.js +2 -2
- package/dist/{search-kernel-BjR2Sr7w.d.ts → search-kernel-kwO-sgCq.d.ts} +2 -2
- package/dist/{search-kernel-BjR2Sr7w.d.ts.map → search-kernel-kwO-sgCq.d.ts.map} +1 -1
- package/dist/{search-ledger-BsVi-Ngv.js → search-ledger-CV_bQQed.js} +2 -2
- package/dist/{search-ledger-BsVi-Ngv.js.map → search-ledger-CV_bQQed.js.map} +1 -1
- package/dist/{search-shipper-pdg4viK7.js → search-shipper-CA3ooBbC.js} +2 -2
- package/dist/{search-shipper-pdg4viK7.js.map → search-shipper-CA3ooBbC.js.map} +1 -1
- package/dist/{search-summary-DedyTdiM.js → search-summary-DBMjdecs.js} +4 -4
- package/dist/{search-summary-DedyTdiM.js.map → search-summary-DBMjdecs.js.map} +1 -1
- package/dist/{sequential-Zp1tsxqI.js → sequential-BPbvgzfe.js} +2 -2
- package/dist/{sequential-Zp1tsxqI.js.map → sequential-BPbvgzfe.js.map} +1 -1
- package/dist/{skillopt-optimization-method-O35aMdxU.js → skillopt-optimization-method-D72XZZfR.js} +9 -9
- package/dist/{skillopt-optimization-method-O35aMdxU.js.map → skillopt-optimization-method-D72XZZfR.js.map} +1 -1
- package/dist/{statistical-heldout-DYF5f10K.js → statistical-heldout-NBxC7jGo.js} +3 -3
- package/dist/{statistical-heldout-DYF5f10K.js.map → statistical-heldout-NBxC7jGo.js.map} +1 -1
- package/dist/{statistical-heldout-bU7FBNjR.d.ts → statistical-heldout-_dXihc9T.d.ts} +3 -3
- package/dist/{statistical-heldout-bU7FBNjR.d.ts.map → statistical-heldout-_dXihc9T.d.ts.map} +1 -1
- package/dist/{store-otlp-DmLm65XW.js → store-otlp-BfPRa2p8.js} +2 -2
- package/dist/{store-otlp-DmLm65XW.js.map → store-otlp-BfPRa2p8.js.map} +1 -1
- package/dist/{store-tool-spans-lWf6INTH.d.ts → store-tool-spans-BgwVHXma.d.ts} +4 -4
- package/dist/{store-tool-spans-lWf6INTH.d.ts.map → store-tool-spans-BgwVHXma.d.ts.map} +1 -1
- package/dist/{store-tool-spans-GGaCijFy.js → store-tool-spans-BrSWHB9O.js} +3 -3
- package/dist/{store-tool-spans-GGaCijFy.js.map → store-tool-spans-BrSWHB9O.js.map} +1 -1
- package/dist/{summary-report-B4BLQb88.js → summary-report-C3IJvp0i.js} +7 -7
- package/dist/{summary-report-B4BLQb88.js.map → summary-report-C3IJvp0i.js.map} +1 -1
- package/dist/supervisor-run/index.d.ts +6 -0
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +3 -3
- package/dist/{systemone-BDVgb6XV.d.ts → systemone-CBvL1gx-.d.ts} +14 -8
- package/dist/systemone-CBvL1gx-.d.ts.map +1 -0
- package/dist/{systemone-review-S49gsy_y.js → systemone-review-BusEIzsg.js} +2 -2
- package/dist/{systemone-review-S49gsy_y.js.map → systemone-review-BusEIzsg.js.map} +1 -1
- package/dist/{systemone-review-BLgxt-4Q.d.ts → systemone-review-nbuMxxmi.d.ts} +2 -2
- package/dist/{systemone-review-BLgxt-4Q.d.ts.map → systemone-review-nbuMxxmi.d.ts.map} +1 -1
- package/dist/systemone.d.ts +4 -4
- package/dist/systemone.js +3 -3
- package/dist/{tool-groups-C3K-d3gd.d.ts → tool-groups-BQsjZD9F.d.ts} +3 -3
- package/dist/tool-groups-BQsjZD9F.d.ts.map +1 -0
- package/dist/{tool-waste-CRJqOASv.js → tool-waste-Czt3aWID.js} +3 -3
- package/dist/{tool-waste-CRJqOASv.js.map → tool-waste-Czt3aWID.js.map} +1 -1
- package/dist/{trace-questions-ej5AEJ5X.d.ts → trace-questions-CpTrtEcm.d.ts} +3 -3
- package/dist/{trace-questions-ej5AEJ5X.d.ts.map → trace-questions-CpTrtEcm.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +1 -1
- package/dist/trace-repair/index.js +2 -2
- package/dist/traces.d.ts +3 -3
- package/dist/traces.js +4 -4
- package/dist/{tree-C2N31CoI.js → tree-DPwgM2LX.js} +6 -6
- package/dist/{tree-C2N31CoI.js.map → tree-DPwgM2LX.js.map} +1 -1
- package/dist/{types-DzCO-S1m.d.ts → types-B9s9Xo5_.d.ts} +24 -2
- package/dist/types-B9s9Xo5_.d.ts.map +1 -0
- package/dist/{types-BF-xQGQn.d.ts → types-CBkDo7ja.d.ts} +2 -2
- package/dist/{types-BF-xQGQn.d.ts.map → types-CBkDo7ja.d.ts.map} +1 -1
- package/dist/{types-BK0blWhe.js → types-CL1_N7AZ.js} +2 -2
- package/dist/{types-BK0blWhe.js.map → types-CL1_N7AZ.js.map} +1 -1
- package/dist/{types-yofaDmQa.d.ts → types-D91tnhzf.d.ts} +2 -2
- package/dist/{types-yofaDmQa.d.ts.map → types-D91tnhzf.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +3 -3
- package/docs/behavioral-trace-questions.md +23 -0
- package/docs/public-api.md +1 -1
- package/package.json +2 -2
- package/dist/agreement-irr-w-t3XUTD.js.map +0 -1
- package/dist/benchmark-command-Did8Of2O.js.map +0 -1
- package/dist/default-registry-DKlKVXMx.d.ts.map +0 -1
- package/dist/default-registry-gmDeN0KT.js.map +0 -1
- package/dist/external-optimizer-subprocess-CeHuAaMJ.js.map +0 -1
- package/dist/finding-composition-DlvE1Qul.js.map +0 -1
- package/dist/findings-store-Bp-0Guuv.js.map +0 -1
- package/dist/index-DAk2quYu.d.ts.map +0 -1
- package/dist/judge-calibration-D93UCm1k.js.map +0 -1
- package/dist/systemone-BDVgb6XV.d.ts.map +0 -1
- package/dist/tool-groups-C3K-d3gd.d.ts.map +0 -1
- package/dist/types-DzCO-S1m.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rubric-predictive-validity-BdxXDN6h.js","names":[],"sources":["../src/meta-eval/rubric-predictive-validity.ts"],"sourcesContent":["/**\n * Join rubric scores to deployment outcomes and measure their association.\n * Higher rubric scores always mean better evaluated behavior.\n * Outcome directions are explicit because success rate and failure rate have opposite meanings.\n * These descriptive associations neither establish causation nor validate a change to rubric weights.\n */\n\nimport type { RunRecord } from '../run-record'\nimport {\n assertUniqueObservationIds,\n type CorrelationInterval,\n correlationSummary,\n hasVariation,\n reduceOutcomeMetric,\n validateObservationOptions,\n validateOutcomeMetricSpecifications,\n} from './outcome-observations'\nimport type { DeploymentOutcome, OutcomeStore } from './outcome-store'\n\nexport interface OutcomeMetricSpec {\n /** Exact key in DeploymentOutcome.metrics. */\n id: string\n direction: 'higher-is-better' | 'lower-is-better'\n}\n\nexport interface RubricPredictiveValidityInput {\n /** One record per independent run; rubric scores come from outcome.raw. */\n runs: RunRecord[]\n outcomes: OutcomeStore\n /** Declare desired directions before inspecting associations. */\n outcomeMetrics: readonly OutcomeMetricSpec[]\n /** Higher is better for each rubric. Omit to discover finite numeric outcome.raw keys. */\n rubrics?: readonly string[]\n /** Minimum joined runs for an estimate; an integer at least 3. Default 8. */\n minSamples?: number\n /** Bootstrap resamples for both correlation intervals. Default 500. */\n bootstrapResamples?: number\n /** Omit to derive a reproducible seed from the paired observations. */\n seed?: number\n /** Reduce finite observations of each named outcome within a run. Default latest. */\n reduction?: 'latest' | 'mean' | 'max'\n}\n\nexport interface RubricOutcomePair {\n rubric: string\n outcome: string\n outcomeDirection: OutcomeMetricSpec['direction']\n n: number\n /** Raw association with the recorded outcome, before direction alignment. */\n pearson: number\n spearman: number\n pearsonCi95: CorrelationInterval | null\n spearmanCi95: CorrelationInterval | null\n /** Positive values associate higher rubric scores with better outcomes. */\n alignedPearson: number\n alignedSpearman: number\n alignedSpearmanCi95: CorrelationInterval | null\n /** Descriptive buckets at aligned Spearman +/-0.4; no causal or release authority. */\n verdict: 'aligned' | 'inverse' | 'weak'\n}\n\nexport interface RubricRanking extends Omit<RubricOutcomePair, 'outcome'> {\n /** Outcome with the greatest direction-aligned Spearman for this rubric. */\n bestOutcome: string\n}\n\nexport interface RubricOutcomeExclusion {\n rubric: string\n outcome: string\n outcomeDirection: OutcomeMetricSpec['direction']\n /** Finite joined observations, including measured zeros. */\n n: number\n reason: 'insufficient_samples' | 'constant_rubric' | 'constant_outcome'\n}\n\nexport interface RubricPredictiveValidityReport {\n outcomeMetrics: OutcomeMetricSpec[]\n pairs: RubricOutcomePair[]\n /** All declared pairs lacking an estimate, with their usable observation count. */\n excludedPairs: RubricOutcomeExclusion[]\n /** Exploratory ordering by aligned Spearman; never use outcome selection as confirmatory evidence. */\n ranked: RubricRanking[]\n /** Runs contributing at least one finite pair, including pairs below minSamples. */\n joinedSamples: number\n /** Runs contributing no finite pair; joinedSamples + skippedRuns equals the input run count. */\n skippedRuns: number\n /** Declared rubrics with no finite score, distinct from too few outcomes or constant observations. */\n rubricsWithoutData: string[]\n}\n\nexport async function rubricPredictiveValidity(\n input: RubricPredictiveValidityInput,\n): Promise<RubricPredictiveValidityReport> {\n const minSamples = input.minSamples ?? 8\n const reduction = input.reduction ?? 'latest'\n const resamples = input.bootstrapResamples ?? 500\n const seed = input.seed\n if (!Number.isSafeInteger(minSamples) || minSamples < 3) {\n throw new Error('minSamples must be a safe integer at least 3')\n }\n validateObservationOptions(reduction, resamples, seed)\n validateOutcomeMetricSpecifications(input.outcomeMetrics)\n assertUniqueObservationIds(\n input.runs.map((run) => run.runId),\n 'runId',\n )\n\n const outcomeMetrics = input.outcomeMetrics.map((metric) => ({ ...metric }))\n const runs = input.runs.map((run) => ({ runId: run.runId, scores: { ...run.outcome.raw } }))\n const declaredRubrics = input.rubrics === undefined ? undefined : [...input.rubrics]\n if (declaredRubrics !== undefined) assertUniqueObservationIds(declaredRubrics, 'rubric')\n\n const outcomes = await input.outcomes.list()\n const outcomesByRun = new Map<string, DeploymentOutcome[]>()\n for (const outcome of outcomes) {\n const rows = outcomesByRun.get(outcome.runId) ?? []\n rows.push(outcome)\n outcomesByRun.set(outcome.runId, rows)\n }\n\n const observedRubrics = new Set<string>()\n for (const run of runs) {\n for (const [rubric, value] of Object.entries(run.scores)) {\n if (typeof value === 'number' && Number.isFinite(value)) observedRubrics.add(rubric)\n }\n }\n const rubrics = declaredRubrics ?? [...observedRubrics]\n const buckets = rubrics.flatMap((rubric) =>\n outcomeMetrics.map((outcome) => ({\n rubric,\n outcome,\n xs: [] as number[],\n ys: [] as number[],\n })),\n )\n\n let joined = 0\n for (const run of runs) {\n const rows = outcomesByRun.get(run.runId) ?? []\n let joinedThisRun = false\n for (const bucket of buckets) {\n const x = run.scores[bucket.rubric]\n if (typeof x !== 'number' || !Number.isFinite(x)) continue\n const y = reduceOutcomeMetric(rows, bucket.outcome.id, reduction)\n if (y === null) continue\n bucket.xs.push(x)\n bucket.ys.push(y)\n joinedThisRun = true\n }\n if (joinedThisRun) joined++\n }\n\n const pairs: RubricOutcomePair[] = []\n const excludedPairs: RubricOutcomeExclusion[] = []\n for (const bucket of buckets) {\n const identity = {\n rubric: bucket.rubric,\n outcome: bucket.outcome.id,\n outcomeDirection: bucket.outcome.direction,\n n: bucket.xs.length,\n }\n const reason =\n bucket.xs.length < minSamples\n ? 'insufficient_samples'\n : !hasVariation(bucket.xs)\n ? 'constant_rubric'\n : !hasVariation(bucket.ys)\n ? 'constant_outcome'\n : null\n if (reason !== null) {\n excludedPairs.push({ ...identity, reason })\n continue\n }\n const summary = correlationSummary(bucket.xs, bucket.ys, resamples, seed)\n const sign = bucket.outcome.direction === 'higher-is-better' ? 1 : -1\n const alignedSpearman = summary.spearman * sign\n const alignedSpearmanCi95 =\n summary.spearmanCi95 === null\n ? null\n : sign === 1\n ? summary.spearmanCi95\n : { lower: -summary.spearmanCi95.upper, upper: -summary.spearmanCi95.lower }\n pairs.push({\n ...identity,\n ...summary,\n alignedPearson: summary.pearson * sign,\n alignedSpearman,\n alignedSpearmanCi95,\n verdict: alignedSpearman >= 0.4 ? 'aligned' : alignedSpearman <= -0.4 ? 'inverse' : 'weak',\n })\n }\n\n const bestByRubric = new Map<string, RubricOutcomePair>()\n for (const pair of pairs) {\n const best = bestByRubric.get(pair.rubric)\n if (!best || pair.alignedSpearman > best.alignedSpearman) bestByRubric.set(pair.rubric, pair)\n }\n const ranked = [...bestByRubric.values()]\n .map(({ outcome, ...pair }) => ({ ...pair, bestOutcome: outcome }))\n .sort((a, b) => b.alignedSpearman - a.alignedSpearman)\n\n return {\n outcomeMetrics,\n pairs,\n excludedPairs,\n ranked,\n joinedSamples: joined,\n skippedRuns: runs.length - joined,\n rubricsWithoutData: rubrics.filter((rubric) => !observedRubrics.has(rubric)),\n }\n}\n"],"mappings":";;AA0FA,eAAsB,yBACpB,OACyC;CACzC,MAAM,aAAa,MAAM,cAAc;CACvC,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,YAAY,MAAM,sBAAsB;CAC9C,MAAM,OAAO,MAAM;CACnB,IAAI,CAAC,OAAO,cAAc,UAAU,KAAK,aAAa,GACpD,MAAM,IAAI,MAAM,8CAA8C;CAEhE,2BAA2B,WAAW,WAAW,IAAI;CACrD,oCAAoC,MAAM,cAAc;CACxD,2BACE,MAAM,KAAK,KAAK,QAAQ,IAAI,KAAK,GACjC,OACF;CAEA,MAAM,iBAAiB,MAAM,eAAe,KAAK,YAAY,EAAE,GAAG,OAAO,EAAE;CAC3E,MAAM,OAAO,MAAM,KAAK,KAAK,SAAS;EAAE,OAAO,IAAI;EAAO,QAAQ,EAAE,GAAG,IAAI,QAAQ,IAAI;CAAE,EAAE;CAC3F,MAAM,kBAAkB,MA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I,MAAM,CAAC;CAC7E;AACF"}
|
|
1
|
+
{"version":3,"file":"rubric-predictive-validity-D_6ZPTNR.js","names":[],"sources":["../src/meta-eval/rubric-predictive-validity.ts"],"sourcesContent":["/**\n * Join rubric scores to deployment outcomes and measure their association.\n * Higher rubric scores always mean better evaluated behavior.\n * Outcome directions are explicit because success rate and failure rate have opposite meanings.\n * These descriptive associations neither establish causation nor validate a change to rubric weights.\n */\n\nimport type { RunRecord } from '../run-record'\nimport {\n assertUniqueObservationIds,\n type CorrelationInterval,\n correlationSummary,\n hasVariation,\n reduceOutcomeMetric,\n validateObservationOptions,\n validateOutcomeMetricSpecifications,\n} from './outcome-observations'\nimport type { DeploymentOutcome, OutcomeStore } from './outcome-store'\n\nexport interface OutcomeMetricSpec {\n /** Exact key in DeploymentOutcome.metrics. */\n id: string\n direction: 'higher-is-better' | 'lower-is-better'\n}\n\nexport interface RubricPredictiveValidityInput {\n /** One record per independent run; rubric scores come from outcome.raw. */\n runs: RunRecord[]\n outcomes: OutcomeStore\n /** Declare desired directions before inspecting associations. */\n outcomeMetrics: readonly OutcomeMetricSpec[]\n /** Higher is better for each rubric. Omit to discover finite numeric outcome.raw keys. */\n rubrics?: readonly string[]\n /** Minimum joined runs for an estimate; an integer at least 3. Default 8. */\n minSamples?: number\n /** Bootstrap resamples for both correlation intervals. Default 500. */\n bootstrapResamples?: number\n /** Omit to derive a reproducible seed from the paired observations. */\n seed?: number\n /** Reduce finite observations of each named outcome within a run. Default latest. */\n reduction?: 'latest' | 'mean' | 'max'\n}\n\nexport interface RubricOutcomePair {\n rubric: string\n outcome: string\n outcomeDirection: OutcomeMetricSpec['direction']\n n: number\n /** Raw association with the recorded outcome, before direction alignment. */\n pearson: number\n spearman: number\n pearsonCi95: CorrelationInterval | null\n spearmanCi95: CorrelationInterval | null\n /** Positive values associate higher rubric scores with better outcomes. */\n alignedPearson: number\n alignedSpearman: number\n alignedSpearmanCi95: CorrelationInterval | null\n /** Descriptive buckets at aligned Spearman +/-0.4; no causal or release authority. */\n verdict: 'aligned' | 'inverse' | 'weak'\n}\n\nexport interface RubricRanking extends Omit<RubricOutcomePair, 'outcome'> {\n /** Outcome with the greatest direction-aligned Spearman for this rubric. */\n bestOutcome: string\n}\n\nexport interface RubricOutcomeExclusion {\n rubric: string\n outcome: string\n outcomeDirection: OutcomeMetricSpec['direction']\n /** Finite joined observations, including measured zeros. */\n n: number\n reason: 'insufficient_samples' | 'constant_rubric' | 'constant_outcome'\n}\n\nexport interface RubricPredictiveValidityReport {\n outcomeMetrics: OutcomeMetricSpec[]\n pairs: RubricOutcomePair[]\n /** All declared pairs lacking an estimate, with their usable observation count. */\n excludedPairs: RubricOutcomeExclusion[]\n /** Exploratory ordering by aligned Spearman; never use outcome selection as confirmatory evidence. */\n ranked: RubricRanking[]\n /** Runs contributing at least one finite pair, including pairs below minSamples. */\n joinedSamples: number\n /** Runs contributing no finite pair; joinedSamples + skippedRuns equals the input run count. */\n skippedRuns: number\n /** Declared rubrics with no finite score, distinct from too few outcomes or constant observations. */\n rubricsWithoutData: string[]\n}\n\nexport async function rubricPredictiveValidity(\n input: RubricPredictiveValidityInput,\n): Promise<RubricPredictiveValidityReport> {\n const minSamples = input.minSamples ?? 8\n const reduction = input.reduction ?? 'latest'\n const resamples = input.bootstrapResamples ?? 500\n const seed = input.seed\n if (!Number.isSafeInteger(minSamples) || minSamples < 3) {\n throw new Error('minSamples must be a safe integer at least 3')\n }\n validateObservationOptions(reduction, resamples, seed)\n validateOutcomeMetricSpecifications(input.outcomeMetrics)\n assertUniqueObservationIds(\n input.runs.map((run) => run.runId),\n 'runId',\n )\n\n const outcomeMetrics = input.outcomeMetrics.map((metric) => ({ ...metric }))\n const runs = input.runs.map((run) => ({ runId: run.runId, scores: { ...run.outcome.raw } }))\n const declaredRubrics = input.rubrics === undefined ? undefined : [...input.rubrics]\n if (declaredRubrics !== undefined) assertUniqueObservationIds(declaredRubrics, 'rubric')\n\n const outcomes = await input.outcomes.list()\n const outcomesByRun = new Map<string, DeploymentOutcome[]>()\n for (const outcome of outcomes) {\n const rows = outcomesByRun.get(outcome.runId) ?? []\n rows.push(outcome)\n outcomesByRun.set(outcome.runId, rows)\n }\n\n const observedRubrics = new Set<string>()\n for (const run of runs) {\n for (const [rubric, value] of Object.entries(run.scores)) {\n if (typeof value === 'number' && Number.isFinite(value)) observedRubrics.add(rubric)\n }\n }\n const rubrics = declaredRubrics ?? [...observedRubrics]\n const buckets = rubrics.flatMap((rubric) =>\n outcomeMetrics.map((outcome) => ({\n rubric,\n outcome,\n xs: [] as number[],\n ys: [] as number[],\n })),\n )\n\n let joined = 0\n for (const run of runs) {\n const rows = outcomesByRun.get(run.runId) ?? []\n let joinedThisRun = false\n for (const bucket of buckets) {\n const x = run.scores[bucket.rubric]\n if (typeof x !== 'number' || !Number.isFinite(x)) continue\n const y = reduceOutcomeMetric(rows, bucket.outcome.id, reduction)\n if (y === null) continue\n bucket.xs.push(x)\n bucket.ys.push(y)\n joinedThisRun = true\n }\n if (joinedThisRun) joined++\n }\n\n const pairs: RubricOutcomePair[] = []\n const excludedPairs: RubricOutcomeExclusion[] = []\n for (const bucket of buckets) {\n const identity = {\n rubric: bucket.rubric,\n outcome: bucket.outcome.id,\n outcomeDirection: bucket.outcome.direction,\n n: bucket.xs.length,\n }\n const reason =\n bucket.xs.length < minSamples\n ? 'insufficient_samples'\n : !hasVariation(bucket.xs)\n ? 'constant_rubric'\n : !hasVariation(bucket.ys)\n ? 'constant_outcome'\n : null\n if (reason !== null) {\n excludedPairs.push({ ...identity, reason })\n continue\n }\n const summary = correlationSummary(bucket.xs, bucket.ys, resamples, seed)\n const sign = bucket.outcome.direction === 'higher-is-better' ? 1 : -1\n const alignedSpearman = summary.spearman * sign\n const alignedSpearmanCi95 =\n summary.spearmanCi95 === null\n ? null\n : sign === 1\n ? summary.spearmanCi95\n : { lower: -summary.spearmanCi95.upper, upper: -summary.spearmanCi95.lower }\n pairs.push({\n ...identity,\n ...summary,\n alignedPearson: summary.pearson * sign,\n alignedSpearman,\n alignedSpearmanCi95,\n verdict: alignedSpearman >= 0.4 ? 'aligned' : alignedSpearman <= -0.4 ? 'inverse' : 'weak',\n })\n }\n\n const bestByRubric = new Map<string, RubricOutcomePair>()\n for (const pair of pairs) {\n const best = bestByRubric.get(pair.rubric)\n if (!best || pair.alignedSpearman > best.alignedSpearman) bestByRubric.set(pair.rubric, pair)\n }\n const ranked = [...bestByRubric.values()]\n .map(({ outcome, ...pair }) => ({ ...pair, bestOutcome: outcome }))\n .sort((a, b) => b.alignedSpearman - a.alignedSpearman)\n\n return {\n outcomeMetrics,\n pairs,\n excludedPairs,\n ranked,\n joinedSamples: joined,\n skippedRuns: runs.length - joined,\n rubricsWithoutData: rubrics.filter((rubric) => !observedRubrics.has(rubric)),\n }\n}\n"],"mappings":";;AA0FA,eAAsB,yBACpB,OACyC;CACzC,MAAM,aAAa,MAAM,cAAc;CACvC,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,YAAY,MAAM,sBAAsB;CAC9C,MAAM,OAAO,MAAM;CACnB,IAAI,CAAC,OAAO,cAAc,UAAU,KAAK,aAAa,GACpD,MAAM,IAAI,MAAM,8CAA8C;CAEhE,2BAA2B,WAAW,WAAW,IAAI;CACrD,oCAAoC,MAAM,cAAc;CACxD,2BACE,MAAM,KAAK,KAAK,QAAQ,IAAI,KAAK,GACjC,OACF;CAEA,MAAM,iBAAiB,MAAM,eAAe,KAAK,YAAY,EAAE,GAAG,OAAO,EAAE;CAC3E,MAAM,OAAO,MAAM,KAAK,KAAK,SAAS;EAAE,OAAO,IAAI;EAAO,QAAQ,EAAE,GAAG,IAAI,QAAQ,IAAI;CAAE,EAAE;CAC3F,MAAM,kBAAkB,MAAM,YAAY,KAAA,IAAY,KAAA,IAAY,CAAC,GAAG,MAAM,OAAO;CACnF,IAAI,oBAAoB,KAAA,GAAW,2BAA2B,iBAAiB,QAAQ;CAEvF,MAAM,WAAW,MAAM,MAAM,SAAS,KAAK;CAC3C,MAAM,g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O,EAAE,IACrB,oBACA,CAAC,aAAa,OAAO,EAAE,IACrB,qBACA;EACV,IAAI,WAAW,MAAM;GACnB,cAAc,KAAK;IAAE,GAAG;IAAU;GAAO,CAAC;GAC1C;EACF;EACA,MAAM,UAAU,mBAAmB,OAAO,IAAI,OAAO,IAAI,WAAW,IAAI;EACxE,MAAM,OAAO,OAAO,QAAQ,cAAc,qBAAqB,IAAI;EACnE,MAAM,kBAAkB,QAAQ,WAAW;EAC3C,MAAM,sBACJ,QAAQ,iBAAiB,OACrB,OACA,SAAS,IACP,QAAQ,eACR;GAAE,OAAO,CAAC,QAAQ,aAAa;GAAO,OAAO,CAAC,QAAQ,aAAa;EAAM;EACjF,MAAM,KAAK;GACT,GAAG;GACH,GAAG;GACH,gBAAgB,QAAQ,UAAU;GAClC;GACA;GACA,SAAS,mBAAmB,KAAM,YAAY,mBAAmB,MAAO,YAAY;EACtF,CAAC;CACH;CAEA,MAAM,+BAAe,IAAI,IAA+B;CACxD,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,aAAa,IAAI,KAAK,MAAM;EACzC,IAAI,CAAC,QAAQ,KAAK,kBAAkB,KAAK,iBAAiB,aAAa,IAAI,KAAK,QAAQ,IAAI;CAC9F;CAKA,OAAO;EACL;EACA;EACA;EACA,QARa,CAAC,GAAG,aAAa,OAAO,CAAC,CAAC,CACtC,KAAK,EAAE,SAAS,GAAG,YAAY;GAAE,GAAG;GAAM,aAAa;EAAQ,EAAE,CAAC,CAClE,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,eAMjC;EACL,eAAe;EACf,aAAa,KAAK,SAAS;EAC3B,oBAAoB,QAAQ,QAAQ,WAAW,CAAC,gBAAgB,IAAI,MAAM,CAAC;CAC7E;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as validateRunRecord } from "./run-record-
|
|
2
|
-
import { t as mean } from "./mean-
|
|
1
|
+
import { c as validateRunRecord } from "./run-record-CpLS4Uid.js";
|
|
2
|
+
import { t as mean } from "./mean-D1d6gedE.js";
|
|
3
3
|
// src/campaign/run-record.ts
|
|
4
4
|
/**
|
|
5
5
|
* A campaign cell carried a judge score without a `dimensions` record.
|
|
@@ -217,4 +217,4 @@ function finiteMetrics(metrics) {
|
|
|
217
217
|
}
|
|
218
218
|
export { campaignCellToRunRecord as n, projectCampaignCellQuality as r, campaignCellCostProvenance as t };
|
|
219
219
|
|
|
220
|
-
//# sourceMappingURL=run-record-
|
|
220
|
+
//# sourceMappingURL=run-record-CbUi2adH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-record-B-G2Tu11.js","names":[],"sources":["../src/campaign/run-record.ts"],"sourcesContent":["import type { AgentProfileCell } from '../agent-profile-cell'\nimport type { CostProvenance } from '../cost-ledger'\nimport type {\n JudgeScoresRecord,\n RunCostProvenance,\n RunOutcome,\n RunRecord,\n RunSearchCoordinates,\n RunSplitTag,\n RunTerminalOutcome,\n RunTraceRef,\n} from '../run-record'\nimport { validateRunRecord } from '../run-record'\nimport { mean } from '../statistics/mean'\nimport type { CampaignCellResult, JudgeScore } from './types'\n\ninterface CampaignCellRunRecordOptions {\n /** With `search`, this must be `searchCellRunId(search)`. */\n runId: string\n experimentId: string\n candidateId: string\n model: string\n promptHash: string\n configHash: string\n commitSha: string\n splitTag: RunSplitTag\n seed?: number\n scenarioId?: string\n /** Estimated total for a cell that proved no spend at all. A cell that\n * proved part of its spend keeps that floor instead. */\n defaultCostUsd?: number\n agentProfile?: AgentProfileCell\n raw?: Record<string, number>\n search?: RunSearchCoordinates\n traceRef?: RunTraceRef\n}\n\ninterface CampaignCellQualityProjection {\n score?: number\n judgeScores?: JudgeScoresRecord\n successfulJudgeScores: Record<string, JudgeScore>\n failedJudges: string[]\n raw: Record<string, number>\n}\n\n/**\n * A campaign cell carried a judge score without a `dimensions` record.\n *\n * Two exported types share the name `JudgeScore`: the campaign verdict\n * (`{ dimensions, composite, notes }` from `@tangle-network/agent-eval/campaign`)\n * and the root export's flat per-dimension row (`{ judgeName, dimension, score }`\n * from `@tangle-network/agent-eval`). Campaign aggregation accepts only the\n * campaign shape; the flat shape previously crashed here with an opaque\n * TypeError deep inside aggregation.\n */\nexport class CampaignJudgeScoreShapeError extends TypeError {\n constructor(judgeName: string) {\n super(\n `campaign cell judge '${judgeName}' carries a score without a 'dimensions' record. ` +\n `Use the campaign JudgeScore ({ dimensions, composite, notes }) from ` +\n `'@tangle-network/agent-eval/campaign'; the root export's JudgeScore ` +\n `({ judgeName, dimension, score }) is a different type with the same name.`,\n )\n this.name = 'CampaignJudgeScoreShapeError'\n }\n}\n\ninterface CampaignCellExecutionEvidence {\n terminalOutcome: RunTerminalOutcome\n executionErrorCount?: number\n judgeErrorCount?: number\n unclassifiedErrorCount?: number\n terminalFailureReason?: string\n}\n\n/**\n * Project one campaign cell into the canonical run format.\n *\n * A dispatch error establishes terminal execution failure. A judge error only\n * establishes that quality measurement failed after dispatch completed.\n * Failures without a stage remain unknown. No failure becomes a zero-quality\n * label.\n */\nexport function campaignCellToRunRecord<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n options: CampaignCellRunRecordOptions,\n): RunRecord {\n const quality = projectCampaignCellQuality(cell)\n const execution = campaignCellExecutionEvidence(cell)\n const judgeErrorCount = Math.max(\n quality.raw.judge_error_count ?? 0,\n execution.judgeErrorCount ?? 0,\n )\n const costProvenance = campaignCellRunCostProvenance(cell, options.defaultCostUsd)\n const costUsd = costProvenance.usd\n const raw: Record<string, number> = {\n ...finiteMetrics(options.raw),\n ...quality.raw,\n rep: cell.rep,\n duration_ms: cell.durationMs,\n ...(costUsd === null ? {} : { cost_usd: costUsd }),\n tokens_input: cell.tokenUsage.input,\n tokens_output: cell.tokenUsage.output,\n tokens_known: cell.tokenUsage.tokensKnown === false ? 0 : 1,\n latency_ms: cell.durationMs,\n ...(execution.executionErrorCount === undefined\n ? {}\n : { execution_error_count: execution.executionErrorCount }),\n ...(judgeErrorCount > 0 ? { judge_error_count: judgeErrorCount } : {}),\n ...(execution.unclassifiedErrorCount === undefined\n ? {}\n : { unclassified_error_count: execution.unclassifiedErrorCount }),\n }\n if (typeof cell.generation === 'number') raw.generation = cell.generation\n if (cell.tokenUsage.reasoning !== undefined) {\n raw.tokens_reasoning = cell.tokenUsage.reasoning\n }\n if (cell.tokenUsage.cached !== undefined) raw.tokens_cached = cell.tokenUsage.cached\n if (cell.tokenUsage.cacheWrite !== undefined) {\n raw.tokens_cache_write = cell.tokenUsage.cacheWrite\n }\n if (cell.tokenUsage.tokensKnown !== false && costUsd !== null && costUsd > 0) {\n raw.tokens_per_dollar = (cell.tokenUsage.input + cell.tokenUsage.output) / costUsd\n }\n if (costUsd !== null && quality.score !== undefined && quality.score > 0.01) {\n raw.cost_per_quality = costUsd / quality.score\n }\n\n const outcome: RunOutcome = {\n raw,\n ...(quality.judgeScores ? { judgeScores: quality.judgeScores } : {}),\n }\n if (quality.score !== undefined) {\n if (options.splitTag === 'holdout') outcome.holdoutScore = quality.score\n else outcome.searchScore = quality.score\n }\n\n return validateRunRecord({\n runId: options.runId,\n experimentId: options.experimentId,\n candidateId: options.candidateId,\n seed: options.seed ?? cell.seed,\n model: options.model,\n promptHash: options.promptHash,\n configHash: options.configHash,\n commitSha: options.commitSha,\n wallMs: cell.durationMs,\n costUsd,\n costProvenance,\n tokenUsage: { ...cell.tokenUsage },\n terminalOutcome: execution.terminalOutcome,\n ...(execution.terminalFailureReason\n ? { terminalFailureReason: execution.terminalFailureReason }\n : {}),\n outcome,\n splitTag: options.splitTag,\n scenarioId: options.scenarioId ?? cell.scenarioId,\n ...(options.agentProfile ? { agentProfile: options.agentProfile } : {}),\n ...(options.search ? { search: options.search } : {}),\n ...(options.traceRef ? { traceRef: options.traceRef } : {}),\n })\n}\n\n/**\n * A cell's cost as a RunRecord states it. An uncaptured cell's `costUsd` is\n * the spend its receipts proved, so a positive one is the run's floor. The\n * caller's `defaultCostUsd` stands in only when nothing was proved: a proven\n * floor is never replaced by a guess.\n */\nfunction campaignCellRunCostProvenance<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n defaultCostUsd: number | undefined,\n): RunCostProvenance {\n const provenance = campaignCellCostProvenance(cell)\n if (provenance.kind !== 'uncaptured') return provenance\n if (cell.costUsd > 0) return { kind: 'lower-bound', usd: null, knownLowerBoundUsd: cell.costUsd }\n return defaultCostUsd === undefined ? provenance : { kind: 'estimated', usd: defaultCostUsd }\n}\n\n/**\n * Validate the cost fields that cross campaign cache and RunRecord boundaries.\n * `costUsd` is a known subtotal for uncaptured cells, but it must equal the\n * authoritative total whenever that total is observed or estimated.\n */\nexport function campaignCellCostProvenance<TArtifact>(\n cell: Pick<CampaignCellResult<TArtifact>, 'cellId' | 'costUsd' | 'costProvenance'>,\n): CostProvenance {\n if (!Number.isFinite(cell.costUsd) || cell.costUsd < 0) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid costUsd`)\n }\n const provenance = cell.costProvenance\n if (!provenance || typeof provenance !== 'object') {\n throw new Error(`campaign cell '${cell.cellId}' has no costProvenance`)\n }\n if (provenance.kind === 'uncaptured') {\n if (provenance.usd !== null) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid uncaptured costProvenance`)\n }\n return { kind: 'uncaptured', usd: null }\n }\n if (\n (provenance.kind !== 'observed' && provenance.kind !== 'estimated') ||\n !Number.isFinite(provenance.usd) ||\n provenance.usd < 0\n ) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid costProvenance`)\n }\n if (provenance.usd !== cell.costUsd) {\n throw new Error(`campaign cell '${cell.cellId}' has costUsd inconsistent with costProvenance`)\n }\n return { kind: provenance.kind, usd: provenance.usd }\n}\n\nfunction campaignCellExecutionEvidence<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n): CampaignCellExecutionEvidence {\n if (cell.errorStage === 'dispatch') {\n return {\n terminalOutcome: 'failed',\n executionErrorCount: 1,\n ...(cell.error ? { terminalFailureReason: cell.error } : {}),\n }\n }\n if (cell.errorStage === 'judge') {\n return {\n terminalOutcome: 'succeeded',\n executionErrorCount: 0,\n judgeErrorCount: 1,\n }\n }\n if (!cell.error) {\n return { terminalOutcome: 'succeeded', executionErrorCount: 0 }\n }\n return {\n terminalOutcome: 'unknown',\n unclassifiedErrorCount: 1,\n }\n}\n\n/**\n * Produce the only task-quality view used by campaign aggregates and exports.\n *\n * Successful judge results remain available for diagnosis after another judge\n * fails, but a task score exists only for an error-free cell whose reported\n * judge values are all finite.\n */\nexport function projectCampaignCellQuality<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n): CampaignCellQualityProjection {\n if (cell.errorStage === 'dispatch') {\n return { successfulJudgeScores: {}, failedJudges: [], raw: {} }\n }\n\n const perJudge: Record<string, Record<string, number>> = {}\n const successfulJudgeScores: Record<string, JudgeScore> = {}\n const dimensionValues = new Map<string, number[]>()\n const composites: number[] = []\n const notes: string[] = []\n const failedJudges = new Set<string>(\n cell.errorStage === 'judge' ? [cell.errorJudge ?? 'unknown-judge'] : [],\n )\n const raw: Record<string, number> = {}\n\n for (const [judgeName, score] of Object.entries(cell.judgeScores)) {\n const dimensionsShape = (score as { dimensions?: unknown }).dimensions\n if (\n typeof dimensionsShape !== 'object' ||\n dimensionsShape === null ||\n Array.isArray(dimensionsShape)\n ) {\n throw new CampaignJudgeScoreShapeError(judgeName)\n }\n const finiteDimensions = Object.values(score.dimensions).every(Number.isFinite)\n if (score.failed || !Number.isFinite(score.composite) || !finiteDimensions) {\n failedJudges.add(judgeName)\n continue\n }\n\n composites.push(score.composite)\n successfulJudgeScores[judgeName] = score\n const dimensions = { ...score.dimensions }\n perJudge[judgeName] = dimensions\n for (const [dimension, value] of Object.entries(dimensions)) {\n raw[`${judgeName}.${dimension}`] = value\n const values = dimensionValues.get(dimension) ?? []\n values.push(value)\n dimensionValues.set(dimension, values)\n }\n if (score.notes) notes.push(`${judgeName}: ${score.notes}`)\n for (const failedJudge of score.failedJudges ?? []) {\n failedJudges.add(`${judgeName}/${failedJudge}`)\n }\n }\n\n if (failedJudges.size > 0) raw.judge_error_count = failedJudges.size\n const sortedFailedJudges = [...failedJudges].sort()\n if (composites.length === 0) {\n return {\n successfulJudgeScores,\n failedJudges: sortedFailedJudges,\n raw,\n }\n }\n\n const composite = mean(composites)\n const perDimMean = Object.fromEntries(\n [...dimensionValues.entries()].map(([dimension, values]) => [dimension, mean(values)]),\n )\n const complete =\n cell.error === undefined && cell.errorStage === undefined && failedJudges.size === 0\n if (complete) raw.composite = composite\n\n return {\n ...(complete ? { score: composite } : {}),\n raw,\n successfulJudgeScores,\n failedJudges: sortedFailedJudges,\n judgeScores: {\n perJudge,\n perDimMean,\n composite,\n ...(sortedFailedJudges.length > 0 ? { failedJudges: sortedFailedJudges } : {}),\n ...(notes.length > 0 ? { notes: notes.join(' | ') } : {}),\n },\n }\n}\n\nfunction finiteMetrics(metrics: Record<string, number> | undefined): Record<string, number> {\n const finite: Record<string, number> = {}\n for (const [key, value] of Object.entries(metrics ?? {})) {\n if (Number.isFinite(value)) finite[key] = value\n }\n return finite\n}\n"],"mappings":";;;;;;;;;;;;;AAuDA,IAAa,+BAAb,cAAkD,UAAU;CAC1D,YAAY,WAAmB;EAC7B,MACE,wBAAwB,UAAU,mQAIpC;EACA,KAAK,OAAO;CACd;AACF;;;;;;;;;AAkBA,SAAgB,wBACd,MACA,SACW;CACX,MAAM,UAAU,2BAA2B,IAAI;CAC/C,MAAM,YAAY,8BAA8B,IAAI;CACpD,MAAM,kBAAkB,KAAK,IAC3B,QAAQ,IAAI,qBAAqB,GACjC,UAAU,mBAAmB,CAC/B;CACA,MAAM,iBAAiB,8BAA8B,MAAM,QAAQ,cAAc;CACjF,MAAM,UAAU,eAAe;CAC/B,MAAM,MAA8B;EAClC,GAAG,cAAc,QAAQ,GAAG;EAC5B,GAAG,QAAQ;EACX,KAAK,KAAK;EACV,aAAa,KAAK;EAClB,GAAI,YAAY,OAAO,CAAC,IAAI,EAAE,UAAU,QAAQ;EAChD,cAAc,KAAK,WAAW;EAC9B,eAAe,KA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,cAAc,SAAqE;CAC1F,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,WAAW,CAAC,CAAC,GACrD,IAAI,OAAO,SAAS,KAAK,GAAG,OAAO,OAAO;CAE5C,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"run-record-CbUi2adH.js","names":[],"sources":["../src/campaign/run-record.ts"],"sourcesContent":["import type { AgentProfileCell } from '../agent-profile-cell'\nimport type { CostProvenance } from '../cost-ledger'\nimport type {\n JudgeScoresRecord,\n RunCostProvenance,\n RunOutcome,\n RunRecord,\n RunSearchCoordinates,\n RunSplitTag,\n RunTerminalOutcome,\n RunTraceRef,\n} from '../run-record'\nimport { validateRunRecord } from '../run-record'\nimport { mean } from '../statistics/mean'\nimport type { CampaignCellResult, JudgeScore } from './types'\n\ninterface CampaignCellRunRecordOptions {\n /** With `search`, this must be `searchCellRunId(search)`. */\n runId: string\n experimentId: string\n candidateId: string\n model: string\n promptHash: string\n configHash: string\n commitSha: string\n splitTag: RunSplitTag\n seed?: number\n scenarioId?: string\n /** Estimated total for a cell that proved no spend at all. A cell that\n * proved part of its spend keeps that floor instead. */\n defaultCostUsd?: number\n agentProfile?: AgentProfileCell\n raw?: Record<string, number>\n search?: RunSearchCoordinates\n traceRef?: RunTraceRef\n}\n\ninterface CampaignCellQualityProjection {\n score?: number\n judgeScores?: JudgeScoresRecord\n successfulJudgeScores: Record<string, JudgeScore>\n failedJudges: string[]\n raw: Record<string, number>\n}\n\n/**\n * A campaign cell carried a judge score without a `dimensions` record.\n *\n * Two exported types share the name `JudgeScore`: the campaign verdict\n * (`{ dimensions, composite, notes }` from `@tangle-network/agent-eval/campaign`)\n * and the root export's flat per-dimension row (`{ judgeName, dimension, score }`\n * from `@tangle-network/agent-eval`). Campaign aggregation accepts only the\n * campaign shape; the flat shape previously crashed here with an opaque\n * TypeError deep inside aggregation.\n */\nexport class CampaignJudgeScoreShapeError extends TypeError {\n constructor(judgeName: string) {\n super(\n `campaign cell judge '${judgeName}' carries a score without a 'dimensions' record. ` +\n `Use the campaign JudgeScore ({ dimensions, composite, notes }) from ` +\n `'@tangle-network/agent-eval/campaign'; the root export's JudgeScore ` +\n `({ judgeName, dimension, score }) is a different type with the same name.`,\n )\n this.name = 'CampaignJudgeScoreShapeError'\n }\n}\n\ninterface CampaignCellExecutionEvidence {\n terminalOutcome: RunTerminalOutcome\n executionErrorCount?: number\n judgeErrorCount?: number\n unclassifiedErrorCount?: number\n terminalFailureReason?: string\n}\n\n/**\n * Project one campaign cell into the canonical run format.\n *\n * A dispatch error establishes terminal execution failure. A judge error only\n * establishes that quality measurement failed after dispatch completed.\n * Failures without a stage remain unknown. No failure becomes a zero-quality\n * label.\n */\nexport function campaignCellToRunRecord<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n options: CampaignCellRunRecordOptions,\n): RunRecord {\n const quality = projectCampaignCellQuality(cell)\n const execution = campaignCellExecutionEvidence(cell)\n const judgeErrorCount = Math.max(\n quality.raw.judge_error_count ?? 0,\n execution.judgeErrorCount ?? 0,\n )\n const costProvenance = campaignCellRunCostProvenance(cell, options.defaultCostUsd)\n const costUsd = costProvenance.usd\n const raw: Record<string, number> = {\n ...finiteMetrics(options.raw),\n ...quality.raw,\n rep: cell.rep,\n duration_ms: cell.durationMs,\n ...(costUsd === null ? {} : { cost_usd: costUsd }),\n tokens_input: cell.tokenUsage.input,\n tokens_output: cell.tokenUsage.output,\n tokens_known: cell.tokenUsage.tokensKnown === false ? 0 : 1,\n latency_ms: cell.durationMs,\n ...(execution.executionErrorCount === undefined\n ? {}\n : { execution_error_count: execution.executionErrorCount }),\n ...(judgeErrorCount > 0 ? { judge_error_count: judgeErrorCount } : {}),\n ...(execution.unclassifiedErrorCount === undefined\n ? {}\n : { unclassified_error_count: execution.unclassifiedErrorCount }),\n }\n if (typeof cell.generation === 'number') raw.generation = cell.generation\n if (cell.tokenUsage.reasoning !== undefined) {\n raw.tokens_reasoning = cell.tokenUsage.reasoning\n }\n if (cell.tokenUsage.cached !== undefined) raw.tokens_cached = cell.tokenUsage.cached\n if (cell.tokenUsage.cacheWrite !== undefined) {\n raw.tokens_cache_write = cell.tokenUsage.cacheWrite\n }\n if (cell.tokenUsage.tokensKnown !== false && costUsd !== null && costUsd > 0) {\n raw.tokens_per_dollar = (cell.tokenUsage.input + cell.tokenUsage.output) / costUsd\n }\n if (costUsd !== null && quality.score !== undefined && quality.score > 0.01) {\n raw.cost_per_quality = costUsd / quality.score\n }\n\n const outcome: RunOutcome = {\n raw,\n ...(quality.judgeScores ? { judgeScores: quality.judgeScores } : {}),\n }\n if (quality.score !== undefined) {\n if (options.splitTag === 'holdout') outcome.holdoutScore = quality.score\n else outcome.searchScore = quality.score\n }\n\n return validateRunRecord({\n runId: options.runId,\n experimentId: options.experimentId,\n candidateId: options.candidateId,\n seed: options.seed ?? cell.seed,\n model: options.model,\n promptHash: options.promptHash,\n configHash: options.configHash,\n commitSha: options.commitSha,\n wallMs: cell.durationMs,\n costUsd,\n costProvenance,\n tokenUsage: { ...cell.tokenUsage },\n terminalOutcome: execution.terminalOutcome,\n ...(execution.terminalFailureReason\n ? { terminalFailureReason: execution.terminalFailureReason }\n : {}),\n outcome,\n splitTag: options.splitTag,\n scenarioId: options.scenarioId ?? cell.scenarioId,\n ...(options.agentProfile ? { agentProfile: options.agentProfile } : {}),\n ...(options.search ? { search: options.search } : {}),\n ...(options.traceRef ? { traceRef: options.traceRef } : {}),\n })\n}\n\n/**\n * A cell's cost as a RunRecord states it. An uncaptured cell's `costUsd` is\n * the spend its receipts proved, so a positive one is the run's floor. The\n * caller's `defaultCostUsd` stands in only when nothing was proved: a proven\n * floor is never replaced by a guess.\n */\nfunction campaignCellRunCostProvenance<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n defaultCostUsd: number | undefined,\n): RunCostProvenance {\n const provenance = campaignCellCostProvenance(cell)\n if (provenance.kind !== 'uncaptured') return provenance\n if (cell.costUsd > 0) return { kind: 'lower-bound', usd: null, knownLowerBoundUsd: cell.costUsd }\n return defaultCostUsd === undefined ? provenance : { kind: 'estimated', usd: defaultCostUsd }\n}\n\n/**\n * Validate the cost fields that cross campaign cache and RunRecord boundaries.\n * `costUsd` is a known subtotal for uncaptured cells, but it must equal the\n * authoritative total whenever that total is observed or estimated.\n */\nexport function campaignCellCostProvenance<TArtifact>(\n cell: Pick<CampaignCellResult<TArtifact>, 'cellId' | 'costUsd' | 'costProvenance'>,\n): CostProvenance {\n if (!Number.isFinite(cell.costUsd) || cell.costUsd < 0) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid costUsd`)\n }\n const provenance = cell.costProvenance\n if (!provenance || typeof provenance !== 'object') {\n throw new Error(`campaign cell '${cell.cellId}' has no costProvenance`)\n }\n if (provenance.kind === 'uncaptured') {\n if (provenance.usd !== null) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid uncaptured costProvenance`)\n }\n return { kind: 'uncaptured', usd: null }\n }\n if (\n (provenance.kind !== 'observed' && provenance.kind !== 'estimated') ||\n !Number.isFinite(provenance.usd) ||\n provenance.usd < 0\n ) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid costProvenance`)\n }\n if (provenance.usd !== cell.costUsd) {\n throw new Error(`campaign cell '${cell.cellId}' has costUsd inconsistent with costProvenance`)\n }\n return { kind: provenance.kind, usd: provenance.usd }\n}\n\nfunction campaignCellExecutionEvidence<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n): CampaignCellExecutionEvidence {\n if (cell.errorStage === 'dispatch') {\n return {\n terminalOutcome: 'failed',\n executionErrorCount: 1,\n ...(cell.error ? { terminalFailureReason: cell.error } : {}),\n }\n }\n if (cell.errorStage === 'judge') {\n return {\n terminalOutcome: 'succeeded',\n executionErrorCount: 0,\n judgeErrorCount: 1,\n }\n }\n if (!cell.error) {\n return { terminalOutcome: 'succeeded', executionErrorCount: 0 }\n }\n return {\n terminalOutcome: 'unknown',\n unclassifiedErrorCount: 1,\n }\n}\n\n/**\n * Produce the only task-quality view used by campaign aggregates and exports.\n *\n * Successful judge results remain available for diagnosis after another judge\n * fails, but a task score exists only for an error-free cell whose reported\n * judge values are all finite.\n */\nexport function projectCampaignCellQuality<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n): CampaignCellQualityProjection {\n if (cell.errorStage === 'dispatch') {\n return { successfulJudgeScores: {}, failedJudges: [], raw: {} }\n }\n\n const perJudge: Record<string, Record<string, number>> = {}\n const successfulJudgeScores: Record<string, JudgeScore> = {}\n const dimensionValues = new Map<string, number[]>()\n const composites: number[] = []\n const notes: string[] = []\n const failedJudges = new Set<string>(\n cell.errorStage === 'judge' ? [cell.errorJudge ?? 'unknown-judge'] : [],\n )\n const raw: Record<string, number> = {}\n\n for (const [judgeName, score] of Object.entries(cell.judgeScores)) {\n const dimensionsShape = (score as { dimensions?: unknown }).dimensions\n if (\n typeof dimensionsShape !== 'object' ||\n dimensionsShape === null ||\n Array.isArray(dimensionsShape)\n ) {\n throw new CampaignJudgeScoreShapeError(judgeName)\n }\n const finiteDimensions = Object.values(score.dimensions).every(Number.isFinite)\n if (score.failed || !Number.isFinite(score.composite) || !finiteDimensions) {\n failedJudges.add(judgeName)\n continue\n }\n\n composites.push(score.composite)\n successfulJudgeScores[judgeName] = score\n const dimensions = { ...score.dimensions }\n perJudge[judgeName] = dimensions\n for (const [dimension, value] of Object.entries(dimensions)) {\n raw[`${judgeName}.${dimension}`] = value\n const values = dimensionValues.get(dimension) ?? []\n values.push(value)\n dimensionValues.set(dimension, values)\n }\n if (score.notes) notes.push(`${judgeName}: ${score.notes}`)\n for (const failedJudge of score.failedJudges ?? []) {\n failedJudges.add(`${judgeName}/${failedJudge}`)\n }\n }\n\n if (failedJudges.size > 0) raw.judge_error_count = failedJudges.size\n const sortedFailedJudges = [...failedJudges].sort()\n if (composites.length === 0) {\n return {\n successfulJudgeScores,\n failedJudges: sortedFailedJudges,\n raw,\n }\n }\n\n const composite = mean(composites)\n const perDimMean = Object.fromEntries(\n [...dimensionValues.entries()].map(([dimension, values]) => [dimension, mean(values)]),\n )\n const complete =\n cell.error === undefined && cell.errorStage === undefined && failedJudges.size === 0\n if (complete) raw.composite = composite\n\n return {\n ...(complete ? { score: composite } : {}),\n raw,\n successfulJudgeScores,\n failedJudges: sortedFailedJudges,\n judgeScores: {\n perJudge,\n perDimMean,\n composite,\n ...(sortedFailedJudges.length > 0 ? { failedJudges: sortedFailedJudges } : {}),\n ...(notes.length > 0 ? { notes: notes.join(' | ') } : {}),\n },\n }\n}\n\nfunction finiteMetrics(metrics: Record<string, number> | undefined): Record<string, number> {\n const finite: Record<string, number> = {}\n for (const [key, value] of Object.entries(metrics ?? {})) {\n if (Number.isFinite(value)) finite[key] = value\n }\n return finite\n}\n"],"mappings":";;;;;;;;;;;;;AAuDA,IAAa,+BAAb,cAAkD,UAAU;CAC1D,YAAY,WAAmB;EAC7B,MACE,wBAAwB,UAAU,mQAIpC;EACA,KAAK,OAAO;CACd;AACF;;;;;;;;;AAkBA,SAAgB,wBACd,MACA,SACW;CACX,MAAM,UAAU,2BAA2B,IAAI;CAC/C,MAAM,YAAY,8BAA8B,IAAI;CACpD,MAAM,kBAAkB,KAAK,IAC3B,QAAQ,IAAI,qBAAqB,GACjC,UAAU,mBAAmB,CAC/B;CACA,MAAM,iBAAiB,8BAA8B,MAAM,QAAQ,cAAc;CACjF,MAAM,UAAU,eAAe;CAC/B,MAAM,MAA8B;EAClC,GAAG,cAAc,QAAQ,GAAG;EAC5B,GAAG,QAAQ;EACX,KAAK,KAAK;EACV,aAAa,KAAK;EAClB,GAAI,YAAY,OAAO,CAAC,IAAI,EAAE,UAAU,QAAQ;EAChD,cAAc,KAAK,WAAW;EAC9B,eAAe,KAAK,WAAW;EAC/B,cAAc,KAAK,WAAW,gBAAgB,QAAQ,IAAI;EAC1D,YAAY,KAAK;EACjB,GAAI,UAAU,wBAAwB,KAAA,IAClC,CAAC,IACD,EAAE,uBAAuB,UAAU,oBAAoB;EAC3D,GAAI,kBAAkB,IAAI,E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@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as ValidationError } from "./errors-DeEEV9Vx.js";
|
|
2
2
|
import { s as validateAgentProfileCell } from "./agent-profile-cell-CT5JYueM.js";
|
|
3
|
-
import { n as observedScore } from "./reward-
|
|
3
|
+
import { n as observedScore } from "./reward-DqMfaEax.js";
|
|
4
4
|
import { t as FAILURE_CLASSES } from "./schema-D-xu3MU_.js";
|
|
5
5
|
// src/run-record.ts
|
|
6
6
|
/** Explicit model value for a row that never produced a served model snapshot. */
|
|
@@ -282,4 +282,4 @@ function validSnapshotDate(year, month, day) {
|
|
|
282
282
|
}
|
|
283
283
|
export { parseRunRecordSafe as a, validateRunRecord as c, modelHasSnapshot as i, UNKNOWN_MODEL as n, runTaskScore as o, isRunRecord as r, searchCellRunId as s, RunRecordValidationError as t };
|
|
284
284
|
|
|
285
|
-
//# sourceMappingURL=run-record-
|
|
285
|
+
//# sourceMappingURL=run-record-CpLS4Uid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-record-DEjx43cI.js","names":[],"sources":["../src/run-record.ts"],"sourcesContent":["/**\n * Paper-grade RunRecord schema + runtime validator.\n *\n * Every run that participates in a promotion gate, paper table, or\n * researcher loop SHOULD be recorded as a `RunRecord`. The mandatory\n * fields are exactly those the paper \"Two Loops, Three Roles\" requires\n * for reproducibility: who/what/when/cost/seed/hash, plus the search vs\n * holdout split tag. A task score is optional because execution-only records\n * must preserve missing labels instead of converting errors into zero quality.\n *\n * This is intentionally NOT a replacement for the rich `Run` /\n * `ProposeReviewReport` / `ScenarioResult` types already in the\n * package. Those are runtime structures with full provenance. A\n * `RunRecord` is the analysis-time projection — the JSON-friendly\n * row you'd put in a parquet file or paste into a notebook.\n *\n * Validate at the boundary:\n *\n * const rec = validateRunRecord(rawJson) // throws on missing\n * const ok = isRunRecord(rawJson) // boolean check\n * const rec = parseRunRecordSafe(rawJson) // { ok, value | error }\n *\n * The validator runs in pure TS — zod is intentionally NOT a\n * dependency.\n */\n\nimport type { AgentProfileCell } from './agent-profile-cell'\nimport { validateAgentProfileCell } from './agent-profile-cell'\nimport type { CostProvenance } from './cost-ledger'\nimport { ValidationError } from './errors'\n// Value import of a leaf module that itself imports only this file's TYPES —\n// no runtime cycle. It keeps the raw split-score derivation spelled in exactly\n// one place (see `rollout/score-derivation-guard`).\nimport { observedScore } from './rollout/reward'\nimport { FAILURE_CLASSES, type FailureClass } from './trace/schema'\n\n/** Search/dev/holdout split tag. 'search' is the paper-grade alias for the\n * combined train+test pool that the optimizer is allowed to read. */\nexport type RunSplitTag = 'search' | 'dev' | 'holdout'\n\n/**\n * Explicit execution-lifecycle result for a run.\n *\n * This is separate from task quality (`outcome`) and failure classification.\n * Producers set it only from root-run or process evidence.\n */\nexport type RunTerminalOutcome = 'succeeded' | 'failed' | 'cancelled' | 'incomplete' | 'unknown'\n\n/** Explicit model value for a row that never produced a served model snapshot. */\nexport const UNKNOWN_MODEL = 'unknown'\n\nexport interface RunTokenUsage {\n input: number\n /** All generated tokens charged as output, including reasoning tokens. */\n output: number\n /** Present only when one or more paid calls did not report token usage.\n * In that case, every numeric field is a known subtotal, not a measured total. */\n tokensKnown?: false\n /** Reasoning-token subset of `output`, when the provider reports it. */\n reasoning?: number\n /** Prompt tokens served from a provider cache. */\n cached?: number\n /** Prompt tokens written into a provider cache. */\n cacheWrite?: number\n}\n\n/**\n * How a run's USD amount was obtained.\n *\n * `costUsd` is the run's total, or null when the total is unknown. A run whose\n * receipts prove only part of its spend is a `lower-bound`: its total is\n * unknown, so `costUsd` and `usd` stay null, and the proven part is\n * `knownLowerBoundUsd`. A reader of the total therefore never takes a floor\n * for a total. A floor of $0 proves nothing, so it is written `uncaptured`.\n *\n * Only a RunRecord needs this kind. Every other cost shape keeps a known\n * subtotal beside `CostProvenance`, where `uncaptured` already means \"at\n * least the subtotal\"; a RunRecord's nullable `costUsd` cannot hold one.\n */\nexport type RunCostProvenance =\n | CostProvenance\n | { kind: 'lower-bound'; usd: null; knownLowerBoundUsd: number }\n\n/**\n * The run's place in a search: one attempt at one cell. The search ledger\n * holds the lineage (the node's parents, depth and order); a RunRecord only\n * points at it.\n */\nexport interface RunSearchCoordinates {\n searchId: string\n nodeId: string\n /** The cell id hashes the search, node, task, split and repeat, so it is\n * unique across candidates. */\n cellId: string\n /** Attempt number within the cell, counted from 1. */\n attempt: number\n}\n\n/** Where the run's execution record lives. */\nexport interface RunTraceRef {\n /** Trace id shared by every span of the run. */\n traceId: string\n /** Root run of the execution tree the run spawned, when one exists. */\n execRunId?: string\n}\n\n/**\n * The run id of one attempt at a search cell. It is unique across candidates\n * and attempts, unlike a `${scenario}:${rep}` id, which every candidate that\n * ran the same scenario shares.\n */\nexport function searchCellRunId(search: Pick<RunSearchCoordinates, 'cellId' | 'attempt'>): string {\n return `${search.cellId}:${search.attempt}`\n}\n\nexport interface RunJudgeMetadata {\n model: string\n promptVersion: string\n /** [0,1] confidence the judge declared. Constant judge confidence\n * across many runs is a fallback signal (see `canary.ts`). */\n confidence: number\n /** True if the judge degraded to a fallback path (rules-only,\n * prior-call cache, etc.). The canary uses this to alert. */\n fallback: boolean\n}\n\n/**\n * Per-judge / per-dimension breakdown for runs scored by an ensemble of\n * judges over a multi-dimensional rubric.\n *\n * The collapsed `outcome.searchScore` / `holdoutScore` carries the\n * composite the gate uses. The full breakdown belongs here so consumers\n * can answer \"which judge disagreed?\", \"which dimension dragged the\n * composite down?\", and \"did half the panel fail?\" without re-running.\n *\n * `perJudge[judgeId][dim]` is the canonical source; `perDimMean` and\n * `composite` are convenience projections — derivable but precomputed so\n * downstream IRR primitives (`interRaterReliability`,\n * `corpusInterRaterAgreement`) and reporters don't pay the same\n * aggregation twice.\n *\n * Fail-loud discipline: judges that errored out land in `failedJudges`\n * by id. A missing key in `perJudge` is ambiguous (silent zero vs not\n * run); the explicit list makes a partial-failure recorded as such.\n */\nexport interface JudgeScoresRecord {\n /** Per-judge per-dimension scores. `{ \"kimi-k2.6\": { helpfulness: 0.8, clarity: 0.7 }, ... }`. */\n perJudge: Record<string, Record<string, number>>\n /** Per-dim mean across judges. Convenience — derivable from `perJudge`. */\n perDimMean: Record<string, number>\n /** Composite mean across successful judges. Mirrors the task score only\n * when `failedJudges` is empty. */\n composite: number\n /** Judges that errored or returned an unparseable verdict. Recorded\n * by id (e.g. `['glm-5.1']`) so a partial-failure case is explicit,\n * not inferred from missing keys in `perJudge`. */\n failedJudges?: string[]\n /** Free-form notes the judges emitted (joined across judges or\n * first-judge only — consumer's choice). */\n notes?: string\n}\n\nexport interface RunOutcome {\n /** Score on the search/optimization split. Optional for holdout-only and\n * execution-only records. */\n searchScore?: number\n /** Score on the held-out split. Optional for search-only and execution-only\n * records. When both scores are absent, the run is explicitly unlabeled. */\n holdoutScore?: number\n /** Bag of any other metric the run produced — judge dimensions,\n * pass/fail counters, latency stats, etc. Numeric only — keeps\n * reporters honest. */\n raw: Record<string, number>\n /** Per-judge / per-dim breakdown. Consumers writing ensemble\n * judgements populate this; substrate primitives like\n * `interRaterReliability` and `corpusInterRaterAgreement` accept\n * these records as input. Optional — single-judge or scalar-only\n * runs leave it unset. */\n judgeScores?: JudgeScoresRecord\n /** Authenticity / realness verdict — did the run build the REAL thing on the\n * intended infra, or fake it (see `./authenticity`)? Optional: only domains\n * with an authenticity config populate it. Carried in the corpus so the\n * flywheel / off-policy learning can optimize for real completion, not gamed\n * pass-rate. `score` is 0-1; `gated` is the anti-Goodhart flag — a gated run\n * must not count as a real success regardless of `score`. */\n realness?: { score: number; gated: boolean; reason?: string }\n}\n\n/**\n * Mandatory paper-grade fields for a single evaluation run. Optional\n * fields are extension points; mandatory fields throw if missing.\n *\n * Hash discipline:\n * - `promptHash` is the sha256 of the EFFECTIVE prompt sent to the\n * model (after any steering bundle merge).\n * - `configHash` is the sha256 of the effective run config (model,\n * temperature, tools, judges, splits). The pair (promptHash,\n * configHash) uniquely identifies an experiment cell.\n *\n * Model snapshot discipline:\n * - successful rows MUST encode a snapshot version. Bare aliases like\n * `claude-sonnet-4` or `gpt-4o` are banned — they remap silently.\n * Use `claude-sonnet-4-6@2025-04-15` or `gpt-4o-2024-11-20`.\n * - a failed, cancelled, incomplete, or otherwise unknown row may use\n * `UNKNOWN_MODEL` when no served model was observed. This is an explicit\n * absence marker, not a fabricated snapshot.\n */\nexport interface RunRecord {\n /** UUID for the run. */\n runId: string\n /** Logical experiment grouping (a treatment vs a baseline within\n * the same sweep should share `experimentId`). */\n experimentId: string\n /** Stable identifier for the candidate (variant) being run. The\n * promotion gate compares two `candidateId`s on matched items. */\n candidateId: string\n /** RNG seed for the run. Always recorded — silent re-seeding is\n * the most common cause of non-reproducible numbers. */\n seed: number\n /** Model identifier WITH snapshot version. */\n model: string\n /** sha256 of the effective prompt (post-steering). */\n promptHash: string\n /** sha256 of the effective config. */\n configHash: string\n /** Git SHA the harness was run from. */\n commitSha: string\n /** End-to-end wall-clock duration in milliseconds. */\n wallMs: number\n /** Time spent queued before execution started, if known. */\n queueMs?: number\n /** Total USD cost, or null when the total is unknown. */\n costUsd: number | null\n /** Whether `costUsd` came from billing data or a price calculation, is only\n * proven down to a floor, or is unavailable. */\n costProvenance: RunCostProvenance\n /** Token usage breakdown. */\n tokenUsage: RunTokenUsage\n /** Root-run or process terminal result. Never inferred from a child span. */\n terminalOutcome: RunTerminalOutcome\n /** Root-run or process failure reason. Valid only for a failed, cancelled,\n * or incomplete terminal result; never populated from a child span. */\n terminalFailureReason?: string\n /** Judge-side metadata, if a judge was used. */\n judgeMetadata?: RunJudgeMetadata\n /** Per-split scores + raw bag. */\n outcome: RunOutcome\n /** Canonical task-failure class drawn from the shared\n * `FAILURE_CLASSES` taxonomy. Producers set it only from task-result\n * evidence. Execution errors belong in\n * `outcome.raw.execution_error_count`. */\n failureClass?: FailureClass\n /** Free-form task-failure detail scoped under a non-success\n * `failureClass`. It is invalid without that class. */\n failureMode?: string\n /** Which split this run was drawn from. */\n splitTag: RunSplitTag\n /**\n * Stable scenario identifier the run observed or was scored against.\n * Comparison primitives match this identity rather than input order.\n */\n scenarioId: string\n /**\n * Canonical identity for the agent profile cell that produced this row:\n * profile artifact hash plus optional harness/model/prompt/reporting\n * dimensions. Use `agentProfile.cellId` to group persona sweeps and\n * longitudinal reports by the complete source profile, not by a loose\n * candidate label or opaque config hash.\n */\n agentProfile?: AgentProfileCell\n /** The search cell this run settled. When present, `runId` is\n * `searchCellRunId(search)`. */\n search?: RunSearchCoordinates\n /** The run's trace and execution tree. Absent means the producer did not\n * record where they are. */\n traceRef?: RunTraceRef\n}\n\n/**\n * Canonical task-result classification.\n *\n * A producer may omit classification, record explicit success, or attach\n * domain-specific detail to a non-success class. Detail can never stand alone.\n * Execution errors belong in `outcome.raw.execution_error_count`.\n */\nexport type RunTaskFailure =\n | { failureClass?: undefined; failureMode?: undefined }\n | { failureClass: 'success'; failureMode?: undefined }\n | {\n failureClass: Exclude<FailureClass, 'success'>\n failureMode?: string\n }\n\n/**\n * Return task quality, preferring held-out evidence when both scores exist.\n *\n * RAW: no realness protection is applied. Built on `observedScore` rather\n * than repeating the split derivation, so only `rollout/reward.ts` reads the\n * raw fields. Anything that becomes training data must use `trainingScore` or\n * `trainingReward` instead.\n */\nexport function runTaskScore(record: RunRecord): number | undefined {\n const score = observedScore(record)\n return typeof score === 'number' && Number.isFinite(score) ? score : undefined\n}\n\n// ── Validation ───────────────────────────────────────────────────────\n\nconst MANDATORY_TOP_LEVEL = [\n 'runId',\n 'experimentId',\n 'candidateId',\n 'seed',\n 'model',\n 'promptHash',\n 'configHash',\n 'commitSha',\n 'wallMs',\n 'costUsd',\n 'costProvenance',\n 'tokenUsage',\n 'terminalOutcome',\n 'outcome',\n 'splitTag',\n 'scenarioId',\n] as const\n\nconst SPLIT_TAGS: ReadonlyArray<RunSplitTag> = ['search', 'dev', 'holdout']\nconst TERMINAL_OUTCOMES: ReadonlyArray<RunTerminalOutcome> = [\n 'succeeded',\n 'failed',\n 'cancelled',\n 'incomplete',\n 'unknown',\n]\n\nexport class RunRecordValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\n/**\n * Strict validator. Throws `RunRecordValidationError` on the first\n * missing or wrongly-typed field. Returns the input cast to\n * `RunRecord` on success — the validator does not coerce.\n */\nexport function validateRunRecord(input: unknown): RunRecord {\n if (input === null || typeof input !== 'object') {\n throw new RunRecordValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n\n for (const key of MANDATORY_TOP_LEVEL) {\n if (!(key in obj)) {\n throw new RunRecordValidationError(`missing mandatory field \"${key}\"`)\n }\n }\n\n expectString(obj.runId, 'runId')\n expectString(obj.experimentId, 'experimentId')\n expectString(obj.candidateId, 'candidateId')\n expectFiniteNumber(obj.seed, 'seed')\n expectString(obj.model, 'model')\n expectString(obj.promptHash, 'promptHash')\n expectString(obj.configHash, 'configHash')\n expectString(obj.commitSha, 'commitSha')\n expectNonNegativeNumber(obj.wallMs, 'wallMs')\n if (obj.queueMs !== undefined) expectNonNegativeNumber(obj.queueMs, 'queueMs')\n validateCost(obj.costUsd, obj.costProvenance)\n\n // Snapshot discipline: successful rows require a served model snapshot.\n // Non-success rows may carry the explicit absence marker when execution\n // stopped before a model identity was observed.\n if (\n !modelHasSnapshot(obj.model as string) &&\n !(obj.model === UNKNOWN_MODEL && obj.terminalOutcome !== 'succeeded')\n ) {\n throw new RunRecordValidationError(\n `model \"${obj.model}\" lacks a snapshot version (use 'name@YYYY-MM-DD' or 'name-YYYYMMDD', or '${UNKNOWN_MODEL}' for a non-success row without a served model)`,\n 'model',\n )\n }\n\n // Token usage.\n const tu = obj.tokenUsage\n if (tu === null || typeof tu !== 'object') {\n throw new RunRecordValidationError('tokenUsage must be an object', 'tokenUsage')\n }\n const tuRec = tu as Record<string, unknown>\n expectNonNegativeNumber(tuRec.input, 'tokenUsage.input')\n expectNonNegativeNumber(tuRec.output, 'tokenUsage.output')\n if (tuRec.tokensKnown !== undefined && tuRec.tokensKnown !== false) {\n throw new RunRecordValidationError(\n 'tokensKnown must be false when present; omit it when token usage is complete',\n 'tokenUsage.tokensKnown',\n )\n }\n if (tuRec.reasoning !== undefined) {\n expectNonNegativeNumber(tuRec.reasoning, 'tokenUsage.reasoning')\n if ((tuRec.reasoning as number) > (tuRec.output as number)) {\n throw new RunRecordValidationError(\n 'reasoning tokens must be a subset of output tokens',\n 'tokenUsage.reasoning',\n )\n }\n }\n if (tuRec.cached !== undefined) expectNonNegativeNumber(tuRec.cached, 'tokenUsage.cached')\n if (tuRec.cacheWrite !== undefined) {\n expectNonNegativeNumber(tuRec.cacheWrite, 'tokenUsage.cacheWrite')\n }\n\n // Judge metadata, optional.\n if (obj.judgeMetadata !== undefined) {\n const jm = obj.judgeMetadata\n if (jm === null || typeof jm !== 'object') {\n throw new RunRecordValidationError('judgeMetadata must be an object', 'judgeMetadata')\n }\n const jmRec = jm as Record<string, unknown>\n expectString(jmRec.model, 'judgeMetadata.model')\n expectString(jmRec.promptVersion, 'judgeMetadata.promptVersion')\n expectFiniteNumber(jmRec.confidence, 'judgeMetadata.confidence')\n if (typeof jmRec.fallback !== 'boolean') {\n throw new RunRecordValidationError(\n 'judgeMetadata.fallback must be boolean',\n 'judgeMetadata.fallback',\n )\n }\n }\n\n // Outcome.\n const out = obj.outcome\n if (out === null || typeof out !== 'object') {\n throw new RunRecordValidationError('outcome must be an object', 'outcome')\n }\n const outRec = out as Record<string, unknown>\n if (outRec.searchScore !== undefined)\n expectFiniteNumber(outRec.searchScore, 'outcome.searchScore')\n if (outRec.holdoutScore !== undefined)\n expectFiniteNumber(outRec.holdoutScore, 'outcome.holdoutScore')\n const raw = outRec.raw\n if (raw === null || typeof raw !== 'object') {\n throw new RunRecordValidationError('outcome.raw must be an object', 'outcome.raw')\n }\n for (const [k, v] of Object.entries(raw as Record<string, unknown>)) {\n expectFiniteNumber(v, `outcome.raw.${k}`)\n }\n // Realness verdict, optional.\n if (outRec.realness !== undefined) {\n const r = outRec.realness\n if (r === null || typeof r !== 'object') {\n throw new RunRecordValidationError('outcome.realness must be an object', 'outcome.realness')\n }\n const rr = r as Record<string, unknown>\n expectFiniteNumber(rr.score, 'outcome.realness.score')\n if (typeof rr.gated !== 'boolean') {\n throw new RunRecordValidationError(\n 'outcome.realness.gated must be a boolean',\n 'outcome.realness.gated',\n )\n }\n }\n\n // Per-judge / per-dim breakdown, optional.\n if (outRec.judgeScores !== undefined) {\n validateJudgeScores(outRec.judgeScores, 'outcome.judgeScores')\n }\n\n // Failure mode optional.\n if (\n obj.failureClass !== undefined &&\n (typeof obj.failureClass !== 'string' ||\n !FAILURE_CLASSES.includes(obj.failureClass as FailureClass))\n ) {\n throw new RunRecordValidationError(\n `failureClass must be one of ${FAILURE_CLASSES.join(', ')}`,\n 'failureClass',\n )\n }\n if (obj.failureMode !== undefined) {\n expectString(obj.failureMode, 'failureMode')\n if (obj.failureClass === undefined || obj.failureClass === 'success') {\n throw new RunRecordValidationError(\n 'failureMode requires a non-success failureClass',\n 'failureMode',\n )\n }\n }\n\n if (\n typeof obj.terminalOutcome !== 'string' ||\n !TERMINAL_OUTCOMES.includes(obj.terminalOutcome as RunTerminalOutcome)\n ) {\n throw new RunRecordValidationError(\n `terminalOutcome must be one of ${TERMINAL_OUTCOMES.join(', ')}`,\n 'terminalOutcome',\n )\n }\n if (obj.terminalFailureReason !== undefined) {\n expectString(obj.terminalFailureReason, 'terminalFailureReason')\n if (\n obj.terminalOutcome !== 'failed' &&\n obj.terminalOutcome !== 'cancelled' &&\n obj.terminalOutcome !== 'incomplete'\n ) {\n throw new RunRecordValidationError(\n 'terminalFailureReason requires terminalOutcome failed, cancelled, or incomplete',\n 'terminalFailureReason',\n )\n }\n }\n\n if (obj.agentProfile !== undefined) {\n try {\n const profile = validateAgentProfileCell(obj.agentProfile)\n if (profile.model !== undefined && profile.model !== obj.model) {\n throw new RunRecordValidationError(\n `agentProfile.model \"${profile.model}\" does not match model \"${obj.model}\"`,\n 'agentProfile.model',\n )\n }\n if (profile.promptHash !== undefined && profile.promptHash !== obj.promptHash) {\n throw new RunRecordValidationError(\n `agentProfile.promptHash \"${profile.promptHash}\" does not match promptHash \"${obj.promptHash}\"`,\n 'agentProfile.promptHash',\n )\n }\n } catch (error) {\n if (error instanceof RunRecordValidationError) throw error\n if (error instanceof Error) {\n throw new RunRecordValidationError(error.message, 'agentProfile')\n }\n throw error\n }\n }\n\n expectString(obj.scenarioId, 'scenarioId')\n\n if (obj.search !== undefined) validateSearchCoordinates(obj.search, obj.runId as string)\n if (obj.traceRef !== undefined) validateTraceRef(obj.traceRef)\n\n // Split tag.\n if (typeof obj.splitTag !== 'string' || !SPLIT_TAGS.includes(obj.splitTag as RunSplitTag)) {\n throw new RunRecordValidationError(\n `splitTag must be one of ${SPLIT_TAGS.join(', ')}, got ${String(obj.splitTag)}`,\n 'splitTag',\n )\n }\n\n return input as RunRecord\n}\n\nfunction validateCost(costUsd: unknown, provenance: unknown): void {\n if (provenance === null || typeof provenance !== 'object') {\n throw new RunRecordValidationError('costProvenance must be an object', 'costProvenance')\n }\n const value = provenance as Record<string, unknown>\n if (\n value.kind !== 'observed' &&\n value.kind !== 'estimated' &&\n value.kind !== 'lower-bound' &&\n value.kind !== 'uncaptured'\n ) {\n throw new RunRecordValidationError(\n 'costProvenance.kind must be observed, estimated, lower-bound, or uncaptured',\n 'costProvenance.kind',\n )\n }\n if (value.kind === 'lower-bound') {\n if (value.usd !== null) {\n throw new RunRecordValidationError(\n 'lower-bound costProvenance.usd must be null; the floor is knownLowerBoundUsd',\n 'costProvenance.usd',\n )\n }\n if (costUsd !== null) {\n throw new RunRecordValidationError(\n 'lower-bound cost requires costUsd to be null; a floor is not a total',\n 'costUsd',\n )\n }\n expectFiniteNumber(value.knownLowerBoundUsd, 'costProvenance.knownLowerBoundUsd')\n if ((value.knownLowerBoundUsd as number) <= 0) {\n throw new RunRecordValidationError(\n \"a lower bound must be positive; write a $0 floor as { kind: 'uncaptured', usd: null }\",\n 'costProvenance.knownLowerBoundUsd',\n )\n }\n return\n }\n // A record must never read as a total it cannot support, so an uncaptured\n // cost carries no number at all. A matrix `CellResult` keeps its known\n // subtotal instead, because a cost ceiling must charge the part it can see;\n // converting one to the other drops that subtotal.\n if (value.kind === 'uncaptured') {\n if (value.usd !== null) {\n throw new RunRecordValidationError(\n 'uncaptured costProvenance.usd must be null',\n 'costProvenance.usd',\n )\n }\n if (costUsd !== null) {\n throw new RunRecordValidationError('uncaptured cost requires costUsd to be null', 'costUsd')\n }\n return\n }\n expectNonNegativeNumber(costUsd, 'costUsd')\n expectNonNegativeNumber(value.usd, 'costProvenance.usd')\n if (value.usd !== costUsd) {\n throw new RunRecordValidationError(\n 'costProvenance.usd must equal costUsd',\n 'costProvenance.usd',\n )\n }\n}\n\nfunction validateSearchCoordinates(value: unknown, runId: string): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('search must be an object', 'search')\n }\n const search = value as Record<string, unknown>\n expectString(search.searchId, 'search.searchId')\n expectString(search.nodeId, 'search.nodeId')\n expectString(search.cellId, 'search.cellId')\n if (!Number.isSafeInteger(search.attempt) || (search.attempt as number) < 1) {\n throw new RunRecordValidationError('expected an integer from 1', 'search.attempt')\n }\n const expected = searchCellRunId(search as unknown as RunSearchCoordinates)\n if (runId !== expected) {\n throw new RunRecordValidationError(\n `runId \"${runId}\" must be \"${expected}\", the search cell and attempt it settled`,\n 'runId',\n )\n }\n}\n\nfunction validateTraceRef(value: unknown): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('traceRef must be an object', 'traceRef')\n }\n const ref = value as Record<string, unknown>\n expectString(ref.traceId, 'traceRef.traceId')\n if (ref.execRunId !== undefined) expectString(ref.execRunId, 'traceRef.execRunId')\n}\n\n/** Boolean validator — convenience for filtering arrays. */\nexport function isRunRecord(input: unknown): input is RunRecord {\n try {\n validateRunRecord(input)\n return true\n } catch {\n return false\n }\n}\n\n/** Non-throwing validator — returns a discriminated union. */\nexport function parseRunRecordSafe(\n input: unknown,\n): { ok: true; value: RunRecord } | { ok: false; error: RunRecordValidationError } {\n try {\n return { ok: true, value: validateRunRecord(input) }\n } catch (e) {\n if (e instanceof RunRecordValidationError) return { ok: false, error: e }\n throw e\n }\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new RunRecordValidationError(`expected non-empty string`, path)\n }\n}\n\nfunction expectFiniteNumber(value: unknown, path: string): void {\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new RunRecordValidationError(`expected finite number`, path)\n }\n}\n\nfunction expectNonNegativeNumber(value: unknown, path: string): void {\n expectFiniteNumber(value, path)\n if ((value as number) < 0) {\n throw new RunRecordValidationError('expected non-negative number', path)\n }\n}\n\nfunction validateJudgeScores(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('judgeScores must be an object', path)\n }\n const rec = value as Record<string, unknown>\n\n const perJudge = rec.perJudge\n if (perJudge === null || typeof perJudge !== 'object') {\n throw new RunRecordValidationError('perJudge must be an object', `${path}.perJudge`)\n }\n for (const [judgeId, dims] of Object.entries(perJudge as Record<string, unknown>)) {\n if (dims === null || typeof dims !== 'object') {\n throw new RunRecordValidationError(\n 'per-judge entry must be an object of dimension scores',\n `${path}.perJudge.${judgeId}`,\n )\n }\n for (const [dim, score] of Object.entries(dims as Record<string, unknown>)) {\n expectFiniteNumber(score, `${path}.perJudge.${judgeId}.${dim}`)\n }\n }\n\n const perDimMean = rec.perDimMean\n if (perDimMean === null || typeof perDimMean !== 'object') {\n throw new RunRecordValidationError('perDimMean must be an object', `${path}.perDimMean`)\n }\n for (const [dim, mean] of Object.entries(perDimMean as Record<string, unknown>)) {\n expectFiniteNumber(mean, `${path}.perDimMean.${dim}`)\n }\n\n expectFiniteNumber(rec.composite, `${path}.composite`)\n\n if (rec.failedJudges !== undefined) {\n if (!Array.isArray(rec.failedJudges)) {\n throw new RunRecordValidationError(\n 'failedJudges must be an array of strings',\n `${path}.failedJudges`,\n )\n }\n for (let i = 0; i < rec.failedJudges.length; i++) {\n const id = rec.failedJudges[i]\n if (typeof id !== 'string' || id.length === 0) {\n throw new RunRecordValidationError(\n 'failedJudges entry must be a non-empty string',\n `${path}.failedJudges[${i}]`,\n )\n }\n }\n }\n\n if (rec.notes !== undefined && typeof rec.notes !== 'string') {\n throw new RunRecordValidationError('notes must be a string', `${path}.notes`)\n }\n}\n\n/**\n * Snapshot check for provider model identifiers. Accepts ISO and compact\n * dates, Router's `-MMDD` snapshots, one opaque `@token`, and Vertex-style\n * `:date-token` suffixes. Routing selectors such as `@preset/name` are not\n * immutable model identities.\n */\nexport function modelHasSnapshot(model: string): boolean {\n if (model.length === 0 || model.trim() !== model) return false\n\n const opaqueAt = model.lastIndexOf('@')\n if (opaqueAt > 0) {\n const base = model.slice(0, opaqueAt)\n const token = model.slice(opaqueAt + 1)\n if (!base.includes('@') && /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/u.test(token)) {\n return true\n }\n }\n\n const isoDate = model.match(/-(\\d{4})-(\\d{2})-(\\d{2})$/u)\n if (isoDate && validSnapshotDate(isoDate[1]!, isoDate[2]!, isoDate[3]!)) return true\n\n const compactDate = model.match(/-(\\d{4})(\\d{2})(\\d{2})$/u)\n if (compactDate && validSnapshotDate(compactDate[1]!, compactDate[2]!, compactDate[3]!)) {\n return true\n }\n\n const routerDate = model.match(/-(\\d{2})(\\d{2})$/u)\n if (routerDate && validSnapshotDate(undefined, routerDate[1]!, routerDate[2]!)) return true\n\n return /:date-[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/u.test(model)\n}\n\nfunction validSnapshotDate(year: string | undefined, month: string, day: string): boolean {\n const monthNumber = Number(month)\n const dayNumber = Number(day)\n if (!Number.isInteger(monthNumber) || monthNumber < 1 || monthNumber > 12) return false\n\n const yearNumber = year === undefined ? undefined : Number(year)\n const leapYear =\n yearNumber === undefined ||\n (yearNumber % 4 === 0 && (yearNumber % 100 !== 0 || yearNumber % 400 === 0))\n const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return Number.isInteger(dayNumber) && dayNumber >= 1 && dayNumber <= daysInMonth[monthNumber - 1]!\n}\n"],"mappings":";;;;;;AAiDA,MAAa,gBAAgB;;;;;;AA8D7B,SAAgB,gBAAgB,QAAkE;CAChG,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO;AACpC;;;;;;;;;AA4LA,SAAgB,aAAa,QAAuC;CAClE,MAAM,QAAQ,cAAc,MAAM;CAClC,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;AAIA,MAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,aAAyC;CAAC;CAAU;CAAO;AAAS;AAC1E,MAAM,oBAAuD;CAC3D;CACA;CACA;CACA;CACA;AACF;AAEA,IAAa,2BAAb,cAA8C,gBAAgB;CAC5D;CACA,YAAY,SAAiB,OAAO,IAAI;EACtC,MAAM,OAAO,GAAG,QAAQ,OAAO,KAAK,KAAK,OAAO;EAChD,KAAK,OAAO;CACd;AACF;;;;;;AAOA,SAAgB,kBAAkB,OAA2B;CAC3D,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,MAAM,IAAI,yBAAyB,iBAAiB;CAEtD,MAAM,MAAM;CAEZ,KAAK,MAAM,OAAO,qBAChB,IAAI,EAAE,OAAO,MACX,MAAM,IAAI,yBAAyB,4BAA4B,IAAI,EAAE;CAIzE,aAAa,IAAI,OAAO,OAAO;CAC/B,aAAa,IAAI,cAAc,cAAc;CAC7C,aAAa,IAAI,aAAa,aAAa;CAC3C,mBAAmB,IAAI,MAAM,MAAM;CACnC,aAAa,IAAI,OAAO,OAAO;CAC/B,aAAa,IAAI,YAAY,YAAY;CACzC,aAAa,IAAI,YAAY,YAAY;CACzC,a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,kBAAkB,YAAY,IAAK,YAAY,IAAK,YAAY,EAAG,GACpF,OAAO;CAGT,MAAM,aAAa,MAAM,MAAM,mBAAmB;CAClD,IAAI,cAAc,kBAAkB,KAAA,GAAW,WAAW,IAAK,WAAW,EAAG,GAAG,OAAO;CAEvF,OAAO,qDAAqD,KAAK,KAAK;AACxE;AAEA,SAAS,kBAAkB,MAA0B,OAAe,KAAsB;CACxF,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,YAAY,OAAO,GAAG;CAC5B,IAAI,CAAC,OAAO,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc,IAAI,OAAO;CAElF,MAAM,aAAa,SAAS,KAAA,IAAY,KAAA,IAAY,OAAO,IAAI;CAI/D,MAAM,cAAc;EAAC;EAFnB,eAAe,KAAA,KACd,aAAa,MAAM,MAAM,aAAa,QAAQ,KAAK,aAAa,QAAQ,KACvC,KAAK;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;CAAE;CACnF,OAAO,OAAO,UAAU,SAAS,KAAK,aAAa,KAAK,aAAa,YAAY,cAAc;AACjG"}
|
|
1
|
+
{"version":3,"file":"run-record-CpLS4Uid.js","names":[],"sources":["../src/run-record.ts"],"sourcesContent":["/**\n * Paper-grade RunRecord schema + runtime validator.\n *\n * Every run that participates in a promotion gate, paper table, or\n * researcher loop SHOULD be recorded as a `RunRecord`. The mandatory\n * fields are exactly those the paper \"Two Loops, Three Roles\" requires\n * for reproducibility: who/what/when/cost/seed/hash, plus the search vs\n * holdout split tag. A task score is optional because execution-only records\n * must preserve missing labels instead of converting errors into zero quality.\n *\n * This is intentionally NOT a replacement for the rich `Run` /\n * `ProposeReviewReport` / `ScenarioResult` types already in the\n * package. Those are runtime structures with full provenance. A\n * `RunRecord` is the analysis-time projection — the JSON-friendly\n * row you'd put in a parquet file or paste into a notebook.\n *\n * Validate at the boundary:\n *\n * const rec = validateRunRecord(rawJson) // throws on missing\n * const ok = isRunRecord(rawJson) // boolean check\n * const rec = parseRunRecordSafe(rawJson) // { ok, value | error }\n *\n * The validator runs in pure TS — zod is intentionally NOT a\n * dependency.\n */\n\nimport type { AgentProfileCell } from './agent-profile-cell'\nimport { validateAgentProfileCell } from './agent-profile-cell'\nimport type { CostProvenance } from './cost-ledger'\nimport { ValidationError } from './errors'\n// Value import of a leaf module that itself imports only this file's TYPES —\n// no runtime cycle. It keeps the raw split-score derivation spelled in exactly\n// one place (see `rollout/score-derivation-guard`).\nimport { observedScore } from './rollout/reward'\nimport { FAILURE_CLASSES, type FailureClass } from './trace/schema'\n\n/** Search/dev/holdout split tag. 'search' is the paper-grade alias for the\n * combined train+test pool that the optimizer is allowed to read. */\nexport type RunSplitTag = 'search' | 'dev' | 'holdout'\n\n/**\n * Explicit execution-lifecycle result for a run.\n *\n * This is separate from task quality (`outcome`) and failure classification.\n * Producers set it only from root-run or process evidence.\n */\nexport type RunTerminalOutcome = 'succeeded' | 'failed' | 'cancelled' | 'incomplete' | 'unknown'\n\n/** Explicit model value for a row that never produced a served model snapshot. */\nexport const UNKNOWN_MODEL = 'unknown'\n\nexport interface RunTokenUsage {\n input: number\n /** All generated tokens charged as output, including reasoning tokens. */\n output: number\n /** Present only when one or more paid calls did not report token usage.\n * In that case, every numeric field is a known subtotal, not a measured total. */\n tokensKnown?: false\n /** Reasoning-token subset of `output`, when the provider reports it. */\n reasoning?: number\n /** Prompt tokens served from a provider cache. */\n cached?: number\n /** Prompt tokens written into a provider cache. */\n cacheWrite?: number\n}\n\n/**\n * How a run's USD amount was obtained.\n *\n * `costUsd` is the run's total, or null when the total is unknown. A run whose\n * receipts prove only part of its spend is a `lower-bound`: its total is\n * unknown, so `costUsd` and `usd` stay null, and the proven part is\n * `knownLowerBoundUsd`. A reader of the total therefore never takes a floor\n * for a total. A floor of $0 proves nothing, so it is written `uncaptured`.\n *\n * Only a RunRecord needs this kind. Every other cost shape keeps a known\n * subtotal beside `CostProvenance`, where `uncaptured` already means \"at\n * least the subtotal\"; a RunRecord's nullable `costUsd` cannot hold one.\n */\nexport type RunCostProvenance =\n | CostProvenance\n | { kind: 'lower-bound'; usd: null; knownLowerBoundUsd: number }\n\n/**\n * The run's place in a search: one attempt at one cell. The search ledger\n * holds the lineage (the node's parents, depth and order); a RunRecord only\n * points at it.\n */\nexport interface RunSearchCoordinates {\n searchId: string\n nodeId: string\n /** The cell id hashes the search, node, task, split and repeat, so it is\n * unique across candidates. */\n cellId: string\n /** Attempt number within the cell, counted from 1. */\n attempt: number\n}\n\n/** Where the run's execution record lives. */\nexport interface RunTraceRef {\n /** Trace id shared by every span of the run. */\n traceId: string\n /** Root run of the execution tree the run spawned, when one exists. */\n execRunId?: string\n}\n\n/**\n * The run id of one attempt at a search cell. It is unique across candidates\n * and attempts, unlike a `${scenario}:${rep}` id, which every candidate that\n * ran the same scenario shares.\n */\nexport function searchCellRunId(search: Pick<RunSearchCoordinates, 'cellId' | 'attempt'>): string {\n return `${search.cellId}:${search.attempt}`\n}\n\nexport interface RunJudgeMetadata {\n model: string\n promptVersion: string\n /** [0,1] confidence the judge declared. Constant judge confidence\n * across many runs is a fallback signal (see `canary.ts`). */\n confidence: number\n /** True if the judge degraded to a fallback path (rules-only,\n * prior-call cache, etc.). The canary uses this to alert. */\n fallback: boolean\n}\n\n/**\n * Per-judge / per-dimension breakdown for runs scored by an ensemble of\n * judges over a multi-dimensional rubric.\n *\n * The collapsed `outcome.searchScore` / `holdoutScore` carries the\n * composite the gate uses. The full breakdown belongs here so consumers\n * can answer \"which judge disagreed?\", \"which dimension dragged the\n * composite down?\", and \"did half the panel fail?\" without re-running.\n *\n * `perJudge[judgeId][dim]` is the canonical source; `perDimMean` and\n * `composite` are convenience projections — derivable but precomputed so\n * downstream IRR primitives (`interRaterReliability`,\n * `corpusInterRaterAgreement`) and reporters don't pay the same\n * aggregation twice.\n *\n * Fail-loud discipline: judges that errored out land in `failedJudges`\n * by id. A missing key in `perJudge` is ambiguous (silent zero vs not\n * run); the explicit list makes a partial-failure recorded as such.\n */\nexport interface JudgeScoresRecord {\n /** Per-judge per-dimension scores. `{ \"kimi-k2.6\": { helpfulness: 0.8, clarity: 0.7 }, ... }`. */\n perJudge: Record<string, Record<string, number>>\n /** Per-dim mean across judges. Convenience — derivable from `perJudge`. */\n perDimMean: Record<string, number>\n /** Composite mean across successful judges. Mirrors the task score only\n * when `failedJudges` is empty. */\n composite: number\n /** Judges that errored or returned an unparseable verdict. Recorded\n * by id (e.g. `['glm-5.1']`) so a partial-failure case is explicit,\n * not inferred from missing keys in `perJudge`. */\n failedJudges?: string[]\n /** Free-form notes the judges emitted (joined across judges or\n * first-judge only — consumer's choice). */\n notes?: string\n}\n\nexport interface RunOutcome {\n /** Score on the search/optimization split. Optional for holdout-only and\n * execution-only records. */\n searchScore?: number\n /** Score on the held-out split. Optional for search-only and execution-only\n * records. When both scores are absent, the run is explicitly unlabeled. */\n holdoutScore?: number\n /** Bag of any other metric the run produced — judge dimensions,\n * pass/fail counters, latency stats, etc. Numeric only — keeps\n * reporters honest. */\n raw: Record<string, number>\n /** Per-judge / per-dim breakdown. Consumers writing ensemble\n * judgements populate this; substrate primitives like\n * `interRaterReliability` and `corpusInterRaterAgreement` accept\n * these records as input. Optional — single-judge or scalar-only\n * runs leave it unset. */\n judgeScores?: JudgeScoresRecord\n /** Authenticity / realness verdict — did the run build the REAL thing on the\n * intended infra, or fake it (see `./authenticity`)? Optional: only domains\n * with an authenticity config populate it. Carried in the corpus so the\n * flywheel / off-policy learning can optimize for real completion, not gamed\n * pass-rate. `score` is 0-1; `gated` is the anti-Goodhart flag — a gated run\n * must not count as a real success regardless of `score`. */\n realness?: { score: number; gated: boolean; reason?: string }\n}\n\n/**\n * Mandatory paper-grade fields for a single evaluation run. Optional\n * fields are extension points; mandatory fields throw if missing.\n *\n * Hash discipline:\n * - `promptHash` is the sha256 of the EFFECTIVE prompt sent to the\n * model (after any steering bundle merge).\n * - `configHash` is the sha256 of the effective run config (model,\n * temperature, tools, judges, splits). The pair (promptHash,\n * configHash) uniquely identifies an experiment cell.\n *\n * Model snapshot discipline:\n * - successful rows MUST encode a snapshot version. Bare aliases like\n * `claude-sonnet-4` or `gpt-4o` are banned — they remap silently.\n * Use `claude-sonnet-4-6@2025-04-15` or `gpt-4o-2024-11-20`.\n * - a failed, cancelled, incomplete, or otherwise unknown row may use\n * `UNKNOWN_MODEL` when no served model was observed. This is an explicit\n * absence marker, not a fabricated snapshot.\n */\nexport interface RunRecord {\n /** UUID for the run. */\n runId: string\n /** Logical experiment grouping (a treatment vs a baseline within\n * the same sweep should share `experimentId`). */\n experimentId: string\n /** Stable identifier for the candidate (variant) being run. The\n * promotion gate compares two `candidateId`s on matched items. */\n candidateId: string\n /** RNG seed for the run. Always recorded — silent re-seeding is\n * the most common cause of non-reproducible numbers. */\n seed: number\n /** Model identifier WITH snapshot version. */\n model: string\n /** sha256 of the effective prompt (post-steering). */\n promptHash: string\n /** sha256 of the effective config. */\n configHash: string\n /** Git SHA the harness was run from. */\n commitSha: string\n /** End-to-end wall-clock duration in milliseconds. */\n wallMs: number\n /** Time spent queued before execution started, if known. */\n queueMs?: number\n /** Total USD cost, or null when the total is unknown. */\n costUsd: number | null\n /** Whether `costUsd` came from billing data or a price calculation, is only\n * proven down to a floor, or is unavailable. */\n costProvenance: RunCostProvenance\n /** Token usage breakdown. */\n tokenUsage: RunTokenUsage\n /** Root-run or process terminal result. Never inferred from a child span. */\n terminalOutcome: RunTerminalOutcome\n /** Root-run or process failure reason. Valid only for a failed, cancelled,\n * or incomplete terminal result; never populated from a child span. */\n terminalFailureReason?: string\n /** Judge-side metadata, if a judge was used. */\n judgeMetadata?: RunJudgeMetadata\n /** Per-split scores + raw bag. */\n outcome: RunOutcome\n /** Canonical task-failure class drawn from the shared\n * `FAILURE_CLASSES` taxonomy. Producers set it only from task-result\n * evidence. Execution errors belong in\n * `outcome.raw.execution_error_count`. */\n failureClass?: FailureClass\n /** Free-form task-failure detail scoped under a non-success\n * `failureClass`. It is invalid without that class. */\n failureMode?: string\n /** Which split this run was drawn from. */\n splitTag: RunSplitTag\n /**\n * Stable scenario identifier the run observed or was scored against.\n * Comparison primitives match this identity rather than input order.\n */\n scenarioId: string\n /**\n * Canonical identity for the agent profile cell that produced this row:\n * profile artifact hash plus optional harness/model/prompt/reporting\n * dimensions. Use `agentProfile.cellId` to group persona sweeps and\n * longitudinal reports by the complete source profile, not by a loose\n * candidate label or opaque config hash.\n */\n agentProfile?: AgentProfileCell\n /** The search cell this run settled. When present, `runId` is\n * `searchCellRunId(search)`. */\n search?: RunSearchCoordinates\n /** The run's trace and execution tree. Absent means the producer did not\n * record where they are. */\n traceRef?: RunTraceRef\n}\n\n/**\n * Canonical task-result classification.\n *\n * A producer may omit classification, record explicit success, or attach\n * domain-specific detail to a non-success class. Detail can never stand alone.\n * Execution errors belong in `outcome.raw.execution_error_count`.\n */\nexport type RunTaskFailure =\n | { failureClass?: undefined; failureMode?: undefined }\n | { failureClass: 'success'; failureMode?: undefined }\n | {\n failureClass: Exclude<FailureClass, 'success'>\n failureMode?: string\n }\n\n/**\n * Return task quality, preferring held-out evidence when both scores exist.\n *\n * RAW: no realness protection is applied. Built on `observedScore` rather\n * than repeating the split derivation, so only `rollout/reward.ts` reads the\n * raw fields. Anything that becomes training data must use `trainingScore` or\n * `trainingReward` instead.\n */\nexport function runTaskScore(record: RunRecord): number | undefined {\n const score = observedScore(record)\n return typeof score === 'number' && Number.isFinite(score) ? score : undefined\n}\n\n// ── Validation ───────────────────────────────────────────────────────\n\nconst MANDATORY_TOP_LEVEL = [\n 'runId',\n 'experimentId',\n 'candidateId',\n 'seed',\n 'model',\n 'promptHash',\n 'configHash',\n 'commitSha',\n 'wallMs',\n 'costUsd',\n 'costProvenance',\n 'tokenUsage',\n 'terminalOutcome',\n 'outcome',\n 'splitTag',\n 'scenarioId',\n] as const\n\nconst SPLIT_TAGS: ReadonlyArray<RunSplitTag> = ['search', 'dev', 'holdout']\nconst TERMINAL_OUTCOMES: ReadonlyArray<RunTerminalOutcome> = [\n 'succeeded',\n 'failed',\n 'cancelled',\n 'incomplete',\n 'unknown',\n]\n\nexport class RunRecordValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\n/**\n * Strict validator. Throws `RunRecordValidationError` on the first\n * missing or wrongly-typed field. Returns the input cast to\n * `RunRecord` on success — the validator does not coerce.\n */\nexport function validateRunRecord(input: unknown): RunRecord {\n if (input === null || typeof input !== 'object') {\n throw new RunRecordValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n\n for (const key of MANDATORY_TOP_LEVEL) {\n if (!(key in obj)) {\n throw new RunRecordValidationError(`missing mandatory field \"${key}\"`)\n }\n }\n\n expectString(obj.runId, 'runId')\n expectString(obj.experimentId, 'experimentId')\n expectString(obj.candidateId, 'candidateId')\n expectFiniteNumber(obj.seed, 'seed')\n expectString(obj.model, 'model')\n expectString(obj.promptHash, 'promptHash')\n expectString(obj.configHash, 'configHash')\n expectString(obj.commitSha, 'commitSha')\n expectNonNegativeNumber(obj.wallMs, 'wallMs')\n if (obj.queueMs !== undefined) expectNonNegativeNumber(obj.queueMs, 'queueMs')\n validateCost(obj.costUsd, obj.costProvenance)\n\n // Snapshot discipline: successful rows require a served model snapshot.\n // Non-success rows may carry the explicit absence marker when execution\n // stopped before a model identity was observed.\n if (\n !modelHasSnapshot(obj.model as string) &&\n !(obj.model === UNKNOWN_MODEL && obj.terminalOutcome !== 'succeeded')\n ) {\n throw new RunRecordValidationError(\n `model \"${obj.model}\" lacks a snapshot version (use 'name@YYYY-MM-DD' or 'name-YYYYMMDD', or '${UNKNOWN_MODEL}' for a non-success row without a served model)`,\n 'model',\n )\n }\n\n // Token usage.\n const tu = obj.tokenUsage\n if (tu === null || typeof tu !== 'object') {\n throw new RunRecordValidationError('tokenUsage must be an object', 'tokenUsage')\n }\n const tuRec = tu as Record<string, unknown>\n expectNonNegativeNumber(tuRec.input, 'tokenUsage.input')\n expectNonNegativeNumber(tuRec.output, 'tokenUsage.output')\n if (tuRec.tokensKnown !== undefined && tuRec.tokensKnown !== false) {\n throw new RunRecordValidationError(\n 'tokensKnown must be false when present; omit it when token usage is complete',\n 'tokenUsage.tokensKnown',\n )\n }\n if (tuRec.reasoning !== undefined) {\n expectNonNegativeNumber(tuRec.reasoning, 'tokenUsage.reasoning')\n if ((tuRec.reasoning as number) > (tuRec.output as number)) {\n throw new RunRecordValidationError(\n 'reasoning tokens must be a subset of output tokens',\n 'tokenUsage.reasoning',\n )\n }\n }\n if (tuRec.cached !== undefined) expectNonNegativeNumber(tuRec.cached, 'tokenUsage.cached')\n if (tuRec.cacheWrite !== undefined) {\n expectNonNegativeNumber(tuRec.cacheWrite, 'tokenUsage.cacheWrite')\n }\n\n // Judge metadata, optional.\n if (obj.judgeMetadata !== undefined) {\n const jm = obj.judgeMetadata\n if (jm === null || typeof jm !== 'object') {\n throw new RunRecordValidationError('judgeMetadata must be an object', 'judgeMetadata')\n }\n const jmRec = jm as Record<string, unknown>\n expectString(jmRec.model, 'judgeMetadata.model')\n expectString(jmRec.promptVersion, 'judgeMetadata.promptVersion')\n expectFiniteNumber(jmRec.confidence, 'judgeMetadata.confidence')\n if (typeof jmRec.fallback !== 'boolean') {\n throw new RunRecordValidationError(\n 'judgeMetadata.fallback must be boolean',\n 'judgeMetadata.fallback',\n )\n }\n }\n\n // Outcome.\n const out = obj.outcome\n if (out === null || typeof out !== 'object') {\n throw new RunRecordValidationError('outcome must be an object', 'outcome')\n }\n const outRec = out as Record<string, unknown>\n if (outRec.searchScore !== undefined)\n expectFiniteNumber(outRec.searchScore, 'outcome.searchScore')\n if (outRec.holdoutScore !== undefined)\n expectFiniteNumber(outRec.holdoutScore, 'outcome.holdoutScore')\n const raw = outRec.raw\n if (raw === null || typeof raw !== 'object') {\n throw new RunRecordValidationError('outcome.raw must be an object', 'outcome.raw')\n }\n for (const [k, v] of Object.entries(raw as Record<string, unknown>)) {\n expectFiniteNumber(v, `outcome.raw.${k}`)\n }\n // Realness verdict, optional.\n if (outRec.realness !== undefined) {\n const r = outRec.realness\n if (r === null || typeof r !== 'object') {\n throw new RunRecordValidationError('outcome.realness must be an object', 'outcome.realness')\n }\n const rr = r as Record<string, unknown>\n expectFiniteNumber(rr.score, 'outcome.realness.score')\n if (typeof rr.gated !== 'boolean') {\n throw new RunRecordValidationError(\n 'outcome.realness.gated must be a boolean',\n 'outcome.realness.gated',\n )\n }\n }\n\n // Per-judge / per-dim breakdown, optional.\n if (outRec.judgeScores !== undefined) {\n validateJudgeScores(outRec.judgeScores, 'outcome.judgeScores')\n }\n\n // Failure mode optional.\n if (\n obj.failureClass !== undefined &&\n (typeof obj.failureClass !== 'string' ||\n !FAILURE_CLASSES.includes(obj.failureClass as FailureClass))\n ) {\n throw new RunRecordValidationError(\n `failureClass must be one of ${FAILURE_CLASSES.join(', ')}`,\n 'failureClass',\n )\n }\n if (obj.failureMode !== undefined) {\n expectString(obj.failureMode, 'failureMode')\n if (obj.failureClass === undefined || obj.failureClass === 'success') {\n throw new RunRecordValidationError(\n 'failureMode requires a non-success failureClass',\n 'failureMode',\n )\n }\n }\n\n if (\n typeof obj.terminalOutcome !== 'string' ||\n !TERMINAL_OUTCOMES.includes(obj.terminalOutcome as RunTerminalOutcome)\n ) {\n throw new RunRecordValidationError(\n `terminalOutcome must be one of ${TERMINAL_OUTCOMES.join(', ')}`,\n 'terminalOutcome',\n )\n }\n if (obj.terminalFailureReason !== undefined) {\n expectString(obj.terminalFailureReason, 'terminalFailureReason')\n if (\n obj.terminalOutcome !== 'failed' &&\n obj.terminalOutcome !== 'cancelled' &&\n obj.terminalOutcome !== 'incomplete'\n ) {\n throw new RunRecordValidationError(\n 'terminalFailureReason requires terminalOutcome failed, cancelled, or incomplete',\n 'terminalFailureReason',\n )\n }\n }\n\n if (obj.agentProfile !== undefined) {\n try {\n const profile = validateAgentProfileCell(obj.agentProfile)\n if (profile.model !== undefined && profile.model !== obj.model) {\n throw new RunRecordValidationError(\n `agentProfile.model \"${profile.model}\" does not match model \"${obj.model}\"`,\n 'agentProfile.model',\n )\n }\n if (profile.promptHash !== undefined && profile.promptHash !== obj.promptHash) {\n throw new RunRecordValidationError(\n `agentProfile.promptHash \"${profile.promptHash}\" does not match promptHash \"${obj.promptHash}\"`,\n 'agentProfile.promptHash',\n )\n }\n } catch (error) {\n if (error instanceof RunRecordValidationError) throw error\n if (error instanceof Error) {\n throw new RunRecordValidationError(error.message, 'agentProfile')\n }\n throw error\n }\n }\n\n expectString(obj.scenarioId, 'scenarioId')\n\n if (obj.search !== undefined) validateSearchCoordinates(obj.search, obj.runId as string)\n if (obj.traceRef !== undefined) validateTraceRef(obj.traceRef)\n\n // Split tag.\n if (typeof obj.splitTag !== 'string' || !SPLIT_TAGS.includes(obj.splitTag as RunSplitTag)) {\n throw new RunRecordValidationError(\n `splitTag must be one of ${SPLIT_TAGS.join(', ')}, got ${String(obj.splitTag)}`,\n 'splitTag',\n )\n }\n\n return input as RunRecord\n}\n\nfunction validateCost(costUsd: unknown, provenance: unknown): void {\n if (provenance === null || typeof provenance !== 'object') {\n throw new RunRecordValidationError('costProvenance must be an object', 'costProvenance')\n }\n const value = provenance as Record<string, unknown>\n if (\n value.kind !== 'observed' &&\n value.kind !== 'estimated' &&\n value.kind !== 'lower-bound' &&\n value.kind !== 'uncaptured'\n ) {\n throw new RunRecordValidationError(\n 'costProvenance.kind must be observed, estimated, lower-bound, or uncaptured',\n 'costProvenance.kind',\n )\n }\n if (value.kind === 'lower-bound') {\n if (value.usd !== null) {\n throw new RunRecordValidationError(\n 'lower-bound costProvenance.usd must be null; the floor is knownLowerBoundUsd',\n 'costProvenance.usd',\n )\n }\n if (costUsd !== null) {\n throw new RunRecordValidationError(\n 'lower-bound cost requires costUsd to be null; a floor is not a total',\n 'costUsd',\n )\n }\n expectFiniteNumber(value.knownLowerBoundUsd, 'costProvenance.knownLowerBoundUsd')\n if ((value.knownLowerBoundUsd as number) <= 0) {\n throw new RunRecordValidationError(\n \"a lower bound must be positive; write a $0 floor as { kind: 'uncaptured', usd: null }\",\n 'costProvenance.knownLowerBoundUsd',\n )\n }\n return\n }\n // A record must never read as a total it cannot support, so an uncaptured\n // cost carries no number at all. A matrix `CellResult` keeps its known\n // subtotal instead, because a cost ceiling must charge the part it can see;\n // converting one to the other drops that subtotal.\n if (value.kind === 'uncaptured') {\n if (value.usd !== null) {\n throw new RunRecordValidationError(\n 'uncaptured costProvenance.usd must be null',\n 'costProvenance.usd',\n )\n }\n if (costUsd !== null) {\n throw new RunRecordValidationError('uncaptured cost requires costUsd to be null', 'costUsd')\n }\n return\n }\n expectNonNegativeNumber(costUsd, 'costUsd')\n expectNonNegativeNumber(value.usd, 'costProvenance.usd')\n if (value.usd !== costUsd) {\n throw new RunRecordValidationError(\n 'costProvenance.usd must equal costUsd',\n 'costProvenance.usd',\n )\n }\n}\n\nfunction validateSearchCoordinates(value: unknown, runId: string): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('search must be an object', 'search')\n }\n const search = value as Record<string, unknown>\n expectString(search.searchId, 'search.searchId')\n expectString(search.nodeId, 'search.nodeId')\n expectString(search.cellId, 'search.cellId')\n if (!Number.isSafeInteger(search.attempt) || (search.attempt as number) < 1) {\n throw new RunRecordValidationError('expected an integer from 1', 'search.attempt')\n }\n const expected = searchCellRunId(search as unknown as RunSearchCoordinates)\n if (runId !== expected) {\n throw new RunRecordValidationError(\n `runId \"${runId}\" must be \"${expected}\", the search cell and attempt it settled`,\n 'runId',\n )\n }\n}\n\nfunction validateTraceRef(value: unknown): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('traceRef must be an object', 'traceRef')\n }\n const ref = value as Record<string, unknown>\n expectString(ref.traceId, 'traceRef.traceId')\n if (ref.execRunId !== undefined) expectString(ref.execRunId, 'traceRef.execRunId')\n}\n\n/** Boolean validator — convenience for filtering arrays. */\nexport function isRunRecord(input: unknown): input is RunRecord {\n try {\n validateRunRecord(input)\n return true\n } catch {\n return false\n }\n}\n\n/** Non-throwing validator — returns a discriminated union. */\nexport function parseRunRecordSafe(\n input: unknown,\n): { ok: true; value: RunRecord } | { ok: false; error: RunRecordValidationError } {\n try {\n return { ok: true, value: validateRunRecord(input) }\n } catch (e) {\n if (e instanceof RunRecordValidationError) return { ok: false, error: e }\n throw e\n }\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new RunRecordValidationError(`expected non-empty string`, path)\n }\n}\n\nfunction expectFiniteNumber(value: unknown, path: string): void {\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new RunRecordValidationError(`expected finite number`, path)\n }\n}\n\nfunction expectNonNegativeNumber(value: unknown, path: string): void {\n expectFiniteNumber(value, path)\n if ((value as number) < 0) {\n throw new RunRecordValidationError('expected non-negative number', path)\n }\n}\n\nfunction validateJudgeScores(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('judgeScores must be an object', path)\n }\n const rec = value as Record<string, unknown>\n\n const perJudge = rec.perJudge\n if (perJudge === null || typeof perJudge !== 'object') {\n throw new RunRecordValidationError('perJudge must be an object', `${path}.perJudge`)\n }\n for (const [judgeId, dims] of Object.entries(perJudge as Record<string, unknown>)) {\n if (dims === null || typeof dims !== 'object') {\n throw new RunRecordValidationError(\n 'per-judge entry must be an object of dimension scores',\n `${path}.perJudge.${judgeId}`,\n )\n }\n for (const [dim, score] of Object.entries(dims as Record<string, unknown>)) {\n expectFiniteNumber(score, `${path}.perJudge.${judgeId}.${dim}`)\n }\n }\n\n const perDimMean = rec.perDimMean\n if (perDimMean === null || typeof perDimMean !== 'object') {\n throw new RunRecordValidationError('perDimMean must be an object', `${path}.perDimMean`)\n }\n for (const [dim, mean] of Object.entries(perDimMean as Record<string, unknown>)) {\n expectFiniteNumber(mean, `${path}.perDimMean.${dim}`)\n }\n\n expectFiniteNumber(rec.composite, `${path}.composite`)\n\n if (rec.failedJudges !== undefined) {\n if (!Array.isArray(rec.failedJudges)) {\n throw new RunRecordValidationError(\n 'failedJudges must be an array of strings',\n `${path}.failedJudges`,\n )\n }\n for (let i = 0; i < rec.failedJudges.length; i++) {\n const id = rec.failedJudges[i]\n if (typeof id !== 'string' || id.length === 0) {\n throw new RunRecordValidationError(\n 'failedJudges entry must be a non-empty string',\n `${path}.failedJudges[${i}]`,\n )\n }\n }\n }\n\n if (rec.notes !== undefined && typeof rec.notes !== 'string') {\n throw new RunRecordValidationError('notes must be a string', `${path}.notes`)\n }\n}\n\n/**\n * Snapshot check for provider model identifiers. Accepts ISO and compact\n * dates, Router's `-MMDD` snapshots, one opaque `@token`, and Vertex-style\n * `:date-token` suffixes. Routing selectors such as `@preset/name` are not\n * immutable model identities.\n */\nexport function modelHasSnapshot(model: string): boolean {\n if (model.length === 0 || model.trim() !== model) return false\n\n const opaqueAt = model.lastIndexOf('@')\n if (opaqueAt > 0) {\n const base = model.slice(0, opaqueAt)\n const token = model.slice(opaqueAt + 1)\n if (!base.includes('@') && /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/u.test(token)) {\n return true\n }\n }\n\n const isoDate = model.match(/-(\\d{4})-(\\d{2})-(\\d{2})$/u)\n if (isoDate && validSnapshotDate(isoDate[1]!, isoDate[2]!, isoDate[3]!)) return true\n\n const compactDate = model.match(/-(\\d{4})(\\d{2})(\\d{2})$/u)\n if (compactDate && validSnapshotDate(compactDate[1]!, compactDate[2]!, compactDate[3]!)) {\n return true\n }\n\n const routerDate = model.match(/-(\\d{2})(\\d{2})$/u)\n if (routerDate && validSnapshotDate(undefined, routerDate[1]!, routerDate[2]!)) return true\n\n return /:date-[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/u.test(model)\n}\n\nfunction validSnapshotDate(year: string | undefined, month: string, day: string): boolean {\n const monthNumber = Number(month)\n const dayNumber = Number(day)\n if (!Number.isInteger(monthNumber) || monthNumber < 1 || monthNumber > 12) return false\n\n const yearNumber = year === undefined ? undefined : Number(year)\n const leapYear =\n yearNumber === undefined ||\n (yearNumber % 4 === 0 && (yearNumber % 100 !== 0 || yearNumber % 400 === 0))\n const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return Number.isInteger(dayNumber) && dayNumber >= 1 && dayNumber <= daysInMonth[monthNumber - 1]!\n}\n"],"mappings":";;;;;;AAiDA,MAAa,gBAAgB;;;;;;AA8D7B,SAAgB,gBAAgB,QAAkE;CAChG,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO;AACpC;;;;;;;;;AA4LA,SAAgB,aAAa,QAAuC;CAClE,MAAM,QAAQ,cAAc,MAAM;CAClC,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;AAIA,MAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,aAAyC;CAAC;CAAU;CAAO;AAAS;AAC1E,MAAM,oBAAuD;CAC3D;CACA;CACA;CACA;CACA;AACF;AAEA,IAAa,2BAAb,cAA8C,gBAAgB;CAC5D;CACA,YAAY,SAAiB,OAAO,IAAI;EACtC,MAAM,OAAO,GAAG,QAAQ,OAAO,KAAK,KAAK,OAAO;EAChD,KAAK,OAAO;CACd;AACF;;;;;;AAOA,SAAgB,kBAAkB,OAA2B;CAC3D,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,MAAM,IAAI,yBAAyB,iBAAiB;CAEtD,MAAM,MAAM;CAEZ,KAAK,MAAM,OAAO,qBAChB,IAAI,EAAE,OAAO,MACX,MAAM,IAAI,yBAAyB,4BAA4B,IAAI,EAAE;CAIzE,aAAa,IAAI,OAAO,OAAO;CAC/B,aAAa,IAAI,cAAc,cAAc;CAC7C,aAAa,IAAI,aAAa,aAAa;CAC3C,mBAAmB,IAAI,MAAM,MAAM;CACnC,aAAa,IAA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QAAQ,EAAG,GAAG,OAAO;CAEhF,MAAM,cAAc,MAAM,MAAM,0BAA0B;CAC1D,IAAI,eAAe,kBAAkB,YAAY,IAAK,YAAY,IAAK,YAAY,EAAG,GACpF,OAAO;CAGT,MAAM,aAAa,MAAM,MAAM,mBAAmB;CAClD,IAAI,cAAc,kBAAkB,KAAA,GAAW,WAAW,IAAK,WAAW,EAAG,GAAG,OAAO;CAEvF,OAAO,qDAAqD,KAAK,KAAK;AACxE;AAEA,SAAS,kBAAkB,MAA0B,OAAe,KAAsB;CACxF,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,YAAY,OAAO,GAAG;CAC5B,IAAI,CAAC,OAAO,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc,IAAI,OAAO;CAElF,MAAM,aAAa,SAAS,KAAA,IAAY,KAAA,IAAY,OAAO,IAAI;CAI/D,MAAM,cAAc;EAAC;EAFnB,eAAe,KAAA,KACd,aAAa,MAAM,MAAM,aAAa,QAAQ,KAAK,aAAa,QAAQ,KACvC,KAAK;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;CAAE;CACnF,OAAO,OAAO,UAAU,SAAS,KAAK,aAAa,KAAK,aAAa,YAAY,cAAc;AACjG"}
|
package/dist/search/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as SearchLedgerHash, C as SearchEdgeOperator, G as SearchSplit, H as SearchProposerKind, I as SearchNodeStatus, L as SearchOpenedEvent, T as SearchEstimateMethod, W as SearchSourceRef, i as SearchArtifactRef, j as SearchModelIdentity, l as SearchCandidateSurface, m as SearchClaim, t as NodeEstimate, y as SearchCloseReason } from "../search-ledger-types-qiYRUo_N.js";
|
|
2
|
-
import { X as SearchStateView, st as SearchNode } from "../types-
|
|
3
|
-
import { $ as ExpansionOperator, I as SearchPolicy, R as SearchPolicyView, a as SearchArtifactCodec, at as OperatorYieldSignal, ct as LensSampleSummary, et as MIN_OUTCOMES_FOR_WEIGHT, h as SearchRunResult, i as RunSearchOptions, it as OperatorYieldRow, j as SearchUnitExtension, l as SearchLane, lt as LensSignal, nt as OperatorYieldData, ot as operatorYield, rt as OperatorYieldOptions, st as LensResult, tt as OperatorOutcomeCounts, ut as summarizeSamples } from "../search-kernel-
|
|
2
|
+
import { X as SearchStateView, st as SearchNode } from "../types-CBkDo7ja.js";
|
|
3
|
+
import { $ as ExpansionOperator, I as SearchPolicy, R as SearchPolicyView, a as SearchArtifactCodec, at as OperatorYieldSignal, ct as LensSampleSummary, et as MIN_OUTCOMES_FOR_WEIGHT, h as SearchRunResult, i as RunSearchOptions, it as OperatorYieldRow, j as SearchUnitExtension, l as SearchLane, lt as LensSignal, nt as OperatorYieldData, ot as operatorYield, rt as OperatorYieldOptions, st as LensResult, tt as OperatorOutcomeCounts, ut as summarizeSamples } from "../search-kernel-kwO-sgCq.js";
|
|
4
4
|
import { AgentProfileResourceRef } from "@tangle-network/agent-interface";
|
|
5
5
|
interface EditCreditOptions {
|
|
6
6
|
/**
|
package/dist/search/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as hashCanonical } from "../canonical-CicJlINA.js";
|
|
2
|
-
import { c as MIN_OUTCOMES_FOR_WEIGHT, f as summarizeSamples, i as runSearch, l as operatorYield } from "../pareto-
|
|
3
|
-
import { _ as vectorEmbedding, a as skillCalibration, b as editCreditText, c as META_SEARCH_SCORE_SOURCE, d as searchPolicyGenome, f as landscape, g as surfaceTextEdits, h as lineageEdits, i as nextUnitExtension, l as metaSearch, n as taskMatrix, o as skillManifold, p as draftOnPlateau, s as renderMetaSearchText, t as tree, u as metaSearchScore, v as front, y as editCredit } from "../tree-
|
|
2
|
+
import { c as MIN_OUTCOMES_FOR_WEIGHT, f as summarizeSamples, i as runSearch, l as operatorYield } from "../pareto-B34N-vnn.js";
|
|
3
|
+
import { _ as vectorEmbedding, a as skillCalibration, b as editCreditText, c as META_SEARCH_SCORE_SOURCE, d as searchPolicyGenome, f as landscape, g as surfaceTextEdits, h as lineageEdits, i as nextUnitExtension, l as metaSearch, n as taskMatrix, o as skillManifold, p as draftOnPlateau, s as renderMetaSearchText, t as tree, u as metaSearchScore, v as front, y as editCredit } from "../tree-DPwgM2LX.js";
|
|
4
4
|
// src/search/nested-search.ts
|
|
5
5
|
/** The deterministic id of the inner search one outer cell attempt runs. */
|
|
6
6
|
function nestedSearchId(containment) {
|
|
@@ -3,7 +3,7 @@ import { a as RunRecord } from "./run-record-D2BFMPGl.js";
|
|
|
3
3
|
import { a as PairedPromotionDecision } from "./paired-promotion-decision-BDnqepZ1.js";
|
|
4
4
|
import { A as SearchLedgerHash, C as SearchEdgeOperator, E as SearchExecutionIdentity, G as SearchSplit, H as SearchProposerKind, I as SearchNodeStatus, L as SearchOpenedEvent, N as SearchNodeDecision, O as SearchLedgerEntry, P as SearchNodeRef, Q as SearchTaskOutcome, R as SearchOperationKind, S as SearchEdgeAttribution, T as SearchEstimateMethod, U as SearchReservation, V as SearchProposer, W as SearchSourceRef, Y as SearchSurfaceEvidence, Z as SearchTask, _ as SearchClaimPower, a as SearchAttemptAccounting, et as SearchTraceRef, i as SearchArtifactRef, j as SearchModelIdentity, k as SearchLedgerEvent, l as SearchCandidateSurface, m as SearchClaim, nt as EvaluationClaim, o as SearchAudit, p as SearchCellStage, t as NodeEstimate, tt as SearchUnknown, y as SearchCloseReason, z as SearchOperationRecordedEvent } from "./search-ledger-types-qiYRUo_N.js";
|
|
5
5
|
import { C as LedgerTrustedHead, v as LedgerLineContext, w as LedgerTrustedHeadRemoval, x as LedgerTextStore } from "./index-B1Bm9oJA.js";
|
|
6
|
-
import { X as SearchStateView, dt as SearchUnitScore, j as MutableSurface, lt as SearchScoredCell, st as SearchNode } from "./types-
|
|
6
|
+
import { X as SearchStateView, dt as SearchUnitScore, j as MutableSurface, lt as SearchScoredCell, st as SearchNode } from "./types-CBkDo7ja.js";
|
|
7
7
|
/**
|
|
8
8
|
* `CampaignStorage` — the filesystem seam `runCampaign` writes through
|
|
9
9
|
* (run/cell dirs, the resumability cache, per-cell artifacts, trace spans).
|
|
@@ -1166,4 +1166,4 @@ declare function searchDivergence(state: SearchStateView, nodeId: string): {
|
|
|
1166
1166
|
/** Run a search to its close, or continue one from its ledger. */
|
|
1167
1167
|
declare function runSearch<TArtifact>(options: RunSearchOptions<TArtifact>): Promise<SearchRunResult>;
|
|
1168
1168
|
export { ExpansionOperator as $, SearchRungDecision as A, SearchHistoryReceipt as At, beam as B, openSearchLedger as Bt, searchClaimDecision as C, surfaceNode as Ct, SearchAllocationView as D, SearchHistoryCoverage as Dt, AshaOptions as E, SearchHistoryAuditSummary as Et, SearchExpansion as F, FileSearchLedger as Ft, NodePosterior as G, createRunCostLedger as Gt, incumbent as H, replaySearchLedgerText as Ht, SearchPolicy as I, OpenSearchLedgerOptions as It, estimateNode as J, SEARCH_ESTIMATOR as K, fsCampaignStorage as Kt, SearchPolicyNode as L, SearchLedger as Lt, asha as M, createSearchHistoryReceipt as Mt, uniform as N, verifySearchHistoryArtifact as Nt, SearchAllocator as O, SearchHistoryCoverageRow as Ot, AideOptions as P, verifySearchHistoryReceipt as Pt, searchPosterior as Q, SearchPolicyView as R, SearchLedgerAppendResult as Rt, planSearchClaim as S, surfaceDiff as St, verifySearchClaim as T, SearchHistoryAdmissionOptions as Tt, incumbentWithOperatorBandit as U, validateSearchLedgerEvent as Ut, crowdedFrontierParent as V, parseSearchLedgerLine as Vt, EstimateNodeCellsInput as W, CampaignStorage as Wt, searchCellSetDigest as X, estimateNodeFromCells as Y, searchEstimateMethod as Z, SEARCH_CLAIM_RULE as _, SearchRecorderOptions as _t, SearchArtifactCodec as a, OperatorYieldSignal as at, SearchClaimVerification as b, developmentClaim as bt, SearchExecutor as c, LensSampleSummary as ct, SearchProposalRequest as d, AllocateSearchCellInput as dt, MIN_OUTCOMES_FOR_WEIGHT as et, SearchProposalResult as f, RecordSearchEdgeInput as ft, PlanSearchClaimInput as g, SearchRecorder as gt, SearchRunResult as h, SearchOpening as ht, RunSearchOptions as i, OperatorYieldRow as it, SearchUnitExtension as j, assertSearchHistoryMatchesState as jt, SearchCellPlan as k, SearchHistoryPolicy as kt, SearchLane as l, LensSignal as lt, SearchProposerPort as m, SearchLedgerBinding as mt, searchDivergence as n, OperatorYieldData as nt, SearchCellResult as o, operatorYield as ot, SearchProposedChild as p, RegisterSearchNodeInput as pt, SearchPosterior as q, inMemoryCampaignStorage as qt, searchPolicyView as r, OperatorYieldOptions as rt, SearchCellWork as s, LensResult as st, runSearch as t, OperatorOutcomeCounts as tt, SearchProposalBlob as u, summarizeSamples as ut, SearchClaimDecision as v, SearchRunIdentity as vt, searchClaimReserveUsd as w, CreateSearchHistoryReceiptInput as wt, decideSearchClaim as x, searchEdgeId as xt, SearchClaimPlan as y, SettleSearchCellInput as yt, aide as z, SearchLedgerTrustedHeadMode as zt };
|
|
1169
|
-
//# sourceMappingURL=search-kernel-
|
|
1169
|
+
//# sourceMappingURL=search-kernel-kwO-sgCq.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-kernel-
|
|
1
|
+
{"version":3,"file":"search-kernel-kwO-sgCq.d.ts","names":[],"sources":["../src/campaign/storage.ts","../src/campaign/search-ledger.ts","../src/campaign/search-history-receipt.ts","../src/campaign/search-ledger-recording.ts","../src/search/lenses/shared.ts","../src/search/lenses/operator-yield.ts","../src/campaign/estimate-node.ts","../src/campaign/search-policy.ts","../src/campaign/allocation.ts","../src/campaign/search-claim.ts","../src/campaign/search-kernel-contract.ts","../src/campaign/search-kernel-policy-view.ts","../src/campaign/search-kernel.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoBiB;;;;WAIN;;EAET,UAAU;;EAEV,OAAO;;EAEP,KAAK;;EAEL,MAAM,cAAc,kBAAkB;;;EAGtC,OAAO,cAAc,iBAAiB;;;;;;;;;iBAUxB,qBAAqB;;;;iBA2CrB,2BAA2B;;iBAoC3B,oBAAoB;EAClC,SAAS;EACT;EACA;;EA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O;;;EAGP;EACA,QAAQ;;EAER,OAAO;;;;EAIP,mBAAmB;;;UAIJ;EACf;EACA,UAAU;EACV;EACA;IAAa;IAAc,UAAU;;EACrC,UAAU;IACR,MAAM;IACN,OAAO,MAAM,oBAAoB;IACjC;IACA;IACA,aAAa,SAAS;IACtB;;;;;;;;;;;iBChOY,iBACd,OAAO,iBACP;EACE;EACA;EACA;EACA;IAED;;;;;;;;iBA4Fa,iBACd,OAAO,iBACP;EACG,OAAO;EAAc;;;iBCnEJ,UAAU,WAC9B,SAAS,iBAAiB,aACzB,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as hashCanonical, i as compareCodeUnits, r as canonicalString } from "./canonical-CicJlINA.js";
|
|
2
|
-
import { i as modelHasSnapshot, s as searchCellRunId } from "./run-record-
|
|
2
|
+
import { i as modelHasSnapshot, s as searchCellRunId } from "./run-record-CpLS4Uid.js";
|
|
3
3
|
import { n as MemoryLedgerJournal, r as replayLedgerText, t as FileLedgerJournal } from "./journal-C1uLJi0w.js";
|
|
4
4
|
import "./ledger-core-CfT-FzPf.js";
|
|
5
5
|
import { a as SearchLedgerError, i as SearchLedgerConflictError, o as SearchLedgerIntegrityError, t as SEARCH_LEDGER_FILE_CONTEXT } from "./search-ledger-file-DTBD6X-y.js";
|
|
@@ -1580,4 +1580,4 @@ function formatZodError(error) {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
export { validateSearchLedgerEvent as a, SearchStateView as c, searchNodeId as d, searchTaskSetDigest as f, replaySearchLedgerText as i, searchUnitScores as l, openSearchLedger as n, SEARCH_LEDGER_SCHEMA as o, USD_TOLERANCE as p, parseSearchLedgerLine as r, SearchState as s, FileSearchLedger as t, searchCellId as u };
|
|
1582
1582
|
|
|
1583
|
-
//# sourceMappingURL=search-ledger-
|
|
1583
|
+
//# sourceMappingURL=search-ledger-CV_bQQed.js.map
|