@tangle-network/agent-bench 2.0.0 → 4.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 (222) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +32 -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 +43 -22
  120. package/dist/index.js +297 -144
  121. package/dist/index.js.map +1 -1
  122. package/package.json +7 -4
  123. package/pier_agents/candidate_contract.py +226 -74
  124. package/pier_agents/tangle_candidate.py +79 -1
  125. package/pier_agents/workspace_boundary.py +29 -1
  126. package/scripts/enterpriseops-gym-run.sh +82 -0
  127. package/scripts/grade-recorded-evidence.mjs +6 -6
  128. package/scripts/harvey-lab-judge.py +50 -0
  129. package/scripts/harvey-lab-run.sh +53 -0
  130. package/scripts/harvey-lab-sandbox.sh +21 -0
  131. package/scripts/healthbench-professional-run.sh +30 -0
  132. package/scripts/healthbench_professional_run.py +112 -0
  133. package/scripts/mlcr-run.sh +17 -0
  134. package/scripts/mlcr_run.py +133 -0
  135. package/scripts/prbench-run.sh +39 -0
  136. package/scripts/prbench_run.py +53 -0
  137. package/scripts/verify-packed-consumer.mjs +32 -27
  138. package/scripts/verify-pier-agent.mts +142 -25
  139. package/src/adapters.ts +5 -7
  140. package/src/benchmarks/_harness.test.mts +18 -1
  141. package/src/benchmarks/_harness.ts +12 -7
  142. package/src/benchmarks/aec-bench.test.mts +14 -14
  143. package/src/benchmarks/aec-bench.ts +62 -56
  144. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  145. package/src/benchmarks/agentbench.ts +44 -37
  146. package/src/benchmarks/appworld.test.mts +7 -7
  147. package/src/benchmarks/appworld.ts +88 -75
  148. package/src/benchmarks/bfcl.ts +60 -53
  149. package/src/benchmarks/cad-design.ts +34 -32
  150. package/src/benchmarks/cadbench.ts +34 -32
  151. package/src/benchmarks/cadgenbench.ts +30 -28
  152. package/src/benchmarks/commit0.test.mts +9 -9
  153. package/src/benchmarks/commit0.ts +50 -43
  154. package/src/benchmarks/crag.ts +45 -40
  155. package/src/benchmarks/dabstep-official.test.mts +8 -8
  156. package/src/benchmarks/dabstep.test.mts +11 -11
  157. package/src/benchmarks/dabstep.ts +47 -40
  158. package/src/benchmarks/external-adapters.test.mts +43 -44
  159. package/src/benchmarks/finresearchbench.ts +57 -47
  160. package/src/benchmarks/finsearchcomp.ts +72 -67
  161. package/src/benchmarks/frames.ts +76 -69
  162. package/src/benchmarks/hotpotqa.ts +69 -64
  163. package/src/benchmarks/humaneval.ts +37 -35
  164. package/src/benchmarks/mcad-bench.test.mts +30 -30
  165. package/src/benchmarks/mcad-bench.ts +66 -60
  166. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  167. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  168. package/src/benchmarks/mcad-cq.test.mts +40 -40
  169. package/src/benchmarks/mcad-golds.ts +1 -1
  170. package/src/benchmarks/mind2web.ts +66 -58
  171. package/src/benchmarks/nomiracl.ts +53 -46
  172. package/src/benchmarks/open-rag-bench.ts +47 -42
  173. package/src/benchmarks/programbench.test.mts +10 -10
  174. package/src/benchmarks/programbench.ts +38 -33
  175. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  176. package/src/benchmarks/rag-shared.ts +13 -16
  177. package/src/benchmarks/ragbench.ts +44 -39
  178. package/src/benchmarks/simpleqa.ts +78 -73
  179. package/src/benchmarks/swe-bench.test.mts +3 -3
  180. package/src/benchmarks/swe-bench.ts +66 -61
  181. package/src/benchmarks/t2-ragbench.ts +47 -42
  182. package/src/benchmarks/tau-bench-shared.ts +51 -44
  183. package/src/benchmarks/tau-pin.test.mts +1 -1
  184. package/src/benchmarks/tau2-bench.ts +2 -2
  185. package/src/benchmarks/tau3-banking.ts +2 -2
  186. package/src/benchmarks/terminal-bench.test.mts +3 -3
  187. package/src/benchmarks/terminal-bench.ts +41 -36
  188. package/src/benchmarks/toollm.ts +54 -47
  189. package/src/benchmarks/trata-hedge.ts +57 -52
  190. package/src/benchmarks/types.ts +70 -59
  191. package/src/benchmarks/webarena-verified.ts +49 -42
  192. package/src/cli.ts +74 -0
  193. package/src/corpus-replay.mts +9 -9
  194. package/src/examples/benchmark-matrix.mts +13 -10
  195. package/src/gate-cli.mts +5 -5
  196. package/src/gate.test.mts +14 -12
  197. package/src/gate.ts +23 -22
  198. package/src/index.ts +20 -11
  199. package/src/pier-agent.ts +108 -38
  200. package/src/pier-trial-controller.test.mts +48 -1
  201. package/src/pier-trial-controller.ts +121 -8
  202. package/src/published.test.mts +534 -0
  203. package/src/published.ts +524 -0
  204. package/src/run-benchmarks-cli.mts +2 -2
  205. package/src/run-benchmarks.test.mts +58 -48
  206. package/src/run-benchmarks.ts +64 -57
  207. package/src/swe-bench-env.ts +6 -6
  208. package/src/worker.ts +1 -1
  209. package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
  210. package/dist/benchmarks/enterpriseops-gym.js +0 -236
  211. package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
  212. package/dist/cadbench-Byr5gO1M.js.map +0 -1
  213. package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
  214. package/fixtures/enterpriseops-gym.json +0 -103
  215. package/scripts/enterpriseops_gym_judge.py +0 -281
  216. package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
  217. package/src/benchmarks/enterpriseops-gym.ts +0 -343
  218. package/src/eops-skills/address-every-subtask.md +0 -5
  219. package/src/eops-skills/exact-tools-and-args.md +0 -5
  220. package/src/eops-skills/full-sequence-to-goal.md +0 -5
  221. package/src/eops-skills/ground-every-value.md +0 -5
  222. package/src/eops-skills/honor-the-policies.md +0 -5
@@ -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
  }
@@ -79,20 +79,20 @@ test('DABSTEP_DATASET_CSV lets the checkout and the released rows live apart, en
79
79
  { DABSTEP_FIXTURES: undefined, DABSTEP_DIR: dir, DABSTEP_DATASET_CSV: dataset },
80
80
  async () => {
81
81
  const adapter = createDabstepAdapter()
82
- await adapter.preflight()
83
- const tasks = await adapter.loadTasks({ split: 'easy' })
82
+ await adapter.runtime.preflight!()
83
+ const tasks = await adapter.loadAll({ subset: 'easy' })
84
84
  assert.deepEqual(
85
85
  tasks.map((task) => task.id),
86
86
  ['7', '8'],
87
87
  )
88
88
  const meta = tasks[0].metadata as Record<string, unknown>
89
89
  assert.equal(meta.resourceRoot, join(dir, 'files'))
90
- assert.equal(await adapter.goldArtifact(tasks[0]), '42')
91
- const pass = await adapter.judge(tasks[0], '42')
92
- assert.equal(pass.resolved, true)
90
+ assert.equal(await adapter.runtime.goldArtifact!(tasks[0]), '42')
91
+ const pass = await adapter.evaluate(tasks[0], '42')
92
+ assert.equal(pass.passed, true)
93
93
  assert.equal(pass.score, 1)
94
- const fail = await adapter.judge(tasks[0], 'dog')
95
- assert.equal(fail.resolved, false)
94
+ const fail = await adapter.evaluate(tasks[0], 'dog')
95
+ assert.equal(fail.passed, false)
96
96
  assert.equal(fail.score, 0)
97
97
  },
98
98
  )
@@ -108,7 +108,7 @@ test('a relative DABSTEP_DATASET_CSV is refused before any load', async () => {
108
108
  await withEnv(
109
109
  { DABSTEP_FIXTURES: undefined, DABSTEP_DIR: dir, DABSTEP_DATASET_CSV: 'relative/dataset.csv' },
110
110
  async () => {
111
- await assert.rejects(() => createDabstepAdapter().preflight(), /DABSTEP_DATASET_CSV must be an absolute path/)
111
+ await assert.rejects(() => createDabstepAdapter().runtime.preflight!(), /DABSTEP_DATASET_CSV must be an absolute path/)
112
112
  },
113
113
  )
114
114
  } finally {
@@ -15,12 +15,12 @@ process.env.DABSTEP_FIXTURES = '1'
15
15
  type Events = Parameters<typeof dabstepAnswerOutput.parse>[0]
16
16
  const stream = (text: string): Events => [{ data: { finalText: text } }] as unknown as Events
17
17
 
18
- test('loadTasks fixtures expose DABStep prompt and resource metadata shape', async () => {
18
+ test('loadAll fixtures expose DABStep prompt and resource metadata shape', async () => {
19
19
  const adapter = createDabstepAdapter()
20
- const tasks = await adapter.loadTasks({ ids: ['1'] })
20
+ const tasks = await adapter.loadAll({ ids: ['1'] })
21
21
  assert.equal(tasks.length, 1)
22
22
  assert.equal(tasks[0].id, '1')
23
- assert.match(tasks[0].prompt, /DABStep data-analysis task/)
23
+ assert.match(tasks[0].payload.prompt, /DABStep data-analysis task/)
24
24
  const meta = tasks[0].metadata as Record<string, unknown>
25
25
  assert.equal(meta.taskId, 1)
26
26
  assert.equal(Array.isArray(meta.golds), true)
@@ -33,25 +33,25 @@ test('answer OutputAdapter extracts final fenced answer when present', () => {
33
33
 
34
34
  test('goldArtifact exposes the fixture oracle without scoring it as a benchmark result', async () => {
35
35
  const adapter = createDabstepAdapter()
36
- const [task] = await adapter.loadTasks({ ids: ['1'] })
37
- const gold = await adapter.goldArtifact(task)
36
+ const [task] = await adapter.loadAll({ ids: ['1'] })
37
+ const gold = await adapter.runtime.goldArtifact!(task)
38
38
  assert.equal(gold, '42')
39
39
  })
40
40
 
41
- test('judge fails loud without an official DABSTEP_DIR/grade.py', async () => {
41
+ test('evaluate fails loud without an official DABSTEP_DIR/grade.py', async () => {
42
42
  const adapter = createDabstepAdapter()
43
- const [task] = await adapter.loadTasks({ ids: ['1'] })
43
+ const [task] = await adapter.loadAll({ ids: ['1'] })
44
44
  delete process.env.DABSTEP_DIR
45
- await assert.rejects(adapter.judge(task, '42'), /DABSTEP_DIR is required/)
45
+ await assert.rejects(adapter.evaluate(task, '42'), /DABSTEP_DIR is required/)
46
46
  })
47
47
 
48
48
  test('preflight is fixture-safe and live mode fails loud without DABSTEP_DIR', async () => {
49
49
  const fixtureAdapter = createDabstepAdapter()
50
- await fixtureAdapter.preflight()
50
+ await fixtureAdapter.runtime.preflight!()
51
51
  delete process.env.DABSTEP_FIXTURES
52
52
  delete process.env.DABSTEP_DIR
53
53
  const liveAdapter = createDabstepAdapter()
54
- await assert.rejects(liveAdapter.preflight(), /DABSTEP_DIR is required/)
54
+ await assert.rejects(liveAdapter.runtime.preflight!(), /DABSTEP_DIR is required/)
55
55
  process.env.DABSTEP_FIXTURES = '1'
56
56
  })
57
57
 
@@ -61,7 +61,7 @@ test('live preflight fails loud when the checkout is missing released dataset.cs
61
61
  process.env.DABSTEP_DIR = dir
62
62
  try {
63
63
  const adapter = createDabstepAdapter()
64
- await assert.rejects(adapter.preflight(), /released dataset\.csv/)
64
+ await assert.rejects(adapter.runtime.preflight!(), /released dataset\.csv/)
65
65
  } finally {
66
66
  process.env.DABSTEP_FIXTURES = '1'
67
67
  delete process.env.DABSTEP_DIR
@@ -17,7 +17,7 @@ import { isAbsolute, join } from 'node:path'
17
17
  import { access, readFile, stat } from 'node:fs/promises'
18
18
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
19
19
  import { benchRoot, runVenvPython, runVenvScriptStdin } from './_harness'
20
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
20
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
21
21
 
22
22
  const FIXTURES = join(benchRoot, 'fixtures', 'dabstep.json')
23
23
  const DEFAULT_SPLIT = 'easy'
@@ -114,13 +114,15 @@ function rowToTask(row: DabstepFixtureRow, split: string, dir?: string): BenchTa
114
114
  }
115
115
  return {
116
116
  id: String(row.task_id),
117
- split,
118
- prompt: [
119
- 'Solve this DABStep data-analysis task using the mounted payment files.',
120
- 'Use code or shell commands as needed, then return only the final answer.',
121
- '',
122
- row.instructions,
123
- ].join('\n'),
117
+ payload: {
118
+ subset: split,
119
+ prompt: [
120
+ 'Solve this DABStep data-analysis task using the mounted payment files.',
121
+ 'Use code or shell commands as needed, then return only the final answer.',
122
+ '',
123
+ row.instructions,
124
+ ].join('\n'),
125
+ },
124
126
  metadata: meta as unknown as Record<string, unknown>,
125
127
  }
126
128
  }
@@ -128,7 +130,7 @@ function rowToTask(row: DabstepFixtureRow, split: string, dir?: string): BenchTa
128
130
  function readMeta(task: BenchTask): DabstepMeta {
129
131
  const md = task.metadata
130
132
  if (!md || typeof md.taskId !== 'number' || !Array.isArray(md.golds)) {
131
- throw new Error(`dabstep task ${task.id} missing metadata — loadTasks did not populate it`)
133
+ throw new Error(`dabstep task ${task.id} missing metadata — loadAll did not populate it`)
132
134
  }
133
135
  return md as unknown as DabstepMeta
134
136
  }
@@ -196,43 +198,21 @@ print(json.dumps(out))
196
198
  return selectRows(JSON.parse(stdout) as DabstepFixtureRow[], opts, split, dir)
197
199
  }
198
200
 
199
- export function createDabstepAdapter(): BenchmarkAdapter {
201
+ export function createDabstepAdapter(): RuntimeBenchmark {
200
202
  const fixturesMode = process.env.DABSTEP_FIXTURES === '1'
201
203
 
202
- return {
203
- name: 'dabstep',
204
- output: dabstepAnswerOutput,
205
-
206
- async preflight() {
207
- if (fixturesMode) return
208
- const dir = dabstepDir()
209
- if (!dir) {
210
- throw new Error(
211
- 'DABSTEP_DIR is required. Fix: clone https://github.com/EnvCommons/DABStep and set DABSTEP_DIR=/path/to/DABStep. ' +
212
- datasetAcquisitionHint,
213
- )
214
- }
215
- await assertOfficialFiles(dir, DEFAULT_SPLIT)
216
- await loadOfficialTasks(dir, { limit: 1 }, DEFAULT_SPLIT)
217
- },
204
+ return runtimeBenchmark({
205
+ id: 'dabstep',
218
206
 
219
- async loadTasks(opts: LoadOptions = {}) {
220
- const split = opts.split ?? DEFAULT_SPLIT
207
+ async loadAll(opts: LoadOptions = {}) {
208
+ const split = opts.subset ?? DEFAULT_SPLIT
221
209
  if (fixturesMode) return loadFixtures(opts, split)
222
210
  const dir = dabstepDir()
223
211
  if (!dir) throw new Error('DABSTEP_DIR is required to load official DABStep tasks')
224
212
  return loadOfficialTasks(dir, opts, split)
225
213
  },
226
214
 
227
- async goldArtifact(task: BenchTask) {
228
- const meta = readMeta(task)
229
- const first = meta.golds[0]
230
- if (!first) return undefined
231
- const value = first.value
232
- return value === undefined ? undefined : String(value)
233
- },
234
-
235
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
215
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
236
216
  const meta = readMeta(task)
237
217
  const dir = dabstepDir()
238
218
  if (!dir) throw new Error('DABSTEP_DIR is required to judge DABStep tasks with the official grade.py')
@@ -245,11 +225,38 @@ export function createDabstepAdapter(): BenchmarkAdapter {
245
225
  const report = JSON.parse(stdout.trim().split('\n').at(-1) ?? '{}') as { correct?: boolean; score?: number; error?: string }
246
226
  if (report.error) throw new Error(`DABStep judge error for ${task.id}: ${report.error}`)
247
227
  const score = typeof report.score === 'number' ? report.score : 0
228
+ const raw = { taskId: meta.taskId, split: meta.split, correct: report.correct }
248
229
  return {
249
- resolved: report.correct === true,
230
+ passed: report.correct === true,
250
231
  score,
251
- detail: JSON.stringify({ taskId: meta.taskId, split: meta.split, correct: report.correct }),
232
+ notes: JSON.stringify(raw),
233
+ raw,
252
234
  }
253
235
  },
254
- }
236
+
237
+ runtime: {
238
+ output: dabstepAnswerOutput,
239
+
240
+ async preflight() {
241
+ if (fixturesMode) return
242
+ const dir = dabstepDir()
243
+ if (!dir) {
244
+ throw new Error(
245
+ 'DABSTEP_DIR is required. Fix: clone https://github.com/EnvCommons/DABStep and set DABSTEP_DIR=/path/to/DABStep. ' +
246
+ datasetAcquisitionHint,
247
+ )
248
+ }
249
+ await assertOfficialFiles(dir, DEFAULT_SPLIT)
250
+ await loadOfficialTasks(dir, { limit: 1 }, DEFAULT_SPLIT)
251
+ },
252
+
253
+ async goldArtifact(task: BenchTask) {
254
+ const meta = readMeta(task)
255
+ const first = meta.golds[0]
256
+ if (!first) return undefined
257
+ const value = first.value
258
+ return value === undefined ? undefined : String(value)
259
+ },
260
+ },
261
+ })
255
262
  }