@tangle-network/agent-eval 0.182.0 → 0.184.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 +32 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-cell-s__adRnK.d.ts → agent-profile-cell-BHcB-mZX.d.ts} +8 -9
- package/dist/{agent-profile-cell-s__adRnK.d.ts.map → agent-profile-cell-BHcB-mZX.d.ts.map} +1 -1
- package/dist/{agent-profile-cell-Cv6UA-W_.js → agent-profile-cell-DcFW4vOc.js} +16 -15
- package/dist/agent-profile-cell-DcFW4vOc.js.map +1 -0
- package/dist/{agent-profile-CivaSsSy.d.ts → agent-profile-uAIQK3Nr.d.ts} +3 -3
- package/dist/{agent-profile-CivaSsSy.d.ts.map → agent-profile-uAIQK3Nr.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +10 -10
- package/dist/analyst/index.js +10 -9
- package/dist/analyst/index.js.map +1 -1
- package/dist/{benchmark-DQKzykkO.js → benchmark-BeQJyrRC.js} +3 -3
- package/dist/{benchmark-DQKzykkO.js.map → benchmark-BeQJyrRC.js.map} +1 -1
- package/dist/{benchmark-command-7X7HPNHh.js → benchmark-command-DlSePljH.js} +16 -15
- package/dist/{benchmark-command-7X7HPNHh.js.map → benchmark-command-DlSePljH.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +3 -3
- package/dist/builder-eval/index.js +1 -1
- package/dist/campaign/index.d.ts +6 -5
- package/dist/campaign/index.js +9 -9
- package/dist/{campaign-B2U7WcFz.js → campaign-D6puiGFO.js} +16 -16
- package/dist/{campaign-B2U7WcFz.js.map → campaign-D6puiGFO.js.map} +1 -1
- package/dist/{campaign-evidence-PYPUftRy.js → campaign-evidence-aWEmfROB.js} +5 -5
- package/dist/{campaign-evidence-PYPUftRy.js.map → campaign-evidence-aWEmfROB.js.map} +1 -1
- package/dist/{canonical-DPyQ_rpt.js → canonical-BsZVgBhW.js} +2 -4
- package/dist/canonical-BsZVgBhW.js.map +1 -0
- package/dist/{chat-client-CkmjYlfB.js → chat-client-DqPqWzVV.js} +2 -2
- package/dist/{chat-client-CkmjYlfB.js.map → chat-client-DqPqWzVV.js.map} +1 -1
- package/dist/{chat-json-call-B_Xv2oJK.js → chat-json-call-C-DnDxEy.js} +2 -2
- package/dist/{chat-json-call-B_Xv2oJK.js.map → chat-json-call-C-DnDxEy.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/{client-kh2jOjTK.d.ts → client-Bc8LANCG.d.ts} +4 -4
- package/dist/{client-kh2jOjTK.d.ts.map → client-Bc8LANCG.d.ts.map} +1 -1
- package/dist/contract/index.d.ts +10 -10
- package/dist/contract/index.js +17 -17
- package/dist/{cost-ledger-B1qx30B4.js → cost-ledger-_IbkejCF.js} +2 -2
- package/dist/{cost-ledger-B1qx30B4.js.map → cost-ledger-_IbkejCF.js.map} +1 -1
- package/dist/{default-registry-DHWwIwa8.js → default-registry-CpLko4jB.js} +5 -4
- package/dist/{default-registry-DHWwIwa8.js.map → default-registry-CpLko4jB.js.map} +1 -1
- package/dist/{default-registry-BwDSWVzg.d.ts → default-registry-DYB4aHVn.d.ts} +6 -6
- package/dist/{default-registry-BwDSWVzg.d.ts.map → default-registry-DYB4aHVn.d.ts.map} +1 -1
- package/dist/{define-agent-eval-CwOWWQt_.d.ts → define-agent-eval-DE67ECH1.d.ts} +7 -7
- package/dist/{define-agent-eval-CwOWWQt_.d.ts.map → define-agent-eval-DE67ECH1.d.ts.map} +1 -1
- package/dist/{define-agent-eval-DSIPB4hi.js → define-agent-eval-RTekxhUE.js} +8 -8
- package/dist/{define-agent-eval-DSIPB4hi.js.map → define-agent-eval-RTekxhUE.js.map} +1 -1
- package/dist/{dspy-rlm-engine-S53V0HhE.js → dspy-rlm-engine-Da-l3CpD.js} +4 -4
- package/dist/{dspy-rlm-engine-S53V0HhE.js.map → dspy-rlm-engine-Da-l3CpD.js.map} +1 -1
- package/dist/{engine-DS1cysJy.d.ts → engine-D1ykrAKR.d.ts} +7 -7
- package/dist/{engine-DS1cysJy.d.ts.map → engine-D1ykrAKR.d.ts.map} +1 -1
- package/dist/{eval-campaign-CCEkwzoH.js → eval-campaign-XFHEpN86.js} +4 -4
- package/dist/{eval-campaign-CCEkwzoH.js.map → eval-campaign-XFHEpN86.js.map} +1 -1
- package/dist/evaluation.d.ts +75 -0
- package/dist/evaluation.d.ts.map +1 -0
- package/dist/evaluation.js +137 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/{exact-types-BZDe0W2D.d.ts → exact-types-BEHN7tnq.d.ts} +2 -2
- package/dist/{exact-types-BZDe0W2D.d.ts.map → exact-types-BEHN7tnq.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +2 -2
- package/dist/experiment/index.js +5 -5
- package/dist/{experiment-tracker-C7PfnF4b.d.ts → experiment-tracker-URRGP9ek.d.ts} +2 -2
- package/dist/{experiment-tracker-C7PfnF4b.d.ts.map → experiment-tracker-URRGP9ek.d.ts.map} +1 -1
- package/dist/{exporters-Df7TgHFv.js → exporters-DEcXbvgO.js} +12 -4
- package/dist/exporters-DEcXbvgO.js.map +1 -0
- package/dist/{external-optimizer-process-QDRURJAM.js → external-optimizer-process-BbhvXTFx.js} +4 -4
- package/dist/{external-optimizer-process-QDRURJAM.js.map → external-optimizer-process-BbhvXTFx.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-D4dzUBZI.js → external-optimizer-subprocess-DMgmqTB6.js} +5 -5
- package/dist/{external-optimizer-subprocess-D4dzUBZI.js.map → external-optimizer-subprocess-DMgmqTB6.js.map} +1 -1
- package/dist/{feedback-trajectory-CXmtITBo.d.ts → feedback-trajectory-CytTR7u4.d.ts} +3 -3
- package/dist/{feedback-trajectory-CXmtITBo.d.ts.map → feedback-trajectory-CytTR7u4.d.ts.map} +1 -1
- package/dist/fuzz.js +1 -1
- package/dist/{hf-dataset-D8_RNIis.js → hf-dataset-CRqtSjnR.js} +2 -2
- package/dist/{hf-dataset-D8_RNIis.js.map → hf-dataset-CRqtSjnR.js.map} +1 -1
- package/dist/hosted/index.d.ts +2 -2
- package/dist/{index-DoykkxW0.d.ts → index-58wex7KV.d.ts} +11 -11
- package/dist/{index-DoykkxW0.d.ts.map → index-58wex7KV.d.ts.map} +1 -1
- package/dist/{index-CJ3LhKIX.d.ts → index-CKZa_rnt.d.ts} +4 -271
- package/dist/index-CKZa_rnt.d.ts.map +1 -0
- package/dist/{index-DbG8QbH9.d.ts → index-DVrtLO5j.d.ts} +6 -6
- package/dist/{index-DbG8QbH9.d.ts.map → index-DVrtLO5j.d.ts.map} +1 -1
- package/dist/{index-Bp_6sj3x.d.ts → index-ww8736Am.d.ts} +20 -315
- package/dist/index-ww8736Am.d.ts.map +1 -0
- package/dist/index.d.ts +23 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -29
- package/dist/{insight-report-D1qa0HWs.d.ts → insight-report-C3Bfl762.d.ts} +3 -3
- package/dist/{insight-report-D1qa0HWs.d.ts.map → insight-report-C3Bfl762.d.ts.map} +1 -1
- package/dist/jev-protocol.d.ts +74 -0
- package/dist/jev-protocol.d.ts.map +1 -0
- package/dist/jev-protocol.js +91 -0
- package/dist/jev-protocol.js.map +1 -0
- package/dist/jev.d.ts +131 -0
- package/dist/jev.d.ts.map +1 -0
- package/dist/jev.js +312 -0
- package/dist/jev.js.map +1 -0
- package/dist/{journal-Cs9f7385.js → journal-BuRLm6ho.js} +2 -2
- package/dist/{journal-Cs9f7385.js.map → journal-BuRLm6ho.js.map} +1 -1
- package/dist/{kind-factory-D5HOW3R0.js → kind-factory-DE088Zhv.js} +5 -4
- package/dist/{kind-factory-D5HOW3R0.js.map → kind-factory-DE088Zhv.js.map} +1 -1
- package/dist/ledger-core/index.js +2 -2
- package/dist/{llm-client-CGlSi8sb.js → llm-client-DDhZ29Vm.js} +2 -2
- package/dist/{llm-client-CGlSi8sb.js.map → llm-client-DDhZ29Vm.js.map} +1 -1
- package/dist/{llm-judge-BPFR12VJ.js → llm-judge-C5wbADA5.js} +11 -11
- package/dist/{llm-judge-BPFR12VJ.js.map → llm-judge-C5wbADA5.js.map} +1 -1
- package/dist/{matrix-CyhW-vgJ.d.ts → matrix-CPKsRY8Y.d.ts} +2 -2
- package/dist/{matrix-CyhW-vgJ.d.ts.map → matrix-CPKsRY8Y.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +54 -2
- package/dist/meta-eval/index.d.ts.map +1 -1
- package/dist/meta-eval/index.js +52 -3
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/{metrics-Qv-cpptD.js → metrics-DOMpkoeb.js} +5 -1
- package/dist/metrics-DOMpkoeb.js.map +1 -0
- package/dist/{mint-ySIIkKlV.js → mint-B4zgSAJW.js} +63 -14
- package/dist/mint-B4zgSAJW.js.map +1 -0
- package/dist/mint-BI14xehJ.d.ts +285 -0
- package/dist/mint-BI14xehJ.d.ts.map +1 -0
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/multishot/index.js +1 -1
- package/dist/openapi.json +1 -1
- package/dist/pipelines/index.js +2 -2
- package/dist/{produced-state-CkoG43gI.js → produced-state-D3uWsY8t.js} +25 -21
- package/dist/{produced-state-CkoG43gI.js.map → produced-state-D3uWsY8t.js.map} +1 -1
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +1 -1
- package/dist/{promotion-policy-BKFrl7CC.js → promotion-policy-CD-bUeyR.js} +3 -3
- package/dist/{promotion-policy-BKFrl7CC.js.map → promotion-policy-CD-bUeyR.js.map} +1 -1
- package/dist/{query-D1nLIKt7.js → query-DlV0pdx4.js} +2 -2
- package/dist/{query-D1nLIKt7.js.map → query-DlV0pdx4.js.map} +1 -1
- package/dist/{registry-BRbB6Y0v.d.ts → registry-D5Ly3GRV.d.ts} +3 -3
- package/dist/{registry-BRbB6Y0v.d.ts.map → registry-D5Ly3GRV.d.ts.map} +1 -1
- package/dist/{release-confidence-BcqeQTHW.d.ts → release-confidence-DsETiO4f.d.ts} +3 -3
- package/dist/{release-confidence-BcqeQTHW.d.ts.map → release-confidence-DsETiO4f.d.ts.map} +1 -1
- package/dist/{release-confidence-DMg8n18l.js → release-confidence-RanRUXRW.js} +2 -2
- package/dist/{release-confidence-DMg8n18l.js.map → release-confidence-RanRUXRW.js.map} +1 -1
- package/dist/reporting.d.ts +3 -3
- package/dist/reporting.js +2 -2
- package/dist/{researcher-64T49THL.d.ts → researcher-CJkH-6Ty.d.ts} +4 -4
- package/dist/{researcher-64T49THL.d.ts.map → researcher-CJkH-6Ty.d.ts.map} +1 -1
- package/dist/{reward-hacking-uzO_ihep.d.ts → reward-hacking-BIQ2BWLG.d.ts} +2 -2
- package/dist/{reward-hacking-uzO_ihep.d.ts.map → reward-hacking-BIQ2BWLG.d.ts.map} +1 -1
- package/dist/rl.d.ts +35 -40
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +79 -61
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +2 -1
- package/dist/rollout/index.js +4 -4
- package/dist/{rollout-BsN6pOU7.js → rollout-C0Ifk3vK.js} +4 -4
- package/dist/{rollout-BsN6pOU7.js.map → rollout-C0Ifk3vK.js.map} +1 -1
- package/dist/{rubric-predictive-validity-Bmj2_cll.d.ts → rubric-predictive-validity-CTU8y8Cv.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-Bmj2_cll.d.ts.map → rubric-predictive-validity-CTU8y8Cv.d.ts.map} +1 -1
- package/dist/{run-record-DPa2PeHx.js → run-record-BhMVsHR1.js} +2 -2
- package/dist/{run-record-DPa2PeHx.js.map → run-record-BhMVsHR1.js.map} +1 -1
- package/dist/{run-record-BiTWauyO.d.ts → run-record-D9wS35fK.d.ts} +2 -2
- package/dist/{run-record-BiTWauyO.d.ts.map → run-record-D9wS35fK.d.ts.map} +1 -1
- package/dist/{run-record-DualPTn2.js → run-record-tg_5H2IK.js} +2 -2
- package/dist/{run-record-DualPTn2.js.map → run-record-tg_5H2IK.js.map} +1 -1
- package/dist/search-ledger-types-D7KDVg-o.d.ts +302 -0
- package/dist/search-ledger-types-D7KDVg-o.d.ts.map +1 -0
- package/dist/{semantic-concept-judge-Bm5JDEKO.js → semantic-concept-judge-5r9hDEBA.js} +7 -7
- package/dist/{semantic-concept-judge-Bm5JDEKO.js.map → semantic-concept-judge-5r9hDEBA.js.map} +1 -1
- package/dist/{sequential-D_xHrBZe.js → sequential-BfDkCBGo.js} +3 -3
- package/dist/{sequential-D_xHrBZe.js.map → sequential-BfDkCBGo.js.map} +1 -1
- package/dist/{server-D_cjseFN.js → server-DmpcFiVK.js} +4 -4
- package/dist/{server-D_cjseFN.js.map → server-DmpcFiVK.js.map} +1 -1
- package/dist/{skillopt-optimization-method-B2IEaCeF.js → skillopt-optimization-method-B2zxoDk0.js} +8 -8
- package/dist/{skillopt-optimization-method-B2IEaCeF.js.map → skillopt-optimization-method-B2zxoDk0.js.map} +1 -1
- package/dist/{statistical-heldout-CpVd6FmY.d.ts → statistical-heldout-Bu4oNOJh.d.ts} +3 -3
- package/dist/{statistical-heldout-CpVd6FmY.d.ts.map → statistical-heldout-Bu4oNOJh.d.ts.map} +1 -1
- package/dist/{store-otlp-DWGUwlyj.js → store-otlp-rU5PFlOB.js} +2 -2
- package/dist/{store-otlp-DWGUwlyj.js.map → store-otlp-rU5PFlOB.js.map} +1 -1
- package/dist/{store-tool-spans-Dt-YdAuE.d.ts → store-tool-spans-DwdokbHg.d.ts} +54 -6
- package/dist/store-tool-spans-DwdokbHg.d.ts.map +1 -0
- package/dist/{store-tool-spans-ceJoiUgS.js → store-tool-spans-zrtftcRe.js} +68 -6
- package/dist/store-tool-spans-zrtftcRe.js.map +1 -0
- package/dist/{summary-report-IGAOtgPd.js → summary-report-BMvou2oZ.js} +2 -2
- package/dist/{summary-report-IGAOtgPd.js.map → summary-report-BMvou2oZ.js.map} +1 -1
- package/dist/{summary-report-D1h4dlrK.d.ts → summary-report-BzFS5UhZ.d.ts} +2 -2
- package/dist/{summary-report-D1h4dlrK.d.ts.map → summary-report-BzFS5UhZ.d.ts.map} +1 -1
- package/dist/{task-failure-attributes-B072KO_n.js → task-failure-attributes-BOxjfbhr.js} +2 -2
- package/dist/{task-failure-attributes-B072KO_n.js.map → task-failure-attributes-BOxjfbhr.js.map} +1 -1
- package/dist/{tool-groups-B2bSNaJB.d.ts → tool-groups-qHMydbAH.d.ts} +3 -3
- package/dist/tool-groups-qHMydbAH.d.ts.map +1 -0
- package/dist/{tool-waste-C7MU9u1e.js → tool-waste-nbHPAxei.js} +2 -2
- package/dist/{tool-waste-C7MU9u1e.js.map → tool-waste-nbHPAxei.js.map} +1 -1
- package/dist/trace-repair/index.d.ts +2 -2
- package/dist/trace-repair/index.js +3 -3
- package/dist/traces.d.ts +5 -5
- package/dist/traces.js +7 -7
- package/dist/trajectory-replay/index.js +1 -1
- package/dist/{types-CS0qk_Yp.d.ts → types-BTRcIqFr.d.ts} +3 -3
- package/dist/{types-CS0qk_Yp.d.ts.map → types-BTRcIqFr.d.ts.map} +1 -1
- package/dist/{types-D7gEdPoQ.d.ts → types-BjB2wZM9.d.ts} +2 -2
- package/dist/{types-D7gEdPoQ.d.ts.map → types-BjB2wZM9.d.ts.map} +1 -1
- package/dist/types-C8VBbiw6.js +91 -0
- package/dist/types-C8VBbiw6.js.map +1 -0
- package/dist/{types-BvZoPTGa.d.ts → types-c3ZRTbw9.d.ts} +3 -3
- package/dist/{types-BvZoPTGa.d.ts.map → types-c3ZRTbw9.d.ts.map} +1 -1
- package/dist/{types-DQ0e2E7y.js → usage-receipt-Cx3xNeyB.js} +2 -89
- package/dist/usage-receipt-Cx3xNeyB.js.map +1 -0
- package/dist/{verdict-BQ3pCFf8.js → verdict-DhPoXApk.js} +2 -2
- package/dist/{verdict-BQ3pCFf8.js.map → verdict-DhPoXApk.js.map} +1 -1
- package/dist/{verdict-cache-B3eCVQtY.js → verdict-cache-BQEsVy9n.js} +2 -2
- package/dist/{verdict-cache-B3eCVQtY.js.map → verdict-cache-BQEsVy9n.js.map} +1 -1
- package/dist/wire/index.d.ts +1 -1
- package/dist/wire/index.js +1 -1
- package/docs/changes/evaluation-definition-identity.md +27 -0
- package/docs/changes/jev-evidence-review.md +18 -0
- package/docs/changes/jev-product-adoption.md +18 -0
- package/docs/changes/probability-policy-audit.md +81 -0
- package/docs/jev-behavior-review.md +174 -0
- package/docs/jev-integrations.md +50 -0
- package/docs/jev.md +140 -0
- package/docs/produced-state.md +13 -0
- package/docs/profile-json-identity.md +33 -0
- package/docs/public-api.md +111 -95
- package/package.json +16 -1
- package/dist/agent-profile-cell-Cv6UA-W_.js.map +0 -1
- package/dist/canonical-DPyQ_rpt.js.map +0 -1
- package/dist/exporters-Df7TgHFv.js.map +0 -1
- package/dist/index-Bp_6sj3x.d.ts.map +0 -1
- package/dist/index-CJ3LhKIX.d.ts.map +0 -1
- package/dist/metrics-Qv-cpptD.js.map +0 -1
- package/dist/mint-ySIIkKlV.js.map +0 -1
- package/dist/store-tool-spans-Dt-YdAuE.d.ts.map +0 -1
- package/dist/store-tool-spans-ceJoiUgS.js.map +0 -1
- package/dist/tool-groups-B2bSNaJB.d.ts.map +0 -1
- package/dist/types-DQ0e2E7y.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as ValidationError } from "./errors-Dngq5h35.js";
|
|
2
2
|
import { a as scoreOrigin, i as rolloutRewardFields } from "./reward-nw2xZGZG.js";
|
|
3
|
-
import { s as runTaskScore } from "./run-record-
|
|
3
|
+
import { s as runTaskScore } from "./run-record-tg_5H2IK.js";
|
|
4
4
|
import { t as buildTrajectory } from "./trajectory-D_7rLrvE.js";
|
|
5
5
|
import { a as assertMinted, r as ROLLOUT_SCHEMA } from "./schema-C1aaAxTf.js";
|
|
6
6
|
//#region src/rollout/mint.ts
|
|
@@ -31,7 +31,7 @@ import { a as assertMinted, r as ROLLOUT_SCHEMA } from "./schema-C1aaAxTf.js";
|
|
|
31
31
|
* carry `reward: null` (interchange imports, existing ledgers) remain valid on
|
|
32
32
|
* the wire; only the RunRecord→line door refuses.
|
|
33
33
|
*
|
|
34
|
-
* Records without spans become labeled GAP LINES (messages: [],
|
|
34
|
+
* Records without spans or an explicit full capture become labeled GAP LINES (messages: [],
|
|
35
35
|
* provenance.gap) — present in the output AND surfaced in
|
|
36
36
|
* `missingTraces`; a capture gap is a finding, never a silent omission.
|
|
37
37
|
*/
|
|
@@ -48,7 +48,7 @@ function projectStep(span, scrub) {
|
|
|
48
48
|
if (span.kind === "llm") {
|
|
49
49
|
const llm = span;
|
|
50
50
|
const last = llm.messages[llm.messages.length - 1];
|
|
51
|
-
if (last) base.input = scrub(last.content);
|
|
51
|
+
if (last && last.content !== null) base.input = scrub(last.content);
|
|
52
52
|
if (llm.output !== void 0) base.output = scrub(llm.output);
|
|
53
53
|
} else if (span.kind === "tool") {
|
|
54
54
|
const tool = span;
|
|
@@ -57,18 +57,61 @@ function projectStep(span, scrub) {
|
|
|
57
57
|
}
|
|
58
58
|
return base;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
function
|
|
60
|
+
/** Preserve captured fields; invocation ids are opaque linkage, not generated text. */
|
|
61
|
+
function projectMessage(message, scrub) {
|
|
62
|
+
return {
|
|
63
|
+
role: message.role,
|
|
64
|
+
content: message.content === null ? null : scrub(message.content),
|
|
65
|
+
...message.reasoning_content !== void 0 ? { reasoning_content: scrub(message.reasoning_content) } : {},
|
|
66
|
+
...message.tool_calls !== void 0 ? { tool_calls: message.tool_calls.map((call) => ({
|
|
67
|
+
id: call.id,
|
|
68
|
+
type: call.type,
|
|
69
|
+
function: {
|
|
70
|
+
name: call.function.name,
|
|
71
|
+
arguments: scrub(call.function.arguments)
|
|
72
|
+
}
|
|
73
|
+
})) } : {},
|
|
74
|
+
...message.tool_call_id !== void 0 ? { tool_call_id: message.tool_call_id } : {},
|
|
75
|
+
...message.name !== void 0 ? { name: message.name } : {},
|
|
76
|
+
...message.is_copied_context !== void 0 ? { is_copied_context: message.is_copied_context } : {}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** Never recover missing calls from tool names, span order or argument summaries. */
|
|
80
|
+
function requireToolLinkage(messages, runId) {
|
|
81
|
+
const seen = /* @__PURE__ */ new Set();
|
|
82
|
+
const pending = /* @__PURE__ */ new Map();
|
|
83
|
+
const refuse = (detail) => {
|
|
84
|
+
throw new ValidationError(`Cannot mint rollout for run ${runId}: ${detail}`);
|
|
85
|
+
};
|
|
86
|
+
for (const message of messages) {
|
|
87
|
+
if (message.tool_calls !== void 0) {
|
|
88
|
+
if (message.role !== "assistant" || !Array.isArray(message.tool_calls)) refuse("tool calls must be captured on an assistant message");
|
|
89
|
+
if (pending.size > 0) refuse("new tool calls precede the prior invocation results");
|
|
90
|
+
for (const call of message.tool_calls) {
|
|
91
|
+
if (!call || typeof call.id !== "string" || call.id.length === 0 || seen.has(call.id) || call.type !== "function" || !call.function || typeof call.function.name !== "string" || call.function.name.length === 0 || typeof call.function.arguments !== "string") refuse("missing, duplicate or malformed tool invocation");
|
|
92
|
+
seen.add(call.id);
|
|
93
|
+
pending.set(call.id, call.function.name);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (message.role === "tool") {
|
|
97
|
+
const id = message.tool_call_id;
|
|
98
|
+
if (typeof id !== "string" || !pending.has(id)) refuse("tool result has no captured invocation (or answers it more than once)");
|
|
99
|
+
if (message.name !== void 0 && message.name !== pending.get(id)) refuse("tool result name does not match its invocation");
|
|
100
|
+
pending.delete(id);
|
|
101
|
+
} else if (message.tool_call_id !== void 0) refuse("tool_call_id is only valid on a tool result");
|
|
102
|
+
else if (pending.size > 0 && message.tool_calls === void 0) refuse("conversation advances before all tool results were captured");
|
|
103
|
+
}
|
|
104
|
+
if (pending.size > 0) refuse("tool invocation has no captured result");
|
|
105
|
+
}
|
|
106
|
+
/** Legacy span history; callers with compacted contexts supply messagesOf instead. */
|
|
107
|
+
function finalConversation(spans) {
|
|
62
108
|
const llms = spans.filter((s) => s.kind === "llm");
|
|
63
109
|
const last = llms[llms.length - 1];
|
|
64
110
|
if (!last) return [];
|
|
65
|
-
const messages = last.messages
|
|
66
|
-
role: m.role,
|
|
67
|
-
content: scrub(m.content)
|
|
68
|
-
}));
|
|
111
|
+
const messages = [...last.messages];
|
|
69
112
|
if (last.output !== void 0 && last.output !== "") messages.push({
|
|
70
113
|
role: "assistant",
|
|
71
|
-
content:
|
|
114
|
+
content: last.output
|
|
72
115
|
});
|
|
73
116
|
return messages;
|
|
74
117
|
}
|
|
@@ -281,7 +324,7 @@ function mintLine(record, steps, messages, options, capturedAt, gap) {
|
|
|
281
324
|
}
|
|
282
325
|
/**
|
|
283
326
|
* Join RunRecords with their traces into canonical rollout lines. Records
|
|
284
|
-
* without spans are emitted as labeled gap lines and reported in
|
|
327
|
+
* without spans or an explicit capture are emitted as labeled gap lines and reported in
|
|
285
328
|
* `missingTraces`. Execution-only records without a task score are rejected
|
|
286
329
|
* because a missing training label is not a zero reward.
|
|
287
330
|
*/
|
|
@@ -292,7 +335,9 @@ async function mintRolloutRows(records, store, options = {}) {
|
|
|
292
335
|
const missingTraces = [];
|
|
293
336
|
for (const record of records) {
|
|
294
337
|
const trajectory = await buildTrajectory(store, record.runId);
|
|
295
|
-
|
|
338
|
+
const captured = options.messagesOf ? await options.messagesOf(record.runId) : void 0;
|
|
339
|
+
if (options.messagesOf && (!Array.isArray(captured) || captured.length === 0)) throw new ValidationError(`Cannot mint rollout for run ${record.runId}: full capture is missing`);
|
|
340
|
+
if (trajectory.steps.length === 0 && !options.messagesOf) {
|
|
296
341
|
missingTraces.push(record.runId);
|
|
297
342
|
rows.push(mintLine(record, [], [], options, capturedAt, "no trace spans recorded for this runId"));
|
|
298
343
|
continue;
|
|
@@ -303,7 +348,11 @@ async function mintRolloutRows(records, store, options = {}) {
|
|
|
303
348
|
const tail = options.maxSteps - head;
|
|
304
349
|
steps = [...steps.slice(0, head), ...steps.slice(steps.length - tail)];
|
|
305
350
|
}
|
|
306
|
-
const
|
|
351
|
+
const spans = trajectory.steps.map((s) => s.span);
|
|
352
|
+
const messages = captured ?? finalConversation(spans);
|
|
353
|
+
requireToolLinkage(messages, record.runId);
|
|
354
|
+
const conversation = messages.map((message) => projectMessage(message, scrub));
|
|
355
|
+
requireToolLinkage(conversation.filter((message) => message.is_copied_context !== true), record.runId);
|
|
307
356
|
const gap = conversation.length === 0 ? "trace has no llm spans — no conversation to inline" : void 0;
|
|
308
357
|
rows.push(mintLine(record, steps, conversation, options, capturedAt, gap));
|
|
309
358
|
}
|
|
@@ -315,4 +364,4 @@ async function mintRolloutRows(records, store, options = {}) {
|
|
|
315
364
|
//#endregion
|
|
316
365
|
export { unmintableReasons as n, mintRolloutRows as t };
|
|
317
366
|
|
|
318
|
-
//# sourceMappingURL=mint-
|
|
367
|
+
//# sourceMappingURL=mint-B4zgSAJW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mint-B4zgSAJW.js","names":[],"sources":["../src/rollout/mint.ts"],"sourcesContent":["/**\n * Rollout minting — `tangle.rollout.v1` lines joined from the records the\n * substrate ALREADY keeps. There is no separate rollout store: a rollout\n * is the JOIN of a RunRecord (identity, provenance, cost, outcome) with\n * its trace (spans share `runId`), projected into the canonical line.\n *\n * Composition, not duplication:\n * - identity/provenance → `RunRecord` (candidateId, splitTag, agentProfile, hashes)\n * - step structure → `buildTrajectory` over the shared TraceStore\n * - preference-pair export → `feedbackTrajectoryToOptimizerRow` (feedback-trajectory.ts)\n * - PRM / reward-model → `reward-model-export.ts`\n *\n * Anti-Goodhart invariant: a run whose `outcome.realness.gated` is true is\n * never exported with a positive reward OR with any of the numbers that reward\n * was computed from. The gate travels into the training data (`reward` forced\n * to 0, `realness_gated: true`) and the whole outcome is transformed by\n * `gateGamedOutcome` inside `assertMinted` below, which relocates `metrics` and\n * `verdict` to `provenance.gated_evidence`. Mint returns\n * `MintedRolloutLine[]`: the brand the training exporters require, which only\n * this function, `readRolloutLedger`, and an explicit `assertMinted` can mint.\n *\n * A record carrying NEITHER split score is REJECTED (`ValidationError`), never\n * minted at 0 — \"nobody graded this\" is not the same claim as \"graded a total\n * failure\", and a trainer reading 0 learns the second. Lines that already\n * carry `reward: null` (interchange imports, existing ledgers) remain valid on\n * the wire; only the RunRecord→line door refuses.\n *\n * Records without spans or an explicit full capture become labeled GAP LINES (messages: [],\n * provenance.gap) — present in the output AND surfaced in\n * `missingTraces`; a capture gap is a finding, never a silent omission.\n */\n\nimport { ValidationError } from '../errors'\nimport { type RunRecord, runTaskScore } from '../run-record'\nimport type { LlmSpan, Span, ToolSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\nimport { buildTrajectory } from '../trajectory'\nimport { rolloutRewardFields, scoreOrigin } from './reward'\nimport {\n assertMinted,\n type ChatMessage,\n type MintedRolloutLine,\n ROLLOUT_SCHEMA,\n type RolloutRole,\n type RolloutSplit,\n type RolloutStep,\n} from './schema'\n\n/** Redactor for transcript/step payload text (secrets, PII), not opaque identity. */\nexport type RolloutScrubber = (text: string) => string\n\nexport interface MintRolloutOptions {\n scrub?: RolloutScrubber\n /**\n * Full canonical capture, including turns no longer in the model's context.\n * When supplied, missing/empty capture is refused, never replaced with a\n * span summary. Use the execution owner's capture or the existing harness\n * readers; reviewer traces and compacted histories are not full capture.\n */\n messagesOf?: (\n runId: string,\n ) => readonly ChatMessage[] | undefined | Promise<readonly ChatMessage[] | undefined>\n /** Cap steps per line (longest runs first drop middle steps). Default: no cap. */\n maxSteps?: number\n /** Role recorded on every minted line. Default 'agent' (a solo eval run). */\n role?: RolloutRole\n /** Task suite label. Default: the record's `experimentId`. */\n suite?: string\n /** Injected clock for deterministic output. */\n now?: () => Date\n}\n\nexport interface MintRolloutResult {\n rows: MintedRolloutLine[]\n /** runIds that had a RunRecord but no spans — emitted as gap lines AND listed here. */\n missingTraces: string[]\n}\n\nconst asText = (v: unknown, scrub: RolloutScrubber): string => {\n const s = typeof v === 'string' ? v : JSON.stringify(v)\n return scrub(s ?? '')\n}\n\nfunction projectStep(span: Span, scrub: RolloutScrubber): RolloutStep {\n const base: RolloutStep = {\n kind: span.kind,\n name: scrub(span.name),\n status: span.status,\n durationMs: span.endedAt !== undefined ? span.endedAt - span.startedAt : undefined,\n }\n if (span.kind === 'llm') {\n const llm = span as LlmSpan\n const last = llm.messages[llm.messages.length - 1]\n if (last && last.content !== null) base.input = scrub(last.content)\n if (llm.output !== undefined) base.output = scrub(llm.output)\n } else if (span.kind === 'tool') {\n const tool = span as ToolSpan\n base.input = asText(tool.args, scrub)\n if (tool.result !== undefined) base.output = asText(tool.result, scrub)\n }\n return base\n}\n\n/** Preserve captured fields; invocation ids are opaque linkage, not generated text. */\nfunction projectMessage(message: ChatMessage, scrub: RolloutScrubber): ChatMessage {\n return {\n role: message.role,\n content: message.content === null ? null : scrub(message.content),\n ...(message.reasoning_content !== undefined\n ? { reasoning_content: scrub(message.reasoning_content) }\n : {}),\n ...(message.tool_calls !== undefined\n ? {\n tool_calls: message.tool_calls.map((call) => ({\n id: call.id,\n type: call.type,\n function: {\n name: call.function.name,\n arguments: scrub(call.function.arguments),\n },\n })),\n }\n : {}),\n ...(message.tool_call_id !== undefined ? { tool_call_id: message.tool_call_id } : {}),\n ...(message.name !== undefined ? { name: message.name } : {}),\n ...(message.is_copied_context !== undefined\n ? { is_copied_context: message.is_copied_context }\n : {}),\n }\n}\n\n/** Never recover missing calls from tool names, span order or argument summaries. */\nfunction requireToolLinkage(messages: readonly ChatMessage[], runId: string): void {\n const seen = new Set<string>()\n const pending = new Map<string, string>()\n const refuse: (detail: string) => never = (detail) => {\n throw new ValidationError(`Cannot mint rollout for run ${runId}: ${detail}`)\n }\n for (const message of messages) {\n if (message.tool_calls !== undefined) {\n if (message.role !== 'assistant' || !Array.isArray(message.tool_calls)) {\n refuse('tool calls must be captured on an assistant message')\n }\n if (pending.size > 0) refuse('new tool calls precede the prior invocation results')\n for (const call of message.tool_calls) {\n if (\n !call ||\n typeof call.id !== 'string' ||\n call.id.length === 0 ||\n seen.has(call.id) ||\n call.type !== 'function' ||\n !call.function ||\n typeof call.function.name !== 'string' ||\n call.function.name.length === 0 ||\n typeof call.function.arguments !== 'string'\n ) {\n refuse('missing, duplicate or malformed tool invocation')\n }\n seen.add(call.id)\n pending.set(call.id, call.function.name)\n }\n }\n if (message.role === 'tool') {\n const id = message.tool_call_id\n if (typeof id !== 'string' || !pending.has(id)) {\n refuse('tool result has no captured invocation (or answers it more than once)')\n }\n if (message.name !== undefined && message.name !== pending.get(id)) {\n refuse('tool result name does not match its invocation')\n }\n pending.delete(id)\n } else if (message.tool_call_id !== undefined) {\n refuse('tool_call_id is only valid on a tool result')\n } else if (pending.size > 0 && message.tool_calls === undefined) {\n refuse('conversation advances before all tool results were captured')\n }\n }\n if (pending.size > 0) refuse('tool invocation has no captured result')\n}\n\n/** Legacy span history; callers with compacted contexts supply messagesOf instead. */\nfunction finalConversation(spans: Span[]): ChatMessage[] {\n const llms = spans.filter((s): s is LlmSpan => s.kind === 'llm')\n const last = llms[llms.length - 1]\n if (!last) return []\n const messages: ChatMessage[] = [...last.messages]\n if (last.output !== undefined && last.output !== '') {\n messages.push({ role: 'assistant', content: last.output })\n }\n return messages\n}\n\n// The reward derivations live in the leaf module `./reward` so gate and\n// reporting code can import them without dragging in the trace store; they are\n// re-exported here because the derivations shipped from this path.\nexport {\n isRealnessGated,\n observedScore,\n observedSplitScore,\n type ScoreOrigin,\n type ScorePreference,\n scoreOrigin,\n trainingReward,\n trainingScore,\n} from './reward'\n\nconst REWARD_SOURCE: Record<ReturnType<typeof scoreOrigin>, string> = {\n holdout: 'run-record/holdout-score',\n search: 'run-record/search-score',\n unscored: 'run-record/unscored',\n}\n\n/**\n * The mint door refuses an execution-only record: a missing training label is\n * not a zero reward, and not a mintable line either. Lines that already carry\n * `reward: null` — interchange imports, existing ledgers — stay valid on the\n * wire and keep their labeled gap; this guard is only about the\n * RunRecord→line door, where the producer can still be told to go score the\n * run instead of shipping an unlabeled row.\n */\nfunction requireTaskScore(record: RunRecord): void {\n if (runTaskScore(record) === undefined) {\n throw new ValidationError(`Cannot mint rollout for run ${record.runId}: task score is missing`)\n }\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null\n\ninterface MintFieldCheck {\n /** The RunRecord path, spelled the way the caller has to fix it. */\n readonly field: string\n /** True when the record carries something the line can honestly be built from. */\n readonly present: (bag: Record<string, unknown>) => boolean\n /** What the caller writes onto the record, and why that value and not another. */\n readonly remedy: string\n}\n\n/**\n * The RunRecord fields mint reads that a record can be missing even though the\n * TYPE says it cannot. There are exactly two ways that happens:\n *\n * 1. The field was OPTIONAL when the record was serialized. `costProvenance`,\n * `terminalOutcome` and `scenarioId` were optional through agent-eval\n * 0.125 and became required in 0.126, with no on-disk migration — so every\n * ledger written before 0.126 is full of records the type calls complete.\n * 2. Mint reads a level DEEPER than the record's own type is checked at:\n * `outcome.raw`, `tokenUsage.input`, `tokenUsage.output`.\n *\n * Nothing else needs a check here. Every other field mint copies is a top-level\n * scalar landing in a typed slot on the line, where an absent value arrives as\n * `undefined` and `assertMinted` refuses it by name. These are the ones where an\n * absent value instead kills the join with `TypeError: Cannot read properties of\n * undefined`, or — worse — mints a line that reads as measured.\n *\n * This is deliberately NOT `validateRunRecord`. That validator answers \"is this\n * a valid RunRecord\", which is a wider question than \"can a rollout line be\n * built from this one\": it also enforces model-snapshot discipline, the\n * `terminalFailureReason` coupling, and the `costUsd === costProvenance.usd`\n * agreement. Routing the mint door through it would refuse records mint can\n * mint honestly today (a model alias with no snapshot date, for one), which is\n * a policy change with its own blast radius and not this bug. The door asks the\n * narrower question and answers it precisely.\n */\nconst MINT_FIELD_CHECKS: readonly MintFieldCheck[] = [\n {\n field: 'costProvenance',\n present: (bag) => isObject(bag.costProvenance) && typeof bag.costProvenance.kind === 'string',\n remedy:\n \"Records written before agent-eval 0.126 predate this field and carry `costUsd: 0` as the documented uncaptured sentinel, which is NOT an observed zero. Backfill it as costProvenance: { kind: 'uncaptured', usd: null } WITH costUsd: null — an uncaptured cost whose costUsd is non-null is rejected by validateRunRecord, so provenance alone leaves the record invalid.\",\n },\n {\n field: 'tokenUsage',\n present: (bag) => isObject(bag.tokenUsage),\n remedy:\n \"The line's cost.tokens_in and cost.tokens_out are read from it. Backfill it from the provider's usage report; mint will not write 0 for tokens nobody counted.\",\n },\n {\n field: 'tokenUsage.input',\n present: (bag) => !isObject(bag.tokenUsage) || typeof bag.tokenUsage.input === 'number',\n remedy: \"The line's cost.tokens_in is read from it, and a missing count is not a zero count.\",\n },\n {\n field: 'tokenUsage.output',\n present: (bag) => !isObject(bag.tokenUsage) || typeof bag.tokenUsage.output === 'number',\n remedy: \"The line's cost.tokens_out is read from it, and a missing count is not a zero count.\",\n },\n {\n field: 'outcome',\n present: (bag) => isObject(bag.outcome),\n remedy:\n \"The line's reward, reward_source and metrics are all read from it. A record with no outcome carries no training label at all, and mint refuses an unlabeled row.\",\n },\n {\n field: 'outcome.raw',\n // Reported only when `outcome` itself is present: one absent field should\n // produce one reason per CAUSE, not one per path that dereferences it.\n present: (bag) => !isObject(bag.outcome) || isObject(bag.outcome.raw),\n remedy:\n 'It is the metric bag copied verbatim into the line\\'s outcome.metrics. `{ ...undefined }` spreads to `{}` without complaint, so an absent bag would mint as \"this run reported no metrics\" — a different claim from \"this record predates the field\". Backfill it as {} only when that is what you mean.',\n },\n {\n field: 'terminalOutcome',\n present: (bag) => typeof bag.terminalOutcome === 'string',\n remedy:\n \"It became required in agent-eval 0.126. Backfill it from root-run or process evidence, or as 'unknown' when the producer has none — mint will not decide the line's is_completed and is_truncated for you.\",\n },\n {\n field: 'scenarioId',\n present: (bag) => typeof bag.scenarioId === 'string' && bag.scenarioId.length > 0,\n remedy:\n \"It became required in agent-eval 0.126 and becomes the line's task.instance_id, which must be a non-empty string. Backfill it from the scenario the run was dealt (pre-0.126 producers often left it in outcome.raw.scenario_id).\",\n },\n]\n\n/**\n * Why a record cannot be minted, one entry per missing field, empty when it can.\n *\n * Exported so a caller can partition a whole ledger — \"which of my 2742 records\n * predate 0.126\" — without catching an exception per record, and without\n * re-deriving the field list on their side. A re-derived list is a list that\n * drifts from the door it is supposed to predict.\n *\n * Takes a `RunRecord` because that is what the caller holds and what the\n * compiler agrees they hold. The type is precisely the thing that is wrong, so\n * the checks read the record as the untyped bag it actually is on disk.\n */\nexport function unmintableReasons(record: RunRecord): string[] {\n const bag = record as unknown as Record<string, unknown>\n return MINT_FIELD_CHECKS.filter((check) => !check.present(bag)).map(\n (check) => `${check.field} is missing. ${check.remedy}`,\n )\n}\n\n/**\n * The mint door THROWS on a record it cannot build a line from. It does NOT\n * normalise an absent `costProvenance` to `{kind:'uncaptured', usd:null}`, and\n * the choice is not stylistic:\n *\n * - Normalising cannot cover the record, only part of it. `terminalOutcome`\n * feeds `is_completed` and `is_truncated`, which the rollout schema requires\n * to be BOOLEAN — there is no null to fall back to, so every possible\n * default is a claim about how the run ended. A door that quietly fixes the\n * cost and invents the ending is a door no caller can predict.\n * - Normalising the cost requires knowing what `costUsd: 0` meant, and mint\n * cannot know. A genuinely free run and an uncaptured one are the same bytes\n * in a pre-0.126 record; only the producer can tell them apart. Guessing is\n * exactly the failure this guard exists to stop — the 0.125 optional chain\n * `record.costProvenance?.kind === 'uncaptured'` already made that guess,\n * silently, and every record it touched minted `cost.usd: 0`: an unmeasured\n * cost published as a measured zero, into a training dataset.\n * - `requireTaskScore`, directly above, already refuses an unlabeled record\n * for the same reason: \"nobody graded this\" is not \"graded zero\". \"Nobody\n * billed this\" is not \"billed zero\".\n *\n * The caller who wants historical records minted backfills them at their store,\n * in one pass, where `costUsd` can be corrected alongside `costProvenance` —\n * which is the only place that decision can be made correctly. The refusal names\n * the run, names every missing field, and spells the value to write.\n */\nfunction requireMintableRecord(record: RunRecord): void {\n const reasons = unmintableReasons(record)\n if (reasons.length === 0) return\n throw new ValidationError(`Cannot mint rollout for run ${record.runId}: ${reasons.join('\\n ')}`)\n}\n\nconst SPLIT_FROM_TAG: Record<RunRecord['splitTag'], RolloutSplit> = {\n search: 'search',\n dev: 'dev',\n holdout: 'holdout',\n}\n\nfunction mintLine(\n record: RunRecord,\n steps: RolloutStep[],\n messages: ChatMessage[],\n options: MintRolloutOptions,\n capturedAt: string,\n gap?: string,\n): MintedRolloutLine {\n // Field presence first, and BEFORE `requireTaskScore`: that guard reads\n // `record.outcome.searchScore` on its way to the answer, so an absent\n // `outcome` would throw a bare TypeError from inside the guard whose whole\n // job is to produce a clean refusal.\n //\n // Both branches of `mintRolloutRows` — the traced line and the gap line —\n // land here, which is the point: `mintLine` is the only constructor of a\n // `MintedRolloutLine` from a RunRecord, so there is no path into the waist\n // that skips the check and no way to get this wrong from the outside.\n requireMintableRecord(record)\n // A missing task score is refused before anything is built: an\n // execution-only record has no training label, and a missing label is\n // neither a zero reward nor a mintable row.\n requireTaskScore(record)\n // `reward` and `realness_gated` come out of one call, so neither door into\n // the waist can write one and forget the other.\n const rewardFields = rolloutRewardFields(record)\n const uncaptured = record.costProvenance.kind === 'uncaptured'\n const terminalOutcome = record.terminalOutcome\n const isCompleted = terminalOutcome === 'succeeded' || terminalOutcome === 'failed'\n const isTruncated = terminalOutcome === 'cancelled' || terminalOutcome === 'incomplete'\n const terminalError =\n terminalOutcome === 'failed' ||\n terminalOutcome === 'cancelled' ||\n terminalOutcome === 'incomplete'\n ? (record.terminalFailureReason ?? `run ended ${terminalOutcome}`)\n : null\n // `assertMinted` rather than a cast: mint is the producer the whole gate\n // rests on, so it proves the line it just built is valid instead of asserting\n // it by fiat. The brand is unforgeable precisely because nobody casts to it.\n return assertMinted(\n {\n schema: ROLLOUT_SCHEMA,\n rollout_id: record.runId,\n parent_rollout_id: null,\n run_id: record.runId,\n experiment_id: record.experimentId,\n candidate_id: record.candidateId,\n generation: null,\n candidate_index: null,\n role: options.role ?? 'agent',\n task: {\n suite: options.suite ?? record.experimentId,\n instance_id: record.scenarioId,\n split: SPLIT_FROM_TAG[record.splitTag],\n seed: record.seed,\n rep: 0,\n },\n policy: {\n harness: null,\n harness_version: null,\n model: record.model,\n provider: null,\n profile_commit: record.commitSha,\n prompt_hash: record.promptHash,\n config_hash: record.configHash,\n agent_profile_cell_id: record.agentProfile?.cellId ?? null,\n sampling: null,\n },\n messages,\n tool_defs: [],\n ...(steps.length > 0 ? { steps } : {}),\n outcome: {\n ...rewardFields,\n reward_source: REWARD_SOURCE[scoreOrigin(record)],\n verdict: null,\n // A verbatim bulk copy, deliberately UNFILTERED here. `outcome.raw`\n // holds the per-layer verifier scores (`layer.*`) that the reward was\n // derived from, so on a gated run this dict is the reward signal in\n // component form — but filtering it at this call site is the pattern\n // that has now leaked twice, because the next producer to write a\n // reward-bearing field forgets. The gate is applied to the whole\n // outcome once, in `assertMinted` below (`gateGamedOutcome`), which\n // moves the block to `provenance.gated_evidence` when the run is gated\n // and leaves it here untouched when it is not.\n metrics: { ...record.outcome.raw },\n is_completed: isCompleted,\n is_truncated: isTruncated,\n error: terminalError,\n },\n cost: {\n usd: uncaptured ? null : record.costUsd,\n tokens_in: record.tokenUsage.input,\n tokens_out: record.tokenUsage.output,\n tokens_reasoning: record.tokenUsage.reasoning ?? null,\n cache_read: record.tokenUsage.cached ?? null,\n cache_write: record.tokenUsage.cacheWrite ?? null,\n wall_s: Math.round(record.wallMs / 1000),\n },\n artifacts: { patch_path: null, run_dir: null, transcript_ref: null },\n provenance: {\n captured_at: capturedAt,\n capture: 'mint',\n ...(gap !== undefined ? { gap } : {}),\n },\n },\n `minted rollout line for run ${record.runId}`,\n )\n}\n\n/**\n * Join RunRecords with their traces into canonical rollout lines. Records\n * without spans or an explicit capture are emitted as labeled gap lines and reported in\n * `missingTraces`. Execution-only records without a task score are rejected\n * because a missing training label is not a zero reward.\n */\nexport async function mintRolloutRows(\n records: RunRecord[],\n store: TraceStore,\n options: MintRolloutOptions = {},\n): Promise<MintRolloutResult> {\n const scrub = options.scrub ?? ((t) => t)\n const capturedAt = (options.now?.() ?? new Date()).toISOString()\n const rows: MintedRolloutLine[] = []\n const missingTraces: string[] = []\n for (const record of records) {\n const trajectory = await buildTrajectory(store, record.runId)\n const captured = options.messagesOf ? await options.messagesOf(record.runId) : undefined\n if (options.messagesOf && (!Array.isArray(captured) || captured.length === 0)) {\n throw new ValidationError(\n `Cannot mint rollout for run ${record.runId}: full capture is missing`,\n )\n }\n if (trajectory.steps.length === 0 && !options.messagesOf) {\n missingTraces.push(record.runId)\n rows.push(\n mintLine(record, [], [], options, capturedAt, 'no trace spans recorded for this runId'),\n )\n continue\n }\n let steps = trajectory.steps.map((s) => projectStep(s.span, scrub))\n if (options.maxSteps !== undefined && steps.length > options.maxSteps) {\n // Keep the head and tail — the middle of a long run is the least\n // informative for outcome attribution.\n const head = Math.ceil(options.maxSteps / 2)\n const tail = options.maxSteps - head\n steps = [...steps.slice(0, head), ...steps.slice(steps.length - tail)]\n }\n const spans = trajectory.steps.map((s) => s.span)\n const messages = captured ?? finalConversation(spans)\n requireToolLinkage(messages, record.runId)\n const conversation = messages.map((message) => projectMessage(message, scrub))\n // SFT drops copied context. That projection must not orphan a retained result.\n requireToolLinkage(\n conversation.filter((message) => message.is_copied_context !== true),\n record.runId,\n )\n const gap =\n conversation.length === 0 ? 'trace has no llm spans — no conversation to inline' : undefined\n rows.push(mintLine(record, steps, conversation, options, capturedAt, gap))\n }\n return { rows, missingTraces }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,MAAM,UAAU,GAAY,UAAmC;CAE7D,OAAO,OADG,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,MACpC,EAAE;AACtB;AAEA,SAAS,YAAY,MAAY,OAAqC;CACpE,MAAM,OAAoB;EACxB,MAAM,KAAK;EACX,MAAM,MAAM,KAAK,IAAI;EACrB,QAAQ,KAAK;EACb,YAAY,KAAK,YAAY,KAAA,IAAY,KAAK,UAAU,KAAK,YAAY,KAAA;CAC3E;CACA,IAAI,KAAK,SAAS,OAAO;EACvB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Q,CAAC,GAAG,CAAC,GAAG,SAAS,YAAY,wCAAwC,CACxF;GACA;EACF;EACA,IAAI,QAAQ,WAAW,MAAM,KAAK,MAAM,YAAY,EAAE,MAAM,KAAK,CAAC;EAClE,IAAI,QAAQ,aAAa,KAAA,KAAa,MAAM,SAAS,QAAQ,UAAU;GAGrE,MAAM,OAAO,KAAK,KAAK,QAAQ,WAAW,CAAC;GAC3C,MAAM,OAAO,QAAQ,WAAW;GAChC,QAAQ,CAAC,GAAG,MAAM,MAAM,GAAG,IAAI,GAAG,GAAG,MAAM,MAAM,MAAM,SAAS,IAAI,CAAC;EACvE;EACA,MAAM,QAAQ,WAAW,MAAM,KAAK,MAAM,EAAE,IAAI;EAChD,MAAM,WAAW,YAAY,kBAAkB,KAAK;EACpD,mBAAmB,UAAU,OAAO,KAAK;EACzC,MAAM,eAAe,SAAS,KAAK,YAAY,eAAe,SAAS,KAAK,CAAC;EAE7E,mBACE,aAAa,QAAQ,YAAY,QAAQ,sBAAsB,IAAI,GACnE,OAAO,KACT;EACA,MAAM,MACJ,aAAa,WAAW,IAAI,uDAAuD,KAAA;EACrF,KAAK,KAAK,SAAS,QAAQ,OAAO,cAAc,SAAS,YAAY,GAAG,CAAC;CAC3E;CACA,OAAO;EAAE;EAAM;CAAc;AAC/B"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { a as RunRecord } from "./run-record-D9wS35fK.js";
|
|
2
|
+
import { s as TraceStore } from "./store-BErPvYBr.js";
|
|
3
|
+
import { S as ToolDef, a as MintedRolloutLine, b as RolloutStep, m as RolloutLine, t as ChatMessage, v as RolloutRole, y as RolloutSplit } from "./schema-BzWDXhOR.js";
|
|
4
|
+
//#region src/rollout/exporters.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The gate's two claims, which travel TOGETHER on every emitted row.
|
|
7
|
+
*
|
|
8
|
+
* `realness_gated` alone is ambiguous, and the ambiguity is exploitable:
|
|
9
|
+
* `false` reads as "we screened it and nothing fired", so a producer that has no
|
|
10
|
+
* screen at all emitted rows indistinguishable from screened-clean ones, and
|
|
11
|
+
* every consumer of the published dataset read them as clean. The second field
|
|
12
|
+
* is what separates the two claims, and it only removes the ambiguity if it
|
|
13
|
+
* reaches the WIRE — for a round it existed on `RolloutOutcome` and on no
|
|
14
|
+
* exported row shape at all, which left the published rows exactly as ambiguous
|
|
15
|
+
* as before.
|
|
16
|
+
*
|
|
17
|
+
* So there is one helper and every row shape spreads it. A row that states one
|
|
18
|
+
* claim without the other is not constructible by copying the pattern, and
|
|
19
|
+
* `exporters.test.ts` walks every emitted shape to prove none does.
|
|
20
|
+
*/
|
|
21
|
+
interface RealnessLabels {
|
|
22
|
+
/** The screen's VERDICT: the run faked its success signal. */
|
|
23
|
+
realness_gated: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether a screen RAN at all. `true` = it ran, so `realness_gated` is its
|
|
26
|
+
* verdict. `false` = the producer declares it has none. `null` = not stated
|
|
27
|
+
* (pre-unification producers), which is "unknown" and never "clean".
|
|
28
|
+
*/
|
|
29
|
+
realness_screened: boolean | null;
|
|
30
|
+
}
|
|
31
|
+
interface TrainingExportOptions {
|
|
32
|
+
/** Include held-out evaluation data in training output. Default false. */
|
|
33
|
+
allowHeldOutTrainingData?: boolean;
|
|
34
|
+
/** Require reward to be strictly greater than this value. Default 0. */
|
|
35
|
+
minimumQualityExclusive?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Explicit split selection, replacing the default trainable-split rule.
|
|
38
|
+
* Use this only when producing a deliberately named non-training slice
|
|
39
|
+
* (e.g. `['holdout']` for a holdout-only evaluation bundle).
|
|
40
|
+
*/
|
|
41
|
+
splitFilter?: RolloutSplit[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What a signed-signal exporter (verifiers, RFT) does with lines that are not
|
|
45
|
+
* clean trainable successes — realness-gated lines above all.
|
|
46
|
+
*
|
|
47
|
+
* - 'exclude' — the default, the same fail-closed policy as every
|
|
48
|
+
* other training export: positive, completed,
|
|
49
|
+
* non-gated rows on a trainable split.
|
|
50
|
+
* - 'zero-and-flag' — keep them, at their non-positive (or null) reward,
|
|
51
|
+
* with `RealnessLabels` on the row. The dataset release
|
|
52
|
+
* sets this per `FORMAT_GATE_DISPOSITION`: in these
|
|
53
|
+
* formats the reward is a signed learning signal, so a
|
|
54
|
+
* gamed trajectory at reward 0 is a correct negative,
|
|
55
|
+
* and dropping it would bias the negative population
|
|
56
|
+
* toward honest failures and leave a trainer no example
|
|
57
|
+
* of gaming being penalized. The split policy is NOT
|
|
58
|
+
* relaxed: held-out lines still need the named opt-in.
|
|
59
|
+
*
|
|
60
|
+
* SFT deliberately has no such option — an SFT row is an imitation target and
|
|
61
|
+
* a gamed trajectory must never appear in one at any weight.
|
|
62
|
+
*/
|
|
63
|
+
type GatedLineDisposition = 'exclude' | 'zero-and-flag';
|
|
64
|
+
interface SignedSignalExportOptions extends TrainingExportOptions {
|
|
65
|
+
/** Disposition for non-trainable lines. Default 'exclude'. */
|
|
66
|
+
gatedLines?: GatedLineDisposition;
|
|
67
|
+
}
|
|
68
|
+
type SftExportOptions = TrainingExportOptions;
|
|
69
|
+
interface SftRow {
|
|
70
|
+
messages: ChatMessage[];
|
|
71
|
+
metadata: {
|
|
72
|
+
rollout_id: string;
|
|
73
|
+
run_id: string;
|
|
74
|
+
candidate_id: string | null;
|
|
75
|
+
instance_id: string;
|
|
76
|
+
reward: number;
|
|
77
|
+
} & RealnessLabels;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Supervised fine-tune rows: the completed conversation of each qualifying
|
|
81
|
+
* line. Fail-closed filters: trainable split only (never holdout/canary unless
|
|
82
|
+
* an explicit `splitFilter` names a non-training slice),
|
|
83
|
+
* reward strictly above `minimumQualityExclusive` (default 0), realness-gated
|
|
84
|
+
* lines never qualify, gap lines carry no trainable content, and
|
|
85
|
+
* copied-context turns are dropped from the transcript (Harbor ATIF RFC 0001
|
|
86
|
+
* rule 7 — see `ChatMessage.is_copied_context`).
|
|
87
|
+
*
|
|
88
|
+
* `realness_gated` is therefore always `false` on an emitted row. It is carried
|
|
89
|
+
* anyway: an SFT row is a pure imitation target, so the row states its realness
|
|
90
|
+
* claims instead of making the reader know the format's policy, and carrying
|
|
91
|
+
* both flags on all four shapes is what lets the release accounting measure
|
|
92
|
+
* every config with one rule rather than skipping the one whose row shape
|
|
93
|
+
* happened to omit the field.
|
|
94
|
+
*/
|
|
95
|
+
declare function toSftRows(lines: MintedRolloutLine[], options?: SftExportOptions): SftRow[];
|
|
96
|
+
interface RewardRow {
|
|
97
|
+
/** First user turn — the task prompt. */
|
|
98
|
+
prompt: string;
|
|
99
|
+
steps: RolloutStep[];
|
|
100
|
+
reward: number;
|
|
101
|
+
metadata: {
|
|
102
|
+
rollout_id: string;
|
|
103
|
+
run_id: string;
|
|
104
|
+
candidate_id: string | null;
|
|
105
|
+
instance_id: string;
|
|
106
|
+
split: RolloutSplit;
|
|
107
|
+
} & RealnessLabels;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Reward-labeled rows for completed, positive-quality training runs.
|
|
111
|
+
*/
|
|
112
|
+
declare function toRewardRows(lines: MintedRolloutLine[], options?: TrainingExportOptions): RewardRow[];
|
|
113
|
+
interface VerifiersTokenUsage {
|
|
114
|
+
input_tokens: number | null;
|
|
115
|
+
output_tokens: number | null;
|
|
116
|
+
reasoning_tokens: number | null;
|
|
117
|
+
cache_read_tokens: number | null;
|
|
118
|
+
cache_write_tokens: number | null;
|
|
119
|
+
}
|
|
120
|
+
interface VerifiersRolloutOutput {
|
|
121
|
+
/** Messages through the last turn BEFORE the first assistant turn. */
|
|
122
|
+
prompt: ChatMessage[];
|
|
123
|
+
/** The first assistant turn onward — what the policy produced. */
|
|
124
|
+
completion: ChatMessage[];
|
|
125
|
+
reward: number | null;
|
|
126
|
+
metrics: Record<string, unknown>;
|
|
127
|
+
tool_defs: ToolDef[];
|
|
128
|
+
token_usage: VerifiersTokenUsage;
|
|
129
|
+
info: {
|
|
130
|
+
task: RolloutLine['task'];
|
|
131
|
+
policy: RolloutLine['policy'];
|
|
132
|
+
rollout_id: string;
|
|
133
|
+
run_id: string;
|
|
134
|
+
experiment_id: string | null;
|
|
135
|
+
candidate_id: string | null;
|
|
136
|
+
generation: number | null;
|
|
137
|
+
candidate_index: number | null;
|
|
138
|
+
role: RolloutLine['role'];
|
|
139
|
+
} & RealnessLabels;
|
|
140
|
+
}
|
|
141
|
+
declare function toVerifiersRolloutOutput(line: MintedRolloutLine): VerifiersRolloutOutput;
|
|
142
|
+
declare function toVerifiersRolloutOutputs(lines: MintedRolloutLine[], options?: SignedSignalExportOptions): VerifiersRolloutOutput[];
|
|
143
|
+
interface RftItem {
|
|
144
|
+
/** Prompt turns only — the graded completion is re-sampled during RFT. */
|
|
145
|
+
messages: ChatMessage[];
|
|
146
|
+
/** Verdict/label fields the grader references as item.reference.* */
|
|
147
|
+
reference: {
|
|
148
|
+
reward: number | null;
|
|
149
|
+
reward_source: string | null;
|
|
150
|
+
verdict: unknown;
|
|
151
|
+
instance_id: string;
|
|
152
|
+
suite: string;
|
|
153
|
+
split: RolloutSplit;
|
|
154
|
+
rollout_id: string;
|
|
155
|
+
} & RealnessLabels;
|
|
156
|
+
}
|
|
157
|
+
declare function toRftItem(line: MintedRolloutLine): RftItem;
|
|
158
|
+
/** RFT needs a real prompt: lines whose transcript starts with prompt turns. */
|
|
159
|
+
declare function toRftItems(lines: MintedRolloutLine[], options?: SignedSignalExportOptions): RftItem[];
|
|
160
|
+
declare function toJsonl(rows: ReadonlyArray<unknown>): string;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/rollout/reward.d.ts
|
|
163
|
+
/**
|
|
164
|
+
* Which split's score wins when a record carries both. `'holdout'` is the
|
|
165
|
+
* canonical "real signal" default; `'search'` exists because some callers
|
|
166
|
+
* deliberately score on the search split when both are present.
|
|
167
|
+
*/
|
|
168
|
+
type ScorePreference = 'holdout' | 'search';
|
|
169
|
+
/** Only the outcome is read, so every accessor here accepts anything carrying one. */
|
|
170
|
+
type Scored = Pick<RunRecord, 'outcome'>;
|
|
171
|
+
/** True when the authenticity gate flagged the run as gamed (`realness.gated`). */
|
|
172
|
+
declare function isRealnessGated(record: Scored): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* The RAW score recorded on ONE split, with no cross-split fallback and no
|
|
175
|
+
* anti-Goodhart gate.
|
|
176
|
+
*
|
|
177
|
+
* The narrowest of the three raw readers, and the one every split-scoped
|
|
178
|
+
* consumer wants: a per-split report, a promotion gate, or a paired comparison
|
|
179
|
+
* asks "what did this run score on the split I am summarising", and answering
|
|
180
|
+
* it with the other split's number silently mixes populations. `undefined` =
|
|
181
|
+
* that split was never scored.
|
|
182
|
+
*
|
|
183
|
+
* Same warning as `observedScore`: this INCLUDES runs flagged as gamed. Never
|
|
184
|
+
* feed it into training data.
|
|
185
|
+
*/
|
|
186
|
+
declare function observedSplitScore(record: Scored, split: ScorePreference): number | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* The RAW split score the run carries, with NO anti-Goodhart gate applied.
|
|
189
|
+
*
|
|
190
|
+
* INCLUDES RUNS FLAGGED AS GAMED (`outcome.realness.gated === true`); NEVER
|
|
191
|
+
* feed this into training data — a fine-tune that sees it learns from gamed
|
|
192
|
+
* successes. It is exported anyway because analysis, reporting, and
|
|
193
|
+
* reward-hacking detection legitimately need the ungated number: forcing a
|
|
194
|
+
* gamed run to 0 collapses the proxy signal toward ground truth and makes a
|
|
195
|
+
* detector report "clean" on exactly the population that is being gamed.
|
|
196
|
+
*
|
|
197
|
+
* Returns `undefined` when the record carries neither score — an unscored run
|
|
198
|
+
* is a labeled gap, not a measured zero, and each caller picks its own
|
|
199
|
+
* sentinel (`?? 0`, `?? null`, skip, throw). Non-finite values are returned
|
|
200
|
+
* as-is; callers that care keep their own `Number.isFinite` guard.
|
|
201
|
+
*/
|
|
202
|
+
declare function observedScore(record: Scored, prefer?: ScorePreference): number | undefined;
|
|
203
|
+
/** Which split actually carried the score, or that none did. */
|
|
204
|
+
type ScoreOrigin = 'holdout' | 'search' | 'unscored';
|
|
205
|
+
/**
|
|
206
|
+
* Where `observedScore` / `trainingScore` read their number from — the
|
|
207
|
+
* provenance label a rollout line's `reward_source` is built from, and the
|
|
208
|
+
* only supported way to ask "was this run scored at all" without respelling
|
|
209
|
+
* the field access.
|
|
210
|
+
*/
|
|
211
|
+
declare function scoreOrigin(record: Scored, prefer?: ScorePreference): ScoreOrigin;
|
|
212
|
+
/**
|
|
213
|
+
* The GATED score — the only derivation allowed to reach training data.
|
|
214
|
+
*
|
|
215
|
+
* A realness-gated run scores 0 no matter what it claims, so a fine-tune
|
|
216
|
+
* cannot learn from a gamed success. An unscored run stays `undefined` (a
|
|
217
|
+
* labeled gap), keeping "we never measured this" distinct from "we measured
|
|
218
|
+
* zero"; callers that need a number apply their own sentinel.
|
|
219
|
+
*/
|
|
220
|
+
declare function trainingScore(record: Scored, prefer?: ScorePreference): number | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* `{reward, gated}` as written onto a minted `RolloutLine` — `trainingScore`
|
|
223
|
+
* plus the flag itself, so the gate travels into the exported row and a
|
|
224
|
+
* downstream filter can drop or down-weight the line.
|
|
225
|
+
*
|
|
226
|
+
* An unscored record yields `reward: null`, matching the schema's "no verdict
|
|
227
|
+
* exists — a labeled gap, never 0" rule. It previously collapsed to 0, which
|
|
228
|
+
* made a run nobody graded indistinguishable from one graded as a total
|
|
229
|
+
* failure, and taught any trainer reading the row that the trajectory was bad.
|
|
230
|
+
* A gated run still yields 0, because that IS a verdict: the gate decided.
|
|
231
|
+
*/
|
|
232
|
+
declare function trainingReward(record: Scored): {
|
|
233
|
+
reward: number | null;
|
|
234
|
+
gated: boolean;
|
|
235
|
+
};
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/rollout/mint.d.ts
|
|
238
|
+
/** Redactor for transcript/step payload text (secrets, PII), not opaque identity. */
|
|
239
|
+
type RolloutScrubber = (text: string) => string;
|
|
240
|
+
interface MintRolloutOptions {
|
|
241
|
+
scrub?: RolloutScrubber;
|
|
242
|
+
/**
|
|
243
|
+
* Full canonical capture, including turns no longer in the model's context.
|
|
244
|
+
* When supplied, missing/empty capture is refused, never replaced with a
|
|
245
|
+
* span summary. Use the execution owner's capture or the existing harness
|
|
246
|
+
* readers; reviewer traces and compacted histories are not full capture.
|
|
247
|
+
*/
|
|
248
|
+
messagesOf?: (runId: string) => readonly ChatMessage[] | undefined | Promise<readonly ChatMessage[] | undefined>;
|
|
249
|
+
/** Cap steps per line (longest runs first drop middle steps). Default: no cap. */
|
|
250
|
+
maxSteps?: number;
|
|
251
|
+
/** Role recorded on every minted line. Default 'agent' (a solo eval run). */
|
|
252
|
+
role?: RolloutRole;
|
|
253
|
+
/** Task suite label. Default: the record's `experimentId`. */
|
|
254
|
+
suite?: string;
|
|
255
|
+
/** Injected clock for deterministic output. */
|
|
256
|
+
now?: () => Date;
|
|
257
|
+
}
|
|
258
|
+
interface MintRolloutResult {
|
|
259
|
+
rows: MintedRolloutLine[];
|
|
260
|
+
/** runIds that had a RunRecord but no spans — emitted as gap lines AND listed here. */
|
|
261
|
+
missingTraces: string[];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Why a record cannot be minted, one entry per missing field, empty when it can.
|
|
265
|
+
*
|
|
266
|
+
* Exported so a caller can partition a whole ledger — "which of my 2742 records
|
|
267
|
+
* predate 0.126" — without catching an exception per record, and without
|
|
268
|
+
* re-deriving the field list on their side. A re-derived list is a list that
|
|
269
|
+
* drifts from the door it is supposed to predict.
|
|
270
|
+
*
|
|
271
|
+
* Takes a `RunRecord` because that is what the caller holds and what the
|
|
272
|
+
* compiler agrees they hold. The type is precisely the thing that is wrong, so
|
|
273
|
+
* the checks read the record as the untyped bag it actually is on disk.
|
|
274
|
+
*/
|
|
275
|
+
declare function unmintableReasons(record: RunRecord): string[];
|
|
276
|
+
/**
|
|
277
|
+
* Join RunRecords with their traces into canonical rollout lines. Records
|
|
278
|
+
* without spans or an explicit capture are emitted as labeled gap lines and reported in
|
|
279
|
+
* `missingTraces`. Execution-only records without a task score are rejected
|
|
280
|
+
* because a missing training label is not a zero reward.
|
|
281
|
+
*/
|
|
282
|
+
declare function mintRolloutRows(records: RunRecord[], store: TraceStore, options?: MintRolloutOptions): Promise<MintRolloutResult>;
|
|
283
|
+
//#endregion
|
|
284
|
+
export { toRewardRows as C, toVerifiersRolloutOutput as D, toSftRows as E, toVerifiersRolloutOutputs as O, toJsonl as S, toRftItems as T, SftExportOptions as _, unmintableReasons as a, VerifiersRolloutOutput as b, isRealnessGated as c, scoreOrigin as d, trainingReward as f, RftItem as g, RewardRow as h, mintRolloutRows as i, observedScore as l, RealnessLabels as m, MintRolloutResult as n, ScoreOrigin as o, trainingScore as p, RolloutScrubber as r, ScorePreference as s, MintRolloutOptions as t, observedSplitScore as u, SftRow as v, toRftItem as w, VerifiersTokenUsage as x, TrainingExportOptions as y };
|
|
285
|
+
//# sourceMappingURL=mint-BI14xehJ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mint-BI14xehJ.d.ts","names":[],"sources":["../src/rollout/exporters.ts","../src/rollout/reward.ts","../src/rollout/mint.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAiDiB;;EAEf;;;;;;EAMA;;UAiBe;;EAEf;;EAEA;;;;;;EAMA,cAAc;;;;;;;;;;;;;;;;;;;;;;KAuBJ;UAEK,kCAAkC;;EAEjD,aAAa;;KAGH,mBAAmB;UAEd;EACf,UAAU;EACV;IACE;IACA;IACA;IACA;IACA;MACE;;;;;;;;;;;;;;;;;;iBAmBU,UAAU,OAAO,qBAAqB,UAAS,mBAAwB;UAyBtE;;EAEf;EACA,OAAO;EACP;EACA;IACE;IACA;IACA;IACA;IACA,OAAO;MAUL;;;;;iBAMU,aACd,OAAO,qBACP,UAAS,wBACR;UAgCc;EACf;EACA;EACA;EACA;EACA;;UAGe;;EAEf,QAAQ;;EAER,YAAY;EACZ;EACA,SAAS;EACT,WAAW;EACX,aAAa;EACb;IACE,MAAM;IACN,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA;IACA,MAAM;MACJ;;iBASU,yBAAyB,MAAM,oBAAoB;iBA+BnD,0BACd,OAAO,qBACP,UAAS,4BACR;UAoBc;;EAEf,UAAU;;EAEV;IACE;IACA;IACA;IACA;IACA;IACA,OAAO;IACP;MACE;;iBAGU,UAAU,MAAM,oBAAoB;;iBAmBpC,WACd,OAAO,qBACP,UAAS,4BACR;iBAkBa,QAAQ,MAAM;;;;;;;;KC3VlB;;KAGP,SAAS,KAAK;;iBAGH,gBAAgB,QAAQ;;;;;;;;;;;;;;iBAiBxB,mBAAmB,QAAQ,QAAQ,OAAO;;;;;;;;;;;;;;;;iBAmB1C,cACd,QAAQ,QACR,SAAQ;;KAOE;;;;;;;iBAQI,YAAY,QAAQ,QAAQ,SAAQ,kBAA8B;;;;;;;;;iBAelE,cACd,QAAQ,QACR,SAAQ;;;;;;;;;;;;iBAiBM,eAAe,QAAQ;EAAW;EAAuB;;;;;KCvE7D,mBAAmB;UAEd;EACf,QAAQ;;;;;;;EAOR,cACE,2BACY,4BAA4B,iBAAiB;;EAE3D;;EAEA,OAAO;;EAEP;;EAEA,YAAY;;UAGG;EACf,MAAM;;EAEN;;;;;;;;;;;;;;iBA4Pc,kBAAkB,QAAQ;;;;;;;iBA+JpB,gBACpB,SAAS,aACT,OAAO,YACP,UAAS,qBACR,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as MultishotResult, M as MultishotTransportRequest, T as MultishotPersona, c as RunMultishotMatrixResult, f as RunMultishotOptions, k as MultishotToolDefinition, s as RunMultishotMatrixOptions } from "../../matrix-
|
|
1
|
+
import { E as MultishotResult, M as MultishotTransportRequest, T as MultishotPersona, c as RunMultishotMatrixResult, f as RunMultishotOptions, k as MultishotToolDefinition, s as RunMultishotMatrixOptions } from "../../matrix-CPKsRY8Y.js";
|
|
2
2
|
//#region src/multishot/golden/compare.d.ts
|
|
3
3
|
interface CompareOptions {
|
|
4
4
|
/** Stop after this many mismatches. A structural divergence high in the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { w as JudgeScore } from "../types-
|
|
2
|
-
import { A as MultishotToolExecutor, C as MultishotFatalToolError, D as MultishotShape, E as MultishotResult, F as assertMultishotShotResult, M as MultishotTransportRequest, N as MultishotTransportResponse, O as MultishotShotResultError, P as MultishotTransportToolCall, S as MultishotDriverEmptyError, T as MultishotPersona, _ as JudgeRunResult, a as MultishotCellOutput, b as runJudge, c as RunMultishotMatrixResult, d as MultishotShot, f as RunMultishotOptions, g as JudgeDimension, h as JudgeConfig, i as ConversationJudgeInput, j as MultishotTransport, k as MultishotToolDefinition, l as computeCellComposite, m as DEFAULT_JUDGE_MODEL, n as CellCompositeInput, o as MultishotJudges, p as runMultishot, r as CellCompositeScore, s as RunMultishotMatrixOptions, t as ArtifactJudgeInput, u as runMultishotMatrix, v as renderDimensions, w as MultishotMessage, x as MultishotArtifact, y as renderJsonFooter } from "../matrix-
|
|
1
|
+
import { w as JudgeScore } from "../types-BTRcIqFr.js";
|
|
2
|
+
import { A as MultishotToolExecutor, C as MultishotFatalToolError, D as MultishotShape, E as MultishotResult, F as assertMultishotShotResult, M as MultishotTransportRequest, N as MultishotTransportResponse, O as MultishotShotResultError, P as MultishotTransportToolCall, S as MultishotDriverEmptyError, T as MultishotPersona, _ as JudgeRunResult, a as MultishotCellOutput, b as runJudge, c as RunMultishotMatrixResult, d as MultishotShot, f as RunMultishotOptions, g as JudgeDimension, h as JudgeConfig, i as ConversationJudgeInput, j as MultishotTransport, k as MultishotToolDefinition, l as computeCellComposite, m as DEFAULT_JUDGE_MODEL, n as CellCompositeInput, o as MultishotJudges, p as runMultishot, r as CellCompositeScore, s as RunMultishotMatrixOptions, t as ArtifactJudgeInput, u as runMultishotMatrix, v as renderDimensions, w as MultishotMessage, x as MultishotArtifact, y as renderJsonFooter } from "../matrix-CPKsRY8Y.js";
|
|
3
3
|
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
4
4
|
//#region src/multishot/cost.d.ts
|
|
5
5
|
/**
|
package/dist/multishot/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isModelPriced, n as estimateCost } from "../metrics-
|
|
1
|
+
import { i as isModelPriced, n as estimateCost } from "../metrics-DOMpkoeb.js";
|
|
2
2
|
import { r as withCellSpend, t as runAgentMatrix } from "../matrix-pWinRMPl.js";
|
|
3
3
|
import { i as assertMultishotShotResult, n as MultishotFatalToolError, r as MultishotShotResultError, t as MultishotDriverEmptyError } from "../types-B3jzCp0p.js";
|
|
4
4
|
import { mkdirSync, writeFileSync } from "node:fs";
|
package/dist/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "@tangle-network/agent-eval — wire protocol",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.184.0",
|
|
6
6
|
"description": "HTTP and stdio RPC interface to agent-eval. The TypeScript runtime is the source of truth; this spec is the contract that cross-language clients (Python, Rust, Go) generate from.\n\nWire-protocol version: 1.1.0. Bumps on breaking changes to request/response schemas.",
|
|
7
7
|
"contact": {
|
|
8
8
|
"name": "Tangle Network",
|
package/dist/pipelines/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as budgetBreachView, i as failureClusterView, n as computeToolUseMetrics, r as judgeAgreementView, t as toolWasteView } from "../tool-waste-
|
|
1
|
+
import { a as budgetBreachView, i as failureClusterView, n as computeToolUseMetrics, r as judgeAgreementView, t as toolWasteView } from "../tool-waste-nbHPAxei.js";
|
|
2
2
|
import { t as compareToBaseline } from "../baseline-BC-eBZ7U.js";
|
|
3
3
|
import { a as isToolSpan } from "../schema-CSf6qWgZ.js";
|
|
4
|
-
import { a as hasCapturedToolArgs, r as argHash, u as runMetricExtractor } from "../query-
|
|
4
|
+
import { a as hasCapturedToolArgs, r as argHash, u as runMetricExtractor } from "../query-DlV0pdx4.js";
|
|
5
5
|
import { t as buildTrajectory } from "../trajectory-D_7rLrvE.js";
|
|
6
6
|
import { t as executionTrackByLane } from "../execution-tracks-CpgFPpS5.js";
|
|
7
7
|
//#region src/pipelines/first-divergence.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { s as ValidationError } from "./errors-Dngq5h35.js";
|
|
2
|
-
import { r as canonicalString } from "./canonical-
|
|
3
|
-
import { O as recoverTruncatedJson } from "./campaign-evidence-
|
|
4
|
-
import { n as JudgeParseError } from "./llm-judge-
|
|
5
|
-
import { i as CostLedger } from "./cost-ledger-
|
|
6
|
-
import { t as certificationEvidenceDigest } from "./verdict-
|
|
7
|
-
import { f as ModelSubstitutionError, h as assertServedModel, o as costReceiptFromLlm, s as costReceiptFromLlmError, u as maximumChargeForLlmRequest } from "./llm-client-
|
|
2
|
+
import { r as canonicalString } from "./canonical-BsZVgBhW.js";
|
|
3
|
+
import { O as recoverTruncatedJson } from "./campaign-evidence-aWEmfROB.js";
|
|
4
|
+
import { n as JudgeParseError } from "./llm-judge-C5wbADA5.js";
|
|
5
|
+
import { i as CostLedger } from "./cost-ledger-_IbkejCF.js";
|
|
6
|
+
import { t as certificationEvidenceDigest } from "./verdict-DhPoXApk.js";
|
|
7
|
+
import { f as ModelSubstitutionError, h as assertServedModel, o as costReceiptFromLlm, s as costReceiptFromLlmError, u as maximumChargeForLlmRequest } from "./llm-client-DDhZ29Vm.js";
|
|
8
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
9
9
|
import { harnessSupportsModel } from "@tangle-network/agent-interface";
|
|
10
10
|
//#region src/agent-profile.ts
|
|
@@ -539,18 +539,21 @@ function artifactKind(mimeType) {
|
|
|
539
539
|
return "file";
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
542
|
-
* Normalize
|
|
542
|
+
* Normalize an emission-ordered stream into its latest observed produced state.
|
|
543
|
+
* Artifacts are keyed by their exact output path (name, then URI, then id);
|
|
544
|
+
* proposals by id. Later observations replace earlier ones, including missing
|
|
545
|
+
* content or a rejected status. An obsolete version cannot prove completion.
|
|
546
|
+
* Distinct paths remain distinct; no path normalization or aliasing is inferred.
|
|
547
|
+
* Results retain first-seen identity order. Tool names describe invocation,
|
|
548
|
+
* not success, and are deduplicated in first-seen order.
|
|
543
549
|
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
* still yields an entry keyed by its `artifactId` so it is never silently
|
|
548
|
-
* dropped; an artifact with no `content` yields empty content, which the
|
|
549
|
-
* completion oracle's structural check then rejects on its own.
|
|
550
|
+
* An artifact without observed content yields empty content, which the
|
|
551
|
+
* completion oracle rejects. This projection does not verify external effects,
|
|
552
|
+
* recover dropped events, or establish freshness beyond the supplied stream.
|
|
550
553
|
*/
|
|
551
554
|
function extractProducedState(events) {
|
|
552
|
-
const artifacts =
|
|
553
|
-
const proposals =
|
|
555
|
+
const artifacts = /* @__PURE__ */ new Map();
|
|
556
|
+
const proposals = /* @__PURE__ */ new Map();
|
|
554
557
|
const toolCalls = [];
|
|
555
558
|
const seenTools = /* @__PURE__ */ new Set();
|
|
556
559
|
for (const ev of events) if (ev.type === "tool_call") {
|
|
@@ -561,14 +564,15 @@ function extractProducedState(events) {
|
|
|
561
564
|
}
|
|
562
565
|
} else if (ev.type === "artifact") {
|
|
563
566
|
const a = ev;
|
|
564
|
-
|
|
567
|
+
const path = a.name ?? a.uri ?? a.artifactId;
|
|
568
|
+
artifacts.set(path, {
|
|
565
569
|
kind: artifactKind(a.mimeType),
|
|
566
|
-
path
|
|
570
|
+
path,
|
|
567
571
|
content: a.content ?? ""
|
|
568
572
|
});
|
|
569
573
|
} else if (ev.type === "proposal_created") {
|
|
570
574
|
const p = ev;
|
|
571
|
-
proposals.
|
|
575
|
+
proposals.set(p.proposalId, {
|
|
572
576
|
id: p.proposalId,
|
|
573
577
|
title: p.title,
|
|
574
578
|
status: p.status ?? "pending",
|
|
@@ -576,12 +580,12 @@ function extractProducedState(events) {
|
|
|
576
580
|
});
|
|
577
581
|
}
|
|
578
582
|
return {
|
|
579
|
-
artifacts,
|
|
580
|
-
proposals,
|
|
583
|
+
artifacts: [...artifacts.values()],
|
|
584
|
+
proposals: [...proposals.values()],
|
|
581
585
|
toolCalls
|
|
582
586
|
};
|
|
583
587
|
}
|
|
584
588
|
//#endregion
|
|
585
589
|
export { CODING_HARNESSES as a, agentProfileId as c, harnessAxisOf as d, verifyCompletion as i, agentProfileModelId as l, completionVerdict as n, HARNESS_NATIVE_MODEL as o, createLlmCorrectnessChecker as r, agentProfileHash as s, extractProducedState as t, expandProfileAxes as u };
|
|
586
590
|
|
|
587
|
-
//# sourceMappingURL=produced-state-
|
|
591
|
+
//# sourceMappingURL=produced-state-D3uWsY8t.js.map
|