@tangle-network/agent-eval 0.208.2 → 0.210.0
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 +26 -0
- package/README.md +1 -1
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-CEhxR_I3.d.ts → agent-profile-BGyt2z8U.d.ts} +3 -3
- package/dist/{agent-profile-CEhxR_I3.d.ts.map → agent-profile-BGyt2z8U.d.ts.map} +1 -1
- package/dist/{agent-profile-cell-BHcB-mZX.d.ts → agent-profile-cell-BNp-Js9F.d.ts} +2 -3
- package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +1 -0
- package/dist/{agent-profile-cell-DcFW4vOc.js → agent-profile-cell-BYc0bxsL.js} +2 -2
- package/dist/agent-profile-cell-BYc0bxsL.js.map +1 -0
- package/dist/analyst/index.d.ts +12 -12
- package/dist/analyst/index.js +5 -5
- package/dist/{analyze-runs-GZ0VSwui.js → analyze-runs-3xpby3p2.js} +6 -6
- package/dist/analyze-runs-3xpby3p2.js.map +1 -0
- package/dist/{analyze-runs-CTJyUplR.d.ts → analyze-runs-BlslTkOJ.d.ts} +4 -4
- package/dist/{analyze-runs-CTJyUplR.d.ts.map → analyze-runs-BlslTkOJ.d.ts.map} +1 -1
- package/dist/{benchmark-command-BC265T1r.js → benchmark-command-S8tCtkxh.js} +6 -6
- package/dist/{benchmark-command-BC265T1r.js.map → benchmark-command-S8tCtkxh.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +5 -7
- package/dist/benchmarks/index.d.ts.map +1 -1
- package/dist/benchmarks/index.js +3 -3
- package/dist/builder-eval/index.js +1 -1
- package/dist/campaign/index.d.ts +6 -6
- package/dist/campaign/index.js +10 -10
- package/dist/{campaign-evidence-DW3Krxov.js → campaign-evidence-OcUciD-N.js} +4 -4
- package/dist/campaign-evidence-OcUciD-N.js.map +1 -0
- package/dist/{campaign-C5pjR-Qn.js → campaign-wvvJA1ps.js} +14 -14
- package/dist/{campaign-C5pjR-Qn.js.map → campaign-wvvJA1ps.js.map} +1 -1
- package/dist/claude-jsonl-dZir12m6.js +86 -0
- package/dist/claude-jsonl-dZir12m6.js.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/contract/index.d.ts +10 -10
- package/dist/contract/index.js +92 -16
- package/dist/contract/index.js.map +1 -1
- package/dist/counterfactual-DtMWvn7D.js.map +1 -1
- package/dist/{default-registry-DZFWY2_E.d.ts → default-registry-Crk3QEy1.d.ts} +6 -6
- package/dist/{default-registry-DZFWY2_E.d.ts.map → default-registry-Crk3QEy1.d.ts.map} +1 -1
- package/dist/{default-registry-DX5R7_n9.js → default-registry-DF4Yp7HQ.js} +2 -2
- package/dist/{default-registry-DX5R7_n9.js.map → default-registry-DF4Yp7HQ.js.map} +1 -1
- package/dist/{define-agent-eval-C8zBSbsc.d.ts → define-agent-eval-B_zZY2AZ.d.ts} +7 -7
- package/dist/{define-agent-eval-C8zBSbsc.d.ts.map → define-agent-eval-B_zZY2AZ.d.ts.map} +1 -1
- package/dist/{define-agent-eval-BjKXcDQp.js → define-agent-eval-CoXXDCMu.js} +7 -7
- package/dist/{define-agent-eval-BjKXcDQp.js.map → define-agent-eval-CoXXDCMu.js.map} +1 -1
- package/dist/diagnosis/index.d.ts +2 -5
- package/dist/diagnosis/index.d.ts.map +1 -1
- package/dist/diagnosis/index.js +2 -26
- package/dist/diagnosis/index.js.map +1 -1
- package/dist/{dspy-rlm-engine-sHwdSxK3.js → dspy-rlm-engine-BpaKVKJA.js} +2 -2
- package/dist/{dspy-rlm-engine-sHwdSxK3.js.map → dspy-rlm-engine-BpaKVKJA.js.map} +1 -1
- package/dist/{engine-DProXJ7A.d.ts → engine-D-YZ32ZJ.d.ts} +5 -12
- package/dist/engine-D-YZ32ZJ.d.ts.map +1 -0
- package/dist/{eval-campaign-DU_p8qVt.js → eval-campaign-4byTtqrf.js} +4 -4
- package/dist/{eval-campaign-DU_p8qVt.js.map → eval-campaign-4byTtqrf.js.map} +1 -1
- package/dist/evaluation.d.ts +2 -2
- package/dist/{exact-types-Cq6xXNVR.d.ts → exact-types-DjhfZglz.d.ts} +2 -2
- package/dist/{exact-types-Cq6xXNVR.d.ts.map → exact-types-DjhfZglz.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +2 -2
- package/dist/experiment/index.js +8 -8
- package/dist/{feedback-trajectory-C6Z8PRoF.d.ts → feedback-trajectory-CX01700m.d.ts} +3 -3
- package/dist/{feedback-trajectory-C6Z8PRoF.d.ts.map → feedback-trajectory-CX01700m.d.ts.map} +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/{index-CbBfavbT.d.ts → index-D0_l25We.d.ts} +21 -42
- package/dist/{index-CbBfavbT.d.ts.map → index-D0_l25We.d.ts.map} +1 -1
- package/dist/{index-nwNoS582.d.ts → index-DnZdBxCL.d.ts} +14 -11
- package/dist/{index-nwNoS582.d.ts.map → index-DnZdBxCL.d.ts.map} +1 -1
- package/dist/{index-DkucR0KJ.d.ts → index-UxNTvn-w.d.ts} +6 -6
- package/dist/{index-DkucR0KJ.d.ts.map → index-UxNTvn-w.d.ts.map} +1 -1
- package/dist/{index-Bzto04CY.d.ts → index-xnhRdqik.d.ts} +9 -20
- package/dist/{index-Bzto04CY.d.ts.map → index-xnhRdqik.d.ts.map} +1 -1
- package/dist/index.d.ts +28 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -90
- package/dist/index.js.map +1 -1
- package/dist/judge-gate-C59znGmR.js +638 -0
- package/dist/judge-gate-C59znGmR.js.map +1 -0
- package/dist/judge-gate-D2hCppem.d.ts +439 -0
- package/dist/judge-gate-D2hCppem.d.ts.map +1 -0
- package/dist/{kind-factory-Cn1lbsAd.js → kind-factory-ivTx6koH.js} +2 -11
- package/dist/{kind-factory-Cn1lbsAd.js.map → kind-factory-ivTx6koH.js.map} +1 -1
- package/dist/{llm-judge-HLWASwUJ.js → llm-judge-Tr7MBUnf.js} +9 -9
- package/dist/llm-judge-Tr7MBUnf.js.map +1 -0
- package/dist/{matrix-Cqkk7eYI.d.ts → matrix-jHTsHEkR.d.ts} +2 -2
- package/dist/{matrix-Cqkk7eYI.d.ts.map → matrix-jHTsHEkR.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +3 -133
- package/dist/meta-eval/index.d.ts.map +1 -1
- package/dist/meta-eval/index.js +3 -276
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/{mint-C1W8w5wo.d.ts → mint-CDy-brUR.d.ts} +2 -2
- package/dist/{mint-C1W8w5wo.d.ts.map → mint-CDy-brUR.d.ts.map} +1 -1
- package/dist/{mint-CWG-s2mI.js → mint-Csor1BLJ.js} +2 -2
- package/dist/{mint-CWG-s2mI.js.map → mint-Csor1BLJ.js.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{paired-arms-CgWT7sHy.js → paired-arms-DzKn0TfY.js} +3 -5
- package/dist/{paired-arms-CgWT7sHy.js.map → paired-arms-DzKn0TfY.js.map} +1 -1
- package/dist/{paired-binary-b2L3WKqr.js → paired-binary-Q36bhn2R.js} +13 -9
- package/dist/paired-binary-Q36bhn2R.js.map +1 -0
- package/dist/{paired-promotion-decision-2deJ7sDX.js → paired-promotion-decision-BN6IQTiu.js} +2 -2
- package/dist/{paired-promotion-decision-2deJ7sDX.js.map → paired-promotion-decision-BN6IQTiu.js.map} +1 -1
- package/dist/pipelines/index.d.ts +1 -1
- package/dist/pipelines/index.js +2 -2
- package/dist/{prime-protocol-Csr9kcOM.d.ts → prime-protocol-B7et3tI7.d.ts} +2 -2
- package/dist/{prime-protocol-Csr9kcOM.d.ts.map → prime-protocol-B7et3tI7.d.ts.map} +1 -1
- package/dist/{produced-state-Bzlh09oj.js → produced-state-CKybuR9F.js} +3 -3
- package/dist/produced-state-CKybuR9F.js.map +1 -0
- package/dist/profile-cell.d.ts +2 -2
- package/dist/profile-cell.js +2 -2
- package/dist/{promotion-policy-CCmyEH_c.js → promotion-policy-CWW35UWq.js} +3 -3
- package/dist/{promotion-policy-CCmyEH_c.js.map → promotion-policy-CWW35UWq.js.map} +1 -1
- package/dist/{query-DlV0pdx4.js → query-B1D1qp2Z.js} +2 -2
- package/dist/{query-DlV0pdx4.js.map → query-B1D1qp2Z.js.map} +1 -1
- package/dist/{query-DBUQhehH.d.ts → query-DK1nWcmp.d.ts} +2 -3
- package/dist/{query-DBUQhehH.d.ts.map → query-DK1nWcmp.d.ts.map} +1 -1
- package/dist/{registry-DMkmhBQ5.d.ts → registry-BL7H33tj.d.ts} +3 -3
- package/dist/{registry-DMkmhBQ5.d.ts.map → registry-BL7H33tj.d.ts.map} +1 -1
- package/dist/{release-confidence-CkoXFx9I.d.ts → release-confidence-C4kI7lQi.d.ts} +4 -12
- package/dist/release-confidence-C4kI7lQi.d.ts.map +1 -0
- package/dist/{release-confidence-CiFg1EPq.js → release-confidence-Dbe9AS_X.js} +2 -2
- package/dist/{release-confidence-CiFg1EPq.js.map → release-confidence-Dbe9AS_X.js.map} +1 -1
- package/dist/{report-command-pXtxg5YK.js → report-command-CtIIsQKP.js} +3 -28
- package/dist/{report-command-pXtxg5YK.js.map → report-command-CtIIsQKP.js.map} +1 -1
- package/dist/reporting.d.ts +3 -3
- package/dist/reporting.js +3 -3
- package/dist/{researcher-CZFZjj-u.d.ts → researcher-DuIJ9IaA.d.ts} +4 -4
- package/dist/{researcher-CZFZjj-u.d.ts.map → researcher-DuIJ9IaA.d.ts.map} +1 -1
- package/dist/{reward-hacking-Cyk-QHk9.d.ts → reward-hacking-C6Kp54Av.d.ts} +2 -2
- package/dist/{reward-hacking-Cyk-QHk9.d.ts.map → reward-hacking-C6Kp54Av.d.ts.map} +1 -1
- package/dist/reward-nw2xZGZG.js.map +1 -1
- package/dist/rl.d.ts +10 -29
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +7 -7
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +3 -3
- package/dist/rollout/index.js +4 -4
- package/dist/{rollout-l9w3Gdvh.js → rollout-D9bKKBnZ.js} +30 -165
- package/dist/rollout-D9bKKBnZ.js.map +1 -0
- package/dist/{rubric-predictive-validity-DIUwJJ9Y.d.ts → rubric-predictive-validity-BiNNEjpG.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-DIUwJJ9Y.d.ts.map → rubric-predictive-validity-BiNNEjpG.d.ts.map} +1 -1
- package/dist/{run-record-BRlM99rX.js → run-record-DlTZ_lqe.js} +3 -13
- package/dist/run-record-DlTZ_lqe.js.map +1 -0
- package/dist/{run-record-BB290Y9A.js → run-record-ES07wfz9.js} +2 -2
- package/dist/{run-record-BB290Y9A.js.map → run-record-ES07wfz9.js.map} +1 -1
- package/dist/{run-record-DF-fuu31.d.ts → run-record-p2AYTrCn.d.ts} +3 -7
- package/dist/run-record-p2AYTrCn.d.ts.map +1 -0
- package/dist/search/index.d.ts +2 -24
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +3 -3
- package/dist/{search-kernel-CIie6xig.js → search-kernel-BIXWM7YV.js} +4 -4
- package/dist/search-kernel-BIXWM7YV.js.map +1 -0
- package/dist/{search-kernel-uKdPVRAe.d.ts → search-kernel-ah2GESe3.d.ts} +3 -3
- package/dist/{search-kernel-uKdPVRAe.d.ts.map → search-kernel-ah2GESe3.d.ts.map} +1 -1
- package/dist/{search-ledger-CXQPwdWz.js → search-ledger-aMTNQn_m.js} +2 -2
- package/dist/{search-ledger-CXQPwdWz.js.map → search-ledger-aMTNQn_m.js.map} +1 -1
- package/dist/{search-shipper-DhhofkDX.js → search-shipper-DKXWuLnp.js} +2 -2
- package/dist/{search-shipper-DhhofkDX.js.map → search-shipper-DKXWuLnp.js.map} +1 -1
- package/dist/{search-summary-BV5uehLd.js → search-summary-nwrtXxC_.js} +3 -3
- package/dist/{search-summary-BV5uehLd.js.map → search-summary-nwrtXxC_.js.map} +1 -1
- package/dist/{semantic-concept-judge-D1wH-YKc.js → semantic-concept-judge-BQxZyXdN.js} +3 -3
- package/dist/{semantic-concept-judge-D1wH-YKc.js.map → semantic-concept-judge-BQxZyXdN.js.map} +1 -1
- package/dist/{sequential-DMqr3sni.js → sequential-D-1PPCmM.js} +3 -3
- package/dist/{sequential-DMqr3sni.js.map → sequential-D-1PPCmM.js.map} +1 -1
- package/dist/{skillopt-optimization-method-Dcnh5Pvr.js → skillopt-optimization-method-DujPOiwD.js} +5 -5
- package/dist/{skillopt-optimization-method-Dcnh5Pvr.js.map → skillopt-optimization-method-DujPOiwD.js.map} +1 -1
- package/dist/{statistical-heldout-BP6iEJvR.js → statistical-heldout-1Gbmex7v.js} +2 -2
- package/dist/{statistical-heldout-BP6iEJvR.js.map → statistical-heldout-1Gbmex7v.js.map} +1 -1
- package/dist/{statistical-heldout-DFKtp-Qm.d.ts → statistical-heldout-8RGPIeyo.d.ts} +17 -14
- package/dist/statistical-heldout-8RGPIeyo.d.ts.map +1 -0
- package/dist/{store-otlp-BA7G1Du-.js → store-otlp-__ebQ6Hn.js} +2 -2
- package/dist/{store-otlp-BA7G1Du-.js.map → store-otlp-__ebQ6Hn.js.map} +1 -1
- package/dist/{store-tool-spans-DKoVbE-w.js → store-tool-spans-TbRBuIM7.js} +3 -3
- package/dist/{store-tool-spans-DKoVbE-w.js.map → store-tool-spans-TbRBuIM7.js.map} +1 -1
- package/dist/{store-tool-spans-9YJNMP-z.d.ts → store-tool-spans-wQ9idsnn.d.ts} +5 -5
- package/dist/{store-tool-spans-9YJNMP-z.d.ts.map → store-tool-spans-wQ9idsnn.d.ts.map} +1 -1
- package/dist/{summary-report-DvvesgR_.d.ts → summary-report-CK0ueoJd.d.ts} +2 -2
- package/dist/{summary-report-DvvesgR_.d.ts.map → summary-report-CK0ueoJd.d.ts.map} +1 -1
- package/dist/{summary-report-fXurE2TR.js → summary-report-DtdRucM0.js} +3 -3
- package/dist/{summary-report-fXurE2TR.js.map → summary-report-DtdRucM0.js.map} +1 -1
- package/dist/supervisor-run/index.d.ts +0 -8
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +36 -71
- package/dist/supervisor-run/index.js.map +1 -1
- package/dist/{systemone-review-Bt4JcxMc.d.ts → systemone-review-BReh3mvm.d.ts} +2 -2
- package/dist/{systemone-review-Bt4JcxMc.d.ts.map → systemone-review-BReh3mvm.d.ts.map} +1 -1
- package/dist/systemone.d.ts +3 -3
- package/dist/{tool-groups-j19pmOfP.d.ts → tool-groups-v28A-ZAF.d.ts} +3 -3
- package/dist/tool-groups-v28A-ZAF.d.ts.map +1 -0
- package/dist/{tool-waste-x_E8h9Ih.js → tool-waste-BYt5rdt8.js} +2 -2
- package/dist/{tool-waste-x_E8h9Ih.js.map → tool-waste-BYt5rdt8.js.map} +1 -1
- package/dist/{tool-waste-DxlebQkx.d.ts → tool-waste-Wi4g6Ekb.d.ts} +2 -2
- package/dist/{tool-waste-DxlebQkx.d.ts.map → tool-waste-Wi4g6Ekb.d.ts.map} +1 -1
- package/dist/{trace-questions-dRvmsbTk.d.ts → trace-questions-C26UvI3D.d.ts} +3 -3
- package/dist/{trace-questions-dRvmsbTk.d.ts.map → trace-questions-C26UvI3D.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +2 -9
- package/dist/trace-repair/index.d.ts.map +1 -1
- package/dist/trace-repair/index.js +1 -1
- package/dist/traces.d.ts +6 -8
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +6 -6
- package/dist/trajectory-replay/index.d.ts +0 -2
- package/dist/trajectory-replay/index.d.ts.map +1 -1
- package/dist/trajectory-replay/index.js +1 -1
- package/dist/{tree-CJOXbVcv.js → tree-kc1d80yF.js} +5 -25
- package/dist/tree-kc1d80yF.js.map +1 -0
- package/dist/{types-CFCUZk0B.d.ts → types-Dv9sYwBB.d.ts} +4 -4
- package/dist/{types-CFCUZk0B.d.ts.map → types-Dv9sYwBB.d.ts.map} +1 -1
- package/dist/{types-DAPpAkd4.d.ts → types-KEkKkETv.d.ts} +2 -2
- package/dist/{types-DAPpAkd4.d.ts.map → types-KEkKkETv.d.ts.map} +1 -1
- package/dist/{types-BlSBUNRd.d.ts → types-tWFY6bON.d.ts} +3 -3
- package/dist/{types-BlSBUNRd.d.ts.map → types-tWFY6bON.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +1 -1
- package/docs/concepts.md +13 -0
- package/docs/experiment.md +10 -0
- package/docs/public-api.md +399 -424
- package/docs/trace-analysis.md +3 -0
- package/package.json +6 -5
- package/dist/agent-profile-cell-BHcB-mZX.d.ts.map +0 -1
- package/dist/agent-profile-cell-DcFW4vOc.js.map +0 -1
- package/dist/analyze-runs-GZ0VSwui.js.map +0 -1
- package/dist/campaign-evidence-DW3Krxov.js.map +0 -1
- package/dist/claude-jsonl-CG3JUbTJ.js +0 -211
- package/dist/claude-jsonl-CG3JUbTJ.js.map +0 -1
- package/dist/engine-DProXJ7A.d.ts.map +0 -1
- package/dist/llm-judge-HLWASwUJ.js.map +0 -1
- package/dist/paired-binary-b2L3WKqr.js.map +0 -1
- package/dist/produced-state-Bzlh09oj.js.map +0 -1
- package/dist/release-confidence-CkoXFx9I.d.ts.map +0 -1
- package/dist/rollout-l9w3Gdvh.js.map +0 -1
- package/dist/run-record-BRlM99rX.js.map +0 -1
- package/dist/run-record-DF-fuu31.d.ts.map +0 -1
- package/dist/search-kernel-CIie6xig.js.map +0 -1
- package/dist/series-convergence-CjO2QdRW.js +0 -43
- package/dist/series-convergence-CjO2QdRW.js.map +0 -1
- package/dist/series-convergence-hEfKdoi-.d.ts +0 -126
- package/dist/series-convergence-hEfKdoi-.d.ts.map +0 -1
- package/dist/statistical-heldout-DFKtp-Qm.d.ts.map +0 -1
- package/dist/tool-groups-j19pmOfP.d.ts.map +0 -1
- package/dist/tree-CJOXbVcv.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/supervisor-run/claude-code-reader.ts"],"sourcesContent":["/**\n * Supervision-tree reader over a THIRD-PARTY harness: Claude Code.\n *\n * The Runtime reader reads a supervisor journal designed for this analysis.\n * for this analysis. This reader reads a harness we do not control, whose\n * transcript was designed for replaying a chat — and recovers the same tree\n * from it. If both produce a `SupervisorRunSources`, the tree model is a\n * property of multi-agent runs, not of our journal format.\n *\n * ## Where the tree hides in a Claude Code transcript\n *\n * | Tree fact | Claude Code evidence |\n * |---|---|\n * | spawn | assistant `tool_use` (`Agent` / `Task`), answered by a `tool_result` whose `toolUseResult.agentId` names the child |\n * | settle | a `<task-notification>` block in a later user line: `<task-id>` = agentId, `<status>` |\n * | steer | assistant `tool_use` (`SendMessage`) with `input.to` = agentId — mid-task, to a LIVE child |\n * | delivered | that steer's `tool_result` carrying `success` / `resumedAgentId` |\n * | cancel | assistant `tool_use` (`TaskStop`) targeting an agentId |\n * | brain spend| `message.usage` on the main thread's assistant lines |\n * | worker spend| `message.usage` inside `<session>/subagents/agent-<id>.jsonl` |\n * | depth | a child transcript that itself contains `Agent` tool_use lines |\n *\n * Every one of those is read through `parseClaudeEntries` — the SAME line\n * parser `src/rollout/readers/claude-jsonl.ts` uses for solo rollouts. There\n * is no second transcript parser.\n *\n * ## What Claude Code cannot say\n *\n * It records tokens but never a price, runs no per-worker verify, and keeps no\n * per-worker patch. Those are declared once in `limits`, so the analyzer\n * reports `unavailable — <reason>` instead of the $0 / 0-accepted that summing\n * an empty field would produce. See `SourceLimits`.\n *\n * ## Metric coverage vs the Runtime journal\n *\n * Measured on a real 52-agent session (fixture:\n * `tests/fixtures/supervisor-run/claude-code-session-*`).\n *\n * | Metric | Runtime | Claude Code | Why |\n * |---|---|---|---|\n * | workersSpawned / Settled / Cancelled | full | full | spawn tool_use + task-notification + TaskStop |\n * | steers / steersDelivered / steersByWorker | full | full | `SendMessage`; delivery from its tool_result |\n * | waves / waveSizes / maxConcurrency | full | full | derived from spawn/settle instants |\n * | respawns / repeatedLabels | full | full | same derivation |\n * | delegationDepth | full | full | a child transcript's own spawn calls |\n * | timeToFirstSpawn / supervisorWall | full | full | transcript instants |\n * | idleMs / idlePct / workerUtilization | full | PARTIAL | an agent that never notifies is counted live to the end of the transcript |\n * | observeThenRespawn / respawnWithoutEvidence | full | full | ordering of spawn vs settle instants |\n * | workerEvidenceBytes | full | PARTIAL | the child's closing message; 0 for pruned transcripts |\n * | brain tokens in/out + cache | full | full | main-thread `message.usage` |\n * | worker tokens in/out + cache | via harness join | full or unavailable | totals are refused if any spawned transcript was pruned; retained per-worker rows remain available |\n * | perWorker wall | full | full | spawn → settle instants |\n * | accepted / rejected / emptyPass / settledVerdicts | full | NONE | no per-worker verify step exists |\n * | brain/worker/total usd, costPerAcceptedPatch | full | NONE | transcripts carry no price |\n * | patch stats, delivered, verifyPass/Rc | full | NONE | no diff is handed back |\n * | judgeResolved / Score / Passed / Total | full | NONE | no judge in the loop |\n * | driverSteerCalls, brainTruncations | full | NONE | no outer driver log, no per-call finish_reason tap |\n */\n\nimport { readdir, readFile } from 'node:fs/promises'\nimport { basename, dirname, join } from 'node:path'\nimport {\n type ClaudeEntry,\n parseClaudeEntries,\n transcriptFromEntries,\n} from '../rollout/readers/claude-jsonl'\nimport type { SupervisorRunReader, SupervisorRunSources, WorkerLogSource } from './types'\n\n/** Tool names that spawn a child agent. `Task` is the older name for `Agent`. */\nconst DEFAULT_SPAWN_TOOLS = ['Agent', 'Task'] as const\n/** Tool names that deliver a message to an ALREADY-RUNNING child agent. */\nconst DEFAULT_STEER_TOOLS = ['SendMessage'] as const\n/** Tool names that stop a running child agent. */\nconst DEFAULT_CANCEL_TOOLS = ['TaskStop', 'KillAgent'] as const\n\nconst SPEND_UNPRICED =\n 'Claude Code transcripts record token usage but never a price — usd is not in the store'\nconst NO_VERDICTS =\n 'Claude Code runs no per-worker verify step — a subagent reports prose, not pass/fail'\nconst NO_DELIVERABLES =\n 'Claude Code retains no per-worker patch — subagents commit to git, they do not hand back a diff'\n\nexport interface ClaudeCodeReaderOptions {\n /** The main session transcript: `~/.claude/projects/<slug>/<sessionId>.jsonl`. */\n readonly transcriptPath: string\n /**\n * Directory of child transcripts. Defaults to `<transcript-dir>/<sessionId>/subagents`.\n * `null` skips the join, and every per-worker token count becomes unavailable.\n */\n readonly subagentsDir?: string | null\n readonly runRef?: string\n readonly instanceId?: string | null\n readonly arm?: string | null\n readonly spawnTools?: readonly string[]\n readonly steerTools?: readonly string[]\n readonly cancelTools?: readonly string[]\n}\n\nconst isRecord = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\n\nconst str = (v: unknown): string | null => (typeof v === 'string' ? v : null)\n\ninterface ToolUse {\n readonly id: string\n readonly name: string\n readonly input: Record<string, unknown>\n readonly at: string | null\n}\n\ninterface ToolResult {\n readonly id: string\n readonly at: string | null\n readonly structured: unknown\n readonly text: string\n}\n\n/** Every tool call and tool result on one thread, in order, with instants. */\ninterface ThreadCalls {\n readonly uses: ToolUse[]\n readonly results: Map<string, ToolResult>\n readonly notifications: TaskNotification[]\n readonly firstAt: string | null\n readonly lastAt: string | null\n}\n\ninterface TaskNotification {\n readonly taskId: string\n readonly toolUseId: string | null\n readonly status: string\n readonly summary: string | null\n readonly at: string | null\n}\n\nfunction blockText(content: unknown): string {\n if (typeof content === 'string') return content\n if (!Array.isArray(content)) return ''\n const parts: string[] = []\n for (const b of content) {\n if (isRecord(b) && b.type === 'text' && typeof b.text === 'string') parts.push(b.text)\n }\n return parts.join('\\n')\n}\n\nconst tag = (xml: string, name: string): string | null => {\n const m = xml.match(new RegExp(`<${name}>([\\\\s\\\\S]*?)</${name}>`))\n return m === null ? null : (m[1] as string)\n}\n\n/**\n * Task notifications are the settle instants. A notification fires each time an\n * agent stops, so a resumed agent produces several — they are kept in order and\n * the LAST one is the settle the analyzer sees, with the earlier ones acting as\n * the intermediate stops they actually were.\n */\nfunction parseNotifications(text: string, at: string | null): TaskNotification[] {\n const out: TaskNotification[] = []\n for (const m of text.matchAll(/<task-notification>[\\s\\S]*?<\\/task-notification>/g)) {\n const xml = m[0]\n const taskId = tag(xml, 'task-id')\n if (taskId === null) continue\n out.push({\n taskId: taskId.trim(),\n toolUseId: tag(xml, 'tool-use-id')?.trim() ?? null,\n status: tag(xml, 'status')?.trim() ?? 'unknown',\n summary: tag(xml, 'summary')?.trim() ?? null,\n at,\n })\n }\n return out\n}\n\n/** Project entries of ONE thread (main or a single sidechain) into tool traffic. */\nfunction threadCalls(entries: readonly ClaudeEntry[]): ThreadCalls {\n const uses: ToolUse[] = []\n const results = new Map<string, ToolResult>()\n const notifications: TaskNotification[] = []\n let firstAt: string | null = null\n let lastAt: string | null = null\n\n for (const entry of entries) {\n if (entry.timestamp !== null) {\n if (firstAt === null) firstAt = entry.timestamp\n lastAt = entry.timestamp\n }\n const content = entry.message.content\n if (entry.type === 'assistant') {\n if (!Array.isArray(content)) continue\n for (const block of content) {\n if (!isRecord(block) || block.type !== 'tool_use') continue\n const id = str(block.id)\n const name = str(block.name)\n if (id === null || name === null) continue\n uses.push({\n id,\n name,\n input: isRecord(block.input) ? block.input : {},\n at: entry.timestamp,\n })\n }\n continue\n }\n if (typeof content === 'string') {\n notifications.push(...parseNotifications(content, entry.timestamp))\n continue\n }\n if (!Array.isArray(content)) continue\n for (const block of content) {\n if (!isRecord(block)) continue\n if (block.type === 'tool_result' && typeof block.tool_use_id === 'string') {\n results.set(block.tool_use_id, {\n id: block.tool_use_id,\n at: entry.timestamp,\n structured: entry.toolUseResult,\n text: blockText(block.content),\n })\n } else if (block.type === 'text' && typeof block.text === 'string') {\n notifications.push(...parseNotifications(block.text, entry.timestamp))\n }\n }\n }\n return { uses, results, notifications, firstAt, lastAt }\n}\n\n/**\n * The agent id a spawn produced. Claude Code puts it in the structured\n * `toolUseResult`; the same id is echoed in the result text for transcripts\n * written before that field existed, so both are tried before giving up.\n */\nfunction spawnedAgentId(result: ToolResult | undefined): string | null {\n if (result === undefined) return null\n if (isRecord(result.structured)) {\n const id = str(result.structured.agentId)\n if (id !== null) return id\n }\n return result.text.match(/agentId:\\s*([A-Za-z0-9_-]+)/)?.[1] ?? null\n}\n\ninterface ChildTranscript {\n readonly agentId: string\n readonly path: string\n readonly description: string | null\n readonly spawnToolUseId: string | null\n readonly spawnDepth: number | null\n readonly entries: ClaudeEntry[]\n readonly tokensIn: number | null\n readonly tokensOut: number | null\n readonly cacheRead: number | null\n readonly cacheWrite: number | null\n readonly gaps: readonly string[]\n readonly firstAt: string | null\n readonly lastAt: string | null\n readonly model: string | null\n /**\n * The child's closing assistant message — what it actually handed back. This\n * is the Claude Code analogue of a worker's `evidence` blob.\n */\n readonly finalReport: string | null\n}\n\nasync function readChildren(dir: string): Promise<ChildTranscript[]> {\n const names = await readdir(dir).catch(() => null)\n if (names === null) return []\n const out: ChildTranscript[] = []\n for (const name of names.filter((n) => n.endsWith('.jsonl')).sort()) {\n const path = join(dir, name)\n const raw = await readFile(path, 'utf8').catch(() => null)\n if (raw === null) continue\n const sourceGaps: string[] = []\n const entries = parseClaudeEntries(raw, (gap) => sourceGaps.push(gap))\n // A subagent transcript is sidechain end to end — that flag is what marks it\n // a separate invocation rather than a turn of the parent.\n const projected = transcriptFromEntries(entries, { includeSidechain: true, sourceGaps })\n const metaRaw = await readFile(path.replace(/\\.jsonl$/, '.meta.json'), 'utf8').catch(() => null)\n let meta: Record<string, unknown> = {}\n if (metaRaw !== null) {\n try {\n const parsed: unknown = JSON.parse(metaRaw)\n if (isRecord(parsed)) meta = parsed\n } catch {\n meta = {}\n }\n }\n const agentId =\n entries.find((e) => e.agentId !== null)?.agentId ??\n name.replace(/^agent-/, '').replace(/\\.jsonl$/, '')\n out.push({\n agentId,\n path,\n description: str(meta.description),\n spawnToolUseId: str(meta.toolUseId),\n spawnDepth: typeof meta.spawnDepth === 'number' ? meta.spawnDepth : null,\n entries,\n tokensIn: projected.usage.tokensIn,\n tokensOut: projected.usage.tokensOut,\n cacheRead: projected.usage.cacheRead,\n cacheWrite: projected.usage.cacheWrite,\n gaps: projected.gaps,\n firstAt: projected.startedAt,\n lastAt: projected.endedAt,\n model: projected.model,\n finalReport:\n [...projected.messages]\n .reverse()\n .find((m) => m.role === 'assistant' && typeof m.content === 'string')?.content ?? null,\n })\n }\n return out\n}\n\ninterface SpawnFact {\n readonly agentId: string\n readonly parentId: string\n readonly label: string\n readonly at: string | null\n readonly model: string | null\n}\n\n/** A journal line in the dialect `parseSupervisorTree` reads. */\nconst line = (obj: Record<string, unknown>): string => JSON.stringify(obj)\n\n/**\n * Read a Claude Code session (plus its subagent transcripts) as supervision-tree\n * source bytes. Never throws on a missing artifact.\n */\nexport async function readClaudeCodeSupervisorRun(\n opts: ClaudeCodeReaderOptions,\n): Promise<SupervisorRunSources> {\n const spawnTools = new Set(opts.spawnTools ?? DEFAULT_SPAWN_TOOLS)\n const steerTools = new Set(opts.steerTools ?? DEFAULT_STEER_TOOLS)\n const cancelTools = new Set(opts.cancelTools ?? DEFAULT_CANCEL_TOOLS)\n\n const raw = await readFile(opts.transcriptPath, 'utf8').catch(() => null)\n const sessionId = basename(opts.transcriptPath).replace(/\\.jsonl$/, '')\n const runRef = opts.runRef ?? opts.transcriptPath\n const limits = {\n managerTokens: null,\n workerTokens: null,\n spendUsd: SPEND_UNPRICED,\n workerVerdicts: NO_VERDICTS,\n deliverables: null,\n }\n const traceCommand = `npx --yes @tangle-network/traces@latest analyze --harness claude-code --session ${sessionId}`\n\n if (raw === null) {\n return {\n runRef,\n instanceId: opts.instanceId ?? sessionId,\n arm: opts.arm ?? null,\n supRunDir: null,\n journal: null,\n brainLog: null,\n state: null,\n progress: null,\n workers: null,\n workersMissingReason: `session transcript unreadable at ${opts.transcriptPath}`,\n result: null,\n judge: null,\n judgeSource: null,\n patch: null,\n driverLog: null,\n harnessWorkerTokens: null,\n harnessMissingReason: `session transcript unreadable at ${opts.transcriptPath}`,\n limits: {\n ...limits,\n managerTokens: `session transcript unreadable at ${opts.transcriptPath}`,\n workerTokens: `session transcript unreadable at ${opts.transcriptPath}`,\n deliverables: NO_DELIVERABLES,\n },\n traceCommand,\n }\n }\n\n const mainSourceGaps: string[] = []\n const allEntries = parseClaudeEntries(raw, (gap) => mainSourceGaps.push(gap))\n const main = threadCalls(allEntries.filter((e) => !e.isSidechain))\n const mainTranscript = transcriptFromEntries(allEntries, { sourceGaps: mainSourceGaps })\n\n const subagentsDir =\n opts.subagentsDir === undefined\n ? join(dirname(opts.transcriptPath), sessionId, 'subagents')\n : opts.subagentsDir\n const children = subagentsDir === null ? [] : await readChildren(subagentsDir)\n const childByAgentId = new Map(children.map((c) => [c.agentId, c]))\n const childBySpawnToolUseId = new Map(\n children.filter((c) => c.spawnToolUseId !== null).map((c) => [c.spawnToolUseId as string, c]),\n )\n\n // Every thread that can spawn: the session itself, plus each child transcript\n // (a child that calls the spawn tool is a second delegation level).\n const threads: Array<{ id: string; calls: ThreadCalls }> = [{ id: sessionId, calls: main }]\n for (const child of children) {\n threads.push({ id: child.agentId, calls: threadCalls(child.entries) })\n }\n\n const spawns: SpawnFact[] = []\n const steersByTarget = new Map<\n string,\n Array<{ requestId: string; at: string | null; delivered: boolean }>\n >()\n const cancels: Array<{ agentId: string; at: string | null }> = []\n const settles: TaskNotification[] = []\n\n for (const thread of threads) {\n for (const use of thread.calls.uses) {\n if (spawnTools.has(use.name)) {\n const result = thread.calls.results.get(use.id)\n const agentId = spawnedAgentId(result) ?? childBySpawnToolUseId.get(use.id)?.agentId ?? null\n if (agentId === null) continue\n const label =\n str(use.input.description) ?? childByAgentId.get(agentId)?.description ?? agentId\n spawns.push({\n agentId,\n parentId: thread.id,\n label,\n // The spawn is complete when the launch call is answered; the tool_use\n // instant is the fallback for a call that never got a result line.\n at: result?.at ?? use.at,\n model: isRecord(result?.structured) ? str(result.structured.resolvedModel) : null,\n })\n continue\n }\n if (steerTools.has(use.name)) {\n const target = str(use.input.to) ?? str(use.input.recipient)\n if (target === null) continue\n const result = thread.calls.results.get(use.id)\n const structured = isRecord(result?.structured) ? result.structured : null\n // `success` is the harness confirming the message reached a live agent;\n // absent, the steer is counted queued but not delivered.\n const delivered = structured?.success === true || str(structured?.resumedAgentId) === target\n const rows = steersByTarget.get(target) ?? []\n rows.push({ requestId: use.id, at: use.at, delivered })\n steersByTarget.set(target, rows)\n continue\n }\n if (cancelTools.has(use.name)) {\n const target = str(use.input.agentId) ?? str(use.input.to) ?? str(use.input.taskId)\n if (target !== null) cancels.push({ agentId: target, at: use.at })\n }\n }\n settles.push(...thread.calls.notifications)\n }\n\n const spawnedIds = new Set(spawns.map((s) => s.agentId))\n const cancelledIds = new Set(\n cancels.filter((c) => spawnedIds.has(c.agentId)).map((c) => c.agentId),\n )\n const startedAt = main.firstAt\n const completedAt = main.lastAt\n\n const journalLines: string[] = [\n line({\n kind: 'spawned',\n id: sessionId,\n parent: null,\n label: `session:${sessionId}`,\n role: 'supervisor',\n at: startedAt,\n }),\n ]\n for (const s of spawns) {\n journalLines.push(\n line({\n kind: 'spawned',\n id: s.agentId,\n parent: s.parentId,\n label: s.label,\n role: 'worker',\n at: s.at,\n }),\n )\n }\n\n // Only the LAST notification per agent is its settle; an earlier one is a stop\n // the supervisor resumed from, which the steer count already records.\n const lastNotification = new Map<string, TaskNotification>()\n for (const n of settles) {\n if (!spawnedIds.has(n.taskId)) continue\n lastNotification.set(n.taskId, n)\n }\n for (const [agentId, n] of lastNotification) {\n if (cancelledIds.has(agentId)) continue\n journalLines.push(\n line({\n kind: 'settled',\n id: agentId,\n status: n.status,\n verdict: n.summary,\n at: n.at,\n // No `spent` key: Claude Code prices nothing, and a zeroed spend object\n // would read as a $0 worker. `limits.spendUsd` carries the reason.\n }),\n )\n }\n // One cancel per agent: Claude Code can emit a stop then a retry-stop for the\n // same agentId, and each raw entry would otherwise mint a duplicate `cancelled`\n // line that double-counts in `workersCancelled`. Keep the last, mirroring the\n // last-notification dedup the settle path already does.\n const lastCancel = new Map<string, { agentId: string; at: string | null }>()\n for (const c of cancels) {\n if (!spawnedIds.has(c.agentId)) continue\n lastCancel.set(c.agentId, c)\n }\n for (const c of lastCancel.values()) {\n journalLines.push(\n line({ kind: 'cancelled', id: c.agentId, reason: 'stopped by supervisor', at: c.at }),\n )\n }\n // `metered` carries the brain's own inference. The token counts are real; the\n // usd stays absent and `limits.spendUsd` explains why.\n if (\n mainTranscript.gaps.length === 0 &&\n mainTranscript.usage.tokensIn !== null &&\n mainTranscript.usage.tokensOut !== null &&\n mainTranscript.usage.cacheRead !== null &&\n mainTranscript.usage.cacheWrite !== null\n ) {\n journalLines.push(\n line({\n kind: 'metered',\n id: sessionId,\n spend: {\n tokens: {\n input: mainTranscript.usage.tokensIn,\n output: mainTranscript.usage.tokensOut,\n cacheRead: mainTranscript.usage.cacheRead,\n cacheWrite: mainTranscript.usage.cacheWrite,\n },\n },\n at: completedAt,\n }),\n )\n }\n\n const settleAtByAgent = new Map(\n [...lastNotification.entries()].map(([id, n]) => [id, n.at] as const),\n )\n const spawnAtByAgent = new Map(spawns.map((s) => [s.agentId, s.at] as const))\n\n const workers: WorkerLogSource[] = []\n for (const spawn of spawns) {\n const { agentId, label } = spawn\n const events: string[] = []\n const inbox: string[] = []\n const child = childByAgentId.get(agentId) ?? null\n const startAt = child?.firstAt ?? spawnAtByAgent.get(agentId) ?? null\n const endAt = settleAtByAgent.get(agentId) ?? child?.lastAt ?? null\n if (startAt !== null) events.push(line({ kind: 'started', label, at: startAt, agentId }))\n for (const steer of steersByTarget.get(agentId) ?? []) {\n inbox.push(line({ id: steer.requestId, at: steer.at, worker: label, message: 'steer' }))\n events.push(\n line({\n kind: 'message',\n label,\n direction: 'down',\n at: steer.at,\n requestId: steer.requestId,\n delivered: steer.delivered,\n }),\n )\n }\n if (endAt !== null) {\n events.push(\n line({\n kind: 'finished',\n label,\n at: endAt,\n agentId,\n // No `passed` / `patchBytes`: this harness has neither. Emitting\n // `passed: false` here would invent a failed worker.\n // `evidence` is the child's closing message — what it handed back.\n ...(child?.finalReport === null || child?.finalReport === undefined\n ? {}\n : { evidence: child.finalReport }),\n }),\n )\n }\n workers.push({\n workerId: agentId,\n label,\n events: events.length === 0 ? '' : `${events.join('\\n')}\\n`,\n inbox: inbox.length === 0 ? '' : `${inbox.join('\\n')}\\n`,\n patchBytes: null,\n transcriptRef: child?.path ?? null,\n patchPath: null,\n tokensIn: child?.tokensIn ?? null,\n tokensOut: child?.tokensOut ?? null,\n cacheRead: child?.cacheRead ?? null,\n cacheWrite: child?.cacheWrite ?? null,\n })\n }\n\n const joined = children.length\n const missingChildren = spawns.filter((spawn) => !childByAgentId.has(spawn.agentId)).length\n const incompleteChildren = children.filter(\n (child) =>\n child.gaps.length > 0 ||\n child.tokensIn === null ||\n child.tokensOut === null ||\n child.cacheRead === null ||\n child.cacheWrite === null,\n ).length\n const harnessMissingReason =\n subagentsDir === null\n ? 'subagent transcript join disabled'\n : joined === 0\n ? `no subagent transcripts under ${subagentsDir}`\n : missingChildren > 0\n ? `${missingChildren}/${spawns.length} spawned agents have no retained transcript under ${subagentsDir}`\n : incompleteChildren > 0\n ? `${incompleteChildren}/${joined} subagent transcripts have malformed lines or unknown usage`\n : null\n const harnessWorkerTokens =\n joined === 0 || incompleteChildren > 0\n ? null\n : {\n store: 'claude-code subagent transcripts',\n sessions: joined,\n input: children.reduce((a, child) => a + (child.tokensIn ?? 0), 0),\n output: children.reduce((a, child) => a + (child.tokensOut ?? 0), 0),\n cacheRead: children.reduce((a, child) => a + (child.cacheRead ?? 0), 0),\n cacheWrite: children.reduce((a, child) => a + (child.cacheWrite ?? 0), 0),\n }\n\n const liveWorkers = spawns.filter(\n (s) => !lastNotification.has(s.agentId) && !cancelledIds.has(s.agentId),\n ).length\n const state = JSON.stringify({\n id: sessionId,\n // Derived, not asserted: a spawned agent with no notification and no stop\n // is still running, which is exactly what a live transcript looks like.\n status: liveWorkers > 0 ? 'running' : 'idle',\n startedAt,\n completedAt,\n result: { delivered: null },\n })\n\n return {\n runRef,\n instanceId: opts.instanceId ?? sessionId,\n arm: opts.arm ?? null,\n supRunDir: subagentsDir,\n journal: `${journalLines.join('\\n')}\\n`,\n brainLog: null,\n state,\n progress: null,\n workers,\n workersMissingReason: null,\n result: null,\n judge: null,\n judgeSource: null,\n patch: null,\n driverLog: null,\n harnessWorkerTokens,\n harnessMissingReason,\n limits: {\n ...limits,\n managerTokens:\n mainTranscript.gaps.length > 0\n ? `main transcript has ${mainTranscript.gaps.length} parse or usage gaps`\n : null,\n workerTokens: spawns.length === 0 ? null : harnessMissingReason,\n deliverables: NO_DELIVERABLES,\n },\n rootTranscriptRef: opts.transcriptPath,\n traceCommand,\n }\n}\n\n/** A `SupervisorRunReader` over a Claude Code session — the same contract Runtime implements. */\nexport function claudeCodeSupervisorRunReader(opts: ClaudeCodeReaderOptions): SupervisorRunReader {\n return {\n runRef: opts.runRef ?? opts.transcriptPath,\n read: () => readClaudeCodeSupervisorRun(opts),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,MAAM,sBAAsB,CAAC,SAAS,MAAM;;AAE5C,MAAM,sBAAsB,CAAC,aAAa;;AAE1C,MAAM,uBAAuB,CAAC,YAAY,WAAW;AAErD,MAAM,iBACJ;AACF,MAAM,cACJ;AACF,MAAM,kBACJ;AAkBF,MAAM,YAAY,MAChB,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAEzD,MAAM,OAAO,MAA+B,OAAO,MAAM,WAAW,IAAI;AAiCxE,SAAS,UAAU,SAA0B;CAC3C,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG,OAAO;CACpC,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,KAAK,SACd,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,UAAU,OAAO,EAAE,SAAS,UAAU,MAAM,KAAK,EAAE,IAAI;CAEvF,OAAO,MAAM,KAAK,IAAI;AACxB;AAEA,MAAM,OAAO,KAAa,SAAgC;CACxD,MAAM,IAAI,IAAI,MAAM,IAAI,OAAO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":["/**\n * Supervision-tree reader over a THIRD-PARTY harness: Claude Code.\n *\n * The Runtime reader reads a supervisor journal designed for this analysis.\n * for this analysis. This reader reads a harness we do not control, whose\n * transcript was designed for replaying a chat — and recovers the same tree\n * from it. If both produce a `SupervisorRunSources`, the tree model is a\n * property of multi-agent runs, not of our journal format.\n *\n * ## Where the tree hides in a Claude Code transcript\n *\n * | Tree fact | Claude Code evidence |\n * |---|---|\n * | spawn | assistant `tool_use` (`Agent` / `Task`), answered by a `tool_result` whose `toolUseResult.agentId` names the child |\n * | settle | a `<task-notification>` block in a later user line: `<task-id>` = agentId, `<status>` |\n * | steer | assistant `tool_use` (`SendMessage`) with `input.to` = agentId — mid-task, to a LIVE child |\n * | delivered | that steer's `tool_result` carrying `success` / `resumedAgentId` |\n * | cancel | assistant `tool_use` (`TaskStop`) targeting an agentId |\n * | brain spend| `message.usage` on the main thread's assistant lines |\n * | worker spend| `message.usage` inside `<session>/subagents/agent-<id>.jsonl` |\n * | depth | a child transcript that itself contains `Agent` tool_use lines |\n *\n * Every one of those is read from the normalized session of @tangle-network/harness-sessions — the SAME\n * parser `src/rollout/readers/claude-jsonl.ts` uses for solo rollouts. There\n * is no second transcript parser.\n *\n * ## What Claude Code cannot say\n *\n * It records tokens but never a price, runs no per-worker verify, and keeps no\n * per-worker patch. Those are declared once in `limits`, so the analyzer\n * reports `unavailable — <reason>` instead of the $0 / 0-accepted that summing\n * an empty field would produce. See `SourceLimits`.\n *\n * ## Metric coverage vs the Runtime journal\n *\n * Measured on a real 52-agent session (fixture:\n * `tests/fixtures/supervisor-run/claude-code-session-*`).\n *\n * | Metric | Runtime | Claude Code | Why |\n * |---|---|---|---|\n * | workersSpawned / Settled / Cancelled | full | full | spawn tool_use + task-notification + TaskStop |\n * | steers / steersDelivered / steersByWorker | full | full | `SendMessage`; delivery from its tool_result |\n * | waves / waveSizes / maxConcurrency | full | full | derived from spawn/settle instants |\n * | respawns / repeatedLabels | full | full | same derivation |\n * | delegationDepth | full | full | a child transcript's own spawn calls |\n * | timeToFirstSpawn / supervisorWall | full | full | transcript instants |\n * | idleMs / idlePct / workerUtilization | full | PARTIAL | an agent that never notifies is counted live to the end of the transcript |\n * | observeThenRespawn / respawnWithoutEvidence | full | full | ordering of spawn vs settle instants |\n * | workerEvidenceBytes | full | PARTIAL | the child's closing message; 0 for pruned transcripts |\n * | brain tokens in/out + cache | full | full | main-thread `message.usage` |\n * | worker tokens in/out + cache | via harness join | full or unavailable | totals are refused if any spawned transcript was pruned; retained per-worker rows remain available |\n * | perWorker wall | full | full | spawn → settle instants |\n * | accepted / rejected / emptyPass / settledVerdicts | full | NONE | no per-worker verify step exists |\n * | brain/worker/total usd, costPerAcceptedPatch | full | NONE | transcripts carry no price |\n * | patch stats, delivered, verifyPass/Rc | full | NONE | no diff is handed back |\n * | judgeResolved / Score / Passed / Total | full | NONE | no judge in the loop |\n * | driverSteerCalls, brainTruncations | full | NONE | no outer driver log, no per-call finish_reason tap |\n */\n\nimport { readdir, readFile } from 'node:fs/promises'\nimport { basename, dirname, join } from 'node:path'\nimport {\n claudeCodeReader,\n claudeCodeRefForFile,\n type HarnessSession,\n} from '@tangle-network/harness-sessions'\nimport { type ClaudeTranscript, transcriptFromSession } from '../rollout/readers/claude-jsonl'\nimport type { SupervisorRunReader, SupervisorRunSources, WorkerLogSource } from './types'\n\n/** Tool names that spawn a child agent. `Task` is the older name for `Agent`. */\nconst DEFAULT_SPAWN_TOOLS = ['Agent', 'Task'] as const\n/** Tool names that deliver a message to an ALREADY-RUNNING child agent. */\nconst DEFAULT_STEER_TOOLS = ['SendMessage'] as const\n/** Tool names that stop a running child agent. */\nconst DEFAULT_CANCEL_TOOLS = ['TaskStop', 'KillAgent'] as const\n\nconst SPEND_UNPRICED =\n 'Claude Code transcripts record token usage but never a price — usd is not in the store'\nconst NO_VERDICTS =\n 'Claude Code runs no per-worker verify step — a subagent reports prose, not pass/fail'\nconst NO_DELIVERABLES =\n 'Claude Code retains no per-worker patch — subagents commit to git, they do not hand back a diff'\n\nexport interface ClaudeCodeReaderOptions {\n /** The main session transcript: `~/.claude/projects/<slug>/<sessionId>.jsonl`. */\n readonly transcriptPath: string\n /**\n * Directory of child transcripts. Defaults to `<transcript-dir>/<sessionId>/subagents`.\n * `null` skips the join, and every per-worker token count becomes unavailable.\n */\n readonly subagentsDir?: string | null\n readonly runRef?: string\n readonly instanceId?: string | null\n readonly arm?: string | null\n readonly spawnTools?: readonly string[]\n readonly steerTools?: readonly string[]\n readonly cancelTools?: readonly string[]\n}\n\nconst isRecord = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\n\nconst str = (v: unknown): string | null => (typeof v === 'string' ? v : null)\n\ninterface ToolUse {\n readonly id: string\n readonly name: string\n readonly input: Record<string, unknown>\n readonly at: string | null\n}\n\ninterface ToolResult {\n readonly id: string\n readonly at: string | null\n readonly structured: unknown\n readonly text: string\n}\n\n/** Every tool call and tool result on one thread, in order, with instants. */\ninterface ThreadCalls {\n readonly uses: ToolUse[]\n readonly results: Map<string, ToolResult>\n readonly notifications: TaskNotification[]\n readonly firstAt: string | null\n readonly lastAt: string | null\n}\n\ninterface TaskNotification {\n readonly taskId: string\n readonly toolUseId: string | null\n readonly status: string\n readonly summary: string | null\n readonly at: string | null\n}\n\nconst tag = (xml: string, name: string): string | null => {\n const m = xml.match(new RegExp(`<${name}>([\\\\s\\\\S]*?)</${name}>`))\n return m === null ? null : (m[1] as string)\n}\n\n/**\n * Task notifications are the settle instants. A notification fires each time an\n * agent stops, so a resumed agent produces several — they are kept in order and\n * the LAST one is the settle the analyzer sees, with the earlier ones acting as\n * the intermediate stops they actually were.\n */\nfunction parseNotifications(text: string, at: string | null): TaskNotification[] {\n const out: TaskNotification[] = []\n for (const m of text.matchAll(/<task-notification>[\\s\\S]*?<\\/task-notification>/g)) {\n const xml = m[0]\n const taskId = tag(xml, 'task-id')\n if (taskId === null) continue\n out.push({\n taskId: taskId.trim(),\n toolUseId: tag(xml, 'tool-use-id')?.trim() ?? null,\n status: tag(xml, 'status')?.trim() ?? 'unknown',\n summary: tag(xml, 'summary')?.trim() ?? null,\n at,\n })\n }\n return out\n}\n\n/** Project ONE thread's session (main or a single subagent) into tool traffic. */\nfunction threadCalls(session: HarnessSession): ThreadCalls {\n const uses: ToolUse[] = []\n const results = new Map<string, ToolResult>()\n const notifications: TaskNotification[] = []\n for (const call of session.toolCalls) {\n uses.push({\n id: call.id,\n name: call.name,\n input: isRecord(call.input) ? call.input : {},\n at: call.startedAt,\n })\n if (call.result !== null) {\n results.set(call.id, {\n id: call.id,\n at: call.result.at,\n structured: call.result.details,\n text: call.result.text ?? '',\n })\n }\n }\n for (const message of session.messages) {\n if (message.role !== 'user') continue\n for (const part of message.parts) {\n if (part.type === 'text') notifications.push(...parseNotifications(part.text, message.at))\n }\n }\n return { uses, results, notifications, firstAt: session.startedAt, lastAt: session.endedAt }\n}\n\n/**\n * The agent id a spawn produced. Claude Code puts it in the structured\n * `toolUseResult`; the same id is echoed in the result text for transcripts\n * written before that field existed, so both are tried before giving up.\n */\nfunction spawnedAgentId(result: ToolResult | undefined): string | null {\n if (result === undefined) return null\n if (isRecord(result.structured)) {\n const id = str(result.structured.agentId)\n if (id !== null) return id\n }\n return result.text.match(/agentId:\\s*([A-Za-z0-9_-]+)/)?.[1] ?? null\n}\n\ninterface ChildTranscript {\n readonly agentId: string\n readonly path: string\n readonly description: string | null\n readonly spawnToolUseId: string | null\n readonly spawnDepth: number | null\n readonly session: HarnessSession\n readonly tokensIn: number | null\n readonly tokensOut: number | null\n readonly cacheRead: number | null\n readonly cacheWrite: number | null\n readonly gaps: readonly string[]\n readonly firstAt: string | null\n readonly lastAt: string | null\n readonly model: string | null\n /**\n * The child's closing assistant message — what it actually handed back. This\n * is the Claude Code analogue of a worker's `evidence` blob.\n */\n readonly finalReport: string | null\n}\n\nasync function readChildren(dir: string): Promise<ChildTranscript[]> {\n const names = await readdir(dir).catch(() => null)\n if (names === null) return []\n const out: ChildTranscript[] = []\n for (const name of names.filter((n) => n.endsWith('.jsonl')).sort()) {\n const path = join(dir, name)\n // A subagent transcript is sidechain end to end: read it as the subagent's own session.\n const session = await claudeCodeReader\n .read(claudeCodeRefForFile(path, 'parent'))\n .catch(() => null)\n if (session === null) continue\n const projected: ClaudeTranscript = transcriptFromSession(session)\n const metaRaw = await readFile(path.replace(/\\.jsonl$/, '.meta.json'), 'utf8').catch(() => null)\n let meta: Record<string, unknown> = {}\n if (metaRaw !== null) {\n try {\n const parsed: unknown = JSON.parse(metaRaw)\n if (isRecord(parsed)) meta = parsed\n } catch {\n meta = {}\n }\n }\n // The records name the agent; the file name is the fallback for a transcript that does not.\n const agentId = session.nativeSessionId\n out.push({\n agentId,\n path,\n description: str(meta.description),\n spawnToolUseId: str(meta.toolUseId),\n spawnDepth: typeof meta.spawnDepth === 'number' ? meta.spawnDepth : null,\n session,\n tokensIn: projected.usage.tokensIn,\n tokensOut: projected.usage.tokensOut,\n cacheRead: projected.usage.cacheRead,\n cacheWrite: projected.usage.cacheWrite,\n gaps: projected.gaps,\n firstAt: projected.startedAt,\n lastAt: projected.endedAt,\n model: projected.model,\n finalReport:\n [...projected.messages]\n .reverse()\n .find((m) => m.role === 'assistant' && typeof m.content === 'string')?.content ?? null,\n })\n }\n return out\n}\n\ninterface SpawnFact {\n readonly agentId: string\n readonly parentId: string\n readonly label: string\n readonly at: string | null\n readonly model: string | null\n}\n\n/** A journal line in the dialect `parseSupervisorTree` reads. */\nconst line = (obj: Record<string, unknown>): string => JSON.stringify(obj)\n\n/**\n * Read a Claude Code session (plus its subagent transcripts) as supervision-tree\n * source bytes. Never throws on a missing artifact.\n */\nexport async function readClaudeCodeSupervisorRun(\n opts: ClaudeCodeReaderOptions,\n): Promise<SupervisorRunSources> {\n const spawnTools = new Set(opts.spawnTools ?? DEFAULT_SPAWN_TOOLS)\n const steerTools = new Set(opts.steerTools ?? DEFAULT_STEER_TOOLS)\n const cancelTools = new Set(opts.cancelTools ?? DEFAULT_CANCEL_TOOLS)\n\n const mainSession = await claudeCodeReader\n .read(claudeCodeRefForFile(opts.transcriptPath))\n .catch(() => null)\n const sessionId = basename(opts.transcriptPath).replace(/\\.jsonl$/, '')\n const runRef = opts.runRef ?? opts.transcriptPath\n const limits = {\n managerTokens: null,\n workerTokens: null,\n spendUsd: SPEND_UNPRICED,\n workerVerdicts: NO_VERDICTS,\n deliverables: null,\n }\n const traceCommand = `npx --yes @tangle-network/traces@latest analyze --harness claude-code --session ${sessionId}`\n\n if (mainSession === null) {\n return {\n runRef,\n instanceId: opts.instanceId ?? sessionId,\n arm: opts.arm ?? null,\n supRunDir: null,\n journal: null,\n brainLog: null,\n state: null,\n progress: null,\n workers: null,\n workersMissingReason: `session transcript unreadable at ${opts.transcriptPath}`,\n result: null,\n judge: null,\n judgeSource: null,\n patch: null,\n driverLog: null,\n harnessWorkerTokens: null,\n harnessMissingReason: `session transcript unreadable at ${opts.transcriptPath}`,\n limits: {\n ...limits,\n managerTokens: `session transcript unreadable at ${opts.transcriptPath}`,\n workerTokens: `session transcript unreadable at ${opts.transcriptPath}`,\n deliverables: NO_DELIVERABLES,\n },\n traceCommand,\n }\n }\n\n const main = threadCalls(mainSession)\n const mainTranscript = transcriptFromSession(mainSession)\n\n const subagentsDir =\n opts.subagentsDir === undefined\n ? join(dirname(opts.transcriptPath), sessionId, 'subagents')\n : opts.subagentsDir\n const children = subagentsDir === null ? [] : await readChildren(subagentsDir)\n const childByAgentId = new Map(children.map((c) => [c.agentId, c]))\n const childBySpawnToolUseId = new Map(\n children.filter((c) => c.spawnToolUseId !== null).map((c) => [c.spawnToolUseId as string, c]),\n )\n\n // Every thread that can spawn: the session itself, plus each child transcript\n // (a child that calls the spawn tool is a second delegation level).\n const threads: Array<{ id: string; calls: ThreadCalls }> = [{ id: sessionId, calls: main }]\n for (const child of children) {\n threads.push({ id: child.agentId, calls: threadCalls(child.session) })\n }\n\n const spawns: SpawnFact[] = []\n const steersByTarget = new Map<\n string,\n Array<{ requestId: string; at: string | null; delivered: boolean }>\n >()\n const cancels: Array<{ agentId: string; at: string | null }> = []\n const settles: TaskNotification[] = []\n\n for (const thread of threads) {\n for (const use of thread.calls.uses) {\n if (spawnTools.has(use.name)) {\n const result = thread.calls.results.get(use.id)\n const agentId = spawnedAgentId(result) ?? childBySpawnToolUseId.get(use.id)?.agentId ?? null\n if (agentId === null) continue\n const label =\n str(use.input.description) ?? childByAgentId.get(agentId)?.description ?? agentId\n spawns.push({\n agentId,\n parentId: thread.id,\n label,\n // The spawn is complete when the launch call is answered; the tool_use\n // instant is the fallback for a call that never got a result line.\n at: result?.at ?? use.at,\n model: isRecord(result?.structured) ? str(result.structured.resolvedModel) : null,\n })\n continue\n }\n if (steerTools.has(use.name)) {\n const target = str(use.input.to) ?? str(use.input.recipient)\n if (target === null) continue\n const result = thread.calls.results.get(use.id)\n const structured = isRecord(result?.structured) ? result.structured : null\n // `success` is the harness confirming the message reached a live agent;\n // absent, the steer is counted queued but not delivered.\n const delivered = structured?.success === true || str(structured?.resumedAgentId) === target\n const rows = steersByTarget.get(target) ?? []\n rows.push({ requestId: use.id, at: use.at, delivered })\n steersByTarget.set(target, rows)\n continue\n }\n if (cancelTools.has(use.name)) {\n const target = str(use.input.agentId) ?? str(use.input.to) ?? str(use.input.taskId)\n if (target !== null) cancels.push({ agentId: target, at: use.at })\n }\n }\n settles.push(...thread.calls.notifications)\n }\n\n const spawnedIds = new Set(spawns.map((s) => s.agentId))\n const cancelledIds = new Set(\n cancels.filter((c) => spawnedIds.has(c.agentId)).map((c) => c.agentId),\n )\n const startedAt = main.firstAt\n const completedAt = main.lastAt\n\n const journalLines: string[] = [\n line({\n kind: 'spawned',\n id: sessionId,\n parent: null,\n label: `session:${sessionId}`,\n role: 'supervisor',\n at: startedAt,\n }),\n ]\n for (const s of spawns) {\n journalLines.push(\n line({\n kind: 'spawned',\n id: s.agentId,\n parent: s.parentId,\n label: s.label,\n role: 'worker',\n at: s.at,\n }),\n )\n }\n\n // Only the LAST notification per agent is its settle; an earlier one is a stop\n // the supervisor resumed from, which the steer count already records.\n const lastNotification = new Map<string, TaskNotification>()\n for (const n of settles) {\n if (!spawnedIds.has(n.taskId)) continue\n lastNotification.set(n.taskId, n)\n }\n for (const [agentId, n] of lastNotification) {\n if (cancelledIds.has(agentId)) continue\n journalLines.push(\n line({\n kind: 'settled',\n id: agentId,\n status: n.status,\n verdict: n.summary,\n at: n.at,\n // No `spent` key: Claude Code prices nothing, and a zeroed spend object\n // would read as a $0 worker. `limits.spendUsd` carries the reason.\n }),\n )\n }\n // One cancel per agent: Claude Code can emit a stop then a retry-stop for the\n // same agentId, and each raw entry would otherwise mint a duplicate `cancelled`\n // line that double-counts in `workersCancelled`. Keep the last, mirroring the\n // last-notification dedup the settle path already does.\n const lastCancel = new Map<string, { agentId: string; at: string | null }>()\n for (const c of cancels) {\n if (!spawnedIds.has(c.agentId)) continue\n lastCancel.set(c.agentId, c)\n }\n for (const c of lastCancel.values()) {\n journalLines.push(\n line({ kind: 'cancelled', id: c.agentId, reason: 'stopped by supervisor', at: c.at }),\n )\n }\n // `metered` carries the brain's own inference. The token counts are real; the\n // usd stays absent and `limits.spendUsd` explains why.\n if (\n mainTranscript.gaps.length === 0 &&\n mainTranscript.usage.tokensIn !== null &&\n mainTranscript.usage.tokensOut !== null &&\n mainTranscript.usage.cacheRead !== null &&\n mainTranscript.usage.cacheWrite !== null\n ) {\n journalLines.push(\n line({\n kind: 'metered',\n id: sessionId,\n spend: {\n tokens: {\n input: mainTranscript.usage.tokensIn,\n output: mainTranscript.usage.tokensOut,\n cacheRead: mainTranscript.usage.cacheRead,\n cacheWrite: mainTranscript.usage.cacheWrite,\n },\n },\n at: completedAt,\n }),\n )\n }\n\n const settleAtByAgent = new Map(\n [...lastNotification.entries()].map(([id, n]) => [id, n.at] as const),\n )\n const spawnAtByAgent = new Map(spawns.map((s) => [s.agentId, s.at] as const))\n\n const workers: WorkerLogSource[] = []\n for (const spawn of spawns) {\n const { agentId, label } = spawn\n const events: string[] = []\n const inbox: string[] = []\n const child = childByAgentId.get(agentId) ?? null\n const startAt = child?.firstAt ?? spawnAtByAgent.get(agentId) ?? null\n const endAt = settleAtByAgent.get(agentId) ?? child?.lastAt ?? null\n if (startAt !== null) events.push(line({ kind: 'started', label, at: startAt, agentId }))\n for (const steer of steersByTarget.get(agentId) ?? []) {\n inbox.push(line({ id: steer.requestId, at: steer.at, worker: label, message: 'steer' }))\n events.push(\n line({\n kind: 'message',\n label,\n direction: 'down',\n at: steer.at,\n requestId: steer.requestId,\n delivered: steer.delivered,\n }),\n )\n }\n if (endAt !== null) {\n events.push(\n line({\n kind: 'finished',\n label,\n at: endAt,\n agentId,\n // No `passed` / `patchBytes`: this harness has neither. Emitting\n // `passed: false` here would invent a failed worker.\n // `evidence` is the child's closing message — what it handed back.\n ...(child?.finalReport === null || child?.finalReport === undefined\n ? {}\n : { evidence: child.finalReport }),\n }),\n )\n }\n workers.push({\n workerId: agentId,\n label,\n events: events.length === 0 ? '' : `${events.join('\\n')}\\n`,\n inbox: inbox.length === 0 ? '' : `${inbox.join('\\n')}\\n`,\n patchBytes: null,\n transcriptRef: child?.path ?? null,\n patchPath: null,\n tokensIn: child?.tokensIn ?? null,\n tokensOut: child?.tokensOut ?? null,\n cacheRead: child?.cacheRead ?? null,\n cacheWrite: child?.cacheWrite ?? null,\n })\n }\n\n const joined = children.length\n const missingChildren = spawns.filter((spawn) => !childByAgentId.has(spawn.agentId)).length\n const incompleteChildren = children.filter(\n (child) =>\n child.gaps.length > 0 ||\n child.tokensIn === null ||\n child.tokensOut === null ||\n child.cacheRead === null ||\n child.cacheWrite === null,\n ).length\n const harnessMissingReason =\n subagentsDir === null\n ? 'subagent transcript join disabled'\n : joined === 0\n ? `no subagent transcripts under ${subagentsDir}`\n : missingChildren > 0\n ? `${missingChildren}/${spawns.length} spawned agents have no retained transcript under ${subagentsDir}`\n : incompleteChildren > 0\n ? `${incompleteChildren}/${joined} subagent transcripts have malformed lines or unknown usage`\n : null\n const harnessWorkerTokens =\n joined === 0 || incompleteChildren > 0\n ? null\n : {\n store: 'claude-code subagent transcripts',\n sessions: joined,\n input: children.reduce((a, child) => a + (child.tokensIn ?? 0), 0),\n output: children.reduce((a, child) => a + (child.tokensOut ?? 0), 0),\n cacheRead: children.reduce((a, child) => a + (child.cacheRead ?? 0), 0),\n cacheWrite: children.reduce((a, child) => a + (child.cacheWrite ?? 0), 0),\n }\n\n const liveWorkers = spawns.filter(\n (s) => !lastNotification.has(s.agentId) && !cancelledIds.has(s.agentId),\n ).length\n const state = JSON.stringify({\n id: sessionId,\n // Derived, not asserted: a spawned agent with no notification and no stop\n // is still running, which is exactly what a live transcript looks like.\n status: liveWorkers > 0 ? 'running' : 'idle',\n startedAt,\n completedAt,\n result: { delivered: null },\n })\n\n return {\n runRef,\n instanceId: opts.instanceId ?? sessionId,\n arm: opts.arm ?? null,\n supRunDir: subagentsDir,\n journal: `${journalLines.join('\\n')}\\n`,\n brainLog: null,\n state,\n progress: null,\n workers,\n workersMissingReason: null,\n result: null,\n judge: null,\n judgeSource: null,\n patch: null,\n driverLog: null,\n harnessWorkerTokens,\n harnessMissingReason,\n limits: {\n ...limits,\n managerTokens:\n mainTranscript.gaps.length > 0\n ? `main transcript has ${mainTranscript.gaps.length} parse or usage gaps`\n : null,\n workerTokens: spawns.length === 0 ? null : harnessMissingReason,\n deliverables: NO_DELIVERABLES,\n },\n rootTranscriptRef: opts.transcriptPath,\n traceCommand,\n }\n}\n\n/** A `SupervisorRunReader` over a Claude Code session — the same contract Runtime implements. */\nexport function claudeCodeSupervisorRunReader(opts: ClaudeCodeReaderOptions): SupervisorRunReader {\n return {\n runRef: opts.runRef ?? opts.transcriptPath,\n read: () => readClaudeCodeSupervisorRun(opts),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,MAAM,sBAAsB,CAAC,SAAS,MAAM;;AAE5C,M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EAGJ,QAAQ,cAAc,IAAI,YAAY;EACtC;EACA;EACA,QAAQ,EAAE,WAAW,KAAK;CAC5B,CAAC;CAED,OAAO;EACL;EACA,YAAY,KAAK,cAAc;EAC/B,KAAK,KAAK,OAAO;EACjB,WAAW;EACX,SAAS,GAAG,aAAa,KAAK,IAAI,EAAE;EACpC,UAAU;EACV;EACA,UAAU;EACV;EACA,sBAAsB;EACtB,QAAQ;EACR,OAAO;EACP,aAAa;EACb,OAAO;EACP,WAAW;EACX;EACA;EACA,QAAQ;GACN,GAAG;GACH,eACE,eAAe,KAAK,SAAS,IACzB,uBAAuB,eAAe,KAAK,OAAO,wBAClD;GACN,cAAc,OAAO,WAAW,IAAI,OAAO;GAC3C,cAAc;EAChB;EACA,mBAAmB,KAAK;EACxB;CACF;AACF;;AAGA,SAAgB,8BAA8B,MAAoD;CAChG,OAAO;EACL,QAAQ,KAAK,UAAU,KAAK;EAC5B,YAAY,4BAA4B,IAAI;CAC9C;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as AnalystFinding } from "./types-
|
|
1
|
+
import { i as AnalystFinding } from "./types-KEkKkETv.js";
|
|
2
2
|
import { f as SystemOneResult, o as SystemOneQuestions, u as SystemOneRequest } from "./systemone-protocol-DKoi1NdK.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/systemone-review.d.ts
|
|
@@ -73,4 +73,4 @@ declare function systemOneReviewFindings<Q extends SystemOneQuestions>(review: P
|
|
|
73
73
|
}): AnalystFinding[];
|
|
74
74
|
//#endregion
|
|
75
75
|
export { SystemOneReviewReport as a, systemOneReviewFindings as c, SystemOneReviewInput as i, SystemOneReviewAssessment as n, assessSystemOneReview as o, SystemOneReviewCheck as r, prepareSystemOneReview as s, PreparedSystemOneReview as t };
|
|
76
|
-
//# sourceMappingURL=systemone-review-
|
|
76
|
+
//# sourceMappingURL=systemone-review-BReh3mvm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemone-review-
|
|
1
|
+
{"version":3,"file":"systemone-review-BReh3mvm.d.ts","names":[],"sources":["../src/systemone-review.ts"],"mappings":";;;;cAcM,aAAW,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Bb,EAAA,KAAA;;KAGQ,uBAAuB,EAAE,aAAa;UACjC,qBAAqB,UAAU,qBAAqB;EACnE;EACA,SAAS,iBAAiB;EAC1B,WAAW,WAAW,IAAI;;UAGX,wBAAwB,UAAU,qBAAqB,4BAC9D,qBAAqB;;EAE7B;;UAGe;EACf;EACA;EACA;;EAQA;EACA;EACA;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA;EACA,aAAa;;;iBAWC,6BAA6B,UAAU,oBACrD,OAAO,qBAAqB,KAC3B,wBAAwB;;iBAuCX,sBAAsB,UAAU,oBAC9C,QAAQ,wBAAwB,IAChC,eACC;;iBAyDa,wBAAwB,UAAU,oBAChD,QAAQ,wBAAwB,IAChC,QAAQ,gBAAgB,IACxB;EAAW;EAAmB;IAC7B"}
|
package/dist/systemone.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { b as CustomTokenPricing, g as CostReceiptInput } from "./cost-ledger-DbQdN3nO.js";
|
|
2
|
-
import { i as AnalystFinding, n as AnalystContext, t as Analyst } from "./types-
|
|
3
|
-
import { R as Scenario, S as JudgeConfig, w as JudgeScore } from "./types-
|
|
2
|
+
import { i as AnalystFinding, n as AnalystContext, t as Analyst } from "./types-KEkKkETv.js";
|
|
3
|
+
import { R as Scenario, S as JudgeConfig, w as JudgeScore } from "./types-Dv9sYwBB.js";
|
|
4
4
|
import { EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, Evaluator, EvaluatorOptions, asAnalyst, asJudge, createEvaluator } from "./evaluation.js";
|
|
5
5
|
import { S as systemOneUsage, _ as parseSystemOneQuestions, a as SystemOneQuestion, b as parseSystemOneResult, c as SystemOneRecordedQuestions, d as SystemOneResponseError, f as SystemOneResult, g as normalizeSystemOneResult, h as SystemOneState, i as SystemOneJson, l as SystemOneRecordedRequest, m as SystemOneScoreCriteria, n as SystemOneAnswerFor, o as SystemOneQuestions, p as SystemOneResultProfile, r as SystemOneDescription, s as SystemOneRecordedQuestion, t as SystemOneAnswer, u as SystemOneRequest, v as parseSystemOneRecordedRequest, x as systemOneConfidence, y as parseSystemOneRequest } from "./systemone-protocol-DKoi1NdK.js";
|
|
6
|
-
import { a as SystemOneReviewReport, c as systemOneReviewFindings, i as SystemOneReviewInput, n as SystemOneReviewAssessment, o as assessSystemOneReview, r as SystemOneReviewCheck, s as prepareSystemOneReview, t as PreparedSystemOneReview } from "./systemone-review-
|
|
6
|
+
import { a as SystemOneReviewReport, c as systemOneReviewFindings, i as SystemOneReviewInput, n as SystemOneReviewAssessment, o as assessSystemOneReview, r as SystemOneReviewCheck, s as prepareSystemOneReview, t as PreparedSystemOneReview } from "./systemone-review-BReh3mvm.js";
|
|
7
7
|
//#region src/systemone.d.ts
|
|
8
8
|
export type SystemOneEvaluate = EvaluatorOptions<SystemOneRequest, unknown>['execute'];
|
|
9
9
|
export interface SystemOneEvaluatorOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as TraceAnalysisStore } from "./types-
|
|
2
|
-
import { h as TraceAnalysisToolDescriptor } from "./engine-
|
|
1
|
+
import { O as TraceAnalysisStore } from "./types-KEkKkETv.js";
|
|
2
|
+
import { h as TraceAnalysisToolDescriptor } from "./engine-D-YZ32ZJ.js";
|
|
3
3
|
//#region src/analyst/tool-groups.d.ts
|
|
4
4
|
/** Named tool sets. Kinds pass `tools: TRACE_TOOL_GROUPS.failureForensics` etc. */
|
|
5
5
|
type TraceToolGroupName =
|
|
@@ -25,4 +25,4 @@ type TraceToolGroupName =
|
|
|
25
25
|
declare function buildTraceToolsForGroup(group: TraceToolGroupName, store: TraceAnalysisStore): TraceAnalysisToolDescriptor[];
|
|
26
26
|
//#endregion
|
|
27
27
|
export { buildTraceToolsForGroup as n, TraceToolGroupName as t };
|
|
28
|
-
//# sourceMappingURL=tool-groups-
|
|
28
|
+
//# sourceMappingURL=tool-groups-v28A-ZAF.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-groups-v28A-ZAF.d.ts","names":[],"sources":["../src/analyst/tool-groups.ts"],"mappings":";;;;KAmBY;;;;;;;;;;;;;;;;;;;;iBAyDI,wBACd,OAAO,oBACP,OAAO,qBACN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as ValidationError } from "./errors-Dngq5h35.js";
|
|
2
2
|
import { r as pearsonR } from "./descriptive-CnU8Yq29.js";
|
|
3
3
|
import { r as continuousAgreement } from "./judge-calibration-N44V04Se.js";
|
|
4
|
-
import { a as hasCapturedToolArgs,
|
|
4
|
+
import { a as hasCapturedToolArgs, d as toolSpans, i as groupBy, r as argHash, s as llmSpans } from "./query-B1D1qp2Z.js";
|
|
5
5
|
import { a as classifyFailure, n as DEFAULT_RULES } from "./failure-taxonomy-CjabTATj.js";
|
|
6
6
|
//#region src/statistics/agreement-irr.ts
|
|
7
7
|
/**
|
|
@@ -518,4 +518,4 @@ function stringify(v) {
|
|
|
518
518
|
//#endregion
|
|
519
519
|
export { budgetBreachView as a, interRaterReliability as c, failureClusterView as i, computeToolUseMetrics as n, corpusInterRaterAgreement as o, judgeAgreementView as r, corpusInterRaterAgreementFromJudgeScores as s, toolWasteView as t };
|
|
520
520
|
|
|
521
|
-
//# sourceMappingURL=tool-waste-
|
|
521
|
+
//# sourceMappingURL=tool-waste-BYt5rdt8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-waste-x_E8h9Ih.js","names":["prev"],"sources":["../src/statistics/agreement-irr.ts","../src/pipelines/budget-breach.ts","../src/pipelines/failure-cluster.ts","../src/pipelines/judge-agreement.ts","../src/tool-use-metrics.ts","../src/pipelines/tool-waste.ts"],"sourcesContent":["import { ValidationError } from '../errors'\nimport {\n type ContinuousAgreement,\n type ContinuousAgreementOptions,\n continuousAgreement,\n} from '../judge-calibration'\nimport type { JudgeScore } from '../types'\n\n/**\n * Inter-rater reliability — Krippendorff's α under the squared-difference\n * metric, pooled across dimensions.\n *\n * Each inner array is one judge's scores. Items are matched by position\n * WITHIN a dimension: the k-th score a judge supplies carrying dimension\n * `d` is item k of `d`, and the ratings compared against each other are\n * the ones different judges gave to the same item. Every judge that scores\n * a dimension at all must supply the same number of scores for it —\n * ragged input cannot be aligned into items and throws rather than\n * comparing mismatched items.\n *\n * α = 1 − D_observed / D_expected: D_observed averages the squared\n * difference over within-item judge pairs, D_expected over every pair of\n * ratings irrespective of item. α = 1 is perfect agreement, 0 is chance,\n * negative is systematic disagreement.\n */\nexport function interRaterReliability(judgeScores: JudgeScore[][]): number {\n if (judgeScores.length < 2) return 1\n\n // dimension → one score sequence per judge, in that judge's supplied order.\n const perDimension = new Map<string, number[][]>()\n for (let judgeIndex = 0; judgeIndex < judgeScores.length; judgeIndex++) {\n for (const s of judgeScores[judgeIndex]!) {\n let byJudge = perDimension.get(s.dimension)\n if (byJudge === undefined) {\n byJudge = Array.from({ length: judgeScores.length }, () => [] as number[])\n perDimension.set(s.dimension, byJudge)\n }\n byJudge[judgeIndex]!.push(s.score)\n }\n }\n\n const allValues: number[] = []\n const pairDiffs: number[] = []\n\n for (const [dimension, byJudge] of perDimension) {\n const scoring = byJudge.filter((scores) => scores.length > 0)\n if (scoring.length < 2) continue\n const itemCount = scoring[0]!.length\n if (scoring.some((scores) => scores.length !== itemCount)) {\n throw new ValidationError(\n `interRaterReliability: dimension '${dimension}' has judges supplying ` +\n `${scoring.map((scores) => scores.length).join('/')} scores — items cannot be aligned`,\n )\n }\n for (let item = 0; item < itemCount; item++) {\n const ratings = scoring.map((scores) => scores[item]!)\n for (const v of ratings) allValues.push(v)\n for (let i = 0; i < ratings.length; i++) {\n for (let j = i + 1; j < ratings.length; j++) {\n pairDiffs.push((ratings[i]! - ratings[j]!) ** 2)\n }\n }\n }\n }\n\n if (pairDiffs.length === 0 || allValues.length < 2) return 1\n\n const observedDisagreement = pairDiffs.reduce((a, b) => a + b, 0) / pairDiffs.length\n\n // Expected disagreement from all possible pairings of values\n let expectedDisagreement = 0\n let expectedCount = 0\n for (let i = 0; i < allValues.length; i++) {\n for (let j = i + 1; j < allValues.length; j++) {\n expectedDisagreement += (allValues[i]! - allValues[j]!) ** 2\n expectedCount++\n }\n }\n expectedDisagreement = expectedCount > 0 ? expectedDisagreement / expectedCount : 0\n\n if (expectedDisagreement === 0) return 1\n return 1 - observedDisagreement / expectedDisagreement\n}\n\n// ── Corpus-wide inter-rater agreement ──────────────────────────────\n//\n// `interRaterReliability(judgeScores)` computes a within-item\n// Krippendorff α — multiple judges score *the same item* and we ask\n// \"how much do their scores agree on that item?\" Useful for a single\n// scenario, but it cannot answer \"how reliable are these judges across\n// the whole evaluation corpus?\"\n//\n// `corpusInterRaterAgreement` does the corpus-wide question properly.\n// Inputs are flat per-(item, judge, dimension) score records. For each\n// dimension we pivot to a complete [n_items × n_judges] matrix and feed\n// it to the ICC(2,1) + κ_w machinery already validated in\n// `judge-calibration.ts`. An overall pooled metric averages the\n// per-dimension ICC/κ across dimensions.\n\nexport interface CorpusScoreRecord {\n /** Stable identifier for the rated item (scenario, span, turn, …). */\n itemId: string\n /** Identifier for the judge that produced this score. */\n judgeName: string\n /** Dimension name (matches `JudgeScore.dimension`). */\n dimension: string\n /** Numeric score; must be finite. */\n score: number\n}\n\nexport interface CorpusAgreementPerDimension extends ContinuousAgreement {\n dimension: string\n /** Item IDs that contributed to this dimension's matrix (every judge scored them). */\n itemIds: string[]\n /** Judge IDs that contributed to this dimension's matrix. */\n judgeIds: string[]\n}\n\nexport interface CorpusAgreementReport {\n /** Per-dimension ICC(2,1) + κ_w + Pearson + Spearman + bootstrap CIs. */\n perDimension: CorpusAgreementPerDimension[]\n /** Mean ICC across dimensions (NaN if no dimension yielded a finite ICC). */\n overallIcc: number\n /** Mean weighted κ across dimensions (NaN if none finite). */\n overallWeightedKappa: number\n /** Dimensions evaluated (sorted). */\n dimensions: string[]\n /** Judges seen across the corpus (sorted). */\n judgeIds: string[]\n}\n\nexport interface CorpusAgreementOptions extends ContinuousAgreementOptions {\n /**\n * Restrict the audit to these dimensions. Default = every dimension\n * that appears in the input. A dimension named here but absent from\n * the input throws — silent omission would corrupt the overall metric.\n */\n dimensions?: string[]\n /**\n * Restrict the audit to these judges. Default = every judge that\n * appears in the input. A judge named here but absent from a\n * dimension throws (see \"fail loud\" below).\n */\n judges?: string[]\n}\n\n/**\n * Corpus-wide inter-rater agreement across N items × M judges × D dimensions.\n *\n * For each dimension, builds the [n_items][n_judges] matrix of scores\n * (keeping only items every judge rated on that dimension), then runs\n * `continuousAgreement` to get ICC(2,1), κ_w, Pearson, Spearman, and\n * bootstrap CIs. Reports a pooled mean across dimensions as a single\n * \"is this judge panel reliable on this corpus?\" number.\n *\n * Fail-loud contract:\n * - Empty input throws.\n * - Fewer than 2 judges or fewer than 2 items per dimension throws.\n * - A judge present in some dimensions but with zero scored items on\n * another dimension throws (would silently shrink the matrix).\n * - Duplicate (itemId, judgeName, dimension) records throw.\n */\nexport function corpusInterRaterAgreement(\n records: CorpusScoreRecord[],\n opts: CorpusAgreementOptions = {},\n): CorpusAgreementReport {\n if (records.length === 0) {\n throw new ValidationError('corpusInterRaterAgreement: no score records supplied')\n }\n\n const judgesSeen = new Set<string>()\n const dimsSeen = new Set<string>()\n // dimension → judge → itemId → score\n const grid = new Map<string, Map<string, Map<string, number>>>()\n\n for (const r of records) {\n if (!Number.isFinite(r.score)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: non-finite score for (item=${r.itemId}, judge=${r.judgeName}, dim=${r.dimension})`,\n )\n }\n judgesSeen.add(r.judgeName)\n dimsSeen.add(r.dimension)\n const byJudge = grid.get(r.dimension) ?? new Map<string, Map<string, number>>()\n const byItem = byJudge.get(r.judgeName) ?? new Map<string, number>()\n if (byItem.has(r.itemId)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: duplicate record for (item=${r.itemId}, judge=${r.judgeName}, dim=${r.dimension})`,\n )\n }\n byItem.set(r.itemId, r.score)\n byJudge.set(r.judgeName, byItem)\n grid.set(r.dimension, byJudge)\n }\n\n const targetDims = opts.dimensions ?? [...dimsSeen].sort()\n for (const d of targetDims) {\n if (!dimsSeen.has(d)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: dimension '${d}' was requested but no records carry it`,\n )\n }\n }\n const targetJudges = opts.judges ? [...opts.judges] : [...judgesSeen].sort()\n for (const j of targetJudges) {\n if (!judgesSeen.has(j)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: judge '${j}' was requested but produced no records`,\n )\n }\n }\n if (targetJudges.length < 2) {\n throw new ValidationError(\n `corpusInterRaterAgreement: need ≥2 judges, got ${targetJudges.length}`,\n )\n }\n\n const perDimension: CorpusAgreementPerDimension[] = []\n const iccs: number[] = []\n const kappas: number[] = []\n\n for (const dim of targetDims) {\n const byJudge = grid.get(dim)!\n // Fail loud: every requested judge must have scored ≥1 item on this dim.\n const judgeItemCounts: Record<string, number> = {}\n for (const j of targetJudges) {\n const m = byJudge.get(j)\n judgeItemCounts[j] = m?.size ?? 0\n }\n const emptyJudges = targetJudges.filter((j) => judgeItemCounts[j] === 0)\n if (emptyJudges.length > 0) {\n throw new ValidationError(\n `corpusInterRaterAgreement: dimension '${dim}' has no scores from judge(s) ${emptyJudges.join(', ')} (counts: ${JSON.stringify(judgeItemCounts)})`,\n )\n }\n\n // Items rated by *every* requested judge on this dim.\n let commonItems: Set<string> | null = null\n for (const j of targetJudges) {\n const ids = new Set(byJudge.get(j)!.keys())\n if (commonItems === null) {\n commonItems = ids\n } else {\n const prev: Set<string> = commonItems\n commonItems = new Set([...prev].filter((x) => ids.has(x)))\n }\n }\n const sortedItems = [...(commonItems ?? new Set<string>())].sort()\n if (sortedItems.length < 2) {\n throw new ValidationError(\n `corpusInterRaterAgreement: dimension '${dim}' has ${sortedItems.length} item(s) rated by all ${targetJudges.length} judges (need ≥2)`,\n )\n }\n\n const matrix: number[][] = sortedItems.map((itemId) =>\n targetJudges.map((j) => byJudge.get(j)!.get(itemId)!),\n )\n const agreement = continuousAgreement(matrix, opts)\n perDimension.push({\n ...agreement,\n dimension: dim,\n itemIds: sortedItems,\n judgeIds: [...targetJudges],\n })\n if (Number.isFinite(agreement.icc)) iccs.push(agreement.icc)\n if (Number.isFinite(agreement.weightedKappa)) kappas.push(agreement.weightedKappa)\n }\n\n const mean = (xs: number[]) =>\n xs.length === 0 ? Number.NaN : xs.reduce((a, b) => a + b, 0) / xs.length\n return {\n perDimension,\n overallIcc: mean(iccs),\n overallWeightedKappa: mean(kappas),\n dimensions: targetDims,\n judgeIds: targetJudges,\n }\n}\n\n/**\n * Convenience adapter for `JudgeScore[]` data keyed externally by item.\n *\n * Use when you have per-item arrays of `JudgeScore[]` (e.g. one\n * `ScenarioResult.judgeScores` per scenario) and want corpus-wide\n * agreement without manually flattening. `itemId` must be unique per\n * row of `itemsScores`.\n */\nexport function corpusInterRaterAgreementFromJudgeScores(\n itemsScores: Array<{ itemId: string; scores: JudgeScore[] }>,\n opts: CorpusAgreementOptions = {},\n): CorpusAgreementReport {\n const records: CorpusScoreRecord[] = []\n const seen = new Set<string>()\n for (const { itemId, scores } of itemsScores) {\n if (seen.has(itemId)) {\n throw new ValidationError(\n `corpusInterRaterAgreementFromJudgeScores: duplicate itemId '${itemId}'`,\n )\n }\n seen.add(itemId)\n for (const s of scores) {\n records.push({\n itemId,\n judgeName: s.judgeName,\n dimension: s.dimension,\n score: s.score,\n })\n }\n }\n return corpusInterRaterAgreement(records, opts)\n}\n","/**\n * BudgetBreachView — aggregates breach events across the corpus.\n *\n * Answers: which dimensions get hit most often? Which scenarios are\n * underbudgeted? Which variants trigger the most breaches?\n */\n\nimport type { BudgetSpec } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface BudgetBreachFinding {\n runId: string\n scenarioId: string\n variantId?: string\n dimension: keyof BudgetSpec\n limit: number\n consumed: number\n excessRatio: number\n timestamp: number\n}\n\nexport interface BudgetBreachReport {\n findings: BudgetBreachFinding[]\n byDimension: Record<string, number>\n byScenario: Record<string, number>\n byVariant: Record<string, number>\n totalRuns: number\n breachedRunRatio: number\n}\n\nexport async function budgetBreachView(\n store: TraceStore,\n options: { scenarioId?: string; variantId?: string } = {},\n): Promise<BudgetBreachReport> {\n const runs = await store.listRuns({\n scenarioId: options.scenarioId,\n variantId: options.variantId,\n })\n const findings: BudgetBreachFinding[] = []\n const byDimension: Record<string, number> = {}\n const byScenario: Record<string, number> = {}\n const byVariant: Record<string, number> = {}\n\n for (const run of runs) {\n const entries = await store.budget(run.runId)\n for (const e of entries) {\n if (!e.breached) continue\n const excessRatio = e.limit > 0 ? e.consumed / e.limit : Infinity\n findings.push({\n runId: run.runId,\n scenarioId: run.scenarioId,\n variantId: run.variantId,\n dimension: e.dimension,\n limit: e.limit,\n consumed: e.consumed,\n excessRatio,\n timestamp: e.timestamp,\n })\n byDimension[e.dimension] = (byDimension[e.dimension] ?? 0) + 1\n byScenario[run.scenarioId] = (byScenario[run.scenarioId] ?? 0) + 1\n if (run.variantId) byVariant[run.variantId] = (byVariant[run.variantId] ?? 0) + 1\n }\n }\n\n const breachedRuns = new Set(findings.map((f) => f.runId))\n return {\n findings,\n byDimension,\n byScenario,\n byVariant,\n totalRuns: runs.length,\n breachedRunRatio: runs.length > 0 ? breachedRuns.size / runs.length : 0,\n }\n}\n","/**\n * FailureClusterView — groups failed runs by (failureClass, triggerTool,\n * argHash-prefix) so weekly reviews can prioritize the top-N clusters.\n *\n * Each cluster includes: N runs, scenarios affected, representative\n * error message, a proposed mitigation hint (rule → action table).\n */\n\nimport { classifyFailure, DEFAULT_RULES, type FailureRule } from '../failure-taxonomy'\nimport { argHash, hasCapturedToolArgs, toolSpans } from '../trace/query'\nimport type { FailureClass, Span } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface FailureCluster {\n failureClass: FailureClass\n /** Tool name when the trigger was a tool span, else undefined. */\n toolName?: string\n /** First 16 chars of argHash — clusters similar args. */\n argPrefix?: string\n /**\n * Source dimension when the trigger was a judge span (e.g. `'format'`,\n * `'safety'`, `'correctness'`). Lets cross-template aggregators\n * group failures by the dimension that fired without overloading\n * `argPrefix`. Optional — clusters without this field deserialize cleanly.\n */\n dimension?: string\n runCount: number\n scenarioIds: string[]\n exampleError?: string\n exampleRunId: string\n}\n\nexport interface FailureClusterReport {\n clusters: FailureCluster[]\n totalFailures: number\n totalRuns: number\n}\n\nexport async function failureClusterView(\n store: TraceStore,\n options: { rules?: FailureRule[]; minClusterSize?: number } = {},\n): Promise<FailureClusterReport> {\n const rules = options.rules ?? DEFAULT_RULES\n const minSize = options.minClusterSize ?? 1\n const runs = await store.listRuns()\n\n type Key = string\n const clusters = new Map<Key, FailureCluster>()\n let totalFailures = 0\n\n for (const run of runs) {\n if (run.status === 'completed' && run.outcome?.pass !== false) continue\n totalFailures++\n const spans = await store.spans({ runId: run.runId })\n const events = await store.events({ runId: run.runId })\n const cls = classifyFailure({ run, spans, events }, rules)\n\n let toolName: string | undefined\n let argPrefix: string | undefined\n let dimension: string | undefined\n if (cls.triggerSpanId) {\n const trig = spans.find((s) => s.spanId === cls.triggerSpanId)\n if (trig?.kind === 'tool') {\n toolName = trig.toolName\n if (hasCapturedToolArgs(trig)) argPrefix = argHash(trig.args).slice(0, 16)\n } else if (trig?.kind === 'judge') {\n dimension = trig.dimension\n }\n }\n // Fallback: look at the last errored tool span\n if (!toolName) {\n const ts = await toolSpans(store, run.runId)\n const errored = ts.filter((t) => t.status === 'error').pop()\n if (errored) {\n toolName = errored.toolName\n if (hasCapturedToolArgs(errored)) argPrefix = argHash(errored.args).slice(0, 16)\n }\n }\n // Secondary signal: any judge span on the failed run carries a\n // dimension. Useful when the rule classified by judge score but\n // didn't surface the trigger span (or surfaced a non-judge span).\n if (!dimension) {\n const judge = spans.find((s) => s.kind === 'judge' && typeof s.dimension === 'string')\n if (judge?.kind === 'judge') dimension = judge.dimension\n }\n\n const key = `${cls.failureClass}|${toolName ?? ''}|${argPrefix ?? ''}|${dimension ?? ''}`\n let cluster = clusters.get(key)\n if (!cluster) {\n cluster = {\n failureClass: cls.failureClass,\n toolName,\n argPrefix,\n dimension,\n runCount: 0,\n scenarioIds: [],\n exampleRunId: run.runId,\n exampleError: firstErrorMessage(spans) ?? cls.reason,\n }\n clusters.set(key, cluster)\n }\n cluster.runCount++\n if (!cluster.scenarioIds.includes(run.scenarioId)) cluster.scenarioIds.push(run.scenarioId)\n }\n\n const arr = [...clusters.values()]\n .filter((c) => c.runCount >= minSize)\n .sort((a, b) => b.runCount - a.runCount)\n\n return { clusters: arr, totalFailures, totalRuns: runs.length }\n}\n\nfunction firstErrorMessage(spans: Span[]): string | undefined {\n const errored = spans.find((s) => s.status === 'error')\n return errored?.error\n}\n","/**\n * JudgeAgreementView — pairwise agreement between judges across the\n * corpus, grouped by dimension.\n *\n * Output drives two workflows:\n * - Judge robustness audit: \"does Claude agree with GPT at κ ≥ 0.6?\"\n * - Calibration tracking: κ vs golden human labels over time (by\n * providing a `humanGoldenJudgeId`).\n */\n\nimport { interRaterReliability, pearsonR } from '../statistics'\nimport type { JudgeSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface JudgePair {\n judgeA: string\n judgeB: string\n dimension: string\n /** Number of (targetSpanId, dimension) tuples both judges scored. */\n commonItems: number\n pearson: number\n krippendorff: number\n}\n\nexport interface JudgeAgreementReport {\n pairs: JudgePair[]\n dimensions: string[]\n judgeIds: string[]\n}\n\nexport async function judgeAgreementView(store: TraceStore): Promise<JudgeAgreementReport> {\n const all = (await store.spans({ kind: 'judge' })).filter(\n (s): s is JudgeSpan => s.kind === 'judge',\n )\n if (all.length === 0) return { pairs: [], dimensions: [], judgeIds: [] }\n\n const byDimension = new Map<string, JudgeSpan[]>()\n for (const s of all) {\n const arr = byDimension.get(s.dimension) ?? []\n arr.push(s)\n byDimension.set(s.dimension, arr)\n }\n\n const judgeIds = [...new Set(all.map((s) => s.judgeId))].sort()\n const pairs: JudgePair[] = []\n for (const [dim, spans] of byDimension) {\n const byJudge = new Map<string, Map<string, number>>()\n for (const s of spans) {\n const m = byJudge.get(s.judgeId) ?? new Map<string, number>()\n m.set(s.targetSpanId, s.score)\n byJudge.set(s.judgeId, m)\n }\n const judgesHere = [...byJudge.keys()]\n for (let i = 0; i < judgesHere.length; i++) {\n for (let j = i + 1; j < judgesHere.length; j++) {\n const judgeI = judgesHere[i]!\n const judgeJ = judgesHere[j]!\n const a = byJudge.get(judgeI)!\n const b = byJudge.get(judgeJ)!\n const common: Array<[number, number]> = []\n for (const [target, scoreA] of a) {\n const scoreB = b.get(target)\n if (scoreB !== undefined) common.push([scoreA, scoreB])\n }\n if (common.length < 2) continue\n const judgeScores = common.map(\n ([scoreA, scoreB]) =>\n [\n { judgeName: judgeI, dimension: dim, score: scoreA, reasoning: '' },\n { judgeName: judgeJ, dimension: dim, score: scoreB, reasoning: '' },\n ] as const,\n )\n const k = interRaterReliability(\n judgeScores[0]!.map((_, k2) => judgeScores.map((pair) => pair[k2]!)),\n )\n pairs.push({\n judgeA: judgeI,\n judgeB: judgeJ,\n dimension: dim,\n commonItems: common.length,\n pearson: pearsonR(\n common.map((c) => c[0]),\n common.map((c) => c[1]),\n ),\n krippendorff: k,\n })\n }\n }\n }\n\n return {\n pairs: pairs.sort((a, b) => b.commonItems - a.commonItems),\n dimensions: [...byDimension.keys()].sort(),\n judgeIds,\n }\n}\n","/**\n * Tool-use metrics — derived purely from trace data.\n *\n * No scoring assumptions: consumers supply optional ground-truth tool\n * selections per turn + optional \"information used downstream\" signals.\n * Without those, we still compute descriptive metrics (error rate,\n * retry rate, duplicate-call rate) that are useful on their own.\n */\n\nimport { argHash, groupBy, hasCapturedToolArgs, toolSpans } from './trace/query'\nimport type { Span } from './trace/schema'\nimport type { TraceStore } from './trace/store'\n\nexport interface ToolUseMetrics {\n runId: string\n totalCalls: number\n /** Calls whose arguments were captured and can be compared for duplication. */\n callsWithCapturedArgs: number\n byTool: Record<string, ToolStats>\n errorRate: number\n /** Ratio of captured-argument calls already seen with the same tool name and arguments. */\n duplicateRate: number\n /** Ratio of error calls followed by ≥1 retry on same tool. */\n retryRate: number\n /** Optional: of the calls agent made, fraction the evaluator marked as \"correct selection\". */\n selectionAccuracy?: number\n}\n\nexport interface ToolStats {\n calls: number\n callsWithCapturedArgs: number\n errors: number\n avgLatencyMs: number\n duplicates: number\n}\n\nexport interface ToolUseOptions {\n /** Map of spanId → whether the evaluator judged the tool selection correct. Optional. */\n selectionLabels?: Record<string, boolean>\n}\n\nexport async function computeToolUseMetrics(\n store: TraceStore,\n runId: string,\n options: ToolUseOptions = {},\n): Promise<ToolUseMetrics> {\n const tools = await toolSpans(store, runId)\n if (tools.length === 0) {\n return {\n runId,\n totalCalls: 0,\n callsWithCapturedArgs: 0,\n byTool: {},\n errorRate: 0,\n duplicateRate: 0,\n retryRate: 0,\n }\n }\n\n const byTool: Record<string, ToolStats> = {}\n let totalErrors = 0\n let totalDuplicates = 0\n let callsWithCapturedArgs = 0\n const sortedTools = [...tools].sort((a, b) => a.startedAt - b.startedAt)\n const seenSignatures = new Set<string>()\n\n // duplicate detection + per-tool aggregation\n for (const t of sortedTools) {\n byTool[t.toolName] ??= {\n calls: 0,\n callsWithCapturedArgs: 0,\n errors: 0,\n avgLatencyMs: 0,\n duplicates: 0,\n }\n const stat = byTool[t.toolName]!\n stat.calls += 1\n if (t.status === 'error') {\n stat.errors += 1\n totalErrors += 1\n }\n if (typeof t.latencyMs === 'number') stat.avgLatencyMs += t.latencyMs\n if (hasCapturedToolArgs(t)) {\n callsWithCapturedArgs += 1\n stat.callsWithCapturedArgs += 1\n const sig = `${t.toolName}|${argHash(t.args)}`\n if (seenSignatures.has(sig)) {\n stat.duplicates += 1\n totalDuplicates += 1\n }\n seenSignatures.add(sig)\n }\n }\n\n for (const stat of Object.values(byTool)) {\n stat.avgLatencyMs = stat.calls > 0 ? stat.avgLatencyMs / stat.calls : 0\n }\n\n // retry detection: per-tool chronological adjacency where error → next same-tool call\n let retryOpportunities = 0\n let retriesFollowed = 0\n for (const [, arr] of groupBy(sortedTools, (t) => t.toolName)) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i]!.status !== 'error') continue\n retryOpportunities += 1\n if (arr[i + 1]) retriesFollowed += 1\n }\n }\n const retryRate = retryOpportunities > 0 ? retriesFollowed / retryOpportunities : 0\n\n let selectionAccuracy: number | undefined\n if (options.selectionLabels) {\n const labeled = sortedTools.filter((t) => t.spanId in options.selectionLabels!)\n if (labeled.length > 0) {\n selectionAccuracy =\n labeled.filter((t) => options.selectionLabels![t.spanId]).length / labeled.length\n }\n }\n\n return {\n runId,\n totalCalls: sortedTools.length,\n callsWithCapturedArgs,\n byTool,\n errorRate: totalErrors / sortedTools.length,\n duplicateRate: callsWithCapturedArgs > 0 ? totalDuplicates / callsWithCapturedArgs : 0,\n retryRate,\n selectionAccuracy,\n }\n}\n\nexport type { Span }\n","/**\n * ToolWasteView — fraction of tool calls whose results weren't used\n * downstream. Without a \"used\" signal we fall back to structural\n * proxies: error calls, duplicate calls, and tool calls followed by\n * zero subsequent LLM spans are all considered waste.\n *\n * Consumers can pass a `usageOracle` that inspects a tool span and\n * returns true iff the tool's result appears in a later LLM message,\n * artifact, or state mutation — that's the canonical definition; the\n * default heuristic is a reasonable fallback.\n */\n\nimport { computeToolUseMetrics } from '../tool-use-metrics'\nimport { llmSpans, toolSpans } from '../trace/query'\nimport type { LlmSpan, ToolSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface ToolWasteFinding {\n runId: string\n wastedCalls: number\n totalCalls: number\n wasteRate: number\n}\n\nexport interface ToolWasteReport {\n byRun: ToolWasteFinding[]\n overallWasteRate: number\n}\n\nexport interface ToolWasteOptions {\n runId?: string\n usageOracle?: (tool: ToolSpan, later: { llm: Awaited<ReturnType<typeof llmSpans>> }) => boolean\n}\n\nexport async function toolWasteView(\n store: TraceStore,\n options: ToolWasteOptions = {},\n): Promise<ToolWasteReport> {\n const runs = options.runId ? [options.runId] : (await store.listRuns()).map((r) => r.runId)\n\n const byRun: ToolWasteFinding[] = []\n let totalCalls = 0\n let totalWasted = 0\n for (const runId of runs) {\n const tools = await toolSpans(store, runId)\n if (tools.length === 0) {\n byRun.push({ runId, wastedCalls: 0, totalCalls: 0, wasteRate: 0 })\n continue\n }\n const llms = await llmSpans(store, runId)\n // Sort LLM spans once by start time, then build a suffix index of the\n // concatenated message text. `suffixText[i]` is the haystack of every\n // string message content in spans[i..]. Per tool we binary-search the\n // first span started strictly after the tool, then test that one suffix\n // — turning the per-tool O(llms × messages × content) scan into a single\n // O(log llms) lookup over precomputed text.\n const sortedLlm = [...llms].sort((a, b) => a.startedAt - b.startedAt)\n const startTimes = sortedLlm.map((l) => l.startedAt)\n const suffixText = buildSuffixText(sortedLlm)\n let wasted = 0\n for (const t of tools) {\n if (t.status === 'error') {\n wasted++\n continue\n }\n // First LLM span started strictly after this tool (upper-bound search).\n const cutoff = upperBound(startTimes, t.startedAt)\n if (options.usageOracle) {\n if (!options.usageOracle(t, { llm: sortedLlm.slice(cutoff) })) wasted++\n } else {\n // Default heuristic: a tool whose result is NOT mentioned in any\n // later LLM input message is likely wasted. An empty/null result has\n // no payload to propagate downstream — there is nothing to find in a\n // later message, so it is not evidence of waste; skip it.\n const resultStr = stringify(t.result)\n if (resultStr === '') continue\n const haystack = suffixText[cutoff] ?? ''\n const used = haystack.includes(resultStr.slice(0, 120))\n if (!used) wasted++\n }\n }\n const wasteRate = wasted / tools.length\n byRun.push({ runId, wastedCalls: wasted, totalCalls: tools.length, wasteRate })\n totalCalls += tools.length\n totalWasted += wasted\n }\n return { byRun, overallWasteRate: totalCalls > 0 ? totalWasted / totalCalls : 0 }\n}\n\n/**\n * Build per-position suffix haystacks: result[i] is the concatenation of every\n * string message content in spans[i..end]. Built back-to-front so each entry\n * reuses the next one — O(total message text) rather than O(spans²).\n */\nfunction buildSuffixText(spans: LlmSpan[]): string[] {\n const result = new Array<string>(spans.length + 1)\n result[spans.length] = ''\n for (let i = spans.length - 1; i >= 0; i--) {\n const own = spans[i]!.messages.map((m) =>\n typeof m.content === 'string' ? m.content : '',\n ).join('\\n')\n result[i] = `${own}\\n${result[i + 1]}`\n }\n return result\n}\n\n/** Index of the first element strictly greater than `target` in a sorted array. */\nfunction upperBound(sorted: number[], target: number): number {\n let lo = 0\n let hi = sorted.length\n while (lo < hi) {\n const mid = (lo + hi) >>> 1\n if (sorted[mid]! <= target) lo = mid + 1\n else hi = mid\n }\n return lo\n}\n\nfunction stringify(v: unknown): string {\n if (v === null || v === undefined) return ''\n if (typeof v === 'string') return v\n try {\n return JSON.stringify(v)\n } catch {\n return String(v)\n }\n}\n\n// Re-export for convenience in consumers that want both descriptive and usage metrics.\nexport { computeToolUseMetrics }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,sBAAsB,aAAqC;CACzE,IAAI,YAAY,SAAS,GAAG,OAAO;CAGnC,MAAM,+BAAe,IAAI,IAAwB;CACjD,KAAK,IAAI,aAAa,GAAG,aAAa,YAAY,QAAQ,cACxD,KAAK,MAAM,KAAK,YAAY,aAAc;EACxC,IAAI,UAAU,aAAa,IAAI,EAAE,SAAS;EAC1C,IAAI,YAAY,KAAA,GAAW;GACzB,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,OAAO,SAAS,CAAC,CAAa;GACzE,aAAa,IAAI,EAAE,WAAW,OAAO;EACvC;EACA,QAAQ,WAAW,CAAE,KAAK,EAAE,KAAK;CACnC;CAGF,MAAM,YAAsB,CAAC;CAC7B,MAAM,YAAsB,CAAC;CAE7B,KAAK,MAAM,CAAC,WAAW,YAAY,cAAc;EAC/C,MAAM,UAAU,QAAQ,QAAQ,WAAW,OAAO,SAAS,CAAC;EAC5D,IAAI,QAAQ,SAAS,GAAG;EACxB,MAAM,YAAY,QAAQ,EAAE,CAAE;EAC9B,I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AChB,OAAO,KAAK,IAAI;EACd,MAAM,MAAO,KAAK,OAAQ;EAC1B,IAAI,OAAO,QAAS,QAAQ,KAAK,MAAM;OAClC,KAAK;CACZ;CACA,OAAO;AACT;AAEA,SAAS,UAAU,GAAoB;CACrC,IAAI,MAAM,QAAQ,MAAM,KAAA,GAAW,OAAO;CAC1C,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,IAAI;EACF,OAAO,KAAK,UAAU,CAAC;CACzB,QAAQ;EACN,OAAO,OAAO,CAAC;CACjB;AACF"}
|
|
1
|
+
{"version":3,"file":"tool-waste-BYt5rdt8.js","names":["prev"],"sources":["../src/statistics/agreement-irr.ts","../src/pipelines/budget-breach.ts","../src/pipelines/failure-cluster.ts","../src/pipelines/judge-agreement.ts","../src/tool-use-metrics.ts","../src/pipelines/tool-waste.ts"],"sourcesContent":["import { ValidationError } from '../errors'\nimport {\n type ContinuousAgreement,\n type ContinuousAgreementOptions,\n continuousAgreement,\n} from '../judge-calibration'\nimport type { JudgeScore } from '../types'\n\n/**\n * Inter-rater reliability — Krippendorff's α under the squared-difference\n * metric, pooled across dimensions.\n *\n * Each inner array is one judge's scores. Items are matched by position\n * WITHIN a dimension: the k-th score a judge supplies carrying dimension\n * `d` is item k of `d`, and the ratings compared against each other are\n * the ones different judges gave to the same item. Every judge that scores\n * a dimension at all must supply the same number of scores for it —\n * ragged input cannot be aligned into items and throws rather than\n * comparing mismatched items.\n *\n * α = 1 − D_observed / D_expected: D_observed averages the squared\n * difference over within-item judge pairs, D_expected over every pair of\n * ratings irrespective of item. α = 1 is perfect agreement, 0 is chance,\n * negative is systematic disagreement.\n */\nexport function interRaterReliability(judgeScores: JudgeScore[][]): number {\n if (judgeScores.length < 2) return 1\n\n // dimension → one score sequence per judge, in that judge's supplied order.\n const perDimension = new Map<string, number[][]>()\n for (let judgeIndex = 0; judgeIndex < judgeScores.length; judgeIndex++) {\n for (const s of judgeScores[judgeIndex]!) {\n let byJudge = perDimension.get(s.dimension)\n if (byJudge === undefined) {\n byJudge = Array.from({ length: judgeScores.length }, () => [] as number[])\n perDimension.set(s.dimension, byJudge)\n }\n byJudge[judgeIndex]!.push(s.score)\n }\n }\n\n const allValues: number[] = []\n const pairDiffs: number[] = []\n\n for (const [dimension, byJudge] of perDimension) {\n const scoring = byJudge.filter((scores) => scores.length > 0)\n if (scoring.length < 2) continue\n const itemCount = scoring[0]!.length\n if (scoring.some((scores) => scores.length !== itemCount)) {\n throw new ValidationError(\n `interRaterReliability: dimension '${dimension}' has judges supplying ` +\n `${scoring.map((scores) => scores.length).join('/')} scores — items cannot be aligned`,\n )\n }\n for (let item = 0; item < itemCount; item++) {\n const ratings = scoring.map((scores) => scores[item]!)\n for (const v of ratings) allValues.push(v)\n for (let i = 0; i < ratings.length; i++) {\n for (let j = i + 1; j < ratings.length; j++) {\n pairDiffs.push((ratings[i]! - ratings[j]!) ** 2)\n }\n }\n }\n }\n\n if (pairDiffs.length === 0 || allValues.length < 2) return 1\n\n const observedDisagreement = pairDiffs.reduce((a, b) => a + b, 0) / pairDiffs.length\n\n // Expected disagreement from all possible pairings of values\n let expectedDisagreement = 0\n let expectedCount = 0\n for (let i = 0; i < allValues.length; i++) {\n for (let j = i + 1; j < allValues.length; j++) {\n expectedDisagreement += (allValues[i]! - allValues[j]!) ** 2\n expectedCount++\n }\n }\n expectedDisagreement = expectedCount > 0 ? expectedDisagreement / expectedCount : 0\n\n if (expectedDisagreement === 0) return 1\n return 1 - observedDisagreement / expectedDisagreement\n}\n\n// ── Corpus-wide inter-rater agreement ──────────────────────────────\n//\n// `interRaterReliability(judgeScores)` computes a within-item\n// Krippendorff α — multiple judges score *the same item* and we ask\n// \"how much do their scores agree on that item?\" Useful for a single\n// scenario, but it cannot answer \"how reliable are these judges across\n// the whole evaluation corpus?\"\n//\n// `corpusInterRaterAgreement` does the corpus-wide question properly.\n// Inputs are flat per-(item, judge, dimension) score records. For each\n// dimension we pivot to a complete [n_items × n_judges] matrix and feed\n// it to the ICC(2,1) + κ_w machinery already validated in\n// `judge-calibration.ts`. An overall pooled metric averages the\n// per-dimension ICC/κ across dimensions.\n\nexport interface CorpusScoreRecord {\n /** Stable identifier for the rated item (scenario, span, turn, …). */\n itemId: string\n /** Identifier for the judge that produced this score. */\n judgeName: string\n /** Dimension name (matches `JudgeScore.dimension`). */\n dimension: string\n /** Numeric score; must be finite. */\n score: number\n}\n\nexport interface CorpusAgreementPerDimension extends ContinuousAgreement {\n dimension: string\n /** Item IDs that contributed to this dimension's matrix (every judge scored them). */\n itemIds: string[]\n /** Judge IDs that contributed to this dimension's matrix. */\n judgeIds: string[]\n}\n\nexport interface CorpusAgreementReport {\n /** Per-dimension ICC(2,1) + κ_w + Pearson + Spearman + bootstrap CIs. */\n perDimension: CorpusAgreementPerDimension[]\n /** Mean ICC across dimensions (NaN if no dimension yielded a finite ICC). */\n overallIcc: number\n /** Mean weighted κ across dimensions (NaN if none finite). */\n overallWeightedKappa: number\n /** Dimensions evaluated (sorted). */\n dimensions: string[]\n /** Judges seen across the corpus (sorted). */\n judgeIds: string[]\n}\n\nexport interface CorpusAgreementOptions extends ContinuousAgreementOptions {\n /**\n * Restrict the audit to these dimensions. Default = every dimension\n * that appears in the input. A dimension named here but absent from\n * the input throws — silent omission would corrupt the overall metric.\n */\n dimensions?: string[]\n /**\n * Restrict the audit to these judges. Default = every judge that\n * appears in the input. A judge named here but absent from a\n * dimension throws (see \"fail loud\" below).\n */\n judges?: string[]\n}\n\n/**\n * Corpus-wide inter-rater agreement across N items × M judges × D dimensions.\n *\n * For each dimension, builds the [n_items][n_judges] matrix of scores\n * (keeping only items every judge rated on that dimension), then runs\n * `continuousAgreement` to get ICC(2,1), κ_w, Pearson, Spearman, and\n * bootstrap CIs. Reports a pooled mean across dimensions as a single\n * \"is this judge panel reliable on this corpus?\" number.\n *\n * Fail-loud contract:\n * - Empty input throws.\n * - Fewer than 2 judges or fewer than 2 items per dimension throws.\n * - A judge present in some dimensions but with zero scored items on\n * another dimension throws (would silently shrink the matrix).\n * - Duplicate (itemId, judgeName, dimension) records throw.\n */\nexport function corpusInterRaterAgreement(\n records: CorpusScoreRecord[],\n opts: CorpusAgreementOptions = {},\n): CorpusAgreementReport {\n if (records.length === 0) {\n throw new ValidationError('corpusInterRaterAgreement: no score records supplied')\n }\n\n const judgesSeen = new Set<string>()\n const dimsSeen = new Set<string>()\n // dimension → judge → itemId → score\n const grid = new Map<string, Map<string, Map<string, number>>>()\n\n for (const r of records) {\n if (!Number.isFinite(r.score)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: non-finite score for (item=${r.itemId}, judge=${r.judgeName}, dim=${r.dimension})`,\n )\n }\n judgesSeen.add(r.judgeName)\n dimsSeen.add(r.dimension)\n const byJudge = grid.get(r.dimension) ?? new Map<string, Map<string, number>>()\n const byItem = byJudge.get(r.judgeName) ?? new Map<string, number>()\n if (byItem.has(r.itemId)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: duplicate record for (item=${r.itemId}, judge=${r.judgeName}, dim=${r.dimension})`,\n )\n }\n byItem.set(r.itemId, r.score)\n byJudge.set(r.judgeName, byItem)\n grid.set(r.dimension, byJudge)\n }\n\n const targetDims = opts.dimensions ?? [...dimsSeen].sort()\n for (const d of targetDims) {\n if (!dimsSeen.has(d)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: dimension '${d}' was requested but no records carry it`,\n )\n }\n }\n const targetJudges = opts.judges ? [...opts.judges] : [...judgesSeen].sort()\n for (const j of targetJudges) {\n if (!judgesSeen.has(j)) {\n throw new ValidationError(\n `corpusInterRaterAgreement: judge '${j}' was requested but produced no records`,\n )\n }\n }\n if (targetJudges.length < 2) {\n throw new ValidationError(\n `corpusInterRaterAgreement: need ≥2 judges, got ${targetJudges.length}`,\n )\n }\n\n const perDimension: CorpusAgreementPerDimension[] = []\n const iccs: number[] = []\n const kappas: number[] = []\n\n for (const dim of targetDims) {\n const byJudge = grid.get(dim)!\n // Fail loud: every requested judge must have scored ≥1 item on this dim.\n const judgeItemCounts: Record<string, number> = {}\n for (const j of targetJudges) {\n const m = byJudge.get(j)\n judgeItemCounts[j] = m?.size ?? 0\n }\n const emptyJudges = targetJudges.filter((j) => judgeItemCounts[j] === 0)\n if (emptyJudges.length > 0) {\n throw new ValidationError(\n `corpusInterRaterAgreement: dimension '${dim}' has no scores from judge(s) ${emptyJudges.join(', ')} (counts: ${JSON.stringify(judgeItemCounts)})`,\n )\n }\n\n // Items rated by *every* requested judge on this dim.\n let commonItems: Set<string> | null = null\n for (const j of targetJudges) {\n const ids = new Set(byJudge.get(j)!.keys())\n if (commonItems === null) {\n commonItems = ids\n } else {\n const prev: Set<string> = commonItems\n commonItems = new Set([...prev].filter((x) => ids.has(x)))\n }\n }\n const sortedItems = [...(commonItems ?? new Set<string>())].sort()\n if (sortedItems.length < 2) {\n throw new ValidationError(\n `corpusInterRaterAgreement: dimension '${dim}' has ${sortedItems.length} item(s) rated by all ${targetJudges.length} judges (need ≥2)`,\n )\n }\n\n const matrix: number[][] = sortedItems.map((itemId) =>\n targetJudges.map((j) => byJudge.get(j)!.get(itemId)!),\n )\n const agreement = continuousAgreement(matrix, opts)\n perDimension.push({\n ...agreement,\n dimension: dim,\n itemIds: sortedItems,\n judgeIds: [...targetJudges],\n })\n if (Number.isFinite(agreement.icc)) iccs.push(agreement.icc)\n if (Number.isFinite(agreement.weightedKappa)) kappas.push(agreement.weightedKappa)\n }\n\n const mean = (xs: number[]) =>\n xs.length === 0 ? Number.NaN : xs.reduce((a, b) => a + b, 0) / xs.length\n return {\n perDimension,\n overallIcc: mean(iccs),\n overallWeightedKappa: mean(kappas),\n dimensions: targetDims,\n judgeIds: targetJudges,\n }\n}\n\n/**\n * Convenience adapter for `JudgeScore[]` data keyed externally by item.\n *\n * Use when you have per-item arrays of `JudgeScore[]` (e.g. one\n * `ScenarioResult.judgeScores` per scenario) and want corpus-wide\n * agreement without manually flattening. `itemId` must be unique per\n * row of `itemsScores`.\n */\nexport function corpusInterRaterAgreementFromJudgeScores(\n itemsScores: Array<{ itemId: string; scores: JudgeScore[] }>,\n opts: CorpusAgreementOptions = {},\n): CorpusAgreementReport {\n const records: CorpusScoreRecord[] = []\n const seen = new Set<string>()\n for (const { itemId, scores } of itemsScores) {\n if (seen.has(itemId)) {\n throw new ValidationError(\n `corpusInterRaterAgreementFromJudgeScores: duplicate itemId '${itemId}'`,\n )\n }\n seen.add(itemId)\n for (const s of scores) {\n records.push({\n itemId,\n judgeName: s.judgeName,\n dimension: s.dimension,\n score: s.score,\n })\n }\n }\n return corpusInterRaterAgreement(records, opts)\n}\n","/**\n * BudgetBreachView — aggregates breach events across the corpus.\n *\n * Answers: which dimensions get hit most often? Which scenarios are\n * underbudgeted? Which variants trigger the most breaches?\n */\n\nimport type { BudgetSpec } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface BudgetBreachFinding {\n runId: string\n scenarioId: string\n variantId?: string\n dimension: keyof BudgetSpec\n limit: number\n consumed: number\n excessRatio: number\n timestamp: number\n}\n\nexport interface BudgetBreachReport {\n findings: BudgetBreachFinding[]\n byDimension: Record<string, number>\n byScenario: Record<string, number>\n byVariant: Record<string, number>\n totalRuns: number\n breachedRunRatio: number\n}\n\nexport async function budgetBreachView(\n store: TraceStore,\n options: { scenarioId?: string; variantId?: string } = {},\n): Promise<BudgetBreachReport> {\n const runs = await store.listRuns({\n scenarioId: options.scenarioId,\n variantId: options.variantId,\n })\n const findings: BudgetBreachFinding[] = []\n const byDimension: Record<string, number> = {}\n const byScenario: Record<string, number> = {}\n const byVariant: Record<string, number> = {}\n\n for (const run of runs) {\n const entries = await store.budget(run.runId)\n for (const e of entries) {\n if (!e.breached) continue\n const excessRatio = e.limit > 0 ? e.consumed / e.limit : Infinity\n findings.push({\n runId: run.runId,\n scenarioId: run.scenarioId,\n variantId: run.variantId,\n dimension: e.dimension,\n limit: e.limit,\n consumed: e.consumed,\n excessRatio,\n timestamp: e.timestamp,\n })\n byDimension[e.dimension] = (byDimension[e.dimension] ?? 0) + 1\n byScenario[run.scenarioId] = (byScenario[run.scenarioId] ?? 0) + 1\n if (run.variantId) byVariant[run.variantId] = (byVariant[run.variantId] ?? 0) + 1\n }\n }\n\n const breachedRuns = new Set(findings.map((f) => f.runId))\n return {\n findings,\n byDimension,\n byScenario,\n byVariant,\n totalRuns: runs.length,\n breachedRunRatio: runs.length > 0 ? breachedRuns.size / runs.length : 0,\n }\n}\n","/**\n * FailureClusterView — groups failed runs by (failureClass, triggerTool,\n * argHash-prefix) so weekly reviews can prioritize the top-N clusters.\n *\n * Each cluster includes: N runs, scenarios affected, representative\n * error message, a proposed mitigation hint (rule → action table).\n */\n\nimport { classifyFailure, DEFAULT_RULES, type FailureRule } from '../failure-taxonomy'\nimport { argHash, hasCapturedToolArgs, toolSpans } from '../trace/query'\nimport type { FailureClass, Span } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface FailureCluster {\n failureClass: FailureClass\n /** Tool name when the trigger was a tool span, else undefined. */\n toolName?: string\n /** First 16 chars of argHash — clusters similar args. */\n argPrefix?: string\n /**\n * Source dimension when the trigger was a judge span (e.g. `'format'`,\n * `'safety'`, `'correctness'`). Lets cross-template aggregators\n * group failures by the dimension that fired without overloading\n * `argPrefix`. Optional — clusters without this field deserialize cleanly.\n */\n dimension?: string\n runCount: number\n scenarioIds: string[]\n exampleError?: string\n exampleRunId: string\n}\n\nexport interface FailureClusterReport {\n clusters: FailureCluster[]\n totalFailures: number\n totalRuns: number\n}\n\nexport async function failureClusterView(\n store: TraceStore,\n options: { rules?: FailureRule[]; minClusterSize?: number } = {},\n): Promise<FailureClusterReport> {\n const rules = options.rules ?? DEFAULT_RULES\n const minSize = options.minClusterSize ?? 1\n const runs = await store.listRuns()\n\n type Key = string\n const clusters = new Map<Key, FailureCluster>()\n let totalFailures = 0\n\n for (const run of runs) {\n if (run.status === 'completed' && run.outcome?.pass !== false) continue\n totalFailures++\n const spans = await store.spans({ runId: run.runId })\n const events = await store.events({ runId: run.runId })\n const cls = classifyFailure({ run, spans, events }, rules)\n\n let toolName: string | undefined\n let argPrefix: string | undefined\n let dimension: string | undefined\n if (cls.triggerSpanId) {\n const trig = spans.find((s) => s.spanId === cls.triggerSpanId)\n if (trig?.kind === 'tool') {\n toolName = trig.toolName\n if (hasCapturedToolArgs(trig)) argPrefix = argHash(trig.args).slice(0, 16)\n } else if (trig?.kind === 'judge') {\n dimension = trig.dimension\n }\n }\n // Fallback: look at the last errored tool span\n if (!toolName) {\n const ts = await toolSpans(store, run.runId)\n const errored = ts.filter((t) => t.status === 'error').pop()\n if (errored) {\n toolName = errored.toolName\n if (hasCapturedToolArgs(errored)) argPrefix = argHash(errored.args).slice(0, 16)\n }\n }\n // Secondary signal: any judge span on the failed run carries a\n // dimension. Useful when the rule classified by judge score but\n // didn't surface the trigger span (or surfaced a non-judge span).\n if (!dimension) {\n const judge = spans.find((s) => s.kind === 'judge' && typeof s.dimension === 'string')\n if (judge?.kind === 'judge') dimension = judge.dimension\n }\n\n const key = `${cls.failureClass}|${toolName ?? ''}|${argPrefix ?? ''}|${dimension ?? ''}`\n let cluster = clusters.get(key)\n if (!cluster) {\n cluster = {\n failureClass: cls.failureClass,\n toolName,\n argPrefix,\n dimension,\n runCount: 0,\n scenarioIds: [],\n exampleRunId: run.runId,\n exampleError: firstErrorMessage(spans) ?? cls.reason,\n }\n clusters.set(key, cluster)\n }\n cluster.runCount++\n if (!cluster.scenarioIds.includes(run.scenarioId)) cluster.scenarioIds.push(run.scenarioId)\n }\n\n const arr = [...clusters.values()]\n .filter((c) => c.runCount >= minSize)\n .sort((a, b) => b.runCount - a.runCount)\n\n return { clusters: arr, totalFailures, totalRuns: runs.length }\n}\n\nfunction firstErrorMessage(spans: Span[]): string | undefined {\n const errored = spans.find((s) => s.status === 'error')\n return errored?.error\n}\n","/**\n * JudgeAgreementView — pairwise agreement between judges across the\n * corpus, grouped by dimension.\n *\n * Output drives two workflows:\n * - Judge robustness audit: \"does Claude agree with GPT at κ ≥ 0.6?\"\n * - Calibration tracking: κ vs golden human labels over time (by\n * providing a `humanGoldenJudgeId`).\n */\n\nimport { interRaterReliability, pearsonR } from '../statistics'\nimport type { JudgeSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface JudgePair {\n judgeA: string\n judgeB: string\n dimension: string\n /** Number of (targetSpanId, dimension) tuples both judges scored. */\n commonItems: number\n pearson: number\n krippendorff: number\n}\n\nexport interface JudgeAgreementReport {\n pairs: JudgePair[]\n dimensions: string[]\n judgeIds: string[]\n}\n\nexport async function judgeAgreementView(store: TraceStore): Promise<JudgeAgreementReport> {\n const all = (await store.spans({ kind: 'judge' })).filter(\n (s): s is JudgeSpan => s.kind === 'judge',\n )\n if (all.length === 0) return { pairs: [], dimensions: [], judgeIds: [] }\n\n const byDimension = new Map<string, JudgeSpan[]>()\n for (const s of all) {\n const arr = byDimension.get(s.dimension) ?? []\n arr.push(s)\n byDimension.set(s.dimension, arr)\n }\n\n const judgeIds = [...new Set(all.map((s) => s.judgeId))].sort()\n const pairs: JudgePair[] = []\n for (const [dim, spans] of byDimension) {\n const byJudge = new Map<string, Map<string, number>>()\n for (const s of spans) {\n const m = byJudge.get(s.judgeId) ?? new Map<string, number>()\n m.set(s.targetSpanId, s.score)\n byJudge.set(s.judgeId, m)\n }\n const judgesHere = [...byJudge.keys()]\n for (let i = 0; i < judgesHere.length; i++) {\n for (let j = i + 1; j < judgesHere.length; j++) {\n const judgeI = judgesHere[i]!\n const judgeJ = judgesHere[j]!\n const a = byJudge.get(judgeI)!\n const b = byJudge.get(judgeJ)!\n const common: Array<[number, number]> = []\n for (const [target, scoreA] of a) {\n const scoreB = b.get(target)\n if (scoreB !== undefined) common.push([scoreA, scoreB])\n }\n if (common.length < 2) continue\n const judgeScores = common.map(\n ([scoreA, scoreB]) =>\n [\n { judgeName: judgeI, dimension: dim, score: scoreA, reasoning: '' },\n { judgeName: judgeJ, dimension: dim, score: scoreB, reasoning: '' },\n ] as const,\n )\n const k = interRaterReliability(\n judgeScores[0]!.map((_, k2) => judgeScores.map((pair) => pair[k2]!)),\n )\n pairs.push({\n judgeA: judgeI,\n judgeB: judgeJ,\n dimension: dim,\n commonItems: common.length,\n pearson: pearsonR(\n common.map((c) => c[0]),\n common.map((c) => c[1]),\n ),\n krippendorff: k,\n })\n }\n }\n }\n\n return {\n pairs: pairs.sort((a, b) => b.commonItems - a.commonItems),\n dimensions: [...byDimension.keys()].sort(),\n judgeIds,\n }\n}\n","/**\n * Tool-use metrics — derived purely from trace data.\n *\n * No scoring assumptions: consumers supply optional ground-truth tool\n * selections per turn + optional \"information used downstream\" signals.\n * Without those, we still compute descriptive metrics (error rate,\n * retry rate, duplicate-call rate) that are useful on their own.\n */\n\nimport { argHash, groupBy, hasCapturedToolArgs, toolSpans } from './trace/query'\nimport type { Span } from './trace/schema'\nimport type { TraceStore } from './trace/store'\n\nexport interface ToolUseMetrics {\n runId: string\n totalCalls: number\n /** Calls whose arguments were captured and can be compared for duplication. */\n callsWithCapturedArgs: number\n byTool: Record<string, ToolStats>\n errorRate: number\n /** Ratio of captured-argument calls already seen with the same tool name and arguments. */\n duplicateRate: number\n /** Ratio of error calls followed by ≥1 retry on same tool. */\n retryRate: number\n /** Optional: of the calls agent made, fraction the evaluator marked as \"correct selection\". */\n selectionAccuracy?: number\n}\n\nexport interface ToolStats {\n calls: number\n callsWithCapturedArgs: number\n errors: number\n avgLatencyMs: number\n duplicates: number\n}\n\nexport interface ToolUseOptions {\n /** Map of spanId → whether the evaluator judged the tool selection correct. Optional. */\n selectionLabels?: Record<string, boolean>\n}\n\nexport async function computeToolUseMetrics(\n store: TraceStore,\n runId: string,\n options: ToolUseOptions = {},\n): Promise<ToolUseMetrics> {\n const tools = await toolSpans(store, runId)\n if (tools.length === 0) {\n return {\n runId,\n totalCalls: 0,\n callsWithCapturedArgs: 0,\n byTool: {},\n errorRate: 0,\n duplicateRate: 0,\n retryRate: 0,\n }\n }\n\n const byTool: Record<string, ToolStats> = {}\n let totalErrors = 0\n let totalDuplicates = 0\n let callsWithCapturedArgs = 0\n const sortedTools = [...tools].sort((a, b) => a.startedAt - b.startedAt)\n const seenSignatures = new Set<string>()\n\n // duplicate detection + per-tool aggregation\n for (const t of sortedTools) {\n byTool[t.toolName] ??= {\n calls: 0,\n callsWithCapturedArgs: 0,\n errors: 0,\n avgLatencyMs: 0,\n duplicates: 0,\n }\n const stat = byTool[t.toolName]!\n stat.calls += 1\n if (t.status === 'error') {\n stat.errors += 1\n totalErrors += 1\n }\n if (typeof t.latencyMs === 'number') stat.avgLatencyMs += t.latencyMs\n if (hasCapturedToolArgs(t)) {\n callsWithCapturedArgs += 1\n stat.callsWithCapturedArgs += 1\n const sig = `${t.toolName}|${argHash(t.args)}`\n if (seenSignatures.has(sig)) {\n stat.duplicates += 1\n totalDuplicates += 1\n }\n seenSignatures.add(sig)\n }\n }\n\n for (const stat of Object.values(byTool)) {\n stat.avgLatencyMs = stat.calls > 0 ? stat.avgLatencyMs / stat.calls : 0\n }\n\n // retry detection: per-tool chronological adjacency where error → next same-tool call\n let retryOpportunities = 0\n let retriesFollowed = 0\n for (const [, arr] of groupBy(sortedTools, (t) => t.toolName)) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i]!.status !== 'error') continue\n retryOpportunities += 1\n if (arr[i + 1]) retriesFollowed += 1\n }\n }\n const retryRate = retryOpportunities > 0 ? retriesFollowed / retryOpportunities : 0\n\n let selectionAccuracy: number | undefined\n if (options.selectionLabels) {\n const labeled = sortedTools.filter((t) => t.spanId in options.selectionLabels!)\n if (labeled.length > 0) {\n selectionAccuracy =\n labeled.filter((t) => options.selectionLabels![t.spanId]).length / labeled.length\n }\n }\n\n return {\n runId,\n totalCalls: sortedTools.length,\n callsWithCapturedArgs,\n byTool,\n errorRate: totalErrors / sortedTools.length,\n duplicateRate: callsWithCapturedArgs > 0 ? totalDuplicates / callsWithCapturedArgs : 0,\n retryRate,\n selectionAccuracy,\n }\n}\n\nexport type { Span }\n","/**\n * ToolWasteView — fraction of tool calls whose results weren't used\n * downstream. Without a \"used\" signal we fall back to structural\n * proxies: error calls, duplicate calls, and tool calls followed by\n * zero subsequent LLM spans are all considered waste.\n *\n * Consumers can pass a `usageOracle` that inspects a tool span and\n * returns true iff the tool's result appears in a later LLM message,\n * artifact, or state mutation — that's the canonical definition; the\n * default heuristic is a reasonable fallback.\n */\n\nimport { computeToolUseMetrics } from '../tool-use-metrics'\nimport { llmSpans, toolSpans } from '../trace/query'\nimport type { LlmSpan, ToolSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nexport interface ToolWasteFinding {\n runId: string\n wastedCalls: number\n totalCalls: number\n wasteRate: number\n}\n\nexport interface ToolWasteReport {\n byRun: ToolWasteFinding[]\n overallWasteRate: number\n}\n\nexport interface ToolWasteOptions {\n runId?: string\n usageOracle?: (tool: ToolSpan, later: { llm: Awaited<ReturnType<typeof llmSpans>> }) => boolean\n}\n\nexport async function toolWasteView(\n store: TraceStore,\n options: ToolWasteOptions = {},\n): Promise<ToolWasteReport> {\n const runs = options.runId ? [options.runId] : (await store.listRuns()).map((r) => r.runId)\n\n const byRun: ToolWasteFinding[] = []\n let totalCalls = 0\n let totalWasted = 0\n for (const runId of runs) {\n const tools = await toolSpans(store, runId)\n if (tools.length === 0) {\n byRun.push({ runId, wastedCalls: 0, totalCalls: 0, wasteRate: 0 })\n continue\n }\n const llms = await llmSpans(store, runId)\n // Sort LLM spans once by start time, then build a suffix index of the\n // concatenated message text. `suffixText[i]` is the haystack of every\n // string message content in spans[i..]. Per tool we binary-search the\n // first span started strictly after the tool, then test that one suffix\n // — turning the per-tool O(llms × messages × content) scan into a single\n // O(log llms) lookup over precomputed text.\n const sortedLlm = [...llms].sort((a, b) => a.startedAt - b.startedAt)\n const startTimes = sortedLlm.map((l) => l.startedAt)\n const suffixText = buildSuffixText(sortedLlm)\n let wasted = 0\n for (const t of tools) {\n if (t.status === 'error') {\n wasted++\n continue\n }\n // First LLM span started strictly after this tool (upper-bound search).\n const cutoff = upperBound(startTimes, t.startedAt)\n if (options.usageOracle) {\n if (!options.usageOracle(t, { llm: sortedLlm.slice(cutoff) })) wasted++\n } else {\n // Default heuristic: a tool whose result is NOT mentioned in any\n // later LLM input message is likely wasted. An empty/null result has\n // no payload to propagate downstream — there is nothing to find in a\n // later message, so it is not evidence of waste; skip it.\n const resultStr = stringify(t.result)\n if (resultStr === '') continue\n const haystack = suffixText[cutoff] ?? ''\n const used = haystack.includes(resultStr.slice(0, 120))\n if (!used) wasted++\n }\n }\n const wasteRate = wasted / tools.length\n byRun.push({ runId, wastedCalls: wasted, totalCalls: tools.length, wasteRate })\n totalCalls += tools.length\n totalWasted += wasted\n }\n return { byRun, overallWasteRate: totalCalls > 0 ? totalWasted / totalCalls : 0 }\n}\n\n/**\n * Build per-position suffix haystacks: result[i] is the concatenation of every\n * string message content in spans[i..end]. Built back-to-front so each entry\n * reuses the next one — O(total message text) rather than O(spans²).\n */\nfunction buildSuffixText(spans: LlmSpan[]): string[] {\n const result = new Array<string>(spans.length + 1)\n result[spans.length] = ''\n for (let i = spans.length - 1; i >= 0; i--) {\n const own = spans[i]!.messages.map((m) =>\n typeof m.content === 'string' ? m.content : '',\n ).join('\\n')\n result[i] = `${own}\\n${result[i + 1]}`\n }\n return result\n}\n\n/** Index of the first element strictly greater than `target` in a sorted array. */\nfunction upperBound(sorted: number[], target: number): number {\n let lo = 0\n let hi = sorted.length\n while (lo < hi) {\n const mid = (lo + hi) >>> 1\n if (sorted[mid]! <= target) lo = mid + 1\n else hi = mid\n }\n return lo\n}\n\nfunction stringify(v: unknown): string {\n if (v === null || v === undefined) return ''\n if (typeof v === 'string') return v\n try {\n return JSON.stringify(v)\n } catch {\n return String(v)\n }\n}\n\n// Re-export for convenience in consumers that want both descriptive and usage metrics.\nexport { computeToolUseMetrics }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,sBAAsB,aAAqC;CACzE,IAAI,YAAY,SAAS,GAAG,OAAO;CAGnC,MAAM,+BAAe,IAAI,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Q;EAAU,CAAC;EAC9E,cAAc,MAAM;EACpB,eAAe;CACjB;CACA,OAAO;EAAE;EAAO,kBAAkB,aAAa,IAAI,cAAc,aAAa;CAAE;AAClF;;;;;;AAOA,SAAS,gBAAgB,OAA4B;CACnD,MAAM,SAAS,IAAI,MAAc,MAAM,SAAS,CAAC;CACjD,OAAO,MAAM,UAAU;CACvB,KAAK,IAAI,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;EAC1C,MAAM,MAAM,MAAM,EAAE,CAAE,SAAS,KAAK,MAClC,OAAO,EAAE,YAAY,WAAW,EAAE,UAAU,EAC9C,CAAC,CAAC,KAAK,IAAI;EACX,OAAO,KAAK,GAAG,IAAI,IAAI,OAAO,IAAI;CACpC;CACA,OAAO;AACT;;AAGA,SAAS,WAAW,QAAkB,QAAwB;CAC5D,IAAI,KAAK;CACT,IAAI,KAAK,OAAO;CAChB,OAAO,KAAK,IAAI;EACd,MAAM,MAAO,KAAK,OAAQ;EAC1B,IAAI,OAAO,QAAS,QAAQ,KAAK,MAAM;OAClC,KAAK;CACZ;CACA,OAAO;AACT;AAEA,SAAS,UAAU,GAAoB;CACrC,IAAI,MAAM,QAAQ,MAAM,KAAA,GAAW,OAAO;CAC1C,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,IAAI;EACF,OAAO,KAAK,UAAU,CAAC;CACzB,QAAQ;EACN,OAAO,OAAO,CAAC;CACjB;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as ToolSpan, r as BudgetSpec } from "./schema-2g7trUwH.js";
|
|
2
2
|
import { s as TraceStore } from "./store-C4avFjIi.js";
|
|
3
|
-
import {
|
|
3
|
+
import { c as llmSpans } from "./query-DK1nWcmp.js";
|
|
4
4
|
//#region src/baseline.d.ts
|
|
5
5
|
interface MetricVerdict {
|
|
6
6
|
metric: string;
|
|
@@ -165,4 +165,4 @@ interface ToolWasteOptions {
|
|
|
165
165
|
declare function toolWasteView(store: TraceStore, options?: ToolWasteOptions): Promise<ToolWasteReport>;
|
|
166
166
|
//#endregion
|
|
167
167
|
export { WelchTestResult as _, ToolStats as a, welchsTTest as b, computeToolUseMetrics as c, judgeAgreementView as d, BudgetBreachFinding as f, BaselineReport as g, BaselineOptions as h, toolWasteView as i, JudgeAgreementReport as l, budgetBreachView as m, ToolWasteOptions as n, ToolUseMetrics as o, BudgetBreachReport as p, ToolWasteReport as r, ToolUseOptions as s, ToolWasteFinding as t, JudgePair as u, WelchTestStatus as v, iqr as y };
|
|
168
|
-
//# sourceMappingURL=tool-waste-
|
|
168
|
+
//# sourceMappingURL=tool-waste-Wi4g6Ekb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-waste-
|
|
1
|
+
{"version":3,"file":"tool-waste-Wi4g6Ekb.d.ts","names":[],"sources":["../src/baseline.ts","../src/pipelines/budget-breach.ts","../src/pipelines/judge-agreement.ts","../src/tool-use-metrics.ts","../src/pipelines/tool-waste.ts"],"mappings":";;;;UA6BiB;EACf;EACA;EACA;EACA;;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EACA;;UAGe;EACf,SAAS;;EAET;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;KAGU;;;;;;;;;UAUF;EACR;EACA;EACA;;KAGU,mBACP;EACC;EACA;EACA;EACA;EACA;EACA;EACA;MAED;EACC;EACA;EACA;EACA;EACA;EACA;EACA;;;iBA6EU,IAAI;;;;;;;;;iBAcJ,YAAY,aAAa,cAAc;;;UCjLtC;EACf;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;;UAGe;EACf,UAAU;EACV,aAAa;EACb,YAAY;EACZ,WAAW;EACX;EACA;;iBAGoB,iBACpB,OAAO,YACP;EAAW;EAAqB;IAC/B,QAAQ;;;UCnBM;EACf;EACA;EACA;;EAEA;EACA;EACA;;UAGe;EACf,OAAO;EACP;EACA;;iBAGoB,mBAAmB,OAAO,aAAa,QAAQ;;;UCjBpD;EACf;EACA;;EAEA;EACA,QAAQ,eAAe;EACvB;;EAEA;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;;EAEf,kBAAkB;;iBAGE,sBACpB,OAAO,YACP,eACA,UAAS,iBACR,QAAQ;;;UC5BM;EACf;EACA;EACA;EACA;;UAGe;EACf,OAAO;EACP;;UAGe;EACf;EACA,eAAe,MAAM,UAAU;IAAS,KAAK,QAAQ,kBAAkB;;;iBAGnD,cACpB,OAAO,YACP,UAAS,mBACR,QAAQ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as CostLedgerHandle } from "./cost-ledger-DbQdN3nO.js";
|
|
2
|
-
import { O as TraceAnalysisStore } from "./types-
|
|
3
|
-
import { a as TraceAnalystLimits, l as RawAnalystFinding, n as TraceAnalysisEngine } from "./engine-
|
|
2
|
+
import { O as TraceAnalysisStore } from "./types-KEkKkETv.js";
|
|
3
|
+
import { a as TraceAnalystLimits, l as RawAnalystFinding, n as TraceAnalysisEngine } from "./engine-D-YZ32ZJ.js";
|
|
4
4
|
//#region src/analyst/trace-questions.d.ts
|
|
5
5
|
/** One question to ask of the store. */
|
|
6
6
|
interface TraceQuestionSpec {
|
|
@@ -65,4 +65,4 @@ declare function askTraceQuestions(opts: AskTraceQuestionsOptions): Promise<Trac
|
|
|
65
65
|
declare function citedSpansOnly(store: TraceAnalysisStore, allowed: ReadonlyMap<string, ReadonlySet<string>>): TraceAnalysisStore;
|
|
66
66
|
//#endregion
|
|
67
67
|
export { askTraceQuestions as a, VerifiedTraceFinding as i, TraceQuestionOutcome as n, citedSpansOnly as o, TraceQuestionSpec as r, AskTraceQuestionsOptions as t };
|
|
68
|
-
//# sourceMappingURL=trace-questions-
|
|
68
|
+
//# sourceMappingURL=trace-questions-C26UvI3D.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-questions-
|
|
1
|
+
{"version":3,"file":"trace-questions-C26UvI3D.d.ts","names":[],"sources":["../src/analyst/trace-questions.ts"],"mappings":";;;;;UA6BiB;;WAEN;WACA;;WAEA;;UAGM;WACN,oBAAoB;WACpB,OAAO;WACP,QAAQ;;WAER,YAAY;;WAEZ;;WAEA;;WAEA;;WAEA;;WAEA;WACA,SAAS,QAAQ;WACjB,SAAS;WACT,OAAO,iBAAiB,SAAS;;;UAI3B;WACN,SAAS;;WAET;;WAEA;;WAEA;;UAGM;WACN;WACA;WACA;WACA;;WAEA;WACA,mBAAmB;;WAEnB;WACA;;;;;;;iBAyBW,kBACpB,MAAM,2BACL,QAAQ;;;;;iBA2JK,eACd,OAAO,oBACP,SAAS,oBAAoB,uBAC5B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as CaptureIntegrityError } from "../errors-DEE6u6ot.js";
|
|
2
2
|
import { b as CustomTokenPricing, c as CostLedgerHandle, p as CostProvenance } from "../cost-ledger-DbQdN3nO.js";
|
|
3
|
-
import { d as RunTokenUsage } from "../run-record-
|
|
3
|
+
import { d as RunTokenUsage } from "../run-record-p2AYTrCn.js";
|
|
4
4
|
import { t as DefaultVerdict } from "../verdict-E4eRNf7-.js";
|
|
5
|
-
import { a as TraceAnalystLimits, n as TraceAnalysisEngine } from "../engine-
|
|
5
|
+
import { a as TraceAnalystLimits, n as TraceAnalysisEngine } from "../engine-D-YZ32ZJ.js";
|
|
6
6
|
import { t as PrimeBridgeTransport } from "../prime-bridge-transport-6feEglLf.js";
|
|
7
7
|
import { a as RecordedTrajectoryStep, h as isRecordedTimeout } from "../steps-Bg5-KVx1.js";
|
|
8
8
|
//#region src/trace-repair/mini-swe-scaffold.d.ts
|
|
@@ -93,13 +93,6 @@ interface InterventionBudget {
|
|
|
93
93
|
}
|
|
94
94
|
/** The scaffold's own per-action budget, pre-registered for the campaign. */
|
|
95
95
|
export declare const SCAFFOLD_INTERVENTION_BUDGET: InterventionBudget;
|
|
96
|
-
/**
|
|
97
|
-
* Actions whose only effect is to consume a turn. They are rejected before a
|
|
98
|
-
* container opens: an intervention that changes nothing is measurably
|
|
99
|
-
* identical to the no-op control, and paying rollouts to rediscover that
|
|
100
|
-
* wastes the corpus.
|
|
101
|
-
*/
|
|
102
|
-
export declare const NO_OP_ACTIONS: readonly string[];
|
|
103
96
|
/**
|
|
104
97
|
* Split a shell script into top-level statements and count its heredocs.
|
|
105
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["RepairArm"],"sources":["../../src/trace-repair/mini-swe-scaffold.ts","../../src/trace-repair/action-budget.ts","../../src/trace-repair/continuation-records.ts","../../src/trace-repair/control-policy.ts","../../src/trace-repair/admission-records.ts","../../src/trace-repair/continuation-policy.ts","../../src/trace-repair/oracle-determinism.ts","../../src/trace-repair/admission.ts","../../src/trace-repair/admission-contract.ts","../../src/trace-repair/admission-report.ts","../../src/trace-repair/analyst-response.ts","../../src/trace-repair/blinding.ts","../../src/trace-repair/analyst-arm.ts","../../src/trace-repair/arm-completion.ts","../../src/trace-repair/arm-dspy.ts","../../src/trace-repair/degenerate-strategies.ts","../../src/trace-repair/ports.ts","../../src/trace-repair/funnel.ts","../../src/trace-repair/grade.ts","../../src/trace-repair/delta-repair.ts","../../src/trace-repair/docker-environment.ts","../../src/trace-repair/repair-prompt.ts","../../src/trace-repair/test-oracle.ts"],"mappings":";;;;;;;;;qBAyBa;;qBAGA;qBAKA;UAiBI;;EAEf;;;;;EAKA;;;wBAIc,sBAAsB,OAAO;KAiFjC;EACN;EAAgB;;EAChB;EAAsB;;;;;;;wBASZ,YAAY,2BAA2B;UAMtC;EACf;EACA;;EAEA;;;;;;;wBAQc,kBAAkB,QAAQ;;wBAsB1B,yBAAyB,iBAAiB;;wBAS1C,6BAA6B;;;;;;wBAyB7B,aAAa,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;KCxMzB;UAEK;;WAEN;;WAEA;;WAEA;;;qBAIE,8BAA8B
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["RepairArm"],"sources":["../../src/trace-repair/mini-swe-scaffold.ts","../../src/trace-repair/action-budget.ts","../../src/trace-repair/continuation-records.ts","../../src/trace-repair/control-policy.ts","../../src/trace-repair/admission-records.ts","../../src/trace-repair/continuation-policy.ts","../../src/trace-repair/oracle-determinism.ts","../../src/trace-repair/admission.ts","../../src/trace-repair/admission-contract.ts","../../src/trace-repair/admission-report.ts","../../src/trace-repair/analyst-response.ts","../../src/trace-repair/blinding.ts","../../src/trace-repair/analyst-arm.ts","../../src/trace-repair/arm-completion.ts","../../src/trace-repair/arm-dspy.ts","../../src/trace-repair/degenerate-strategies.ts","../../src/trace-repair/ports.ts","../../src/trace-repair/funnel.ts","../../src/trace-repair/grade.ts","../../src/trace-repair/delta-repair.ts","../../src/trace-repair/docker-environment.ts","../../src/trace-repair/repair-prompt.ts","../../src/trace-repair/test-oracle.ts"],"mappings":";;;;;;;;;qBAyBa;;qBAGA;qBAKA;UAiBI;;EAEf;;;;;EAKA;;;wBAIc,sBAAsB,OAAO;KAiFjC;EACN;EAAgB;;EAChB;EAAsB;;;;;;;wBASZ,YAAY,2BAA2B;UAMtC;EACf;EACA;;EAEA;;;;;;;wBAQc,kBAAkB,QAAQ;;wBAsB1B,yBAAyB,iBAAiB;;wBAS1C,6BAA6B;;;;;;wBAyB7B,aAAa,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;KCxMzB;UAEK;;WAEN;;WAEA;;WAEA;;;qBAIE,8BAA8B;;;;;;;;;;wBA4C3B,gBAAgB;EAAmB;EAAsB;;;;wBA8QzD,sBAAsB,iBAAiB;;;KAM3C;UAQK;EACf;EACA;EACA;;EAEA,SAAS;;EAET,UAAU;;KAGA;WACG;WAA2B,aAAa;;WAExC;WACA,WAAW;WACX;WACA,aAAa;;;;;;;;;;;;;;;wBAqBZ,wBACd,gBACA,cAAc,mBACd,SAAQ,qBACP;;;;;;wBA8Da,6BAA6B;;;;KCtcjC;;UAGK;EACf;EACA;;;KAIU;UAOK;EACf;EACA;;EAEA;EACA;EACA;;UAGe;;EAEf;EACA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