@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
@@ -30,7 +30,7 @@ async function withEnv<T>(patch: Record<string, string | undefined>, fn: () => P
30
30
 
31
31
  test('RAG benchmark adapters are registered', () => {
32
32
  for (const key of ['ragbench', 'crag', 'nomiracl', 'open-rag-bench', 't2-ragbench']) {
33
- assert.equal(resolveAdapter(key).name, key)
33
+ assert.equal(resolveAdapter(key).id, key)
34
34
  }
35
35
  })
36
36
 
@@ -51,50 +51,50 @@ test('RAG JSON reader accepts object-starting JSONL exports', async () => {
51
51
  test('RAGBench fixture mode loads rows and scores final answers', async () => {
52
52
  await withEnv({ RAGBENCH_FIXTURES: '1', RAGBENCH_DATA_FILE: undefined }, async () => {
53
53
  const adapter = createRagBenchAdapter()
54
- await adapter.preflight()
55
- const [task] = await adapter.loadTasks({ limit: 1 })
54
+ await adapter.runtime.preflight!()
55
+ const [task] = await adapter.loadAll({ limit: 1 })
56
56
  assert.equal(task.id, 'ragbench-fixture-0')
57
- const gold = await adapter.goldArtifact(task)
58
- assert.equal((await adapter.judge(task, gold ?? '')).resolved, true)
59
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} 90 days`)).resolved, false)
57
+ const gold = await adapter.runtime.goldArtifact!(task)
58
+ assert.equal((await adapter.evaluate(task, gold ?? '')).passed, true)
59
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 90 days`)).passed, false)
60
60
  })
61
61
 
62
62
  await withEnv({ RAGBENCH_FIXTURES: undefined, RAGBENCH_DATA_FILE: undefined }, async () => {
63
- await assert.rejects(() => createRagBenchAdapter().preflight(), /RAGBENCH_DATA_FILE is required/)
63
+ await assert.rejects(() => createRagBenchAdapter().runtime.preflight!(), /RAGBENCH_DATA_FILE is required/)
64
64
  })
65
65
  })
66
66
 
67
67
  test('CRAG fixture mode exposes domain slices and answer judging', async () => {
68
68
  await withEnv({ CRAG_FIXTURES: '1', CRAG_DATA_FILE: undefined }, async () => {
69
69
  const adapter = createCragAdapter()
70
- await adapter.preflight()
71
- const [task] = await adapter.loadTasks({ limit: 1 })
72
- assert.equal(task.split, 'finance')
73
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} 12.4 billion dollars`)).score, 1)
74
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} 9 billion dollars`)).resolved, false)
70
+ await adapter.runtime.preflight!()
71
+ const [task] = await adapter.loadAll({ limit: 1 })
72
+ assert.equal(task.payload.subset, 'finance')
73
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 12.4 billion dollars`)).score, 1)
74
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 9 billion dollars`)).passed, false)
75
75
  })
76
76
 
77
77
  await withEnv({ CRAG_FIXTURES: undefined, CRAG_DATA_FILE: undefined }, async () => {
78
- await assert.rejects(() => createCragAdapter().preflight(), /CRAG_DATA_FILE is required/)
78
+ await assert.rejects(() => createCragAdapter().runtime.preflight!(), /CRAG_DATA_FILE is required/)
79
79
  })
80
80
  })
81
81
 
82
82
  test('NoMIRACL fixture mode scores answerable and unanswerable classifications', async () => {
83
83
  await withEnv({ NOMIRACL_FIXTURES: '1', NOMIRACL_DATA_FILE: undefined }, async () => {
84
84
  const adapter = createNoMiraclAdapter()
85
- await adapter.preflight()
86
- const tasks = await adapter.loadTasks({})
85
+ await adapter.runtime.preflight!()
86
+ const tasks = await adapter.loadAll({})
87
87
  const relevant = tasks.find((task) => task.id === 'nomiracl-fixture-relevant')
88
88
  const nonRelevant = tasks.find((task) => task.id === 'nomiracl-fixture-non-relevant')
89
89
  assert.ok(relevant)
90
90
  assert.ok(nonRelevant)
91
- assert.equal((await adapter.judge(relevant, 'ANSWERABLE')).score, 1)
92
- assert.equal((await adapter.judge(nonRelevant, 'UNANSWERABLE')).score, 1)
93
- assert.equal((await adapter.judge(nonRelevant, 'ANSWERABLE')).score, 0)
91
+ assert.equal((await adapter.evaluate(relevant, 'ANSWERABLE')).score, 1)
92
+ assert.equal((await adapter.evaluate(nonRelevant, 'UNANSWERABLE')).score, 1)
93
+ assert.equal((await adapter.evaluate(nonRelevant, 'ANSWERABLE')).score, 0)
94
94
  })
95
95
 
96
96
  await withEnv({ NOMIRACL_FIXTURES: undefined, NOMIRACL_DATA_FILE: undefined }, async () => {
97
- await assert.rejects(() => createNoMiraclAdapter().preflight(), /NOMIRACL_DATA_FILE is required/)
97
+ await assert.rejects(() => createNoMiraclAdapter().runtime.preflight!(), /NOMIRACL_DATA_FILE is required/)
98
98
  })
99
99
  })
100
100
 
@@ -103,11 +103,11 @@ test('Open RAG Bench fixture mode keeps PDF modality metadata and scores answers
103
103
  { OPEN_RAG_BENCH_FIXTURES: '1', OPEN_RAG_BENCH_DATA_FILE: undefined },
104
104
  async () => {
105
105
  const adapter = createOpenRagBenchAdapter()
106
- await adapter.preflight()
107
- const [task] = await adapter.loadTasks({ limit: 1 })
108
- assert.equal(task.split, 'table')
109
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} Hybrid BM25`)).resolved, true)
110
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} Dense`)).resolved, false)
106
+ await adapter.runtime.preflight!()
107
+ const [task] = await adapter.loadAll({ limit: 1 })
108
+ assert.equal(task.payload.subset, 'table')
109
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} Hybrid BM25`)).passed, true)
110
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} Dense`)).passed, false)
111
111
  },
112
112
  )
113
113
 
@@ -115,7 +115,7 @@ test('Open RAG Bench fixture mode keeps PDF modality metadata and scores answers
115
115
  { OPEN_RAG_BENCH_FIXTURES: undefined, OPEN_RAG_BENCH_DATA_FILE: undefined },
116
116
  async () => {
117
117
  await assert.rejects(
118
- () => createOpenRagBenchAdapter().preflight(),
118
+ () => createOpenRagBenchAdapter().runtime.preflight!(),
119
119
  /OPEN_RAG_BENCH_DATA_FILE is required/,
120
120
  )
121
121
  },
@@ -125,14 +125,14 @@ test('Open RAG Bench fixture mode keeps PDF modality metadata and scores answers
125
125
  test('T2-RAGBench fixture mode scores numeric text-table answers', async () => {
126
126
  await withEnv({ T2_RAGBENCH_FIXTURES: '1', T2_RAGBENCH_DATA_FILE: undefined }, async () => {
127
127
  const adapter = createT2RagBenchAdapter()
128
- await adapter.preflight()
129
- const [task] = await adapter.loadTasks({ limit: 1 })
130
- assert.equal(task.split, 'finqa')
131
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} 12.0 percent`)).resolved, true)
132
- assert.equal((await adapter.judge(task, `${FINAL_ANSWER_SENTINEL} 8 percent`)).resolved, false)
128
+ await adapter.runtime.preflight!()
129
+ const [task] = await adapter.loadAll({ limit: 1 })
130
+ assert.equal(task.payload.subset, 'finqa')
131
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 12.0 percent`)).passed, true)
132
+ assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 8 percent`)).passed, false)
133
133
  })
134
134
 
135
135
  await withEnv({ T2_RAGBENCH_FIXTURES: undefined, T2_RAGBENCH_DATA_FILE: undefined }, async () => {
136
- await assert.rejects(() => createT2RagBenchAdapter().preflight(), /T2_RAGBENCH_DATA_FILE is required/)
136
+ await assert.rejects(() => createT2RagBenchAdapter().runtime.preflight!(), /T2_RAGBENCH_DATA_FILE is required/)
137
137
  })
138
138
  })
@@ -1,6 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises'
2
2
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
3
- import type { BenchScore, BenchTask, LoadOptions } from './types'
3
+ import type { BenchEvaluation, BenchTask, LoadOptions } from './types'
4
4
 
5
5
  export const FINAL_ANSWER_SENTINEL = 'FINAL ANSWER:'
6
6
 
@@ -168,23 +168,20 @@ export function scoreAnswerArtifact(
168
168
  return best
169
169
  }
170
170
 
171
- export function answerScoreToBenchScore(
171
+ export function answerScoreToEvaluation(
172
172
  score: RagAnswerScore,
173
173
  detail: Record<string, unknown>,
174
- ): BenchScore {
175
- return {
176
- resolved: score.resolved,
177
- score: score.score,
178
- detail: JSON.stringify({
179
- ...detail,
180
- finalAnswer: score.finalAnswer,
181
- bestGold: score.bestGold,
182
- exact: score.exact,
183
- numeric: score.numeric,
184
- f1: score.f1,
185
- threshold: score.threshold,
186
- }),
174
+ ): BenchEvaluation {
175
+ const raw = {
176
+ ...detail,
177
+ finalAnswer: score.finalAnswer,
178
+ bestGold: score.bestGold,
179
+ exact: score.exact,
180
+ numeric: score.numeric,
181
+ f1: score.f1,
182
+ threshold: score.threshold,
187
183
  }
184
+ return { passed: score.resolved, score: score.score, notes: JSON.stringify(raw), raw }
188
185
  }
189
186
 
190
187
  export async function readJsonRows(path: string): Promise<unknown[]> {
@@ -219,7 +216,7 @@ export async function readJsonRows(path: string): Promise<unknown[]> {
219
216
 
220
217
  export function selectTasks(tasks: BenchTask[], opts: LoadOptions, label: string): BenchTask[] {
221
218
  let selected = tasks
222
- if (opts.split) selected = selected.filter((task) => task.split === opts.split)
219
+ if (opts.subset) selected = selected.filter((task) => task.payload.subset === opts.subset)
223
220
  if (opts.ids) {
224
221
  const ids = new Set(opts.ids)
225
222
  selected = selected.filter((task) => ids.has(task.id))
@@ -11,11 +11,11 @@
11
11
  import { readFile } from 'node:fs/promises'
12
12
  import { join } from 'node:path'
13
13
  import { benchRoot } from './_harness'
14
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
14
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
15
15
  import {
16
16
  FINAL_ANSWER_SENTINEL,
17
17
  allStrings,
18
- answerScoreToBenchScore,
18
+ answerScoreToEvaluation,
19
19
  contextBlock,
20
20
  contextsFrom,
21
21
  firstString,
@@ -91,16 +91,18 @@ function rowToTask(raw: unknown, index: number): BenchTask {
91
91
  }
92
92
  return {
93
93
  id,
94
- split: stringFrom(raw.split) ?? dataset ?? 'ragbench',
95
- prompt: [
96
- 'Answer this RAGBench question using the supplied retrieved context.',
97
- 'End with a single final line: `FINAL ANSWER: <answer>`.',
98
- '',
99
- `Question: ${query}`,
100
- contexts.length > 0 ? `\nRetrieved context:\n${contextBlock(contexts)}` : undefined,
101
- ]
102
- .filter(Boolean)
103
- .join('\n'),
94
+ payload: {
95
+ subset: stringFrom(raw.split) ?? dataset ?? 'ragbench',
96
+ prompt: [
97
+ 'Answer this RAGBench question using the supplied retrieved context.',
98
+ 'End with a single final line: `FINAL ANSWER: <answer>`.',
99
+ '',
100
+ `Question: ${query}`,
101
+ contexts.length > 0 ? `\nRetrieved context:\n${contextBlock(contexts)}` : undefined,
102
+ ]
103
+ .filter(Boolean)
104
+ .join('\n'),
105
+ },
104
106
  metadata: meta as unknown as Record<string, unknown>,
105
107
  }
106
108
  }
@@ -108,7 +110,7 @@ function rowToTask(raw: unknown, index: number): BenchTask {
108
110
  function readMeta(task: BenchTask): RagBenchMeta {
109
111
  const md = task.metadata
110
112
  if (!md || !Array.isArray(md.goldAnswers)) {
111
- throw new Error(`RAGBench task ${task.id} missing metadata — loadTasks did not populate it`)
113
+ throw new Error(`RAGBench task ${task.id} missing metadata — loadAll did not populate it`)
112
114
  }
113
115
  return md as unknown as RagBenchMeta
114
116
  }
@@ -125,47 +127,50 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
125
127
  return selectTasks(rows.map(rowToTask), opts, 'RAGBench')
126
128
  }
127
129
 
128
- export function createRagBenchAdapter(): BenchmarkAdapter {
130
+ export function createRagBenchAdapter(): RuntimeBenchmark {
129
131
  const fixturesMode = process.env.RAGBENCH_FIXTURES === '1'
130
132
 
131
- return {
132
- name: 'ragbench',
133
- output: ragAnswerOutput,
134
-
135
- async preflight() {
136
- if (fixturesMode) {
137
- await readFile(FIXTURES, 'utf8')
138
- return
139
- }
140
- const path = dataFile()
141
- if (!path) {
142
- throw new Error(
143
- 'RAGBENCH_DATA_FILE is required. Fix: export rungalileo/ragbench rows to JSONL and set RAGBENCH_DATA_FILE=/path/to/ragbench.jsonl, or set RAGBENCH_FIXTURES=1 for adapter plumbing.',
144
- )
145
- }
146
- await loadRows(path)
147
- },
133
+ return runtimeBenchmark({
134
+ id: 'ragbench',
148
135
 
149
- async loadTasks(opts: LoadOptions = {}) {
136
+ async loadAll(opts: LoadOptions = {}) {
150
137
  if (fixturesMode) return loadFixtures(opts)
151
138
  const path = dataFile()
152
139
  if (!path) throw new Error('RAGBENCH_DATA_FILE is required to load RAGBench tasks')
153
140
  return selectTasks((await loadRows(path)).map(rowToTask), opts, 'RAGBench')
154
141
  },
155
142
 
156
- async goldArtifact(task: BenchTask) {
157
- return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
158
- },
159
-
160
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
143
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
161
144
  const meta = readMeta(task)
162
145
  const score = scoreAnswerArtifact(artifact, meta.goldAnswers)
163
- return answerScoreToBenchScore(score, {
146
+ return answerScoreToEvaluation(score, {
164
147
  benchmark: meta.benchmark,
165
148
  dataset: meta.dataset ?? null,
166
149
  traceLabels: meta.traceLabels,
167
150
  contextCount: meta.contexts.length,
168
151
  })
169
152
  },
170
- }
153
+
154
+ runtime: {
155
+ output: ragAnswerOutput,
156
+
157
+ async preflight() {
158
+ if (fixturesMode) {
159
+ await readFile(FIXTURES, 'utf8')
160
+ return
161
+ }
162
+ const path = dataFile()
163
+ if (!path) {
164
+ throw new Error(
165
+ 'RAGBENCH_DATA_FILE is required. Fix: export rungalileo/ragbench rows to JSONL and set RAGBENCH_DATA_FILE=/path/to/ragbench.jsonl, or set RAGBENCH_FIXTURES=1 for adapter plumbing.',
166
+ )
167
+ }
168
+ await loadRows(path)
169
+ },
170
+
171
+ async goldArtifact(task: BenchTask) {
172
+ return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
173
+ },
174
+ },
175
+ })
171
176
  }
@@ -9,12 +9,12 @@
9
9
  * A = CORRECT — fully contains the gold, no contradiction
10
10
  * B = INCORRECT — contradicts / contains a different factual value
11
11
  * C = NOT_ATTEMPTED — hedged, non-committal, or no value given
12
- * resolved = (grade == CORRECT). score = 1 for CORRECT else 0. The grade letter
13
- * (with its label) rides in `detail`; NOT_ATTEMPTED is surfaced distinctly from
12
+ * passed = (grade == CORRECT). score = 1 for CORRECT else 0. The grade letter
13
+ * (with its label) rides in `notes`; NOT_ATTEMPTED is surfaced distinctly from
14
14
  * INCORRECT so the scorecard can separate abstention from error.
15
15
  *
16
16
  * There is no deterministic tier: SimpleQA's rubric (containment + abstention)
17
- * is the grader's job by design, so judge() always calls the pinned grader model
17
+ * is the grader's job by design, so evaluate() always calls the pinned grader model
18
18
  * (temperature 0) and fails loud on unparseable grader output. The final-answer
19
19
  * extraction IS deterministic (FINAL ANSWER: sentinel, fail-closed to '').
20
20
  *
@@ -32,7 +32,7 @@ import { fileURLToPath } from 'node:url'
32
32
  import { promisify } from 'node:util'
33
33
  import { runBenchRouterTurn } from '../router-turn'
34
34
  import { FINAL_ANSWER_SENTINEL, parseCitations, parseFinalAnswer } from './rag-shared'
35
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
35
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
36
36
 
37
37
  const execFileAsync = promisify(execFile)
38
38
  const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
@@ -206,8 +206,7 @@ function rowToTask(row: SimpleQaRow, index: number): BenchTask {
206
206
  }
207
207
  return {
208
208
  id: `simpleqa-${index}`,
209
- split: 'test',
210
- prompt: row.problem + WORKER_CONTRACT,
209
+ payload: { prompt: row.problem + WORKER_CONTRACT, subset: 'test' },
211
210
  metadata: meta as unknown as Record<string, unknown>,
212
211
  }
213
212
  }
@@ -215,7 +214,7 @@ function rowToTask(row: SimpleQaRow, index: number): BenchTask {
215
214
  function readMeta(task: BenchTask): SimpleQaMeta {
216
215
  const md = task.metadata
217
216
  if (!md || typeof md.gold !== 'string' || typeof md.question !== 'string') {
218
- throw new Error(`SimpleQA task ${task.id} missing metadata.gold/question — loadTasks did not populate it`)
217
+ throw new Error(`SimpleQA task ${task.id} missing metadata.gold/question — loadAll did not populate it`)
219
218
  }
220
219
  return md as unknown as SimpleQaMeta
221
220
  }
@@ -239,7 +238,7 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
239
238
  * Load the live test set: fetch the public CSV via the bench venv python, parse
240
239
  * with `csv` (handles quoted/embedded-comma fields) and `ast.literal_eval` for
241
240
  * the python-repr `metadata` dict. Emits the same normalized SimpleQaRow shape
242
- * the fixtures use, so loadTasks/judge share one parse path.
241
+ * the fixtures use, so loadAll/evaluate share one parse path.
243
242
  */
244
243
  async function loadLive(opts: LoadOptions): Promise<BenchTask[]> {
245
244
  const script = `
@@ -265,94 +264,100 @@ print(json.dumps(out))
265
264
  return selectTasks(rows.map(rowToTask), opts)
266
265
  }
267
266
 
268
- export function createSimpleQaAdapter(): BenchmarkAdapter {
267
+ export function createSimpleQaAdapter(): RuntimeBenchmark {
269
268
  const fixturesMode = process.env.SIMPLEQA_FIXTURES === '1'
270
269
 
271
- return {
272
- name: 'simpleqa',
273
-
274
- async preflight() {
275
- // The grader router must be configured in both modes — SimpleQA's score is
276
- // defined by the grader, so a run without it is meaningless.
277
- graderRouter()
278
- if (fixturesMode) {
279
- await readFile(FIXTURES, 'utf8').catch((err) => {
280
- throw new Error(
281
- `SIMPLEQA_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
282
- )
283
- })
284
- return
285
- }
286
- try {
287
- await py(
288
- `from urllib.request import urlopen
289
- with urlopen(${JSON.stringify(DATASET_URL)}, timeout=120) as resp:
290
- head = resp.read(64).decode('utf-8', 'replace')
291
- assert head.startswith('metadata,problem,answer'), 'unexpected CSV header: ' + head[:40]
292
- print('ok')`,
293
- )
294
- } catch (err) {
295
- const msg = err instanceof Error ? err.message : String(err)
296
- throw new Error(
297
- `simpleqa preflight failed: ${msg}\n` +
298
- `Fix: (1) ensure the bench venv exists (python3 -m venv bench/.venv) ; ` +
299
- `(2) ensure network access to ${DATASET_URL} ; ` +
300
- `or set SIMPLEQA_FIXTURES=1 to run against the committed fixtures offline.`,
301
- )
302
- }
303
- },
270
+ return runtimeBenchmark({
271
+ id: 'simpleqa',
304
272
 
305
- async loadTasks(opts: LoadOptions = {}) {
273
+ async loadAll(opts: LoadOptions = {}) {
306
274
  if (fixturesMode) return loadFixtures(opts)
307
275
  return loadLive(opts)
308
276
  },
309
277
 
310
- async goldArtifact(task: BenchTask) {
311
- // Gold artifact = the worker-contract serialization of the gold answer, so
312
- // verify-judge proves gold→CORRECT through the SAME parse path the real
313
- // artifact takes.
314
- const meta = readMeta(task)
315
- return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
316
- },
317
-
318
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
278
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
319
279
  const meta = readMeta(task)
320
280
  const finalAnswer = parseFinalAnswer(artifact)
321
281
  const citations = parseCitations(artifact)
322
282
 
323
283
  if (finalAnswer.length === 0) {
324
284
  // No parseable value committed — NOT_ATTEMPTED by construction, no grader call.
285
+ const raw = {
286
+ grade: 'NOT_ATTEMPTED',
287
+ gradeLetter: 'C',
288
+ reason: 'no parseable answer',
289
+ gold: meta.gold,
290
+ topic: meta.topic,
291
+ answerType: meta.answerType,
292
+ citationCount: citations.length,
293
+ }
325
294
  return {
326
- resolved: false,
295
+ passed: false,
327
296
  score: 0,
328
- detail: JSON.stringify({
329
- grade: 'NOT_ATTEMPTED',
330
- gradeLetter: 'C',
331
- reason: 'no parseable answer',
332
- gold: meta.gold,
333
- topic: meta.topic,
334
- answerType: meta.answerType,
335
- citationCount: citations.length,
336
- }),
297
+ notes: JSON.stringify(raw),
298
+ raw,
337
299
  }
338
300
  }
339
301
 
340
302
  const grade = await gradeAnswer(meta.question, meta.gold, finalAnswer, graderRouter())
341
303
  const gradeLetter = grade === 'CORRECT' ? 'A' : grade === 'INCORRECT' ? 'B' : 'C'
342
304
  const resolved = grade === 'CORRECT'
305
+ const raw = {
306
+ grade,
307
+ gradeLetter,
308
+ gold: meta.gold,
309
+ predicted: finalAnswer,
310
+ topic: meta.topic,
311
+ answerType: meta.answerType,
312
+ citationCount: citations.length,
313
+ }
343
314
  return {
344
- resolved,
315
+ passed: resolved,
345
316
  score: resolved ? 1 : 0,
346
- detail: JSON.stringify({
347
- grade,
348
- gradeLetter,
349
- gold: meta.gold,
350
- predicted: finalAnswer,
351
- topic: meta.topic,
352
- answerType: meta.answerType,
353
- citationCount: citations.length,
354
- }),
317
+ notes: JSON.stringify(raw),
318
+ raw,
355
319
  }
356
320
  },
357
- }
321
+
322
+ runtime: {
323
+ async preflight() {
324
+ // The grader router must be configured in both modes — SimpleQA's score is
325
+ // defined by the grader, so a run without it is meaningless.
326
+ graderRouter()
327
+ if (fixturesMode) {
328
+ await readFile(FIXTURES, 'utf8').catch((err) => {
329
+ throw new Error(
330
+ `SIMPLEQA_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
331
+ )
332
+ })
333
+ return
334
+ }
335
+ try {
336
+ await py(
337
+ `from urllib.request import urlopen
338
+ with urlopen(${JSON.stringify(DATASET_URL)}, timeout=120) as resp:
339
+ head = resp.read(64).decode('utf-8', 'replace')
340
+ assert head.startswith('metadata,problem,answer'), 'unexpected CSV header: ' + head[:40]
341
+ print('ok')`,
342
+ )
343
+ } catch (err) {
344
+ const msg = err instanceof Error ? err.message : String(err)
345
+ throw new Error(
346
+ `simpleqa preflight failed: ${msg}\n` +
347
+ `Fix: (1) ensure the bench venv exists (python3 -m venv bench/.venv) ; ` +
348
+ `(2) ensure network access to ${DATASET_URL} ; ` +
349
+ `or set SIMPLEQA_FIXTURES=1 to run against the committed fixtures offline.`,
350
+ )
351
+ }
352
+ },
353
+
354
+ async goldArtifact(task: BenchTask) {
355
+ // Gold artifact = the worker-contract serialization of the gold answer, so
356
+ // verify-judge proves gold→CORRECT through the SAME parse path the real
357
+ // artifact takes.
358
+ const meta = readMeta(task)
359
+ return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
360
+ },
361
+ },
362
+ })
358
363
  }
@@ -79,10 +79,10 @@ test('SWE setup and extraction stay in the session workspace and exclude test ed
79
79
  const base = git(['hash-object', '-t', 'commit', '-w', '--stdin'],
80
80
  `tree ${tree}\nauthor Fixture <fixture@example.invalid> 1 +0000\ncommitter Fixture <fixture@example.invalid> 1 +0000\n\nfixture\n`)
81
81
  git(['update-ref', 'HEAD', base])
82
- const task = { id: taskId, prompt: 'fix', metadata: { repo: 'fixture/repo', base_commit: base } }
82
+ const task = { id: taskId, payload: { prompt: 'fix' }, metadata: { repo: 'fixture/repo', base_commit: base } }
83
83
  const adapter = createSweBenchAdapter()
84
- const setup = adapter.boxSetup!(task)
85
- const extract = adapter.boxExtract!(task)
84
+ const setup = adapter.runtime.workspaceSetup!(task)
85
+ const extract = adapter.runtime.workspaceExtract!(task)
86
86
  assert.match(setup.command, /^rm -rf '\.\//)
87
87
  assert.equal(setup.cwd, undefined)
88
88
  assert.equal(extract.cwd, undefined)