@tangle-network/agent-eval 0.216.1 → 0.217.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 +102 -57
- package/README.md +2 -2
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-VFcQncbW.d.ts → agent-profile-DTt8uGP9.d.ts} +4 -17
- package/dist/agent-profile-DTt8uGP9.d.ts.map +1 -0
- package/dist/{agent-profile-cell-BK8mlqlq.js → agent-profile-cell-B1V1gUZs.js} +4 -53
- package/dist/agent-profile-cell-B1V1gUZs.js.map +1 -0
- package/dist/{agent-profile-cell-BNp-Js9F.d.ts → agent-profile-cell-BcpFbNd5.d.ts} +2 -22
- package/dist/agent-profile-cell-BcpFbNd5.d.ts.map +1 -0
- package/dist/{agreement-irr-BEWLIF3_.js → agreement-irr-BhAqjluA.js} +5 -5
- package/dist/agreement-irr-BhAqjluA.js.map +1 -0
- package/dist/analyst/index.d.ts +36 -169
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +17 -192
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-C84irm4i.js → analyze-runs-DqPJaJ4X.js} +225 -21
- package/dist/analyze-runs-DqPJaJ4X.js.map +1 -0
- package/dist/{analyze-runs-D68fd-su.d.ts → analyze-runs-DyeNcenW.d.ts} +5 -5
- package/dist/{analyze-runs-D68fd-su.d.ts.map → analyze-runs-DyeNcenW.d.ts.map} +1 -1
- package/dist/authenticity/index.d.ts +0 -23
- package/dist/authenticity/index.d.ts.map +1 -1
- package/dist/authenticity/index.js +1 -34
- package/dist/authenticity/index.js.map +1 -1
- package/dist/{benchmark-command-By0vh8q7.js → benchmark-command-xQK8nOI6.js} +554 -89
- package/dist/benchmark-command-xQK8nOI6.js.map +1 -0
- package/dist/benchmarks/index.d.ts +5 -6
- package/dist/benchmarks/index.d.ts.map +1 -1
- package/dist/benchmarks/index.js +4 -4
- package/dist/benchmarks/index.js.map +1 -1
- package/dist/builder-eval/index.d.ts +3 -3
- package/dist/builder-eval/index.js +2 -2
- package/dist/builder-eval/index.js.map +1 -1
- package/dist/campaign/index.d.ts +7 -7
- package/dist/campaign/index.js +15 -15
- package/dist/{campaign-BudZ70zo.js → campaign-CJGkxAQ6.js} +23 -530
- package/dist/campaign-CJGkxAQ6.js.map +1 -0
- package/dist/{campaign-evidence-Clrn4hBV.js → campaign-evidence-CQYw8_0H.js} +10 -18
- package/dist/{campaign-evidence-Clrn4hBV.js.map → campaign-evidence-CQYw8_0H.js.map} +1 -1
- package/dist/{canonical-B2RqLofv.js → canonical-Dq2hOQ8L.js} +2 -2
- package/dist/{canonical-B2RqLofv.js.map → canonical-Dq2hOQ8L.js.map} +1 -1
- package/dist/cell-spend-DEWR3nj-.js +90 -0
- package/dist/cell-spend-DEWR3nj-.js.map +1 -0
- package/dist/{chat-client-l-MVDlDk.js → chat-client-ldqxYYTN.js} +2 -2
- package/dist/{chat-client-l-MVDlDk.js.map → chat-client-ldqxYYTN.js.map} +1 -1
- package/dist/{chat-json-call-puMArmtW.js → chat-json-call-DavzexSp.js} +3 -2
- package/dist/chat-json-call-DavzexSp.js.map +1 -0
- package/dist/{claim-q4HQhK1G.js → claim-BPVuyHuy.js} +3 -3
- package/dist/{claim-q4HQhK1G.js.map → claim-BPVuyHuy.js.map} +1 -1
- package/dist/cli.js +113 -12
- package/dist/cli.js.map +1 -1
- package/dist/{client-BzL9niqi.d.ts → client-hwo3cJjR.d.ts} +3 -16
- package/dist/client-hwo3cJjR.d.ts.map +1 -0
- package/dist/{cluster-bootstrap-qcUWYFl-.js → cluster-bootstrap-DEwwhl0C.js} +3 -3
- package/dist/{cluster-bootstrap-qcUWYFl-.js.map → cluster-bootstrap-DEwwhl0C.js.map} +1 -1
- package/dist/{produced-state-BsDmnwxc.js → completion-verifier-B_jw6C9p.js} +9 -64
- package/dist/completion-verifier-B_jw6C9p.js.map +1 -0
- package/dist/contract/index.d.ts +12 -12
- package/dist/contract/index.js +25 -401
- package/dist/contract/index.js.map +1 -1
- package/dist/{cost-ledger-BP8V4kUQ.js → cost-ledger-D0352Z4d.js} +4 -8
- package/dist/cost-ledger-D0352Z4d.js.map +1 -0
- package/dist/dataset-DQqhOCPt.d.ts.map +1 -1
- package/dist/{default-registry-COhk9g36.js → default-registry-ClYjq3QE.js} +8 -11
- package/dist/default-registry-ClYjq3QE.js.map +1 -0
- package/dist/{default-registry-DzHiGruW.d.ts → default-registry-DXgLmoDI.d.ts} +7 -50
- package/dist/default-registry-DXgLmoDI.d.ts.map +1 -0
- package/dist/{define-agent-eval-CNTPzIkp.js → define-agent-eval-BDxNlP3D.js} +10 -10
- package/dist/{define-agent-eval-CNTPzIkp.js.map → define-agent-eval-BDxNlP3D.js.map} +1 -1
- package/dist/{define-agent-eval-WSck0CZJ.d.ts → define-agent-eval-BIkH_gAR.d.ts} +8 -8
- package/dist/define-agent-eval-BIkH_gAR.d.ts.map +1 -0
- package/dist/{descriptive-DboxPZrG.js → descriptive-CVNy48rR.js} +2 -2
- package/dist/{descriptive-DboxPZrG.js.map → descriptive-CVNy48rR.js.map} +1 -1
- package/dist/diagnosis/index.d.ts +4 -14
- package/dist/diagnosis/index.d.ts.map +1 -1
- package/dist/diagnosis/index.js +67 -28
- package/dist/diagnosis/index.js.map +1 -1
- package/dist/{dspy-rlm-engine-LRCu61m5.js → dspy-rlm-engine-DhdCr1Dc.js} +5 -10
- package/dist/dspy-rlm-engine-DhdCr1Dc.js.map +1 -0
- package/dist/{emitter-HcCmFQl_.d.ts → emitter-DABYYTcH.d.ts} +5 -5
- package/dist/emitter-DABYYTcH.d.ts.map +1 -0
- package/dist/emitter-DbMXUIVP.js.map +1 -1
- package/dist/{engine-3A_4jOlI.d.ts → engine-BvZ0R-36.d.ts} +17 -21
- package/dist/engine-BvZ0R-36.d.ts.map +1 -0
- package/dist/{equal-terms-BtdXayCJ.js → equal-terms-DbPGcVtI.js} +2 -2
- package/dist/equal-terms-DbPGcVtI.js.map +1 -0
- package/dist/{errors-DVZiqS7K.js → errors-BcOs5MKW.js} +2 -8
- package/dist/{errors-DVZiqS7K.js.map → errors-BcOs5MKW.js.map} +1 -1
- package/dist/{eval-campaign-90jeaCAI.js → eval-campaign-BLEfBGbA.js} +6 -6
- package/dist/{eval-campaign-90jeaCAI.js.map → eval-campaign-BLEfBGbA.js.map} +1 -1
- package/dist/{evaluation-6Yoi74gM.d.ts → evaluation-jTjC_QQD.d.ts} +7 -7
- package/dist/evaluation-jTjC_QQD.d.ts.map +1 -0
- package/dist/evaluation.d.ts +2 -2
- package/dist/evaluation.js +1 -1
- package/dist/evaluation.js.map +1 -1
- package/dist/{exact-types-ClugMJfI.d.ts → exact-types-CflbJ9f3.d.ts} +2 -2
- package/dist/{exact-types-ClugMJfI.d.ts.map → exact-types-CflbJ9f3.d.ts.map} +1 -1
- package/dist/{exec-ChJ6d5if.js → exec-CpbtOXVt.js} +2 -24
- package/dist/{exec-ChJ6d5if.js.map → exec-CpbtOXVt.js.map} +1 -1
- package/dist/execution-tracks-CpgFPpS5.js.map +1 -1
- package/dist/experiment/index.d.ts +9 -112
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +149 -241
- package/dist/experiment/index.js.map +1 -1
- package/dist/{exporters-X4xwla8A.js → exporters-Cl6IeNAu.js} +3 -3
- package/dist/exporters-Cl6IeNAu.js.map +1 -0
- package/dist/{exporters-ChTnR90l.d.ts → exporters-Dk3oEbK_.d.ts} +2 -4
- package/dist/{exporters-ChTnR90l.d.ts.map → exporters-Dk3oEbK_.d.ts.map} +1 -1
- package/dist/{external-optimizer-process-BjMGUuds.js → external-optimizer-process-KVFGvYX1.js} +4 -3
- package/dist/external-optimizer-process-KVFGvYX1.js.map +1 -0
- package/dist/{external-optimizer-subprocess-BqW0hHcI.js → external-optimizer-subprocess-XIHBOSKt.js} +9 -11
- package/dist/external-optimizer-subprocess-XIHBOSKt.js.map +1 -0
- package/dist/{extract-usage-BrnzRJ6H.js → extract-usage-BZLU01kR.js} +2 -23
- package/dist/{extract-usage-BrnzRJ6H.js.map → extract-usage-BZLU01kR.js.map} +1 -1
- package/dist/{failure-cluster-CbgEDcFJ.d.ts → failure-cluster-DN0t63Z0.d.ts} +4 -43
- package/dist/failure-cluster-DN0t63Z0.d.ts.map +1 -0
- package/dist/{failure-taxonomy-CjabTATj.js → failure-taxonomy-Bx5oWqaW.js} +2 -19
- package/dist/{failure-taxonomy-CjabTATj.js.map → failure-taxonomy-Bx5oWqaW.js.map} +1 -1
- package/dist/{feedback-trajectory-C4EG0nNH.d.ts → feedback-trajectory-BWmhRBGu.d.ts} +7 -9
- package/dist/feedback-trajectory-BWmhRBGu.d.ts.map +1 -0
- package/dist/{semantic-concept-judge-BQF8te0T.js → findings-store-BMVQtEsm.js} +9 -249
- package/dist/findings-store-BMVQtEsm.js.map +1 -0
- package/dist/fuzz.d.ts +19 -62
- package/dist/fuzz.d.ts.map +1 -1
- package/dist/fuzz.js +62 -108
- package/dist/fuzz.js.map +1 -1
- package/dist/{hf-dataset-BR2yhuNn.js → hf-dataset-D9f7-oX7.js} +4 -24
- package/dist/hf-dataset-D9f7-oX7.js.map +1 -0
- package/dist/hosted/index.d.ts +2 -2
- package/dist/hosted/index.js +2 -2
- package/dist/{index-DHKEAv3s.d.ts → index-9jJ2fKSX.d.ts} +2 -64
- package/dist/index-9jJ2fKSX.d.ts.map +1 -0
- package/dist/{index-DV-jSzxF.d.ts → index-BLGqZ81N.d.ts} +10 -15
- package/dist/{index-DV-jSzxF.d.ts.map → index-BLGqZ81N.d.ts.map} +1 -1
- package/dist/{index-DPcngtwt.d.ts → index-BiT6RtNH.d.ts} +11 -36
- package/dist/index-BiT6RtNH.d.ts.map +1 -0
- package/dist/{index-BO41eGj5.d.ts → index-CX-GAUpw.d.ts} +3 -7
- package/dist/index-CX-GAUpw.d.ts.map +1 -0
- package/dist/{index-BFRO6chs.d.ts → index-CiRwLv2R.d.ts} +5 -69
- package/dist/index-CiRwLv2R.d.ts.map +1 -0
- package/dist/{index-CyszSg4O.d.ts → index-ZuWx52WG.d.ts} +115 -347
- package/dist/index-ZuWx52WG.d.ts.map +1 -0
- package/dist/index.d.ts +211 -218
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +402 -1040
- package/dist/index.js.map +1 -1
- package/dist/{integrity-dLiDe2kD.js → integrity-DOd9Q86O.js} +7 -9
- package/dist/integrity-DOd9Q86O.js.map +1 -0
- package/dist/{integrity-BXOsAb3i.js → integrity-W4CADcFc.js} +3 -7
- package/dist/{integrity-BXOsAb3i.js.map → integrity-W4CADcFc.js.map} +1 -1
- package/dist/{integrity-DAMEDFaC.d.ts → integrity-_qgZLA5p.d.ts} +4 -6
- package/dist/{integrity-DAMEDFaC.d.ts.map → integrity-_qgZLA5p.d.ts.map} +1 -1
- package/dist/{internal-Epl-YBZW.js → internal-BTK91Bqt.js} +3 -3
- package/dist/{internal-Epl-YBZW.js.map → internal-BTK91Bqt.js.map} +1 -1
- package/dist/{interval-CELpye1n.js → interval-Dq9gt7jx.js} +3 -3
- package/dist/{interval-CELpye1n.js.map → interval-Dq9gt7jx.js.map} +1 -1
- package/dist/{journal-DfRz9kps.js → journal-CR4QikYp.js} +110 -110
- package/dist/journal-CR4QikYp.js.map +1 -0
- package/dist/json-BhdsJaOQ.js +111 -0
- package/dist/json-BhdsJaOQ.js.map +1 -0
- package/dist/{judge-calibration-BpCy5XQl.js → judge-calibration-BkXMIWA4.js} +3 -3
- package/dist/{judge-calibration-BpCy5XQl.js.map → judge-calibration-BkXMIWA4.js.map} +1 -1
- package/dist/{judge-gate-iY9s4L44.js → judge-gate-Co5tuh57.js} +4 -27
- package/dist/{judge-gate-iY9s4L44.js.map → judge-gate-Co5tuh57.js.map} +1 -1
- package/dist/{judge-gate-CE7CQAgt.d.ts → judge-gate-DsL0yFcb.d.ts} +8 -9
- package/dist/judge-gate-DsL0yFcb.d.ts.map +1 -0
- package/dist/{kind-factory-BobI5Jy3.js → kind-factory-Gy4fXixd.js} +88 -17
- package/dist/kind-factory-Gy4fXixd.js.map +1 -0
- package/dist/ledger-core/index.d.ts +2 -2
- package/dist/ledger-core/index.js +4 -4
- package/dist/{ledger-core-Gq7yp8lP.js → ledger-core-DrJhbms9.js} +5 -84
- package/dist/ledger-core-DrJhbms9.js.map +1 -0
- package/dist/{llm-client-CyBAoYiX.js → llm-client-BshCREn6.js} +6 -108
- package/dist/llm-client-BshCREn6.js.map +1 -0
- package/dist/{llm-judge-CG12SQJq.js → llm-judge-C8jMTNNG.js} +24 -32
- package/dist/llm-judge-C8jMTNNG.js.map +1 -0
- package/dist/matrix/index.d.ts +3 -3
- package/dist/matrix/index.js +3 -2
- package/dist/{matrix-Dm0BQW7U.js → matrix-B8l-Nsxd.js} +3 -88
- package/dist/matrix-B8l-Nsxd.js.map +1 -0
- package/dist/{matrix-DSrSxjjy.d.ts → matrix-DHe-dwVJ.d.ts} +9 -18
- package/dist/matrix-DHe-dwVJ.d.ts.map +1 -0
- package/dist/{mean-DHoMiudD.js → mean-BbA_JCzW.js} +39 -5
- package/dist/mean-BbA_JCzW.js.map +1 -0
- package/dist/meta-eval/index.d.ts +5 -5
- package/dist/meta-eval/index.js +10 -10
- package/dist/metrics-BKaPBtIG.js.map +1 -1
- package/dist/{mint-DNU8QPG4.d.ts → mint-BRZXuwRi.d.ts} +4 -4
- package/dist/{mint-DNU8QPG4.d.ts.map → mint-BRZXuwRi.d.ts.map} +1 -1
- package/dist/{mint-QaD5cA0u.js → mint-zszyYlpA.js} +4 -4
- package/dist/{mint-QaD5cA0u.js.map → mint-zszyYlpA.js.map} +1 -1
- package/dist/{multi-layer-verifier-BUaQ4C17.d.ts → multi-layer-verifier-DEgMUk6v.d.ts} +2 -2
- package/dist/{multi-layer-verifier-BUaQ4C17.d.ts.map → multi-layer-verifier-DEgMUk6v.d.ts.map} +1 -1
- package/dist/{multiplicity-DQUFcbW4.js → multiplicity-Sg0U7h8j.js} +2 -2
- package/dist/{multiplicity-DQUFcbW4.js.map → multiplicity-Sg0U7h8j.js.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -23
- package/dist/multishot/golden/index.d.ts.map +1 -1
- package/dist/multishot/golden/index.js +3 -3
- package/dist/multishot/golden/index.js.map +1 -1
- package/dist/multishot/index.d.ts +3 -12
- package/dist/multishot/index.d.ts.map +1 -1
- package/dist/multishot/index.js +4 -3
- package/dist/multishot/index.js.map +1 -1
- package/dist/openapi.json +114 -10
- package/dist/{otel-spans-B9tUXRHF.js → otel-spans-CdN909k1.js} +3 -3
- package/dist/{otel-spans-B9tUXRHF.js.map → otel-spans-CdN909k1.js.map} +1 -1
- package/dist/{paired-arms-CwMGJsrS.js → paired-arms-Ct4LTKc1.js} +32 -9
- package/dist/paired-arms-Ct4LTKc1.js.map +1 -0
- package/dist/{paired-binary-CvpFHfKZ.js → paired-binary-B_nejA44.js} +3 -36
- package/dist/paired-binary-B_nejA44.js.map +1 -0
- package/dist/{paired-promotion-decision-DPKz8ZnF.d.ts → paired-promotion-decision-CQMJ5xGN.d.ts} +2 -34
- package/dist/paired-promotion-decision-CQMJ5xGN.d.ts.map +1 -0
- package/dist/{paired-promotion-decision-DsAPYGCm.js → paired-promotion-decision-D0SHb-ZL.js} +3 -3
- package/dist/{paired-promotion-decision-DsAPYGCm.js.map → paired-promotion-decision-D0SHb-ZL.js.map} +1 -1
- package/dist/{pareto-Cm6ndrWN.js → pareto-BzsxidFD.js} +11 -11
- package/dist/pareto-BzsxidFD.js.map +1 -0
- package/dist/pipelines/index.d.ts +16 -19
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +4 -68
- package/dist/pipelines/index.js.map +1 -1
- package/dist/{power-and-mde-Hj2ubb4B.js → power-and-mde-N5nU4_Ly.js} +3 -3
- package/dist/{power-and-mde-Hj2ubb4B.js.map → power-and-mde-N5nU4_Ly.js.map} +1 -1
- package/dist/{prime-protocol-CHKgA3a6.js → prime-protocol-BFgGrEMP.js} +3 -3
- package/dist/prime-protocol-BFgGrEMP.js.map +1 -0
- package/dist/{prime-protocol-HiB9HX7E.d.ts → prime-protocol-BWG2DQIk.d.ts} +3 -21
- package/dist/prime-protocol-BWG2DQIk.d.ts.map +1 -0
- package/dist/profile-cell.d.ts +2 -2
- package/dist/profile-cell.js +2 -2
- package/dist/{promotion-gate-BawrdPYr.d.ts → promotion-gate-DaY95yU6.d.ts} +7 -8
- package/dist/{promotion-gate-BawrdPYr.d.ts.map → promotion-gate-DaY95yU6.d.ts.map} +1 -1
- package/dist/{promotion-policy-KO57gbyV.js → promotion-policy-6A8osGr_.js} +4 -4
- package/dist/{promotion-policy-KO57gbyV.js.map → promotion-policy-6A8osGr_.js.map} +1 -1
- package/dist/{proposal-findings-CY1xKn_a.js → proposal-findings-BbWidvUk.js} +3 -3
- package/dist/proposal-findings-BbWidvUk.js.map +1 -0
- package/dist/{query-BUCZCK7F.js → query-B_RZ36an.js} +5 -5
- package/dist/query-B_RZ36an.js.map +1 -0
- package/dist/{query-DK1nWcmp.d.ts → query-Cmv_U8vf.d.ts} +4 -24
- package/dist/{query-DK1nWcmp.d.ts.map → query-Cmv_U8vf.d.ts.map} +1 -1
- package/dist/{random-ByUSnV9w.js → random-DDDcC7YU.js} +2 -2
- package/dist/{random-ByUSnV9w.js.map → random-DDDcC7YU.js.map} +1 -1
- package/dist/{raw-provider-sink-DoHz4JNG.js → raw-provider-sink-75w4FWBj.js} +2 -2
- package/dist/{raw-provider-sink-DoHz4JNG.js.map → raw-provider-sink-75w4FWBj.js.map} +1 -1
- package/dist/{redact-mtCCcT8z.d.ts → redact-DXdlFb_U.d.ts} +2 -3
- package/dist/redact-DXdlFb_U.d.ts.map +1 -0
- package/dist/{redact-B5xXKqQ3.js → redact-mtkTiJVk.js} +2 -7
- package/dist/{redact-B5xXKqQ3.js.map → redact-mtkTiJVk.js.map} +1 -1
- package/dist/{registry-D7_hm2fK.d.ts → registry-ssNoHzwD.d.ts} +4 -4
- package/dist/{registry-D7_hm2fK.d.ts.map → registry-ssNoHzwD.d.ts.map} +1 -1
- package/dist/{release-confidence-CpuP65S5.js → release-confidence-CYIFH-fp.js} +6 -11
- package/dist/release-confidence-CYIFH-fp.js.map +1 -0
- package/dist/{report-command-SC9nqb4M.js → render-C-w2EZ6p.js} +205 -363
- package/dist/render-C-w2EZ6p.js.map +1 -0
- package/dist/reporting.d.ts +6 -6
- package/dist/reporting.js +8 -8
- package/dist/{researcher-CEcfku-T.d.ts → researcher-0ABVIdGa.d.ts} +9 -9
- package/dist/{researcher-CEcfku-T.d.ts.map → researcher-0ABVIdGa.d.ts.map} +1 -1
- package/dist/{reward-CpCmAM8L.d.ts → reward-DrZ71vnf.d.ts} +3 -26
- package/dist/reward-DrZ71vnf.d.ts.map +1 -0
- package/dist/{reward-hacking-E0d-WVcP.js → reward-hacking-ByuETaIb.js} +3 -3
- package/dist/{reward-hacking-E0d-WVcP.js.map → reward-hacking-ByuETaIb.js.map} +1 -1
- package/dist/{reward-hacking-RVdZ6Kkt.d.ts → reward-hacking-E52wq86n.d.ts} +5 -18
- package/dist/reward-hacking-E52wq86n.d.ts.map +1 -0
- package/dist/reward-nw2xZGZG.js.map +1 -1
- package/dist/rl.d.ts +117 -295
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +27 -747
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +5 -5
- package/dist/rollout/index.js +7 -8
- package/dist/{rollout-DZV1t2Wg.js → rollout-D6C50mfA.js} +88 -13
- package/dist/rollout-D6C50mfA.js.map +1 -0
- package/dist/{rubric-predictive-validity-DaFW70y9.js → rubric-predictive-validity-D3_oI72N.js} +3 -3
- package/dist/{rubric-predictive-validity-DaFW70y9.js.map → rubric-predictive-validity-D3_oI72N.js.map} +1 -1
- package/dist/{rubric-predictive-validity-C03EC7ZE.d.ts → rubric-predictive-validity-DiwT8PbL.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-C03EC7ZE.d.ts.map → rubric-predictive-validity-DiwT8PbL.d.ts.map} +1 -1
- package/dist/{run-record-C1E24G2A.d.ts → run-record-CaxbLq6Y.d.ts} +4 -10
- package/dist/run-record-CaxbLq6Y.d.ts.map +1 -0
- package/dist/{run-record-C5e7FjhJ.js → run-record-CysKLB93.js} +3 -3
- package/dist/run-record-CysKLB93.js.map +1 -0
- package/dist/{run-record-Boc5IUTp.js → run-record-DhEJgoPz.js} +4 -4
- package/dist/{run-record-Boc5IUTp.js.map → run-record-DhEJgoPz.js.map} +1 -1
- package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -1
- package/dist/{schema-CSf6qWgZ.js → schema-Bt2vLFm3.js} +2 -14
- package/dist/schema-Bt2vLFm3.js.map +1 -0
- package/dist/schema-C-ziyJD7.d.ts.map +1 -1
- package/dist/{schema-2g7trUwH.d.ts → schema-D6EVKzTB.d.ts} +4 -5
- package/dist/schema-D6EVKzTB.d.ts.map +1 -0
- package/dist/{schema-BuiujZ-g.js → schema-DxcKTzbi.js} +2 -2
- package/dist/schema-DxcKTzbi.js.map +1 -0
- package/dist/search/index.d.ts +3 -31
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +4 -4
- package/dist/{search-kernel-DyNEa6IU.d.ts → search-kernel-DxqjBxA-.d.ts} +10 -27
- package/dist/search-kernel-DxqjBxA-.d.ts.map +1 -0
- package/dist/{search-ledger-CVUGLDZp.js → search-ledger-TUvB5gWH.js} +7 -7
- package/dist/{search-ledger-CVUGLDZp.js.map → search-ledger-TUvB5gWH.js.map} +1 -1
- package/dist/{search-ledger-file-DDQUgvCg.js → search-ledger-file-UKCO2r8a.js} +4 -4
- package/dist/search-ledger-file-UKCO2r8a.js.map +1 -0
- package/dist/{search-shipper-BOSD46qv.js → search-shipper-Cw2z3-td.js} +4 -4
- package/dist/search-shipper-Cw2z3-td.js.map +1 -0
- package/dist/{search-summary-BQCSWf1g.js → search-summary-DQIvJsSB.js} +5 -5
- package/dist/{search-summary-BQCSWf1g.js.map → search-summary-DQIvJsSB.js.map} +1 -1
- package/dist/{sequential-CzK5DarL.js → sequential-BVv1sjsw.js} +2 -32
- package/dist/{sequential-CzK5DarL.js.map → sequential-BVv1sjsw.js.map} +1 -1
- package/dist/{sequential-Bf_pbE50.js → sequential-CimQrbjv.js} +5 -5
- package/dist/sequential-CimQrbjv.js.map +1 -0
- package/dist/{sequential-BhsrMupG.d.ts → sequential-KwGspfeR.d.ts} +2 -9
- package/dist/{sequential-BhsrMupG.d.ts.map → sequential-KwGspfeR.d.ts.map} +1 -1
- package/dist/{sequential-eprocess-DM_qENCl.js → sequential-eprocess-DodI6RoF.js} +2 -2
- package/dist/{sequential-eprocess-DM_qENCl.js.map → sequential-eprocess-DodI6RoF.js.map} +1 -1
- package/dist/{server-e9oWO_bN.js → server-DoVbqqtJ.js} +101 -101
- package/dist/server-DoVbqqtJ.js.map +1 -0
- package/dist/{single-run-lock-CV9Eyd_q.js → single-run-lock-U58yf8N6.js} +2 -2
- package/dist/{single-run-lock-CV9Eyd_q.js.map → single-run-lock-U58yf8N6.js.map} +1 -1
- package/dist/{skillopt-optimization-method-BiwA8nfX.js → skillopt-optimization-method-kyL94-ri.js} +17 -95
- package/dist/skillopt-optimization-method-kyL94-ri.js.map +1 -0
- package/dist/{spans-BHAUXMGN.d.ts → spans-CVngGij3.d.ts} +2 -2
- package/dist/{spans-BHAUXMGN.d.ts.map → spans-CVngGij3.d.ts.map} +1 -1
- package/dist/{statistical-heldout-42NlCNDe.js → statistical-heldout-Bksv92Th.js} +3 -3
- package/dist/statistical-heldout-Bksv92Th.js.map +1 -0
- package/dist/{statistical-heldout-CYpGaoDH.d.ts → statistical-heldout-C9AbgREN.d.ts} +8 -67
- package/dist/statistical-heldout-C9AbgREN.d.ts.map +1 -0
- package/dist/{steps-Bg5-KVx1.d.ts → steps-DlepJPwD.d.ts} +2 -56
- package/dist/steps-DlepJPwD.d.ts.map +1 -0
- package/dist/{store-C4avFjIi.d.ts → store-B3nWRy3B.d.ts} +2 -2
- package/dist/{store-C4avFjIi.d.ts.map → store-B3nWRy3B.d.ts.map} +1 -1
- package/dist/{store-otlp-DJ9dtA5x.js → store-otlp-BteDAbHK.js} +3 -3
- package/dist/{store-otlp-DJ9dtA5x.js.map → store-otlp-BteDAbHK.js.map} +1 -1
- package/dist/{store-tool-spans-CIX5arAG.js → store-tool-spans-D5l_OfTJ.js} +8 -8
- package/dist/store-tool-spans-D5l_OfTJ.js.map +1 -0
- package/dist/{store-tool-spans-DdCSPa7C.d.ts → store-tool-spans-DZS0HWVf.d.ts} +9 -18
- package/dist/store-tool-spans-DZS0HWVf.d.ts.map +1 -0
- package/dist/storyboard/index.d.ts +4 -11
- package/dist/storyboard/index.d.ts.map +1 -1
- package/dist/storyboard/index.js +1 -16
- package/dist/storyboard/index.js.map +1 -1
- package/dist/{summary-report-V_JACR4Y.js → summary-report-BsXJoYX5.js} +88 -10
- package/dist/summary-report-BsXJoYX5.js.map +1 -0
- package/dist/{summary-report-bdFDXq0b.d.ts → summary-report-DM7tlml1.d.ts} +10 -19
- package/dist/summary-report-DM7tlml1.d.ts.map +1 -0
- package/dist/supervisor-run/index.d.ts +60 -28
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +4 -458
- package/dist/supervisor-run/index.js.map +1 -1
- package/dist/{systemone-BomhHr2c.d.ts → systemone-Bp_Ac0p1.d.ts} +5 -5
- package/dist/{systemone-BomhHr2c.d.ts.map → systemone-Bp_Ac0p1.d.ts.map} +1 -1
- package/dist/systemone-protocol.js +1 -1
- package/dist/{systemone-review-CUVcQJu6.d.ts → systemone-review-CwE6JGIp.d.ts} +2 -2
- package/dist/{systemone-review-CUVcQJu6.d.ts.map → systemone-review-CwE6JGIp.d.ts.map} +1 -1
- package/dist/{systemone-review-D7sXwsqq.js → systemone-review-DzdOJ8I6.js} +3 -3
- package/dist/{systemone-review-D7sXwsqq.js.map → systemone-review-DzdOJ8I6.js.map} +1 -1
- package/dist/systemone.d.ts +5 -5
- package/dist/systemone.js +5 -5
- package/dist/systemone.js.map +1 -1
- package/dist/{task-failure-attributes-hEmASjix.js → task-failure-attributes-BMsblaDh.js} +3 -3
- package/dist/task-failure-attributes-BMsblaDh.js.map +1 -0
- package/dist/{terminal-record-DZyQZ3pz.js → terminal-record-78g6E4vh.js} +5 -5
- package/dist/terminal-record-78g6E4vh.js.map +1 -0
- package/dist/{tool-groups-C3NEcdCM.d.ts → tool-groups-DyNz2JZ_.d.ts} +3 -3
- package/dist/tool-groups-DyNz2JZ_.d.ts.map +1 -0
- package/dist/{tool-waste-BKgvd-TP.d.ts → tool-waste-CkjzWmeY.d.ts} +25 -28
- package/dist/tool-waste-CkjzWmeY.d.ts.map +1 -0
- package/dist/{tool-waste-BlesqTqW.js → tool-waste-DLsjS_p-.js} +5 -5
- package/dist/{tool-waste-BlesqTqW.js.map → tool-waste-DLsjS_p-.js.map} +1 -1
- package/dist/{trace-questions-CM2CAocU.d.ts → trace-questions-xxwgsuMi.d.ts} +4 -9
- package/dist/{trace-questions-CM2CAocU.d.ts.map → trace-questions-xxwgsuMi.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +14 -211
- package/dist/trace-repair/index.d.ts.map +1 -1
- package/dist/trace-repair/index.js +865 -981
- package/dist/trace-repair/index.js.map +1 -1
- package/dist/traces.d.ts +18 -46
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +13 -13
- package/dist/traces.js.map +1 -1
- package/dist/trajectory-replay/index.d.ts +3 -117
- package/dist/trajectory-replay/index.d.ts.map +1 -1
- package/dist/trajectory-replay/index.js +98 -56
- package/dist/trajectory-replay/index.js.map +1 -1
- package/dist/{tree-C1XYeXvy.js → tree-BGRglkKd.js} +13 -10
- package/dist/tree-BGRglkKd.js.map +1 -0
- package/dist/{types-B3jzCp0p.js → types-BXgASBCL.js} +2 -2
- package/dist/{types-B3jzCp0p.js.map → types-BXgASBCL.js.map} +1 -1
- package/dist/{types-C1tnkEgM.d.ts → types-CW8ewATZ.d.ts} +4 -113
- package/dist/types-CW8ewATZ.d.ts.map +1 -0
- package/dist/{types-BqkVmHfv.d.ts → types-CmXY0PQf.d.ts} +2 -4
- package/dist/types-CmXY0PQf.d.ts.map +1 -0
- package/dist/{types-C02qtnG8.d.ts → types-D-mgRzlh.d.ts} +7 -28
- package/dist/types-D-mgRzlh.d.ts.map +1 -0
- package/dist/{types-Cq8mSbq8.d.ts → types-D8GhJoHk.d.ts} +7 -9
- package/dist/{types-Cq8mSbq8.d.ts.map → types-D8GhJoHk.d.ts.map} +1 -1
- package/dist/{types-IXD2HJzu.js → types-DqFMNTgK.js} +2 -4
- package/dist/types-DqFMNTgK.js.map +1 -0
- package/dist/{types-Cbe2fWBa.d.ts → types-DtMbFw6U.d.ts} +3 -3
- package/dist/{types-Cbe2fWBa.d.ts.map → types-DtMbFw6U.d.ts.map} +1 -1
- package/dist/{verdict-Dl0tiT1X.js → verdict-BGQmxQ8A.js} +3 -3
- package/dist/verdict-BGQmxQ8A.js.map +1 -0
- package/dist/{verdict-E4eRNf7-.d.ts → verdict-C24NELtN.d.ts} +2 -15
- package/dist/{verdict-E4eRNf7-.d.ts.map → verdict-C24NELtN.d.ts.map} +1 -1
- package/dist/{verdict-cache-Bm8EKL2s.js → verdict-cache-CL_7tePD.js} +2 -2
- package/dist/verdict-cache-CL_7tePD.js.map +1 -0
- package/dist/wire/index.d.ts +31 -410
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +2 -2
- package/docs/changes/jev-evidence-review.md +1 -1
- package/docs/changes/jev-product-adoption.md +1 -1
- package/docs/changes/jev-recorded-evidence.md +1 -1
- package/docs/design/statistics-decisions.md +17 -17
- package/docs/design.md +1 -1
- package/docs/evaluation-integrity.md +1 -1
- package/docs/proofs/campaign-attempt-retention-20261001/README.md +2 -2
- package/docs/public-api.md +138 -529
- package/docs/rollout.md +1 -1
- package/docs/trace-repair-admission.md +1 -1
- package/docs/wire-protocol.md +1 -1
- package/package.json +1 -1
- package/dist/active-curriculum-B_Lc9kfO.js +0 -61
- package/dist/active-curriculum-B_Lc9kfO.js.map +0 -1
- package/dist/agent-profile-VFcQncbW.d.ts.map +0 -1
- package/dist/agent-profile-cell-BK8mlqlq.js.map +0 -1
- package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +0 -1
- package/dist/agreement-irr-BEWLIF3_.js.map +0 -1
- package/dist/analyze-runs-C84irm4i.js.map +0 -1
- package/dist/baseline-Udi_PLuT.js +0 -259
- package/dist/baseline-Udi_PLuT.js.map +0 -1
- package/dist/benchmark-CXmVVHH2.js +0 -562
- package/dist/benchmark-CXmVVHH2.js.map +0 -1
- package/dist/benchmark-command-By0vh8q7.js.map +0 -1
- package/dist/campaign-BudZ70zo.js.map +0 -1
- package/dist/chat-json-call-puMArmtW.js.map +0 -1
- package/dist/claude-jsonl-dZir12m6.js +0 -86
- package/dist/claude-jsonl-dZir12m6.js.map +0 -1
- package/dist/client-BzL9niqi.d.ts.map +0 -1
- package/dist/cost-ledger-BP8V4kUQ.js.map +0 -1
- package/dist/counterfactual-CPaWN99-.d.ts +0 -60
- package/dist/counterfactual-CPaWN99-.d.ts.map +0 -1
- package/dist/counterfactual-Dn3veueY.js +0 -98
- package/dist/counterfactual-Dn3veueY.js.map +0 -1
- package/dist/default-registry-COhk9g36.js.map +0 -1
- package/dist/default-registry-DzHiGruW.d.ts.map +0 -1
- package/dist/define-agent-eval-WSck0CZJ.d.ts.map +0 -1
- package/dist/dspy-rlm-engine-LRCu61m5.js.map +0 -1
- package/dist/effect-sizes-BhzEpXMc.js +0 -82
- package/dist/effect-sizes-BhzEpXMc.js.map +0 -1
- package/dist/emitter-HcCmFQl_.d.ts.map +0 -1
- package/dist/engine-3A_4jOlI.d.ts.map +0 -1
- package/dist/equal-terms-BtdXayCJ.js.map +0 -1
- package/dist/evaluation-6Yoi74gM.d.ts.map +0 -1
- package/dist/exporters-X4xwla8A.js.map +0 -1
- package/dist/external-optimizer-process-BjMGUuds.js.map +0 -1
- package/dist/external-optimizer-subprocess-BqW0hHcI.js.map +0 -1
- package/dist/failure-cluster-CbgEDcFJ.d.ts.map +0 -1
- package/dist/feedback-trajectory-C4EG0nNH.d.ts.map +0 -1
- package/dist/hf-dataset-BR2yhuNn.js.map +0 -1
- package/dist/index-BFRO6chs.d.ts.map +0 -1
- package/dist/index-BO41eGj5.d.ts.map +0 -1
- package/dist/index-CyszSg4O.d.ts.map +0 -1
- package/dist/index-DHKEAv3s.d.ts.map +0 -1
- package/dist/index-DPcngtwt.d.ts.map +0 -1
- package/dist/integrity-dLiDe2kD.js.map +0 -1
- package/dist/journal-DfRz9kps.js.map +0 -1
- package/dist/judge-gate-CE7CQAgt.d.ts.map +0 -1
- package/dist/kind-factory-BobI5Jy3.js.map +0 -1
- package/dist/ledger-core-Gq7yp8lP.js.map +0 -1
- package/dist/llm-client-CyBAoYiX.js.map +0 -1
- package/dist/llm-judge-CG12SQJq.js.map +0 -1
- package/dist/matrix-DSrSxjjy.d.ts.map +0 -1
- package/dist/matrix-Dm0BQW7U.js.map +0 -1
- package/dist/mean-DHoMiudD.js.map +0 -1
- package/dist/normal-DsJZtrJc.js +0 -25
- package/dist/normal-DsJZtrJc.js.map +0 -1
- package/dist/paired-arms-CwMGJsrS.js.map +0 -1
- package/dist/paired-binary-CvpFHfKZ.js.map +0 -1
- package/dist/paired-promotion-decision-DPKz8ZnF.d.ts.map +0 -1
- package/dist/pareto-Cm6ndrWN.js.map +0 -1
- package/dist/prime-protocol-CHKgA3a6.js.map +0 -1
- package/dist/prime-protocol-HiB9HX7E.d.ts.map +0 -1
- package/dist/produced-state-BsDmnwxc.js.map +0 -1
- package/dist/proposal-findings-CY1xKn_a.js.map +0 -1
- package/dist/query-BUCZCK7F.js.map +0 -1
- package/dist/redact-mtCCcT8z.d.ts.map +0 -1
- package/dist/release-confidence-CpuP65S5.js.map +0 -1
- package/dist/report-command-SC9nqb4M.js.map +0 -1
- package/dist/reward-CpCmAM8L.d.ts.map +0 -1
- package/dist/reward-hacking-RVdZ6Kkt.d.ts.map +0 -1
- package/dist/rollout-DZV1t2Wg.js.map +0 -1
- package/dist/run-record-C1E24G2A.d.ts.map +0 -1
- package/dist/run-record-C5e7FjhJ.js.map +0 -1
- package/dist/schema-2g7trUwH.d.ts.map +0 -1
- package/dist/schema-BuiujZ-g.js.map +0 -1
- package/dist/schema-CSf6qWgZ.js.map +0 -1
- package/dist/search-kernel-DyNEa6IU.d.ts.map +0 -1
- package/dist/search-ledger-file-DDQUgvCg.js.map +0 -1
- package/dist/search-shipper-BOSD46qv.js.map +0 -1
- package/dist/semantic-concept-judge-BQF8te0T.js.map +0 -1
- package/dist/sequential-Bf_pbE50.js.map +0 -1
- package/dist/server-e9oWO_bN.js.map +0 -1
- package/dist/skillopt-optimization-method-BiwA8nfX.js.map +0 -1
- package/dist/statistical-heldout-42NlCNDe.js.map +0 -1
- package/dist/statistical-heldout-CYpGaoDH.d.ts.map +0 -1
- package/dist/steps-Bg5-KVx1.d.ts.map +0 -1
- package/dist/store-tool-spans-CIX5arAG.js.map +0 -1
- package/dist/store-tool-spans-DdCSPa7C.d.ts.map +0 -1
- package/dist/student-t-DVPW7CdL.js +0 -39
- package/dist/student-t-DVPW7CdL.js.map +0 -1
- package/dist/summary-report-V_JACR4Y.js.map +0 -1
- package/dist/summary-report-bdFDXq0b.d.ts.map +0 -1
- package/dist/task-failure-attributes-hEmASjix.js.map +0 -1
- package/dist/terminal-record-DZyQZ3pz.js.map +0 -1
- package/dist/tool-groups-C3NEcdCM.d.ts.map +0 -1
- package/dist/tool-waste-BKgvd-TP.d.ts.map +0 -1
- package/dist/trajectory-Y1fmdlw7.d.ts +0 -24
- package/dist/trajectory-Y1fmdlw7.d.ts.map +0 -1
- package/dist/tree-C1XYeXvy.js.map +0 -1
- package/dist/types-BqkVmHfv.d.ts.map +0 -1
- package/dist/types-C02qtnG8.d.ts.map +0 -1
- package/dist/types-C1tnkEgM.d.ts.map +0 -1
- package/dist/types-IXD2HJzu.js.map +0 -1
- package/dist/usage-receipt-Cx3xNeyB.js +0 -76
- package/dist/usage-receipt-Cx3xNeyB.js.map +0 -1
- package/dist/verdict-Dl0tiT1X.js.map +0 -1
- package/dist/verdict-cache-Bm8EKL2s.js.map +0 -1
- package/docs/design/self-improvement-evidence-audit.md +0 -263
package/dist/index.js
CHANGED
|
@@ -1,66 +1,64 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as JudgeError, n as CaptureIntegrityError, o as NotFoundError, r as ConfigError, s as ValidationError, t as AgentEvalError } from "./errors-
|
|
3
|
-
import { a as hashCanonical, r as canonicalString } from "./canonical-
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
2
|
+
import { i as JudgeError, n as CaptureIntegrityError, o as NotFoundError, r as ConfigError, s as ValidationError, t as AgentEvalError } from "./errors-BcOs5MKW.js";
|
|
3
|
+
import { a as hashCanonical, r as canonicalString } from "./canonical-Dq2hOQ8L.js";
|
|
4
|
+
import { a as HARNESS_NATIVE_MODEL, c as agentProfileModelId, i as CODING_HARNESSES, l as expandProfileAxes, n as createLlmCorrectnessChecker, o as agentProfileHash, r as verifyCompletion, s as agentProfileId, t as completionVerdict, u as harnessAxisOf } from "./completion-verifier-B_jw6C9p.js";
|
|
5
|
+
import { a as groupRunsByAgentProfileCell, c as verifyAgentProfileCell, i as buildAgentProfileCell, l as hashJson, o as toAgentProfileJson, r as agentProfileCellKey, s as validateAgentProfileCell, t as AGENT_PROFILE_KINDS, u as manifestContentDigest } from "./agent-profile-cell-B1V1gUZs.js";
|
|
6
6
|
import { r as observedSplitScore, t as isRealnessGated } from "./reward-nw2xZGZG.js";
|
|
7
|
-
import {
|
|
8
|
-
import { a as parseRunRecordSafe, c as validateRunRecord, i as modelHasSnapshot, n as UNKNOWN_MODEL, o as runTaskScore, r as isRunRecord,
|
|
9
|
-
import { i as summaryTable, n as gainHistogram,
|
|
7
|
+
import { i as isToolSpan, n as isJudgeSpan, r as isLlmSpan, t as FAILURE_CLASSES } from "./schema-Bt2vLFm3.js";
|
|
8
|
+
import { a as parseRunRecordSafe, c as validateRunRecord, i as modelHasSnapshot, n as UNKNOWN_MODEL, o as runTaskScore, r as isRunRecord, t as RunRecordValidationError } from "./run-record-DhEJgoPz.js";
|
|
9
|
+
import { a as cliffsDelta, c as pairedCohensDz, i as summaryTable, n as gainHistogram, o as cohensD, s as interpretCliffs } from "./summary-report-BsXJoYX5.js";
|
|
10
10
|
import { t as interpolatedQuantile } from "./quantile--0yb07pD.js";
|
|
11
|
-
import { a as medianInPlace, i as makeRng, t as assertFiniteSample } from "./internal-
|
|
12
|
-
import { t as mulberry32 } from "./random-
|
|
13
|
-
import { a as spearmanR, c as weightedMean, i as ranks, n as partialCredit, o as summarizeNumberSeries, r as pearsonR, s as weightedComposite, t as confidenceInterval } from "./descriptive-
|
|
14
|
-
import { n as calibrateJudgeContinuous, o as verbosityBias, r as continuousAgreement, t as calibrateJudge } from "./judge-calibration-
|
|
15
|
-
import { n as corpusInterRaterAgreementFromJudgeScores, r as interRaterReliability, t as corpusInterRaterAgreement } from "./agreement-irr-
|
|
16
|
-
import { i as
|
|
17
|
-
import { a as
|
|
18
|
-
import { n as bonferroni, r as holm, t as benjaminiHochberg } from "./multiplicity-
|
|
19
|
-
import { a as
|
|
20
|
-
import {
|
|
21
|
-
import { a as requiredSampleSize, i as requiredPairedSampleSize, n as mcnemarRequiredN, r as pairedMde, t as mcnemarPower } from "./power-and-mde-
|
|
22
|
-
import {
|
|
23
|
-
import { t as
|
|
24
|
-
import {
|
|
25
|
-
import { n as
|
|
26
|
-
import {
|
|
27
|
-
import { n as contentHash, r as fileVerdictCache, t as canonicalJson } from "./verdict-cache-Bm8EKL2s.js";
|
|
28
|
-
import { J as redTeamReport, K as DEFAULT_RED_TEAM_CORPUS, X as runCanaries, Y as scoreRedTeamOutput, a as transientDispatchFailure, i as quotaExhaustedUntil, o as aggregateRunScore, q as redTeamDataset, rt as runCampaign, s as clamp01, t as llmJudge } from "./llm-judge-CG12SQJq.js";
|
|
11
|
+
import { a as medianInPlace, i as makeRng, t as assertFiniteSample } from "./internal-BTK91Bqt.js";
|
|
12
|
+
import { t as mulberry32 } from "./random-DDDcC7YU.js";
|
|
13
|
+
import { a as spearmanR, c as weightedMean, i as ranks, n as partialCredit, o as summarizeNumberSeries, r as pearsonR, s as weightedComposite, t as confidenceInterval } from "./descriptive-CVNy48rR.js";
|
|
14
|
+
import { n as calibrateJudgeContinuous, o as verbosityBias, r as continuousAgreement, t as calibrateJudge } from "./judge-calibration-BkXMIWA4.js";
|
|
15
|
+
import { n as corpusInterRaterAgreementFromJudgeScores, r as interRaterReliability, t as corpusInterRaterAgreement } from "./agreement-irr-BhAqjluA.js";
|
|
16
|
+
import { a as wilcoxonSignedRank, i as mannWhitneyU, n as pairArms, r as pairRunRecords, t as comparePairedArms } from "./paired-arms-Ct4LTKc1.js";
|
|
17
|
+
import { a as welchsTTest, c as fisherExactTwoSided, d as studentTTwoSidedPValue, f as twoByTwoPValue, i as iqr, l as linearRegressionSlope, n as checkCanaries, o as chiSquared, s as chiSquaredPValue, t as analyzeRuns, u as normalTwoSidedPValue } from "./analyze-runs-DqPJaJ4X.js";
|
|
18
|
+
import { n as bonferroni, r as holm, t as benjaminiHochberg } from "./multiplicity-Sg0U7h8j.js";
|
|
19
|
+
import { a as pairedRiskDifferenceScore, i as pairedRiskDifferenceExact, o as passAtK, r as pairedRiskDifference, s as wilson, t as mcnemar } from "./paired-binary-B_nejA44.js";
|
|
20
|
+
import { i as pairedBootstrap, n as BOOTSTRAP_GATE_MIN_N, o as pairedSignTest, s as pairedTTest, t as mean$1 } from "./mean-BbA_JCzW.js";
|
|
21
|
+
import { a as requiredSampleSize, i as requiredPairedSampleSize, n as mcnemarRequiredN, r as pairedMde, t as mcnemarPower } from "./power-and-mde-N5nU4_Ly.js";
|
|
22
|
+
import { t as eProcess } from "./sequential-eprocess-DodI6RoF.js";
|
|
23
|
+
import { i as pairedDeltaTest, n as pairedDecisionShape, r as minimumPairsForPairedDeltaTest, t as decidePairedPromotion } from "./paired-promotion-decision-D0SHb-ZL.js";
|
|
24
|
+
import { c as runsForScenario, i as judgeSpans, t as argHash } from "./query-B_RZ36an.js";
|
|
25
|
+
import { n as contentHash, r as fileVerdictCache, t as canonicalJson } from "./verdict-cache-CL_7tePD.js";
|
|
26
|
+
import { G as runCanaries, H as redTeamDataset, Q as runCampaign, U as redTeamReport, V as DEFAULT_RED_TEAM_CORPUS, W as scoreRedTeamOutput, a as aggregateRunScore, i as transientDispatchFailure, o as clamp01, t as llmJudge } from "./llm-judge-C8jMTNNG.js";
|
|
29
27
|
import { a as resolveModelPricing, i as isModelPriced, n as estimateCost, r as estimateTokens, t as MODEL_PRICING } from "./metrics-BKaPBtIG.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { a as
|
|
34
|
-
import { S as requiredPairsForPairedPromotion, n as paretoFrontier, t as dominates, x as pairedPromotionPower } from "./pareto-
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import { t as
|
|
38
|
-
import { t as
|
|
39
|
-
import { t as
|
|
40
|
-
import { G as DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, U as parseFindingSubject, h as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, l as createBoundedTraceAnalysisStore, m as DEFAULT_TRACE_ANALYST_BUDGETS, t as createTraceAnalyst } from "./kind-factory-BobI5Jy3.js";
|
|
41
|
-
import { _ as completedAnalystReviewQuality, b as validateAnalystReviewDecisions, c as FAILURE_MODE_KIND_SPEC, g as assertUniqueFindingIds, h as analystRunDigest, i as DEFAULT_TRACE_ANALYST_KINDS, m as analystFindingDigest, n as AnalystRegistry, t as buildDefaultAnalystRegistry, v as readAnalystReview, y as snapshotAnalystRun } from "./default-registry-COhk9g36.js";
|
|
28
|
+
import { c as costForTokenPricing, i as CostCeilingReachedError, l as costForUsage, n as CostAccountingIncompleteError, t as CostLedger } from "./cost-ledger-D0352Z4d.js";
|
|
29
|
+
import { D as surfaceContentHash, M as assertRealBackend, N as summarizeBackendIntegrity, _ as parseReflectionResponse, a as ATTESTATION_ALGORITHM, g as buildReflectionPrompt, j as BackendIntegrityError, o as attest, s as verifyAttestation } from "./campaign-evidence-CQYw8_0H.js";
|
|
30
|
+
import { a as redact, c as shareAllowed, n as assessShareSafety, o as redactForShare, s as redactText, t as REDACTION_VERSION } from "./redact-mtkTiJVk.js";
|
|
31
|
+
import { a as makeProposalFinding, i as makeFinding, r as computeFindingId } from "./types-DqFMNTgK.js";
|
|
32
|
+
import { S as requiredPairsForPairedPromotion, n as paretoFrontier, t as dominates, x as pairedPromotionPower } from "./pareto-BzsxidFD.js";
|
|
33
|
+
import { a as LlmCallError, i as stripFencedJson, n as isRecord, o as LlmResponseError } from "./json-BhdsJaOQ.js";
|
|
34
|
+
import { r as selfImprove, t as defineAgentEval } from "./define-agent-eval-BDxNlP3D.js";
|
|
35
|
+
import { n as equivalenceVerdict, t as certificationEvidenceDigest } from "./verdict-BGQmxQ8A.js";
|
|
36
|
+
import { c as createBoundedTraceAnalysisStore, p as DEFAULT_TRACE_ANALYST_BUDGETS, t as createTraceAnalyst } from "./kind-factory-Gy4fXixd.js";
|
|
37
|
+
import { _ as readAnalystReview, c as FAILURE_MODE_KIND_SPEC, g as completedAnalystReviewQuality, h as assertUniqueFindingIds, i as DEFAULT_TRACE_ANALYST_KINDS, m as analystRunDigest, n as AnalystRegistry, p as analystFindingDigest, t as buildDefaultAnalystRegistry, v as snapshotAnalystRun, y as validateAnalystReviewDecisions } from "./default-registry-ClYjq3QE.js";
|
|
42
38
|
import { OUTPUT_VALUE } from "./trace-attributes.js";
|
|
43
|
-
import {
|
|
44
|
-
import { n as InMemoryRawProviderSink, r as NoopRawProviderSink, t as FileSystemRawProviderSink } from "./raw-provider-sink-
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
39
|
+
import { n as extractUsageFromSse, t as extractUsage } from "./extract-usage-BZLU01kR.js";
|
|
40
|
+
import { n as InMemoryRawProviderSink, r as NoopRawProviderSink, t as FileSystemRawProviderSink } from "./raw-provider-sink-75w4FWBj.js";
|
|
41
|
+
import { _ as exportRunAsOtlp, b as captureFetchToRawSink, c as describeTraceInsightScope, g as analyzeTraces, h as tokenizeDomainWords, l as domainEvidencePattern, m as scoreTraceInsightReadiness, n as toolSpansToTraceAnalysisStore, o as buildTraceInsightContext, s as buildTraceInsightPrompt, u as inferDomainKeywords } from "./store-tool-spans-D5l_OfTJ.js";
|
|
42
|
+
import { t as TraceEmitter } from "./emitter-DbMXUIVP.js";
|
|
43
|
+
import { n as assertRunCaptured, t as RunIntegrityError } from "./integrity-W4CADcFc.js";
|
|
47
44
|
import { n as InMemoryTraceStore, t as FileSystemTraceStore } from "./store-BhNuLdJw.js";
|
|
48
45
|
import { t as packageVersion$1 } from "./package-version-D7lQHt_-.js";
|
|
49
|
-
import {
|
|
46
|
+
import { t as buildTrajectory } from "./trajectory-D_7rLrvE.js";
|
|
47
|
+
import { i as failureBlame, n as classifyFailure, r as classifyFailureReason } from "./failure-taxonomy-Bx5oWqaW.js";
|
|
50
48
|
import { n as runBoundedProcess, t as DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS } from "./bounded-process-Cj9YjXbE.js";
|
|
51
|
-
import { t as runEvalCampaign } from "./eval-campaign-
|
|
52
|
-
import "./rollout-
|
|
53
|
-
import { t as mintRolloutRows } from "./mint-
|
|
54
|
-
import { n as pairedEvalueSequence, t as evaluateInterimReleaseConfidence } from "./sequential-
|
|
55
|
-
import {
|
|
56
|
-
import { n as paidJsonChat } from "./chat-json-call-
|
|
57
|
-
import { t as createDspyRlmTraceEngine } from "./dspy-rlm-engine-
|
|
58
|
-
import {
|
|
59
|
-
import { a as budgetBreachView, i as failureClusterView, n as computeToolUseMetrics, r as judgeAgreementView, t as toolWasteView } from "./tool-waste-
|
|
60
|
-
import {
|
|
61
|
-
import { a as spanRecordsToTraceAnalysisStore, i as otlpTextToTraceAnalysisStore, r as OtlpFileTraceStore } from "./store-otlp-
|
|
62
|
-
import { n as
|
|
63
|
-
import { t as createChatClient } from "./chat-client-
|
|
49
|
+
import { t as runEvalCampaign } from "./eval-campaign-BLEfBGbA.js";
|
|
50
|
+
import "./rollout-D6C50mfA.js";
|
|
51
|
+
import { t as mintRolloutRows } from "./mint-zszyYlpA.js";
|
|
52
|
+
import { n as pairedEvalueSequence, t as evaluateInterimReleaseConfidence } from "./sequential-BVv1sjsw.js";
|
|
53
|
+
import { a as maximumChargeForLlmRequest, c as ModelSubstitutionError, f as assertServedModels, g as judgeFamily, h as assertCrossFamily, i as costReceiptFromLlmError, l as assertCrossFamilyServed, m as CrossFamilyError, o as backoffMs, p as checkServedModel, r as costReceiptFromLlm, s as isTransientLlmError, u as assertServedModel } from "./llm-client-BshCREn6.js";
|
|
54
|
+
import { n as paidJsonChat } from "./chat-json-call-DavzexSp.js";
|
|
55
|
+
import { t as createDspyRlmTraceEngine } from "./dspy-rlm-engine-DhdCr1Dc.js";
|
|
56
|
+
import { n as diffFindings, r as createChatTraceEngine, t as FindingsStore } from "./findings-store-BMVQtEsm.js";
|
|
57
|
+
import { a as budgetBreachView, i as failureClusterView, n as computeToolUseMetrics, r as judgeAgreementView, t as toolWasteView } from "./tool-waste-DLsjS_p-.js";
|
|
58
|
+
import { a as judgeGateDecision, c as snapshotFromJudgeAgreement, g as analyzeSeries, i as assertJudgeMayGate, n as JudgeGateRefusedError, o as measureJudgeAgreement, r as addCalibrationVerdicts, s as registerCalibrationSet, t as DEFAULT_JUDGE_GATE_POLICY } from "./judge-gate-Co5tuh57.js";
|
|
59
|
+
import { a as spanRecordsToTraceAnalysisStore, i as otlpTextToTraceAnalysisStore, r as OtlpFileTraceStore } from "./store-otlp-BteDAbHK.js";
|
|
60
|
+
import { n as bootstrapCi, t as evaluateReleaseConfidence } from "./release-confidence-CYIFH-fp.js";
|
|
61
|
+
import { t as createChatClient } from "./chat-client-ldqxYYTN.js";
|
|
64
62
|
import { createHash } from "node:crypto";
|
|
65
63
|
import { accessSync, appendFileSync, constants, cpSync, existsSync, mkdirSync, promises, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
66
64
|
import { basename, delimiter, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -3460,37 +3458,6 @@ var ProductClient = class {
|
|
|
3460
3458
|
* implementations live with their consumer because they depend on
|
|
3461
3459
|
* SDK-specific Box / Sandbox types that don't belong in this package.
|
|
3462
3460
|
*/
|
|
3463
|
-
/**
|
|
3464
|
-
* Host-process runner, mapped onto {@link runBoundedProcess} so the package
|
|
3465
|
-
* has one spawn site rather than two.
|
|
3466
|
-
*
|
|
3467
|
-
* It used `spawnSync` and therefore had none of the bounds that runner exists
|
|
3468
|
-
* to provide: a `capMs` timeout killed the direct child and left any
|
|
3469
|
-
* descendant it had started running, a killed run could still report exit
|
|
3470
|
-
* code 0, captured output was unbounded, and the whole run blocked the event
|
|
3471
|
-
* loop. This runner spawns build, test and lint commands, which are exactly
|
|
3472
|
-
* the commands most likely to start descendants.
|
|
3473
|
-
*
|
|
3474
|
-
* It is not the package's last private spawn: `nodeProcessRunner`
|
|
3475
|
-
* (`src/trace-repair/docker-environment.ts`) and `runProcess`
|
|
3476
|
-
* (`src/campaign/external-optimizer-subprocess.ts`) still spawn their own
|
|
3477
|
-
* detached children, and several one-shot `spawnSync` git and CLI calls
|
|
3478
|
-
* remain. What this removes is the second spawn behind the `CommandRunner`
|
|
3479
|
-
* contract, which is the one that graded build, test and lint commands.
|
|
3480
|
-
*
|
|
3481
|
-
* Two behaviours the mapping changes on purpose:
|
|
3482
|
-
* - a run with no `capMs` is now bounded by
|
|
3483
|
-
* {@link LOCAL_COMMAND_RUNNER_DEFAULT_CAP_MS} instead of running forever;
|
|
3484
|
-
* - the run no longer blocks the event loop, so a minutes-long `capMs` no
|
|
3485
|
-
* longer stalls everything else in the process.
|
|
3486
|
-
*/
|
|
3487
|
-
/**
|
|
3488
|
-
* Wall clock {@link localCommandRunner} applies when the caller names no
|
|
3489
|
-
* `capMs`. It is `runBoundedProcess`'s own default, stated here because this
|
|
3490
|
-
* runner used to be unbounded: a consumer whose command runs longer names its
|
|
3491
|
-
* own `capMs`, and a run the bound stops says so with `timedOut: true`.
|
|
3492
|
-
*/
|
|
3493
|
-
const LOCAL_COMMAND_RUNNER_DEFAULT_CAP_MS = DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS;
|
|
3494
3461
|
const localCommandRunner = {
|
|
3495
3462
|
name: "local",
|
|
3496
3463
|
async run(input) {
|
|
@@ -4424,65 +4391,6 @@ async function discoverPersonas(dir, opts = {}) {
|
|
|
4424
4391
|
return results;
|
|
4425
4392
|
}
|
|
4426
4393
|
//#endregion
|
|
4427
|
-
//#region src/improvement-verdict.ts
|
|
4428
|
-
const DEFAULTS = {
|
|
4429
|
-
keepThreshold: 5,
|
|
4430
|
-
regressionThreshold: 5,
|
|
4431
|
-
iqrUnstableAbove: 10,
|
|
4432
|
-
stddevUnstableAbove: Number.POSITIVE_INFINITY,
|
|
4433
|
-
minRepsForVerdict: 3
|
|
4434
|
-
};
|
|
4435
|
-
function resolveThresholds(t) {
|
|
4436
|
-
const r = {
|
|
4437
|
-
...DEFAULTS,
|
|
4438
|
-
...t ?? {}
|
|
4439
|
-
};
|
|
4440
|
-
if (r.keepThreshold < 0) throw new ValidationError(`improvement-verdict: keepThreshold must be >= 0, got ${r.keepThreshold}`);
|
|
4441
|
-
if (r.regressionThreshold < 0) throw new ValidationError(`improvement-verdict: regressionThreshold must be >= 0, got ${r.regressionThreshold}`);
|
|
4442
|
-
if (r.minRepsForVerdict < 1) throw new ValidationError(`improvement-verdict: minRepsForVerdict must be >= 1, got ${r.minRepsForVerdict}`);
|
|
4443
|
-
return r;
|
|
4444
|
-
}
|
|
4445
|
-
/**
|
|
4446
|
-
* Verdict for a candidate against its parent. Pure — operates on already-computed
|
|
4447
|
-
* stats. KEEP/REGRESSION require both sides to have `>= minRepsForVerdict` reps
|
|
4448
|
-
* AND the candidate to be `stable`; otherwise the result is NOISE (unstable) or
|
|
4449
|
-
* ITERATE (not enough reps / no parent).
|
|
4450
|
-
*/
|
|
4451
|
-
function improvementVerdict(candidate, parent, thresholds) {
|
|
4452
|
-
const t = resolveThresholds(thresholds);
|
|
4453
|
-
if (!parent) return {
|
|
4454
|
-
verdict: "ITERATE",
|
|
4455
|
-
medianDelta: null,
|
|
4456
|
-
reason: "no parent experiment to compare against"
|
|
4457
|
-
};
|
|
4458
|
-
if (candidate.n < t.minRepsForVerdict || parent.n < t.minRepsForVerdict) return {
|
|
4459
|
-
verdict: "ITERATE",
|
|
4460
|
-
medianDelta: null,
|
|
4461
|
-
reason: `need >= ${t.minRepsForVerdict} reps on both sides (candidate n=${candidate.n}, parent n=${parent.n})`
|
|
4462
|
-
};
|
|
4463
|
-
if (!candidate.stable) return {
|
|
4464
|
-
verdict: "NOISE",
|
|
4465
|
-
medianDelta: candidate.median - parent.median,
|
|
4466
|
-
reason: `candidate unstable (iqr=${candidate.iqr}, stddev=${candidate.stddev.toFixed(2)})`
|
|
4467
|
-
};
|
|
4468
|
-
const medianDelta = candidate.median - parent.median;
|
|
4469
|
-
if (medianDelta > t.keepThreshold) return {
|
|
4470
|
-
verdict: "KEEP",
|
|
4471
|
-
medianDelta,
|
|
4472
|
-
reason: `median +${medianDelta} > +${t.keepThreshold}`
|
|
4473
|
-
};
|
|
4474
|
-
if (medianDelta < -t.regressionThreshold) return {
|
|
4475
|
-
verdict: "REGRESSION",
|
|
4476
|
-
medianDelta,
|
|
4477
|
-
reason: `median ${medianDelta} < -${t.regressionThreshold}`
|
|
4478
|
-
};
|
|
4479
|
-
return {
|
|
4480
|
-
verdict: "NOISE",
|
|
4481
|
-
medianDelta,
|
|
4482
|
-
reason: `median delta ${medianDelta} inside noise band [-${t.regressionThreshold}, +${t.keepThreshold}]`
|
|
4483
|
-
};
|
|
4484
|
-
}
|
|
4485
|
-
//#endregion
|
|
4486
4394
|
//#region src/propose-review.ts
|
|
4487
4395
|
/**
|
|
4488
4396
|
* Propose / Verify / Review — the core multi-shot primitive.
|
|
@@ -4553,14 +4461,14 @@ function jsonlReviewStore(path) {
|
|
|
4553
4461
|
}
|
|
4554
4462
|
};
|
|
4555
4463
|
}
|
|
4556
|
-
const DEFAULT_FALLBACK_INSTRUCTION
|
|
4464
|
+
const DEFAULT_FALLBACK_INSTRUCTION = "Inspect the verification failures above. Fix the critical issues first, then the major ones. Do not restate the failures — act on them.";
|
|
4557
4465
|
async function runProposeReview(config) {
|
|
4558
4466
|
const maxShots = config.maxShots ?? 10;
|
|
4559
4467
|
const maxWallMs = config.maxWallMs ?? 6e5;
|
|
4560
4468
|
const confidenceFloor = config.confidenceFloor ?? .3;
|
|
4561
4469
|
const confidenceFloorWindow = config.confidenceFloorWindow ?? 2;
|
|
4562
4470
|
const memory = config.memory ?? inMemoryReviewStore();
|
|
4563
|
-
const fallbackInstruction = config.fallbackInstruction ?? DEFAULT_FALLBACK_INSTRUCTION
|
|
4471
|
+
const fallbackInstruction = config.fallbackInstruction ?? DEFAULT_FALLBACK_INSTRUCTION;
|
|
4564
4472
|
const emitter = config.store ? new TraceEmitter(config.store) : null;
|
|
4565
4473
|
if (emitter) await emitter.startRun({
|
|
4566
4474
|
scenarioId: config.scenarioId ?? "propose-review",
|
|
@@ -4793,196 +4701,6 @@ function safeJson(x) {
|
|
|
4793
4701
|
}
|
|
4794
4702
|
}
|
|
4795
4703
|
//#endregion
|
|
4796
|
-
//#region src/propose-review-control.ts
|
|
4797
|
-
const DEFAULT_FALLBACK_INSTRUCTION = "Inspect the verification failures above. Fix the critical issues first, then the major ones. Do not restate the failures — act on them.";
|
|
4798
|
-
async function runProposeReviewAsControlLoop(config) {
|
|
4799
|
-
const maxShots = config.maxShots ?? 10;
|
|
4800
|
-
const confidenceFloor = config.confidenceFloor ?? .3;
|
|
4801
|
-
const confidenceFloorWindow = config.confidenceFloorWindow ?? 2;
|
|
4802
|
-
const memory = config.memory ?? inMemoryReviewStore();
|
|
4803
|
-
const fallbackInstruction = config.fallbackInstruction ?? DEFAULT_FALLBACK_INSTRUCTION;
|
|
4804
|
-
const failureClassFromVerification = config.failureClassFromVerification ?? controlFailureClassFromVerification;
|
|
4805
|
-
let lowConfidenceStreak = 0;
|
|
4806
|
-
let current = {
|
|
4807
|
-
shot: 0,
|
|
4808
|
-
state: config.initialState,
|
|
4809
|
-
priorReview: null,
|
|
4810
|
-
verification: { pass: false },
|
|
4811
|
-
memory: await memory.load(),
|
|
4812
|
-
completed: false,
|
|
4813
|
-
reviewAvailable: false
|
|
4814
|
-
};
|
|
4815
|
-
return runAgentControlLoop({
|
|
4816
|
-
intent: config.goal,
|
|
4817
|
-
budget: {
|
|
4818
|
-
maxSteps: maxShots,
|
|
4819
|
-
maxWallMs: config.maxWallMs
|
|
4820
|
-
},
|
|
4821
|
-
store: config.store,
|
|
4822
|
-
scenarioId: config.scenarioId ?? "propose-review-control",
|
|
4823
|
-
projectId: config.projectId,
|
|
4824
|
-
variantId: config.variantId,
|
|
4825
|
-
actionFailure: config.actionFailure ?? "stop",
|
|
4826
|
-
observe: () => current,
|
|
4827
|
-
validate: ({ state }) => [objectiveEval({
|
|
4828
|
-
id: "verification",
|
|
4829
|
-
passed: state.verification.pass,
|
|
4830
|
-
score: state.verification.score,
|
|
4831
|
-
severity: "critical",
|
|
4832
|
-
detail: state.verification.pass ? "verification passed" : `verification failed${state.verification.failingLayers?.length ? `: ${state.verification.failingLayers.join(", ")}` : ""}`
|
|
4833
|
-
})],
|
|
4834
|
-
shouldStop: ({ state }) => {
|
|
4835
|
-
if (state.verification.pass) return {
|
|
4836
|
-
stop: true,
|
|
4837
|
-
pass: true,
|
|
4838
|
-
reason: "verification passed",
|
|
4839
|
-
score: state.verification.score
|
|
4840
|
-
};
|
|
4841
|
-
if (state.completed) return {
|
|
4842
|
-
stop: true,
|
|
4843
|
-
pass: false,
|
|
4844
|
-
reason: "reviewer stopped continuation",
|
|
4845
|
-
score: state.verification.score,
|
|
4846
|
-
failureClass: failureClassFromVerification(state.verification)
|
|
4847
|
-
};
|
|
4848
|
-
return {
|
|
4849
|
-
stop: false,
|
|
4850
|
-
pass: false,
|
|
4851
|
-
reason: "verification still failing",
|
|
4852
|
-
score: state.verification.score
|
|
4853
|
-
};
|
|
4854
|
-
},
|
|
4855
|
-
decide: ({ state }) => ({
|
|
4856
|
-
type: "continue",
|
|
4857
|
-
action: {
|
|
4858
|
-
type: "propose-review-shot",
|
|
4859
|
-
shot: state.shot + 1
|
|
4860
|
-
},
|
|
4861
|
-
reason: state.priorReview?.nextShotInstruction ?? fallbackInstruction
|
|
4862
|
-
}),
|
|
4863
|
-
act: async (action, ctx) => {
|
|
4864
|
-
const shot = action.shot;
|
|
4865
|
-
const proposeOut = await config.propose({
|
|
4866
|
-
shot,
|
|
4867
|
-
goal: config.goal,
|
|
4868
|
-
state: current.state,
|
|
4869
|
-
priorReview: current.priorReview,
|
|
4870
|
-
abortSignal: ctx.abortSignal,
|
|
4871
|
-
emitter: ctx.emitter
|
|
4872
|
-
});
|
|
4873
|
-
const nextState = proposeOut.state;
|
|
4874
|
-
const verification = await config.verify(nextState);
|
|
4875
|
-
let review = null;
|
|
4876
|
-
let reviewAvailable = false;
|
|
4877
|
-
let reviewError;
|
|
4878
|
-
let shouldContinue = !verification.pass;
|
|
4879
|
-
if (!verification.pass) try {
|
|
4880
|
-
review = await config.review({
|
|
4881
|
-
shot,
|
|
4882
|
-
goal: config.goal,
|
|
4883
|
-
state: nextState,
|
|
4884
|
-
verification,
|
|
4885
|
-
traceSummary: proposeOut.traceSummary,
|
|
4886
|
-
memory: await memory.load()
|
|
4887
|
-
});
|
|
4888
|
-
reviewAvailable = true;
|
|
4889
|
-
shouldContinue = review.shouldContinue;
|
|
4890
|
-
lowConfidenceStreak = review.confidence <= confidenceFloor ? lowConfidenceStreak + 1 : 0;
|
|
4891
|
-
if (confidenceFloorWindow > 0 && lowConfidenceStreak >= confidenceFloorWindow) shouldContinue = false;
|
|
4892
|
-
} catch (err) {
|
|
4893
|
-
reviewError = err instanceof Error ? err.message : String(err);
|
|
4894
|
-
review = current.priorReview ?? {
|
|
4895
|
-
observations: "Reviewer unavailable.",
|
|
4896
|
-
diagnosis: reviewError,
|
|
4897
|
-
nextShotInstruction: fallbackInstruction,
|
|
4898
|
-
shouldContinue: true,
|
|
4899
|
-
confidence: 0
|
|
4900
|
-
};
|
|
4901
|
-
shouldContinue = true;
|
|
4902
|
-
}
|
|
4903
|
-
else review = {
|
|
4904
|
-
observations: "Verification passed.",
|
|
4905
|
-
diagnosis: "No further revision needed.",
|
|
4906
|
-
nextShotInstruction: "",
|
|
4907
|
-
shouldContinue: false,
|
|
4908
|
-
confidence: 1
|
|
4909
|
-
};
|
|
4910
|
-
const entry = {
|
|
4911
|
-
...review ?? {
|
|
4912
|
-
observations: "No review.",
|
|
4913
|
-
diagnosis: "",
|
|
4914
|
-
nextShotInstruction: fallbackInstruction,
|
|
4915
|
-
shouldContinue,
|
|
4916
|
-
confidence: 0
|
|
4917
|
-
},
|
|
4918
|
-
shot,
|
|
4919
|
-
timestamp: Date.now(),
|
|
4920
|
-
verification: {
|
|
4921
|
-
pass: verification.pass,
|
|
4922
|
-
score: verification.score,
|
|
4923
|
-
failingLayers: verification.failingLayers
|
|
4924
|
-
}
|
|
4925
|
-
};
|
|
4926
|
-
await memory.append(entry);
|
|
4927
|
-
current = {
|
|
4928
|
-
shot,
|
|
4929
|
-
state: nextState,
|
|
4930
|
-
priorReview: review,
|
|
4931
|
-
verification,
|
|
4932
|
-
traceSummary: proposeOut.traceSummary,
|
|
4933
|
-
memory: await memory.load(),
|
|
4934
|
-
completed: verification.pass || !shouldContinue,
|
|
4935
|
-
reviewAvailable,
|
|
4936
|
-
reviewError
|
|
4937
|
-
};
|
|
4938
|
-
return {
|
|
4939
|
-
state: nextState,
|
|
4940
|
-
verification,
|
|
4941
|
-
traceSummary: proposeOut.traceSummary,
|
|
4942
|
-
review,
|
|
4943
|
-
reviewAvailable,
|
|
4944
|
-
reviewError
|
|
4945
|
-
};
|
|
4946
|
-
}
|
|
4947
|
-
});
|
|
4948
|
-
}
|
|
4949
|
-
function controlFailureClassFromVerification(verification) {
|
|
4950
|
-
if (verification.pass) return void 0;
|
|
4951
|
-
return verification.failingLayers?.length ? "instruction_following" : "unknown";
|
|
4952
|
-
}
|
|
4953
|
-
//#endregion
|
|
4954
|
-
//#region src/analyst/steer-firewall.ts
|
|
4955
|
-
/** True iff the finding is a JUDGE VERDICT (an acceptance score lifted into a
|
|
4956
|
-
* finding), identified by provenance set at the lift site — independent of
|
|
4957
|
-
* whatever evidence it cites. */
|
|
4958
|
-
function isJudgeVerdict(finding) {
|
|
4959
|
-
return finding.derived_from_judge === true;
|
|
4960
|
-
}
|
|
4961
|
-
/**
|
|
4962
|
-
* THE steer firewall. Fail-loud guard for any path that admits analyst findings
|
|
4963
|
-
* as STEERING input (the `f(trace)` role): rejects — naming the offenders — any
|
|
4964
|
-
* finding whose provenance is a judge verdict, rather than let `J` leak into the
|
|
4965
|
-
* loop. Returns the findings unchanged for chaining.
|
|
4966
|
-
*
|
|
4967
|
-
* Call this at the chokepoint where a detector that ALSO scores/gates has its
|
|
4968
|
-
* findings turned into a steer (the judge-and-steer dual-role case). It keys on
|
|
4969
|
-
* provenance, so it correctly admits evidence-less trace-analyst observations and
|
|
4970
|
-
* correctly rejects an artifact-citing judge verdict — the cases an evidence
|
|
4971
|
-
* check gets backwards.
|
|
4972
|
-
*
|
|
4973
|
-
* It is necessary, not sufficient: it stops PROVENANCE-tagged verdicts. A judge
|
|
4974
|
-
* whose output is laundered through a hand-built finding with no provenance flag
|
|
4975
|
-
* is out of its reach — provenance must be honestly set at every judge→finding
|
|
4976
|
-
* lift (today: createJudgeAdapter). That is why the integrity rule lives at the
|
|
4977
|
-
* lift site, and why ProposeContext.judgeScores?: never is the complementary
|
|
4978
|
-
* compile-time tripwire on the obvious direct channel.
|
|
4979
|
-
*/
|
|
4980
|
-
function assertNoJudgeVerdict(findings, context = "steer") {
|
|
4981
|
-
const leaks = findings.filter(isJudgeVerdict);
|
|
4982
|
-
if (leaks.length > 0) throw new Error(`${context}: a judge verdict cannot be admitted as steering input — that is the held-out judge leaking into the loop. Offending judge-derived findings: [${leaks.map((f) => f.finding_id).join(", ")}]. Steering consumes observations of behavior, never acceptance verdicts.`);
|
|
4983
|
-
return findings;
|
|
4984
|
-
}
|
|
4985
|
-
//#endregion
|
|
4986
4704
|
//#region src/analyst/policy-edit.ts
|
|
4987
4705
|
const POLICY_EDIT_AXES = [
|
|
4988
4706
|
"carrier",
|
|
@@ -5013,20 +4731,7 @@ var PolicyEditValidationError = class extends ValidationError {
|
|
|
5013
4731
|
this.path = path;
|
|
5014
4732
|
}
|
|
5015
4733
|
};
|
|
5016
|
-
const DEFAULT_MIN_SCORE = .7;
|
|
5017
|
-
const DEFAULT_MIN_EXPECTED_GAIN = .01;
|
|
5018
4734
|
const POLICY_EDIT_ID = /^policy-edit:sha256:[0-9a-f]{64}$/;
|
|
5019
|
-
function makePolicyEdit(init) {
|
|
5020
|
-
const normalized = normalizePolicyEdit({
|
|
5021
|
-
schemaVersion: "policy-edit/v1",
|
|
5022
|
-
...init,
|
|
5023
|
-
source: normalizeSource(init.source)
|
|
5024
|
-
});
|
|
5025
|
-
return validatePolicyEdit({
|
|
5026
|
-
...normalized,
|
|
5027
|
-
editId: init.editId ?? computePolicyEditId(normalized)
|
|
5028
|
-
});
|
|
5029
|
-
}
|
|
5030
4735
|
function computePolicyEditId(edit) {
|
|
5031
4736
|
const { editId: _editId, schemaVersion, ...material } = edit;
|
|
5032
4737
|
return `policy-edit:${hashCanonical({
|
|
@@ -5080,363 +4785,6 @@ function validatePolicyEditCandidateRecord(input) {
|
|
|
5080
4785
|
policyEdit: validatePolicyEdit(snapshot)
|
|
5081
4786
|
};
|
|
5082
4787
|
}
|
|
5083
|
-
function policyEditsFromFindings(findings, opts = {}) {
|
|
5084
|
-
assertNoJudgeVerdict(findings, "policyEditsFromFindings");
|
|
5085
|
-
const edits = [];
|
|
5086
|
-
for (const finding of findings) {
|
|
5087
|
-
const edit = policyEditFromFinding(finding, opts);
|
|
5088
|
-
if (edit) edits.push(edit);
|
|
5089
|
-
}
|
|
5090
|
-
return edits;
|
|
5091
|
-
}
|
|
5092
|
-
function policyEditFromFinding(finding, opts = {}) {
|
|
5093
|
-
assertNoJudgeVerdict([finding], "policyEditFromFinding");
|
|
5094
|
-
if (!finding.recommended_action?.trim()) return null;
|
|
5095
|
-
const expectedGain = resolveExpectedGain(finding, opts);
|
|
5096
|
-
if (!expectedGain) return null;
|
|
5097
|
-
if (typeof finding.confidence !== "number" || !Number.isFinite(finding.confidence) || finding.confidence < 0 || finding.confidence > 1) return null;
|
|
5098
|
-
const routed = routeFindingSubject(finding.subject, opts);
|
|
5099
|
-
const risk = resolveRisk(finding, opts);
|
|
5100
|
-
return makePolicyEdit({
|
|
5101
|
-
axis: routed.axis,
|
|
5102
|
-
target: routed.target,
|
|
5103
|
-
change: {
|
|
5104
|
-
kind: "text",
|
|
5105
|
-
mode: "append",
|
|
5106
|
-
value: finding.recommended_action.trim()
|
|
5107
|
-
},
|
|
5108
|
-
claim: finding.claim,
|
|
5109
|
-
rationale: finding.rationale,
|
|
5110
|
-
expectedGain,
|
|
5111
|
-
confidence: finding.confidence,
|
|
5112
|
-
risk,
|
|
5113
|
-
validationPlan: finding.validation_plan,
|
|
5114
|
-
source: {
|
|
5115
|
-
findingIds: [finding.finding_id],
|
|
5116
|
-
analystIds: [finding.analyst_id],
|
|
5117
|
-
evidenceRefs: finding.evidence_refs,
|
|
5118
|
-
derivedFromJudge: finding.derived_from_judge
|
|
5119
|
-
}
|
|
5120
|
-
});
|
|
5121
|
-
}
|
|
5122
|
-
function scorePolicyEditReadiness(edit, opts = {}) {
|
|
5123
|
-
validatePolicyEdit(edit);
|
|
5124
|
-
const minExpectedGain = opts.minExpectedGain ?? DEFAULT_MIN_EXPECTED_GAIN;
|
|
5125
|
-
const requireEvidence = opts.requireEvidence ?? false;
|
|
5126
|
-
const evidenceScore = Math.min(1, edit.source.evidenceRefs.length / 2);
|
|
5127
|
-
const confidenceScore = clamp01$3(edit.confidence);
|
|
5128
|
-
const gainScore = clamp01$3(Math.abs(edit.expectedGain.amount) / Math.max(minExpectedGain * 5, .001));
|
|
5129
|
-
const targetScore = targetSpecificityScore(edit);
|
|
5130
|
-
const riskPenalty = edit.risk === "high" && opts.allowHighRisk !== true ? .35 : edit.risk === "unknown" ? .2 : 0;
|
|
5131
|
-
return clamp01$3((requireEvidence ? .3 * evidenceScore + .25 * confidenceScore + .25 * gainScore + .2 * targetScore : .35 * confidenceScore + .35 * gainScore + .3 * targetScore + .1 * evidenceScore) - riskPenalty);
|
|
5132
|
-
}
|
|
5133
|
-
function admitPolicyEdit(edit, opts = {}) {
|
|
5134
|
-
const validated = validatePolicyEdit(edit);
|
|
5135
|
-
const score = scorePolicyEditReadiness(validated, opts);
|
|
5136
|
-
const reasons = [];
|
|
5137
|
-
const minExpectedGain = opts.minExpectedGain ?? DEFAULT_MIN_EXPECTED_GAIN;
|
|
5138
|
-
const requireEvidence = opts.requireEvidence ?? false;
|
|
5139
|
-
if (validated.source.derivedFromJudge) reasons.push("source is judge-derived; judge verdicts cannot steer policy edits");
|
|
5140
|
-
if (requireEvidence && validated.source.evidenceRefs.length === 0) reasons.push("missing evidence refs");
|
|
5141
|
-
if (Math.abs(validated.expectedGain.amount) < minExpectedGain) reasons.push(`expected gain below ${minExpectedGain}`);
|
|
5142
|
-
if (validated.risk === "high" && opts.allowHighRisk !== true) reasons.push("high-risk edit requires explicit allowHighRisk");
|
|
5143
|
-
if (score < (opts.minScore ?? DEFAULT_MIN_SCORE)) reasons.push(`readiness score ${score.toFixed(3)} below ${(opts.minScore ?? DEFAULT_MIN_SCORE).toFixed(3)}`);
|
|
5144
|
-
return {
|
|
5145
|
-
edit: validated,
|
|
5146
|
-
decision: reasons.length === 0 ? "admit" : "reject",
|
|
5147
|
-
score,
|
|
5148
|
-
reasons
|
|
5149
|
-
};
|
|
5150
|
-
}
|
|
5151
|
-
function applyPolicyEditToSurface(surface, edit) {
|
|
5152
|
-
const validated = validatePolicyEdit(edit);
|
|
5153
|
-
if (validated.change.kind === "text") return applyTextChange(surface, validated.change);
|
|
5154
|
-
return applyJsonChange(surface, validated.change);
|
|
5155
|
-
}
|
|
5156
|
-
function routeFindingSubject(subject, opts) {
|
|
5157
|
-
const parsed = parseFindingSubject(subject);
|
|
5158
|
-
if (!parsed) return {
|
|
5159
|
-
axis: opts.defaultAxis ?? "representation",
|
|
5160
|
-
target: { surface: opts.defaultTargetSurface ?? "prompt" }
|
|
5161
|
-
};
|
|
5162
|
-
return routeParsedSubject(parsed);
|
|
5163
|
-
}
|
|
5164
|
-
function routeParsedSubject(subject) {
|
|
5165
|
-
switch (subject.kind) {
|
|
5166
|
-
case "system-prompt": return {
|
|
5167
|
-
axis: "representation",
|
|
5168
|
-
target: {
|
|
5169
|
-
surface: "prompt",
|
|
5170
|
-
path: `system-prompt:${subject.section}`
|
|
5171
|
-
}
|
|
5172
|
-
};
|
|
5173
|
-
case "skill": return {
|
|
5174
|
-
axis: "agent_profile",
|
|
5175
|
-
target: {
|
|
5176
|
-
surface: "agent-profile",
|
|
5177
|
-
path: `skill:${subject.name}`
|
|
5178
|
-
}
|
|
5179
|
-
};
|
|
5180
|
-
case "tool-doc": return {
|
|
5181
|
-
axis: "tool_contract",
|
|
5182
|
-
target: {
|
|
5183
|
-
surface: "tool-contract",
|
|
5184
|
-
path: subject.aspect ? `tool-doc:${subject.tool}:${subject.aspect}` : `tool-doc:${subject.tool}`
|
|
5185
|
-
}
|
|
5186
|
-
};
|
|
5187
|
-
case "new-tool": return {
|
|
5188
|
-
axis: "tool_contract",
|
|
5189
|
-
target: {
|
|
5190
|
-
surface: "tool-contract",
|
|
5191
|
-
path: `new-tool:${subject.name}`
|
|
5192
|
-
}
|
|
5193
|
-
};
|
|
5194
|
-
case "mcp": return {
|
|
5195
|
-
axis: "tool_contract",
|
|
5196
|
-
target: {
|
|
5197
|
-
surface: "agent-profile",
|
|
5198
|
-
path: subject.tool ? `mcp:${subject.server}:${subject.tool}` : `mcp:${subject.server}`
|
|
5199
|
-
}
|
|
5200
|
-
};
|
|
5201
|
-
case "hook": return {
|
|
5202
|
-
axis: "agent_profile",
|
|
5203
|
-
target: {
|
|
5204
|
-
surface: "agent-profile",
|
|
5205
|
-
path: `hook:${subject.name}`
|
|
5206
|
-
}
|
|
5207
|
-
};
|
|
5208
|
-
case "subagent": return {
|
|
5209
|
-
axis: "routing",
|
|
5210
|
-
target: {
|
|
5211
|
-
surface: "agent-profile",
|
|
5212
|
-
path: `subagent:${subject.name}`
|
|
5213
|
-
}
|
|
5214
|
-
};
|
|
5215
|
-
case "workflow": return {
|
|
5216
|
-
axis: "routing",
|
|
5217
|
-
target: {
|
|
5218
|
-
surface: "runtime-config",
|
|
5219
|
-
path: `workflow:${subject.name}`
|
|
5220
|
-
}
|
|
5221
|
-
};
|
|
5222
|
-
case "rollout-policy": return {
|
|
5223
|
-
axis: rolloutPolicyAxis(subject.field),
|
|
5224
|
-
target: {
|
|
5225
|
-
surface: "runtime-config",
|
|
5226
|
-
path: `rollout-policy:${subject.field}`
|
|
5227
|
-
}
|
|
5228
|
-
};
|
|
5229
|
-
case "agent-profile": return {
|
|
5230
|
-
axis: "agent_profile",
|
|
5231
|
-
target: {
|
|
5232
|
-
surface: "agent-profile",
|
|
5233
|
-
path: `agent-profile:${subject.field}`
|
|
5234
|
-
}
|
|
5235
|
-
};
|
|
5236
|
-
case "code": return {
|
|
5237
|
-
axis: "representation",
|
|
5238
|
-
target: {
|
|
5239
|
-
surface: "code",
|
|
5240
|
-
path: `code:${subject.path}`
|
|
5241
|
-
}
|
|
5242
|
-
};
|
|
5243
|
-
case "rag": return {
|
|
5244
|
-
axis: "memory",
|
|
5245
|
-
target: {
|
|
5246
|
-
surface: "memory",
|
|
5247
|
-
path: `rag:${subject.corpus}:${subject.docId}`
|
|
5248
|
-
}
|
|
5249
|
-
};
|
|
5250
|
-
case "memory": return {
|
|
5251
|
-
axis: "memory",
|
|
5252
|
-
target: {
|
|
5253
|
-
surface: "memory",
|
|
5254
|
-
path: `memory:${subject.key}`
|
|
5255
|
-
}
|
|
5256
|
-
};
|
|
5257
|
-
case "scaffolding": return {
|
|
5258
|
-
axis: "routing",
|
|
5259
|
-
target: {
|
|
5260
|
-
surface: "runtime-config",
|
|
5261
|
-
path: `scaffolding:${subject.concern}`
|
|
5262
|
-
}
|
|
5263
|
-
};
|
|
5264
|
-
case "output-schema": return {
|
|
5265
|
-
axis: "output_contract",
|
|
5266
|
-
target: {
|
|
5267
|
-
surface: "runtime-config",
|
|
5268
|
-
path: `output-schema:${subject.field}`
|
|
5269
|
-
}
|
|
5270
|
-
};
|
|
5271
|
-
case "knowledge.wiki": return {
|
|
5272
|
-
axis: "memory",
|
|
5273
|
-
target: {
|
|
5274
|
-
surface: "memory",
|
|
5275
|
-
path: `agent-knowledge:wiki:${subject.slug}${subject.heading ? `#${subject.heading}` : ""}`
|
|
5276
|
-
}
|
|
5277
|
-
};
|
|
5278
|
-
case "knowledge.claim": return {
|
|
5279
|
-
axis: "memory",
|
|
5280
|
-
target: {
|
|
5281
|
-
surface: "memory",
|
|
5282
|
-
path: `agent-knowledge:claim:${subject.topic}`
|
|
5283
|
-
}
|
|
5284
|
-
};
|
|
5285
|
-
case "knowledge.raw": return {
|
|
5286
|
-
axis: "memory",
|
|
5287
|
-
target: {
|
|
5288
|
-
surface: "memory",
|
|
5289
|
-
path: `agent-knowledge:raw:${subject.sourceId}`
|
|
5290
|
-
}
|
|
5291
|
-
};
|
|
5292
|
-
case "knowledge.stale": return {
|
|
5293
|
-
axis: "memory",
|
|
5294
|
-
target: {
|
|
5295
|
-
surface: "memory",
|
|
5296
|
-
path: `agent-knowledge:stale:${subject.slug}`
|
|
5297
|
-
}
|
|
5298
|
-
};
|
|
5299
|
-
case "websearch.outdated": return {
|
|
5300
|
-
axis: "memory",
|
|
5301
|
-
target: {
|
|
5302
|
-
surface: "memory",
|
|
5303
|
-
path: `websearch:outdated:${subject.topic}`
|
|
5304
|
-
}
|
|
5305
|
-
};
|
|
5306
|
-
case "prior-run-summary": return {
|
|
5307
|
-
axis: "memory",
|
|
5308
|
-
target: {
|
|
5309
|
-
surface: "memory",
|
|
5310
|
-
path: `prior-run-summary:${subject.topic}`
|
|
5311
|
-
}
|
|
5312
|
-
};
|
|
5313
|
-
case "cluster": return {
|
|
5314
|
-
axis: "representation",
|
|
5315
|
-
target: {
|
|
5316
|
-
surface: "prompt",
|
|
5317
|
-
path: subject.label
|
|
5318
|
-
}
|
|
5319
|
-
};
|
|
5320
|
-
}
|
|
5321
|
-
}
|
|
5322
|
-
function rolloutPolicyAxis(field) {
|
|
5323
|
-
const normalized = field.toLowerCase();
|
|
5324
|
-
if (/budget|max(?:imum)?[-_. ]?(?:turns?|tokens?|cost)|timeout|deadline/.test(normalized)) return "budget";
|
|
5325
|
-
if (/temperature|top[-_. ]?p|sampling|seed|shots?|parallel|concurrency/.test(normalized)) return "sampling";
|
|
5326
|
-
if (/output|schema|format/.test(normalized)) return "output_contract";
|
|
5327
|
-
return "routing";
|
|
5328
|
-
}
|
|
5329
|
-
function resolveExpectedGain(finding, opts) {
|
|
5330
|
-
if (typeof opts.expectedGain === "function") return opts.expectedGain(finding) ?? null;
|
|
5331
|
-
if (opts.expectedGain) return opts.expectedGain;
|
|
5332
|
-
return readExpectedGainFromMetadata(finding.metadata);
|
|
5333
|
-
}
|
|
5334
|
-
function readExpectedGainFromMetadata(metadata) {
|
|
5335
|
-
const raw = readPolicyEditMetadata(metadata)?.expectedGain ?? readPolicyEditMetadata(metadata)?.expected_gain;
|
|
5336
|
-
if (!raw || typeof raw !== "object") return null;
|
|
5337
|
-
const obj = raw;
|
|
5338
|
-
if (typeof obj.metric !== "string" || obj.direction !== "increase" && obj.direction !== "decrease" || typeof obj.amount !== "number" || !Number.isFinite(obj.amount) || obj.amount <= 0) return null;
|
|
5339
|
-
const out = {
|
|
5340
|
-
metric: obj.metric,
|
|
5341
|
-
direction: obj.direction,
|
|
5342
|
-
amount: obj.amount
|
|
5343
|
-
};
|
|
5344
|
-
if (obj.unit === "absolute" || obj.unit === "relative" || obj.unit === "percent" || obj.unit === "score") out.unit = obj.unit;
|
|
5345
|
-
if (typeof obj.rationale === "string") out.rationale = obj.rationale;
|
|
5346
|
-
return out;
|
|
5347
|
-
}
|
|
5348
|
-
function readPolicyEditMetadata(metadata) {
|
|
5349
|
-
const raw = metadata?.policyEdit ?? metadata?.policy_edit;
|
|
5350
|
-
return raw && typeof raw === "object" ? raw : null;
|
|
5351
|
-
}
|
|
5352
|
-
function resolveRisk(finding, opts) {
|
|
5353
|
-
if (typeof opts.risk === "function") return opts.risk(finding);
|
|
5354
|
-
if (opts.risk) return opts.risk;
|
|
5355
|
-
const raw = readPolicyEditMetadata(finding.metadata)?.risk;
|
|
5356
|
-
if (raw === "low" || raw === "medium" || raw === "high" || raw === "unknown") return raw;
|
|
5357
|
-
if (finding.severity === "critical" || finding.severity === "high") return "medium";
|
|
5358
|
-
return "low";
|
|
5359
|
-
}
|
|
5360
|
-
function applyTextChange(surface, change) {
|
|
5361
|
-
if (typeof surface !== "string") throw new PolicyEditValidationError("text policy edits require a string surface", "change");
|
|
5362
|
-
if (change.mode === "append") {
|
|
5363
|
-
if (hasExactTextBlock(surface, change.value)) return surface;
|
|
5364
|
-
return `${surface.trimEnd()}\n\n${change.value}`.trimStart();
|
|
5365
|
-
}
|
|
5366
|
-
if (change.mode === "prepend") {
|
|
5367
|
-
if (hasExactTextBlock(surface, change.value)) return surface;
|
|
5368
|
-
return `${change.value}\n\n${surface.trimStart()}`.trimEnd();
|
|
5369
|
-
}
|
|
5370
|
-
const find = expectNonEmpty(change.find, "change.find");
|
|
5371
|
-
if (!surface.includes(find)) throw new PolicyEditValidationError("replace target not found in surface", "change.find");
|
|
5372
|
-
return surface.replace(find, change.value);
|
|
5373
|
-
}
|
|
5374
|
-
function applyJsonChange(surface, change) {
|
|
5375
|
-
const root = parseJsonSurface(surface);
|
|
5376
|
-
const path = splitPath(change.path);
|
|
5377
|
-
if (change.mode === "remove") return setJsonAtPath(root, path, void 0, "remove");
|
|
5378
|
-
if (change.mode === "set") return setJsonAtPath(root, path, change.value ?? null, "set");
|
|
5379
|
-
const prior = readJsonAtPath(root, path);
|
|
5380
|
-
return setJsonAtPath(root, path, prior && typeof prior === "object" && !Array.isArray(prior) && change.value && typeof change.value === "object" && !Array.isArray(change.value) ? {
|
|
5381
|
-
...prior,
|
|
5382
|
-
...change.value
|
|
5383
|
-
} : change.value ?? null, "set");
|
|
5384
|
-
}
|
|
5385
|
-
function parseJsonSurface(surface) {
|
|
5386
|
-
if (typeof surface === "string") try {
|
|
5387
|
-
return JSON.parse(surface);
|
|
5388
|
-
} catch {
|
|
5389
|
-
throw new PolicyEditValidationError("json policy edits require a JSON string surface", "change");
|
|
5390
|
-
}
|
|
5391
|
-
assertJson(surface, "surface");
|
|
5392
|
-
return surface;
|
|
5393
|
-
}
|
|
5394
|
-
function readJsonAtPath(root, path) {
|
|
5395
|
-
let cursor = root;
|
|
5396
|
-
for (const part of path) {
|
|
5397
|
-
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) return void 0;
|
|
5398
|
-
cursor = cursor[part];
|
|
5399
|
-
}
|
|
5400
|
-
return cursor;
|
|
5401
|
-
}
|
|
5402
|
-
function setJsonAtPath(root, path, value, mode) {
|
|
5403
|
-
if (path.length === 0) {
|
|
5404
|
-
if (mode === "remove") return null;
|
|
5405
|
-
return value ?? null;
|
|
5406
|
-
}
|
|
5407
|
-
if (root === null || typeof root !== "object" || Array.isArray(root)) throw new PolicyEditValidationError("json edit root must be an object", "change.path");
|
|
5408
|
-
const out = { ...root };
|
|
5409
|
-
let cursor = out;
|
|
5410
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
5411
|
-
const key = path[i];
|
|
5412
|
-
const existing = cursor[key];
|
|
5413
|
-
if (mode === "remove" && (!existing || typeof existing !== "object" || Array.isArray(existing))) return out;
|
|
5414
|
-
const next = existing && typeof existing === "object" && !Array.isArray(existing) ? { ...existing } : {};
|
|
5415
|
-
cursor[key] = next;
|
|
5416
|
-
cursor = next;
|
|
5417
|
-
}
|
|
5418
|
-
const leaf = path[path.length - 1];
|
|
5419
|
-
if (mode === "remove") delete cursor[leaf];
|
|
5420
|
-
else cursor[leaf] = value ?? null;
|
|
5421
|
-
return out;
|
|
5422
|
-
}
|
|
5423
|
-
function normalizePolicyEdit(input) {
|
|
5424
|
-
const out = {
|
|
5425
|
-
schemaVersion: "policy-edit/v1",
|
|
5426
|
-
axis: input.axis,
|
|
5427
|
-
target: normalizeTarget(input.target),
|
|
5428
|
-
change: normalizeChange(input.change),
|
|
5429
|
-
claim: input.claim.trim(),
|
|
5430
|
-
expectedGain: normalizeExpectedGain(input.expectedGain),
|
|
5431
|
-
confidence: input.confidence,
|
|
5432
|
-
risk: input.risk,
|
|
5433
|
-
source: normalizeSource(input.source)
|
|
5434
|
-
};
|
|
5435
|
-
if (input.rationale?.trim()) out.rationale = input.rationale.trim();
|
|
5436
|
-
if (input.validationPlan?.trim()) out.validationPlan = input.validationPlan.trim();
|
|
5437
|
-
if (input.metadata) out.metadata = input.metadata;
|
|
5438
|
-
return out;
|
|
5439
|
-
}
|
|
5440
4788
|
function assertJsonSafe(value, path, ancestors = /* @__PURE__ */ new WeakSet()) {
|
|
5441
4789
|
if (value === null || typeof value === "string" || typeof value === "boolean") return;
|
|
5442
4790
|
if (typeof value === "number") {
|
|
@@ -5458,50 +4806,6 @@ function assertJsonSafe(value, path, ancestors = /* @__PURE__ */ new WeakSet())
|
|
|
5458
4806
|
}
|
|
5459
4807
|
ancestors.delete(value);
|
|
5460
4808
|
}
|
|
5461
|
-
function normalizeTarget(target) {
|
|
5462
|
-
const out = { surface: target.surface };
|
|
5463
|
-
if (target.path?.trim()) out.path = target.path.trim();
|
|
5464
|
-
if (target.agentProfileCell) out.agentProfileCell = validateAgentProfileCell(target.agentProfileCell);
|
|
5465
|
-
if (target.label?.trim()) out.label = target.label.trim();
|
|
5466
|
-
return out;
|
|
5467
|
-
}
|
|
5468
|
-
function normalizeChange(change) {
|
|
5469
|
-
if (change.kind === "text") {
|
|
5470
|
-
const out = {
|
|
5471
|
-
kind: "text",
|
|
5472
|
-
mode: change.mode,
|
|
5473
|
-
value: change.value.trim()
|
|
5474
|
-
};
|
|
5475
|
-
if (change.find?.trim()) out.find = change.find.trim();
|
|
5476
|
-
return out;
|
|
5477
|
-
}
|
|
5478
|
-
const out = {
|
|
5479
|
-
kind: "json",
|
|
5480
|
-
mode: change.mode,
|
|
5481
|
-
path: change.path.trim()
|
|
5482
|
-
};
|
|
5483
|
-
if (change.value !== void 0) out.value = change.value;
|
|
5484
|
-
return out;
|
|
5485
|
-
}
|
|
5486
|
-
function normalizeExpectedGain(gain) {
|
|
5487
|
-
const out = {
|
|
5488
|
-
metric: gain.metric.trim(),
|
|
5489
|
-
direction: gain.direction,
|
|
5490
|
-
amount: gain.amount
|
|
5491
|
-
};
|
|
5492
|
-
if (gain.unit) out.unit = gain.unit;
|
|
5493
|
-
if (gain.rationale?.trim()) out.rationale = gain.rationale.trim();
|
|
5494
|
-
return out;
|
|
5495
|
-
}
|
|
5496
|
-
function normalizeSource(source) {
|
|
5497
|
-
const out = {
|
|
5498
|
-
findingIds: uniqueSorted(source.findingIds.map((s) => s.trim()).filter(Boolean)),
|
|
5499
|
-
analystIds: uniqueSorted(source.analystIds.map((s) => s.trim()).filter(Boolean)),
|
|
5500
|
-
evidenceRefs: source.evidenceRefs
|
|
5501
|
-
};
|
|
5502
|
-
if (source.derivedFromJudge) out.derivedFromJudge = true;
|
|
5503
|
-
return out;
|
|
5504
|
-
}
|
|
5505
4809
|
function validateTarget(target) {
|
|
5506
4810
|
if (!target || typeof target !== "object") throw new PolicyEditValidationError("expected object", "target");
|
|
5507
4811
|
const obj = target;
|
|
@@ -5584,14 +4888,6 @@ function assertJson(value, path) {
|
|
|
5584
4888
|
}
|
|
5585
4889
|
throw new PolicyEditValidationError("expected JSON-compatible value", path);
|
|
5586
4890
|
}
|
|
5587
|
-
function targetSpecificityScore(edit) {
|
|
5588
|
-
let score = .4;
|
|
5589
|
-
if (edit.target.path) score += .25;
|
|
5590
|
-
if (edit.target.agentProfileCell) score += .15;
|
|
5591
|
-
if (edit.change.kind === "json" || edit.change.mode === "replace") score += .2;
|
|
5592
|
-
else if (edit.change.value.length > 0) score += .1;
|
|
5593
|
-
return clamp01$3(score);
|
|
5594
|
-
}
|
|
5595
4891
|
const FORBIDDEN_PATH_KEYS = /* @__PURE__ */ new Set([
|
|
5596
4892
|
"__proto__",
|
|
5597
4893
|
"constructor",
|
|
@@ -5609,21 +4905,9 @@ function expectLiteral(value, expected, path) {
|
|
|
5609
4905
|
function expectString$1(value, path) {
|
|
5610
4906
|
if (typeof value !== "string" || value.trim().length === 0) throw new PolicyEditValidationError("expected non-empty string", path);
|
|
5611
4907
|
}
|
|
5612
|
-
function expectNonEmpty(value, path) {
|
|
5613
|
-
expectString$1(value, path);
|
|
5614
|
-
return value;
|
|
5615
|
-
}
|
|
5616
4908
|
function expectConfidence(value, path) {
|
|
5617
4909
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) throw new PolicyEditValidationError("expected finite number in [0,1]", path);
|
|
5618
4910
|
}
|
|
5619
|
-
function hasExactTextBlock(surface, value) {
|
|
5620
|
-
const needle = normalizeTextBlock(value);
|
|
5621
|
-
const normalizedSurface = surface.replace(/\r\n/g, "\n");
|
|
5622
|
-
return [...normalizedSurface.split(/\n{2,}/), ...normalizedSurface.split("\n")].some((block) => normalizeTextBlock(block) === needle);
|
|
5623
|
-
}
|
|
5624
|
-
function normalizeTextBlock(value) {
|
|
5625
|
-
return value.replace(/\r\n/g, "\n").trim();
|
|
5626
|
-
}
|
|
5627
4911
|
function expectOneOf(value, allowed, path) {
|
|
5628
4912
|
if (typeof value !== "string" || !allowed.includes(value)) throw new PolicyEditValidationError(`expected one of ${allowed.join(", ")}`, path);
|
|
5629
4913
|
}
|
|
@@ -5635,15 +4919,6 @@ function expectNonEmptyStringArray(value, path) {
|
|
|
5635
4919
|
expectStringArray$1(value, path);
|
|
5636
4920
|
if (value.length === 0) throw new PolicyEditValidationError("expected non-empty array", path);
|
|
5637
4921
|
}
|
|
5638
|
-
function uniqueSorted(values) {
|
|
5639
|
-
return [...new Set(values)].sort();
|
|
5640
|
-
}
|
|
5641
|
-
function clamp01$3(n) {
|
|
5642
|
-
if (!Number.isFinite(n)) return 0;
|
|
5643
|
-
if (n < 0) return 0;
|
|
5644
|
-
if (n > 1) return 1;
|
|
5645
|
-
return n;
|
|
5646
|
-
}
|
|
5647
4922
|
//#endregion
|
|
5648
4923
|
//#region src/capability-headroom.ts
|
|
5649
4924
|
/**
|
|
@@ -6208,58 +5483,6 @@ function partitionHeldOut(ids, options = {}) {
|
|
|
6208
5483
|
function assertFraction(f) {
|
|
6209
5484
|
if (!Number.isFinite(f) || f <= 0 || f >= 1) throw new ValidationError(`partitionHeldOut: holdoutFraction must be in (0, 1), got ${f}`);
|
|
6210
5485
|
}
|
|
6211
|
-
/**
|
|
6212
|
-
* Partition items into disjoint train, selection and test sets, the three
|
|
6213
|
-
* partitions `compareOptimizationMethods` and Runtime `improve()` take.
|
|
6214
|
-
*
|
|
6215
|
-
* Assignment is per unit: `hashToUnit(unit, seed)` below `testFraction` is
|
|
6216
|
-
* test, below `testFraction + selectionFraction` is selection, and the rest is
|
|
6217
|
-
* train. A unit therefore keeps its partition as the corpus grows, and items of
|
|
6218
|
-
* one unit never straddle two partitions. Fail-loud like `partitionHeldOut`:
|
|
6219
|
-
* empty input, a duplicate or empty id, an empty unit, fractions outside
|
|
6220
|
-
* (0, 1) or summing to 1 or more, and a partition below its floor all throw.
|
|
6221
|
-
* Order within each partition follows the input order.
|
|
6222
|
-
*/
|
|
6223
|
-
function partitionTrainSelectionTest(items, options = {}) {
|
|
6224
|
-
const seed = options.seed ?? "train-selection-test-v1";
|
|
6225
|
-
const selectionFraction = options.selectionFraction ?? .25;
|
|
6226
|
-
const testFraction = options.testFraction ?? .25;
|
|
6227
|
-
assertSplitFraction("selectionFraction", selectionFraction);
|
|
6228
|
-
assertSplitFraction("testFraction", testFraction);
|
|
6229
|
-
if (selectionFraction + testFraction >= 1) throw new ValidationError(`partitionTrainSelectionTest: selectionFraction + testFraction must be below 1, got ${selectionFraction + testFraction}`);
|
|
6230
|
-
if (items.length === 0) throw new ValidationError("partitionTrainSelectionTest: no items supplied");
|
|
6231
|
-
const unitOf = options.unitOf ?? ((item) => item.id);
|
|
6232
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6233
|
-
const partition = {
|
|
6234
|
-
train: [],
|
|
6235
|
-
selection: [],
|
|
6236
|
-
test: [],
|
|
6237
|
-
seed,
|
|
6238
|
-
selectionFraction,
|
|
6239
|
-
testFraction
|
|
6240
|
-
};
|
|
6241
|
-
for (const item of items) {
|
|
6242
|
-
if (typeof item.id !== "string" || item.id.length === 0) throw new ValidationError(`partitionTrainSelectionTest: ids must be non-empty strings, got ${JSON.stringify(item.id)}`);
|
|
6243
|
-
if (seen.has(item.id)) throw new ValidationError(`partitionTrainSelectionTest: duplicate id "${item.id}" — one item cannot be scored in two partitions`);
|
|
6244
|
-
seen.add(item.id);
|
|
6245
|
-
const unit = unitOf(item);
|
|
6246
|
-
if (typeof unit !== "string" || unit.length === 0) throw new ValidationError(`partitionTrainSelectionTest: item "${item.id}" has no unit`);
|
|
6247
|
-
const position = hashToUnit(unit, seed);
|
|
6248
|
-
if (position < testFraction) partition.test.push(item);
|
|
6249
|
-
else if (position < testFraction + selectionFraction) partition.selection.push(item);
|
|
6250
|
-
else partition.train.push(item);
|
|
6251
|
-
}
|
|
6252
|
-
const floors = [
|
|
6253
|
-
["train", options.minTrain ?? 1],
|
|
6254
|
-
["selection", options.minSelection ?? 1],
|
|
6255
|
-
["test", options.minTest ?? 1]
|
|
6256
|
-
];
|
|
6257
|
-
for (const [name, floor] of floors) if (partition[name].length < floor) throw new ValidationError(`partitionTrainSelectionTest: ${name} has ${partition[name].length} item(s), below the floor of ${floor} (n=${items.length}, selectionFraction=${selectionFraction}, testFraction=${testFraction}, seed=${seed})`);
|
|
6258
|
-
return partition;
|
|
6259
|
-
}
|
|
6260
|
-
function assertSplitFraction(name, value) {
|
|
6261
|
-
if (!Number.isFinite(value) || value <= 0 || value >= 1) throw new ValidationError(`partitionTrainSelectionTest: ${name} must be in (0, 1), got ${value}`);
|
|
6262
|
-
}
|
|
6263
5486
|
//#endregion
|
|
6264
5487
|
//#region src/product-benchmark/export.ts
|
|
6265
5488
|
/**
|
|
@@ -7224,9 +6447,6 @@ function parseRuntimeTrajectoryHookEvent(input) {
|
|
|
7224
6447
|
function runtimeTrajectoryRecordKey(record, index, recordIdOf) {
|
|
7225
6448
|
return stringOrUndefined(recordIdOf?.(record, index)) ?? stringOrUndefined(record.id) ?? `record[${index}]`;
|
|
7226
6449
|
}
|
|
7227
|
-
function isRecord(value) {
|
|
7228
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7229
|
-
}
|
|
7230
6450
|
function stringOrUndefined(value) {
|
|
7231
6451
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
7232
6452
|
}
|
|
@@ -7919,6 +7139,40 @@ function fmt(x) {
|
|
|
7919
7139
|
}
|
|
7920
7140
|
//#endregion
|
|
7921
7141
|
//#region src/hidden-criteria-grading.ts
|
|
7142
|
+
/**
|
|
7143
|
+
* Hidden-criteria grading firewall — grade an agent on criteria it never saw.
|
|
7144
|
+
*
|
|
7145
|
+
* A trustworthy benchmark splits every scenario's data by WHERE each field is
|
|
7146
|
+
* allowed to flow, then proves the held-out / judge-only fields never reach the
|
|
7147
|
+
* agent during the run. The coding bench expresses this with four destinations
|
|
7148
|
+
* (prompt / develop-against / held-out suite / rubric); this module lifts the
|
|
7149
|
+
* domain-FREE core out of it so research, legal, tax, content — any domain —
|
|
7150
|
+
* can declare the same routing and get the same firewall enforcement and the
|
|
7151
|
+
* same held-out-weighted composite, plugging in its OWN grader.
|
|
7152
|
+
*
|
|
7153
|
+
* Two reusable pieces, both domain-agnostic:
|
|
7154
|
+
*
|
|
7155
|
+
* 1. FIELD ROUTING BY DESTINATION. A scenario declares each field's
|
|
7156
|
+
* `FieldDestination`; `assertNoHiddenLeak` is a pure checker that throws if
|
|
7157
|
+
* a grading-only or judge-only field's value appears in what reaches the
|
|
7158
|
+
* agent. The domain decides which fields exist and where they go — the
|
|
7159
|
+
* substrate only enforces "hidden stays hidden".
|
|
7160
|
+
*
|
|
7161
|
+
* 2. HIDDEN-CRITERIA GRADING. The domain supplies its own grader
|
|
7162
|
+
* `(artifact, hiddenCriteria) => { passRate, total }` — the coding
|
|
7163
|
+
* node-test executor is ONE such grader a consumer plugs in; the substrate
|
|
7164
|
+
* bakes in NO node/test/TS/exec/regex. `gradeOnHidden` runs that grader
|
|
7165
|
+
* behind the firewall and `blendHeldout` composes its pass rate with a
|
|
7166
|
+
* judge score into the final number the leaderboard ranks on.
|
|
7167
|
+
*
|
|
7168
|
+
* Shape mirrors `treatment-gate`/`authenticity`: pure predicates and pure
|
|
7169
|
+
* composition over already-computed values, fail-loud, with the
|
|
7170
|
+
* "which field / which weight / which grader" decisions left as parameters and
|
|
7171
|
+
* no domain literal anywhere in the module.
|
|
7172
|
+
*
|
|
7173
|
+
* Lives next to `test-graded-scenario` and `partition-held-out` — it is a
|
|
7174
|
+
* scorecard/grading concept that makes sense without a running agent loop.
|
|
7175
|
+
*/
|
|
7922
7176
|
/** The destinations a value must be kept OUT of the agent context for. */
|
|
7923
7177
|
const hiddenDestinations = /* @__PURE__ */ new Set(["grading-only", "judge-only"]);
|
|
7924
7178
|
/** True for the destinations whose values must never reach the agent context. */
|
|
@@ -7926,26 +7180,6 @@ function isHiddenDestination(destination) {
|
|
|
7926
7180
|
return hiddenDestinations.has(destination);
|
|
7927
7181
|
}
|
|
7928
7182
|
/**
|
|
7929
|
-
* Route a domain's named fields by destination into the firewall's input shape.
|
|
7930
|
-
* The `routing` declares each field's destination; the `values` carry each
|
|
7931
|
-
* field's renderable string. A field present in `routing` but missing from
|
|
7932
|
-
* `values` is an authoring error (fail loud) — every routed field must have a
|
|
7933
|
-
* value the firewall can check.
|
|
7934
|
-
*/
|
|
7935
|
-
function routeFields(routing, values) {
|
|
7936
|
-
const out = [];
|
|
7937
|
-
for (const name of Object.keys(routing)) {
|
|
7938
|
-
const value = values[name];
|
|
7939
|
-
if (value === void 0) throw new ValidationError(`routed field "${name}" has a destination but no value — every routed field must carry its value`);
|
|
7940
|
-
out.push({
|
|
7941
|
-
name,
|
|
7942
|
-
value,
|
|
7943
|
-
destination: routing[name]
|
|
7944
|
-
});
|
|
7945
|
-
}
|
|
7946
|
-
return out;
|
|
7947
|
-
}
|
|
7948
|
-
/**
|
|
7949
7183
|
* The FIREWALL. Throws `ValidationError` if any `grading-only`/`judge-only`
|
|
7950
7184
|
* field's value is found inside `agentContext` — the exact text that reaches the
|
|
7951
7185
|
* agent during the run (its prompt, its seeded files concatenated, whatever the
|
|
@@ -7974,34 +7208,6 @@ function assertNoHiddenLeak(fields, agentContext, opts = {}) {
|
|
|
7974
7208
|
}
|
|
7975
7209
|
return fields;
|
|
7976
7210
|
}
|
|
7977
|
-
/** Normalize a grader's raw `{passed, total}` into a `HiddenGradeResult` with a
|
|
7978
|
-
* consistent, fail-loud `passRate` — the canonical "honest zero on no-run"
|
|
7979
|
-
* rule, single-sourced so every domain grader gets it. */
|
|
7980
|
-
function hiddenGrade(passed, total, notes) {
|
|
7981
|
-
const p = Number.isFinite(passed) && passed > 0 ? Math.floor(passed) : 0;
|
|
7982
|
-
const t = Number.isFinite(total) && total > 0 ? Math.floor(total) : 0;
|
|
7983
|
-
const passRate = t > 0 ? Math.min(1, p / t) : 0;
|
|
7984
|
-
return {
|
|
7985
|
-
passed: Math.min(p, t > 0 ? t : p),
|
|
7986
|
-
total: t,
|
|
7987
|
-
passRate,
|
|
7988
|
-
notes
|
|
7989
|
-
};
|
|
7990
|
-
}
|
|
7991
|
-
/**
|
|
7992
|
-
* Run a domain's hidden-criteria grader behind the firewall. Before grading, it
|
|
7993
|
-
* re-asserts the firewall against the agent context the run actually used —
|
|
7994
|
-
* proving (at grading time, on real data) that the hidden criteria never
|
|
7995
|
-
* reached the agent — then invokes the grader and returns its pass rate. A
|
|
7996
|
-
* domain that wants the firewall and the grader wired together in one call uses
|
|
7997
|
-
* this; a domain that already asserted the firewall at dispatch time can call
|
|
7998
|
-
* its grader directly and feed the result to `blendHeldout`.
|
|
7999
|
-
*/
|
|
8000
|
-
async function gradeOnHidden(args) {
|
|
8001
|
-
assertNoHiddenLeak(args.firewall.fields, args.firewall.agentContext, args.firewall.options);
|
|
8002
|
-
const result = await args.grader(args.artifact, args.hiddenCriteria, args.signal);
|
|
8003
|
-
return hiddenGrade(result.passed, result.total, result.notes);
|
|
8004
|
-
}
|
|
8005
7211
|
/** Default blend: 0.7 hidden correctness, 0.3 judge quality. The coding bench's
|
|
8006
7212
|
* long-standing split — execution truth dominates, style refines. */
|
|
8007
7213
|
const defaultBlendWeights = {
|
|
@@ -8032,33 +7238,6 @@ function blendHeldout(heldoutPassRate, judgeScore, weights = defaultBlendWeights
|
|
|
8032
7238
|
const judge = clampUnit(judgeScore);
|
|
8033
7239
|
return w.heldout * heldout + w.judge * judge;
|
|
8034
7240
|
}
|
|
8035
|
-
/**
|
|
8036
|
-
* Wrap a judge's `score` so the `composite` it REPORTS is the held-out-weighted
|
|
8037
|
-
* blend. The judge still scores its quality dimensions (recorded, secondary),
|
|
8038
|
-
* but the composite that downstream selection/scorecard reads becomes
|
|
8039
|
-
* `blendHeldout(heldoutPassRate(artifact), judgeComposite, weights)`. The held-
|
|
8040
|
-
* out pass rate is read off the artifact via `heldoutPassRate` — already
|
|
8041
|
-
* computed before the judge runs — so no second grading pass is needed.
|
|
8042
|
-
*
|
|
8043
|
-
* Generic over the artifact type, inferred from `heldoutPassRate`, so it
|
|
8044
|
-
* composes with both a `campaign` `JudgeConfig.score` and a bare scoring
|
|
8045
|
-
* function. The input is the judge's `{ artifact, ... }` — any extra fields
|
|
8046
|
-
* (`scenario`, `signal`) ride through untouched via the index signature.
|
|
8047
|
-
*/
|
|
8048
|
-
function withHeldoutBlend(score, heldoutPassRate, weights = defaultBlendWeights) {
|
|
8049
|
-
return async (input) => {
|
|
8050
|
-
const base = await score(input);
|
|
8051
|
-
if (base.failed) return base;
|
|
8052
|
-
const rate = clampUnit(heldoutPassRate(input.artifact));
|
|
8053
|
-
const composite = blendHeldout(rate, base.composite, weights);
|
|
8054
|
-
const w = normalizeWeights(weights);
|
|
8055
|
-
return {
|
|
8056
|
-
...base,
|
|
8057
|
-
composite,
|
|
8058
|
-
notes: `composite=${composite.toFixed(3)} (held-out ${(rate * 100).toFixed(0)}% × ${w.heldout.toFixed(2)} + quality ${base.composite.toFixed(3)} × ${w.judge.toFixed(2)})` + (base.notes ? ` — ${base.notes}` : "")
|
|
8059
|
-
};
|
|
8060
|
-
};
|
|
8061
|
-
}
|
|
8062
7241
|
function clampUnit(value) {
|
|
8063
7242
|
if (!Number.isFinite(value)) return 0;
|
|
8064
7243
|
return Math.max(0, Math.min(1, value));
|
|
@@ -8141,12 +7320,12 @@ function assertSingleBackend(agent, judge, opts = {}) {
|
|
|
8141
7320
|
//#endregion
|
|
8142
7321
|
//#region src/intent-match-judge.ts
|
|
8143
7322
|
const INTENT_MATCH_JUDGE_VERSION = "intent-match-judge-v1-2026-04-24";
|
|
8144
|
-
const DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
8145
|
-
const DEFAULT_TIMEOUT = 3e5;
|
|
8146
|
-
const DEFAULT_MAX_TOKENS = 800;
|
|
8147
|
-
const DEFAULT_MAX_SOURCE = 25e3;
|
|
8148
|
-
const DEFAULT_MAX_PER_FILE = 12e3;
|
|
8149
|
-
const DEFAULT_MAX_HTML = 2e4;
|
|
7323
|
+
const DEFAULT_MODEL$1 = "claude-sonnet-4-6";
|
|
7324
|
+
const DEFAULT_TIMEOUT$1 = 3e5;
|
|
7325
|
+
const DEFAULT_MAX_TOKENS$1 = 800;
|
|
7326
|
+
const DEFAULT_MAX_SOURCE$1 = 25e3;
|
|
7327
|
+
const DEFAULT_MAX_PER_FILE$1 = 12e3;
|
|
7328
|
+
const DEFAULT_MAX_HTML$1 = 2e4;
|
|
8150
7329
|
const INTENT_SCHEMA = {
|
|
8151
7330
|
type: "object",
|
|
8152
7331
|
additionalProperties: false,
|
|
@@ -8164,11 +7343,11 @@ const INTENT_SCHEMA = {
|
|
|
8164
7343
|
}
|
|
8165
7344
|
}
|
|
8166
7345
|
};
|
|
8167
|
-
function truncate(body, cap, label) {
|
|
7346
|
+
function truncate$1(body, cap, label) {
|
|
8168
7347
|
if (body.length <= cap) return body;
|
|
8169
7348
|
return `${body.slice(0, cap)}\n… [truncated ${body.length - cap} chars of ${label}]`;
|
|
8170
7349
|
}
|
|
8171
|
-
function buildPrompt(input, opts) {
|
|
7350
|
+
function buildPrompt$1(input, opts) {
|
|
8172
7351
|
const sourceBlob = input.sourceFiles.filter((f) => f.content.length <= opts.maxPerFileChars).map((f) => `--- FILE: ${f.path} ---\n${f.content}`).join("\n\n");
|
|
8173
7352
|
const html = input.servedHtml ?? "";
|
|
8174
7353
|
return `You are evaluating whether an agent built THE RIGHT APP for a user request.
|
|
@@ -8181,8 +7360,8 @@ project entirely?
|
|
|
8181
7360
|
USER REQUEST:
|
|
8182
7361
|
${input.userRequest}
|
|
8183
7362
|
|
|
8184
|
-
${input.artifactLabel ? `ARTIFACT METADATA:\n name: ${input.artifactLabel}\n description: ${input.artifactDescription ?? ""}\n\n` : ""}${html ? `SERVED HTML (what the preview returns):\n${truncate(html, opts.maxHtmlChars, "HTML")}\n\n` : ""}SOURCE FILES (the agent's workdir):
|
|
8185
|
-
${truncate(sourceBlob, opts.maxSourceChars, "source")}
|
|
7363
|
+
${input.artifactLabel ? `ARTIFACT METADATA:\n name: ${input.artifactLabel}\n description: ${input.artifactDescription ?? ""}\n\n` : ""}${html ? `SERVED HTML (what the preview returns):\n${truncate$1(html, opts.maxHtmlChars, "HTML")}\n\n` : ""}SOURCE FILES (the agent's workdir):
|
|
7364
|
+
${truncate$1(sourceBlob, opts.maxSourceChars, "source")}
|
|
8186
7365
|
|
|
8187
7366
|
Score 0–1:
|
|
8188
7367
|
1.0 — unmistakably the right app. Even with bugs, gaps, or missing
|
|
@@ -8214,12 +7393,12 @@ async function runIntentMatchJudge(input, options) {
|
|
|
8214
7393
|
const start = Date.now();
|
|
8215
7394
|
const opts = {
|
|
8216
7395
|
chat: options.chat,
|
|
8217
|
-
model: options.model ?? options.chat.defaultModel ?? DEFAULT_MODEL,
|
|
8218
|
-
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT,
|
|
8219
|
-
maxTokens: options.maxTokens ?? DEFAULT_MAX_TOKENS,
|
|
8220
|
-
maxSourceChars: options.maxSourceChars ?? DEFAULT_MAX_SOURCE,
|
|
8221
|
-
maxPerFileChars: options.maxPerFileChars ?? DEFAULT_MAX_PER_FILE,
|
|
8222
|
-
maxHtmlChars: options.maxHtmlChars ?? DEFAULT_MAX_HTML,
|
|
7396
|
+
model: options.model ?? options.chat.defaultModel ?? DEFAULT_MODEL$1,
|
|
7397
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT$1,
|
|
7398
|
+
maxTokens: options.maxTokens ?? DEFAULT_MAX_TOKENS$1,
|
|
7399
|
+
maxSourceChars: options.maxSourceChars ?? DEFAULT_MAX_SOURCE$1,
|
|
7400
|
+
maxPerFileChars: options.maxPerFileChars ?? DEFAULT_MAX_PER_FILE$1,
|
|
7401
|
+
maxHtmlChars: options.maxHtmlChars ?? DEFAULT_MAX_HTML$1,
|
|
8223
7402
|
...options.pricing ? { pricing: options.pricing } : {},
|
|
8224
7403
|
costLedger: options.costLedger ?? new CostLedger(),
|
|
8225
7404
|
costPhase: options.costPhase ?? "judge.intent-match",
|
|
@@ -8245,7 +7424,7 @@ async function runIntentMatchJudge(input, options) {
|
|
|
8245
7424
|
content: "You are a holistic code reviewer answering one question: did the agent build the right app for the user. Return strict JSON. No prose outside."
|
|
8246
7425
|
}, {
|
|
8247
7426
|
role: "user",
|
|
8248
|
-
content: buildPrompt(input, opts)
|
|
7427
|
+
content: buildPrompt$1(input, opts)
|
|
8249
7428
|
}],
|
|
8250
7429
|
jsonSchema: {
|
|
8251
7430
|
name: "intent_match_judge",
|
|
@@ -8920,38 +8099,6 @@ function mergeSignals(a, b) {
|
|
|
8920
8099
|
* `'test'`-strategy certification: an oracle set IS a small answer key,
|
|
8921
8100
|
* and certifies nothing outside its own coverage.
|
|
8922
8101
|
*/
|
|
8923
|
-
function textInSnapshot(needle, opts = {}) {
|
|
8924
|
-
const id = `text-in-snapshot(${needle})`;
|
|
8925
|
-
return {
|
|
8926
|
-
id,
|
|
8927
|
-
check(obs) {
|
|
8928
|
-
const hay = obs.text ?? "";
|
|
8929
|
-
const found = opts.caseSensitive ? hay.includes(needle) : hay.toLowerCase().includes(needle.toLowerCase());
|
|
8930
|
-
return {
|
|
8931
|
-
id,
|
|
8932
|
-
pass: found,
|
|
8933
|
-
detail: found ? `"${needle}" found` : `"${needle}" not present in observation`,
|
|
8934
|
-
evidence: found ? excerpt(hay, needle, opts.caseSensitive) : void 0
|
|
8935
|
-
};
|
|
8936
|
-
}
|
|
8937
|
-
};
|
|
8938
|
-
}
|
|
8939
|
-
function urlContains(fragment) {
|
|
8940
|
-
const id = `url-contains(${fragment})`;
|
|
8941
|
-
return {
|
|
8942
|
-
id,
|
|
8943
|
-
check(obs) {
|
|
8944
|
-
const url = obs.url ?? "";
|
|
8945
|
-
const pass = url.toLowerCase().includes(fragment.toLowerCase());
|
|
8946
|
-
return {
|
|
8947
|
-
id,
|
|
8948
|
-
pass,
|
|
8949
|
-
detail: pass ? `url ok (${url})` : `url "${url}" missing "${fragment}"`,
|
|
8950
|
-
evidence: url
|
|
8951
|
-
};
|
|
8952
|
-
}
|
|
8953
|
-
};
|
|
8954
|
-
}
|
|
8955
8102
|
function jsonShape(expected) {
|
|
8956
8103
|
const id = `json-shape(${Object.keys(expected).join(",")})`;
|
|
8957
8104
|
return {
|
|
@@ -8991,77 +8138,6 @@ function jsonShape(expected) {
|
|
|
8991
8138
|
}
|
|
8992
8139
|
};
|
|
8993
8140
|
}
|
|
8994
|
-
function regexMatches(pattern) {
|
|
8995
|
-
const id = `regex(${pattern.source})`;
|
|
8996
|
-
return {
|
|
8997
|
-
id,
|
|
8998
|
-
check(obs) {
|
|
8999
|
-
const m = (obs.text ?? "").match(pattern);
|
|
9000
|
-
return {
|
|
9001
|
-
id,
|
|
9002
|
-
pass: m !== null,
|
|
9003
|
-
detail: m ? `matched "${m[0]}"` : `pattern ${pattern.source} not matched`,
|
|
9004
|
-
evidence: m?.[0]
|
|
9005
|
-
};
|
|
9006
|
-
}
|
|
9007
|
-
};
|
|
9008
|
-
}
|
|
9009
|
-
/**
|
|
9010
|
-
* Anti-bot detector — distinguishes genuine failures from blocked navigation
|
|
9011
|
-
* (cloudflare, recaptcha, etc). Returns an Oracle that PASSES when no block
|
|
9012
|
-
* marker is present; on block, detail names the blocker so runners can tag
|
|
9013
|
-
* results as "blocked" rather than "failed". Lifted from browser-agent-driver.
|
|
9014
|
-
*/
|
|
9015
|
-
function notBlocked() {
|
|
9016
|
-
const id = "not-blocked";
|
|
9017
|
-
const markers = [
|
|
9018
|
-
{
|
|
9019
|
-
name: "cloudflare",
|
|
9020
|
-
re: /just a moment|verifying you are human|cf-chl-|cloudflare/i
|
|
9021
|
-
},
|
|
9022
|
-
{
|
|
9023
|
-
name: "recaptcha",
|
|
9024
|
-
re: /recaptcha|i'?m not a robot|challenge.?form/i
|
|
9025
|
-
},
|
|
9026
|
-
{
|
|
9027
|
-
name: "hcaptcha",
|
|
9028
|
-
re: /hcaptcha/i
|
|
9029
|
-
},
|
|
9030
|
-
{
|
|
9031
|
-
name: "akamai",
|
|
9032
|
-
re: /akamai|pragma: no-cache/i
|
|
9033
|
-
},
|
|
9034
|
-
{
|
|
9035
|
-
name: "perimeterx",
|
|
9036
|
-
re: /perimeterx|px-captcha/i
|
|
9037
|
-
},
|
|
9038
|
-
{
|
|
9039
|
-
name: "rate-limit",
|
|
9040
|
-
re: /rate.?limit|429 too many requests/i
|
|
9041
|
-
},
|
|
9042
|
-
{
|
|
9043
|
-
name: "access-denied",
|
|
9044
|
-
re: /access denied|403 forbidden/i
|
|
9045
|
-
}
|
|
9046
|
-
];
|
|
9047
|
-
return {
|
|
9048
|
-
id,
|
|
9049
|
-
check(obs) {
|
|
9050
|
-
const hay = obs.text ?? "";
|
|
9051
|
-
for (const { name, re } of markers) if (re.test(hay)) return {
|
|
9052
|
-
id,
|
|
9053
|
-
pass: false,
|
|
9054
|
-
detail: `blocked by ${name}`,
|
|
9055
|
-
evidence: (hay.match(re) ?? [])[0]
|
|
9056
|
-
};
|
|
9057
|
-
return {
|
|
9058
|
-
id,
|
|
9059
|
-
pass: true,
|
|
9060
|
-
detail: "no anti-bot block detected"
|
|
9061
|
-
};
|
|
9062
|
-
}
|
|
9063
|
-
};
|
|
9064
|
-
}
|
|
9065
8141
|
/** Run all oracles against one observation and aggregate. */
|
|
9066
8142
|
function evaluateOracles(obs, oracles) {
|
|
9067
8143
|
const results = oracles.map((o) => o.check(obs));
|
|
@@ -9088,19 +8164,305 @@ function evaluateOracles(obs, oracles) {
|
|
|
9088
8164
|
}
|
|
9089
8165
|
};
|
|
9090
8166
|
}
|
|
9091
|
-
function excerpt(hay, needle, caseSensitive = false) {
|
|
9092
|
-
const haySearch = caseSensitive ? hay : hay.toLowerCase();
|
|
9093
|
-
const needleSearch = caseSensitive ? needle : needle.toLowerCase();
|
|
9094
|
-
const idx = haySearch.indexOf(needleSearch);
|
|
9095
|
-
if (idx === -1) return "";
|
|
9096
|
-
const start = Math.max(0, idx - 20);
|
|
9097
|
-
const end = Math.min(hay.length, idx + needle.length + 20);
|
|
9098
|
-
return (start > 0 ? "…" : "") + hay.slice(start, end) + (end < hay.length ? "…" : "");
|
|
9099
|
-
}
|
|
9100
8167
|
function isObject(v) {
|
|
9101
8168
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
9102
8169
|
}
|
|
9103
8170
|
//#endregion
|
|
8171
|
+
//#region src/produced-state.ts
|
|
8172
|
+
function artifactKind(mimeType) {
|
|
8173
|
+
if (!mimeType) return "file";
|
|
8174
|
+
if (mimeType.includes("json")) return "json";
|
|
8175
|
+
if (mimeType.startsWith("text/")) return "text";
|
|
8176
|
+
return "file";
|
|
8177
|
+
}
|
|
8178
|
+
/**
|
|
8179
|
+
* Normalize an emission-ordered stream into its latest observed produced state.
|
|
8180
|
+
* Artifacts are keyed by their exact output path (name, then URI, then id);
|
|
8181
|
+
* proposals by id. Later observations replace earlier ones, including missing
|
|
8182
|
+
* content or a rejected status. An obsolete version cannot prove completion.
|
|
8183
|
+
* Distinct paths remain distinct; no path normalization or aliasing is inferred.
|
|
8184
|
+
* Results retain first-seen identity order. Tool names describe invocation,
|
|
8185
|
+
* not success, and are deduplicated in first-seen order.
|
|
8186
|
+
*
|
|
8187
|
+
* An artifact without observed content yields empty content, which the
|
|
8188
|
+
* completion oracle rejects. This projection does not verify external effects,
|
|
8189
|
+
* recover dropped events, or establish freshness beyond the supplied stream.
|
|
8190
|
+
*/
|
|
8191
|
+
function extractProducedState(events) {
|
|
8192
|
+
const artifacts = /* @__PURE__ */ new Map();
|
|
8193
|
+
const proposals = /* @__PURE__ */ new Map();
|
|
8194
|
+
const toolCalls = [];
|
|
8195
|
+
const seenTools = /* @__PURE__ */ new Set();
|
|
8196
|
+
for (const ev of events) if (ev.type === "tool_call") {
|
|
8197
|
+
const name = ev.toolName;
|
|
8198
|
+
if (name && !seenTools.has(name)) {
|
|
8199
|
+
seenTools.add(name);
|
|
8200
|
+
toolCalls.push(name);
|
|
8201
|
+
}
|
|
8202
|
+
} else if (ev.type === "artifact") {
|
|
8203
|
+
const a = ev;
|
|
8204
|
+
const path = a.name ?? a.uri ?? a.artifactId;
|
|
8205
|
+
artifacts.set(path, {
|
|
8206
|
+
kind: artifactKind(a.mimeType),
|
|
8207
|
+
path,
|
|
8208
|
+
content: a.content ?? ""
|
|
8209
|
+
});
|
|
8210
|
+
} else if (ev.type === "proposal_created") {
|
|
8211
|
+
const p = ev;
|
|
8212
|
+
proposals.set(p.proposalId, {
|
|
8213
|
+
id: p.proposalId,
|
|
8214
|
+
title: p.title,
|
|
8215
|
+
status: p.status ?? "pending",
|
|
8216
|
+
...p.content !== void 0 ? { content: p.content } : {}
|
|
8217
|
+
});
|
|
8218
|
+
}
|
|
8219
|
+
return {
|
|
8220
|
+
artifacts: [...artifacts.values()],
|
|
8221
|
+
proposals: [...proposals.values()],
|
|
8222
|
+
toolCalls
|
|
8223
|
+
};
|
|
8224
|
+
}
|
|
8225
|
+
//#endregion
|
|
8226
|
+
//#region src/semantic-concept-judge.ts
|
|
8227
|
+
const DEFAULT_COMPLEXITY_WEIGHTS = {
|
|
8228
|
+
render: 1,
|
|
8229
|
+
integrate: 2,
|
|
8230
|
+
compute: 2.5
|
|
8231
|
+
};
|
|
8232
|
+
const SEMANTIC_CONCEPT_JUDGE_VERSION = "semantic-concept-judge-v1-2026-04-24";
|
|
8233
|
+
const DEFAULT_MAX_SOURCE = 45e3;
|
|
8234
|
+
const DEFAULT_MAX_HTML = 3e4;
|
|
8235
|
+
const DEFAULT_MAX_PER_FILE = 2e4;
|
|
8236
|
+
const DEFAULT_TIMEOUT = 3e5;
|
|
8237
|
+
const DEFAULT_MAX_TOKENS = 16e3;
|
|
8238
|
+
const DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
8239
|
+
const SEMANTIC_SCHEMA = {
|
|
8240
|
+
type: "object",
|
|
8241
|
+
additionalProperties: false,
|
|
8242
|
+
required: ["summary", "concepts"],
|
|
8243
|
+
properties: {
|
|
8244
|
+
summary: {
|
|
8245
|
+
type: "string",
|
|
8246
|
+
minLength: 20,
|
|
8247
|
+
maxLength: 600
|
|
8248
|
+
},
|
|
8249
|
+
concepts: {
|
|
8250
|
+
type: "array",
|
|
8251
|
+
minItems: 1,
|
|
8252
|
+
items: {
|
|
8253
|
+
type: "object",
|
|
8254
|
+
additionalProperties: false,
|
|
8255
|
+
required: [
|
|
8256
|
+
"concept",
|
|
8257
|
+
"present",
|
|
8258
|
+
"score",
|
|
8259
|
+
"evidence",
|
|
8260
|
+
"severity"
|
|
8261
|
+
],
|
|
8262
|
+
properties: {
|
|
8263
|
+
concept: {
|
|
8264
|
+
type: "string",
|
|
8265
|
+
minLength: 1,
|
|
8266
|
+
maxLength: 120
|
|
8267
|
+
},
|
|
8268
|
+
present: { type: "boolean" },
|
|
8269
|
+
score: {
|
|
8270
|
+
type: "number",
|
|
8271
|
+
minimum: 0,
|
|
8272
|
+
maximum: 10
|
|
8273
|
+
},
|
|
8274
|
+
evidence: {
|
|
8275
|
+
type: "string",
|
|
8276
|
+
minLength: 5,
|
|
8277
|
+
maxLength: 400
|
|
8278
|
+
},
|
|
8279
|
+
severity: {
|
|
8280
|
+
type: "string",
|
|
8281
|
+
enum: [
|
|
8282
|
+
"critical",
|
|
8283
|
+
"major",
|
|
8284
|
+
"minor",
|
|
8285
|
+
"info"
|
|
8286
|
+
]
|
|
8287
|
+
}
|
|
8288
|
+
}
|
|
8289
|
+
}
|
|
8290
|
+
}
|
|
8291
|
+
}
|
|
8292
|
+
};
|
|
8293
|
+
function truncate(body, cap, label) {
|
|
8294
|
+
if (body.length <= cap) return body;
|
|
8295
|
+
return `${body.slice(0, cap)}\n… [truncated ${body.length - cap} chars of ${label}]`;
|
|
8296
|
+
}
|
|
8297
|
+
function buildPrompt(input, opts) {
|
|
8298
|
+
const sourceBlob = input.sourceFiles.filter((f) => f.content.length <= opts.maxPerFileChars).map((f) => `--- FILE: ${f.path} ---\n${f.content}`).join("\n\n");
|
|
8299
|
+
const html = input.servedHtml ?? "";
|
|
8300
|
+
return `You are a strict code-review judge evaluating whether an agent's 0-to-1 build actually implements the features the user asked for.
|
|
8301
|
+
|
|
8302
|
+
You MUST distinguish:
|
|
8303
|
+
(a) WORKING code that implements the concept (rendered UI, wired handler, real API call),
|
|
8304
|
+
(b) KEYWORD-PRESENT stub (comments mentioning the concept, variable names, TODOs),
|
|
8305
|
+
(c) ABSENT (concept nowhere).
|
|
8306
|
+
|
|
8307
|
+
A comment like "// TODO: add mint button" is NOT present — score 2-3. Only count a concept as present if there is real functional code: a rendered component, a call handler wired to state or a network call, a computed value actually used.
|
|
8308
|
+
|
|
8309
|
+
USER REQUEST (what the agent was asked to build):
|
|
8310
|
+
${input.userRequest}
|
|
8311
|
+
|
|
8312
|
+
${input.artifactLabel ? `ARTIFACT METADATA:\n name: ${input.artifactLabel}\n description: ${input.artifactDescription ?? ""}\n\n` : ""}EXPECTED CONCEPTS (each must be graded independently):
|
|
8313
|
+
${input.expectedConcepts.map((c, i) => ` ${i + 1}. "${c.name}"${c.keywords?.length ? ` — hints: [${c.keywords.slice(0, 6).join(" | ")}]` : ""}`).join("\n")}
|
|
8314
|
+
|
|
8315
|
+
${html ? `SERVED HTML (what the preview returns when hit):\n${truncate(html, opts.maxHtmlChars, "HTML")}\n\n` : ""}SOURCE FILES (the agent's workdir):
|
|
8316
|
+
${truncate(sourceBlob, opts.maxSourceChars, "source")}
|
|
8317
|
+
|
|
8318
|
+
For EACH concept, return:
|
|
8319
|
+
- concept: the concept name as given (match exactly)
|
|
8320
|
+
- present: boolean — does a working implementation exist?
|
|
8321
|
+
- score: 0-10 — 10 = production-ready; 7 = functional but thin; 4 = partial/stubbed; 2 = keyword-only comment; 0 = absent
|
|
8322
|
+
- evidence: cite "<file>:<line>" or "served-html:<selector>" pointing at the strongest supporting code. If the concept is absent or stubbed, explain what's missing.
|
|
8323
|
+
- severity:
|
|
8324
|
+
"info" when present: true AND score >= 7
|
|
8325
|
+
"minor" when present: true AND 4 <= score < 7
|
|
8326
|
+
"major" when present: false OR score < 4
|
|
8327
|
+
"critical" when the concept is not only absent but a core user flow depends on it
|
|
8328
|
+
|
|
8329
|
+
Also produce a "summary" (one sentence, 20-600 chars): overall verdict on whether this is a shippable implementation of the user request vs a keyword-dense placeholder.
|
|
8330
|
+
|
|
8331
|
+
BE SKEPTICAL. Keyword matching already passed — your job is to catch what keyword matching misses. If the agent shipped a working build, say so. If it shipped a stub, say so. Don't grade on effort.
|
|
8332
|
+
|
|
8333
|
+
Return STRICT JSON. No prose outside the JSON.`;
|
|
8334
|
+
}
|
|
8335
|
+
/**
|
|
8336
|
+
* Run the semantic concept judge. Soft-fails to available=false on
|
|
8337
|
+
* LLM/JSON errors — callers in a MultiLayerVerifier pipeline can treat
|
|
8338
|
+
* that as "skip" rather than "fail."
|
|
8339
|
+
*/
|
|
8340
|
+
async function runSemanticConceptJudge(input, options) {
|
|
8341
|
+
const start = Date.now();
|
|
8342
|
+
const totalCount = input.expectedConcepts.length;
|
|
8343
|
+
if (totalCount === 0) return {
|
|
8344
|
+
kind: "semantic-concept",
|
|
8345
|
+
version: SEMANTIC_CONCEPT_JUDGE_VERSION,
|
|
8346
|
+
score: 0,
|
|
8347
|
+
presentCount: 0,
|
|
8348
|
+
totalCount: 0,
|
|
8349
|
+
findings: [],
|
|
8350
|
+
summary: "no expected concepts declared",
|
|
8351
|
+
durationMs: 0,
|
|
8352
|
+
costUsd: null,
|
|
8353
|
+
available: false,
|
|
8354
|
+
error: "no expected concepts declared"
|
|
8355
|
+
};
|
|
8356
|
+
const opts = {
|
|
8357
|
+
chat: options.chat,
|
|
8358
|
+
model: options.model ?? options.chat.defaultModel ?? DEFAULT_MODEL,
|
|
8359
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT,
|
|
8360
|
+
maxTokens: options.maxTokens ?? DEFAULT_MAX_TOKENS,
|
|
8361
|
+
maxSourceChars: options.maxSourceChars ?? DEFAULT_MAX_SOURCE,
|
|
8362
|
+
maxPerFileChars: options.maxPerFileChars ?? DEFAULT_MAX_PER_FILE,
|
|
8363
|
+
maxHtmlChars: options.maxHtmlChars ?? DEFAULT_MAX_HTML,
|
|
8364
|
+
...options.pricing ? { pricing: options.pricing } : {},
|
|
8365
|
+
costLedger: options.costLedger ?? new CostLedger(),
|
|
8366
|
+
costPhase: options.costPhase ?? "judge.semantic-concept",
|
|
8367
|
+
costTags: options.costTags ?? {},
|
|
8368
|
+
signal: options.signal ?? new AbortController().signal,
|
|
8369
|
+
weightConcepts: options.weightConcepts ?? "mean",
|
|
8370
|
+
complexityWeights: {
|
|
8371
|
+
...DEFAULT_COMPLEXITY_WEIGHTS,
|
|
8372
|
+
...options.complexityWeights ?? {}
|
|
8373
|
+
}
|
|
8374
|
+
};
|
|
8375
|
+
const weightForConcept = (spec) => {
|
|
8376
|
+
if (opts.weightConcepts === "mean") return 1;
|
|
8377
|
+
if (spec.weight != null) return spec.weight;
|
|
8378
|
+
if (opts.weightConcepts === "complexity") return opts.complexityWeights[spec.complexity ?? "render"] ?? 1;
|
|
8379
|
+
return 1;
|
|
8380
|
+
};
|
|
8381
|
+
const weightByName = new Map(input.expectedConcepts.map((c) => [c.name, weightForConcept(c)]));
|
|
8382
|
+
let receipt;
|
|
8383
|
+
try {
|
|
8384
|
+
const request = {
|
|
8385
|
+
model: opts.model,
|
|
8386
|
+
messages: [{
|
|
8387
|
+
role: "system",
|
|
8388
|
+
content: "You are a strict code-review judge. Return strict JSON only. No prose outside the JSON. A keyword in a comment is NOT a working implementation."
|
|
8389
|
+
}, {
|
|
8390
|
+
role: "user",
|
|
8391
|
+
content: buildPrompt(input, opts)
|
|
8392
|
+
}],
|
|
8393
|
+
jsonSchema: {
|
|
8394
|
+
name: "semantic_concept_judge",
|
|
8395
|
+
schema: SEMANTIC_SCHEMA
|
|
8396
|
+
},
|
|
8397
|
+
temperature: 0,
|
|
8398
|
+
maxTokens: opts.maxTokens,
|
|
8399
|
+
timeoutMs: opts.timeoutMs
|
|
8400
|
+
};
|
|
8401
|
+
const paid = await paidJsonChat({
|
|
8402
|
+
chat: opts.chat,
|
|
8403
|
+
request,
|
|
8404
|
+
ledger: opts.costLedger,
|
|
8405
|
+
channel: "judge",
|
|
8406
|
+
phase: opts.costPhase,
|
|
8407
|
+
actor: "semantic-concept",
|
|
8408
|
+
tags: opts.costTags,
|
|
8409
|
+
signal: opts.signal,
|
|
8410
|
+
...opts.pricing ? { pricing: opts.pricing } : {}
|
|
8411
|
+
});
|
|
8412
|
+
receipt = paid.receipt;
|
|
8413
|
+
if (!paid.succeeded) throw paid.error;
|
|
8414
|
+
const { value } = paid;
|
|
8415
|
+
if (!value?.concepts || !Array.isArray(value.concepts)) throw new Error("judge returned malformed response — expected array under \"concepts\"");
|
|
8416
|
+
const findings = value.concepts.map((c) => ({
|
|
8417
|
+
concept: String(c.concept),
|
|
8418
|
+
present: Boolean(c.present),
|
|
8419
|
+
score: Math.max(0, Math.min(10, Number(c.score ?? 0))),
|
|
8420
|
+
evidence: String(c.evidence ?? ""),
|
|
8421
|
+
severity: [
|
|
8422
|
+
"critical",
|
|
8423
|
+
"major",
|
|
8424
|
+
"minor",
|
|
8425
|
+
"info"
|
|
8426
|
+
].includes(c.severity) ? c.severity : "info"
|
|
8427
|
+
}));
|
|
8428
|
+
const presentCount = findings.filter((f) => f.present && f.score >= 7).length;
|
|
8429
|
+
let weightSum = 0;
|
|
8430
|
+
let weightedScoreSum = 0;
|
|
8431
|
+
for (const f of findings) {
|
|
8432
|
+
const w = weightByName.get(f.concept) ?? 1;
|
|
8433
|
+
weightSum += w;
|
|
8434
|
+
weightedScoreSum += w * f.score;
|
|
8435
|
+
}
|
|
8436
|
+
const scoreAvg = weightSum > 0 ? weightedScoreSum / weightSum : findings.reduce((a, f) => a + f.score, 0) / Math.max(1, findings.length);
|
|
8437
|
+
return {
|
|
8438
|
+
kind: "semantic-concept",
|
|
8439
|
+
version: SEMANTIC_CONCEPT_JUDGE_VERSION,
|
|
8440
|
+
score: Number((scoreAvg / 10).toFixed(3)),
|
|
8441
|
+
presentCount,
|
|
8442
|
+
totalCount,
|
|
8443
|
+
findings,
|
|
8444
|
+
summary: String(value.summary ?? ""),
|
|
8445
|
+
durationMs: Date.now() - start,
|
|
8446
|
+
costUsd: paid.receipt.costUnknown ? null : paid.receipt.costUsd,
|
|
8447
|
+
available: true
|
|
8448
|
+
};
|
|
8449
|
+
} catch (err) {
|
|
8450
|
+
return {
|
|
8451
|
+
kind: "semantic-concept",
|
|
8452
|
+
version: SEMANTIC_CONCEPT_JUDGE_VERSION,
|
|
8453
|
+
score: 0,
|
|
8454
|
+
presentCount: 0,
|
|
8455
|
+
totalCount,
|
|
8456
|
+
findings: [],
|
|
8457
|
+
summary: "",
|
|
8458
|
+
durationMs: Date.now() - start,
|
|
8459
|
+
costUsd: receipt && !receipt.costUnknown ? receipt.costUsd : null,
|
|
8460
|
+
available: false,
|
|
8461
|
+
error: err instanceof Error ? err.message : String(err)
|
|
8462
|
+
};
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
//#endregion
|
|
9104
8466
|
//#region src/treatment-gate.ts
|
|
9105
8467
|
/**
|
|
9106
8468
|
* Core predicate. Gated (treatment-not-applied) ONLY when telemetry was
|
|
@@ -9670,6 +9032,6 @@ function rankRows(rows, weights) {
|
|
|
9670
9032
|
})).sort((a, b) => b.mean - a.mean);
|
|
9671
9033
|
}
|
|
9672
9034
|
//#endregion
|
|
9673
|
-
export { AGENT_PROFILE_KINDS, ATTESTATION_ALGORITHM, AgentEvalError, AnalystRegistry, BOOTSTRAP_GATE_MIN_N, BackendIntegrityError, BudgetBreachError, BudgetGuard, CODING_HARNESSES, ConfigError, CostAccountingIncompleteError,
|
|
9035
|
+
export { AGENT_PROFILE_KINDS, ATTESTATION_ALGORITHM, AgentEvalError, AnalystRegistry, BOOTSTRAP_GATE_MIN_N, BackendIntegrityError, BudgetBreachError, BudgetGuard, CODING_HARNESSES, ConfigError, CostAccountingIncompleteError, CostCeilingReachedError, CostLedger, CostTracker, CrossFamilyError, DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS, DEFAULT_JUDGE_GATE_POLICY, DEFAULT_RED_TEAM_CORPUS, DEFAULT_TRACE_ANALYST_BUDGETS, DEFAULT_TRACE_ANALYST_KINDS, ERROR_COUNT_PATTERNS, EquivalenceProtocolError, FAILURE_CLASSES, FAILURE_MODE_KIND_SPEC, FileSystemFeedbackTrajectoryStore, FileSystemRawProviderSink, FileSystemTraceStore, FindingsStore, HARNESS_NATIVE_MODEL, HeldOutGate, InMemoryFeedbackTrajectoryStore, InMemoryRawProviderSink, InMemoryTraceStore, JudgeError, JudgeGateRefusedError, LlmCallError, LlmResponseError, MODEL_PRICING, ModelSubstitutionError, MultiLayerVerifier, NoopRawProviderSink, NotFoundError, OUTPUT_VALUE, OtlpFileTraceStore, PairwiseSteeringOptimizer, ProductClient, PromptRegistry, REDACTION_VERSION, RunIntegrityError, RunRecordValidationError, SEMANTIC_CONCEPT_JUDGE_VERSION, TraceEmitter, UNKNOWN_MODEL, VERIFICATION_STRATEGIES, VERIFICATION_STRATEGY_SOURCES, ValidationError, acquisitionPlansForKnowledgeGaps, addCalibrationVerdicts, agentProfileCellKey, agentProfileHash, agentProfileId, aggregateJudgeVerdicts, aggregateRunScore, analystRunDigest, analystRunToFeedbackTrajectory, analystRunToReviewRequests, analyzeAntiSlop, analyzeRuns, analyzeSeries, analyzeTraces, argHash, assertCapabilityHeadroom, assertCrossFamily, assertCrossFamilyServed, assertJudgeMayGate, assertNoHiddenLeak, assertProductBenchmarkRun, assertRealBackend, assertRunCaptured, assertServedModel, assertServedModels, assertSingleBackend, assessShareSafety, assignFeedbackSplit, attest, benjaminiHochberg, blendHeldout, blockingKnowledgeEval, bonferroni, bootstrapCi, budgetBreachView, buildAgentProfileCell, buildDefaultAnalystRegistry, buildReflectionPrompt, buildTraceInsightContext, buildTraceInsightPrompt, buildTrajectory, calibrateJudge, calibrateJudgeContinuous, canonicalJson, capabilityHeadroom, captureFetchToRawSink, certificationEvidenceDigest, checkCanaries, checkServedModel, checkTraceContracts, chiSquared, chiSquaredPValue, clamp01, classifyFailure, classifyFailureReason, cliffsDelta, cohensD, comparePairedArms, compileTraceContractSpec, completionVerdict, computeFindingId, computeToolUseMetrics, confidenceInterval, contentHash, continuousAgreement, controlRunToFeedbackTrajectory, corpusInterRaterAgreement, corpusInterRaterAgreementFromJudgeScores, costForTokenPricing, costForUsage, costReceiptFromLlm, costReceiptFromLlmError, createAntiSlopJudge, createBoundedTraceAnalysisStore, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createFeedbackTrajectory, createLlmCorrectnessChecker, createLlmReviewer, createTraceAnalyst, decidePairedPromotion, defineAgentEval, defineEquivalenceCheck, deployGateLayer, describeTraceInsightScope, diffFindings, diffScorecard, discoverPersonas, domainEvidencePattern, dominates, eProcess, ensembleJudge, equivalenceVerdict, errorStreakDetector, estimateCost, estimateTokens, evaluateActionPolicy, evaluateInterimReleaseConfidence, evaluateOracles, evaluateReleaseConfidence, evaluateTraceContract, expandProfileAxes, explainTraceContract, exportProductBenchmark, exportProductBenchmarkRuns, exportRunAsOtlp, extractErrorCount, extractProducedState, extractUsage, extractUsageFromSse, failureBlame, failureClusterView, feedbackTrajectoriesToDatasetScenarios, feedbackTrajectoriesToOptimizerRows, feedbackTrajectoryToOptimizerRow, fileVerdictCache, fisherExactTwoSided, formatScorecardDiff, gainHistogram, gateTreatmentApplied, gradeSemanticStatus, groupRunsByAgentProfileCell, harnessAxisOf, hashContent, hashJson, holm, inMemoryReviewStore, inferDomainKeywords, interRaterReliability, interpretCliffs, iqr, isJudgeSpan, isLlmSpan, isModelPriced, isRunRecord, isToolSpan, isTransientLlmError, jsonShape, jsonlReviewStore, jsonlRunRecordBackend, judgeAgreementView, judgeFamily, judgeGateDecision, judgeSpans, knowledgeReadinessTracePayload, leaderboard, linearRegressionSlope, lintTraceContractSpec, llmJudge, loadScorecard, localCommandRunner, makeFinding, makePolicyEditCandidateRecord, makeProposalFinding, manifestContentDigest, mannWhitneyU, maximumChargeForLlmRequest, mcnemar, mcnemarPower, mcnemarRequiredN, measureJudgeAgreement, minimumPairsForPairedDeltaTest, mintRolloutRows, modelHasSnapshot, mulberry32, normalTwoSidedPValue, objectiveEval, observeAll, otlpTextToTraceAnalysisStore, pairArms, pairRunRecords, pairedBootstrap, pairedCohensDz, pairedDeltaTest, pairedEvalueSequence, pairedMde, pairedPromotionPower, pairedRiskDifference, pairedRiskDifferenceExact, pairedRiskDifferenceScore, pairedSignTest, pairedTTest, paretoFrontier, parseReflectionResponse, parseRunRecordSafe, partialCredit, partitionHeldOut, passAtK, pearsonR, preflightModels, productBenchmarkRepoIdentity, profile_exports as profile, projectRuntimeTrajectoryEvidence, proposeSynthesisTargets, ranks, readProductBenchmarkManifest, recordRuns, recordRunsToScorecard, redTeamDataset, redTeamReport, redact, redactForShare, redactText, registerCalibrationSet, renderPreferenceMemoryMarkdown, repeatedActionDetector, requiredPairedSampleSize, requiredPairsForPairedPromotion, requiredSampleSize, resolveModelPricing, resolveSeat, runAgentControlLoop, runBoundedProcess, runCampaign, runCanaries, runEquivalenceCheck, runEvalCampaign, runIntentMatchJudge, runKeywordCoverageJudge, runKeywordCoverageJudgeUrl, runProposeReview, runSemanticConceptJudge, runTaskScore, runsForScenario, sampleMedian, scoreKnowledgeReadiness, scoreRedTeamOutput, scoreTraceInsightReadiness, seatPresets, selfImprove, shareAllowed, snapshotFromJudgeAgreement, spanRecordsToTraceAnalysisStore, spearmanR, stripFencedJson, studentTTwoSidedPValue, subjectiveEval, summarizeBackendIntegrity, summarizeNumberSeries, summarizePreferenceMemory, summarizeSample, summaryTable, toAgentProfileJson, tokenizeDomainWords, toolSpansToTraceAnalysisStore, toolWasteView, traceContract, transientDispatchFailure, twoByTwoPValue, userQuestionsForKnowledgeGaps, validateRunRecord, verbosityBias, verifyAgentProfileCell, verifyAttestation, verifyCompletion, viteDeployRunner, weightedComposite, weightedMean, welchsTTest, wilcoxonSignedRank, wilson, withAssignedFeedbackSplit, withJudgeRetry, wranglerDeployRunner };
|
|
9674
9036
|
|
|
9675
9037
|
//# sourceMappingURL=index.js.map
|