@tangle-network/agent-bench 1.0.2 → 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 (222) hide show
  1. package/CHANGELOG.md +29 -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 +63 -50
  39. package/dist/benchmarks/finresearchbench.js.map +1 -1
  40. package/dist/benchmarks/finsearchcomp.d.ts +3 -3
  41. package/dist/benchmarks/finsearchcomp.js +55 -44
  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 +3 -3
  56. package/dist/benchmarks/mcad-cq-bench.js +70 -58
  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 +63 -52
  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 +49 -43
  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-DhAndllg.js → cadbench-htzAmMaI.js} +41 -36
  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 +11 -10
  120. package/dist/index.js +64 -59
  121. package/dist/index.js.map +1 -1
  122. package/package.json +9 -6
  123. package/scripts/enterpriseops-gym-run.sh +82 -0
  124. package/scripts/grade-recorded-evidence.mjs +50 -0
  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/atom-mcp-e2e.mts +2 -2
  137. package/src/benchmarks/_harness.test.mts +18 -1
  138. package/src/benchmarks/_harness.ts +12 -7
  139. package/src/benchmarks/aec-bench.test.mts +14 -14
  140. package/src/benchmarks/aec-bench.ts +62 -56
  141. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  142. package/src/benchmarks/agentbench.ts +44 -37
  143. package/src/benchmarks/appworld.test.mts +7 -7
  144. package/src/benchmarks/appworld.ts +88 -75
  145. package/src/benchmarks/bfcl.ts +60 -53
  146. package/src/benchmarks/cad-design.ts +34 -32
  147. package/src/benchmarks/cadbench.ts +36 -36
  148. package/src/benchmarks/cadgenbench.ts +30 -28
  149. package/src/benchmarks/commit0.test.mts +9 -9
  150. package/src/benchmarks/commit0.ts +50 -43
  151. package/src/benchmarks/crag.ts +45 -40
  152. package/src/benchmarks/dabstep-official.test.mts +8 -8
  153. package/src/benchmarks/dabstep.test.mts +11 -11
  154. package/src/benchmarks/dabstep.ts +47 -40
  155. package/src/benchmarks/external-adapters.test.mts +43 -44
  156. package/src/benchmarks/finresearchbench.ts +58 -48
  157. package/src/benchmarks/finsearchcomp.ts +73 -68
  158. package/src/benchmarks/frames.ts +76 -69
  159. package/src/benchmarks/hotpotqa.ts +69 -64
  160. package/src/benchmarks/humaneval.ts +37 -35
  161. package/src/benchmarks/mcad-bench.test.mts +30 -30
  162. package/src/benchmarks/mcad-bench.ts +66 -60
  163. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  164. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  165. package/src/benchmarks/mcad-cq.test.mts +40 -40
  166. package/src/benchmarks/mcad-golds.ts +1 -1
  167. package/src/benchmarks/mind2web.ts +66 -58
  168. package/src/benchmarks/nomiracl.ts +53 -46
  169. package/src/benchmarks/open-rag-bench.ts +47 -42
  170. package/src/benchmarks/programbench.test.mts +10 -10
  171. package/src/benchmarks/programbench.ts +38 -33
  172. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  173. package/src/benchmarks/rag-shared.ts +13 -16
  174. package/src/benchmarks/ragbench.ts +44 -39
  175. package/src/benchmarks/simpleqa.ts +79 -74
  176. package/src/benchmarks/swe-bench.test.mts +3 -3
  177. package/src/benchmarks/swe-bench.ts +66 -61
  178. package/src/benchmarks/t2-ragbench.ts +47 -42
  179. package/src/benchmarks/tau-bench-shared.ts +51 -44
  180. package/src/benchmarks/tau-pin.test.mts +1 -1
  181. package/src/benchmarks/tau2-bench.ts +2 -2
  182. package/src/benchmarks/tau3-banking.ts +2 -2
  183. package/src/benchmarks/terminal-bench.test.mts +3 -3
  184. package/src/benchmarks/terminal-bench.ts +41 -36
  185. package/src/benchmarks/toollm.ts +54 -47
  186. package/src/benchmarks/trata-hedge.ts +61 -58
  187. package/src/benchmarks/types.ts +70 -59
  188. package/src/benchmarks/webarena-verified.ts +49 -42
  189. package/src/cli.ts +74 -0
  190. package/src/corpus-replay.mts +9 -9
  191. package/src/examples/benchmark-matrix.mts +19 -16
  192. package/src/examples/lean-proof-gate.mts +1 -1
  193. package/src/examples/math-demo.mts +2 -2
  194. package/src/examples/strategy-demo.mts +1 -1
  195. package/src/gate-cli.mts +6 -6
  196. package/src/gate.test.mts +14 -12
  197. package/src/gate.ts +23 -22
  198. package/src/generate-eval/certify.ts +4 -4
  199. package/src/index.ts +17 -11
  200. package/src/published.test.mts +534 -0
  201. package/src/published.ts +524 -0
  202. package/src/run-benchmarks-cli.mts +3 -3
  203. package/src/run-benchmarks.test.mts +58 -48
  204. package/src/run-benchmarks.ts +64 -57
  205. package/src/swe-bench-env.ts +6 -6
  206. package/src/swe-self-improve.mts +3 -3
  207. package/src/terminal-compare.ts +1 -1
  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-DhAndllg.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
@@ -13,7 +13,7 @@ import { resolve } from 'node:path'
13
13
  import { promisify } from 'node:util'
14
14
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
15
15
  import { runVenvPython } from './_harness'
16
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
16
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
17
17
 
18
18
  const execFileAsync = promisify(execFile)
19
19
 
@@ -162,16 +162,18 @@ function rowToTask(row: TauRow, config: TauBenchConfig, split?: string, pin?: Ta
162
162
  }
163
163
  return {
164
164
  id: row.id,
165
- split,
166
- prompt: [
167
- config.taskIntro,
168
- `Run this task in the official ${row.domain} domain.`,
169
- 'The benchmark is a simulated multi-turn user/tool conversation.',
170
- '',
171
- typeof row.user_scenario === 'string' ? row.user_scenario : JSON.stringify(row.user_scenario ?? {}, null, 2),
172
- '',
173
- 'Return the path to the official tau results.json or trajectory file containing this task run.',
174
- ].join('\n'),
165
+ payload: {
166
+ subset: split,
167
+ prompt: [
168
+ config.taskIntro,
169
+ `Run this task in the official ${row.domain} domain.`,
170
+ 'The benchmark is a simulated multi-turn user/tool conversation.',
171
+ '',
172
+ typeof row.user_scenario === 'string' ? row.user_scenario : JSON.stringify(row.user_scenario ?? {}, null, 2),
173
+ '',
174
+ 'Return the path to the official tau results.json or trajectory file containing this task run.',
175
+ ].join('\n'),
176
+ },
175
177
  metadata: meta as unknown as Record<string, unknown>,
176
178
  }
177
179
  }
@@ -179,7 +181,7 @@ function rowToTask(row: TauRow, config: TauBenchConfig, split?: string, pin?: Ta
179
181
  function readMeta(task: BenchTask, benchName: string): TauMeta {
180
182
  const md = task.metadata
181
183
  if (!md || typeof md.taskId !== 'string' || typeof md.domain !== 'string') {
182
- throw new Error(`${benchName} task ${task.id} missing metadata — loadTasks did not populate it`)
184
+ throw new Error(`${benchName} task ${task.id} missing metadata — loadAll did not populate it`)
183
185
  }
184
186
  return md as unknown as TauMeta
185
187
  }
@@ -199,7 +201,7 @@ function selectRows(rows: TauRow[], opts: LoadOptions, config: TauBenchConfig, s
199
201
  async function loadFixtures(config: TauBenchConfig, opts: LoadOptions): Promise<BenchTask[]> {
200
202
  const rows = JSON.parse(await readFile(config.fixturePath, 'utf8')) as TauRow[]
201
203
  console.warn(`[${config.name}] ${config.fixturesEnv}=1 — loading ${rows.length} adapter fixtures`)
202
- return selectRows(rows, opts, config, opts.split)
204
+ return selectRows(rows, opts, config, opts.subset)
203
205
  }
204
206
 
205
207
  async function loadOfficialTasks(config: TauBenchConfig, root: string, opts: LoadOptions): Promise<BenchTask[]> {
@@ -223,13 +225,13 @@ for task in tasks:
223
225
  print(json.dumps({"upstreamVersion": upstream_version, "rows": rows}))
224
226
  `
225
227
  const upstreamCommit = await resolveUpstreamCommit(root, config.name)
226
- const stdout = await runVenvPython(script, [root, domain, opts.split ?? ''])
228
+ const stdout = await runVenvPython(script, [root, domain, opts.subset ?? ''])
227
229
  const report = JSON.parse(stdout) as { upstreamVersion?: unknown; rows?: unknown }
228
230
  if (typeof report.upstreamVersion !== 'string' || report.upstreamVersion.length === 0 || !Array.isArray(report.rows)) {
229
231
  throw new Error(`${config.name}: upstream task loader returned no pinned version/rows`)
230
232
  }
231
233
  const pin: TauUpstreamPin = { upstreamCommit, upstreamVersion: report.upstreamVersion }
232
- return selectRows(report.rows as TauRow[], opts, config, opts.split, pin)
234
+ return selectRows(report.rows as TauRow[], opts, config, opts.subset, pin)
233
235
  }
234
236
 
235
237
  async function scoreOfficialTrajectory(root: string, meta: TauMeta, artifactPath: string): Promise<Record<string, unknown>> {
@@ -257,35 +259,20 @@ print(json.dumps({"count": len(scores), "score": sum(scores) / len(scores), "sco
257
259
  return JSON.parse(stdout.trim().split('\n').at(-1) ?? '{}') as Record<string, unknown>
258
260
  }
259
261
 
260
- export function createTauBenchAdapter(config: TauBenchConfig): BenchmarkAdapter {
262
+ export function createTauBenchAdapter(config: TauBenchConfig): RuntimeBenchmark {
261
263
  const fixturesMode = process.env[config.fixturesEnv] === '1'
262
264
 
263
- return {
264
- name: config.name,
265
- output: tauResultsOutput,
266
-
267
- async preflight() {
268
- if (fixturesMode) return
269
- const dir = benchDir(config)
270
- if (!dir) {
271
- throw new Error(`${config.dirEnv} is required. Fix: ${config.installHint}`)
272
- }
273
- await assertPath(`${dir}/src/tau2/registry.py`, 'tau registry', config.name)
274
- await loadOfficialTasks(config, dir, { limit: 1 })
275
- },
265
+ return runtimeBenchmark({
266
+ id: config.name,
276
267
 
277
- async loadTasks(opts: LoadOptions = {}) {
268
+ async loadAll(opts: LoadOptions = {}) {
278
269
  if (fixturesMode) return loadFixtures(config, opts)
279
270
  const dir = benchDir(config)
280
271
  if (!dir) throw new Error(`${config.dirEnv} is required to load official ${config.name} tasks`)
281
272
  return loadOfficialTasks(config, dir, opts)
282
273
  },
283
274
 
284
- async goldArtifact() {
285
- return undefined
286
- },
287
-
288
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
275
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
289
276
  const dir = benchDir(config)
290
277
  if (!dir) throw new Error(`${config.dirEnv} is required to judge ${config.name} trajectory artifacts`)
291
278
  const meta = readMeta(task, config.name)
@@ -300,17 +287,37 @@ export function createTauBenchAdapter(config: TauBenchConfig): BenchmarkAdapter
300
287
  const live: TauUpstreamPin = { upstreamCommit, upstreamVersion }
301
288
  assertTauUpstreamPinUnchanged(config.name, meta.taskId, meta, live)
302
289
  const score = typeof report.score === 'number' ? report.score : 0
290
+ const raw = {
291
+ taskId: meta.taskId,
292
+ domain: meta.domain,
293
+ count: report.count,
294
+ upstreamCommit,
295
+ upstreamVersion,
296
+ }
303
297
  return {
304
- resolved: score === 1,
298
+ passed: score === 1,
305
299
  score,
306
- detail: JSON.stringify({
307
- taskId: meta.taskId,
308
- domain: meta.domain,
309
- count: report.count,
310
- upstreamCommit,
311
- upstreamVersion,
312
- }),
300
+ notes: JSON.stringify(raw),
301
+ raw,
313
302
  }
314
303
  },
315
- }
304
+
305
+ runtime: {
306
+ output: tauResultsOutput,
307
+
308
+ async preflight() {
309
+ if (fixturesMode) return
310
+ const dir = benchDir(config)
311
+ if (!dir) {
312
+ throw new Error(`${config.dirEnv} is required. Fix: ${config.installHint}`)
313
+ }
314
+ await assertPath(`${dir}/src/tau2/registry.py`, 'tau registry', config.name)
315
+ await loadOfficialTasks(config, dir, { limit: 1 })
316
+ },
317
+
318
+ async goldArtifact() {
319
+ return undefined
320
+ },
321
+ },
322
+ })
316
323
  }
@@ -30,7 +30,7 @@ test('a dirty upstream checkout is refused before any task load', async () => {
30
30
 
31
31
  delete process.env.TAU3_FIXTURES
32
32
  process.env.TAU3_BENCH_DIR = dir
33
- await assert.rejects(() => createTau3BankingAdapter().loadTasks({ limit: 1 }), /uncommitted changes/)
33
+ await assert.rejects(() => createTau3BankingAdapter().loadAll({ limit: 1 }), /uncommitted changes/)
34
34
  } finally {
35
35
  if (previous === undefined) delete process.env.TAU3_BENCH_DIR
36
36
  else process.env.TAU3_BENCH_DIR = previous
@@ -9,13 +9,13 @@
9
9
  import { join } from 'node:path'
10
10
  import { benchRoot } from './_harness'
11
11
  import { createTauBenchAdapter, tauResultsOutput } from './tau-bench-shared'
12
- import type { BenchmarkAdapter } from './types'
12
+ import type { RuntimeBenchmark } from './types'
13
13
 
14
14
  const FIXTURES = join(benchRoot, 'fixtures', 'tau2-bench.json')
15
15
 
16
16
  export const tau2ResultsOutput = tauResultsOutput
17
17
 
18
- export function createTau2BenchAdapter(): BenchmarkAdapter {
18
+ export function createTau2BenchAdapter(): RuntimeBenchmark {
19
19
  return createTauBenchAdapter({
20
20
  name: 'tau2-bench',
21
21
  fixturePath: FIXTURES,
@@ -10,11 +10,11 @@
10
10
  import { join } from 'node:path'
11
11
  import { benchRoot } from './_harness'
12
12
  import { createTauBenchAdapter } from './tau-bench-shared'
13
- import type { BenchmarkAdapter } from './types'
13
+ import type { RuntimeBenchmark } from './types'
14
14
 
15
15
  const FIXTURES = join(benchRoot, 'fixtures', 'tau3-banking.json')
16
16
 
17
- export function createTau3BankingAdapter(): BenchmarkAdapter {
17
+ export function createTau3BankingAdapter(): RuntimeBenchmark {
18
18
  return createTauBenchAdapter({
19
19
  name: 'tau3-banking',
20
20
  fixturePath: FIXTURES,
@@ -9,8 +9,8 @@ import { createTerminalBenchAdapter } from './terminal-bench'
9
9
 
10
10
  test('goldArtifact returns portable shell solutions and rejects missing ones', async () => {
11
11
  const a = createTerminalBenchAdapter()
12
- assert.equal(await a.goldArtifact({ id: 'with-solution', prompt: '', metadata: { solution: 'echo ok\n' } }), 'echo ok\n')
13
- assert.equal(await a.goldArtifact({ id: 'without-solution', prompt: '', metadata: {} }), undefined)
12
+ assert.equal(await a.runtime.goldArtifact!({ id: 'with-solution', payload: { prompt: '' }, metadata: { solution: 'echo ok\n' } }), 'echo ok\n')
13
+ assert.equal(await a.runtime.goldArtifact!({ id: 'without-solution', payload: { prompt: '' }, metadata: {} }), undefined)
14
14
  })
15
15
 
16
16
  test('preflight FAILS LOUD with isolated Terminal-Bench venv instructions when harness is absent', async () => {
@@ -18,7 +18,7 @@ test('preflight FAILS LOUD with isolated Terminal-Bench venv instructions when h
18
18
  process.env.TERMINAL_BENCH_VENV = '.venv-terminal-bench-does-not-exist'
19
19
  try {
20
20
  const a = createTerminalBenchAdapter()
21
- await assert.rejects(a.preflight(), (e: Error) => {
21
+ await assert.rejects(a.runtime.preflight!(), (e: Error) => {
22
22
  assert.match(e.message, /pip install terminal-bench/)
23
23
  assert.match(e.message, /ISOLATED venv/)
24
24
  assert.match(e.message, /TERMINAL_BENCH_VENV/)
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Requires: an isolated bench `.venv-terminal-bench` with `terminal-bench`
10
10
  * installed + a running Docker daemon (per-task images are built on first run).
11
- * Override with TERMINAL_BENCH_VENV. loadTasks caches the dataset from the
11
+ * Override with TERMINAL_BENCH_VENV. loadAll caches the dataset from the
12
12
  * Terminal-Bench registry on first run.
13
13
  *
14
14
  * Process/Docker/report plumbing is shared via ./_harness; this file owns the
@@ -28,7 +28,7 @@ import {
28
28
  venvBinAt,
29
29
  venvPythonAt,
30
30
  } from './_harness'
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
  // Terminal-Bench imports LiteLLM/Pydantic-2 APIs, while AppWorld pins Pydantic 1.
34
34
  // Keep it out of the shared bench .venv. Resolved at call-time so tests/runs can
@@ -106,38 +106,25 @@ print(json.dumps(out))
106
106
  return JSON.parse(stdout) as TbTaskRow[]
107
107
  }
108
108
 
109
- export function createTerminalBenchAdapter(): BenchmarkAdapter {
110
- return {
111
- name: 'terminal-bench',
112
-
113
- async preflight() {
114
- await preflightVenvImports({
115
- modules: ['terminal_bench'],
116
- requireDocker: true,
117
- python: terminalBenchPython(),
118
- fix:
119
- `Fix: (1) python3 -m venv bench/${terminalBenchVenvDir()} && ` +
120
- `bench/${terminalBenchVenvDir()}/bin/pip install terminal-bench ` +
121
- `(an ISOLATED venv — Terminal-Bench/LiteLLM require Pydantic 2 while AppWorld pins Pydantic 1; ` +
122
- `override the dir with TERMINAL_BENCH_VENV) ; ` +
123
- `(2) ensure the Docker daemon is running (the judge builds per-task images on first run). ` +
124
- `The ${DATASET_REF} dataset is cached from the Terminal-Bench registry on first loadTasks.`,
125
- })
126
- },
109
+ export function createTerminalBenchAdapter(): RuntimeBenchmark {
110
+ return runtimeBenchmark({
111
+ id: 'terminal-bench',
127
112
 
128
- async loadTasks(opts: LoadOptions = {}) {
113
+ async loadAll(opts: LoadOptions = {}) {
129
114
  const rows = await loadRows(opts)
130
115
  if (rows.length === 0) {
131
116
  throw new Error(
132
- `terminal-bench loadTasks returned no tasks for ${JSON.stringify(opts)} ` +
117
+ `terminal-bench loadAll returned no tasks for ${JSON.stringify(opts)} ` +
133
118
  `(dataset ${DATASET_REF}). Check the requested ids exist in the dataset.`,
134
119
  )
135
120
  }
136
121
  return rows.map(
137
122
  (r): BenchTask => ({
138
123
  id: r.id,
139
- split: DATASET_VERSION,
140
- prompt: r.instruction,
124
+ payload: {
125
+ subset: DATASET_VERSION,
126
+ prompt: r.instruction,
127
+ },
141
128
  metadata: {
142
129
  dataset: DATASET,
143
130
  datasetVersion: DATASET_VERSION,
@@ -150,15 +137,7 @@ export function createTerminalBenchAdapter(): BenchmarkAdapter {
150
137
  )
151
138
  },
152
139
 
153
- async goldArtifact(task: BenchTask) {
154
- // Gold = the task's solution.sh (the oracle script). solution.yaml tasks have
155
- // no shell-script artifact form here, so they return undefined (cannot be
156
- // verify-judged via the script-replay seam — use a .sh-solution task).
157
- const sol = task.metadata?.solution
158
- return typeof sol === 'string' ? sol : undefined
159
- },
160
-
161
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
140
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
162
141
  const runId = safeRunId('bench', `${task.id}-${Date.now()}`)
163
142
  return runStagedJudge({
164
143
  tmpPrefix: 'tbench-',
@@ -187,12 +166,38 @@ export function createTerminalBenchAdapter(): BenchmarkAdapter {
187
166
  const resolved = (report.resolved_ids ?? []).includes(task.id)
188
167
  const trial = report.results?.find((r) => r.task_id === task.id)
189
168
  return {
190
- resolved,
169
+ passed: resolved,
191
170
  score: resolved ? 1 : 0,
192
- detail: JSON.stringify(trial?.parser_results ?? report.resolved_ids ?? {}),
171
+ notes: JSON.stringify(trial?.parser_results ?? report.resolved_ids ?? {}),
172
+ raw: {},
193
173
  }
194
174
  },
195
175
  })
196
176
  },
197
- }
177
+
178
+ runtime: {
179
+ async preflight() {
180
+ await preflightVenvImports({
181
+ modules: ['terminal_bench'],
182
+ requireDocker: true,
183
+ python: terminalBenchPython(),
184
+ fix:
185
+ `Fix: (1) python3 -m venv bench/${terminalBenchVenvDir()} && ` +
186
+ `bench/${terminalBenchVenvDir()}/bin/pip install terminal-bench ` +
187
+ `(an ISOLATED venv — Terminal-Bench/LiteLLM require Pydantic 2 while AppWorld pins Pydantic 1; ` +
188
+ `override the dir with TERMINAL_BENCH_VENV) ; ` +
189
+ `(2) ensure the Docker daemon is running (the judge builds per-task images on first run). ` +
190
+ `The ${DATASET_REF} dataset is cached from the Terminal-Bench registry on first loadAll.`,
191
+ })
192
+ },
193
+
194
+ async goldArtifact(task: BenchTask) {
195
+ // Gold = the task's solution.sh (the oracle script). solution.yaml tasks have
196
+ // no shell-script artifact form here, so they return undefined (cannot be
197
+ // verify-judged via the script-replay seam — use a .sh-solution task).
198
+ const sol = task.metadata?.solution
199
+ return typeof sol === 'string' ? sol : undefined
200
+ },
201
+ },
202
+ })
198
203
  }
@@ -11,7 +11,7 @@ import { readFile } from 'node:fs/promises'
11
11
  import { join } from 'node:path'
12
12
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
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
 
16
16
  const FIXTURES = join(benchRoot, 'fixtures', 'toollm.json')
17
17
  const DEFAULT_QUERY_REL = join('data_example', 'instruction', 'G1_query.json')
@@ -65,16 +65,18 @@ function rowToTask(row: ToolBenchRow): BenchTask {
65
65
  }
66
66
  return {
67
67
  id: String(row.query_id),
68
- prompt: [
69
- 'Solve this ToolLLM/ToolBench API-use task.',
70
- 'Use only the listed APIs/tools and return the completed tool-use trace plus final answer.',
71
- '',
72
- `Query: ${row.query}`,
73
- '',
74
- `Available APIs: ${JSON.stringify(row.api_list ?? [], null, 2)}`,
75
- '',
76
- 'Return the APIs you used as JSON: {"api_calls":[{"tool_name":"...","api_name":"..."}]}.',
77
- ].join('\n'),
68
+ payload: {
69
+ prompt: [
70
+ 'Solve this ToolLLM/ToolBench API-use task.',
71
+ 'Use only the listed APIs/tools and return the completed tool-use trace plus final answer.',
72
+ '',
73
+ `Query: ${row.query}`,
74
+ '',
75
+ `Available APIs: ${JSON.stringify(row.api_list ?? [], null, 2)}`,
76
+ '',
77
+ 'Return the APIs you used as JSON: {"api_calls":[{"tool_name":"...","api_name":"..."}]}.',
78
+ ].join('\n'),
79
+ },
78
80
  metadata: meta as unknown as Record<string, unknown>,
79
81
  }
80
82
  }
@@ -107,7 +109,7 @@ function normalizeApiPairs(value: unknown): Array<[string, string]> {
107
109
  function readMeta(task: BenchTask): ToolBenchMeta {
108
110
  const md = task.metadata
109
111
  if (!md || !Array.isArray(md.relevantApis)) {
110
- throw new Error(`ToolLLM task ${task.id} missing metadata — loadTasks did not populate deterministic API-selection labels`)
112
+ throw new Error(`ToolLLM task ${task.id} missing metadata — loadAll did not populate deterministic API-selection labels`)
111
113
  }
112
114
  return md as unknown as ToolBenchMeta
113
115
  }
@@ -186,7 +188,7 @@ function extractCalledApis(text: string, expected: readonly [string, string][]):
186
188
  }
187
189
  }
188
190
 
189
- function scoreApiSelection(task: BenchTask, artifact: string): BenchScore {
191
+ function scoreApiSelection(task: BenchTask, artifact: string): BenchEvaluation {
190
192
  const meta = readMeta(task)
191
193
  if (meta.relevantApis.length === 0) {
192
194
  throw new Error(`ToolLLM task ${task.id} has no deterministic API-selection labels; refusing to score`)
@@ -200,55 +202,60 @@ function scoreApiSelection(task: BenchTask, artifact: string): BenchScore {
200
202
  const recall = truePositives / expected.size
201
203
  const score = expected.size === 0 ? 0 : recall
202
204
  const resolved = extracted.source === 'structured-json' && recall === 1 && precision === 1
205
+ const raw = {
206
+ scoring: 'api-selection-only',
207
+ extractionSource: extracted.source,
208
+ queryId: meta.queryId,
209
+ expected: meta.relevantApis,
210
+ called: calledPairs,
211
+ precision,
212
+ recall,
213
+ fullToolEvalScore: null,
214
+ }
203
215
  return {
204
- resolved,
216
+ passed: resolved,
205
217
  score,
206
- detail: JSON.stringify({
207
- scoring: 'api-selection-only',
208
- extractionSource: extracted.source,
209
- queryId: meta.queryId,
210
- expected: meta.relevantApis,
211
- called: calledPairs,
212
- precision,
213
- recall,
214
- fullToolEvalScore: null,
215
- }),
218
+ notes: JSON.stringify(raw),
219
+ raw,
216
220
  }
217
221
  }
218
222
 
219
- export function createToolLlmAdapter(): BenchmarkAdapter {
223
+ export function createToolLlmAdapter(): RuntimeBenchmark {
220
224
  const fixturesMode = process.env.TOOLLM_FIXTURES === '1'
221
225
 
222
- return {
223
- name: 'toollm',
224
- output: toollmOutput,
225
-
226
- async preflight() {
227
- if (fixturesMode) return
228
- const dir = toolbenchDir()
229
- if (!dir) {
230
- throw new Error('TOOLBENCH_DIR is required. Fix: clone https://github.com/OpenBMB/ToolBench and set TOOLBENCH_DIR=/path/to/ToolBench.')
231
- }
232
- await loadOfficialTasks(dir, { limit: 1 })
233
- },
226
+ return runtimeBenchmark({
227
+ id: 'toollm',
234
228
 
235
- async loadTasks(opts: LoadOptions = {}) {
229
+ async loadAll(opts: LoadOptions = {}) {
236
230
  if (fixturesMode) return loadFixtures(opts)
237
231
  const dir = toolbenchDir()
238
232
  if (!dir) throw new Error('TOOLBENCH_DIR is required to load ToolLLM tasks')
239
233
  return loadOfficialTasks(dir, opts)
240
234
  },
241
235
 
242
- async goldArtifact(task: BenchTask) {
243
- const meta = readMeta(task)
244
- if (meta.relevantApis.length === 0) return undefined
245
- return JSON.stringify({
246
- api_calls: meta.relevantApis.map(([tool_name, api_name]) => ({ tool_name, api_name })),
247
- }, null, 2)
236
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
237
+ return scoreApiSelection(task, artifact)
248
238
  },
249
239
 
250
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
251
- return scoreApiSelection(task, artifact)
240
+ runtime: {
241
+ output: toollmOutput,
242
+
243
+ async preflight() {
244
+ if (fixturesMode) return
245
+ const dir = toolbenchDir()
246
+ if (!dir) {
247
+ throw new Error('TOOLBENCH_DIR is required. Fix: clone https://github.com/OpenBMB/ToolBench and set TOOLBENCH_DIR=/path/to/ToolBench.')
248
+ }
249
+ await loadOfficialTasks(dir, { limit: 1 })
250
+ },
251
+
252
+ async goldArtifact(task: BenchTask) {
253
+ const meta = readMeta(task)
254
+ if (meta.relevantApis.length === 0) return undefined
255
+ return JSON.stringify({
256
+ api_calls: meta.relevantApis.map(([tool_name, api_name]) => ({ tool_name, api_name })),
257
+ }, null, 2)
258
+ },
252
259
  },
253
- }
260
+ })
254
261
  }