@tangle-network/agent-bench 2.0.0 → 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 +20 -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 +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 +9 -8
- package/dist/index.js +61 -56
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- 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/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 +17 -11
- 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
|
@@ -4,34 +4,36 @@
|
|
|
4
4
|
* the fail-loud guards — without a model, sandbox, or dataset. Run: `tsx bench/src/run-benchmarks.test.mts`.
|
|
5
5
|
*/
|
|
6
6
|
import assert from 'node:assert/strict'
|
|
7
|
-
import type
|
|
7
|
+
import { type BenchEvaluation, type BenchTask, type RuntimeBenchmark, runtimeBenchmark } from './benchmarks/types'
|
|
8
8
|
import { runBenchmarks, type BenchShot, type BenchExecution, type BenchExecutionContext } from './run-benchmarks'
|
|
9
9
|
|
|
10
|
-
function stubAdapter(name: string, n: number):
|
|
10
|
+
function stubAdapter(name: string, n: number): RuntimeBenchmark {
|
|
11
11
|
const tasks: BenchTask[] = Array.from({ length: n }, (_, i) => ({
|
|
12
12
|
id: `${name}-${i}`,
|
|
13
|
-
prompt: `solve ${name} ${i}
|
|
13
|
+
payload: { prompt: `solve ${name} ${i}` },
|
|
14
14
|
metadata: { gold: `GOLD-${name}-${i}` },
|
|
15
15
|
}))
|
|
16
|
-
return {
|
|
17
|
-
name,
|
|
18
|
-
|
|
19
|
-
loadTasks: async (o) => {
|
|
16
|
+
return runtimeBenchmark({
|
|
17
|
+
id: name,
|
|
18
|
+
loadAll: async (o) => {
|
|
20
19
|
let t = tasks
|
|
21
20
|
if (o?.ids) t = t.filter((x) => o.ids!.includes(x.id))
|
|
22
21
|
if (o?.limit !== undefined) t = t.slice(0, o.limit)
|
|
23
22
|
return t
|
|
24
23
|
},
|
|
25
|
-
|
|
24
|
+
evaluate: async (task, artifact): Promise<BenchEvaluation> => {
|
|
26
25
|
const gold = String(task.metadata?.gold)
|
|
27
|
-
return {
|
|
26
|
+
return { passed: artifact === gold, score: artifact === gold ? 1 : 0, raw: {} }
|
|
28
27
|
},
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
runtime: {
|
|
29
|
+
preflight: async () => {},
|
|
30
|
+
goldArtifact: async (task) => String(task.metadata?.gold),
|
|
31
|
+
},
|
|
32
|
+
})
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
const REGISTRY: Record<string,
|
|
34
|
-
const resolveStub = (key: string):
|
|
35
|
+
const REGISTRY: Record<string, RuntimeBenchmark> = { alpha: stubAdapter('alpha', 4), beta: stubAdapter('beta', 4) }
|
|
36
|
+
const resolveStub = (key: string): RuntimeBenchmark => {
|
|
35
37
|
const a = REGISTRY[key]
|
|
36
38
|
if (!a) throw new Error(`unknown benchmark: ${key}`)
|
|
37
39
|
return a
|
|
@@ -72,7 +74,7 @@ async function main(): Promise<void> {
|
|
|
72
74
|
const judgeFailure = await runBenchmarks({
|
|
73
75
|
benchmarks: ['alpha'], cells: [{ label: 'measured', model: 'm' }],
|
|
74
76
|
routerBaseUrl: 'x', routerKey: 'x', n: 1, verifyJudge: false,
|
|
75
|
-
resolveAdapter: () => ({ ...REGISTRY.alpha!,
|
|
77
|
+
resolveAdapter: () => ({ ...REGISTRY.alpha!, evaluate: async () => { throw new Error('judge unavailable') } }),
|
|
76
78
|
runShot: async () => ({ artifact: 'PATCH', ok: true, usage: { input: 23, output: 7, costUsd: 0.04 } }),
|
|
77
79
|
})
|
|
78
80
|
assert.equal(judgeFailure.perTask[0]?.ok, false)
|
|
@@ -146,7 +148,7 @@ async function main(): Promise<void> {
|
|
|
146
148
|
// Looped cells feed safe failure feedback into the next attempt and stop once the judge passes.
|
|
147
149
|
let prompts: string[] = []
|
|
148
150
|
const retryShot: BenchShot = async ({ task, prompt }) => {
|
|
149
|
-
prompts.push(prompt ?? task.prompt)
|
|
151
|
+
prompts.push(prompt ?? task.payload.prompt)
|
|
150
152
|
return { artifact: prompts.length === 1 ? 'WRONG' : String(task.metadata?.gold), ok: true, usage: { input: 11, output: 3, costUsd: 0.02 } }
|
|
151
153
|
}
|
|
152
154
|
const oneShot = await runBenchmarks({
|
|
@@ -214,17 +216,20 @@ async function main(): Promise<void> {
|
|
|
214
216
|
|
|
215
217
|
// A benchmark's detail may include hidden answer fields; those must never be fed back as hints.
|
|
216
218
|
const leakyGold = 'SECRET-GOLD'
|
|
217
|
-
const leaky:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
resolved: artifact === leakyGold,
|
|
219
|
+
const leaky: RuntimeBenchmark = runtimeBenchmark({
|
|
220
|
+
id: 'leaky',
|
|
221
|
+
loadAll: async () => [{ id: 'leaky-0', payload: { prompt: 'Answer the hidden task.' }, metadata: { gold: leakyGold } }],
|
|
222
|
+
evaluate: async (_task, artifact) => ({
|
|
223
|
+
passed: artifact === leakyGold,
|
|
223
224
|
score: artifact === leakyGold ? 1 : 0,
|
|
224
|
-
|
|
225
|
+
notes: JSON.stringify({ bestGold: leakyGold, expectedAnswer: leakyGold, publicHint: 'retry' }),
|
|
226
|
+
raw: {},
|
|
225
227
|
}),
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
runtime: {
|
|
229
|
+
preflight: async () => {},
|
|
230
|
+
goldArtifact: async () => leakyGold,
|
|
231
|
+
},
|
|
232
|
+
})
|
|
228
233
|
const leakyPrompts: string[] = []
|
|
229
234
|
const leakyShot: BenchShot = async ({ prompt }) => {
|
|
230
235
|
leakyPrompts.push(prompt ?? '')
|
|
@@ -270,15 +275,17 @@ async function main(): Promise<void> {
|
|
|
270
275
|
}
|
|
271
276
|
},
|
|
272
277
|
}
|
|
273
|
-
const boxAdapter:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
const boxAdapter: RuntimeBenchmark = runtimeBenchmark({
|
|
279
|
+
id: 'boxy',
|
|
280
|
+
loadAll: async () => [{ id: 'boxy-0', payload: { prompt: 'edit repo' }, metadata: {} }],
|
|
281
|
+
evaluate: async (_task, artifact) => ({ passed: artifact === 'PATCH', score: artifact === 'PATCH' ? 1 : 0, raw: {} }),
|
|
282
|
+
runtime: {
|
|
283
|
+
preflight: async () => {},
|
|
284
|
+
goldArtifact: async () => 'PATCH',
|
|
285
|
+
workspaceSetup: () => ({ command: 'setup-repo' }),
|
|
286
|
+
workspaceExtract: () => ({ command: 'extract-patch' }),
|
|
287
|
+
},
|
|
288
|
+
})
|
|
282
289
|
const boxy = await runBenchmarks({
|
|
283
290
|
benchmarks: ['boxy'],
|
|
284
291
|
cells: [{ label: 'default-shot', model: 'm', backend: 'sandbox' }],
|
|
@@ -291,7 +298,7 @@ async function main(): Promise<void> {
|
|
|
291
298
|
return fakeClient as never
|
|
292
299
|
},
|
|
293
300
|
})
|
|
294
|
-
assert.equal(boxy.rows[0]!.resolveRate, 1, '
|
|
301
|
+
assert.equal(boxy.rows[0]!.resolveRate, 1, 'workspaceExtract artifact is judged instead of fallback text')
|
|
295
302
|
assert.equal(boxy.perTask[0]?.artifact, 'PATCH')
|
|
296
303
|
assert.deepEqual(boxy.perTask[0]?.usage, { input: 23, output: 7, costUsd: 0.04 })
|
|
297
304
|
assert.deepEqual(boxy.perTask[0]?.execution, { phase: 'started', terminalOutcome: 'succeeded' })
|
|
@@ -308,7 +315,7 @@ async function main(): Promise<void> {
|
|
|
308
315
|
const failed = await runBenchmarks({
|
|
309
316
|
benchmarks: ['boxy'], cells: [{ label: failure, model: 'm', backend: 'sandbox' }],
|
|
310
317
|
routerBaseUrl: 'x', routerKey: 'x',
|
|
311
|
-
resolveAdapter: () => ({ ...boxAdapter, output: { parse: () => { throw new Error('parser failed') } } }),
|
|
318
|
+
resolveAdapter: () => ({ ...boxAdapter, runtime: { ...boxAdapter.runtime, output: { parse: () => { throw new Error('parser failed') } } } }),
|
|
312
319
|
resolveClient: () => fakeClient as never,
|
|
313
320
|
})
|
|
314
321
|
assert.equal(failed.perTask[0]?.measurement, 'unavailable')
|
|
@@ -349,9 +356,10 @@ async function main(): Promise<void> {
|
|
|
349
356
|
}
|
|
350
357
|
|
|
351
358
|
// An unavailable benchmark (preflight throws) is skipped, not fatal; the sweep still runs the rest.
|
|
352
|
-
const
|
|
359
|
+
const down = stubAdapter('down', 2)
|
|
360
|
+
const flaky: Record<string, RuntimeBenchmark> = {
|
|
353
361
|
ok: stubAdapter('ok', 2),
|
|
354
|
-
down: { ...
|
|
362
|
+
down: { ...down, runtime: { ...down.runtime, preflight: async () => { throw new Error('no docker') } } },
|
|
355
363
|
}
|
|
356
364
|
const mixed = await runBenchmarks({
|
|
357
365
|
benchmarks: ['ok', 'down'], cells: [{ label: 'perfect', model: 'm' }],
|
|
@@ -363,7 +371,7 @@ async function main(): Promise<void> {
|
|
|
363
371
|
assert.ok(mixed.rows.every((r) => r.benchmark === 'ok'), 'only the available benchmark produced rows')
|
|
364
372
|
|
|
365
373
|
// Judge self-verification: a miscalibrated judge (rejects its own gold) marks the bench unavailable.
|
|
366
|
-
const miscalibrated:
|
|
374
|
+
const miscalibrated: RuntimeBenchmark = { ...stubAdapter('mis', 2), evaluate: async () => ({ passed: false, score: 0, raw: {} }) }
|
|
367
375
|
const guarded = await runBenchmarks({
|
|
368
376
|
benchmarks: ['mis'], cells: [{ label: 'perfect', model: 'm' }],
|
|
369
377
|
routerBaseUrl: 'x', routerKey: 'x', runShot: shot,
|
|
@@ -429,19 +437,21 @@ async function managedExecutionProof(): Promise<void> {
|
|
|
429
437
|
}
|
|
430
438
|
},
|
|
431
439
|
}
|
|
432
|
-
const adapter:
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
boxSetup: () => ({ command: 'setup' }),
|
|
437
|
-
boxExtract: () => ({ command: 'extract' }),
|
|
438
|
-
goldArtifact: async () => 'PATCH',
|
|
439
|
-
judge: async (_task, artifact) => {
|
|
440
|
+
const adapter: RuntimeBenchmark = runtimeBenchmark({
|
|
441
|
+
id: 'managed',
|
|
442
|
+
loadAll: async () => [{ id: 'task', payload: { prompt: 'fix the branch' }, metadata: { gold: 'PRIVATE FINAL ORACLE' } }],
|
|
443
|
+
evaluate: async (_task, artifact) => {
|
|
440
444
|
grades += 1
|
|
441
445
|
operations.push('judge')
|
|
442
|
-
return {
|
|
446
|
+
return { passed: artifact === 'PATCH', score: artifact === 'PATCH' ? 1 : 0, raw: {} }
|
|
443
447
|
},
|
|
444
|
-
|
|
448
|
+
runtime: {
|
|
449
|
+
preflight: async () => {},
|
|
450
|
+
workspaceSetup: () => ({ command: 'setup' }),
|
|
451
|
+
workspaceExtract: () => ({ command: 'extract' }),
|
|
452
|
+
goldArtifact: async () => 'PATCH',
|
|
453
|
+
},
|
|
454
|
+
})
|
|
445
455
|
return {
|
|
446
456
|
operations, requests, get creates() { return creates }, get grades() { return grades },
|
|
447
457
|
run: (execute?: BenchExecution, loopAttempts = 1) => runBenchmarks({
|
package/src/run-benchmarks.ts
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* It owns no new mechanism. Each cell is one `openSandboxRun` shot (the same per-run primitive the
|
|
11
11
|
* SWE worker uses) driven by `resolveBenchClient` (off-box router completion OR in-box Sandbox; the
|
|
12
12
|
* harness rides `sandboxOverrides.backend.type`). The deliverable is the adapter's OWN parser
|
|
13
|
-
* (`adapter.output`), defaulting to the final answer text — so `runBenchmarks` needs no
|
|
13
|
+
* (`adapter.runtime.output`), defaulting to the final answer text — so `runBenchmarks` needs no
|
|
14
14
|
* per-benchmark branching. Concurrency is the shared `runPool`. The number comes from
|
|
15
|
-
* `adapter.
|
|
15
|
+
* `adapter.evaluate`, never a self-authored judge.
|
|
16
16
|
*
|
|
17
|
-
* Subset = the `benchmarks` and `cells` arrays plus `n`/`ids`/`
|
|
18
|
-
* `preflight()` fails (missing Docker/venv/dataset) is recorded as unavailable and skipped — the
|
|
17
|
+
* Subset = the `benchmarks` and `cells` arrays plus `n`/`ids`/`subset`. A benchmark whose
|
|
18
|
+
* `runtime.preflight()` fails (missing Docker/venv/dataset) is recorded as unavailable and skipped — the
|
|
19
19
|
* sweep never aborts because one bench's harness is absent.
|
|
20
20
|
*
|
|
21
21
|
* const report = await runBenchmarks({
|
|
@@ -41,7 +41,7 @@ import type {
|
|
|
41
41
|
import { openSandboxRun, SandboxRunAbortError, sumSandboxUsage } from '@tangle-network/agent-runtime/kernel'
|
|
42
42
|
import type { SandboxEvent } from '@tangle-network/sandbox'
|
|
43
43
|
import { resolveAdapter } from './adapters'
|
|
44
|
-
import type {
|
|
44
|
+
import type { BenchEvaluation, BenchTask, RuntimeBenchmark } from './benchmarks/types'
|
|
45
45
|
import { runRefineLoop } from './refine-loop'
|
|
46
46
|
import { resolveBenchClient } from './resolve-client'
|
|
47
47
|
import { runPool } from './run-pool'
|
|
@@ -111,10 +111,10 @@ export interface BenchShotResult {
|
|
|
111
111
|
|
|
112
112
|
/** Runs one (adapter, task, cell) shot. Defaults to `openSandboxRun`. */
|
|
113
113
|
export type BenchShot = (input: {
|
|
114
|
-
readonly adapter:
|
|
114
|
+
readonly adapter: RuntimeBenchmark
|
|
115
115
|
readonly task: BenchTask
|
|
116
116
|
readonly cell: BenchCell
|
|
117
|
-
/** Prompt to hand to the worker. Defaults to `
|
|
117
|
+
/** Prompt to hand to the worker. Defaults to `adapter.runtime.prompt(task)`; looped runs pass revised prompts. */
|
|
118
118
|
readonly prompt?: string
|
|
119
119
|
/** 1-based attempt index for looped runs. */
|
|
120
120
|
readonly attempt?: number
|
|
@@ -147,7 +147,8 @@ export interface RunBenchmarksOptions {
|
|
|
147
147
|
/** Tasks per benchmark (the n). */
|
|
148
148
|
readonly n?: number
|
|
149
149
|
readonly ids?: string[]
|
|
150
|
-
|
|
150
|
+
/** The publisher's subset (domain, category, language), for benchmarks that have them. */
|
|
151
|
+
readonly subset?: string
|
|
151
152
|
/** Replicates per (benchmark × cell × task). Default 1. */
|
|
152
153
|
readonly reps?: number
|
|
153
154
|
/** Bounded concurrency across all shots. Default 4. */
|
|
@@ -169,7 +170,7 @@ export interface RunBenchmarksOptions {
|
|
|
169
170
|
/** Test seam: a deterministic shot runner. Defaults to the `openSandboxRun` leaf. */
|
|
170
171
|
readonly runShot?: BenchShot
|
|
171
172
|
/** Test seam: resolve a benchmark key to an adapter. Defaults to the registry `resolveAdapter`. */
|
|
172
|
-
readonly resolveAdapter?: (key: string) =>
|
|
173
|
+
readonly resolveAdapter?: (key: string) => RuntimeBenchmark
|
|
173
174
|
readonly onResult?: (r: BenchCellTaskResult) => void
|
|
174
175
|
}
|
|
175
176
|
|
|
@@ -257,7 +258,10 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
257
258
|
// supplied profile declared rather than being dropped when one is supplied. `buildBackendOptions`
|
|
258
259
|
// now sends this provider/model pair on the create request and refuses a conflicting override,
|
|
259
260
|
// so the two must be derived from the same profile.
|
|
260
|
-
|
|
261
|
+
// A Bridge cell names the Bridge's own model id, `harness/provider/model`; its provider is the middle segment.
|
|
262
|
+
const bridgeRoute = cell.backend === 'bridge' && cell.model.startsWith(`${harness}/`) ? cell.model.slice(harness.length + 1) : undefined
|
|
263
|
+
const bridgeProvider = bridgeRoute?.includes('/') ? bridgeRoute.slice(0, bridgeRoute.indexOf('/')) : undefined
|
|
264
|
+
const profileProvider = cell.profile?.model?.provider ?? bridgeProvider ?? 'tangle-router'
|
|
261
265
|
const profile: AgentProfile = {
|
|
262
266
|
...(cell.profile ?? { name: cell.label }),
|
|
263
267
|
harness: harness as AgentProfile['harness'],
|
|
@@ -272,14 +276,14 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
272
276
|
name: cell.label,
|
|
273
277
|
taskToPrompt: () => '',
|
|
274
278
|
sandboxOverrides: {
|
|
275
|
-
name: `bench-${adapter.
|
|
279
|
+
name: `bench-${adapter.id}-${task.id}-${uniq}`.replace(/[^a-zA-Z0-9_.-]/g, '_').slice(0, 60),
|
|
276
280
|
environment: 'universal',
|
|
277
281
|
backend: { type: harness as never, model: { provider: profileProvider, model: cell.model, baseUrl: routerBaseUrl, ...(modelApiKey === undefined ? {} : { apiKey: modelApiKey }) } },
|
|
278
282
|
},
|
|
279
283
|
}
|
|
280
284
|
const deliverable: Deliverable<string> = {
|
|
281
285
|
kind: 'events',
|
|
282
|
-
fromEvents: (events) => (adapter.output ? adapter.output.parse(events) : finalText(events)),
|
|
286
|
+
fromEvents: (events) => (adapter.runtime.output ? adapter.runtime.output.parse(events) : finalText(events)),
|
|
283
287
|
}
|
|
284
288
|
const controller = new AbortController()
|
|
285
289
|
const timer = timeoutMs ? setTimeout(() => controller.abort(), timeoutMs) : undefined
|
|
@@ -287,14 +291,14 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
287
291
|
const runOptions: OpenSandboxRunOptions = {
|
|
288
292
|
agentRun,
|
|
289
293
|
signal: signal ? AbortSignal.any([controller.signal, signal]) : controller.signal,
|
|
290
|
-
runId: `bench:${adapter.
|
|
294
|
+
runId: `bench:${adapter.id}:${task.id}:${uniq}`,
|
|
291
295
|
scenarioId: task.id,
|
|
292
296
|
onSandboxEvent: (event) => { observedEvents.push(event) },
|
|
293
297
|
}
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
298
|
+
const workspaceSetup = adapter.runtime.workspaceSetup
|
|
299
|
+
if (workspaceSetup) {
|
|
296
300
|
runOptions.beforeStart = async ({ box, sessionId }) => {
|
|
297
|
-
const setup =
|
|
301
|
+
const setup = workspaceSetup(task)
|
|
298
302
|
const sres = await box.exec(setup.command, {
|
|
299
303
|
timeoutMs: 300_000,
|
|
300
304
|
sessionId,
|
|
@@ -302,7 +306,7 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
302
306
|
})
|
|
303
307
|
if (sres.exitCode !== 0)
|
|
304
308
|
throw new Error(
|
|
305
|
-
`
|
|
309
|
+
`workspaceSetup failed (exit ${sres.exitCode}): ${(sres.stderr ?? '').slice(0, 200)}`,
|
|
306
310
|
)
|
|
307
311
|
}
|
|
308
312
|
}
|
|
@@ -366,7 +370,7 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
366
370
|
return pending
|
|
367
371
|
}
|
|
368
372
|
const context: BenchExecutionContext = {
|
|
369
|
-
prompt: prompt ??
|
|
373
|
+
prompt: prompt ?? adapter.runtime.prompt(task), profile: structuredClone(profile), benchmark: adapter.id, taskId: task.id, attempt,
|
|
370
374
|
signal: runOptions.signal,
|
|
371
375
|
run: {
|
|
372
376
|
start: (input) => invoke('start', input),
|
|
@@ -398,16 +402,16 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
398
402
|
terminalOutcome: turn.outcome.success ? 'succeeded' : turn.outcome.status === 'failed' ? 'failed' : 'incomplete',
|
|
399
403
|
},
|
|
400
404
|
}
|
|
401
|
-
// Event-stream deliverable (adapter.output ?? finalText) — the FALLBACK.
|
|
405
|
+
// Event-stream deliverable (adapter.runtime.output ?? finalText) — the FALLBACK.
|
|
402
406
|
let artifact = (turn.out ?? '').trim()
|
|
403
|
-
let
|
|
407
|
+
let workspaceExtractError: string | undefined
|
|
404
408
|
// Primary deliverable for benchmarks whose real artifact lives in the box FS
|
|
405
409
|
// (SWE-bench: a git diff of the agent's edits). Run the adapter's extraction
|
|
406
410
|
// command in the STILL-ALIVE box (valid until run.close() below) and prefer its
|
|
407
411
|
// stdout; the event-stream parse remains the fallback when the box yields nothing.
|
|
408
|
-
if (adapter.
|
|
412
|
+
if (adapter.runtime.workspaceExtract) {
|
|
409
413
|
try {
|
|
410
|
-
const ex = adapter.
|
|
414
|
+
const ex = adapter.runtime.workspaceExtract(task)
|
|
411
415
|
// The agent runs under a DRIVER SESSION whose workspace is a remapped
|
|
412
416
|
// virtual root; an exec WITHOUT that sessionId lands on the host FS and
|
|
413
417
|
// cannot see the agent's edits. Thread run.sessionId so the extraction
|
|
@@ -419,12 +423,12 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
419
423
|
})
|
|
420
424
|
const boxArtifact = (res.stdout ?? '').trim()
|
|
421
425
|
if (res.exitCode !== 0)
|
|
422
|
-
|
|
426
|
+
workspaceExtractError = `exit ${res.exitCode}: ${(res.stderr ?? '').slice(0, 160)}`
|
|
423
427
|
else if (boxArtifact.length > 0) artifact = boxArtifact
|
|
424
428
|
if (process.env.BENCH_ARTIFACT_DIR) {
|
|
425
429
|
try {
|
|
426
430
|
mkdirSync(process.env.BENCH_ARTIFACT_DIR, { recursive: true })
|
|
427
|
-
const safe = `${adapter.
|
|
431
|
+
const safe = `${adapter.id}_${task.id}_${uniq}`.replace(/[^a-zA-Z0-9_.-]/g, '_')
|
|
428
432
|
const map = await run.box
|
|
429
433
|
.exec(
|
|
430
434
|
'echo "PWD:"; pwd; echo "LS:"; ls -la; echo "GITROOTS:"; find / -maxdepth 5 -type d -name .git 2>/dev/null; echo "SETTINGS:"; find / -maxdepth 8 -name global_settings.py -path "*conf*" 2>/dev/null',
|
|
@@ -444,7 +448,7 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
444
448
|
}
|
|
445
449
|
}
|
|
446
450
|
} catch (err) {
|
|
447
|
-
|
|
451
|
+
workspaceExtractError = err instanceof Error ? err.message.slice(0, 160) : String(err)
|
|
448
452
|
}
|
|
449
453
|
}
|
|
450
454
|
const detail =
|
|
@@ -452,8 +456,8 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
452
456
|
? turn.outcome.error ?? `agent ended with status ${turn.outcome.status}`
|
|
453
457
|
: turn.readError !== undefined
|
|
454
458
|
? `read: ${turn.readError.slice(0, 160)}`
|
|
455
|
-
:
|
|
456
|
-
? `
|
|
459
|
+
: workspaceExtractError !== undefined
|
|
460
|
+
? `workspaceExtract: ${workspaceExtractError}`
|
|
457
461
|
: undefined
|
|
458
462
|
// Debug affordance: dump the judged artifact (the exact model_patch the judge
|
|
459
463
|
// will score) so a scoring failure can be diagnosed off the real bytes without
|
|
@@ -461,7 +465,7 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
461
465
|
if (process.env.BENCH_ARTIFACT_DIR) {
|
|
462
466
|
try {
|
|
463
467
|
mkdirSync(process.env.BENCH_ARTIFACT_DIR, { recursive: true })
|
|
464
|
-
const safe = `${adapter.
|
|
468
|
+
const safe = `${adapter.id}_${task.id}_${uniq}`.replace(/[^a-zA-Z0-9_.-]/g, '_')
|
|
465
469
|
writeFileSync(`${process.env.BENCH_ARTIFACT_DIR}/${safe}.patch`, artifact)
|
|
466
470
|
} catch {
|
|
467
471
|
// debug-only; never fail the shot on a dump error
|
|
@@ -469,9 +473,9 @@ const openSandboxShot: BenchShot = async ({ adapter, task, cell, prompt, attempt
|
|
|
469
473
|
}
|
|
470
474
|
result = {
|
|
471
475
|
artifact,
|
|
472
|
-
ok: turn.outcome.success && artifact.length > 0 && turn.readError === undefined &&
|
|
476
|
+
ok: turn.outcome.success && artifact.length > 0 && turn.readError === undefined && workspaceExtractError === undefined,
|
|
473
477
|
execution: result.execution,
|
|
474
|
-
artifactAvailable: turn.readError === undefined &&
|
|
478
|
+
artifactAvailable: turn.readError === undefined && workspaceExtractError === undefined,
|
|
475
479
|
usage: result.usage,
|
|
476
480
|
events: observedEvents,
|
|
477
481
|
prompts,
|
|
@@ -543,11 +547,11 @@ function redactJudgeLeak(value: unknown): unknown {
|
|
|
543
547
|
return out
|
|
544
548
|
}
|
|
545
549
|
|
|
546
|
-
function safeFeedback(score:
|
|
550
|
+
function safeFeedback(score: BenchEvaluation): Record<string, unknown> {
|
|
547
551
|
return {
|
|
548
|
-
resolved: score.
|
|
552
|
+
resolved: score.passed === true,
|
|
549
553
|
score: score.score,
|
|
550
|
-
...(score.
|
|
554
|
+
...(score.notes ? { detail: redactJudgeLeak(parseMaybeJson(score.notes)) } : {}),
|
|
551
555
|
}
|
|
552
556
|
}
|
|
553
557
|
|
|
@@ -555,7 +559,7 @@ function truncate(value: string, max = 4_000): string {
|
|
|
555
559
|
return value.length <= max ? value : `${value.slice(0, max)}\n...[truncated ${value.length - max} chars]`
|
|
556
560
|
}
|
|
557
561
|
|
|
558
|
-
function retryPrompt(
|
|
562
|
+
function retryPrompt(prompt: string, history: ReadonlyArray<{ round: number; artifact: string }>, scores: ReadonlyMap<number, BenchEvaluation>): string {
|
|
559
563
|
const attempts = history
|
|
560
564
|
.map((h) => {
|
|
561
565
|
const score = scores.get(h.round)
|
|
@@ -575,7 +579,7 @@ function retryPrompt(task: BenchTask, history: ReadonlyArray<{ round: number; ar
|
|
|
575
579
|
'Return the corrected artifact in exactly the format requested by the original task.',
|
|
576
580
|
'',
|
|
577
581
|
'Original task:',
|
|
578
|
-
|
|
582
|
+
prompt,
|
|
579
583
|
'',
|
|
580
584
|
'Previous attempts and safe checker feedback:',
|
|
581
585
|
attempts,
|
|
@@ -587,14 +591,17 @@ async function loopedShot(
|
|
|
587
591
|
shot: BenchShot,
|
|
588
592
|
attempts: number,
|
|
589
593
|
): Promise<BenchShotResult> {
|
|
590
|
-
const scores = new Map<number,
|
|
594
|
+
const scores = new Map<number, BenchEvaluation>()
|
|
591
595
|
const shots = new Map<number, BenchShotResult>()
|
|
592
596
|
let pendingShot = false
|
|
593
597
|
let result: Awaited<ReturnType<typeof runRefineLoop<string>>>
|
|
594
598
|
try {
|
|
595
599
|
result = await runRefineLoop<string>({
|
|
596
600
|
rounds: attempts,
|
|
597
|
-
prompt: (round, history) =>
|
|
601
|
+
prompt: (round, history) => {
|
|
602
|
+
const original = input.adapter.runtime.prompt(input.task)
|
|
603
|
+
return round === 1 ? original : retryPrompt(original, history, scores)
|
|
604
|
+
},
|
|
598
605
|
runShot: async (prompt, round) => {
|
|
599
606
|
input.signal?.throwIfAborted()
|
|
600
607
|
pendingShot = true
|
|
@@ -604,10 +611,10 @@ async function loopedShot(
|
|
|
604
611
|
return { artifact: out.artifact, note: out.detail }
|
|
605
612
|
},
|
|
606
613
|
judge: async (artifact, round) => {
|
|
607
|
-
const score = await input.adapter.
|
|
614
|
+
const score = await input.adapter.evaluate(input.task, artifact)
|
|
608
615
|
scores.set(round, score)
|
|
609
616
|
const succeeded = shots.get(round)?.ok === true
|
|
610
|
-
return { valid: succeeded && score.
|
|
617
|
+
return { valid: succeeded && score.passed === true, score: succeeded ? score.score : 0 }
|
|
611
618
|
},
|
|
612
619
|
})
|
|
613
620
|
} catch (err) {
|
|
@@ -633,8 +640,8 @@ async function loopedShot(
|
|
|
633
640
|
const b = scores.get(candidate.round)
|
|
634
641
|
if (!a) return candidate
|
|
635
642
|
if (!b) return winner
|
|
636
|
-
if (b.
|
|
637
|
-
if (b.
|
|
643
|
+
if (b.passed && !a.passed) return candidate
|
|
644
|
+
if (!!b.passed === !!a.passed && b.score > a.score) return candidate
|
|
638
645
|
return winner
|
|
639
646
|
}, result.rounds[0]!)
|
|
640
647
|
const bestScore = scores.get(best.round)
|
|
@@ -655,7 +662,7 @@ async function loopedShot(
|
|
|
655
662
|
rounds: result.rounds.map((round) => ({
|
|
656
663
|
attempt: round.round,
|
|
657
664
|
score: scores.get(round.round)?.score ?? null,
|
|
658
|
-
resolved: scores.get(round.round)?.
|
|
665
|
+
resolved: scores.get(round.round)?.passed ?? null,
|
|
659
666
|
note: round.note ?? null,
|
|
660
667
|
})),
|
|
661
668
|
}),
|
|
@@ -695,7 +702,7 @@ function combineDetails(runDetail: string | undefined, scoreDetail: string | und
|
|
|
695
702
|
|
|
696
703
|
interface Job {
|
|
697
704
|
readonly benchmark: string
|
|
698
|
-
readonly adapter:
|
|
705
|
+
readonly adapter: RuntimeBenchmark
|
|
699
706
|
readonly cell: BenchCell
|
|
700
707
|
readonly task: BenchTask
|
|
701
708
|
readonly rep: number
|
|
@@ -705,29 +712,29 @@ interface Job {
|
|
|
705
712
|
* whose harness is absent or whose judge rejects its own gold is recorded unavailable, not run. */
|
|
706
713
|
async function prepareBenchmarks(
|
|
707
714
|
benchmarks: readonly string[],
|
|
708
|
-
resolve: (key: string) =>
|
|
709
|
-
opts: Pick<RunBenchmarksOptions, 'n' | 'ids' | '
|
|
710
|
-
): Promise<{ ready: Array<{ benchmark: string; adapter:
|
|
711
|
-
const ready: Array<{ benchmark: string; adapter:
|
|
715
|
+
resolve: (key: string) => RuntimeBenchmark,
|
|
716
|
+
opts: Pick<RunBenchmarksOptions, 'n' | 'ids' | 'subset' | 'verifyJudge'>,
|
|
717
|
+
): Promise<{ ready: Array<{ benchmark: string; adapter: RuntimeBenchmark; tasks: BenchTask[] }>; unavailable: Array<{ benchmark: string; reason: string }> }> {
|
|
718
|
+
const ready: Array<{ benchmark: string; adapter: RuntimeBenchmark; tasks: BenchTask[] }> = []
|
|
712
719
|
const unavailable: Array<{ benchmark: string; reason: string }> = []
|
|
713
720
|
for (const benchmark of benchmarks) {
|
|
714
721
|
const adapter = resolve(benchmark) // throws on an unknown key — fail loud on a typo
|
|
715
722
|
try {
|
|
716
|
-
await adapter.preflight()
|
|
717
|
-
const tasks = await adapter.
|
|
723
|
+
await adapter.runtime.preflight?.()
|
|
724
|
+
const tasks = await adapter.loadAll({
|
|
718
725
|
...(opts.n !== undefined ? { limit: opts.n } : {}),
|
|
719
726
|
...(opts.ids ? { ids: opts.ids } : {}),
|
|
720
|
-
...(opts.
|
|
727
|
+
...(opts.subset ? { subset: opts.subset } : {}),
|
|
721
728
|
})
|
|
722
729
|
if (tasks.length === 0) {
|
|
723
|
-
unavailable.push({ benchmark, reason: '
|
|
730
|
+
unavailable.push({ benchmark, reason: 'loadAll returned no tasks' })
|
|
724
731
|
continue
|
|
725
732
|
}
|
|
726
733
|
if (opts.verifyJudge !== false) {
|
|
727
|
-
const gold = await adapter.goldArtifact(tasks[0]!)
|
|
734
|
+
const gold = await adapter.runtime.goldArtifact?.(tasks[0]!)
|
|
728
735
|
if (gold !== undefined) {
|
|
729
|
-
const verdict = await adapter.
|
|
730
|
-
if (!verdict.
|
|
736
|
+
const verdict = await adapter.evaluate(tasks[0]!, gold)
|
|
737
|
+
if (!verdict.passed) {
|
|
731
738
|
unavailable.push({ benchmark, reason: `judge rejected its own gold on ${tasks[0]!.id} — judge is miscalibrated` })
|
|
732
739
|
continue
|
|
733
740
|
}
|
|
@@ -780,18 +787,18 @@ export async function runBenchmarks(opts: RunBenchmarksOptions): Promise<RunBenc
|
|
|
780
787
|
}
|
|
781
788
|
invoked = true
|
|
782
789
|
out = loopAttempts > 1 ? await loopedShot(shotInput, shot, loopAttempts) : await shot(shotInput)
|
|
783
|
-
const score:
|
|
790
|
+
const score: BenchEvaluation = await job.adapter.evaluate(job.task, out.artifact)
|
|
784
791
|
result = {
|
|
785
792
|
benchmark: job.benchmark,
|
|
786
793
|
cell: job.cell.label,
|
|
787
794
|
taskId: job.task.id,
|
|
788
795
|
rep: job.rep,
|
|
789
|
-
resolved: out.ok && score.
|
|
796
|
+
resolved: out.ok && score.passed === true,
|
|
790
797
|
score: out.ok ? score.score : 0,
|
|
791
798
|
ok: out.ok,
|
|
792
799
|
execution: out.execution ?? { phase: out.ok ? 'started' : 'unknown', terminalOutcome: out.ok ? 'succeeded' : 'unknown' },
|
|
793
800
|
measurement: (out.artifactAvailable ?? out.ok) ? 'available' : 'unavailable',
|
|
794
|
-
...(out.detail ?? score.
|
|
801
|
+
...(out.detail ?? score.notes ? { detail: combineDetails(out.detail, score.notes) } : {}),
|
|
795
802
|
wallMs: Date.now() - startedAt,
|
|
796
803
|
artifact: out.artifact,
|
|
797
804
|
...(out.usage === undefined ? {} : { usage: out.usage }),
|
package/src/swe-bench-env.ts
CHANGED
|
@@ -63,7 +63,7 @@ export const SWE_SEED_PROMPT =
|
|
|
63
63
|
* The WITH-TOOLS arm: the baseline prompt PLUS the run-tool workflow (write a failing repro, edit, re-run
|
|
64
64
|
* until it passes). Only used when the environment is built with `enableRun`. Kept as a separate constant
|
|
65
65
|
* so enabling the run tool never mutates the read/edit-only baseline. Also reconciles the now-active
|
|
66
|
-
* confusion from
|
|
66
|
+
* confusion from loadAll's userPrompt (which says the repo is "at /work, cd /work" — the container path
|
|
67
67
|
* from the sandbox path; here the run tool's cwd is the repo root and there is nothing to cd into).
|
|
68
68
|
*/
|
|
69
69
|
// NOTE (WAF): the router sits behind a Cloudflare WAF whose RCE ruleset 403s any request body that
|
|
@@ -291,8 +291,8 @@ export async function createSweBenchEnvironment(
|
|
|
291
291
|
// the established read/edit-only baseline byte-identical.
|
|
292
292
|
const enableRun = opts.enableRun ?? false
|
|
293
293
|
const pool = opts.ids?.length
|
|
294
|
-
? await adapter.
|
|
295
|
-
: await adapter.
|
|
294
|
+
? await adapter.loadAll({ ids: [...opts.ids], subset: 'test' })
|
|
295
|
+
: await adapter.loadAll({ limit: poolN, subset: 'test' })
|
|
296
296
|
const byId = new Map(pool.map((t) => [t.id, t]))
|
|
297
297
|
// Each environment owns its workspace registry so concurrent environments don't share state.
|
|
298
298
|
const workspaces = new Map<string, Ws>()
|
|
@@ -518,8 +518,8 @@ export async function createSweBenchEnvironment(
|
|
|
518
518
|
}
|
|
519
519
|
if (!patch.trim()) return { passes: 0, total: 1, errored: 0 }
|
|
520
520
|
try {
|
|
521
|
-
const s = await adapter.
|
|
522
|
-
return { passes: s.
|
|
521
|
+
const s = await adapter.evaluate(ws.task, patch)
|
|
522
|
+
return { passes: s.passed ? 1 : 0, total: 1, errored: 0 }
|
|
523
523
|
} catch {
|
|
524
524
|
return { passes: 0, total: 1, errored: 1 }
|
|
525
525
|
}
|
|
@@ -538,7 +538,7 @@ export async function createSweBenchEnvironment(
|
|
|
538
538
|
return slice.map((bt) => ({
|
|
539
539
|
id: bt.id,
|
|
540
540
|
systemPrompt: enableRun ? SWE_SEED_PROMPT_WITH_RUN : SWE_SEED_PROMPT,
|
|
541
|
-
userPrompt: bt.prompt,
|
|
541
|
+
userPrompt: bt.payload.prompt,
|
|
542
542
|
meta: { instanceId: bt.id },
|
|
543
543
|
}))
|
|
544
544
|
}
|
package/src/worker.ts
CHANGED
|
@@ -79,7 +79,7 @@ export async function solveShot(
|
|
|
79
79
|
'',
|
|
80
80
|
'Resolve this issue by editing the SOURCE (never the tests):',
|
|
81
81
|
'',
|
|
82
|
-
String(md.problem_statement ?? task.prompt),
|
|
82
|
+
String(md.problem_statement ?? task.payload.prompt),
|
|
83
83
|
steer ? `\n--- Guidance from a prior failed attempt ---\n${steer}\n` : '',
|
|
84
84
|
'',
|
|
85
85
|
`When finished, from the repo root run EXACTLY:`,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BenchmarkAdapter } from "./types.js";
|
|
2
|
-
import { OutputAdapter } from "@tangle-network/agent-runtime/kernel";
|
|
3
|
-
/** Worker transcript = the last fenced ```json block, else the raw text. */
|
|
4
|
-
export declare const enterpriseOpsTranscriptOutput: OutputAdapter<string>;
|
|
5
|
-
export declare function createEnterpriseOpsGymAdapter(): BenchmarkAdapter;
|
|
6
|
-
//# sourceMappingURL=enterpriseops-gym.d.ts.map
|