@tangle-network/agent-eval 0.183.0 → 0.185.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 +28 -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 +11 -336
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +10 -8
- package/dist/analyst/index.js.map +1 -1
- package/dist/analyze-runs-CrYhqXop.d.ts +75 -0
- package/dist/analyze-runs-CrYhqXop.d.ts.map +1 -0
- package/dist/{define-agent-eval-CneiWyuA.js → analyze-runs-sTygaDyD.js} +6 -813
- package/dist/analyze-runs-sTygaDyD.js.map +1 -0
- 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-NBrqNwgy.js → benchmark-command-kvq7yFY4.js} +17 -54
- package/dist/benchmark-command-kvq7yFY4.js.map +1 -0
- 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 +10 -9
- package/dist/{campaign-BwcEBC91.js → campaign-eJgtRs-W.js} +16 -15
- package/dist/{campaign-BwcEBC91.js.map → campaign-eJgtRs-W.js.map} +1 -1
- package/dist/{campaign-evidence-PYPUftRy.js → campaign-evidence-BsrCmBSE.js} +7 -258
- package/dist/campaign-evidence-BsrCmBSE.js.map +1 -0
- package/dist/{canonical-DPyQ_rpt.js → canonical-BsZVgBhW.js} +2 -4
- package/dist/canonical-BsZVgBhW.js.map +1 -0
- package/dist/cli.js +2 -2
- 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 +15 -284
- package/dist/contract/index.js.map +1 -1
- package/dist/{default-registry-BwDSWVzg.d.ts → default-registry-CXv9kHMt.d.ts} +6 -6
- package/dist/{default-registry-BwDSWVzg.d.ts.map → default-registry-CXv9kHMt.d.ts.map} +1 -1
- package/dist/{default-registry-C0-N4PkG.js → default-registry-xiHrldW8.js} +6 -4
- package/dist/{default-registry-C0-N4PkG.js.map → default-registry-xiHrldW8.js.map} +1 -1
- package/dist/define-agent-eval-D4uumjl3.js +813 -0
- package/dist/define-agent-eval-D4uumjl3.js.map +1 -0
- 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/diagnosis/index.d.ts +319 -0
- package/dist/diagnosis/index.d.ts.map +1 -0
- package/dist/diagnosis/index.js +1328 -0
- package/dist/diagnosis/index.js.map +1 -0
- package/dist/{dspy-rlm-engine-8pgBSiy7.js → dspy-rlm-engine-BE9lCzzL.js} +3 -3
- package/dist/{dspy-rlm-engine-8pgBSiy7.js.map → dspy-rlm-engine-BE9lCzzL.js.map} +1 -1
- package/dist/{engine-DS1cysJy.d.ts → engine-cXUK-WHS.d.ts} +5 -77
- package/dist/engine-cXUK-WHS.d.ts.map +1 -0
- package/dist/equal-terms-Blx9Zk5I.js +25 -0
- package/dist/equal-terms-Blx9Zk5I.js.map +1 -0
- 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 +6 -5
- package/dist/experiment/index.js.map +1 -1
- 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/{external-optimizer-process-DIB4YWEe.js → external-optimizer-process-BbhvXTFx.js} +4 -4
- package/dist/{external-optimizer-process-DIB4YWEe.js.map → external-optimizer-process-BbhvXTFx.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-CjguXN2e.js → external-optimizer-subprocess-DMgmqTB6.js} +3 -3
- package/dist/{external-optimizer-subprocess-CjguXN2e.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/hosted/index.d.ts +2 -2
- package/dist/{index-DoykkxW0.d.ts → index-BQWfAFeH.d.ts} +11 -11
- package/dist/{index-DoykkxW0.d.ts.map → index-BQWfAFeH.d.ts.map} +1 -1
- package/dist/{index-DbG8QbH9.d.ts → index-C8_iU8KL.d.ts} +6 -6
- package/dist/{index-DbG8QbH9.d.ts.map → index-C8_iU8KL.d.ts.map} +1 -1
- package/dist/{index--_8_Nlpn.d.ts → index-CKZa_rnt.d.ts} +4 -121
- package/dist/index-CKZa_rnt.d.ts.map +1 -0
- 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 +24 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- 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-DxTzg32u.js → kind-factory-V79Hw0AU.js} +7 -84
- package/dist/kind-factory-V79Hw0AU.js.map +1 -0
- package/dist/ledger-core/index.js +2 -2
- package/dist/{llm-judge-FfaRgz9X.js → llm-judge-FWWhEb31.js} +11 -9
- package/dist/{llm-judge-FfaRgz9X.js.map → llm-judge-FWWhEb31.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/{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/openapi.json +1 -1
- package/dist/otel-spans-CQY1pNiN.js +275 -0
- package/dist/otel-spans-CQY1pNiN.js.map +1 -0
- package/dist/otlp-attributes-BpC_blLF.js +83 -0
- package/dist/otlp-attributes-BpC_blLF.js.map +1 -0
- package/dist/{run-record-DPa2PeHx.js → paired-promotion-decision-ClJh_9nK.js} +2 -215
- package/dist/paired-promotion-decision-ClJh_9nK.js.map +1 -0
- package/dist/pipelines/index.js +2 -2
- package/dist/prime-bridge-transport-Z3cpKGoV.js +43 -0
- package/dist/prime-bridge-transport-Z3cpKGoV.js.map +1 -0
- package/dist/prime-protocol-CDBcL9NM.d.ts +331 -0
- package/dist/prime-protocol-CDBcL9NM.d.ts.map +1 -0
- package/dist/{prime-protocol-6tZTVsWm.js → prime-protocol-DcAK9pC8.js} +2 -23
- package/dist/prime-protocol-DcAK9pC8.js.map +1 -0
- package/dist/{produced-state-CGoVInrl.js → produced-state-CmB02tr2.js} +23 -19
- package/dist/{produced-state-CGoVInrl.js.map → produced-state-CmB02tr2.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-DdrYWHDh.js} +3 -3
- package/dist/{promotion-policy-BKFrl7CC.js.map → promotion-policy-DdrYWHDh.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 +10 -6
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +22 -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-D_54FZVu.js → rollout-C0Ifk3vK.js} +2 -2
- package/dist/{rollout-D_54FZVu.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-CNNzWGpB.js +216 -0
- package/dist/run-record-CNNzWGpB.js.map +1 -0
- 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-_3Fp6Q_3.js → semantic-concept-judge-Cnt0TWp0.js} +4 -4
- package/dist/{semantic-concept-judge-_3Fp6Q_3.js.map → semantic-concept-judge-Cnt0TWp0.js.map} +1 -1
- package/dist/{sequential-D_xHrBZe.js → sequential-PgLEqcTJ.js} +3 -3
- package/dist/{sequential-D_xHrBZe.js.map → sequential-PgLEqcTJ.js.map} +1 -1
- package/dist/{server-BZQR1f0C.js → server-DmpcFiVK.js} +2 -2
- package/dist/{server-BZQR1f0C.js.map → server-DmpcFiVK.js.map} +1 -1
- package/dist/{skillopt-optimization-method-DY1aQ-aL.js → skillopt-optimization-method-FSk8b5FQ.js} +8 -7
- package/dist/{skillopt-optimization-method-DY1aQ-aL.js.map → skillopt-optimization-method-FSk8b5FQ.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/statistical-heldout-CeWT_W7y.js +256 -0
- package/dist/statistical-heldout-CeWT_W7y.js.map +1 -0
- package/dist/{store-otlp-DAaEbMLf.js → store-otlp-2gYCy-v0.js} +2 -2
- package/dist/{store-otlp-DAaEbMLf.js.map → store-otlp-2gYCy-v0.js.map} +1 -1
- package/dist/{store-tool-spans-BZ8MPKFe.js → store-tool-spans-B1e6Auc2.js} +69 -6
- package/dist/store-tool-spans-B1e6Auc2.js.map +1 -0
- package/dist/{store-tool-spans-Dt-YdAuE.d.ts → store-tool-spans-BrdfPaVh.d.ts} +54 -6
- package/dist/store-tool-spans-BrdfPaVh.d.ts.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-B_JjrOVo.js → task-failure-attributes-B34TiMBe.js} +2 -2
- package/dist/{task-failure-attributes-B_JjrOVo.js.map → task-failure-attributes-B34TiMBe.js.map} +1 -1
- package/dist/{tool-groups-B2bSNaJB.d.ts → tool-groups-eOOgYGaM.d.ts} +3 -3
- package/dist/tool-groups-eOOgYGaM.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 +5 -4
- package/dist/trace-repair/index.js.map +1 -1
- package/dist/traces.d.ts +5 -5
- package/dist/traces.js +8 -7
- package/dist/traces.js.map +1 -1
- 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/diagnosis.md +42 -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/package.json +22 -1
- package/dist/agent-profile-cell-Cv6UA-W_.js.map +0 -1
- package/dist/benchmark-command-NBrqNwgy.js.map +0 -1
- package/dist/campaign-evidence-PYPUftRy.js.map +0 -1
- package/dist/canonical-DPyQ_rpt.js.map +0 -1
- package/dist/define-agent-eval-CneiWyuA.js.map +0 -1
- package/dist/engine-DS1cysJy.d.ts.map +0 -1
- package/dist/exporters-D98GPi1n.d.ts +0 -161
- package/dist/exporters-D98GPi1n.d.ts.map +0 -1
- package/dist/index--_8_Nlpn.d.ts.map +0 -1
- package/dist/index-Bp_6sj3x.d.ts.map +0 -1
- package/dist/kind-factory-DxTzg32u.js.map +0 -1
- package/dist/mint-ySIIkKlV.js.map +0 -1
- package/dist/prime-protocol-6tZTVsWm.js.map +0 -1
- package/dist/run-record-DPa2PeHx.js.map +0 -1
- package/dist/store-tool-spans-BZ8MPKFe.js.map +0 -1
- package/dist/store-tool-spans-Dt-YdAuE.d.ts.map +0 -1
- package/dist/tool-groups-B2bSNaJB.d.ts.map +0 -1
- package/dist/types-DQ0e2E7y.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as FailureClass } from "./schema-CR5cpjQ3.js";
|
|
2
|
-
import { l as RunTerminalOutcome } from "./run-record-
|
|
2
|
+
import { l as RunTerminalOutcome } from "./run-record-D9wS35fK.js";
|
|
3
3
|
import { r as ContinuousAgreement } from "./judge-calibration-DFtEMlde.js";
|
|
4
|
-
import { i as ParetoFigureSpec, t as GainDistributionBin } from "./summary-report-
|
|
4
|
+
import { i as ParetoFigureSpec, t as GainDistributionBin } from "./summary-report-BzFS5UhZ.js";
|
|
5
5
|
//#region src/contract/insight-report.d.ts
|
|
6
6
|
interface InsightReport {
|
|
7
7
|
/** Number of runs analyzed. */
|
|
@@ -407,4 +407,4 @@ interface Recommendation {
|
|
|
407
407
|
}
|
|
408
408
|
//#endregion
|
|
409
409
|
export { FailureClusterInsight as a, JudgeInsight as c, Recommendation as d, ReleaseSummary as f, FailureClassTally as i, LiftInsight as l, TokenUsageInsight as m, ExecutionErrorOutcomeCell as n, InsightReport as o, ScalarDistribution as p, ExecutionInsight as r, InterRaterInsight as s, CostProvenanceSummary as t, OutcomeCorrelationInsight as u };
|
|
410
|
-
//# sourceMappingURL=insight-report-
|
|
410
|
+
//# sourceMappingURL=insight-report-C3Bfl762.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insight-report-
|
|
1
|
+
{"version":3,"file":"insight-report-C3Bfl762.d.ts","names":[],"sources":["../src/contract/insight-report.ts"],"mappings":";;;;;UAqCiB;;EAEf;;;;EAKA,WAAW;;EAGX,WAAW;;;EAIX,cAAc,eAAe;;EAG7B;IACE,MAAM;IACN,QAAQ;;;;IAIR,aAAa;;;;;IAKb;MAAa;MAAe;;;;;;EAM9B,QAAQ,eAAe;;;;EAKvB,aAAa;;;;EAKb,OAAO;;;EAIP,kBAAkB;;;EAIlB,gBAAgB;;;;;EAMhB,qBAAqB;;;;;EAMrB,SAAS;;;;;;EAOT,wBAAwB;;;;EAKxB,iBAAiB;;;EAIjB,iBAAiB;;UAGF;EACf;IAAY;IAAW;;EACvB;IAAa;IAAW;;EACxB;IAAc;;EACd;;UAGe;;EA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;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;EAEA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/jev-protocol.d.ts
|
|
2
|
+
/** Structural equivalents of the native SDK types; callers can use its builders unchanged. */
|
|
3
|
+
type JevJson = string | number | boolean | null | JevJson[] | {
|
|
4
|
+
[key: string]: JevJson;
|
|
5
|
+
};
|
|
6
|
+
type JevState = string | {
|
|
7
|
+
[key: string]: JevJson;
|
|
8
|
+
} | JevJson[] | null;
|
|
9
|
+
type JevScoreCriteria = readonly [JevState, JevState, ...JevState[]];
|
|
10
|
+
type JevQuestion = {
|
|
11
|
+
type: 'noul';
|
|
12
|
+
instructions?: JevState;
|
|
13
|
+
criteria?: {
|
|
14
|
+
true?: JevState;
|
|
15
|
+
false?: JevState;
|
|
16
|
+
} | null;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'score';
|
|
19
|
+
instructions?: JevState;
|
|
20
|
+
criteria: JevScoreCriteria;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'choice';
|
|
23
|
+
instructions?: JevState;
|
|
24
|
+
criteria: Record<string, JevState>;
|
|
25
|
+
};
|
|
26
|
+
type JevQuestions = Record<string, JevQuestion>;
|
|
27
|
+
interface JevRequest<Q extends JevQuestions = JevQuestions> {
|
|
28
|
+
model: string;
|
|
29
|
+
state: JevState;
|
|
30
|
+
questions: Q;
|
|
31
|
+
}
|
|
32
|
+
type ScoreKeys<T extends JevScoreCriteria> = number extends T['length'] ? number : Extract<keyof T, `${number}`>;
|
|
33
|
+
type JevAnswerFor<Q extends JevQuestion> = Q extends {
|
|
34
|
+
type: 'noul';
|
|
35
|
+
} ? {
|
|
36
|
+
readonly type: 'noul';
|
|
37
|
+
readonly noul: number;
|
|
38
|
+
} : Q extends {
|
|
39
|
+
type: 'score';
|
|
40
|
+
criteria: infer C extends JevScoreCriteria;
|
|
41
|
+
} ? {
|
|
42
|
+
readonly type: 'score';
|
|
43
|
+
readonly score: number;
|
|
44
|
+
readonly confidence: number;
|
|
45
|
+
readonly legend: { readonly [K in ScoreKeys<C>]: C[K]; };
|
|
46
|
+
readonly probabilities: { readonly [K in ScoreKeys<C>]: number; };
|
|
47
|
+
} : Q extends {
|
|
48
|
+
type: 'choice';
|
|
49
|
+
criteria: infer C;
|
|
50
|
+
} ? {
|
|
51
|
+
readonly type: 'choice';
|
|
52
|
+
readonly choice: keyof C & string;
|
|
53
|
+
readonly confidence: number;
|
|
54
|
+
readonly probabilities: { readonly [K in keyof C]: number; };
|
|
55
|
+
} : never;
|
|
56
|
+
type JevAnswer = JevAnswerFor<JevQuestion>;
|
|
57
|
+
interface JevResult<Q extends JevQuestions = JevQuestions> {
|
|
58
|
+
readonly model: string;
|
|
59
|
+
readonly answers: { readonly [K in keyof Q]: JevAnswerFor<Q[K]>; };
|
|
60
|
+
readonly usage: {
|
|
61
|
+
readonly input_tokens: number;
|
|
62
|
+
readonly output_tokens: number;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
declare class JevResponseError extends Error {
|
|
66
|
+
constructor(message: string);
|
|
67
|
+
}
|
|
68
|
+
declare function parseJevRequest(raw: unknown): JevRequest;
|
|
69
|
+
declare function jevUsage(raw: unknown): JevResult['usage'];
|
|
70
|
+
/** Validate native evidence, not model alias policy or the caller's scoring rules. */
|
|
71
|
+
declare function parseJevResult<Q extends JevQuestions>(raw: unknown, request: JevRequest<Q>): JevResult<Q>;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { JevAnswer, JevAnswerFor, JevJson, JevQuestion, JevQuestions, JevRequest, JevResponseError, JevResult, JevScoreCriteria, JevState, jevUsage, parseJevRequest, parseJevResult };
|
|
74
|
+
//# sourceMappingURL=jev-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jev-protocol.d.ts","names":[],"sources":["../src/jev-protocol.ts"],"mappings":";;KAIY,6CAA6C;GAAe,cAAc;;KAC1E;GAAuB,cAAc;IAAY;KACjD,6BAA6B,UAAU,aAAa;KACpD;EAEN;EACA,eAAe;EACf;IAAa,OAAO;IAAU,QAAQ;;;EAEtC;EAAe,eAAe;EAAU,UAAU;;EAClD;EAAgB,eAAe;EAAU,UAAU,eAAe;;KAC5D,eAAe,eAAe;UACzB,WAAW,UAAU,eAAe;EACnD;EACA,OAAO;EACP,WAAW;;KAGR,UAAU,UAAU,mCAAmC,uBAExD,cAAc;KACN,aAAa,UAAU,eAAe;EAAY;;WAC/C;WAAuB;IAClC;EAAY;EAAe,gBAAgB,UAAU;;WAExC;WACA;WACA;WACA,oBAAoB,KAAK,UAAU,KAAK,EAAE;WAC1C,2BAA2B,KAAK,UAAU;IAErD;EAAY;EAAgB,gBAAgB;;WAE/B;WACA,cAAc;WACd;WACA,2BAA2B,WAAW;;KAG7C,YAAY,aAAa;UACpB,UAAU,UAAU,eAAe;WACzC;WACA,qBAAqB,WAAW,IAAI,aAAa,EAAE;WACnD;aAAkB;aAA+B;;;cAG/C,yBAAyB;EACpC,YAAY;;iBAoBE,gBAAgB,eAAe;iBAqC/B,SAAS,eAAe;;iBA2BxB,eAAe,UAAU,cACvC,cACA,SAAS,WAAW,KACnB,UAAU"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { r as canonicalString } from "./canonical-BsZVgBhW.js";
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
//#region src/jev-protocol.ts
|
|
4
|
+
var JevResponseError = class extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(`Jev: ${message}`);
|
|
7
|
+
this.name = "JevResponseError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function object(value) {
|
|
11
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new JevResponseError("Expected an object");
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function entry(value) {
|
|
15
|
+
if (value === null || typeof value === "string") return;
|
|
16
|
+
if (typeof value !== "object") throw new TypeError("Expected text, JSON object/array, or null");
|
|
17
|
+
canonicalString(value);
|
|
18
|
+
}
|
|
19
|
+
function parseJevRequest(raw) {
|
|
20
|
+
const request = object(raw);
|
|
21
|
+
if (typeof request.model !== "string" || !request.model.trim()) throw new TypeError("Evaluation requires a model");
|
|
22
|
+
entry(request.state);
|
|
23
|
+
const questions = object(request.questions);
|
|
24
|
+
if (!Object.keys(questions).length) throw new TypeError("At least one question is required");
|
|
25
|
+
for (const rawQuestion of Object.values(questions)) {
|
|
26
|
+
const question = object(rawQuestion);
|
|
27
|
+
if (question.instructions !== void 0) entry(question.instructions);
|
|
28
|
+
if (question.type === "noul") {
|
|
29
|
+
if (question.criteria != null) {
|
|
30
|
+
const criteria = object(question.criteria);
|
|
31
|
+
if (Object.keys(criteria).some((key) => key !== "true" && key !== "false")) throw new TypeError("Noul criteria must describe true and/or false");
|
|
32
|
+
for (const value of Object.values(criteria)) if (value !== void 0) entry(value);
|
|
33
|
+
}
|
|
34
|
+
} else if (question.type === "score") {
|
|
35
|
+
if (!Array.isArray(question.criteria) || question.criteria.length < 2) throw new TypeError("Score criteria require at least two ordered entries");
|
|
36
|
+
for (const value of question.criteria) entry(value);
|
|
37
|
+
} else if (question.type === "choice") {
|
|
38
|
+
const criteria = object(question.criteria);
|
|
39
|
+
if (!Object.keys(criteria).length) throw new TypeError("Choice criteria cannot be empty");
|
|
40
|
+
for (const value of Object.values(criteria)) entry(value);
|
|
41
|
+
} else throw new TypeError("Unsupported native question type");
|
|
42
|
+
}
|
|
43
|
+
return raw;
|
|
44
|
+
}
|
|
45
|
+
function jevUsage(raw) {
|
|
46
|
+
const usage = object(object(raw).usage);
|
|
47
|
+
for (const key of ["input_tokens", "output_tokens"]) if (!Number.isSafeInteger(usage[key]) || Number(usage[key]) < 0) throw new JevResponseError("Missing or invalid usage");
|
|
48
|
+
return usage;
|
|
49
|
+
}
|
|
50
|
+
function probability(value) {
|
|
51
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) throw new JevResponseError("Invalid probability");
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function exactKeys(value, names) {
|
|
55
|
+
if (Object.keys(value).length !== names.length || names.some((key) => !Object.hasOwn(value, key))) throw new JevResponseError("Response keys differ from the request");
|
|
56
|
+
}
|
|
57
|
+
/** Validate native evidence, not model alias policy or the caller's scoring rules. */
|
|
58
|
+
function parseJevResult(raw, request) {
|
|
59
|
+
canonicalString(raw);
|
|
60
|
+
const response = object(raw);
|
|
61
|
+
if (typeof response.model !== "string" || !response.model.trim()) throw new JevResponseError("Missing served model");
|
|
62
|
+
const answers = object(response.answers);
|
|
63
|
+
exactKeys(answers, Object.keys(request.questions));
|
|
64
|
+
for (const [name, question] of Object.entries(request.questions)) {
|
|
65
|
+
const answer = object(answers[name]);
|
|
66
|
+
if (answer.type !== question.type) throw new JevResponseError("Wrong answer type");
|
|
67
|
+
if (question.type === "noul") {
|
|
68
|
+
probability(answer.noul);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
probability(answer.confidence);
|
|
72
|
+
const levels = question.type === "score" ? question.criteria.map((_, index) => String(index)) : Object.keys(question.criteria);
|
|
73
|
+
const probabilities = object(answer.probabilities);
|
|
74
|
+
exactKeys(probabilities, levels);
|
|
75
|
+
const sum = levels.reduce((total, level) => total + probability(probabilities[level]), 0);
|
|
76
|
+
if (Math.abs(sum - 1) > 1e-4) throw new JevResponseError("Invalid probability distribution");
|
|
77
|
+
if (question.type === "score") {
|
|
78
|
+
const legend = object(answer.legend);
|
|
79
|
+
exactKeys(legend, levels);
|
|
80
|
+
if (levels.some((level) => !isDeepStrictEqual(legend[level], question.criteria[Number(level)]))) throw new JevResponseError("Provider changed the rubric");
|
|
81
|
+
const expected = levels.reduce((total, level) => total + Number(level) * Number(probabilities[level]), 0);
|
|
82
|
+
if (typeof answer.score !== "number" || !Number.isFinite(answer.score) || Math.abs(answer.score - expected) > 1e-4) throw new JevResponseError("Score differs from its distribution");
|
|
83
|
+
} else if (typeof answer.choice !== "string" || !Object.hasOwn(probabilities, answer.choice) || levels.some((level) => Number(probabilities[level]) > Number(probabilities[String(answer.choice)]) + 1e-4)) throw new JevResponseError("Choice is not a highest-probability option");
|
|
84
|
+
}
|
|
85
|
+
jevUsage(raw);
|
|
86
|
+
return raw;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { JevResponseError, jevUsage, parseJevRequest, parseJevResult };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=jev-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jev-protocol.js","names":[],"sources":["../src/jev-protocol.ts"],"sourcesContent":["import { isDeepStrictEqual } from 'node:util'\nimport { canonicalString } from './ledger-core/canonical'\n\n/** Structural equivalents of the native SDK types; callers can use its builders unchanged. */\nexport type JevJson = string | number | boolean | null | JevJson[] | { [key: string]: JevJson }\nexport type JevState = string | { [key: string]: JevJson } | JevJson[] | null\nexport type JevScoreCriteria = readonly [JevState, JevState, ...JevState[]]\nexport type JevQuestion =\n | {\n type: 'noul'\n instructions?: JevState\n criteria?: { true?: JevState; false?: JevState } | null\n }\n | { type: 'score'; instructions?: JevState; criteria: JevScoreCriteria }\n | { type: 'choice'; instructions?: JevState; criteria: Record<string, JevState> }\nexport type JevQuestions = Record<string, JevQuestion>\nexport interface JevRequest<Q extends JevQuestions = JevQuestions> {\n model: string\n state: JevState\n questions: Q\n}\n\ntype ScoreKeys<T extends JevScoreCriteria> = number extends T['length']\n ? number\n : Extract<keyof T, `${number}`>\nexport type JevAnswerFor<Q extends JevQuestion> = Q extends { type: 'noul' }\n ? { readonly type: 'noul'; readonly noul: number }\n : Q extends { type: 'score'; criteria: infer C extends JevScoreCriteria }\n ? {\n readonly type: 'score'\n readonly score: number\n readonly confidence: number\n readonly legend: { readonly [K in ScoreKeys<C>]: C[K] }\n readonly probabilities: { readonly [K in ScoreKeys<C>]: number }\n }\n : Q extends { type: 'choice'; criteria: infer C }\n ? {\n readonly type: 'choice'\n readonly choice: keyof C & string\n readonly confidence: number\n readonly probabilities: { readonly [K in keyof C]: number }\n }\n : never\nexport type JevAnswer = JevAnswerFor<JevQuestion>\nexport interface JevResult<Q extends JevQuestions = JevQuestions> {\n readonly model: string\n readonly answers: { readonly [K in keyof Q]: JevAnswerFor<Q[K]> }\n readonly usage: { readonly input_tokens: number; readonly output_tokens: number }\n}\n\nexport class JevResponseError extends Error {\n constructor(message: string) {\n super(`Jev: ${message}`)\n this.name = 'JevResponseError'\n }\n}\n\nfunction object(value: unknown): Record<string, unknown> {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new JevResponseError('Expected an object')\n }\n return value as Record<string, unknown>\n}\n\nfunction entry(value: unknown): void {\n if (value === null || typeof value === 'string') return\n if (typeof value !== 'object') throw new TypeError('Expected text, JSON object/array, or null')\n // Reuse the canonical JSON validator rather than accepting lossy Map/Date coercions.\n canonicalString(value)\n}\n\nexport function parseJevRequest(raw: unknown): JevRequest {\n const request = object(raw)\n if (typeof request.model !== 'string' || !request.model.trim()) {\n throw new TypeError('Evaluation requires a model')\n }\n entry(request.state)\n const questions = object(request.questions)\n if (!Object.keys(questions).length) throw new TypeError('At least one question is required')\n for (const rawQuestion of Object.values(questions)) {\n const question = object(rawQuestion)\n if (question.instructions !== undefined) entry(question.instructions)\n if (question.type === 'noul') {\n if (question.criteria != null) {\n const criteria = object(question.criteria)\n if (Object.keys(criteria).some((key) => key !== 'true' && key !== 'false')) {\n throw new TypeError('Noul criteria must describe true and/or false')\n }\n for (const value of Object.values(criteria)) {\n if (value !== undefined) entry(value)\n }\n }\n } else if (question.type === 'score') {\n if (!Array.isArray(question.criteria) || question.criteria.length < 2) {\n throw new TypeError('Score criteria require at least two ordered entries')\n }\n for (const value of question.criteria) entry(value)\n } else if (question.type === 'choice') {\n const criteria = object(question.criteria)\n if (!Object.keys(criteria).length) throw new TypeError('Choice criteria cannot be empty')\n for (const value of Object.values(criteria)) entry(value)\n } else {\n throw new TypeError('Unsupported native question type')\n }\n }\n return raw as JevRequest\n}\n\nexport function jevUsage(raw: unknown): JevResult['usage'] {\n const usage = object(object(raw).usage)\n for (const key of ['input_tokens', 'output_tokens']) {\n if (!Number.isSafeInteger(usage[key]) || Number(usage[key]) < 0) {\n throw new JevResponseError('Missing or invalid usage')\n }\n }\n return usage as unknown as JevResult['usage']\n}\n\nfunction probability(value: unknown): number {\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1) {\n throw new JevResponseError('Invalid probability')\n }\n return value\n}\n\nfunction exactKeys(value: Record<string, unknown>, names: string[]): void {\n if (\n Object.keys(value).length !== names.length ||\n names.some((key) => !Object.hasOwn(value, key))\n ) {\n throw new JevResponseError('Response keys differ from the request')\n }\n}\n\n/** Validate native evidence, not model alias policy or the caller's scoring rules. */\nexport function parseJevResult<Q extends JevQuestions>(\n raw: unknown,\n request: JevRequest<Q>,\n): JevResult<Q> {\n // Preserve extension metadata, rejecting values that change when persisted as JSON.\n canonicalString(raw)\n const response = object(raw)\n if (typeof response.model !== 'string' || !response.model.trim()) {\n throw new JevResponseError('Missing served model')\n }\n const answers = object(response.answers)\n exactKeys(answers, Object.keys(request.questions))\n for (const [name, question] of Object.entries(request.questions)) {\n const answer = object(answers[name])\n if (answer.type !== question.type) throw new JevResponseError('Wrong answer type')\n if (question.type === 'noul') {\n probability(answer.noul)\n continue\n }\n probability(answer.confidence)\n const levels =\n question.type === 'score'\n ? question.criteria.map((_, index) => String(index))\n : Object.keys(question.criteria)\n const probabilities = object(answer.probabilities)\n exactKeys(probabilities, levels)\n const sum = levels.reduce((total, level) => total + probability(probabilities[level]), 0)\n if (Math.abs(sum - 1) > 0.0001) throw new JevResponseError('Invalid probability distribution')\n if (question.type === 'score') {\n const legend = object(answer.legend)\n exactKeys(legend, levels)\n if (\n levels.some((level) => !isDeepStrictEqual(legend[level], question.criteria[Number(level)]))\n ) {\n throw new JevResponseError('Provider changed the rubric')\n }\n const expected = levels.reduce(\n (total, level) => total + Number(level) * Number(probabilities[level]),\n 0,\n )\n if (\n typeof answer.score !== 'number' ||\n !Number.isFinite(answer.score) ||\n Math.abs(answer.score - expected) > 0.0001\n ) {\n throw new JevResponseError('Score differs from its distribution')\n }\n } else if (\n typeof answer.choice !== 'string' ||\n !Object.hasOwn(probabilities, answer.choice) ||\n levels.some(\n (level) =>\n Number(probabilities[level]) > Number(probabilities[String(answer.choice)]) + 0.0001,\n )\n ) {\n throw new JevResponseError('Choice is not a highest-probability option')\n }\n }\n jevUsage(raw)\n return raw as JevResult<Q>\n}\n"],"mappings":";;;AAkDA,IAAa,mBAAb,cAAsC,MAAM;CAC1C,YAAY,SAAiB;EAC3B,MAAM,QAAQ,SAAS;EACvB,KAAK,OAAO;CACd;AACF;AAEA,SAAS,OAAO,OAAyC;CACvD,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GACpE,MAAM,IAAI,iBAAiB,oBAAoB;CAEjD,OAAO;AACT;AAEA,SAAS,MAAM,OAAsB;CACnC,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;CACjD,IAAI,OAAO,UAAU,UAAU,MAAM,IAAI,UAAU,2CAA2C;CAE9F,gBAAgB,KAAK;AACvB;AAEA,SAAgB,gBAAgB,KAA0B;CACxD,MAAM,UAAU,OAAO,GAAG;CAC1B,IAAI,OAAO,QAAQ,UAAU,YAAY,CAAC,QAAQ,MAAM,KAAK,GAC3D,MAAM,IAAI,UAAU,6BAA6B;CAEnD,MAAM,QAAQ,KAAK;CACnB,MAAM,YAAY,OAAO,QAAQ,SAAS;CAC1C,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,QAAQ,MAAM,IAAI,UAAU,mCAAmC;CAC3F,KAAK,MAAM,eAAe,OAAO,OAAO,SAAS,GAAG;EAClD,MAAM,WAAW,OAAO,WAAW;EACnC,IAAI,SAAS,iBAAiB,KAAA,GAAW,MAAM,SAAS,YAAY;EACpE,IAAI,SAAS,SAAS,QAChB;OAAA,SAAS,YAAY,MAAM;I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,cAAc,MAAM,GACrE,CACF;GACA,IACE,OAAO,OAAO,UAAU,YACxB,CAAC,OAAO,SAAS,OAAO,KAAK,KAC7B,KAAK,IAAI,OAAO,QAAQ,QAAQ,IAAI,MAEpC,MAAM,IAAI,iBAAiB,qCAAqC;EAEpE,OAAO,IACL,OAAO,OAAO,WAAW,YACzB,CAAC,OAAO,OAAO,eAAe,OAAO,MAAM,KAC3C,OAAO,MACJ,UACC,OAAO,cAAc,MAAM,IAAI,OAAO,cAAc,OAAO,OAAO,MAAM,EAAE,IAAI,IAClF,GAEA,MAAM,IAAI,iBAAiB,4CAA4C;CAE3E;CACA,SAAS,GAAG;CACZ,OAAO;AACT"}
|
package/dist/jev.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { b as CustomTokenPricing, g as CostReceiptInput } from "./cost-ledger-DbQdN3nO.js";
|
|
2
|
+
import { i as AnalystFinding, n as AnalystContext, t as Analyst } from "./types-BjB2wZM9.js";
|
|
3
|
+
import { R as Scenario, S as JudgeConfig, w as JudgeScore } from "./types-BTRcIqFr.js";
|
|
4
|
+
import { EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, Evaluator, EvaluatorOptions, asAnalyst, asJudge, createEvaluator } from "./evaluation.js";
|
|
5
|
+
import { JevAnswer, JevAnswerFor, JevJson, JevQuestion, JevQuestions, JevRequest, JevResponseError, JevResult, JevScoreCriteria, JevState, jevUsage, parseJevRequest, parseJevResult } from "./jev-protocol.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/jev-review.d.ts
|
|
8
|
+
declare const checkSchema: z.ZodObject<{
|
|
9
|
+
claim: z.ZodString;
|
|
10
|
+
area: z.ZodString;
|
|
11
|
+
subject: z.ZodString;
|
|
12
|
+
severity: z.ZodEnum<{
|
|
13
|
+
critical: "critical";
|
|
14
|
+
high: "high";
|
|
15
|
+
info: "info";
|
|
16
|
+
low: "low";
|
|
17
|
+
medium: "medium";
|
|
18
|
+
}>;
|
|
19
|
+
supports: z.ZodArray<z.ZodString>;
|
|
20
|
+
refutes: z.ZodArray<z.ZodString>;
|
|
21
|
+
supportAtLeast: z.ZodNumber;
|
|
22
|
+
refuteAtLeast: z.ZodNumber;
|
|
23
|
+
coverage: z.ZodEnum<{
|
|
24
|
+
complete: "complete";
|
|
25
|
+
missing: "missing";
|
|
26
|
+
partial: "partial";
|
|
27
|
+
}>;
|
|
28
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
29
|
+
kind: z.ZodEnum<{
|
|
30
|
+
artifact: "artifact";
|
|
31
|
+
event: "event";
|
|
32
|
+
finding: "finding";
|
|
33
|
+
metric: "metric";
|
|
34
|
+
span: "span";
|
|
35
|
+
}>;
|
|
36
|
+
uri: z.ZodString;
|
|
37
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
/** Optional interpretation of native choices/scores. Policy and evidence belong to the caller. */
|
|
41
|
+
type JevReviewCheck = z.infer<typeof checkSchema>;
|
|
42
|
+
interface JevReviewInput<Q extends JevQuestions = JevQuestions> {
|
|
43
|
+
version: string;
|
|
44
|
+
request: JevRequest<Q>;
|
|
45
|
+
checks: { [K in keyof Q]: JevReviewCheck; };
|
|
46
|
+
}
|
|
47
|
+
interface PreparedJevReview<Q extends JevQuestions = JevQuestions> extends JevReviewInput<Q> {
|
|
48
|
+
/** Binds questions, option order, context, evidence, thresholds and definition version. */
|
|
49
|
+
digest: string;
|
|
50
|
+
}
|
|
51
|
+
interface JevReviewAssessment {
|
|
52
|
+
question: string;
|
|
53
|
+
status: 'supported' | 'refuted' | 'unresolved';
|
|
54
|
+
reason: 'support-threshold' | 'refutation-threshold' | 'missing-evidence' | 'partial-negative-evidence' | 'below-threshold' | 'ambiguous-thresholds';
|
|
55
|
+
/** Unnormalized marginal mass of caller-designated native alternatives. Not calibrated risk. */
|
|
56
|
+
supportProbability: number;
|
|
57
|
+
refutationProbability: number;
|
|
58
|
+
unresolvedProbability: number;
|
|
59
|
+
modelConfidence: number | null;
|
|
60
|
+
check: JevReviewCheck;
|
|
61
|
+
}
|
|
62
|
+
interface JevReviewReport {
|
|
63
|
+
reviewDigest: string;
|
|
64
|
+
requestedModel: string;
|
|
65
|
+
servedModel: string;
|
|
66
|
+
assessments: JevReviewAssessment[];
|
|
67
|
+
}
|
|
68
|
+
/** Validate before paid admission; make a detached, frozen snapshot without rewriting native JSON. */
|
|
69
|
+
declare function prepareJevReview<const Q extends JevQuestions>(input: JevReviewInput<Q>): PreparedJevReview<Q>;
|
|
70
|
+
/** Re-score the same retained distribution without new inference or any authorization effect. */
|
|
71
|
+
declare function assessJevReview<Q extends JevQuestions>(review: PreparedJevReview<Q>, raw: unknown): JevReviewReport;
|
|
72
|
+
/** Ordinary analyst findings; a negative review is not a global safety certificate. */
|
|
73
|
+
declare function jevReviewFindings<Q extends JevQuestions>(review: PreparedJevReview<Q>, result: JevResult<Q>, options: {
|
|
74
|
+
analystId: string;
|
|
75
|
+
producedAt?: string;
|
|
76
|
+
}): AnalystFinding[];
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/jev.d.ts
|
|
79
|
+
type JevEvaluate = EvaluatorOptions<JevRequest, unknown>['execute'];
|
|
80
|
+
interface JevEvaluatorOptions {
|
|
81
|
+
evaluate: JevEvaluate;
|
|
82
|
+
costLedger?: EvaluatorOptions<JevRequest, unknown>['costLedger'];
|
|
83
|
+
maximumCharge?: EvaluatorOptions<JevRequest, unknown>['maximumCharge'];
|
|
84
|
+
pricing?: CustomTokenPricing;
|
|
85
|
+
receipt?: (response: unknown) => CostReceiptInput;
|
|
86
|
+
receiptFromError?: (error: Error) => CostReceiptInput | undefined;
|
|
87
|
+
/** Optional deployment policy; the protocol adapter does not hardcode model aliases. */
|
|
88
|
+
acceptModel?: (requested: string, served: string) => boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Configure transport once; supply native state, questions, and model on every invocation. */
|
|
91
|
+
declare function jevEvaluator(options: JevEvaluatorOptions): <const Q extends JevQuestions>(request: JevRequest<Q>, context?: EvaluationContext) => Promise<EvaluationResult<JevResult<Q>>>;
|
|
92
|
+
type Input<A, S extends Scenario> = {
|
|
93
|
+
artifact: A;
|
|
94
|
+
scenario: S;
|
|
95
|
+
};
|
|
96
|
+
type QuestionSource<I, Q extends JevQuestions> = Q | ((input: I) => Q | Promise<Q>);
|
|
97
|
+
interface JevOptions extends JevEvaluatorOptions {
|
|
98
|
+
model: string;
|
|
99
|
+
version: string;
|
|
100
|
+
questions: JevQuestions;
|
|
101
|
+
}
|
|
102
|
+
interface JevJudgeOptions<A, S extends Scenario = Scenario, Q extends JevQuestions = JevQuestions> extends JevEvaluatorOptions {
|
|
103
|
+
model: string;
|
|
104
|
+
version: string;
|
|
105
|
+
questions: QuestionSource<Input<A, S>, Q>;
|
|
106
|
+
renderState: (input: Input<A, S>, context: EvaluationContext) => JevState | Promise<JevState>;
|
|
107
|
+
dimensions?: JudgeConfig<A, S>['dimensions'];
|
|
108
|
+
weights?: Record<string, number>;
|
|
109
|
+
map?: (value: JevResult<Q>, input: Input<A, S>) => JudgeScore | Promise<JudgeScore>;
|
|
110
|
+
record?: (result: EvaluationResult<JevResult<Q>>, input: Input<A, S>) => void | Promise<void>;
|
|
111
|
+
appliesTo?: (scenario: S) => boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Optional convention. Choice utilities and non-uniform scales belong in an explicit map. */
|
|
114
|
+
declare function normalizedJevScore(result: JevResult, weights?: Record<string, number>): JudgeScore;
|
|
115
|
+
/** Convenience around the public evaluator. No domain questions, thresholds, or prose. */
|
|
116
|
+
declare function jevJudge<A, S extends Scenario = Scenario, Q extends JevQuestions = JevQuestions>(name: string, options: JevJudgeOptions<A, S, Q>): JudgeConfig<A, S>;
|
|
117
|
+
interface JevAnalystOptions<I, Q extends JevQuestions = JevQuestions> extends JevEvaluatorOptions {
|
|
118
|
+
id: string;
|
|
119
|
+
description: string;
|
|
120
|
+
inputKind: Analyst<I>['inputKind'];
|
|
121
|
+
model: string;
|
|
122
|
+
version: string;
|
|
123
|
+
questions: Q | ((input: I, context: AnalystContext) => Q | Promise<Q>);
|
|
124
|
+
renderState: (input: I, context: AnalystContext) => JevState | Promise<JevState>;
|
|
125
|
+
findings: (value: JevResult<Q>, input: I, context: AnalystContext) => AnalystFinding[] | Promise<AnalystFinding[]>;
|
|
126
|
+
record?: (result: EvaluationResult<JevResult<Q>>, input: I, context: AnalystContext) => void | Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
declare function jevAnalyst<I, Q extends JevQuestions = JevQuestions>(options: JevAnalystOptions<I, Q>): Analyst<I>;
|
|
129
|
+
//#endregion
|
|
130
|
+
export { EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, Evaluator, EvaluatorOptions, JevAnalystOptions, JevAnswer, JevAnswerFor, JevEvaluate, JevEvaluatorOptions, JevJson, JevJudgeOptions, JevOptions, JevQuestion, JevQuestions, JevRequest, JevResponseError, JevResult, JevReviewAssessment, JevReviewCheck, JevReviewInput, JevReviewReport, JevScoreCriteria, JevState, PreparedJevReview, asAnalyst, asJudge, assessJevReview, createEvaluator, jevAnalyst, jevEvaluator, jevJudge, jevReviewFindings, jevUsage, normalizedJevScore, parseJevRequest, parseJevResult, prepareJevReview };
|
|
131
|
+
//# sourceMappingURL=jev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jev.d.ts","names":[],"sources":["../src/jev-review.ts","../src/jev.ts"],"mappings":";;;;;;;cAcM,aAAW,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Bb,EAAA,KAAA;;KAGQ,iBAAiB,EAAE,aAAa;UAC3B,eAAe,UAAU,eAAe;EACvD;EACA,SAAS,WAAW;EACpB,WAAW,WAAW,IAAI;;UAGX,kBAAkB,UAAU,eAAe,sBAClD,eAAe;;EAEvB;;UAGe;EACf;EACA;EACA;;EAQA;EACA;EACA;E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