@tangle-network/agent-eval 0.109.1 → 0.110.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 (174) hide show
  1. package/dist/analyst/index.d.ts +10 -12
  2. package/dist/analyst/index.js +8 -11
  3. package/dist/analyst/index.js.map +1 -1
  4. package/dist/{analyze-runs-DJYpep3L.d.ts → analyze-runs-Dmz6LA9e.d.ts} +4 -4
  5. package/dist/{baseline-Bbid3WoO.d.ts → baseline-DsNteOgR.d.ts} +32 -2
  6. package/dist/belief-state/index.d.ts +6 -6
  7. package/dist/benchmarks/index.d.ts +4 -4
  8. package/dist/benchmarks/index.js +7 -8
  9. package/dist/builder-eval/index.d.ts +4 -4
  10. package/dist/builder-eval/index.js +1 -2
  11. package/dist/builder-eval/index.js.map +1 -1
  12. package/dist/{calibration-BPmzuVPk.d.ts → calibration-Dz8TQV4y.d.ts} +2 -2
  13. package/dist/campaign/index.d.ts +16 -19
  14. package/dist/campaign/index.js +7 -8
  15. package/dist/{chunk-LOJ2QVCE.js → chunk-2IY4ILP4.js} +2 -2
  16. package/dist/{chunk-LIEJUH2I.js → chunk-6PL5MGDL.js} +9 -9
  17. package/dist/{chunk-2OGPXHOB.js → chunk-7NX6ZSBG.js} +36 -7
  18. package/dist/chunk-7NX6ZSBG.js.map +1 -0
  19. package/dist/{chunk-OVPVM4JC.js → chunk-GTERJI6Q.js} +4 -4
  20. package/dist/{chunk-YEHAEDUD.js → chunk-IMWDSFUM.js} +604 -2
  21. package/dist/chunk-IMWDSFUM.js.map +1 -0
  22. package/dist/{chunk-JZXGWLK5.js → chunk-MHNQWM4I.js} +62 -6
  23. package/dist/chunk-MHNQWM4I.js.map +1 -0
  24. package/dist/{chunk-QRVS7MX4.js → chunk-OW47B5WA.js} +3 -5
  25. package/dist/{chunk-QRVS7MX4.js.map → chunk-OW47B5WA.js.map} +1 -1
  26. package/dist/{chunk-DBDRR6GF.js → chunk-PLOMR3HP.js} +48 -2
  27. package/dist/chunk-PLOMR3HP.js.map +1 -0
  28. package/dist/{chunk-GDZAWO2I.js → chunk-QFGTU7MT.js} +2 -2
  29. package/dist/{chunk-R6D7NEYJ.js → chunk-RNB2NICW.js} +11 -11
  30. package/dist/{chunk-V7HNA47Z.js → chunk-RSVSSZKF.js} +5 -5
  31. package/dist/{chunk-5PK3626Q.js → chunk-XRGOKCMO.js} +88 -17
  32. package/dist/chunk-XRGOKCMO.js.map +1 -0
  33. package/dist/{code-agent-session-rnJKlqmT.d.ts → code-agent-session-yitf9I-F.d.ts} +1 -1
  34. package/dist/contract/index.d.ts +20 -23
  35. package/dist/contract/index.js +11 -13
  36. package/dist/contract/index.js.map +1 -1
  37. package/dist/{control-B8UthSBL.d.ts → control-U8LBKUES.d.ts} +5 -6
  38. package/dist/control.d.ts +8 -9
  39. package/dist/control.js +6 -8
  40. package/dist/{dataset-DS7ytHZU.d.ts → dataset-NENEzRgk.d.ts} +1 -1
  41. package/dist/{default-registry-BswHCXnU.d.ts → default-registry-Bcf1uKVI.d.ts} +1 -2
  42. package/dist/{emitter-C2rqGH_l.d.ts → emitter-BRchAAAx.d.ts} +2 -2
  43. package/dist/{failure-cluster-DH9Flgcf.d.ts → failure-cluster-C48PiReX.d.ts} +2 -2
  44. package/dist/feedback-trajectory-pDcz1lQ1.d.ts +348 -0
  45. package/dist/{gepa-B3x5Ulcv.d.ts → gepa-BUNP3606.d.ts} +143 -2
  46. package/dist/hosted/index.d.ts +7 -7
  47. package/dist/{index-pPtfoIJO.d.ts → index-Dc3VLGhp.d.ts} +2 -2
  48. package/dist/index.d.ts +645 -61
  49. package/dist/index.js +1282 -190
  50. package/dist/index.js.map +1 -1
  51. package/dist/{insight-report-B4xrdwEK.d.ts → insight-report-D4cXFsLt.d.ts} +1 -1
  52. package/dist/{integrity-DqGZg3st.d.ts → integrity-qemeBAyx.d.ts} +1 -1
  53. package/dist/{types-D1ytG0Yg.d.ts → kind-factory-20hcaYpf.d.ts} +169 -2
  54. package/dist/meta-eval/index.d.ts +5 -5
  55. package/dist/meta-eval/index.js +1 -2
  56. package/dist/meta-eval/index.js.map +1 -1
  57. package/dist/{multi-layer-verifier-CI4jdX-q.d.ts → multi-layer-verifier-BsqKuLyN.d.ts} +1 -1
  58. package/dist/multishot/index.d.ts +3 -3
  59. package/dist/openapi.json +1 -1
  60. package/dist/pipelines/index.d.ts +6 -7
  61. package/dist/pipelines/index.js +3 -6
  62. package/dist/pipelines/index.js.map +1 -1
  63. package/dist/{policy-edit-DQUXYMDm.d.ts → policy-edit-D2bBDZDf.d.ts} +2 -2
  64. package/dist/{pre-registration-BUhVPzE7.d.ts → pre-registration-BepVVa6P.d.ts} +3 -3
  65. package/dist/{provenance-DdDhf6cg.d.ts → provenance-DMvsfknv.d.ts} +3 -5
  66. package/dist/{query-0aTmbmQe.d.ts → query-Ck190MOd.d.ts} +2 -2
  67. package/dist/{release-report-DeJpsBiA.d.ts → release-report-oBfOz8ku.d.ts} +3 -3
  68. package/dist/reporting.d.ts +8 -8
  69. package/dist/{researcher-Wc7dx6GM.d.ts → researcher-CaH0CwFC.d.ts} +6 -6
  70. package/dist/rl.d.ts +568 -15
  71. package/dist/rl.js +4 -4
  72. package/dist/{rubric-predictive-validity-DPnyG-CE.d.ts → rubric-predictive-validity-C-fMteAW.d.ts} +1 -1
  73. package/dist/{run-record-I-Z3JNvO.d.ts → run-record-DksGsfgv.d.ts} +1 -1
  74. package/dist/{runtime-trajectory-iW9IhV3e.d.ts → runtime-trajectory-h5i0SZUj.d.ts} +1 -1
  75. package/dist/{schema-m0gsnbt3.d.ts → schema-SGWcK9wa.d.ts} +1 -1
  76. package/dist/{semantic-concept-judge-BmNZPB_j.d.ts → semantic-concept-judge-D7z6JCLZ.d.ts} +57 -4
  77. package/dist/{store-BcFXE6LG.d.ts → store-BsVi7ncX.d.ts} +1 -1
  78. package/dist/storyboard/index.d.ts +1 -1
  79. package/dist/{summary-report-QMZVe3P-.d.ts → summary-report-Bz-0-t8v.d.ts} +2 -2
  80. package/dist/{test-graded-scenario-DeODGLra.d.ts → test-graded-scenario-mzYBKspu.d.ts} +3 -3
  81. package/dist/traces.d.ts +54 -11
  82. package/dist/traces.js +25 -27
  83. package/dist/{types-BdIv5dvA.d.ts → types-v--ctu-b.d.ts} +2 -2
  84. package/dist/wire/index.d.ts +5 -6
  85. package/package.json +1 -71
  86. package/dist/adapters/http.d.ts +0 -142
  87. package/dist/adapters/http.js +0 -203
  88. package/dist/adapters/http.js.map +0 -1
  89. package/dist/adapters/langchain.d.ts +0 -95
  90. package/dist/adapters/langchain.js +0 -34
  91. package/dist/adapters/langchain.js.map +0 -1
  92. package/dist/adapters/otel.d.ts +0 -112
  93. package/dist/adapters/otel.js +0 -110
  94. package/dist/adapters/otel.js.map +0 -1
  95. package/dist/chunk-2OGPXHOB.js.map +0 -1
  96. package/dist/chunk-45EEMHTC.js +0 -35
  97. package/dist/chunk-45EEMHTC.js.map +0 -1
  98. package/dist/chunk-5BKGXME7.js +0 -65
  99. package/dist/chunk-5BKGXME7.js.map +0 -1
  100. package/dist/chunk-5PK3626Q.js.map +0 -1
  101. package/dist/chunk-6SK5VFYK.js +0 -100
  102. package/dist/chunk-6SK5VFYK.js.map +0 -1
  103. package/dist/chunk-DBDRR6GF.js.map +0 -1
  104. package/dist/chunk-DJWX3GVS.js +0 -81
  105. package/dist/chunk-DJWX3GVS.js.map +0 -1
  106. package/dist/chunk-FOUG2VVS.js +0 -855
  107. package/dist/chunk-FOUG2VVS.js.map +0 -1
  108. package/dist/chunk-JZXGWLK5.js.map +0 -1
  109. package/dist/chunk-K7QEIHHJ.js +0 -613
  110. package/dist/chunk-K7QEIHHJ.js.map +0 -1
  111. package/dist/chunk-KKHDIONI.js +0 -414
  112. package/dist/chunk-KKHDIONI.js.map +0 -1
  113. package/dist/chunk-KMPRBJK4.js +0 -74
  114. package/dist/chunk-KMPRBJK4.js.map +0 -1
  115. package/dist/chunk-Q2JRAWRI.js +0 -196
  116. package/dist/chunk-Q2JRAWRI.js.map +0 -1
  117. package/dist/chunk-RZTMDUO7.js +0 -49
  118. package/dist/chunk-RZTMDUO7.js.map +0 -1
  119. package/dist/chunk-STGVSCDH.js +0 -202
  120. package/dist/chunk-STGVSCDH.js.map +0 -1
  121. package/dist/chunk-YEHAEDUD.js.map +0 -1
  122. package/dist/control-runtime-Acf9CGhw.d.ts +0 -182
  123. package/dist/corpus-eBVwhCp1.d.ts +0 -560
  124. package/dist/counterfactual-DlOz8PBx.d.ts +0 -85
  125. package/dist/diagnose.d.ts +0 -252
  126. package/dist/diagnose.js +0 -382
  127. package/dist/diagnose.js.map +0 -1
  128. package/dist/feedback-trajectory-C9KCo8ag.d.ts +0 -169
  129. package/dist/governance/index.d.ts +0 -135
  130. package/dist/governance/index.js +0 -18
  131. package/dist/governance/index.js.map +0 -1
  132. package/dist/groundedness/index.d.ts +0 -112
  133. package/dist/groundedness/index.js +0 -77
  134. package/dist/groundedness/index.js.map +0 -1
  135. package/dist/harness-optimizer-mOl9XX_O.d.ts +0 -106
  136. package/dist/kind-factory-DvIGo_cP.d.ts +0 -171
  137. package/dist/knowledge/index.d.ts +0 -103
  138. package/dist/knowledge/index.js +0 -18
  139. package/dist/knowledge/index.js.map +0 -1
  140. package/dist/pareto-E-pembql.d.ts +0 -81
  141. package/dist/perf/index.d.ts +0 -123
  142. package/dist/perf/index.js +0 -18
  143. package/dist/perf/index.js.map +0 -1
  144. package/dist/prm/index.d.ts +0 -104
  145. package/dist/prm/index.js +0 -265
  146. package/dist/prm/index.js.map +0 -1
  147. package/dist/product-benchmark/index.d.ts +0 -247
  148. package/dist/product-benchmark/index.js +0 -37
  149. package/dist/product-benchmark/index.js.map +0 -1
  150. package/dist/red-team-KmmiqBlY.d.ts +0 -63
  151. package/dist/redact-B40YG2M_.d.ts +0 -45
  152. package/dist/rubric-Cc6UHvUb.d.ts +0 -73
  153. package/dist/run-critic-CmMf05uV.d.ts +0 -56
  154. package/dist/sink-fetch-B1Yg4Til.d.ts +0 -101
  155. package/dist/telemetry/file.d.ts +0 -19
  156. package/dist/telemetry/file.js +0 -45
  157. package/dist/telemetry/file.js.map +0 -1
  158. package/dist/telemetry/index.d.ts +0 -38
  159. package/dist/telemetry/index.js +0 -130
  160. package/dist/telemetry/index.js.map +0 -1
  161. package/dist/testing-C21CHsq2.d.ts +0 -20
  162. package/dist/testing.d.ts +0 -1
  163. package/dist/testing.js +0 -8
  164. package/dist/testing.js.map +0 -1
  165. package/dist/trajectory-2TkpSEVh.d.ts +0 -33
  166. package/dist/workflow/index.d.ts +0 -496
  167. package/dist/workflow/index.js +0 -2178
  168. package/dist/workflow/index.js.map +0 -1
  169. /package/dist/{chunk-LOJ2QVCE.js.map → chunk-2IY4ILP4.js.map} +0 -0
  170. /package/dist/{chunk-LIEJUH2I.js.map → chunk-6PL5MGDL.js.map} +0 -0
  171. /package/dist/{chunk-OVPVM4JC.js.map → chunk-GTERJI6Q.js.map} +0 -0
  172. /package/dist/{chunk-GDZAWO2I.js.map → chunk-QFGTU7MT.js.map} +0 -0
  173. /package/dist/{chunk-R6D7NEYJ.js.map → chunk-RNB2NICW.js.map} +0 -0
  174. /package/dist/{chunk-V7HNA47Z.js.map → chunk-RSVSSZKF.js.map} +0 -0
@@ -1,104 +0,0 @@
1
- import { P as PrmGradedTrace, S as StepRubric, a as PrmGrader } from '../rubric-Cc6UHvUb.js';
2
- export { G as GradedStep, b as StepContext, i as isPrmVerdict } from '../rubric-Cc6UHvUb.js';
3
- import { T as TraceStore } from '../store-BcFXE6LG.js';
4
- import { S as Span } from '../schema-m0gsnbt3.js';
5
- import '../trajectory-2TkpSEVh.js';
6
-
7
- /**
8
- * Export PRM-graded traces as training data for downstream reward-model
9
- * fine-tuning. Canonical format is NDJSON of
10
- * `{ trajectory_text, step_index, rubric, score }` so a small model can
11
- * learn to predict step rewards from step context.
12
- *
13
- * The framework doesn't train the model — we emit the data; callers
14
- * plug it into their preferred trainer (TRL, Unsloth, custom).
15
- */
16
-
17
- interface PrmTrainingSample {
18
- runId: string;
19
- spanId: string;
20
- rubricId: string;
21
- score: number;
22
- /** Serialized step context — step + surrounding conversation. */
23
- context: {
24
- priorTurns: Array<{
25
- role: string;
26
- content: string;
27
- }>;
28
- step: {
29
- kind: Span['kind'];
30
- text: string;
31
- };
32
- };
33
- /** Optional evidence + rationale for auditability. */
34
- rationale?: string;
35
- evidence?: string;
36
- }
37
- declare function exportTrainingData(store: TraceStore, graded: PrmGradedTrace[], options?: {
38
- contextWindow?: number;
39
- }): Promise<PrmTrainingSample[]>;
40
- /** NDJSON serialization — write to file or stream directly to a trainer. */
41
- declare function toNdjson(samples: PrmTrainingSample[]): string;
42
-
43
- /**
44
- * Built-in reference rubrics. Consumers combine these with domain
45
- * rubrics. All are deterministic, rule-based — cheap to run + easy
46
- * to unit-test. LLM-based rubrics are trivially authored by
47
- * following the StepRubric contract.
48
- */
49
-
50
- /** Penalize very short or very long assistant outputs. */
51
- declare function outputLengthRubric(args?: {
52
- minChars?: number;
53
- maxChars?: number;
54
- weight?: number;
55
- }): StepRubric;
56
- /** Reward tool calls that succeeded (status='ok') with an informative result. */
57
- declare function toolSuccessRubric(args?: {
58
- weight?: number;
59
- }): StepRubric;
60
- /** Penalize tool calls that duplicate a prior call with identical args. */
61
- declare function toolNonRedundantRubric(args?: {
62
- weight?: number;
63
- }): StepRubric;
64
- /** Penalize LLM outputs that contain common refusal markers when a refusal
65
- * is NOT expected (caller inverts weight for scenarios where refusal IS expected). */
66
- declare function nonRefusalRubric(args?: {
67
- markers?: RegExp[];
68
- weight?: number;
69
- }): StepRubric;
70
- /** Reward outputs that invoke the next-step tool the trajectory actually uses
71
- * (i.e. the LLM span announced "I will call X" and the following tool span IS X). */
72
- declare function toolIntentAlignmentRubric(args?: {
73
- weight?: number;
74
- }): StepRubric;
75
-
76
- /**
77
- * Inference-time PRM scoring — pick the best of N candidate trajectories
78
- * using a trained reward model (or a rule-based PRM as a proxy).
79
- *
80
- * The canonical Best-of-N pattern: generate N completions, score each
81
- * with a PRM, pick the winner. Here the scoring loop is framework-agnostic
82
- * — supply a TraceStore + PrmGrader + N run IDs → get ranking + winner.
83
- */
84
-
85
- interface BestOfNResult {
86
- winner: PrmGradedTrace;
87
- ranked: PrmGradedTrace[];
88
- /** Standard deviation of aggregate scores — small = candidates were homogenous. */
89
- stdDev: number;
90
- }
91
- interface PrmBestOfNOptions {
92
- /** Max concurrent `grader.grade` calls. Default 4. */
93
- concurrency?: number;
94
- }
95
- declare function prmBestOfN(store: TraceStore, grader: PrmGrader, runIds: string[], options?: PrmBestOfNOptions): Promise<BestOfNResult>;
96
- /**
97
- * Weighted vote across multiple graders — use when you want a PRM ensemble
98
- * (e.g. rule-based + LLM-based + trained model). Each grader produces its
99
- * own ranking; we aggregate via rank-sum (Borda count) so no single grader
100
- * dominates via a different score scale.
101
- */
102
- declare function prmEnsembleBestOfN(store: TraceStore, graders: PrmGrader[], runIds: string[], options?: PrmBestOfNOptions): Promise<BestOfNResult>;
103
-
104
- export { type BestOfNResult, type PrmBestOfNOptions, PrmGradedTrace, PrmGrader, type PrmTrainingSample, StepRubric, exportTrainingData, nonRefusalRubric, outputLengthRubric, prmBestOfN, prmEnsembleBestOfN, toNdjson, toolIntentAlignmentRubric, toolNonRedundantRubric, toolSuccessRubric };
package/dist/prm/index.js DELETED
@@ -1,265 +0,0 @@
1
- import {
2
- exportTrainingData,
3
- toNdjson
4
- } from "../chunk-KMPRBJK4.js";
5
- import {
6
- buildTrajectory
7
- } from "../chunk-RZTMDUO7.js";
8
- import "../chunk-5BKGXME7.js";
9
- import {
10
- TraceEmitter
11
- } from "../chunk-TVVP3ZZQ.js";
12
- import "../chunk-PZ5AY32C.js";
13
-
14
- // src/prm/builtin-rubrics.ts
15
- function outputLengthRubric(args = {}) {
16
- const min = args.minChars ?? 20;
17
- const max = args.maxChars ?? 8e3;
18
- return {
19
- id: "output-length",
20
- kinds: ["llm"],
21
- weight: args.weight ?? 0.5,
22
- async grade({ step }) {
23
- const llm = step.span;
24
- const len = (llm.output ?? "").length;
25
- if (len === 0) return { score: 0, rationale: "empty output" };
26
- if (len < min)
27
- return { score: Math.max(0, len / min), rationale: `below min (${len} < ${min})` };
28
- if (len > max)
29
- return {
30
- score: Math.max(0, 1 - (len - max) / max),
31
- rationale: `above max (${len} > ${max})`
32
- };
33
- return { score: 1, rationale: `${len} chars in bounds` };
34
- }
35
- };
36
- }
37
- function toolSuccessRubric(args = {}) {
38
- return {
39
- id: "tool-success",
40
- kinds: ["tool"],
41
- weight: args.weight ?? 1,
42
- async grade({ step }) {
43
- const tool = step.span;
44
- if (tool.status === "error")
45
- return { score: 0, rationale: `error: ${tool.error ?? "unknown"}` };
46
- const r = tool.result;
47
- if (r === null || r === void 0) return { score: 0.3, rationale: "empty result" };
48
- const asText = typeof r === "string" ? r : JSON.stringify(r);
49
- if (asText.length < 4) return { score: 0.5, rationale: "tiny result" };
50
- return { score: 1, rationale: `${tool.toolName} ok` };
51
- }
52
- };
53
- }
54
- function toolNonRedundantRubric(args = {}) {
55
- const weight = args.weight ?? 0.5;
56
- return {
57
- id: "tool-non-redundant",
58
- kinds: ["tool"],
59
- weight,
60
- async grade({ step, prior }) {
61
- const tool = step.span;
62
- const priorMatches = prior.filter((p) => {
63
- if (p.span.kind !== "tool") return false;
64
- const pt = p.span;
65
- return pt.toolName === tool.toolName && stableStringify(pt.args) === stableStringify(tool.args);
66
- });
67
- if (priorMatches.length === 0) return { score: 1, rationale: "novel call" };
68
- return {
69
- score: Math.max(0, 1 - priorMatches.length * 0.5),
70
- rationale: `${priorMatches.length} duplicate(s)`
71
- };
72
- }
73
- };
74
- }
75
- function nonRefusalRubric(args = {}) {
76
- const weight = args.weight ?? 1;
77
- const markers = args.markers ?? [
78
- /\bi\s+(?:can(?:not|'t)|won't|will\s+not)\b/i,
79
- /\b(?:as\s+an?\s+)?ai\b.*?\b(?:can't|cannot)\b/i
80
- ];
81
- return {
82
- id: "non-refusal",
83
- kinds: ["llm"],
84
- weight,
85
- async grade({ step }) {
86
- const llm = step.span;
87
- const out = llm.output ?? "";
88
- const refused = markers.some((re) => re.test(out));
89
- return refused ? { score: 0, rationale: "refusal marker present" } : { score: 1, rationale: "no refusal" };
90
- }
91
- };
92
- }
93
- function toolIntentAlignmentRubric(args = {}) {
94
- return {
95
- id: "tool-intent-alignment",
96
- kinds: ["llm"],
97
- weight: args.weight ?? 0.5,
98
- async grade({ step, next }) {
99
- const llm = step.span;
100
- const nextTool = next.find((s) => s.span.kind === "tool");
101
- if (!nextTool) return null;
102
- const toolName = nextTool.span.toolName;
103
- const out = (llm.output ?? "").toLowerCase();
104
- const mentioned = out.includes(toolName.toLowerCase());
105
- return mentioned ? { score: 1, rationale: `mentioned "${toolName}" before calling it` } : { score: 0.5, rationale: `called "${toolName}" without announcing it` };
106
- }
107
- };
108
- }
109
- function stableStringify(value) {
110
- if (value === null || typeof value !== "object") return JSON.stringify(value);
111
- if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
112
- const keys = Object.keys(value).sort();
113
- return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify(value[k])}`).join(",")}}`;
114
- }
115
-
116
- // src/prm/inference.ts
117
- var DEFAULT_PRM_CONCURRENCY = 4;
118
- async function prmBestOfN(store, grader, runIds, options = {}) {
119
- if (runIds.length === 0) throw new Error("prmBestOfN: at least 1 candidate required");
120
- const concurrency = Math.max(1, options.concurrency ?? DEFAULT_PRM_CONCURRENCY);
121
- const graded = new Array(runIds.length);
122
- let cursor = 0;
123
- async function worker() {
124
- while (true) {
125
- const i = cursor++;
126
- if (i >= runIds.length) return;
127
- graded[i] = await grader.grade(store, runIds[i]);
128
- }
129
- }
130
- await Promise.all(Array.from({ length: Math.min(concurrency, runIds.length) }, () => worker()));
131
- const ranked = [...graded].sort((a, b) => b.aggregateScore - a.aggregateScore);
132
- const mean = graded.reduce((a, g) => a + g.aggregateScore, 0) / graded.length;
133
- const variance = graded.reduce((a, g) => a + (g.aggregateScore - mean) ** 2, 0) / graded.length;
134
- return { winner: ranked[0], ranked, stdDev: Math.sqrt(variance) };
135
- }
136
- async function prmEnsembleBestOfN(store, graders, runIds, options = {}) {
137
- if (graders.length === 0) throw new Error("prmEnsembleBestOfN: at least 1 grader");
138
- if (runIds.length === 0) throw new Error("prmEnsembleBestOfN: at least 1 candidate required");
139
- const concurrency = Math.max(1, options.concurrency ?? DEFAULT_PRM_CONCURRENCY);
140
- const jobs = [];
141
- for (let gi = 0; gi < graders.length; gi++) {
142
- for (const runId of runIds) jobs.push({ graderIdx: gi, runId });
143
- }
144
- const settled = new Array(jobs.length);
145
- let cursor = 0;
146
- async function worker() {
147
- while (true) {
148
- const i = cursor++;
149
- if (i >= jobs.length) return;
150
- const job = jobs[i];
151
- settled[i] = await graders[job.graderIdx].grade(store, job.runId).then((value) => ({ status: "fulfilled", value })).catch((reason) => ({ status: "rejected", reason }));
152
- }
153
- }
154
- await Promise.all(Array.from({ length: Math.min(concurrency, jobs.length) }, () => worker()));
155
- const perGrader = graders.map(() => []);
156
- const failures = [];
157
- for (let i = 0; i < jobs.length; i++) {
158
- const job = jobs[i];
159
- const result = settled[i];
160
- if (result.status === "fulfilled") perGrader[job.graderIdx].push(result.value);
161
- else {
162
- const error = result.reason instanceof Error ? result.reason.message : String(result.reason);
163
- failures.push({ graderIdx: job.graderIdx, runId: job.runId, error });
164
- }
165
- }
166
- const survivingGraders = perGrader.filter((ranking) => ranking.length > 0);
167
- if (survivingGraders.length === 0) {
168
- throw new Error(
169
- `prmEnsembleBestOfN: every grader failed on every candidate (${failures.length} call(s)). First error: ${failures[0]?.error ?? "unknown"}`
170
- );
171
- }
172
- for (const ranking of survivingGraders)
173
- ranking.sort((a, b) => b.aggregateScore - a.aggregateScore);
174
- const bordaScores = /* @__PURE__ */ new Map();
175
- for (const ranking of survivingGraders) {
176
- ranking.forEach((g, rank) => {
177
- bordaScores.set(g.runId, (bordaScores.get(g.runId) ?? 0) + (ranking.length - rank));
178
- });
179
- }
180
- const byRun = /* @__PURE__ */ new Map();
181
- for (const ranking of survivingGraders) {
182
- for (const g of ranking) if (!byRun.has(g.runId)) byRun.set(g.runId, g);
183
- }
184
- const ranked = [...byRun.values()].sort(
185
- (a, b) => (bordaScores.get(b.runId) ?? 0) - (bordaScores.get(a.runId) ?? 0)
186
- );
187
- const mean = ranked.reduce((a, g) => a + g.aggregateScore, 0) / ranked.length;
188
- const variance = ranked.reduce((a, g) => a + (g.aggregateScore - mean) ** 2, 0) / ranked.length;
189
- return { winner: ranked[0], ranked, stdDev: Math.sqrt(variance) };
190
- }
191
-
192
- // src/prm/rubric.ts
193
- var PrmGrader = class {
194
- constructor(rubrics) {
195
- this.rubrics = rubrics;
196
- if (rubrics.length === 0) throw new Error("PrmGrader: at least 1 rubric required");
197
- }
198
- rubrics;
199
- /**
200
- * Grade every eligible span in a run. Emits a JudgeVerdict span for each
201
- * (rubric × span) verdict so the result is visible to downstream pipelines
202
- * (judgeAgreementView, etc.) — PRM is just "a judge that runs per span."
203
- */
204
- async grade(store, runId) {
205
- const trajectory = await buildTrajectory(store, runId);
206
- const emitter = new TraceEmitter(store, { runId });
207
- const steps = [];
208
- let ungraded = 0;
209
- for (let i = 0; i < trajectory.steps.length; i++) {
210
- const step = trajectory.steps[i];
211
- const ctx = {
212
- trajectory,
213
- step,
214
- prior: trajectory.steps.slice(0, i),
215
- next: trajectory.steps.slice(i + 1)
216
- };
217
- let gradedThis = false;
218
- for (const rubric of this.rubrics) {
219
- if (rubric.kinds && !rubric.kinds.includes(step.span.kind)) continue;
220
- const verdict = await rubric.grade(ctx);
221
- if (verdict === null) continue;
222
- const weight = rubric.weight ?? 1;
223
- steps.push({
224
- spanId: step.span.spanId,
225
- rubricId: rubric.id,
226
- score: verdict.score,
227
- weight,
228
- rationale: verdict.rationale,
229
- evidence: verdict.evidence
230
- });
231
- gradedThis = true;
232
- await emitter.recordJudge({
233
- judgeId: `prm:${rubric.id}`,
234
- targetSpanId: step.span.spanId,
235
- dimension: "step_quality",
236
- score: verdict.score,
237
- rationale: verdict.rationale,
238
- evidence: verdict.evidence,
239
- name: `prm:${rubric.id}`
240
- });
241
- }
242
- if (!gradedThis) ungraded++;
243
- }
244
- const totalWeight = steps.reduce((a, s) => a + s.weight, 0);
245
- const aggregateScore = totalWeight === 0 ? 0 : steps.reduce((a, s) => a + s.score * s.weight, 0) / totalWeight;
246
- return { runId, steps, aggregateScore, gradedCount: steps.length, ungradedCount: ungraded };
247
- }
248
- };
249
- function isPrmVerdict(verdict) {
250
- return verdict.judgeId.startsWith("prm:");
251
- }
252
- export {
253
- PrmGrader,
254
- exportTrainingData,
255
- isPrmVerdict,
256
- nonRefusalRubric,
257
- outputLengthRubric,
258
- prmBestOfN,
259
- prmEnsembleBestOfN,
260
- toNdjson,
261
- toolIntentAlignmentRubric,
262
- toolNonRedundantRubric,
263
- toolSuccessRubric
264
- };
265
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/prm/builtin-rubrics.ts","../../src/prm/inference.ts","../../src/prm/rubric.ts"],"sourcesContent":["/**\n * Built-in reference rubrics. Consumers combine these with domain\n * rubrics. All are deterministic, rule-based — cheap to run + easy\n * to unit-test. LLM-based rubrics are trivially authored by\n * following the StepRubric contract.\n */\n\nimport type { LlmSpan, ToolSpan } from '../trace/schema'\nimport type { StepRubric } from './rubric'\n\n/** Penalize very short or very long assistant outputs. */\nexport function outputLengthRubric(\n args: { minChars?: number; maxChars?: number; weight?: number } = {},\n): StepRubric {\n const min = args.minChars ?? 20\n const max = args.maxChars ?? 8000\n return {\n id: 'output-length',\n kinds: ['llm'],\n weight: args.weight ?? 0.5,\n async grade({ step }) {\n const llm = step.span as LlmSpan\n const len = (llm.output ?? '').length\n if (len === 0) return { score: 0, rationale: 'empty output' }\n if (len < min)\n return { score: Math.max(0, len / min), rationale: `below min (${len} < ${min})` }\n if (len > max)\n return {\n score: Math.max(0, 1 - (len - max) / max),\n rationale: `above max (${len} > ${max})`,\n }\n return { score: 1, rationale: `${len} chars in bounds` }\n },\n }\n}\n\n/** Reward tool calls that succeeded (status='ok') with an informative result. */\nexport function toolSuccessRubric(args: { weight?: number } = {}): StepRubric {\n return {\n id: 'tool-success',\n kinds: ['tool'],\n weight: args.weight ?? 1,\n async grade({ step }) {\n const tool = step.span as ToolSpan\n if (tool.status === 'error')\n return { score: 0, rationale: `error: ${tool.error ?? 'unknown'}` }\n const r = tool.result\n if (r === null || r === undefined) return { score: 0.3, rationale: 'empty result' }\n const asText = typeof r === 'string' ? r : JSON.stringify(r)\n if (asText.length < 4) return { score: 0.5, rationale: 'tiny result' }\n return { score: 1, rationale: `${tool.toolName} ok` }\n },\n }\n}\n\n/** Penalize tool calls that duplicate a prior call with identical args. */\nexport function toolNonRedundantRubric(args: { weight?: number } = {}): StepRubric {\n const weight = args.weight ?? 0.5\n return {\n id: 'tool-non-redundant',\n kinds: ['tool'],\n weight,\n async grade({ step, prior }) {\n const tool = step.span as ToolSpan\n const priorMatches = prior.filter((p) => {\n if (p.span.kind !== 'tool') return false\n const pt = p.span as ToolSpan\n return (\n pt.toolName === tool.toolName && stableStringify(pt.args) === stableStringify(tool.args)\n )\n })\n if (priorMatches.length === 0) return { score: 1, rationale: 'novel call' }\n return {\n score: Math.max(0, 1 - priorMatches.length * 0.5),\n rationale: `${priorMatches.length} duplicate(s)`,\n }\n },\n }\n}\n\n/** Penalize LLM outputs that contain common refusal markers when a refusal\n * is NOT expected (caller inverts weight for scenarios where refusal IS expected). */\nexport function nonRefusalRubric(args: { markers?: RegExp[]; weight?: number } = {}): StepRubric {\n const weight = args.weight ?? 1\n const markers = args.markers ?? [\n /\\bi\\s+(?:can(?:not|'t)|won't|will\\s+not)\\b/i,\n /\\b(?:as\\s+an?\\s+)?ai\\b.*?\\b(?:can't|cannot)\\b/i,\n ]\n return {\n id: 'non-refusal',\n kinds: ['llm'],\n weight,\n async grade({ step }) {\n const llm = step.span as LlmSpan\n const out = llm.output ?? ''\n const refused = markers.some((re) => re.test(out))\n return refused\n ? { score: 0, rationale: 'refusal marker present' }\n : { score: 1, rationale: 'no refusal' }\n },\n }\n}\n\n/** Reward outputs that invoke the next-step tool the trajectory actually uses\n * (i.e. the LLM span announced \"I will call X\" and the following tool span IS X). */\nexport function toolIntentAlignmentRubric(args: { weight?: number } = {}): StepRubric {\n return {\n id: 'tool-intent-alignment',\n kinds: ['llm'],\n weight: args.weight ?? 0.5,\n async grade({ step, next }) {\n const llm = step.span as LlmSpan\n const nextTool = next.find((s) => s.span.kind === 'tool')\n if (!nextTool) return null\n const toolName = (nextTool.span as ToolSpan).toolName\n const out = (llm.output ?? '').toLowerCase()\n const mentioned = out.includes(toolName.toLowerCase())\n return mentioned\n ? { score: 1, rationale: `mentioned \"${toolName}\" before calling it` }\n : { score: 0.5, rationale: `called \"${toolName}\" without announcing it` }\n },\n }\n}\n\nfunction stableStringify(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value)\n if (Array.isArray(value)) return `[${value.map(stableStringify).join(',')}]`\n const keys = Object.keys(value as Record<string, unknown>).sort()\n return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify((value as Record<string, unknown>)[k])}`).join(',')}}`\n}\n","/**\n * Inference-time PRM scoring — pick the best of N candidate trajectories\n * using a trained reward model (or a rule-based PRM as a proxy).\n *\n * The canonical Best-of-N pattern: generate N completions, score each\n * with a PRM, pick the winner. Here the scoring loop is framework-agnostic\n * — supply a TraceStore + PrmGrader + N run IDs → get ranking + winner.\n */\n\nimport type { TraceStore } from '../trace/store'\nimport type { PrmGradedTrace, PrmGrader } from './rubric'\n\nexport interface BestOfNResult {\n winner: PrmGradedTrace\n ranked: PrmGradedTrace[]\n /** Standard deviation of aggregate scores — small = candidates were homogenous. */\n stdDev: number\n}\n\n/** Default max concurrent grader calls. Bounds LLM fan-out so a wide ensemble\n * doesn't trigger a provider rate-limit storm. */\nconst DEFAULT_PRM_CONCURRENCY = 4\n\nexport interface PrmBestOfNOptions {\n /** Max concurrent `grader.grade` calls. Default 4. */\n concurrency?: number\n}\n\nexport async function prmBestOfN(\n store: TraceStore,\n grader: PrmGrader,\n runIds: string[],\n options: PrmBestOfNOptions = {},\n): Promise<BestOfNResult> {\n if (runIds.length === 0) throw new Error('prmBestOfN: at least 1 candidate required')\n const concurrency = Math.max(1, options.concurrency ?? DEFAULT_PRM_CONCURRENCY)\n const graded: PrmGradedTrace[] = new Array(runIds.length)\n let cursor = 0\n async function worker(): Promise<void> {\n while (true) {\n const i = cursor++\n if (i >= runIds.length) return\n graded[i] = await grader.grade(store, runIds[i]!)\n }\n }\n await Promise.all(Array.from({ length: Math.min(concurrency, runIds.length) }, () => worker()))\n const ranked = [...graded].sort((a, b) => b.aggregateScore - a.aggregateScore)\n const mean = graded.reduce((a, g) => a + g.aggregateScore, 0) / graded.length\n const variance = graded.reduce((a, g) => a + (g.aggregateScore - mean) ** 2, 0) / graded.length\n return { winner: ranked[0]!, ranked, stdDev: Math.sqrt(variance) }\n}\n\n/**\n * Weighted vote across multiple graders — use when you want a PRM ensemble\n * (e.g. rule-based + LLM-based + trained model). Each grader produces its\n * own ranking; we aggregate via rank-sum (Borda count) so no single grader\n * dominates via a different score scale.\n */\nexport async function prmEnsembleBestOfN(\n store: TraceStore,\n graders: PrmGrader[],\n runIds: string[],\n options: PrmBestOfNOptions = {},\n): Promise<BestOfNResult> {\n if (graders.length === 0) throw new Error('prmEnsembleBestOfN: at least 1 grader')\n if (runIds.length === 0) throw new Error('prmEnsembleBestOfN: at least 1 candidate required')\n const concurrency = Math.max(1, options.concurrency ?? DEFAULT_PRM_CONCURRENCY)\n\n // Flatten the (grader, runId) product and run it through a single bounded\n // pool. Nested unbounded fan-out (graders × runIds) would launch every LLM\n // call at once. allSettled isolates failures: one grader (or one runId)\n // failing doesn't void the whole ensemble.\n type Job = { graderIdx: number; runId: string }\n const jobs: Job[] = []\n for (let gi = 0; gi < graders.length; gi++) {\n for (const runId of runIds) jobs.push({ graderIdx: gi, runId })\n }\n const settled: PromiseSettledResult<PrmGradedTrace>[] = new Array(jobs.length)\n let cursor = 0\n async function worker(): Promise<void> {\n while (true) {\n const i = cursor++\n if (i >= jobs.length) return\n const job = jobs[i]!\n settled[i] = await graders[job.graderIdx]!.grade(store, job.runId)\n .then((value): PromiseSettledResult<PrmGradedTrace> => ({ status: 'fulfilled', value }))\n .catch((reason): PromiseSettledResult<PrmGradedTrace> => ({ status: 'rejected', reason }))\n }\n }\n await Promise.all(Array.from({ length: Math.min(concurrency, jobs.length) }, () => worker()))\n\n // Regroup fulfilled results into per-grader rankings. A grader contributes\n // only the candidates it successfully graded; a grader that graded nothing\n // is dropped from the vote rather than skewing it with phantom zeros.\n const perGrader: PrmGradedTrace[][] = graders.map(() => [])\n const failures: { graderIdx: number; runId: string; error: string }[] = []\n for (let i = 0; i < jobs.length; i++) {\n const job = jobs[i]!\n const result = settled[i]!\n if (result.status === 'fulfilled') perGrader[job.graderIdx]!.push(result.value)\n else {\n const error = result.reason instanceof Error ? result.reason.message : String(result.reason)\n failures.push({ graderIdx: job.graderIdx, runId: job.runId, error })\n }\n }\n const survivingGraders = perGrader.filter((ranking) => ranking.length > 0)\n if (survivingGraders.length === 0) {\n throw new Error(\n `prmEnsembleBestOfN: every grader failed on every candidate (${failures.length} call(s)). First error: ${failures[0]?.error ?? 'unknown'}`,\n )\n }\n for (const ranking of survivingGraders)\n ranking.sort((a, b) => b.aggregateScore - a.aggregateScore)\n\n // Borda: rank-sum across surviving graders.\n const bordaScores = new Map<string, number>()\n for (const ranking of survivingGraders) {\n ranking.forEach((g, rank) => {\n bordaScores.set(g.runId, (bordaScores.get(g.runId) ?? 0) + (ranking.length - rank))\n })\n }\n // Synthesize a ranking from the union of every successfully-graded trace,\n // ordered by Borda score. aggregateScore field kept for UX. Using the union\n // (not just the first grader) keeps a candidate that one grader dropped but\n // another graded.\n const byRun = new Map<string, PrmGradedTrace>()\n for (const ranking of survivingGraders) {\n for (const g of ranking) if (!byRun.has(g.runId)) byRun.set(g.runId, g)\n }\n const ranked = [...byRun.values()].sort(\n (a, b) => (bordaScores.get(b.runId) ?? 0) - (bordaScores.get(a.runId) ?? 0),\n )\n const mean = ranked.reduce((a, g) => a + g.aggregateScore, 0) / ranked.length\n const variance = ranked.reduce((a, g) => a + (g.aggregateScore - mean) ** 2, 0) / ranked.length\n return { winner: ranked[0]!, ranked, stdDev: Math.sqrt(variance) }\n}\n","/**\n * Process Reward Modeling — per-step rubric grading.\n *\n * A StepRubric inspects one span and returns a score + rationale.\n * PrmGrader applies an array of rubrics to every LLM span in a\n * trajectory (consumers can broaden to tool/retrieval spans via the\n * `kind` filter on each rubric).\n *\n * Why this matters: outcome-only eval (did the final artifact work?)\n * gives sparse reward — most agent turns are unattributable. PRMs\n * densify the signal so optimizers and RL fine-tuning can assign\n * credit per turn.\n */\n\nimport { TraceEmitter } from '../trace/emitter'\nimport type { JudgeSpan, Span } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\nimport { buildTrajectory, type Trajectory, type TrajectoryStep } from '../trajectory'\n\nexport interface StepContext {\n trajectory: Trajectory\n step: TrajectoryStep\n /** Steps preceding `step` in trajectory order. */\n prior: TrajectoryStep[]\n /** Steps following `step`. */\n next: TrajectoryStep[]\n}\n\nexport interface StepRubric {\n id: string\n /** Only grade spans of these kinds (default: all). */\n kinds?: Array<Span['kind']>\n /** Weight in the aggregate score. Default 1. */\n weight?: number\n /** Returns score in 0..1 + optional rationale/evidence. Return `null` to\n * skip grading (rubric doesn't apply to this step). */\n grade: (\n ctx: StepContext,\n ) => Promise<{ score: number; rationale?: string; evidence?: string } | null>\n}\n\nexport interface GradedStep {\n spanId: string\n rubricId: string\n score: number\n weight: number\n rationale?: string\n evidence?: string\n}\n\nexport interface PrmGradedTrace {\n runId: string\n steps: GradedStep[]\n /** Weighted mean of all graded steps; 0..1. */\n aggregateScore: number\n /** Number of spans graded — useful for sanity-checking coverage. */\n gradedCount: number\n /** Number of spans in the trajectory that no rubric matched. */\n ungradedCount: number\n}\n\nexport class PrmGrader {\n constructor(private rubrics: StepRubric[]) {\n if (rubrics.length === 0) throw new Error('PrmGrader: at least 1 rubric required')\n }\n\n /**\n * Grade every eligible span in a run. Emits a JudgeVerdict span for each\n * (rubric × span) verdict so the result is visible to downstream pipelines\n * (judgeAgreementView, etc.) — PRM is just \"a judge that runs per span.\"\n */\n async grade(store: TraceStore, runId: string): Promise<PrmGradedTrace> {\n const trajectory = await buildTrajectory(store, runId)\n const emitter = new TraceEmitter(store, { runId })\n const steps: GradedStep[] = []\n let ungraded = 0\n for (let i = 0; i < trajectory.steps.length; i++) {\n const step = trajectory.steps[i]!\n const ctx: StepContext = {\n trajectory,\n step,\n prior: trajectory.steps.slice(0, i),\n next: trajectory.steps.slice(i + 1),\n }\n let gradedThis = false\n for (const rubric of this.rubrics) {\n if (rubric.kinds && !rubric.kinds.includes(step.span.kind)) continue\n const verdict = await rubric.grade(ctx)\n if (verdict === null) continue\n const weight = rubric.weight ?? 1\n steps.push({\n spanId: step.span.spanId,\n rubricId: rubric.id,\n score: verdict.score,\n weight,\n rationale: verdict.rationale,\n evidence: verdict.evidence,\n })\n gradedThis = true\n // Persist the verdict as a JudgeSpan so the query pipelines see it\n await emitter.recordJudge({\n judgeId: `prm:${rubric.id}`,\n targetSpanId: step.span.spanId,\n dimension: 'step_quality',\n score: verdict.score,\n rationale: verdict.rationale,\n evidence: verdict.evidence,\n name: `prm:${rubric.id}`,\n })\n }\n if (!gradedThis) ungraded++\n }\n\n const totalWeight = steps.reduce((a, s) => a + s.weight, 0)\n const aggregateScore =\n totalWeight === 0 ? 0 : steps.reduce((a, s) => a + s.score * s.weight, 0) / totalWeight\n\n return { runId, steps, aggregateScore, gradedCount: steps.length, ungradedCount: ungraded }\n }\n}\n\n/** Helper: reads JudgeVerdict spans that PRM emitted so downstream pipelines\n * can distinguish PRM verdicts from human or top-level LLM judges. */\nexport function isPrmVerdict(verdict: JudgeSpan): boolean {\n return verdict.judgeId.startsWith('prm:')\n}\n"],"mappings":";;;;;;;;;;;;;;AAWO,SAAS,mB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AM,SAAS,KAAK,KAAK,IAAI,EAAG;AAC5D,cAAM,UAAU,MAAM,OAAO,MAAM,GAAG;AACtC,YAAI,YAAY,KAAM;AACtB,cAAM,SAAS,OAAO,UAAU;AAChC,cAAM,KAAK;AAAA,UACT,QAAQ,KAAK,KAAK;AAAA,UAClB,UAAU,OAAO;AAAA,UACjB,OAAO,QAAQ;AAAA,UACf;AAAA,UACA,WAAW,QAAQ;AAAA,UACnB,UAAU,QAAQ;AAAA,QACpB,CAAC;AACD,qBAAa;AAEb,cAAM,QAAQ,YAAY;AAAA,UACxB,SAAS,OAAO,OAAO,EAAE;AAAA,UACzB,cAAc,KAAK,KAAK;AAAA,UACxB,WAAW;AAAA,UACX,OAAO,QAAQ;AAAA,UACf,WAAW,QAAQ;AAAA,UACnB,UAAU,QAAQ;AAAA,UAClB,MAAM,OAAO,OAAO,EAAE;AAAA,QACxB,CAAC;AAAA,MACH;AACA,UAAI,CAAC,WAAY;AAAA,IACnB;AAEA,UAAM,cAAc,MAAM,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,QAAQ,CAAC;AAC1D,UAAM,iBACJ,gBAAgB,IAAI,IAAI,MAAM,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI;AAE9E,WAAO,EAAE,OAAO,OAAO,gBAAgB,aAAa,MAAM,QAAQ,eAAe,SAAS;AAAA,EAC5F;AACF;AAIO,SAAS,aAAa,SAA6B;AACxD,SAAO,QAAQ,QAAQ,WAAW,MAAM;AAC1C;","names":[]}
@@ -1,247 +0,0 @@
1
- import { R as RunRecord } from '../run-record-I-Z3JNvO.js';
2
- import '@tangle-network/agent-interface';
3
- import '../errors-oeQrLqXC.js';
4
- import '../schema-m0gsnbt3.js';
5
-
6
- /**
7
- * Export side of the product benchmark bundle contract: convert product
8
- * eval run directories (`records.jsonl` of `RunRecord` rows + trace/raw
9
- * artifacts) into a portable `product-benchmark-manifest.json` +
10
- * `product-benchmark-records.jsonl` bundle that
11
- * `validateProductBenchmarkRun` accepts.
12
- *
13
- * Product-specific policy (safety-split detection, tool-call recovery,
14
- * profile id fallback, artifact materialization) enters through explicit
15
- * options; everything else is the shared union of the tax/legal/creative
16
- * exporters. Scenario catalogs, smoke runners, and CLIs stay in the
17
- * products.
18
- *
19
- * Input rows are checked structurally, not with `validateRunRecord`:
20
- * product harnesses record bare model aliases and partial provenance, and
21
- * the bundle contract's own validators re-check every field that matters
22
- * on the way out.
23
- */
24
-
25
- /** Full mutable-surface superset a product arm may declare. */
26
- declare const productBenchmarkMutableSurfaces: readonly ["prompt", "resources.files", "tools", "mcp", "hooks", "subagents"];
27
- interface ProductBenchmarkExportOptions {
28
- /** Source eval run directories, each containing a `records.jsonl` of RunRecord rows. */
29
- readonly runDirs: readonly string[];
30
- /** Destination directory for the bundle (manifest + records + materialized source runs). */
31
- readonly outDir: string;
32
- readonly projectId: string;
33
- readonly benchmarkId: string;
34
- /** Repo-relative path of the product's canonical agent profile source. */
35
- readonly agentProfilePath: string;
36
- /** Pass threshold applied when a row carries no explicit `outcome.raw.pass`. Default 0.7. */
37
- readonly passThreshold?: number;
38
- /**
39
- * First scenario tag. Defaults to `projectId` with a trailing `-agent`
40
- * stripped (`tax-agent` → `tax`), matching the product exporters.
41
- */
42
- readonly scenarioTagPrefix?: string;
43
- /** Profile id used when a row has no `agentProfile.profileId`. Defaults to the row's arm id. */
44
- readonly fallbackProfileId?: string;
45
- /** Arm mutable surfaces recorded in the manifest. Defaults to the full superset. */
46
- readonly mutableSurfaces?: readonly string[];
47
- /**
48
- * Copy each run dir into `<outDir>/source-runs/` and record
49
- * bundle-relative artifact paths (portable, self-contained). When false,
50
- * artifacts keep absolute paths into the original run dirs. Default true.
51
- */
52
- readonly materializeSourceRuns?: boolean;
53
- /**
54
- * Override split classification for a row. Return undefined to fall back
55
- * to the default (`outcome.raw.safety === 1` → safety, then splitTag).
56
- */
57
- readonly classifySplit?: (record: RunRecord) => ProductBenchmarkSplit | undefined;
58
- /** Recovers a tool-call count when the row's raw bag carries none (e.g. from turn artifacts). */
59
- readonly toolCallFallback?: (record: RunRecord, runDir: string) => number;
60
- /** Backend version recorded per row. Defaults to the cwd package.json's `@tangle-network/sandbox` range. */
61
- readonly backendVersion?: string;
62
- /**
63
- * Explicit substrate versions for the manifest, merged over what the cwd
64
- * package.json / node_modules resolve. Use when a substrate package is not
65
- * installed where the export runs — the validator refuses an `'unknown'`
66
- * version, so provide the real one rather than shipping the sentinel.
67
- */
68
- readonly substrate?: Partial<ProductBenchmarkManifest['substrate']>;
69
- }
70
- interface ProductBenchmarkSingleRunExportOptions extends Omit<ProductBenchmarkExportOptions, 'runDirs'> {
71
- readonly runDir: string;
72
- }
73
- interface ProductBenchmarkExportResult {
74
- readonly manifestPath: string;
75
- readonly recordsPath: string;
76
- readonly records: number;
77
- }
78
- /** Repo identity from the exporting process's cwd. `'unknown'` values are flagged by `validateProductBenchmarkRun`. */
79
- declare function productBenchmarkRepoIdentity(): ProductBenchmarkManifest['repo'];
80
- /** Map one RunRecord row to a validated product benchmark record. */
81
- declare function runRecordToProductBenchmarkRecord(record: RunRecord, runDir: string, artifactRoot: string, artifacts: ProductBenchmarkRecord['artifacts'], options: ProductBenchmarkExportOptions | ProductBenchmarkSingleRunExportOptions): ProductBenchmarkRecord;
82
- /** Derive the bundle manifest from already-normalized records. */
83
- declare function buildProductBenchmarkManifest(records: readonly ProductBenchmarkRecord[], options: Pick<ProductBenchmarkExportOptions, 'outDir' | 'projectId' | 'benchmarkId' | 'scenarioTagPrefix' | 'mutableSurfaces' | 'substrate'>): ProductBenchmarkManifest;
84
- /** Single-run convenience wrapper over `exportProductBenchmarkRuns`. */
85
- declare function exportProductBenchmark(options: ProductBenchmarkSingleRunExportOptions): ProductBenchmarkExportResult;
86
- /**
87
- * Export one or more product eval run dirs into a validated product
88
- * benchmark bundle at `outDir`. Both the manifest and every record are
89
- * run through the contract validators before anything is written.
90
- */
91
- declare function exportProductBenchmarkRuns(options: ProductBenchmarkExportOptions): ProductBenchmarkExportResult;
92
-
93
- declare const productBenchmarkSplits: readonly ["practice", "dev", "holdout", "safety", "sentinel"];
94
- type ProductBenchmarkSplit = (typeof productBenchmarkSplits)[number];
95
- interface ProductBenchmarkRepoRef {
96
- readonly url: string;
97
- readonly commit: string;
98
- readonly branch: string;
99
- }
100
- interface ProductBenchmarkSubstrateVersions {
101
- readonly agentEval: string;
102
- readonly agentRuntime: string;
103
- readonly agentInterface: string;
104
- readonly sandbox: string;
105
- readonly agentBench?: string;
106
- }
107
- interface ProductBenchmarkProfileRef {
108
- readonly id: string;
109
- readonly profileHash: string;
110
- readonly agentProfilePath: string;
111
- }
112
- interface ProductBenchmarkArm {
113
- readonly id: string;
114
- readonly profileId: string;
115
- readonly mutableSurfaces: readonly string[];
116
- readonly policyAxes: Record<string, unknown>;
117
- }
118
- interface ProductBenchmarkScenario {
119
- readonly id: string;
120
- readonly split: ProductBenchmarkSplit;
121
- readonly tags: readonly string[];
122
- readonly sourceAllowedForSynthesis: boolean;
123
- }
124
- interface ProductBenchmarkBudgets {
125
- readonly maxUsd: number;
126
- readonly maxCells: number;
127
- readonly maxWallMs: number;
128
- }
129
- interface ProductBenchmarkManifest {
130
- readonly schemaVersion: 1;
131
- readonly projectId: string;
132
- readonly benchmarkId: string;
133
- readonly repo: ProductBenchmarkRepoRef;
134
- readonly substrate: ProductBenchmarkSubstrateVersions;
135
- readonly profiles: readonly ProductBenchmarkProfileRef[];
136
- readonly arms: readonly ProductBenchmarkArm[];
137
- readonly scenarios: readonly ProductBenchmarkScenario[];
138
- readonly budgets: ProductBenchmarkBudgets;
139
- readonly expectedArtifactDir: string;
140
- }
141
- interface AgentProfileRuntimeReceipt {
142
- readonly model: string;
143
- readonly harness: string;
144
- readonly backend: string;
145
- readonly reasoningEffort?: string;
146
- }
147
- type RuntimeResolution = AgentProfileRuntimeReceipt;
148
- interface ProductBenchmarkRecord {
149
- readonly schemaVersion: 1;
150
- readonly projectId: string;
151
- readonly benchmarkId: string;
152
- readonly runId: string;
153
- readonly scenarioId: string;
154
- readonly split: ProductBenchmarkSplit;
155
- readonly armId: string;
156
- readonly rep: number;
157
- readonly agentProfile: {
158
- readonly id: string;
159
- readonly hash: string;
160
- readonly path: string;
161
- readonly declared: RuntimeResolution;
162
- readonly resolved: RuntimeResolution;
163
- };
164
- readonly model: {
165
- readonly provider: string;
166
- readonly id: string;
167
- };
168
- readonly backend: {
169
- readonly kind: string;
170
- readonly version: string;
171
- };
172
- readonly outcome: {
173
- readonly pass: boolean;
174
- readonly score: number;
175
- readonly dimensions: Record<string, number>;
176
- readonly failureMode: string | null;
177
- };
178
- readonly usage: {
179
- readonly inputTokens: number;
180
- readonly outputTokens: number;
181
- readonly costUsd: number;
182
- readonly wallMs: number;
183
- readonly toolCalls: number;
184
- };
185
- readonly integrity: {
186
- readonly realBackend: boolean;
187
- readonly rawCapture: boolean;
188
- readonly traceCapture: boolean;
189
- readonly noStubRows: boolean;
190
- readonly priced: boolean;
191
- readonly profileMaterialized: boolean;
192
- };
193
- readonly artifacts: {
194
- readonly records: string;
195
- readonly traces: string;
196
- readonly raws: string;
197
- readonly scores: string;
198
- readonly workspace: string;
199
- };
200
- }
201
- interface ProductBenchmarkRunInput {
202
- readonly manifestPath: string;
203
- readonly recordsPath: string;
204
- readonly artifactRoot?: string;
205
- readonly checkArtifacts?: boolean;
206
- }
207
- interface ProductBenchmarkValidationReport {
208
- readonly manifestPath: string;
209
- readonly recordsPath: string;
210
- readonly records: number;
211
- /** Manifest repo fields that are empty or the `'unknown'` export sentinel. */
212
- readonly repoFailures: readonly string[];
213
- /** Manifest substrate versions that are empty or the `'unknown'` export
214
- * sentinel — a bundle without substrate identity is not reproducible. */
215
- readonly substrateFailures: readonly string[];
216
- readonly projects: readonly string[];
217
- readonly benchmarks: readonly string[];
218
- readonly arms: readonly string[];
219
- readonly scenarios: readonly string[];
220
- readonly passed: number;
221
- readonly failed: number;
222
- readonly inputTokens: number;
223
- readonly outputTokens: number;
224
- readonly costUsd: number;
225
- readonly wallMs: number;
226
- readonly integrityFailures: readonly string[];
227
- readonly missingArtifacts: readonly string[];
228
- }
229
- interface ProductBenchmarkArtifactPaths {
230
- readonly manifestPath: string;
231
- readonly recordsPath: string;
232
- }
233
- declare function validateProductBenchmarkManifest(value: unknown): ProductBenchmarkManifest;
234
- declare function validateProductBenchmarkRecord(value: unknown): ProductBenchmarkRecord;
235
- declare function productBenchmarkIntegrityFailures(record: ProductBenchmarkRecord): string[];
236
- declare function readProductBenchmarkRecords(path: string): ProductBenchmarkRecord[];
237
- declare function readProductBenchmarkManifest(path: string): ProductBenchmarkManifest;
238
- declare function validateProductBenchmarkRun(input: ProductBenchmarkRunInput): ProductBenchmarkValidationReport;
239
- declare function findProductBenchmarkArtifacts(runDir: string): ProductBenchmarkArtifactPaths | null;
240
- /**
241
- * Fail-loud gate over a bundle directory: locates the manifest + records,
242
- * runs `validateProductBenchmarkRun`, and throws with every repo,
243
- * integrity, and artifact failure listed. Returns the report when clean.
244
- */
245
- declare function assertProductBenchmarkRun(runDir: string): ProductBenchmarkValidationReport;
246
-
247
- export { type AgentProfileRuntimeReceipt, type ProductBenchmarkArm, type ProductBenchmarkArtifactPaths, type ProductBenchmarkBudgets, type ProductBenchmarkExportOptions, type ProductBenchmarkExportResult, type ProductBenchmarkManifest, type ProductBenchmarkProfileRef, type ProductBenchmarkRecord, type ProductBenchmarkRepoRef, type ProductBenchmarkRunInput, type ProductBenchmarkScenario, type ProductBenchmarkSingleRunExportOptions, type ProductBenchmarkSplit, type ProductBenchmarkSubstrateVersions, type ProductBenchmarkValidationReport, type RuntimeResolution, assertProductBenchmarkRun, buildProductBenchmarkManifest, exportProductBenchmark, exportProductBenchmarkRuns, findProductBenchmarkArtifacts, productBenchmarkIntegrityFailures, productBenchmarkMutableSurfaces, productBenchmarkRepoIdentity, productBenchmarkSplits, readProductBenchmarkManifest, readProductBenchmarkRecords, runRecordToProductBenchmarkRecord, validateProductBenchmarkManifest, validateProductBenchmarkRecord, validateProductBenchmarkRun };