@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
@@ -31,94 +31,94 @@ async function withEnv<T>(patch: Record<string, string | undefined>, fn: () => P
31
31
  test('WebArena-Verified fixture mode loads tasks and live mode fails loud without checkout', async () => {
32
32
  await withEnv({ WEBARENA_VERIFIED_FIXTURES: '1', WEBARENA_VERIFIED_DIR: undefined }, async () => {
33
33
  const adapter = createWebArenaVerifiedAdapter()
34
- await adapter.preflight()
35
- const tasks = await adapter.loadTasks({ limit: 1 })
34
+ await adapter.runtime.preflight!()
35
+ const tasks = await adapter.loadAll({ limit: 1 })
36
36
  assert.equal(tasks.length, 1)
37
37
  assert.equal(tasks[0].id, '0')
38
- assert.match(tasks[0].prompt, /WebArena-Verified/)
38
+ assert.match(tasks[0].payload.prompt, /WebArena-Verified/)
39
39
  })
40
40
 
41
41
  await withEnv({ WEBARENA_VERIFIED_FIXTURES: undefined, WEBARENA_VERIFIED_DIR: undefined }, async () => {
42
- await assert.rejects(() => createWebArenaVerifiedAdapter().preflight(), /WEBARENA_VERIFIED_DIR is required/)
42
+ await assert.rejects(() => createWebArenaVerifiedAdapter().runtime.preflight!(), /WEBARENA_VERIFIED_DIR is required/)
43
43
  })
44
44
  })
45
45
 
46
46
  test('tau2-bench fixture mode loads tasks and live mode fails loud without checkout', async () => {
47
47
  await withEnv({ TAU2_FIXTURES: '1', TAU2_BENCH_DIR: undefined }, async () => {
48
48
  const adapter = createTau2BenchAdapter()
49
- await adapter.preflight()
50
- const tasks = await adapter.loadTasks({ limit: 1 })
49
+ await adapter.runtime.preflight!()
50
+ const tasks = await adapter.loadAll({ limit: 1 })
51
51
  assert.equal(tasks.length, 1)
52
52
  assert.equal(tasks[0].id, 'retail-fixture-0')
53
- assert.match(tasks[0].prompt, /tau2 task/)
53
+ assert.match(tasks[0].payload.prompt, /tau2 task/)
54
54
  })
55
55
 
56
56
  await withEnv({ TAU2_FIXTURES: undefined, TAU2_BENCH_DIR: undefined }, async () => {
57
- await assert.rejects(() => createTau2BenchAdapter().preflight(), /TAU2_BENCH_DIR is required/)
57
+ await assert.rejects(() => createTau2BenchAdapter().runtime.preflight!(), /TAU2_BENCH_DIR is required/)
58
58
  })
59
59
  })
60
60
 
61
61
  test('tau3-banking fixture mode loads tasks and live mode fails loud without checkout', async () => {
62
62
  await withEnv({ TAU3_FIXTURES: '1', TAU3_BENCH_DIR: undefined }, async () => {
63
63
  const adapter = createTau3BankingAdapter()
64
- await adapter.preflight()
65
- const tasks = await adapter.loadTasks({ limit: 1 })
64
+ await adapter.runtime.preflight!()
65
+ const tasks = await adapter.loadAll({ limit: 1 })
66
66
  assert.equal(tasks.length, 1)
67
67
  assert.equal(tasks[0].id, 'banking-knowledge-fixture-0')
68
- assert.match(tasks[0].prompt, /tau3 banking task/)
68
+ assert.match(tasks[0].payload.prompt, /tau3 banking task/)
69
69
  })
70
70
 
71
71
  await withEnv({ TAU3_FIXTURES: undefined, TAU3_BENCH_DIR: undefined }, async () => {
72
- await assert.rejects(() => createTau3BankingAdapter().preflight(), /TAU3_BENCH_DIR is required/)
72
+ await assert.rejects(() => createTau3BankingAdapter().runtime.preflight!(), /TAU3_BENCH_DIR is required/)
73
73
  })
74
74
  })
75
75
 
76
76
  test('AgentBench DBBench fixture mode loads and exact-label judge scores deterministically', async () => {
77
77
  await withEnv({ AGENTBENCH_FIXTURES: '1', AGENTBENCH_DIR: undefined }, async () => {
78
78
  const adapter = createAgentBenchAdapter()
79
- await adapter.preflight()
80
- const [task] = await adapter.loadTasks({ limit: 1 })
81
- assert.equal(await adapter.goldArtifact(task), 'Women +60kg Bronze')
82
- assert.equal((await adapter.judge(task, 'women +60kg bronze')).score, 1)
83
- assert.equal((await adapter.judge(task, 'wrong')).score, 0)
79
+ await adapter.runtime.preflight!()
80
+ const [task] = await adapter.loadAll({ limit: 1 })
81
+ assert.equal(await adapter.runtime.goldArtifact!(task), 'Women +60kg Bronze')
82
+ assert.equal((await adapter.evaluate(task, 'women +60kg bronze')).score, 1)
83
+ assert.equal((await adapter.evaluate(task, 'wrong')).score, 0)
84
84
  })
85
85
 
86
86
  await withEnv({ AGENTBENCH_FIXTURES: undefined, AGENTBENCH_DIR: undefined }, async () => {
87
- await assert.rejects(() => createAgentBenchAdapter().preflight(), /AGENTBENCH_DIR is required/)
87
+ await assert.rejects(() => createAgentBenchAdapter().runtime.preflight!(), /AGENTBENCH_DIR is required/)
88
88
  })
89
89
  })
90
90
 
91
91
  test('BFCL fixture mode loads official-shaped rows and scores function calls', async () => {
92
92
  await withEnv({ BFCL_FIXTURES: '1', BFCL_DIR: undefined }, async () => {
93
93
  const adapter = createBfclAdapter()
94
- await adapter.preflight()
95
- const [task] = await adapter.loadTasks({ limit: 1 })
94
+ await adapter.runtime.preflight!()
95
+ const [task] = await adapter.loadAll({ limit: 1 })
96
96
  assert.equal(task.id, 'simple_python_fixture_0')
97
- const gold = await adapter.goldArtifact(task)
97
+ const gold = await adapter.runtime.goldArtifact!(task)
98
98
  assert.match(gold ?? '', /calculate_triangle_area/)
99
- assert.equal((await adapter.judge(task, gold ?? '')).score, 1)
100
- assert.equal((await adapter.judge(task, '{"function_calls":[{"name":"wrong","arguments":{}}]}')).score, 0)
99
+ assert.equal((await adapter.evaluate(task, gold ?? '')).score, 1)
100
+ assert.equal((await adapter.evaluate(task, '{"function_calls":[{"name":"wrong","arguments":{}}]}')).score, 0)
101
101
  })
102
102
 
103
103
  await withEnv({ BFCL_FIXTURES: undefined, BFCL_DIR: undefined }, async () => {
104
- await assert.rejects(() => createBfclAdapter().preflight(), /BFCL_DIR is required/)
104
+ await assert.rejects(() => createBfclAdapter().runtime.preflight!(), /BFCL_DIR is required/)
105
105
  })
106
106
  })
107
107
 
108
108
  test('ToolLLM scores only deterministic API-selection labels and rejects unlabeled rows', async () => {
109
109
  await withEnv({ TOOLLM_FIXTURES: '1', TOOLBENCH_DIR: undefined }, async () => {
110
110
  const adapter = createToolLlmAdapter()
111
- await adapter.preflight()
112
- const [task] = await adapter.loadTasks({ limit: 1 })
111
+ await adapter.runtime.preflight!()
112
+ const [task] = await adapter.loadAll({ limit: 1 })
113
113
  assert.equal(task.id, '1')
114
- const gold = await adapter.goldArtifact(task)
114
+ const gold = await adapter.runtime.goldArtifact!(task)
115
115
  assert.match(gold ?? '', /Checkhealth/)
116
- assert.equal((await adapter.judge(task, '')).score, 0)
117
- assert.equal((await adapter.judge(task, gold ?? '')).score, 1)
118
- assert.equal((await adapter.judge(task, '{"api_calls":[{"tool_name":"SQUAKE","api_name":"Checkhealth"}]}')).score, 0.5)
119
- const freeText = await adapter.judge(task, 'Use SQUAKE Checkhealth, then call SQUAKE Projects.')
116
+ assert.equal((await adapter.evaluate(task, '')).score, 0)
117
+ assert.equal((await adapter.evaluate(task, gold ?? '')).score, 1)
118
+ assert.equal((await adapter.evaluate(task, '{"api_calls":[{"tool_name":"SQUAKE","api_name":"Checkhealth"}]}')).score, 0.5)
119
+ const freeText = await adapter.evaluate(task, 'Use SQUAKE Checkhealth, then call SQUAKE Projects.')
120
120
  assert.equal(freeText.score, 1)
121
- assert.equal(freeText.resolved, false)
121
+ assert.equal(freeText.passed, false)
122
122
  })
123
123
 
124
124
  const dir = await mkdtemp(join(tmpdir(), 'toollm-'))
@@ -126,7 +126,7 @@ test('ToolLLM scores only deterministic API-selection labels and rejects unlabel
126
126
  const query = join(dir, 'queries.json')
127
127
  await writeFile(query, JSON.stringify([{ query_id: 1, query: 'Call a tool.', api_list: [] }]))
128
128
  await withEnv({ TOOLLM_FIXTURES: undefined, TOOLBENCH_DIR: dir, TOOLLM_QUERY_FILE: query }, async () => {
129
- await assert.rejects(() => createToolLlmAdapter().preflight(), /deterministic API-selection labels missing/)
129
+ await assert.rejects(() => createToolLlmAdapter().runtime.preflight!(), /deterministic API-selection labels missing/)
130
130
  })
131
131
  } finally {
132
132
  await rm(dir, { recursive: true, force: true })
@@ -136,23 +136,22 @@ test('ToolLLM scores only deterministic API-selection labels and rejects unlabel
136
136
  test('FinResearchBench fixture mode is explicit and live mode requires exported judge rows', async () => {
137
137
  await withEnv({ FINRESEARCHBENCH_FIXTURES: '1', FINRESEARCHBENCH_DATA_FILE: undefined }, async () => {
138
138
  const adapter = createFinResearchBenchAdapter()
139
- await adapter.preflight()
140
- const [task] = await adapter.loadTasks({ limit: 1 })
141
- const gold = await adapter.goldArtifact(task)
139
+ await adapter.runtime.preflight!()
140
+ const [task] = await adapter.loadAll({ limit: 1 })
141
+ const gold = await adapter.runtime.goldArtifact!(task)
142
142
  assert.match(gold ?? '', /Margin expansion/)
143
- assert.equal((await adapter.judge(task, gold ?? '')).score, 1)
144
- assert.equal((await adapter.judge(task, 'unrelated answer')).score, 0)
143
+ assert.equal((await adapter.evaluate(task, gold ?? '')).score, 1)
144
+ assert.equal((await adapter.evaluate(task, 'unrelated answer')).score, 0)
145
145
  })
146
146
 
147
147
  await withEnv({ FINRESEARCHBENCH_FIXTURES: undefined, FINRESEARCHBENCH_DATA_FILE: undefined }, async () => {
148
- await assert.rejects(() => createFinResearchBenchAdapter().preflight(), /FINRESEARCHBENCH_DATA_FILE is required/)
148
+ await assert.rejects(() => createFinResearchBenchAdapter().runtime.preflight!(), /FINRESEARCHBENCH_DATA_FILE is required/)
149
149
  })
150
150
  })
151
151
 
152
152
  const officialFinResearchTask = {
153
153
  id: 'row-1',
154
- prompt: 'unused',
155
- split: 'macro',
154
+ payload: { prompt: 'unused', subset: 'macro' },
156
155
  metadata: {
157
156
  id: 'row-1',
158
157
  category: 'macro',
@@ -178,9 +177,9 @@ test('FinResearchBench official judge score carries the judge turn usage verbati
178
177
  'deepseek-v4-flash',
179
178
  )
180
179
  assert.equal(score.score, 0.8)
181
- assert.equal(score.resolved, true)
180
+ assert.equal(score.passed, true)
182
181
  assert.deepEqual(score.judgeUsage, usage)
183
- const detail = JSON.parse(score.detail ?? '{}') as Record<string, unknown>
182
+ const detail = JSON.parse(score.notes ?? '{}') as Record<string, unknown>
184
183
  assert.equal(detail.judgeModel, 'deepseek-v4-flash')
185
184
  assert.equal(detail.scoring, 'official-logic-tree-judge')
186
185
  })
@@ -195,7 +194,7 @@ test('FinResearchBench keeps unknown judge cost unknown instead of reporting zer
195
194
  }
196
195
  const score = scoreOfficialJudgeTurn(officialFinResearchTask, { finalText: '{"score": 3}', usage }, 'deepseek-v4-flash')
197
196
  assert.equal(score.score, 0.3)
198
- assert.equal(score.resolved, false)
197
+ assert.equal(score.passed, false)
199
198
  assert.equal(score.judgeUsage?.usdKnown, false)
200
199
  assert.equal(score.judgeUsage?.tokensKnown, false)
201
200
  assert.equal(score.judgeUsage?.costUsd, undefined)
@@ -12,7 +12,7 @@ import { join } from 'node:path'
12
12
  import type { AgentTurnUsage } from '@tangle-network/agent-runtime/kernel'
13
13
  import { runBenchRouterTurn } from '../router-turn'
14
14
  import { benchRoot } from './_harness'
15
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
15
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
16
16
 
17
17
  const FIXTURES = join(benchRoot, 'fixtures', 'finresearchbench.json')
18
18
 
@@ -100,13 +100,15 @@ function rowToTask(row: FinResearchRecord, fixturesMode: boolean): BenchTask {
100
100
  }
101
101
  return {
102
102
  id: row.id,
103
- split: row.category,
104
- prompt: [
105
- 'Complete this FinResearchBench financial research task.',
106
- 'Produce a decision-grade research answer with explicit reasoning, evidence, and final conclusion.',
107
- '',
108
- row.question,
109
- ].join('\n'),
103
+ payload: {
104
+ subset: row.category,
105
+ prompt: [
106
+ 'Complete this FinResearchBench financial research task.',
107
+ 'Produce a decision-grade research answer with explicit reasoning, evidence, and final conclusion.',
108
+ '',
109
+ row.question,
110
+ ].join('\n'),
111
+ },
110
112
  metadata: meta as unknown as Record<string, unknown>,
111
113
  }
112
114
  }
@@ -114,14 +116,14 @@ function rowToTask(row: FinResearchRecord, fixturesMode: boolean): BenchTask {
114
116
  function readMeta(task: BenchTask): FinResearchMeta {
115
117
  const md = task.metadata
116
118
  if (!md || typeof md.question !== 'string') {
117
- throw new Error(`FinResearchBench task ${task.id} missing metadata — loadTasks did not populate it`)
119
+ throw new Error(`FinResearchBench task ${task.id} missing metadata — loadAll did not populate it`)
118
120
  }
119
121
  return md as unknown as FinResearchMeta
120
122
  }
121
123
 
122
124
  function selectRows(rows: FinResearchRecord[], opts: LoadOptions, fixturesMode: boolean): BenchTask[] {
123
125
  let tasks = rows.map((row) => rowToTask(row, fixturesMode))
124
- if (opts.split) tasks = tasks.filter((task) => task.split === opts.split)
126
+ if (opts.subset) tasks = tasks.filter((task) => task.payload.subset === opts.subset)
125
127
  if (opts.ids) {
126
128
  const want = new Set(opts.ids)
127
129
  tasks = tasks.filter((task) => want.has(task.id))
@@ -180,7 +182,7 @@ function parseJudgeScore(content: string): { score: number; raw: unknown } {
180
182
  }
181
183
 
182
184
  /**
183
- * Map one drained judge turn to a BenchScore. The judge turn's exact Runtime
185
+ * Map one drained judge turn to a BenchEvaluation. The judge turn's exact Runtime
184
186
  * usage record lands on `judgeUsage` verbatim, so an unproven token count or
185
187
  * dollar amount stays flagged (`tokensKnown`/`usdKnown` false) instead of
186
188
  * reading as a known zero cost.
@@ -189,20 +191,22 @@ export function scoreOfficialJudgeTurn(
189
191
  task: BenchTask,
190
192
  turn: Readonly<{ finalText?: string; usage: AgentTurnUsage }>,
191
193
  requestedJudgeModel: string,
192
- ): BenchScore {
194
+ ): BenchEvaluation {
193
195
  const meta = readMeta(task)
194
196
  const content = turn.finalText
195
197
  if (!content) throw new Error('FinResearchBench judge returned no message content')
196
198
  const { score, raw } = parseJudgeScore(content)
199
+ const detail = { scoring: meta.scoring, category: meta.category, judgeModel: requestedJudgeModel, raw }
197
200
  return {
198
- resolved: score >= Number(process.env.FINRESEARCHBENCH_PASS_THRESHOLD ?? 0.8),
201
+ passed: score >= Number(process.env.FINRESEARCHBENCH_PASS_THRESHOLD ?? 0.8),
199
202
  score,
200
- detail: JSON.stringify({ scoring: meta.scoring, category: meta.category, judgeModel: requestedJudgeModel, raw }),
203
+ notes: JSON.stringify(detail),
204
+ raw: detail,
201
205
  judgeUsage: turn.usage,
202
206
  }
203
207
  }
204
208
 
205
- async function runOfficialJudge(task: BenchTask, meta: FinResearchMeta, response: string): Promise<BenchScore> {
209
+ async function runOfficialJudge(task: BenchTask, meta: FinResearchMeta, response: string): Promise<BenchEvaluation> {
206
210
  if (!meta.judgeSystemPrompt) throw new Error(`FinResearchBench task ${meta.id} missing judge_system_prompt`)
207
211
  const router = routerConfig()
208
212
  const turn = await runBenchRouterTurn(
@@ -229,62 +233,68 @@ function normalizeText(value: string): string {
229
233
  return value.toLowerCase().replace(/\s+/g, ' ').trim()
230
234
  }
231
235
 
232
- function scoreFixture(meta: FinResearchMeta, artifact: string): BenchScore {
236
+ function scoreFixture(meta: FinResearchMeta, artifact: string): BenchEvaluation {
233
237
  const answer = normalizeText(meta.referenceAnswer || meta.referenceReport)
234
238
  const response = normalizeText(artifact)
235
239
  const score = answer.length > 0 && response.includes(answer) ? 1 : 0
240
+ const raw = { scoring: meta.scoring, category: meta.category }
236
241
  return {
237
- resolved: score === 1,
242
+ passed: score === 1,
238
243
  score,
239
- detail: JSON.stringify({ scoring: meta.scoring, category: meta.category }),
244
+ notes: JSON.stringify(raw),
245
+ raw,
240
246
  }
241
247
  }
242
248
 
243
- export function createFinResearchBenchAdapter(): BenchmarkAdapter {
249
+ export function createFinResearchBenchAdapter(): RuntimeBenchmark {
244
250
  const fixturesMode = process.env.FINRESEARCHBENCH_FIXTURES === '1'
245
251
 
246
- return {
247
- name: 'finresearchbench',
252
+ return runtimeBenchmark({
253
+ id: 'finresearchbench',
248
254
 
249
- async preflight() {
250
- if (fixturesMode) {
251
- await assertReadable(FIXTURES, 'fixture file')
252
- return
253
- }
254
- const file = dataFile()
255
- if (!file) {
256
- throw new Error(
257
- 'FINRESEARCHBENCH_DATA_FILE is required. Fix: export the official FinResearchBench rows as JSON/JSONL with judge_system_prompt and judge_prompt_template fields, then set FINRESEARCHBENCH_DATA_FILE=/path/to/export.jsonl.',
258
- )
259
- }
260
- routerConfig()
261
- await assertReadable(file, 'data file')
262
- await loadOfficialTasks(file, { limit: 1 })
263
- },
264
-
265
- async loadTasks(opts: LoadOptions = {}) {
255
+ async loadAll(opts: LoadOptions = {}) {
266
256
  if (fixturesMode) return loadFixtures(opts)
267
257
  const file = dataFile()
268
258
  if (!file) throw new Error('FINRESEARCHBENCH_DATA_FILE is required to load FinResearchBench rows')
269
259
  return loadOfficialTasks(file, opts)
270
260
  },
271
261
 
272
- async goldArtifact(task: BenchTask) {
273
- const meta = readMeta(task)
274
- return meta.referenceReport || meta.referenceAnswer || undefined
275
- },
276
-
277
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
262
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
278
263
  const meta = readMeta(task)
279
264
  if (fixturesMode) return scoreFixture(meta, artifact)
280
265
  if (artifact.trim().length === 0) {
266
+ const raw = { scoring: meta.scoring, category: meta.category, reason: 'empty answer' }
281
267
  return {
282
- resolved: false,
268
+ passed: false,
283
269
  score: 0,
284
- detail: JSON.stringify({ scoring: meta.scoring, category: meta.category, reason: 'empty answer' }),
270
+ notes: JSON.stringify(raw),
271
+ raw,
285
272
  }
286
273
  }
287
274
  return runOfficialJudge(task, meta, artifact)
288
275
  },
289
- }
276
+
277
+ runtime: {
278
+ async preflight() {
279
+ if (fixturesMode) {
280
+ await assertReadable(FIXTURES, 'fixture file')
281
+ return
282
+ }
283
+ const file = dataFile()
284
+ if (!file) {
285
+ throw new Error(
286
+ 'FINRESEARCHBENCH_DATA_FILE is required. Fix: export the official FinResearchBench rows as JSON/JSONL with judge_system_prompt and judge_prompt_template fields, then set FINRESEARCHBENCH_DATA_FILE=/path/to/export.jsonl.',
287
+ )
288
+ }
289
+ routerConfig()
290
+ await assertReadable(file, 'data file')
291
+ await loadOfficialTasks(file, { limit: 1 })
292
+ },
293
+
294
+ async goldArtifact(task: BenchTask) {
295
+ const meta = readMeta(task)
296
+ return meta.referenceReport || meta.referenceAnswer || undefined
297
+ },
298
+ },
299
+ })
290
300
  }
@@ -8,23 +8,23 @@
8
8
  * and {response} (the student answer) placeholders. We faithfully REPLICATE the
9
9
  * benchmark's judge — fill the template, run it under the record's system prompt
10
10
  * via the pinned router (temperature 0), and parse the JSON the judge emits. The
11
- * judge returns an `answer_score` field; 1/positive = resolved, else not.
11
+ * judge returns an `answer_score` field; 1/positive = passed, else not.
12
12
  * This matches the FinSearchComp leaderboard (Grok-4-web 68.9%).
13
13
  *
14
14
  * There is NO deterministic Tier-1 path here: the gold answer is prose with
15
15
  * region-specific units, embedded tolerances ("允许1%的误差"), and multi-point
16
16
  * scoring criteria. The benchmark intends its own LLM judge to be the arbiter,
17
17
  * so the judge IS the score — fail loud on unparseable judge output (never
18
- * default to resolved).
18
+ * default to passed).
19
19
  *
20
20
  * SCOPE: T2 (Simple_Historical_Lookup) + T3 (Complex_Historical_Investigation)
21
21
  * are fully self-contained and supported. T1 (Time_Sensitive_Data_Fetching)
22
22
  * needs a live market snapshot / akshare ground truth to fill the judge's
23
- * {ground_truth} slot — it is SKIPPED in loadTasks and flagged in preflight.
23
+ * {ground_truth} slot — it is SKIPPED in loadAll and flagged in preflight.
24
24
  * See {@link T1Seam}.
25
25
  *
26
26
  * Requires for a live run: network access to the GitHub-hosted dataset JSON and
27
- * a TANGLE_API_KEY for the judge. For offline/CI verification, loadTasks falls back
27
+ * a TANGLE_API_KEY for the judge. For offline/CI verification, loadAll falls back
28
28
  * to the committed fixtures (bench/fixtures/finsearchcomp.json) with an explicit
29
29
  * console.warn — never a silent fallback.
30
30
  */
@@ -33,7 +33,7 @@ import { readFile } from 'node:fs/promises'
33
33
  import { join } from 'node:path'
34
34
  import { fileURLToPath } from 'node:url'
35
35
  import { runBenchRouterTurn } from '../router-turn'
36
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
36
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
37
37
 
38
38
  const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
39
39
  const FIXTURES = join(BENCH_ROOT, 'fixtures', 'finsearchcomp.json')
@@ -64,7 +64,7 @@ const WORKER_CONTRACT = [
64
64
  * live market snapshot the judge consumes via a {ground_truth} template slot;
65
65
  * the adapter does NOT fabricate that snapshot. Wiring T1 means supplying a
66
66
  * resolver that fetches the akshare/market value for the record at judge time
67
- * and filling {ground_truth}. Until then T1 is excluded from loadTasks.
67
+ * and filling {ground_truth}. Until then T1 is excluded from loadAll.
68
68
  */
69
69
  export interface T1Seam {
70
70
  promptId: string
@@ -119,8 +119,7 @@ function recordToTask(rec: FinSearchRecord): BenchTask {
119
119
  }
120
120
  return {
121
121
  id: rec.prompt_id,
122
- split: taskType,
123
- prompt: rec.prompt + WORKER_CONTRACT,
122
+ payload: { prompt: rec.prompt + WORKER_CONTRACT, subset: taskType },
124
123
  metadata: meta as unknown as Record<string, unknown>,
125
124
  }
126
125
  }
@@ -134,7 +133,7 @@ function readMeta(task: BenchTask): FinSearchMeta {
134
133
  typeof md.judgeSystemPrompt !== 'string' ||
135
134
  typeof md.rawPrompt !== 'string'
136
135
  ) {
137
- throw new Error(`FinSearchComp task ${task.id} missing judge metadata — loadTasks did not populate it`)
136
+ throw new Error(`FinSearchComp task ${task.id} missing judge metadata — loadAll did not populate it`)
138
137
  }
139
138
  return md as unknown as FinSearchMeta
140
139
  }
@@ -206,7 +205,7 @@ function parseJudgeOutput(content: string): { resolved: boolean; score: number;
206
205
  }
207
206
 
208
207
  /** Run the record's own judge via the router. Fail loud on transport/parse errors. */
209
- async function runRecordJudge(meta: FinSearchMeta, response: string, router: JudgeRouter): Promise<BenchScore> {
208
+ async function runRecordJudge(meta: FinSearchMeta, response: string, router: JudgeRouter): Promise<BenchEvaluation> {
210
209
  const turn = await runBenchRouterTurn(
211
210
  {
212
211
  routerBaseUrl: router.baseUrl,
@@ -227,15 +226,17 @@ async function runRecordJudge(meta: FinSearchMeta, response: string, router: Jud
227
226
  const content = turn.finalText
228
227
  if (!content) throw new Error('FinSearchComp judge returned no message content')
229
228
  const { resolved, score, raw } = parseJudgeOutput(content)
229
+ const evidence = {
230
+ taskType: meta.taskType,
231
+ region: meta.region,
232
+ answerScore: raw,
233
+ judgeModel: router.model,
234
+ }
230
235
  return {
231
- resolved,
236
+ passed: resolved,
232
237
  score,
233
- detail: JSON.stringify({
234
- taskType: meta.taskType,
235
- region: meta.region,
236
- answerScore: raw,
237
- judgeModel: router.model,
238
- }),
238
+ notes: JSON.stringify(evidence),
239
+ raw: evidence,
239
240
  }
240
241
  }
241
242
 
@@ -243,7 +244,7 @@ function selectRecords(records: FinSearchRecord[], opts: LoadOptions): BenchTask
243
244
  let tasks = records
244
245
  .filter((r) => SUPPORTED_TYPES.has(parseTaskType(r.prompt_id)))
245
246
  .map(recordToTask)
246
- if (opts.split) tasks = tasks.filter((t) => t.split === opts.split)
247
+ if (opts.subset) tasks = tasks.filter((t) => t.payload.subset === opts.subset)
247
248
  if (opts.ids) {
248
249
  const want = new Set(opts.ids)
249
250
  tasks = tasks.filter((t) => want.has(t.id))
@@ -292,45 +293,13 @@ async function fetchDataset(): Promise<FinSearchRecord[]> {
292
293
  return data
293
294
  }
294
295
 
295
- export function createFinsearchcompAdapter(): BenchmarkAdapter {
296
+ export function createFinsearchcompAdapter(): RuntimeBenchmark {
296
297
  const fixturesMode = process.env.FINSEARCHCOMP_FIXTURES === '1'
297
298
 
298
- return {
299
- name: 'finsearchcomp',
299
+ return runtimeBenchmark({
300
+ id: 'finsearchcomp',
300
301
 
301
- async preflight() {
302
- // The per-record LLM judge is the arbiter in both modes — its router
303
- // config must exist or no score can be produced.
304
- judgeRouter()
305
- console.warn(
306
- '[finsearchcomp] T1 (Time_Sensitive_Data_Fetching) is NOT scored: it needs a live ' +
307
- 'market snapshot / akshare ground truth for the judge {ground_truth} slot. ' +
308
- 'loadTasks supports T2 + T3 only; wire T1Seam to add T1.',
309
- )
310
- if (fixturesMode) {
311
- await readFile(FIXTURES, 'utf8').catch((err) => {
312
- throw new Error(
313
- `FINSEARCHCOMP_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
314
- )
315
- })
316
- return
317
- }
318
- const res = await fetch(DATASET_URL, { method: 'HEAD' }).catch((err) => {
319
- throw new Error(
320
- `finsearchcomp preflight failed reaching ${DATASET_URL}: ${err instanceof Error ? err.message : err}\n` +
321
- `Fix: ensure network access to raw.githubusercontent.com, or set FINSEARCHCOMP_FIXTURES=1 ` +
322
- `to run against the committed fixtures offline.`,
323
- )
324
- })
325
- if (!res.ok) {
326
- throw new Error(
327
- `finsearchcomp preflight: dataset HEAD ${res.status} for ${DATASET_URL}. ` +
328
- `Set FINSEARCHCOMP_FIXTURES=1 to run against the committed fixtures offline.`,
329
- )
330
- }
331
- },
332
-
333
- async loadTasks(opts: LoadOptions = {}) {
302
+ async loadAll(opts: LoadOptions = {}) {
334
303
  if (fixturesMode) return loadFixtures(opts)
335
304
  let records: FinSearchRecord[]
336
305
  try {
@@ -345,27 +314,63 @@ export function createFinsearchcompAdapter(): BenchmarkAdapter {
345
314
  return selectRecords(records, opts)
346
315
  },
347
316
 
348
- async goldArtifact(task: BenchTask) {
349
- // Gold artifact = the record's response_reference fed back as the student
350
- // answer, so verify-judge proves gold→resolved through the SAME per-record
351
- // judge the real artifact takes. The reference may carry tolerance/criteria
352
- // prose; the judge is built to read the value out of it.
353
- const meta = readMeta(task)
354
- return meta.responseReference
355
- },
356
-
357
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
317
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
358
318
  const meta = readMeta(task)
359
319
  const response = artifact.trim()
360
320
  if (response.length === 0) {
361
321
  // Fail-closed — the benchmark's own judges score an empty answer 0.
322
+ const raw = { taskType: meta.taskType, region: meta.region, reason: 'empty answer' }
362
323
  return {
363
- resolved: false,
324
+ passed: false,
364
325
  score: 0,
365
- detail: JSON.stringify({ taskType: meta.taskType, region: meta.region, reason: 'empty answer' }),
326
+ notes: JSON.stringify(raw),
327
+ raw,
366
328
  }
367
329
  }
368
330
  return runRecordJudge(meta, response, judgeRouter())
369
331
  },
370
- }
332
+
333
+ runtime: {
334
+ async preflight() {
335
+ // The per-record LLM judge is the arbiter in both modes — its router
336
+ // config must exist or no score can be produced.
337
+ judgeRouter()
338
+ console.warn(
339
+ '[finsearchcomp] T1 (Time_Sensitive_Data_Fetching) is NOT scored: it needs a live ' +
340
+ 'market snapshot / akshare ground truth for the judge {ground_truth} slot. ' +
341
+ 'loadAll supports T2 + T3 only; wire T1Seam to add T1.',
342
+ )
343
+ if (fixturesMode) {
344
+ await readFile(FIXTURES, 'utf8').catch((err) => {
345
+ throw new Error(
346
+ `FINSEARCHCOMP_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
347
+ )
348
+ })
349
+ return
350
+ }
351
+ const res = await fetch(DATASET_URL, { method: 'HEAD' }).catch((err) => {
352
+ throw new Error(
353
+ `finsearchcomp preflight failed reaching ${DATASET_URL}: ${err instanceof Error ? err.message : err}\n` +
354
+ `Fix: ensure network access to raw.githubusercontent.com, or set FINSEARCHCOMP_FIXTURES=1 ` +
355
+ `to run against the committed fixtures offline.`,
356
+ )
357
+ })
358
+ if (!res.ok) {
359
+ throw new Error(
360
+ `finsearchcomp preflight: dataset HEAD ${res.status} for ${DATASET_URL}. ` +
361
+ `Set FINSEARCHCOMP_FIXTURES=1 to run against the committed fixtures offline.`,
362
+ )
363
+ }
364
+ },
365
+
366
+ async goldArtifact(task: BenchTask) {
367
+ // Gold artifact = the record's response_reference fed back as the student
368
+ // answer, so verify-judge proves gold→passed through the SAME per-record
369
+ // judge the real artifact takes. The reference may carry tolerance/criteria
370
+ // prose; the judge is built to read the value out of it.
371
+ const meta = readMeta(task)
372
+ return meta.responseReference
373
+ },
374
+ },
375
+ })
371
376
  }