@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.
- package/CHANGELOG.md +29 -0
- package/README.md +24 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +63 -50
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +55 -44
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +3 -3
- package/dist/benchmarks/mcad-cq-bench.js +70 -58
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +63 -52
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +49 -43
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-DhAndllg.js → cadbench-htzAmMaI.js} +41 -36
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +64 -59
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +50 -0
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/src/adapters.ts +5 -7
- package/src/atom-mcp-e2e.mts +2 -2
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +36 -36
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +58 -48
- package/src/benchmarks/finsearchcomp.ts +73 -68
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +79 -74
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +61 -58
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +19 -16
- package/src/examples/lean-proof-gate.mts +1 -1
- package/src/examples/math-demo.mts +2 -2
- package/src/examples/strategy-demo.mts +1 -1
- package/src/gate-cli.mts +6 -6
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/generate-eval/certify.ts +4 -4
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +3 -3
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/swe-self-improve.mts +3 -3
- package/src/terminal-compare.ts +1 -1
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-DhAndllg.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -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
|
-
*
|
|
13
|
-
* (with its label) rides in `
|
|
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
|
|
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
|
|
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))
|
|
@@ -150,7 +150,7 @@ interface GraderRouter {
|
|
|
150
150
|
function graderRouter(): GraderRouter {
|
|
151
151
|
const key = process.env.TANGLE_API_KEY
|
|
152
152
|
if (!key) throw new Error('TANGLE_API_KEY is required for the SimpleQA grader (set the Tangle API key)')
|
|
153
|
-
const model = process.env.JUDGE_MODEL ?? 'deepseek-v4-flash'
|
|
153
|
+
const model = process.env.JUDGE_MODEL ?? 'deepseek/deepseek-v4.1-flash'
|
|
154
154
|
const baseUrl = process.env.ROUTER_BASE ?? 'https://router.tangle.tools/v1'
|
|
155
155
|
return { baseUrl, key, model }
|
|
156
156
|
}
|
|
@@ -206,8 +206,7 @@ function rowToTask(row: SimpleQaRow, index: number): BenchTask {
|
|
|
206
206
|
}
|
|
207
207
|
return {
|
|
208
208
|
id: `simpleqa-${index}`,
|
|
209
|
-
|
|
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 —
|
|
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
|
|
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():
|
|
267
|
+
export function createSimpleQaAdapter(): RuntimeBenchmark {
|
|
269
268
|
const fixturesMode = process.env.SIMPLEQA_FIXTURES === '1'
|
|
270
269
|
|
|
271
|
-
return {
|
|
272
|
-
|
|
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
|
|
273
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
306
274
|
if (fixturesMode) return loadFixtures(opts)
|
|
307
275
|
return loadLive(opts)
|
|
308
276
|
},
|
|
309
277
|
|
|
310
|
-
async
|
|
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
|
-
|
|
295
|
+
passed: false,
|
|
327
296
|
score: 0,
|
|
328
|
-
|
|
329
|
-
|
|
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
|
-
|
|
347
|
-
|
|
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.
|
|
85
|
-
const extract = adapter.
|
|
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)
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
stageFile,
|
|
24
24
|
type StagedRunCaptureSpec,
|
|
25
25
|
} from './_harness'
|
|
26
|
-
import
|
|
26
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
27
27
|
|
|
28
28
|
/** Root-level directories are not writable in every sandbox; use the session workspace. */
|
|
29
29
|
const SWE_REPO_DIR = './swe-bench-repo'
|
|
@@ -31,7 +31,7 @@ const SWE_REPO_DIR = './swe-bench-repo'
|
|
|
31
31
|
/**
|
|
32
32
|
* The SWE deliverable's FALLBACK parser, from the agent's event STREAM.
|
|
33
33
|
*
|
|
34
|
-
* The PRIMARY deliverable is `
|
|
34
|
+
* The PRIMARY deliverable is `workspaceExtract` below: a `git diff` of the agent's
|
|
35
35
|
* actual edits, read from the cloned repo's STATE inside the box (standard
|
|
36
36
|
* SWE-bench practice). This event-stream parse only runs when that diff is empty
|
|
37
37
|
* — a model that edited the source correctly but never printed a fenced diff (the
|
|
@@ -116,7 +116,7 @@ function stringIds(report: Record<string, unknown>, key: keyof SweReport): strin
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/** Convert one official report into a score without turning evaluator failures into agent failures. */
|
|
119
|
-
export function scoreSweReport(taskId: string, value: unknown):
|
|
119
|
+
export function scoreSweReport(taskId: string, value: unknown): BenchEvaluation {
|
|
120
120
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
121
121
|
throw new Error('swe-bench: report must be an object')
|
|
122
122
|
}
|
|
@@ -152,7 +152,7 @@ export function scoreSweReport(taskId: string, value: unknown): BenchScore {
|
|
|
152
152
|
throw new Error(`swe-bench: report lacks a completed evaluation for ${taskId}`)
|
|
153
153
|
}
|
|
154
154
|
const resolved = outcomes[0]
|
|
155
|
-
return { resolved, score: resolved ? 1 : 0,
|
|
155
|
+
return { passed: resolved, score: resolved ? 1 : 0, notes: JSON.stringify(report), raw: report }
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
export function sweEvaluationArgv(args: {
|
|
@@ -200,7 +200,7 @@ function sweMetadata(task: BenchTask): { repo: string; base: string } {
|
|
|
200
200
|
return { repo, base }
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
export function createSweBenchAdapter(options: SweBenchAdapterOptions = {}):
|
|
203
|
+
export function createSweBenchAdapter(options: SweBenchAdapterOptions = {}): RuntimeBenchmark {
|
|
204
204
|
if (
|
|
205
205
|
options.timeoutMs !== undefined
|
|
206
206
|
&& (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs <= 0)
|
|
@@ -213,45 +213,12 @@ export function createSweBenchAdapter(options: SweBenchAdapterOptions = {}): Ben
|
|
|
213
213
|
) throw new Error('swe-bench: captureEvaluatorArtifacts must be a function')
|
|
214
214
|
let attemptSequence = 0
|
|
215
215
|
let legacyFlags: boolean | undefined
|
|
216
|
-
return {
|
|
217
|
-
|
|
218
|
-
output: swePatchOutput,
|
|
216
|
+
return runtimeBenchmark({
|
|
217
|
+
id: 'swe-bench-verified',
|
|
219
218
|
|
|
220
|
-
|
|
221
|
-
// agent made in the cloned repo and diff it against the checked-out
|
|
222
|
-
// base_commit (`HEAD`). Test files are excluded — the judge applies the gold
|
|
223
|
-
// `test_patch` itself, so an agent edit to a test would collide on apply. The
|
|
224
|
-
// paths come out `a/<repo-relative>` (cwd = repo root), matching the gold
|
|
225
|
-
// patch format the swebench judge's `git apply` expects.
|
|
226
|
-
// Pre-stage: clone the instance repo at base_commit into SWE_REPO_DIR so the
|
|
227
|
-
// agent only edits (the harness owns the checkout — a stochastic model can't be
|
|
228
|
-
// trusted to clone to an exact path). `--quiet` keeps the exec output small.
|
|
229
|
-
boxSetup(task) {
|
|
230
|
-
const { repo, base } = sweMetadata(task)
|
|
231
|
-
return {
|
|
232
|
-
command: `rm -rf ${shellQuote(SWE_REPO_DIR)} && git clone --quiet ${shellQuote(`https://github.com/${repo}`)} ${shellQuote(SWE_REPO_DIR)} && git -C ${shellQuote(SWE_REPO_DIR)} checkout --quiet ${shellQuote(base)}`,
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
boxExtract() {
|
|
236
|
-
return {
|
|
237
|
-
command: `git -C ${shellQuote(SWE_REPO_DIR)} add -A && git -C ${shellQuote(SWE_REPO_DIR)} diff --cached -- . ${TEST_FILE_EXCLUDES}`,
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
async preflight() {
|
|
242
|
-
await preflightVenvImports({
|
|
243
|
-
modules: ['swebench'],
|
|
244
|
-
requireDocker: true,
|
|
245
|
-
fix:
|
|
246
|
-
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install 'swebench>=4,<6' ; ` +
|
|
247
|
-
`(2) ensure the Docker daemon is running (the judge builds per-instance images).`,
|
|
248
|
-
})
|
|
249
|
-
legacyFlags = await detectLegacyFlags()
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
async loadTasks(opts: LoadOptions = {}) {
|
|
219
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
253
220
|
const limit = opts.limit ?? 10
|
|
254
|
-
const split = opts.
|
|
221
|
+
const split = opts.subset ?? 'test'
|
|
255
222
|
// Dump instances as JSON via the datasets loader (HF download on first run).
|
|
256
223
|
const script = `
|
|
257
224
|
import json, sys
|
|
@@ -277,29 +244,26 @@ print(json.dumps(out))
|
|
|
277
244
|
return rows.map(
|
|
278
245
|
(r): BenchTask => ({
|
|
279
246
|
id: String(r.instance_id),
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
247
|
+
payload: {
|
|
248
|
+
subset: split,
|
|
249
|
+
prompt: [
|
|
250
|
+
`Repository: ${r.repo} @ ${r.base_commit}`,
|
|
251
|
+
'',
|
|
252
|
+
`The repository is ALREADY cloned at ${SWE_REPO_DIR} relative to your initial session workspace, checked out at commit ${r.base_commit}. Work there directly (\`cd ${SWE_REPO_DIR}\`); do not re-clone.`,
|
|
253
|
+
'',
|
|
254
|
+
'Resolve this issue by editing the repository SOURCE so the failing tests pass without breaking the passing ones. Do NOT edit test files — the evaluation runs hidden tests on a fresh checkout, so editing tests does not count. Keep the change minimal and confined to the cloned repo.',
|
|
255
|
+
'Work iteratively: reproduce the issue, implement the fix in the source, and re-run the relevant tests until they pass. You do NOT need to print the diff — the harness reads your source edits directly from the repo, including uncommitted changes.',
|
|
256
|
+
'',
|
|
257
|
+
'--- Issue ---',
|
|
258
|
+
String(r.problem_statement ?? ''),
|
|
259
|
+
].join('\n'),
|
|
260
|
+
},
|
|
292
261
|
metadata: r,
|
|
293
262
|
}),
|
|
294
263
|
)
|
|
295
264
|
},
|
|
296
265
|
|
|
297
|
-
async
|
|
298
|
-
const gold = task.metadata?.patch
|
|
299
|
-
return typeof gold === 'string' ? gold : undefined
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
266
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
303
267
|
const useLegacyFlags = await ensureLegacyFlags()
|
|
304
268
|
const runId = safeRunId('bench', task.id)
|
|
305
269
|
const capture = options.captureEvaluatorArtifacts?.({
|
|
@@ -338,7 +302,48 @@ print(json.dumps(out))
|
|
|
338
302
|
},
|
|
339
303
|
})
|
|
340
304
|
},
|
|
341
|
-
|
|
305
|
+
|
|
306
|
+
runtime: {
|
|
307
|
+
output: swePatchOutput,
|
|
308
|
+
|
|
309
|
+
// Extract the patch from repo STATE, not printed text: stage every edit the
|
|
310
|
+
// agent made in the cloned repo and diff it against the checked-out
|
|
311
|
+
// base_commit (`HEAD`). Test files are excluded — the judge applies the gold
|
|
312
|
+
// `test_patch` itself, so an agent edit to a test would collide on apply. The
|
|
313
|
+
// paths come out `a/<repo-relative>` (cwd = repo root), matching the gold
|
|
314
|
+
// patch format the swebench judge's `git apply` expects.
|
|
315
|
+
// Pre-stage: clone the instance repo at base_commit into SWE_REPO_DIR so the
|
|
316
|
+
// agent only edits (the harness owns the checkout — a stochastic model can't be
|
|
317
|
+
// trusted to clone to an exact path). `--quiet` keeps the exec output small.
|
|
318
|
+
workspaceSetup(task) {
|
|
319
|
+
const { repo, base } = sweMetadata(task)
|
|
320
|
+
return {
|
|
321
|
+
command: `rm -rf ${shellQuote(SWE_REPO_DIR)} && git clone --quiet ${shellQuote(`https://github.com/${repo}`)} ${shellQuote(SWE_REPO_DIR)} && git -C ${shellQuote(SWE_REPO_DIR)} checkout --quiet ${shellQuote(base)}`,
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
workspaceExtract() {
|
|
325
|
+
return {
|
|
326
|
+
command: `git -C ${shellQuote(SWE_REPO_DIR)} add -A && git -C ${shellQuote(SWE_REPO_DIR)} diff --cached -- . ${TEST_FILE_EXCLUDES}`,
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
async preflight() {
|
|
331
|
+
await preflightVenvImports({
|
|
332
|
+
modules: ['swebench'],
|
|
333
|
+
requireDocker: true,
|
|
334
|
+
fix:
|
|
335
|
+
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install 'swebench>=4,<6' ; ` +
|
|
336
|
+
`(2) ensure the Docker daemon is running (the judge builds per-instance images).`,
|
|
337
|
+
})
|
|
338
|
+
legacyFlags = await detectLegacyFlags()
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
async goldArtifact(task: BenchTask) {
|
|
342
|
+
const gold = task.metadata?.patch
|
|
343
|
+
return typeof gold === 'string' ? gold : undefined
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
})
|
|
342
347
|
|
|
343
348
|
async function detectLegacyFlags(): Promise<boolean> {
|
|
344
349
|
const script = `
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
import { readFile } from 'node:fs/promises'
|
|
10
10
|
import { join } from 'node:path'
|
|
11
11
|
import { benchRoot } from './_harness'
|
|
12
|
-
import
|
|
12
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
13
13
|
import {
|
|
14
14
|
FINAL_ANSWER_SENTINEL,
|
|
15
15
|
allStrings,
|
|
16
|
-
|
|
16
|
+
answerScoreToEvaluation,
|
|
17
17
|
contextBlock,
|
|
18
18
|
contextsFrom,
|
|
19
19
|
firstString,
|
|
@@ -83,19 +83,21 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
83
83
|
}
|
|
84
84
|
return {
|
|
85
85
|
id,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
payload: {
|
|
87
|
+
subset: stringFrom(raw.split) ?? subset,
|
|
88
|
+
prompt: [
|
|
89
|
+
'Answer this T2-RAGBench text-and-table financial question.',
|
|
90
|
+
'Do the required numerical reasoning from the supplied context before giving the final value.',
|
|
91
|
+
'End with a single final line: `FINAL ANSWER: <answer>`.',
|
|
92
|
+
'',
|
|
93
|
+
`Question: ${query}`,
|
|
94
|
+
`Document: ${documentId}`,
|
|
95
|
+
`Subset: ${subset}`,
|
|
96
|
+
contexts.length > 0 ? `\nContext:\n${contextBlock(contexts)}` : undefined,
|
|
97
|
+
]
|
|
98
|
+
.filter(Boolean)
|
|
99
|
+
.join('\n'),
|
|
100
|
+
},
|
|
99
101
|
metadata: meta as unknown as Record<string, unknown>,
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -103,7 +105,7 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
103
105
|
function readMeta(task: BenchTask): T2RagBenchMeta {
|
|
104
106
|
const md = task.metadata
|
|
105
107
|
if (!md || !Array.isArray(md.goldAnswers)) {
|
|
106
|
-
throw new Error(`T2-RAGBench task ${task.id} missing metadata —
|
|
108
|
+
throw new Error(`T2-RAGBench task ${task.id} missing metadata — loadAll did not populate it`)
|
|
107
109
|
}
|
|
108
110
|
return md as unknown as T2RagBenchMeta
|
|
109
111
|
}
|
|
@@ -120,47 +122,50 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
120
122
|
return selectTasks(rows.map(rowToTask), opts, 'T2-RAGBench')
|
|
121
123
|
}
|
|
122
124
|
|
|
123
|
-
export function createT2RagBenchAdapter():
|
|
125
|
+
export function createT2RagBenchAdapter(): RuntimeBenchmark {
|
|
124
126
|
const fixturesMode = process.env.T2_RAGBENCH_FIXTURES === '1'
|
|
125
127
|
|
|
126
|
-
return {
|
|
127
|
-
|
|
128
|
-
output: ragAnswerOutput,
|
|
129
|
-
|
|
130
|
-
async preflight() {
|
|
131
|
-
if (fixturesMode) {
|
|
132
|
-
await readFile(FIXTURES, 'utf8')
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
const path = dataFile()
|
|
136
|
-
if (!path) {
|
|
137
|
-
throw new Error(
|
|
138
|
-
'T2_RAGBENCH_DATA_FILE is required. Fix: export T2-RAGBench rows to JSONL and set T2_RAGBENCH_DATA_FILE=/path/to/t2-ragbench.jsonl, or set T2_RAGBENCH_FIXTURES=1 for adapter plumbing.',
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
await loadRows(path)
|
|
142
|
-
},
|
|
128
|
+
return runtimeBenchmark({
|
|
129
|
+
id: 't2-ragbench',
|
|
143
130
|
|
|
144
|
-
async
|
|
131
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
145
132
|
if (fixturesMode) return loadFixtures(opts)
|
|
146
133
|
const path = dataFile()
|
|
147
134
|
if (!path) throw new Error('T2_RAGBENCH_DATA_FILE is required to load T2-RAGBench tasks')
|
|
148
135
|
return selectTasks((await loadRows(path)).map(rowToTask), opts, 'T2-RAGBench')
|
|
149
136
|
},
|
|
150
137
|
|
|
151
|
-
async
|
|
152
|
-
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
138
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
156
139
|
const meta = readMeta(task)
|
|
157
140
|
const score = scoreAnswerArtifact(artifact, meta.goldAnswers, { numericTolerance: 0.01 })
|
|
158
|
-
return
|
|
141
|
+
return answerScoreToEvaluation(score, {
|
|
159
142
|
benchmark: meta.benchmark,
|
|
160
143
|
subset: meta.subset,
|
|
161
144
|
documentId: meta.documentId,
|
|
162
145
|
contextCount: meta.contexts.length,
|
|
163
146
|
})
|
|
164
147
|
},
|
|
165
|
-
|
|
148
|
+
|
|
149
|
+
runtime: {
|
|
150
|
+
output: ragAnswerOutput,
|
|
151
|
+
|
|
152
|
+
async preflight() {
|
|
153
|
+
if (fixturesMode) {
|
|
154
|
+
await readFile(FIXTURES, 'utf8')
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
const path = dataFile()
|
|
158
|
+
if (!path) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
'T2_RAGBENCH_DATA_FILE is required. Fix: export T2-RAGBench rows to JSONL and set T2_RAGBENCH_DATA_FILE=/path/to/t2-ragbench.jsonl, or set T2_RAGBENCH_FIXTURES=1 for adapter plumbing.',
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
await loadRows(path)
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
async goldArtifact(task: BenchTask) {
|
|
167
|
+
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
})
|
|
166
171
|
}
|