@tangle-network/agent-eval 0.183.0 → 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-cell-s__adRnK.d.ts → agent-profile-cell-BHcB-mZX.d.ts} +8 -9
- package/dist/{agent-profile-cell-s__adRnK.d.ts.map → agent-profile-cell-BHcB-mZX.d.ts.map} +1 -1
- package/dist/{agent-profile-cell-Cv6UA-W_.js → agent-profile-cell-DcFW4vOc.js} +16 -15
- package/dist/agent-profile-cell-DcFW4vOc.js.map +1 -0
- package/dist/{agent-profile-CivaSsSy.d.ts → agent-profile-uAIQK3Nr.d.ts} +3 -3
- package/dist/{agent-profile-CivaSsSy.d.ts.map → agent-profile-uAIQK3Nr.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +10 -10
- package/dist/analyst/index.js +8 -7
- package/dist/analyst/index.js.map +1 -1
- package/dist/{benchmark-DQKzykkO.js → benchmark-BeQJyrRC.js} +3 -3
- package/dist/{benchmark-DQKzykkO.js.map → benchmark-BeQJyrRC.js.map} +1 -1
- package/dist/{benchmark-command-NBrqNwgy.js → benchmark-command-DlSePljH.js} +13 -12
- package/dist/{benchmark-command-NBrqNwgy.js.map → benchmark-command-DlSePljH.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +3 -3
- package/dist/builder-eval/index.js +1 -1
- package/dist/campaign/index.d.ts +6 -5
- package/dist/campaign/index.js +9 -9
- package/dist/{campaign-BwcEBC91.js → campaign-D6puiGFO.js} +15 -15
- package/dist/{campaign-BwcEBC91.js.map → campaign-D6puiGFO.js.map} +1 -1
- package/dist/{campaign-evidence-PYPUftRy.js → campaign-evidence-aWEmfROB.js} +5 -5
- package/dist/{campaign-evidence-PYPUftRy.js.map → campaign-evidence-aWEmfROB.js.map} +1 -1
- package/dist/{canonical-DPyQ_rpt.js → canonical-BsZVgBhW.js} +2 -4
- package/dist/canonical-BsZVgBhW.js.map +1 -0
- package/dist/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 +14 -14
- package/dist/{default-registry-C0-N4PkG.js → default-registry-CpLko4jB.js} +5 -4
- package/dist/{default-registry-C0-N4PkG.js.map → default-registry-CpLko4jB.js.map} +1 -1
- package/dist/{default-registry-BwDSWVzg.d.ts → default-registry-DYB4aHVn.d.ts} +6 -6
- package/dist/{default-registry-BwDSWVzg.d.ts.map → default-registry-DYB4aHVn.d.ts.map} +1 -1
- package/dist/{define-agent-eval-CwOWWQt_.d.ts → define-agent-eval-DE67ECH1.d.ts} +7 -7
- package/dist/{define-agent-eval-CwOWWQt_.d.ts.map → define-agent-eval-DE67ECH1.d.ts.map} +1 -1
- package/dist/{define-agent-eval-CneiWyuA.js → define-agent-eval-RTekxhUE.js} +8 -8
- package/dist/{define-agent-eval-CneiWyuA.js.map → define-agent-eval-RTekxhUE.js.map} +1 -1
- package/dist/{dspy-rlm-engine-8pgBSiy7.js → dspy-rlm-engine-Da-l3CpD.js} +3 -3
- package/dist/{dspy-rlm-engine-8pgBSiy7.js.map → dspy-rlm-engine-Da-l3CpD.js.map} +1 -1
- package/dist/{engine-DS1cysJy.d.ts → engine-D1ykrAKR.d.ts} +7 -7
- package/dist/{engine-DS1cysJy.d.ts.map → engine-D1ykrAKR.d.ts.map} +1 -1
- package/dist/{eval-campaign-CCEkwzoH.js → eval-campaign-XFHEpN86.js} +4 -4
- package/dist/{eval-campaign-CCEkwzoH.js.map → eval-campaign-XFHEpN86.js.map} +1 -1
- package/dist/evaluation.d.ts +75 -0
- package/dist/evaluation.d.ts.map +1 -0
- package/dist/evaluation.js +137 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/{exact-types-BZDe0W2D.d.ts → exact-types-BEHN7tnq.d.ts} +2 -2
- package/dist/{exact-types-BZDe0W2D.d.ts.map → exact-types-BEHN7tnq.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +2 -2
- package/dist/experiment/index.js +5 -5
- package/dist/{experiment-tracker-C7PfnF4b.d.ts → experiment-tracker-URRGP9ek.d.ts} +2 -2
- package/dist/{experiment-tracker-C7PfnF4b.d.ts.map → experiment-tracker-URRGP9ek.d.ts.map} +1 -1
- package/dist/{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-58wex7KV.d.ts} +11 -11
- package/dist/{index-DoykkxW0.d.ts.map → index-58wex7KV.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-DbG8QbH9.d.ts → index-DVrtLO5j.d.ts} +6 -6
- package/dist/{index-DbG8QbH9.d.ts.map → index-DVrtLO5j.d.ts.map} +1 -1
- package/dist/{index-Bp_6sj3x.d.ts → index-ww8736Am.d.ts} +20 -315
- package/dist/index-ww8736Am.d.ts.map +1 -0
- package/dist/index.d.ts +23 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -24
- 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-DE088Zhv.js} +4 -3
- package/dist/{kind-factory-DxTzg32u.js.map → kind-factory-DE088Zhv.js.map} +1 -1
- package/dist/ledger-core/index.js +2 -2
- package/dist/{llm-judge-FfaRgz9X.js → llm-judge-C5wbADA5.js} +9 -9
- package/dist/{llm-judge-FfaRgz9X.js.map → llm-judge-C5wbADA5.js.map} +1 -1
- package/dist/{matrix-CyhW-vgJ.d.ts → matrix-CPKsRY8Y.d.ts} +2 -2
- package/dist/{matrix-CyhW-vgJ.d.ts.map → matrix-CPKsRY8Y.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +54 -2
- package/dist/meta-eval/index.d.ts.map +1 -1
- package/dist/meta-eval/index.js +52 -3
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/{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/pipelines/index.js +2 -2
- package/dist/{produced-state-CGoVInrl.js → produced-state-D3uWsY8t.js} +23 -19
- package/dist/{produced-state-CGoVInrl.js.map → produced-state-D3uWsY8t.js.map} +1 -1
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +1 -1
- package/dist/{promotion-policy-BKFrl7CC.js → promotion-policy-CD-bUeyR.js} +3 -3
- package/dist/{promotion-policy-BKFrl7CC.js.map → promotion-policy-CD-bUeyR.js.map} +1 -1
- package/dist/{query-D1nLIKt7.js → query-DlV0pdx4.js} +2 -2
- package/dist/{query-D1nLIKt7.js.map → query-DlV0pdx4.js.map} +1 -1
- package/dist/{registry-BRbB6Y0v.d.ts → registry-D5Ly3GRV.d.ts} +3 -3
- package/dist/{registry-BRbB6Y0v.d.ts.map → registry-D5Ly3GRV.d.ts.map} +1 -1
- package/dist/{release-confidence-BcqeQTHW.d.ts → release-confidence-DsETiO4f.d.ts} +3 -3
- package/dist/{release-confidence-BcqeQTHW.d.ts.map → release-confidence-DsETiO4f.d.ts.map} +1 -1
- package/dist/{release-confidence-DMg8n18l.js → release-confidence-RanRUXRW.js} +2 -2
- package/dist/{release-confidence-DMg8n18l.js.map → release-confidence-RanRUXRW.js.map} +1 -1
- package/dist/reporting.d.ts +3 -3
- package/dist/reporting.js +2 -2
- package/dist/{researcher-64T49THL.d.ts → researcher-CJkH-6Ty.d.ts} +4 -4
- package/dist/{researcher-64T49THL.d.ts.map → researcher-CJkH-6Ty.d.ts.map} +1 -1
- package/dist/{reward-hacking-uzO_ihep.d.ts → reward-hacking-BIQ2BWLG.d.ts} +2 -2
- package/dist/{reward-hacking-uzO_ihep.d.ts.map → reward-hacking-BIQ2BWLG.d.ts.map} +1 -1
- package/dist/rl.d.ts +10 -6
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +21 -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-DPa2PeHx.js → run-record-BhMVsHR1.js} +2 -2
- package/dist/{run-record-DPa2PeHx.js.map → run-record-BhMVsHR1.js.map} +1 -1
- package/dist/{run-record-BiTWauyO.d.ts → run-record-D9wS35fK.d.ts} +2 -2
- package/dist/{run-record-BiTWauyO.d.ts.map → run-record-D9wS35fK.d.ts.map} +1 -1
- package/dist/{run-record-DualPTn2.js → run-record-tg_5H2IK.js} +2 -2
- package/dist/{run-record-DualPTn2.js.map → run-record-tg_5H2IK.js.map} +1 -1
- package/dist/search-ledger-types-D7KDVg-o.d.ts +302 -0
- package/dist/search-ledger-types-D7KDVg-o.d.ts.map +1 -0
- package/dist/{semantic-concept-judge-_3Fp6Q_3.js → semantic-concept-judge-5r9hDEBA.js} +4 -4
- package/dist/{semantic-concept-judge-_3Fp6Q_3.js.map → semantic-concept-judge-5r9hDEBA.js.map} +1 -1
- package/dist/{sequential-D_xHrBZe.js → sequential-BfDkCBGo.js} +3 -3
- package/dist/{sequential-D_xHrBZe.js.map → sequential-BfDkCBGo.js.map} +1 -1
- package/dist/{server-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-B2zxoDk0.js} +7 -7
- package/dist/{skillopt-optimization-method-DY1aQ-aL.js.map → skillopt-optimization-method-B2zxoDk0.js.map} +1 -1
- package/dist/{statistical-heldout-CpVd6FmY.d.ts → statistical-heldout-Bu4oNOJh.d.ts} +3 -3
- package/dist/{statistical-heldout-CpVd6FmY.d.ts.map → statistical-heldout-Bu4oNOJh.d.ts.map} +1 -1
- package/dist/{store-otlp-DAaEbMLf.js → store-otlp-rU5PFlOB.js} +2 -2
- package/dist/{store-otlp-DAaEbMLf.js.map → store-otlp-rU5PFlOB.js.map} +1 -1
- package/dist/{store-tool-spans-Dt-YdAuE.d.ts → store-tool-spans-DwdokbHg.d.ts} +54 -6
- package/dist/store-tool-spans-DwdokbHg.d.ts.map +1 -0
- package/dist/{store-tool-spans-BZ8MPKFe.js → store-tool-spans-zrtftcRe.js} +68 -6
- package/dist/store-tool-spans-zrtftcRe.js.map +1 -0
- package/dist/{summary-report-IGAOtgPd.js → summary-report-BMvou2oZ.js} +2 -2
- package/dist/{summary-report-IGAOtgPd.js.map → summary-report-BMvou2oZ.js.map} +1 -1
- package/dist/{summary-report-D1h4dlrK.d.ts → summary-report-BzFS5UhZ.d.ts} +2 -2
- package/dist/{summary-report-D1h4dlrK.d.ts.map → summary-report-BzFS5UhZ.d.ts.map} +1 -1
- package/dist/{task-failure-attributes-B_JjrOVo.js → task-failure-attributes-BOxjfbhr.js} +2 -2
- package/dist/{task-failure-attributes-B_JjrOVo.js.map → task-failure-attributes-BOxjfbhr.js.map} +1 -1
- package/dist/{tool-groups-B2bSNaJB.d.ts → tool-groups-qHMydbAH.d.ts} +3 -3
- package/dist/tool-groups-qHMydbAH.d.ts.map +1 -0
- package/dist/{tool-waste-C7MU9u1e.js → tool-waste-nbHPAxei.js} +2 -2
- package/dist/{tool-waste-C7MU9u1e.js.map → tool-waste-nbHPAxei.js.map} +1 -1
- package/dist/trace-repair/index.d.ts +2 -2
- package/dist/trace-repair/index.js +3 -3
- package/dist/traces.d.ts +5 -5
- package/dist/traces.js +7 -7
- package/dist/trajectory-replay/index.js +1 -1
- package/dist/{types-CS0qk_Yp.d.ts → types-BTRcIqFr.d.ts} +3 -3
- package/dist/{types-CS0qk_Yp.d.ts.map → types-BTRcIqFr.d.ts.map} +1 -1
- package/dist/{types-D7gEdPoQ.d.ts → types-BjB2wZM9.d.ts} +2 -2
- package/dist/{types-D7gEdPoQ.d.ts.map → types-BjB2wZM9.d.ts.map} +1 -1
- package/dist/types-C8VBbiw6.js +91 -0
- package/dist/types-C8VBbiw6.js.map +1 -0
- package/dist/{types-BvZoPTGa.d.ts → types-c3ZRTbw9.d.ts} +3 -3
- package/dist/{types-BvZoPTGa.d.ts.map → types-c3ZRTbw9.d.ts.map} +1 -1
- package/dist/{types-DQ0e2E7y.js → usage-receipt-Cx3xNeyB.js} +2 -89
- package/dist/usage-receipt-Cx3xNeyB.js.map +1 -0
- package/dist/{verdict-BQ3pCFf8.js → verdict-DhPoXApk.js} +2 -2
- package/dist/{verdict-BQ3pCFf8.js.map → verdict-DhPoXApk.js.map} +1 -1
- package/dist/{verdict-cache-B3eCVQtY.js → verdict-cache-BQEsVy9n.js} +2 -2
- package/dist/{verdict-cache-B3eCVQtY.js.map → verdict-cache-BQEsVy9n.js.map} +1 -1
- package/dist/wire/index.d.ts +1 -1
- package/dist/wire/index.js +1 -1
- package/docs/changes/evaluation-definition-identity.md +27 -0
- package/docs/changes/jev-evidence-review.md +18 -0
- package/docs/changes/jev-product-adoption.md +18 -0
- package/docs/changes/probability-policy-audit.md +81 -0
- package/docs/jev-behavior-review.md +174 -0
- package/docs/jev-integrations.md +50 -0
- package/docs/jev.md +140 -0
- package/docs/produced-state.md +13 -0
- package/docs/profile-json-identity.md +33 -0
- package/package.json +16 -1
- package/dist/agent-profile-cell-Cv6UA-W_.js.map +0 -1
- package/dist/canonical-DPyQ_rpt.js.map +0 -1
- package/dist/exporters-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/mint-ySIIkKlV.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
package/dist/jev.js
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { a as hashCanonical, o as jsonDocument, r as canonicalString } from "./canonical-BsZVgBhW.js";
|
|
2
|
+
import { s as weightedComposite } from "./descriptive-1V17A-qa.js";
|
|
3
|
+
import { n as contentHash } from "./verdict-cache-BQEsVy9n.js";
|
|
4
|
+
import { a as deepFreezeCanonicalJson, r as makeFinding, t as ANALYST_SEVERITIES } from "./types-C8VBbiw6.js";
|
|
5
|
+
import { asAnalyst, asJudge, createEvaluator } from "./evaluation.js";
|
|
6
|
+
import { JevResponseError, jevUsage, parseJevRequest, parseJevResult } from "./jev-protocol.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
//#region src/jev-review.ts
|
|
9
|
+
const name = z.string().trim().min(1);
|
|
10
|
+
const probability = z.number().finite().gt(0).max(1);
|
|
11
|
+
const checkSchema = z.object({
|
|
12
|
+
claim: name,
|
|
13
|
+
area: name,
|
|
14
|
+
subject: name,
|
|
15
|
+
severity: z.enum(ANALYST_SEVERITIES),
|
|
16
|
+
/** Choice labels or score-level keys, never scores invented from category order. */
|
|
17
|
+
supports: z.array(z.string()).min(1),
|
|
18
|
+
refutes: z.array(z.string()).min(1),
|
|
19
|
+
supportAtLeast: probability,
|
|
20
|
+
refuteAtLeast: probability,
|
|
21
|
+
/** Host-supplied coverage of the question's required evidence, not model self-assessment. */
|
|
22
|
+
coverage: z.enum([
|
|
23
|
+
"complete",
|
|
24
|
+
"partial",
|
|
25
|
+
"missing"
|
|
26
|
+
]),
|
|
27
|
+
evidence: z.array(z.object({
|
|
28
|
+
kind: z.enum([
|
|
29
|
+
"span",
|
|
30
|
+
"event",
|
|
31
|
+
"artifact",
|
|
32
|
+
"finding",
|
|
33
|
+
"metric"
|
|
34
|
+
]),
|
|
35
|
+
uri: name,
|
|
36
|
+
excerpt: z.string().optional()
|
|
37
|
+
}).strict())
|
|
38
|
+
}).strict().refine((value) => value.supportAtLeast + value.refuteAtLeast > 1, { message: "Support and refutation thresholds must not overlap" });
|
|
39
|
+
function alternatives(question) {
|
|
40
|
+
if (question.type === "noul") return ["true", "false"];
|
|
41
|
+
return question.type === "choice" ? Object.keys(question.criteria) : question.criteria.map((_, index) => String(index));
|
|
42
|
+
}
|
|
43
|
+
/** Validate before paid admission; make a detached, frozen snapshot without rewriting native JSON. */
|
|
44
|
+
function prepareJevReview(input) {
|
|
45
|
+
if (!input.version?.trim()) throw new TypeError("Review version is required");
|
|
46
|
+
parseJevRequest(input.request);
|
|
47
|
+
const document = jsonDocument(input);
|
|
48
|
+
canonicalString(document);
|
|
49
|
+
const snapshot = structuredClone(document);
|
|
50
|
+
const keys = Object.keys(snapshot.request.questions);
|
|
51
|
+
if (!snapshot.checks || Object.keys(snapshot.checks).length !== keys.length || keys.some((key) => !Object.hasOwn(snapshot.checks, key))) throw new TypeError("Review checks must match the exact question names");
|
|
52
|
+
for (const key of keys) {
|
|
53
|
+
const check = checkSchema.parse(snapshot.checks[key]);
|
|
54
|
+
const labels = [...check.supports, ...check.refutes];
|
|
55
|
+
const allowed = alternatives(snapshot.request.questions[key]);
|
|
56
|
+
if (new Set(labels).size !== labels.length || labels.some((label) => !allowed.includes(label))) throw new TypeError("Review alternatives must exist and be disjoint");
|
|
57
|
+
if (check.coverage !== "missing" && check.evidence.length === 0) throw new TypeError("Review evidence references are required for non-missing coverage");
|
|
58
|
+
if (canonicalString(jsonDocument(check)) !== canonicalString(snapshot.checks[key])) throw new TypeError("Review metadata must not require normalization");
|
|
59
|
+
}
|
|
60
|
+
const order = keys.map((key) => [key, alternatives(snapshot.request.questions[key])]);
|
|
61
|
+
return deepFreezeCanonicalJson({
|
|
62
|
+
...snapshot,
|
|
63
|
+
digest: hashCanonical({
|
|
64
|
+
snapshot,
|
|
65
|
+
order
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Re-score the same retained distribution without new inference or any authorization effect. */
|
|
70
|
+
function assessJevReview(review, raw) {
|
|
71
|
+
const { digest, ...input } = review;
|
|
72
|
+
const prepared = prepareJevReview(input);
|
|
73
|
+
if (prepared.digest !== digest) throw new TypeError("Review definition changed after preparation");
|
|
74
|
+
const result = parseJevResult(raw, prepared.request);
|
|
75
|
+
const assessments = Object.entries(prepared.checks).map(([question, check]) => {
|
|
76
|
+
const answer = result.answers[question];
|
|
77
|
+
const probabilities = answer.type === "noul" ? {
|
|
78
|
+
true: answer.noul,
|
|
79
|
+
false: 1 - answer.noul
|
|
80
|
+
} : answer.probabilities;
|
|
81
|
+
const sum = (labels) => labels.reduce((total, label) => total + probabilities[label], 0);
|
|
82
|
+
const supportProbability = sum(check.supports);
|
|
83
|
+
const refutationProbability = sum(check.refutes);
|
|
84
|
+
const used = /* @__PURE__ */ new Set([...check.supports, ...check.refutes]);
|
|
85
|
+
const unresolvedProbability = sum(Object.keys(probabilities).filter((label) => !used.has(label)));
|
|
86
|
+
let status = "unresolved";
|
|
87
|
+
let reason = "below-threshold";
|
|
88
|
+
if (supportProbability > 1 || refutationProbability > 1 || unresolvedProbability > 1) throw new TypeError("Review probability mass exceeds one; do not silently normalize it");
|
|
89
|
+
if (check.coverage === "missing") reason = "missing-evidence";
|
|
90
|
+
else if (supportProbability >= check.supportAtLeast && refutationProbability >= check.refuteAtLeast) reason = "ambiguous-thresholds";
|
|
91
|
+
else if (supportProbability >= check.supportAtLeast) {
|
|
92
|
+
status = "supported";
|
|
93
|
+
reason = "support-threshold";
|
|
94
|
+
} else if (refutationProbability >= check.refuteAtLeast) if (check.coverage === "complete") {
|
|
95
|
+
status = "refuted";
|
|
96
|
+
reason = "refutation-threshold";
|
|
97
|
+
} else reason = "partial-negative-evidence";
|
|
98
|
+
return {
|
|
99
|
+
question,
|
|
100
|
+
status,
|
|
101
|
+
reason,
|
|
102
|
+
supportProbability,
|
|
103
|
+
refutationProbability,
|
|
104
|
+
unresolvedProbability,
|
|
105
|
+
modelConfidence: answer.type === "noul" ? null : answer.confidence,
|
|
106
|
+
check: structuredClone(check)
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
reviewDigest: digest,
|
|
111
|
+
requestedModel: review.request.model,
|
|
112
|
+
servedModel: result.model,
|
|
113
|
+
assessments
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/** Ordinary analyst findings; a negative review is not a global safety certificate. */
|
|
117
|
+
function jevReviewFindings(review, result, options) {
|
|
118
|
+
if (!options.analystId.trim()) throw new TypeError("Analyst id is required");
|
|
119
|
+
const report = assessJevReview(review, result);
|
|
120
|
+
return report.assessments.filter((item) => item.status !== "refuted").map((item) => makeFinding({
|
|
121
|
+
analyst_id: options.analystId,
|
|
122
|
+
...options.producedAt === void 0 ? {} : { produced_at: options.producedAt },
|
|
123
|
+
subject: item.check.subject,
|
|
124
|
+
area: item.status === "unresolved" ? "assessment-coverage" : item.check.area,
|
|
125
|
+
severity: item.status === "unresolved" ? "info" : item.check.severity,
|
|
126
|
+
claim: item.status === "supported" ? `Model-supported hypothesis: ${item.check.claim}` : `Unresolved review: ${item.check.claim}`,
|
|
127
|
+
evidence_refs: structuredClone(item.check.evidence),
|
|
128
|
+
confidence: item.status === "supported" ? item.supportProbability : 1,
|
|
129
|
+
derived_from_judge: true,
|
|
130
|
+
id_basis: hashCanonical([
|
|
131
|
+
item.question,
|
|
132
|
+
item.status,
|
|
133
|
+
review.version,
|
|
134
|
+
item.check.claim
|
|
135
|
+
]),
|
|
136
|
+
metadata: {
|
|
137
|
+
review_digest: report.reviewDigest,
|
|
138
|
+
question: item.question,
|
|
139
|
+
requested_model: report.requestedModel,
|
|
140
|
+
served_model: report.servedModel,
|
|
141
|
+
assessment: item.status,
|
|
142
|
+
assessment_reason: item.reason,
|
|
143
|
+
evidence_coverage: item.check.coverage,
|
|
144
|
+
support_probability: item.supportProbability,
|
|
145
|
+
refutation_probability: item.refutationProbability,
|
|
146
|
+
unresolved_probability: item.unresolvedProbability,
|
|
147
|
+
model_confidence: item.modelConfidence,
|
|
148
|
+
calibration: "not-established",
|
|
149
|
+
confidence_basis: item.status === "supported" ? "model-support-mass" : "deterministic-status",
|
|
150
|
+
native_answer: structuredClone(result.answers[item.question])
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/jev.ts
|
|
156
|
+
/** Configure transport once; supply native state, questions, and model on every invocation. */
|
|
157
|
+
function jevEvaluator(options) {
|
|
158
|
+
const config = {
|
|
159
|
+
...options,
|
|
160
|
+
pricing: options.pricing && { ...options.pricing }
|
|
161
|
+
};
|
|
162
|
+
const run = createEvaluator({
|
|
163
|
+
execute: (request, context) => config.evaluate(structuredClone(request), context),
|
|
164
|
+
model: (request) => request.model,
|
|
165
|
+
costLedger: config.costLedger,
|
|
166
|
+
maximumCharge: config.maximumCharge,
|
|
167
|
+
receiptFromError: config.receiptFromError,
|
|
168
|
+
receipt: config.receipt ?? ((raw) => {
|
|
169
|
+
const usage = jevUsage(raw);
|
|
170
|
+
const { model } = raw;
|
|
171
|
+
return {
|
|
172
|
+
model,
|
|
173
|
+
inputTokens: usage.input_tokens,
|
|
174
|
+
outputTokens: usage.output_tokens,
|
|
175
|
+
customTokenPricing: config.pricing
|
|
176
|
+
};
|
|
177
|
+
}),
|
|
178
|
+
validate: (raw, request) => {
|
|
179
|
+
const result = parseJevResult(raw, request);
|
|
180
|
+
if (config.acceptModel && !config.acceptModel(request.model, result.model)) throw new Error("Evaluation served a model rejected by the caller policy");
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return async (request, context) => {
|
|
184
|
+
context?.signal?.throwIfAborted();
|
|
185
|
+
parseJevRequest(request);
|
|
186
|
+
const snapshot = structuredClone(request);
|
|
187
|
+
const result = await run(snapshot, context);
|
|
188
|
+
return {
|
|
189
|
+
...result,
|
|
190
|
+
value: result.value
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/** Canonical identity also retains native question/alternative order; dispatch stays untouched. */
|
|
195
|
+
function questionIdentity(questions) {
|
|
196
|
+
return {
|
|
197
|
+
document: jsonDocument(questions),
|
|
198
|
+
order: Object.entries(questions).map(([name, question]) => [name, question.type === "choice" ? Object.keys(question.criteria) : null])
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function validateWeights(weights, keys) {
|
|
202
|
+
if (Object.entries(weights).some(([key, weight]) => !keys.includes(key) || !Number.isFinite(weight) || weight < 0) || Object.values(weights).reduce((sum, weight) => sum + weight, 0) <= 0) throw new TypeError("Invalid judge weights");
|
|
203
|
+
}
|
|
204
|
+
/** Optional convention. Choice utilities and non-uniform scales belong in an explicit map. */
|
|
205
|
+
function normalizedJevScore(result, weights) {
|
|
206
|
+
const dimensions = Object.create(null);
|
|
207
|
+
const distribution = Object.create(null);
|
|
208
|
+
for (const [key, answer] of Object.entries(result.answers)) {
|
|
209
|
+
if (answer.type === "choice") throw new TypeError("Choice scoring requires an explicit map");
|
|
210
|
+
if (answer.type === "noul") {
|
|
211
|
+
dimensions[key] = answer.noul;
|
|
212
|
+
distribution[key] = [{
|
|
213
|
+
score: 0,
|
|
214
|
+
probability: 1 - answer.noul
|
|
215
|
+
}, {
|
|
216
|
+
score: 1,
|
|
217
|
+
probability: answer.noul
|
|
218
|
+
}];
|
|
219
|
+
} else {
|
|
220
|
+
const scale = Object.keys(answer.legend).length - 1;
|
|
221
|
+
dimensions[key] = answer.score / scale;
|
|
222
|
+
distribution[key] = Object.entries(answer.probabilities).map(([level, probability]) => ({
|
|
223
|
+
score: Number(level) / scale,
|
|
224
|
+
probability
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const effective = weights ?? Object.fromEntries(Object.keys(dimensions).map((key) => [key, 1]));
|
|
229
|
+
validateWeights(effective, Object.keys(dimensions));
|
|
230
|
+
return {
|
|
231
|
+
dimensions,
|
|
232
|
+
composite: weightedComposite({
|
|
233
|
+
dims: dimensions,
|
|
234
|
+
weights: effective
|
|
235
|
+
}).composite,
|
|
236
|
+
notes: "",
|
|
237
|
+
scoringMethod: "expectation",
|
|
238
|
+
distribution
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** Convenience around the public evaluator. No domain questions, thresholds, or prose. */
|
|
242
|
+
function jevJudge(name, options) {
|
|
243
|
+
const config = { ...options };
|
|
244
|
+
const source = typeof options.questions === "function" ? options.questions : structuredClone(options.questions);
|
|
245
|
+
const weights = options.weights && { ...options.weights };
|
|
246
|
+
if (!name.trim() || !options.version.trim()) throw new TypeError("Judge name and version are required");
|
|
247
|
+
if ((typeof source === "function" || config.map) && !config.dimensions) throw new TypeError("Dynamic questions and custom mappings require stable judge dimensions");
|
|
248
|
+
if (!config.map && typeof source !== "function") {
|
|
249
|
+
parseJevRequest({
|
|
250
|
+
model: config.model,
|
|
251
|
+
state: null,
|
|
252
|
+
questions: source
|
|
253
|
+
});
|
|
254
|
+
if (Object.values(source).some((question) => question.type === "choice")) throw new TypeError("Choice scoring requires an explicit map; labels have no numeric ordering");
|
|
255
|
+
if (weights) validateWeights(weights, Object.keys(source));
|
|
256
|
+
}
|
|
257
|
+
const dimensions = config.dimensions ?? Object.entries(source).map(([key, question]) => ({
|
|
258
|
+
key,
|
|
259
|
+
description: typeof question.instructions === "string" ? question.instructions : key
|
|
260
|
+
}));
|
|
261
|
+
const evaluate = jevEvaluator(config);
|
|
262
|
+
return asJudge({
|
|
263
|
+
name,
|
|
264
|
+
version: contentHash({
|
|
265
|
+
model: config.model,
|
|
266
|
+
version: config.version,
|
|
267
|
+
questions: typeof source === "function" ? "dynamic" : questionIdentity(source),
|
|
268
|
+
dimensions,
|
|
269
|
+
...weights ? { weights } : {}
|
|
270
|
+
}),
|
|
271
|
+
dimensions,
|
|
272
|
+
appliesTo: config.appliesTo,
|
|
273
|
+
evaluate: async (input, context = {}) => evaluate({
|
|
274
|
+
model: config.model,
|
|
275
|
+
state: await config.renderState(input, context),
|
|
276
|
+
questions: typeof source === "function" ? await source(input) : source
|
|
277
|
+
}, context),
|
|
278
|
+
map: config.map ?? ((value) => normalizedJevScore(value, weights)),
|
|
279
|
+
record: config.record
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function jevAnalyst(options) {
|
|
283
|
+
const config = { ...options };
|
|
284
|
+
const source = typeof options.questions === "function" ? options.questions : structuredClone(options.questions);
|
|
285
|
+
if (!config.id.trim() || !config.version.trim() || !config.description.trim()) throw new TypeError("Analyst id, version, and description are required");
|
|
286
|
+
const evaluate = jevEvaluator(config);
|
|
287
|
+
return asAnalyst({
|
|
288
|
+
id: config.id,
|
|
289
|
+
description: config.description,
|
|
290
|
+
inputKind: config.inputKind,
|
|
291
|
+
version: contentHash({
|
|
292
|
+
model: config.model,
|
|
293
|
+
version: config.version,
|
|
294
|
+
questions: typeof source === "function" ? "dynamic" : questionIdentity(source)
|
|
295
|
+
}),
|
|
296
|
+
cost: {
|
|
297
|
+
kind: "llm",
|
|
298
|
+
models: [config.model]
|
|
299
|
+
},
|
|
300
|
+
evaluate: async (input, context, analystContext) => evaluate({
|
|
301
|
+
model: config.model,
|
|
302
|
+
state: await config.renderState(input, analystContext),
|
|
303
|
+
questions: typeof source === "function" ? await source(input, analystContext) : source
|
|
304
|
+
}, context),
|
|
305
|
+
map: config.findings,
|
|
306
|
+
record: config.record
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
export { JevResponseError, asAnalyst, asJudge, assessJevReview, createEvaluator, jevAnalyst, jevEvaluator, jevJudge, jevReviewFindings, jevUsage, normalizedJevScore, parseJevRequest, parseJevResult, prepareJevReview };
|
|
311
|
+
|
|
312
|
+
//# sourceMappingURL=jev.js.map
|
package/dist/jev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jev.js","names":[],"sources":["../src/jev-review.ts","../src/jev.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ANALYST_SEVERITIES,\n type AnalystFinding,\n type EvidenceRef,\n makeFinding,\n} from './analyst/types'\nimport type { JevQuestions, JevRequest, JevResult } from './jev-protocol'\nimport { parseJevRequest, parseJevResult } from './jev-protocol'\nimport { canonicalString, hashCanonical, jsonDocument } from './ledger-core/canonical'\nimport { deepFreezeCanonicalJson } from './ledger-core/deep-freeze'\n\nconst name = z.string().trim().min(1)\nconst probability = z.number().finite().gt(0).max(1)\nconst checkSchema = z\n .object({\n claim: name,\n area: name,\n subject: name,\n severity: z.enum(ANALYST_SEVERITIES),\n /** Choice labels or score-level keys, never scores invented from category order. */\n supports: z.array(z.string()).min(1),\n refutes: z.array(z.string()).min(1),\n supportAtLeast: probability,\n refuteAtLeast: probability,\n /** Host-supplied coverage of the question's required evidence, not model self-assessment. */\n coverage: z.enum(['complete', 'partial', 'missing']),\n evidence: z.array(\n z\n .object({\n kind: z.enum(['span', 'event', 'artifact', 'finding', 'metric']),\n uri: name,\n excerpt: z.string().optional(),\n })\n .strict(),\n ),\n })\n .strict()\n .refine((value) => value.supportAtLeast + value.refuteAtLeast > 1, {\n message: 'Support and refutation thresholds must not overlap',\n })\n\n/** Optional interpretation of native choices/scores. Policy and evidence belong to the caller. */\nexport type JevReviewCheck = z.infer<typeof checkSchema>\nexport interface JevReviewInput<Q extends JevQuestions = JevQuestions> {\n version: string\n request: JevRequest<Q>\n checks: { [K in keyof Q]: JevReviewCheck }\n}\n\nexport interface PreparedJevReview<Q extends JevQuestions = JevQuestions>\n extends JevReviewInput<Q> {\n /** Binds questions, option order, context, evidence, thresholds and definition version. */\n digest: string\n}\n\nexport interface JevReviewAssessment {\n question: string\n status: 'supported' | 'refuted' | 'unresolved'\n reason:\n | 'support-threshold'\n | 'refutation-threshold'\n | 'missing-evidence'\n | 'partial-negative-evidence'\n | 'below-threshold'\n | 'ambiguous-thresholds'\n /** Unnormalized marginal mass of caller-designated native alternatives. Not calibrated risk. */\n supportProbability: number\n refutationProbability: number\n unresolvedProbability: number\n modelConfidence: number | null\n check: JevReviewCheck\n}\n\nexport interface JevReviewReport {\n reviewDigest: string\n requestedModel: string\n servedModel: string\n assessments: JevReviewAssessment[]\n}\n\nfunction alternatives(question: JevQuestions[string]): string[] {\n if (question.type === 'noul') return ['true', 'false']\n return question.type === 'choice'\n ? Object.keys(question.criteria)\n : question.criteria.map((_, index) => String(index))\n}\n\n/** Validate before paid admission; make a detached, frozen snapshot without rewriting native JSON. */\nexport function prepareJevReview<const Q extends JevQuestions>(\n input: JevReviewInput<Q>,\n): PreparedJevReview<Q> {\n if (!input.version?.trim()) throw new TypeError('Review version is required')\n parseJevRequest(input.request)\n // Document form drops only optional undefined object fields; canonicalization rejects loss.\n const document = jsonDocument(input)\n canonicalString(document)\n // Canonical bytes are for hashing, not dispatch: option order can affect a classifier.\n const snapshot = structuredClone(document) as JevReviewInput<Q>\n const keys = Object.keys(snapshot.request.questions)\n if (\n !snapshot.checks ||\n Object.keys(snapshot.checks).length !== keys.length ||\n keys.some((key) => !Object.hasOwn(snapshot.checks, key))\n ) {\n throw new TypeError('Review checks must match the exact question names')\n }\n for (const key of keys) {\n const check = checkSchema.parse(snapshot.checks[key])\n const labels = [...check.supports, ...check.refutes]\n const allowed = alternatives(snapshot.request.questions[key]!)\n if (\n new Set(labels).size !== labels.length ||\n labels.some((label) => !allowed.includes(label))\n ) {\n throw new TypeError('Review alternatives must exist and be disjoint')\n }\n if (check.coverage !== 'missing' && check.evidence.length === 0) {\n throw new TypeError('Review evidence references are required for non-missing coverage')\n }\n // Validation must not normalize a label into a different native option.\n if (canonicalString(jsonDocument(check)) !== canonicalString(snapshot.checks[key])) {\n throw new TypeError('Review metadata must not require normalization')\n }\n }\n const order = keys.map((key) => [key, alternatives(snapshot.request.questions[key]!)])\n return deepFreezeCanonicalJson({ ...snapshot, digest: hashCanonical({ snapshot, order }) })\n}\n\n/** Re-score the same retained distribution without new inference or any authorization effect. */\nexport function assessJevReview<Q extends JevQuestions>(\n review: PreparedJevReview<Q>,\n raw: unknown,\n): JevReviewReport {\n const { digest, ...input } = review\n const prepared = prepareJevReview(input)\n if (prepared.digest !== digest) throw new TypeError('Review definition changed after preparation')\n const result = parseJevResult(raw, prepared.request)\n const assessments = Object.entries(prepared.checks).map(([question, check]) => {\n const answer = result.answers[question]!\n const probabilities: Record<string, number> =\n answer.type === 'noul' ? { true: answer.noul, false: 1 - answer.noul } : answer.probabilities\n const sum = (labels: string[]) =>\n labels.reduce((total, label) => total + probabilities[label]!, 0)\n const supportProbability = sum(check.supports)\n const refutationProbability = sum(check.refutes)\n const used = new Set([...check.supports, ...check.refutes])\n const unresolvedProbability = sum(\n Object.keys(probabilities).filter((label) => !used.has(label)),\n )\n let status: JevReviewAssessment['status'] = 'unresolved'\n let reason: JevReviewAssessment['reason'] = 'below-threshold'\n if (supportProbability > 1 || refutationProbability > 1 || unresolvedProbability > 1) {\n throw new TypeError('Review probability mass exceeds one; do not silently normalize it')\n }\n if (check.coverage === 'missing') reason = 'missing-evidence'\n else if (\n supportProbability >= check.supportAtLeast &&\n refutationProbability >= check.refuteAtLeast\n ) {\n reason = 'ambiguous-thresholds'\n } else if (supportProbability >= check.supportAtLeast) {\n status = 'supported'\n reason = 'support-threshold'\n } else if (refutationProbability >= check.refuteAtLeast) {\n if (check.coverage === 'complete') {\n status = 'refuted'\n reason = 'refutation-threshold'\n } else reason = 'partial-negative-evidence'\n }\n return {\n question,\n status,\n reason,\n supportProbability,\n refutationProbability,\n unresolvedProbability,\n modelConfidence: answer.type === 'noul' ? null : answer.confidence,\n check: structuredClone(check),\n }\n })\n return {\n reviewDigest: digest,\n requestedModel: review.request.model,\n servedModel: result.model,\n assessments,\n }\n}\n\n/** Ordinary analyst findings; a negative review is not a global safety certificate. */\nexport function jevReviewFindings<Q extends JevQuestions>(\n review: PreparedJevReview<Q>,\n result: JevResult<Q>,\n options: { analystId: string; producedAt?: string },\n): AnalystFinding[] {\n if (!options.analystId.trim()) throw new TypeError('Analyst id is required')\n const report = assessJevReview(review, result)\n return report.assessments\n .filter((item) => item.status !== 'refuted')\n .map((item) =>\n makeFinding({\n analyst_id: options.analystId,\n ...(options.producedAt === undefined ? {} : { produced_at: options.producedAt }),\n subject: item.check.subject,\n area: item.status === 'unresolved' ? 'assessment-coverage' : item.check.area,\n severity: item.status === 'unresolved' ? 'info' : item.check.severity,\n claim:\n item.status === 'supported'\n ? `Model-supported hypothesis: ${item.check.claim}`\n : `Unresolved review: ${item.check.claim}`,\n evidence_refs: structuredClone(item.check.evidence) as EvidenceRef[],\n // For unresolved findings, confidence describes the deterministic unresolved status only.\n confidence: item.status === 'supported' ? item.supportProbability : 1,\n derived_from_judge: true,\n id_basis: hashCanonical([item.question, item.status, review.version, item.check.claim]),\n metadata: {\n review_digest: report.reviewDigest,\n question: item.question,\n requested_model: report.requestedModel,\n served_model: report.servedModel,\n assessment: item.status,\n assessment_reason: item.reason,\n evidence_coverage: item.check.coverage,\n support_probability: item.supportProbability,\n refutation_probability: item.refutationProbability,\n unresolved_probability: item.unresolvedProbability,\n model_confidence: item.modelConfidence,\n calibration: 'not-established',\n confidence_basis:\n item.status === 'supported' ? 'model-support-mass' : 'deterministic-status',\n native_answer: structuredClone(result.answers[item.question]),\n },\n }),\n )\n}\n","import type { Analyst, AnalystContext, AnalystFinding } from './analyst/types'\nimport type { JudgeConfig, JudgeScore, Scenario } from './campaign/types'\nimport type { CostReceiptInput, CustomTokenPricing } from './cost-ledger'\nimport type { EvaluationContext, EvaluationResult, EvaluatorOptions } from './evaluation'\nimport { asAnalyst, asJudge, createEvaluator } from './evaluation'\nimport type { JevQuestions, JevRequest, JevResult, JevState } from './jev-protocol'\nimport { jevUsage, parseJevRequest, parseJevResult } from './jev-protocol'\nimport { jsonDocument } from './ledger-core/canonical'\nimport { weightedComposite } from './statistics'\nimport { contentHash } from './verdict-cache'\n\nexport * from './evaluation'\nexport * from './jev-protocol'\nexport * from './jev-review'\n\nexport type JevEvaluate = EvaluatorOptions<JevRequest, unknown>['execute']\nexport interface JevEvaluatorOptions {\n evaluate: JevEvaluate\n costLedger?: EvaluatorOptions<JevRequest, unknown>['costLedger']\n maximumCharge?: EvaluatorOptions<JevRequest, unknown>['maximumCharge']\n pricing?: CustomTokenPricing\n receipt?: (response: unknown) => CostReceiptInput\n receiptFromError?: (error: Error) => CostReceiptInput | undefined\n /** Optional deployment policy; the protocol adapter does not hardcode model aliases. */\n acceptModel?: (requested: string, served: string) => boolean\n}\n\n/** Configure transport once; supply native state, questions, and model on every invocation. */\nexport function jevEvaluator(options: JevEvaluatorOptions) {\n const config = { ...options, pricing: options.pricing && { ...options.pricing } }\n const run = createEvaluator<JevRequest, unknown>({\n execute: (request, context) => config.evaluate(structuredClone(request), context),\n model: (request) => request.model,\n costLedger: config.costLedger,\n maximumCharge: config.maximumCharge,\n receiptFromError: config.receiptFromError,\n receipt:\n config.receipt ??\n ((raw) => {\n const usage = jevUsage(raw)\n const { model } = raw as JevResult\n return {\n model,\n inputTokens: usage.input_tokens,\n outputTokens: usage.output_tokens,\n customTokenPricing: config.pricing,\n }\n }),\n validate: (raw, request) => {\n const result = parseJevResult(raw, request)\n if (config.acceptModel && !config.acceptModel(request.model, result.model)) {\n throw new Error('Evaluation served a model rejected by the caller policy')\n }\n },\n })\n return async <const Q extends JevQuestions>(\n request: JevRequest<Q>,\n context?: EvaluationContext,\n ): Promise<EvaluationResult<JevResult<Q>>> => {\n context?.signal?.throwIfAborted()\n parseJevRequest(request)\n const snapshot = structuredClone(request)\n const result = await run(snapshot, context)\n // The validator checked these exact questions after recording the paid work.\n return { ...result, value: result.value as JevResult<Q> }\n }\n}\n\ntype Input<A, S extends Scenario> = { artifact: A; scenario: S }\ntype QuestionSource<I, Q extends JevQuestions> = Q | ((input: I) => Q | Promise<Q>)\nexport interface JevOptions extends JevEvaluatorOptions {\n model: string\n version: string\n questions: JevQuestions\n}\nexport interface JevJudgeOptions<\n A,\n S extends Scenario = Scenario,\n Q extends JevQuestions = JevQuestions,\n> extends JevEvaluatorOptions {\n model: string\n version: string\n questions: QuestionSource<Input<A, S>, Q>\n renderState: (input: Input<A, S>, context: EvaluationContext) => JevState | Promise<JevState>\n dimensions?: JudgeConfig<A, S>['dimensions']\n weights?: Record<string, number>\n map?: (value: JevResult<Q>, input: Input<A, S>) => JudgeScore | Promise<JudgeScore>\n record?: (result: EvaluationResult<JevResult<Q>>, input: Input<A, S>) => void | Promise<void>\n appliesTo?: (scenario: S) => boolean\n}\n\n/** Canonical identity also retains native question/alternative order; dispatch stays untouched. */\nfunction questionIdentity(questions: JevQuestions) {\n return {\n document: jsonDocument(questions),\n order: Object.entries(questions).map(([name, question]) => [\n name,\n question.type === 'choice' ? Object.keys(question.criteria) : null,\n ]),\n }\n}\n\nfunction validateWeights(weights: Record<string, number>, keys: string[]): void {\n if (\n Object.entries(weights).some(\n ([key, weight]) => !keys.includes(key) || !Number.isFinite(weight) || weight < 0,\n ) ||\n Object.values(weights).reduce((sum, weight) => sum + weight, 0) <= 0\n ) {\n throw new TypeError('Invalid judge weights')\n }\n}\n\n/** Optional convention. Choice utilities and non-uniform scales belong in an explicit map. */\nexport function normalizedJevScore(\n result: JevResult,\n weights?: Record<string, number>,\n): JudgeScore {\n const dimensions: Record<string, number> = Object.create(null)\n const distribution: NonNullable<JudgeScore['distribution']> = Object.create(null)\n for (const [key, answer] of Object.entries(result.answers)) {\n if (answer.type === 'choice') throw new TypeError('Choice scoring requires an explicit map')\n if (answer.type === 'noul') {\n dimensions[key] = answer.noul\n distribution[key] = [\n { score: 0, probability: 1 - answer.noul },\n { score: 1, probability: answer.noul },\n ]\n } else {\n const scale = Object.keys(answer.legend).length - 1\n dimensions[key] = answer.score / scale\n distribution[key] = Object.entries(answer.probabilities).map(([level, probability]) => ({\n score: Number(level) / scale,\n probability,\n }))\n }\n }\n const effective = weights ?? Object.fromEntries(Object.keys(dimensions).map((key) => [key, 1]))\n validateWeights(effective, Object.keys(dimensions))\n return {\n dimensions,\n composite: weightedComposite({ dims: dimensions, weights: effective }).composite,\n notes: '',\n scoringMethod: 'expectation',\n distribution,\n }\n}\n\n/** Convenience around the public evaluator. No domain questions, thresholds, or prose. */\nexport function jevJudge<A, S extends Scenario = Scenario, Q extends JevQuestions = JevQuestions>(\n name: string,\n options: JevJudgeOptions<A, S, Q>,\n): JudgeConfig<A, S> {\n const config = { ...options }\n const source =\n typeof options.questions === 'function' ? options.questions : structuredClone(options.questions)\n const weights = options.weights && { ...options.weights }\n if (!name.trim() || !options.version.trim()) {\n throw new TypeError('Judge name and version are required')\n }\n if ((typeof source === 'function' || config.map) && !config.dimensions) {\n throw new TypeError('Dynamic questions and custom mappings require stable judge dimensions')\n }\n if (!config.map && typeof source !== 'function') {\n parseJevRequest({ model: config.model, state: null, questions: source })\n if (Object.values(source).some((question) => question.type === 'choice')) {\n throw new TypeError(\n 'Choice scoring requires an explicit map; labels have no numeric ordering',\n )\n }\n if (weights) validateWeights(weights, Object.keys(source))\n }\n const dimensions =\n config.dimensions ??\n Object.entries(source).map(([key, question]) => ({\n key,\n description: typeof question.instructions === 'string' ? question.instructions : key,\n }))\n const evaluate = jevEvaluator(config)\n return asJudge<A, S, JevResult<Q>>({\n name,\n version: contentHash({\n model: config.model,\n version: config.version,\n questions: typeof source === 'function' ? 'dynamic' : questionIdentity(source),\n dimensions,\n // Hash the JSON document: optional undefined fields are absent on the wire.\n ...(weights ? { weights } : {}),\n }),\n dimensions,\n appliesTo: config.appliesTo,\n evaluate: async (input, context = {}) =>\n evaluate(\n {\n model: config.model,\n state: await config.renderState(input, context),\n questions: typeof source === 'function' ? await source(input) : source,\n },\n context,\n ),\n map: config.map ?? ((value) => normalizedJevScore(value, weights)),\n record: config.record,\n })\n}\n\nexport interface JevAnalystOptions<I, Q extends JevQuestions = JevQuestions>\n extends JevEvaluatorOptions {\n id: string\n description: string\n inputKind: Analyst<I>['inputKind']\n model: string\n version: string\n questions: Q | ((input: I, context: AnalystContext) => Q | Promise<Q>)\n renderState: (input: I, context: AnalystContext) => JevState | Promise<JevState>\n findings: (\n value: JevResult<Q>,\n input: I,\n context: AnalystContext,\n ) => AnalystFinding[] | Promise<AnalystFinding[]>\n record?: (\n result: EvaluationResult<JevResult<Q>>,\n input: I,\n context: AnalystContext,\n ) => void | Promise<void>\n}\n\nexport function jevAnalyst<I, Q extends JevQuestions = JevQuestions>(\n options: JevAnalystOptions<I, Q>,\n): Analyst<I> {\n const config = { ...options }\n const source =\n typeof options.questions === 'function' ? options.questions : structuredClone(options.questions)\n if (!config.id.trim() || !config.version.trim() || !config.description.trim()) {\n throw new TypeError('Analyst id, version, and description are required')\n }\n const evaluate = jevEvaluator(config)\n return asAnalyst<I, JevResult<Q>>({\n id: config.id,\n description: config.description,\n inputKind: config.inputKind,\n version: contentHash({\n model: config.model,\n version: config.version,\n questions: typeof source === 'function' ? 'dynamic' : questionIdentity(source),\n }),\n cost: { kind: 'llm', models: [config.model] },\n evaluate: async (input, context, analystContext) =>\n evaluate(\n {\n model: config.model,\n state: await config.renderState(input, analystContext),\n questions: typeof source === 'function' ? await source(input, analystContext) : source,\n },\n context,\n ),\n map: config.findings,\n record: config.record,\n })\n}\n"],"mappings":";;;;;;;;AAYA,MAAM,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AACpC,MAAM,cAAc,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,MAAM,cAAc,EACjB,OAAO;CACN,OAAO;CACP,MAAM;CACN,SAAS;CACT,UAAU,EAAE,KAAK,kBAAkB;;CAEnC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;CACnC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;CAClC,gBAAgB;CAChB,eAAe;;CAEf,UAAU,EAAE,KAAK;EAAC;EAAY;EAAW;CAAS,CAAC;CACnD,UAAU,EAAE,MACV,EACG,OAAO;EACN,MAAM,EAAE,KAAK;GAAC;GAAQ;GAAS;GAAY;GAAW;EAAQ,CAAC;EAC/D,KAAK;EACL,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,CAAC,C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a,MAAM,OAAO,KAAK,IAAI;EAClE,GACA,OACF;EACF,KAAK,OAAO,SAAS,UAAU,mBAAmB,OAAO,OAAO;EAChE,QAAQ,OAAO;CACjB,CAAC;AACH;AAuBA,SAAgB,WACd,SACY;CACZ,MAAM,SAAS,EAAE,GAAG,QAAQ;CAC5B,MAAM,SACJ,OAAO,QAAQ,cAAc,aAAa,QAAQ,YAAY,gBAAgB,QAAQ,SAAS;CACjG,IAAI,CAAC,OAAO,GAAG,KAAK,KAAK,CAAC,OAAO,QAAQ,KAAK,KAAK,CAAC,OAAO,YAAY,KAAK,GAC1E,MAAM,IAAI,UAAU,mDAAmD;CAEzE,MAAM,WAAW,aAAa,MAAM;CACpC,OAAO,UAA2B;EAChC,IAAI,OAAO;EACX,aAAa,OAAO;EACpB,WAAW,OAAO;EAClB,SAAS,YAAY;GACnB,OAAO,OAAO;GACd,SAAS,OAAO;GAChB,WAAW,OAAO,WAAW,aAAa,YAAY,iBAAiB,MAAM;EAC/E,CAAC;EACD,MAAM;GAAE,MAAM;GAAO,QAAQ,CAAC,OAAO,KAAK;EAAE;EAC5C,UAAU,OAAO,OAAO,SAAS,mBAC/B,SACE;GACE,OAAO,OAAO;GACd,OAAO,MAAM,OAAO,YAAY,OAAO,cAAc;GACrD,WAAW,OAAO,WAAW,aAAa,MAAM,OAAO,OAAO,cAAc,IAAI;EAClF,GACA,OACF;EACF,KAAK,OAAO;EACZ,QAAQ,OAAO;CACjB,CAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as hashCanonical, r as canonicalString, t as LEDGER_HASH_PATTERN } from "./canonical-
|
|
1
|
+
import { a as hashCanonical, r as canonicalString, t as LEDGER_HASH_PATTERN } from "./canonical-BsZVgBhW.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { closeSync, constants, existsSync, fstatSync, fsyncSync, linkSync, mkdirSync, openSync, readFileSync, readSync, renameSync, rmSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
@@ -860,4 +860,4 @@ function projectLedgerEntries(entries, codec) {
|
|
|
860
860
|
//#endregion
|
|
861
861
|
export { verifyEntriesAgainstTrustedHead as a, withLedgerFileLock as c, mapConcurrent as d, mapConcurrentRange as f, tryAcquireAtomicFileLock as h, trustedHeadPathFor as i, writeLedgerFileAtomically as l, probeAtomicFileLock as m, replayLedgerText as n, appendLedgerLine as o, AtomicFileLockError as p, readTrustedHeadFile as r, tryWithLedgerFileLock as s, FileLedgerJournal as t, Mutex as u };
|
|
862
862
|
|
|
863
|
-
//# sourceMappingURL=journal-
|
|
863
|
+
//# sourceMappingURL=journal-BuRLm6ho.js.map
|