@tangle-network/agent-bench 1.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +24 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +63 -50
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +55 -44
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +3 -3
- package/dist/benchmarks/mcad-cq-bench.js +70 -58
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +63 -52
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +49 -43
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-DhAndllg.js → cadbench-htzAmMaI.js} +41 -36
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +64 -59
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +50 -0
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/src/adapters.ts +5 -7
- package/src/atom-mcp-e2e.mts +2 -2
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +36 -36
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +58 -48
- package/src/benchmarks/finsearchcomp.ts +73 -68
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +79 -74
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +61 -58
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +19 -16
- package/src/examples/lean-proof-gate.mts +1 -1
- package/src/examples/math-demo.mts +2 -2
- package/src/examples/strategy-demo.mts +1 -1
- package/src/gate-cli.mts +6 -6
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/generate-eval/certify.ts +4 -4
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +3 -3
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/swe-self-improve.mts +3 -3
- package/src/terminal-compare.ts +1 -1
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-DhAndllg.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { benchRoot, runVenvScriptStdin } from "./_harness.js";
|
|
2
|
-
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
// src/benchmarks/enterpriseops-gym.ts
|
|
5
|
-
/**
|
|
6
|
-
* EnterpriseOps-Gym adapter (ServiceNow-AI/EnterpriseOps-Gym, Apache-2.0) —
|
|
7
|
-
* stateful agentic planning + tool use in enterprise settings. Each record is an
|
|
8
|
-
* enterprise-ops task (Customer Service, HR, ITSM, Calendar, Email, Drive, Teams,
|
|
9
|
-
* Hybrid) handed to the agent with a domain `system_prompt`, a `selected_tools`
|
|
10
|
-
* allow-list, and one or more containerized gym MCP servers (`gym_servers_config`).
|
|
11
|
-
* Worker artifact = the ordered tool-call transcript the agent would issue against
|
|
12
|
-
* those servers, emitted as a single fenced ```json block of
|
|
13
|
-
* `{ "calls": [ { "tool": ..., "arguments": {...}, "gym_name"?: ... } ] }`.
|
|
14
|
-
*
|
|
15
|
-
* Judge = the benchmark's OWN deterministic state-checker. The driver replays the
|
|
16
|
-
* transcript against a freshly-seeded gym server (mutating its database), then runs
|
|
17
|
-
* each task's `database_state` verifier — an SQL SELECT executed via the gym
|
|
18
|
-
* server's /api/sql-runner endpoint, compared to `expected_value` under
|
|
19
|
-
* `comparison_type` (equals/greater_than/less_than/contains). GRADED: score =
|
|
20
|
-
* (verifiers passing) / (total verifiers) = the bench's verifier_level_pass_rate;
|
|
21
|
-
* binary `resolved` = ALL verifiers pass = the bench's overall_success_rate. Fully
|
|
22
|
-
* deterministic — no LLM judge.
|
|
23
|
-
*
|
|
24
|
-
* loadTasks enumerates the real suite from the HF rows server (config = tool-set
|
|
25
|
-
* MODE oracle|plus_5_tools|plus_10_tools|plus_15_tools; split = DOMAIN); a committed
|
|
26
|
-
* sample (bench/fixtures/enterpriseops-gym.json) loads offline.
|
|
27
|
-
*
|
|
28
|
-
* Requires for a LIVE judge run: a Docker daemon with the domain gym images
|
|
29
|
-
* (`docker pull shivakrishnareddyma225/enterpriseops-gym-mcp-<domain>:latest`) up
|
|
30
|
-
* on the ports in `gym_servers_config`, seeded from gym_dbs.zip. preflight + judge
|
|
31
|
-
* fail loud with the exact pull/run/unzip step when a server is unreachable — never
|
|
32
|
-
* a fabricated score. No portable gold artifact ships, so goldArtifact is undefined.
|
|
33
|
-
*/
|
|
34
|
-
const FIXTURES = join(benchRoot, "fixtures", "enterpriseops-gym.json");
|
|
35
|
-
const JUDGE = join(benchRoot, "scripts", "enterpriseops_gym_judge.py");
|
|
36
|
-
/** Monotonic discriminator so concurrent judge calls stage distinct task-cache files. */
|
|
37
|
-
let judgeCallSeq = 0;
|
|
38
|
-
const DATASET = "ServiceNow-AI/EnterpriseOps-Gym";
|
|
39
|
-
/** Tool-set mode = HF config; oracle ships exact tools, plus_N adds N distractors. */
|
|
40
|
-
const DEFAULT_MODE = "oracle";
|
|
41
|
-
/** Domain = HF split. */
|
|
42
|
-
const DEFAULT_DOMAIN = "itsm";
|
|
43
|
-
const rowsApi = (mode, domain) => `https://datasets-server.huggingface.co/rows?dataset=${encodeURIComponent(DATASET)}&config=${encodeURIComponent(mode)}&split=${encodeURIComponent(domain)}`;
|
|
44
|
-
/** Worker transcript = the last fenced ```json block, else the raw text. */
|
|
45
|
-
const enterpriseOpsTranscriptOutput = { parse(events) {
|
|
46
|
-
let text = "";
|
|
47
|
-
for (const ev of events) {
|
|
48
|
-
const d = ev?.data;
|
|
49
|
-
const t = d?.finalText ?? d?.text ?? d?.result;
|
|
50
|
-
if (typeof t === "string" && t.length > 0) text = t;
|
|
51
|
-
}
|
|
52
|
-
return ([...text.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)].at(-1)?.[1] ?? text).trim();
|
|
53
|
-
} };
|
|
54
|
-
function asArray(v) {
|
|
55
|
-
return typeof v === "string" ? JSON.parse(v) : v;
|
|
56
|
-
}
|
|
57
|
-
function workerContract(tools) {
|
|
58
|
-
return [
|
|
59
|
-
"",
|
|
60
|
-
`You have exactly these tools available (call NO others): ${tools.join(", ")}.`,
|
|
61
|
-
"Plan the full sequence of tool calls that brings the enterprise database to the required final state, honoring every policy in the role above.",
|
|
62
|
-
"Emit your COMPLETE plan as the LAST thing in your reply, in a single fenced ```json block, as an object:",
|
|
63
|
-
"{ \"calls\": [ { \"tool\": \"<tool_name>\", \"arguments\": { ... } } ] }",
|
|
64
|
-
"Include one entry per tool call in execution order. Nothing after the closing fence."
|
|
65
|
-
].join("\n");
|
|
66
|
-
}
|
|
67
|
-
function rowToTask(row, mode) {
|
|
68
|
-
const servers = asArray(row.gym_servers_config);
|
|
69
|
-
const verifiers = asArray(row.verifiers);
|
|
70
|
-
const meta = {
|
|
71
|
-
taskId: row.task_id,
|
|
72
|
-
domain: row.domain,
|
|
73
|
-
mode,
|
|
74
|
-
selectedTools: row.selected_tools,
|
|
75
|
-
servers,
|
|
76
|
-
verifiers
|
|
77
|
-
};
|
|
78
|
-
return {
|
|
79
|
-
id: row.task_id,
|
|
80
|
-
split: row.domain,
|
|
81
|
-
prompt: [
|
|
82
|
-
row.system_prompt,
|
|
83
|
-
"",
|
|
84
|
-
row.user_prompt,
|
|
85
|
-
workerContract(row.selected_tools)
|
|
86
|
-
].join("\n"),
|
|
87
|
-
metadata: meta
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function readMeta(task) {
|
|
91
|
-
const md = task.metadata;
|
|
92
|
-
if (!md || typeof md.taskId !== "string" || !Array.isArray(md.servers) || !Array.isArray(md.verifiers) || md.verifiers.length === 0) throw new Error(`enterpriseops-gym task ${task.id} missing metadata — loadTasks did not populate it`);
|
|
93
|
-
return md;
|
|
94
|
-
}
|
|
95
|
-
function selectRows(rows, mode, opts) {
|
|
96
|
-
let tasks = rows.map((r) => rowToTask(r, mode));
|
|
97
|
-
if (opts.ids) {
|
|
98
|
-
const want = new Set(opts.ids);
|
|
99
|
-
tasks = tasks.filter((t) => want.has(t.id));
|
|
100
|
-
} else if (opts.limit !== void 0) tasks = tasks.slice(0, opts.limit);
|
|
101
|
-
return tasks;
|
|
102
|
-
}
|
|
103
|
-
async function loadFixtures(mode, opts) {
|
|
104
|
-
const rows = JSON.parse(await readFile(FIXTURES, "utf8"));
|
|
105
|
-
console.warn(`[enterpriseops-gym] EOPS_FIXTURES=1 — loading ${rows.length} committed sample rows from ${FIXTURES} (no HF fetch)`);
|
|
106
|
-
const domain = opts.split;
|
|
107
|
-
return selectRows(domain ? rows.filter((r) => r.domain === domain) : rows, mode, opts);
|
|
108
|
-
}
|
|
109
|
-
/** Pull real rows from the HF rows server (paged) for one mode/domain. Throws loud on a non-OK response. */
|
|
110
|
-
async function fetchRows(mode, domain, opts) {
|
|
111
|
-
const target = opts.ids ? opts.ids.length * 4 : opts.limit ?? 16;
|
|
112
|
-
const rows = [];
|
|
113
|
-
const want = opts.ids ? new Set(opts.ids) : null;
|
|
114
|
-
const page = 100;
|
|
115
|
-
const base = rowsApi(mode, domain);
|
|
116
|
-
for (let offset = 0; offset < 1024 && rows.length < target; offset += page) {
|
|
117
|
-
const res = await fetch(`${base}&offset=${offset}&length=${page}`);
|
|
118
|
-
if (!res.ok) throw new Error(`enterpriseops-gym rows HTTP ${res.status} (offset ${offset}): ${(await res.text()).slice(0, 200)}`);
|
|
119
|
-
const got = (await res.json()).rows ?? [];
|
|
120
|
-
if (got.length === 0) break;
|
|
121
|
-
for (const r of got) {
|
|
122
|
-
if (want && !want.has(r.row.task_id)) continue;
|
|
123
|
-
rows.push(r.row);
|
|
124
|
-
}
|
|
125
|
-
if (got.length < page) break;
|
|
126
|
-
}
|
|
127
|
-
if (rows.length === 0) throw new Error(`enterpriseops-gym: no rows matched ${JSON.stringify(opts)} for ${mode}/${domain}`);
|
|
128
|
-
return rows;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Run the benchmark's own state-checker for one task over the worker's transcript.
|
|
132
|
-
* The driver replays the tool calls against the live gym server, runs each
|
|
133
|
-
* database_state verifier's SQL via /api/sql-runner, and reports {passes,total}.
|
|
134
|
-
* Score = passes/total (verifier_level_pass_rate); resolved = all pass
|
|
135
|
-
* (overall_success_rate). This is the expensive Docker-backed boundary — delegated
|
|
136
|
-
* to the python driver, not reimplemented. The transcript is piped on stdin via the
|
|
137
|
-
* shared stdin-aware runner (execFile's `input` is not honored async and hangs the
|
|
138
|
-
* reader).
|
|
139
|
-
*/
|
|
140
|
-
async function runJudge(meta, artifact) {
|
|
141
|
-
const taskJsonPath = join(benchRoot, ".eops-task-cache", `${meta.taskId}-${process.pid}-${judgeCallSeq++}.json`);
|
|
142
|
-
await writeTaskCache(taskJsonPath, meta);
|
|
143
|
-
let stdout;
|
|
144
|
-
try {
|
|
145
|
-
stdout = await runVenvScriptStdin(JUDGE, [
|
|
146
|
-
"judge",
|
|
147
|
-
"--task-json",
|
|
148
|
-
taskJsonPath
|
|
149
|
-
], artifact, { cwd: benchRoot });
|
|
150
|
-
} catch (err) {
|
|
151
|
-
const e = err;
|
|
152
|
-
throw new Error(`enterpriseops-gym judge failed for ${meta.taskId}: ${(e.message || String(err)).slice(0, 1500)}\nFix: (1) run the ${meta.domain} gym server — docker pull shivakrishnareddyma225/enterpriseops-gym-mcp-${meta.domain}:latest ; docker run -d -p <host>:8005 shivakrishnareddyma225/enterpriseops-gym-mcp-${meta.domain}:latest ; (2) unzip gym_dbs.zip (ServiceNow/EnterpriseOps-Gym) and export EOPS_GYM_DBS_DIR to its dir (the judge seeds each task's database from seed_database_file).`);
|
|
153
|
-
} finally {
|
|
154
|
-
await rm(taskJsonPath, { force: true }).catch(() => {});
|
|
155
|
-
}
|
|
156
|
-
const report = JSON.parse(stdout.trim().split("\n").at(-1) ?? "{}");
|
|
157
|
-
if (report.error) throw new Error(`enterpriseops-gym judge error for ${meta.taskId}: ${report.error}`);
|
|
158
|
-
if (typeof report.passes !== "number" || typeof report.total !== "number") throw new Error(`enterpriseops-gym judge returned no {passes,total}: ${stdout.slice(0, 400)}`);
|
|
159
|
-
const score = report.total > 0 ? report.passes / report.total : 0;
|
|
160
|
-
return {
|
|
161
|
-
resolved: report.success === true && report.total > 0 && report.passes === report.total,
|
|
162
|
-
score,
|
|
163
|
-
detail: JSON.stringify({
|
|
164
|
-
taskId: meta.taskId,
|
|
165
|
-
domain: meta.domain,
|
|
166
|
-
passes: report.passes,
|
|
167
|
-
total: report.total
|
|
168
|
-
})
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
async function writeTaskCache(path, meta) {
|
|
172
|
-
await mkdir(join(path, ".."), { recursive: true });
|
|
173
|
-
await writeFile(path, JSON.stringify({
|
|
174
|
-
task_id: meta.taskId,
|
|
175
|
-
domain: meta.domain,
|
|
176
|
-
gym_servers_config: meta.servers,
|
|
177
|
-
verifiers: meta.verifiers
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
/** Ping the configured gym servers' SQL endpoint; throw loud with the docker fix if any is unreachable. */
|
|
181
|
-
async function probeServers(servers, domain) {
|
|
182
|
-
for (const s of servers) {
|
|
183
|
-
const url = `${s.mcp_server_url.replace(/\/$/, "")}/api/sql-runner`;
|
|
184
|
-
try {
|
|
185
|
-
(await fetch(url, {
|
|
186
|
-
method: "POST",
|
|
187
|
-
headers: { "content-type": "application/json" },
|
|
188
|
-
body: "{}"
|
|
189
|
-
})).status;
|
|
190
|
-
} catch (err) {
|
|
191
|
-
throw new Error(`enterpriseops-gym preflight: ${s.mcp_server_name} unreachable at ${url}: ${err instanceof Error ? err.message : err}\nFix: docker pull shivakrishnareddyma225/enterpriseops-gym-mcp-${domain}:latest ; docker run -d -p <port>:<port> shivakrishnareddyma225/enterpriseops-gym-mcp-${domain}:latest ; seed from gym_dbs.zip. Set EOPS_FIXTURES=1 to load sample tasks offline (judge still needs a live server).`);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function createEnterpriseOpsGymAdapter() {
|
|
196
|
-
const fixturesMode = process.env.EOPS_FIXTURES === "1";
|
|
197
|
-
const mode = process.env.EOPS_MODE ?? DEFAULT_MODE;
|
|
198
|
-
return {
|
|
199
|
-
name: "enterpriseops-gym",
|
|
200
|
-
output: enterpriseOpsTranscriptOutput,
|
|
201
|
-
async preflight() {
|
|
202
|
-
if (fixturesMode) {
|
|
203
|
-
await readFile(FIXTURES, "utf8").catch((err) => {
|
|
204
|
-
throw new Error(`EOPS_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`);
|
|
205
|
-
});
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
const sample = await loadFixtures(mode, {
|
|
209
|
-
split: DEFAULT_DOMAIN,
|
|
210
|
-
limit: 1
|
|
211
|
-
}).catch(() => []);
|
|
212
|
-
const servers = sample[0] ? readMeta(sample[0]).servers : [];
|
|
213
|
-
if (servers.length === 0) throw new Error("enterpriseops-gym preflight: no gym_servers_config to probe. Set EOPS_FIXTURES=1 to load offline, or ensure the dataset rows carry gym_servers_config.");
|
|
214
|
-
await probeServers(servers, DEFAULT_DOMAIN);
|
|
215
|
-
},
|
|
216
|
-
async loadTasks(opts = {}) {
|
|
217
|
-
const domain = opts.split ?? DEFAULT_DOMAIN;
|
|
218
|
-
if (fixturesMode) return loadFixtures(mode, opts);
|
|
219
|
-
let rows;
|
|
220
|
-
try {
|
|
221
|
-
rows = await fetchRows(mode, domain, opts);
|
|
222
|
-
} catch (err) {
|
|
223
|
-
console.warn(`[enterpriseops-gym] live rows fetch failed (${err instanceof Error ? err.message : err}); falling back to committed sample at ${FIXTURES}`);
|
|
224
|
-
return loadFixtures(mode, opts);
|
|
225
|
-
}
|
|
226
|
-
return selectRows(rows, mode, opts);
|
|
227
|
-
},
|
|
228
|
-
async goldArtifact() {},
|
|
229
|
-
async judge(task, artifact) {
|
|
230
|
-
return runJudge(readMeta(task), artifact);
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
export { createEnterpriseOpsGymAdapter, enterpriseOpsTranscriptOutput };
|
|
235
|
-
|
|
236
|
-
//# sourceMappingURL=enterpriseops-gym.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enterpriseops-gym.js","names":[],"sources":["../../src/benchmarks/enterpriseops-gym.ts"],"sourcesContent":["/**\n * EnterpriseOps-Gym adapter (ServiceNow-AI/EnterpriseOps-Gym, Apache-2.0) —\n * stateful agentic planning + tool use in enterprise settings. Each record is an\n * enterprise-ops task (Customer Service, HR, ITSM, Calendar, Email, Drive, Teams,\n * Hybrid) handed to the agent with a domain `system_prompt`, a `selected_tools`\n * allow-list, and one or more containerized gym MCP servers (`gym_servers_config`).\n * Worker artifact = the ordered tool-call transcript the agent would issue against\n * those servers, emitted as a single fenced ```json block of\n * `{ \"calls\": [ { \"tool\": ..., \"arguments\": {...}, \"gym_name\"?: ... } ] }`.\n *\n * Judge = the benchmark's OWN deterministic state-checker. The driver replays the\n * transcript against a freshly-seeded gym server (mutating its database), then runs\n * each task's `database_state` verifier — an SQL SELECT executed via the gym\n * server's /api/sql-runner endpoint, compared to `expected_value` under\n * `comparison_type` (equals/greater_than/less_than/contains). GRADED: score =\n * (verifiers passing) / (total verifiers) = the bench's verifier_level_pass_rate;\n * binary `resolved` = ALL verifiers pass = the bench's overall_success_rate. Fully\n * deterministic — no LLM judge.\n *\n * loadTasks enumerates the real suite from the HF rows server (config = tool-set\n * MODE oracle|plus_5_tools|plus_10_tools|plus_15_tools; split = DOMAIN); a committed\n * sample (bench/fixtures/enterpriseops-gym.json) loads offline.\n *\n * Requires for a LIVE judge run: a Docker daemon with the domain gym images\n * (`docker pull shivakrishnareddyma225/enterpriseops-gym-mcp-<domain>:latest`) up\n * on the ports in `gym_servers_config`, seeded from gym_dbs.zip. preflight + judge\n * fail loud with the exact pull/run/unzip step when a server is unreachable — never\n * a fabricated score. No portable gold artifact ships, so goldArtifact is undefined.\n */\n\nimport { mkdir, readFile, rm, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'\nimport { benchRoot, runVenvScriptStdin } from './_harness'\nimport type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'\n\nconst FIXTURES = join(benchRoot, 'fixtures', 'enterpriseops-gym.json')\nconst JUDGE = join(benchRoot, 'scripts', 'enterpriseops_gym_judge.py')\n\n/** Monotonic discriminator so concurrent judge calls stage distinct task-cache files. */\nlet judgeCallSeq = 0\n\nconst DATASET = 'ServiceNow-AI/EnterpriseOps-Gym'\n/** Tool-set mode = HF config; oracle ships exact tools, plus_N adds N distractors. */\nconst DEFAULT_MODE = 'oracle'\n/** Domain = HF split. */\nconst DEFAULT_DOMAIN = 'itsm'\n\nconst rowsApi = (mode: string, domain: string) =>\n `https://datasets-server.huggingface.co/rows?dataset=${encodeURIComponent(DATASET)}&config=${encodeURIComponent(mode)}&split=${encodeURIComponent(domain)}`\n\ninterface GymServerConfig {\n mcp_server_name: string\n mcp_server_url: string\n seed_database_file: string\n context?: Record<string, string>\n user_info?: Record<string, unknown>\n}\n\ninterface Verifier {\n verifier_type: string\n name: string\n description?: string\n gym_name: string\n validation_config: { query: string; expected_value: unknown; comparison_type: string }\n}\n\ninterface EopsRow {\n task_id: string\n domain: string\n system_prompt: string\n user_prompt: string\n selected_tools: string[]\n restricted_tools: string[]\n mcp_endpoint: string\n number_of_runs: number\n reset_database_between_runs: boolean\n /** HF parquet stores these as JSON strings; fixtures store them as parsed arrays. */\n gym_servers_config: string | GymServerConfig[]\n verifiers: string | Verifier[]\n}\n\ninterface EopsMeta {\n taskId: string\n domain: string\n mode: string\n selectedTools: string[]\n servers: GymServerConfig[]\n verifiers: Verifier[]\n}\n\n/** Worker transcript = the last fenced ```json block, else the raw text. */\nexport const enterpriseOpsTranscriptOutput: 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(/```(?:json)?\\s*\\n([\\s\\S]*?)```/g)]\n return (fences.at(-1)?.[1] ?? text).trim()\n },\n}\n\nfunction asArray<T>(v: string | T[]): T[] {\n return typeof v === 'string' ? (JSON.parse(v) as T[]) : v\n}\n\nfunction workerContract(tools: string[]): string {\n return [\n '',\n `You have exactly these tools available (call NO others): ${tools.join(', ')}.`,\n 'Plan the full sequence of tool calls that brings the enterprise database to the required final state, honoring every policy in the role above.',\n 'Emit your COMPLETE plan as the LAST thing in your reply, in a single fenced ```json block, as an object:',\n '{ \"calls\": [ { \"tool\": \"<tool_name>\", \"arguments\": { ... } } ] }',\n 'Include one entry per tool call in execution order. Nothing after the closing fence.',\n ].join('\\n')\n}\n\nfunction rowToTask(row: EopsRow, mode: string): BenchTask {\n const servers = asArray<GymServerConfig>(row.gym_servers_config)\n const verifiers = asArray<Verifier>(row.verifiers)\n const meta: EopsMeta = {\n taskId: row.task_id,\n domain: row.domain,\n mode,\n selectedTools: row.selected_tools,\n servers,\n verifiers,\n }\n return {\n id: row.task_id,\n split: row.domain,\n prompt: [row.system_prompt, '', row.user_prompt, workerContract(row.selected_tools)].join('\\n'),\n metadata: meta as unknown as Record<string, unknown>,\n }\n}\n\nfunction readMeta(task: BenchTask): EopsMeta {\n const md = task.metadata\n if (\n !md ||\n typeof md.taskId !== 'string' ||\n !Array.isArray(md.servers) ||\n !Array.isArray(md.verifiers) ||\n (md.verifiers as unknown[]).length === 0\n ) {\n throw new Error(`enterpriseops-gym task ${task.id} missing metadata — loadTasks did not populate it`)\n }\n return md as unknown as EopsMeta\n}\n\nfunction selectRows(rows: EopsRow[], mode: string, opts: LoadOptions): BenchTask[] {\n let tasks = rows.map((r) => rowToTask(r, mode))\n if (opts.ids) {\n const want = new Set(opts.ids)\n tasks = tasks.filter((t) => want.has(t.id))\n } else if (opts.limit !== undefined) {\n tasks = tasks.slice(0, opts.limit)\n }\n return tasks\n}\n\nasync function loadFixtures(mode: string, opts: LoadOptions): Promise<BenchTask[]> {\n const rows = JSON.parse(await readFile(FIXTURES, 'utf8')) as EopsRow[]\n console.warn(\n `[enterpriseops-gym] EOPS_FIXTURES=1 — loading ${rows.length} committed sample rows from ${FIXTURES} (no HF fetch)`,\n )\n const domain = opts.split\n const scoped = domain ? rows.filter((r) => r.domain === domain) : rows\n return selectRows(scoped, mode, opts)\n}\n\n/** Pull real rows from the HF rows server (paged) for one mode/domain. Throws loud on a non-OK response. */\nasync function fetchRows(mode: string, domain: string, opts: LoadOptions): Promise<EopsRow[]> {\n const target = opts.ids ? opts.ids.length * 4 : (opts.limit ?? 16)\n const rows: EopsRow[] = []\n const want = opts.ids ? new Set(opts.ids) : null\n const page = 100\n const base = rowsApi(mode, domain)\n for (let offset = 0; offset < 1024 && rows.length < target; offset += page) {\n const res = await fetch(`${base}&offset=${offset}&length=${page}`)\n if (!res.ok) {\n throw new Error(`enterpriseops-gym rows HTTP ${res.status} (offset ${offset}): ${(await res.text()).slice(0, 200)}`)\n }\n const body = (await res.json()) as { rows?: Array<{ row: EopsRow }> }\n const got = body.rows ?? []\n if (got.length === 0) break\n for (const r of got) {\n if (want && !want.has(r.row.task_id)) continue\n rows.push(r.row)\n }\n if (got.length < page) break\n }\n if (rows.length === 0) throw new Error(`enterpriseops-gym: no rows matched ${JSON.stringify(opts)} for ${mode}/${domain}`)\n return rows\n}\n\n/**\n * Run the benchmark's own state-checker for one task over the worker's transcript.\n * The driver replays the tool calls against the live gym server, runs each\n * database_state verifier's SQL via /api/sql-runner, and reports {passes,total}.\n * Score = passes/total (verifier_level_pass_rate); resolved = all pass\n * (overall_success_rate). This is the expensive Docker-backed boundary — delegated\n * to the python driver, not reimplemented. The transcript is piped on stdin via the\n * shared stdin-aware runner (execFile's `input` is not honored async and hangs the\n * reader).\n */\nasync function runJudge(meta: EopsMeta, artifact: string): Promise<BenchScore> {\n // Stage the full task record (servers + verifiers) so the driver has the live\n // server URLs/contexts and the SQL it must run. The path is UNIQUE per call: the gate\n // runs k judges for one task concurrently, so a `${taskId}.json` shared path would race.\n const taskJsonPath = join(\n benchRoot,\n '.eops-task-cache',\n `${meta.taskId}-${process.pid}-${judgeCallSeq++}.json`,\n )\n await writeTaskCache(taskJsonPath, meta)\n let stdout: string\n try {\n stdout = await runVenvScriptStdin(JUDGE, ['judge', '--task-json', taskJsonPath], artifact, { cwd: benchRoot })\n } catch (err) {\n const e = err as { message?: string }\n throw new Error(\n `enterpriseops-gym judge failed for ${meta.taskId}: ${(e.message || String(err)).slice(0, 1500)}\\n` +\n `Fix: (1) run the ${meta.domain} gym server — ` +\n `docker pull shivakrishnareddyma225/enterpriseops-gym-mcp-${meta.domain}:latest ; ` +\n `docker run -d -p <host>:8005 shivakrishnareddyma225/enterpriseops-gym-mcp-${meta.domain}:latest ; ` +\n `(2) unzip gym_dbs.zip (ServiceNow/EnterpriseOps-Gym) and export EOPS_GYM_DBS_DIR to its dir ` +\n `(the judge seeds each task's database from seed_database_file).`,\n )\n } finally {\n await rm(taskJsonPath, { force: true }).catch(() => {})\n }\n const report = JSON.parse(stdout.trim().split('\\n').at(-1) ?? '{}') as {\n success?: boolean\n passes?: number\n total?: number\n error?: string\n }\n if (report.error) throw new Error(`enterpriseops-gym judge error for ${meta.taskId}: ${report.error}`)\n if (typeof report.passes !== 'number' || typeof report.total !== 'number') {\n throw new Error(`enterpriseops-gym judge returned no {passes,total}: ${stdout.slice(0, 400)}`)\n }\n const score = report.total > 0 ? report.passes / report.total : 0\n return {\n resolved: report.success === true && report.total > 0 && report.passes === report.total,\n score,\n detail: JSON.stringify({ taskId: meta.taskId, domain: meta.domain, passes: report.passes, total: report.total }),\n }\n}\n\nasync function writeTaskCache(path: string, meta: EopsMeta): Promise<void> {\n await mkdir(join(path, '..'), { recursive: true })\n await writeFile(\n path,\n JSON.stringify({ task_id: meta.taskId, domain: meta.domain, gym_servers_config: meta.servers, verifiers: meta.verifiers }),\n )\n}\n\n/** Ping the configured gym servers' SQL endpoint; throw loud with the docker fix if any is unreachable. */\nasync function probeServers(servers: GymServerConfig[], domain: string): Promise<void> {\n for (const s of servers) {\n const url = `${s.mcp_server_url.replace(/\\/$/, '')}/api/sql-runner`\n try {\n // A HEAD/empty POST just proves reachability; a real query runs in judge.\n const res = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' })\n // Any HTTP response (even an error status) proves the server is up. Only a\n // transport failure (refused/ENOTFOUND) means the container is not running.\n void res.status\n } catch (err) {\n throw new Error(\n `enterpriseops-gym preflight: ${s.mcp_server_name} unreachable at ${url}: ${err instanceof Error ? err.message : err}\\n` +\n `Fix: docker pull shivakrishnareddyma225/enterpriseops-gym-mcp-${domain}:latest ; ` +\n `docker run -d -p <port>:<port> shivakrishnareddyma225/enterpriseops-gym-mcp-${domain}:latest ; ` +\n `seed from gym_dbs.zip. Set EOPS_FIXTURES=1 to load sample tasks offline (judge still needs a live server).`,\n )\n }\n }\n}\n\nexport function createEnterpriseOpsGymAdapter(): BenchmarkAdapter {\n const fixturesMode = process.env.EOPS_FIXTURES === '1'\n const mode = process.env.EOPS_MODE ?? DEFAULT_MODE\n\n return {\n name: 'enterpriseops-gym',\n output: enterpriseOpsTranscriptOutput,\n\n async preflight() {\n // Fixtures mode proves only that the sample file is readable; a live judge\n // still requires running gym servers (and fails loud there if absent).\n if (fixturesMode) {\n await readFile(FIXTURES, 'utf8').catch((err) => {\n throw new Error(`EOPS_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)\n })\n return\n }\n // Live mode: probe the gym servers for the default domain (the suite's tasks\n // each carry their own server config; preflight verifies reachability up\n // front so a batch fails fast with the docker fix rather than mid-run).\n const sample = await loadFixtures(mode, { split: DEFAULT_DOMAIN, limit: 1 }).catch(() => [])\n const servers = sample[0] ? readMeta(sample[0]).servers : []\n if (servers.length === 0) {\n throw new Error(\n `enterpriseops-gym preflight: no gym_servers_config to probe. ` +\n `Set EOPS_FIXTURES=1 to load offline, or ensure the dataset rows carry gym_servers_config.`,\n )\n }\n await probeServers(servers, DEFAULT_DOMAIN)\n },\n\n async loadTasks(opts: LoadOptions = {}) {\n const domain = opts.split ?? DEFAULT_DOMAIN\n if (fixturesMode) return loadFixtures(mode, opts)\n let rows: EopsRow[]\n try {\n rows = await fetchRows(mode, domain, opts)\n } catch (err) {\n console.warn(\n `[enterpriseops-gym] live rows fetch failed (${err instanceof Error ? err.message : err}); falling back to committed sample at ${FIXTURES}`,\n )\n return loadFixtures(mode, opts)\n }\n return selectRows(rows, mode, opts)\n },\n\n async goldArtifact() {\n // The benchmark ships no portable per-task oracle transcript — the reference\n // is the seeded final DB state the verifiers check, not a tool-call script.\n // Judge correctness is proven by replaying a real solve against the live gym\n // server, not by a synthetic gold transcript. Returns undefined (documented,\n // not faked).\n return undefined\n },\n\n async judge(task: BenchTask, artifact: string): Promise<Ben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D;CAChE,MAAM,eAAe,QAAQ,IAAI,kBAAkB;CACnD,MAAM,OAAO,QAAQ,IAAI,aAAa;CAEtC,OAAO;EACL,MAAM;EACN,QAAQ;EAER,MAAM,YAAY;GAGhB,IAAI,cAAc;IAChB,MAAM,SAAS,UAAU,MAAM,CAAC,CAAC,OAAO,QAAQ;KAC9C,MAAM,IAAI,MAAM,uBAAuB,SAAS,eAAe,eAAe,QAAQ,IAAI,UAAU,KAAK;IAC3G,CAAC;IACD;GACF;GAIA,MAAM,SAAS,MAAM,aAAa,MAAM;IAAE,OAAO;IAAgB,OAAO;GAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;GAC3F,MAAM,UAAU,OAAO,KAAK,SAAS,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC;GAC3D,IAAI,QAAQ,WAAW,GACrB,MAAM,IAAI,MACR,wJAEF;GAEF,MAAM,aAAa,SAAS,cAAc;EAC5C;EAEA,MAAM,UAAU,OAAoB,CAAC,GAAG;GACtC,MAAM,SAAS,KAAK,SAAS;GAC7B,IAAI,cAAc,OAAO,aAAa,MAAM,IAAI;GAChD,IAAI;GACJ,IAAI;IACF,OAAO,MAAM,UAAU,MAAM,QAAQ,IAAI;GAC3C,SAAS,KAAK;IACZ,QAAQ,KACN,+CAA+C,eAAe,QAAQ,IAAI,UAAU,IAAI,yCAAyC,UACnI;IACA,OAAO,aAAa,MAAM,IAAI;GAChC;GACA,OAAO,WAAW,MAAM,MAAM,IAAI;EACpC;EAEA,MAAM,eAAe,CAOrB;EAEA,MAAM,MAAM,MAAiB,UAAuC;GAElE,OAAO,SADM,SAAS,IACH,GAAG,QAAQ;EAChC;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cadbench-DhAndllg.js","names":[],"sources":["../src/worker-blender.ts","../src/benchmarks/cadbench.ts"],"sourcesContent":["/**\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 { runBenchRouterTurn } from './router-turn'\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\ninterface 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\ninterface 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 * 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'\nimport { runBenchRouterTurn } from '../router-turn'\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 turn = await runBenchRouterTurn(\n {\n routerBaseUrl: base,\n routerKey: key,\n profile: {\n name: 'cadbench-vision-judge',\n harness: 'cli-base',\n model: {\n provider: 'tangle-router',\n default: model,\n metadata: {\n temperature: 0,\n maxTokens: Number(process.env.JUDGE_MAX_TOKENS ?? 1500),\n },\n },\n },\n },\n { messages: [{ role: 'user', content }] },\n )\n const raw = turn.finalText\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"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAM,gBAAgB,UAAU,QAAQ;AAExC,eAAe,SAAS,KAAa,MAAgB,KAAa,YAAY,MAAoE;CAChJ,IAAI;EACF,MAAM,EAAE,QAAQ,WAAW,MAAM,cAAc,KAAK,MAAM;GAAE;GAAK,WAAW,KAAK;GAAI,SAAS;EAAU,CAAC;EACzG,OAAO;GAAE,MAAM;GAAG;GAAQ;EAAO;CACnC,SAAS,KAAK;EACZ,MAAM,IAAI;EACV,OAAO;GAAE,MAAM,OAAO,EAAE,SAAS,WAAW,EAAE,OAAO;GAAG,QAAQ,EAAE,UAAU;GAAI,Q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I,OAAO,MAAM,KAAK;GACtB,IAAI,KAAK,KAAK,OAAO,KAAK,QAAQ,MAAM,KAAK,IAAK,SAAS,EAAE,EAAE,CAAC;GAEhE,MAAM,IAAI,QAAQ,IAAI;GACtB,IAAI,GAAG,OAAO,KAAK,QAAQ,MAAM,EAAE,KAAK,KAAK,YAAY,MAAM,EAAE,YAAY,CAAC;GAC9E,IAAI,KAAK,SAAS,MAAM,OAAO,KAAK,MAAM,GAAG,KAAK,KAAK;GACvD,OAAO,KAAK,KAAK,OAAkB;IAAE,IAAI,EAAE;IAAI,QAAQ,EAAE;IAAa,UAAU,EAAE;GAA2C,EAAE;EACjI;EAEA,MAAM,eAAe,CAErB;EAEA,MAAM,MAAM,MAAiB,UAAuC;GAElE,MAAM,WADO,KAAK,SACI,YAAY,CAAC;GACnC,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO;IAAE,UAAU;IAAO,OAAO;IAAG,QAAQ;GAAiB;GACnF,IAAI,SAAS,WAAW,GAAG,OAAO;IAAE,UAAU;IAAO,OAAO;IAAG,QAAQ;GAAuB;GAC9F,MAAM,IAAI,MAAM,UAAU,UAAU,EAAE,OAAO,EAAE,CAAC;GAChD,IAAI,CAAC,EAAE,OAAO,OAAO;IAAE,UAAU;IAAO,OAAO;IAAG,QAAQ,yBAAyB,EAAE,SAAS;GAAY;GAC1G,MAAM,EAAE,QAAQ,SAAS,MAAM,cAAc,KAAK,QAAQ,UAAU,UAAU,EAAE,OAAO;GACvF,MAAM,QAAQ,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,SAAS;GACvD,OAAO;IAAE,UAAU,UAAU;IAAG;IAAO,QAAQ;GAAK;EACtD;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cadgenbench-Tvk16YKT.js","names":[],"sources":["../src/worker-build123d.ts","../src/benchmarks/cadgenbench.ts"],"sourcesContent":["/**\n * CADGenBench worker. The deliverable is a STEP B-rep solid (output.step). We\n * author a build123d (Python on the OpenCascade kernel) script via the router,\n * execute it in the CADGenBench venv, and read back the produced output.step —\n * exactly the reference baseline's contract. The artifact returned IS the STEP\n * text, which the CADGenBench geometric scorer grades against the ground truth.\n *\n * The build123d authoring directive is the GEPA-optimizable surface; the\n * build123d API cheat sheet (shipped in the cadgenbench package) is appended as\n * fixed reference context. Requires the CADGenBench venv (CADGENBENCH_VENV) +\n * its clone (CADGENBENCH_DIR for the cheat sheet).\n */\n\nimport { execFile } from 'node:child_process'\nimport { existsSync, readFileSync } from 'node:fs'\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_BUILD123D_DIRECTIVE } from './directives'\nimport { runRefineLoop } from './refine-loop'\nimport { runBenchRouterTurn } from './router-turn'\n\nconst execFileAsync = promisify(execFile)\n\nexport const CGB_VENV_PY = process.env.CADGENBENCH_VENV ?? '/tmp/cgb-venv/bin/python'\nexport const CGB_DIR = process.env.CADGENBENCH_DIR ?? '/tmp/cadgenbench'\n\nasync function runLocal(cmd: string, args: string[], cwd: string, timeoutMs = 120_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\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\nlet _cheat: string | null = null\nfunction cheatSheet(): string {\n if (_cheat != null) return _cheat\n const p = join(CGB_DIR, 'src/cadgenbench/baseline/build123d_cheat_sheet.md')\n _cheat = existsSync(p) ? readFileSync(p, 'utf8').slice(0, 12000) : ''\n return _cheat\n}\n\ninterface Build123dConfig {\n routerBaseUrl: string\n routerKey: string\n model: string\n rounds?: number\n /** The build123d authoring directive — the GEPA-optimizable surface. */\n directive?: string\n}\n\ninterface Build123dShot {\n /** The produced STEP text (the artifact the CADGenBench scorer grades). */\n artifact: string\n /** The Python source the agent wrote. */\n source: string\n trace: Span[]\n usage: { input: number; output: number }\n ok: boolean\n built: boolean\n detail?: string\n}\n","/**\n * CADGenBench adapter (huggingface/cadgenbench, Apache-2.0). Task = a part\n * description → a STEP B-rep solid (output.step). Score = the benchmark's OWN\n * deterministic geometric metric (cad_score): validity gate → PCA/ICP align to\n * the ground truth → point-cloud F1 + volume IoU + edge F1 + topology match.\n * NOT an LLM judge, NOT self-defined checks — the published CAD kernel decides.\n *\n * The official task set (private GT, server-side graded) isn't released yet, so\n * tasks here are seeded from the repo's dimension-named geometry fixtures (real\n * GT STEPs scored by the real scorer). When CADGENBENCH_DATA_DIR is set, swap\n * loadTasks to read the published fixtures' description.yaml + ground_truth.step.\n *\n * Requires the CADGenBench venv (CADGENBENCH_VENV) + clone (CADGENBENCH_DIR) +\n * xvfb (the scorer's alignment renders need a display).\n */\n\nimport { execFile } from 'node:child_process'\nimport { mkdtemp, rm, writeFile } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport { promisify } from 'node:util'\nimport type { BenchScore, BenchTask, BenchmarkAdapter, LoadOptions } from './types'\nimport { CGB_DIR, CGB_VENV_PY } from '../worker-build123d'\n\nconst execFileAsync = promisify(execFile)\n\n/** Self-contained scorer wrapper (written to a temp file, run in the venv).\n * Scores a candidate STEP against a ground-truth STEP via the benchmark's own\n * evaluate_result, printing the cad_score line. */\nconst SCORE_PY = `\nimport sys, json, tempfile, shutil\nfrom pathlib import Path\nfrom cadgenbench.eval.evaluate import evaluate_result\ncand, gt = Path(sys.argv[1]), Path(sys.argv[2])\nwith tempfile.TemporaryDirectory() as rd, tempfile.TemporaryDirectory() as gd:\n rd, gd = Path(rd), Path(gd)\n (rd / 'result.json').write_text('{}')\n shutil.copy(gt, gd / 'ground_truth.step')\n try:\n evaluate_result(rd, gd, candidate_step=cand)\n d = json.loads((rd / 'result.json').read_text())\n print('CGB_SCORE ' + json.dumps({'cad_score': d.get('cad_score', 0.0), 'status': d.get('status', 'unknown')}))\n except Exception as e:\n print('CGB_SCORE ' + json.dumps({'cad_score': 0.0, 'status': 'error', 'error': str(e)[:200]}))\n`.trim()\n\ninterface CgbMeta {\n gtStep: string\n resolveThreshold: number\n}\n\n/** Fixture-seeded tasks (real GT STEPs from the repo, dim-named so the spec is\n * exact). Replaced by the published dataset when CADGENBENCH_DATA_DIR is set. */\nfunction fixtureTasks(): Array<{ id: string; prompt: string; gtStep: string }> {\n const g = join(CGB_DIR, 'tests/fixtures/geometry')\n return [\n { id: 'box-10x20x30', prompt: 'A rectangular solid box, 10 units wide (X), 20 units deep (Y), and 30 units tall (Z).', gtStep: join(g, 'box_10_20_30.step') },\n { id: 'cube-10', prompt: 'A cube, 10 units on every side.', gtStep: join(g, 'box_10_10_10.step') },\n { id: 'sphere-10', prompt: 'A sphere of radius 10 units, centered at the origin.', gtStep: join(g, 'sphere_10.step') },\n ]\n}\n\nexport function createCadGenBenchAdapter(): BenchmarkAdapter {\n return {\n name: 'cadgenbench',\n\n async preflight() {\n const r = await execFileAsync(CGB_VENV_PY, ['-c', 'import cadgenbench.eval.evaluate, build123d, trimesh, manifold3d; print(\"ok\")'], { timeout: 60_000 }).catch(\n (e) => ({ stdout: '', stderr: e instanceof Error ? e.message : String(e) }),\n )\n if (!/ok/.test(r.stdout)) {\n throw new Error(\n `cadgenbench preflight failed (venv=${CGB_VENV_PY}): ${r.stderr.slice(0, 200)}\\n` +\n `Fix: git clone https://github.com/huggingface/cadgenbench ${CGB_DIR}; python3 -m venv $CADGENBENCH_VENV; $CADGENBENCH_VENV/bin/pip install -e ${CGB_DIR}`,\n )\n }\n },\n\n async loadTasks(opts: LoadOptions = {}) {\n // CGB_HARD_DIR (a dir with tasks.json = [{id,prompt,gtStep}]) overrides the\n // trivial fixture primitives with hard multi-feature parts (real headroom).\n let tasks = fixtureTasks()\n const hard = process.env.CGB_HARD_DIR\n if (hard) {\n const { readFile } = await import('node:fs/promises')\n tasks = JSON.parse(await readFile(join(hard, 'tasks.json'), 'utf8')) as Array<{ id: string; prompt: string; gtStep: string }>\n }\n if (opts.ids) tasks = tasks.filter((t) => opts.ids!.includes(t.id))\n if (opts.limit != null) tasks = tasks.slice(0, opts.limit)\n const meta = (gtStep: string): CgbMeta => ({ gtStep, resolveThreshold: Number(process.env.CGB_RESOLVE_THRESHOLD ?? 0.9) })\n return tasks.map((t): BenchTask => ({ id: t.id, prompt: t.prompt, metadata: meta(t.gtStep) as unknown as Record<string, unknown> }))\n },\n\n async goldArtifact() {\n return undefined // GT is a STEP file scored by the kernel, not a returnable artifact\n },\n\n async judge(task: BenchTask, artifact: string): Promise<BenchScore> {\n const { gtStep, resolveThreshold } = task.metadata as unknown as CgbMeta\n if (!artifact.includes('ISO-10303-21')) return { resolved: false, score: 0, detail: 'artifact is not a STEP file' }\n const dir = await mkdtemp(join(tmpdir(), 'cgb-judge-'))\n const cand = join(dir, 'candidate.step')\n const scorer = join(dir, 'score.py')\n try {\n await writeFile(cand, artifact)\n await writeFile(scorer, SCORE_PY)\n // xvfb: the scorer's alignment step renders; needs a display.\n const r = await execFileAsync('xvfb-run', ['-a', CGB_VENV_PY, scorer, cand, gtStep], { maxBuffer: 1 << 26, timeout: 180_000 }).catch(\n (e) => ({ stdout: (e as { stdout?: string }).stdout ?? '', stderr: e instanceof Error ? e.message : String(e) }),\n )\n const m = /CGB_SCORE (\\{.*\\})/.exec(r.stdout)\n if (!m) return { resolved: false, score: 0, detail: `scorer produced no verdict: ${(r.stderr || r.stdout).slice(0, 160)}` }\n const v = JSON.parse(m[1]) as { cad_score: number; status: string; error?: string }\n const score = typeof v.cad_score === 'number' ? v.cad_score : 0\n return { resolved: score >= resolveThreshold, score, detail: `cad_score=${score.toFixed(3)} status=${v.status}${v.error ? ` (${v.error})` : ''}` }\n } finally {\n await rm(dir, { recursive: true, force: true }).catch(() => {})\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBsB,UAAU,QAAQ;AAExC,MAAa,cAAc,QAAQ,IAAI,oBAAoB;AAC3D,MAAa,UAAU,QAAQ,IAAI,mBAAmB;;;;;;;;;;;;;;;;;ACJtD,MAAM,gBAAgB,UAAU,QAAQ;;;;AAKxC,MAAM,WAAW;;;;;;;;;;;;;;;EAef,KAAK;;;AASP,SAAS,eAAsE;CAC7E,MAAM,IAAI,KAAK,SAAS,yBAAyB;CACjD,OAAO;EACL;GAAE,IAAI;GAAgB,QAAQ;GAAyF,QAAQ,KAAK,GAAG,mBAAmB;EAAE;EAC5J;GAAE,IAAI;GAAW,QAAQ;GAAmC,QAAQ,KAAK,GAAG,mBAAmB;EAAE;EACjG;GAAE,IAAI;GAAa,QAAQ;GAAwD,QAAQ,KAAK,GAAG,gBAAgB;EAAE;CACvH;AACF;AAEA,SAAgB,2BAA6C;CAC3D,OAAO;EACL,MAAM;EAEN,MAAM,YAAY;GAChB,MAAM,IAAI,MAAM,cAAc,aAAa,CAAC,MAAM,iFAA+E,GAAG,EAAE,SAAS,IAAO,CAAC,CAAC,CAAC,OACtJ,OAAO;IAAE,QAAQ;IAAI,QAAQ,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;GAAE,EAC3E;GACA,IAAI,CAAC,KAAK,KAAK,EAAE,MAAM,GACrB,MAAM,IAAI,MACR,sCAAsC,YAAY,KAAK,EAAE,OAAO,MAAM,GAAG,GAAG,EAAE,8DACf,QAAQ,4EAA4E,SACrJ;EAEJ;EAEA,MAAM,UAAU,OAAoB,CAAC,GAAG;GAGtC,IAAI,QAAQ,aAAa;GACzB,MAAM,OAAO,QAAQ,IAAI;GACzB,IAAI,MAAM;IACR,MAAM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AU,EAAE,OAAA,CAAQ,MAAM,GAAG,GAAG;IAAI;IAC1H,MAAM,IAAI,KAAK,MAAM,EAAE,EAAE;IACzB,MAAM,QAAQ,OAAO,EAAE,cAAc,WAAW,EAAE,YAAY;IAC9D,OAAO;KAAE,UAAU,SAAS;KAAkB;KAAO,QAAQ,aAAa,MAAM,QAAQ,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,KAAK,EAAE,MAAM,KAAK;IAAK;GACnJ,UAAU;IACR,MAAM,GAAG,KAAK;KAAE,WAAW;KAAM,OAAO;IAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;GAChE;EACF;CACF;AACF"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"task_id": "task_20251212_172511_458_e6427839_47076c15",
|
|
4
|
-
"domain": "itsm",
|
|
5
|
-
"system_prompt": "# ITSM Assistant Policy\n\nRole: ITSM Assistant (IT Service Management). Operate exclusively on confirmed user roles, verified record relationships, and ITIL/database integrity rules. Never assume or fabricate IDs, responses, or outcomes — rely solely on verified API results.",
|
|
6
|
-
"user_prompt": "An update came in from the caller regarding the printer connectivity issue for incident INC0000003. The user stated that several urgent client documents are still pending, and the inability to print is causing significant delays. Although the submission deadline has been extended by one business day, the service impact remains significant. Therefore increase the impact of the incident to high and update the necessary details.",
|
|
7
|
-
"selected_tools": [
|
|
8
|
-
"find_sla_definitions",
|
|
9
|
-
"find_incident_slas",
|
|
10
|
-
"find_incident_by_number",
|
|
11
|
-
"get_user",
|
|
12
|
-
"update_incident",
|
|
13
|
-
"link_new_incident_sla"
|
|
14
|
-
],
|
|
15
|
-
"restricted_tools": [],
|
|
16
|
-
"mcp_endpoint": "/mcp",
|
|
17
|
-
"number_of_runs": 1,
|
|
18
|
-
"reset_database_between_runs": true,
|
|
19
|
-
"gym_servers_config": [
|
|
20
|
-
{
|
|
21
|
-
"mcp_server_name": "gym-itsm-mcp",
|
|
22
|
-
"mcp_server_url": "http://localhost:8006",
|
|
23
|
-
"seed_database_file": "Domain Wise DBs and Task-DB Mappings/itsm/dbs/db_1765301900121_3mwjj54xy.sql",
|
|
24
|
-
"context": {
|
|
25
|
-
"x-itsm-user-token": "admin_token_marcus_2024_secure"
|
|
26
|
-
},
|
|
27
|
-
"user_info": {
|
|
28
|
-
"user_id": "USER_001",
|
|
29
|
-
"name": "Marcus Thompson",
|
|
30
|
-
"email": "marcus.thompson@techcorp.com"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"verifiers": [
|
|
35
|
-
{
|
|
36
|
-
"verifier_type": "database_state",
|
|
37
|
-
"name": "Verify if the priority of the incident is set correctly.",
|
|
38
|
-
"description": "Verify if the priority of the incident is set correctly.",
|
|
39
|
-
"gym_name": "gym-itsm-mcp",
|
|
40
|
-
"validation_config": {
|
|
41
|
-
"query": "SELECT COUNT(*) FROM incident WHERE incident_id = 'INC_003' AND impact = 'high' AND priority = 'high';",
|
|
42
|
-
"expected_value": 1,
|
|
43
|
-
"comparison_type": "equals"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"verifier_type": "database_state",
|
|
48
|
-
"name": "Verify if the correct high-priority SLA is linked to the incident.",
|
|
49
|
-
"description": "Verify if the correct high-priority SLA is linked to the incident.",
|
|
50
|
-
"gym_name": "gym-itsm-mcp",
|
|
51
|
-
"validation_config": {
|
|
52
|
-
"query": "SELECT COUNT(*) FROM incident_sla WHERE incident_id = 'INC_003' AND sla_def_id = 'SLA_002';",
|
|
53
|
-
"expected_value": 1,
|
|
54
|
-
"comparison_type": "equals"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"task_id": "task_20251117_165528_648_bca89e7d_3e81ece9",
|
|
61
|
-
"domain": "calendar",
|
|
62
|
-
"system_prompt": "# Calendar Assistant Policy\n\nRole: Calendar Assistant. Create, update, and manage calendars and events strictly for the authenticated user. Never operate on calendars outside the user's access scope.",
|
|
63
|
-
"user_prompt": "Create a secondary (non-primary) calendar named 'Search Algorithm Beta' for bob_developer so the team can track the beta milestones separately from the main work calendar.",
|
|
64
|
-
"selected_tools": [
|
|
65
|
-
"list_calendars",
|
|
66
|
-
"create_calendar",
|
|
67
|
-
"get_calendar",
|
|
68
|
-
"list_events"
|
|
69
|
-
],
|
|
70
|
-
"restricted_tools": [],
|
|
71
|
-
"mcp_endpoint": "/mcp",
|
|
72
|
-
"number_of_runs": 1,
|
|
73
|
-
"reset_database_between_runs": true,
|
|
74
|
-
"gym_servers_config": [
|
|
75
|
-
{
|
|
76
|
-
"mcp_server_name": "gym-calendar",
|
|
77
|
-
"mcp_server_url": "http://localhost:8003",
|
|
78
|
-
"seed_database_file": "Domain Wise DBs and Task-DB Mappings/calendar/dbs/db_1762868439331_kf914hbmw.sql",
|
|
79
|
-
"context": {
|
|
80
|
-
"x-access-token": "bob_developer_calendar_token"
|
|
81
|
-
},
|
|
82
|
-
"user_info": {
|
|
83
|
-
"user_id": "bob_developer",
|
|
84
|
-
"name": "Bob Developer",
|
|
85
|
-
"email": "bob.developer@techcorp.com"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"verifiers": [
|
|
90
|
-
{
|
|
91
|
-
"verifier_type": "database_state",
|
|
92
|
-
"name": "Calendar Creation",
|
|
93
|
-
"description": "Verify secondary calendar created",
|
|
94
|
-
"gym_name": "gym-calendar",
|
|
95
|
-
"validation_config": {
|
|
96
|
-
"query": "SELECT COUNT(*) AS count FROM calendars WHERE summary = 'Search Algorithm Beta' AND is_primary = 0 AND user_id = 'bob_developer';",
|
|
97
|
-
"expected_value": 1,
|
|
98
|
-
"comparison_type": "equals"
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
]
|