@tangle-network/agent-eval 0.144.5 → 0.144.7
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 +30 -0
- package/README.md +2 -0
- package/dist/{benchmark-Fmo42QVE.d.ts → agent-profile-CgDTo40f.d.ts} +91 -4
- package/dist/agent-profile-CgDTo40f.d.ts.map +1 -0
- package/dist/{agent-profile-cell-Cw0PVwDr.d.ts → agent-profile-cell-BOP-iA9Q.d.ts} +2 -2
- package/dist/{agent-profile-cell-Cw0PVwDr.d.ts.map → agent-profile-cell-BOP-iA9Q.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +471 -89
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +24 -5
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-DWIvOAGk.js → analyze-runs-BNNK7irB.js} +3 -3
- package/dist/{analyze-runs-DWIvOAGk.js.map → analyze-runs-BNNK7irB.js.map} +1 -1
- package/dist/{baseline-D_fT6277.d.ts → baseline-CavEbRyH.d.ts} +2 -23
- package/dist/baseline-CavEbRyH.d.ts.map +1 -0
- package/dist/{benchmark-command-CA_NFOmy.js → benchmark-command-BCafwNrf.js} +664 -605
- package/dist/benchmark-command-BCafwNrf.js.map +1 -0
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-CWbsj0t4.js → benchmarks-CDSolHq7.js} +4 -4
- package/dist/{benchmarks-CWbsj0t4.js.map → benchmarks-CDSolHq7.js.map} +1 -1
- package/dist/campaign/index.d.ts +8 -6
- package/dist/campaign/index.js +5 -3
- package/dist/{campaign-ClpnD7Ug.js → campaign-Tdy3h62h.js} +17 -301
- package/dist/campaign-Tdy3h62h.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{client-DAb7MWtL.d.ts → client-DjXROWpx.d.ts} +4 -4
- package/dist/{client-DAb7MWtL.d.ts.map → client-DjXROWpx.d.ts.map} +1 -1
- package/dist/{completion-verifier-VvpHRu78.d.ts → completion-verifier-foUCLif_.d.ts} +6 -6
- package/dist/{completion-verifier-VvpHRu78.d.ts.map → completion-verifier-foUCLif_.d.ts.map} +1 -1
- package/dist/contract/index.d.ts +11 -10
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +7 -6
- package/dist/contract/index.js.map +1 -1
- package/dist/control.d.ts +2 -2
- package/dist/control.js +1 -1
- package/dist/{cost-ledger-FuQvHxPm.d.ts → cost-ledger-Bv_e8XHY.d.ts} +2 -2
- package/dist/{cost-ledger-FuQvHxPm.d.ts.map → cost-ledger-Bv_e8XHY.d.ts.map} +1 -1
- package/dist/counterfactual-CWPTrMH7.js +126 -0
- package/dist/counterfactual-CWPTrMH7.js.map +1 -0
- package/dist/counterfactual-CxmxAONP.d.ts +72 -0
- package/dist/counterfactual-CxmxAONP.d.ts.map +1 -0
- package/dist/{dataset-v_Y5902-.d.ts → dataset-C8xaLXdY.d.ts} +2 -2
- package/dist/{dataset-v_Y5902-.d.ts.map → dataset-C8xaLXdY.d.ts.map} +1 -1
- package/dist/{default-registry-BwbZ9N9v.d.ts → default-registry-BZhStdjl.d.ts} +6 -5
- package/dist/default-registry-BZhStdjl.d.ts.map +1 -0
- package/dist/{default-registry-RLNNoeEP.js → default-registry-BaQXW1Ow.js} +2 -2
- package/dist/{default-registry-RLNNoeEP.js.map → default-registry-BaQXW1Ow.js.map} +1 -1
- package/dist/{dspy-rlm-engine-19FQEMBK.js → dspy-rlm-engine-BiN49gK6.js} +4 -3
- package/dist/{dspy-rlm-engine-19FQEMBK.js.map → dspy-rlm-engine-BiN49gK6.js.map} +1 -1
- package/dist/{tool-groups-ByZiqpVk.d.ts → engine-nB64f48I.d.ts} +21 -34
- package/dist/engine-nB64f48I.d.ts.map +1 -0
- package/dist/{errors-DkfjIDvD.d.ts → errors-CKPfb2aH.d.ts} +2 -2
- package/dist/{errors-DkfjIDvD.d.ts.map → errors-CKPfb2aH.d.ts.map} +1 -1
- package/dist/errors-D-LKuDhb.js.map +1 -1
- package/dist/{eval-campaign-lZcDIwQM.js → eval-campaign-DNjCvAm-.js} +7 -6
- package/dist/{eval-campaign-lZcDIwQM.js.map → eval-campaign-DNjCvAm-.js.map} +1 -1
- package/dist/{exact-types-BQ7W90C4.d.ts → exact-types-Djvzosly.d.ts} +2 -2
- package/dist/{exact-types-BQ7W90C4.d.ts.map → exact-types-Djvzosly.d.ts.map} +1 -1
- package/dist/exec-BLtYZdWo.js +49 -0
- package/dist/exec-BLtYZdWo.js.map +1 -0
- package/dist/experiment/index.d.ts +802 -0
- package/dist/experiment/index.d.ts.map +1 -0
- package/dist/experiment/index.js +1108 -0
- package/dist/experiment/index.js.map +1 -0
- package/dist/experiment-tracker-CnRICnMl.js +500 -0
- package/dist/experiment-tracker-CnRICnMl.js.map +1 -0
- package/dist/experiment-tracker-IMntXr6J.d.ts +299 -0
- package/dist/experiment-tracker-IMntXr6J.d.ts.map +1 -0
- package/dist/{external-optimizer-contracts-CdmX2K2S.d.ts → external-optimizer-contracts-CZuJNcT5.d.ts} +3 -3
- package/dist/{external-optimizer-contracts-CdmX2K2S.d.ts.map → external-optimizer-contracts-CZuJNcT5.d.ts.map} +1 -1
- package/dist/{feedback-trajectory-WK7x4mhy.d.ts → feedback-trajectory-Rh280oXo.d.ts} +4 -4
- package/dist/{feedback-trajectory-WK7x4mhy.d.ts.map → feedback-trajectory-Rh280oXo.d.ts.map} +1 -1
- package/dist/fuzz.d.ts +2 -2
- package/dist/hosted/index.d.ts +3 -3
- package/dist/{index-BZUe-ODI.d.ts → index-BZ3-y4YL.d.ts} +3 -3
- package/dist/{index-BZUe-ODI.d.ts.map → index-BZ3-y4YL.d.ts.map} +1 -1
- package/dist/{index-DSC51roc.d.ts → index-C3ssXVLv.d.ts} +2 -2
- package/dist/{index-DSC51roc.d.ts.map → index-C3ssXVLv.d.ts.map} +1 -1
- package/dist/{index-CsuAo2-J.d.ts → index-C5HOo4ZF2.d.ts} +5 -5
- package/dist/index-C5HOo4ZF2.d.ts.map +1 -0
- package/dist/{index-DEb46kc6.d.ts → index-CvSN3IG1.d.ts} +2 -2
- package/dist/{index-DEb46kc6.d.ts.map → index-CvSN3IG1.d.ts.map} +1 -1
- package/dist/{index-CNOCxBLh.d.ts → index-CvXXlyz7.d.ts} +3 -3
- package/dist/{index-CNOCxBLh.d.ts.map → index-CvXXlyz7.d.ts.map} +1 -1
- package/dist/{index-DGIzNtRv.d.ts → index-CwDrUMe0.d.ts} +3 -3
- package/dist/{index-DGIzNtRv.d.ts.map → index-CwDrUMe0.d.ts.map} +1 -1
- package/dist/{index-CpxZSlB7.d.ts → index-Sh2I0DRc.d.ts} +15 -649
- package/dist/index-Sh2I0DRc.d.ts.map +1 -0
- package/dist/index.d.ts +252 -451
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +271 -751
- package/dist/index.js.map +1 -1
- package/dist/{insight-report-D5m1z0_n.d.ts → insight-report-C6h6F_4L.d.ts} +4 -4
- package/dist/{insight-report-D5m1z0_n.d.ts.map → insight-report-C6h6F_4L.d.ts.map} +1 -1
- package/dist/{integrity-DRXobPEs.d.ts → integrity-BuqEKu-x.d.ts} +3 -3
- package/dist/{integrity-DRXobPEs.d.ts.map → integrity-BuqEKu-x.d.ts.map} +1 -1
- package/dist/integrity-MLzHOfV9.js +141 -0
- package/dist/integrity-MLzHOfV9.js.map +1 -0
- package/dist/kind-factory-BHIgPmzS.js.map +1 -1
- package/dist/ledger-core/index.d.ts +1 -1
- package/dist/{llm-client-D3EoChAU.js → llm-client-DzvMUsS_.js} +310 -10
- package/dist/llm-client-DzvMUsS_.js.map +1 -0
- package/dist/matrix/index.d.ts +2 -2
- package/dist/meta-eval/index.d.ts +2 -2
- package/dist/{mint-DD-0oQTA.js → mint-CGEkzPLf.js} +2 -2
- package/dist/{mint-DD-0oQTA.js.map → mint-CGEkzPLf.js.map} +1 -1
- package/dist/{multi-layer-verifier-BHY1gWAc.d.ts → multi-layer-verifier-DnAqwl0h.d.ts} +2 -2
- package/dist/{multi-layer-verifier-BHY1gWAc.d.ts.map → multi-layer-verifier-DnAqwl0h.d.ts.map} +1 -1
- package/dist/multishot/index.d.ts +3 -3
- package/dist/openapi.json +1 -1
- package/dist/paired-promotion-decision-B6zJ3gYM.d.ts +114 -0
- package/dist/paired-promotion-decision-B6zJ3gYM.d.ts.map +1 -0
- package/dist/pipelines/index.d.ts +2 -1
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pre-registration-DakwTRXk.js +96 -0
- package/dist/pre-registration-DakwTRXk.js.map +1 -0
- package/dist/prime-bridge-transport-6feEglLf.d.ts +49 -0
- package/dist/prime-bridge-transport-6feEglLf.d.ts.map +1 -0
- package/dist/prime-protocol-BfSalTfR.js +453 -0
- package/dist/prime-protocol-BfSalTfR.js.map +1 -0
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +242 -1
- package/dist/profile-cell.js.map +1 -0
- package/dist/promotion-policy-ChWhTDBH.d.ts +289 -0
- package/dist/promotion-policy-ChWhTDBH.d.ts.map +1 -0
- package/dist/promotion-policy-CrLrmys8.js +682 -0
- package/dist/promotion-policy-CrLrmys8.js.map +1 -0
- package/dist/{propose-review-control-BciUCZoh.js → propose-review-control-qgWLA6E9.js} +2 -2
- package/dist/{propose-review-control-BciUCZoh.js.map → propose-review-control-qgWLA6E9.js.map} +1 -1
- package/dist/{release-report-BZRWdq_t.d.ts → release-report-CI8uisI1.d.ts} +4 -4
- package/dist/{release-report-BZRWdq_t.d.ts.map → release-report-CI8uisI1.d.ts.map} +1 -1
- package/dist/{release-report-Sl0xfkFv.js → release-report-Dy39cbFF.js} +3 -3
- package/dist/{release-report-Sl0xfkFv.js.map → release-report-Dy39cbFF.js.map} +1 -1
- package/dist/{replay-B7S7Pdbw.d.ts → replay-DFf-teiC.d.ts} +8 -7
- package/dist/replay-DFf-teiC.d.ts.map +1 -0
- package/dist/{replay-GW61ezMW.js → replay-DyBLaKFc.js} +3 -3
- package/dist/{replay-GW61ezMW.js.map → replay-DyBLaKFc.js.map} +1 -1
- package/dist/reporting.d.ts +4 -4
- package/dist/reporting.js +2 -2
- package/dist/{researcher-BSiCoM1s.d.ts → researcher-BoaxeCzP.d.ts} +6 -6
- package/dist/{researcher-BSiCoM1s.d.ts.map → researcher-BoaxeCzP.d.ts.map} +1 -1
- package/dist/{reward-hacking-CyuzxKly.js → reward-hacking-B2tPL9a3.js} +12 -3
- package/dist/reward-hacking-B2tPL9a3.js.map +1 -0
- package/dist/{reward-hacking-DFgkEY4p.d.ts → reward-hacking-Cf1PtEOz.d.ts} +34 -4
- package/dist/reward-hacking-Cf1PtEOz.d.ts.map +1 -0
- package/dist/rl.d.ts +19 -9
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +16 -7
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +2 -2
- package/dist/rollout/index.js +2 -2
- package/dist/{rollout-C2fD1cf4.js → rollout-2ECTXb2N.js} +2 -2
- package/dist/{rollout-C2fD1cf4.js.map → rollout-2ECTXb2N.js.map} +1 -1
- package/dist/{rubric-predictive-validity-C4r4Y-q8.d.ts → rubric-predictive-validity-9qAwzkZm.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-C4r4Y-q8.d.ts.map → rubric-predictive-validity-9qAwzkZm.d.ts.map} +1 -1
- package/dist/{run-evidence-j5Ynww6L.d.ts → run-evidence-BDFFai9R.d.ts} +3 -3
- package/dist/{run-evidence-j5Ynww6L.d.ts.map → run-evidence-BDFFai9R.d.ts.map} +1 -1
- package/dist/{run-record-ooo9FWns.d.ts → run-record-DdSa93_W.d.ts} +4 -4
- package/dist/{run-record-ooo9FWns.d.ts.map → run-record-DdSa93_W.d.ts.map} +1 -1
- package/dist/{run-record-CWN8-VsV.js → run-record-DqOw5X6_.js} +2 -2
- package/dist/{run-record-CWN8-VsV.js.map → run-record-DqOw5X6_.js.map} +1 -1
- package/dist/{schema-Cef2cFmb.d.ts → schema-Cef2cFmb2.d.ts} +1 -1
- package/dist/schema-Cef2cFmb2.d.ts.map +1 -0
- package/dist/{semantic-concept-judge-DKRtp2sY.js → semantic-concept-judge-Bmrq6yqU.js} +2 -2
- package/dist/{semantic-concept-judge-DKRtp2sY.js.map → semantic-concept-judge-Bmrq6yqU.js.map} +1 -1
- package/dist/sequential-D-BLJBKU.js +299 -0
- package/dist/sequential-D-BLJBKU.js.map +1 -0
- package/dist/{server-Df00sdwz.js → server-iu0ede49.js} +2 -2
- package/dist/{server-Df00sdwz.js.map → server-iu0ede49.js.map} +1 -1
- package/dist/{single-run-lock-D5iN0Xzb.js → single-run-lock-BMQEv1wG.js} +7 -161
- package/dist/single-run-lock-BMQEv1wG.js.map +1 -0
- package/dist/{skill-usage-DUvvudWR.d.ts → skill-usage-CJlWEUFt.d.ts} +11 -11
- package/dist/{skill-usage-DUvvudWR.d.ts.map → skill-usage-CJlWEUFt.d.ts.map} +1 -1
- package/dist/{skillopt-optimization-method-CGz9ywhM.d.ts → skillopt-optimization-method-BO7NAl3b.d.ts} +11 -297
- package/dist/skillopt-optimization-method-BO7NAl3b.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-C4FX42dy.js → skillopt-optimization-method-CQwZ-ZX8.js} +8 -652
- package/dist/skillopt-optimization-method-CQwZ-ZX8.js.map +1 -0
- package/dist/statistical-heldout-Dn9ruizm.d.ts +555 -0
- package/dist/statistical-heldout-Dn9ruizm.d.ts.map +1 -0
- package/dist/{statistics-B4u_CiFd.d.ts → statistics-D6Uebe_4.d.ts} +2 -2
- package/dist/{statistics-B4u_CiFd.d.ts.map → statistics-D6Uebe_4.d.ts.map} +1 -1
- package/dist/steps-BArUxhna.d.ts +51 -0
- package/dist/steps-BArUxhna.d.ts.map +1 -0
- package/dist/{integrity-fdt8XPAv.js → store-DNe_Uv1Q.js} +2 -140
- package/dist/store-DNe_Uv1Q.js.map +1 -0
- package/dist/{summary-report-BOM6dfP7.d.ts → summary-report-DuUS_i7W.d.ts} +4 -115
- package/dist/summary-report-DuUS_i7W.d.ts.map +1 -0
- package/dist/{summary-report-9A5y7EsK.js → summary-report-Lf-5I7xh.js} +2 -2
- package/dist/{summary-report-9A5y7EsK.js.map → summary-report-Lf-5I7xh.js.map} +1 -1
- package/dist/supervisor-run/index.d.ts +2 -2
- package/dist/supervisor-run/index.js +1 -1
- package/dist/{supervisor-run-DiyQVczd.js → supervisor-run-D_sokXcO.js} +32 -8
- package/dist/{supervisor-run-DiyQVczd.js.map → supervisor-run-D_sokXcO.js.map} +1 -1
- package/dist/tool-groups-DIVBnJyl.d.ts +28 -0
- package/dist/tool-groups-DIVBnJyl.d.ts.map +1 -0
- package/dist/trace-repair/index.d.ts +2102 -0
- package/dist/trace-repair/index.d.ts.map +1 -0
- package/dist/trace-repair/index.js +3878 -0
- package/dist/trace-repair/index.js.map +1 -0
- package/dist/traces.d.ts +6 -6
- package/dist/traces.js +3 -2
- package/dist/trajectory-YC15QDYQ.d.ts +24 -0
- package/dist/trajectory-YC15QDYQ.d.ts.map +1 -0
- package/dist/trajectory-replay/index.d.ts +781 -0
- package/dist/trajectory-replay/index.d.ts.map +1 -0
- package/dist/trajectory-replay/index.js +2103 -0
- package/dist/trajectory-replay/index.js.map +1 -0
- package/dist/{types-BjMFz88h.d.ts → types-D216SgwM.d.ts} +228 -9
- package/dist/types-D216SgwM.d.ts.map +1 -0
- package/dist/{types-yLK8gXE9.d.ts → types-D4mog56g.d.ts} +2 -2
- package/dist/{types-yLK8gXE9.d.ts.map → types-D4mog56g.d.ts.map} +1 -1
- package/dist/{types-CZt1PBIk.d.ts → types-DF_Udrp-.d.ts} +54 -5
- package/dist/{types-CZt1PBIk.d.ts.map → types-DF_Udrp-.d.ts.map} +1 -1
- package/dist/{types-Dcoaqcsc.d.ts → types-DYuNHo9R.d.ts} +5 -5
- package/dist/{types-Dcoaqcsc.d.ts.map → types-DYuNHo9R.d.ts.map} +1 -1
- package/dist/usage-receipt-EVI8B8Xu.js.map +1 -1
- package/dist/verdict-DExhxfgR.d.ts +201 -0
- package/dist/verdict-DExhxfgR.d.ts.map +1 -0
- package/dist/verdict-cache-BCcOh0kF.js +159 -0
- package/dist/verdict-cache-BCcOh0kF.js.map +1 -0
- package/dist/wire/index.d.ts +3 -3
- package/dist/wire/index.js +1 -1
- package/docs/building-doctrine.md +15 -0
- package/docs/charter.md +112 -0
- package/docs/experiment.md +104 -0
- package/docs/prime-analyst.md +1 -0
- package/docs/trace-analysis.md +26 -0
- package/docs/trace-repair-admission.md +194 -0
- package/docs/trace-repair-analyst-arms.md +121 -0
- package/docs/trace-repair-continuation.md +107 -0
- package/docs/trace-repair-grader.md +163 -0
- package/docs/trajectory-replay.md +110 -0
- package/docs/verification-strategies.md +103 -0
- package/package.json +21 -4
- package/dist/agent-profile-cell-CbfBm2g6.js +0 -335
- package/dist/agent-profile-cell-CbfBm2g6.js.map +0 -1
- package/dist/baseline-D_fT6277.d.ts.map +0 -1
- package/dist/benchmark-Fmo42QVE.d.ts.map +0 -1
- package/dist/benchmark-command-CA_NFOmy.js.map +0 -1
- package/dist/campaign-ClpnD7Ug.js.map +0 -1
- package/dist/default-registry-BwbZ9N9v.d.ts.map +0 -1
- package/dist/index-CpxZSlB7.d.ts.map +0 -1
- package/dist/index-CsuAo2-J.d.ts.map +0 -1
- package/dist/integrity-fdt8XPAv.js.map +0 -1
- package/dist/llm-client-D3EoChAU.js.map +0 -1
- package/dist/replay-B7S7Pdbw.d.ts.map +0 -1
- package/dist/reward-hacking-CyuzxKly.js.map +0 -1
- package/dist/reward-hacking-DFgkEY4p.d.ts.map +0 -1
- package/dist/schema-Cef2cFmb.d.ts.map +0 -1
- package/dist/single-run-lock-D5iN0Xzb.js.map +0 -1
- package/dist/skillopt-optimization-method-C4FX42dy.js.map +0 -1
- package/dist/skillopt-optimization-method-CGz9ywhM.d.ts.map +0 -1
- package/dist/summary-report-BOM6dfP7.d.ts.map +0 -1
- package/dist/tool-groups-ByZiqpVk.d.ts.map +0 -1
- package/dist/types-BjMFz88h.d.ts.map +0 -1
- package/dist/verdict-Dps8_okt.d.ts +0 -37
- package/dist/verdict-Dps8_okt.d.ts.map +0 -1
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import { c as ValidationError } from "./errors-D-LKuDhb.js";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
//#region src/analyst/equal-terms.ts
|
|
4
|
+
/**
|
|
5
|
+
* Refuses a comparison whose arms are not on equal terms: an empty set, a
|
|
6
|
+
* duplicated id, or unequal repair turns — a retry is a second sample the
|
|
7
|
+
* other arms never got. `noun` names the arm kind in every message so a
|
|
8
|
+
* refusal reads in the caller's vocabulary.
|
|
9
|
+
*/
|
|
10
|
+
function assertEqualDeclarativeTerms(noun, terms) {
|
|
11
|
+
if (terms.length === 0) throw new ValidationError(`a ${noun} comparison needs at least one ${noun}`);
|
|
12
|
+
const ids = terms.map((term) => term.id);
|
|
13
|
+
const duplicate = ids.find((id, index) => ids.indexOf(id) !== index);
|
|
14
|
+
if (duplicate !== void 0) throw new ValidationError(`${noun} '${duplicate}' is declared twice`);
|
|
15
|
+
const repairTurns = terms[0].repairTurns;
|
|
16
|
+
const unequal = terms.find((term) => term.repairTurns !== repairTurns);
|
|
17
|
+
if (unequal) throw new ValidationError(`${noun} '${unequal.id}' gets ${unequal.repairTurns} bounded repair turns and ${noun} '${terms[0].id}' gets ${repairTurns}; a retry is a second sample the other arms never got`);
|
|
18
|
+
return {
|
|
19
|
+
ids,
|
|
20
|
+
repairTurns
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/analyst/prime-protocol.ts
|
|
25
|
+
function buildPrimePrompt(spec) {
|
|
26
|
+
return [
|
|
27
|
+
`QUESTION: ${spec.question}`,
|
|
28
|
+
"",
|
|
29
|
+
...spec.taskDefinition === void 0 ? [] : [
|
|
30
|
+
"TASK DEFINITION:",
|
|
31
|
+
spec.taskDefinition,
|
|
32
|
+
""
|
|
33
|
+
],
|
|
34
|
+
...spec.contractLines,
|
|
35
|
+
"",
|
|
36
|
+
spec.trajectoryHeader,
|
|
37
|
+
spec.renderedTrajectory,
|
|
38
|
+
...spec.trailer === void 0 ? [] : ["", spec.trailer]
|
|
39
|
+
].join("\n");
|
|
40
|
+
}
|
|
41
|
+
/** Carries the malformed reply and the contract — never the trajectory. */
|
|
42
|
+
function buildPrimeRepairPrompt(spec) {
|
|
43
|
+
return [
|
|
44
|
+
"Your previous reply to a trace-analysis task was structurally malformed and could not be parsed",
|
|
45
|
+
`(${spec.defect}). Below is your previous reply verbatim. Re-emit ONLY the corrected JSON — one`,
|
|
46
|
+
"fenced ```json block, no other text, no tools. The JSON object has exactly two fields:",
|
|
47
|
+
...spec.repairContractLines,
|
|
48
|
+
"",
|
|
49
|
+
"PREVIOUS REPLY:",
|
|
50
|
+
spec.previousReply
|
|
51
|
+
].join("\n");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Recover the reply's JSON object.
|
|
55
|
+
*
|
|
56
|
+
* Distinct from `extractJsonPayload` in ../llm-client, which serves a response
|
|
57
|
+
* that DECLARES a JSON root and therefore must not scan onward. A prime reply
|
|
58
|
+
* is prose plus a fenced block, and when the model emits several fences the
|
|
59
|
+
* last one is its answer — so fences are scanned in reverse, and only then is a
|
|
60
|
+
* brace-to-brace slice tried.
|
|
61
|
+
*/
|
|
62
|
+
function extractPrimeJsonObject(text) {
|
|
63
|
+
const direct = parsePrimeJsonObject(text);
|
|
64
|
+
if (direct) return direct;
|
|
65
|
+
const fenced = [...text.matchAll(/```(?:json)?\s*\n?([\s\S]*?)```/g)];
|
|
66
|
+
for (let index = fenced.length - 1; index >= 0; index -= 1) {
|
|
67
|
+
const candidate = parsePrimeJsonObject(fenced[index][1]);
|
|
68
|
+
if (candidate) return candidate;
|
|
69
|
+
}
|
|
70
|
+
const start = text.indexOf("{");
|
|
71
|
+
const end = text.lastIndexOf("}");
|
|
72
|
+
if (start >= 0 && end > start) {
|
|
73
|
+
const candidate = parsePrimeJsonObject(text.slice(start, end + 1));
|
|
74
|
+
if (candidate) return candidate;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
/** Why the reply cannot be read as a prime answer, or null when it can. */
|
|
79
|
+
function primeReplyDefect(parsed, rowsField) {
|
|
80
|
+
if (parsed === null) return "no parseable JSON object";
|
|
81
|
+
if (!Array.isArray(parsed[rowsField])) return `JSON has no "${rowsField}" array`;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
function parsePrimeJsonObject(text) {
|
|
85
|
+
try {
|
|
86
|
+
const value = JSON.parse(text.trim());
|
|
87
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
88
|
+
} catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function emptyPrimeRawUsage() {
|
|
93
|
+
return {
|
|
94
|
+
calls: null,
|
|
95
|
+
inputTokens: null,
|
|
96
|
+
outputTokens: null,
|
|
97
|
+
bridgeEstimated: false
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Read the bridge's OpenAI-shaped `usage` object. */
|
|
101
|
+
function normalizePrimeUsage(raw) {
|
|
102
|
+
if (typeof raw !== "object" || raw === null) return emptyPrimeRawUsage();
|
|
103
|
+
const record = raw;
|
|
104
|
+
return {
|
|
105
|
+
calls: tokenCountOrNull(record.model_requests),
|
|
106
|
+
inputTokens: tokenCountOrNull(record.prompt_tokens),
|
|
107
|
+
outputTokens: tokenCountOrNull(record.completion_tokens),
|
|
108
|
+
bridgeEstimated: record.estimated === true
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Sum two turns. Each side poisons independently: two turns that both report
|
|
113
|
+
* input and neither report output yield a real input total beside a null
|
|
114
|
+
* output, because discarding a measured count is as wrong as inventing one.
|
|
115
|
+
*/
|
|
116
|
+
function mergePrimeRawUsage(a, b) {
|
|
117
|
+
return {
|
|
118
|
+
calls: sumOrNull(a.calls, b.calls),
|
|
119
|
+
inputTokens: sumOrNull(a.inputTokens, b.inputTokens),
|
|
120
|
+
outputTokens: sumOrNull(a.outputTokens, b.outputTokens),
|
|
121
|
+
bridgeEstimated: a.bridgeEstimated || b.bridgeEstimated
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function sumOrNull(a, b) {
|
|
125
|
+
return a !== null && b !== null ? a + b : null;
|
|
126
|
+
}
|
|
127
|
+
function tokenCountOrNull(value) {
|
|
128
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Bind raw prime usage to agent-eval's typed receipt.
|
|
132
|
+
*
|
|
133
|
+
* `RunTokenUsage.input` and `.output` are non-nullable, so a one-sided count
|
|
134
|
+
* cannot round-trip through `tokens` without writing a zero nobody measured.
|
|
135
|
+
* The complete-accounting field therefore stays null, the reported side is
|
|
136
|
+
* carried verbatim in `partialTokens`, and its price becomes the receipt's
|
|
137
|
+
* `knownCostUsd` lower bound.
|
|
138
|
+
*
|
|
139
|
+
* Only agent-eval calls this; consumers with no pricing table read
|
|
140
|
+
* `PrimeRawUsage` directly.
|
|
141
|
+
*/
|
|
142
|
+
function analystUsageReceiptFromPrimeUsage(usage, pricing) {
|
|
143
|
+
const { calls, inputTokens, outputTokens, bridgeEstimated } = usage;
|
|
144
|
+
const estimatedTokens = bridgeEstimated ? { tokensEstimated: true } : {};
|
|
145
|
+
if (inputTokens !== null && outputTokens !== null) return {
|
|
146
|
+
calls,
|
|
147
|
+
tokens: {
|
|
148
|
+
input: inputTokens,
|
|
149
|
+
output: outputTokens
|
|
150
|
+
},
|
|
151
|
+
cost: {
|
|
152
|
+
kind: "estimated",
|
|
153
|
+
usd: priceTokens(inputTokens, outputTokens, pricing)
|
|
154
|
+
},
|
|
155
|
+
...estimatedTokens
|
|
156
|
+
};
|
|
157
|
+
if (inputTokens === null && outputTokens === null) return {
|
|
158
|
+
calls,
|
|
159
|
+
tokens: null,
|
|
160
|
+
cost: {
|
|
161
|
+
kind: "uncaptured",
|
|
162
|
+
usd: null
|
|
163
|
+
},
|
|
164
|
+
...estimatedTokens
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
calls,
|
|
168
|
+
tokens: null,
|
|
169
|
+
partialTokens: {
|
|
170
|
+
input: inputTokens,
|
|
171
|
+
output: outputTokens
|
|
172
|
+
},
|
|
173
|
+
cost: {
|
|
174
|
+
kind: "uncaptured",
|
|
175
|
+
usd: null
|
|
176
|
+
},
|
|
177
|
+
knownCostUsd: priceTokens(inputTokens ?? 0, outputTokens ?? 0, pricing),
|
|
178
|
+
...estimatedTokens
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function priceTokens(input, output, pricing) {
|
|
182
|
+
return (input * pricing.inputUsdPerMillion + output * pricing.outputUsdPerMillion) / 1e6;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Run the protocol: one call, one bounded repair turn on a structurally
|
|
186
|
+
* malformed reply, then decode. Zero valid rows from a well-formed reply is an
|
|
187
|
+
* honest null, not a failure.
|
|
188
|
+
*/
|
|
189
|
+
async function runPrimeExchange(options) {
|
|
190
|
+
const { contract } = options;
|
|
191
|
+
const turns = [];
|
|
192
|
+
const repair = {
|
|
193
|
+
attempted: false,
|
|
194
|
+
succeeded: null
|
|
195
|
+
};
|
|
196
|
+
const first = await callPrimeTurn(options, options.prompt);
|
|
197
|
+
if (!first.ok) return {
|
|
198
|
+
ok: false,
|
|
199
|
+
failure: first.failure,
|
|
200
|
+
usage: mergeTurns(turns),
|
|
201
|
+
turns,
|
|
202
|
+
repair
|
|
203
|
+
};
|
|
204
|
+
turns.push({
|
|
205
|
+
turn: "first",
|
|
206
|
+
usage: first.usage,
|
|
207
|
+
rawUsage: first.rawUsage
|
|
208
|
+
});
|
|
209
|
+
let reply = first.content;
|
|
210
|
+
let parsed = extractPrimeJsonObject(reply);
|
|
211
|
+
let defect = primeReplyDefect(parsed, contract.rowsField);
|
|
212
|
+
if (defect !== null && options.repair) {
|
|
213
|
+
repair.attempted = true;
|
|
214
|
+
const second = await callPrimeTurn(options, buildPrimeRepairPrompt({
|
|
215
|
+
defect,
|
|
216
|
+
previousReply: reply,
|
|
217
|
+
repairContractLines: contract.repairContractLines
|
|
218
|
+
}));
|
|
219
|
+
if (!second.ok) return {
|
|
220
|
+
ok: false,
|
|
221
|
+
failure: second.failure,
|
|
222
|
+
usage: mergeTurns(turns),
|
|
223
|
+
turns,
|
|
224
|
+
repair,
|
|
225
|
+
reply
|
|
226
|
+
};
|
|
227
|
+
turns.push({
|
|
228
|
+
turn: "repair",
|
|
229
|
+
usage: second.usage,
|
|
230
|
+
rawUsage: second.rawUsage
|
|
231
|
+
});
|
|
232
|
+
reply = second.content;
|
|
233
|
+
parsed = extractPrimeJsonObject(reply);
|
|
234
|
+
defect = primeReplyDefect(parsed, contract.rowsField);
|
|
235
|
+
repair.succeeded = defect === null;
|
|
236
|
+
}
|
|
237
|
+
const usage = mergeTurns(turns);
|
|
238
|
+
if (defect !== null) return {
|
|
239
|
+
ok: false,
|
|
240
|
+
failure: {
|
|
241
|
+
kind: "malformed-reply",
|
|
242
|
+
message: `${defect} in prime reply${repair.attempted ? " even after the bounded repair turn" : ""}`
|
|
243
|
+
},
|
|
244
|
+
usage,
|
|
245
|
+
turns,
|
|
246
|
+
repair,
|
|
247
|
+
reply
|
|
248
|
+
};
|
|
249
|
+
const rawRows = parsed[contract.rowsField];
|
|
250
|
+
const rows = [];
|
|
251
|
+
const rejected = [];
|
|
252
|
+
let overflow = 0;
|
|
253
|
+
rawRows.forEach((row, index) => {
|
|
254
|
+
const decoded = contract.decodeRow(row, index);
|
|
255
|
+
if (!decoded.ok) {
|
|
256
|
+
rejected.push({
|
|
257
|
+
index,
|
|
258
|
+
reason: decoded.reason
|
|
259
|
+
});
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (contract.maxRows !== void 0 && rows.length >= contract.maxRows) {
|
|
263
|
+
overflow += 1;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
rows.push(decoded.row);
|
|
267
|
+
});
|
|
268
|
+
const answer = parsed.answer;
|
|
269
|
+
return {
|
|
270
|
+
ok: true,
|
|
271
|
+
answer: typeof answer === "string" ? answer : null,
|
|
272
|
+
rows,
|
|
273
|
+
rejected,
|
|
274
|
+
reportedRows: rawRows.length,
|
|
275
|
+
overflow,
|
|
276
|
+
usage,
|
|
277
|
+
turns,
|
|
278
|
+
repair,
|
|
279
|
+
reply
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
async function callPrimeTurn(options, content) {
|
|
283
|
+
const { transport, url, model, timeoutMs, signal } = options;
|
|
284
|
+
const controller = new AbortController();
|
|
285
|
+
const forwardAbort = () => controller.abort(signal?.reason);
|
|
286
|
+
if (signal?.aborted) controller.abort(signal.reason);
|
|
287
|
+
else signal?.addEventListener("abort", forwardAbort, { once: true });
|
|
288
|
+
const deadline = setTimeout(() => controller.abort(), timeoutMs);
|
|
289
|
+
let result;
|
|
290
|
+
try {
|
|
291
|
+
result = await transport({
|
|
292
|
+
url,
|
|
293
|
+
body: {
|
|
294
|
+
model,
|
|
295
|
+
messages: [{
|
|
296
|
+
role: "user",
|
|
297
|
+
content
|
|
298
|
+
}]
|
|
299
|
+
},
|
|
300
|
+
signal: controller.signal
|
|
301
|
+
});
|
|
302
|
+
} catch (error) {
|
|
303
|
+
if (signal?.aborted) return {
|
|
304
|
+
ok: false,
|
|
305
|
+
failure: {
|
|
306
|
+
kind: "aborted",
|
|
307
|
+
message: "prime exchange cancelled by the caller",
|
|
308
|
+
cause: error
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
if (controller.signal.aborted) return {
|
|
312
|
+
ok: false,
|
|
313
|
+
failure: {
|
|
314
|
+
kind: "deadline",
|
|
315
|
+
message: `bridge call exceeded ${timeoutMs}ms`
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
return {
|
|
319
|
+
ok: false,
|
|
320
|
+
failure: {
|
|
321
|
+
kind: "transport",
|
|
322
|
+
message: `bridge transport failure: ${error instanceof Error ? error.message : String(error)}`
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
} finally {
|
|
326
|
+
clearTimeout(deadline);
|
|
327
|
+
signal?.removeEventListener("abort", forwardAbort);
|
|
328
|
+
}
|
|
329
|
+
if (result.status !== 200) {
|
|
330
|
+
const bodySnippet = result.text.slice(0, 500);
|
|
331
|
+
return {
|
|
332
|
+
ok: false,
|
|
333
|
+
failure: {
|
|
334
|
+
kind: "http-status",
|
|
335
|
+
message: `bridge HTTP ${result.status}: ${bodySnippet}`,
|
|
336
|
+
status: result.status,
|
|
337
|
+
bodySnippet
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
let response;
|
|
342
|
+
try {
|
|
343
|
+
response = JSON.parse(result.text);
|
|
344
|
+
} catch {
|
|
345
|
+
return {
|
|
346
|
+
ok: false,
|
|
347
|
+
failure: {
|
|
348
|
+
kind: "unparseable-json",
|
|
349
|
+
message: `bridge returned unparseable JSON (${result.text.length} bytes)`
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
const replyContent = primeReplyContent(response);
|
|
354
|
+
if (replyContent === null) return {
|
|
355
|
+
ok: false,
|
|
356
|
+
failure: {
|
|
357
|
+
kind: "no-content",
|
|
358
|
+
message: "bridge reply carries no message content"
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
const rawUsage = primeReplyUsage(response);
|
|
362
|
+
return {
|
|
363
|
+
ok: true,
|
|
364
|
+
content: replyContent,
|
|
365
|
+
usage: normalizePrimeUsage(rawUsage),
|
|
366
|
+
rawUsage
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Fold from the FIRST turn, never from an empty receipt: an all-null identity
|
|
371
|
+
* would poison every side it merged with and erase counts the bridge reported.
|
|
372
|
+
*/
|
|
373
|
+
function mergeTurns(turns) {
|
|
374
|
+
if (turns.length === 0) return emptyPrimeRawUsage();
|
|
375
|
+
return turns.slice(1).reduce((total, turn) => mergePrimeRawUsage(total, turn.usage), turns[0].usage);
|
|
376
|
+
}
|
|
377
|
+
function primeReplyContent(response) {
|
|
378
|
+
if (typeof response !== "object" || response === null) return null;
|
|
379
|
+
const choices = response.choices;
|
|
380
|
+
if (!Array.isArray(choices) || choices.length === 0) return null;
|
|
381
|
+
const message = choices[0]?.message;
|
|
382
|
+
if (typeof message !== "object" || message === null) return null;
|
|
383
|
+
const content = message.content;
|
|
384
|
+
return typeof content === "string" && content.length > 0 ? content : null;
|
|
385
|
+
}
|
|
386
|
+
function primeReplyUsage(response) {
|
|
387
|
+
if (typeof response !== "object" || response === null) return null;
|
|
388
|
+
return response.usage ?? null;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Render, measure, fall back to the capped projection, re-measure, fail loud.
|
|
392
|
+
*
|
|
393
|
+
* Inline is the only delivery prime has, so an oversized trajectory is a
|
|
394
|
+
* refusal rather than a silent truncation: dropping spans would understate the
|
|
395
|
+
* trajectory and the analyst would answer a question about a different run.
|
|
396
|
+
*/
|
|
397
|
+
async function projectPrimeTrajectory(source, limits) {
|
|
398
|
+
let fetch = "full";
|
|
399
|
+
let items = await source.full();
|
|
400
|
+
if (items === null) {
|
|
401
|
+
fetch = "capped";
|
|
402
|
+
items = await source.capped();
|
|
403
|
+
}
|
|
404
|
+
let rendered = JSON.stringify(items);
|
|
405
|
+
if (rendered.length > limits.maxInlineChars && fetch === "full") {
|
|
406
|
+
fetch = "capped";
|
|
407
|
+
items = await source.capped();
|
|
408
|
+
rendered = JSON.stringify(items);
|
|
409
|
+
}
|
|
410
|
+
if (rendered.length > limits.maxInlineChars) return {
|
|
411
|
+
ok: false,
|
|
412
|
+
reason: `trajectory renders to ${rendered.length} chars even at ${source.cappedDescription}; inline delivery impossible`,
|
|
413
|
+
renderedChars: rendered.length
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
ok: true,
|
|
417
|
+
items,
|
|
418
|
+
rendered,
|
|
419
|
+
delivery: {
|
|
420
|
+
mode: "inline-json",
|
|
421
|
+
fetch,
|
|
422
|
+
renderedChars: rendered.length
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Digest of everything a consumer can send to the bridge under the prime
|
|
428
|
+
* protocol, recorded per observation so a prime result names the exact contract
|
|
429
|
+
* that produced it.
|
|
430
|
+
*
|
|
431
|
+
* Computed over the ACTUALLY composed contract, so two consumers that both
|
|
432
|
+
* stamp `analyst_id: 'prime'` while asking materially different questions get
|
|
433
|
+
* different digests by construction. That is what makes 'prime' a reproducible
|
|
434
|
+
* claim rather than a label.
|
|
435
|
+
*/
|
|
436
|
+
function primeProtocolSha256(identity) {
|
|
437
|
+
return createHash("sha256").update(JSON.stringify({
|
|
438
|
+
kind: "prime-analyst-protocol",
|
|
439
|
+
question: identity.question,
|
|
440
|
+
taskPrompt: identity.taskDefinition ?? null,
|
|
441
|
+
outputContract: identity.contractLines,
|
|
442
|
+
repairContract: buildPrimeRepairPrompt({
|
|
443
|
+
defect: "<defect>",
|
|
444
|
+
previousReply: "<previous-reply>",
|
|
445
|
+
repairContractLines: identity.repairContractLines
|
|
446
|
+
}),
|
|
447
|
+
limits: identity.limits
|
|
448
|
+
})).digest("hex");
|
|
449
|
+
}
|
|
450
|
+
//#endregion
|
|
451
|
+
export { extractPrimeJsonObject as a, primeProtocolSha256 as c, runPrimeExchange as d, assertEqualDeclarativeTerms as f, emptyPrimeRawUsage as i, primeReplyDefect as l, buildPrimePrompt as n, mergePrimeRawUsage as o, buildPrimeRepairPrompt as r, normalizePrimeUsage as s, analystUsageReceiptFromPrimeUsage as t, projectPrimeTrajectory as u };
|
|
452
|
+
|
|
453
|
+
//# sourceMappingURL=prime-protocol-BfSalTfR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prime-protocol-BfSalTfR.js","names":[],"sources":["../src/analyst/equal-terms.ts","../src/analyst/prime-protocol.ts"],"sourcesContent":["import { ValidationError } from '../errors'\n\n/**\n * The terms every declarative-arm comparison must hold equal before any\n * per-kind check runs. Arm kinds (analyst definitions, repair arms) extend\n * the comparison with their own fields; the refusals here are the floor.\n */\nexport interface DeclarativeArmTerms {\n readonly id: string\n /** Bounded repair turns the arm earns on a malformed reply. */\n readonly repairTurns: number\n}\n\nexport interface EqualDeclarativeTerms {\n readonly ids: readonly string[]\n readonly repairTurns: number\n}\n\n/**\n * Refuses a comparison whose arms are not on equal terms: an empty set, a\n * duplicated id, or unequal repair turns — a retry is a second sample the\n * other arms never got. `noun` names the arm kind in every message so a\n * refusal reads in the caller's vocabulary.\n */\nexport function assertEqualDeclarativeTerms(\n noun: string,\n terms: ReadonlyArray<DeclarativeArmTerms>,\n): EqualDeclarativeTerms {\n if (terms.length === 0) {\n throw new ValidationError(`a ${noun} comparison needs at least one ${noun}`)\n }\n const ids = terms.map((term) => term.id)\n const duplicate = ids.find((id, index) => ids.indexOf(id) !== index)\n if (duplicate !== undefined) {\n throw new ValidationError(`${noun} '${duplicate}' is declared twice`)\n }\n const repairTurns = terms[0]!.repairTurns\n const unequal = terms.find((term) => term.repairTurns !== repairTurns)\n if (unequal) {\n throw new ValidationError(\n `${noun} '${unequal.id}' gets ${unequal.repairTurns} bounded repair turns and ` +\n `${noun} '${terms[0]!.id}' gets ${repairTurns}; a retry is a second sample ` +\n 'the other arms never got',\n )\n }\n return { ids, repairTurns }\n}\n","import { createHash } from 'node:crypto'\nimport type { CustomTokenPricing } from '../cost-ledger'\nimport type { PrimeBridgeTransport, PrimeBridgeTransportResult } from './prime-bridge-transport'\nimport type { ReplyContract, ReplyRowDecoded } from './reply-contract'\nimport type { AnalystUsageReceipt } from './types'\n\n/**\n * The prime analyst protocol: a one-shot RLM reached through an\n * OpenAI-compatible bridge, given the whole trajectory inline because it has no\n * REPL and no trace tools, answering in one fenced JSON block of short strings.\n *\n * This module owns every part of that protocol that does not depend on what the\n * rows MEAN: prompt and contract composition, the bounded repair turn, reply\n * extraction, row decoding order, the render-measure-fall-back-fail-loud\n * projection ladder, usage normalization, and the protocol identity digest.\n *\n * The cut: the core speaks RAW ROWS and never names a finding type. It knows a\n * prime reply carries an `answer` string plus an array of rows under a named\n * field, and that each row is decoded by a caller-supplied function. Consumers\n * — the CodeTraceBench benchmark runner here, a span-grounded trace analyzer\n * elsewhere — map decoded rows into their own finding shape on the way out. So\n * nothing in this file may import a block type, a finding type, or a trace\n * store, and no consumer needs another copy of the protocol.\n */\n\n// ── Reply contract ───────────────────────────────────────────────────\n\n/**\n * The prime reply grammar is the general analyst reply contract: these aliases\n * keep every prime-protocol consumer compiling against the shared type in\n * ./reply-contract. The exchange below reads the base fields (`rowsField`,\n * contract lines, `decodeRow`, `maxRows`); the strict-envelope knobs serve\n * one-shot JSON arms and are inert here.\n */\nexport type PrimeRowDecoded<TRow> = ReplyRowDecoded<TRow>\n\nexport type PrimeReplyContract<TRow> = ReplyContract<TRow>\n\n// ── Prompt composition ───────────────────────────────────────────────\n\nexport interface PrimePromptSpec {\n question: string\n /** Task definition spliced under a `TASK DEFINITION:` heading. Omit when the question is the whole task. */\n taskDefinition?: string\n contractLines: readonly string[]\n /** Line introducing the trajectory, e.g. `TRAJECTORY (trace_id X; 12 assistant step spans; ...):`. */\n trajectoryHeader: string\n renderedTrajectory: string\n /** Material appended after the trajectory, e.g. the final-verification spans. */\n trailer?: string\n}\n\nexport function buildPrimePrompt(spec: PrimePromptSpec): string {\n return [\n `QUESTION: ${spec.question}`,\n '',\n ...(spec.taskDefinition === undefined ? [] : ['TASK DEFINITION:', spec.taskDefinition, '']),\n ...spec.contractLines,\n '',\n spec.trajectoryHeader,\n spec.renderedTrajectory,\n ...(spec.trailer === undefined ? [] : ['', spec.trailer]),\n ].join('\\n')\n}\n\nexport interface PrimeRepairPromptSpec {\n defect: string\n previousReply: string\n repairContractLines: readonly string[]\n}\n\n/** Carries the malformed reply and the contract — never the trajectory. */\nexport function buildPrimeRepairPrompt(spec: PrimeRepairPromptSpec): string {\n return [\n 'Your previous reply to a trace-analysis task was structurally malformed and could not be parsed',\n `(${spec.defect}). Below is your previous reply verbatim. Re-emit ONLY the corrected JSON — one`,\n 'fenced ```json block, no other text, no tools. The JSON object has exactly two fields:',\n ...spec.repairContractLines,\n '',\n 'PREVIOUS REPLY:',\n spec.previousReply,\n ].join('\\n')\n}\n\n// ── Reply extraction ─────────────────────────────────────────────────\n\n/**\n * Recover the reply's JSON object.\n *\n * Distinct from `extractJsonPayload` in ../llm-client, which serves a response\n * that DECLARES a JSON root and therefore must not scan onward. A prime reply\n * is prose plus a fenced block, and when the model emits several fences the\n * last one is its answer — so fences are scanned in reverse, and only then is a\n * brace-to-brace slice tried.\n */\nexport function extractPrimeJsonObject(text: string): Record<string, unknown> | null {\n const direct = parsePrimeJsonObject(text)\n if (direct) return direct\n const fenced = [...text.matchAll(/```(?:json)?\\s*\\n?([\\s\\S]*?)```/g)]\n for (let index = fenced.length - 1; index >= 0; index -= 1) {\n const candidate = parsePrimeJsonObject(fenced[index]![1]!)\n if (candidate) return candidate\n }\n const start = text.indexOf('{')\n const end = text.lastIndexOf('}')\n if (start >= 0 && end > start) {\n const candidate = parsePrimeJsonObject(text.slice(start, end + 1))\n if (candidate) return candidate\n }\n return null\n}\n\n/** Why the reply cannot be read as a prime answer, or null when it can. */\nexport function primeReplyDefect(\n parsed: Record<string, unknown> | null,\n rowsField: string,\n): string | null {\n if (parsed === null) return 'no parseable JSON object'\n if (!Array.isArray(parsed[rowsField])) return `JSON has no \"${rowsField}\" array`\n return null\n}\n\nfunction parsePrimeJsonObject(text: string): Record<string, unknown> | null {\n try {\n const value: unknown = JSON.parse(text.trim())\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null\n } catch {\n return null\n }\n}\n\n// ── Usage ────────────────────────────────────────────────────────────\n\n/**\n * Token accounting exactly as the bridge reported it. Lossless on purpose: a\n * side the bridge did not report stays null rather than becoming a zero, and a\n * side it DID report survives even when its partner is missing.\n */\nexport interface PrimeRawUsage {\n /**\n * Model-usage records the bridge observed. NOT a count of bridge round trips:\n * one prime turn routes several internal model calls, so a single turn\n * typically reports 3-5.\n */\n calls: number | null\n /** Prompt tokens the bridge reported; null when it reported none. */\n inputTokens: number | null\n /** Completion tokens the bridge reported; null when it reported none. */\n outputTokens: number | null\n /**\n * True when the bridge DERIVED the counts (from character lengths) because\n * the backend reported no usage of its own. Pricing derived counts produces a\n * guess about a guess, which a reader must be able to tell apart from a\n * rate-estimated cost over exact tokens.\n */\n bridgeEstimated: boolean\n}\n\nexport function emptyPrimeRawUsage(): PrimeRawUsage {\n return { calls: null, inputTokens: null, outputTokens: null, bridgeEstimated: false }\n}\n\n/** Read the bridge's OpenAI-shaped `usage` object. */\nexport function normalizePrimeUsage(raw: unknown): PrimeRawUsage {\n if (typeof raw !== 'object' || raw === null) return emptyPrimeRawUsage()\n const record = raw as Record<string, unknown>\n return {\n calls: tokenCountOrNull(record.model_requests),\n inputTokens: tokenCountOrNull(record.prompt_tokens),\n outputTokens: tokenCountOrNull(record.completion_tokens),\n bridgeEstimated: record.estimated === true,\n }\n}\n\n/**\n * Sum two turns. Each side poisons independently: two turns that both report\n * input and neither report output yield a real input total beside a null\n * output, because discarding a measured count is as wrong as inventing one.\n */\nexport function mergePrimeRawUsage(a: PrimeRawUsage, b: PrimeRawUsage): PrimeRawUsage {\n return {\n calls: sumOrNull(a.calls, b.calls),\n inputTokens: sumOrNull(a.inputTokens, b.inputTokens),\n outputTokens: sumOrNull(a.outputTokens, b.outputTokens),\n bridgeEstimated: a.bridgeEstimated || b.bridgeEstimated,\n }\n}\n\nfunction sumOrNull(a: number | null, b: number | null): number | null {\n return a !== null && b !== null ? a + b : null\n}\n\nfunction tokenCountOrNull(value: unknown): number | null {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 ? value : null\n}\n\n/**\n * Bind raw prime usage to agent-eval's typed receipt.\n *\n * `RunTokenUsage.input` and `.output` are non-nullable, so a one-sided count\n * cannot round-trip through `tokens` without writing a zero nobody measured.\n * The complete-accounting field therefore stays null, the reported side is\n * carried verbatim in `partialTokens`, and its price becomes the receipt's\n * `knownCostUsd` lower bound.\n *\n * Only agent-eval calls this; consumers with no pricing table read\n * `PrimeRawUsage` directly.\n */\nexport function analystUsageReceiptFromPrimeUsage(\n usage: PrimeRawUsage,\n pricing: CustomTokenPricing,\n): AnalystUsageReceipt {\n const { calls, inputTokens, outputTokens, bridgeEstimated } = usage\n const estimatedTokens = bridgeEstimated ? { tokensEstimated: true } : {}\n if (inputTokens !== null && outputTokens !== null) {\n return {\n calls,\n tokens: { input: inputTokens, output: outputTokens },\n cost: { kind: 'estimated', usd: priceTokens(inputTokens, outputTokens, pricing) },\n ...estimatedTokens,\n }\n }\n if (inputTokens === null && outputTokens === null) {\n return { calls, tokens: null, cost: { kind: 'uncaptured', usd: null }, ...estimatedTokens }\n }\n return {\n calls,\n tokens: null,\n partialTokens: { input: inputTokens, output: outputTokens },\n cost: { kind: 'uncaptured', usd: null },\n knownCostUsd: priceTokens(inputTokens ?? 0, outputTokens ?? 0, pricing),\n ...estimatedTokens,\n }\n}\n\nfunction priceTokens(input: number, output: number, pricing: CustomTokenPricing): number {\n return (input * pricing.inputUsdPerMillion + output * pricing.outputUsdPerMillion) / 1_000_000\n}\n\n// ── Two-turn exchange ────────────────────────────────────────────────\n\n/**\n * Why an exchange ended without a readable reply. `deadline` and `aborted` are\n * separate members from `transport` on purpose: a model that ran past its\n * deadline, a caller who cancelled, and a bridge that refused the connection\n * demand three different responses, and a record that conflates them cannot be\n * acted on.\n */\nexport type PrimeFailure =\n | {\n kind: 'transport' | 'unparseable-json' | 'no-content' | 'deadline' | 'malformed-reply'\n message: string\n }\n | { kind: 'http-status'; message: string; status: number; bodySnippet: string }\n | { kind: 'aborted'; message: string; cause: unknown }\n\nexport interface PrimeRepairState {\n attempted: boolean\n /** Null when no repair turn ran, or when the repair turn never returned a reply. */\n succeeded: boolean | null\n}\n\n/** One completed bridge turn. A turn that failed produces no record. */\nexport interface PrimeTurnRecord {\n turn: 'first' | 'repair'\n usage: PrimeRawUsage\n /** The reply's `usage` object verbatim; null when the bridge sent none. */\n rawUsage: unknown\n}\n\nexport interface PrimeRejectedRow {\n index: number\n reason: string\n}\n\nexport type PrimeExchangeOutcome<TRow> =\n | {\n ok: true\n /** The reply's `answer` field; null when absent or not a string. */\n answer: string | null\n rows: TRow[]\n rejected: PrimeRejectedRow[]\n /** Rows the model reported, before decoding or the count cap. */\n reportedRows: number\n /** Valid rows dropped by `contract.maxRows`. */\n overflow: number\n usage: PrimeRawUsage\n turns: PrimeTurnRecord[]\n repair: PrimeRepairState\n reply: string\n }\n | {\n ok: false\n failure: PrimeFailure\n usage: PrimeRawUsage\n turns: PrimeTurnRecord[]\n repair: PrimeRepairState\n /** The last reply received, when one arrived — the diagnostic artifact for a malformed case. */\n reply?: string\n }\n\nexport interface PrimeExchangeOptions<TRow> {\n contract: PrimeReplyContract<TRow>\n prompt: string\n transport: PrimeBridgeTransport\n /** Full endpoint, e.g. `http://localhost:4181/v1/chat/completions`. */\n url: string\n model: string\n /** Deadline for ONE turn. Prime analyses routinely exceed five minutes. */\n timeoutMs: number\n /** Whether a structurally malformed reply gets one bounded repair turn. */\n repair: boolean\n signal?: AbortSignal\n}\n\n/**\n * Run the protocol: one call, one bounded repair turn on a structurally\n * malformed reply, then decode. Zero valid rows from a well-formed reply is an\n * honest null, not a failure.\n */\nexport async function runPrimeExchange<TRow>(\n options: PrimeExchangeOptions<TRow>,\n): Promise<PrimeExchangeOutcome<TRow>> {\n const { contract } = options\n const turns: PrimeTurnRecord[] = []\n const repair: PrimeRepairState = { attempted: false, succeeded: null }\n\n const first = await callPrimeTurn(options, options.prompt)\n if (!first.ok) {\n return { ok: false, failure: first.failure, usage: mergeTurns(turns), turns, repair }\n }\n turns.push({ turn: 'first', usage: first.usage, rawUsage: first.rawUsage })\n\n let reply = first.content\n let parsed = extractPrimeJsonObject(reply)\n let defect = primeReplyDefect(parsed, contract.rowsField)\n\n if (defect !== null && options.repair) {\n repair.attempted = true\n const second = await callPrimeTurn(\n options,\n buildPrimeRepairPrompt({\n defect,\n previousReply: reply,\n repairContractLines: contract.repairContractLines,\n }),\n )\n if (!second.ok) {\n return { ok: false, failure: second.failure, usage: mergeTurns(turns), turns, repair, reply }\n }\n turns.push({ turn: 'repair', usage: second.usage, rawUsage: second.rawUsage })\n reply = second.content\n parsed = extractPrimeJsonObject(reply)\n defect = primeReplyDefect(parsed, contract.rowsField)\n repair.succeeded = defect === null\n }\n\n const usage = mergeTurns(turns)\n if (defect !== null) {\n return {\n ok: false,\n failure: {\n kind: 'malformed-reply',\n message: `${defect} in prime reply${repair.attempted ? ' even after the bounded repair turn' : ''}`,\n },\n usage,\n turns,\n repair,\n reply,\n }\n }\n\n const rawRows = parsed![contract.rowsField] as unknown[]\n const rows: TRow[] = []\n const rejected: PrimeRejectedRow[] = []\n let overflow = 0\n rawRows.forEach((row, index) => {\n const decoded = contract.decodeRow(row, index)\n if (!decoded.ok) {\n rejected.push({ index, reason: decoded.reason })\n return\n }\n // Shape before count: a malformed row must never consume an accepted slot.\n if (contract.maxRows !== undefined && rows.length >= contract.maxRows) {\n overflow += 1\n return\n }\n rows.push(decoded.row)\n })\n const answer = parsed!.answer\n return {\n ok: true,\n answer: typeof answer === 'string' ? answer : null,\n rows,\n rejected,\n reportedRows: rawRows.length,\n overflow,\n usage,\n turns,\n repair,\n reply,\n }\n}\n\ntype PrimeTurnOutcome =\n | { ok: true; content: string; usage: PrimeRawUsage; rawUsage: unknown }\n | { ok: false; failure: PrimeFailure }\n\nasync function callPrimeTurn<TRow>(\n options: PrimeExchangeOptions<TRow>,\n content: string,\n): Promise<PrimeTurnOutcome> {\n const { transport, url, model, timeoutMs, signal } = options\n const controller = new AbortController()\n const forwardAbort = () => controller.abort(signal?.reason)\n if (signal?.aborted) controller.abort(signal.reason)\n else signal?.addEventListener('abort', forwardAbort, { once: true })\n const deadline = setTimeout(() => controller.abort(), timeoutMs)\n let result: PrimeBridgeTransportResult\n try {\n result = await transport({\n url,\n body: { model, messages: [{ role: 'user', content }] },\n signal: controller.signal,\n })\n } catch (error) {\n if (signal?.aborted) {\n return {\n ok: false,\n failure: {\n kind: 'aborted',\n message: 'prime exchange cancelled by the caller',\n cause: error,\n },\n }\n }\n if (controller.signal.aborted) {\n return {\n ok: false,\n failure: { kind: 'deadline', message: `bridge call exceeded ${timeoutMs}ms` },\n }\n }\n return {\n ok: false,\n failure: {\n kind: 'transport',\n message: `bridge transport failure: ${error instanceof Error ? error.message : String(error)}`,\n },\n }\n } finally {\n clearTimeout(deadline)\n signal?.removeEventListener('abort', forwardAbort)\n }\n\n if (result.status !== 200) {\n const bodySnippet = result.text.slice(0, 500)\n return {\n ok: false,\n failure: {\n kind: 'http-status',\n message: `bridge HTTP ${result.status}: ${bodySnippet}`,\n status: result.status,\n bodySnippet,\n },\n }\n }\n let response: unknown\n try {\n response = JSON.parse(result.text)\n } catch {\n return {\n ok: false,\n failure: {\n kind: 'unparseable-json',\n message: `bridge returned unparseable JSON (${result.text.length} bytes)`,\n },\n }\n }\n const replyContent = primeReplyContent(response)\n if (replyContent === null) {\n return {\n ok: false,\n failure: { kind: 'no-content', message: 'bridge reply carries no message content' },\n }\n }\n const rawUsage = primeReplyUsage(response)\n return { ok: true, content: replyContent, usage: normalizePrimeUsage(rawUsage), rawUsage }\n}\n\n/**\n * Fold from the FIRST turn, never from an empty receipt: an all-null identity\n * would poison every side it merged with and erase counts the bridge reported.\n */\nfunction mergeTurns(turns: readonly PrimeTurnRecord[]): PrimeRawUsage {\n if (turns.length === 0) return emptyPrimeRawUsage()\n return turns\n .slice(1)\n .reduce<PrimeRawUsage>((total, turn) => mergePrimeRawUsage(total, turn.usage), turns[0]!.usage)\n}\n\nfunction primeReplyContent(response: unknown): string | null {\n if (typeof response !== 'object' || response === null) return null\n const choices = (response as { choices?: unknown }).choices\n if (!Array.isArray(choices) || choices.length === 0) return null\n const message = (choices[0] as { message?: unknown })?.message\n if (typeof message !== 'object' || message === null) return null\n const content = (message as { content?: unknown }).content\n return typeof content === 'string' && content.length > 0 ? content : null\n}\n\nfunction primeReplyUsage(response: unknown): unknown {\n if (typeof response !== 'object' || response === null) return null\n return (response as { usage?: unknown }).usage ?? null\n}\n\n// ── Trajectory projection ────────────────────────────────────────────\n\n/**\n * Where the inlined trajectory comes from. The protocol needs only two moves —\n * fetch it all, or fetch a reduced version — so no store, artifact path, or\n * span type enters the shared signature.\n */\nexport interface PrimeProjectionSource<TItem> {\n /** The full projection, or null when the source declares itself oversized. */\n full(): Promise<readonly TItem[] | null>\n /** A reduced projection of the same material. */\n capped(): Promise<readonly TItem[]>\n /** How `capped` reduces, named for the failure message, e.g. `per-attribute cap 1200`. */\n cappedDescription: string\n}\n\nexport interface PrimeProjectionDelivery {\n mode: 'inline-json'\n fetch: 'full' | 'capped'\n renderedChars: number\n}\n\nexport type PrimeProjectionOutcome<TItem> =\n | {\n ok: true\n items: readonly TItem[]\n rendered: string\n delivery: PrimeProjectionDelivery\n }\n | { ok: false; reason: string; renderedChars: number }\n\n/**\n * Render, measure, fall back to the capped projection, re-measure, fail loud.\n *\n * Inline is the only delivery prime has, so an oversized trajectory is a\n * refusal rather than a silent truncation: dropping spans would understate the\n * trajectory and the analyst would answer a question about a different run.\n */\nexport async function projectPrimeTrajectory<TItem>(\n source: PrimeProjectionSource<TItem>,\n limits: { maxInlineChars: number },\n): Promise<PrimeProjectionOutcome<TItem>> {\n let fetch: PrimeProjectionDelivery['fetch'] = 'full'\n let items = await source.full()\n if (items === null) {\n fetch = 'capped'\n items = await source.capped()\n }\n let rendered = JSON.stringify(items)\n if (rendered.length > limits.maxInlineChars && fetch === 'full') {\n fetch = 'capped'\n items = await source.capped()\n rendered = JSON.stringify(items)\n }\n if (rendered.length > limits.maxInlineChars) {\n return {\n ok: false,\n reason: `trajectory renders to ${rendered.length} chars even at ${source.cappedDescription}; inline delivery impossible`,\n renderedChars: rendered.length,\n }\n }\n return {\n ok: true,\n items,\n rendered,\n delivery: { mode: 'inline-json', fetch, renderedChars: rendered.length },\n }\n}\n\n// ── Protocol identity ────────────────────────────────────────────────\n\nexport interface PrimeProtocolIdentity {\n question: string\n taskDefinition?: string\n contractLines: readonly string[]\n repairContractLines: readonly string[]\n /** Numeric limits the contract states, e.g. row and width caps. */\n limits: Readonly<Record<string, number>>\n}\n\n/**\n * Digest of everything a consumer can send to the bridge under the prime\n * protocol, recorded per observation so a prime result names the exact contract\n * that produced it.\n *\n * Computed over the ACTUALLY composed contract, so two consumers that both\n * stamp `analyst_id: 'prime'` while asking materially different questions get\n * different digests by construction. That is what makes 'prime' a reproducible\n * claim rather than a label.\n */\nexport function primeProtocolSha256(identity: PrimeProtocolIdentity): string {\n return createHash('sha256')\n .update(\n JSON.stringify({\n kind: 'prime-analyst-protocol',\n question: identity.question,\n taskPrompt: identity.taskDefinition ?? null,\n outputContract: identity.contractLines,\n repairContract: buildPrimeRepairPrompt({\n defect: '<defect>',\n previousReply: '<previous-reply>',\n repairContractLines: identity.repairContractLines,\n }),\n limits: identity.limits,\n }),\n )\n .digest('hex')\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAgB,4BACd,MACA,OACuB;CACvB,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,gBAAgB,KAAK,KAAK,iCAAiC,MAAM;CAE7E,MAAM,MAAM,MAAM,KAAK,SAAS,KAAK,EAAE;CACvC,MAAM,YAAY,IAAI,MAAM,IAAI,UAAU,IAAI,QAAQ,EAAE,MAAM,KAAK;CACnE,IAAI,cAAc,KAAA,GAChB,MAAM,IAAI,gBAAgB,GAAG,KAAK,IAAI,UAAU,oBAAoB;CAEtE,MAAM,cAAc,MAAM,EAAE,CAAE;CAC9B,MAAM,UAAU,MAAM,MAAM,SAAS,KAAK,gBAAgB,WAAW;CACrE,IAAI,SACF,MAAM,IAA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;;;;;;;;;;AAuBA,SAAgB,oBAAoB,UAAyC;CAC3E,OAAO,WAAW,QAAQ,CAAC,CACxB,OACC,KAAK,UAAU;EACb,MAAM;EACN,UAAU,SAAS;EACnB,YAAY,SAAS,kBAAkB;EACvC,gBAAgB,SAAS;EACzB,gBAAgB,uBAAuB;GACrC,QAAQ;GACR,eAAe;GACf,qBAAqB,SAAS;EAChC,CAAC;EACD,QAAQ,SAAS;CACnB,CAAC,CACH,CAAC,CACA,OAAO,KAAK;AACjB"}
|
package/dist/profile-cell.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as verifyAgentProfileCell, S as validateAgentProfileCell, _ as buildAgentInterfaceProfileCell, a as AgentProfileCellSchemaVersion, b as requireAgentProfileCell, c as AgentProfileHarness, d as AgentProfileKind, f as AgentProfileSource, g as assertRunAgentProfileCell, h as agentProfileCellKey, i as AgentProfileCellInput, l as AgentProfileJson, m as agentProfileCellHashMaterial, n as AgentInterfaceProfileLike, o as AgentProfileCellValidationError, p as AgentProfileSourceInput, r as AgentProfileCell, s as AgentProfileDimensionValue, t as AGENT_PROFILE_KINDS, u as AgentProfileJsonObject, v as buildAgentProfileCell, x as toAgentProfileJson, y as groupRunsByAgentProfileCell } from "./agent-profile-cell-
|
|
1
|
+
import { C as verifyAgentProfileCell, S as validateAgentProfileCell, _ as buildAgentInterfaceProfileCell, a as AgentProfileCellSchemaVersion, b as requireAgentProfileCell, c as AgentProfileHarness, d as AgentProfileKind, f as AgentProfileSource, g as assertRunAgentProfileCell, h as agentProfileCellKey, i as AgentProfileCellInput, l as AgentProfileJson, m as agentProfileCellHashMaterial, n as AgentInterfaceProfileLike, o as AgentProfileCellValidationError, p as AgentProfileSourceInput, r as AgentProfileCell, s as AgentProfileDimensionValue, t as AGENT_PROFILE_KINDS, u as AgentProfileJsonObject, v as buildAgentProfileCell, x as toAgentProfileJson, y as groupRunsByAgentProfileCell } from "./agent-profile-cell-BOP-iA9Q.js";
|
|
2
2
|
export { AGENT_PROFILE_KINDS, AgentInterfaceProfileLike, AgentProfileCell, AgentProfileCellInput, AgentProfileCellSchemaVersion, AgentProfileCellValidationError, AgentProfileDimensionValue, AgentProfileHarness, AgentProfileJson, AgentProfileJsonObject, AgentProfileKind, AgentProfileSource, AgentProfileSourceInput, agentProfileCellHashMaterial, agentProfileCellKey, assertRunAgentProfileCell, buildAgentInterfaceProfileCell, buildAgentProfileCell, groupRunsByAgentProfileCell, requireAgentProfileCell, toAgentProfileJson, validateAgentProfileCell, verifyAgentProfileCell };
|