@tangle-network/agent-eval 0.150.2 → 0.161.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 +158 -1
- package/README.md +7 -3
- package/dist/{active-curriculum-C4mk67HP.js → active-curriculum-CD5TU2yW.js} +3 -13
- package/dist/active-curriculum-CD5TU2yW.js.map +1 -0
- package/dist/{agent-profile-cell-BkcRDikH.d.ts → agent-profile-cell-CTOZJUuE.d.ts} +4 -2
- package/dist/agent-profile-cell-CTOZJUuE.d.ts.map +1 -0
- package/dist/analyst/index.d.ts +19 -36
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +8 -8
- package/dist/analyst/index.js.map +1 -1
- package/dist/{backend-integrity-DOCa_QrR.d.ts → backend-integrity-DxuQCu_A.d.ts} +4 -3
- package/dist/backend-integrity-DxuQCu_A.d.ts.map +1 -0
- package/dist/{benchmark-BtAWA8nT.d.ts → benchmark-CGPp-kDC.d.ts} +3 -3
- package/dist/{benchmark-BtAWA8nT.d.ts.map → benchmark-CGPp-kDC.d.ts.map} +1 -1
- package/dist/{benchmark-command-BU1Las59.js → benchmark-command-BDC3Gocz.js} +26 -31
- package/dist/benchmark-command-BDC3Gocz.js.map +1 -0
- package/dist/benchmarks/index.d.ts +6 -19
- 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/campaign/index.d.ts +9 -9
- package/dist/campaign/index.js +7 -7
- package/dist/{campaign-la-gEYNz.js → campaign-BSmOwskD.js} +77 -795
- package/dist/campaign-BSmOwskD.js.map +1 -0
- package/dist/{canonical-D-XsTQ6_.js → canonical-IL-Bu-14.js} +26 -2
- package/dist/canonical-IL-Bu-14.js.map +1 -0
- package/dist/{capture-fetch-BBVFzhkk.d.ts → capture-fetch-CqwsJkkG.d.ts} +3 -3
- package/dist/{capture-fetch-BBVFzhkk.d.ts.map → capture-fetch-CqwsJkkG.d.ts.map} +1 -1
- package/dist/{chat-client-Bvmxedyv.js → chat-client-DlMlAeYI.js} +5 -55
- package/dist/{chat-client-Bvmxedyv.js.map → chat-client-DlMlAeYI.js.map} +1 -1
- package/dist/chat-json-call-6g5sJobJ.js +53 -0
- package/dist/chat-json-call-6g5sJobJ.js.map +1 -0
- package/dist/cli.js +54 -19
- package/dist/cli.js.map +1 -1
- package/dist/{client-LIuo-KPv.js → client-CX7KqIdB.js} +3 -3
- package/dist/client-CX7KqIdB.js.map +1 -0
- package/dist/{client-kPQYT_56.d.ts → client-L9VVPkim.d.ts} +4 -4
- package/dist/{client-kPQYT_56.d.ts.map → client-L9VVPkim.d.ts.map} +1 -1
- package/dist/contract/index.d.ts +13 -27
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +14 -17
- package/dist/contract/index.js.map +1 -1
- package/dist/{counterfactual--bpysZF0.d.ts → counterfactual-BaFUWK3H.d.ts} +4 -4
- package/dist/{counterfactual--bpysZF0.d.ts.map → counterfactual-BaFUWK3H.d.ts.map} +1 -1
- package/dist/{counterfactual-lDfCx0Uz.js → counterfactual-D_VWavVm.js} +2 -2
- package/dist/{counterfactual-lDfCx0Uz.js.map → counterfactual-D_VWavVm.js.map} +1 -1
- package/dist/{dataset-CJjKqQfA.d.ts → dataset-DQqhOCPt.d.ts} +5 -4
- package/dist/{dataset-CJjKqQfA.d.ts.map → dataset-DQqhOCPt.d.ts.map} +1 -1
- package/dist/{default-registry-Cw0Ohdoj.d.ts → default-registry-G9CKMNkc.d.ts} +7 -8
- package/dist/{default-registry-Cw0Ohdoj.d.ts.map → default-registry-G9CKMNkc.d.ts.map} +1 -1
- package/dist/{define-agent-eval-CEQWL9Hy.d.ts → define-agent-eval-Dx1JnPEa.d.ts} +26 -6
- package/dist/define-agent-eval-Dx1JnPEa.d.ts.map +1 -0
- package/dist/{define-agent-eval-C8V8sMqP.js → define-agent-eval-h-s-sI-v.js} +15 -9
- package/dist/define-agent-eval-h-s-sI-v.js.map +1 -0
- package/dist/{dspy-rlm-engine-CBYlPvNy.js → dspy-rlm-engine-DptEII26.js} +95 -15
- package/dist/dspy-rlm-engine-DptEII26.js.map +1 -0
- package/dist/{emitter-CPBAhxum.js → emitter-BpYFQPj4.js} +2 -18
- package/dist/emitter-BpYFQPj4.js.map +1 -0
- package/dist/{emitter-DGQGoLyj.d.ts → emitter-D_jYSGRd.d.ts} +4 -20
- package/dist/{emitter-DGQGoLyj.d.ts.map → emitter-D_jYSGRd.d.ts.map} +1 -1
- package/dist/{engine-BLzhNzoY.d.ts → engine-Cu5qD5Fc.d.ts} +9 -11
- package/dist/{engine-BLzhNzoY.d.ts.map → engine-Cu5qD5Fc.d.ts.map} +1 -1
- package/dist/{eval-campaign-CQuZrLR_.js → eval-campaign-BsXWL2-2.js} +17 -28
- package/dist/eval-campaign-BsXWL2-2.js.map +1 -0
- package/dist/{exact-types-ccQAyut1.d.ts → exact-types-qnexxJ1Z.d.ts} +2 -2
- package/dist/{exact-types-ccQAyut1.d.ts.map → exact-types-qnexxJ1Z.d.ts.map} +1 -1
- package/dist/{exec-y-DCLqK7.js → exec-D9WpA2p-.js} +2 -2
- package/dist/exec-D9WpA2p-.js.map +1 -0
- package/dist/experiment/index.d.ts +45 -11
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +30 -11
- package/dist/experiment/index.js.map +1 -1
- package/dist/{experiment-tracker-0MhuPArU.d.ts → experiment-tracker-DCO6Cz4s.d.ts} +2 -2
- package/dist/{experiment-tracker-0MhuPArU.d.ts.map → experiment-tracker-DCO6Cz4s.d.ts.map} +1 -1
- package/dist/{exporters-q9iL-2Jf.js → exporters-Df7TgHFv.js} +3 -3
- package/dist/exporters-Df7TgHFv.js.map +1 -0
- package/dist/{external-optimizer-contracts-DbLsm4Po.d.ts → external-optimizer-contracts-szBJ_1vh.d.ts} +2 -2
- package/dist/{external-optimizer-contracts-DbLsm4Po.d.ts.map → external-optimizer-contracts-szBJ_1vh.d.ts.map} +1 -1
- package/dist/{external-optimizer-process-x9oEXKsU.js → external-optimizer-process-WosTBChy.js} +4 -4
- package/dist/{external-optimizer-process-x9oEXKsU.js.map → external-optimizer-process-WosTBChy.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-CKNb42oM.js → external-optimizer-subprocess-BIWbHpgD.js} +4 -4
- package/dist/{external-optimizer-subprocess-CKNb42oM.js.map → external-optimizer-subprocess-BIWbHpgD.js.map} +1 -1
- package/dist/{failure-cluster-BLURuWG4.d.ts → failure-cluster-CXL8NbEw.d.ts} +3 -3
- package/dist/{failure-cluster-BLURuWG4.d.ts.map → failure-cluster-CXL8NbEw.d.ts.map} +1 -1
- package/dist/{feedback-trajectory-DpTTjo0q.d.ts → feedback-trajectory-B3ZHaHV_.d.ts} +7 -7
- package/dist/{feedback-trajectory-DpTTjo0q.d.ts.map → feedback-trajectory-B3ZHaHV_.d.ts.map} +1 -1
- package/dist/fuzz.js +1 -1
- package/dist/{hf-dataset-XggBupCr.js → hf-dataset-D8_RNIis.js} +4 -4
- package/dist/{hf-dataset-XggBupCr.js.map → hf-dataset-D8_RNIis.js.map} +1 -1
- package/dist/hosted/index.d.ts +3 -14
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +2 -2
- package/dist/{index-Aj3WO3_a.d.ts → index-CGtH1piv.d.ts} +48 -26
- package/dist/index-CGtH1piv.d.ts.map +1 -0
- package/dist/{index-BNPtkBPf.d.ts → index-D-IiQIBB.d.ts} +5 -10
- package/dist/index-D-IiQIBB.d.ts.map +1 -0
- package/dist/{index-IQccV3Ou.d.ts → index-D-V8gCs_.d.ts} +13 -90
- package/dist/index-D-V8gCs_.d.ts.map +1 -0
- package/dist/{index-B8Ui1mr1.d.ts → index-lfaSeKSD.d.ts} +18 -2
- package/dist/index-lfaSeKSD.d.ts.map +1 -0
- package/dist/index-vrJugRal.d.ts +1 -0
- package/dist/index.d.ts +68 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -110
- package/dist/index.js.map +1 -1
- package/dist/{insight-report-BeT8KCgI.d.ts → insight-report-DRe8LB6d.d.ts} +4 -4
- package/dist/{insight-report-BeT8KCgI.d.ts.map → insight-report-DRe8LB6d.d.ts.map} +1 -1
- package/dist/{integrity-DL91tucI.js → integrity-CyWSSoQS.js} +2 -2
- package/dist/{integrity-DL91tucI.js.map → integrity-CyWSSoQS.js.map} +1 -1
- package/dist/{integrity-B0dZ96EO.d.ts → integrity-DUNX9Fao.d.ts} +3 -3
- package/dist/{integrity-B0dZ96EO.d.ts.map → integrity-DUNX9Fao.d.ts.map} +1 -1
- package/dist/{kind-factory-DmAa0h3K.js → kind-factory-DY8FdoXf.js} +3 -71
- package/dist/kind-factory-DY8FdoXf.js.map +1 -0
- package/dist/ledger-core/index.d.ts +2 -2
- package/dist/ledger-core/index.js +3 -3
- package/dist/{ledger-core-DTae9rv_.js → ledger-core-BOzlRygb.js} +2 -2
- package/dist/{ledger-core-DTae9rv_.js.map → ledger-core-BOzlRygb.js.map} +1 -1
- package/dist/{llm-client-Bg32RW0j.js → llm-client-hgDieDNN.js} +53 -98
- package/dist/llm-client-hgDieDNN.js.map +1 -0
- package/dist/{llm-judge-BqqMS8t7.js → llm-judge-BhasIPFT.js} +1135 -77
- package/dist/llm-judge-BhasIPFT.js.map +1 -0
- package/dist/{matrix-DrVnRp4G.d.ts → matrix-eXKRMHnL.d.ts} +74 -72
- package/dist/matrix-eXKRMHnL.d.ts.map +1 -0
- package/dist/meta-eval/index.d.ts +8 -6
- package/dist/meta-eval/index.d.ts.map +1 -1
- package/dist/meta-eval/index.js +8 -6
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/{mint-BV6tLVWl.js → mint-DfODW1KW.js} +3 -3
- package/dist/{mint-BV6tLVWl.js.map → mint-DfODW1KW.js.map} +1 -1
- package/dist/multishot/golden/index.d.ts +2 -8
- package/dist/multishot/golden/index.d.ts.map +1 -1
- package/dist/multishot/golden/index.js +56 -86
- package/dist/multishot/golden/index.js.map +1 -1
- package/dist/multishot/index.d.ts +11 -46
- package/dist/multishot/index.d.ts.map +1 -1
- package/dist/multishot/index.js +30 -83
- package/dist/multishot/index.js.map +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{opencode-sqlite-DJWAXLms.js → opencode-sqlite-eK6HW6dr.js} +2 -6
- package/dist/{opencode-sqlite-DJWAXLms.js.map → opencode-sqlite-eK6HW6dr.js.map} +1 -1
- package/dist/pipelines/index.d.ts +5 -5
- package/dist/pipelines/index.js +3 -3
- package/dist/{pre-registration-zFSLEiFU.d.ts → pre-registration-CzFCcwYk.d.ts} +55 -40
- package/dist/pre-registration-CzFCcwYk.d.ts.map +1 -0
- package/dist/pre-registration-KN9jkh58.js +110 -0
- package/dist/pre-registration-KN9jkh58.js.map +1 -0
- package/dist/{produced-state-Bnq4FaDO.js → produced-state-DZ89riy5.js} +8 -8
- package/dist/produced-state-DZ89riy5.js.map +1 -0
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +31 -5
- package/dist/profile-cell.js.map +1 -1
- package/dist/{promotion-policy-DLOUkYhI.d.ts → promotion-policy-DtnOIZvk.d.ts} +2 -2
- package/dist/{promotion-policy-DLOUkYhI.d.ts.map → promotion-policy-DtnOIZvk.d.ts.map} +1 -1
- package/dist/{query-Di7eEQ79.js → query-CHmMP42p.js} +20 -11
- package/dist/query-CHmMP42p.js.map +1 -0
- package/dist/{query-CJ_DX8vl.d.ts → query-DxPYqpmT.d.ts} +10 -4
- package/dist/query-DxPYqpmT.d.ts.map +1 -0
- package/dist/raw-provider-sink-BU29Sh8h.d.ts +134 -0
- package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +1 -0
- package/dist/{registry-BQwrSYpC.d.ts → registry-8You7OK1.d.ts} +5 -7
- package/dist/{registry-BQwrSYpC.d.ts.map → registry-8You7OK1.d.ts.map} +1 -1
- package/dist/{release-confidence-BknrpBnO.js → release-confidence-DKfD2RYU.js} +28 -14
- package/dist/release-confidence-DKfD2RYU.js.map +1 -0
- package/dist/{release-confidence-4XrqlpFD.d.ts → release-confidence-Dqt0NFep.d.ts} +7 -6
- package/dist/release-confidence-Dqt0NFep.d.ts.map +1 -0
- package/dist/reporting.d.ts +3 -3
- package/dist/reporting.js +3 -3
- package/dist/{researcher-DJnoUE8c.d.ts → researcher-Cz565b7D.d.ts} +34 -21
- package/dist/researcher-Cz565b7D.d.ts.map +1 -0
- package/dist/{reward-hacking-62tojkQd.d.ts → reward-hacking-MBf7qpSB.d.ts} +2 -2
- package/dist/{reward-hacking-62tojkQd.d.ts.map → reward-hacking-MBf7qpSB.d.ts.map} +1 -1
- package/dist/{reward-hacking-C0x0xihA.js → reward-hacking-t4lB1yt8.js} +2 -2
- package/dist/{reward-hacking-C0x0xihA.js.map → reward-hacking-t4lB1yt8.js.map} +1 -1
- package/dist/rl.d.ts +11 -42
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +41 -24
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +3 -3
- package/dist/rollout/index.js +7 -7
- package/dist/{rollout-ytVQ7WT8.js → rollout-Dm2tSdiQ.js} +6 -6
- package/dist/{rollout-ytVQ7WT8.js.map → rollout-Dm2tSdiQ.js.map} +1 -1
- package/dist/{rubric-predictive-validity-CzxLoZge.js → rubric-predictive-validity-CK8SCOg-.js} +5 -15
- package/dist/rubric-predictive-validity-CK8SCOg-.js.map +1 -0
- package/dist/{rubric-predictive-validity-C7LnNvF2.d.ts → rubric-predictive-validity-CxycqzX5.d.ts} +4 -3
- package/dist/rubric-predictive-validity-CxycqzX5.d.ts.map +1 -0
- package/dist/{run-record-D2lDdSAz.js → run-record-BC0ebuRP.js} +2 -2
- package/dist/{run-record-D2lDdSAz.js.map → run-record-BC0ebuRP.js.map} +1 -1
- package/dist/{run-record-DVV82Gwh.d.ts → run-record-VVy4T9OW.d.ts} +3 -3
- package/dist/{run-record-DVV82Gwh.d.ts.map → run-record-VVy4T9OW.d.ts.map} +1 -1
- package/dist/{schema-BtVldJ3T.d.ts → schema-Bjgdsn73.d.ts} +2 -4
- package/dist/{schema-BtVldJ3T.d.ts.map → schema-Bjgdsn73.d.ts.map} +1 -1
- package/dist/{schema-Cef2cFmb.d.ts → schema-BzWDXhOR.d.ts} +2 -5
- package/dist/schema-BzWDXhOR.d.ts.map +1 -0
- package/dist/{schema-C6DW4ZHR.js → schema-C1aaAxTf.js} +2 -2
- package/dist/schema-C1aaAxTf.js.map +1 -0
- package/dist/{schema-CRhEY1SO.js → schema-k6ZBftVv.js} +2 -8
- package/dist/{schema-CRhEY1SO.js.map → schema-k6ZBftVv.js.map} +1 -1
- package/dist/{semantic-concept-judge-laMCnTLn.js → semantic-concept-judge-BSkKKHeq.js} +14 -38
- package/dist/semantic-concept-judge-BSkKKHeq.js.map +1 -0
- package/dist/{sequential-eprocess-CbUt2htw.js → sequential-eprocess-D1jKoihe.js} +49 -2
- package/dist/sequential-eprocess-D1jKoihe.js.map +1 -0
- package/dist/{sequential-C458DXNf.js → sequential-rYW-Ophm.js} +41 -16
- package/dist/sequential-rYW-Ophm.js.map +1 -0
- package/dist/{series-convergence-BxKEgBwA.d.ts → series-convergence-D9WgpXGi.d.ts} +2 -2
- package/dist/{series-convergence-BxKEgBwA.d.ts.map → series-convergence-D9WgpXGi.d.ts.map} +1 -1
- package/dist/{server-dIWwF3j_.js → server-BtFd4uzB.js} +19 -42
- package/dist/server-BtFd4uzB.js.map +1 -0
- package/dist/{skillopt-optimization-method-CPBlTcj5.js → skillopt-optimization-method-DbaekMcn.js} +794 -8
- package/dist/skillopt-optimization-method-DbaekMcn.js.map +1 -0
- package/dist/{skillopt-optimization-method-BDD_o1xE.d.ts → skillopt-optimization-method-x7TTF23P.d.ts} +20 -7
- package/dist/{skillopt-optimization-method-BDD_o1xE.d.ts.map → skillopt-optimization-method-x7TTF23P.d.ts.map} +1 -1
- package/dist/{statistical-heldout-_woZ9q9j.d.ts → statistical-heldout-Cy3EhjlC.d.ts} +21 -8
- package/dist/statistical-heldout-Cy3EhjlC.d.ts.map +1 -0
- package/dist/{steps-AmkT-GIM.d.ts → steps-CiNVJry_.d.ts} +2 -17
- package/dist/steps-CiNVJry_.d.ts.map +1 -0
- package/dist/{store-CT9YIIve.d.ts → store-B06JdC56.d.ts} +2 -2
- package/dist/{store-CT9YIIve.d.ts.map → store-B06JdC56.d.ts.map} +1 -1
- package/dist/{store-otlp-CDYWW_8N.js → store-otlp-C_Rq5I4D.js} +2 -2
- package/dist/{store-otlp-CDYWW_8N.js.map → store-otlp-C_Rq5I4D.js.map} +1 -1
- package/dist/{store-tool-spans-Br2_IUhm.d.ts → store-tool-spans-DPUG7UUY.d.ts} +6 -6
- package/dist/{store-tool-spans-Br2_IUhm.d.ts.map → store-tool-spans-DPUG7UUY.d.ts.map} +1 -1
- package/dist/{store-tool-spans-CykkbOlv.js → store-tool-spans-Dlh9vkFK.js} +3 -3
- package/dist/{store-tool-spans-CykkbOlv.js.map → store-tool-spans-Dlh9vkFK.js.map} +1 -1
- package/dist/storyboard/index.d.ts +1 -1
- package/dist/{summary-report-DW2bEpdB.js → summary-report-BI5hUtvK.js} +6 -16
- package/dist/summary-report-BI5hUtvK.js.map +1 -0
- package/dist/{summary-report-B__Y5ub3.d.ts → summary-report-CC07PhEL.d.ts} +6 -5
- package/dist/summary-report-CC07PhEL.d.ts.map +1 -0
- package/dist/supervisor-run/index.d.ts +3 -16
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +3 -3
- package/dist/supervisor-run/index.js.map +1 -1
- package/dist/{task-failure-attributes--ZTP3tYO.js → task-failure-attributes-DTl-7-Kw.js} +3 -3
- package/dist/{task-failure-attributes--ZTP3tYO.js.map → task-failure-attributes-DTl-7-Kw.js.map} +1 -1
- package/dist/{tool-groups-B4tqh8jB.d.ts → tool-groups-Ci8i9ErB.d.ts} +3 -3
- package/dist/tool-groups-Ci8i9ErB.d.ts.map +1 -0
- package/dist/{tool-waste-C-VHSRwF.js → tool-waste-BqzmVdJk.js} +2 -2
- package/dist/{tool-waste-C-VHSRwF.js.map → tool-waste-BqzmVdJk.js.map} +1 -1
- package/dist/{tool-waste-DjRDEsuI.d.ts → tool-waste-Dro0gJi3.d.ts} +4 -4
- package/dist/{tool-waste-DjRDEsuI.d.ts.map → tool-waste-Dro0gJi3.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +4 -77
- package/dist/trace-repair/index.d.ts.map +1 -1
- package/dist/trace-repair/index.js +5 -15
- package/dist/trace-repair/index.js.map +1 -1
- package/dist/traces.d.ts +13 -23
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +9 -20
- package/dist/traces.js.map +1 -1
- package/dist/{trajectory-YC15QDYQ.d.ts → trajectory-Bi157Gun.d.ts} +3 -3
- package/dist/{trajectory-YC15QDYQ.d.ts.map → trajectory-Bi157Gun.d.ts.map} +1 -1
- package/dist/trajectory-replay/index.d.ts +5 -5
- package/dist/trajectory-replay/index.js +5 -5
- package/dist/{provenance-oA4-zUqm.d.ts → transient-failure-DKF5Mofa.d.ts} +468 -13
- package/dist/transient-failure-DKF5Mofa.d.ts.map +1 -0
- package/dist/types-B3jzCp0p.js.map +1 -1
- package/dist/{types-CLAwnY-L.d.ts → types-BPb2Kf_C2.d.ts} +3 -3
- package/dist/types-BPb2Kf_C2.d.ts.map +1 -0
- package/dist/types-Bfk0uxRj.d.ts +443 -0
- package/dist/types-Bfk0uxRj.d.ts.map +1 -0
- package/dist/{types-DdFNuyxQ.d.ts → types-D4s7Z6nq.d.ts} +30 -6
- package/dist/types-D4s7Z6nq.d.ts.map +1 -0
- package/dist/{types-B2NsbrNy.d.ts → types-D9ssmxKL.d.ts} +3 -3
- package/dist/{types-B2NsbrNy.d.ts.map → types-D9ssmxKL.d.ts.map} +1 -1
- package/dist/{types-I5WwVzQ7.d.ts → types-DeIUdzNd.d.ts} +2 -2
- package/dist/{types-I5WwVzQ7.d.ts.map → types-DeIUdzNd.d.ts.map} +1 -1
- package/dist/{verdict-BndeTAh_.js → verdict-B0xltqu6.js} +2 -2
- package/dist/{verdict-BndeTAh_.js.map → verdict-B0xltqu6.js.map} +1 -1
- package/dist/verdict-cache-CdVVTVmn.js +88 -0
- package/dist/verdict-cache-CdVVTVmn.js.map +1 -0
- package/dist/wire/index.d.ts +21 -111
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +2 -2
- package/docs/building-doctrine.md +3 -3
- package/docs/campaign-proposers.md +41 -10
- package/docs/design/statistics-decisions.md +89 -1
- package/docs/eval-surface-map.md +14 -0
- package/docs/experiment.md +19 -2
- package/docs/feedback-trajectories.md +1 -1
- package/docs/multishot-golden-records.md +4 -4
- package/docs/public-api.md +1616 -0
- package/docs/research-report-methodology.md +1 -1
- package/docs/search-history-receipts.md +39 -1
- package/docs/trace-analysis.md +1 -1
- package/docs/trace-repair-admission.md +1 -1
- package/docs/trace-repair-continuation.md +1 -1
- package/docs/verdicts.md +24 -0
- package/package.json +7 -3
- package/dist/active-curriculum-C4mk67HP.js.map +0 -1
- package/dist/agent-profile-cell-BkcRDikH.d.ts.map +0 -1
- package/dist/backend-integrity-DOCa_QrR.d.ts.map +0 -1
- package/dist/benchmark-command-BU1Las59.js.map +0 -1
- package/dist/campaign-la-gEYNz.js.map +0 -1
- package/dist/canonical-D-XsTQ6_.js.map +0 -1
- package/dist/client-LIuo-KPv.js.map +0 -1
- package/dist/define-agent-eval-C8V8sMqP.js.map +0 -1
- package/dist/define-agent-eval-CEQWL9Hy.d.ts.map +0 -1
- package/dist/dspy-rlm-engine-CBYlPvNy.js.map +0 -1
- package/dist/emitter-CPBAhxum.js.map +0 -1
- package/dist/eval-campaign-CQuZrLR_.js.map +0 -1
- package/dist/exec-y-DCLqK7.js.map +0 -1
- package/dist/exporters-q9iL-2Jf.js.map +0 -1
- package/dist/index-Aj3WO3_a.d.ts.map +0 -1
- package/dist/index-B8Ui1mr1.d.ts.map +0 -1
- package/dist/index-BNPtkBPf.d.ts.map +0 -1
- package/dist/index-C1ravkGA.d.ts +0 -1
- package/dist/index-IQccV3Ou.d.ts.map +0 -1
- package/dist/kind-factory-DmAa0h3K.js.map +0 -1
- package/dist/llm-client-Bg32RW0j.js.map +0 -1
- package/dist/llm-judge-BqqMS8t7.js.map +0 -1
- package/dist/matrix-DrVnRp4G.d.ts.map +0 -1
- package/dist/pre-registration-DakwTRXk.js +0 -96
- package/dist/pre-registration-DakwTRXk.js.map +0 -1
- package/dist/pre-registration-zFSLEiFU.d.ts.map +0 -1
- package/dist/produced-state-Bnq4FaDO.js.map +0 -1
- package/dist/provenance-oA4-zUqm.d.ts.map +0 -1
- package/dist/query-CJ_DX8vl.d.ts.map +0 -1
- package/dist/query-Di7eEQ79.js.map +0 -1
- package/dist/release-confidence-4XrqlpFD.d.ts.map +0 -1
- package/dist/release-confidence-BknrpBnO.js.map +0 -1
- package/dist/researcher-DJnoUE8c.d.ts.map +0 -1
- package/dist/rubric-predictive-validity-C7LnNvF2.d.ts.map +0 -1
- package/dist/rubric-predictive-validity-CzxLoZge.js.map +0 -1
- package/dist/schema-C6DW4ZHR.js.map +0 -1
- package/dist/schema-Cef2cFmb.d.ts.map +0 -1
- package/dist/semantic-concept-judge-laMCnTLn.js.map +0 -1
- package/dist/sequential-C458DXNf.js.map +0 -1
- package/dist/sequential-eprocess-CbUt2htw.js.map +0 -1
- package/dist/server-dIWwF3j_.js.map +0 -1
- package/dist/skillopt-optimization-method-CPBlTcj5.js.map +0 -1
- package/dist/statistical-heldout-_woZ9q9j.d.ts.map +0 -1
- package/dist/steps-AmkT-GIM.d.ts.map +0 -1
- package/dist/summary-report-B__Y5ub3.d.ts.map +0 -1
- package/dist/summary-report-DW2bEpdB.js.map +0 -1
- package/dist/tool-groups-B4tqh8jB.d.ts.map +0 -1
- package/dist/types-CLAwnY-L.d.ts.map +0 -1
- package/dist/types-DdFNuyxQ.d.ts.map +0 -1
- package/dist/types-jUBXJ7Iz.d.ts +0 -884
- package/dist/types-jUBXJ7Iz.d.ts.map +0 -1
- package/dist/verdict-cache-mZf5FEiY.js +0 -107
- package/dist/verdict-cache-mZf5FEiY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["v1"],"sources":["../../../src/multishot/golden/compare.ts","../../../src/multishot/golden/recording.ts","../../../src/multishot/golden/matrix-scenarios.ts","../../../src/multishot/golden/records/v1.json","../../../src/multishot/golden/records/index.ts","../../../src/multishot/golden/scenarios.ts","../../../src/multishot/golden/harness.ts"],"sourcesContent":["// Structural comparison with a readable failure path.\n//\n// A golden mismatch has to name the field that moved, not print two blobs.\n// Every mismatch is one line: the dotted path, what the record holds, and what\n// the engine produced.\n\nconst MAX_RENDER = 240\n\nexport interface CompareOptions {\n /** Stop after this many mismatches. A structural divergence high in the\n * tree would otherwise report every leaf below it. */\n limit?: number\n}\n\nexport function compareJson(\n expected: unknown,\n actual: unknown,\n path: string,\n options: CompareOptions = {},\n): string[] {\n const limit = options.limit ?? 25\n const mismatches: string[] = []\n walk(expected, actual, path, mismatches, limit)\n // The walk stops checking past the cap but a single frame can push several\n // lines, so the list is trimmed to the number the caller asked for.\n return mismatches.slice(0, limit)\n}\n\nfunction walk(\n expected: unknown,\n actual: unknown,\n path: string,\n out: string[],\n limit: number,\n): void {\n if (out.length >= limit) return\n\n if (Array.isArray(expected) || Array.isArray(actual)) {\n if (!Array.isArray(expected) || !Array.isArray(actual)) {\n out.push(mismatch(path, expected, actual))\n return\n }\n if (expected.length !== actual.length) {\n out.push(`${path}: expected ${expected.length} entries, received ${actual.length}`)\n }\n const shared = Math.min(expected.length, actual.length)\n for (let i = 0; i < shared && out.length < limit; i++) {\n walk(expected[i], actual[i], `${path}[${i}]`, out, limit)\n }\n return\n }\n\n const expectedIsRow = isRow(expected)\n const actualIsRow = isRow(actual)\n if (expectedIsRow || actualIsRow) {\n if (!expectedIsRow || !actualIsRow) {\n out.push(mismatch(path, expected, actual))\n return\n }\n const keys = [...new Set([...Object.keys(expected), ...Object.keys(actual)])].sort()\n for (const key of keys) {\n const inExpected = key in expected\n const inActual = key in actual\n const child = path ? `${path}.${key}` : key\n if (!inActual) {\n out.push(`${child}: expected ${render(expected[key])}, received nothing`)\n continue\n }\n if (!inExpected) {\n out.push(`${child}: expected nothing, received ${render(actual[key])}`)\n continue\n }\n walk(expected[key], actual[key], child, out, limit)\n if (out.length >= limit) return\n }\n return\n }\n\n if (!Object.is(expected, actual)) out.push(mismatch(path, expected, actual))\n}\n\nfunction isRow(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction mismatch(path: string, expected: unknown, actual: unknown): string {\n return `${path}: expected ${render(expected)}, received ${render(actual)}`\n}\n\nfunction render(value: unknown): string {\n if (value === undefined) return 'undefined'\n let text: string\n try {\n text = JSON.stringify(value) ?? String(value)\n } catch {\n text = String(value)\n }\n return text.length > MAX_RENDER ? `${text.slice(0, MAX_RENDER)}…` : text\n}\n","// Normalizers shared by the recorder and the replay check.\n//\n// Everything here is pure. The recorder writes what these functions produce;\n// the check runs the same functions over a live engine and compares. A field\n// that is not normalized identically on both sides would read as a permanent\n// mismatch, so there is exactly one implementation.\n\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { join, posix, relative, sep } from 'node:path'\nimport { readCellSpend } from '../../matrix'\nimport type { MultishotResult, MultishotToolDefinition, MultishotTransportRequest } from '../types'\nimport type {\n MultishotRecordedMessage,\n MultishotRecordedRequest,\n RecordedJudgeRequest,\n RecordedMultishotError,\n RecordedMultishotResult,\n} from './types'\n\n/** Keys whose value is wall clock or run identity. Two runs never agree on\n * them, so they are removed before comparison instead of being compared. */\nexport const VOLATILE_KEYS: ReadonlySet<string> = new Set([\n 'durationMs',\n 'meanDurationMs',\n 'matrixId',\n 'runId',\n])\n\nexport function recordMessage(raw: unknown): MultishotRecordedMessage {\n const row = (typeof raw === 'object' && raw !== null ? raw : {}) as Record<string, unknown>\n const message: MultishotRecordedMessage = {\n role: typeof row.role === 'string' ? row.role : '(missing role)',\n content: typeof row.content === 'string' ? row.content : null,\n }\n if (typeof row.tool_call_id === 'string') message.toolCallId = row.tool_call_id\n if (Array.isArray(row.tool_calls)) {\n message.toolCalls = row.tool_calls.map((call) => {\n const entry = (typeof call === 'object' && call !== null ? call : {}) as Record<\n string,\n unknown\n >\n const fn = (\n typeof entry.function === 'object' && entry.function !== null ? entry.function : {}\n ) as Record<string, unknown>\n return {\n id: typeof entry.id === 'string' ? entry.id : '(missing id)',\n name: typeof fn.name === 'string' ? fn.name : '(missing name)',\n arguments: typeof fn.arguments === 'string' ? fn.arguments : '(missing arguments)',\n }\n })\n }\n return message\n}\n\nexport function recordRequest(\n leg: 'agent' | 'driver',\n req: MultishotTransportRequest,\n): MultishotRecordedRequest {\n return {\n leg,\n model: req.model,\n temperature: req.temperature ?? null,\n maxTokens: req.maxTokens ?? null,\n tools: req.tools ? (JSON.parse(JSON.stringify(req.tools)) as MultishotToolDefinition[]) : null,\n messages: req.messages.map(recordMessage),\n }\n}\n\n/** Judge calls reach the wire as an OpenAI-compat body, not through a\n * transport, so they are recorded from the request body the stub receives. */\nexport function recordJudgeRequest(body: Record<string, unknown>): RecordedJudgeRequest {\n return {\n model: typeof body.model === 'string' ? body.model : '(missing model)',\n temperature: typeof body.temperature === 'number' ? body.temperature : null,\n maxTokens: typeof body.max_tokens === 'number' ? body.max_tokens : null,\n messages: Array.isArray(body.messages) ? body.messages.map(recordMessage) : [],\n }\n}\n\nexport function recordResult(result: MultishotResult): RecordedMultishotResult {\n const { durationMs: _durationMs, ...rest } = result\n return JSON.parse(JSON.stringify(rest)) as RecordedMultishotResult\n}\n\nexport function recordError(err: unknown): RecordedMultishotError {\n const spend = readCellSpend(err)\n return {\n name: err instanceof Error ? err.name : typeof err,\n message: err instanceof Error ? err.message : String(err),\n cellSpend: spend ? { costUsd: spend.costUsd, kind: spend.kind } : null,\n }\n}\n\n/** Deep copy with every wall-clock and run-identity key removed. */\nexport function stripVolatile(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(stripVolatile)\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {\n if (VOLATILE_KEYS.has(key)) continue\n out[key] = stripVolatile(entry)\n }\n return out\n }\n return value\n}\n\n/** The matrix summary Markdown carries a rendered duration. Mask it so the rest\n * of the document — cell counts, pass rate, mean, cost, the uncaptured warning\n * — stays under comparison.\n *\n * A duration the mask does not recognise would stay in the comparison and make\n * every run mismatch on a definitionally irreproducible field, so an\n * unmaskable duration line fails loud instead. */\nexport function maskVolatileMarkdown(text: string): string {\n const masked = text.replace(/\\*\\*Duration\\*\\*: [\\d.]+\\s*(?:ms|s|m)\\b/g, '**Duration**: <elided>')\n if (/\\*\\*Duration\\*\\*: (?!<elided>)/.test(masked)) {\n throw new Error(\n `multishot golden: a rendered duration is not in a form the mask recognises — ${\n masked.match(/\\*\\*Duration\\*\\*: [^|\\n]*/)?.[0] ?? '(unreadable)'\n }`,\n )\n }\n return masked\n}\n\n/** Judge calls fan out through `Promise.all` across three slots, so their\n * issue order is an implementation detail of the cell body, not behaviour a\n * caller can observe. Their CONTENT is behaviour, so they are compared as a\n * set with a stable order. */\nexport function sortJudgeRequests(\n requests: readonly RecordedJudgeRequest[],\n): RecordedJudgeRequest[] {\n return [...requests].sort((a, b) => {\n const left = JSON.stringify(a)\n const right = JSON.stringify(b)\n return left < right ? -1 : left > right ? 1 : 0\n })\n}\n\n/** Every file under `dir`, keyed by slash-separated relative path. JSON is\n * parsed and stripped of wall-clock keys; Markdown keeps its text with the\n * rendered duration masked; anything else is kept verbatim. */\nexport function readRunDir(dir: string): Record<string, unknown> {\n if (!existsSync(dir)) {\n throw new Error(\n `multishot golden: the run directory ${dir} does not exist — the engine wrote no per-cell files`,\n )\n }\n const files: Record<string, unknown> = {}\n for (const path of walkFiles(dir)) {\n const key = relative(dir, path).split(sep).join(posix.sep)\n const text = readFileSync(path, 'utf8')\n if (path.endsWith('.json')) {\n files[key] = stripVolatile(JSON.parse(text))\n continue\n }\n files[key] = path.endsWith('.md') ? maskVolatileMarkdown(text) : text\n }\n return files\n}\n\nfunction walkFiles(dir: string): string[] {\n const out: string[] = []\n for (const entry of readdirSync(dir).sort()) {\n const path = join(dir, entry)\n if (statSync(path).isDirectory()) out.push(...walkFiles(path))\n else out.push(path)\n }\n return out\n}\n","// Deterministic multishot MATRIX scenarios.\n//\n// The shot scenarios pin one conversation. These pin the cell body around it:\n// profile x persona fan-out, the three judge slots, the cell composite, the\n// per-cell files, the run summary, and the cost provenance the cell reports.\n//\n// Cells run one at a time. Concurrency is the matrix runner's own mechanic and\n// is covered by the runner's tests; forcing it to one here makes the recorded\n// request ledger a property of the conversation engine alone, not of how two\n// engines happen to interleave their microtasks.\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport type { JudgeConfig } from '../judges'\nimport type { RunMultishotMatrixOptions } from '../matrix'\nimport type {\n MultishotPersona,\n MultishotToolDefinition,\n MultishotToolExecutor,\n MultishotTransport,\n} from '../types'\nimport { recordJudgeRequest, recordRequest } from './recording'\nimport type { MultishotRecordedRequest, RecordedJudgeRequest } from './types'\n\nexport interface MultishotMatrixGoldenCase {\n options: RunMultishotMatrixOptions<MultishotPersona>\n requests: MultishotRecordedRequest[]\n /** Judge calls, filled while the case runs. Sorted before comparison. */\n judgeRequests: RecordedJudgeRequest[]\n /** Installs the deterministic judge wire on `globalThis.fetch` and returns\n * the function that restores the previous one. */\n installJudgeWire: () => () => void\n}\n\nexport interface MultishotMatrixGoldenScenario {\n readonly id: string\n readonly description: string\n readonly build: (runDir: string) => MultishotMatrixGoldenCase\n}\n\nconst JUDGE_BASE_URL = 'http://router.invalid/v1'\n\nconst personas: MultishotPersona[] = [\n { id: 'retail-founder', ask: 'a launch brief' },\n { id: 'saas-operator', ask: 'a pricing page' },\n]\n\nconst profiles: Array<{ id: string; value: AgentProfile }> = [\n {\n id: 'baseline',\n value: {\n name: 'multishot-golden-baseline',\n prompt: { systemPrompt: 'You are the baseline operator.' },\n },\n },\n {\n id: 'challenger',\n value: {\n name: 'multishot-golden-challenger',\n prompt: { systemPrompt: 'You are the challenger operator.' },\n },\n },\n]\n\nconst shape = {\n buildOpener: (p: MultishotPersona) => `I need ${String(p.ask)}. What do you need from me?`,\n buildDriverSystemPrompt: (p: MultishotPersona) => `You are ${p.id}. Demand ${String(p.ask)}.`,\n}\n\nconst tools: MultishotToolDefinition[] = [\n {\n type: 'function',\n function: { name: 'delegate_research', description: 'research', parameters: {} },\n },\n { type: 'function', function: { name: 'delegate_code', description: 'code', parameters: {} } },\n]\n\nfunction toolExecutors(): Record<string, MultishotToolExecutor> {\n return {\n delegate_research: async (args) => ({\n content: `RESEARCH: ${JSON.stringify(args)}`,\n costUsd: 0.011,\n }),\n delegate_code: async (args) => ({ content: `CODE: ${JSON.stringify(args)}`, costUsd: 0.023 }),\n }\n}\n\nconst artifactTypeFor = (name: string): string | undefined =>\n name === 'delegate_research' ? 'research' : name === 'delegate_code' ? 'code' : undefined\n\n/** Turn 1 dispatches research silently, turn 2 dispatches code beside text,\n * turn 3 answers with text — so both artifact kinds exist in every cell and\n * both artifact judge slots fire. */\nconst agentTransport: MultishotTransport = async (req) => {\n const userCount = req.messages.filter((m) => m.role === 'user').length\n const last = req.messages[req.messages.length - 1] as { role?: string }\n const afterTools = last?.role === 'tool'\n if (userCount === 1 && !afterTools) {\n return {\n message: {\n content: '',\n tool_calls: [\n {\n id: 'tc-1',\n type: 'function',\n function: { name: 'delegate_research', arguments: '{\"topic\":\"market\"}' },\n },\n ],\n },\n usage: { prompt_tokens: 100, completion_tokens: 20 },\n }\n }\n if (userCount === 1 && afterTools) {\n return {\n message: { content: 'Research done — here is the direction.' },\n usage: { prompt_tokens: 140, completion_tokens: 30 },\n costUsd: 0.005,\n }\n }\n if (userCount === 2 && !afterTools) {\n return {\n message: {\n content: 'Building it now.',\n tool_calls: [\n {\n id: 'tc-2',\n type: 'function',\n function: { name: 'delegate_code', arguments: '{\"spec\":\"landing page\"}' },\n },\n ],\n },\n usage: { prompt_tokens: 200, completion_tokens: 25 },\n costUsd: 0.004,\n }\n }\n if (userCount === 2 && afterTools) {\n return {\n message: { content: 'Shipped the artifact you asked for.' },\n usage: { prompt_tokens: 240, completion_tokens: 40 },\n costUsd: 0.006,\n }\n }\n return {\n message: { content: `Closing summary for turn ${userCount}.` },\n usage: { prompt_tokens: 260, completion_tokens: 15 },\n costUsd: 0.002,\n }\n}\n\nconst driverTransport: MultishotTransport = async (req) => {\n const priorReplies = req.messages.filter((m) => m.role === 'assistant').length\n return {\n message: { content: `Driver follow-up #${priorReplies}: sharper, please.` },\n usage: { prompt_tokens: 80, completion_tokens: 18 },\n costUsd: 0.001,\n }\n}\n\nconst dimensions = [\n { key: 'usefulness', description: 'Was it useful? (0-10)' },\n { key: 'specificity', description: 'Was it specific? (0-10)' },\n]\n\nfunction judge<TInput>(name: string, buildPrompt: (input: TInput) => string): JudgeConfig<TInput> {\n return {\n name,\n model: 'test/judge-model',\n dimensions,\n systemPrompt: `JUDGE:${name}`,\n buildPrompt,\n apiKey: 'golden-key',\n baseUrl: JUDGE_BASE_URL,\n }\n}\n\n/** True while some case holds `globalThis.fetch`. Module scope, because the\n * resource being guarded is the process's own fetch. */\nlet judgeWireInstalled = false\n\n/** Scores keyed by judge name, so the wire is a pure function of the request. */\nconst JUDGE_SCORES: Record<string, { usefulness: number; specificity: number }> = {\n conversation: { usefulness: 8, specificity: 7 },\n 'code-review': { usefulness: 6, specificity: 9 },\n 'content-quality': { usefulness: 5, specificity: 4 },\n}\n\nexport function multishotMatrixGoldenScenarios(): MultishotMatrixGoldenScenario[] {\n return [\n {\n id: 'matrix-two-profiles-two-personas',\n description:\n 'a 2x2 matrix at one replicate: every cell produces both artifact kinds, all three judge slots score, and the run persists per-cell files plus the summary',\n build: (runDir: string) => buildMatrixCase(runDir),\n },\n ]\n}\n\nfunction buildMatrixCase(runDir: string): MultishotMatrixGoldenCase {\n const requests: MultishotRecordedRequest[] = []\n const judgeRequests: RecordedJudgeRequest[] = []\n\n const options: RunMultishotMatrixOptions<MultishotPersona> = {\n profiles,\n personas,\n shape,\n judges: {\n conversation: judge(\n 'conversation',\n (input: { transcript: unknown[] }) =>\n `Score this conversation of ${input.transcript.length} messages.`,\n ),\n codeReview: judge(\n 'code-review',\n (input: { artifact: { content: string } }) => `Score this code: ${input.artifact.content}`,\n ),\n contentQuality: judge(\n 'content-quality',\n (input: { artifact: { content: string } }) =>\n `Score this content: ${input.artifact.content}`,\n ),\n },\n tools,\n toolExecutors: toolExecutors(),\n artifactTypeFor,\n runDir,\n reps: 1,\n maxTurns: 3,\n maxConcurrency: 1,\n agentModel: 'test/agent-model',\n driverModel: 'test/driver-model',\n apiKey: 'golden-key',\n baseUrl: JUDGE_BASE_URL,\n agentTransport: async (req) => {\n requests.push(recordRequest('agent', req))\n return agentTransport(req)\n },\n driverTransport: async (req) => {\n requests.push(recordRequest('driver', req))\n return driverTransport(req)\n },\n }\n\n const installJudgeWire = (): (() => void) => {\n // The wire is process-wide, so two matrix checks running at once in one\n // process would cross their judge ledgers. Refuse the second one instead of\n // recording a mixture: a golden check that silently reads another run's\n // calls reports a mismatch nobody can explain.\n if (judgeWireInstalled) {\n throw new Error(\n 'multishot golden judge wire: another matrix check already holds globalThis.fetch — run matrix checks serially within one process',\n )\n }\n judgeWireInstalled = true\n const previous = globalThis.fetch\n globalThis.fetch = (async (url: unknown, init?: { body?: string }) => {\n // The judge leg is the ONLY call allowed to reach the wire; the agent\n // and driver legs run on the scripted transports above. Anything else is\n // a wiring defect in the engine under test, so fail loud.\n if (String(url) !== `${JUDGE_BASE_URL}/chat/completions`) {\n throw new Error(`multishot golden judge wire: unexpected request to ${String(url)}`)\n }\n const body = JSON.parse(init?.body ?? '{}') as Record<string, unknown>\n judgeRequests.push(recordJudgeRequest(body))\n const messages = (body.messages ?? []) as Array<{ role: string; content: string }>\n const system = messages.find((m) => m.role === 'system')?.content ?? ''\n const name = system.replace('JUDGE:', '')\n const score = JUDGE_SCORES[name]\n if (!score) {\n throw new Error(`multishot golden judge wire: unknown judge system prompt ${system}`)\n }\n return {\n ok: true,\n status: 200,\n json: async () => ({\n choices: [{ message: { content: JSON.stringify({ ...score, notes: `${name} ok` }) } }],\n usage: { prompt_tokens: 300, completion_tokens: 25 },\n model: 'test/judge-model',\n _response_cost: 0.0007,\n }),\n text: async () => '',\n }\n }) as unknown as typeof globalThis.fetch\n return () => {\n globalThis.fetch = previous\n judgeWireInstalled = false\n }\n }\n\n return { options, requests, judgeRequests, installJudgeWire }\n}\n","","// Frozen golden-record fixtures.\n//\n// A version file is written once and never edited. A behaviour change mints a\n// new file and registers it here beside the old one, so the diff between two\n// versions is the reviewable record of what moved and the previous contract\n// stays runnable.\n\nimport type { MultishotGoldenRecordSet } from '../types'\nimport v1 from './v1.json'\n\n/** Version a check uses when the caller names none. */\nexport const CURRENT_MULTISHOT_GOLDEN_VERSION = 'v1'\n\n/** A fixture reaches this module as parsed JSON, which types cannot vouch for.\n * A record set that is not the shape the harness reads would surface as a\n * confusing mismatch on every scenario, so the shape is checked once at load\n * and named where it breaks. */\nfunction assertRecordSet(value: unknown, version: string): MultishotGoldenRecordSet {\n const fail = (reason: string): never => {\n throw new Error(`multishot golden ${version}: malformed record set — ${reason}`)\n }\n if (typeof value !== 'object' || value === null) fail('expected an object')\n const set = value as Record<string, unknown>\n for (const key of ['version', 'recordedFrom', 'recordedFromPackageVersion', 'recordedAt']) {\n if (typeof set[key] !== 'string') fail(`${key} must be a string`)\n }\n if (set.version !== version) fail(`declares version ${String(set.version)}`)\n if (!Array.isArray(set.scenarios) || set.scenarios.length === 0) {\n fail('scenarios must be a non-empty array')\n }\n if (!Array.isArray(set.matrixScenarios)) fail('matrixScenarios must be an array')\n for (const [index, entry] of (set.scenarios as unknown[]).entries()) {\n const row = entry as Record<string, unknown>\n if (typeof row?.id !== 'string') fail(`scenarios[${index}].id must be a string`)\n if (!Array.isArray(row.requests)) fail(`scenarios[${index}].requests must be an array`)\n const outcome = row.outcome as Record<string, unknown> | undefined\n if (outcome?.kind !== 'result' && outcome?.kind !== 'error') {\n fail(`scenarios[${index}].outcome.kind must be result or error`)\n }\n }\n for (const [index, entry] of (set.matrixScenarios as unknown[]).entries()) {\n const row = entry as Record<string, unknown>\n if (typeof row?.id !== 'string') fail(`matrixScenarios[${index}].id must be a string`)\n if (typeof row.files !== 'object' || row.files === null) {\n fail(`matrixScenarios[${index}].files must be an object`)\n }\n }\n return set as unknown as MultishotGoldenRecordSet\n}\n\n/** The set is handed to every caller, so a caller that mutated it would move\n * the oracle for the whole process. Freezing makes the documented immutability\n * a property of the value rather than a convention. */\nfunction deepFreeze<T>(value: T): T {\n if (value === null || typeof value !== 'object') return value\n for (const entry of Object.values(value as Record<string, unknown>)) deepFreeze(entry)\n return Object.freeze(value)\n}\n\nconst VERSIONS: Record<string, MultishotGoldenRecordSet> = {\n v1: deepFreeze(assertRecordSet(v1, 'v1')),\n}\n\nexport function multishotGoldenVersions(): string[] {\n return Object.keys(VERSIONS)\n}\n\nexport function goldenRecords(\n version: string = CURRENT_MULTISHOT_GOLDEN_VERSION,\n): MultishotGoldenRecordSet {\n const set = VERSIONS[version]\n if (!set) {\n throw new Error(\n `multishot golden: no record set for version \"${version}\" — known versions are ${multishotGoldenVersions().join(', ')}`,\n )\n }\n return set\n}\n","// Deterministic multishot scenarios.\n//\n// Every scenario is a closed system: scripted agent and driver transports,\n// scripted tool executors, a fixed persona and profile, fixed token budgets.\n// Nothing reads the clock for a recorded field, nothing calls a network, and\n// nothing draws a random number. Two runs of the same scenario on the same\n// engine produce byte-identical records; the recorder enforces that.\n//\n// The catalog is the union of the behaviours the merged loop-to-graph parity\n// proofs covered. Two scripts run through it:\n//\n// delegation-* a research/code delegation agent: silent multi-tool\n// turns, an unknown tool, typed artifacts of two kinds,\n// both cost paths, turn-count edges, driver rotation.\n// sampling-contract-* a tool-using agent with distinct per-leg token\n// budgets: retry-on-empty, whitespace-only driver\n// content, an empty assistant follow-up, full rotation.\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport type { RunMultishotOptions } from '../multishot'\nimport {\n MultishotFatalToolError,\n type MultishotPersona,\n type MultishotToolDefinition,\n type MultishotToolExecutor,\n type MultishotTransport,\n type MultishotTransportResponse,\n} from '../types'\nimport { recordRequest } from './recording'\nimport type { MultishotRecordedRequest } from './types'\n\n/** Options plus the ledger the scenario's transports fill while it runs. */\nexport interface MultishotGoldenCase {\n options: RunMultishotOptions<MultishotPersona>\n /** Every transport call, in issue order. Populated by running the case. */\n requests: MultishotRecordedRequest[]\n}\n\nexport interface MultishotGoldenScenario {\n readonly id: string\n readonly description: string\n /** Fresh options and a fresh ledger. Scripted transports carry per-run\n * state, so an engine run and a re-run must never share a case. */\n readonly build: () => MultishotGoldenCase\n}\n\nfunction ledgerTransport(\n ledger: MultishotRecordedRequest[],\n leg: 'agent' | 'driver',\n inner: MultishotTransport,\n): MultishotTransport {\n return async (req) => {\n ledger.push(recordRequest(leg, req))\n return inner(req)\n }\n}\n\n// ---------------------------------------------------------------------------\n// delegation script\n// ---------------------------------------------------------------------------\n\nconst delegationPersona: MultishotPersona = { id: 'test-owner', ask: 'a launch brief' }\n\nconst delegationProfile: AgentProfile = {\n name: 'multishot-golden-delegation',\n prompt: { systemPrompt: 'You are the operator agent under test.' },\n}\n\nconst delegationShape = {\n buildOpener: (p: MultishotPersona) => `I need ${String(p.ask)}. What do you need from me?`,\n buildDriverSystemPrompt: (p: MultishotPersona) => `You are ${p.id}. Demand ${String(p.ask)}.`,\n}\n\nconst delegationTools: MultishotToolDefinition[] = [\n {\n type: 'function',\n function: { name: 'delegate_research', description: 'research', parameters: {} },\n },\n { type: 'function', function: { name: 'delegate_code', description: 'code', parameters: {} } },\n]\n\nfunction delegationExecutors(): Record<string, MultishotToolExecutor> {\n return {\n delegate_research: async (args) => ({\n content: `RESEARCH: ${JSON.stringify(args)}`,\n costUsd: 0.011,\n }),\n delegate_code: async (args) => ({ content: `CODE: ${JSON.stringify(args)}`, costUsd: 0.023 }),\n }\n}\n\nconst delegationArtifactTypeFor = (name: string): string | undefined =>\n name === 'delegate_research' ? 'research' : name === 'delegate_code' ? 'code' : undefined\n\n/** Pure in the request. The turn index is the number of `user` messages; a\n * trailing `tool` message means the follow-up call after inline execution.\n * Turn 1 is a SILENT multi-tool turn (empty content, two calls, one of them\n * an unknown tool with unparseable arguments); turn 2 dispatches one tool\n * beside text; turn 3 and later answer with text only. */\nconst delegationAgent: MultishotTransport = async (req) => {\n const userCount = req.messages.filter((m) => m.role === 'user').length\n const last = req.messages[req.messages.length - 1] as { role?: string }\n const afterTools = last?.role === 'tool'\n if (userCount === 1 && !afterTools) {\n return {\n message: {\n content: '',\n tool_calls: [\n {\n id: 'tc-1',\n type: 'function',\n function: { name: 'delegate_research', arguments: '{\"topic\":\"market\"}' },\n },\n {\n id: 'tc-2',\n type: 'function',\n function: { name: 'mystery_tool', arguments: 'not json' },\n },\n ],\n },\n usage: { prompt_tokens: 100, completion_tokens: 20 },\n }\n }\n if (userCount === 1 && afterTools) {\n return {\n message: { content: 'Research done — here is the direction.' },\n usage: { prompt_tokens: 140, completion_tokens: 30 },\n costUsd: 0.005,\n }\n }\n if (userCount === 2 && !afterTools) {\n return {\n message: {\n content: 'Building it now.',\n tool_calls: [\n {\n id: 'tc-3',\n type: 'function',\n function: { name: 'delegate_code', arguments: '{\"spec\":\"landing page\"}' },\n },\n ],\n },\n usage: { prompt_tokens: 200, completion_tokens: 25 },\n costUsd: 0.004,\n }\n }\n if (userCount === 2 && afterTools) {\n return {\n message: { content: 'Shipped the artifact you asked for.' },\n usage: { prompt_tokens: 240, completion_tokens: 40 },\n costUsd: 0.006,\n }\n }\n return {\n message: { content: `Closing summary for turn ${userCount}.` },\n usage: { prompt_tokens: 260, completion_tokens: 15 },\n costUsd: 0.002,\n }\n}\n\n/** Pure in the request: the reply indexes on how many prior driver replies the\n * point-of-view-translated conversation already carries. */\nconst delegationDriver: MultishotTransport = async (req) => {\n const priorReplies = req.messages.filter((m) => m.role === 'assistant').length\n return {\n message: { content: `Driver follow-up #${priorReplies}: sharper, please.` },\n usage: { prompt_tokens: 80, completion_tokens: 18 },\n costUsd: 0.001,\n }\n}\n\ninterface DelegationOverrides {\n maxTurns?: number\n maxToolDispatches?: number\n driverFallbackModels?: string[]\n toolExecutors?: Record<string, MultishotToolExecutor>\n agent?: MultishotTransport\n driver?: MultishotTransport\n}\n\nfunction delegationCase(overrides: DelegationOverrides = {}): MultishotGoldenCase {\n const requests: MultishotRecordedRequest[] = []\n const options: RunMultishotOptions<MultishotPersona> = {\n profile: delegationProfile,\n persona: delegationPersona,\n shape: delegationShape,\n tools: delegationTools,\n toolExecutors: overrides.toolExecutors ?? delegationExecutors(),\n artifactTypeFor: delegationArtifactTypeFor,\n maxTurns: overrides.maxTurns ?? 3,\n agentModel: 'test/agent-model',\n driverModel: 'test/driver-model',\n apiKey: 'golden-key',\n baseUrl: 'http://router.invalid',\n agentTransport: ledgerTransport(requests, 'agent', overrides.agent ?? delegationAgent),\n driverTransport: ledgerTransport(requests, 'driver', overrides.driver ?? delegationDriver),\n }\n if (overrides.maxToolDispatches !== undefined) {\n options.maxToolDispatches = overrides.maxToolDispatches\n }\n if (overrides.driverFallbackModels !== undefined) {\n options.driverFallbackModels = overrides.driverFallbackModels\n }\n return { options, requests }\n}\n\n/** Silent on the primary model, substantive on any other — the rotation path. */\nconst delegationSilentPrimaryDriver: MultishotTransport = async (req) => {\n if (req.model === 'test/driver-model') {\n return { message: { content: '' }, usage: { prompt_tokens: 10, completion_tokens: 0 } }\n }\n const priorReplies = req.messages.filter((m) => m.role === 'assistant').length\n return {\n message: { content: `Fallback follow-up #${priorReplies}.` },\n usage: { prompt_tokens: 80, completion_tokens: 18 },\n costUsd: 0.003,\n }\n}\n\nconst delegationAlwaysSilentDriver: MultishotTransport = async () => ({\n message: { content: '' },\n usage: { prompt_tokens: 10, completion_tokens: 0 },\n})\n\n/** One tool call per assistant turn, forever — walks past any dispatch cap. */\nconst delegationToolStormAgent: MultishotTransport = async (req) => ({\n message: {\n content: '',\n tool_calls: [\n {\n id: `tc-${req.messages.length}`,\n type: 'function',\n function: { name: 'delegate_research', arguments: '{}' },\n },\n ],\n },\n usage: { prompt_tokens: 10, completion_tokens: 5 },\n})\n\n// ---------------------------------------------------------------------------\n// sampling-contract script\n// ---------------------------------------------------------------------------\n\nconst SAMPLING_AGENT_MAX_TOKENS = 111\nconst SAMPLING_FOLLOWUP_MAX_TOKENS = 222\nconst SAMPLING_DRIVER_MAX_TOKENS = 333\n\nconst samplingPersona: MultishotPersona = { id: 'parity-persona', name: 'Parity Persona' }\n\nconst samplingProfile: AgentProfile = {\n name: 'multishot-golden-sampling',\n prompt: { systemPrompt: 'You are the domain agent under test.' },\n}\n\nconst samplingShape = {\n buildOpener: () => 'I need help with my CA return.',\n buildDriverSystemPrompt: (p: MultishotPersona) => `You simulate taxpayer ${p.id}.`,\n}\n\nconst samplingTools: MultishotToolDefinition[] = [\n {\n type: 'function',\n function: {\n name: 'state_tax_search',\n description: 'search state tax rules',\n parameters: { type: 'object', properties: {} },\n },\n },\n {\n type: 'function',\n function: {\n name: 'list_source_documents',\n description: 'list docs',\n parameters: { type: 'object', properties: {} },\n },\n },\n]\n\nfunction samplingExecutors(): Record<string, MultishotToolExecutor> {\n return {\n state_tax_search: async (args) => ({\n content: JSON.stringify({ ok: true, echo: args }),\n costUsd: 0.01,\n }),\n list_source_documents: async () => ({ content: '', costUsd: 0 }),\n }\n}\n\n/** A transport that answers from a fixed list and fails loud past its end. An\n * engine that issues more calls than the script has steps is a divergence,\n * not a longer conversation. */\nfunction scriptedTransport(steps: MultishotTransportResponse[], label: string): MultishotTransport {\n let index = 0\n return async () => {\n const step = steps[index++]\n if (!step) throw new Error(`${label}: unscripted call ${index}`)\n return step\n }\n}\n\n/** Three agent turns: a silent multi-tool dispatch with one unparseable\n * argument payload, a priced follow-up, a text-plus-unknown-tool turn, an\n * EMPTY follow-up with no usage at all (the uncaptured cost path), and a\n * closing answer priced from usage alone. */\nfunction samplingAgentScript(): MultishotTransportResponse[] {\n return [\n {\n message: {\n content: '',\n tool_calls: [\n {\n id: 'tc-1',\n type: 'function',\n function: { name: 'state_tax_search', arguments: '{\"state\":\"CA\"}' },\n },\n {\n id: 'tc-2',\n type: 'function',\n function: { name: 'list_source_documents', arguments: 'not-json' },\n },\n ],\n },\n usage: { prompt_tokens: 100, completion_tokens: 20 },\n },\n {\n message: { content: 'Here is my CA analysis.' },\n usage: { prompt_tokens: 140, completion_tokens: 30 },\n costUsd: 0.002,\n },\n {\n message: {\n content: 'Checking one more source.',\n tool_calls: [\n { id: 'tc-3', type: 'function', function: { name: 'mystery_tool', arguments: '{}' } },\n ],\n },\n usage: { prompt_tokens: 200, completion_tokens: 15 },\n },\n { message: { content: '' } },\n {\n message: { content: 'Final answer: file CA 540.' },\n usage: { prompt_tokens: 260, completion_tokens: 40 },\n },\n ]\n}\n\n/** Two driver turns: retry-on-empty on the primary, then a whitespace-only\n * reply that must count as empty, then full rotation to the fallback. */\nfunction samplingDriverScript(): MultishotTransportResponse[] {\n return [\n { message: { content: '' } },\n {\n message: { content: 'Follow-up question A.' },\n usage: { prompt_tokens: 50, completion_tokens: 12 },\n },\n { message: { content: '' } },\n { message: { content: ' ' } },\n { message: { content: 'Follow-up question B.' }, costUsd: 0.0004 },\n ]\n}\n\ninterface SamplingOverrides {\n maxToolDispatches?: number\n toolExecutors?: Record<string, MultishotToolExecutor>\n agentScript?: MultishotTransportResponse[]\n driverScript?: MultishotTransportResponse[]\n}\n\nfunction samplingCase(overrides: SamplingOverrides = {}): MultishotGoldenCase {\n const requests: MultishotRecordedRequest[] = []\n const options: RunMultishotOptions<MultishotPersona> = {\n profile: samplingProfile,\n persona: samplingPersona,\n shape: samplingShape,\n tools: samplingTools,\n toolExecutors: overrides.toolExecutors ?? samplingExecutors(),\n artifactTypeFor: (toolName: string) =>\n toolName.startsWith('state_tax_') ? 'state-tax-tool' : undefined,\n maxTurns: 3,\n agentMaxTokens: SAMPLING_AGENT_MAX_TOKENS,\n toolFollowupMaxTokens: SAMPLING_FOLLOWUP_MAX_TOKENS,\n driverMaxTokens: SAMPLING_DRIVER_MAX_TOKENS,\n maxToolDispatches: overrides.maxToolDispatches ?? 4,\n agentModel: 'scripted/agent',\n driverModel: 'primary/driver',\n driverFallbackModels: ['fallback/driver'],\n apiKey: 'golden-key',\n baseUrl: 'http://router.invalid',\n agentTransport: ledgerTransport(\n requests,\n 'agent',\n scriptedTransport(overrides.agentScript ?? samplingAgentScript(), 'agent transport'),\n ),\n driverTransport: ledgerTransport(\n requests,\n 'driver',\n scriptedTransport(overrides.driverScript ?? samplingDriverScript(), 'driver transport'),\n ),\n }\n return { options, requests }\n}\n\n// ---------------------------------------------------------------------------\n// catalog\n// ---------------------------------------------------------------------------\n\n/** Every recorded shot scenario, in record order. */\nexport function multishotGoldenScenarios(): MultishotGoldenScenario[] {\n return [\n {\n id: 'delegation-three-turns',\n description:\n 'three turns with a silent multi-tool dispatch, an unknown tool, both typed artifact kinds, and both cost paths',\n build: () => delegationCase(),\n },\n {\n id: 'delegation-ten-turns',\n description: 'ten turns — the function default depth, past any short driver-turn budget',\n build: () => delegationCase({ maxTurns: 10 }),\n },\n {\n id: 'delegation-zero-turns',\n description: 'maxTurns 0 returns the opener-only result and spends nothing',\n build: () => delegationCase({ maxTurns: 0 }),\n },\n {\n id: 'delegation-nan-turns',\n description: 'a non-numeric maxTurns behaves as zero turns, not as the default',\n build: () => delegationCase({ maxTurns: Number('not-a-number') }),\n },\n {\n id: 'delegation-single-turn',\n description: 'maxTurns 1 never calls the driver leg',\n build: () => delegationCase({ maxTurns: 1 }),\n },\n {\n id: 'delegation-driver-rotation',\n description: 'a silent primary driver rotates to the fallback model after two attempts',\n build: () =>\n delegationCase({\n driver: delegationSilentPrimaryDriver,\n driverFallbackModels: ['test/driver-fallback'],\n }),\n },\n {\n id: 'delegation-fatal-tool-error',\n description:\n 'MultishotFatalToolError from an executor aborts the shot and declares its spend',\n build: () =>\n delegationCase({\n toolExecutors: {\n ...delegationExecutors(),\n delegate_research: async () => {\n throw new MultishotFatalToolError('research backend down')\n },\n },\n }),\n },\n {\n id: 'delegation-driver-empty',\n description: 'a driver silent on every model raises MultishotDriverEmptyError',\n build: () => delegationCase({ driver: delegationAlwaysSilentDriver }),\n },\n {\n id: 'delegation-dispatch-cap',\n description: 'a tool storm trips the dispatch cap with the exact cap message',\n build: () =>\n delegationCase({ agent: delegationToolStormAgent, maxToolDispatches: 2, maxTurns: 3 }),\n },\n {\n id: 'sampling-contract-three-turns',\n description:\n 'per-leg token budgets, driver retry-on-empty, a whitespace-only driver reply, an empty assistant follow-up with no usage, and full rotation',\n build: () => samplingCase(),\n },\n {\n id: 'sampling-contract-fatal-tool-error',\n description: 'MultishotFatalToolError propagates unchanged out of the first tool dispatch',\n build: () =>\n samplingCase({\n toolExecutors: {\n state_tax_search: async () => {\n throw new MultishotFatalToolError('citation budget exhausted')\n },\n list_source_documents: async () => ({ content: '', costUsd: 0 }),\n },\n }),\n },\n {\n id: 'sampling-contract-driver-empty-after-rotation',\n description:\n 'MultishotDriverEmptyError names the turn only after both attempts on both models',\n build: () =>\n samplingCase({\n driverScript: [\n { message: { content: '' } },\n { message: { content: '' } },\n { message: { content: '' } },\n { message: { content: '' } },\n ],\n }),\n },\n {\n id: 'sampling-contract-dispatch-cap',\n description: 'three calls against a cap of two fail loud on turn 0',\n build: () =>\n samplingCase({\n maxToolDispatches: 2,\n agentScript: [\n {\n message: {\n content: '',\n tool_calls: [1, 2, 3].map((n) => ({\n id: `tc-${n}`,\n type: 'function' as const,\n function: { name: 'state_tax_search', arguments: '{}' },\n })),\n },\n },\n ],\n driverScript: [],\n }),\n },\n ]\n}\n","// The check a conversation engine runs against the golden records.\n//\n// The harness owns the whole comparison: it builds the scenario, runs the\n// engine, normalizes what came back exactly as the recorder did, and reports\n// every field that moved. It asserts through a thrown error rather than a test\n// framework, so a consumer on vitest, node:test, or a plain script all use the\n// same call.\n\nimport type { RunMultishotMatrixResult } from '../matrix'\nimport { compareJson } from './compare'\nimport type { MultishotGoldenEngine, MultishotMatrixGoldenEngine } from './engine'\nimport {\n type MultishotMatrixGoldenScenario,\n multishotMatrixGoldenScenarios,\n} from './matrix-scenarios'\nimport {\n readRunDir,\n recordError,\n recordResult,\n sortJudgeRequests,\n stripVolatile,\n} from './recording'\nimport { goldenRecords } from './records'\nimport { type MultishotGoldenScenario, multishotGoldenScenarios } from './scenarios'\nimport type {\n MultishotGoldenRecord,\n MultishotGoldenRecordSet,\n MultishotMatrixGoldenRecord,\n} from './types'\n\nexport interface MultishotGoldenScenarioReport {\n id: string\n description: string\n ok: boolean\n mismatches: string[]\n}\n\nexport interface MultishotGoldenReport {\n version: string\n recordedFrom: string\n ok: boolean\n scenarios: MultishotGoldenScenarioReport[]\n}\n\nexport class MultishotGoldenMismatchError extends Error {\n constructor(\n readonly scenarioId: string,\n readonly mismatches: string[],\n readonly version: string,\n ) {\n super(\n [\n `multishot golden ${version} — scenario \"${scenarioId}\" diverged from the record:`,\n ...mismatches.map((line) => ` - ${line}`),\n ].join('\\n'),\n )\n this.name = 'MultishotGoldenMismatchError'\n }\n}\n\nfunction requireRecord(records: MultishotGoldenRecordSet, id: string): MultishotGoldenRecord {\n const record = records.scenarios.find((entry) => entry.id === id)\n if (!record) {\n throw new Error(\n `multishot golden ${records.version} holds no record for scenario \"${id}\" — regenerate the fixture for the new scenario`,\n )\n }\n return record\n}\n\nfunction requireMatrixRecord(\n records: MultishotGoldenRecordSet,\n id: string,\n): MultishotMatrixGoldenRecord {\n const record = records.matrixScenarios.find((entry) => entry.id === id)\n if (!record) {\n throw new Error(\n `multishot golden ${records.version} holds no matrix record for scenario \"${id}\" — regenerate the fixture for the new scenario`,\n )\n }\n return record\n}\n\n/** Run one scenario and report every field that diverged from the record. */\nexport async function checkMultishotGoldenScenario(opts: {\n engine: MultishotGoldenEngine\n scenario: MultishotGoldenScenario\n records?: MultishotGoldenRecordSet\n}): Promise<MultishotGoldenScenarioReport> {\n const records = opts.records ?? goldenRecords()\n const record = requireRecord(records, opts.scenario.id)\n const runCase = opts.scenario.build()\n\n let observed: MultishotGoldenRecord['outcome']\n const mismatches: string[] = []\n try {\n const result = await opts.engine(runCase.options)\n observed = { kind: 'result', result: recordResult(result) }\n // durationMs is wall clock and is excluded from the record, but it is still\n // part of the contract: a result must report a usable duration. It joins the\n // other mismatches rather than replacing them, so one bad field cannot hide\n // the rest of a divergent run.\n if (!isUsableDuration(result.durationMs)) {\n mismatches.push(\n `durationMs: expected a finite number >= 0, received ${String(result.durationMs)}`,\n )\n }\n } catch (err) {\n observed = { kind: 'error', error: recordError(err) }\n }\n\n mismatches.push(\n ...compareJson(record.outcome, observed, 'outcome'),\n ...compareJson(record.requests, runCase.requests, 'requests'),\n )\n return {\n id: opts.scenario.id,\n description: opts.scenario.description,\n ok: mismatches.length === 0,\n mismatches,\n }\n}\n\n/** Same as `checkMultishotGoldenScenario`, but throws on divergence. */\nexport async function assertMultishotGoldenScenario(opts: {\n engine: MultishotGoldenEngine\n scenario: MultishotGoldenScenario\n records?: MultishotGoldenRecordSet\n}): Promise<void> {\n const records = opts.records ?? goldenRecords()\n const report = await checkMultishotGoldenScenario({ ...opts, records })\n if (!report.ok) {\n throw new MultishotGoldenMismatchError(report.id, report.mismatches, records.version)\n }\n}\n\n/** Run every shot scenario. Never throws on divergence — read `ok`. */\nexport async function checkMultishotGolden(opts: {\n engine: MultishotGoldenEngine\n records?: MultishotGoldenRecordSet\n only?: string[]\n}): Promise<MultishotGoldenReport> {\n const records = opts.records ?? goldenRecords()\n const catalog = multishotGoldenScenarios()\n const wanted = opts.only ? new Set(opts.only) : undefined\n if (wanted) {\n // An id that names no scenario would silently shrink the run, and a run of\n // zero scenarios reports ok. A stale id after a rename must stop the check,\n // not green it.\n const unknown = [...wanted].filter((id) => !catalog.some((s) => s.id === id)).sort()\n if (unknown.length > 0) {\n throw new Error(\n `multishot golden: \\`only\\` names ${unknown.length === 1 ? 'a scenario' : 'scenarios'} the catalog does not hold: ${unknown.join(', ')}`,\n )\n }\n }\n const scenarios = catalog.filter((s) => !wanted || wanted.has(s.id))\n const reports: MultishotGoldenScenarioReport[] = []\n for (const scenario of scenarios) {\n reports.push(await checkMultishotGoldenScenario({ engine: opts.engine, scenario, records }))\n }\n return {\n version: records.version,\n recordedFrom: records.recordedFrom,\n ok: reports.every((report) => report.ok),\n scenarios: reports,\n }\n}\n\n/** Run one matrix scenario against `runDir` and report every divergence. */\nexport async function checkMultishotMatrixGoldenScenario(opts: {\n engine: MultishotMatrixGoldenEngine\n scenario: MultishotMatrixGoldenScenario\n /** An empty directory the engine may write its per-cell files into. */\n runDir: string\n records?: MultishotGoldenRecordSet\n}): Promise<MultishotGoldenScenarioReport> {\n const records = opts.records ?? goldenRecords()\n const record = requireMatrixRecord(records, opts.scenario.id)\n const runCase = opts.scenario.build(opts.runDir)\n const restore = runCase.installJudgeWire()\n let matrix: RunMultishotMatrixResult\n try {\n matrix = await opts.engine(runCase.options)\n } finally {\n restore()\n }\n\n const mismatches = [\n ...compareJson(record.matrix, stripVolatile(matrix.matrix), 'matrix'),\n ...compareJson(record.requests, runCase.requests, 'requests'),\n ...compareJson(record.judgeRequests, sortJudgeRequests(runCase.judgeRequests), 'judgeRequests'),\n ...compareJson(record.files, readRunDir(opts.runDir), 'files'),\n ]\n return {\n id: opts.scenario.id,\n description: opts.scenario.description,\n ok: mismatches.length === 0,\n mismatches,\n }\n}\n\nexport async function assertMultishotMatrixGoldenScenario(opts: {\n engine: MultishotMatrixGoldenEngine\n scenario: MultishotMatrixGoldenScenario\n runDir: string\n records?: MultishotGoldenRecordSet\n}): Promise<void> {\n const records = opts.records ?? goldenRecords()\n const report = await checkMultishotMatrixGoldenScenario({ ...opts, records })\n if (!report.ok) {\n throw new MultishotGoldenMismatchError(report.id, report.mismatches, records.version)\n }\n}\n\n/** A duration a caller can read: finite and not negative. */\nexport function isUsableDuration(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0\n}\n\nexport { multishotGoldenScenarios, multishotMatrixGoldenScenarios }\n"],"mappings":";;;;;AAMA,MAAM,aAAa;AAQnB,SAAgB,YACd,UACA,QACA,MACA,UAA0B,CAAC,GACjB;CACV,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,aAAuB,CAAC;CAC9B,KAAK,UAAU,QAAQ,MAAM,YAAY,KAAK;CAG9C,OAAO,WAAW,MAAM,GAAG,KAAK;AAClC;AAEA,SAAS,KACP,UACA,QACA,MACA,KACA,OACM;CACN,IAAI,IAAI,UAAU,OAAO;CAEzB,IAAI,MAAM,QAAQ,QAAQ,KAAK,MAAM,QAAQ,MAAM,GAAG;EACpD,IAAI,CAAC,MAAM,QAAQ,QAAQ,KAAK,CAAC,MAAM,QAAQ,MAAM,GAAG;GACtD,IAAI,KAAK,SAAS,MAAM,UAAU,MAAM,CAAC;GACzC;EACF;EACA,IAAI,SAAS,WAAW,OAAO,QAC7B,IAAI,KAAK,GAAG,KAAK,aAAa,SAAS,OAAO,qBAAqB,OAAO,QAAQ;EAEpF,MAAM,SAAS,KAAK,IAAI,SAAS,QAAQ,OAAO,MAAM;EACtD,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,IAAI,SAAS,OAAO,KAChD,KAAK,SAAS,IAAI,OAAO,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,KAAK,KAAK;EAE1D;CACF;CAEA,MAAM,gBAAgB,MAAM,QAAQ;CACpC,MAAM,cAAc,MAAM,MAAM;CAChC,IAAI,iBAAiB,aAAa;EAChC,IAAI,CAAC,iBAAiB,CAAC,aAAa;GAClC,IAAI,KAAK,SAAS,MAAM,UAAU,MAAM,CAAC;GACzC;EACF;EACA,MAAM,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,OAAO,KAAK,QAAQ,GAAG,GAAG,OAAO,KAAK,MAAM,CAAC,CAAC,C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,WAAW,WAAW;EAC1B;CACF;AACF;AAEA,eAAsB,oCAAoC,MAKxC;CAChB,MAAM,UAAU,KAAK,WAAW,cAAc;CAC9C,MAAM,SAAS,MAAM,mCAAmC;EAAE,GAAG;EAAM;CAAQ,CAAC;CAC5E,IAAI,CAAC,OAAO,IACV,MAAM,IAAI,6BAA6B,OAAO,IAAI,OAAO,YAAY,QAAQ,OAAO;AAExF;;AAGA,SAAgB,iBAAiB,OAAiC;CAChE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS;AACzE"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["v1"],"sources":["../../../src/multishot/golden/compare.ts","../../../src/multishot/golden/recording.ts","../../../src/multishot/golden/matrix-scenarios.ts","../../../src/multishot/golden/records/v1.json","../../../src/multishot/golden/records/index.ts","../../../src/multishot/golden/scenarios.ts","../../../src/multishot/golden/harness.ts"],"sourcesContent":["// Structural comparison with a readable failure path.\n//\n// A golden mismatch has to name the field that moved, not print two blobs.\n// Every mismatch is one line: the dotted path, what the record holds, and what\n// the engine produced.\n\nconst MAX_RENDER = 240\n\nexport interface CompareOptions {\n /** Stop after this many mismatches. A structural divergence high in the\n * tree would otherwise report every leaf below it. */\n limit?: number\n}\n\nexport function compareJson(\n expected: unknown,\n actual: unknown,\n path: string,\n options: CompareOptions = {},\n): string[] {\n const limit = options.limit ?? 25\n const mismatches: string[] = []\n walk(expected, actual, path, mismatches, limit)\n // The walk stops checking past the cap but a single frame can push several\n // lines, so the list is trimmed to the number the caller asked for.\n return mismatches.slice(0, limit)\n}\n\nfunction walk(\n expected: unknown,\n actual: unknown,\n path: string,\n out: string[],\n limit: number,\n): void {\n if (out.length >= limit) return\n\n if (Array.isArray(expected) || Array.isArray(actual)) {\n if (!Array.isArray(expected) || !Array.isArray(actual)) {\n out.push(mismatch(path, expected, actual))\n return\n }\n if (expected.length !== actual.length) {\n out.push(`${path}: expected ${expected.length} entries, received ${actual.length}`)\n }\n const shared = Math.min(expected.length, actual.length)\n for (let i = 0; i < shared && out.length < limit; i++) {\n walk(expected[i], actual[i], `${path}[${i}]`, out, limit)\n }\n return\n }\n\n const expectedIsRow = isRow(expected)\n const actualIsRow = isRow(actual)\n if (expectedIsRow || actualIsRow) {\n if (!expectedIsRow || !actualIsRow) {\n out.push(mismatch(path, expected, actual))\n return\n }\n const keys = [...new Set([...Object.keys(expected), ...Object.keys(actual)])].sort()\n for (const key of keys) {\n const inExpected = key in expected\n const inActual = key in actual\n const child = path ? `${path}.${key}` : key\n if (!inActual) {\n out.push(`${child}: expected ${render(expected[key])}, received nothing`)\n continue\n }\n if (!inExpected) {\n out.push(`${child}: expected nothing, received ${render(actual[key])}`)\n continue\n }\n walk(expected[key], actual[key], child, out, limit)\n if (out.length >= limit) return\n }\n return\n }\n\n if (!Object.is(expected, actual)) out.push(mismatch(path, expected, actual))\n}\n\nfunction isRow(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction mismatch(path: string, expected: unknown, actual: unknown): string {\n return `${path}: expected ${render(expected)}, received ${render(actual)}`\n}\n\nfunction render(value: unknown): string {\n if (value === undefined) return 'undefined'\n let text: string\n try {\n text = JSON.stringify(value) ?? String(value)\n } catch {\n text = String(value)\n }\n return text.length > MAX_RENDER ? `${text.slice(0, MAX_RENDER)}…` : text\n}\n","// Normalizers shared by the recorder and the replay check.\n//\n// Everything here is pure. The recorder writes what these functions produce;\n// the check runs the same functions over a live engine and compares. A field\n// that is not normalized identically on both sides would read as a permanent\n// mismatch, so there is exactly one implementation.\n\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { join, posix, relative, sep } from 'node:path'\nimport { readCellSpend } from '../../matrix'\nimport type { MultishotResult, MultishotToolDefinition, MultishotTransportRequest } from '../types'\nimport type {\n MultishotRecordedMessage,\n MultishotRecordedRequest,\n RecordedJudgeRequest,\n RecordedMultishotError,\n RecordedMultishotResult,\n} from './types'\n\n/** Keys whose value is wall clock or run identity. Two runs never agree on\n * them, so they are removed before comparison instead of being compared. */\nconst VOLATILE_KEYS: ReadonlySet<string> = new Set([\n 'durationMs',\n 'meanDurationMs',\n 'matrixId',\n 'runId',\n])\n\nexport function recordMessage(raw: unknown): MultishotRecordedMessage {\n const row = (typeof raw === 'object' && raw !== null ? raw : {}) as Record<string, unknown>\n const message: MultishotRecordedMessage = {\n role: typeof row.role === 'string' ? row.role : '(missing role)',\n content: typeof row.content === 'string' ? row.content : null,\n }\n if (typeof row.tool_call_id === 'string') message.toolCallId = row.tool_call_id\n if (Array.isArray(row.tool_calls)) {\n message.toolCalls = row.tool_calls.map((call) => {\n const entry = (typeof call === 'object' && call !== null ? call : {}) as Record<\n string,\n unknown\n >\n const fn = (\n typeof entry.function === 'object' && entry.function !== null ? entry.function : {}\n ) as Record<string, unknown>\n return {\n id: typeof entry.id === 'string' ? entry.id : '(missing id)',\n name: typeof fn.name === 'string' ? fn.name : '(missing name)',\n arguments: typeof fn.arguments === 'string' ? fn.arguments : '(missing arguments)',\n }\n })\n }\n return message\n}\n\nexport function recordRequest(\n leg: 'agent' | 'driver',\n req: MultishotTransportRequest,\n): MultishotRecordedRequest {\n return {\n leg,\n model: req.model,\n temperature: req.temperature ?? null,\n maxTokens: req.maxTokens ?? null,\n tools: req.tools ? (JSON.parse(JSON.stringify(req.tools)) as MultishotToolDefinition[]) : null,\n messages: req.messages.map(recordMessage),\n }\n}\n\n/** Judge calls reach the wire as an OpenAI-compat body, not through a\n * transport, so they are recorded from the request body the stub receives. */\nexport function recordJudgeRequest(body: Record<string, unknown>): RecordedJudgeRequest {\n return {\n model: typeof body.model === 'string' ? body.model : '(missing model)',\n temperature: typeof body.temperature === 'number' ? body.temperature : null,\n maxTokens: typeof body.max_tokens === 'number' ? body.max_tokens : null,\n messages: Array.isArray(body.messages) ? body.messages.map(recordMessage) : [],\n }\n}\n\nexport function recordResult(result: MultishotResult): RecordedMultishotResult {\n const { durationMs: _durationMs, ...rest } = result\n return JSON.parse(JSON.stringify(rest)) as RecordedMultishotResult\n}\n\nexport function recordError(err: unknown): RecordedMultishotError {\n const spend = readCellSpend(err)\n return {\n name: err instanceof Error ? err.name : typeof err,\n message: err instanceof Error ? err.message : String(err),\n cellSpend: spend ? { costUsd: spend.costUsd, kind: spend.kind } : null,\n }\n}\n\n/** Deep copy with every wall-clock and run-identity key removed. */\nexport function stripVolatile(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(stripVolatile)\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {\n if (VOLATILE_KEYS.has(key)) continue\n out[key] = stripVolatile(entry)\n }\n return out\n }\n return value\n}\n\n/** The matrix summary Markdown carries a rendered duration. Mask it so the rest\n * of the document — cell counts, pass rate, mean, cost, the uncaptured warning\n * — stays under comparison.\n *\n * A duration the mask does not recognise would stay in the comparison and make\n * every run mismatch on a definitionally irreproducible field, so an\n * unmaskable duration line fails loud instead. */\nexport function maskVolatileMarkdown(text: string): string {\n const masked = text.replace(/\\*\\*Duration\\*\\*: [\\d.]+\\s*(?:ms|s|m)\\b/g, '**Duration**: <elided>')\n if (/\\*\\*Duration\\*\\*: (?!<elided>)/.test(masked)) {\n throw new Error(\n `multishot golden: a rendered duration is not in a form the mask recognises — ${\n masked.match(/\\*\\*Duration\\*\\*: [^|\\n]*/)?.[0] ?? '(unreadable)'\n }`,\n )\n }\n return masked\n}\n\n/** Judge calls fan out through `Promise.all` across three slots, so their\n * issue order is an implementation detail of the cell body, not behaviour a\n * caller can observe. Their CONTENT is behaviour, so they are compared as a\n * set with a stable order. */\nexport function sortJudgeRequests(\n requests: readonly RecordedJudgeRequest[],\n): RecordedJudgeRequest[] {\n return [...requests].sort((a, b) => {\n const left = JSON.stringify(a)\n const right = JSON.stringify(b)\n return left < right ? -1 : left > right ? 1 : 0\n })\n}\n\n/** Every file under `dir`, keyed by slash-separated relative path. JSON is\n * parsed and stripped of wall-clock keys; Markdown keeps its text with the\n * rendered duration masked; anything else is kept verbatim. */\nexport function readRunDir(dir: string): Record<string, unknown> {\n if (!existsSync(dir)) {\n throw new Error(\n `multishot golden: the run directory ${dir} does not exist — the engine wrote no per-cell files`,\n )\n }\n const files: Record<string, unknown> = {}\n for (const path of walkFiles(dir)) {\n const key = relative(dir, path).split(sep).join(posix.sep)\n const text = readFileSync(path, 'utf8')\n if (path.endsWith('.json')) {\n files[key] = stripVolatile(JSON.parse(text))\n continue\n }\n files[key] = path.endsWith('.md') ? maskVolatileMarkdown(text) : text\n }\n return files\n}\n\nfunction walkFiles(dir: string): string[] {\n const out: string[] = []\n for (const entry of readdirSync(dir).sort()) {\n const path = join(dir, entry)\n if (statSync(path).isDirectory()) out.push(...walkFiles(path))\n else out.push(path)\n }\n return out\n}\n","// Deterministic multishot MATRIX scenarios.\n//\n// The shot scenarios pin one conversation. These pin the cell body around it:\n// profile x persona fan-out, the three judge slots, the cell composite, the\n// per-cell files, the run summary, and the cost provenance the cell reports.\n//\n// Cells run one at a time. Concurrency is the matrix runner's own mechanic and\n// is covered by the runner's tests; forcing it to one here makes the recorded\n// request ledger a property of the conversation engine alone, not of how two\n// engines happen to interleave their microtasks.\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport type { JudgeConfig } from '../judges'\nimport type { RunMultishotMatrixOptions } from '../matrix'\nimport type {\n MultishotPersona,\n MultishotToolDefinition,\n MultishotToolExecutor,\n MultishotTransport,\n} from '../types'\nimport { recordJudgeRequest, recordRequest } from './recording'\nimport type { MultishotRecordedRequest, RecordedJudgeRequest } from './types'\n\nexport interface MultishotMatrixGoldenCase {\n options: RunMultishotMatrixOptions<MultishotPersona>\n requests: MultishotRecordedRequest[]\n /** Judge calls, filled while the case runs. Sorted before comparison. */\n judgeRequests: RecordedJudgeRequest[]\n}\n\nexport interface MultishotMatrixGoldenScenario {\n readonly id: string\n readonly description: string\n readonly build: (runDir: string) => MultishotMatrixGoldenCase\n}\n\nconst personas: MultishotPersona[] = [\n { id: 'retail-founder', ask: 'a launch brief' },\n { id: 'saas-operator', ask: 'a pricing page' },\n]\n\nconst profiles: Array<{ id: string; value: AgentProfile }> = [\n {\n id: 'baseline',\n value: {\n name: 'multishot-golden-baseline',\n prompt: { systemPrompt: 'You are the baseline operator.' },\n },\n },\n {\n id: 'challenger',\n value: {\n name: 'multishot-golden-challenger',\n prompt: { systemPrompt: 'You are the challenger operator.' },\n },\n },\n]\n\nconst shape = {\n buildOpener: (p: MultishotPersona) => `I need ${String(p.ask)}. What do you need from me?`,\n buildDriverSystemPrompt: (p: MultishotPersona) => `You are ${p.id}. Demand ${String(p.ask)}.`,\n}\n\nconst tools: MultishotToolDefinition[] = [\n {\n type: 'function',\n function: { name: 'delegate_research', description: 'research', parameters: {} },\n },\n { type: 'function', function: { name: 'delegate_code', description: 'code', parameters: {} } },\n]\n\nfunction toolExecutors(): Record<string, MultishotToolExecutor> {\n return {\n delegate_research: async (args) => ({\n content: `RESEARCH: ${JSON.stringify(args)}`,\n costUsd: 0.011,\n }),\n delegate_code: async (args) => ({ content: `CODE: ${JSON.stringify(args)}`, costUsd: 0.023 }),\n }\n}\n\nconst artifactTypeFor = (name: string): string | undefined =>\n name === 'delegate_research' ? 'research' : name === 'delegate_code' ? 'code' : undefined\n\n/** Turn 1 dispatches research silently, turn 2 dispatches code beside text,\n * turn 3 answers with text — so both artifact kinds exist in every cell and\n * both artifact judge slots fire. */\nconst agentTransport: MultishotTransport = async (req) => {\n const userCount = req.messages.filter((m) => m.role === 'user').length\n const last = req.messages[req.messages.length - 1] as { role?: string }\n const afterTools = last?.role === 'tool'\n if (userCount === 1 && !afterTools) {\n return {\n message: {\n content: '',\n tool_calls: [\n {\n id: 'tc-1',\n type: 'function',\n function: { name: 'delegate_research', arguments: '{\"topic\":\"market\"}' },\n },\n ],\n },\n usage: { prompt_tokens: 100, completion_tokens: 20 },\n }\n }\n if (userCount === 1 && afterTools) {\n return {\n message: { content: 'Research done — here is the direction.' },\n usage: { prompt_tokens: 140, completion_tokens: 30 },\n costUsd: 0.005,\n }\n }\n if (userCount === 2 && !afterTools) {\n return {\n message: {\n content: 'Building it now.',\n tool_calls: [\n {\n id: 'tc-2',\n type: 'function',\n function: { name: 'delegate_code', arguments: '{\"spec\":\"landing page\"}' },\n },\n ],\n },\n usage: { prompt_tokens: 200, completion_tokens: 25 },\n costUsd: 0.004,\n }\n }\n if (userCount === 2 && afterTools) {\n return {\n message: { content: 'Shipped the artifact you asked for.' },\n usage: { prompt_tokens: 240, completion_tokens: 40 },\n costUsd: 0.006,\n }\n }\n return {\n message: { content: `Closing summary for turn ${userCount}.` },\n usage: { prompt_tokens: 260, completion_tokens: 15 },\n costUsd: 0.002,\n }\n}\n\nconst driverTransport: MultishotTransport = async (req) => {\n const priorReplies = req.messages.filter((m) => m.role === 'assistant').length\n return {\n message: { content: `Driver follow-up #${priorReplies}: sharper, please.` },\n usage: { prompt_tokens: 80, completion_tokens: 18 },\n costUsd: 0.001,\n }\n}\n\nconst dimensions = [\n { key: 'usefulness', description: 'Was it useful? (0-10)' },\n { key: 'specificity', description: 'Was it specific? (0-10)' },\n]\n\nfunction judge<TInput>(\n name: string,\n buildPrompt: (input: TInput) => string,\n transport: MultishotTransport,\n): JudgeConfig<TInput> {\n return {\n name,\n transport,\n model: 'test/judge-model',\n dimensions,\n systemPrompt: `JUDGE:${name}`,\n buildPrompt,\n }\n}\n\n/** Scores keyed by judge name, so the judge leg is a pure function of the request. */\nconst JUDGE_SCORES: Record<string, { usefulness: number; specificity: number }> = {\n conversation: { usefulness: 8, specificity: 7 },\n 'code-review': { usefulness: 6, specificity: 9 },\n 'content-quality': { usefulness: 5, specificity: 4 },\n}\n\nexport function multishotMatrixGoldenScenarios(): MultishotMatrixGoldenScenario[] {\n return [\n {\n id: 'matrix-two-profiles-two-personas',\n description:\n 'a 2x2 matrix at one replicate: every cell produces both artifact kinds, all three judge slots score, and the run persists per-cell files plus the summary',\n build: (runDir: string) => buildMatrixCase(runDir),\n },\n ]\n}\n\nfunction buildMatrixCase(runDir: string): MultishotMatrixGoldenCase {\n const requests: MultishotRecordedRequest[] = []\n const judgeRequests: RecordedJudgeRequest[] = []\n\n // The judge leg is scripted exactly like the agent and driver legs: a pure\n // function of the request, so the recorded ledger is a property of the\n // engine under test alone.\n const judgeTransport: MultishotTransport = async (req) => {\n judgeRequests.push(\n recordJudgeRequest({\n model: req.model,\n temperature: req.temperature,\n max_tokens: req.maxTokens,\n messages: req.messages,\n }),\n )\n const messages = req.messages as Array<{ role?: string; content?: string }>\n const system = messages.find((m) => m.role === 'system')?.content ?? ''\n const name = system.replace('JUDGE:', '')\n const score = JUDGE_SCORES[name]\n if (!score) {\n throw new Error(`multishot golden judge transport: unknown judge system prompt ${system}`)\n }\n return {\n message: { content: JSON.stringify({ ...score, notes: `${name} ok` }) },\n usage: { prompt_tokens: 300, completion_tokens: 25 },\n model: 'test/judge-model',\n costUsd: 0.0007,\n }\n }\n\n const options: RunMultishotMatrixOptions<MultishotPersona> = {\n profiles,\n personas,\n shape,\n judges: {\n conversation: judge(\n 'conversation',\n (input: { transcript: unknown[] }) =>\n `Score this conversation of ${input.transcript.length} messages.`,\n judgeTransport,\n ),\n codeReview: judge(\n 'code-review',\n (input: { artifact: { content: string } }) => `Score this code: ${input.artifact.content}`,\n judgeTransport,\n ),\n contentQuality: judge(\n 'content-quality',\n (input: { artifact: { content: string } }) =>\n `Score this content: ${input.artifact.content}`,\n judgeTransport,\n ),\n },\n tools,\n toolExecutors: toolExecutors(),\n artifactTypeFor,\n runDir,\n reps: 1,\n maxTurns: 3,\n maxConcurrency: 1,\n agentModel: 'test/agent-model',\n driverModel: 'test/driver-model',\n agentTransport: async (req) => {\n requests.push(recordRequest('agent', req))\n return agentTransport(req)\n },\n driverTransport: async (req) => {\n requests.push(recordRequest('driver', req))\n return driverTransport(req)\n },\n }\n\n return { options, requests, judgeRequests }\n}\n","","// Frozen golden-record fixtures.\n//\n// A version file is written once and never edited. A behaviour change mints a\n// new file and registers it here beside the old one, so the diff between two\n// versions is the reviewable record of what moved and the previous contract\n// stays runnable.\n\nimport type { MultishotGoldenRecordSet } from '../types'\nimport v1 from './v1.json'\n\n/** Version a check uses when the caller names none. */\nexport const CURRENT_MULTISHOT_GOLDEN_VERSION = 'v1'\n\n/** A fixture reaches this module as parsed JSON, which types cannot vouch for.\n * A record set that is not the shape the harness reads would surface as a\n * confusing mismatch on every scenario, so the shape is checked once at load\n * and named where it breaks. */\nfunction assertRecordSet(value: unknown, version: string): MultishotGoldenRecordSet {\n const fail = (reason: string): never => {\n throw new Error(`multishot golden ${version}: malformed record set — ${reason}`)\n }\n if (typeof value !== 'object' || value === null) fail('expected an object')\n const set = value as Record<string, unknown>\n for (const key of ['version', 'recordedFrom', 'recordedFromPackageVersion', 'recordedAt']) {\n if (typeof set[key] !== 'string') fail(`${key} must be a string`)\n }\n if (set.version !== version) fail(`declares version ${String(set.version)}`)\n if (!Array.isArray(set.scenarios) || set.scenarios.length === 0) {\n fail('scenarios must be a non-empty array')\n }\n if (!Array.isArray(set.matrixScenarios)) fail('matrixScenarios must be an array')\n for (const [index, entry] of (set.scenarios as unknown[]).entries()) {\n const row = entry as Record<string, unknown>\n if (typeof row?.id !== 'string') fail(`scenarios[${index}].id must be a string`)\n if (!Array.isArray(row.requests)) fail(`scenarios[${index}].requests must be an array`)\n const outcome = row.outcome as Record<string, unknown> | undefined\n if (outcome?.kind !== 'result' && outcome?.kind !== 'error') {\n fail(`scenarios[${index}].outcome.kind must be result or error`)\n }\n }\n for (const [index, entry] of (set.matrixScenarios as unknown[]).entries()) {\n const row = entry as Record<string, unknown>\n if (typeof row?.id !== 'string') fail(`matrixScenarios[${index}].id must be a string`)\n if (typeof row.files !== 'object' || row.files === null) {\n fail(`matrixScenarios[${index}].files must be an object`)\n }\n }\n return set as unknown as MultishotGoldenRecordSet\n}\n\n/** The set is handed to every caller, so a caller that mutated it would move\n * the oracle for the whole process. Freezing makes the documented immutability\n * a property of the value rather than a convention. */\nfunction deepFreeze<T>(value: T): T {\n if (value === null || typeof value !== 'object') return value\n for (const entry of Object.values(value as Record<string, unknown>)) deepFreeze(entry)\n return Object.freeze(value)\n}\n\nconst VERSIONS: Record<string, MultishotGoldenRecordSet> = {\n v1: deepFreeze(assertRecordSet(v1, 'v1')),\n}\n\nexport function multishotGoldenVersions(): string[] {\n return Object.keys(VERSIONS)\n}\n\nexport function goldenRecords(\n version: string = CURRENT_MULTISHOT_GOLDEN_VERSION,\n): MultishotGoldenRecordSet {\n const set = VERSIONS[version]\n if (!set) {\n throw new Error(\n `multishot golden: no record set for version \"${version}\" — known versions are ${multishotGoldenVersions().join(', ')}`,\n )\n }\n return set\n}\n","// Deterministic multishot scenarios.\n//\n// Every scenario is a closed system: scripted agent and driver transports,\n// scripted tool executors, a fixed persona and profile, fixed token budgets.\n// Nothing reads the clock for a recorded field, nothing calls a network, and\n// nothing draws a random number. Two runs of the same scenario on the same\n// engine produce byte-identical records; the recorder enforces that.\n//\n// The catalog is the union of the behaviours the merged loop-to-graph parity\n// proofs covered. Two scripts run through it:\n//\n// delegation-* a research/code delegation agent: silent multi-tool\n// turns, an unknown tool, typed artifacts of two kinds,\n// both cost paths, turn-count edges, driver rotation.\n// sampling-contract-* a tool-using agent with distinct per-leg token\n// budgets: retry-on-empty, whitespace-only driver\n// content, an empty assistant follow-up, full rotation.\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport type { RunMultishotOptions } from '../multishot'\nimport {\n MultishotFatalToolError,\n type MultishotPersona,\n type MultishotToolDefinition,\n type MultishotToolExecutor,\n type MultishotTransport,\n type MultishotTransportResponse,\n} from '../types'\nimport { recordRequest } from './recording'\nimport type { MultishotRecordedRequest } from './types'\n\n/** Options plus the ledger the scenario's transports fill while it runs. */\nexport interface MultishotGoldenCase {\n options: RunMultishotOptions<MultishotPersona>\n /** Every transport call, in issue order. Populated by running the case. */\n requests: MultishotRecordedRequest[]\n}\n\nexport interface MultishotGoldenScenario {\n readonly id: string\n readonly description: string\n /** Fresh options and a fresh ledger. Scripted transports carry per-run\n * state, so an engine run and a re-run must never share a case. */\n readonly build: () => MultishotGoldenCase\n}\n\nfunction ledgerTransport(\n ledger: MultishotRecordedRequest[],\n leg: 'agent' | 'driver',\n inner: MultishotTransport,\n): MultishotTransport {\n return async (req) => {\n ledger.push(recordRequest(leg, req))\n return inner(req)\n }\n}\n\n// ---------------------------------------------------------------------------\n// delegation script\n// ---------------------------------------------------------------------------\n\nconst delegationPersona: MultishotPersona = { id: 'test-owner', ask: 'a launch brief' }\n\nconst delegationProfile: AgentProfile = {\n name: 'multishot-golden-delegation',\n prompt: { systemPrompt: 'You are the operator agent under test.' },\n}\n\nconst delegationShape = {\n buildOpener: (p: MultishotPersona) => `I need ${String(p.ask)}. What do you need from me?`,\n buildDriverSystemPrompt: (p: MultishotPersona) => `You are ${p.id}. Demand ${String(p.ask)}.`,\n}\n\nconst delegationTools: MultishotToolDefinition[] = [\n {\n type: 'function',\n function: { name: 'delegate_research', description: 'research', parameters: {} },\n },\n { type: 'function', function: { name: 'delegate_code', description: 'code', parameters: {} } },\n]\n\nfunction delegationExecutors(): Record<string, MultishotToolExecutor> {\n return {\n delegate_research: async (args) => ({\n content: `RESEARCH: ${JSON.stringify(args)}`,\n costUsd: 0.011,\n }),\n delegate_code: async (args) => ({ content: `CODE: ${JSON.stringify(args)}`, costUsd: 0.023 }),\n }\n}\n\nconst delegationArtifactTypeFor = (name: string): string | undefined =>\n name === 'delegate_research' ? 'research' : name === 'delegate_code' ? 'code' : undefined\n\n/** Pure in the request. The turn index is the number of `user` messages; a\n * trailing `tool` message means the follow-up call after inline execution.\n * Turn 1 is a SILENT multi-tool turn (empty content, two calls, one of them\n * an unknown tool with unparseable arguments); turn 2 dispatches one tool\n * beside text; turn 3 and later answer with text only. */\nconst delegationAgent: MultishotTransport = async (req) => {\n const userCount = req.messages.filter((m) => m.role === 'user').length\n const last = req.messages[req.messages.length - 1] as { role?: string }\n const afterTools = last?.role === 'tool'\n if (userCount === 1 && !afterTools) {\n return {\n message: {\n content: '',\n tool_calls: [\n {\n id: 'tc-1',\n type: 'function',\n function: { name: 'delegate_research', arguments: '{\"topic\":\"market\"}' },\n },\n {\n id: 'tc-2',\n type: 'function',\n function: { name: 'mystery_tool', arguments: 'not json' },\n },\n ],\n },\n usage: { prompt_tokens: 100, completion_tokens: 20 },\n }\n }\n if (userCount === 1 && afterTools) {\n return {\n message: { content: 'Research done — here is the direction.' },\n usage: { prompt_tokens: 140, completion_tokens: 30 },\n costUsd: 0.005,\n }\n }\n if (userCount === 2 && !afterTools) {\n return {\n message: {\n content: 'Building it now.',\n tool_calls: [\n {\n id: 'tc-3',\n type: 'function',\n function: { name: 'delegate_code', arguments: '{\"spec\":\"landing page\"}' },\n },\n ],\n },\n usage: { prompt_tokens: 200, completion_tokens: 25 },\n costUsd: 0.004,\n }\n }\n if (userCount === 2 && afterTools) {\n return {\n message: { content: 'Shipped the artifact you asked for.' },\n usage: { prompt_tokens: 240, completion_tokens: 40 },\n costUsd: 0.006,\n }\n }\n return {\n message: { content: `Closing summary for turn ${userCount}.` },\n usage: { prompt_tokens: 260, completion_tokens: 15 },\n costUsd: 0.002,\n }\n}\n\n/** Pure in the request: the reply indexes on how many prior driver replies the\n * point-of-view-translated conversation already carries. */\nconst delegationDriver: MultishotTransport = async (req) => {\n const priorReplies = req.messages.filter((m) => m.role === 'assistant').length\n return {\n message: { content: `Driver follow-up #${priorReplies}: sharper, please.` },\n usage: { prompt_tokens: 80, completion_tokens: 18 },\n costUsd: 0.001,\n }\n}\n\ninterface DelegationOverrides {\n maxTurns?: number\n maxToolDispatches?: number\n driverFallbackModels?: string[]\n toolExecutors?: Record<string, MultishotToolExecutor>\n agent?: MultishotTransport\n driver?: MultishotTransport\n}\n\nfunction delegationCase(overrides: DelegationOverrides = {}): MultishotGoldenCase {\n const requests: MultishotRecordedRequest[] = []\n const options: RunMultishotOptions<MultishotPersona> = {\n profile: delegationProfile,\n persona: delegationPersona,\n shape: delegationShape,\n tools: delegationTools,\n toolExecutors: overrides.toolExecutors ?? delegationExecutors(),\n artifactTypeFor: delegationArtifactTypeFor,\n maxTurns: overrides.maxTurns ?? 3,\n agentModel: 'test/agent-model',\n driverModel: 'test/driver-model',\n agentTransport: ledgerTransport(requests, 'agent', overrides.agent ?? delegationAgent),\n driverTransport: ledgerTransport(requests, 'driver', overrides.driver ?? delegationDriver),\n }\n if (overrides.maxToolDispatches !== undefined) {\n options.maxToolDispatches = overrides.maxToolDispatches\n }\n if (overrides.driverFallbackModels !== undefined) {\n options.driverFallbackModels = overrides.driverFallbackModels\n }\n return { options, requests }\n}\n\n/** Silent on the primary model, substantive on any other — the rotation path. */\nconst delegationSilentPrimaryDriver: MultishotTransport = async (req) => {\n if (req.model === 'test/driver-model') {\n return { message: { content: '' }, usage: { prompt_tokens: 10, completion_tokens: 0 } }\n }\n const priorReplies = req.messages.filter((m) => m.role === 'assistant').length\n return {\n message: { content: `Fallback follow-up #${priorReplies}.` },\n usage: { prompt_tokens: 80, completion_tokens: 18 },\n costUsd: 0.003,\n }\n}\n\nconst delegationAlwaysSilentDriver: MultishotTransport = async () => ({\n message: { content: '' },\n usage: { prompt_tokens: 10, completion_tokens: 0 },\n})\n\n/** One tool call per assistant turn, forever — walks past any dispatch cap. */\nconst delegationToolStormAgent: MultishotTransport = async (req) => ({\n message: {\n content: '',\n tool_calls: [\n {\n id: `tc-${req.messages.length}`,\n type: 'function',\n function: { name: 'delegate_research', arguments: '{}' },\n },\n ],\n },\n usage: { prompt_tokens: 10, completion_tokens: 5 },\n})\n\n// ---------------------------------------------------------------------------\n// sampling-contract script\n// ---------------------------------------------------------------------------\n\nconst SAMPLING_AGENT_MAX_TOKENS = 111\nconst SAMPLING_FOLLOWUP_MAX_TOKENS = 222\nconst SAMPLING_DRIVER_MAX_TOKENS = 333\n\nconst samplingPersona: MultishotPersona = { id: 'parity-persona', name: 'Parity Persona' }\n\nconst samplingProfile: AgentProfile = {\n name: 'multishot-golden-sampling',\n prompt: { systemPrompt: 'You are the domain agent under test.' },\n}\n\nconst samplingShape = {\n buildOpener: () => 'I need help with my CA return.',\n buildDriverSystemPrompt: (p: MultishotPersona) => `You simulate taxpayer ${p.id}.`,\n}\n\nconst samplingTools: MultishotToolDefinition[] = [\n {\n type: 'function',\n function: {\n name: 'state_tax_search',\n description: 'search state tax rules',\n parameters: { type: 'object', properties: {} },\n },\n },\n {\n type: 'function',\n function: {\n name: 'list_source_documents',\n description: 'list docs',\n parameters: { type: 'object', properties: {} },\n },\n },\n]\n\nfunction samplingExecutors(): Record<string, MultishotToolExecutor> {\n return {\n state_tax_search: async (args) => ({\n content: JSON.stringify({ ok: true, echo: args }),\n costUsd: 0.01,\n }),\n list_source_documents: async () => ({ content: '', costUsd: 0 }),\n }\n}\n\n/** A transport that answers from a fixed list and fails loud past its end. An\n * engine that issues more calls than the script has steps is a divergence,\n * not a longer conversation. */\nfunction scriptedTransport(steps: MultishotTransportResponse[], label: string): MultishotTransport {\n let index = 0\n return async () => {\n const step = steps[index++]\n if (!step) throw new Error(`${label}: unscripted call ${index}`)\n return step\n }\n}\n\n/** Three agent turns: a silent multi-tool dispatch with one unparseable\n * argument payload, a priced follow-up, a text-plus-unknown-tool turn, an\n * EMPTY follow-up with no usage at all (the uncaptured cost path), and a\n * closing answer priced from usage alone. */\nfunction samplingAgentScript(): MultishotTransportResponse[] {\n return [\n {\n message: {\n content: '',\n tool_calls: [\n {\n id: 'tc-1',\n type: 'function',\n function: { name: 'state_tax_search', arguments: '{\"state\":\"CA\"}' },\n },\n {\n id: 'tc-2',\n type: 'function',\n function: { name: 'list_source_documents', arguments: 'not-json' },\n },\n ],\n },\n usage: { prompt_tokens: 100, completion_tokens: 20 },\n },\n {\n message: { content: 'Here is my CA analysis.' },\n usage: { prompt_tokens: 140, completion_tokens: 30 },\n costUsd: 0.002,\n },\n {\n message: {\n content: 'Checking one more source.',\n tool_calls: [\n { id: 'tc-3', type: 'function', function: { name: 'mystery_tool', arguments: '{}' } },\n ],\n },\n usage: { prompt_tokens: 200, completion_tokens: 15 },\n },\n { message: { content: '' } },\n {\n message: { content: 'Final answer: file CA 540.' },\n usage: { prompt_tokens: 260, completion_tokens: 40 },\n },\n ]\n}\n\n/** Two driver turns: retry-on-empty on the primary, then a whitespace-only\n * reply that must count as empty, then full rotation to the fallback. */\nfunction samplingDriverScript(): MultishotTransportResponse[] {\n return [\n { message: { content: '' } },\n {\n message: { content: 'Follow-up question A.' },\n usage: { prompt_tokens: 50, completion_tokens: 12 },\n },\n { message: { content: '' } },\n { message: { content: ' ' } },\n { message: { content: 'Follow-up question B.' }, costUsd: 0.0004 },\n ]\n}\n\ninterface SamplingOverrides {\n maxToolDispatches?: number\n toolExecutors?: Record<string, MultishotToolExecutor>\n agentScript?: MultishotTransportResponse[]\n driverScript?: MultishotTransportResponse[]\n}\n\nfunction samplingCase(overrides: SamplingOverrides = {}): MultishotGoldenCase {\n const requests: MultishotRecordedRequest[] = []\n const options: RunMultishotOptions<MultishotPersona> = {\n profile: samplingProfile,\n persona: samplingPersona,\n shape: samplingShape,\n tools: samplingTools,\n toolExecutors: overrides.toolExecutors ?? samplingExecutors(),\n artifactTypeFor: (toolName: string) =>\n toolName.startsWith('state_tax_') ? 'state-tax-tool' : undefined,\n maxTurns: 3,\n agentMaxTokens: SAMPLING_AGENT_MAX_TOKENS,\n toolFollowupMaxTokens: SAMPLING_FOLLOWUP_MAX_TOKENS,\n driverMaxTokens: SAMPLING_DRIVER_MAX_TOKENS,\n maxToolDispatches: overrides.maxToolDispatches ?? 4,\n agentModel: 'scripted/agent',\n driverModel: 'primary/driver',\n driverFallbackModels: ['fallback/driver'],\n agentTransport: ledgerTransport(\n requests,\n 'agent',\n scriptedTransport(overrides.agentScript ?? samplingAgentScript(), 'agent transport'),\n ),\n driverTransport: ledgerTransport(\n requests,\n 'driver',\n scriptedTransport(overrides.driverScript ?? samplingDriverScript(), 'driver transport'),\n ),\n }\n return { options, requests }\n}\n\n// ---------------------------------------------------------------------------\n// catalog\n// ---------------------------------------------------------------------------\n\n/** Every recorded shot scenario, in record order. */\nexport function multishotGoldenScenarios(): MultishotGoldenScenario[] {\n return [\n {\n id: 'delegation-three-turns',\n description:\n 'three turns with a silent multi-tool dispatch, an unknown tool, both typed artifact kinds, and both cost paths',\n build: () => delegationCase(),\n },\n {\n id: 'delegation-ten-turns',\n description: 'ten turns — the function default depth, past any short driver-turn budget',\n build: () => delegationCase({ maxTurns: 10 }),\n },\n {\n id: 'delegation-zero-turns',\n description: 'maxTurns 0 returns the opener-only result and spends nothing',\n build: () => delegationCase({ maxTurns: 0 }),\n },\n {\n id: 'delegation-nan-turns',\n description: 'a non-numeric maxTurns behaves as zero turns, not as the default',\n build: () => delegationCase({ maxTurns: Number('not-a-number') }),\n },\n {\n id: 'delegation-single-turn',\n description: 'maxTurns 1 never calls the driver leg',\n build: () => delegationCase({ maxTurns: 1 }),\n },\n {\n id: 'delegation-driver-rotation',\n description: 'a silent primary driver rotates to the fallback model after two attempts',\n build: () =>\n delegationCase({\n driver: delegationSilentPrimaryDriver,\n driverFallbackModels: ['test/driver-fallback'],\n }),\n },\n {\n id: 'delegation-fatal-tool-error',\n description:\n 'MultishotFatalToolError from an executor aborts the shot and declares its spend',\n build: () =>\n delegationCase({\n toolExecutors: {\n ...delegationExecutors(),\n delegate_research: async () => {\n throw new MultishotFatalToolError('research backend down')\n },\n },\n }),\n },\n {\n id: 'delegation-driver-empty',\n description: 'a driver silent on every model raises MultishotDriverEmptyError',\n build: () => delegationCase({ driver: delegationAlwaysSilentDriver }),\n },\n {\n id: 'delegation-dispatch-cap',\n description: 'a tool storm trips the dispatch cap with the exact cap message',\n build: () =>\n delegationCase({ agent: delegationToolStormAgent, maxToolDispatches: 2, maxTurns: 3 }),\n },\n {\n id: 'sampling-contract-three-turns',\n description:\n 'per-leg token budgets, driver retry-on-empty, a whitespace-only driver reply, an empty assistant follow-up with no usage, and full rotation',\n build: () => samplingCase(),\n },\n {\n id: 'sampling-contract-fatal-tool-error',\n description: 'MultishotFatalToolError propagates unchanged out of the first tool dispatch',\n build: () =>\n samplingCase({\n toolExecutors: {\n state_tax_search: async () => {\n throw new MultishotFatalToolError('citation budget exhausted')\n },\n list_source_documents: async () => ({ content: '', costUsd: 0 }),\n },\n }),\n },\n {\n id: 'sampling-contract-driver-empty-after-rotation',\n description:\n 'MultishotDriverEmptyError names the turn only after both attempts on both models',\n build: () =>\n samplingCase({\n driverScript: [\n { message: { content: '' } },\n { message: { content: '' } },\n { message: { content: '' } },\n { message: { content: '' } },\n ],\n }),\n },\n {\n id: 'sampling-contract-dispatch-cap',\n description: 'three calls against a cap of two fail loud on turn 0',\n build: () =>\n samplingCase({\n maxToolDispatches: 2,\n agentScript: [\n {\n message: {\n content: '',\n tool_calls: [1, 2, 3].map((n) => ({\n id: `tc-${n}`,\n type: 'function' as const,\n function: { name: 'state_tax_search', arguments: '{}' },\n })),\n },\n },\n ],\n driverScript: [],\n }),\n },\n ]\n}\n","// The check a conversation engine runs against the golden records.\n//\n// The harness owns the whole comparison: it builds the scenario, runs the\n// engine, normalizes what came back exactly as the recorder did, and reports\n// every field that moved. It asserts through a thrown error rather than a test\n// framework, so a consumer on vitest, node:test, or a plain script all use the\n// same call.\n\nimport type { RunMultishotMatrixResult } from '../matrix'\nimport { compareJson } from './compare'\nimport type { MultishotGoldenEngine, MultishotMatrixGoldenEngine } from './engine'\nimport {\n type MultishotMatrixGoldenScenario,\n multishotMatrixGoldenScenarios,\n} from './matrix-scenarios'\nimport {\n readRunDir,\n recordError,\n recordResult,\n sortJudgeRequests,\n stripVolatile,\n} from './recording'\nimport { goldenRecords } from './records'\nimport { type MultishotGoldenScenario, multishotGoldenScenarios } from './scenarios'\nimport type {\n MultishotGoldenRecord,\n MultishotGoldenRecordSet,\n MultishotMatrixGoldenRecord,\n} from './types'\n\nexport interface MultishotGoldenScenarioReport {\n id: string\n description: string\n ok: boolean\n mismatches: string[]\n}\n\nexport interface MultishotGoldenReport {\n version: string\n recordedFrom: string\n ok: boolean\n scenarios: MultishotGoldenScenarioReport[]\n}\n\nexport class MultishotGoldenMismatchError extends Error {\n constructor(\n readonly scenarioId: string,\n readonly mismatches: string[],\n readonly version: string,\n ) {\n super(\n [\n `multishot golden ${version} — scenario \"${scenarioId}\" diverged from the record:`,\n ...mismatches.map((line) => ` - ${line}`),\n ].join('\\n'),\n )\n this.name = 'MultishotGoldenMismatchError'\n }\n}\n\nfunction requireRecord(records: MultishotGoldenRecordSet, id: string): MultishotGoldenRecord {\n const record = records.scenarios.find((entry) => entry.id === id)\n if (!record) {\n throw new Error(\n `multishot golden ${records.version} holds no record for scenario \"${id}\" — regenerate the fixture for the new scenario`,\n )\n }\n return record\n}\n\nfunction requireMatrixRecord(\n records: MultishotGoldenRecordSet,\n id: string,\n): MultishotMatrixGoldenRecord {\n const record = records.matrixScenarios.find((entry) => entry.id === id)\n if (!record) {\n throw new Error(\n `multishot golden ${records.version} holds no matrix record for scenario \"${id}\" — regenerate the fixture for the new scenario`,\n )\n }\n return record\n}\n\n/** Run one scenario and report every field that diverged from the record. */\nexport async function checkMultishotGoldenScenario(opts: {\n engine: MultishotGoldenEngine\n scenario: MultishotGoldenScenario\n records?: MultishotGoldenRecordSet\n}): Promise<MultishotGoldenScenarioReport> {\n const records = opts.records ?? goldenRecords()\n const record = requireRecord(records, opts.scenario.id)\n const runCase = opts.scenario.build()\n\n let observed: MultishotGoldenRecord['outcome']\n const mismatches: string[] = []\n try {\n const result = await opts.engine(runCase.options)\n observed = { kind: 'result', result: recordResult(result) }\n // durationMs is wall clock and is excluded from the record, but it is still\n // part of the contract: a result must report a usable duration. It joins the\n // other mismatches rather than replacing them, so one bad field cannot hide\n // the rest of a divergent run.\n if (!isUsableDuration(result.durationMs)) {\n mismatches.push(\n `durationMs: expected a finite number >= 0, received ${String(result.durationMs)}`,\n )\n }\n } catch (err) {\n observed = { kind: 'error', error: recordError(err) }\n }\n\n mismatches.push(\n ...compareJson(record.outcome, observed, 'outcome'),\n ...compareJson(record.requests, runCase.requests, 'requests'),\n )\n return {\n id: opts.scenario.id,\n description: opts.scenario.description,\n ok: mismatches.length === 0,\n mismatches,\n }\n}\n\n/** Same as `checkMultishotGoldenScenario`, but throws on divergence. */\nexport async function assertMultishotGoldenScenario(opts: {\n engine: MultishotGoldenEngine\n scenario: MultishotGoldenScenario\n records?: MultishotGoldenRecordSet\n}): Promise<void> {\n const records = opts.records ?? goldenRecords()\n const report = await checkMultishotGoldenScenario({ ...opts, records })\n if (!report.ok) {\n throw new MultishotGoldenMismatchError(report.id, report.mismatches, records.version)\n }\n}\n\n/** Run every shot scenario. Never throws on divergence — read `ok`. */\nexport async function checkMultishotGolden(opts: {\n engine: MultishotGoldenEngine\n records?: MultishotGoldenRecordSet\n only?: string[]\n}): Promise<MultishotGoldenReport> {\n const records = opts.records ?? goldenRecords()\n const catalog = multishotGoldenScenarios()\n const wanted = opts.only ? new Set(opts.only) : undefined\n if (wanted) {\n // An id that names no scenario would silently shrink the run, and a run of\n // zero scenarios reports ok. A stale id after a rename must stop the check,\n // not green it.\n const unknown = [...wanted].filter((id) => !catalog.some((s) => s.id === id)).sort()\n if (unknown.length > 0) {\n throw new Error(\n `multishot golden: \\`only\\` names ${unknown.length === 1 ? 'a scenario' : 'scenarios'} the catalog does not hold: ${unknown.join(', ')}`,\n )\n }\n }\n const scenarios = catalog.filter((s) => !wanted || wanted.has(s.id))\n const reports: MultishotGoldenScenarioReport[] = []\n for (const scenario of scenarios) {\n reports.push(await checkMultishotGoldenScenario({ engine: opts.engine, scenario, records }))\n }\n return {\n version: records.version,\n recordedFrom: records.recordedFrom,\n ok: reports.every((report) => report.ok),\n scenarios: reports,\n }\n}\n\n/** Run one matrix scenario against `runDir` and report every divergence. */\nexport async function checkMultishotMatrixGoldenScenario(opts: {\n engine: MultishotMatrixGoldenEngine\n scenario: MultishotMatrixGoldenScenario\n /** An empty directory the engine may write its per-cell files into. */\n runDir: string\n records?: MultishotGoldenRecordSet\n}): Promise<MultishotGoldenScenarioReport> {\n const records = opts.records ?? goldenRecords()\n const record = requireMatrixRecord(records, opts.scenario.id)\n const runCase = opts.scenario.build(opts.runDir)\n const matrix: RunMultishotMatrixResult = await opts.engine(runCase.options)\n\n const mismatches = [\n ...compareJson(record.matrix, stripVolatile(matrix.matrix), 'matrix'),\n ...compareJson(record.requests, runCase.requests, 'requests'),\n ...compareJson(record.judgeRequests, sortJudgeRequests(runCase.judgeRequests), 'judgeRequests'),\n ...compareJson(record.files, readRunDir(opts.runDir), 'files'),\n ]\n return {\n id: opts.scenario.id,\n description: opts.scenario.description,\n ok: mismatches.length === 0,\n mismatches,\n }\n}\n\nexport async function assertMultishotMatrixGoldenScenario(opts: {\n engine: MultishotMatrixGoldenEngine\n scenario: MultishotMatrixGoldenScenario\n runDir: string\n records?: MultishotGoldenRecordSet\n}): Promise<void> {\n const records = opts.records ?? goldenRecords()\n const report = await checkMultishotMatrixGoldenScenario({ ...opts, records })\n if (!report.ok) {\n throw new MultishotGoldenMismatchError(report.id, report.mismatches, records.version)\n }\n}\n\n/** A duration a caller can read: finite and not negative. */\nexport function isUsableDuration(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0\n}\n\nexport { multishotGoldenScenarios, multishotMatrixGoldenScenarios }\n"],"mappings":";;;;;AAMA,MAAM,aAAa;AAQnB,SAAgB,YACd,UACA,QACA,MACA,UAA0B,CAAC,GACjB;CACV,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,aAAuB,CAAC;CAC9B,KAAK,UAAU,QAAQ,MAAM,YAAY,KAAK;CAG9C,OAAO,WAAW,MAAM,GAAG,KAAK;AAClC;AAEA,SAAS,KACP,UACA,QACA,MACA,KACA,OACM;CACN,IAAI,IAAI,UAAU,OAAO;CAEzB,IAAI,MAAM,QAAQ,QAAQ,KAAK,MAAM,QAAQ,MAAM,GAAG;EACpD,IAAI,CAAC,MAAM,QAAQ,QAAQ,KAAK,CAAC,MAAM,QAAQ,MAAM,GAAG;GACtD,IAAI,KAAK,SAAS,MAAM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O;CAC/D;CACA,OAAO;EACL,IAAI,KAAK,SAAS;EAClB,aAAa,KAAK,SAAS;EAC3B,IAAI,WAAW,WAAW;EAC1B;CACF;AACF;AAEA,eAAsB,oCAAoC,MAKxC;CAChB,MAAM,UAAU,KAAK,WAAW,cAAc;CAC9C,MAAM,SAAS,MAAM,mCAAmC;EAAE,GAAG;EAAM;CAAQ,CAAC;CAC5E,IAAI,CAAC,OAAO,IACV,MAAM,IAAI,6BAA6B,OAAO,IAAI,OAAO,YAAY,QAAQ,OAAO;AAExF;;AAGA,SAAgB,iBAAiB,OAAiC;CAChE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS;AACzE"}
|
|
@@ -1,50 +1,19 @@
|
|
|
1
|
-
import { w as JudgeScore } from "../types-
|
|
2
|
-
import { A as
|
|
1
|
+
import { w as JudgeScore } from "../types-D4s7Z6nq.js";
|
|
2
|
+
import { A as MultishotToolExecutor, C as MultishotFatalToolError, D as MultishotShape, E as MultishotResult, F as assertMultishotShotResult, M as MultishotTransportRequest, N as MultishotTransportResponse, O as MultishotShotResultError, P as MultishotTransportToolCall, S as MultishotDriverEmptyError, T as MultishotPersona, _ as JudgeRunResult, a as MultishotCellOutput, b as runJudge, c as RunMultishotMatrixResult, d as MultishotShot, f as RunMultishotOptions, g as JudgeDimension, h as JudgeConfig, i as ConversationJudgeInput, j as MultishotTransport, k as MultishotToolDefinition, l as computeCellComposite, m as DEFAULT_JUDGE_MODEL, n as CellCompositeInput, o as MultishotJudges, p as runMultishot, r as CellCompositeScore, s as RunMultishotMatrixOptions, t as ArtifactJudgeInput, u as runMultishotMatrix, v as renderDimensions, w as MultishotMessage, x as MultishotArtifact, y as renderJsonFooter } from "../matrix-eXKRMHnL.js";
|
|
3
3
|
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
4
|
-
//#region src/multishot/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
maxTokens?: number;
|
|
13
|
-
signal?: AbortSignal;
|
|
14
|
-
}
|
|
15
|
-
interface RouterToolCall {
|
|
16
|
-
id: string;
|
|
17
|
-
type: 'function';
|
|
18
|
-
function: {
|
|
19
|
-
name: string;
|
|
20
|
-
arguments: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
interface RouterCompletionResponse {
|
|
24
|
-
message: {
|
|
25
|
-
content?: string | null;
|
|
26
|
-
tool_calls?: RouterToolCall[];
|
|
27
|
-
};
|
|
28
|
-
usage?: {
|
|
29
|
-
prompt_tokens?: number;
|
|
30
|
-
completion_tokens?: number;
|
|
31
|
-
};
|
|
32
|
-
/** Provider-reported spend when the endpoint supplies it. */
|
|
33
|
-
costUsd?: number;
|
|
34
|
-
/** Model echoed by the provider, falling back to the requested model. */
|
|
35
|
-
model: string;
|
|
36
|
-
durationMs: number;
|
|
37
|
-
}
|
|
38
|
-
declare function routerCompletion(req: RouterCompletionRequest): Promise<RouterCompletionResponse>;
|
|
39
|
-
declare function estimateRouterCost(model: string, usage?: {
|
|
4
|
+
//#region src/multishot/cost.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Rough per-model cost estimate from token counts. Underestimates Anthropic,
|
|
7
|
+
* overestimates open-weight models — accurate enough for a cost ceiling, and
|
|
8
|
+
* never presented as a billed amount: a leg metered from this table is
|
|
9
|
+
* recorded with `estimated` provenance.
|
|
10
|
+
*/
|
|
11
|
+
declare function estimateMultishotCost(model: string, usage?: {
|
|
40
12
|
prompt_tokens?: number;
|
|
41
13
|
completion_tokens?: number;
|
|
42
14
|
}): number;
|
|
43
|
-
declare function defaultRouterBaseUrl(): string;
|
|
44
|
-
declare function requireRouterApiKey(): string;
|
|
45
15
|
//#endregion
|
|
46
16
|
//#region src/multishot/default-tools.d.ts
|
|
47
|
-
declare const DEFAULT_RESEARCHER_MODEL = "openai/gpt-4o-mini";
|
|
48
17
|
declare const DEFAULT_CODER_MODEL = "openai/gpt-4o-mini";
|
|
49
18
|
interface DefaultResearcherConfig {
|
|
50
19
|
/** Replace the system prompt to bias the researcher toward a domain's
|
|
@@ -58,10 +27,6 @@ interface DefaultCoderConfig {
|
|
|
58
27
|
systemPrompt?: string;
|
|
59
28
|
model?: string;
|
|
60
29
|
}
|
|
61
|
-
declare const DEFAULT_DELEGATE_RESEARCH_TOOL: MultishotToolDefinition;
|
|
62
|
-
declare const DEFAULT_DELEGATE_CODE_TOOL: MultishotToolDefinition;
|
|
63
|
-
declare function createResearchExecutor(config?: DefaultResearcherConfig): MultishotToolExecutor;
|
|
64
|
-
declare function createCodeExecutor(config?: DefaultCoderConfig): MultishotToolExecutor;
|
|
65
30
|
interface DefaultToolsConfig {
|
|
66
31
|
research?: DefaultResearcherConfig;
|
|
67
32
|
code?: DefaultCoderConfig;
|
|
@@ -90,5 +55,5 @@ declare function defaultMultishotDriverSystemPrompt(profile: AgentProfile, perso
|
|
|
90
55
|
* profile-derived defaults fill the rest. */
|
|
91
56
|
declare function defaultShapeFromProfile<TPersona extends MultishotPersona>(profile: AgentProfile, shape?: MultishotShape<TPersona>): Required<MultishotShape<TPersona>>;
|
|
92
57
|
//#endregion
|
|
93
|
-
export { type ArtifactJudgeInput, type CellCompositeInput, type CellCompositeScore, type ConversationJudgeInput, DEFAULT_CODER_MODEL,
|
|
58
|
+
export { type ArtifactJudgeInput, type CellCompositeInput, type CellCompositeScore, type ConversationJudgeInput, DEFAULT_CODER_MODEL, DEFAULT_JUDGE_MODEL, type DefaultCoderConfig, type DefaultResearcherConfig, type DefaultToolsBundle, type DefaultToolsConfig, type JudgeConfig, type JudgeDimension, type JudgeRunResult, type JudgeScore, type MultishotArtifact, type MultishotCellOutput, MultishotDriverEmptyError, MultishotFatalToolError, type MultishotJudges, type MultishotMessage, type MultishotPersona, type MultishotResult, type MultishotShape, type MultishotShot, MultishotShotResultError, type MultishotToolDefinition, type MultishotToolExecutor, type MultishotTransport, type MultishotTransportRequest, type MultishotTransportResponse, type MultishotTransportToolCall, type RunMultishotMatrixOptions, type RunMultishotMatrixResult, type RunMultishotOptions, assertMultishotShotResult, computeCellComposite, defaultDelegationTools, defaultMultishotDriverSystemPrompt, defaultMultishotOpener, defaultShapeFromProfile, estimateMultishotCost, renderDimensions, renderJsonFooter, renderPersonaFacts, runJudge, runMultishot, runMultishotMatrix };
|
|
94
59
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/multishot/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/multishot/cost.ts","../../src/multishot/default-tools.ts","../../src/multishot/shape-defaults.ts"],"mappings":";;;;;;;;;;iBASgB,sBACd,eACA;EAAU;EAAwB;;;;cCAvB;UAEI;;;EAGf;EACA;;UAGe;;;EAGf;EACA;;UA+Fe;EACf,WAAW;EACX,OAAO;;;EAGP;;UAGe;EACf,OAAO;EACP,WAAW,eAAe;EAC1B,kBAAkB;;iBAGJ,uBAAuB,SAAQ,qBAA0B;;;;;iBCvHzD,mBAAmB,SAAS;;;iBAe5B,uBAAuB,SAAS,cAAc,SAAS;;;iBAavD,mCACd,SAAS,cACT,SAAS;;;iBAqBK,wBAAwB,iBAAiB,kBACvD,SAAS,cACT,QAAQ,eAAe,YACtB,SAAS,eAAe"}
|