@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.
- package/CHANGELOG.md +27 -0
- package/README.md +32 -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 +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- 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 +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- 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 +62 -51
- 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 +46 -38
- 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-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- 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 +43 -22
- package/dist/index.js +297 -144
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/pier_agents/candidate_contract.py +226 -74
- package/pier_agents/tangle_candidate.py +79 -1
- package/pier_agents/workspace_boundary.py +29 -1
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- 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/scripts/verify-pier-agent.mts +142 -25
- package/src/adapters.ts +5 -7
- 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 +34 -32
- 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 +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- 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 +78 -73
- 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 +57 -52
- 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 +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +20 -11
- package/src/pier-agent.ts +108 -38
- package/src/pier-trial-controller.test.mts +48 -1
- package/src/pier-trial-controller.ts +121 -8
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- 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/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-Byr5gO1M.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
|
@@ -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
|
}
|
|
@@ -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
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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 —
|
|
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.
|
|
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.
|
|
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.
|
|
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):
|
|
262
|
+
export function createTauBenchAdapter(config: TauBenchConfig): RuntimeBenchmark {
|
|
261
263
|
const fixturesMode = process.env[config.fixturesEnv] === '1'
|
|
262
264
|
|
|
263
|
-
return {
|
|
264
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
298
|
+
passed: score === 1,
|
|
305
299
|
score,
|
|
306
|
-
|
|
307
|
-
|
|
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().
|
|
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 {
|
|
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():
|
|
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 {
|
|
13
|
+
import type { RuntimeBenchmark } from './types'
|
|
14
14
|
|
|
15
15
|
const FIXTURES = join(benchRoot, 'fixtures', 'tau3-banking.json')
|
|
16
16
|
|
|
17
|
-
export function createTau3BankingAdapter():
|
|
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/)
|