@tangle-network/agent-bench 2.0.0 → 3.0.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 (215) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +24 -2
  3. package/dist/adapters.d.ts +3 -3
  4. package/dist/adapters.js +3 -5
  5. package/dist/adapters.js.map +1 -1
  6. package/dist/benchmarks/_harness.d.ts +4 -4
  7. package/dist/benchmarks/_harness.js +5 -2
  8. package/dist/benchmarks/_harness.js.map +1 -1
  9. package/dist/benchmarks/aec-bench.d.ts +2 -2
  10. package/dist/benchmarks/aec-bench.js +49 -42
  11. package/dist/benchmarks/aec-bench.js.map +1 -1
  12. package/dist/benchmarks/agentbench.d.ts +2 -2
  13. package/dist/benchmarks/agentbench.js +41 -34
  14. package/dist/benchmarks/agentbench.js.map +1 -1
  15. package/dist/benchmarks/appworld.d.ts +4 -4
  16. package/dist/benchmarks/appworld.js +67 -53
  17. package/dist/benchmarks/appworld.js.map +1 -1
  18. package/dist/benchmarks/bfcl.d.ts +2 -2
  19. package/dist/benchmarks/bfcl.js +52 -44
  20. package/dist/benchmarks/bfcl.js.map +1 -1
  21. package/dist/benchmarks/cad-design.d.ts +2 -2
  22. package/dist/benchmarks/cad-design.js +53 -44
  23. package/dist/benchmarks/cad-design.js.map +1 -1
  24. package/dist/benchmarks/cadbench.d.ts +2 -2
  25. package/dist/benchmarks/cadbench.js +1 -1
  26. package/dist/benchmarks/cadgenbench.d.ts +2 -2
  27. package/dist/benchmarks/cadgenbench.js +1 -1
  28. package/dist/benchmarks/commit0.d.ts +2 -2
  29. package/dist/benchmarks/commit0.js +38 -31
  30. package/dist/benchmarks/commit0.js.map +1 -1
  31. package/dist/benchmarks/crag.d.ts +2 -2
  32. package/dist/benchmarks/crag.js +37 -32
  33. package/dist/benchmarks/crag.js.map +1 -1
  34. package/dist/benchmarks/dabstep.d.ts +2 -2
  35. package/dist/benchmarks/dabstep.js +41 -34
  36. package/dist/benchmarks/dabstep.js.map +1 -1
  37. package/dist/benchmarks/finresearchbench.d.ts +4 -4
  38. package/dist/benchmarks/finresearchbench.js +61 -48
  39. package/dist/benchmarks/finresearchbench.js.map +1 -1
  40. package/dist/benchmarks/finsearchcomp.d.ts +3 -3
  41. package/dist/benchmarks/finsearchcomp.js +54 -43
  42. package/dist/benchmarks/finsearchcomp.js.map +1 -1
  43. package/dist/benchmarks/frames.d.ts +2 -2
  44. package/dist/benchmarks/frames.js +66 -51
  45. package/dist/benchmarks/frames.js.map +1 -1
  46. package/dist/benchmarks/hotpotqa.d.ts +2 -2
  47. package/dist/benchmarks/hotpotqa.js +59 -47
  48. package/dist/benchmarks/hotpotqa.js.map +1 -1
  49. package/dist/benchmarks/humaneval.d.ts +3 -3
  50. package/dist/benchmarks/humaneval.js +39 -35
  51. package/dist/benchmarks/humaneval.js.map +1 -1
  52. package/dist/benchmarks/mcad-bench.d.ts +2 -2
  53. package/dist/benchmarks/mcad-bench.js +68 -56
  54. package/dist/benchmarks/mcad-bench.js.map +1 -1
  55. package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
  56. package/dist/benchmarks/mcad-cq-bench.js +69 -57
  57. package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
  58. package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
  59. package/dist/benchmarks/mcad-cq-golds.js +1 -1
  60. package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
  61. package/dist/benchmarks/mcad-golds.d.ts +1 -1
  62. package/dist/benchmarks/mcad-golds.js.map +1 -1
  63. package/dist/benchmarks/mind2web.d.ts +3 -3
  64. package/dist/benchmarks/mind2web.js +62 -49
  65. package/dist/benchmarks/mind2web.js.map +1 -1
  66. package/dist/benchmarks/nomiracl.d.ts +2 -2
  67. package/dist/benchmarks/nomiracl.js +43 -36
  68. package/dist/benchmarks/nomiracl.js.map +1 -1
  69. package/dist/benchmarks/open-rag-bench.d.ts +2 -2
  70. package/dist/benchmarks/open-rag-bench.js +37 -32
  71. package/dist/benchmarks/open-rag-bench.js.map +1 -1
  72. package/dist/benchmarks/programbench.d.ts +2 -2
  73. package/dist/benchmarks/programbench.js +28 -23
  74. package/dist/benchmarks/programbench.js.map +1 -1
  75. package/dist/benchmarks/rag-shared.d.ts +2 -2
  76. package/dist/benchmarks/rag-shared.js +15 -13
  77. package/dist/benchmarks/rag-shared.js.map +1 -1
  78. package/dist/benchmarks/ragbench.d.ts +2 -2
  79. package/dist/benchmarks/ragbench.js +34 -29
  80. package/dist/benchmarks/ragbench.js.map +1 -1
  81. package/dist/benchmarks/simpleqa.d.ts +2 -2
  82. package/dist/benchmarks/simpleqa.js +62 -51
  83. package/dist/benchmarks/simpleqa.js.map +1 -1
  84. package/dist/benchmarks/swe-bench.d.ts +4 -4
  85. package/dist/benchmarks/swe-bench.js +47 -41
  86. package/dist/benchmarks/swe-bench.js.map +1 -1
  87. package/dist/benchmarks/t2-ragbench.d.ts +2 -2
  88. package/dist/benchmarks/t2-ragbench.js +37 -32
  89. package/dist/benchmarks/t2-ragbench.js.map +1 -1
  90. package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
  91. package/dist/benchmarks/tau-bench-shared.js +43 -36
  92. package/dist/benchmarks/tau-bench-shared.js.map +1 -1
  93. package/dist/benchmarks/tau2-bench.d.ts +2 -2
  94. package/dist/benchmarks/tau2-bench.js.map +1 -1
  95. package/dist/benchmarks/tau3-banking.d.ts +2 -2
  96. package/dist/benchmarks/tau3-banking.js.map +1 -1
  97. package/dist/benchmarks/terminal-bench.d.ts +2 -2
  98. package/dist/benchmarks/terminal-bench.js +29 -23
  99. package/dist/benchmarks/terminal-bench.js.map +1 -1
  100. package/dist/benchmarks/toollm.d.ts +2 -2
  101. package/dist/benchmarks/toollm.js +40 -34
  102. package/dist/benchmarks/toollm.js.map +1 -1
  103. package/dist/benchmarks/trata-hedge.d.ts +2 -2
  104. package/dist/benchmarks/trata-hedge.js +46 -38
  105. package/dist/benchmarks/trata-hedge.js.map +1 -1
  106. package/dist/benchmarks/types.d.ts +33 -63
  107. package/dist/benchmarks/types.js +36 -1
  108. package/dist/benchmarks/types.js.map +1 -0
  109. package/dist/benchmarks/webarena-verified.d.ts +2 -2
  110. package/dist/benchmarks/webarena-verified.js +29 -24
  111. package/dist/benchmarks/webarena-verified.js.map +1 -1
  112. package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
  113. package/dist/cadbench-htzAmMaI.js.map +1 -0
  114. package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
  115. package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
  116. package/dist/cli.d.ts +1 -0
  117. package/dist/cli.js +667 -0
  118. package/dist/cli.js.map +1 -0
  119. package/dist/index.d.ts +9 -8
  120. package/dist/index.js +61 -56
  121. package/dist/index.js.map +1 -1
  122. package/package.json +7 -4
  123. package/scripts/enterpriseops-gym-run.sh +82 -0
  124. package/scripts/grade-recorded-evidence.mjs +6 -6
  125. package/scripts/harvey-lab-judge.py +50 -0
  126. package/scripts/harvey-lab-run.sh +53 -0
  127. package/scripts/harvey-lab-sandbox.sh +21 -0
  128. package/scripts/healthbench-professional-run.sh +30 -0
  129. package/scripts/healthbench_professional_run.py +112 -0
  130. package/scripts/mlcr-run.sh +17 -0
  131. package/scripts/mlcr_run.py +133 -0
  132. package/scripts/prbench-run.sh +39 -0
  133. package/scripts/prbench_run.py +53 -0
  134. package/scripts/verify-packed-consumer.mjs +32 -27
  135. package/src/adapters.ts +5 -7
  136. package/src/benchmarks/_harness.test.mts +18 -1
  137. package/src/benchmarks/_harness.ts +12 -7
  138. package/src/benchmarks/aec-bench.test.mts +14 -14
  139. package/src/benchmarks/aec-bench.ts +62 -56
  140. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  141. package/src/benchmarks/agentbench.ts +44 -37
  142. package/src/benchmarks/appworld.test.mts +7 -7
  143. package/src/benchmarks/appworld.ts +88 -75
  144. package/src/benchmarks/bfcl.ts +60 -53
  145. package/src/benchmarks/cad-design.ts +34 -32
  146. package/src/benchmarks/cadbench.ts +34 -32
  147. package/src/benchmarks/cadgenbench.ts +30 -28
  148. package/src/benchmarks/commit0.test.mts +9 -9
  149. package/src/benchmarks/commit0.ts +50 -43
  150. package/src/benchmarks/crag.ts +45 -40
  151. package/src/benchmarks/dabstep-official.test.mts +8 -8
  152. package/src/benchmarks/dabstep.test.mts +11 -11
  153. package/src/benchmarks/dabstep.ts +47 -40
  154. package/src/benchmarks/external-adapters.test.mts +43 -44
  155. package/src/benchmarks/finresearchbench.ts +57 -47
  156. package/src/benchmarks/finsearchcomp.ts +72 -67
  157. package/src/benchmarks/frames.ts +76 -69
  158. package/src/benchmarks/hotpotqa.ts +69 -64
  159. package/src/benchmarks/humaneval.ts +37 -35
  160. package/src/benchmarks/mcad-bench.test.mts +30 -30
  161. package/src/benchmarks/mcad-bench.ts +66 -60
  162. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  163. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  164. package/src/benchmarks/mcad-cq.test.mts +40 -40
  165. package/src/benchmarks/mcad-golds.ts +1 -1
  166. package/src/benchmarks/mind2web.ts +66 -58
  167. package/src/benchmarks/nomiracl.ts +53 -46
  168. package/src/benchmarks/open-rag-bench.ts +47 -42
  169. package/src/benchmarks/programbench.test.mts +10 -10
  170. package/src/benchmarks/programbench.ts +38 -33
  171. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  172. package/src/benchmarks/rag-shared.ts +13 -16
  173. package/src/benchmarks/ragbench.ts +44 -39
  174. package/src/benchmarks/simpleqa.ts +78 -73
  175. package/src/benchmarks/swe-bench.test.mts +3 -3
  176. package/src/benchmarks/swe-bench.ts +66 -61
  177. package/src/benchmarks/t2-ragbench.ts +47 -42
  178. package/src/benchmarks/tau-bench-shared.ts +51 -44
  179. package/src/benchmarks/tau-pin.test.mts +1 -1
  180. package/src/benchmarks/tau2-bench.ts +2 -2
  181. package/src/benchmarks/tau3-banking.ts +2 -2
  182. package/src/benchmarks/terminal-bench.test.mts +3 -3
  183. package/src/benchmarks/terminal-bench.ts +41 -36
  184. package/src/benchmarks/toollm.ts +54 -47
  185. package/src/benchmarks/trata-hedge.ts +57 -52
  186. package/src/benchmarks/types.ts +70 -59
  187. package/src/benchmarks/webarena-verified.ts +49 -42
  188. package/src/cli.ts +74 -0
  189. package/src/corpus-replay.mts +9 -9
  190. package/src/examples/benchmark-matrix.mts +13 -10
  191. package/src/gate-cli.mts +5 -5
  192. package/src/gate.test.mts +14 -12
  193. package/src/gate.ts +23 -22
  194. package/src/index.ts +17 -11
  195. package/src/published.test.mts +534 -0
  196. package/src/published.ts +524 -0
  197. package/src/run-benchmarks-cli.mts +2 -2
  198. package/src/run-benchmarks.test.mts +58 -48
  199. package/src/run-benchmarks.ts +64 -57
  200. package/src/swe-bench-env.ts +6 -6
  201. package/src/worker.ts +1 -1
  202. package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
  203. package/dist/benchmarks/enterpriseops-gym.js +0 -236
  204. package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
  205. package/dist/cadbench-Byr5gO1M.js.map +0 -1
  206. package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
  207. package/fixtures/enterpriseops-gym.json +0 -103
  208. package/scripts/enterpriseops_gym_judge.py +0 -281
  209. package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
  210. package/src/benchmarks/enterpriseops-gym.ts +0 -343
  211. package/src/eops-skills/address-every-subtask.md +0 -5
  212. package/src/eops-skills/exact-tools-and-args.md +0 -5
  213. package/src/eops-skills/full-sequence-to-goal.md +0 -5
  214. package/src/eops-skills/ground-every-value.md +0 -5
  215. package/src/eops-skills/honor-the-policies.md +0 -5
@@ -28,7 +28,7 @@ import { mkdtemp, readFile, writeFile } from 'node:fs/promises'
28
28
  import { tmpdir } from 'node:os'
29
29
  import { join } from 'node:path'
30
30
  import { promisify } from 'node:util'
31
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
31
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
32
32
 
33
33
  const execFileAsync = promisify(execFile)
34
34
 
@@ -341,39 +341,21 @@ difference(){
341
341
  },
342
342
  ]
343
343
 
344
- export function createCadDesignAdapter(): BenchmarkAdapter {
345
- return {
346
- name: 'cad-design',
344
+ export function createCadDesignAdapter(): RuntimeBenchmark {
345
+ return runtimeBenchmark({
346
+ id: 'cad-design',
347
347
 
348
- async preflight() {
349
- try {
350
- await execFileAsync('xvfb-run', ['-a', 'openscad', '--version'], { timeout: 30_000 })
351
- } catch (err) {
352
- const msg = err instanceof Error ? err.message : String(err)
353
- throw new Error(
354
- `cad-design preflight failed: ${msg}\n` +
355
- `Fix: install OpenSCAD + Xvfb (Debian/Ubuntu: sudo apt-get install -y openscad xvfb). ` +
356
- `The judge runs \`xvfb-run -a openscad -o out.stl model.scad\` — both must be on PATH.`,
357
- )
358
- }
359
- },
360
-
361
- async loadTasks(opts: LoadOptions = {}) {
348
+ async loadAll(opts: LoadOptions = {}) {
362
349
  let tasks = TASKS
363
350
  if (opts.ids) tasks = tasks.filter((t) => opts.ids!.includes(t.id))
364
351
  if (opts.limit != null) tasks = tasks.slice(0, opts.limit)
365
- return tasks.map((t): BenchTask => ({ id: t.id, prompt: t.prompt, metadata: t.meta as unknown as Record<string, unknown> }))
366
- },
367
-
368
- async goldArtifact(task: BenchTask) {
369
- const meta = task.metadata as unknown as CadTaskMeta | undefined
370
- return meta?.gold
352
+ return tasks.map((t): BenchTask => ({ id: t.id, payload: { prompt: t.prompt }, metadata: t.meta as unknown as Record<string, unknown> }))
371
353
  },
372
354
 
373
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
355
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
374
356
  const spec = (task.metadata as unknown as CadTaskMeta).spec
375
357
  const src = artifact.trim()
376
- if (!src) return { resolved: false, score: 0, detail: 'empty artifact' }
358
+ if (!src) return { passed: false, score: 0, notes: 'empty artifact', raw: {} }
377
359
 
378
360
  const dir = await mkdtemp(join(tmpdir(), 'cad-'))
379
361
  const scad = join(dir, 'model.scad')
@@ -388,7 +370,7 @@ export function createCadDesignAdapter(): BenchmarkAdapter {
388
370
  stderr = r.stderr
389
371
  } catch (err) {
390
372
  const msg = err instanceof Error ? err.message : String(err)
391
- return { resolved: false, score: 0, detail: `compile failed: ${msg.slice(0, 300)}` }
373
+ return { passed: false, score: 0, notes: `compile failed: ${msg.slice(0, 300)}`, raw: {} }
392
374
  }
393
375
 
394
376
  // Render a PNG alongside (the artifact run-capsule animates). Non-fatal.
@@ -405,13 +387,13 @@ export function createCadDesignAdapter(): BenchmarkAdapter {
405
387
  try {
406
388
  stl = await readFile(stlPath, 'utf8')
407
389
  } catch {
408
- return { resolved: false, score: 0, detail: 'compiled but produced no STL (empty geometry)' }
390
+ return { passed: false, score: 0, notes: 'compiled but produced no STL (empty geometry)', raw: {} }
409
391
  }
410
392
  const volumes = Number(/Volumes:\s*(\d+)/.exec(stderr)?.[1] ?? '1')
411
393
  const geo = measureStl(stl, volumes)
412
394
  const { checks, score } = scoreGeometry(geo, spec)
413
395
  const resolved = score === 1
414
- const detail = JSON.stringify({
396
+ const raw = {
415
397
  checks,
416
398
  geo: {
417
399
  triangles: geo.triangles,
@@ -422,8 +404,28 @@ export function createCadDesignAdapter(): BenchmarkAdapter {
422
404
  },
423
405
  renderPath: pngPath,
424
406
  stlPath,
425
- })
426
- return { resolved, score, detail }
407
+ }
408
+ return { passed: resolved, score, notes: JSON.stringify(raw), raw }
427
409
  },
428
- }
410
+
411
+ runtime: {
412
+ async preflight() {
413
+ try {
414
+ await execFileAsync('xvfb-run', ['-a', 'openscad', '--version'], { timeout: 30_000 })
415
+ } catch (err) {
416
+ const msg = err instanceof Error ? err.message : String(err)
417
+ throw new Error(
418
+ `cad-design preflight failed: ${msg}\n` +
419
+ `Fix: install OpenSCAD + Xvfb (Debian/Ubuntu: sudo apt-get install -y openscad xvfb). ` +
420
+ `The judge runs \`xvfb-run -a openscad -o out.stl model.scad\` — both must be on PATH.`,
421
+ )
422
+ }
423
+ },
424
+
425
+ async goldArtifact(task: BenchTask) {
426
+ const meta = task.metadata as unknown as CadTaskMeta | undefined
427
+ return meta?.gold
428
+ },
429
+ },
430
+ })
429
431
  }
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { readFile } from 'node:fs/promises'
15
- import type { BenchScore, BenchTask, BenchmarkAdapter, LoadOptions } from './types'
15
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
16
16
  import { renderBpy } from '../worker-blender'
17
17
  import { runBenchRouterTurn } from '../router-turn'
18
18
 
@@ -81,7 +81,7 @@ async function judgeCriteria(
81
81
  return { passed, note: `${passed.filter(Boolean).length}/${criteria.length} criteria` }
82
82
  }
83
83
 
84
- export function createCadBenchAdapter(): BenchmarkAdapter {
84
+ export function createCadBenchAdapter(): RuntimeBenchmark {
85
85
  let cache: Array<{ id: string; instruction: string; meta: CadBenchMeta }> | null = null
86
86
 
87
87
  async function load(): Promise<typeof cache & object> {
@@ -99,48 +99,50 @@ export function createCadBenchAdapter(): BenchmarkAdapter {
99
99
  return cache
100
100
  }
101
101
 
102
- return {
103
- name: 'cadbench',
102
+ return runtimeBenchmark({
103
+ id: 'cadbench',
104
104
 
105
- async preflight() {
106
- const { execFile } = await import('node:child_process')
107
- const { promisify } = await import('node:util')
108
- const exec = promisify(execFile)
109
- try {
110
- await exec('xvfb-run', ['-a', 'blender', '--version'], { timeout: 30_000 })
111
- } catch (err) {
112
- throw new Error(
113
- `cadbench preflight failed: ${(err instanceof Error ? err.message : String(err)).slice(0, 200)}\n` +
114
- `Fix: install Blender + Xvfb (sudo apt-get install -y blender xvfb). The judge runs \`xvfb-run -a blender --background --python\`.`,
115
- )
116
- }
117
- await load()
118
- },
119
-
120
- async loadTasks(opts: LoadOptions = {}) {
105
+ async loadAll(opts: LoadOptions = {}) {
121
106
  let rows = await load()
122
107
  if (opts.ids) rows = rows.filter((r) => opts.ids!.includes(r.id))
123
108
  // TYPE filter (Simulative|Wild) via env, applied before limit.
124
109
  const t = process.env.CADBENCH_TYPE
125
110
  if (t) rows = rows.filter((r) => r.meta.type.toLowerCase() === t.toLowerCase())
126
111
  if (opts.limit != null) rows = rows.slice(0, opts.limit)
127
- return rows.map((r): BenchTask => ({ id: r.id, prompt: r.instruction, metadata: r.meta as unknown as Record<string, unknown> }))
112
+ return rows.map((r): BenchTask => ({ id: r.id, payload: { prompt: r.instruction }, metadata: r.meta as unknown as Record<string, unknown> }))
128
113
  },
129
114
 
130
- async goldArtifact() {
131
- return undefined // no reference bpy script ships with the benchmark
132
- },
133
-
134
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
115
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
135
116
  const meta = task.metadata as unknown as CadBenchMeta
136
117
  const criteria = meta.criteria ?? []
137
- if (!artifact.trim()) return { resolved: false, score: 0, detail: 'empty artifact' }
138
- if (criteria.length === 0) return { resolved: false, score: 0, detail: 'task has no criteria' }
118
+ if (!artifact.trim()) return { passed: false, score: 0, notes: 'empty artifact', raw: {} }
119
+ if (criteria.length === 0) return { passed: false, score: 0, notes: 'task has no criteria', raw: {} }
139
120
  const r = await renderBpy(artifact, { views: 4 })
140
- if (!r.built) return { resolved: false, score: 0, detail: `did not build/render: ${r.error ?? 'no mesh'}` }
141
- const { passed, note } = await judgeCriteria(task.prompt, artifact, criteria, r.renders)
121
+ if (!r.built) return { passed: false, score: 0, notes: `did not build/render: ${r.error ?? 'no mesh'}`, raw: {} }
122
+ const { passed, note } = await judgeCriteria(task.payload.prompt, artifact, criteria, r.renders)
142
123
  const score = passed.filter(Boolean).length / criteria.length
143
- return { resolved: score === 1, score, detail: note }
124
+ return { passed: score === 1, score, notes: note, raw: {} }
144
125
  },
145
- }
126
+
127
+ runtime: {
128
+ async preflight() {
129
+ const { execFile } = await import('node:child_process')
130
+ const { promisify } = await import('node:util')
131
+ const exec = promisify(execFile)
132
+ try {
133
+ await exec('xvfb-run', ['-a', 'blender', '--version'], { timeout: 30_000 })
134
+ } catch (err) {
135
+ throw new Error(
136
+ `cadbench preflight failed: ${(err instanceof Error ? err.message : String(err)).slice(0, 200)}\n` +
137
+ `Fix: install Blender + Xvfb (sudo apt-get install -y blender xvfb). The judge runs \`xvfb-run -a blender --background --python\`.`,
138
+ )
139
+ }
140
+ await load()
141
+ },
142
+
143
+ async goldArtifact() {
144
+ return undefined // no reference bpy script ships with the benchmark
145
+ },
146
+ },
147
+ })
146
148
  }
@@ -8,7 +8,7 @@
8
8
  * The official task set (private GT, server-side graded) isn't released yet, so
9
9
  * tasks here are seeded from the repo's dimension-named geometry fixtures (real
10
10
  * GT STEPs scored by the real scorer). When CADGENBENCH_DATA_DIR is set, swap
11
- * loadTasks to read the published fixtures' description.yaml + ground_truth.step.
11
+ * loadAll to read the published fixtures' description.yaml + ground_truth.step.
12
12
  *
13
13
  * Requires the CADGenBench venv (CADGENBENCH_VENV) + clone (CADGENBENCH_DIR) +
14
14
  * xvfb (the scorer's alignment renders need a display).
@@ -19,7 +19,7 @@ import { mkdtemp, rm, writeFile } from 'node:fs/promises'
19
19
  import { tmpdir } from 'node:os'
20
20
  import { join } from 'node:path'
21
21
  import { promisify } from 'node:util'
22
- import type { BenchScore, BenchTask, BenchmarkAdapter, LoadOptions } from './types'
22
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
23
23
  import { CGB_DIR, CGB_VENV_PY } from '../worker-build123d'
24
24
 
25
25
  const execFileAsync = promisify(execFile)
@@ -60,23 +60,11 @@ function fixtureTasks(): Array<{ id: string; prompt: string; gtStep: string }> {
60
60
  ]
61
61
  }
62
62
 
63
- export function createCadGenBenchAdapter(): BenchmarkAdapter {
64
- return {
65
- name: 'cadgenbench',
63
+ export function createCadGenBenchAdapter(): RuntimeBenchmark {
64
+ return runtimeBenchmark({
65
+ id: 'cadgenbench',
66
66
 
67
- async preflight() {
68
- const r = await execFileAsync(CGB_VENV_PY, ['-c', 'import cadgenbench.eval.evaluate, build123d, trimesh, manifold3d; print("ok")'], { timeout: 60_000 }).catch(
69
- (e) => ({ stdout: '', stderr: e instanceof Error ? e.message : String(e) }),
70
- )
71
- if (!/ok/.test(r.stdout)) {
72
- throw new Error(
73
- `cadgenbench preflight failed (venv=${CGB_VENV_PY}): ${r.stderr.slice(0, 200)}\n` +
74
- `Fix: git clone https://github.com/huggingface/cadgenbench ${CGB_DIR}; python3 -m venv $CADGENBENCH_VENV; $CADGENBENCH_VENV/bin/pip install -e ${CGB_DIR}`,
75
- )
76
- }
77
- },
78
-
79
- async loadTasks(opts: LoadOptions = {}) {
67
+ async loadAll(opts: LoadOptions = {}) {
80
68
  // CGB_HARD_DIR (a dir with tasks.json = [{id,prompt,gtStep}]) overrides the
81
69
  // trivial fixture primitives with hard multi-feature parts (real headroom).
82
70
  let tasks = fixtureTasks()
@@ -88,16 +76,12 @@ export function createCadGenBenchAdapter(): BenchmarkAdapter {
88
76
  if (opts.ids) tasks = tasks.filter((t) => opts.ids!.includes(t.id))
89
77
  if (opts.limit != null) tasks = tasks.slice(0, opts.limit)
90
78
  const meta = (gtStep: string): CgbMeta => ({ gtStep, resolveThreshold: Number(process.env.CGB_RESOLVE_THRESHOLD ?? 0.9) })
91
- return tasks.map((t): BenchTask => ({ id: t.id, prompt: t.prompt, metadata: meta(t.gtStep) as unknown as Record<string, unknown> }))
92
- },
93
-
94
- async goldArtifact() {
95
- return undefined // GT is a STEP file scored by the kernel, not a returnable artifact
79
+ return tasks.map((t): BenchTask => ({ id: t.id, payload: { prompt: t.prompt }, metadata: meta(t.gtStep) as unknown as Record<string, unknown> }))
96
80
  },
97
81
 
98
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
82
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
99
83
  const { gtStep, resolveThreshold } = task.metadata as unknown as CgbMeta
100
- if (!artifact.includes('ISO-10303-21')) return { resolved: false, score: 0, detail: 'artifact is not a STEP file' }
84
+ if (!artifact.includes('ISO-10303-21')) return { passed: false, score: 0, notes: 'artifact is not a STEP file', raw: {} }
101
85
  const dir = await mkdtemp(join(tmpdir(), 'cgb-judge-'))
102
86
  const cand = join(dir, 'candidate.step')
103
87
  const scorer = join(dir, 'score.py')
@@ -109,13 +93,31 @@ export function createCadGenBenchAdapter(): BenchmarkAdapter {
109
93
  (e) => ({ stdout: (e as { stdout?: string }).stdout ?? '', stderr: e instanceof Error ? e.message : String(e) }),
110
94
  )
111
95
  const m = /CGB_SCORE (\{.*\})/.exec(r.stdout)
112
- if (!m) return { resolved: false, score: 0, detail: `scorer produced no verdict: ${(r.stderr || r.stdout).slice(0, 160)}` }
96
+ if (!m) return { passed: false, score: 0, notes: `scorer produced no verdict: ${(r.stderr || r.stdout).slice(0, 160)}`, raw: {} }
113
97
  const v = JSON.parse(m[1]) as { cad_score: number; status: string; error?: string }
114
98
  const score = typeof v.cad_score === 'number' ? v.cad_score : 0
115
- return { resolved: score >= resolveThreshold, score, detail: `cad_score=${score.toFixed(3)} status=${v.status}${v.error ? ` (${v.error})` : ''}` }
99
+ return { passed: score >= resolveThreshold, score, notes: `cad_score=${score.toFixed(3)} status=${v.status}${v.error ? ` (${v.error})` : ''}`, raw: {} }
116
100
  } finally {
117
101
  await rm(dir, { recursive: true, force: true }).catch(() => {})
118
102
  }
119
103
  },
120
- }
104
+
105
+ runtime: {
106
+ async preflight() {
107
+ const r = await execFileAsync(CGB_VENV_PY, ['-c', 'import cadgenbench.eval.evaluate, build123d, trimesh, manifold3d; print("ok")'], { timeout: 60_000 }).catch(
108
+ (e) => ({ stdout: '', stderr: e instanceof Error ? e.message : String(e) }),
109
+ )
110
+ if (!/ok/.test(r.stdout)) {
111
+ throw new Error(
112
+ `cadgenbench preflight failed (venv=${CGB_VENV_PY}): ${r.stderr.slice(0, 200)}\n` +
113
+ `Fix: git clone https://github.com/huggingface/cadgenbench ${CGB_DIR}; python3 -m venv $CADGENBENCH_VENV; $CADGENBENCH_VENV/bin/pip install -e ${CGB_DIR}`,
114
+ )
115
+ }
116
+ },
117
+
118
+ async goldArtifact() {
119
+ return undefined // GT is a STEP file scored by the kernel, not a returnable artifact
120
+ },
121
+ },
122
+ })
121
123
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Offline commit0 adapter test. The judge needs the official `commit0` harness +
3
3
  * a Docker daemon, neither installed in CI, so this exercises the parts that run
4
- * offline (fixtures loadTasks, the diff OutputAdapter, goldArtifact) and asserts
4
+ * offline (fixtures loadAll, the diff OutputAdapter, goldArtifact) and asserts
5
5
  * the harness-backed path FAILS LOUD with the documented fix — never a fake score.
6
6
  * Run: COMMIT0_FIXTURES=1 npx tsx --test src/benchmarks/commit0.test.mts
7
7
  */
@@ -14,22 +14,22 @@ process.env.COMMIT0_FIXTURES = '1'
14
14
  type Events = Parameters<typeof commit0DiffOutput.parse>[0]
15
15
  const stream = (text: string): Events => [{ data: { finalText: text } }] as unknown as Events
16
16
 
17
- test('loadTasks (fixtures) yields stubbed-library tasks with diff-deliverable prompt + metadata', async () => {
17
+ test('loadAll (fixtures) yields stubbed-library tasks with diff-deliverable prompt + metadata', async () => {
18
18
  const a = createCommit0Adapter()
19
- const tasks = await a.loadTasks({ ids: ['commit-0/wcwidth'] })
19
+ const tasks = await a.loadAll({ ids: ['commit-0/wcwidth'] })
20
20
  assert.equal(tasks.length, 1)
21
21
  const t = tasks[0]
22
22
  assert.equal(t.id, 'commit-0/wcwidth')
23
- assert.match(t.prompt, /```diff/)
23
+ assert.match(t.payload.prompt, /```diff/)
24
24
  const md = t.metadata as Record<string, unknown>
25
25
  assert.equal(md.instanceId, 'commit-0/wcwidth')
26
26
  assert.equal(typeof md.referenceCommit, 'string')
27
27
  assert.equal(md.srcDir, 'wcwidth/')
28
28
  })
29
29
 
30
- test('loadTasks limit slices the fixture set', async () => {
30
+ test('loadAll limit slices the fixture set', async () => {
31
31
  const a = createCommit0Adapter()
32
- const tasks = await a.loadTasks({ limit: 2 })
32
+ const tasks = await a.loadAll({ limit: 2 })
33
33
  assert.equal(tasks.length, 2)
34
34
  })
35
35
 
@@ -47,8 +47,8 @@ test('diff OutputAdapter: last fenced ```diff wins; fence-less falls back to tri
47
47
 
48
48
  test('goldArtifact is undefined — oracle is a git ref, documented, not a fabricated diff', async () => {
49
49
  const a = createCommit0Adapter()
50
- const [t] = await a.loadTasks({ ids: ['commit-0/wcwidth'] })
51
- assert.equal(await a.goldArtifact(t), undefined)
50
+ const [t] = await a.loadAll({ ids: ['commit-0/wcwidth'] })
51
+ assert.equal(await a.runtime.goldArtifact?.(t), undefined)
52
52
  })
53
53
 
54
54
  test('preflight FAILS LOUD with the install/Docker fix when the harness venv is absent', async () => {
@@ -59,7 +59,7 @@ test('preflight FAILS LOUD with the install/Docker fix when the harness venv is
59
59
  process.env.COMMIT0_VENV = '.venv-commit0-does-not-exist'
60
60
  try {
61
61
  const a = createCommit0Adapter()
62
- await assert.rejects(a.preflight(), (e: Error) => {
62
+ await assert.rejects(a.runtime.preflight!(), (e: Error) => {
63
63
  assert.match(e.message, /pip install commit0/)
64
64
  assert.match(e.message, /Docker daemon/)
65
65
  return true
@@ -25,7 +25,7 @@ import { join } from 'node:path'
25
25
  import { readFile } from 'node:fs/promises'
26
26
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
27
27
  import { benchRoot, preflightVenvImports, runVenvScriptStdin, venvPythonAt } from './_harness'
28
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
28
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
29
29
 
30
30
  const FIXTURES = join(benchRoot, 'fixtures', 'commit0.json')
31
31
 
@@ -103,15 +103,17 @@ function rowToTask(row: Commit0Row): BenchTask {
103
103
  }
104
104
  return {
105
105
  id: row.instance_id,
106
- split: DATASET_SPLIT,
107
- prompt: [
108
- `Clone https://github.com/${row.repo} into /work, then \`cd /work && git checkout ${row.base_commit}\`.`,
109
- `This is the STUBBED library: the public functions/classes under \`${row.src_dir}\` have empty bodies (\`pass\`/\`...\`).`,
110
- `Fill in COMPLETE implementations under \`${row.src_dir}\` so the existing test suite under \`${row.test.test_dir}\` passes. Read those tests and the spec to learn the required behavior.`,
111
- `Specification / docs: ${row.setup.specification}`,
112
- 'Do NOT edit the test files — the evaluation re-runs the existing tests on a fresh clone. Implement only the source.',
113
- `When done, from /work run EXACTLY: \`git add -A && git diff --cached -- ${row.src_dir}\` and END your reply with its COMPLETE output as the LAST thing, fenced exactly as \`\`\`diff … \`\`\` (nothing after the closing fence). That fenced diff (against ${row.base_commit}) is the only deliverable.`,
114
- ].join('\n'),
106
+ payload: {
107
+ subset: DATASET_SPLIT,
108
+ prompt: [
109
+ `Clone https://github.com/${row.repo} into /work, then \`cd /work && git checkout ${row.base_commit}\`.`,
110
+ `This is the STUBBED library: the public functions/classes under \`${row.src_dir}\` have empty bodies (\`pass\`/\`...\`).`,
111
+ `Fill in COMPLETE implementations under \`${row.src_dir}\` so the existing test suite under \`${row.test.test_dir}\` passes. Read those tests and the spec to learn the required behavior.`,
112
+ `Specification / docs: ${row.setup.specification}`,
113
+ 'Do NOT edit the test files — the evaluation re-runs the existing tests on a fresh clone. Implement only the source.',
114
+ `When done, from /work run EXACTLY: \`git add -A && git diff --cached -- ${row.src_dir}\` and END your reply with its COMPLETE output as the LAST thing, fenced exactly as \`\`\`diff … \`\`\` (nothing after the closing fence). That fenced diff (against ${row.base_commit}) is the only deliverable.`,
115
+ ].join('\n'),
116
+ },
115
117
  metadata: meta as unknown as Record<string, unknown>,
116
118
  }
117
119
  }
@@ -119,7 +121,7 @@ function rowToTask(row: Commit0Row): BenchTask {
119
121
  function readMeta(task: BenchTask): Commit0Meta {
120
122
  const md = task.metadata
121
123
  if (!md || typeof md.instanceId !== 'string' || typeof md.referenceCommit !== 'string' || typeof md.srcDir !== 'string') {
122
- throw new Error(`commit0 task ${task.id} missing metadata — loadTasks did not populate it`)
124
+ throw new Error(`commit0 task ${task.id} missing metadata — loadAll did not populate it`)
123
125
  }
124
126
  return md as unknown as Commit0Meta
125
127
  }
@@ -176,7 +178,7 @@ async function fetchRows(opts: LoadOptions): Promise<Commit0Row[]> {
176
178
  * not reimplemented. The driver script lives in scripts/commit0_judge.py so the
177
179
  * harness call + report parse are one auditable python entrypoint.
178
180
  */
179
- async function runHarness(meta: Commit0Meta, artifact: string): Promise<BenchScore> {
181
+ async function runHarness(meta: Commit0Meta, artifact: string): Promise<BenchEvaluation> {
180
182
  const judge = join(benchRoot, 'scripts', 'commit0_judge.py')
181
183
  let stdout: string
182
184
  try {
@@ -208,34 +210,22 @@ async function runHarness(meta: Commit0Meta, artifact: string): Promise<BenchSco
208
210
  throw new Error(`commit0 judge measured no tests for ${meta.instanceId} (total=0): ${stdout.slice(0, 400)}`)
209
211
  }
210
212
  const score = report.passed / report.total
213
+ const raw = { instanceId: meta.instanceId, passed: report.passed, total: report.total }
211
214
  return {
212
- resolved: report.passed === report.total,
215
+ passed: report.passed === report.total,
213
216
  score,
214
- detail: JSON.stringify({ instanceId: meta.instanceId, passed: report.passed, total: report.total }),
217
+ notes: JSON.stringify(raw),
218
+ raw,
215
219
  }
216
220
  }
217
221
 
218
- export function createCommit0Adapter(): BenchmarkAdapter {
222
+ export function createCommit0Adapter(): RuntimeBenchmark {
219
223
  const fixturesMode = process.env.COMMIT0_FIXTURES === '1'
220
224
 
221
- return {
222
- name: 'commit0',
223
- output: commit0DiffOutput,
224
-
225
- async preflight() {
226
- await preflightVenvImports({
227
- modules: ['commit0'],
228
- requireDocker: true,
229
- python: commit0Python(),
230
- fix:
231
- `Fix: (1) python3 -m venv bench/${commit0VenvDir()} && bench/${commit0VenvDir()}/bin/pip install commit0 datasets ` +
232
- `(an ISOLATED venv — commit0's deps conflict with the shared bench/.venv; override the dir with COMMIT0_VENV) ; ` +
233
- `(2) ensure the Docker daemon is running (commit0 --backend local builds per-repo images). ` +
234
- `Dataset rows come from the HF rows server; set COMMIT0_FIXTURES=1 to list the committed lite rows offline.`,
235
- })
236
- },
225
+ return runtimeBenchmark({
226
+ id: 'commit0',
237
227
 
238
- async loadTasks(opts: LoadOptions = {}) {
228
+ async loadAll(opts: LoadOptions = {}) {
239
229
  if (fixturesMode) return loadFixtures(opts)
240
230
  let rows: Commit0Row[]
241
231
  try {
@@ -249,18 +239,35 @@ export function createCommit0Adapter(): BenchmarkAdapter {
249
239
  return selectRows(rows, opts)
250
240
  },
251
241
 
252
- async goldArtifact() {
253
- // The oracle is the reference_commit's src_dir, which the commit0 harness
254
- // checks out by ref — not expressible as a portable diff string without
255
- // cloning. verify-judge against this adapter requires the live harness, so
256
- // we return undefined (no offline gold-diff). Judge correctness is proven by
257
- // running the harness on a real solve, not by a synthetic gold patch.
258
- return undefined
259
- },
260
-
261
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
242
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
262
243
  const meta = readMeta(task)
263
244
  return runHarness(meta, artifact)
264
245
  },
265
- }
246
+
247
+ runtime: {
248
+ output: commit0DiffOutput,
249
+
250
+ async preflight() {
251
+ await preflightVenvImports({
252
+ modules: ['commit0'],
253
+ requireDocker: true,
254
+ python: commit0Python(),
255
+ fix:
256
+ `Fix: (1) python3 -m venv bench/${commit0VenvDir()} && bench/${commit0VenvDir()}/bin/pip install commit0 datasets ` +
257
+ `(an ISOLATED venv — commit0's deps conflict with the shared bench/.venv; override the dir with COMMIT0_VENV) ; ` +
258
+ `(2) ensure the Docker daemon is running (commit0 --backend local builds per-repo images). ` +
259
+ `Dataset rows come from the HF rows server; set COMMIT0_FIXTURES=1 to list the committed lite rows offline.`,
260
+ })
261
+ },
262
+
263
+ async goldArtifact() {
264
+ // The oracle is the reference_commit's src_dir, which the commit0 harness
265
+ // checks out by ref — not expressible as a portable diff string without
266
+ // cloning. verify-judge against this adapter requires the live harness, so
267
+ // we return undefined (no offline gold-diff). Judge correctness is proven by
268
+ // running the harness on a real solve, not by a synthetic gold patch.
269
+ return undefined
270
+ },
271
+ },
272
+ })
266
273
  }
@@ -9,11 +9,11 @@
9
9
  import { readFile } from 'node:fs/promises'
10
10
  import { join } from 'node:path'
11
11
  import { benchRoot } from './_harness'
12
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
12
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
13
13
  import {
14
14
  FINAL_ANSWER_SENTINEL,
15
15
  allStrings,
16
- answerScoreToBenchScore,
16
+ answerScoreToEvaluation,
17
17
  firstString,
18
18
  isObject,
19
19
  ragAnswerOutput,
@@ -56,17 +56,19 @@ function rowToTask(raw: unknown, index: number): BenchTask {
56
56
  }
57
57
  return {
58
58
  id,
59
- split: stringFrom(raw.split) ?? domain,
60
- prompt: [
61
- 'Answer this CRAG factual question.',
62
- 'Return a concise answer and do not guess when the evidence is insufficient.',
63
- 'End with a single final line: `FINAL ANSWER: <answer>`.',
64
- '',
65
- `Question: ${query}`,
66
- `Domain: ${domain}`,
67
- `Question type: ${questionType}`,
68
- `Dynamism: ${dynamism}`,
69
- ].join('\n'),
59
+ payload: {
60
+ subset: stringFrom(raw.split) ?? domain,
61
+ prompt: [
62
+ 'Answer this CRAG factual question.',
63
+ 'Return a concise answer and do not guess when the evidence is insufficient.',
64
+ 'End with a single final line: `FINAL ANSWER: <answer>`.',
65
+ '',
66
+ `Question: ${query}`,
67
+ `Domain: ${domain}`,
68
+ `Question type: ${questionType}`,
69
+ `Dynamism: ${dynamism}`,
70
+ ].join('\n'),
71
+ },
70
72
  metadata: meta as unknown as Record<string, unknown>,
71
73
  }
72
74
  }
@@ -74,7 +76,7 @@ function rowToTask(raw: unknown, index: number): BenchTask {
74
76
  function readMeta(task: BenchTask): CragMeta {
75
77
  const md = task.metadata
76
78
  if (!md || !Array.isArray(md.goldAnswers)) {
77
- throw new Error(`CRAG task ${task.id} missing metadata — loadTasks did not populate it`)
79
+ throw new Error(`CRAG task ${task.id} missing metadata — loadAll did not populate it`)
78
80
  }
79
81
  return md as unknown as CragMeta
80
82
  }
@@ -91,47 +93,50 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
91
93
  return selectTasks(rows.map(rowToTask), opts, 'CRAG')
92
94
  }
93
95
 
94
- export function createCragAdapter(): BenchmarkAdapter {
96
+ export function createCragAdapter(): RuntimeBenchmark {
95
97
  const fixturesMode = process.env.CRAG_FIXTURES === '1'
96
98
 
97
- return {
98
- name: 'crag',
99
- output: ragAnswerOutput,
100
-
101
- async preflight() {
102
- if (fixturesMode) {
103
- await readFile(FIXTURES, 'utf8')
104
- return
105
- }
106
- const path = dataFile()
107
- if (!path) {
108
- throw new Error(
109
- 'CRAG_DATA_FILE is required. Fix: export facebookresearch/CRAG rows to JSONL and set CRAG_DATA_FILE=/path/to/crag.jsonl, or set CRAG_FIXTURES=1 for adapter plumbing.',
110
- )
111
- }
112
- await loadRows(path)
113
- },
99
+ return runtimeBenchmark({
100
+ id: 'crag',
114
101
 
115
- async loadTasks(opts: LoadOptions = {}) {
102
+ async loadAll(opts: LoadOptions = {}) {
116
103
  if (fixturesMode) return loadFixtures(opts)
117
104
  const path = dataFile()
118
105
  if (!path) throw new Error('CRAG_DATA_FILE is required to load CRAG tasks')
119
106
  return selectTasks((await loadRows(path)).map(rowToTask), opts, 'CRAG')
120
107
  },
121
108
 
122
- async goldArtifact(task: BenchTask) {
123
- return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
124
- },
125
-
126
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
109
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
127
110
  const meta = readMeta(task)
128
111
  const score = scoreAnswerArtifact(artifact, meta.goldAnswers)
129
- return answerScoreToBenchScore(score, {
112
+ return answerScoreToEvaluation(score, {
130
113
  benchmark: meta.benchmark,
131
114
  domain: meta.domain,
132
115
  questionType: meta.questionType,
133
116
  dynamism: meta.dynamism,
134
117
  })
135
118
  },
136
- }
119
+
120
+ runtime: {
121
+ output: ragAnswerOutput,
122
+
123
+ async preflight() {
124
+ if (fixturesMode) {
125
+ await readFile(FIXTURES, 'utf8')
126
+ return
127
+ }
128
+ const path = dataFile()
129
+ if (!path) {
130
+ throw new Error(
131
+ 'CRAG_DATA_FILE is required. Fix: export facebookresearch/CRAG rows to JSONL and set CRAG_DATA_FILE=/path/to/crag.jsonl, or set CRAG_FIXTURES=1 for adapter plumbing.',
132
+ )
133
+ }
134
+ await loadRows(path)
135
+ },
136
+
137
+ async goldArtifact(task: BenchTask) {
138
+ return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
139
+ },
140
+ },
141
+ })
137
142
  }