@tangle-network/agent-eval 0.205.1 → 0.206.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 +9 -0
- package/dist/analyst/index.d.ts +1 -1
- package/dist/analyst/index.js +1 -1
- package/dist/{benchmark-command-DuDTN5ID.js → benchmark-command-DtP94cOB.js} +2 -2
- package/dist/{benchmark-command-DuDTN5ID.js.map → benchmark-command-DtP94cOB.js.map} +1 -1
- package/dist/{claude-jsonl-DoQJBCVR.js → claude-jsonl-CG3JUbTJ.js} +8 -4
- package/dist/claude-jsonl-CG3JUbTJ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{index-BoVEyQwH.d.ts → index-CbBfavbT.d.ts} +5 -3
- package/dist/{index-BoVEyQwH.d.ts.map → index-CbBfavbT.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/meta-eval/index.d.ts +6 -0
- package/dist/meta-eval/index.d.ts.map +1 -1
- package/dist/meta-eval/index.js +15 -1
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/openapi.json +1 -1
- package/dist/rl.d.ts +12 -12
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +17 -17
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +2 -2
- package/dist/rollout/index.js +3 -3
- package/dist/{rollout-BdCoWV9n.js → rollout-l9w3Gdvh.js} +2 -2
- package/dist/{rollout-BdCoWV9n.js.map → rollout-l9w3Gdvh.js.map} +1 -1
- package/dist/supervisor-run/index.js +1 -1
- package/dist/systemone-protocol-DKoi1NdK.d.ts +132 -0
- package/dist/systemone-protocol-DKoi1NdK.d.ts.map +1 -0
- package/dist/systemone-protocol.d.ts +2 -0
- package/dist/systemone-protocol.js +214 -0
- package/dist/systemone-protocol.js.map +1 -0
- package/dist/{jev-review-Cw06AKuF.d.ts → systemone-review-DGTKkLMG.d.ts} +16 -16
- package/dist/systemone-review-DGTKkLMG.d.ts.map +1 -0
- package/dist/{jev-review-DZEjDzlF.js → systemone-review-DTClwgmE.js} +11 -11
- package/dist/systemone-review-DTClwgmE.js.map +1 -0
- package/dist/systemone.d.ts +60 -0
- package/dist/systemone.d.ts.map +1 -0
- package/dist/{jev.js → systemone.js} +16 -16
- package/dist/systemone.js.map +1 -0
- package/docs/changes/jev-evidence-review.md +1 -1
- package/docs/changes/systemone-provider-neutral.md +36 -0
- package/docs/public-api.md +93 -68
- package/docs/rollout.md +9 -1
- package/docs/{jev-behavior-review.md → systemone-behavior-review.md} +17 -17
- package/docs/{jev-integrations.md → systemone-integrations.md} +4 -4
- package/docs/{jev-replay.md → systemone-replay.md} +6 -6
- package/docs/{jev.md → systemone.md} +84 -33
- package/package.json +9 -9
- package/dist/claude-jsonl-DoQJBCVR.js.map +0 -1
- package/dist/jev-protocol-BQLxwbqD.d.ts +0 -99
- package/dist/jev-protocol-BQLxwbqD.d.ts.map +0 -1
- package/dist/jev-protocol.d.ts +0 -2
- package/dist/jev-protocol.js +0 -114
- package/dist/jev-protocol.js.map +0 -1
- package/dist/jev-review-Cw06AKuF.d.ts.map +0 -1
- package/dist/jev-review-DZEjDzlF.js.map +0 -1
- package/dist/jev.d.ts +0 -60
- package/dist/jev.d.ts.map +0 -1
- package/dist/jev.js.map +0 -1
package/dist/jev-protocol.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
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 textOrJson(value, name) {
|
|
15
|
-
if (typeof value === "string") return;
|
|
16
|
-
if (value === null || typeof value !== "object") throw new TypeError(`${name} must be text or a JSON object/array`);
|
|
17
|
-
canonicalString(value);
|
|
18
|
-
}
|
|
19
|
-
function optionalTextOrJson(value, name) {
|
|
20
|
-
if (value !== null) textOrJson(value, name);
|
|
21
|
-
}
|
|
22
|
-
/** Validate named questions without a state, as a judge does before it has input. */
|
|
23
|
-
function parseJevQuestions(raw) {
|
|
24
|
-
return readQuestions(raw, false);
|
|
25
|
-
}
|
|
26
|
-
function readQuestions(raw, recorded) {
|
|
27
|
-
const questions = object(raw);
|
|
28
|
-
if (!Object.keys(questions).length) throw new TypeError("At least one question is required");
|
|
29
|
-
for (const [name, rawQuestion] of Object.entries(questions)) {
|
|
30
|
-
const question = object(rawQuestion);
|
|
31
|
-
if (question.instructions !== void 0) optionalTextOrJson(question.instructions, `${name} instructions`);
|
|
32
|
-
if (question.type === "noul") {
|
|
33
|
-
if (question.criteria != null) {
|
|
34
|
-
const criteria = object(question.criteria);
|
|
35
|
-
if (Object.keys(criteria).some((key) => key !== "true" && key !== "false")) throw new TypeError("Noul criteria must describe true and/or false");
|
|
36
|
-
for (const value of Object.values(criteria)) if (value !== void 0) optionalTextOrJson(value, `${name} criteria`);
|
|
37
|
-
}
|
|
38
|
-
} else if (question.type === "score") {
|
|
39
|
-
if (!Array.isArray(question.criteria) || question.criteria.length < 2) throw new TypeError("Score criteria require at least two ordered entries");
|
|
40
|
-
for (const value of question.criteria) {
|
|
41
|
-
if (recorded && value === null) continue;
|
|
42
|
-
textOrJson(value, `${name} score level`);
|
|
43
|
-
}
|
|
44
|
-
} else if (question.type === "choice") {
|
|
45
|
-
const criteria = object(question.criteria);
|
|
46
|
-
if (!Object.keys(criteria).length) throw new TypeError("Choice criteria cannot be empty");
|
|
47
|
-
for (const value of Object.values(criteria)) optionalTextOrJson(value, `${name} choice`);
|
|
48
|
-
} else throw new TypeError("Unsupported native question type");
|
|
49
|
-
}
|
|
50
|
-
return raw;
|
|
51
|
-
}
|
|
52
|
-
function parseJevRequest(raw) {
|
|
53
|
-
return readRequest(raw, false);
|
|
54
|
-
}
|
|
55
|
-
/** Read immutable historical evidence without rewriting it or authorizing new inference.
|
|
56
|
-
* Live transports must still call parseJevRequest, even for re-execution of an old request. */
|
|
57
|
-
function parseJevRecordedRequest(raw) {
|
|
58
|
-
canonicalString(raw);
|
|
59
|
-
return readRequest(raw, true);
|
|
60
|
-
}
|
|
61
|
-
function readRequest(raw, recorded) {
|
|
62
|
-
const request = object(raw);
|
|
63
|
-
if (typeof request.model !== "string" || !request.model.trim()) throw new TypeError("Evaluation requires a model");
|
|
64
|
-
if (!recorded || request.state !== null) textOrJson(request.state, "Evaluation state");
|
|
65
|
-
readQuestions(request.questions, recorded);
|
|
66
|
-
return raw;
|
|
67
|
-
}
|
|
68
|
-
function jevUsage(raw) {
|
|
69
|
-
const usage = object(object(raw).usage);
|
|
70
|
-
for (const key of ["input_tokens", "output_tokens"]) if (!Number.isSafeInteger(usage[key]) || Number(usage[key]) < 0) throw new JevResponseError("Missing or invalid usage");
|
|
71
|
-
return usage;
|
|
72
|
-
}
|
|
73
|
-
function probability(value) {
|
|
74
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) throw new JevResponseError("Invalid probability");
|
|
75
|
-
return value;
|
|
76
|
-
}
|
|
77
|
-
function exactKeys(value, names) {
|
|
78
|
-
if (Object.keys(value).length !== names.length || names.some((key) => !Object.hasOwn(value, key))) throw new JevResponseError("Response keys differ from the request");
|
|
79
|
-
}
|
|
80
|
-
/** Validate native evidence, not model alias policy or the caller's scoring rules. */
|
|
81
|
-
function parseJevResult(raw, request) {
|
|
82
|
-
canonicalString(raw);
|
|
83
|
-
const response = object(raw);
|
|
84
|
-
if (typeof response.model !== "string" || !response.model.trim()) throw new JevResponseError("Missing served model");
|
|
85
|
-
const answers = object(response.answers);
|
|
86
|
-
exactKeys(answers, Object.keys(request.questions));
|
|
87
|
-
for (const [name, question] of Object.entries(request.questions)) {
|
|
88
|
-
const answer = object(answers[name]);
|
|
89
|
-
if (answer.type !== question.type) throw new JevResponseError("Wrong answer type");
|
|
90
|
-
if (question.type === "noul") {
|
|
91
|
-
probability(answer.noul);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
probability(answer.confidence);
|
|
95
|
-
const levels = question.type === "score" ? question.criteria.map((_, index) => String(index)) : Object.keys(question.criteria);
|
|
96
|
-
const probabilities = object(answer.probabilities);
|
|
97
|
-
exactKeys(probabilities, levels);
|
|
98
|
-
const sum = levels.reduce((total, level) => total + probability(probabilities[level]), 0);
|
|
99
|
-
if (Math.abs(sum - 1) > 1e-4) throw new JevResponseError("Invalid probability distribution");
|
|
100
|
-
if (question.type === "score") {
|
|
101
|
-
const legend = object(answer.legend);
|
|
102
|
-
exactKeys(legend, levels);
|
|
103
|
-
if (levels.some((level) => !isDeepStrictEqual(legend[level], question.criteria[Number(level)]))) throw new JevResponseError("Provider changed the rubric");
|
|
104
|
-
const expected = levels.reduce((total, level) => total + Number(level) * Number(probabilities[level]), 0);
|
|
105
|
-
if (typeof answer.score !== "number" || !Number.isFinite(answer.score) || Math.abs(answer.score - expected) > 1e-4) throw new JevResponseError("Score differs from its distribution");
|
|
106
|
-
} 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");
|
|
107
|
-
}
|
|
108
|
-
jevUsage(raw);
|
|
109
|
-
return raw;
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
export { JevResponseError, jevUsage, parseJevQuestions, parseJevRecordedRequest, parseJevRequest, parseJevResult };
|
|
113
|
-
|
|
114
|
-
//# sourceMappingURL=jev-protocol.js.map
|
package/dist/jev-protocol.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/**\n * Structural equivalents of TypeSafe's published request schema\n * (https://api.typesafe.ai/openapi.json); callers can use its builders unchanged.\n */\nexport type JevJson = string | number | boolean | null | JevJson[] | { [key: string]: JevJson }\n/** What TypeSafe accepts as `state` and as a score level: text or JSON, never null. */\nexport type JevState = string | { [key: string]: JevJson } | JevJson[]\n/** Instructions and choice or noul descriptions, which TypeSafe also accepts as null. */\nexport type JevDescription = JevState | null\nexport type JevScoreCriteria = readonly [JevState, JevState, ...JevState[]]\nexport type JevQuestion =\n | {\n type: 'noul'\n instructions?: JevDescription\n criteria?: { true?: JevDescription; false?: JevDescription } | null\n }\n | { type: 'score'; instructions?: JevDescription; criteria: JevScoreCriteria }\n | { type: 'choice'; instructions?: JevDescription; criteria: Record<string, JevDescription> }\nexport type JevQuestions = Record<string, JevQuestion>\nexport interface JevRequest<Q extends JevQuestions = JevQuestions> {\n model: string\n state: JevState\n questions: Q\n}\n\n/** Historical Tangle observations accepted null state and score levels. Not a live request. */\nexport type JevRecordedQuestion =\n | Exclude<JevQuestion, { type: 'score' }>\n | {\n type: 'score'\n instructions?: JevDescription\n criteria: readonly [JevDescription, JevDescription, ...JevDescription[]]\n }\nexport type JevRecordedQuestions = Record<string, JevRecordedQuestion>\nexport interface JevRecordedRequest<Q extends JevRecordedQuestions = JevRecordedQuestions> {\n model: string\n state: JevDescription\n questions: Q\n}\n\ntype ScoreKeys<T extends readonly JevDescription[]> = number extends T['length']\n ? number\n : Extract<keyof T, `${number}`>\nexport type JevAnswerFor<Q extends JevRecordedQuestion> = Q extends { type: 'noul' }\n ? { readonly type: 'noul'; readonly noul: number }\n : Q extends { type: 'score'; criteria: infer C extends readonly JevDescription[] }\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 JevRecordedQuestions = 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\n// TypeSafe answers 422 for a null state or score level. Refusing it here reports the\n// caller's mistake before a paid round trip, not as a provider failure after one.\nfunction textOrJson(value: unknown, name: string): void {\n if (typeof value === 'string') return\n if (value === null || typeof value !== 'object') {\n throw new TypeError(`${name} must be text or a JSON object/array`)\n }\n // Reuse the canonical JSON validator rather than accepting lossy Map/Date coercions.\n canonicalString(value)\n}\n\nfunction optionalTextOrJson(value: unknown, name: string): void {\n if (value !== null) textOrJson(value, name)\n}\n\n/** Validate named questions without a state, as a judge does before it has input. */\nexport function parseJevQuestions(raw: unknown): JevQuestions {\n return readQuestions(raw, false) as JevQuestions\n}\n\nfunction readQuestions(raw: unknown, recorded: boolean): JevRecordedQuestions {\n const questions = object(raw)\n if (!Object.keys(questions).length) throw new TypeError('At least one question is required')\n for (const [name, rawQuestion] of Object.entries(questions)) {\n const question = object(rawQuestion)\n if (question.instructions !== undefined) {\n optionalTextOrJson(question.instructions, `${name} instructions`)\n }\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) optionalTextOrJson(value, `${name} criteria`)\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) {\n if (recorded && value === null) continue\n textOrJson(value, `${name} score level`)\n }\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)) optionalTextOrJson(value, `${name} choice`)\n } else {\n throw new TypeError('Unsupported native question type')\n }\n }\n return raw as JevRecordedQuestions\n}\n\nexport function parseJevRequest(raw: unknown): JevRequest {\n return readRequest(raw, false) as JevRequest\n}\n\n/** Read immutable historical evidence without rewriting it or authorizing new inference.\n * Live transports must still call parseJevRequest, even for re-execution of an old request. */\nexport function parseJevRecordedRequest(raw: unknown): JevRecordedRequest {\n canonicalString(raw)\n return readRequest(raw, true)\n}\n\nfunction readRequest(raw: unknown, recorded: boolean): JevRecordedRequest {\n const request = object(raw)\n if (typeof request.model !== 'string' || !request.model.trim()) {\n throw new TypeError('Evaluation requires a model')\n }\n if (!recorded || request.state !== null) textOrJson(request.state, 'Evaluation state')\n readQuestions(request.questions, recorded)\n return raw as JevRecordedRequest\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 JevRecordedQuestions>(\n raw: unknown,\n request: JevRecordedRequest<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":";;;AAuEA,IAAa,mBAAb,cAAsC,MAAM;CAC1C,YAAY,SAAiB;EAC3B,MAAM,QAAQ,SAAS;EACvB,KAAK,OAAO;CACd;A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
1
|
-
{"version":3,"file":"jev-review-DZEjDzlF.js","names":[],"sources":["../src/jev-review.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"],"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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AQ;EAElD,YAAY,KAAK,WAAW,cAAc,KAAK,qBAAqB;EACpE,oBAAoB;EACpB,UAAU,cAAc;GAAC,KAAK;GAAU,KAAK;GAAQ,OAAO;GAAS,KAAK,MAAM;EAAK,CAAC;EACtF,UAAU;GACR,eAAe,OAAO;GACtB,UAAU,KAAK;GACf,iBAAiB,OAAO;GACxB,cAAc,OAAO;GACrB,YAAY,KAAK;GACjB,mBAAmB,KAAK;GACxB,mBAAmB,KAAK,MAAM;GAC9B,qBAAqB,KAAK;GAC1B,wBAAwB,KAAK;GAC7B,wBAAwB,KAAK;GAC7B,kBAAkB,KAAK;GACvB,aAAa;GACb,kBACE,KAAK,WAAW,cAAc,uBAAuB;GACvD,eAAe,gBAAgB,OAAO,QAAQ,KAAK,SAAS;EAC9D;CACF,CAAC,CACH;AACJ"}
|
package/dist/jev.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
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-6VEehmEg.js";
|
|
3
|
-
import { R as Scenario, S as JudgeConfig, w as JudgeScore } from "./types-ZUy5HGY5.js";
|
|
4
|
-
import { EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, Evaluator, EvaluatorOptions, asAnalyst, asJudge, createEvaluator } from "./evaluation.js";
|
|
5
|
-
import { _ as parseJevRecordedRequest, a as JevQuestion, c as JevRecordedQuestions, d as JevResponseError, f as JevResult, g as parseJevQuestions, h as jevUsage, i as JevJson, l as JevRecordedRequest, m as JevState, n as JevAnswerFor, o as JevQuestions, p as JevScoreCriteria, r as JevDescription, s as JevRecordedQuestion, t as JevAnswer, u as JevRequest, v as parseJevRequest, y as parseJevResult } from "./jev-protocol-BQLxwbqD.js";
|
|
6
|
-
import { a as PreparedJevReview, c as prepareJevReview, i as JevReviewReport, n as JevReviewCheck, o as assessJevReview, r as JevReviewInput, s as jevReviewFindings, t as JevReviewAssessment } from "./jev-review-Cw06AKuF.js";
|
|
7
|
-
//#region src/jev.d.ts
|
|
8
|
-
export type JevEvaluate = EvaluatorOptions<JevRequest, unknown>['execute'];
|
|
9
|
-
export interface JevEvaluatorOptions {
|
|
10
|
-
evaluate: JevEvaluate;
|
|
11
|
-
costLedger?: EvaluatorOptions<JevRequest, unknown>['costLedger'];
|
|
12
|
-
maximumCharge?: EvaluatorOptions<JevRequest, unknown>['maximumCharge'];
|
|
13
|
-
pricing?: CustomTokenPricing;
|
|
14
|
-
receipt?: (response: unknown) => CostReceiptInput;
|
|
15
|
-
receiptFromError?: (error: Error) => CostReceiptInput | undefined;
|
|
16
|
-
/** Optional deployment policy; the protocol adapter does not hardcode model aliases. */
|
|
17
|
-
acceptModel?: (requested: string, served: string) => boolean;
|
|
18
|
-
}
|
|
19
|
-
/** Configure transport once; supply native state, questions, and model on every invocation. */
|
|
20
|
-
export declare function jevEvaluator(options: JevEvaluatorOptions): <const Q extends JevQuestions>(request: JevRequest<Q>, context?: EvaluationContext) => Promise<EvaluationResult<JevResult<Q>>>;
|
|
21
|
-
type Input<A, S extends Scenario> = {
|
|
22
|
-
artifact: A;
|
|
23
|
-
scenario: S;
|
|
24
|
-
};
|
|
25
|
-
type QuestionSource<I, Q extends JevQuestions> = Q | ((input: I) => Q | Promise<Q>);
|
|
26
|
-
export interface JevOptions extends JevEvaluatorOptions {
|
|
27
|
-
model: string;
|
|
28
|
-
version: string;
|
|
29
|
-
questions: JevQuestions;
|
|
30
|
-
}
|
|
31
|
-
export interface JevJudgeOptions<A, S extends Scenario = Scenario, Q extends JevQuestions = JevQuestions> extends JevEvaluatorOptions {
|
|
32
|
-
model: string;
|
|
33
|
-
version: string;
|
|
34
|
-
questions: QuestionSource<Input<A, S>, Q>;
|
|
35
|
-
renderState: (input: Input<A, S>, context: EvaluationContext) => JevState | Promise<JevState>;
|
|
36
|
-
dimensions?: JudgeConfig<A, S>['dimensions'];
|
|
37
|
-
weights?: Record<string, number>;
|
|
38
|
-
map?: (value: JevResult<Q>, input: Input<A, S>) => JudgeScore | Promise<JudgeScore>;
|
|
39
|
-
record?: (result: EvaluationResult<JevResult<Q>>, input: Input<A, S>) => void | Promise<void>;
|
|
40
|
-
appliesTo?: (scenario: S) => boolean;
|
|
41
|
-
}
|
|
42
|
-
/** Optional convention. Choice utilities and non-uniform scales belong in an explicit map. */
|
|
43
|
-
export declare function normalizedJevScore(result: JevResult, weights?: Record<string, number>): JudgeScore;
|
|
44
|
-
/** Convenience around the public evaluator. No domain questions, thresholds, or prose. */
|
|
45
|
-
export declare function jevJudge<A, S extends Scenario = Scenario, Q extends JevQuestions = JevQuestions>(name: string, options: JevJudgeOptions<A, S, Q>): JudgeConfig<A, S>;
|
|
46
|
-
export interface JevAnalystOptions<I, Q extends JevQuestions = JevQuestions> extends JevEvaluatorOptions {
|
|
47
|
-
id: string;
|
|
48
|
-
description: string;
|
|
49
|
-
inputKind: Analyst<I>['inputKind'];
|
|
50
|
-
model: string;
|
|
51
|
-
version: string;
|
|
52
|
-
questions: Q | ((input: I, context: AnalystContext) => Q | Promise<Q>);
|
|
53
|
-
renderState: (input: I, context: AnalystContext) => JevState | Promise<JevState>;
|
|
54
|
-
findings: (value: JevResult<Q>, input: I, context: AnalystContext) => AnalystFinding[] | Promise<AnalystFinding[]>;
|
|
55
|
-
record?: (result: EvaluationResult<JevResult<Q>>, input: I, context: AnalystContext) => void | Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
export declare function jevAnalyst<I, Q extends JevQuestions = JevQuestions>(options: JevAnalystOptions<I, Q>): Analyst<I>;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, Evaluator, EvaluatorOptions, JevAnswer, JevAnswerFor, JevDescription, JevJson, JevQuestion, JevQuestions, JevRecordedQuestion, JevRecordedQuestions, JevRecordedRequest, JevRequest, JevResponseError, JevResult, JevReviewAssessment, JevReviewCheck, JevReviewInput, JevReviewReport, JevScoreCriteria, JevState, PreparedJevReview, asAnalyst, asJudge, assessJevReview, createEvaluator, jevReviewFindings, jevUsage, parseJevQuestions, parseJevRecordedRequest, parseJevRequest, parseJevResult, prepareJevReview };
|
|
60
|
-
//# sourceMappingURL=jev.d.ts.map
|
package/dist/jev.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jev.d.ts","names":[],"sources":["../src/jev.ts"],"mappings":";;;;;;;YAeY,cAAc,iBAAiB;iBAC1B;EACf,UAAU;EACV,aAAa,iBAAiB;EAC9B,gBAAgB,iBAAiB;EACjC,UAAU;EACV,WAAW,sBAAsB;EACjC,oBAAoB,OAAO,UAAU;;EAErC,eAAe,mBAAmB;;;wBAIpB,aAAa,SAAS,6BA2BhB,UAAU,cAAY,SAC/B,WAAW,IAAE,UACZ,sBACT,QAAQ,iBAAiB,UAAU;KAUnC,MAAM,GAAG,UAAU;EAAc,UAAU;EAAG,UAAU;;KACxD,eAAe,GAAG,UAAU,gBAAgB,MAAM,OAAO,MAAM,IAAI,QAAQ;iBAC/D,mBAAmB;EAClC;EACA;EACA,WAAW;;iBAEI,gBACf,GACA,UAAU,WAAW,UACrB,UAAU,eAAe,sBACjB;EACR;EACA;EACA,WAAW,eAAe,MAAM,GAAG,IAAI;EACvC,cAAc,OAAO,MAAM,GAAG,IAAI,SAAS,sBAAsB,WAAW,QAAQ;EACpF,aAAa,YAAY,GAAG;EAC5B,UAAU;EACV,OAAO,OAAO,UAAU,IAAI,OAAO,MAAM,GAAG,OAAO,aAAa,QAAQ;EACxE,UAAU,QAAQ,iBAAiB,UAAU,KAAK,OAAO,MAAM,GAAG,cAAc;EAChF,aAAa,UAAU;;;wBA0BT,mBACd,QAAQ,WACR,UAAU,yBACT;;wBAgCa,SAAS,GAAG,UAAU,WAAW,UAAU,UAAU,eAAe,cAClF,cACA,SAAS,gBAAgB,GAAG,GAAG,KAC9B,YAAY,GAAG;iBAqDD,kBAAkB,GAAG,UAAU,eAAe,sBACrD;EACR;EACA;EACA,WAAW,QAAQ;EACnB;EACA;EACA,WAAW,MAAM,OAAO,GAAG,SAAS,mBAAmB,IAAI,QAAQ;EACnE,cAAc,OAAO,GAAG,SAAS,mBAAmB,WAAW,QAAQ;EACvE,WACE,OAAO,UAAU,IACjB,OAAO,GACP,SAAS,mBACN,mBAAmB,QAAQ;EAChC,UACE,QAAQ,iBAAiB,UAAU,KACnC,OAAO,GACP,SAAS,0BACC;;wBAGE,WAAW,GAAG,UAAU,eAAe,cACrD,SAAS,kBAAkB,GAAG,KAC7B,QAAQ"}
|
package/dist/jev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jev.js","names":[],"sources":["../src/jev.ts"],"sourcesContent":["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, parseJevQuestions, 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 parseJevQuestions(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":";;;;;;;;AA4BA,SAAgB,aAAa,SAA8B;CACzD,MAAM,SAAS;EAAE,GAAG;EAAS,SAAS,QAAQ,WAAW,EAAE,GAAG,QAAQ,QAAQ;CAAE;CAChF,MAAM,MAAM,gBAAqC;EAC/C,UAAU,SAAS,YAAY,OAAO,SAAS,gBAAgB,OAAO,GAAG,OAAO;EAChF,QAAQ,YAAY,QAAQ;EAC5B,YAAY,OAAO;EACnB,eAAe,OAAO;EACtB,kBAAkB,OAAO;EACzB,SACE,OAAO,aACL,QAAQ;GACR,MAAM,QAAQ,SAAS,GAAG;GAC1B,MAAM,EAAE,UAAU;GAClB,OAAO;IACL;IACA,aAAa,MAAM;IACnB,cAAc,MAAM;IACpB,oBAAoB,OAAO;GAC7B;EACF;EACF,WAAW,KAAK,YAAY;GAC1B,MAAM,SAAS,eAAe,KAAK,OAAO;GAC1C,IAAI,OAAO,eAAe,CAAC,OAAO,YAAY,QAAQ,OAAO,OAAO,KAAK,GACvE,MAAM,IAAI,MAAM,yDAAyD;EAE7E;CACF,CAAC;CACD,OAAO,OACL,SACA,YAC4C;EAC5C,SAAS,QAAQ,eAAe;EAChC,gBAAgB,OAAO;EACvB,MAAM,WAAW,gBAAgB,OAAO;EACxC,MAAM,SAAS,MAAM,IAAI,UAAU,OAAO;EAE1C,OAAO;GAAE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