@tangle-network/agent-eval 0.205.2 → 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.
Files changed (46) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/analyst/index.d.ts +1 -1
  3. package/dist/analyst/index.js +1 -1
  4. package/dist/{benchmark-command-DuDTN5ID.js → benchmark-command-DtP94cOB.js} +2 -2
  5. package/dist/{benchmark-command-DuDTN5ID.js.map → benchmark-command-DtP94cOB.js.map} +1 -1
  6. package/dist/cli.js +1 -1
  7. package/dist/meta-eval/index.d.ts +6 -0
  8. package/dist/meta-eval/index.d.ts.map +1 -1
  9. package/dist/meta-eval/index.js +15 -1
  10. package/dist/meta-eval/index.js.map +1 -1
  11. package/dist/openapi.json +1 -1
  12. package/dist/rl.d.ts +12 -12
  13. package/dist/rl.d.ts.map +1 -1
  14. package/dist/rl.js +17 -17
  15. package/dist/rl.js.map +1 -1
  16. package/dist/systemone-protocol-DKoi1NdK.d.ts +132 -0
  17. package/dist/systemone-protocol-DKoi1NdK.d.ts.map +1 -0
  18. package/dist/systemone-protocol.d.ts +2 -0
  19. package/dist/systemone-protocol.js +214 -0
  20. package/dist/systemone-protocol.js.map +1 -0
  21. package/dist/{jev-review-Cw06AKuF.d.ts → systemone-review-DGTKkLMG.d.ts} +16 -16
  22. package/dist/systemone-review-DGTKkLMG.d.ts.map +1 -0
  23. package/dist/{jev-review-DZEjDzlF.js → systemone-review-DTClwgmE.js} +11 -11
  24. package/dist/systemone-review-DTClwgmE.js.map +1 -0
  25. package/dist/systemone.d.ts +60 -0
  26. package/dist/systemone.d.ts.map +1 -0
  27. package/dist/{jev.js → systemone.js} +16 -16
  28. package/dist/systemone.js.map +1 -0
  29. package/docs/changes/jev-evidence-review.md +1 -1
  30. package/docs/changes/systemone-provider-neutral.md +36 -0
  31. package/docs/public-api.md +93 -68
  32. package/docs/{jev-behavior-review.md → systemone-behavior-review.md} +17 -17
  33. package/docs/{jev-integrations.md → systemone-integrations.md} +4 -4
  34. package/docs/{jev-replay.md → systemone-replay.md} +6 -6
  35. package/docs/{jev.md → systemone.md} +84 -33
  36. package/package.json +9 -9
  37. package/dist/jev-protocol-BQLxwbqD.d.ts +0 -99
  38. package/dist/jev-protocol-BQLxwbqD.d.ts.map +0 -1
  39. package/dist/jev-protocol.d.ts +0 -2
  40. package/dist/jev-protocol.js +0 -114
  41. package/dist/jev-protocol.js.map +0 -1
  42. package/dist/jev-review-Cw06AKuF.d.ts.map +0 -1
  43. package/dist/jev-review-DZEjDzlF.js.map +0 -1
  44. package/dist/jev.d.ts +0 -60
  45. package/dist/jev.d.ts.map +0 -1
  46. package/dist/jev.js.map +0 -1
@@ -0,0 +1,60 @@
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 { S as systemOneUsage, _ as parseSystemOneQuestions, a as SystemOneQuestion, b as parseSystemOneResult, c as SystemOneRecordedQuestions, d as SystemOneResponseError, f as SystemOneResult, g as normalizeSystemOneResult, h as SystemOneState, i as SystemOneJson, l as SystemOneRecordedRequest, m as SystemOneScoreCriteria, n as SystemOneAnswerFor, o as SystemOneQuestions, p as SystemOneResultProfile, r as SystemOneDescription, s as SystemOneRecordedQuestion, t as SystemOneAnswer, u as SystemOneRequest, v as parseSystemOneRecordedRequest, x as systemOneConfidence, y as parseSystemOneRequest } from "./systemone-protocol-DKoi1NdK.js";
6
+ import { a as SystemOneReviewReport, c as systemOneReviewFindings, i as SystemOneReviewInput, n as SystemOneReviewAssessment, o as assessSystemOneReview, r as SystemOneReviewCheck, s as prepareSystemOneReview, t as PreparedSystemOneReview } from "./systemone-review-DGTKkLMG.js";
7
+ //#region src/systemone.d.ts
8
+ export type SystemOneEvaluate = EvaluatorOptions<SystemOneRequest, unknown>['execute'];
9
+ export interface SystemOneEvaluatorOptions {
10
+ evaluate: SystemOneEvaluate;
11
+ costLedger?: EvaluatorOptions<SystemOneRequest, unknown>['costLedger'];
12
+ maximumCharge?: EvaluatorOptions<SystemOneRequest, 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 systemOneEvaluator(options: SystemOneEvaluatorOptions): <const Q extends SystemOneQuestions>(request: SystemOneRequest<Q>, context?: EvaluationContext) => Promise<EvaluationResult<SystemOneResult<Q>>>;
21
+ type Input<A, S extends Scenario> = {
22
+ artifact: A;
23
+ scenario: S;
24
+ };
25
+ type QuestionSource<I, Q extends SystemOneQuestions> = Q | ((input: I) => Q | Promise<Q>);
26
+ export interface SystemOneOptions extends SystemOneEvaluatorOptions {
27
+ model: string;
28
+ version: string;
29
+ questions: SystemOneQuestions;
30
+ }
31
+ export interface SystemOneJudgeOptions<A, S extends Scenario = Scenario, Q extends SystemOneQuestions = SystemOneQuestions> extends SystemOneEvaluatorOptions {
32
+ model: string;
33
+ version: string;
34
+ questions: QuestionSource<Input<A, S>, Q>;
35
+ renderState: (input: Input<A, S>, context: EvaluationContext) => SystemOneState | Promise<SystemOneState>;
36
+ dimensions?: JudgeConfig<A, S>['dimensions'];
37
+ weights?: Record<string, number>;
38
+ map?: (value: SystemOneResult<Q>, input: Input<A, S>) => JudgeScore | Promise<JudgeScore>;
39
+ record?: (result: EvaluationResult<SystemOneResult<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 normalizedSystemOneScore(result: SystemOneResult, weights?: Record<string, number>): JudgeScore;
44
+ /** Convenience around the public evaluator. No domain questions, thresholds, or prose. */
45
+ export declare function systemOneJudge<A, S extends Scenario = Scenario, Q extends SystemOneQuestions = SystemOneQuestions>(name: string, options: SystemOneJudgeOptions<A, S, Q>): JudgeConfig<A, S>;
46
+ export interface SystemOneAnalystOptions<I, Q extends SystemOneQuestions = SystemOneQuestions> extends SystemOneEvaluatorOptions {
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) => SystemOneState | Promise<SystemOneState>;
54
+ findings: (value: SystemOneResult<Q>, input: I, context: AnalystContext) => AnalystFinding[] | Promise<AnalystFinding[]>;
55
+ record?: (result: EvaluationResult<SystemOneResult<Q>>, input: I, context: AnalystContext) => void | Promise<void>;
56
+ }
57
+ export declare function systemOneAnalyst<I, Q extends SystemOneQuestions = SystemOneQuestions>(options: SystemOneAnalystOptions<I, Q>): Analyst<I>;
58
+ //#endregion
59
+ export { EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, Evaluator, EvaluatorOptions, PreparedSystemOneReview, SystemOneAnswer, SystemOneAnswerFor, SystemOneDescription, SystemOneJson, SystemOneQuestion, SystemOneQuestions, SystemOneRecordedQuestion, SystemOneRecordedQuestions, SystemOneRecordedRequest, SystemOneRequest, SystemOneResponseError, SystemOneResult, SystemOneResultProfile, SystemOneReviewAssessment, SystemOneReviewCheck, SystemOneReviewInput, SystemOneReviewReport, SystemOneScoreCriteria, SystemOneState, asAnalyst, asJudge, assessSystemOneReview, createEvaluator, normalizeSystemOneResult, parseSystemOneQuestions, parseSystemOneRecordedRequest, parseSystemOneRequest, parseSystemOneResult, prepareSystemOneReview, systemOneConfidence, systemOneReviewFindings, systemOneUsage };
60
+ //# sourceMappingURL=systemone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemone.d.ts","names":[],"sources":["../src/systemone.ts"],"mappings":";;;;;;;YAyBY,oBAAoB,iBAAiB;iBAChC;EACf,UAAU;EACV,aAAa,iBAAiB;EAC9B,gBAAgB,iBAAiB;EACjC,UAAU;EACV,WAAW,sBAAsB;EACjC,oBAAoB,OAAO,UAAU;;EAErC,eAAe,mBAAmB;;;wBAIpB,mBAAmB,SAAS,mCA2BtB,UAAU,oBAAkB,SACrC,iBAAiB,IAAE,UAClB,sBACT,QAAQ,iBAAiB,gBAAgB;KAUzC,MAAM,GAAG,UAAU;EAAc,UAAU;EAAG,UAAU;;KACxD,eAAe,GAAG,UAAU,sBAAsB,MAAM,OAAO,MAAM,IAAI,QAAQ;iBACrE,yBAAyB;EACxC;EACA;EACA,WAAW;;iBAEI,sBACf,GACA,UAAU,WAAW,UACrB,UAAU,qBAAqB,4BACvB;EACR;EACA;EACA,WAAW,eAAe,MAAM,GAAG,IAAI;EACvC,cACE,OAAO,MAAM,GAAG,IAChB,SAAS,sBACN,iBAAiB,QAAQ;EAC9B,aAAa,YAAY,GAAG;EAC5B,UAAU;EACV,OAAO,OAAO,gBAAgB,IAAI,OAAO,MAAM,GAAG,OAAO,aAAa,QAAQ;EAC9E,UACE,QAAQ,iBAAiB,gBAAgB,KACzC,OAAO,MAAM,GAAG,cACN;EACZ,aAAa,UAAU;;;wBA0BT,yBACd,QAAQ,iBACR,UAAU,yBACT;;wBAgCa,eACd,GACA,UAAU,WAAW,UACrB,UAAU,qBAAqB,oBAC/B,cAAc,SAAS,sBAAsB,GAAG,GAAG,KAAK,YAAY,GAAG;iBAqDxD,wBAAwB,GAAG,UAAU,qBAAqB,4BACjE;EACR;EACA;EACA,WAAW,QAAQ;EACnB;EACA;EACA,WAAW,MAAM,OAAO,GAAG,SAAS,mBAAmB,IAAI,QAAQ;EACnE,cAAc,OAAO,GAAG,SAAS,mBAAmB,iBAAiB,QAAQ;EAC7E,WACE,OAAO,gBAAgB,IACvB,OAAO,GACP,SAAS,mBACN,mBAAmB,QAAQ;EAChC,UACE,QAAQ,iBAAiB,gBAAgB,KACzC,OAAO,GACP,SAAS,0BACC;;wBAGE,iBAAiB,GAAG,UAAU,qBAAqB,oBACjE,SAAS,wBAAwB,GAAG,KACnC,QAAQ"}
@@ -2,11 +2,11 @@ import { o as jsonDocument } from "./canonical-BsZVgBhW.js";
2
2
  import { s as weightedComposite } from "./descriptive-CnU8Yq29.js";
3
3
  import { n as contentHash } from "./verdict-cache-BQEsVy9n.js";
4
4
  import { asAnalyst, asJudge, createEvaluator } from "./evaluation.js";
5
- import { JevResponseError, jevUsage, parseJevQuestions, parseJevRecordedRequest, parseJevRequest, parseJevResult } from "./jev-protocol.js";
6
- import { n as jevReviewFindings, r as prepareJevReview, t as assessJevReview } from "./jev-review-DZEjDzlF.js";
7
- //#region src/jev.ts
5
+ import { SystemOneResponseError, normalizeSystemOneResult, parseSystemOneQuestions, parseSystemOneRecordedRequest, parseSystemOneRequest, parseSystemOneResult, systemOneConfidence, systemOneUsage } from "./systemone-protocol.js";
6
+ import { n as prepareSystemOneReview, r as systemOneReviewFindings, t as assessSystemOneReview } from "./systemone-review-DTClwgmE.js";
7
+ //#region src/systemone.ts
8
8
  /** Configure transport once; supply native state, questions, and model on every invocation. */
9
- function jevEvaluator(options) {
9
+ function systemOneEvaluator(options) {
10
10
  const config = {
11
11
  ...options,
12
12
  pricing: options.pricing && { ...options.pricing }
@@ -18,7 +18,7 @@ function jevEvaluator(options) {
18
18
  maximumCharge: config.maximumCharge,
19
19
  receiptFromError: config.receiptFromError,
20
20
  receipt: config.receipt ?? ((raw) => {
21
- const usage = jevUsage(raw);
21
+ const usage = systemOneUsage(raw);
22
22
  const { model } = raw;
23
23
  return {
24
24
  model,
@@ -28,13 +28,13 @@ function jevEvaluator(options) {
28
28
  };
29
29
  }),
30
30
  validate: (raw, request) => {
31
- const result = parseJevResult(raw, request);
31
+ const result = parseSystemOneResult(raw, request);
32
32
  if (config.acceptModel && !config.acceptModel(request.model, result.model)) throw new Error("Evaluation served a model rejected by the caller policy");
33
33
  }
34
34
  });
35
35
  return async (request, context) => {
36
36
  context?.signal?.throwIfAborted();
37
- parseJevRequest(request);
37
+ parseSystemOneRequest(request);
38
38
  const snapshot = structuredClone(request);
39
39
  const result = await run(snapshot, context);
40
40
  return {
@@ -54,7 +54,7 @@ function validateWeights(weights, keys) {
54
54
  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");
55
55
  }
56
56
  /** Optional convention. Choice utilities and non-uniform scales belong in an explicit map. */
57
- function normalizedJevScore(result, weights) {
57
+ function normalizedSystemOneScore(result, weights) {
58
58
  const dimensions = Object.create(null);
59
59
  const distribution = Object.create(null);
60
60
  for (const [key, answer] of Object.entries(result.answers)) {
@@ -91,14 +91,14 @@ function normalizedJevScore(result, weights) {
91
91
  };
92
92
  }
93
93
  /** Convenience around the public evaluator. No domain questions, thresholds, or prose. */
94
- function jevJudge(name, options) {
94
+ function systemOneJudge(name, options) {
95
95
  const config = { ...options };
96
96
  const source = typeof options.questions === "function" ? options.questions : structuredClone(options.questions);
97
97
  const weights = options.weights && { ...options.weights };
98
98
  if (!name.trim() || !options.version.trim()) throw new TypeError("Judge name and version are required");
99
99
  if ((typeof source === "function" || config.map) && !config.dimensions) throw new TypeError("Dynamic questions and custom mappings require stable judge dimensions");
100
100
  if (!config.map && typeof source !== "function") {
101
- parseJevQuestions(source);
101
+ parseSystemOneQuestions(source);
102
102
  if (Object.values(source).some((question) => question.type === "choice")) throw new TypeError("Choice scoring requires an explicit map; labels have no numeric ordering");
103
103
  if (weights) validateWeights(weights, Object.keys(source));
104
104
  }
@@ -106,7 +106,7 @@ function jevJudge(name, options) {
106
106
  key,
107
107
  description: typeof question.instructions === "string" ? question.instructions : key
108
108
  }));
109
- const evaluate = jevEvaluator(config);
109
+ const evaluate = systemOneEvaluator(config);
110
110
  return asJudge({
111
111
  name,
112
112
  version: contentHash({
@@ -123,15 +123,15 @@ function jevJudge(name, options) {
123
123
  state: await config.renderState(input, context),
124
124
  questions: typeof source === "function" ? await source(input) : source
125
125
  }, context),
126
- map: config.map ?? ((value) => normalizedJevScore(value, weights)),
126
+ map: config.map ?? ((value) => normalizedSystemOneScore(value, weights)),
127
127
  record: config.record
128
128
  });
129
129
  }
130
- function jevAnalyst(options) {
130
+ function systemOneAnalyst(options) {
131
131
  const config = { ...options };
132
132
  const source = typeof options.questions === "function" ? options.questions : structuredClone(options.questions);
133
133
  if (!config.id.trim() || !config.version.trim() || !config.description.trim()) throw new TypeError("Analyst id, version, and description are required");
134
- const evaluate = jevEvaluator(config);
134
+ const evaluate = systemOneEvaluator(config);
135
135
  return asAnalyst({
136
136
  id: config.id,
137
137
  description: config.description,
@@ -155,6 +155,6 @@ function jevAnalyst(options) {
155
155
  });
156
156
  }
157
157
  //#endregion
158
- export { JevResponseError, asAnalyst, asJudge, assessJevReview, createEvaluator, jevAnalyst, jevEvaluator, jevJudge, jevReviewFindings, jevUsage, normalizedJevScore, parseJevQuestions, parseJevRecordedRequest, parseJevRequest, parseJevResult, prepareJevReview };
158
+ export { SystemOneResponseError, asAnalyst, asJudge, assessSystemOneReview, createEvaluator, normalizeSystemOneResult, normalizedSystemOneScore, parseSystemOneQuestions, parseSystemOneRecordedRequest, parseSystemOneRequest, parseSystemOneResult, prepareSystemOneReview, systemOneAnalyst, systemOneConfidence, systemOneEvaluator, systemOneJudge, systemOneReviewFindings, systemOneUsage };
159
159
 
160
- //# sourceMappingURL=jev.js.map
160
+ //# sourceMappingURL=systemone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemone.js","names":[],"sources":["../src/systemone.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 { jsonDocument } from './ledger-core/canonical'\nimport { weightedComposite } from './statistics'\nimport type {\n SystemOneQuestions,\n SystemOneRequest,\n SystemOneResult,\n SystemOneState,\n} from './systemone-protocol'\nimport {\n parseSystemOneQuestions,\n parseSystemOneRequest,\n parseSystemOneResult,\n systemOneUsage,\n} from './systemone-protocol'\nimport { contentHash } from './verdict-cache'\n\nexport * from './evaluation'\nexport * from './systemone-protocol'\nexport * from './systemone-review'\n\nexport type SystemOneEvaluate = EvaluatorOptions<SystemOneRequest, unknown>['execute']\nexport interface SystemOneEvaluatorOptions {\n evaluate: SystemOneEvaluate\n costLedger?: EvaluatorOptions<SystemOneRequest, unknown>['costLedger']\n maximumCharge?: EvaluatorOptions<SystemOneRequest, 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 systemOneEvaluator(options: SystemOneEvaluatorOptions) {\n const config = { ...options, pricing: options.pricing && { ...options.pricing } }\n const run = createEvaluator<SystemOneRequest, 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 = systemOneUsage(raw)\n const { model } = raw as SystemOneResult\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 = parseSystemOneResult(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 SystemOneQuestions>(\n request: SystemOneRequest<Q>,\n context?: EvaluationContext,\n ): Promise<EvaluationResult<SystemOneResult<Q>>> => {\n context?.signal?.throwIfAborted()\n parseSystemOneRequest(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 SystemOneResult<Q> }\n }\n}\n\ntype Input<A, S extends Scenario> = { artifact: A; scenario: S }\ntype QuestionSource<I, Q extends SystemOneQuestions> = Q | ((input: I) => Q | Promise<Q>)\nexport interface SystemOneOptions extends SystemOneEvaluatorOptions {\n model: string\n version: string\n questions: SystemOneQuestions\n}\nexport interface SystemOneJudgeOptions<\n A,\n S extends Scenario = Scenario,\n Q extends SystemOneQuestions = SystemOneQuestions,\n> extends SystemOneEvaluatorOptions {\n model: string\n version: string\n questions: QuestionSource<Input<A, S>, Q>\n renderState: (\n input: Input<A, S>,\n context: EvaluationContext,\n ) => SystemOneState | Promise<SystemOneState>\n dimensions?: JudgeConfig<A, S>['dimensions']\n weights?: Record<string, number>\n map?: (value: SystemOneResult<Q>, input: Input<A, S>) => JudgeScore | Promise<JudgeScore>\n record?: (\n result: EvaluationResult<SystemOneResult<Q>>,\n input: Input<A, S>,\n ) => 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: SystemOneQuestions) {\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 normalizedSystemOneScore(\n result: SystemOneResult,\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 systemOneJudge<\n A,\n S extends Scenario = Scenario,\n Q extends SystemOneQuestions = SystemOneQuestions,\n>(name: string, options: SystemOneJudgeOptions<A, S, Q>): 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 parseSystemOneQuestions(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 = systemOneEvaluator(config)\n return asJudge<A, S, SystemOneResult<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) => normalizedSystemOneScore(value, weights)),\n record: config.record,\n })\n}\n\nexport interface SystemOneAnalystOptions<I, Q extends SystemOneQuestions = SystemOneQuestions>\n extends SystemOneEvaluatorOptions {\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) => SystemOneState | Promise<SystemOneState>\n findings: (\n value: SystemOneResult<Q>,\n input: I,\n context: AnalystContext,\n ) => AnalystFinding[] | Promise<AnalystFinding[]>\n record?: (\n result: EvaluationResult<SystemOneResult<Q>>,\n input: I,\n context: AnalystContext,\n ) => void | Promise<void>\n}\n\nexport function systemOneAnalyst<I, Q extends SystemOneQuestions = SystemOneQuestions>(\n options: SystemOneAnalystOptions<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 = systemOneEvaluator(config)\n return asAnalyst<I, SystemOneResult<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":";;;;;;;;AAsCA,SAAgB,mBAAmB,SAAoC;CACrE,MAAM,SAAS;EAAE,GAAG;EAAS,SAAS,QAAQ,WAAW,EAAE,GAAG,QAAQ,QAAQ;CAAE;CAChF,MAAM,MAAM,gBAA2C;EACrD,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,eAAe,GAAG;GAChC,MAAM,EAAE,UAAU;GAClB,OAAO;IACL;IACA,aAAa,MAAM;IACnB,cAAc,MAAM;IACpB,oBAAoB,OAAO;GAC7B;EACF;EACF,WAAW,KAAK,YAAY;GAC1B,MAAM,SAAS,qBAAqB,KAAK,OAAO;GAChD,IAAI,OAAO,eAAe,CAAC,OAAO,YAAY,QAAQ,OAAO,OAAO,KAAK,GACvE,MAAM,IAAI,MAAM,yDAAyD;EAE7E;CACF,CAAC;CACD,OAAO,OACL,SACA,YACkD;EAClD,SAAS,QAAQ,eAAe;EAChC,sBAAsB,OAAO;EAC7B,MAAM,WAAW,gBAAgB,OAAO;EACxC,MAAM,SAAS,MAAM,IAAI,UAAU,OAAO;EAE1C,OAAO;GAAE,GAAG;GAAQ,OAAO,OAAO;EAA4B;CAChE;AACF;;AAgCA,SAAS,iBAAiB,WAA+B;CACvD,OAAO;EACL,UAAU,aAAa,SAAS;EAChC,OAAO,OAAO,QAAQ,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,cAAc,CACzD,MACA,SAAS,SAAS,WAAW,OAAO,KAAK,SAAS,QAAQ,IAAI,IAChE,CAAC;C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B,OAAO,OAAO;EACtE,QAAQ,OAAO;CACjB,CAAC;AACH;AAuBA,SAAgB,iBACd,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,mBAAmB,MAAM;CAC1C,OAAO,UAAiC;EACtC,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"}
@@ -9,7 +9,7 @@ The optional `examples/jev-behavior-review.ts` recipe covers reward gaming, eval
9
9
  policy/authorization/data-boundary breaches, injection-following, contradicted completion,
10
10
  oversight bypass, matched-baseline anomalies and cross-run behavior. It composes the existing
11
11
  `jevAnalyst`; the taxonomy is not installed in the generic evaluator and is not a calibrated
12
- safety detector. See [behavioral reviews](../jev-behavior-review.md) for evidence and limits.
12
+ safety detector. See [behavioral reviews](../systemone-behavior-review.md) for evidence and limits.
13
13
 
14
14
  No dependency, transport, scheduler, package entrypoint, default model, production action or
15
15
  spending policy changes. Existing evaluator, judge, analyst and protocol APIs remain unchanged.
@@ -0,0 +1,36 @@
1
+ # System One is provider-neutral
2
+
3
+ The Jev surface is renamed to System One, because the same typed decision protocol is now served by
4
+ TypeSafe (Jev), Cloudflare Workers AI (Clef, Clef-flash) and Perplexity (pplx-decider). The wire
5
+ format does not change, so recorded requests and answers stay readable. There are no aliases: each
6
+ consumer renames in the pull request that bumps its pin.
7
+
8
+ | Before | After |
9
+ | --- | --- |
10
+ | `@tangle-network/agent-eval/jev`, `/jev/protocol` | `/systemone`, `/systemone/protocol` |
11
+ | `Jev*` types (`JevRequest`, `JevResult`, `JevQuestions`, `JevRecordedRequest`, ...) | `SystemOne*` |
12
+ | `parseJev{Request,RecordedRequest,Questions,Result}`, `jevUsage` | `parseSystemOne*`, `systemOneUsage` |
13
+ | `JevResponseError` (message prefix `Jev:`) | `SystemOneResponseError` (prefix `System One:`) |
14
+ | `jevEvaluator`, `jevJudge`, `jevAnalyst`, `normalizedJevScore` | `systemOneEvaluator`, `systemOneJudge`, `systemOneAnalyst`, `normalizedSystemOneScore` |
15
+ | `prepareJevReview`, `assessJevReview`, `jevReviewFindings` | `prepareSystemOneReview`, `assessSystemOneReview`, `systemOneReviewFindings` |
16
+ | `claimIntegrityJev{Questions,Review}`, `jevSignal`, signal id `jev`, version prefix `claim-integrity-jev-` | `claimIntegritySystemOne*`, `systemOneSignal`, id `systemone`, prefix `claim-integrity-systemone-` |
17
+
18
+ Historical records keep their old signal ids and versions; a reader that filters on `jev` must also
19
+ accept `systemone`.
20
+
21
+ New in `/systemone/protocol`:
22
+
23
+ - `normalizeSystemOneResult(raw, request, profile)` removes a provider's declared rounding before
24
+ the strict parser and gives every provider the same `confidence`. The route owner supplies the
25
+ profile (`{ decimals?, confidence: canonical | provider-defined }`). Answers that already pass
26
+ the strict checks are unchanged.
27
+ - `systemOneConfidence(answer)` is that one definition, TypeSafe's published formulas.
28
+
29
+ New in `/meta-eval`: `brierScore(pairs)`. Equal-mass ECE and the reliability table already come from
30
+ `calibrationFromPairs(pairs, ..., { binning: equal-frequency, range: { lo: 0, hi: 1 } })`.
31
+
32
+ Without normalization the strict parser refuses a recorded TypeSafe score answer whose rounded score
33
+ is not the expectation of its rounded probabilities (8.79 against 8.86), so a transport that passes
34
+ TypeSafe bytes straight to `parseSystemOneResult` should normalize with `{ decimals: 2, confidence:
35
+ canonical }`. See [System One evaluations](../systemone.md#providers-rounding-and-confidence) for
36
+ the recorded provider profiles.