@tangle-network/agent-eval 0.221.8 → 0.222.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +168 -0
- package/dist/adapters/http.d.ts +3 -5
- package/dist/adapters/http.d.ts.map +1 -1
- package/dist/adapters/http.js +1 -2
- package/dist/{adversarial-smnADNFS.d.ts → adversarial-DnQQFqTR.d.ts} +1 -3
- package/dist/adversarial-DnQQFqTR.d.ts.map +1 -0
- package/dist/{agent-profile-CNmwfaqq.d.ts → agent-profile-CSEQRC9l.d.ts} +4 -10
- package/dist/agent-profile-CSEQRC9l.d.ts.map +1 -0
- package/dist/agent-profile-Dngk3LZ0.js +153 -0
- package/dist/agent-profile-Dngk3LZ0.js.map +1 -0
- package/dist/{agent-profile-cell-BcpFbNd5.d.ts → agent-profile-cell-3kYxUsK2.d.ts} +3 -5
- package/dist/agent-profile-cell-3kYxUsK2.d.ts.map +1 -0
- package/dist/{agent-profile-cell-B1V1gUZs.js → agent-profile-cell-CT5JYueM.js} +5 -7
- package/dist/{agent-profile-cell-B1V1gUZs.js.map → agent-profile-cell-CT5JYueM.js.map} +1 -1
- package/dist/{agreement-irr-BhAqjluA.js → agreement-irr-BTjDN0i6.js} +4 -5
- package/dist/{agreement-irr-BhAqjluA.js.map → agreement-irr-BTjDN0i6.js.map} +1 -1
- package/dist/analyst/index.d.ts +95 -159
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +28 -39
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-DfX6dHP0.d.ts → analyze-runs-CGLRgZGd.d.ts} +7 -13
- package/dist/analyze-runs-CGLRgZGd.d.ts.map +1 -0
- package/dist/{analyze-runs-CHmsykNJ.js → analyze-runs-CTheASYV.js} +23 -32
- package/dist/{analyze-runs-CHmsykNJ.js.map → analyze-runs-CTheASYV.js.map} +1 -1
- package/dist/{attribute-vocabulary-CcXqHODT.d.ts → attribute-vocabulary-5oo8ykIx.d.ts} +2 -4
- package/dist/attribute-vocabulary-5oo8ykIx.d.ts.map +1 -0
- package/dist/authenticity/index.d.ts +0 -2
- package/dist/authenticity/index.d.ts.map +1 -1
- package/dist/authenticity/index.js +1 -2
- package/dist/{benchmark-command-Cnjfo0Zh.js → benchmark-command-Cr7i7YSX.js} +61 -94
- package/dist/benchmark-command-Cr7i7YSX.js.map +1 -0
- package/dist/benchmarks/index.d.ts +5 -15
- package/dist/benchmarks/index.d.ts.map +1 -1
- package/dist/benchmarks/index.js +27 -38
- package/dist/benchmarks/index.js.map +1 -1
- package/dist/{bounded-process-Cj9YjXbE.js → bounded-process-BZrWXIKW.js} +2 -3
- package/dist/{bounded-process-Cj9YjXbE.js.map → bounded-process-BZrWXIKW.js.map} +1 -1
- package/dist/builder-eval/index.d.ts +5 -14
- package/dist/builder-eval/index.d.ts.map +1 -1
- package/dist/builder-eval/index.js +11 -17
- package/dist/builder-eval/index.js.map +1 -1
- package/dist/{calibration-CTwxpJ-t.js → calibration-6usfVYYo.js} +4 -5
- package/dist/{calibration-CTwxpJ-t.js.map → calibration-6usfVYYo.js.map} +1 -1
- package/dist/campaign/index.d.ts +9 -9
- package/dist/campaign/index.js +15 -14
- package/dist/{campaign-uddTlFg5.js → campaign-ddr1N3yD.js} +61 -58
- package/dist/campaign-ddr1N3yD.js.map +1 -0
- package/dist/{campaign-evidence-DunzcJGv.js → campaign-evidence-DN8rWuBj.js} +20 -322
- package/dist/campaign-evidence-DN8rWuBj.js.map +1 -0
- package/dist/{canonical-Dq2hOQ8L.js → canonical-CicJlINA.js} +3 -4
- package/dist/{canonical-Dq2hOQ8L.js.map → canonical-CicJlINA.js.map} +1 -1
- package/dist/{canonical-CFpojCN5.d.ts → canonical-gLeHiqzd.d.ts} +2 -4
- package/dist/canonical-gLeHiqzd.d.ts.map +1 -0
- package/dist/{cell-spend-DEWR3nj-.js → cell-spend-zxmzg4GH.js} +3 -4
- package/dist/{cell-spend-DEWR3nj-.js.map → cell-spend-zxmzg4GH.js.map} +1 -1
- package/dist/{chat-client-BNATB3rJ.js → chat-client-CO3uB33i.js} +3 -4
- package/dist/{chat-client-BNATB3rJ.js.map → chat-client-CO3uB33i.js.map} +1 -1
- package/dist/{chat-json-call-BzWYp18J.js → chat-json-call-8yUv4LFO.js} +4 -5
- package/dist/{chat-json-call-BzWYp18J.js.map → chat-json-call-8yUv4LFO.js.map} +1 -1
- package/dist/{claim-BPVuyHuy.js → claim-Dod_mjk3.js} +5 -6
- package/dist/{claim-BPVuyHuy.js.map → claim-Dod_mjk3.js.map} +1 -1
- package/dist/cli.js +179 -23
- package/dist/cli.js.map +1 -1
- package/dist/{client-hwo3cJjR.d.ts → client-BIFwUg7I.d.ts} +6 -12
- package/dist/client-BIFwUg7I.d.ts.map +1 -0
- package/dist/{cluster-bootstrap-DEwwhl0C.js → cluster-bootstrap-SbaeM44s.js} +4 -5
- package/dist/{cluster-bootstrap-DEwwhl0C.js.map → cluster-bootstrap-SbaeM44s.js.map} +1 -1
- package/dist/completion-verifier-7KEfroqx.d.ts +168 -0
- package/dist/completion-verifier-7KEfroqx.d.ts.map +1 -0
- package/dist/{completion-verifier-asaV1nSj.js → completion-verifier-rqbMh5-4.js} +9 -160
- package/dist/completion-verifier-rqbMh5-4.js.map +1 -0
- package/dist/contract/index.d.ts +13 -13
- package/dist/contract/index.js +41 -60
- package/dist/contract/index.js.map +1 -1
- package/dist/{cost-ledger-BGZB6yY2.js → cost-ledger-CS8R3IZj.js} +10 -17
- package/dist/{cost-ledger-BGZB6yY2.js.map → cost-ledger-CS8R3IZj.js.map} +1 -1
- package/dist/{cost-ledger-C1W3ICmP.d.ts → cost-ledger-Czro9wmo.d.ts} +1 -5
- package/dist/cost-ledger-Czro9wmo.d.ts.map +1 -0
- package/dist/{dataset-DQqhOCPt.d.ts → dataset-DThC1S6G.d.ts} +1 -3
- package/dist/dataset-DThC1S6G.d.ts.map +1 -0
- package/dist/{decision-point-0nJubuoM.js → decision-point-lhMgODOR.js} +14 -18
- package/dist/{decision-point-0nJubuoM.js.map → decision-point-lhMgODOR.js.map} +1 -1
- package/dist/{deep-freeze-CurcOQg3.js → deep-freeze-CK8-2W7p.js} +2 -3
- package/dist/{deep-freeze-CurcOQg3.js.map → deep-freeze-CK8-2W7p.js.map} +1 -1
- package/dist/{default-registry-CLG5YqGS.d.ts → default-registry-1f4ukAIX.d.ts} +53 -61
- package/dist/default-registry-1f4ukAIX.d.ts.map +1 -0
- package/dist/{default-registry-BBTDgkDM.js → default-registry-C1tPEjZ4.js} +29 -45
- package/dist/{default-registry-BBTDgkDM.js.map → default-registry-C1tPEjZ4.js.map} +1 -1
- package/dist/{define-agent-eval-CCbT7Kfr.js → define-agent-eval-BLoP4Lf9.js} +15 -18
- package/dist/{define-agent-eval-CCbT7Kfr.js.map → define-agent-eval-BLoP4Lf9.js.map} +1 -1
- package/dist/{define-agent-eval-JKt3gMQr.d.ts → define-agent-eval-sUYh9BFA.d.ts} +19 -27
- package/dist/define-agent-eval-sUYh9BFA.d.ts.map +1 -0
- package/dist/{descriptive-CVNy48rR.js → descriptive-cPwITVfy.js} +30 -8
- package/dist/descriptive-cPwITVfy.js.map +1 -0
- package/dist/diagnosis/index.d.ts +5 -15
- package/dist/diagnosis/index.d.ts.map +1 -1
- package/dist/diagnosis/index.js +13 -19
- package/dist/diagnosis/index.js.map +1 -1
- package/dist/{dspy-rlm-engine-DN1p_5jx.js → dspy-rlm-engine-jDiWkul6.js} +7 -10
- package/dist/{dspy-rlm-engine-DN1p_5jx.js.map → dspy-rlm-engine-jDiWkul6.js.map} +1 -1
- package/dist/{emitter-DbMXUIVP.js → emitter-DhQ65mza.js} +3 -4
- package/dist/{emitter-DbMXUIVP.js.map → emitter-DhQ65mza.js.map} +1 -1
- package/dist/{emitter-DABYYTcH.d.ts → emitter-mAXC5PSN.d.ts} +3 -5
- package/dist/emitter-mAXC5PSN.d.ts.map +1 -0
- package/dist/{engine-dtRVeuQs.d.ts → engine-BITiErg-.d.ts} +10 -18
- package/dist/engine-BITiErg-.d.ts.map +1 -0
- package/dist/{equal-terms-DbPGcVtI.js → equal-terms-K11VHmR3.js} +3 -4
- package/dist/{equal-terms-DbPGcVtI.js.map → equal-terms-K11VHmR3.js.map} +1 -1
- package/dist/{errors-BcOs5MKW.js → errors-DeEEV9Vx.js} +2 -3
- package/dist/{errors-BcOs5MKW.js.map → errors-DeEEV9Vx.js.map} +1 -1
- package/dist/{errors-DEE6u6ot.d.ts → errors-E9I2hldP.d.ts} +1 -3
- package/dist/errors-E9I2hldP.d.ts.map +1 -0
- package/dist/{eval-campaign-DoX5vz3E.js → eval-campaign-Cgixrvf7.js} +8 -9
- package/dist/{eval-campaign-DoX5vz3E.js.map → eval-campaign-Cgixrvf7.js.map} +1 -1
- package/dist/{evaluation-wdGyZ7jV.js → evaluation-B8H3GYej.js} +4 -6
- package/dist/{evaluation-wdGyZ7jV.js.map → evaluation-B8H3GYej.js.map} +1 -1
- package/dist/{evaluation-DblGquCB.d.ts → evaluation-Djq7-Ybj.d.ts} +4 -6
- package/dist/evaluation-Djq7-Ybj.d.ts.map +1 -0
- package/dist/evaluation.d.ts +1 -1
- package/dist/evaluation.js +1 -2
- package/dist/{exact-types-Do63KoKn.d.ts → exact-types-CndDT_h7.d.ts} +8 -10
- package/dist/exact-types-CndDT_h7.d.ts.map +1 -0
- package/dist/{exec-CpbtOXVt.js → exec-C0_AkLUv.js} +3 -5
- package/dist/{exec-CpbtOXVt.js.map → exec-C0_AkLUv.js.map} +1 -1
- package/dist/{execution-tracks-CpgFPpS5.js → execution-tracks-DaDXYwAq.js} +2 -3
- package/dist/{execution-tracks-CpgFPpS5.js.map → execution-tracks-DaDXYwAq.js.map} +1 -1
- package/dist/experiment/index.d.ts +9 -37
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +29 -40
- package/dist/experiment/index.js.map +1 -1
- package/dist/{exporters-Dk3oEbK_.d.ts → exporters-B5Ze_RKh.d.ts} +4 -4
- package/dist/exporters-B5Ze_RKh.d.ts.map +1 -0
- package/dist/{exporters-DWvM16LE.js → exporters-ByLcILYU.js} +23 -5
- package/dist/exporters-ByLcILYU.js.map +1 -0
- package/dist/{external-optimizer-process-DEzJ2CGX.js → external-optimizer-process-BRVmaDFe.js} +5 -6
- package/dist/{external-optimizer-process-DEzJ2CGX.js.map → external-optimizer-process-BRVmaDFe.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-B_ukPtRD.js → external-optimizer-subprocess-U616hV_l.js} +24 -37
- package/dist/{external-optimizer-subprocess-B_ukPtRD.js.map → external-optimizer-subprocess-U616hV_l.js.map} +1 -1
- package/dist/{extract-usage-BZLU01kR.js → extract-usage-ISFqhfDz.js} +2 -3
- package/dist/{extract-usage-BZLU01kR.js.map → extract-usage-ISFqhfDz.js.map} +1 -1
- package/dist/{failure-cluster-DN0t63Z0.d.ts → failure-cluster-DOoa7CBg.d.ts} +3 -7
- package/dist/failure-cluster-DOoa7CBg.d.ts.map +1 -0
- package/dist/{failure-taxonomy-Bx5oWqaW.js → failure-taxonomy-9eQfXKoW.js} +2 -3
- package/dist/{failure-taxonomy-Bx5oWqaW.js.map → failure-taxonomy-9eQfXKoW.js.map} +1 -1
- package/dist/{feedback-trajectory-CYVJXolG.d.ts → feedback-trajectory-DsHR9krG.d.ts} +7 -13
- package/dist/feedback-trajectory-DsHR9krG.d.ts.map +1 -0
- package/dist/{finding-composition-8n0fFgVI.js → finding-composition-DlvE1Qul.js} +4 -6
- package/dist/{finding-composition-8n0fFgVI.js.map → finding-composition-DlvE1Qul.js.map} +1 -1
- package/dist/{findings-store-Bg4sdS-e.js → findings-store-B75Dspaq.js} +11 -14
- package/dist/{findings-store-Bg4sdS-e.js.map → findings-store-B75Dspaq.js.map} +1 -1
- package/dist/fuzz.d.ts +3 -17
- package/dist/fuzz.d.ts.map +1 -1
- package/dist/fuzz.js +30 -29
- package/dist/fuzz.js.map +1 -1
- package/dist/{hf-dataset-CKxIJQba.js → hf-dataset-DPVQXW5n.js} +362 -21
- package/dist/hf-dataset-DPVQXW5n.js.map +1 -0
- package/dist/hosted/index.d.ts +2 -6
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +1 -2
- package/dist/{index-CalAsXMR.d.ts → index-B1Bm9oJA.d.ts} +3 -15
- package/dist/index-B1Bm9oJA.d.ts.map +1 -0
- package/dist/{index-D7fmC-1K.d.ts → index-BdKzYYkC.d.ts} +183 -36
- package/dist/index-BdKzYYkC.d.ts.map +1 -0
- package/dist/{index-CdEVr8-O.d.ts → index-Bdcpx2s8.d.ts} +24 -299
- package/dist/index-Bdcpx2s8.d.ts.map +1 -0
- package/dist/{index-jnuFLxOs.d.ts → index-Cu12qxJb.d.ts} +11 -39
- package/dist/index-Cu12qxJb.d.ts.map +1 -0
- package/dist/{index-CfJULcW5.d.ts → index-DAk2quYu.d.ts} +18 -38
- package/dist/index-DAk2quYu.d.ts.map +1 -0
- package/dist/{index-CHxwfW5g.d.ts → index-DwUGehqX.d.ts} +3 -9
- package/dist/index-DwUGehqX.d.ts.map +1 -0
- package/dist/{index-CTIRz-AB.d.ts → index-IzWTz5EP.d.ts} +14 -36
- package/dist/index-IzWTz5EP.d.ts.map +1 -0
- package/dist/index.d.ts +55 -188
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -195
- package/dist/index.js.map +1 -1
- package/dist/{integrity-D-s2iHiT.js → integrity-B1V6klyO.js} +12 -363
- package/dist/integrity-B1V6klyO.js.map +1 -0
- package/dist/{integrity-D9lBnv_K.d.ts → integrity-BAdVzT8u.d.ts} +4 -6
- package/dist/integrity-BAdVzT8u.d.ts.map +1 -0
- package/dist/{integrity-W4CADcFc.js → integrity-DOHt1mwU.js} +3 -4
- package/dist/{integrity-W4CADcFc.js.map → integrity-DOHt1mwU.js.map} +1 -1
- package/dist/{internal-BTK91Bqt.js → internal-v6XfOeJW.js} +6 -8
- package/dist/{internal-BTK91Bqt.js.map → internal-v6XfOeJW.js.map} +1 -1
- package/dist/{interval-Dq9gt7jx.js → interval-Bd2f4CRT.js} +6 -8
- package/dist/{interval-Dq9gt7jx.js.map → interval-Bd2f4CRT.js.map} +1 -1
- package/dist/{interval-ohuOJurX.d.ts → interval-CWyxqDpE.d.ts} +1 -5
- package/dist/interval-CWyxqDpE.d.ts.map +1 -0
- package/dist/{journal-C7om8Gum.js → journal-C1uLJi0w.js} +115 -121
- package/dist/{journal-C7om8Gum.js.map → journal-C1uLJi0w.js.map} +1 -1
- package/dist/{json-BhdsJaOQ.js → json-DtvZNAU9.js} +4 -6
- package/dist/{json-BhdsJaOQ.js.map → json-DtvZNAU9.js.map} +1 -1
- package/dist/json-recovery-DK4MDm5r.js +296 -0
- package/dist/json-recovery-DK4MDm5r.js.map +1 -0
- package/dist/{judge-calibration-BkXMIWA4.js → judge-calibration-DGqlfWW8.js} +5 -6
- package/dist/{judge-calibration-BkXMIWA4.js.map → judge-calibration-DGqlfWW8.js.map} +1 -1
- package/dist/{judge-calibration-DFtEMlde.d.ts → judge-calibration-DnrbQaXI.d.ts} +1 -3
- package/dist/judge-calibration-DnrbQaXI.d.ts.map +1 -0
- package/dist/{judge-gate-BVvmP00P.js → judge-gate-C2BCOt-M.js} +8 -12
- package/dist/{judge-gate-BVvmP00P.js.map → judge-gate-C2BCOt-M.js.map} +1 -1
- package/dist/judges-BLxg5p8E.js +20 -0
- package/dist/judges-BLxg5p8E.js.map +1 -0
- package/dist/{kind-factory-Dl0PmNQL.js → kind-factory-VKysp1ds.js} +23 -39
- package/dist/{kind-factory-Dl0PmNQL.js.map → kind-factory-VKysp1ds.js.map} +1 -1
- package/dist/ledger-core/index.d.ts +2 -2
- package/dist/ledger-core/index.js +3 -3
- package/dist/ledger-core/lock-holder.d.ts +1 -1
- package/dist/ledger-core/lock-holder.js +1 -2
- package/dist/{ledger-core-CAxUdDk0.js → ledger-core-CfT-FzPf.js} +5 -6
- package/dist/{ledger-core-CAxUdDk0.js.map → ledger-core-CfT-FzPf.js.map} +1 -1
- package/dist/{llm-client-b1ysZVIU.js → llm-client-kJ9EOqjt.js} +22 -30
- package/dist/{llm-client-b1ysZVIU.js.map → llm-client-kJ9EOqjt.js.map} +1 -1
- package/dist/{llm-judge-Cybq29bL.js → llm-judge-cgbhTKQp.js} +108 -164
- package/dist/llm-judge-cgbhTKQp.js.map +1 -0
- package/dist/{lock-holder-DaJbfpci.d.ts → lock-holder-DoxlZFkQ.d.ts} +1 -3
- package/dist/lock-holder-DoxlZFkQ.d.ts.map +1 -0
- package/dist/matrix/index.d.ts +3 -3
- package/dist/matrix/index.js +2 -2
- package/dist/{matrix-DtkZLD_3.d.ts → matrix-8X6i5kJ6.d.ts} +4 -12
- package/dist/matrix-8X6i5kJ6.d.ts.map +1 -0
- package/dist/{matrix-B8l-Nsxd.js → matrix-CgpX8wdm.js} +8 -13
- package/dist/matrix-CgpX8wdm.js.map +1 -0
- package/dist/{mean-BbA_JCzW.js → mean-CdDYG-us.js} +6 -9
- package/dist/{mean-BbA_JCzW.js.map → mean-CdDYG-us.js.map} +1 -1
- package/dist/meta-eval/index.d.ts +3 -3
- package/dist/meta-eval/index.js +17 -21
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/{metrics-BKaPBtIG.js → metrics-DNCAUtuB.js} +2 -3
- package/dist/{metrics-BKaPBtIG.js.map → metrics-DNCAUtuB.js.map} +1 -1
- package/dist/{mint-CbdwjTPW.js → mint-D9ZysYtY.js} +7 -8
- package/dist/{mint-CbdwjTPW.js.map → mint-D9ZysYtY.js.map} +1 -1
- package/dist/{multi-layer-verifier-DEgMUk6v.d.ts → multi-layer-verifier-lM4aVN78.d.ts} +2 -4
- package/dist/multi-layer-verifier-lM4aVN78.d.ts.map +1 -0
- package/dist/{multiplicity-Sg0U7h8j.js → multiplicity-DAd4xaDC.js} +3 -4
- package/dist/{multiplicity-Sg0U7h8j.js.map → multiplicity-DAd4xaDC.js.map} +1 -1
- package/dist/{multiplicity-DIWHvysC.d.ts → multiplicity-D_SEsc5j.d.ts} +1 -3
- package/dist/multiplicity-D_SEsc5j.d.ts.map +1 -0
- package/dist/multishot/golden/index.d.ts +1 -17
- package/dist/multishot/golden/index.d.ts.map +1 -1
- package/dist/multishot/golden/index.js +10 -17
- package/dist/multishot/golden/index.js.map +1 -1
- package/dist/multishot/index.d.ts +2 -10
- package/dist/multishot/index.d.ts.map +1 -1
- package/dist/multishot/index.js +11 -18
- package/dist/multishot/index.js.map +1 -1
- package/dist/{nonnegative-number-DvdMxg_f.js → nonnegative-number-lEYbOsuh.js} +2 -3
- package/dist/{nonnegative-number-DvdMxg_f.js.map → nonnegative-number-lEYbOsuh.js.map} +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{otel-spans-64hmQqON.js → otel-spans-BsGzTWIK.js} +5 -6
- package/dist/{otel-spans-64hmQqON.js.map → otel-spans-BsGzTWIK.js.map} +1 -1
- package/dist/{otlp-attributes-D9ptWaIJ.js → otlp-attributes-Boeb7gtH.js} +2 -3
- package/dist/{otlp-attributes-D9ptWaIJ.js.map → otlp-attributes-Boeb7gtH.js.map} +1 -1
- package/dist/{outcome-observations-FLmRpgYa.js → outcome-observations-D4snOtUb.js} +4 -5
- package/dist/{outcome-observations-FLmRpgYa.js.map → outcome-observations-D4snOtUb.js.map} +1 -1
- package/dist/{outcome-store-DUcMj-3D.js → outcome-store-TarrcfHG.js} +2 -3
- package/dist/{outcome-store-DUcMj-3D.js.map → outcome-store-TarrcfHG.js.map} +1 -1
- package/dist/{package-version-D7lQHt_-.js → package-version-CJl_pY9W.js} +2 -3
- package/dist/{package-version-D7lQHt_-.js.map → package-version-CJl_pY9W.js.map} +1 -1
- package/dist/{paired-arms-B2ttLc0_.js → paired-arms-D-54hO-k.js} +10 -14
- package/dist/{paired-arms-B2ttLc0_.js.map → paired-arms-D-54hO-k.js.map} +1 -1
- package/dist/{paired-binary-B_nejA44.js → paired-binary-BR0nwHOA.js} +3 -4
- package/dist/{paired-binary-B_nejA44.js.map → paired-binary-BR0nwHOA.js.map} +1 -1
- package/dist/{paired-promotion-decision-CQMJ5xGN.d.ts → paired-promotion-decision-BDnqepZ1.d.ts} +1 -5
- package/dist/paired-promotion-decision-BDnqepZ1.d.ts.map +1 -0
- package/dist/{paired-promotion-decision-D0SHb-ZL.js → paired-promotion-decision-FGvHA4p_.js} +5 -7
- package/dist/{paired-promotion-decision-D0SHb-ZL.js.map → paired-promotion-decision-FGvHA4p_.js.map} +1 -1
- package/dist/{pareto-BiBnQXAE.js → pareto-B9udAt2i.js} +28 -50
- package/dist/pareto-B9udAt2i.js.map +1 -0
- package/dist/pipelines/index.d.ts +5 -11
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +6 -8
- package/dist/pipelines/index.js.map +1 -1
- package/dist/{power-and-mde-CQX-0weG.js → power-and-mde-ClI6RWw4.js} +4 -5
- package/dist/{power-and-mde-CQX-0weG.js.map → power-and-mde-ClI6RWw4.js.map} +1 -1
- package/dist/{predicate-FdKmElA_.js → predicate-BYHA4MBn.js} +2 -3
- package/dist/{predicate-FdKmElA_.js.map → predicate-BYHA4MBn.js.map} +1 -1
- package/dist/{prime-bridge-transport-6feEglLf.d.ts → prime-bridge-transport-Cfqir_Im.d.ts} +1 -3
- package/dist/prime-bridge-transport-Cfqir_Im.d.ts.map +1 -0
- package/dist/{prime-bridge-transport-Z3cpKGoV.js → prime-bridge-transport-Csd5SQg7.js} +2 -3
- package/dist/{prime-bridge-transport-Z3cpKGoV.js.map → prime-bridge-transport-Csd5SQg7.js.map} +1 -1
- package/dist/{prime-protocol-BGxjfhM4.d.ts → prime-protocol-BpQlTowq.d.ts} +4 -8
- package/dist/prime-protocol-BpQlTowq.d.ts.map +1 -0
- package/dist/{prime-protocol-BFgGrEMP.js → prime-protocol-CrhpXRz9.js} +4 -6
- package/dist/{prime-protocol-BFgGrEMP.js.map → prime-protocol-CrhpXRz9.js.map} +1 -1
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +1 -2
- package/dist/{promotion-gate-CkVZHagC.d.ts → promotion-gate-CixshGI8.d.ts} +5 -11
- package/dist/promotion-gate-CixshGI8.d.ts.map +1 -0
- package/dist/{promotion-policy-6A8osGr_.js → promotion-policy-CBYeD4zi.js} +5 -6
- package/dist/{promotion-policy-6A8osGr_.js.map → promotion-policy-CBYeD4zi.js.map} +1 -1
- package/dist/{proposal-findings-DqLUWsAG.js → proposal-findings-WFQrxnfe.js} +3 -4
- package/dist/{proposal-findings-DqLUWsAG.js.map → proposal-findings-WFQrxnfe.js.map} +1 -1
- package/dist/{quantile--0yb07pD.js → quantile-CncXP-Ss.js} +2 -3
- package/dist/{quantile--0yb07pD.js.map → quantile-CncXP-Ss.js.map} +1 -1
- package/dist/{query-B_RZ36an.js → query-CGXzO9d4.js} +5 -6
- package/dist/{query-B_RZ36an.js.map → query-CGXzO9d4.js.map} +1 -1
- package/dist/{query-Cmv_U8vf.d.ts → query-UD0B08Sb.d.ts} +4 -6
- package/dist/query-UD0B08Sb.d.ts.map +1 -0
- package/dist/{random-DGEyr3zG.d.ts → random-BN150Q_X.d.ts} +1 -5
- package/dist/random-BN150Q_X.d.ts.map +1 -0
- package/dist/{random-DDDcC7YU.js → random-DrzcgC7F.js} +3 -4
- package/dist/{random-DDDcC7YU.js.map → random-DrzcgC7F.js.map} +1 -1
- package/dist/{raw-provider-sink-75w4FWBj.js → raw-provider-sink-DDLkP_eF.js} +3 -4
- package/dist/{raw-provider-sink-75w4FWBj.js.map → raw-provider-sink-DDLkP_eF.js.map} +1 -1
- package/dist/{record-id-DUgsK5qp.js → record-id-CWZXFh58.js} +2 -3
- package/dist/{record-id-DUgsK5qp.js.map → record-id-CWZXFh58.js.map} +1 -1
- package/dist/{redact-DXdlFb_U.d.ts → redact-C_wzC4c_.d.ts} +1 -3
- package/dist/redact-C_wzC4c_.d.ts.map +1 -0
- package/dist/{redact-mtkTiJVk.js → redact-D6APJS1d.js} +3 -5
- package/dist/{redact-mtkTiJVk.js.map → redact-D6APJS1d.js.map} +1 -1
- package/dist/{registry-BcdJmyoU.d.ts → registry-D9A7Tybn.d.ts} +5 -11
- package/dist/registry-D9A7Tybn.d.ts.map +1 -0
- package/dist/{release-confidence-CYIFH-fp.js → release-confidence-CTUJz5mM.js} +10 -16
- package/dist/release-confidence-CTUJz5mM.js.map +1 -0
- package/dist/{render-BhJqXoBH.js → render-pfAZ7IR4.js} +266 -33
- package/dist/render-pfAZ7IR4.js.map +1 -0
- package/dist/{reporting-html-Kvlc8oMt.js → reporting-html-DMXIjATy.js} +2 -3
- package/dist/{reporting-html-Kvlc8oMt.js.map → reporting-html-DMXIjATy.js.map} +1 -1
- package/dist/reporting.d.ts +6 -6
- package/dist/reporting.js +7 -7
- package/dist/{researcher-DKWtoMWk.d.ts → researcher-CLnNJ7Or.d.ts} +8 -12
- package/dist/researcher-CLnNJ7Or.d.ts.map +1 -0
- package/dist/{reward-nw2xZGZG.js → reward-P0VD_Aft.js} +2 -3
- package/dist/{reward-nw2xZGZG.js.map → reward-P0VD_Aft.js.map} +1 -1
- package/dist/{reward-BeUgVVC_.d.ts → reward-ST4PXNXF.d.ts} +2 -4
- package/dist/reward-ST4PXNXF.d.ts.map +1 -0
- package/dist/{reward-hacking-WTxUbtbb.d.ts → reward-hacking-C9hPVT0Q.d.ts} +4 -8
- package/dist/reward-hacking-C9hPVT0Q.d.ts.map +1 -0
- package/dist/{reward-hacking-ByuETaIb.js → reward-hacking-DZzHZlS1.js} +5 -7
- package/dist/{reward-hacking-ByuETaIb.js.map → reward-hacking-DZzHZlS1.js.map} +1 -1
- package/dist/rl.d.ts +26 -63
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +35 -52
- package/dist/rl.js.map +1 -1
- package/dist/{rolldown-runtime-8H4AJuhK.js → rolldown-runtime-BJohB4LM.js} +1 -2
- package/dist/rollout/index.d.ts +6 -6
- package/dist/rollout/index.js +7 -7
- package/dist/{rollout-Dd1ucT_M.js → rollout-BhkMpAJT.js} +279 -16
- package/dist/rollout-BhkMpAJT.js.map +1 -0
- package/dist/{terminal-record-CB9BFtjS.js → rollout-nodes-BHR9Q5jP.js} +351 -11
- package/dist/rollout-nodes-BHR9Q5jP.js.map +1 -0
- package/dist/{round-decimal-COrKglMh.js → round-decimal-ZmjAQPo1.js} +2 -3
- package/dist/{round-decimal-COrKglMh.js.map → round-decimal-ZmjAQPo1.js.map} +1 -1
- package/dist/{rubric-predictive-validity-Cd5SCtAf.d.ts → rubric-predictive-validity-B3RzbwOx.d.ts} +2 -8
- package/dist/rubric-predictive-validity-B3RzbwOx.d.ts.map +1 -0
- package/dist/{rubric-predictive-validity-CeKW2GQN.js → rubric-predictive-validity-CQp_M0vy.js} +3 -4
- package/dist/{rubric-predictive-validity-CeKW2GQN.js.map → rubric-predictive-validity-CQp_M0vy.js.map} +1 -1
- package/dist/{run-record-CysKLB93.js → run-record-CZy4-TnZ.js} +4 -5
- package/dist/{run-record-CysKLB93.js.map → run-record-CZy4-TnZ.js.map} +1 -1
- package/dist/{run-record-C3awiXPf.d.ts → run-record-D2BFMPGl.d.ts} +5 -7
- package/dist/run-record-D2BFMPGl.d.ts.map +1 -0
- package/dist/{run-record-DhEJgoPz.js → run-record-DEjx43cI.js} +6 -7
- package/dist/{run-record-DhEJgoPz.js.map → run-record-DEjx43cI.js.map} +1 -1
- package/dist/{sandbox-harness-BlSOu4LX.d.ts → sandbox-harness-B3Kx1fOA.d.ts} +1 -3
- package/dist/sandbox-harness-B3Kx1fOA.d.ts.map +1 -0
- package/dist/{schema-D6EVKzTB.d.ts → schema-CkIvnmLU.d.ts} +2 -43
- package/dist/schema-CkIvnmLU.d.ts.map +1 -0
- package/dist/{schema-Bt2vLFm3.js → schema-D-xu3MU_.js} +2 -3
- package/dist/{schema-Bt2vLFm3.js.map → schema-D-xu3MU_.js.map} +1 -1
- package/dist/{schema-C-ziyJD7.d.ts → schema-DkFJr3Y8.d.ts} +111 -48
- package/dist/schema-DkFJr3Y8.d.ts.map +1 -0
- package/dist/{schema-CvhfLjtZ.js → schema-YUIXT8iW.js} +37 -7
- package/dist/schema-YUIXT8iW.js.map +1 -0
- package/dist/search/index.d.ts +3 -35
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +4 -5
- package/dist/{search-kernel-CctpiDd2.d.ts → search-kernel-B77eE7Ac.d.ts} +10 -36
- package/dist/search-kernel-B77eE7Ac.d.ts.map +1 -0
- package/dist/{search-ledger-CZRqtFbW.js → search-ledger-BsVi-Ngv.js} +17 -26
- package/dist/{search-ledger-CZRqtFbW.js.map → search-ledger-BsVi-Ngv.js.map} +1 -1
- package/dist/{search-ledger-file-Bd5Tioq6.js → search-ledger-file-DTBD6X-y.js} +6 -8
- package/dist/{search-ledger-file-Bd5Tioq6.js.map → search-ledger-file-DTBD6X-y.js.map} +1 -1
- package/dist/{search-ledger-types-p2xKfiDJ.d.ts → search-ledger-types-qiYRUo_N.d.ts} +5 -9
- package/dist/search-ledger-types-qiYRUo_N.d.ts.map +1 -0
- package/dist/{search-shipper-Dn3NLsuH.js → search-shipper-pdg4viK7.js} +8 -13
- package/dist/{search-shipper-Dn3NLsuH.js.map → search-shipper-pdg4viK7.js.map} +1 -1
- package/dist/{search-summary-D4bwYnAE.js → search-summary-Ct7SrmVc.js} +6 -7
- package/dist/{search-summary-D4bwYnAE.js.map → search-summary-Ct7SrmVc.js.map} +1 -1
- package/dist/{sequential-CimQrbjv.js → sequential-B1I0tRfL.js} +6 -7
- package/dist/{sequential-CimQrbjv.js.map → sequential-B1I0tRfL.js.map} +1 -1
- package/dist/{sequential-KwGspfeR.d.ts → sequential-Bb_pdTqG.d.ts} +1 -3
- package/dist/sequential-Bb_pdTqG.d.ts.map +1 -0
- package/dist/{sequential-BVv1sjsw.js → sequential-Bjs5roiK.js} +2 -3
- package/dist/{sequential-BVv1sjsw.js.map → sequential-Bjs5roiK.js.map} +1 -1
- package/dist/{sequential-eprocess-DodI6RoF.js → sequential-eprocess-C1YLwFaz.js} +3 -4
- package/dist/{sequential-eprocess-DodI6RoF.js.map → sequential-eprocess-C1YLwFaz.js.map} +1 -1
- package/dist/{server-ChhXPCgX.js → server-DA6h3co5.js} +11 -17
- package/dist/{server-ChhXPCgX.js.map → server-DA6h3co5.js.map} +1 -1
- package/dist/{single-run-lock-Dekd8_Wv.js → single-run-lock-BGlW3OSk.js} +3 -4
- package/dist/{single-run-lock-Dekd8_Wv.js.map → single-run-lock-BGlW3OSk.js.map} +1 -1
- package/dist/{skillopt-optimization-method-sB_-yi1G.js → skillopt-optimization-method-qB1M554K.js} +38 -57
- package/dist/{skillopt-optimization-method-sB_-yi1G.js.map → skillopt-optimization-method-qB1M554K.js.map} +1 -1
- package/dist/{spans-CVngGij3.d.ts → spans-vZoW__3q.d.ts} +2 -4
- package/dist/spans-vZoW__3q.d.ts.map +1 -0
- package/dist/{statistical-heldout-BjzSOmLH.d.ts → statistical-heldout-BYxHe3KO.d.ts} +9 -37
- package/dist/statistical-heldout-BYxHe3KO.d.ts.map +1 -0
- package/dist/{statistical-heldout-Bksv92Th.js → statistical-heldout-TP6ndL0B.js} +4 -5
- package/dist/{statistical-heldout-Bksv92Th.js.map → statistical-heldout-TP6ndL0B.js.map} +1 -1
- package/dist/{steps-DlepJPwD.d.ts → steps-B8fYY_Vo.d.ts} +1 -3
- package/dist/steps-B8fYY_Vo.d.ts.map +1 -0
- package/dist/{store-B3nWRy3B.d.ts → store-CMs5wGXP.d.ts} +2 -4
- package/dist/store-CMs5wGXP.d.ts.map +1 -0
- package/dist/{store-BhNuLdJw.js → store-ZykIyQmy.js} +2 -3
- package/dist/{store-BhNuLdJw.js.map → store-ZykIyQmy.js.map} +1 -1
- package/dist/{store-otlp-CFf27E8_.js → store-otlp-DmLm65XW.js} +8 -13
- package/dist/{store-otlp-CFf27E8_.js.map → store-otlp-DmLm65XW.js.map} +1 -1
- package/dist/{store-tool-spans-BK_8FjGG.js → store-tool-spans-C2g8UYm-.js} +17 -41
- package/dist/{store-tool-spans-BK_8FjGG.js.map → store-tool-spans-C2g8UYm-.js.map} +1 -1
- package/dist/{store-tool-spans-DxsFwtdr.d.ts → store-tool-spans-DMM6wMwB.d.ts} +11 -29
- package/dist/store-tool-spans-DMM6wMwB.d.ts.map +1 -0
- package/dist/storyboard/index.d.ts +1 -5
- package/dist/storyboard/index.d.ts.map +1 -1
- package/dist/storyboard/index.js +3 -5
- package/dist/storyboard/index.js.map +1 -1
- package/dist/{summary-report-C8V49Jt3.d.ts → summary-report-0La5vejY.d.ts} +5 -13
- package/dist/summary-report-0La5vejY.d.ts.map +1 -0
- package/dist/{summary-report-DHDWxe6p.js → summary-report-CPfsrLac.js} +21 -30
- package/dist/summary-report-CPfsrLac.js.map +1 -0
- package/dist/supervisor-run/index.d.ts +30 -29
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +6 -7
- package/dist/{systemone-CHnqwmYg.d.ts → systemone-UHbKD6LH.d.ts} +12 -24
- package/dist/systemone-UHbKD6LH.d.ts.map +1 -0
- package/dist/{systemone-protocol-Bl2EI2KQ.d.ts → systemone-protocol-C4t7JH4Y.d.ts} +1 -3
- package/dist/systemone-protocol-C4t7JH4Y.d.ts.map +1 -0
- package/dist/systemone-protocol.d.ts +1 -1
- package/dist/systemone-protocol.js +2 -3
- package/dist/{systemone-review-cQ9acAsb.d.ts → systemone-review-Cn9Uj0xG.d.ts} +8 -10
- package/dist/systemone-review-Cn9Uj0xG.d.ts.map +1 -0
- package/dist/{systemone-review-DFGtIUcf.js → systemone-review-S49gsy_y.js} +5 -6
- package/dist/{systemone-review-DFGtIUcf.js.map → systemone-review-S49gsy_y.js.map} +1 -1
- package/dist/systemone.d.ts +4 -4
- package/dist/systemone.js +3 -3
- package/dist/{task-failure-attributes-oIK3BhCR.js → task-failure-attributes-CC6VuIpk.js} +7 -10
- package/dist/{task-failure-attributes-oIK3BhCR.js.map → task-failure-attributes-CC6VuIpk.js.map} +1 -1
- package/dist/{tool-groups-b3oU_D88.d.ts → tool-groups-CFWmAGCV.d.ts} +3 -5
- package/dist/tool-groups-CFWmAGCV.d.ts.map +1 -0
- package/dist/{tool-waste-CkjzWmeY.d.ts → tool-waste-BFG1vwTV.d.ts} +4 -16
- package/dist/tool-waste-BFG1vwTV.d.ts.map +1 -0
- package/dist/{tool-waste-DLsjS_p-.js → tool-waste-CLJ46AbT.js} +10 -26
- package/dist/{tool-waste-DLsjS_p-.js.map → tool-waste-CLJ46AbT.js.map} +1 -1
- package/dist/trace-attributes.d.ts +1 -1
- package/dist/trace-attributes.js +1 -2
- package/dist/{trace-questions-BmT8M6UQ.d.ts → trace-questions-BFCQAzoT.d.ts} +4 -6
- package/dist/trace-questions-BFCQAzoT.d.ts.map +1 -0
- package/dist/trace-repair/index.d.ts +46 -92
- package/dist/trace-repair/index.d.ts.map +1 -1
- package/dist/trace-repair/index.js +32 -54
- package/dist/trace-repair/index.js.map +1 -1
- package/dist/traces.d.ts +13 -29
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +18 -22
- package/dist/traces.js.map +1 -1
- package/dist/{trajectory-D_7rLrvE.js → trajectory-O3GDHmev.js} +2 -3
- package/dist/{trajectory-D_7rLrvE.js.map → trajectory-O3GDHmev.js.map} +1 -1
- package/dist/trajectory-replay/index.d.ts +2 -22
- package/dist/trajectory-replay/index.d.ts.map +1 -1
- package/dist/trajectory-replay/index.js +19 -30
- package/dist/trajectory-replay/index.js.map +1 -1
- package/dist/{tree-DSqwJpL9.js → tree-DrIChF4a.js} +39 -68
- package/dist/{tree-DSqwJpL9.js.map → tree-DrIChF4a.js.map} +1 -1
- package/dist/{types-B_IFcKp5.d.ts → types-0KglnQ9o.d.ts} +3 -15
- package/dist/types-0KglnQ9o.d.ts.map +1 -0
- package/dist/{types-6Lfdlshp.d.ts → types-BEvjDziM.d.ts} +50 -62
- package/dist/types-BEvjDziM.d.ts.map +1 -0
- package/dist/{types-CnWmj8NW.js → types-BK0blWhe.js} +3 -4
- package/dist/{types-CnWmj8NW.js.map → types-BK0blWhe.js.map} +1 -1
- package/dist/{types-CmXY0PQf.d.ts → types-C-aOqgt2.d.ts} +2 -5
- package/dist/types-C-aOqgt2.d.ts.map +1 -0
- package/dist/{types-BXgASBCL.js → types-DK4vNv5q.js} +2 -3
- package/dist/{types-BXgASBCL.js.map → types-DK4vNv5q.js.map} +1 -1
- package/dist/{types-DZ0mYVw9.d.ts → types-DUR0dqET.d.ts} +3 -5
- package/dist/types-DUR0dqET.d.ts.map +1 -0
- package/dist/{types-M6eF9m-r.d.ts → types-e3HGaI7P.d.ts} +84 -24
- package/dist/types-e3HGaI7P.d.ts.map +1 -0
- package/dist/{verdict-BGQmxQ8A.js → verdict-C8TcdwfD.js} +3 -4
- package/dist/{verdict-BGQmxQ8A.js.map → verdict-C8TcdwfD.js.map} +1 -1
- package/dist/{verdict-C24NELtN.d.ts → verdict-D_qiBQ6_.d.ts} +1 -5
- package/dist/verdict-D_qiBQ6_.d.ts.map +1 -0
- package/dist/{verdict-cache-CL_7tePD.js → verdict-cache-BVH-fl18.js} +3 -4
- package/dist/{verdict-cache-CL_7tePD.js.map → verdict-cache-BVH-fl18.js.map} +1 -1
- package/dist/wire/index.d.ts +43 -51
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +1 -2
- package/docs/eval-surface-map.md +15 -0
- package/docs/rollout.md +132 -6
- package/package.json +18 -18
- package/dist/adversarial-smnADNFS.d.ts.map +0 -1
- package/dist/agent-profile-CNmwfaqq.d.ts.map +0 -1
- package/dist/agent-profile-cell-BcpFbNd5.d.ts.map +0 -1
- package/dist/analyze-runs-DfX6dHP0.d.ts.map +0 -1
- package/dist/attribute-vocabulary-CcXqHODT.d.ts.map +0 -1
- package/dist/benchmark-command-Cnjfo0Zh.js.map +0 -1
- package/dist/campaign-evidence-DunzcJGv.js.map +0 -1
- package/dist/campaign-uddTlFg5.js.map +0 -1
- package/dist/canonical-CFpojCN5.d.ts.map +0 -1
- package/dist/client-hwo3cJjR.d.ts.map +0 -1
- package/dist/completion-verifier-asaV1nSj.js.map +0 -1
- package/dist/cost-ledger-C1W3ICmP.d.ts.map +0 -1
- package/dist/dataset-DQqhOCPt.d.ts.map +0 -1
- package/dist/default-registry-CLG5YqGS.d.ts.map +0 -1
- package/dist/define-agent-eval-JKt3gMQr.d.ts.map +0 -1
- package/dist/descriptive-B2iPaT9J.d.ts +0 -89
- package/dist/descriptive-B2iPaT9J.d.ts.map +0 -1
- package/dist/descriptive-CVNy48rR.js.map +0 -1
- package/dist/emitter-DABYYTcH.d.ts.map +0 -1
- package/dist/engine-dtRVeuQs.d.ts.map +0 -1
- package/dist/errors-DEE6u6ot.d.ts.map +0 -1
- package/dist/evaluation-DblGquCB.d.ts.map +0 -1
- package/dist/exact-types-Do63KoKn.d.ts.map +0 -1
- package/dist/exporters-DWvM16LE.js.map +0 -1
- package/dist/exporters-Dk3oEbK_.d.ts.map +0 -1
- package/dist/failure-cluster-DN0t63Z0.d.ts.map +0 -1
- package/dist/feedback-trajectory-CYVJXolG.d.ts.map +0 -1
- package/dist/hf-dataset-CKxIJQba.js.map +0 -1
- package/dist/index-CHxwfW5g.d.ts.map +0 -1
- package/dist/index-CTIRz-AB.d.ts.map +0 -1
- package/dist/index-CalAsXMR.d.ts.map +0 -1
- package/dist/index-CdEVr8-O.d.ts.map +0 -1
- package/dist/index-CfJULcW5.d.ts.map +0 -1
- package/dist/index-D7fmC-1K.d.ts.map +0 -1
- package/dist/index-jnuFLxOs.d.ts.map +0 -1
- package/dist/integrity-D-s2iHiT.js.map +0 -1
- package/dist/integrity-D9lBnv_K.d.ts.map +0 -1
- package/dist/interval-ohuOJurX.d.ts.map +0 -1
- package/dist/judge-calibration-DFtEMlde.d.ts.map +0 -1
- package/dist/llm-judge-Cybq29bL.js.map +0 -1
- package/dist/lock-holder-DaJbfpci.d.ts.map +0 -1
- package/dist/matrix-B8l-Nsxd.js.map +0 -1
- package/dist/matrix-DtkZLD_3.d.ts.map +0 -1
- package/dist/mint-CkzpVPdz.d.ts +0 -81
- package/dist/mint-CkzpVPdz.d.ts.map +0 -1
- package/dist/multi-layer-verifier-DEgMUk6v.d.ts.map +0 -1
- package/dist/multiplicity-DIWHvysC.d.ts.map +0 -1
- package/dist/paired-promotion-decision-CQMJ5xGN.d.ts.map +0 -1
- package/dist/pareto-BiBnQXAE.js.map +0 -1
- package/dist/prime-bridge-transport-6feEglLf.d.ts.map +0 -1
- package/dist/prime-protocol-BGxjfhM4.d.ts.map +0 -1
- package/dist/promotion-gate-CkVZHagC.d.ts.map +0 -1
- package/dist/query-Cmv_U8vf.d.ts.map +0 -1
- package/dist/random-DGEyr3zG.d.ts.map +0 -1
- package/dist/redact-DXdlFb_U.d.ts.map +0 -1
- package/dist/registry-BcdJmyoU.d.ts.map +0 -1
- package/dist/release-confidence-CYIFH-fp.js.map +0 -1
- package/dist/render-BhJqXoBH.js.map +0 -1
- package/dist/researcher-DKWtoMWk.d.ts.map +0 -1
- package/dist/reward-BeUgVVC_.d.ts.map +0 -1
- package/dist/reward-hacking-WTxUbtbb.d.ts.map +0 -1
- package/dist/rollout-Dd1ucT_M.js.map +0 -1
- package/dist/rubric-predictive-validity-Cd5SCtAf.d.ts.map +0 -1
- package/dist/run-record-C3awiXPf.d.ts.map +0 -1
- package/dist/sandbox-harness-BlSOu4LX.d.ts.map +0 -1
- package/dist/schema-C-ziyJD7.d.ts.map +0 -1
- package/dist/schema-CvhfLjtZ.js.map +0 -1
- package/dist/schema-D6EVKzTB.d.ts.map +0 -1
- package/dist/search-kernel-CctpiDd2.d.ts.map +0 -1
- package/dist/search-ledger-types-p2xKfiDJ.d.ts.map +0 -1
- package/dist/sequential-KwGspfeR.d.ts.map +0 -1
- package/dist/spans-CVngGij3.d.ts.map +0 -1
- package/dist/statistical-heldout-BjzSOmLH.d.ts.map +0 -1
- package/dist/steps-DlepJPwD.d.ts.map +0 -1
- package/dist/store-B3nWRy3B.d.ts.map +0 -1
- package/dist/store-tool-spans-DxsFwtdr.d.ts.map +0 -1
- package/dist/summary-report-C8V49Jt3.d.ts.map +0 -1
- package/dist/summary-report-DHDWxe6p.js.map +0 -1
- package/dist/systemone-CHnqwmYg.d.ts.map +0 -1
- package/dist/systemone-protocol-Bl2EI2KQ.d.ts.map +0 -1
- package/dist/systemone-review-cQ9acAsb.d.ts.map +0 -1
- package/dist/terminal-record-CB9BFtjS.js.map +0 -1
- package/dist/tool-groups-b3oU_D88.d.ts.map +0 -1
- package/dist/tool-waste-CkjzWmeY.d.ts.map +0 -1
- package/dist/trace-questions-BmT8M6UQ.d.ts.map +0 -1
- package/dist/types-6Lfdlshp.d.ts.map +0 -1
- package/dist/types-B_IFcKp5.d.ts.map +0 -1
- package/dist/types-CmXY0PQf.d.ts.map +0 -1
- package/dist/types-DZ0mYVw9.d.ts.map +0 -1
- package/dist/types-M6eF9m-r.d.ts.map +0 -1
- package/dist/verdict-C24NELtN.d.ts.map +0 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { r as canonicalString } from "./canonical-CicJlINA.js";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
// src/campaign/surface-identity.ts
|
|
4
|
+
const GIT_OBJECT_ID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
5
|
+
const SHA256 = /^sha256:[a-f0-9]{64}$/;
|
|
6
|
+
/** Validate the immutable identity shape; the owning executor verifies the Git objects and patch. */
|
|
7
|
+
function assertCodeSurfaceIdentity(surface) {
|
|
8
|
+
if (!surface || typeof surface !== "object") throw new TypeError("CodeSurface must be an object");
|
|
9
|
+
const candidate = surface;
|
|
10
|
+
if (candidate.kind !== "code") throw new TypeError("CodeSurface.kind must be \"code\"");
|
|
11
|
+
if (typeof candidate.worktreeRef !== "string" || candidate.worktreeRef.trim().length === 0) throw new TypeError("CodeSurface.worktreeRef must be a non-empty locator");
|
|
12
|
+
if (typeof candidate.baseRef !== "string" || candidate.baseRef.trim().length === 0) throw new TypeError("CodeSurface.baseRef must be a non-empty ref label");
|
|
13
|
+
for (const [field, value] of [
|
|
14
|
+
["baseCommit", candidate.baseCommit],
|
|
15
|
+
["baseTree", candidate.baseTree],
|
|
16
|
+
["candidateCommit", candidate.candidateCommit],
|
|
17
|
+
["candidateTree", candidate.candidateTree]
|
|
18
|
+
]) if (typeof value !== "string" || !GIT_OBJECT_ID.test(value)) throw new TypeError(`CodeSurface.${field} must be a full Git object id`);
|
|
19
|
+
const patch = candidate.patch;
|
|
20
|
+
if (!patch || typeof patch !== "object" || patch.format !== "git-diff-binary") throw new TypeError("CodeSurface.patch.format must be \"git-diff-binary\"");
|
|
21
|
+
if (typeof patch.sha256 !== "string" || !SHA256.test(patch.sha256)) throw new TypeError("CodeSurface.patch.sha256 must be a sha256 digest");
|
|
22
|
+
if (!Number.isSafeInteger(patch.byteLength) || patch.byteLength < 0) throw new TypeError("CodeSurface.patch.byteLength must be a non-negative safe integer");
|
|
23
|
+
}
|
|
24
|
+
/** Assert that a value is a valid non-empty component surface. */
|
|
25
|
+
function assertComponentSurface(surface) {
|
|
26
|
+
if (!surface || typeof surface !== "object") throw new TypeError("ComponentSurface must be an object");
|
|
27
|
+
const candidate = surface;
|
|
28
|
+
if (candidate.kind !== "components") throw new TypeError("ComponentSurface.kind must be \"components\"");
|
|
29
|
+
if (!candidate.components || typeof candidate.components !== "object" || Array.isArray(candidate.components)) throw new TypeError("ComponentSurface.components must be an object");
|
|
30
|
+
const entries = Object.entries(candidate.components);
|
|
31
|
+
if (entries.length === 0) throw new TypeError("ComponentSurface.components must not be empty");
|
|
32
|
+
for (const [name, content] of entries) {
|
|
33
|
+
if (!name.trim() || name.trim() !== name) throw new TypeError("ComponentSurface component names must be trimmed and non-empty");
|
|
34
|
+
if (typeof content !== "string") throw new TypeError(`ComponentSurface component '${name}' must be a string`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Deterministic identity material for a component surface.
|
|
39
|
+
*
|
|
40
|
+
* `canonicalString` orders keys by UTF-16 code unit (RFC 8785), which is a
|
|
41
|
+
* property of the value alone. The previous material ordered them with
|
|
42
|
+
* `localeCompare`, which reads the host's collation — so the same surface
|
|
43
|
+
* could produce two different identities on two machines, and the stored
|
|
44
|
+
* identity would stop matching a recomputation of the identical surface.
|
|
45
|
+
*/
|
|
46
|
+
function componentSurfaceIdentityMaterial(surface) {
|
|
47
|
+
assertComponentSurface(surface);
|
|
48
|
+
return canonicalString({
|
|
49
|
+
schema: "tangle.component-surface",
|
|
50
|
+
components: surface.components
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The retired material builder, kept PRIVATE and reachable only from
|
|
55
|
+
* {@link surfaceHashMatches}.
|
|
56
|
+
*
|
|
57
|
+
* A surface identity recorded before this release was minted from these bytes.
|
|
58
|
+
* The verify path tries the current material first and falls back to this one,
|
|
59
|
+
* so a stored identity still matches its own surface; nothing mints from it.
|
|
60
|
+
*
|
|
61
|
+
* Every component surface's identity moves, not only one whose names sort
|
|
62
|
+
* differently under the host's collation: RFC 8785 also orders the two
|
|
63
|
+
* top-level keys, so `components` precedes `schema` where this builder emitted
|
|
64
|
+
* them in literal order. The retention window therefore covers every stored
|
|
65
|
+
* component-surface identity, which is why this builder is kept rather than
|
|
66
|
+
* scoped to the mixed-case case.
|
|
67
|
+
*/
|
|
68
|
+
function retiredComponentSurfaceIdentityMaterial(surface) {
|
|
69
|
+
assertComponentSurface(surface);
|
|
70
|
+
return JSON.stringify({
|
|
71
|
+
schema: "tangle.component-surface",
|
|
72
|
+
components: Object.fromEntries(Object.entries(surface.components).sort(([left], [right]) => left.localeCompare(right)))
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/** Canonical, location-independent identity of a finalized code candidate.
|
|
76
|
+
* Commit metadata is excluded: two commits with the same base, final tree,
|
|
77
|
+
* and patch bytes are the same executable candidate. */
|
|
78
|
+
function codeSurfaceIdentityMaterial(surface) {
|
|
79
|
+
assertCodeSurfaceIdentity(surface);
|
|
80
|
+
return JSON.stringify({
|
|
81
|
+
schema: "tangle.code-surface",
|
|
82
|
+
baseCommit: surface.baseCommit,
|
|
83
|
+
baseTree: surface.baseTree,
|
|
84
|
+
candidateTree: surface.candidateTree,
|
|
85
|
+
patch: {
|
|
86
|
+
format: surface.patch.format,
|
|
87
|
+
sha256: surface.patch.sha256,
|
|
88
|
+
byteLength: surface.patch.byteLength
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Full SHA-256 content identity for a prompt or finalized code surface. */
|
|
93
|
+
function surfaceContentHash(surface) {
|
|
94
|
+
const material = typeof surface === "string" ? surface : surface.kind === "components" ? componentSurfaceIdentityMaterial(surface) : codeSurfaceIdentityMaterial(surface);
|
|
95
|
+
return `sha256:${createHash("sha256").update(material).digest("hex")}`;
|
|
96
|
+
}
|
|
97
|
+
/** Short loop key derived from the same content identity as provenance. */
|
|
98
|
+
function surfaceHash(surface) {
|
|
99
|
+
return surfaceContentHash(surface).slice(7, 23);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Whether `storedHash` is the loop key of `surface`, under the current identity
|
|
103
|
+
* material or the retired one.
|
|
104
|
+
*
|
|
105
|
+
* A stored key is 16 hex characters with no room for a scheme tag, so the
|
|
106
|
+
* scheme cannot be read off the value the way an `agent-profile-cell` id names
|
|
107
|
+
* its own. The verify path therefore tries both, which gives the same property:
|
|
108
|
+
* a key minted by an earlier release still matches its own surface, and a
|
|
109
|
+
* surface that was actually edited matches neither.
|
|
110
|
+
*
|
|
111
|
+
* Only a component surface can differ between the two; a prompt or code surface
|
|
112
|
+
* produces identical material under both, so the second comparison is a no-op
|
|
113
|
+
* for them.
|
|
114
|
+
*/
|
|
115
|
+
function surfaceHashMatches(surface, storedHash) {
|
|
116
|
+
if (surfaceHash(surface) === storedHash) return true;
|
|
117
|
+
if (typeof surface === "string" || surface.kind !== "components") return false;
|
|
118
|
+
return createHash("sha256").update(retiredComponentSurfaceIdentityMaterial(surface)).digest("hex").slice(0, 16) === storedHash;
|
|
119
|
+
}
|
|
120
|
+
/** Canonical customer-visible description of the exact before/after surfaces. */
|
|
121
|
+
function renderSurfaceDiff(winnerSurface, baselineSurface) {
|
|
122
|
+
if (typeof winnerSurface === "string" && typeof baselineSurface === "string") return [
|
|
123
|
+
"--- baseline",
|
|
124
|
+
"+++ winner",
|
|
125
|
+
...baselineSurface.split("\n").map((line) => `- ${line}`),
|
|
126
|
+
...winnerSurface.split("\n").map((line) => `+ ${line}`)
|
|
127
|
+
].join("\n");
|
|
128
|
+
const describe = (surface) => {
|
|
129
|
+
if (typeof surface === "string") return "(prompt surface)";
|
|
130
|
+
if (surface.kind === "components") {
|
|
131
|
+
assertComponentSurface(surface);
|
|
132
|
+
return Object.entries(surface.components).sort(([left], [right]) => left.localeCompare(right)).map(([name, content]) => `[${name}]\n${content}`).join("\n\n");
|
|
133
|
+
}
|
|
134
|
+
assertCodeSurfaceIdentity(surface);
|
|
135
|
+
return [
|
|
136
|
+
`baseCommit=${surface.baseCommit}`,
|
|
137
|
+
`baseTree=${surface.baseTree}`,
|
|
138
|
+
`candidateCommit=${surface.candidateCommit}`,
|
|
139
|
+
`candidateTree=${surface.candidateTree}`,
|
|
140
|
+
`patch=${surface.patch.sha256}`,
|
|
141
|
+
`patchBytes=${surface.patch.byteLength}`,
|
|
142
|
+
...surface.summary ? [surface.summary] : []
|
|
143
|
+
].join("\n");
|
|
144
|
+
};
|
|
145
|
+
return `--- baseline\n${describe(baselineSurface)}\n+++ winner\n${describe(winnerSurface)}`;
|
|
146
|
+
}
|
|
147
|
+
/** Bind a campaign cache entry to the exact surface and caller-owned execution revision. */
|
|
148
|
+
function surfaceDispatchRef(surface, executionRef = "anonymous") {
|
|
149
|
+
if (!executionRef.trim() || executionRef.trim() !== executionRef) throw new Error("surfaceDispatchRef: executionRef must be trimmed and non-empty");
|
|
150
|
+
return `surface:${executionRef}:${surfaceContentHash(surface)}`;
|
|
151
|
+
}
|
|
152
|
+
// src/json-recovery.ts
|
|
153
|
+
/**
|
|
154
|
+
* Truncation-tolerant JSON recovery — shared by every parser that reads JSON
|
|
155
|
+
* out of a model response (reflective-mutation proposals, judge scores, the
|
|
156
|
+
* completion-correctness checker).
|
|
157
|
+
*
|
|
158
|
+
* LLMs routinely hit a max_tokens cap mid-emission, leaving a JSON prefix
|
|
159
|
+
* with an unclosed string / object / array and often a dangling key or
|
|
160
|
+
* trailing comma. Throwing on that prefix — and letting the throw fold into
|
|
161
|
+
* a fabricated zero score downstream — is the bug class this module exists
|
|
162
|
+
* to prevent (see `JudgeParseError`'s contract: a synthetic zero is
|
|
163
|
+
* indistinguishable from a real low score). Recovering the complete prefix
|
|
164
|
+
* turns a would-be fabricated zero into a real measurement.
|
|
165
|
+
*/
|
|
166
|
+
/**
|
|
167
|
+
* Walk the input as JSON-aware (string vs not, escape-aware) and close
|
|
168
|
+
* unclosed `{` / `[` in LIFO order at the tail. If the input was already
|
|
169
|
+
* balanced returns it unchanged. If a string was open at end-of-input we
|
|
170
|
+
* also close it with `"` first, since a truncated string-mid-value is the
|
|
171
|
+
* most common LLM cap-hit failure mode and JSON.parse cannot proceed
|
|
172
|
+
* without one.
|
|
173
|
+
*
|
|
174
|
+
* Returns null when the structure is unrecoverable (e.g. depth would go
|
|
175
|
+
* negative — that's an *over*-closed prefix, not a truncation).
|
|
176
|
+
*/
|
|
177
|
+
function autoCloseTruncatedJson(raw) {
|
|
178
|
+
const stack = [];
|
|
179
|
+
let inString = false;
|
|
180
|
+
let escaped = false;
|
|
181
|
+
for (const c of raw) {
|
|
182
|
+
if (escaped) {
|
|
183
|
+
escaped = false;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (inString) {
|
|
187
|
+
if (c === "\\") {
|
|
188
|
+
escaped = true;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (c === "\"") {
|
|
192
|
+
inString = false;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (c === "\"") {
|
|
198
|
+
inString = true;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (c === "{" || c === "[") stack.push(c);
|
|
202
|
+
else if (c === "}") {
|
|
203
|
+
if (stack.pop() !== "{") return null;
|
|
204
|
+
} else if (c === "]") {
|
|
205
|
+
if (stack.pop() !== "[") return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (stack.length === 0 && !inString) return raw;
|
|
209
|
+
let suffix = "";
|
|
210
|
+
if (escaped) suffix += "\\";
|
|
211
|
+
if (inString) suffix += "\"";
|
|
212
|
+
while (stack.length > 0) {
|
|
213
|
+
const opener = stack.pop();
|
|
214
|
+
suffix += opener === "{" ? "}" : "]";
|
|
215
|
+
}
|
|
216
|
+
return raw + suffix;
|
|
217
|
+
}
|
|
218
|
+
const UNPARSEABLE = Symbol("unparseable");
|
|
219
|
+
function tryParse(candidate) {
|
|
220
|
+
try {
|
|
221
|
+
return JSON.parse(candidate);
|
|
222
|
+
} catch {
|
|
223
|
+
return UNPARSEABLE;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** Index of the last `,` that sits outside any string literal, or -1. Cutting
|
|
227
|
+
* there discards a dangling key / half-emitted value at the tail while
|
|
228
|
+
* keeping every complete member before it. */
|
|
229
|
+
function lastCommaOutsideString(s) {
|
|
230
|
+
let inString = false;
|
|
231
|
+
let escaped = false;
|
|
232
|
+
let last = -1;
|
|
233
|
+
for (let i = 0; i < s.length; i++) {
|
|
234
|
+
const c = s[i];
|
|
235
|
+
if (escaped) {
|
|
236
|
+
escaped = false;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (inString) {
|
|
240
|
+
if (c === "\\") escaped = true;
|
|
241
|
+
else if (c === "\"") inString = false;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (c === "\"") inString = true;
|
|
245
|
+
else if (c === ",") last = i;
|
|
246
|
+
}
|
|
247
|
+
return last;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Best-effort parse of a possibly-truncated JSON payload embedded in model
|
|
251
|
+
* output (prose and markdown fences tolerated). Tries each opener position
|
|
252
|
+
* (earliest `{`/`[` first, then the other when the first yields nothing —
|
|
253
|
+
* prose like `[note] {"score":3}` must not poison the slice), and from each
|
|
254
|
+
* start, in order:
|
|
255
|
+
*
|
|
256
|
+
* 1. plain `JSON.parse` of the opener → last-closer slice,
|
|
257
|
+
* 2. auto-closing unclosed structures at the tail
|
|
258
|
+
* (`autoCloseTruncatedJson`),
|
|
259
|
+
* 3. trimming the tail back to the previous complete member boundary (the
|
|
260
|
+
* last comma outside a string) and auto-closing again, repeatedly.
|
|
261
|
+
*
|
|
262
|
+
* Recovers e.g. `{"correct": false, "` → `{ correct: false }` — the exact
|
|
263
|
+
* cap-hit shape that has zeroed real eval rows. Returns the parsed value
|
|
264
|
+
* (always an object or array, given the slice starts at an opener), or
|
|
265
|
+
* `null` when nothing parseable can be recovered. Never throws.
|
|
266
|
+
*/
|
|
267
|
+
function recoverTruncatedJson(text) {
|
|
268
|
+
const starts = [text.indexOf("{"), text.indexOf("[")].filter((i) => i >= 0).sort((a, b) => a - b);
|
|
269
|
+
for (const start of starts) {
|
|
270
|
+
const recovered = recoverFrom(text.slice(start));
|
|
271
|
+
if (recovered !== UNPARSEABLE) return recovered;
|
|
272
|
+
}
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
function recoverFrom(slice) {
|
|
276
|
+
let candidate = slice;
|
|
277
|
+
const lastClose = Math.max(candidate.lastIndexOf("}"), candidate.lastIndexOf("]"));
|
|
278
|
+
if (lastClose > 0) {
|
|
279
|
+
const balanced = tryParse(candidate.slice(0, lastClose + 1));
|
|
280
|
+
if (balanced !== UNPARSEABLE) return balanced;
|
|
281
|
+
}
|
|
282
|
+
for (let i = 0; i < 64; i++) {
|
|
283
|
+
const closed = autoCloseTruncatedJson(candidate);
|
|
284
|
+
if (closed !== null) {
|
|
285
|
+
const parsed = tryParse(closed);
|
|
286
|
+
if (parsed !== UNPARSEABLE) return parsed;
|
|
287
|
+
}
|
|
288
|
+
const cut = lastCommaOutsideString(candidate);
|
|
289
|
+
if (cut <= 0) return UNPARSEABLE;
|
|
290
|
+
candidate = candidate.slice(0, cut);
|
|
291
|
+
}
|
|
292
|
+
return UNPARSEABLE;
|
|
293
|
+
}
|
|
294
|
+
export { componentSurfaceIdentityMaterial as a, surfaceDispatchRef as c, codeSurfaceIdentityMaterial as i, surfaceHash as l, recoverTruncatedJson as n, renderSurfaceDiff as o, assertCodeSurfaceIdentity as r, surfaceContentHash as s, autoCloseTruncatedJson as t, surfaceHashMatches as u };
|
|
295
|
+
|
|
296
|
+
//# sourceMappingURL=json-recovery-DK4MDm5r.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-recovery-DK4MDm5r.js","names":[],"sources":["../src/campaign/surface-identity.ts","../src/json-recovery.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\nimport { canonicalString } from '../ledger-core/canonical'\nimport type { CodeSurface, ComponentSurface, MutableSurface } from './types'\n\nconst GIT_OBJECT_ID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/\nconst SHA256 = /^sha256:[a-f0-9]{64}$/\n\n/** Validate the immutable identity shape; the owning executor verifies the Git objects and patch. */\nexport function assertCodeSurfaceIdentity(surface: unknown): asserts surface is CodeSurface {\n if (!surface || typeof surface !== 'object') {\n throw new TypeError('CodeSurface must be an object')\n }\n const candidate = surface as Partial<CodeSurface>\n if (candidate.kind !== 'code') throw new TypeError('CodeSurface.kind must be \"code\"')\n if (typeof candidate.worktreeRef !== 'string' || candidate.worktreeRef.trim().length === 0) {\n throw new TypeError('CodeSurface.worktreeRef must be a non-empty locator')\n }\n if (typeof candidate.baseRef !== 'string' || candidate.baseRef.trim().length === 0) {\n throw new TypeError('CodeSurface.baseRef must be a non-empty ref label')\n }\n for (const [field, value] of [\n ['baseCommit', candidate.baseCommit],\n ['baseTree', candidate.baseTree],\n ['candidateCommit', candidate.candidateCommit],\n ['candidateTree', candidate.candidateTree],\n ] as const) {\n if (typeof value !== 'string' || !GIT_OBJECT_ID.test(value)) {\n throw new TypeError(`CodeSurface.${field} must be a full Git object id`)\n }\n }\n const patch = candidate.patch\n if (!patch || typeof patch !== 'object' || patch.format !== 'git-diff-binary') {\n throw new TypeError('CodeSurface.patch.format must be \"git-diff-binary\"')\n }\n if (typeof patch.sha256 !== 'string' || !SHA256.test(patch.sha256)) {\n throw new TypeError('CodeSurface.patch.sha256 must be a sha256 digest')\n }\n if (!Number.isSafeInteger(patch.byteLength) || patch.byteLength < 0) {\n throw new TypeError('CodeSurface.patch.byteLength must be a non-negative safe integer')\n }\n}\n\n/** Assert that a value is a valid non-empty component surface. */\nfunction assertComponentSurface(surface: unknown): asserts surface is ComponentSurface {\n if (!surface || typeof surface !== 'object') {\n throw new TypeError('ComponentSurface must be an object')\n }\n const candidate = surface as Partial<ComponentSurface>\n if (candidate.kind !== 'components') {\n throw new TypeError('ComponentSurface.kind must be \"components\"')\n }\n if (\n !candidate.components ||\n typeof candidate.components !== 'object' ||\n Array.isArray(candidate.components)\n ) {\n throw new TypeError('ComponentSurface.components must be an object')\n }\n const entries = Object.entries(candidate.components)\n if (entries.length === 0) {\n throw new TypeError('ComponentSurface.components must not be empty')\n }\n for (const [name, content] of entries) {\n if (!name.trim() || name.trim() !== name) {\n throw new TypeError('ComponentSurface component names must be trimmed and non-empty')\n }\n if (typeof content !== 'string') {\n throw new TypeError(`ComponentSurface component '${name}' must be a string`)\n }\n }\n}\n\n/**\n * Deterministic identity material for a component surface.\n *\n * `canonicalString` orders keys by UTF-16 code unit (RFC 8785), which is a\n * property of the value alone. The previous material ordered them with\n * `localeCompare`, which reads the host's collation — so the same surface\n * could produce two different identities on two machines, and the stored\n * identity would stop matching a recomputation of the identical surface.\n */\nexport function componentSurfaceIdentityMaterial(surface: ComponentSurface): string {\n assertComponentSurface(surface)\n return canonicalString({\n schema: 'tangle.component-surface',\n components: surface.components,\n })\n}\n\n/**\n * The retired material builder, kept PRIVATE and reachable only from\n * {@link surfaceHashMatches}.\n *\n * A surface identity recorded before this release was minted from these bytes.\n * The verify path tries the current material first and falls back to this one,\n * so a stored identity still matches its own surface; nothing mints from it.\n *\n * Every component surface's identity moves, not only one whose names sort\n * differently under the host's collation: RFC 8785 also orders the two\n * top-level keys, so `components` precedes `schema` where this builder emitted\n * them in literal order. The retention window therefore covers every stored\n * component-surface identity, which is why this builder is kept rather than\n * scoped to the mixed-case case.\n */\nfunction retiredComponentSurfaceIdentityMaterial(surface: ComponentSurface): string {\n assertComponentSurface(surface)\n return JSON.stringify({\n schema: 'tangle.component-surface',\n components: Object.fromEntries(\n Object.entries(surface.components).sort(([left], [right]) => left.localeCompare(right)),\n ),\n })\n}\n\n/** Canonical, location-independent identity of a finalized code candidate.\n * Commit metadata is excluded: two commits with the same base, final tree,\n * and patch bytes are the same executable candidate. */\nexport function codeSurfaceIdentityMaterial(surface: CodeSurface): string {\n assertCodeSurfaceIdentity(surface)\n return JSON.stringify({\n schema: 'tangle.code-surface',\n baseCommit: surface.baseCommit,\n baseTree: surface.baseTree,\n candidateTree: surface.candidateTree,\n patch: {\n format: surface.patch.format,\n sha256: surface.patch.sha256,\n byteLength: surface.patch.byteLength,\n },\n })\n}\n\n/** Full SHA-256 content identity for a prompt or finalized code surface. */\nexport function surfaceContentHash(surface: MutableSurface): `sha256:${string}` {\n const material =\n typeof surface === 'string'\n ? surface\n : surface.kind === 'components'\n ? componentSurfaceIdentityMaterial(surface)\n : codeSurfaceIdentityMaterial(surface)\n return `sha256:${createHash('sha256').update(material).digest('hex')}`\n}\n\n/** Short loop key derived from the same content identity as provenance. */\nexport function surfaceHash(surface: MutableSurface): string {\n return surfaceContentHash(surface).slice('sha256:'.length, 'sha256:'.length + 16)\n}\n\n/**\n * Whether `storedHash` is the loop key of `surface`, under the current identity\n * material or the retired one.\n *\n * A stored key is 16 hex characters with no room for a scheme tag, so the\n * scheme cannot be read off the value the way an `agent-profile-cell` id names\n * its own. The verify path therefore tries both, which gives the same property:\n * a key minted by an earlier release still matches its own surface, and a\n * surface that was actually edited matches neither.\n *\n * Only a component surface can differ between the two; a prompt or code surface\n * produces identical material under both, so the second comparison is a no-op\n * for them.\n */\nexport function surfaceHashMatches(surface: MutableSurface, storedHash: string): boolean {\n if (surfaceHash(surface) === storedHash) return true\n if (typeof surface === 'string' || surface.kind !== 'components') return false\n const retired = createHash('sha256')\n .update(retiredComponentSurfaceIdentityMaterial(surface))\n .digest('hex')\n return retired.slice(0, 16) === storedHash\n}\n\n/** Canonical customer-visible description of the exact before/after surfaces. */\nexport function renderSurfaceDiff(\n winnerSurface: MutableSurface,\n baselineSurface: MutableSurface,\n): string {\n if (typeof winnerSurface === 'string' && typeof baselineSurface === 'string') {\n return [\n '--- baseline',\n '+++ winner',\n ...baselineSurface.split('\\n').map((line) => `- ${line}`),\n ...winnerSurface.split('\\n').map((line) => `+ ${line}`),\n ].join('\\n')\n }\n\n const describe = (surface: MutableSurface): string => {\n if (typeof surface === 'string') return '(prompt surface)'\n if (surface.kind === 'components') {\n assertComponentSurface(surface)\n return Object.entries(surface.components)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([name, content]) => `[${name}]\\n${content}`)\n .join('\\n\\n')\n }\n assertCodeSurfaceIdentity(surface)\n return [\n `baseCommit=${surface.baseCommit}`,\n `baseTree=${surface.baseTree}`,\n `candidateCommit=${surface.candidateCommit}`,\n `candidateTree=${surface.candidateTree}`,\n `patch=${surface.patch.sha256}`,\n `patchBytes=${surface.patch.byteLength}`,\n ...(surface.summary ? [surface.summary] : []),\n ].join('\\n')\n }\n\n return `--- baseline\\n${describe(baselineSurface)}\\n+++ winner\\n${describe(winnerSurface)}`\n}\n\n/** Bind a campaign cache entry to the exact surface and caller-owned execution revision. */\nexport function surfaceDispatchRef(surface: MutableSurface, executionRef = 'anonymous'): string {\n if (!executionRef.trim() || executionRef.trim() !== executionRef) {\n throw new Error('surfaceDispatchRef: executionRef must be trimmed and non-empty')\n }\n return `surface:${executionRef}:${surfaceContentHash(surface)}`\n}\n","/**\n * Truncation-tolerant JSON recovery — shared by every parser that reads JSON\n * out of a model response (reflective-mutation proposals, judge scores, the\n * completion-correctness checker).\n *\n * LLMs routinely hit a max_tokens cap mid-emission, leaving a JSON prefix\n * with an unclosed string / object / array and often a dangling key or\n * trailing comma. Throwing on that prefix — and letting the throw fold into\n * a fabricated zero score downstream — is the bug class this module exists\n * to prevent (see `JudgeParseError`'s contract: a synthetic zero is\n * indistinguishable from a real low score). Recovering the complete prefix\n * turns a would-be fabricated zero into a real measurement.\n */\n\n/**\n * Walk the input as JSON-aware (string vs not, escape-aware) and close\n * unclosed `{` / `[` in LIFO order at the tail. If the input was already\n * balanced returns it unchanged. If a string was open at end-of-input we\n * also close it with `\"` first, since a truncated string-mid-value is the\n * most common LLM cap-hit failure mode and JSON.parse cannot proceed\n * without one.\n *\n * Returns null when the structure is unrecoverable (e.g. depth would go\n * negative — that's an *over*-closed prefix, not a truncation).\n */\nexport function autoCloseTruncatedJson(raw: string): string | null {\n const stack: Array<'{' | '['> = []\n let inString = false\n let escaped = false\n for (const c of raw) {\n if (escaped) {\n escaped = false\n continue\n }\n if (inString) {\n if (c === '\\\\') {\n escaped = true\n continue\n }\n if (c === '\"') {\n inString = false\n continue\n }\n continue\n }\n if (c === '\"') {\n inString = true\n continue\n }\n if (c === '{' || c === '[') stack.push(c)\n else if (c === '}') {\n if (stack.pop() !== '{') return null\n } else if (c === ']') {\n if (stack.pop() !== '[') return null\n }\n }\n if (stack.length === 0 && !inString) return raw\n let suffix = ''\n // A truncation right after a backslash leaves an incomplete escape: the\n // closing `\"` we append would be consumed as the escape target and the\n // string would stay open. Complete the escape to a literal backslash first.\n if (escaped) suffix += '\\\\'\n if (inString) suffix += '\"'\n while (stack.length > 0) {\n const opener = stack.pop()!\n suffix += opener === '{' ? '}' : ']'\n }\n return raw + suffix\n}\n\nconst UNPARSEABLE = Symbol('unparseable')\n\nfunction tryParse(candidate: string): unknown {\n try {\n return JSON.parse(candidate)\n } catch {\n return UNPARSEABLE\n }\n}\n\n/** Index of the last `,` that sits outside any string literal, or -1. Cutting\n * there discards a dangling key / half-emitted value at the tail while\n * keeping every complete member before it. */\nfunction lastCommaOutsideString(s: string): number {\n let inString = false\n let escaped = false\n let last = -1\n for (let i = 0; i < s.length; i++) {\n const c = s[i]!\n if (escaped) {\n escaped = false\n continue\n }\n if (inString) {\n if (c === '\\\\') escaped = true\n else if (c === '\"') inString = false\n continue\n }\n if (c === '\"') inString = true\n else if (c === ',') last = i\n }\n return last\n}\n\n/**\n * Best-effort parse of a possibly-truncated JSON payload embedded in model\n * output (prose and markdown fences tolerated). Tries each opener position\n * (earliest `{`/`[` first, then the other when the first yields nothing —\n * prose like `[note] {\"score\":3}` must not poison the slice), and from each\n * start, in order:\n *\n * 1. plain `JSON.parse` of the opener → last-closer slice,\n * 2. auto-closing unclosed structures at the tail\n * (`autoCloseTruncatedJson`),\n * 3. trimming the tail back to the previous complete member boundary (the\n * last comma outside a string) and auto-closing again, repeatedly.\n *\n * Recovers e.g. `{\"correct\": false, \"` → `{ correct: false }` — the exact\n * cap-hit shape that has zeroed real eval rows. Returns the parsed value\n * (always an object or array, given the slice starts at an opener), or\n * `null` when nothing parseable can be recovered. Never throws.\n */\nexport function recoverTruncatedJson(text: string): unknown {\n const objStart = text.indexOf('{')\n const arrStart = text.indexOf('[')\n const starts = [objStart, arrStart].filter((i) => i >= 0).sort((a, b) => a - b)\n for (const start of starts) {\n const recovered = recoverFrom(text.slice(start))\n if (recovered !== UNPARSEABLE) return recovered\n }\n return null\n}\n\nfunction recoverFrom(slice: string): unknown {\n let candidate = slice\n\n const lastClose = Math.max(candidate.lastIndexOf('}'), candidate.lastIndexOf(']'))\n if (lastClose > 0) {\n const balanced = tryParse(candidate.slice(0, lastClose + 1))\n if (balanced !== UNPARSEABLE) return balanced\n }\n\n // Bounded: each iteration strictly shortens the candidate at a comma, so 64\n // covers any realistic member count without risking a pathological spin.\n for (let i = 0; i < 64; i++) {\n const closed = autoCloseTruncatedJson(candidate)\n if (closed !== null) {\n const parsed = tryParse(closed)\n if (parsed !== UNPARSEABLE) return parsed\n }\n const cut = lastCommaOutsideString(candidate)\n if (cut <= 0) return UNPARSEABLE\n candidate = candidate.slice(0, cut)\n }\n return UNPARSEABLE\n}\n"],"mappings":";;;AAIA,MAAM,gBAAgB;AACtB,MAAM,SAAS;;AAGf,SAAgB,0BAA0B,SAAkD;CAC1F,IAAI,CAAC,WAAW,OAAO,YAAY,UACjC,MAAM,IAAI,UAAU,+BAA+B;CAErD,MAAM,YAAY;CAClB,IAAI,UAAU,SAAS,QAAQ,MAAM,IAAI,UAAU,mCAAiC;CACpF,IAAI,OAAO,UAAU,gBAAgB,YAAY,UAAU,YAAY,KAAK,CAAC,CAAC,WAAW,GACvF,MAAM,IAAI,UAAU,qDAAqD;CAE3E,IAAI,OAAO,UAAU,YAAY,YAAY,UAAU,QAAQ,KAAK,CAAC,CAAC,WAAW,GAC/E,MAAM,IAAI,UAAU,mDAAmD;CAEzE,KAAK,MAAM,CAAC,OAAO,UAAU;EAC3B,CAAC,cAAc,UAAU,UAAU;EACnC,CAAC,YAAY,UAAU,QAAQ;EAC/B,CAAC,mBAAmB,UAAU,eAAe;EAC7C,CAAC,iBAAiB,UAAU,aAAa;CAC3C,GACE,IAAI,OAAO,UAAU,YAAY,CAAC,cAAc,KAAK,KAAK,GACxD,MAAM,IAAI,UAAU,eAAe,MAAM,8BAA8B;CAG3E,MAAM,QAAQ,UAAU;CACxB,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,WAAW,mBAC1D,MAAM,IAAI,UAAU,sDAAoD;CAE1E,IAAI,OAAO,MAAM,WAAW,YAAY,CAAC,OAAO,KAAK,MAAM,MAAM,GAC/D,MAAM,IAAI,UAAU,kDAAkD;CAExE,IAAI,CAAC,OAAO,cAAc,MAAM,UAAU,KAAK,MAAM,aAAa,GAChE,MAAM,IAAI,UAAU,kEAAkE;AAE1F;;AAGA,SAAS,uBAAuB,SAAuD;CAC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AC5C,IAAI,OAAO,GAAG,OAAO;EACrB,YAAY,UAAU,MAAM,GAAG,GAAG;CACpC;CACA,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as interpolatedQuantile } from "./quantile
|
|
2
|
-
import { t as mulberry32 } from "./random-
|
|
3
|
-
import { a as spearmanR, r as pearsonR } from "./descriptive-
|
|
4
|
-
|
|
1
|
+
import { t as interpolatedQuantile } from "./quantile-CncXP-Ss.js";
|
|
2
|
+
import { t as mulberry32 } from "./random-DrzcgC7F.js";
|
|
3
|
+
import { a as spearmanR, r as pearsonR } from "./descriptive-cPwITVfy.js";
|
|
4
|
+
// src/judge-calibration.ts
|
|
5
5
|
/**
|
|
6
6
|
* Judge calibration — measure judge quality against human gold + bias.
|
|
7
7
|
*
|
|
@@ -337,7 +337,6 @@ function percentileBounds(ciLevel) {
|
|
|
337
337
|
const tail = (1 - ciLevel) / 2;
|
|
338
338
|
return [tail, 1 - tail];
|
|
339
339
|
}
|
|
340
|
-
//#endregion
|
|
341
340
|
export { selfPreference as a, positionalBias as i, calibrateJudgeContinuous as n, verbosityBias as o, continuousAgreement as r, calibrateJudge as t };
|
|
342
341
|
|
|
343
|
-
//# sourceMappingURL=judge-calibration-
|
|
342
|
+
//# sourceMappingURL=judge-calibration-DGqlfWW8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"judge-calibration-BkXMIWA4.js","names":["quantile"],"sources":["../src/judge-calibration.ts"],"sourcesContent":["/**\n * Judge calibration — measure judge quality against human gold + bias.\n *\n * Workflow:\n * 1. Build a golden set: {itemId, humanScore}[].\n * 2. Run candidate judges; each produces {itemId, score}.\n * 3. `calibrateJudge(golden, candidate)` reports κ + Pearson + MAE.\n * 4. `calibrateJudgeContinuous(golden, candidate)` adds quadratic-weighted\n * κ over the un-rounded [0,1] scores plus ICC(2,1), Pearson, Spearman,\n * and bootstrap CIs — use this for fine-grained judges where rounding\n * to int discards information (e.g. 0.78 vs 0.81 both round to 1 and\n * look \"perfectly agreed\" to integer κ).\n * 5. Run bias probes (positional, verbosity, self-preference) to\n * detect systematic score inflation.\n * 6. For N≥2 judges on the same items, `continuousAgreement(scores)`\n * reports ICC(2,1) + κ_w + Pearson + Spearman with bootstrap CIs.\n *\n * Returns actionable diagnostics, not a single number. Consumers then\n * decide whether to trust the judge, retrain it, or add a tie-breaker.\n */\n\nimport { interpolatedQuantile as quantile } from './math/quantile'\nimport { pearsonR, spearmanR } from './statistics/descriptive'\nimport { mulberry32 } from './statistics/random'\n\nexport interface GoldenItem {\n itemId: string\n humanScore: number\n /** Optional group used for per-group bias audits (e.g. model-of-output family). */\n group?: string\n}\n\nexport interface CandidateScore {\n itemId: string\n score: number\n /** Optional — enables positional-bias analysis (did order matter?). */\n positionOfAInput?: 'first' | 'second'\n}\n\nexport interface CalibrationResult {\n n: number\n pearson: number\n /** Cohen's κ with quadratic weights over integer-rounded scores. */\n kappa: number\n /** Mean absolute error vs human. */\n mae: number\n /** Worst-5 miscalibrations (largest |judge - human|). */\n worstItems: Array<{ itemId: string; judge: number; human: number; delta: number }>\n}\n\n/**\n * Measure judge quality against human gold labels: computes Cohen's κ, Pearson correlation, and MAE over matched item ids.\n */\nexport function calibrateJudge(\n golden: GoldenItem[],\n candidate: CandidateScore[],\n): CalibrationResult {\n const map = new Map<string, { h: number; j: number }>()\n for (const g of golden) map.set(g.itemId, { h: g.humanScore, j: NaN })\n for (const c of candidate) {\n const entry = map.get(c.itemId)\n if (entry) entry.j = c.score\n }\n const common = [...map.values()].filter((v) => Number.isFinite(v.j))\n const n = common.length\n if (n < 2) {\n return { n, pearson: NaN, kappa: NaN, mae: NaN, worstItems: [] }\n }\n const humans = common.map((c) => c.h)\n const judges = common.map((c) => c.j)\n const pearson = pearsonR(humans, judges)\n const kappa = weightedKappa(humans.map(Math.round), judges.map(Math.round))\n const absDiffs = common.map((c) => Math.abs(c.j - c.h))\n const mae = absDiffs.reduce((a, b) => a + b, 0) / n\n const worst = [...map.entries()]\n .filter(([, v]) => Number.isFinite(v.j))\n .map(([itemId, v]) => ({ itemId, judge: v.j, human: v.h, delta: Math.abs(v.j - v.h) }))\n .sort((a, b) => b.delta - a.delta)\n .slice(0, 5)\n return { n, pearson, kappa, mae, worstItems: worst }\n}\n\nexport interface PositionalBiasResult {\n /**\n * Score delta (first-position - second-position) averaged across items\n * presented in both positions. Non-zero = positional bias.\n */\n avgDelta: number\n n: number\n}\n\n/**\n * Feed the same items to the judge twice with A/B swapped and pass all\n * results here. Items that don't appear in both positions are ignored.\n */\nexport function positionalBias(scores: CandidateScore[]): PositionalBiasResult {\n const pairs = new Map<string, { first?: number; second?: number }>()\n for (const s of scores) {\n const slot = pairs.get(s.itemId) ?? {}\n if (s.positionOfAInput === 'first') slot.first = s.score\n else if (s.positionOfAInput === 'second') slot.second = s.score\n pairs.set(s.itemId, slot)\n }\n const deltas: number[] = []\n for (const { first, second } of pairs.values()) {\n if (first !== undefined && second !== undefined) deltas.push(first - second)\n }\n if (deltas.length === 0) return { avgDelta: 0, n: 0 }\n return { avgDelta: deltas.reduce((a, b) => a + b, 0) / deltas.length, n: deltas.length }\n}\n\nexport interface VerbosityBiasResult {\n /** Pearson correlation between output length and score. Strong positive = verbosity bias. */\n pearson: number\n n: number\n}\n\nexport function verbosityBias(\n samples: Array<{ outputLen: number; score: number }>,\n): VerbosityBiasResult {\n const n = samples.length\n if (n < 3) return { pearson: NaN, n }\n return {\n pearson: pearsonR(\n samples.map((s) => s.outputLen),\n samples.map((s) => s.score),\n ),\n n,\n }\n}\n\nexport interface SelfPreferenceResult {\n /** Mean judge score when judge's family matches output's family. */\n inFamilyMean: number\n outOfFamilyMean: number\n deltaMean: number\n n: number\n}\n\n/**\n * Pass the same scenarios scored with judge-model X grading outputs from\n * model X (in-family) and model Y (out-of-family). Non-zero delta\n * indicates self-preference.\n */\nexport function selfPreference(\n samples: Array<{ score: number; inFamily: boolean }>,\n): SelfPreferenceResult {\n const inF = samples.filter((s) => s.inFamily).map((s) => s.score)\n const outF = samples.filter((s) => !s.inFamily).map((s) => s.score)\n if (inF.length === 0 || outF.length === 0)\n return { inFamilyMean: 0, outOfFamilyMean: 0, deltaMean: 0, n: 0 }\n const inMean = inF.reduce((a, b) => a + b, 0) / inF.length\n const outMean = outF.reduce((a, b) => a + b, 0) / outF.length\n return {\n inFamilyMean: inMean,\n outOfFamilyMean: outMean,\n deltaMean: inMean - outMean,\n n: samples.length,\n }\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\n/** Quadratic weighted Cohen's κ over bounded integer scores. */\nfunction weightedKappa(a: number[], b: number[]): number {\n if (a.length !== b.length || a.length === 0) return NaN\n const min = Math.min(...a, ...b)\n const max = Math.max(...a, ...b)\n const K = max - min + 1\n if (K < 2) return 1\n const observed: number[][] = Array.from({ length: K }, () => new Array(K).fill(0))\n const rowMarg = new Array(K).fill(0)\n const colMarg = new Array(K).fill(0)\n for (let i = 0; i < a.length; i++) {\n const ai = a[i]! - min\n const bi = b[i]! - min\n const row = observed[ai]!\n row[bi] = (row[bi] ?? 0) + 1\n rowMarg[ai]++\n colMarg[bi]++\n }\n let num = 0\n let den = 0\n for (let i = 0; i < K; i++) {\n for (let j = 0; j < K; j++) {\n const w = (i - j) ** 2 / (K - 1) ** 2\n const expected = (rowMarg[i] * colMarg[j]) / a.length\n num += w * observed[i]![j]!\n den += w * expected\n }\n }\n if (den === 0) return 1\n return 1 - num / den\n}\n\n// ── Continuous-value inter-rater agreement ──────────────────────────\n//\n// `weightedKappa` above quantises to integers. For [0,1] judges that is\n// lossy: 0.78 and 0.81 both round to 1 and look identical to integer κ.\n// `continuousAgreement` keeps the original magnitudes:\n//\n// - κ_w : Cohen's weighted κ generalised to continuous scores. For two\n// raters, weighted κ = 1 − Σ w_ij·o_ij / Σ w_ij·e_ij collapses\n// into the closed form below when each \"category\" is the score\n// itself (Janson & Olsson 2001; Cohen 1968 quadratic weights).\n// - ICC : Intraclass Correlation Coefficient, ICC(2,1) per Shrout &\n// Fleiss (1979) — two-way random effects, absolute agreement,\n// single rater. The right reliability coefficient when judges\n// are a random sample of the judge population.\n// - r, ρ : Pearson + Spearman for sanity-check. Pearson catches linear\n// association regardless of scale; Spearman catches monotone\n// association regardless of distribution.\n// - CIs : Bootstrap percentile CIs over items (rows). Bias is preserved\n// because we resample the full row, i.e. a judge's vector\n// stays internally consistent within each bootstrap replicate.\n//\n// References:\n// - Shrout, P. E. & Fleiss, J. L. (1979). Intraclass correlations: uses\n// in assessing rater reliability. Psychological Bulletin, 86(2), 420.\n// - McGraw, K. O. & Wong, S. P. (1996). Forming inferences about some\n// intraclass correlation coefficients. Psychological Methods, 1, 30.\n// - Janson, H. & Olsson, U. (2001). A measure of agreement for interval\n// or nominal multivariate observations. Educ. Psychol. Meas., 61, 277.\n\nexport interface ContinuousAgreement {\n /** Cohen's κ_w with quadratic weights, computed on raw [0,1] scores. */\n weightedKappa: number\n /** ICC(2,1): two-way random effects, absolute agreement, single rater. */\n icc: number\n /** Pearson product-moment correlation (averaged over rater pairs if N>2). */\n pearson: number\n /** Spearman rank correlation (averaged over rater pairs if N>2). */\n spearman: number\n /** 95% bootstrap percentile CIs over items. */\n ci: {\n icc: [number, number]\n weightedKappa: [number, number]\n }\n /** Number of complete items (no NaN across raters). */\n n: number\n /** Number of raters. */\n raters: number\n}\n\nexport interface ContinuousAgreementOptions {\n /** Bootstrap iterations. Default 1000. Set to 0 to skip CIs (CI = [NaN, NaN]). */\n bootstrap?: number\n /** κ weighting scheme. Default 'quadratic'. */\n weights?: 'linear' | 'quadratic'\n /** PRNG seed for reproducible bootstrap. Default 0xC0FFEE. */\n seed?: number\n /** Confidence level for percentile CI. Default 0.95. */\n ciLevel?: number\n}\n\n/**\n * Inter-rater agreement on continuous (typically [0,1]) scores.\n *\n * `scores` has shape [n_items][n_raters]. Rows with any non-finite entry\n * are dropped. Returns NaN metrics if fewer than 2 raters or 2 complete\n * items remain.\n */\nexport function continuousAgreement(\n scores: number[][],\n opts: ContinuousAgreementOptions = {},\n): ContinuousAgreement {\n const bootstrap = opts.bootstrap ?? 1000\n const weights = opts.weights ?? 'quadratic'\n const seed = opts.seed ?? 0xc0ffee\n const ciLevel = opts.ciLevel ?? 0.95\n\n const matrix = scores.filter((row) => row.length >= 2 && row.every((v) => Number.isFinite(v)))\n const raters = matrix[0]?.length ?? 0\n // All rows must have the same rater count, else drop the offenders.\n const clean = matrix.filter((row) => row.length === raters)\n const nClean = clean.length\n\n if (nClean < 2 || raters < 2) {\n return {\n weightedKappa: NaN,\n icc: NaN,\n pearson: NaN,\n spearman: NaN,\n ci: { icc: [NaN, NaN], weightedKappa: [NaN, NaN] },\n n: nClean,\n raters,\n }\n }\n\n const kappa = continuousWeightedKappa(clean, weights)\n const icc = icc21(clean)\n const pearson = avgPairwise(clean, pearsonR)\n const spearman = avgPairwise(clean, spearmanR)\n\n const ciIcc: [number, number] = [NaN, NaN]\n const ciKappa: [number, number] = [NaN, NaN]\n if (bootstrap > 0) {\n const rng = mulberry32(seed)\n const iccs: number[] = []\n const kappas: number[] = []\n for (let b = 0; b < bootstrap; b++) {\n const sample: number[][] = new Array(nClean)\n for (let i = 0; i < nClean; i++) {\n sample[i] = clean[Math.floor(rng() * nClean)]!\n }\n const iccB = icc21(sample)\n const kB = continuousWeightedKappa(sample, weights)\n if (Number.isFinite(iccB)) iccs.push(iccB)\n if (Number.isFinite(kB)) kappas.push(kB)\n }\n const [lo, hi] = percentileBounds(ciLevel)\n if (iccs.length > 0) {\n iccs.sort((a, b) => a - b)\n ciIcc[0] = quantile(iccs, lo)\n ciIcc[1] = quantile(iccs, hi)\n }\n if (kappas.length > 0) {\n kappas.sort((a, b) => a - b)\n ciKappa[0] = quantile(kappas, lo)\n ciKappa[1] = quantile(kappas, hi)\n }\n }\n\n return {\n weightedKappa: kappa,\n icc,\n pearson,\n spearman,\n ci: { icc: ciIcc, weightedKappa: ciKappa },\n n: nClean,\n raters,\n }\n}\n\nexport interface ContinuousCalibrationResult extends CalibrationResult {\n /** Cohen's κ_w computed on raw (un-rounded) scores. */\n weightedKappaContinuous: number\n /** ICC(2,1) treating golden + candidate as two raters. */\n icc: number\n spearman: number\n ci: {\n icc: [number, number]\n weightedKappa: [number, number]\n }\n}\n\n/**\n * Extends `calibrateJudge` with continuous-value agreement metrics while\n * retaining its base calibration summary.\n */\nexport function calibrateJudgeContinuous(\n golden: GoldenItem[],\n candidate: CandidateScore[],\n opts: ContinuousAgreementOptions = {},\n): ContinuousCalibrationResult {\n const base = calibrateJudge(golden, candidate)\n const map = new Map<string, { h: number; j: number }>()\n for (const g of golden) map.set(g.itemId, { h: g.humanScore, j: NaN })\n for (const c of candidate) {\n const entry = map.get(c.itemId)\n if (entry) entry.j = c.score\n }\n const rows: number[][] = []\n for (const v of map.values()) {\n if (Number.isFinite(v.j)) rows.push([v.h, v.j])\n }\n const agreement = continuousAgreement(rows, opts)\n return {\n ...base,\n weightedKappaContinuous: agreement.weightedKappa,\n icc: agreement.icc,\n spearman: agreement.spearman,\n ci: agreement.ci,\n }\n}\n\n// ── Continuous-agreement internals ──────────────────────────────────\n\n/**\n * Quadratic-weighted κ on continuous scores. With weights w(x,y) = (x-y)^2\n * (or |x-y| for linear) the formula collapses to:\n *\n * κ_w = 1 − E_obs[w] / E_exp[w]\n *\n * where E_obs averages w over paired (a_i, b_i) and E_exp averages w over\n * the independent product distribution (sum_{i,j} w(a_i, b_j) / n^2).\n * The normalisation by (max-min)^2 in the integer version cancels in the\n * ratio, so we don't need it here. Generalises to N raters by averaging κ_w\n * over all rater pairs (mean pairwise weighted agreement).\n */\nfunction continuousWeightedKappa(rows: number[][], scheme: 'linear' | 'quadratic'): number {\n if (rows.length === 0) return NaN\n const raters = rows[0]!.length\n if (raters < 2) return NaN\n const wFn =\n scheme === 'linear'\n ? (x: number, y: number) => Math.abs(x - y)\n : (x: number, y: number) => (x - y) ** 2\n let sum = 0\n let pairs = 0\n for (let r1 = 0; r1 < raters; r1++) {\n for (let r2 = r1 + 1; r2 < raters; r2++) {\n const a = rows.map((row) => row[r1]!)\n const b = rows.map((row) => row[r2]!)\n const n = a.length\n let obs = 0\n for (let i = 0; i < n; i++) obs += wFn(a[i]!, b[i]!)\n obs /= n\n // Expected under independence: average of w over all i,j cross pairs.\n let exp = 0\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < n; j++) exp += wFn(a[i]!, b[j]!)\n }\n exp /= n * n\n if (exp === 0) {\n // Degenerate: at least one rater is constant. Convention: perfect\n // agreement iff observed disagreement is also zero, else 0.\n sum += obs === 0 ? 1 : 0\n } else {\n sum += 1 - obs / exp\n }\n pairs++\n }\n }\n return pairs === 0 ? NaN : sum / pairs\n}\n\n/**\n * ICC(2,1) — two-way random effects, absolute agreement, single rater.\n *\n * ICC(2,1) = (MSR − MSE) / (MSR + (k−1)·MSE + k·(MSC − MSE)/n)\n *\n * where MSR = between-rows MS, MSC = between-columns MS, MSE = residual MS,\n * n = rows (items), k = columns (raters).\n */\nfunction icc21(rows: number[][]): number {\n const n = rows.length\n if (n < 2) return NaN\n const k = rows[0]!.length\n if (k < 2) return NaN\n\n // Row means.\n const rowMeans = rows.map((row) => row.reduce((s, v) => s + v, 0) / k)\n // Column means.\n const colMeans = new Array(k).fill(0)\n for (let j = 0; j < k; j++) {\n let s = 0\n for (let i = 0; i < n; i++) s += rows[i]![j]!\n colMeans[j] = s / n\n }\n // Grand mean.\n let grand = 0\n for (let i = 0; i < n; i++) grand += rowMeans[i]!\n grand /= n\n\n let ssR = 0\n for (let i = 0; i < n; i++) ssR += (rowMeans[i]! - grand) ** 2\n ssR *= k\n let ssC = 0\n for (let j = 0; j < k; j++) ssC += (colMeans[j]! - grand) ** 2\n ssC *= n\n let ssT = 0\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < k; j++) ssT += (rows[i]![j]! - grand) ** 2\n }\n const ssE = ssT - ssR - ssC\n\n const dfR = n - 1\n const dfC = k - 1\n const dfE = (n - 1) * (k - 1)\n const msR = ssR / dfR\n const msC = ssC / dfC\n const msE = dfE > 0 ? ssE / dfE : 0\n\n const denom = msR + (k - 1) * msE + (k * (msC - msE)) / n\n if (denom === 0) {\n // Degenerate (all values equal): convention = 1 if rows identical,\n // else 0. Identical rows ⇒ msR = 0 too, so msR − msE near 0.\n return msR === 0 && msE === 0 ? 1 : 0\n }\n return (msR - msE) / denom\n}\n\n/** Average pairwise statistic over all rater pairs. */\nfunction avgPairwise(rows: number[][], fn: (a: number[], b: number[]) => number): number {\n const k = rows[0]?.length ?? 0\n if (k < 2) return NaN\n let sum = 0\n let pairs = 0\n for (let i = 0; i < k; i++) {\n for (let j = i + 1; j < k; j++) {\n const a = rows.map((row) => row[i]!)\n const b = rows.map((row) => row[j]!)\n const r = fn(a, b)\n if (Number.isFinite(r)) {\n sum += r\n pairs++\n }\n }\n }\n return pairs === 0 ? NaN : sum / pairs\n}\n\nfunction percentileBounds(ciLevel: number): [number, number] {\n const tail = (1 - ciLevel) / 2\n return [tail, 1 - tail]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,SAAgB,eACd,QACA,WACmB;CACnB,MAAM,sBAAM,IAAI,IAAsC;CACtD,KAAK,MAAM,KAAK,QAAQ,IAAI,IAAI,EAAE,QAAQ;EAAE,GAAG,EAAE;EAAY,GAAG;CAAI,CAAC;CACrE,KAAK,MAAM,KAAK,WAAW;EACzB,MAAM,QAAQ,IAAI,IAAI,EAAE,MAAM;EAC9B,IAAI,OAAO,MAAM,IAAI,EAAE;CACzB;CACA,MAAM,SAAS,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO,SAAS,EAAE,CAAC,CAAC;CACnE,MAAM,IAAI,OAAO;CACjB,IAAI,IAAI,GACN,OAAO;EAAE;EAAG,SAAS;EAAK,OAAO;EAAK,KAAK;EAAK,YAAY,CAAC;CAAE;CAEjE,MAAM,SAAS,OAAO,KAAK,MAAM,EAAE,CAAC;CACpC,MAAM,SAAS,OAAO,KAAK,MAAM,EAAE,CAAC;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MAAM,MAAM;CAClB,MAAM,MAAM,MAAM;CAClB,MAAM,MAAM,MAAM,IAAI,MAAM,MAAM;CAElC,MAAM,QAAQ,OAAO,IAAI,KAAK,MAAO,KAAK,MAAM,OAAQ;CACxD,IAAI,UAAU,GAGZ,OAAO,QAAQ,KAAK,QAAQ,IAAI,IAAI;CAEtC,QAAQ,MAAM,OAAO;AACvB;;AAGA,SAAS,YAAY,MAAkB,IAAkD;CACvF,MAAM,IAAI,KAAK,EAAE,EAAE,UAAU;CAC7B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,MAAM;CACV,IAAI,QAAQ;CACZ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACrB,KAAK,IAAI,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAG9B,MAAM,IAAI,GAFA,KAAK,KAAK,QAAQ,IAAI,EAEnB,GADH,KAAK,KAAK,QAAQ,IAAI,EAChB,CAAC;EACjB,IAAI,OAAO,SAAS,CAAC,GAAG;GACtB,OAAO;GACP;EACF;CACF;CAEF,OAAO,UAAU,IAAI,MAAM,MAAM;AACnC;AAEA,SAAS,iBAAiB,SAAmC;CAC3D,MAAM,QAAQ,IAAI,WAAW;CAC7B,OAAO,CAAC,MAAM,IAAI,IAAI;AACxB"}
|
|
1
|
+
{"version":3,"file":"judge-calibration-DGqlfWW8.js","names":["quantile"],"sources":["../src/judge-calibration.ts"],"sourcesContent":["/**\n * Judge calibration — measure judge quality against human gold + bias.\n *\n * Workflow:\n * 1. Build a golden set: {itemId, humanScore}[].\n * 2. Run candidate judges; each produces {itemId, score}.\n * 3. `calibrateJudge(golden, candidate)` reports κ + Pearson + MAE.\n * 4. `calibrateJudgeContinuous(golden, candidate)` adds quadratic-weighted\n * κ over the un-rounded [0,1] scores plus ICC(2,1), Pearson, Spearman,\n * and bootstrap CIs — use this for fine-grained judges where rounding\n * to int discards information (e.g. 0.78 vs 0.81 both round to 1 and\n * look \"perfectly agreed\" to integer κ).\n * 5. Run bias probes (positional, verbosity, self-preference) to\n * detect systematic score inflation.\n * 6. For N≥2 judges on the same items, `continuousAgreement(scores)`\n * reports ICC(2,1) + κ_w + Pearson + Spearman with bootstrap CIs.\n *\n * Returns actionable diagnostics, not a single number. Consumers then\n * decide whether to trust the judge, retrain it, or add a tie-breaker.\n */\n\nimport { interpolatedQuantile as quantile } from './math/quantile'\nimport { pearsonR, spearmanR } from './statistics/descriptive'\nimport { mulberry32 } from './statistics/random'\n\nexport interface GoldenItem {\n itemId: string\n humanScore: number\n /** Optional group used for per-group bias audits (e.g. model-of-output family). */\n group?: string\n}\n\nexport interface CandidateScore {\n itemId: string\n score: number\n /** Optional — enables positional-bias analysis (did order matter?). */\n positionOfAInput?: 'first' | 'second'\n}\n\nexport interface CalibrationResult {\n n: number\n pearson: number\n /** Cohen's κ with quadratic weights over integer-rounded scores. */\n kappa: number\n /** Mean absolute error vs human. */\n mae: number\n /** Worst-5 miscalibrations (largest |judge - human|). */\n worstItems: Array<{ itemId: string; judge: number; human: number; delta: number }>\n}\n\n/**\n * Measure judge quality against human gold labels: computes Cohen's κ, Pearson correlation, and MAE over matched item ids.\n */\nexport function calibrateJudge(\n golden: GoldenItem[],\n candidate: CandidateScore[],\n): CalibrationResult {\n const map = new Map<string, { h: number; j: number }>()\n for (const g of golden) map.set(g.itemId, { h: g.humanScore, j: NaN })\n for (const c of candidate) {\n const entry = map.get(c.itemId)\n if (entry) entry.j = c.score\n }\n const common = [...map.values()].filter((v) => Number.isFinite(v.j))\n const n = common.length\n if (n < 2) {\n return { n, pearson: NaN, kappa: NaN, mae: NaN, worstItems: [] }\n }\n const humans = common.map((c) => c.h)\n const judges = common.map((c) => c.j)\n const pearson = pearsonR(humans, judges)\n const kappa = weightedKappa(humans.map(Math.round), judges.map(Math.round))\n const absDiffs = common.map((c) => Math.abs(c.j - c.h))\n const mae = absDiffs.reduce((a, b) => a + b, 0) / n\n const worst = [...map.entries()]\n .filter(([, v]) => Number.isFinite(v.j))\n .map(([itemId, v]) => ({ itemId, judge: v.j, human: v.h, delta: Math.abs(v.j - v.h) }))\n .sort((a, b) => b.delta - a.delta)\n .slice(0, 5)\n return { n, pearson, kappa, mae, worstItems: worst }\n}\n\nexport interface PositionalBiasResult {\n /**\n * Score delta (first-position - second-position) averaged across items\n * presented in both positions. Non-zero = positional bias.\n */\n avgDelta: number\n n: number\n}\n\n/**\n * Feed the same items to the judge twice with A/B swapped and pass all\n * results here. Items that don't appear in both positions are ignored.\n */\nexport function positionalBias(scores: CandidateScore[]): PositionalBiasResult {\n const pairs = new Map<string, { first?: number; second?: number }>()\n for (const s of scores) {\n const slot = pairs.get(s.itemId) ?? {}\n if (s.positionOfAInput === 'first') slot.first = s.score\n else if (s.positionOfAInput === 'second') slot.second = s.score\n pairs.set(s.itemId, slot)\n }\n const deltas: number[] = []\n for (const { first, second } of pairs.values()) {\n if (first !== undefined && second !== undefined) deltas.push(first - second)\n }\n if (deltas.length === 0) return { avgDelta: 0, n: 0 }\n return { avgDelta: deltas.reduce((a, b) => a + b, 0) / deltas.length, n: deltas.length }\n}\n\nexport interface VerbosityBiasResult {\n /** Pearson correlation between output length and score. Strong positive = verbosity bias. */\n pearson: number\n n: number\n}\n\nexport function verbosityBias(\n samples: Array<{ outputLen: number; score: number }>,\n): VerbosityBiasResult {\n const n = samples.length\n if (n < 3) return { pearson: NaN, n }\n return {\n pearson: pearsonR(\n samples.map((s) => s.outputLen),\n samples.map((s) => s.score),\n ),\n n,\n }\n}\n\nexport interface SelfPreferenceResult {\n /** Mean judge score when judge's family matches output's family. */\n inFamilyMean: number\n outOfFamilyMean: number\n deltaMean: number\n n: number\n}\n\n/**\n * Pass the same scenarios scored with judge-model X grading outputs from\n * model X (in-family) and model Y (out-of-family). Non-zero delta\n * indicates self-preference.\n */\nexport function selfPreference(\n samples: Array<{ score: number; inFamily: boolean }>,\n): SelfPreferenceResult {\n const inF = samples.filter((s) => s.inFamily).map((s) => s.score)\n const outF = samples.filter((s) => !s.inFamily).map((s) => s.score)\n if (inF.length === 0 || outF.length === 0)\n return { inFamilyMean: 0, outOfFamilyMean: 0, deltaMean: 0, n: 0 }\n const inMean = inF.reduce((a, b) => a + b, 0) / inF.length\n const outMean = outF.reduce((a, b) => a + b, 0) / outF.length\n return {\n inFamilyMean: inMean,\n outOfFamilyMean: outMean,\n deltaMean: inMean - outMean,\n n: samples.length,\n }\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\n/** Quadratic weighted Cohen's κ over bounded integer scores. */\nfunction weightedKappa(a: number[], b: number[]): number {\n if (a.length !== b.length || a.length === 0) return NaN\n const min = Math.min(...a, ...b)\n const max = Math.max(...a, ...b)\n const K = max - min + 1\n if (K < 2) return 1\n const observed: number[][] = Array.from({ length: K }, () => new Array(K).fill(0))\n const rowMarg = new Array(K).fill(0)\n const colMarg = new Array(K).fill(0)\n for (let i = 0; i < a.length; i++) {\n const ai = a[i]! - min\n const bi = b[i]! - min\n const row = observed[ai]!\n row[bi] = (row[bi] ?? 0) + 1\n rowMarg[ai]++\n colMarg[bi]++\n }\n let num = 0\n let den = 0\n for (let i = 0; i < K; i++) {\n for (let j = 0; j < K; j++) {\n const w = (i - j) ** 2 / (K - 1) ** 2\n const expected = (rowMarg[i] * colMarg[j]) / a.length\n num += w * observed[i]![j]!\n den += w * expected\n }\n }\n if (den === 0) return 1\n return 1 - num / den\n}\n\n// ── Continuous-value inter-rater agreement ──────────────────────────\n//\n// `weightedKappa` above quantises to integers. For [0,1] judges that is\n// lossy: 0.78 and 0.81 both round to 1 and look identical to integer κ.\n// `continuousAgreement` keeps the original magnitudes:\n//\n// - κ_w : Cohen's weighted κ generalised to continuous scores. For two\n// raters, weighted κ = 1 − Σ w_ij·o_ij / Σ w_ij·e_ij collapses\n// into the closed form below when each \"category\" is the score\n// itself (Janson & Olsson 2001; Cohen 1968 quadratic weights).\n// - ICC : Intraclass Correlation Coefficient, ICC(2,1) per Shrout &\n// Fleiss (1979) — two-way random effects, absolute agreement,\n// single rater. The right reliability coefficient when judges\n// are a random sample of the judge population.\n// - r, ρ : Pearson + Spearman for sanity-check. Pearson catches linear\n// association regardless of scale; Spearman catches monotone\n// association regardless of distribution.\n// - CIs : Bootstrap percentile CIs over items (rows). Bias is preserved\n// because we resample the full row, i.e. a judge's vector\n// stays internally consistent within each bootstrap replicate.\n//\n// References:\n// - Shrout, P. E. & Fleiss, J. L. (1979). Intraclass correlations: uses\n// in assessing rater reliability. Psychological Bulletin, 86(2), 420.\n// - McGraw, K. O. & Wong, S. P. (1996). Forming inferences about some\n// intraclass correlation coefficients. Psychological Methods, 1, 30.\n// - Janson, H. & Olsson, U. (2001). A measure of agreement for interval\n// or nominal multivariate observations. Educ. Psychol. Meas., 61, 277.\n\nexport interface ContinuousAgreement {\n /** Cohen's κ_w with quadratic weights, computed on raw [0,1] scores. */\n weightedKappa: number\n /** ICC(2,1): two-way random effects, absolute agreement, single rater. */\n icc: number\n /** Pearson product-moment correlation (averaged over rater pairs if N>2). */\n pearson: number\n /** Spearman rank correlation (averaged over rater pairs if N>2). */\n spearman: number\n /** 95% bootstrap percentile CIs over items. */\n ci: {\n icc: [number, number]\n weightedKappa: [number, number]\n }\n /** Number of complete items (no NaN across raters). */\n n: number\n /** Number of raters. */\n raters: number\n}\n\nexport interface ContinuousAgreementOptions {\n /** Bootstrap iterations. Default 1000. Set to 0 to skip CIs (CI = [NaN, NaN]). */\n bootstrap?: number\n /** κ weighting scheme. Default 'quadratic'. */\n weights?: 'linear' | 'quadratic'\n /** PRNG seed for reproducible bootstrap. Default 0xC0FFEE. */\n seed?: number\n /** Confidence level for percentile CI. Default 0.95. */\n ciLevel?: number\n}\n\n/**\n * Inter-rater agreement on continuous (typically [0,1]) scores.\n *\n * `scores` has shape [n_items][n_raters]. Rows with any non-finite entry\n * are dropped. Returns NaN metrics if fewer than 2 raters or 2 complete\n * items remain.\n */\nexport function continuousAgreement(\n scores: number[][],\n opts: ContinuousAgreementOptions = {},\n): ContinuousAgreement {\n const bootstrap = opts.bootstrap ?? 1000\n const weights = opts.weights ?? 'quadratic'\n const seed = opts.seed ?? 0xc0ffee\n const ciLevel = opts.ciLevel ?? 0.95\n\n const matrix = scores.filter((row) => row.length >= 2 && row.every((v) => Number.isFinite(v)))\n const raters = matrix[0]?.length ?? 0\n // All rows must have the same rater count, else drop the offenders.\n const clean = matrix.filter((row) => row.length === raters)\n const nClean = clean.length\n\n if (nClean < 2 || raters < 2) {\n return {\n weightedKappa: NaN,\n icc: NaN,\n pearson: NaN,\n spearman: NaN,\n ci: { icc: [NaN, NaN], weightedKappa: [NaN, NaN] },\n n: nClean,\n raters,\n }\n }\n\n const kappa = continuousWeightedKappa(clean, weights)\n const icc = icc21(clean)\n const pearson = avgPairwise(clean, pearsonR)\n const spearman = avgPairwise(clean, spearmanR)\n\n const ciIcc: [number, number] = [NaN, NaN]\n const ciKappa: [number, number] = [NaN, NaN]\n if (bootstrap > 0) {\n const rng = mulberry32(seed)\n const iccs: number[] = []\n const kappas: number[] = []\n for (let b = 0; b < bootstrap; b++) {\n const sample: number[][] = new Array(nClean)\n for (let i = 0; i < nClean; i++) {\n sample[i] = clean[Math.floor(rng() * nClean)]!\n }\n const iccB = icc21(sample)\n const kB = continuousWeightedKappa(sample, weights)\n if (Number.isFinite(iccB)) iccs.push(iccB)\n if (Number.isFinite(kB)) kappas.push(kB)\n }\n const [lo, hi] = percentileBounds(ciLevel)\n if (iccs.length > 0) {\n iccs.sort((a, b) => a - b)\n ciIcc[0] = quantile(iccs, lo)\n ciIcc[1] = quantile(iccs, hi)\n }\n if (kappas.length > 0) {\n kappas.sort((a, b) => a - b)\n ciKappa[0] = quantile(kappas, lo)\n ciKappa[1] = quantile(kappas, hi)\n }\n }\n\n return {\n weightedKappa: kappa,\n icc,\n pearson,\n spearman,\n ci: { icc: ciIcc, weightedKappa: ciKappa },\n n: nClean,\n raters,\n }\n}\n\nexport interface ContinuousCalibrationResult extends CalibrationResult {\n /** Cohen's κ_w computed on raw (un-rounded) scores. */\n weightedKappaContinuous: number\n /** ICC(2,1) treating golden + candidate as two raters. */\n icc: number\n spearman: number\n ci: {\n icc: [number, number]\n weightedKappa: [number, number]\n }\n}\n\n/**\n * Extends `calibrateJudge` with continuous-value agreement metrics while\n * retaining its base calibration summary.\n */\nexport function calibrateJudgeContinuous(\n golden: GoldenItem[],\n candidate: CandidateScore[],\n opts: ContinuousAgreementOptions = {},\n): ContinuousCalibrationResult {\n const base = calibrateJudge(golden, candidate)\n const map = new Map<string, { h: number; j: number }>()\n for (const g of golden) map.set(g.itemId, { h: g.humanScore, j: NaN })\n for (const c of candidate) {\n const entry = map.get(c.itemId)\n if (entry) entry.j = c.score\n }\n const rows: number[][] = []\n for (const v of map.values()) {\n if (Number.isFinite(v.j)) rows.push([v.h, v.j])\n }\n const agreement = continuousAgreement(rows, opts)\n return {\n ...base,\n weightedKappaContinuous: agreement.weightedKappa,\n icc: agreement.icc,\n spearman: agreement.spearman,\n ci: agreement.ci,\n }\n}\n\n// ── Continuous-agreement internals ──────────────────────────────────\n\n/**\n * Quadratic-weighted κ on continuous scores. With weights w(x,y) = (x-y)^2\n * (or |x-y| for linear) the formula collapses to:\n *\n * κ_w = 1 − E_obs[w] / E_exp[w]\n *\n * where E_obs averages w over paired (a_i, b_i) and E_exp averages w over\n * the independent product distribution (sum_{i,j} w(a_i, b_j) / n^2).\n * The normalisation by (max-min)^2 in the integer version cancels in the\n * ratio, so we don't need it here. Generalises to N raters by averaging κ_w\n * over all rater pairs (mean pairwise weighted agreement).\n */\nfunction continuousWeightedKappa(rows: number[][], scheme: 'linear' | 'quadratic'): number {\n if (rows.length === 0) return NaN\n const raters = rows[0]!.length\n if (raters < 2) return NaN\n const wFn =\n scheme === 'linear'\n ? (x: number, y: number) => Math.abs(x - y)\n : (x: number, y: number) => (x - y) ** 2\n let sum = 0\n let pairs = 0\n for (let r1 = 0; r1 < raters; r1++) {\n for (let r2 = r1 + 1; r2 < raters; r2++) {\n const a = rows.map((row) => row[r1]!)\n const b = rows.map((row) => row[r2]!)\n const n = a.length\n let obs = 0\n for (let i = 0; i < n; i++) obs += wFn(a[i]!, b[i]!)\n obs /= n\n // Expected under independence: average of w over all i,j cross pairs.\n let exp = 0\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < n; j++) exp += wFn(a[i]!, b[j]!)\n }\n exp /= n * n\n if (exp === 0) {\n // Degenerate: at least one rater is constant. Convention: perfect\n // agreement iff observed disagreement is also zero, else 0.\n sum += obs === 0 ? 1 : 0\n } else {\n sum += 1 - obs / exp\n }\n pairs++\n }\n }\n return pairs === 0 ? NaN : sum / pairs\n}\n\n/**\n * ICC(2,1) — two-way random effects, absolute agreement, single rater.\n *\n * ICC(2,1) = (MSR − MSE) / (MSR + (k−1)·MSE + k·(MSC − MSE)/n)\n *\n * where MSR = between-rows MS, MSC = between-columns MS, MSE = residual MS,\n * n = rows (items), k = columns (raters).\n */\nfunction icc21(rows: number[][]): number {\n const n = rows.length\n if (n < 2) return NaN\n const k = rows[0]!.length\n if (k < 2) return NaN\n\n // Row means.\n const rowMeans = rows.map((row) => row.reduce((s, v) => s + v, 0) / k)\n // Column means.\n const colMeans = new Array(k).fill(0)\n for (let j = 0; j < k; j++) {\n let s = 0\n for (let i = 0; i < n; i++) s += rows[i]![j]!\n colMeans[j] = s / n\n }\n // Grand mean.\n let grand = 0\n for (let i = 0; i < n; i++) grand += rowMeans[i]!\n grand /= n\n\n let ssR = 0\n for (let i = 0; i < n; i++) ssR += (rowMeans[i]! - grand) ** 2\n ssR *= k\n let ssC = 0\n for (let j = 0; j < k; j++) ssC += (colMeans[j]! - grand) ** 2\n ssC *= n\n let ssT = 0\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < k; j++) ssT += (rows[i]![j]! - grand) ** 2\n }\n const ssE = ssT - ssR - ssC\n\n const dfR = n - 1\n const dfC = k - 1\n const dfE = (n - 1) * (k - 1)\n const msR = ssR / dfR\n const msC = ssC / dfC\n const msE = dfE > 0 ? ssE / dfE : 0\n\n const denom = msR + (k - 1) * msE + (k * (msC - msE)) / n\n if (denom === 0) {\n // Degenerate (all values equal): convention = 1 if rows identical,\n // else 0. Identical rows ⇒ msR = 0 too, so msR − msE near 0.\n return msR === 0 && msE === 0 ? 1 : 0\n }\n return (msR - msE) / denom\n}\n\n/** Average pairwise statistic over all rater pairs. */\nfunction avgPairwise(rows: number[][], fn: (a: number[], b: number[]) => number): number {\n const k = rows[0]?.length ?? 0\n if (k < 2) return NaN\n let sum = 0\n let pairs = 0\n for (let i = 0; i < k; i++) {\n for (let j = i + 1; j < k; j++) {\n const a = rows.map((row) => row[i]!)\n const b = rows.map((row) => row[j]!)\n const r = fn(a, b)\n if (Number.isFinite(r)) {\n sum += r\n pairs++\n }\n }\n }\n return pairs === 0 ? NaN : sum / pairs\n}\n\nfunction percentileBounds(ciLevel: number): [number, number] {\n const tail = (1 - ciLevel) / 2\n return [tail, 1 - tail]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,SAAgB,eACd,QACA,WACmB;CACnB,MAAM,sBAAM,IAAI,IAAsC;CACtD,KAAK,MAAM,KAAK,QAAQ,IAAI,IAAI,EAAE,QAAQ;EAAE,GAAG,EAAE;EAAY,GAAG;CAAI,CAAC;CACrE,KAAK,MAAM,KAAK,WAAW;EACzB,MAAM,QAAQ,IAAI,IAAI,EAAE,MAAM;EAC9B,IAAI,OAAO,MAAM,IAAI,EAAE;CACzB;CACA,MAAM,SAAS,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO,SAAS,EAAE,CAAC,CAAC;CACnE,MAAM,IAAI,OAAO;CACjB,IAAI,IAAI,GACN,OAAO;EAAE;EAAG,SAAS;EAAK,OAAO;EAAK,KAAK;EAAK,YAAY,CAAC;CAAE;CAEjE,MAAM,SAAS,OAAO,KAAK,MAAM,EAAE,CAAC;CACpC,MAAM,SAAS,OAAO,KAAK,MAAM,EAAE,CAAC;CAUpC,OAAO;EAAE;EAAG,SATI,SAAS,QAAQ,MASf;EAAG,O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AAM,IAAI,MAAM,MAAM;CAElC,MAAM,QAAQ,OAAO,IAAI,KAAK,MAAO,KAAK,MAAM,OAAQ;CACxD,IAAI,UAAU,GAGZ,OAAO,QAAQ,KAAK,QAAQ,IAAI,IAAI;CAEtC,QAAQ,MAAM,OAAO;AACvB;;AAGA,SAAS,YAAY,MAAkB,IAAkD;CACvF,MAAM,IAAI,KAAK,EAAE,EAAE,UAAU;CAC7B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,MAAM;CACV,IAAI,QAAQ;CACZ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACrB,KAAK,IAAI,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAG9B,MAAM,IAAI,GAFA,KAAK,KAAK,QAAQ,IAAI,EAEnB,GADH,KAAK,KAAK,QAAQ,IAAI,EAChB,CAAC;EACjB,IAAI,OAAO,SAAS,CAAC,GAAG;GACtB,OAAO;GACP;EACF;CACF;CAEF,OAAO,UAAU,IAAI,MAAM,MAAM;AACnC;AAEA,SAAS,iBAAiB,SAAmC;CAC3D,MAAM,QAAQ,IAAI,WAAW;CAC7B,OAAO,CAAC,MAAM,IAAI,IAAI;AACxB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/judge-calibration.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Judge calibration — measure judge quality against human gold + bias.
|
|
4
3
|
*
|
|
@@ -141,6 +140,5 @@ interface ContinuousCalibrationResult extends CalibrationResult {
|
|
|
141
140
|
* retaining its base calibration summary.
|
|
142
141
|
*/
|
|
143
142
|
declare function calibrateJudgeContinuous(golden: GoldenItem[], candidate: CandidateScore[], opts?: ContinuousAgreementOptions): ContinuousCalibrationResult;
|
|
144
|
-
//#endregion
|
|
145
143
|
export { ContinuousCalibrationResult as a, SelfPreferenceResult as c, calibrateJudgeContinuous as d, continuousAgreement as f, verbosityBias as h, ContinuousAgreementOptions as i, VerbosityBiasResult as l, selfPreference as m, CandidateScore as n, GoldenItem as o, positionalBias as p, ContinuousAgreement as r, PositionalBiasResult as s, CalibrationResult as t, calibrateJudge as u };
|
|
146
|
-
//# sourceMappingURL=judge-calibration-
|
|
144
|
+
//# sourceMappingURL=judge-calibration-DnrbQaXI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge-calibration-DnrbQaXI.d.ts","names":[],"sources":["../src/judge-calibration.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAyBiB;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA;;EAEA;;EAEA,YAAY;IAAQ;IAAgB;IAAe;IAAe;;;;;;iBAMpD,eACd,QAAQ,cACR,WAAW,mBACV;UA0Bc;;;;;EAKf;EACA;;;;;;iBAOc,eAAe,QAAQ,mBAAmB;UAgBzC;;EAEf;EACA;;iBAGc,cACd,SAAS;EAAQ;EAAmB;KACnC;UAYc;;EAEf;EACA;EACA;EACA;;;;;;;iBAQc,eACd,SAAS;EAAQ;EAAe;KAC/B;UA8Ec;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;IACE;IACA;;;EAGF;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;;iBAUc,oBACd,oBACA,OAAM,6BACL;UAqEc,oCAAoC;;EAEnD;;EAEA;EACA;EACA;IACE;IACA;;;;;;;iBAQY,yBACd,QAAQ,cACR,WAAW,kBACX,OAAM,6BACL"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as JudgeError, s as ValidationError } from "./errors-
|
|
2
|
-
import { o as backoffMs, s as isTransientLlmError } from "./llm-client-
|
|
3
|
-
import { t as computeInterval } from "./interval-
|
|
4
|
-
|
|
1
|
+
import { i as JudgeError, s as ValidationError } from "./errors-DeEEV9Vx.js";
|
|
2
|
+
import { o as backoffMs, s as isTransientLlmError } from "./llm-client-kJ9EOqjt.js";
|
|
3
|
+
import { t as computeInterval } from "./interval-Bd2f4CRT.js";
|
|
4
|
+
// src/series-convergence.ts
|
|
5
5
|
function analyzeSeries(values, options = {}) {
|
|
6
6
|
const window = options.window ?? 5;
|
|
7
7
|
const stableCv = options.stableCv ?? .05;
|
|
@@ -40,8 +40,7 @@ function analyzeSeries(values, options = {}) {
|
|
|
40
40
|
stable
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
//#region src/judge-retry.ts
|
|
43
|
+
// src/judge-retry.ts
|
|
45
44
|
/**
|
|
46
45
|
* Wrap a single judge LLM call with retry, optional fallback-model
|
|
47
46
|
* rotation, exponential backoff, and a typed `JudgeRetryOutcome`. Callers
|
|
@@ -119,8 +118,7 @@ async function withJudgeRetry(judgeFn, policy = {}) {
|
|
|
119
118
|
attemptErrors
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
|
-
|
|
123
|
-
//#region src/meta-eval/sentinel.ts
|
|
121
|
+
// src/meta-eval/sentinel.ts
|
|
124
122
|
/**
|
|
125
123
|
* Judge sentinel — eval trustworthiness as a continuously measured,
|
|
126
124
|
* alarmed trend.
|
|
@@ -369,8 +367,7 @@ function evalHealthStamp(report) {
|
|
|
369
367
|
alarms: [...report.alarms]
|
|
370
368
|
};
|
|
371
369
|
}
|
|
372
|
-
|
|
373
|
-
//#region src/meta-eval/judge-gate.ts
|
|
370
|
+
// src/meta-eval/judge-gate.ts
|
|
374
371
|
/**
|
|
375
372
|
* Judge calibration gate: a judge may gate only while its measured agreement
|
|
376
373
|
* with its owner's verdicts holds.
|
|
@@ -709,7 +706,6 @@ function snapshotFromJudgeAgreement(agreement, options = {}) {
|
|
|
709
706
|
validateSentinelSnapshot(snapshot);
|
|
710
707
|
return snapshot;
|
|
711
708
|
}
|
|
712
|
-
//#endregion
|
|
713
709
|
export { analyzeSeries as _, judgeGateDecision as a, snapshotFromJudgeAgreement as c, judgeSentinelReport as d, snapshotFromAgreement as f, withJudgeRetry as g, validateSentinelSnapshot as h, assertJudgeMayGate as i, evalHealthStamp as l, snapshotFromSentinelSet as m, JudgeGateRefusedError as n, measureJudgeAgreement as o, snapshotFromCalibration as p, addCalibrationVerdicts as r, registerCalibrationSet as s, DEFAULT_JUDGE_GATE_POLICY as t, fileSentinelStore as u };
|
|
714
710
|
|
|
715
|
-
//# sourceMappingURL=judge-gate-
|
|
711
|
+
//# sourceMappingURL=judge-gate-C2BCOt-M.js.map
|