@tangle-network/agent-bench 0.3.5 → 0.3.7
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 +13 -0
- package/README.md +13 -1
- package/dist/adapters.d.ts +15 -0
- package/dist/adapters.js +43 -0
- package/dist/adapters.js.map +1 -0
- package/dist/benchmarks/_harness.d.ts +125 -0
- package/dist/benchmarks/_harness.js +33 -0
- package/dist/benchmarks/_harness.js.map +1 -0
- package/dist/benchmarks/aec-bench.d.ts +27 -0
- package/dist/benchmarks/aec-bench.js +8 -0
- package/dist/benchmarks/aec-bench.js.map +1 -0
- package/dist/benchmarks/agentbench.d.ts +16 -0
- package/dist/benchmarks/agentbench.js +10 -0
- package/dist/benchmarks/agentbench.js.map +1 -0
- package/dist/benchmarks/appworld.d.ts +37 -0
- package/dist/benchmarks/appworld.js +14 -0
- package/dist/benchmarks/appworld.js.map +1 -0
- package/dist/benchmarks/bfcl.d.ts +18 -0
- package/dist/benchmarks/bfcl.js +10 -0
- package/dist/benchmarks/bfcl.js.map +1 -0
- package/dist/benchmarks/cad-design.d.ts +45 -0
- package/dist/benchmarks/cad-design.js +7 -0
- package/dist/benchmarks/cad-design.js.map +1 -0
- package/dist/benchmarks/cadbench.d.ts +19 -0
- package/dist/benchmarks/cadbench.js +8 -0
- package/dist/benchmarks/cadbench.js.map +1 -0
- package/dist/benchmarks/cadgenbench.d.ts +22 -0
- package/dist/benchmarks/cadgenbench.js +8 -0
- package/dist/benchmarks/cadgenbench.js.map +1 -0
- package/dist/benchmarks/commit0.d.ts +31 -0
- package/dist/benchmarks/commit0.js +10 -0
- package/dist/benchmarks/commit0.js.map +1 -0
- package/dist/benchmarks/crag.d.ts +14 -0
- package/dist/benchmarks/crag.js +9 -0
- package/dist/benchmarks/crag.js.map +1 -0
- package/dist/benchmarks/dabstep.d.ts +18 -0
- package/dist/benchmarks/dabstep.js +10 -0
- package/dist/benchmarks/dabstep.js.map +1 -0
- package/dist/benchmarks/enterpriseops-gym.d.ts +38 -0
- package/dist/benchmarks/enterpriseops-gym.js +10 -0
- package/dist/benchmarks/enterpriseops-gym.js.map +1 -0
- package/dist/benchmarks/finresearchbench.d.ts +15 -0
- package/dist/benchmarks/finresearchbench.js +8 -0
- package/dist/benchmarks/finresearchbench.js.map +1 -0
- package/dist/benchmarks/finsearchcomp.d.ts +49 -0
- package/dist/benchmarks/finsearchcomp.js +7 -0
- package/dist/benchmarks/finsearchcomp.js.map +1 -0
- package/dist/benchmarks/frames.d.ts +59 -0
- package/dist/benchmarks/frames.js +13 -0
- package/dist/benchmarks/frames.js.map +1 -0
- package/dist/benchmarks/hotpotqa.d.ts +48 -0
- package/dist/benchmarks/hotpotqa.js +15 -0
- package/dist/benchmarks/hotpotqa.js.map +1 -0
- package/dist/benchmarks/humaneval.d.ts +62 -0
- package/dist/benchmarks/humaneval.js +17 -0
- package/dist/benchmarks/humaneval.js.map +1 -0
- package/dist/benchmarks/mind2web.d.ts +41 -0
- package/dist/benchmarks/mind2web.js +9 -0
- package/dist/benchmarks/mind2web.js.map +1 -0
- package/dist/benchmarks/nomiracl.d.ts +15 -0
- package/dist/benchmarks/nomiracl.js +9 -0
- package/dist/benchmarks/nomiracl.js.map +1 -0
- package/dist/benchmarks/open-rag-bench.d.ts +14 -0
- package/dist/benchmarks/open-rag-bench.js +9 -0
- package/dist/benchmarks/open-rag-bench.js.map +1 -0
- package/dist/benchmarks/programbench.d.ts +38 -0
- package/dist/benchmarks/programbench.js +10 -0
- package/dist/benchmarks/programbench.js.map +1 -0
- package/dist/benchmarks/rag-shared.d.ts +42 -0
- package/dist/benchmarks/rag-shared.js +39 -0
- package/dist/benchmarks/rag-shared.js.map +1 -0
- package/dist/benchmarks/ragbench.d.ts +16 -0
- package/dist/benchmarks/ragbench.js +9 -0
- package/dist/benchmarks/ragbench.js.map +1 -0
- package/dist/benchmarks/simpleqa.d.ts +64 -0
- package/dist/benchmarks/simpleqa.js +11 -0
- package/dist/benchmarks/simpleqa.js.map +1 -0
- package/dist/benchmarks/swe-bench.d.ts +56 -0
- package/dist/benchmarks/swe-bench.js +14 -0
- package/dist/benchmarks/swe-bench.js.map +1 -0
- package/dist/benchmarks/t2-ragbench.d.ts +14 -0
- package/dist/benchmarks/t2-ragbench.js +9 -0
- package/dist/benchmarks/t2-ragbench.js.map +1 -0
- package/dist/benchmarks/tau-bench-shared.d.ts +26 -0
- package/dist/benchmarks/tau-bench-shared.js +10 -0
- package/dist/benchmarks/tau-bench-shared.js.map +1 -0
- package/dist/benchmarks/tau2-bench.d.ts +7 -0
- package/dist/benchmarks/tau2-bench.js +11 -0
- package/dist/benchmarks/tau2-bench.js.map +1 -0
- package/dist/benchmarks/tau3-banking.d.ts +15 -0
- package/dist/benchmarks/tau3-banking.js +9 -0
- package/dist/benchmarks/tau3-banking.js.map +1 -0
- package/dist/benchmarks/terminal-bench.d.ts +24 -0
- package/dist/benchmarks/terminal-bench.js +8 -0
- package/dist/benchmarks/terminal-bench.js.map +1 -0
- package/dist/benchmarks/toollm.d.ts +16 -0
- package/dist/benchmarks/toollm.js +10 -0
- package/dist/benchmarks/toollm.js.map +1 -0
- package/dist/benchmarks/trata-hedge.d.ts +32 -0
- package/dist/benchmarks/trata-hedge.js +7 -0
- package/dist/benchmarks/trata-hedge.js.map +1 -0
- package/dist/benchmarks/types.d.ts +107 -0
- package/dist/benchmarks/types.js +1 -0
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +16 -0
- package/dist/benchmarks/webarena-verified.js +10 -0
- package/dist/benchmarks/webarena-verified.js.map +1 -0
- package/dist/chunk-2PVVP7GN.js +197 -0
- package/dist/chunk-2PVVP7GN.js.map +1 -0
- package/dist/chunk-2XU6OGEN.js +170 -0
- package/dist/chunk-2XU6OGEN.js.map +1 -0
- package/dist/chunk-53UPUNBZ.js +325 -0
- package/dist/chunk-53UPUNBZ.js.map +1 -0
- package/dist/chunk-5H5XV76F.js +240 -0
- package/dist/chunk-5H5XV76F.js.map +1 -0
- package/dist/chunk-7WSD27QQ.js +118 -0
- package/dist/chunk-7WSD27QQ.js.map +1 -0
- package/dist/chunk-C7T7WEK2.js +103 -0
- package/dist/chunk-C7T7WEK2.js.map +1 -0
- package/dist/chunk-CKUVRZ2T.js +251 -0
- package/dist/chunk-CKUVRZ2T.js.map +1 -0
- package/dist/chunk-HBSWHQNJ.js +30 -0
- package/dist/chunk-HBSWHQNJ.js.map +1 -0
- package/dist/chunk-HHXFIHXC.js +116 -0
- package/dist/chunk-HHXFIHXC.js.map +1 -0
- package/dist/chunk-IFAV6KEM.js +276 -0
- package/dist/chunk-IFAV6KEM.js.map +1 -0
- package/dist/chunk-INNOYXCP.js +387 -0
- package/dist/chunk-INNOYXCP.js.map +1 -0
- package/dist/chunk-J3KDJNX2.js +182 -0
- package/dist/chunk-J3KDJNX2.js.map +1 -0
- package/dist/chunk-JRWWGMK7.js +148 -0
- package/dist/chunk-JRWWGMK7.js.map +1 -0
- package/dist/chunk-JTHWEDEW.js +32 -0
- package/dist/chunk-JTHWEDEW.js.map +1 -0
- package/dist/chunk-KDIKRJGB.js +120 -0
- package/dist/chunk-KDIKRJGB.js.map +1 -0
- package/dist/chunk-LRRD7NAG.js +301 -0
- package/dist/chunk-LRRD7NAG.js.map +1 -0
- package/dist/chunk-ODT47UAY.js +221 -0
- package/dist/chunk-ODT47UAY.js.map +1 -0
- package/dist/chunk-PA2ZKHJC.js +230 -0
- package/dist/chunk-PA2ZKHJC.js.map +1 -0
- package/dist/chunk-PUIRNYI7.js +189 -0
- package/dist/chunk-PUIRNYI7.js.map +1 -0
- package/dist/chunk-PWQVGAJB.js +144 -0
- package/dist/chunk-PWQVGAJB.js.map +1 -0
- package/dist/chunk-R36V2VP7.js +169 -0
- package/dist/chunk-R36V2VP7.js.map +1 -0
- package/dist/chunk-R67DFVLO.js +142 -0
- package/dist/chunk-R67DFVLO.js.map +1 -0
- package/dist/chunk-SEVJPLZC.js +260 -0
- package/dist/chunk-SEVJPLZC.js.map +1 -0
- package/dist/chunk-SYDW647C.js +318 -0
- package/dist/chunk-SYDW647C.js.map +1 -0
- package/dist/chunk-TBKU5XQI.js +228 -0
- package/dist/chunk-TBKU5XQI.js.map +1 -0
- package/dist/chunk-TSWPNOYM.js +147 -0
- package/dist/chunk-TSWPNOYM.js.map +1 -0
- package/dist/chunk-UAIOHCUK.js +27 -0
- package/dist/chunk-UAIOHCUK.js.map +1 -0
- package/dist/chunk-UPAMRDX4.js +233 -0
- package/dist/chunk-UPAMRDX4.js.map +1 -0
- package/dist/chunk-VQRS7VUC.js +342 -0
- package/dist/chunk-VQRS7VUC.js.map +1 -0
- package/dist/chunk-X3BTXCJ4.js +262 -0
- package/dist/chunk-X3BTXCJ4.js.map +1 -0
- package/dist/chunk-X5YKXC6V.js +211 -0
- package/dist/chunk-X5YKXC6V.js.map +1 -0
- package/dist/chunk-Y6O2OCUO.js +130 -0
- package/dist/chunk-Y6O2OCUO.js.map +1 -0
- package/dist/chunk-YCGY7UIZ.js +208 -0
- package/dist/chunk-YCGY7UIZ.js.map +1 -0
- package/dist/chunk-Z7ML6L77.js +162 -0
- package/dist/chunk-Z7ML6L77.js.map +1 -0
- package/dist/chunk-ZEWMTR5M.js +136 -0
- package/dist/chunk-ZEWMTR5M.js.map +1 -0
- package/dist/index.d.ts +355 -0
- package/dist/index.js +1908 -0
- package/dist/index.js.map +1 -0
- package/package.json +26 -9
- package/scripts/run-package-tests.mjs +30 -8
- package/scripts/verify-packed-consumer.mjs +12 -1
- package/scripts/verify-pier-agent.mts +1 -0
- package/src/benchmarks/humaneval.test.mts +122 -0
- package/src/benchmarks/humaneval.ts +100 -27
- package/src/david-attribution.mts +78 -0
- package/src/david-goliath.mts +149 -0
- package/src/hev-improve.mts +25 -6
- package/src/humaneval-object-ablation.mts +201 -0
- package/src/live-improve-campaign-mbpp.mts +641 -0
- package/src/live-improve-campaign.mts +500 -0
- package/src/mbpp-structural.mts +12 -7
- package/src/stream-observe.py +45 -0
- package/src/stream-observe.tpl.html +247 -0
- package/src/supervisor-arena.mts +816 -0
- package/src/swe-arena/analyze.ts +211 -0
- package/src/swe-arena/arms.ts +788 -0
- package/src/swe-arena/bootstrap-meta.mts +188 -0
- package/src/swe-arena/bootstrap-meta.test.mts +51 -0
- package/src/swe-arena/calibrate.ts +116 -0
- package/src/swe-arena/capabilities.mts +76 -0
- package/src/swe-arena/capabilities.test.mts +57 -0
- package/src/swe-arena/capacity.ts +194 -0
- package/src/swe-arena/cell-evidence.mts +405 -0
- package/src/swe-arena/cell-evidence.test.mts +248 -0
- package/src/swe-arena/diagnosis-ensemble.test.mts +210 -0
- package/src/swe-arena/diagnosis-ensemble.ts +520 -0
- package/src/swe-arena/execution.test.mts +1170 -0
- package/src/swe-arena/fixtures/analyze.py +80 -0
- package/src/swe-arena/fixtures/excludes.txt +8 -0
- package/src/swe-arena/fixtures/gen1-salvage/README.md +45 -0
- package/src/swe-arena/fixtures/gen1-salvage/cand0-e6d7361.diff +116 -0
- package/src/swe-arena/fixtures/gen1-salvage/cand1-76a8590.diff +293 -0
- package/src/swe-arena/fixtures/holdout-preregister.log +12 -0
- package/src/swe-arena/fixtures/holdout.json +44 -0
- package/src/swe-arena/fixtures/instances.json +146 -0
- package/src/swe-arena/fixtures/ledger.jsonl +12 -0
- package/src/swe-arena/fixtures/patches/pallets__flask-5014.solo.patch +36 -0
- package/src/swe-arena/fixtures/patches/pydata__xarray-4687.sup.patch +33 -0
- package/src/swe-arena/fixtures/rejudge.jsonl +15 -0
- package/src/swe-arena/fixtures/rematch.jsonl +3 -0
- package/src/swe-arena/fixtures/rematch2.jsonl +3 -0
- package/src/swe-arena/fixtures/rematch3.jsonl +3 -0
- package/src/swe-arena/fixtures/sup-journal-true.json +19 -0
- package/src/swe-arena/fixtures/verify/astropy__astropy-13033.sh +48 -0
- package/src/swe-arena/fixtures/verify/django__django-11532.sh +50 -0
- package/src/swe-arena/fixtures/verify/matplotlib__matplotlib-20826.sh +76 -0
- package/src/swe-arena/fixtures/verify/pydata__xarray-4687.sh +44 -0
- package/src/swe-arena/fixtures/verify/pytest-dev__pytest-6197.sh +32 -0
- package/src/swe-arena/fixtures/verify/sphinx-doc__sphinx-9658.sh +51 -0
- package/src/swe-arena/fixtures/worker-tokens.json +42 -0
- package/src/swe-arena/fixtures.ts +104 -0
- package/src/swe-arena/holdout-certify.mts +408 -0
- package/src/swe-arena/holdout-certify.test.mts +160 -0
- package/src/swe-arena/judge-child.mts +37 -0
- package/src/swe-arena/manifest.mts +293 -0
- package/src/swe-arena/manifest.test.mts +169 -0
- package/src/swe-arena/materialize.ts +142 -0
- package/src/swe-arena/outer-loop.mts +2145 -0
- package/src/swe-arena/outer-loop.test.mts +696 -0
- package/src/swe-arena/parity.test.mts +87 -0
- package/src/swe-arena/proc.test.mts +174 -0
- package/src/swe-arena/proc.ts +260 -0
- package/src/swe-arena/profiles/default-author.profile.json +4 -0
- package/src/swe-arena/proposer-fanout.mts +489 -0
- package/src/swe-arena/proposer-fanout.test.mts +372 -0
- package/src/swe-arena/reconcile.ts +0 -0
- package/src/swe-arena/replay.mts +183 -0
- package/src/swe-arena/replay.test.mts +300 -0
- package/src/swe-arena/run-experiment.mts +361 -0
- package/src/swe-arena/run-supervisor.mjs +297 -0
- package/src/swe-arena/run-supervisor.test.mts +498 -0
- package/src/swe-arena/serialized-judge.ts +414 -0
- package/src/swe-arena/types.ts +166 -0
- package/src/swe-code-improve.mts +328 -0
- package/src/swe-emit-patch.mts +104 -0
- package/src/swe-improve.mts +232 -0
- package/src/swe-jail.ts +2 -2
- package/src/swe-local-proof.mts +169 -0
- package/src/swe-repro-calibrate.mts +446 -0
- package/src/swe-stream.mts +1497 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// src/benchmarks/cadbench.ts
|
|
2
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
3
|
+
|
|
4
|
+
// src/worker-blender.ts
|
|
5
|
+
import { execFile } from "child_process";
|
|
6
|
+
import { mkdtemp, readFile, rm, writeFile } from "fs/promises";
|
|
7
|
+
import { tmpdir } from "os";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { promisify } from "util";
|
|
10
|
+
import { routerChatWithUsage } from "@tangle-network/agent-runtime/loops";
|
|
11
|
+
var execFileAsync = promisify(execFile);
|
|
12
|
+
async function runLocal(cmd, args, cwd, timeoutMs = 18e4) {
|
|
13
|
+
try {
|
|
14
|
+
const { stdout, stderr } = await execFileAsync(cmd, args, { cwd, maxBuffer: 1 << 26, timeout: timeoutMs });
|
|
15
|
+
return { code: 0, stdout, stderr };
|
|
16
|
+
} catch (err) {
|
|
17
|
+
const e = err;
|
|
18
|
+
return { code: typeof e.code === "number" ? e.code : 1, stdout: e.stdout ?? "", stderr: e.stderr ?? e.message ?? String(err) };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
var RUNNER_PY = `
|
|
22
|
+
import bpy, sys, math, mathutils, traceback, os
|
|
23
|
+
agent_script, outdir, nviews = sys.argv[-3], sys.argv[-2], int(sys.argv[-1])
|
|
24
|
+
bpy.ops.object.select_all(action='SELECT'); bpy.ops.object.delete()
|
|
25
|
+
ok=True
|
|
26
|
+
try:
|
|
27
|
+
g={'bpy':bpy,'math':math,'mathutils':mathutils,'__name__':'__main__'}
|
|
28
|
+
exec(compile(open(agent_script).read(), agent_script, 'exec'), g)
|
|
29
|
+
except Exception as e:
|
|
30
|
+
traceback.print_exc(); print('AGENT_SCRIPT_ERROR:'+repr(e)); ok=False
|
|
31
|
+
meshes=[o for o in bpy.context.scene.objects if o.type=='MESH']
|
|
32
|
+
if not meshes:
|
|
33
|
+
print('NO_MESH'); sys.exit(0 if ok else 3)
|
|
34
|
+
mn=[1e18]*3; mx=[-1e18]*3
|
|
35
|
+
for o in meshes:
|
|
36
|
+
for c in o.bound_box:
|
|
37
|
+
w=o.matrix_world @ mathutils.Vector(c)
|
|
38
|
+
for i in range(3): mn[i]=min(mn[i],w[i]); mx[i]=max(mx[i],w[i])
|
|
39
|
+
center=mathutils.Vector(((mn[0]+mx[0])/2,(mn[1]+mx[1])/2,(mn[2]+mx[2])/2))
|
|
40
|
+
size=max(mx[i]-mn[i] for i in range(3)) or 1.0
|
|
41
|
+
# standardize: drop any agent-added cameras/lights
|
|
42
|
+
for o in list(bpy.context.scene.objects):
|
|
43
|
+
if o.type in ('CAMERA','LIGHT'): bpy.data.objects.remove(o, do_unlink=True)
|
|
44
|
+
w=bpy.context.scene.world or bpy.data.worlds.new('W'); bpy.context.scene.world=w
|
|
45
|
+
w.use_nodes=True
|
|
46
|
+
try: w.node_tree.nodes['Background'].inputs[1].default_value=0.6
|
|
47
|
+
except Exception: pass
|
|
48
|
+
bpy.ops.object.light_add(type='SUN'); sun=bpy.context.object; sun.data.energy=4.0; sun.rotation_euler=mathutils.Euler((0.6,0.2,0.4))
|
|
49
|
+
bpy.ops.object.camera_add(); cam=bpy.context.object; bpy.context.scene.camera=cam
|
|
50
|
+
sc=bpy.context.scene
|
|
51
|
+
sc.render.engine='CYCLES'; sc.cycles.samples=20; sc.cycles.device='CPU'; sc.cycles.use_denoising=False
|
|
52
|
+
sc.render.resolution_x=640; sc.render.resolution_y=640; sc.render.film_transparent=False
|
|
53
|
+
dist=size*2.4
|
|
54
|
+
el=math.radians(58)
|
|
55
|
+
for v in range(nviews):
|
|
56
|
+
az=math.radians(40 + v*360.0/nviews)
|
|
57
|
+
cam.location=center+mathutils.Vector((math.cos(az)*math.sin(el), math.sin(az)*math.sin(el), math.cos(el)))*dist
|
|
58
|
+
d=(center-cam.location); cam.rotation_euler=d.to_track_quat('-Z','Y').to_euler()
|
|
59
|
+
sc.render.filepath=os.path.join(outdir, 'view_%d.png'%v); bpy.ops.render.render(write_still=True)
|
|
60
|
+
print('RENDER_DONE')
|
|
61
|
+
`.trim();
|
|
62
|
+
async function renderBpy(script, opts = {}) {
|
|
63
|
+
const views = Math.max(1, opts.views ?? 4);
|
|
64
|
+
const dir = await mkdtemp(join(tmpdir(), "blender-judge-"));
|
|
65
|
+
const runnerPath = join(dir, "runner.py");
|
|
66
|
+
const scriptPath = join(dir, "model.py");
|
|
67
|
+
try {
|
|
68
|
+
await writeFile(runnerPath, RUNNER_PY);
|
|
69
|
+
await writeFile(scriptPath, script);
|
|
70
|
+
const run = await runLocal("xvfb-run", ["-a", "blender", "--background", "--python", runnerPath, "--", scriptPath, dir, String(views)], dir);
|
|
71
|
+
const out = `${run.stdout}
|
|
72
|
+
${run.stderr}`;
|
|
73
|
+
const built = /RENDER_DONE/.test(out);
|
|
74
|
+
if (!built) return { built: false, renders: [], error: /(AGENT_SCRIPT_ERROR:.*|NO_MESH)/.exec(out)?.[0] ?? out.trim().slice(-400) };
|
|
75
|
+
const renders = [];
|
|
76
|
+
for (let v = 0; v < views; v++) {
|
|
77
|
+
const buf = await readFile(join(dir, `view_${v}.png`)).catch(() => void 0);
|
|
78
|
+
if (buf) renders.push(`data:image/png;base64,${buf.toString("base64")}`);
|
|
79
|
+
}
|
|
80
|
+
return { built: renders.length > 0, renders };
|
|
81
|
+
} finally {
|
|
82
|
+
await rm(dir, { recursive: true, force: true }).catch(() => {
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/benchmarks/cadbench.ts
|
|
88
|
+
function must(name) {
|
|
89
|
+
const v = process.env[name];
|
|
90
|
+
if (!v) throw new Error(`env ${name} is required for the CADBench judge`);
|
|
91
|
+
return v;
|
|
92
|
+
}
|
|
93
|
+
async function judgeCriteria(instruction, script, criteria, renders) {
|
|
94
|
+
const base = (process.env.ROUTER_BASE ?? "https://router.tangle.tools/v1").replace(/\/$/, "");
|
|
95
|
+
const key = must("TANGLE_API_KEY");
|
|
96
|
+
const model = process.env.JUDGE_MODEL ?? "deepseek-v4-flash";
|
|
97
|
+
const numbered = criteria.map((c, i) => `${i + 1}. ${c}`).join("\n");
|
|
98
|
+
const text = `You are strictly grading a 3D model that was built by a Blender bpy script for this instruction:
|
|
99
|
+
"${instruction}"
|
|
100
|
+
|
|
101
|
+
Below are ${renders.length} rendered views of the produced model, and the script that built it. For EACH numbered criterion, decide whether it is satisfied (judge geometry/shape/proportion/structure from the IMAGES; judge color/size/material reasonableness from the SCRIPT where the images are ambiguous). Return ONLY a JSON array of exactly ${criteria.length} booleans (true=satisfied, false=not), in order, no prose.
|
|
102
|
+
|
|
103
|
+
CRITERIA:
|
|
104
|
+
${numbered}
|
|
105
|
+
|
|
106
|
+
SCRIPT:
|
|
107
|
+
\`\`\`python
|
|
108
|
+
${script.slice(0, 6e3)}
|
|
109
|
+
\`\`\``;
|
|
110
|
+
const content = [{ type: "text", text }];
|
|
111
|
+
for (const url of renders) content.push({ type: "image_url", image_url: { url } });
|
|
112
|
+
const res = await fetch(`${base}/chat/completions`, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${key}` },
|
|
115
|
+
body: JSON.stringify({ model, max_tokens: 1500, temperature: 0, messages: [{ role: "user", content }] })
|
|
116
|
+
});
|
|
117
|
+
if (!res.ok) throw new Error(`judge ${model} ${res.status}: ${(await res.text()).slice(0, 200)}`);
|
|
118
|
+
const data = await res.json();
|
|
119
|
+
const raw = data.choices?.[0]?.message?.content ?? "";
|
|
120
|
+
const m = /\[\s*(?:true|false)[\s\S]*?\]/i.exec(raw);
|
|
121
|
+
if (!m) return { passed: criteria.map(() => false), note: `judge returned no parseable verdict: ${raw.slice(0, 80)}` };
|
|
122
|
+
let arr;
|
|
123
|
+
try {
|
|
124
|
+
arr = JSON.parse(m[0].toLowerCase());
|
|
125
|
+
} catch {
|
|
126
|
+
return { passed: criteria.map(() => false), note: "judge verdict not valid JSON" };
|
|
127
|
+
}
|
|
128
|
+
const bools = Array.isArray(arr) ? arr.map((x) => x === true) : [];
|
|
129
|
+
const passed = criteria.map((_, i) => bools[i] === true);
|
|
130
|
+
return { passed, note: `${passed.filter(Boolean).length}/${criteria.length} criteria` };
|
|
131
|
+
}
|
|
132
|
+
function createCadBenchAdapter() {
|
|
133
|
+
let cache = null;
|
|
134
|
+
async function load() {
|
|
135
|
+
if (cache) return cache;
|
|
136
|
+
const path = process.env.CADBENCH_PATH;
|
|
137
|
+
if (!path) throw new Error("CADBENCH_PATH must point at the cleaned CADBench JSONL ({id,instruction,type,criteria:[]} per line)");
|
|
138
|
+
const text = await readFile2(path, "utf8");
|
|
139
|
+
cache = text.split("\n").filter((l) => l.trim()).map((l) => {
|
|
140
|
+
const r = JSON.parse(l);
|
|
141
|
+
return { id: r.id, instruction: r.instruction, meta: { name: r.name ?? "", type: r.type ?? "", criteria: r.criteria } };
|
|
142
|
+
});
|
|
143
|
+
return cache;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
name: "cadbench",
|
|
147
|
+
async preflight() {
|
|
148
|
+
const { execFile: execFile2 } = await import("child_process");
|
|
149
|
+
const { promisify: promisify2 } = await import("util");
|
|
150
|
+
const exec = promisify2(execFile2);
|
|
151
|
+
try {
|
|
152
|
+
await exec("xvfb-run", ["-a", "blender", "--version"], { timeout: 3e4 });
|
|
153
|
+
} catch (err) {
|
|
154
|
+
throw new Error(
|
|
155
|
+
`cadbench preflight failed: ${(err instanceof Error ? err.message : String(err)).slice(0, 200)}
|
|
156
|
+
Fix: install Blender + Xvfb (sudo apt-get install -y blender xvfb). The judge runs \`xvfb-run -a blender --background --python\`.`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
await load();
|
|
160
|
+
},
|
|
161
|
+
async loadTasks(opts = {}) {
|
|
162
|
+
let rows = await load();
|
|
163
|
+
if (opts.ids) rows = rows.filter((r) => opts.ids.includes(r.id));
|
|
164
|
+
const t = process.env.CADBENCH_TYPE;
|
|
165
|
+
if (t) rows = rows.filter((r) => r.meta.type.toLowerCase() === t.toLowerCase());
|
|
166
|
+
if (opts.limit != null) rows = rows.slice(0, opts.limit);
|
|
167
|
+
return rows.map((r) => ({ id: r.id, prompt: r.instruction, metadata: r.meta }));
|
|
168
|
+
},
|
|
169
|
+
async goldArtifact() {
|
|
170
|
+
return void 0;
|
|
171
|
+
},
|
|
172
|
+
async judge(task, artifact) {
|
|
173
|
+
const meta = task.metadata;
|
|
174
|
+
const criteria = meta.criteria ?? [];
|
|
175
|
+
if (!artifact.trim()) return { resolved: false, score: 0, detail: "empty artifact" };
|
|
176
|
+
if (criteria.length === 0) return { resolved: false, score: 0, detail: "task has no criteria" };
|
|
177
|
+
const r = await renderBpy(artifact, { views: 4 });
|
|
178
|
+
if (!r.built) return { resolved: false, score: 0, detail: `did not build/render: ${r.error ?? "no mesh"}` };
|
|
179
|
+
const { passed, note } = await judgeCriteria(task.prompt, artifact, criteria, r.renders);
|
|
180
|
+
const score = passed.filter(Boolean).length / criteria.length;
|
|
181
|
+
return { resolved: score === 1, score, detail: note };
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
createCadBenchAdapter
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=chunk-PUIRNYI7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/benchmarks/cadbench.ts","../src/worker-blender.ts"],"sourcesContent":["/**\n * CADBench / BlenderLLM adapter (FreedomIntelligence/CADBench, arXiv:2412.14203).\n * Task = NL instruction → a Blender `bpy` script. Score = the paper's criteria\n * eval: render the produced model to standardized views, then a vision judge\n * (GPT-4o-class) marks each per-task criterion bullet pass/fail against the\n * rendered images + the script text. score = fraction of criteria satisfied.\n *\n * Data: the published dataset's `criteria` flattened to a bullet list (700 tasks,\n * 500 Simulative + 200 Wild). Point CADBENCH_PATH at the cleaned JSONL\n * ({id,name,instruction,type,criteria:string[]} per line). Judge creds from\n * TANGLE_API_KEY / ROUTER_BASE / JUDGE_MODEL (default gpt-4o).\n */\n\nimport { readFile } from 'node:fs/promises'\nimport type { BenchScore, BenchTask, BenchmarkAdapter, LoadOptions } from './types'\nimport { renderBpy } from '../worker-blender'\n\ninterface CadBenchMeta {\n name: string\n type: string\n criteria: string[]\n}\n\nfunction must(name: string): string {\n const v = process.env[name]\n if (!v) throw new Error(`env ${name} is required for the CADBench judge`)\n return v\n}\n\n/** One batched vision call: rendered views + the bpy script + the numbered\n * criteria → a JSON array of booleans (true = satisfied). Faithful to the\n * paper's combined image+script evaluation. Throws on transport failure (never\n * a silent zero); a parse miss falls back to \"all fail\" with a note. */\nasync function judgeCriteria(\n instruction: string,\n script: string,\n criteria: string[],\n renders: string[],\n): Promise<{ passed: boolean[]; note: string }> {\n const base = (process.env.ROUTER_BASE ?? 'https://router.tangle.tools/v1').replace(/\\/$/, '')\n const key = must('TANGLE_API_KEY')\n const model = process.env.JUDGE_MODEL ?? 'deepseek-v4-flash'\n const numbered = criteria.map((c, i) => `${i + 1}. ${c}`).join('\\n')\n const text =\n `You are strictly grading a 3D model that was built by a Blender bpy script for this instruction:\\n\"${instruction}\"\\n\\n` +\n `Below are ${renders.length} rendered views of the produced model, and the script that built it. ` +\n `For EACH numbered criterion, decide whether it is satisfied (judge geometry/shape/proportion/structure from the IMAGES; judge color/size/material reasonableness from the SCRIPT where the images are ambiguous). ` +\n `Return ONLY a JSON array of exactly ${criteria.length} booleans (true=satisfied, false=not), in order, no prose.\\n\\nCRITERIA:\\n${numbered}\\n\\nSCRIPT:\\n\\`\\`\\`python\\n${script.slice(0, 6000)}\\n\\`\\`\\``\n const content: unknown[] = [{ type: 'text', text }]\n for (const url of renders) content.push({ type: 'image_url', image_url: { url } })\n const res = await fetch(`${base}/chat/completions`, {\n method: 'POST',\n headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` },\n body: JSON.stringify({ model, max_tokens: 1500, temperature: 0, messages: [{ role: 'user', content }] }),\n })\n if (!res.ok) throw new Error(`judge ${model} ${res.status}: ${(await res.text()).slice(0, 200)}`)\n const data = (await res.json()) as { choices?: Array<{ message?: { content?: string } }> }\n const raw = data.choices?.[0]?.message?.content ?? ''\n const m = /\\[\\s*(?:true|false)[\\s\\S]*?\\]/i.exec(raw)\n if (!m) return { passed: criteria.map(() => false), note: `judge returned no parseable verdict: ${raw.slice(0, 80)}` }\n let arr: unknown\n try {\n arr = JSON.parse(m[0].toLowerCase())\n } catch {\n return { passed: criteria.map(() => false), note: 'judge verdict not valid JSON' }\n }\n const bools = Array.isArray(arr) ? arr.map((x) => x === true) : []\n // Pad/truncate to criteria length (a short array scores the missing as fail).\n const passed = criteria.map((_, i) => bools[i] === true)\n return { passed, note: `${passed.filter(Boolean).length}/${criteria.length} criteria` }\n}\n\nexport function createCadBenchAdapter(): BenchmarkAdapter {\n let cache: Array<{ id: string; instruction: string; meta: CadBenchMeta }> | null = null\n\n async function load(): Promise<typeof cache & object> {\n if (cache) return cache\n const path = process.env.CADBENCH_PATH\n if (!path) throw new Error('CADBENCH_PATH must point at the cleaned CADBench JSONL ({id,instruction,type,criteria:[]} per line)')\n const text = await readFile(path, 'utf8')\n cache = text\n .split('\\n')\n .filter((l) => l.trim())\n .map((l) => {\n const r = JSON.parse(l) as { id: string; name?: string; instruction: string; type?: string; criteria: string[] }\n return { id: r.id, instruction: r.instruction, meta: { name: r.name ?? '', type: r.type ?? '', criteria: r.criteria } }\n })\n return cache\n }\n\n return {\n name: 'cadbench',\n\n async preflight() {\n const { execFile } = await import('node:child_process')\n const { promisify } = await import('node:util')\n const exec = promisify(execFile)\n try {\n await exec('xvfb-run', ['-a', 'blender', '--version'], { timeout: 30_000 })\n } catch (err) {\n throw new Error(\n `cadbench preflight failed: ${(err instanceof Error ? err.message : String(err)).slice(0, 200)}\\n` +\n `Fix: install Blender + Xvfb (sudo apt-get install -y blender xvfb). The judge runs \\`xvfb-run -a blender --background --python\\`.`,\n )\n }\n await load()\n },\n\n async loadTasks(opts: LoadOptions = {}) {\n let rows = await load()\n if (opts.ids) rows = rows.filter((r) => opts.ids!.includes(r.id))\n // TYPE filter (Simulative|Wild) via env, applied before limit.\n const t = process.env.CADBENCH_TYPE\n if (t) rows = rows.filter((r) => r.meta.type.toLowerCase() === t.toLowerCase())\n if (opts.limit != null) rows = rows.slice(0, opts.limit)\n return rows.map((r): BenchTask => ({ id: r.id, prompt: r.instruction, metadata: r.meta as unknown as Record<string, unknown> }))\n },\n\n async goldArtifact() {\n return undefined // no reference bpy script ships with the benchmark\n },\n\n async judge(task: BenchTask, artifact: string): Promise<BenchScore> {\n const meta = task.metadata as unknown as CadBenchMeta\n const criteria = meta.criteria ?? []\n if (!artifact.trim()) return { resolved: false, score: 0, detail: 'empty artifact' }\n if (criteria.length === 0) return { resolved: false, score: 0, detail: 'task has no criteria' }\n const r = await renderBpy(artifact, { views: 4 })\n if (!r.built) return { resolved: false, score: 0, detail: `did not build/render: ${r.error ?? 'no mesh'}` }\n const { passed, note } = await judgeCriteria(task.prompt, artifact, criteria, r.renders)\n const score = passed.filter(Boolean).length / criteria.length\n return { resolved: score === 1, score, detail: note }\n },\n }\n}\n","/**\n * BlenderLLM / CADBench worker. The deliverable for a CADBench task is a Blender\n * `bpy` Python script that builds the described 3D model. We author it via the\n * router, execute it headless in Blender (Cycles CPU, no GPU), auto-frame the\n * produced geometry, and render N standardized views — the images the CADBench\n * criteria judge scores. The authoring directive is the GEPA-optimizable surface.\n *\n * Requires `blender` + `xvfb-run` on PATH (apt blender 4.x). No GPU: Cycles CPU\n * with denoising off (the apt build ships without OpenImageDenoise).\n */\n\nimport { execFile } from 'node:child_process'\nimport { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport { promisify } from 'node:util'\nimport type { Span } from '@tangle-network/agent-eval'\nimport type { BenchTask } from './benchmarks/types'\nimport { DEFAULT_BLENDER_DIRECTIVE } from './directives'\nimport { runRefineLoop } from './refine-loop'\nimport { routerChatWithUsage } from '@tangle-network/agent-runtime/loops'\n\nexport { DEFAULT_BLENDER_DIRECTIVE } from './directives'\n\nconst execFileAsync = promisify(execFile)\n\nasync function runLocal(cmd: string, args: string[], cwd: string, timeoutMs = 180_000): Promise<{ code: number; stdout: string; stderr: string }> {\n try {\n const { stdout, stderr } = await execFileAsync(cmd, args, { cwd, maxBuffer: 1 << 26, timeout: timeoutMs })\n return { code: 0, stdout, stderr }\n } catch (err) {\n const e = err as { code?: number; stdout?: string; stderr?: string; message?: string }\n return { code: typeof e.code === 'number' ? e.code : 1, stdout: e.stdout ?? '', stderr: e.stderr ?? e.message ?? String(err) }\n }\n}\n\n\n/** Strip markdown fences so we keep just the Python. */\nfunction extractPy(text: string): string {\n const fence = /```(?:python|py)?\\s*\\n([\\s\\S]*?)```/i.exec(text)\n return (fence ? fence[1] : text).trim()\n}\n\n/**\n * The standardized Blender runner (written to a temp file per run). It clears the\n * scene, executes the agent's bpy script, auto-frames the produced meshes, sets\n * up neutral lighting, and renders N azimuth views with Cycles CPU.\n */\nconst RUNNER_PY = `\nimport bpy, sys, math, mathutils, traceback, os\nagent_script, outdir, nviews = sys.argv[-3], sys.argv[-2], int(sys.argv[-1])\nbpy.ops.object.select_all(action='SELECT'); bpy.ops.object.delete()\nok=True\ntry:\n g={'bpy':bpy,'math':math,'mathutils':mathutils,'__name__':'__main__'}\n exec(compile(open(agent_script).read(), agent_script, 'exec'), g)\nexcept Exception as e:\n traceback.print_exc(); print('AGENT_SCRIPT_ERROR:'+repr(e)); ok=False\nmeshes=[o for o in bpy.context.scene.objects if o.type=='MESH']\nif not meshes:\n print('NO_MESH'); sys.exit(0 if ok else 3)\nmn=[1e18]*3; mx=[-1e18]*3\nfor o in meshes:\n for c in o.bound_box:\n w=o.matrix_world @ mathutils.Vector(c)\n for i in range(3): mn[i]=min(mn[i],w[i]); mx[i]=max(mx[i],w[i])\ncenter=mathutils.Vector(((mn[0]+mx[0])/2,(mn[1]+mx[1])/2,(mn[2]+mx[2])/2))\nsize=max(mx[i]-mn[i] for i in range(3)) or 1.0\n# standardize: drop any agent-added cameras/lights\nfor o in list(bpy.context.scene.objects):\n if o.type in ('CAMERA','LIGHT'): bpy.data.objects.remove(o, do_unlink=True)\nw=bpy.context.scene.world or bpy.data.worlds.new('W'); bpy.context.scene.world=w\nw.use_nodes=True\ntry: w.node_tree.nodes['Background'].inputs[1].default_value=0.6\nexcept Exception: pass\nbpy.ops.object.light_add(type='SUN'); sun=bpy.context.object; sun.data.energy=4.0; sun.rotation_euler=mathutils.Euler((0.6,0.2,0.4))\nbpy.ops.object.camera_add(); cam=bpy.context.object; bpy.context.scene.camera=cam\nsc=bpy.context.scene\nsc.render.engine='CYCLES'; sc.cycles.samples=20; sc.cycles.device='CPU'; sc.cycles.use_denoising=False\nsc.render.resolution_x=640; sc.render.resolution_y=640; sc.render.film_transparent=False\ndist=size*2.4\nel=math.radians(58)\nfor v in range(nviews):\n az=math.radians(40 + v*360.0/nviews)\n cam.location=center+mathutils.Vector((math.cos(az)*math.sin(el), math.sin(az)*math.sin(el), math.cos(el)))*dist\n d=(center-cam.location); cam.rotation_euler=d.to_track_quat('-Z','Y').to_euler()\n sc.render.filepath=os.path.join(outdir, 'view_%d.png'%v); bpy.ops.render.render(write_still=True)\nprint('RENDER_DONE')\n`.trim()\n\n/** Execute a bpy script headless + render N standardized views — no authoring.\n * Used by the CADBench judge to render an artifact before vision-scoring it. */\nexport async function renderBpy(script: string, opts: { views?: number } = {}): Promise<{ built: boolean; renders: string[]; error?: string }> {\n const views = Math.max(1, opts.views ?? 4)\n const dir = await mkdtemp(join(tmpdir(), 'blender-judge-'))\n const runnerPath = join(dir, 'runner.py')\n const scriptPath = join(dir, 'model.py')\n try {\n await writeFile(runnerPath, RUNNER_PY)\n await writeFile(scriptPath, script)\n const run = await runLocal('xvfb-run', ['-a', 'blender', '--background', '--python', runnerPath, '--', scriptPath, dir, String(views)], dir)\n const out = `${run.stdout}\\n${run.stderr}`\n const built = /RENDER_DONE/.test(out)\n if (!built) return { built: false, renders: [], error: (/(AGENT_SCRIPT_ERROR:.*|NO_MESH)/.exec(out)?.[0] ?? out.trim().slice(-400)) }\n const renders: string[] = []\n for (let v = 0; v < views; v++) {\n const buf = await readFile(join(dir, `view_${v}.png`)).catch(() => undefined)\n if (buf) renders.push(`data:image/png;base64,${buf.toString('base64')}`)\n }\n return { built: renders.length > 0, renders }\n } finally {\n await rm(dir, { recursive: true, force: true }).catch(() => {})\n }\n}\n\nexport interface BlenderLocalConfig {\n routerBaseUrl: string\n routerKey: string\n model: string\n rounds?: number\n /** N standardized views to render (CADBench uses 4). Default 4. */\n views?: number\n /** The bpy authoring directive — the GEPA-optimizable surface. */\n directive?: string\n}\n\nexport interface BlenderShot {\n /** The bpy script the agent wrote — the artifact. */\n artifact: string\n /** Rendered view PNGs as data URIs (the images the criteria judge scores). */\n renders: string[]\n trace: Span[]\n usage: { input: number; output: number }\n ok: boolean\n /** True if the script executed and produced at least one mesh. */\n built: boolean\n detail?: string\n}\n\n/**\n * Author a bpy script for the task via the router, execute + render it headless\n * in Blender, refine on execution errors across rounds. Returns the script, the\n * rendered views, a screenshot-rich trace, and real token usage.\n */\nexport async function solveBlenderLocal(task: BenchTask, cfg: BlenderLocalConfig): Promise<BlenderShot> {\n const rounds = Math.max(1, cfg.rounds ?? 2)\n const views = Math.max(1, cfg.views ?? 4)\n const directive = cfg.directive ?? DEFAULT_BLENDER_DIRECTIVE\n const trace: Span[] = []\n const runId = `cadbench-${task.id}`\n let ts = Date.now()\n const tick = () => (ts += 1)\n const usage = { input: 0, output: 0 }\n // Carried across rounds in closures (the round Artifact is the bpy script; the\n // render PNGs + built flag + lastErr persist outside the loop). usage is REAL.\n let renders: string[] = []\n let built = false\n let lastErr = ''\n\n trace.push({ spanId: 's-brief', runId, kind: 'llm', name: 'brief', model: cfg.model, messages: [{ role: 'user', content: task.prompt }], startedAt: tick(), endedAt: tick(), status: 'ok' } as Span)\n\n // Migrated onto runRefineLoop: the mkdtemp dir (with the runner.py written once\n // in setup) is the Ctx; built (RENDER_DONE + ≥1 collected view) is the early-stop,\n // modeled as a judge so default-decide stops the loop. The round-2+ steer carries\n // lastErr + the prior script verbatim.\n const res = await runRefineLoop<string, string>({\n rounds,\n setup: async () => {\n const dir = await mkdtemp(join(tmpdir(), 'blender-'))\n await writeFile(join(dir, 'runner.py'), RUNNER_PY)\n return dir\n },\n prompt: (round, history) =>\n round === 1\n ? task.prompt\n : `Your previous bpy script failed:\\n${lastErr}\\n\\nPrevious script:\\n${history[history.length - 1]?.artifact ?? ''}\\n\\nFix it so it runs under \\`blender --background --python\\` and builds the object as mesh(es). Brief:\\n${task.prompt}`,\n runShot: async (user, round, dir) => {\n const runnerPath = join(dir, 'runner.py')\n const scriptPath = join(dir, 'model.py')\n const { content, usage: u } = await routerChatWithUsage(\n cfg,\n [\n { role: 'system', content: directive },\n { role: 'user', content: user },\n ],\n { temperature: 0.3 },\n )\n if (u) {\n usage.input += u.input\n usage.output += u.output\n }\n const script = extractPy(content)\n trace.push({ spanId: `s-author-${round}`, runId, kind: 'llm', name: `author r${round}`, model: cfg.model, messages: [{ role: 'user', content: round === 1 ? task.prompt : 'refine' }], output: content.slice(0, 600), startedAt: tick(), endedAt: tick(), status: 'ok' } as Span)\n trace.push({ spanId: `s-write-${round}`, runId, kind: 'tool', name: 'write_file', toolName: 'create_file', args: { path: 'model.py', content: script }, startedAt: tick(), endedAt: tick(), status: 'ok' } as Span)\n\n await writeFile(scriptPath, script)\n const run = await runLocal('xvfb-run', ['-a', 'blender', '--background', '--python', runnerPath, '--', scriptPath, dir, String(views)], dir)\n const out = `${run.stdout}\\n${run.stderr}`\n built = /RENDER_DONE/.test(out)\n lastErr = built ? '' : (/(AGENT_SCRIPT_ERROR:.*|NO_MESH)/.exec(out)?.[0] ?? out.trim().slice(-800))\n trace.push({ spanId: `s-blender-${round}`, runId, kind: 'tool', name: `blender r${round}`, toolName: 'shell.exec', args: 'blender --background --python runner.py model.py', result: (built ? 'RENDER_DONE' : lastErr).slice(0, 1500), startedAt: tick(), endedAt: tick(), status: built ? 'ok' : 'error', error: built ? undefined : `exit ${run.code}` } as Span)\n\n if (built) {\n const collected: string[] = []\n for (let v = 0; v < views; v++) {\n const buf = await readFile(join(dir, `view_${v}.png`)).catch(() => undefined)\n if (buf) collected.push(`data:image/png;base64,${buf.toString('base64')}`)\n }\n renders = collected\n // first view carries the screen span (run-capsule reveal)\n trace.push({ spanId: `s-render-${round}`, runId, kind: 'tool', name: 'render', toolName: 'render.screenshot', args: { action: 'rendered model', url: 'view_0.png' }, attributes: collected[0] ? { screenshot: collected[0] } : {}, startedAt: tick(), endedAt: tick(), status: collected.length ? 'ok' : 'error', error: collected.length ? undefined : 'render produced no image' } as Span)\n built = collected.length > 0\n }\n return { artifact: script }\n },\n judge: async () => ({ valid: built }),\n teardown: (dir) => rm(dir, { recursive: true, force: true }).then(() => {}, () => {}),\n })\n\n const script = res.final.artifact\n return {\n artifact: script,\n renders,\n trace,\n usage,\n ok: script.trim().length > 0,\n built,\n detail: built ? `built + rendered ${renders.length} views` : `did not build in ${rounds} rounds${lastErr ? `; last: ${lastErr.slice(0, 140)}` : ''}`,\n }\n}\n"],"mappings":";AAaA,SAAS,YAAAA,iBAAgB;;;ACFzB,SAAS,gBAAgB;AACzB,SAAS,SAAS,UAAU,IAAI,iBAAiB;AACjD,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAK1B,SAAS,2BAA2B;AAIpC,IAAM,gBAAgB,UAAU,QAAQ;AAExC,eAAe,SAAS,KAAa,MAAgB,KAAa,YAAY,MAAoE;AAChJ,MAAI;AACF,UAAM,EAAE,QAAQ,OAAO,IAAI,MAAM,cAAc,KAAK,MAAM,EAAE,KAAK,WAAW,KAAK,IAAI,SAAS,UAAU,CAAC;AACzG,WAAO,EAAE,MAAM,GAAG,QAAQ,OAAO;AAAA,EACnC,SAAS,KAAK;AACZ,UAAM,IAAI;AACV,WAAO,EAAE,MAAM,OAAO,EAAE,SAAS,WAAW,EAAE,OAAO,GAAG,QAAQ,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,EAAE,WAAW,OAAO,GAAG,EAAE;AAAA,EAC/H;AACF;AAcA,IAAM,YAAY;AAAA;AAAA;A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UAAI,SAAS,WAAW,EAAG,QAAO,EAAE,UAAU,OAAO,OAAO,GAAG,QAAQ,uBAAuB;AAC9F,YAAM,IAAI,MAAM,UAAU,UAAU,EAAE,OAAO,EAAE,CAAC;AAChD,UAAI,CAAC,EAAE,MAAO,QAAO,EAAE,UAAU,OAAO,OAAO,GAAG,QAAQ,yBAAyB,EAAE,SAAS,SAAS,GAAG;AAC1G,YAAM,EAAE,QAAQ,KAAK,IAAI,MAAM,cAAc,KAAK,QAAQ,UAAU,UAAU,EAAE,OAAO;AACvF,YAAM,QAAQ,OAAO,OAAO,OAAO,EAAE,SAAS,SAAS;AACvD,aAAO,EAAE,UAAU,UAAU,GAAG,OAAO,QAAQ,KAAK;AAAA,IACtD;AAAA,EACF;AACF;","names":["readFile","readFile","execFile","promisify"]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createToolLlmAdapter
|
|
3
|
+
} from "./chunk-2PVVP7GN.js";
|
|
4
|
+
import {
|
|
5
|
+
createTrataHedgeAdapter
|
|
6
|
+
} from "./chunk-VQRS7VUC.js";
|
|
7
|
+
import {
|
|
8
|
+
createWebArenaVerifiedAdapter
|
|
9
|
+
} from "./chunk-Z7ML6L77.js";
|
|
10
|
+
import {
|
|
11
|
+
createRagBenchAdapter
|
|
12
|
+
} from "./chunk-R67DFVLO.js";
|
|
13
|
+
import {
|
|
14
|
+
createSimpleQaAdapter
|
|
15
|
+
} from "./chunk-SEVJPLZC.js";
|
|
16
|
+
import {
|
|
17
|
+
createSweBenchAdapter
|
|
18
|
+
} from "./chunk-CKUVRZ2T.js";
|
|
19
|
+
import {
|
|
20
|
+
createT2RagBenchAdapter
|
|
21
|
+
} from "./chunk-Y6O2OCUO.js";
|
|
22
|
+
import {
|
|
23
|
+
createTau2BenchAdapter
|
|
24
|
+
} from "./chunk-HBSWHQNJ.js";
|
|
25
|
+
import {
|
|
26
|
+
createTau3BankingAdapter
|
|
27
|
+
} from "./chunk-UAIOHCUK.js";
|
|
28
|
+
import {
|
|
29
|
+
createTerminalBenchAdapter
|
|
30
|
+
} from "./chunk-JRWWGMK7.js";
|
|
31
|
+
import {
|
|
32
|
+
createFramesAdapter
|
|
33
|
+
} from "./chunk-INNOYXCP.js";
|
|
34
|
+
import {
|
|
35
|
+
createHotpotqaAdapter
|
|
36
|
+
} from "./chunk-PA2ZKHJC.js";
|
|
37
|
+
import {
|
|
38
|
+
createHumanEvalAdapter
|
|
39
|
+
} from "./chunk-5H5XV76F.js";
|
|
40
|
+
import {
|
|
41
|
+
createMind2WebAdapter
|
|
42
|
+
} from "./chunk-TBKU5XQI.js";
|
|
43
|
+
import {
|
|
44
|
+
createNoMiraclAdapter
|
|
45
|
+
} from "./chunk-TSWPNOYM.js";
|
|
46
|
+
import {
|
|
47
|
+
createOpenRagBenchAdapter
|
|
48
|
+
} from "./chunk-KDIKRJGB.js";
|
|
49
|
+
import {
|
|
50
|
+
createProgrambenchAdapter
|
|
51
|
+
} from "./chunk-ZEWMTR5M.js";
|
|
52
|
+
import {
|
|
53
|
+
createCadBenchAdapter
|
|
54
|
+
} from "./chunk-PUIRNYI7.js";
|
|
55
|
+
import {
|
|
56
|
+
createCadGenBenchAdapter
|
|
57
|
+
} from "./chunk-C7T7WEK2.js";
|
|
58
|
+
import {
|
|
59
|
+
createCommit0Adapter
|
|
60
|
+
} from "./chunk-2XU6OGEN.js";
|
|
61
|
+
import {
|
|
62
|
+
createCragAdapter
|
|
63
|
+
} from "./chunk-HHXFIHXC.js";
|
|
64
|
+
import {
|
|
65
|
+
createDabstepAdapter
|
|
66
|
+
} from "./chunk-J3KDJNX2.js";
|
|
67
|
+
import {
|
|
68
|
+
createEnterpriseOpsGymAdapter
|
|
69
|
+
} from "./chunk-X5YKXC6V.js";
|
|
70
|
+
import {
|
|
71
|
+
createFinResearchBenchAdapter
|
|
72
|
+
} from "./chunk-YCGY7UIZ.js";
|
|
73
|
+
import {
|
|
74
|
+
createFinsearchcompAdapter
|
|
75
|
+
} from "./chunk-UPAMRDX4.js";
|
|
76
|
+
import {
|
|
77
|
+
createAecBenchAdapter
|
|
78
|
+
} from "./chunk-ODT47UAY.js";
|
|
79
|
+
import {
|
|
80
|
+
createAgentBenchAdapter
|
|
81
|
+
} from "./chunk-7WSD27QQ.js";
|
|
82
|
+
import {
|
|
83
|
+
createAppWorldAdapter,
|
|
84
|
+
createAppWorldReactAdapter
|
|
85
|
+
} from "./chunk-SYDW647C.js";
|
|
86
|
+
import {
|
|
87
|
+
createBfclAdapter
|
|
88
|
+
} from "./chunk-IFAV6KEM.js";
|
|
89
|
+
import {
|
|
90
|
+
createCadDesignAdapter
|
|
91
|
+
} from "./chunk-53UPUNBZ.js";
|
|
92
|
+
|
|
93
|
+
// src/adapters.ts
|
|
94
|
+
var ADAPTERS = {
|
|
95
|
+
"swe-bench": createSweBenchAdapter,
|
|
96
|
+
"terminal-bench": createTerminalBenchAdapter,
|
|
97
|
+
// Code-benches sharing ./benchmarks/_harness (stage → external evaluator → report).
|
|
98
|
+
// loadTasks fetches the REAL dataset (committed fixtures fallback offline); judge
|
|
99
|
+
// delegates to the benchmark's own harness and fails loud when it/Docker is absent.
|
|
100
|
+
"aec-bench": createAecBenchAdapter,
|
|
101
|
+
commit0: createCommit0Adapter,
|
|
102
|
+
dabstep: createDabstepAdapter,
|
|
103
|
+
programbench: createProgrambenchAdapter,
|
|
104
|
+
"webarena-verified": createWebArenaVerifiedAdapter,
|
|
105
|
+
"tau2-bench": createTau2BenchAdapter,
|
|
106
|
+
"tau3-banking": createTau3BankingAdapter,
|
|
107
|
+
agentbench: createAgentBenchAdapter,
|
|
108
|
+
bfcl: createBfclAdapter,
|
|
109
|
+
toollm: createToolLlmAdapter,
|
|
110
|
+
appworld: createAppWorldAdapter,
|
|
111
|
+
// AppWorld's native interactive protocol — the worker is the in-engine ReAct
|
|
112
|
+
// episode (execution feedback every turn), the mode published baselines use.
|
|
113
|
+
"appworld-react": createAppWorldReactAdapter,
|
|
114
|
+
"enterpriseops-gym": createEnterpriseOpsGymAdapter,
|
|
115
|
+
"cad-design": createCadDesignAdapter,
|
|
116
|
+
cadbench: createCadBenchAdapter,
|
|
117
|
+
cadgenbench: createCadGenBenchAdapter,
|
|
118
|
+
frames: createFramesAdapter,
|
|
119
|
+
ragbench: createRagBenchAdapter,
|
|
120
|
+
crag: createCragAdapter,
|
|
121
|
+
nomiracl: createNoMiraclAdapter,
|
|
122
|
+
"open-rag-bench": createOpenRagBenchAdapter,
|
|
123
|
+
"t2-ragbench": createT2RagBenchAdapter,
|
|
124
|
+
finresearchbench: createFinResearchBenchAdapter,
|
|
125
|
+
finsearchcomp: createFinsearchcompAdapter,
|
|
126
|
+
simpleqa: createSimpleQaAdapter,
|
|
127
|
+
hotpotqa: createHotpotqaAdapter,
|
|
128
|
+
// Deployable-checker code domain: worker = router completion, judge = Docker test
|
|
129
|
+
// run (--network=none). The steering A/B counterpart to humaneval-gate.mts (selection).
|
|
130
|
+
humaneval: createHumanEvalAdapter,
|
|
131
|
+
mind2web: createMind2WebAdapter,
|
|
132
|
+
"trata-hedge": createTrataHedgeAdapter
|
|
133
|
+
};
|
|
134
|
+
function resolveAdapter(key) {
|
|
135
|
+
const make = ADAPTERS[key];
|
|
136
|
+
if (!make) throw new Error(`unknown benchmark ${JSON.stringify(key)} (have: ${Object.keys(ADAPTERS).join(", ")})`);
|
|
137
|
+
return make();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export {
|
|
141
|
+
ADAPTERS,
|
|
142
|
+
resolveAdapter
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=chunk-PWQVGAJB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters.ts"],"sourcesContent":["/**\n * The benchmark registry — the single source of truth for every wired benchmark.\n * One key per benchmark; the value is its `BenchmarkAdapter` factory. `runBenchmarks`\n * (the unifier) maps over this; `run.ts`, `rsi.ts`, and `corpus-replay.mts` all read it\n * here rather than each keeping their own copy.\n */\n\nimport { createAecBenchAdapter } from './benchmarks/aec-bench'\nimport { createAgentBenchAdapter } from './benchmarks/agentbench'\nimport { createAppWorldAdapter, createAppWorldReactAdapter } from './benchmarks/appworld'\nimport { createBfclAdapter } from './benchmarks/bfcl'\nimport { createCadBenchAdapter } from './benchmarks/cadbench'\nimport { createCadDesignAdapter } from './benchmarks/cad-design'\nimport { createCadGenBenchAdapter } from './benchmarks/cadgenbench'\nimport { createCommit0Adapter } from './benchmarks/commit0'\nimport { createCragAdapter } from './benchmarks/crag'\nimport { createDabstepAdapter } from './benchmarks/dabstep'\nimport { createEnterpriseOpsGymAdapter } from './benchmarks/enterpriseops-gym'\nimport { createFinResearchBenchAdapter } from './benchmarks/finresearchbench'\nimport { createFinsearchcompAdapter } from './benchmarks/finsearchcomp'\nimport { createFramesAdapter } from './benchmarks/frames'\nimport { createHotpotqaAdapter } from './benchmarks/hotpotqa'\nimport { createHumanEvalAdapter } from './benchmarks/humaneval'\nimport { createMind2WebAdapter } from './benchmarks/mind2web'\nimport { createNoMiraclAdapter } from './benchmarks/nomiracl'\nimport { createOpenRagBenchAdapter } from './benchmarks/open-rag-bench'\nimport { createProgrambenchAdapter } from './benchmarks/programbench'\nimport { createRagBenchAdapter } from './benchmarks/ragbench'\nimport { createSimpleQaAdapter } from './benchmarks/simpleqa'\nimport { createSweBenchAdapter } from './benchmarks/swe-bench'\nimport { createT2RagBenchAdapter } from './benchmarks/t2-ragbench'\nimport { createTau2BenchAdapter } from './benchmarks/tau2-bench'\nimport { createTau3BankingAdapter } from './benchmarks/tau3-banking'\nimport { createTerminalBenchAdapter } from './benchmarks/terminal-bench'\nimport { createToolLlmAdapter } from './benchmarks/toollm'\nimport { createTrataHedgeAdapter } from './benchmarks/trata-hedge'\nimport { createWebArenaVerifiedAdapter } from './benchmarks/webarena-verified'\nimport type { BenchmarkAdapter } from './benchmarks/types'\n\nexport const ADAPTERS: Record<string, () => BenchmarkAdapter> = {\n 'swe-bench': createSweBenchAdapter,\n 'terminal-bench': createTerminalBenchAdapter,\n // Code-benches sharing ./benchmarks/_harness (stage → external evaluator → report).\n // loadTasks fetches the REAL dataset (committed fixtures fallback offline); judge\n // delegates to the benchmark's own harness and fails loud when it/Docker is absent.\n 'aec-bench': createAecBenchAdapter,\n commit0: createCommit0Adapter,\n dabstep: createDabstepAdapter,\n programbench: createProgrambenchAdapter,\n 'webarena-verified': createWebArenaVerifiedAdapter,\n 'tau2-bench': createTau2BenchAdapter,\n 'tau3-banking': createTau3BankingAdapter,\n agentbench: createAgentBenchAdapter,\n bfcl: createBfclAdapter,\n toollm: createToolLlmAdapter,\n appworld: createAppWorldAdapter,\n // AppWorld's native interactive protocol — the worker is the in-engine ReAct\n // episode (execution feedback every turn), the mode published baselines use.\n 'appworld-react': createAppWorldReactAdapter,\n 'enterpriseops-gym': createEnterpriseOpsGymAdapter,\n 'cad-design': createCadDesignAdapter,\n cadbench: createCadBenchAdapter,\n cadgenbench: createCadGenBenchAdapter,\n frames: createFramesAdapter,\n ragbench: createRagBenchAdapter,\n crag: createCragAdapter,\n nomiracl: createNoMiraclAdapter,\n 'open-rag-bench': createOpenRagBenchAdapter,\n 't2-ragbench': createT2RagBenchAdapter,\n finresearchbench: createFinResearchBenchAdapter,\n finsearchcomp: createFinsearchcompAdapter,\n simpleqa: createSimpleQaAdapter,\n hotpotqa: createHotpotqaAdapter,\n // Deployable-checker code domain: worker = router completion, judge = Docker test\n // run (--network=none). The steering A/B counterpart to humaneval-gate.mts (selection).\n humaneval: createHumanEvalAdapter,\n mind2web: createMind2WebAdapter,\n 'trata-hedge': createTrataHedgeAdapter,\n}\n\n/** Resolve a benchmark key to its adapter, failing loud with the known keys. */\nexport function resolveAdapter(key: string): BenchmarkAdapter {\n const make = ADAPTERS[key]\n if (!make) throw new Error(`unknown benchmark ${JSON.stringify(key)} (have: ${Object.keys(ADAPTERS).join(', ')})`)\n return make()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,IAAM,WAAmD;AAAA,EAC9D,aAAa;AAAA,EACb,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAIlB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,SAAS;AAAA,EACT,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA;AAAA;AAAA,EAGV,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,UAAU;AAAA,EACV,UAAU;AAAA;AAAA;AAAA,EAGV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AACjB;AAGO,SAAS,eAAe,KAA+B;AAC5D,QAAM,OAAO,SAAS,GAAG;AACzB,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,qBAAqB,KAAK,UAAU,GAAG,CAAC,WAAW,OAAO,KAAK,QAAQ,EAAE,KAAK,IAAI,CAAC,GAAG;AACjH,SAAO,KAAK;AACd;","names":[]}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runVenvPython
|
|
3
|
+
} from "./chunk-LRRD7NAG.js";
|
|
4
|
+
|
|
5
|
+
// src/benchmarks/tau-bench-shared.ts
|
|
6
|
+
import { readFile, stat } from "fs/promises";
|
|
7
|
+
import { resolve } from "path";
|
|
8
|
+
var tauResultsOutput = {
|
|
9
|
+
parse(events) {
|
|
10
|
+
let text = "";
|
|
11
|
+
for (const ev of events) {
|
|
12
|
+
const d = ev?.data;
|
|
13
|
+
const t = d?.finalText ?? d?.text ?? d?.result;
|
|
14
|
+
if (typeof t === "string" && t.length > 0) text = t;
|
|
15
|
+
}
|
|
16
|
+
const fences = [...text.matchAll(/```(?:text|path|json)?\s*\n([\s\S]*?)```/g)];
|
|
17
|
+
return (fences.at(-1)?.[1] ?? text).trim();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
async function assertPath(path, label, benchName) {
|
|
21
|
+
try {
|
|
22
|
+
await stat(path);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
throw new Error(`${benchName}: missing ${label} at ${path} (${err instanceof Error ? err.message : err})`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function benchDir(config) {
|
|
28
|
+
return process.env[config.dirEnv];
|
|
29
|
+
}
|
|
30
|
+
function benchDomain(config) {
|
|
31
|
+
return process.env[config.domainEnv] ?? config.defaultDomain;
|
|
32
|
+
}
|
|
33
|
+
function rowToTask(row, config, split) {
|
|
34
|
+
const meta = {
|
|
35
|
+
taskId: row.id,
|
|
36
|
+
domain: row.domain,
|
|
37
|
+
split,
|
|
38
|
+
userScenario: row.user_scenario,
|
|
39
|
+
description: row.description,
|
|
40
|
+
evaluationCriteria: row.evaluation_criteria
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
id: row.id,
|
|
44
|
+
split,
|
|
45
|
+
prompt: [
|
|
46
|
+
config.taskIntro,
|
|
47
|
+
`Run this task in the official ${row.domain} domain.`,
|
|
48
|
+
"The benchmark is a simulated multi-turn user/tool conversation.",
|
|
49
|
+
"",
|
|
50
|
+
typeof row.user_scenario === "string" ? row.user_scenario : JSON.stringify(row.user_scenario ?? {}, null, 2),
|
|
51
|
+
"",
|
|
52
|
+
"Return the path to the official tau results.json or trajectory file containing this task run."
|
|
53
|
+
].join("\n"),
|
|
54
|
+
metadata: meta
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function readMeta(task, benchName) {
|
|
58
|
+
const md = task.metadata;
|
|
59
|
+
if (!md || typeof md.taskId !== "string" || typeof md.domain !== "string") {
|
|
60
|
+
throw new Error(`${benchName} task ${task.id} missing metadata \u2014 loadTasks did not populate it`);
|
|
61
|
+
}
|
|
62
|
+
return md;
|
|
63
|
+
}
|
|
64
|
+
function selectRows(rows, opts, config, split) {
|
|
65
|
+
let tasks = rows.map((row) => rowToTask(row, config, split));
|
|
66
|
+
if (opts.ids) {
|
|
67
|
+
const want = new Set(opts.ids);
|
|
68
|
+
tasks = tasks.filter((task) => want.has(task.id));
|
|
69
|
+
} else if (opts.limit !== void 0) {
|
|
70
|
+
tasks = tasks.slice(0, opts.limit);
|
|
71
|
+
}
|
|
72
|
+
if (tasks.length === 0) throw new Error(`${config.name}: no tasks matched ${JSON.stringify(opts)}`);
|
|
73
|
+
return tasks;
|
|
74
|
+
}
|
|
75
|
+
async function loadFixtures(config, opts) {
|
|
76
|
+
const rows = JSON.parse(await readFile(config.fixturePath, "utf8"));
|
|
77
|
+
console.warn(`[${config.name}] ${config.fixturesEnv}=1 \u2014 loading ${rows.length} adapter fixtures`);
|
|
78
|
+
return selectRows(rows, opts, config, opts.split);
|
|
79
|
+
}
|
|
80
|
+
async function loadOfficialTasks(config, root, opts) {
|
|
81
|
+
const domain = benchDomain(config);
|
|
82
|
+
const script = `
|
|
83
|
+
import json, sys
|
|
84
|
+
from pathlib import Path
|
|
85
|
+
root = Path(sys.argv[1])
|
|
86
|
+
domain = sys.argv[2]
|
|
87
|
+
split = sys.argv[3] or None
|
|
88
|
+
sys.path.insert(0, str(root / "src"))
|
|
89
|
+
from tau2.registry import registry
|
|
90
|
+
loader = registry.get_tasks_loader(domain)
|
|
91
|
+
tasks = loader(split)
|
|
92
|
+
rows = []
|
|
93
|
+
for task in tasks:
|
|
94
|
+
row = task.model_dump(mode="json")
|
|
95
|
+
row["domain"] = domain
|
|
96
|
+
rows.append(row)
|
|
97
|
+
print(json.dumps(rows))
|
|
98
|
+
`;
|
|
99
|
+
const stdout = await runVenvPython(script, [root, domain, opts.split ?? ""]);
|
|
100
|
+
return selectRows(JSON.parse(stdout), opts, config, opts.split);
|
|
101
|
+
}
|
|
102
|
+
async function scoreOfficialTrajectory(root, meta, artifactPath) {
|
|
103
|
+
const script = `
|
|
104
|
+
import json, sys
|
|
105
|
+
from pathlib import Path
|
|
106
|
+
root = Path(sys.argv[1])
|
|
107
|
+
task_id = sys.argv[2]
|
|
108
|
+
artifact = Path(sys.argv[3])
|
|
109
|
+
sys.path.insert(0, str(root / "src"))
|
|
110
|
+
from tau2.data_model.simulation import Results
|
|
111
|
+
from tau2.scripts.evaluate_trajectories import compute_simulation_rewards
|
|
112
|
+
results = Results.load(artifact)
|
|
113
|
+
updated = compute_simulation_rewards(results)
|
|
114
|
+
scores = []
|
|
115
|
+
for sim in updated.simulations:
|
|
116
|
+
if sim.task_id == task_id and sim.reward_info is not None:
|
|
117
|
+
scores.append(float(sim.reward_info.reward))
|
|
118
|
+
if not scores:
|
|
119
|
+
raise SystemExit(f"no scored simulations for task_id={task_id} in {artifact}")
|
|
120
|
+
print(json.dumps({"count": len(scores), "score": sum(scores) / len(scores), "scores": scores}))
|
|
121
|
+
`;
|
|
122
|
+
const stdout = await runVenvPython(script, [root, meta.taskId, artifactPath], 0);
|
|
123
|
+
return JSON.parse(stdout.trim().split("\n").at(-1) ?? "{}");
|
|
124
|
+
}
|
|
125
|
+
function createTauBenchAdapter(config) {
|
|
126
|
+
const fixturesMode = process.env[config.fixturesEnv] === "1";
|
|
127
|
+
return {
|
|
128
|
+
name: config.name,
|
|
129
|
+
output: tauResultsOutput,
|
|
130
|
+
async preflight() {
|
|
131
|
+
if (fixturesMode) return;
|
|
132
|
+
const dir = benchDir(config);
|
|
133
|
+
if (!dir) {
|
|
134
|
+
throw new Error(`${config.dirEnv} is required. Fix: ${config.installHint}`);
|
|
135
|
+
}
|
|
136
|
+
await assertPath(`${dir}/src/tau2/registry.py`, "tau registry", config.name);
|
|
137
|
+
await loadOfficialTasks(config, dir, { limit: 1 });
|
|
138
|
+
},
|
|
139
|
+
async loadTasks(opts = {}) {
|
|
140
|
+
if (fixturesMode) return loadFixtures(config, opts);
|
|
141
|
+
const dir = benchDir(config);
|
|
142
|
+
if (!dir) throw new Error(`${config.dirEnv} is required to load official ${config.name} tasks`);
|
|
143
|
+
return loadOfficialTasks(config, dir, opts);
|
|
144
|
+
},
|
|
145
|
+
async goldArtifact() {
|
|
146
|
+
return void 0;
|
|
147
|
+
},
|
|
148
|
+
async judge(task, artifact) {
|
|
149
|
+
const dir = benchDir(config);
|
|
150
|
+
if (!dir) throw new Error(`${config.dirEnv} is required to judge ${config.name} trajectory artifacts`);
|
|
151
|
+
const meta = readMeta(task, config.name);
|
|
152
|
+
const artifactPath = resolve(artifact.trim());
|
|
153
|
+
await assertPath(artifactPath, "tau results/trajectory artifact", config.name);
|
|
154
|
+
const report = await scoreOfficialTrajectory(dir, meta, artifactPath);
|
|
155
|
+
const score = typeof report.score === "number" ? report.score : 0;
|
|
156
|
+
return {
|
|
157
|
+
resolved: score === 1,
|
|
158
|
+
score,
|
|
159
|
+
detail: JSON.stringify({ taskId: meta.taskId, domain: meta.domain, count: report.count })
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
tauResultsOutput,
|
|
167
|
+
createTauBenchAdapter
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=chunk-R36V2VP7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/benchmarks/tau-bench-shared.ts"],"sourcesContent":["/**\n * Shared tau-bench adapter spine.\n *\n * tau2 and tau3 live in the same upstream repository/package namespace today:\n * `sierra-research/tau2-bench`, Python package `tau2`. Keep one implementation\n * for task loading and reward recomputation so the domain/version adapters only\n * choose env names, default domain, and fixture file.\n */\n\nimport { readFile, stat } from 'node:fs/promises'\nimport { resolve } from 'node:path'\nimport type { OutputAdapter } from '@tangle-network/agent-runtime/loops'\nimport { runVenvPython } from './_harness'\nimport type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'\n\nexport interface TauBenchConfig {\n name: string\n fixturePath: string\n fixturesEnv: string\n dirEnv: string\n domainEnv: string\n defaultDomain: string\n installHint: string\n taskIntro: string\n}\n\ninterface TauRow {\n id: string\n domain: string\n user_scenario?: unknown\n description?: unknown\n evaluation_criteria?: unknown\n}\n\ninterface TauMeta {\n taskId: string\n domain: string\n split?: string\n userScenario?: unknown\n description?: unknown\n evaluationCriteria?: unknown\n}\n\nexport const tauResultsOutput: OutputAdapter<string> = {\n parse(events) {\n let text = ''\n for (const ev of events) {\n const d = (ev as { data?: Record<string, unknown> })?.data\n const t = d?.finalText ?? d?.text ?? d?.result\n if (typeof t === 'string' && t.length > 0) text = t\n }\n const fences = [...text.matchAll(/```(?:text|path|json)?\\s*\\n([\\s\\S]*?)```/g)]\n return (fences.at(-1)?.[1] ?? text).trim()\n },\n}\n\nasync function assertPath(path: string, label: string, benchName: string): Promise<void> {\n try {\n await stat(path)\n } catch (err) {\n throw new Error(`${benchName}: missing ${label} at ${path} (${err instanceof Error ? err.message : err})`)\n }\n}\n\nfunction benchDir(config: TauBenchConfig): string | undefined {\n return process.env[config.dirEnv]\n}\n\nfunction benchDomain(config: TauBenchConfig): string {\n return process.env[config.domainEnv] ?? config.defaultDomain\n}\n\nfunction rowToTask(row: TauRow, config: TauBenchConfig, split?: string): BenchTask {\n const meta: TauMeta = {\n taskId: row.id,\n domain: row.domain,\n split,\n userScenario: row.user_scenario,\n description: row.description,\n evaluationCriteria: row.evaluation_criteria,\n }\n return {\n id: row.id,\n split,\n prompt: [\n config.taskIntro,\n `Run this task in the official ${row.domain} domain.`,\n 'The benchmark is a simulated multi-turn user/tool conversation.',\n '',\n typeof row.user_scenario === 'string' ? row.user_scenario : JSON.stringify(row.user_scenario ?? {}, null, 2),\n '',\n 'Return the path to the official tau results.json or trajectory file containing this task run.',\n ].join('\\n'),\n metadata: meta as unknown as Record<string, unknown>,\n }\n}\n\nfunction readMeta(task: BenchTask, benchName: string): TauMeta {\n const md = task.metadata\n if (!md || typeof md.taskId !== 'string' || typeof md.domain !== 'string') {\n throw new Error(`${benchName} task ${task.id} missing metadata — loadTasks did not populate it`)\n }\n return md as unknown as TauMeta\n}\n\nfunction selectRows(rows: TauRow[], opts: LoadOptions, config: TauBenchConfig, split?: string): BenchTask[] {\n let tasks = rows.map((row) => rowToTask(row, config, split))\n if (opts.ids) {\n const want = new Set(opts.ids)\n tasks = tasks.filter((task) => want.has(task.id))\n } else if (opts.limit !== undefined) {\n tasks = tasks.slice(0, opts.limit)\n }\n if (tasks.length === 0) throw new Error(`${config.name}: no tasks matched ${JSON.stringify(opts)}`)\n return tasks\n}\n\nasync function loadFixtures(config: TauBenchConfig, opts: LoadOptions): Promise<BenchTask[]> {\n const rows = JSON.parse(await readFile(config.fixturePath, 'utf8')) as TauRow[]\n console.warn(`[${config.name}] ${config.fixturesEnv}=1 — loading ${rows.length} adapter fixtures`)\n return selectRows(rows, opts, config, opts.split)\n}\n\nasync function loadOfficialTasks(config: TauBenchConfig, root: string, opts: LoadOptions): Promise<BenchTask[]> {\n const domain = benchDomain(config)\n const script = `\nimport json, sys\nfrom pathlib import Path\nroot = Path(sys.argv[1])\ndomain = sys.argv[2]\nsplit = sys.argv[3] or None\nsys.path.insert(0, str(root / \"src\"))\nfrom tau2.registry import registry\nloader = registry.get_tasks_loader(domain)\ntasks = loader(split)\nrows = []\nfor task in tasks:\n row = task.model_dump(mode=\"json\")\n row[\"domain\"] = domain\n rows.append(row)\nprint(json.dumps(rows))\n`\n const stdout = await runVenvPython(script, [root, domain, opts.split ?? ''])\n return selectRows(JSON.parse(stdout) as TauRow[], opts, config, opts.split)\n}\n\nasync function scoreOfficialTrajectory(root: string, meta: TauMeta, artifactPath: string): Promise<Record<string, unknown>> {\n const script = `\nimport json, sys\nfrom pathlib import Path\nroot = Path(sys.argv[1])\ntask_id = sys.argv[2]\nartifact = Path(sys.argv[3])\nsys.path.insert(0, str(root / \"src\"))\nfrom tau2.data_model.simulation import Results\nfrom tau2.scripts.evaluate_trajectories import compute_simulation_rewards\nresults = Results.load(artifact)\nupdated = compute_simulation_rewards(results)\nscores = []\nfor sim in updated.simulations:\n if sim.task_id == task_id and sim.reward_info is not None:\n scores.append(float(sim.reward_info.reward))\nif not scores:\n raise SystemExit(f\"no scored simulations for task_id={task_id} in {artifact}\")\nprint(json.dumps({\"count\": len(scores), \"score\": sum(scores) / len(scores), \"scores\": scores}))\n`\n const stdout = await runVenvPython(script, [root, meta.taskId, artifactPath], 0)\n return JSON.parse(stdout.trim().split('\\n').at(-1) ?? '{}') as Record<string, unknown>\n}\n\nexport function createTauBenchAdapter(config: TauBenchConfig): BenchmarkAdapter {\n const fixturesMode = process.env[config.fixturesEnv] === '1'\n\n return {\n name: config.name,\n output: tauResultsOutput,\n\n async preflight() {\n if (fixturesMode) return\n const dir = benchDir(config)\n if (!dir) {\n throw new Error(`${config.dirEnv} is required. Fix: ${config.installHint}`)\n }\n await assertPath(`${dir}/src/tau2/registry.py`, 'tau registry', config.name)\n await loadOfficialTasks(config, dir, { limit: 1 })\n },\n\n async loadTasks(opts: LoadOptions = {}) {\n if (fixturesMode) return loadFixtures(config, opts)\n const dir = benchDir(config)\n if (!dir) throw new Error(`${config.dirEnv} is required to load official ${config.name} tasks`)\n return loadOfficialTasks(config, dir, opts)\n },\n\n async goldArtifact() {\n return undefined\n },\n\n async judge(task: BenchTask, artifact: string): Promise<BenchScore> {\n const dir = benchDir(config)\n if (!dir) throw new Error(`${config.dirEnv} is required to judge ${config.name} trajectory artifacts`)\n const meta = readMeta(task, config.name)\n const artifactPath = resolve(artifact.trim())\n await assertPath(artifactPath, 'tau results/trajectory artifact', config.name)\n const report = await scoreOfficialTrajectory(dir, meta, artifactPath)\n const score = typeof report.score === 'number' ? report.score : 0\n return {\n resolved: score === 1,\n score,\n detail: JSON.stringify({ taskId: meta.taskId, domain: meta.domain, count: report.count }),\n }\n },\n }\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