@tangle-network/agent-bench 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +24 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +62 -51
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +46 -38
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +61 -56
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/src/adapters.ts +5 -7
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +34 -32
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +78 -73
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +57 -52
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-Byr5gO1M.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../src/published.ts","../src/cli.ts"],"sourcesContent":["/**\n * Published benchmarks, run by their publishers' own runners, unmodified, at a pinned commit.\n *\n * One registry entry per benchmark: the publisher's repository and commit, its install and run commands, a parser from the\n * publisher's result file to per-task scores (agent-eval's verdict names: `passed`, `score`, `notes`), the license, the data terms, and the judge the publisher names. Nothing here loads\n * tasks, drives an agent loop, or grades: the publisher's runner does all three. A target becomes the OpenAI-compatible\n * endpoint that runner calls:\n *\n * model:<router model> the Tangle Router with `TANGLE_API_KEY`; the target is a model driving the benchmark's tools.\n * profile:<harness/model> a CLI Bridge (`AGENT_BENCH_BRIDGE_URL`, default http://127.0.0.1:3344/v1) running that harness with\n * its own loop and tools; the benchmark's tools reach it as caller-executed MCP tools (cli-bridge#397).\n * app:<agent app>@<harness/model>\n * the AgentProfile the app serves in production (prompt, skills, subagents, resources), run by\n * that subscription harness through the same CLI Bridge at `/profiles/<id>/v1` (cli-bridge#408).\n * The app's production model and its own MCP servers are not part of it; the run record names both.\n *\n * Every run says what it measured: `model-shaped` (the target as a model calling the benchmark's tools, which the\n * benchmark executes) or `own-loop` (the agent with its own loop and tools). The two are never compared as one.\n */\nimport { spawn } from 'node:child_process'\nimport { createHash, randomUUID } from 'node:crypto'\nimport { existsSync } from 'node:fs'\nimport { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'\nimport { homedir } from 'node:os'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { canonicalJson, RunRecordValidationError, UNKNOWN_MODEL, validateRunRecord, type RunRecord } from '@tangle-network/agent-eval'\n\nexport type Measured = 'model-shaped' | 'own-loop'\n\n/** The OpenAI-compatible endpoint a publisher's runner calls for one target. */\nexport interface Endpoint {\n target: string\n baseUrl: string\n model: string\n /** The environment variable that holds the endpoint's key; the runner reads it, nothing here prints it. */\n apiKeyVar: string\n /** What a run through this endpoint measures. */\n measured: Measured\n /** For an app target: which served profile ran, and what of the app it leaves out. */\n app?: AppProfile\n}\n\n/** An agent app's served AgentProfile as an app target runs it. */\nexport interface AppProfile {\n app: string\n profileUrl: string\n profileName: string | null\n profileVersion: string | null\n /** sha256 of the profile as run (served profile without `model` and `mcp`). */\n profileDigest: string\n /** The model the app runs in production, replaced by the target's harness model. */\n productionModel: unknown\n /** The app's own MCP servers, which need the app's deployment and are not mounted. */\n omittedMcp: string[]\n}\n\n/**\n * Agent apps a benchmark can target, each by the executable AgentProfile it serves in production: the projection its own\n * sandbox sends a harness (gtm-agent toExecutableAgentProfile, legal-agent slimSandboxProfile). `AGENT_BENCH_APPS`, a JSON\n * object of app name to profile URL or absolute file path, adds an app or points one at another source: a staging deployment,\n * a profile exported from a checkout, or a candidate profile an optimizer is scoring.\n */\nexport const AGENT_APPS: Readonly<Record<string, { profileUrl: string }>> = {\n 'gtm-agent': { profileUrl: 'https://gtm.tangle.tools/api/tools/profile?definition=executable' },\n 'legal-agent': { profileUrl: 'https://legal.tangle.tools/api/tools/profile?definition=executable' },\n}\n\nfunction agentApps(env: NodeJS.ProcessEnv): Record<string, { profileUrl: string }> {\n if (!env.AGENT_BENCH_APPS) return { ...AGENT_APPS }\n const extra = JSON.parse(env.AGENT_BENCH_APPS) as unknown\n if (!extra || typeof extra !== 'object' || Array.isArray(extra) || !Object.values(extra).every((url) => typeof url === 'string')) {\n throw new Error('AGENT_BENCH_APPS must be a JSON object of app name to profile URL or absolute file path')\n }\n return { ...AGENT_APPS, ...Object.fromEntries(Object.entries(extra as Record<string, string>).map(([name, profileUrl]) => [name, { profileUrl }])) }\n}\n\nexport interface PublishedRunOptions {\n /** Run this many tasks in the publisher's order (a sample, never a full official run unless asked). */\n tasks?: number\n /** Run exactly these publisher task ids. */\n taskIds?: string[]\n /** Extra arguments passed to the publisher's runner unchanged, after the ones this registry sets. */\n args?: string[]\n /** Where the publisher's result file and this run's record are written. */\n out: string\n env?: NodeJS.ProcessEnv\n /** Where publisher checkouts are cached; defaults to ~/.cache/agent-bench/published. */\n cacheDir?: string\n /**\n * Replace the publisher's judge with `bridge/<harness/model>`, a model on a subscription seat behind a CLI Bridge\n * (AGENT_BENCH_JUDGE_URL, default the profile Bridge). The run is then not official, and its record says so.\n */\n judge?: string\n /** The agent-eval RunRecord identity each task row carries; defaults: experiment `<benchmark>@<ref>`, candidate the target, split holdout. */\n record?: { experimentId?: string; candidateId?: string; splitTag?: 'search' | 'dev' | 'holdout' }\n}\n\n/** One task's score; `raw` carries the publisher's numeric per-task detail (Harvey LAB: `crit.<id>` 1|0, criteria counts). */\nexport interface PublishedTaskScore {\n id: string\n passed: boolean\n score: number\n notes?: string\n raw?: Record<string, number>\n}\n\nexport interface PublishedBenchmark {\n name: string\n repository: string\n /** The exact publisher commit; a moved tag cannot change a recorded number. */\n ref: string\n version: string\n license: string\n terms: string\n /** The judge model the publisher names, or null when the publisher's grader is deterministic. */\n judge: string | null\n /** The benchmark's runner accepts a substituted judge (`--judge`). */\n judgeSubstitutable?: boolean\n /** Why no run of this entry is official, when the publisher reports from an implementation it does not release. */\n unofficial?: string\n measured: Measured\n /** The runner writes a folder of results rather than one file. */\n resultIsFolder?: boolean\n install: string[][]\n run(endpoint: Endpoint, options: PublishedRunOptions, resultPath: string): string[]\n /** Read the publisher's result (a file or a folder) into one score per task, as the publisher's grader reported it. */\n parse(resultPath: string): Promise<PublishedTaskScore[]>\n}\n\nexport interface PublishedRun {\n benchmark: string\n version: string\n ref: string\n target: string\n model: string\n measured: Measured\n judge: string | null\n /** The judge the publisher names, kept beside a substituted one. */\n publisherJudge: string | null\n /** True when the score comes from the publisher's own grader and judge; false whenever a judge was substituted. */\n official: boolean\n /** Why the entry is never official (`PublishedBenchmark.unofficial`). */\n unofficial?: string\n app?: AppProfile\n tasks: number\n passed: number\n /** Mean task score, 0..1, as the publisher's grader reports it. */\n score: number\n taskScores: PublishedTaskScore[]\n resultPath: string\n /** One agent-eval RunRecord per task (JSON lines), for the ledgers, dashboards and promotion gates every other run feeds. */\n runRecords: string\n license: string\n terms: string\n startedAt: string\n finishedAt: string\n}\n\nexport const PUBLISHED_BENCHMARKS: Readonly<Record<string, PublishedBenchmark>> = {\n automationbench: {\n name: 'automationbench',\n repository: 'https://github.com/zapier/AutomationBench.git',\n ref: '4a8e1061254004d9dac807054eed33fad7d1ff14',\n version: '1.0.6',\n license: 'MIT (Zapier, Inc.); third-party API schemas excluded',\n terms: 'MIT: tasks and code may be redistributed with attribution',\n judge: null,\n measured: 'model-shaped',\n install: [['uv', 'sync', '--frozen']],\n run: (endpoint, options, resultPath) => [\n 'uv', 'run', 'auto-bench',\n '--model', endpoint.model, '--base-url', endpoint.baseUrl, '--api-key-var', endpoint.apiKeyVar,\n ...(options.taskIds?.length ? ['--tasks', options.taskIds.join(',')] : []),\n ...(options.tasks === undefined ? [] : ['--num-examples', String(options.tasks)]),\n '--max-concurrent', String(Math.max(1, Math.min(options.tasks ?? options.taskIds?.length ?? 4, 4))),\n '--export-json', resultPath,\n ...(options.args ?? []),\n ],\n parse: async (resultPath) => {\n const tasks = (JSON.parse(await readFile(resultPath, 'utf8')) as { tasks?: Array<{ name?: unknown; score?: unknown; passed?: unknown }> }).tasks\n if (!Array.isArray(tasks)) throw new Error('AutomationBench result has no tasks array')\n return tasks.map((task) => {\n if (typeof task.name !== 'string' || typeof task.score !== 'number' || typeof task.passed !== 'boolean') {\n throw new Error(`AutomationBench task result is malformed: ${JSON.stringify(task).slice(0, 200)}`)\n }\n return { id: task.name, passed: task.passed, score: task.score }\n })\n },\n },\n 'enterpriseops-gym': {\n name: 'enterpriseops-gym',\n repository: 'https://github.com/ServiceNow/EnterpriseOps-Gym.git',\n ref: '271f2c357f763376997dfd16807fcde2474ae41b',\n version: '271f2c3 (no release tag)',\n license: 'Apache-2.0 (ServiceNow; code and the ServiceNow-AI/EnterpriseOps-Gym dataset)',\n terms: 'Apache-2.0: tasks may be redistributed with attribution',\n judge: null,\n measured: 'model-shaped',\n resultIsFolder: true,\n install: [['uv', 'sync', '--extra', 'openai'], ['python3', '-c', \"import zipfile; zipfile.ZipFile('gym_dbs.zip').extractall('.')\"]],\n // A sample runs `--task` ids or the first --tasks of the domain (default teams, mode oracle; pass `-- --domain d --mode m`).\n run: (endpoint, options, resultPath) => [\n 'sh', fileURLToPath(new URL('../scripts/enterpriseops-gym-run.sh', import.meta.url)),\n resultPath, endpoint.baseUrl, endpoint.model, endpoint.apiKeyVar,\n options.tasks === undefined ? 'all' : String(options.tasks), (options.taskIds ?? []).join(','),\n ...(options.args ?? []),\n ],\n parse: async (resultPath) => {\n const folder = path.join(resultPath, 'run_1')\n const files = (await readdir(folder)).filter((file) => file.startsWith('results_') && file.endsWith('.json')).sort()\n if (!files.length) throw new Error(`EnterpriseOps-Gym wrote no task results under ${folder}`)\n return Promise.all(files.map(async (file) => {\n const result = JSON.parse(await readFile(path.join(folder, file), 'utf8')) as {\n statistics?: { overall_success_rate?: unknown; verifier_level_pass_rate?: unknown }; runs?: Array<{ error?: unknown }>\n }\n const success = result.statistics?.overall_success_rate\n const verifiers = result.statistics?.verifier_level_pass_rate\n if (typeof success !== 'number') throw new Error(`EnterpriseOps-Gym result ${file} has no statistics.overall_success_rate`)\n const error = result.runs?.find((run) => run.error)?.error\n return {\n id: file.slice('results_'.length, -'.json'.length).split('__').pop()!, passed: success === 1, score: success,\n notes: `verifier pass rate ${typeof verifiers === 'number' ? verifiers : 'unknown'}${error ? `; runner error: ${String(error).slice(0, 200)}` : ''}`,\n }\n }))\n },\n },\n 'harvey-lab': {\n name: 'harvey-lab',\n repository: 'https://github.com/harveyai/harvey-labs.git',\n // v1.3.0, the latest tag: v1.0 has no OpenAI-compatible chat adapter; v1.3.0 ships baseten/ (chat completions with tools).\n ref: '81d6a31b22d7c9f661cda4770cffcc12a5735dc2',\n version: 'v1.3.0',\n license: 'MIT (Harvey AI)',\n terms: 'MIT: tasks and their synthetic documents ship in the repository; no training or redistribution restriction stated',\n judge: 'claude-sonnet-4-6 + gpt-5.5 (LAB standard dual judge, all-pass per criterion)',\n judgeSubstitutable: true,\n measured: 'model-shaped',\n resultIsFolder: true,\n install: [\n ['uv', 'sync', '--all-extras'],\n // The publisher's own pinned pandoc, which its grader needs for .docx deliverables, into the checkout.\n ['sh', 'lab_core/sandbox/install_pandoc.sh', '.agent-bench'],\n ['sh', fileURLToPath(new URL('../scripts/harvey-lab-sandbox.sh', import.meta.url))],\n ],\n // A sample runs --task ids or the first --tasks in sorted task-id order (pass `-- --area <practice area>` to stay in one).\n run: (endpoint, options, resultPath) => [\n 'sh', fileURLToPath(new URL('../scripts/harvey-lab-run.sh', import.meta.url)),\n resultPath, endpoint.baseUrl, endpoint.model, endpoint.apiKeyVar,\n options.tasks === undefined ? 'all' : String(options.tasks), (options.taskIds ?? []).join(','), options.judge ?? 'publisher',\n ...(options.args ?? []),\n ],\n parse: async (resultPath) => {\n const runs = (await readFile(path.join(resultPath, 'tasks.tsv'), 'utf8')).trim().split('\\n').map((line) => line.split('\\t') as [string, string])\n return Promise.all(runs.map(async ([run, task]) => {\n const read = (file: string) => readFile(path.join(resultPath, run, file), 'utf8').then((text) => JSON.parse(text) as Record<string, unknown>, () => null)\n const dual = await read('scores_dual.json')\n if (dual) return { id: task, passed: dual.all_pass === true, score: Number(dual.dual_all_pass_rate), notes: `dual-judge criterion pass ${String(dual.dual_criterion_pass)}` }\n const single = await read('scores.json')\n if (single) {\n const criteria = Array.isArray(single.criteria_results) ? single.criteria_results as Array<{ id?: unknown; verdict?: unknown }> : []\n return { id: task, passed: single.all_pass === true, score: single.all_pass === true ? 1 : 0,\n notes: `${String(single.n_passed)} of ${String(single.n_criteria)} criteria passed${single.n_grading_errors ? `; ${String(single.n_grading_errors)} grading errors` : ''}`,\n raw: { criteria_passed: Number(single.n_passed) || 0, criteria_total: Number(single.n_criteria) || 0,\n ...Object.fromEntries(criteria.filter((c) => typeof c.id === 'string').map((c) => [`crit.${String(c.id)}`, c.verdict === 'pass' ? 1 : 0])) } }\n }\n return { id: task, passed: false, score: 0, notes: 'no scores: the harness or the grader failed (see the runner log)' }\n }))\n },\n },\n prbench: {\n name: 'prbench',\n repository: 'https://github.com/scaleapi/PRBench.git',\n ref: '7b2df0a28bf99ec51263c41b90dd510a740a7711',\n version: '7b2df0a (no release tag)',\n license: 'MIT (Scale AI); dataset ScaleAI/PRBench CC-BY-4.0',\n terms: 'CC-BY-4.0 dataset, not gated, loaded from Hugging Face at run time; attribution required, no training restriction stated',\n judge: 'openai/o4-mini (reasoning effort high), one call per rubric criterion',\n judgeSubstitutable: true,\n measured: 'model-shaped',\n resultIsFolder: true,\n // The publisher pins no dependency versions (requirements.txt), so a fresh install resolves them anew.\n install: [['uv', 'venv', '--quiet', '--python', '3.12'], ['uv', 'pip', 'install', '--quiet', '-r', 'requirements.txt']],\n // A sample runs --task ids or the first --tasks rows of the split (default legal; pass `-- --split finance`).\n run: (endpoint, options, resultPath) => [\n 'sh', fileURLToPath(new URL('../scripts/prbench-run.sh', import.meta.url)),\n resultPath, endpoint.baseUrl, endpoint.model, endpoint.apiKeyVar,\n options.tasks === undefined ? 'all' : String(options.tasks), (options.taskIds ?? []).join(','), options.judge ?? 'publisher',\n ...(options.args ?? []),\n ],\n // Per task, the publisher's clipped score: rubric points over the positive weights (negative criteria can take it below\n // zero; clamped to 0..1 here). The publisher's aggregate, mean_clipped, is max(0, mean of the unclamped scores).\n parse: async (resultPath) => {\n const folder = path.join(resultPath, 'results')\n const files = (await readdir(folder)).filter((file) => file.endsWith('.json'))\n if (files.length !== 1) throw new Error(`PRBench wrote ${files.length} result files under ${folder}, expected one`)\n const result = JSON.parse(await readFile(path.join(folder, files[0]!), 'utf8')) as { outputs?: Record<string, Record<string, { points?: unknown; weights?: unknown }>> }\n const tasks = Object.values(result.outputs ?? {})[0]\n if (!tasks) throw new Error(`PRBench result ${files[0]} has no outputs`)\n return Object.entries(tasks).map(([id, task]) => {\n const weights = Array.isArray(task.weights) ? task.weights.filter((weight): weight is number => typeof weight === 'number') : []\n const best = weights.filter((weight) => weight > 0).reduce((sum, weight) => sum + weight, 0)\n const points = typeof task.points === 'number' ? task.points : Number.NaN\n if (!best || Number.isNaN(points)) throw new Error(`PRBench task ${id} has no points or weights`)\n return { id, passed: points >= best, score: Math.min(1, Math.max(0, points / best)), notes: `${points} of ${best} rubric points` }\n })\n },\n },\n 'healthbench-professional': {\n name: 'healthbench-professional',\n repository: 'https://github.com/openai/simple-evals.git',\n ref: '652c89d0ca9df547706735883097e9537d40dc47',\n version: '652c89d (no release tag), data openai/healthbench-professional@349962fd',\n license: 'MIT (OpenAI simple-evals); dataset openai/healthbench-professional MIT',\n terms: 'MIT dataset, not gated, fetched from Hugging Face at the pinned revision at run time and never committed: the authors ask that examples not be revealed in plain text or images online. No training restriction stated.',\n judge: 'gpt-5.4-2026-03-05 (reasoning effort low), one call per rubric item; length-adjusted (center 2000 characters, 1.47 points per 500)',\n judgeSubstitutable: true,\n unofficial: 'OpenAI reports HealthBench Professional from an internal implementation it does not release; simple-evals with its Professional settings is the reference implementation',\n measured: 'model-shaped',\n resultIsFolder: true,\n // The publisher pins no dependency versions and ships no requirements file; these are the imports HealthBenchEval needs.\n install: [['uv', 'venv', '--quiet', '--python', '3.12'], ['uv', 'pip', 'install', '--quiet', 'openai', 'blobfile', 'numpy', 'pandas', 'jinja2', 'requests', 'tqdm']],\n // A sample runs the publisher's seeded sample of --tasks examples, or the --task ids.\n run: (endpoint, options, resultPath) => [\n 'sh', fileURLToPath(new URL('../scripts/healthbench-professional-run.sh', import.meta.url)),\n resultPath, endpoint.baseUrl, endpoint.model, endpoint.apiKeyVar,\n options.tasks === undefined ? 'all' : String(options.tasks), (options.taskIds ?? []).join(','), options.judge ?? 'publisher',\n ...(options.args ?? []),\n ],\n // Per task, the publisher's length-adjusted rubric score, clamped to 0..1 (the publisher clips the mean, not each task).\n // Passed: every positive criterion met and no negative one.\n parse: async (resultPath) => {\n const result = JSON.parse(await readFile(path.join(resultPath, 'result.json'), 'utf8')) as {\n examples?: Array<{ prompt_id: string; overall_score: number; length_adjusted: number; response_chars: number; positive_met: number; positive_total: number; negative_met: number }>\n }\n if (!result.examples?.length) throw new Error(`HealthBench Professional wrote no examples under ${resultPath}`)\n return result.examples.map((example) => ({\n id: example.prompt_id,\n passed: example.positive_met === example.positive_total && example.negative_met === 0,\n score: Math.min(1, Math.max(0, example.length_adjusted)),\n notes: `${example.positive_met} of ${example.positive_total} positive criteria met, ${example.negative_met} negative met; rubric score ${example.overall_score.toFixed(3)}, length-adjusted for ${example.response_chars} characters`,\n raw: {\n overall_score: example.overall_score, length_adjusted: example.length_adjusted, response_chars: example.response_chars,\n positive_met: example.positive_met, positive_total: example.positive_total, negative_met: example.negative_met,\n },\n }))\n },\n },\n mlcr: {\n name: 'mlcr',\n repository: 'https://github.com/Wisedocs-AI/medical-long-context-reasoning.git',\n ref: 'ca822de2d274184bb0cd5bf280ff917922f3716f',\n version: 'v1.1 (ca822de, the release commit; no tag), data Wisedocs/mlcr-dataset@1198206e',\n license: 'none: neither the code nor the Wisedocs/mlcr-dataset release carries a license (the dataset card says \"other\")',\n terms: 'No license: run locally for evaluation only, never committed, redistributed, or used for training or prompt optimization. The dataset is not gated and is fetched from Hugging Face at the pinned revision at run time.',\n // A substituted judge sits all three jury seats, each sampling independently, so the publisher's two-of-three rule applies.\n judge: \"jury of gemini-3.1-pro-preview, claude-opus-4-8-gcp and gpt-5.5 (majority vote, medium thinking) on the publisher's Vertex, Anthropic-on-GCP and Azure OpenAI providers, after a conciseness gate\",\n judgeSubstitutable: true,\n measured: 'model-shaped',\n resultIsFolder: true,\n install: [['uv', 'venv', '--quiet', '--python', '3.12'], ['uv', 'pip', 'install', '--quiet', '-e', '.[all]']],\n // A sample is the runner's first --tasks rows of the publisher's smoke experiment; MLCR names rows by matrix cell, not id.\n run: (endpoint, options, resultPath) => [\n 'sh', fileURLToPath(new URL('../scripts/mlcr-run.sh', import.meta.url)),\n resultPath, endpoint.baseUrl, endpoint.model, endpoint.apiKeyVar,\n options.tasks === undefined ? 'all' : String(options.tasks), (options.taskIds ?? []).join(','), options.judge ?? 'publisher',\n ...(options.args ?? []),\n ],\n // Per row, the jury's verdict: correct (complete and accurate by majority) after the conciseness gate.\n parse: async (resultPath) => {\n const result = JSON.parse(await readFile(path.join(resultPath, 'result.json'), 'utf8')) as {\n examples?: Array<{ id: string; concise: string; complete: string; accurate: string; correct: string; judge_error: boolean; response_chars: number }>\n }\n if (!result.examples?.length) throw new Error(`MLCR wrote no scored rows under ${resultPath}`)\n const verdict = (value: string) => (value === '' ? undefined : Number(value))\n return result.examples.map((example) => {\n if (example.correct === '') throw new Error(`MLCR row ${example.id} has no jury verdict${example.judge_error ? ' (the judge failed)' : ''}`)\n const raw = Object.fromEntries(Object.entries({ concise: verdict(example.concise), complete: verdict(example.complete), accurate: verdict(example.accurate), correct: verdict(example.correct) })\n .filter((entry): entry is [string, number] => entry[1] !== undefined))\n return {\n id: example.id, passed: example.correct === '1', score: example.correct === '1' ? 1 : 0,\n notes: `concise ${example.concise || '-'}, complete ${example.complete || '-'}, accurate ${example.accurate || '-'}; ${example.response_chars} characters`,\n raw: { ...raw, response_chars: example.response_chars },\n }\n })\n },\n },\n}\n\n/** Resolve a `model:`, `app:` or `profile:` target to the endpoint a publisher's runner calls. */\nexport async function resolveEndpoint(target: string, benchmark: PublishedBenchmark, env: NodeJS.ProcessEnv = process.env): Promise<Endpoint> {\n const match = /^(model|app|profile):(.+)$/.exec(target)\n if (!match) throw new Error(`target must be model:<router model>, app:<agent app>@<harness/model> or profile:<harness/model>, not '${target}'`)\n const [, kind, id] = match as unknown as [string, 'model' | 'app' | 'profile', string]\n if (kind === 'model') {\n return { target, model: id, baseUrl: env.AGENT_BENCH_ROUTER_URL ?? 'https://router.tangle.tools/v1', apiKeyVar: 'TANGLE_API_KEY', measured: benchmark.measured }\n }\n // A loopback Bridge without a bearer accepts any key; the runner still needs one to send.\n const bridge = env.AGENT_BENCH_BRIDGE_URL ?? 'http://127.0.0.1:3344/v1'\n if (kind === 'profile') return { target, model: id, baseUrl: bridge, apiKeyVar: 'AGENT_BENCH_BRIDGE_KEY', measured: 'own-loop' }\n const at = id.indexOf('@')\n const [name, harness] = at === -1 ? [id, ''] : [id.slice(0, at), id.slice(at + 1)]\n const apps = agentApps(env)\n const app = apps[name]\n if (!app) throw new Error(`no agent app '${name}'; registered: ${Object.keys(apps).join(', ')} (add one with AGENT_BENCH_APPS)`)\n if (!harness) throw new Error(`app:${name} needs @<harness/model>, the subscription harness that runs the app's profile, e.g. app:${name}@opencode/zai-coding-plan/glm-5.3`)\n const catalog = env.AGENT_BENCH_BRIDGE_PROFILES_DIR\n if (!catalog) throw new Error(`AGENT_BENCH_BRIDGE_PROFILES_DIR is not set: point it at the CLI Bridge's SANDBOX_PROFILES_DIR, where app:${name} writes its profile`)\n const { mcp, model, ...profile } = await readAppProfile(name, app.profileUrl)\n const text = JSON.stringify(profile)\n const digest = createHash('sha256').update(text).digest('hex')\n // Content-addressed: the Bridge rereads its catalog only for an id it does not know.\n const profileId = `${name}-${digest.slice(0, 12)}`\n await mkdir(catalog, { recursive: true })\n await writeFile(path.join(catalog, `${profileId}.json`), text)\n return {\n target, model: harness, baseUrl: `${bridge.replace(/\\/v1\\/?$/, '')}/profiles/${profileId}/v1`, apiKeyVar: 'AGENT_BENCH_BRIDGE_KEY', measured: 'own-loop',\n app: {\n app: name, profileUrl: app.profileUrl, profileDigest: `sha256:${digest}`, productionModel: model ?? null,\n profileName: typeof profile.name === 'string' ? profile.name : null, profileVersion: typeof profile.version === 'string' ? profile.version : null,\n omittedMcp: mcp && typeof mcp === 'object' ? Object.keys(mcp) : [],\n },\n }\n}\n\n/** An app's profile from its URL, or from an absolute file path. */\nasync function readAppProfile(name: string, source: string): Promise<Record<string, unknown>> {\n if (path.isAbsolute(source)) return JSON.parse(await readFile(source, 'utf8')) as Record<string, unknown>\n const response = await fetch(source)\n if (!response.ok) throw new Error(`${source} answered ${response.status}; app:${name} needs the profile the app serves`)\n return await response.json() as Record<string, unknown>\n}\n\n/** Run one published benchmark against one target with the publisher's runner and grader, and record the result. */\nexport async function runPublished(name: string, target: string, options: PublishedRunOptions): Promise<PublishedRun> {\n const benchmark = PUBLISHED_BENCHMARKS[name]\n if (!benchmark) throw new Error(`no published benchmark '${name}'; registered: ${Object.keys(PUBLISHED_BENCHMARKS).join(', ')}`)\n const env = { ...process.env, ...options.env }\n if (options.judge !== undefined && !benchmark.judgeSubstitutable) {\n throw new Error(`${benchmark.name} grades ${benchmark.judge === null ? 'deterministically' : `with ${benchmark.judge}`}; this registry cannot substitute its judge`)\n }\n if (options.judge !== undefined && !options.judge.startsWith('bridge/')) throw new Error(`--judge must be bridge/<harness/model>, not '${options.judge}'`)\n env.AGENT_BENCH_JUDGE_URL ??= env.AGENT_BENCH_BRIDGE_URL ?? 'http://127.0.0.1:3344/v1'\n const endpoint = await resolveEndpoint(target, benchmark, env)\n if (!env[endpoint.apiKeyVar]) throw new Error(`${endpoint.apiKeyVar} is not set; the ${target} endpoint needs it`)\n const checkout = await publisherCheckout(benchmark, options.cacheDir, env)\n await mkdir(options.out, { recursive: true })\n const resultPath = path.resolve(options.out, `${benchmark.name}-result${benchmark.resultIsFolder ? '' : '.json'}`)\n const startedAt = new Date().toISOString()\n const [command, ...args] = benchmark.run(endpoint, options, resultPath)\n await execute(command!, args, checkout, env)\n const taskScores = await benchmark.parse(resultPath)\n const run: PublishedRun = {\n benchmark: benchmark.name, version: benchmark.version, ref: benchmark.ref, target, model: endpoint.model,\n measured: endpoint.measured, judge: options.judge ?? benchmark.judge, publisherJudge: benchmark.judge,\n official: options.judge === undefined && benchmark.unofficial === undefined,\n ...(benchmark.unofficial ? { unofficial: benchmark.unofficial } : {}),\n ...(endpoint.app ? { app: endpoint.app } : {}),\n tasks: taskScores.length, passed: taskScores.filter((task) => task.passed).length,\n score: taskScores.length ? taskScores.reduce((sum, task) => sum + task.score, 0) / taskScores.length : 0,\n taskScores, resultPath, runRecords: path.resolve(options.out, `${benchmark.name}-runrecords.jsonl`),\n license: benchmark.license, terms: benchmark.terms, startedAt, finishedAt: new Date().toISOString(),\n }\n await writeFile(run.runRecords, runRecords(run, options).map((record) => JSON.stringify(record)).join('\\n') + '\\n')\n await writeFile(path.resolve(options.out, `${benchmark.name}-run.json`), `${JSON.stringify(run, null, 2)}\\n`)\n return run\n}\n\n/**\n * One agent-eval RunRecord per task, validated by agent-eval's own validator. The publisher's runner makes the model calls,\n * so cost and tokens are uncaptured, never zero. A RunRecord's model must name a served snapshot; a subscription harness\n * reports none, and a snapshot invented from the date would be false, so such rows record `unknown` with terminal outcome\n * `unknown` and keep the requested model in `candidateId`. A pinned model id (a Router snapshot) is recorded as served.\n */\nfunction runRecords(run: PublishedRun, options: PublishedRunOptions): RunRecord[] {\n const split = options.record?.splitTag ?? 'holdout'\n const sha = (value: string) => `sha256:${createHash('sha256').update(value).digest('hex')}`\n const configHash = sha(canonicalJson({ benchmark: run.benchmark, ref: run.ref, target: run.target, judge: run.judge, args: options.args ?? [] }))\n return run.taskScores.map((task) => {\n const row = {\n runId: randomUUID(), experimentId: options.record?.experimentId ?? `${run.benchmark}@${run.ref}`,\n candidateId: options.record?.candidateId ?? run.target, seed: 0, model: run.model,\n // The publisher owns the prompt; an app run's prompt is its profile.\n promptHash: run.app?.profileDigest ?? sha(run.target), configHash, commitSha: run.ref,\n wallMs: Math.max(0, Date.parse(run.finishedAt) - Date.parse(run.startedAt)),\n costUsd: null, costProvenance: { kind: 'uncaptured', usd: null }, tokenUsage: { input: 0, output: 0, tokensKnown: false },\n terminalOutcome: 'succeeded',\n outcome: { [split === 'holdout' ? 'holdoutScore' : 'searchScore']: task.score, raw: { passed: task.passed ? 1 : 0, ...task.raw } },\n splitTag: split, scenarioId: `${run.benchmark}:${task.id}`,\n }\n try {\n return validateRunRecord(row)\n } catch (error) {\n if (!(error instanceof RunRecordValidationError) || error.path !== 'model') throw error\n return validateRunRecord({ ...row, model: UNKNOWN_MODEL, terminalOutcome: 'unknown' })\n }\n })\n}\n\n/** The publisher's repository at the pinned commit, installed once per cache. */\nasync function publisherCheckout(benchmark: PublishedBenchmark, cacheDir: string | undefined, env: NodeJS.ProcessEnv): Promise<string> {\n const root = cacheDir ?? path.join(homedir(), '.cache', 'agent-bench', 'published')\n const dir = path.join(root, `${benchmark.name}@${benchmark.ref}`)\n const installed = path.join(dir, '.agent-bench-installed')\n if (existsSync(installed)) return dir\n if (!existsSync(path.join(dir, '.git'))) {\n await mkdir(root, { recursive: true })\n await execute('git', ['clone', '--quiet', '--filter=blob:none', '--no-checkout', benchmark.repository, dir], root, env)\n }\n await execute('git', ['checkout', '--quiet', '--detach', benchmark.ref], dir, env)\n for (const [command, ...args] of benchmark.install) await execute(command!, args, dir, env)\n await writeFile(installed, `${benchmark.ref}\\n`)\n return dir\n}\n\nfunction execute(command: string, args: string[], cwd: string, env: NodeJS.ProcessEnv): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, { cwd, env, stdio: 'inherit' })\n child.once('error', (error) => reject(new Error(`${command} could not start in ${cwd}: ${error.message}`)))\n child.once('exit', (code, signal) => code === 0\n ? resolve()\n : reject(new Error(`${command} ${args.slice(0, 3).join(' ')} exited ${signal ?? code} in ${cwd}`)))\n })\n}\n","#!/usr/bin/env node\n/**\n * agent-bench run <benchmark> --target <model:|app:|profile:> [--tasks N] [--task <publisher task id>]... [--out <dir>] [-- <runner args>]\n * agent-bench list\n *\n * Runs a published benchmark with its publisher's own runner and grader (src/published.ts), prints the score with what it\n * measured, and writes the run record to --out (default ./agent-bench-runs/<benchmark>-<time>).\n */\nimport path from 'node:path'\nimport { PUBLISHED_BENCHMARKS, runPublished } from './published'\n\nconst usage = 'usage: agent-bench run <benchmark> --target <model:<router model>|app:<agent app>@<harness/model>|profile:<harness/model>> [--tasks N] [--task <id>]... [--judge bridge/<harness/model>] [--experiment <id>] [--candidate <id>] [--split search|dev|holdout] [--out <dir>] [-- <runner args>]\\n agent-bench list'\n\nasync function main(argv: string[]): Promise<number> {\n const [command, ...rest] = argv\n if (command === 'list') {\n for (const benchmark of Object.values(PUBLISHED_BENCHMARKS)) {\n console.log(`${benchmark.name} ${benchmark.version} ${benchmark.repository}@${benchmark.ref.slice(0, 12)} ${benchmark.measured} judge=${benchmark.judge ?? 'deterministic'} license=${benchmark.license}`)\n }\n return 0\n }\n if (command !== 'run' || !rest[0] || rest[0].startsWith('-')) {\n console.error(usage)\n return 2\n }\n const name = rest[0]\n const separator = rest.indexOf('--')\n const own = separator === -1 ? rest.slice(1) : rest.slice(1, separator)\n const runnerArgs = separator === -1 ? [] : rest.slice(separator + 1)\n let target: string | undefined\n let tasks: number | undefined\n const taskIds: string[] = []\n let out: string | undefined\n let judge: string | undefined\n const record: { experimentId?: string; candidateId?: string; splitTag?: 'search' | 'dev' | 'holdout' } = {}\n for (let i = 0; i < own.length; i++) {\n const flag = own[i]\n const value = own[i + 1]\n if (value === undefined) throw new Error(`${flag} needs a value\\n${usage}`)\n if (flag === '--target') target = value\n else if (flag === '--tasks') tasks = Number.parseInt(value, 10)\n else if (flag === '--task') taskIds.push(value)\n else if (flag === '--out') out = value\n else if (flag === '--judge') judge = value\n else if (flag === '--experiment') record.experimentId = value\n else if (flag === '--candidate') record.candidateId = value\n else if (flag === '--split') record.splitTag = value as 'search' | 'dev' | 'holdout'\n else throw new Error(`unknown option ${flag}\\n${usage}`)\n i++\n }\n if (!target) throw new Error(`--target is required\\n${usage}`)\n if (tasks !== undefined && !(Number.isSafeInteger(tasks) && tasks > 0)) throw new Error('--tasks must be a positive integer')\n const run = await runPublished(name, target, {\n ...(tasks === undefined ? {} : { tasks }),\n ...(taskIds.length ? { taskIds } : {}),\n ...(judge === undefined ? {} : { judge }),\n ...(Object.keys(record).length ? { record } : {}),\n args: runnerArgs,\n out: path.resolve(out ?? path.join('agent-bench-runs', `${name}-${new Date().toISOString().replace(/[:.]/g, '-')}`)),\n })\n console.log(`${run.benchmark} ${run.version} on ${run.target}: ${run.passed} of ${run.tasks} passed, score ${run.score.toFixed(3)}, measured ${run.measured}, judge ${run.judge === null ? 'deterministic' : run.judge} (${run.official ? 'official' : `${[run.judge !== run.publisherJudge ? `substituted for ${run.publisherJudge}` : undefined, run.unofficial].filter(Boolean).join('; ')}, not official`})`)\n if (run.app) {\n console.log(`app: ${run.app.app} profile ${run.app.profileName ?? '?'} ${run.app.profileVersion ?? ''} ${run.app.profileDigest.slice(0, 19)} from ${run.app.profileUrl}; ` +\n `its production model ${JSON.stringify(run.app.productionModel)} replaced by ${run.model}; its MCP servers not mounted: ${run.app.omittedMcp.join(', ') || 'none'}`)\n }\n console.log(`record: ${path.join(path.dirname(run.resultPath), `${run.benchmark}-run.json`)}`)\n console.log(`run records: ${run.runRecords}`)\n return 0\n}\n\nmain(process.argv.slice(2)).then((code) => process.exit(code), (error: unknown) => {\n console.error(error instanceof Error ? error.message : String(error))\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,aAA+D;CAC1E,aAAa,EAAE,YAAY,mEAAmE;CAC9F,eAAe,EAAE,YAAY,qEAAqE;AACpG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ACpE,QAAQ,KAAK,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,15 @@ import { createCragAdapter } from "./benchmarks/crag.js";
|
|
|
3
3
|
import { createNoMiraclAdapter } from "./benchmarks/nomiracl.js";
|
|
4
4
|
import { createOpenRagBenchAdapter } from "./benchmarks/open-rag-bench.js";
|
|
5
5
|
import { createRagBenchAdapter } from "./benchmarks/ragbench.js";
|
|
6
|
-
import { FINAL_ANSWER_SENTINEL, RagAnswerScore, RagContext, ResearchAnswer,
|
|
6
|
+
import { FINAL_ANSWER_SENTINEL, RagAnswerScore, RagContext, ResearchAnswer, answerScoreToEvaluation, contextBlock, contextsFrom, normalizeAnswer, parseCitations, parseFinalAnswer, ragAnswerOutput, scoreAnswerArtifact, tokenF1 } from "./benchmarks/rag-shared.js";
|
|
7
7
|
import { createT2RagBenchAdapter } from "./benchmarks/t2-ragbench.js";
|
|
8
8
|
import { SweBenchAdapterOptions, SweBenchArtifactCaptureContext, SweBenchCacheLevel, createSweBenchAdapter, scoreSweReport, sweEvaluationArgv, swePatchOutput } from "./benchmarks/swe-bench.js";
|
|
9
9
|
import { StagedJudgeError, StagedRunCaptureSpec, StagedRunSpec, runStagedJudge } from "./benchmarks/_harness.js";
|
|
10
|
-
import {
|
|
10
|
+
import { BenchEvaluation, BenchPayload, BenchRuntime, BenchTask, JudgeArtifactFileReceipt, JudgeArtifactReceipt, LoadOptions, RuntimeBenchmark, RuntimeBenchmarkSpec, runtimeBenchmark } from "./benchmarks/types.js";
|
|
11
11
|
import { AgentProfile, SandboxClient, SandboxRun, TurnResult, sumSandboxUsage } from "@tangle-network/agent-runtime/kernel";
|
|
12
|
+
import { RunTerminalOutcome, TraceStore } from "@tangle-network/agent-eval";
|
|
12
13
|
import { SandboxEvent } from "@tangle-network/sandbox";
|
|
13
14
|
import { AgentCandidateBenchmarkGraderPort, AgentCandidateExecutionClaimStore, AgentCandidateExecutorPort, AgentCandidateExecutorRequest, AgentCandidateExecutorStopRequest, AgentCandidateOutputArtifactPort, AgentCandidateRunFinalization, PreparedAgentCandidateExecution } from "@tangle-network/agent-runtime/candidate-execution";
|
|
14
|
-
import { RunTerminalOutcome, TraceStore } from "@tangle-network/agent-eval";
|
|
15
15
|
interface ResolveBenchClientOptions {
|
|
16
16
|
/** The selector (the `BACKEND` env value): `router` = off-box; anything else = in-box Sandbox. */
|
|
17
17
|
backend: string;
|
|
@@ -89,10 +89,10 @@ interface BenchShotResult {
|
|
|
89
89
|
}
|
|
90
90
|
/** Runs one (adapter, task, cell) shot. Defaults to `openSandboxRun`. */
|
|
91
91
|
type BenchShot = (input: {
|
|
92
|
-
readonly adapter:
|
|
92
|
+
readonly adapter: RuntimeBenchmark;
|
|
93
93
|
readonly task: BenchTask;
|
|
94
94
|
readonly cell: BenchCell;
|
|
95
|
-
/** Prompt to hand to the worker. Defaults to `
|
|
95
|
+
/** Prompt to hand to the worker. Defaults to `adapter.runtime.prompt(task)`; looped runs pass revised prompts. */
|
|
96
96
|
readonly prompt?: string;
|
|
97
97
|
/** 1-based attempt index for looped runs. */
|
|
98
98
|
readonly attempt?: number;
|
|
@@ -124,7 +124,8 @@ interface RunBenchmarksOptions {
|
|
|
124
124
|
/** Tasks per benchmark (the n). */
|
|
125
125
|
readonly n?: number;
|
|
126
126
|
readonly ids?: string[];
|
|
127
|
-
|
|
127
|
+
/** The publisher's subset (domain, category, language), for benchmarks that have them. */
|
|
128
|
+
readonly subset?: string;
|
|
128
129
|
/** Replicates per (benchmark × cell × task). Default 1. */
|
|
129
130
|
readonly reps?: number;
|
|
130
131
|
/** Bounded concurrency across all shots. Default 4. */
|
|
@@ -146,7 +147,7 @@ interface RunBenchmarksOptions {
|
|
|
146
147
|
/** Test seam: a deterministic shot runner. Defaults to the `openSandboxRun` leaf. */
|
|
147
148
|
readonly runShot?: BenchShot;
|
|
148
149
|
/** Test seam: resolve a benchmark key to an adapter. Defaults to the registry `resolveAdapter`. */
|
|
149
|
-
readonly resolveAdapter?: (key: string) =>
|
|
150
|
+
readonly resolveAdapter?: (key: string) => RuntimeBenchmark;
|
|
150
151
|
readonly onResult?: (r: BenchCellTaskResult) => void;
|
|
151
152
|
}
|
|
152
153
|
interface BenchCellTaskResult {
|
|
@@ -349,5 +350,5 @@ export declare class FilePierCandidateTrialController implements PierCandidateTr
|
|
|
349
350
|
private forceRecovery;
|
|
350
351
|
}
|
|
351
352
|
export declare function createPierResultGrader(descriptor: Pick<PierCandidateGraderPort, 'name' | 'version' | 'artifact'>): PierCandidateGraderPort;
|
|
352
|
-
export { ADAPTERS, type BenchCell, type BenchCellTaskResult, type BenchExecution, type BenchExecutionContext, type BenchLeaderboardRow, type BenchPromptResult, type
|
|
353
|
+
export { ADAPTERS, type BenchCell, type BenchCellTaskResult, type BenchEvaluation, type BenchExecution, type BenchExecutionContext, type BenchLeaderboardRow, type BenchPayload, type BenchPromptResult, type BenchRuntime, type BenchShot, type BenchShotResult, type BenchTask, type ExecutePreparedPierCandidateOptions, FINAL_ANSWER_SENTINEL, type FilePierCandidateTrialControllerOptions, type JudgeArtifactFileReceipt, type JudgeArtifactReceipt, type LoadOptions, type PierCandidateGraderPort, type PierCandidateOfficialResult, type PierCandidateProcessSpec, type PierCandidateTerminationAcknowledgement, type PierCandidateTrialController, type PierCandidateTrialHandle, type PierCandidateTrialIdentity, type PierCandidateTrialResult, type PierDockerConnection, type RagAnswerScore, type RagContext, type ResearchAnswer, type RunBenchmarksOptions, type RunBenchmarksReport, type RuntimeBenchmark, type RuntimeBenchmarkSpec, StagedJudgeError, type StagedPierCandidateExecution, type StagedRunCaptureSpec, type StagedRunSpec, type SweBenchAdapterOptions, type SweBenchArtifactCaptureContext, type SweBenchCacheLevel, answerScoreToEvaluation, contextBlock, contextsFrom, createCragAdapter, createNoMiraclAdapter, createOpenRagBenchAdapter, createRagBenchAdapter, createSweBenchAdapter, createT2RagBenchAdapter, normalizeAnswer, parseCitations, parseFinalAnswer, ragAnswerOutput, resolveAdapter, runStagedJudge, runtimeBenchmark, scoreAnswerArtifact, scoreSweReport, sweEvaluationArgv, swePatchOutput, tokenF1 };
|
|
353
354
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,11 @@ import { createCragAdapter } from "./benchmarks/crag.js";
|
|
|
3
3
|
import { createNoMiraclAdapter } from "./benchmarks/nomiracl.js";
|
|
4
4
|
import { createOpenRagBenchAdapter } from "./benchmarks/open-rag-bench.js";
|
|
5
5
|
import { createRagBenchAdapter } from "./benchmarks/ragbench.js";
|
|
6
|
-
import { FINAL_ANSWER_SENTINEL,
|
|
6
|
+
import { FINAL_ANSWER_SENTINEL, answerScoreToEvaluation, contextBlock, contextsFrom, normalizeAnswer, parseCitations, parseFinalAnswer, ragAnswerOutput, scoreAnswerArtifact, tokenF1 } from "./benchmarks/rag-shared.js";
|
|
7
7
|
import { createT2RagBenchAdapter } from "./benchmarks/t2-ragbench.js";
|
|
8
8
|
import { createSweBenchAdapter, scoreSweReport, sweEvaluationArgv, swePatchOutput } from "./benchmarks/swe-bench.js";
|
|
9
9
|
import { StagedJudgeError, runStagedJudge } from "./benchmarks/_harness.js";
|
|
10
|
+
import { runtimeBenchmark } from "./benchmarks/types.js";
|
|
10
11
|
import { chmod, lstat, mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
11
12
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
12
13
|
import { execFileSync, spawn } from "node:child_process";
|
|
@@ -15,10 +16,10 @@ import { accessSync, closeSync, constants, existsSync, fsyncSync, lstatSync, mkd
|
|
|
15
16
|
import { tmpdir } from "node:os";
|
|
16
17
|
import { fileURLToPath } from "node:url";
|
|
17
18
|
import { SandboxRunAbortError, createExecutor, inlineSandboxClient, openSandboxRun, resolveSandboxClient, sumSandboxUsage } from "@tangle-network/agent-runtime/kernel";
|
|
19
|
+
import { canonicalJson } from "@tangle-network/agent-eval";
|
|
18
20
|
import { Sandbox } from "@tangle-network/sandbox";
|
|
19
21
|
import assert from "node:assert/strict";
|
|
20
22
|
import { captureAgentCandidateWorkspaceFiles, executePreparedAgentCandidate } from "@tangle-network/agent-runtime/candidate-execution";
|
|
21
|
-
import { canonicalJson } from "@tangle-network/agent-eval";
|
|
22
23
|
// src/refine-loop.ts
|
|
23
24
|
const defaultDecide = (history) => history[history.length - 1]?.verdict?.valid === true;
|
|
24
25
|
async function runRefineLoop(spec) {
|
|
@@ -210,12 +211,12 @@ async function runPool(items, concurrency, worker, opts) {
|
|
|
210
211
|
* It owns no new mechanism. Each cell is one `openSandboxRun` shot (the same per-run primitive the
|
|
211
212
|
* SWE worker uses) driven by `resolveBenchClient` (off-box router completion OR in-box Sandbox; the
|
|
212
213
|
* harness rides `sandboxOverrides.backend.type`). The deliverable is the adapter's OWN parser
|
|
213
|
-
* (`adapter.output`), defaulting to the final answer text — so `runBenchmarks` needs no
|
|
214
|
+
* (`adapter.runtime.output`), defaulting to the final answer text — so `runBenchmarks` needs no
|
|
214
215
|
* per-benchmark branching. Concurrency is the shared `runPool`. The number comes from
|
|
215
|
-
* `adapter.
|
|
216
|
+
* `adapter.evaluate`, never a self-authored judge.
|
|
216
217
|
*
|
|
217
|
-
* Subset = the `benchmarks` and `cells` arrays plus `n`/`ids`/`
|
|
218
|
-
* `preflight()` fails (missing Docker/venv/dataset) is recorded as unavailable and skipped — the
|
|
218
|
+
* Subset = the `benchmarks` and `cells` arrays plus `n`/`ids`/`subset`. A benchmark whose
|
|
219
|
+
* `runtime.preflight()` fails (missing Docker/venv/dataset) is recorded as unavailable and skipped — the
|
|
219
220
|
* sweep never aborts because one bench's harness is absent.
|
|
220
221
|
*
|
|
221
222
|
* const report = await runBenchmarks({
|
|
@@ -261,7 +262,9 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
261
262
|
...timeoutMs ? { timeoutMs } : {}
|
|
262
263
|
});
|
|
263
264
|
const harness = cell.harness ?? cell.profile?.metadata?.backendType ?? "opencode";
|
|
264
|
-
const
|
|
265
|
+
const bridgeRoute = cell.backend === "bridge" && cell.model.startsWith(`${harness}/`) ? cell.model.slice(harness.length + 1) : void 0;
|
|
266
|
+
const bridgeProvider = bridgeRoute?.includes("/") ? bridgeRoute.slice(0, bridgeRoute.indexOf("/")) : void 0;
|
|
267
|
+
const profileProvider = cell.profile?.model?.provider ?? bridgeProvider ?? "tangle-router";
|
|
265
268
|
const profile = {
|
|
266
269
|
...cell.profile ?? { name: cell.label },
|
|
267
270
|
harness,
|
|
@@ -281,7 +284,7 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
281
284
|
name: cell.label,
|
|
282
285
|
taskToPrompt: () => "",
|
|
283
286
|
sandboxOverrides: {
|
|
284
|
-
name: `bench-${adapter.
|
|
287
|
+
name: `bench-${adapter.id}-${task.id}-${uniq}`.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 60),
|
|
285
288
|
environment: "universal",
|
|
286
289
|
backend: {
|
|
287
290
|
type: harness,
|
|
@@ -296,7 +299,7 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
296
299
|
};
|
|
297
300
|
const deliverable = {
|
|
298
301
|
kind: "events",
|
|
299
|
-
fromEvents: (events) => adapter.output ? adapter.output.parse(events) : finalText(events)
|
|
302
|
+
fromEvents: (events) => adapter.runtime.output ? adapter.runtime.output.parse(events) : finalText(events)
|
|
300
303
|
};
|
|
301
304
|
const controller = new AbortController();
|
|
302
305
|
const timer = timeoutMs ? setTimeout(() => controller.abort(), timeoutMs) : void 0;
|
|
@@ -304,21 +307,21 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
304
307
|
const runOptions = {
|
|
305
308
|
agentRun,
|
|
306
309
|
signal: signal ? AbortSignal.any([controller.signal, signal]) : controller.signal,
|
|
307
|
-
runId: `bench:${adapter.
|
|
310
|
+
runId: `bench:${adapter.id}:${task.id}:${uniq}`,
|
|
308
311
|
scenarioId: task.id,
|
|
309
312
|
onSandboxEvent: (event) => {
|
|
310
313
|
observedEvents.push(event);
|
|
311
314
|
}
|
|
312
315
|
};
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
const setup =
|
|
316
|
+
const workspaceSetup = adapter.runtime.workspaceSetup;
|
|
317
|
+
if (workspaceSetup) runOptions.beforeStart = async ({ box, sessionId }) => {
|
|
318
|
+
const setup = workspaceSetup(task);
|
|
316
319
|
const sres = await box.exec(setup.command, {
|
|
317
320
|
timeoutMs: 3e5,
|
|
318
321
|
sessionId,
|
|
319
322
|
...setup.cwd ? { cwd: setup.cwd } : {}
|
|
320
323
|
});
|
|
321
|
-
if (sres.exitCode !== 0) throw new Error(`
|
|
324
|
+
if (sres.exitCode !== 0) throw new Error(`workspaceSetup failed (exit ${sres.exitCode}): ${(sres.stderr ?? "").slice(0, 200)}`);
|
|
322
325
|
};
|
|
323
326
|
let run;
|
|
324
327
|
let result = {
|
|
@@ -395,9 +398,9 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
395
398
|
return pending;
|
|
396
399
|
};
|
|
397
400
|
const context = {
|
|
398
|
-
prompt: prompt ??
|
|
401
|
+
prompt: prompt ?? adapter.runtime.prompt(task),
|
|
399
402
|
profile: structuredClone(profile),
|
|
400
|
-
benchmark: adapter.
|
|
403
|
+
benchmark: adapter.id,
|
|
401
404
|
taskId: task.id,
|
|
402
405
|
attempt,
|
|
403
406
|
signal: runOptions.signal,
|
|
@@ -440,20 +443,20 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
440
443
|
}
|
|
441
444
|
};
|
|
442
445
|
let artifact = (turn.out ?? "").trim();
|
|
443
|
-
let
|
|
444
|
-
if (adapter.
|
|
445
|
-
const ex = adapter.
|
|
446
|
+
let workspaceExtractError;
|
|
447
|
+
if (adapter.runtime.workspaceExtract) try {
|
|
448
|
+
const ex = adapter.runtime.workspaceExtract(task);
|
|
446
449
|
const res = await run.box.exec(ex.command, {
|
|
447
450
|
timeoutMs: 12e4,
|
|
448
451
|
sessionId: run.sessionId,
|
|
449
452
|
...ex.cwd ? { cwd: ex.cwd } : {}
|
|
450
453
|
});
|
|
451
454
|
const boxArtifact = (res.stdout ?? "").trim();
|
|
452
|
-
if (res.exitCode !== 0)
|
|
455
|
+
if (res.exitCode !== 0) workspaceExtractError = `exit ${res.exitCode}: ${(res.stderr ?? "").slice(0, 160)}`;
|
|
453
456
|
else if (boxArtifact.length > 0) artifact = boxArtifact;
|
|
454
457
|
if (process.env.BENCH_ARTIFACT_DIR) try {
|
|
455
458
|
mkdirSync(process.env.BENCH_ARTIFACT_DIR, { recursive: true });
|
|
456
|
-
const safe = `${adapter.
|
|
459
|
+
const safe = `${adapter.id}_${task.id}_${uniq}`.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
457
460
|
const map = await run.box.exec("echo \"PWD:\"; pwd; echo \"LS:\"; ls -la; echo \"GITROOTS:\"; find / -maxdepth 5 -type d -name .git 2>/dev/null; echo \"SETTINGS:\"; find / -maxdepth 8 -name global_settings.py -path \"*conf*\" 2>/dev/null", {
|
|
458
461
|
timeoutMs: 6e4,
|
|
459
462
|
sessionId: run.sessionId
|
|
@@ -473,19 +476,19 @@ const openSandboxShot = async ({ adapter, task, cell, prompt, attempt = 1, execu
|
|
|
473
476
|
}, null, 2));
|
|
474
477
|
} catch {}
|
|
475
478
|
} catch (err) {
|
|
476
|
-
|
|
479
|
+
workspaceExtractError = err instanceof Error ? err.message.slice(0, 160) : String(err);
|
|
477
480
|
}
|
|
478
|
-
const detail = !turn.outcome.success ? turn.outcome.error ?? `agent ended with status ${turn.outcome.status}` : turn.readError !== void 0 ? `read: ${turn.readError.slice(0, 160)}` :
|
|
481
|
+
const detail = !turn.outcome.success ? turn.outcome.error ?? `agent ended with status ${turn.outcome.status}` : turn.readError !== void 0 ? `read: ${turn.readError.slice(0, 160)}` : workspaceExtractError !== void 0 ? `workspaceExtract: ${workspaceExtractError}` : void 0;
|
|
479
482
|
if (process.env.BENCH_ARTIFACT_DIR) try {
|
|
480
483
|
mkdirSync(process.env.BENCH_ARTIFACT_DIR, { recursive: true });
|
|
481
|
-
const safe = `${adapter.
|
|
484
|
+
const safe = `${adapter.id}_${task.id}_${uniq}`.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
482
485
|
writeFileSync(`${process.env.BENCH_ARTIFACT_DIR}/${safe}.patch`, artifact);
|
|
483
486
|
} catch {}
|
|
484
487
|
result = {
|
|
485
488
|
artifact,
|
|
486
|
-
ok: turn.outcome.success && artifact.length > 0 && turn.readError === void 0 &&
|
|
489
|
+
ok: turn.outcome.success && artifact.length > 0 && turn.readError === void 0 && workspaceExtractError === void 0,
|
|
487
490
|
execution: result.execution,
|
|
488
|
-
artifactAvailable: turn.readError === void 0 &&
|
|
491
|
+
artifactAvailable: turn.readError === void 0 && workspaceExtractError === void 0,
|
|
489
492
|
usage: result.usage,
|
|
490
493
|
events: observedEvents,
|
|
491
494
|
prompts,
|
|
@@ -561,34 +564,33 @@ function redactJudgeLeak(value) {
|
|
|
561
564
|
}
|
|
562
565
|
function safeFeedback(score) {
|
|
563
566
|
return {
|
|
564
|
-
resolved: score.
|
|
567
|
+
resolved: score.passed === true,
|
|
565
568
|
score: score.score,
|
|
566
|
-
...score.
|
|
569
|
+
...score.notes ? { detail: redactJudgeLeak(parseMaybeJson(score.notes)) } : {}
|
|
567
570
|
};
|
|
568
571
|
}
|
|
569
572
|
function truncate(value, max = 4e3) {
|
|
570
573
|
return value.length <= max ? value : `${value.slice(0, max)}\n...[truncated ${value.length - max} chars]`;
|
|
571
574
|
}
|
|
572
|
-
function retryPrompt(
|
|
573
|
-
const attempts = history.map((h) => {
|
|
574
|
-
const score = scores.get(h.round);
|
|
575
|
-
return [
|
|
576
|
-
`Attempt ${h.round}:`,
|
|
577
|
-
"Artifact:",
|
|
578
|
-
truncate(h.artifact),
|
|
579
|
-
score ? `Checker feedback: ${JSON.stringify(safeFeedback(score))}` : void 0
|
|
580
|
-
].filter(Boolean).join("\n");
|
|
581
|
-
}).join("\n\n");
|
|
575
|
+
function retryPrompt(prompt, history, scores) {
|
|
582
576
|
return [
|
|
583
577
|
"Retry the benchmark task. The previous artifact did not pass the checker.",
|
|
584
578
|
"Use only the original task statement and supplied context. Do not invent facts.",
|
|
585
579
|
"Return the corrected artifact in exactly the format requested by the original task.",
|
|
586
580
|
"",
|
|
587
581
|
"Original task:",
|
|
588
|
-
|
|
582
|
+
prompt,
|
|
589
583
|
"",
|
|
590
584
|
"Previous attempts and safe checker feedback:",
|
|
591
|
-
|
|
585
|
+
history.map((h) => {
|
|
586
|
+
const score = scores.get(h.round);
|
|
587
|
+
return [
|
|
588
|
+
`Attempt ${h.round}:`,
|
|
589
|
+
"Artifact:",
|
|
590
|
+
truncate(h.artifact),
|
|
591
|
+
score ? `Checker feedback: ${JSON.stringify(safeFeedback(score))}` : void 0
|
|
592
|
+
].filter(Boolean).join("\n");
|
|
593
|
+
}).join("\n\n")
|
|
592
594
|
].join("\n");
|
|
593
595
|
}
|
|
594
596
|
async function loopedShot(input, shot, attempts) {
|
|
@@ -599,7 +601,10 @@ async function loopedShot(input, shot, attempts) {
|
|
|
599
601
|
try {
|
|
600
602
|
result = await runRefineLoop({
|
|
601
603
|
rounds: attempts,
|
|
602
|
-
prompt: (round, history) =>
|
|
604
|
+
prompt: (round, history) => {
|
|
605
|
+
const original = input.adapter.runtime.prompt(input.task);
|
|
606
|
+
return round === 1 ? original : retryPrompt(original, history, scores);
|
|
607
|
+
},
|
|
603
608
|
runShot: async (prompt, round) => {
|
|
604
609
|
input.signal?.throwIfAborted();
|
|
605
610
|
pendingShot = true;
|
|
@@ -616,11 +621,11 @@ async function loopedShot(input, shot, attempts) {
|
|
|
616
621
|
};
|
|
617
622
|
},
|
|
618
623
|
judge: async (artifact, round) => {
|
|
619
|
-
const score = await input.adapter.
|
|
624
|
+
const score = await input.adapter.evaluate(input.task, artifact);
|
|
620
625
|
scores.set(round, score);
|
|
621
626
|
const succeeded = shots.get(round)?.ok === true;
|
|
622
627
|
return {
|
|
623
|
-
valid: succeeded && score.
|
|
628
|
+
valid: succeeded && score.passed === true,
|
|
624
629
|
score: succeeded ? score.score : 0
|
|
625
630
|
};
|
|
626
631
|
}
|
|
@@ -653,8 +658,8 @@ async function loopedShot(input, shot, attempts) {
|
|
|
653
658
|
const b = scores.get(candidate.round);
|
|
654
659
|
if (!a) return candidate;
|
|
655
660
|
if (!b) return winner;
|
|
656
|
-
if (b.
|
|
657
|
-
if (b.
|
|
661
|
+
if (b.passed && !a.passed) return candidate;
|
|
662
|
+
if (!!b.passed === !!a.passed && b.score > a.score) return candidate;
|
|
658
663
|
return winner;
|
|
659
664
|
}, result.rounds[0]);
|
|
660
665
|
const bestScore = scores.get(best.round);
|
|
@@ -675,7 +680,7 @@ async function loopedShot(input, shot, attempts) {
|
|
|
675
680
|
rounds: result.rounds.map((round) => ({
|
|
676
681
|
attempt: round.round,
|
|
677
682
|
score: scores.get(round.round)?.score ?? null,
|
|
678
|
-
resolved: scores.get(round.round)?.
|
|
683
|
+
resolved: scores.get(round.round)?.passed ?? null,
|
|
679
684
|
note: round.note ?? null
|
|
680
685
|
}))
|
|
681
686
|
})
|
|
@@ -723,23 +728,23 @@ async function prepareBenchmarks(benchmarks, resolve, opts) {
|
|
|
723
728
|
for (const benchmark of benchmarks) {
|
|
724
729
|
const adapter = resolve(benchmark);
|
|
725
730
|
try {
|
|
726
|
-
await adapter.preflight();
|
|
727
|
-
const tasks = await adapter.
|
|
731
|
+
await adapter.runtime.preflight?.();
|
|
732
|
+
const tasks = await adapter.loadAll({
|
|
728
733
|
...opts.n !== void 0 ? { limit: opts.n } : {},
|
|
729
734
|
...opts.ids ? { ids: opts.ids } : {},
|
|
730
|
-
...opts.
|
|
735
|
+
...opts.subset ? { subset: opts.subset } : {}
|
|
731
736
|
});
|
|
732
737
|
if (tasks.length === 0) {
|
|
733
738
|
unavailable.push({
|
|
734
739
|
benchmark,
|
|
735
|
-
reason: "
|
|
740
|
+
reason: "loadAll returned no tasks"
|
|
736
741
|
});
|
|
737
742
|
continue;
|
|
738
743
|
}
|
|
739
744
|
if (opts.verifyJudge !== false) {
|
|
740
|
-
const gold = await adapter.goldArtifact(tasks[0]);
|
|
745
|
+
const gold = await adapter.runtime.goldArtifact?.(tasks[0]);
|
|
741
746
|
if (gold !== void 0) {
|
|
742
|
-
if (!(await adapter.
|
|
747
|
+
if (!(await adapter.evaluate(tasks[0], gold)).passed) {
|
|
743
748
|
unavailable.push({
|
|
744
749
|
benchmark,
|
|
745
750
|
reason: `judge rejected its own gold on ${tasks[0].id} — judge is miscalibrated`
|
|
@@ -806,13 +811,13 @@ async function runBenchmarks(opts) {
|
|
|
806
811
|
};
|
|
807
812
|
invoked = true;
|
|
808
813
|
out = loopAttempts > 1 ? await loopedShot(shotInput, shot, loopAttempts) : await shot(shotInput);
|
|
809
|
-
const score = await job.adapter.
|
|
814
|
+
const score = await job.adapter.evaluate(job.task, out.artifact);
|
|
810
815
|
result = {
|
|
811
816
|
benchmark: job.benchmark,
|
|
812
817
|
cell: job.cell.label,
|
|
813
818
|
taskId: job.task.id,
|
|
814
819
|
rep: job.rep,
|
|
815
|
-
resolved: out.ok && score.
|
|
820
|
+
resolved: out.ok && score.passed === true,
|
|
816
821
|
score: out.ok ? score.score : 0,
|
|
817
822
|
ok: out.ok,
|
|
818
823
|
execution: out.execution ?? {
|
|
@@ -820,7 +825,7 @@ async function runBenchmarks(opts) {
|
|
|
820
825
|
terminalOutcome: out.ok ? "succeeded" : "unknown"
|
|
821
826
|
},
|
|
822
827
|
measurement: out.artifactAvailable ?? out.ok ? "available" : "unavailable",
|
|
823
|
-
...out.detail ?? score.
|
|
828
|
+
...out.detail ?? score.notes ? { detail: combineDetails(out.detail, score.notes) } : {},
|
|
824
829
|
wallMs: Date.now() - startedAt,
|
|
825
830
|
artifact: out.artifact,
|
|
826
831
|
...out.usage === void 0 ? {} : { usage: out.usage },
|
|
@@ -2043,6 +2048,6 @@ async function runNode(script, input, signal) {
|
|
|
2043
2048
|
child.stdin.end(input);
|
|
2044
2049
|
});
|
|
2045
2050
|
}
|
|
2046
|
-
export { ADAPTERS, FINAL_ANSWER_SENTINEL, FilePierCandidateTrialController, StagedJudgeError,
|
|
2051
|
+
export { ADAPTERS, FINAL_ANSWER_SENTINEL, FilePierCandidateTrialController, StagedJudgeError, answerScoreToEvaluation, contextBlock, contextsFrom, createCragAdapter, createNoMiraclAdapter, createOpenRagBenchAdapter, createPierCandidateRecoveryExecutor, createPierResultGrader, createRagBenchAdapter, createSweBenchAdapter, createT2RagBenchAdapter, executePreparedPierCandidate, normalizeAnswer, parseCitations, parseFinalAnswer, printBenchmarksReport, ragAnswerOutput, resolveAdapter, runBenchmarks, runStagedJudge, runtimeBenchmark, scoreAnswerArtifact, scoreSweReport, sweEvaluationArgv, swePatchOutput, tokenF1 };
|
|
2047
2052
|
|
|
2048
2053
|
//# sourceMappingURL=index.js.map
|