@tangle-network/agent-bench 2.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +32 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +62 -51
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +46 -38
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +43 -22
- package/dist/index.js +297 -144
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/pier_agents/candidate_contract.py +226 -74
- package/pier_agents/tangle_candidate.py +79 -1
- package/pier_agents/workspace_boundary.py +29 -1
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/scripts/verify-pier-agent.mts +142 -25
- package/src/adapters.ts +5 -7
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +34 -32
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +78 -73
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +57 -52
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +20 -11
- package/src/pier-agent.ts +108 -38
- package/src/pier-trial-controller.test.mts +48 -1
- package/src/pier-trial-controller.ts +121 -8
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-Byr5gO1M.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -4,6 +4,7 @@ import { tmpdir } from 'node:os'
|
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import { fileURLToPath } from 'node:url'
|
|
6
6
|
import { promisify } from 'node:util'
|
|
7
|
+
import { installAcrossPropagation } from '../../scripts/lib/npm-registry.mjs'
|
|
7
8
|
|
|
8
9
|
const execFileAsync = promisify(execFile)
|
|
9
10
|
const benchDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
@@ -163,12 +164,12 @@ writeFileSync(
|
|
|
163
164
|
)
|
|
164
165
|
await writeFile(
|
|
165
166
|
path.join(consumerDir, 'index.ts'),
|
|
166
|
-
"import { createSweBenchAdapter, executePreparedPierCandidate, FilePierCandidateTrialController, resolveAdapter, runBenchmarks, runStagedJudge, StagedJudgeError, type
|
|
167
|
+
"import { createSweBenchAdapter, executePreparedPierCandidate, FilePierCandidateTrialController, resolveAdapter, runBenchmarks, runStagedJudge, StagedJudgeError, type RuntimeBenchmark, type JudgeArtifactReceipt, type PierCandidateTrialController, type PierCandidateTrialHandle, type PierDockerConnection, type StagedPierCandidateExecution } from '@tangle-network/agent-bench'\n\nconst adapter: RuntimeBenchmark = resolveAdapter('swe-bench')\nconst captureAdapter: RuntimeBenchmark = createSweBenchAdapter({ captureEvaluatorArtifacts: ({ taskId, attemptSequence }) => ({ destination: `/tmp/${taskId}/${attemptSequence}` }) })\nconst receipt = undefined as JudgeArtifactReceipt | undefined\nconst staged = undefined as StagedPierCandidateExecution | undefined\nconst trial = undefined as PierCandidateTrialHandle | undefined\nconst controller = undefined as PierCandidateTrialController | undefined\nconst dockerConnection = undefined as PierDockerConnection | undefined\nvoid adapter\nvoid captureAdapter\nvoid receipt\nvoid staged\nvoid trial\nvoid controller\nvoid dockerConnection\nvoid executePreparedPierCandidate\nvoid FilePierCandidateTrialController\nvoid runBenchmarks\nvoid runStagedJudge\nvoid StagedJudgeError\n",
|
|
167
168
|
)
|
|
168
169
|
await writeFile(
|
|
169
170
|
path.join(consumerDir, 'managed-execution.ts'),
|
|
170
171
|
`import assert from 'node:assert/strict'
|
|
171
|
-
import { runBenchmarks, type BenchExecution, type BenchExecutionContext, type BenchPromptResult } from '@tangle-network/agent-bench'
|
|
172
|
+
import { runBenchmarks, runtimeBenchmark, type BenchExecution, type BenchExecutionContext, type BenchPromptResult } from '@tangle-network/agent-bench'
|
|
172
173
|
|
|
173
174
|
const sessions: Array<string | undefined> = []
|
|
174
175
|
let closed = 0
|
|
@@ -179,11 +180,11 @@ const execute: BenchExecution = async (context: BenchExecutionContext) => {
|
|
|
179
180
|
const report = await runBenchmarks({
|
|
180
181
|
benchmarks: ['fixture'], cells: [{ label: 'worker', model: 'fixture' }],
|
|
181
182
|
routerBaseUrl: 'unused', routerKey: 'unused', verifyJudge: false, execute,
|
|
182
|
-
resolveAdapter: () => ({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
resolveAdapter: () => runtimeBenchmark({
|
|
184
|
+
id: 'fixture',
|
|
185
|
+
loadAll: async () => [{ id: 'task', payload: { prompt: 'initial' } }],
|
|
186
|
+
evaluate: async (_task, artifact) => ({ passed: artifact === 'corrected', score: artifact === 'corrected' ? 1 : 0, raw: {} }),
|
|
187
|
+
runtime: { preflight: async () => {}, goldArtifact: async () => undefined },
|
|
187
188
|
}),
|
|
188
189
|
resolveClient: () => ({
|
|
189
190
|
create: async () => ({
|
|
@@ -211,19 +212,19 @@ assert.deepEqual(report.perTask[0]?.usage, { input: 4, output: 2, costUsd: 0.02
|
|
|
211
212
|
)
|
|
212
213
|
await writeFile(
|
|
213
214
|
path.join(consumerDir, 'index.mjs'),
|
|
214
|
-
"import { resolveAdapter, runBenchmarks } from '@tangle-network/agent-bench'\nimport { ADAPTERS } from '@tangle-network/agent-bench/adapters'\nimport { createCragAdapter } from '@tangle-network/agent-bench/benchmarks/crag'\n\nif (typeof resolveAdapter !== 'function' || typeof runBenchmarks !== 'function') throw new Error('root exports are not executable')\nif (typeof ADAPTERS !== 'object' || typeof createCragAdapter !== 'function') throw new Error('subpath exports are not executable')\nif (resolveAdapter('crag').
|
|
215
|
+
"import { resolveAdapter, runBenchmarks } from '@tangle-network/agent-bench'\nimport { ADAPTERS } from '@tangle-network/agent-bench/adapters'\nimport { createCragAdapter } from '@tangle-network/agent-bench/benchmarks/crag'\n\nif (typeof resolveAdapter !== 'function' || typeof runBenchmarks !== 'function') throw new Error('root exports are not executable')\nif (typeof ADAPTERS !== 'object' || typeof createCragAdapter !== 'function') throw new Error('subpath exports are not executable')\nif (resolveAdapter('crag').id !== 'crag') throw new Error('compiled adapter registry returned the wrong adapter')\nprocess.env.TOOLLM_FIXTURES = '1'\nconst toolLlmTasks = await resolveAdapter('toollm').loadAll({ limit: 1 })\nif (toolLlmTasks.length !== 1 || toolLlmTasks[0]?.id !== '1') throw new Error('packed ToolLLM fixture loading failed')\n",
|
|
215
216
|
)
|
|
216
217
|
await writeFile(
|
|
217
218
|
path.join(consumerDir, 'terminal-bench-absolute-venv.mjs'),
|
|
218
219
|
`import { createTerminalBenchAdapter } from '@tangle-network/agent-bench/benchmarks/terminal-bench'
|
|
219
220
|
|
|
220
221
|
const adapter = createTerminalBenchAdapter()
|
|
221
|
-
const tasks = await adapter.
|
|
222
|
+
const tasks = await adapter.loadAll({ ids: ['installed-absolute-venv'] })
|
|
222
223
|
if (tasks.length !== 1 || tasks[0]?.id !== 'installed-absolute-venv') {
|
|
223
224
|
throw new Error('packed Terminal-Bench adapter did not load through the absolute venv')
|
|
224
225
|
}
|
|
225
|
-
const score = await adapter.
|
|
226
|
-
if (!score.
|
|
226
|
+
const score = await adapter.evaluate(tasks[0], 'echo installed-package-path')
|
|
227
|
+
if (!score.passed || score.score !== 1) {
|
|
227
228
|
throw new Error(\`packed Terminal-Bench adapter did not judge through the absolute venv: \${JSON.stringify(score)}\`)
|
|
228
229
|
}
|
|
229
230
|
`,
|
|
@@ -265,10 +266,12 @@ for name in sorted(expected):
|
|
|
265
266
|
|
|
266
267
|
// Intentionally resolve the declared ranges like a brand-new registry consumer.
|
|
267
268
|
// The preceding frozen install + public typecheck cover the exact bench lockfile.
|
|
268
|
-
await
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
await installAcrossPropagation(() =>
|
|
270
|
+
run(
|
|
271
|
+
'npm',
|
|
272
|
+
['install', '--ignore-scripts', '--no-audit', '--no-fund', '--package-lock=false'],
|
|
273
|
+
consumerDir,
|
|
274
|
+
),
|
|
272
275
|
)
|
|
273
276
|
await run('node', ['index.mjs'], consumerDir)
|
|
274
277
|
await run('node', ['terminal-bench-absolute-venv.mjs'], consumerDir, {
|
|
@@ -280,18 +283,20 @@ for name in sorted(expected):
|
|
|
280
283
|
if (typescript5.stdout.trim() !== `Version ${TYPESCRIPT_5}`) {
|
|
281
284
|
throw new Error(`expected TypeScript ${TYPESCRIPT_5}, received ${typescript5.stdout.trim()}`)
|
|
282
285
|
}
|
|
283
|
-
await
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
await installAcrossPropagation(() =>
|
|
287
|
+
run(
|
|
288
|
+
'npm',
|
|
289
|
+
[
|
|
290
|
+
'install',
|
|
291
|
+
'--ignore-scripts',
|
|
292
|
+
'--no-audit',
|
|
293
|
+
'--no-fund',
|
|
294
|
+
'--no-save',
|
|
295
|
+
'--package-lock=false',
|
|
296
|
+
`typescript@${TYPESCRIPT_6}`,
|
|
297
|
+
],
|
|
298
|
+
consumerDir,
|
|
299
|
+
),
|
|
295
300
|
)
|
|
296
301
|
await run('npm', ['exec', '--', 'tsc', '-p', 'tsconfig.json'], consumerDir)
|
|
297
302
|
const typescript6 = await run('npm', ['exec', '--', 'tsc', '--version'], consumerDir)
|
|
@@ -19,6 +19,7 @@ import { canonicalJson, InMemoryTraceStore } from '@tangle-network/agent-eval'
|
|
|
19
19
|
import {
|
|
20
20
|
sealCandidateBenchmarkSuite,
|
|
21
21
|
sealCandidateBenchmarkTask,
|
|
22
|
+
sealCandidateExperiment,
|
|
22
23
|
} from '@tangle-network/agent-eval/contract'
|
|
23
24
|
import type {
|
|
24
25
|
AgentCandidateArtifactRef,
|
|
@@ -26,6 +27,18 @@ import type {
|
|
|
26
27
|
AgentCandidateWorkspaceSnapshotEvidence,
|
|
27
28
|
Sha256Digest,
|
|
28
29
|
} from '@tangle-network/agent-interface'
|
|
30
|
+
import {
|
|
31
|
+
addSourceText,
|
|
32
|
+
applyKnowledgeWriteBlocks,
|
|
33
|
+
improveKnowledgeBase,
|
|
34
|
+
initKnowledgeBase,
|
|
35
|
+
type KnowledgeImprovementEvaluationInput,
|
|
36
|
+
knowledgeImprovementCandidateRef,
|
|
37
|
+
} from '@tangle-network/agent-knowledge'
|
|
38
|
+
import {
|
|
39
|
+
buildKnowledgeImprovementExperimentBundles,
|
|
40
|
+
captureKnowledgeImprovementCandidatePair,
|
|
41
|
+
} from '@tangle-network/agent-runtime'
|
|
29
42
|
import {
|
|
30
43
|
createAgentCandidateWorkspacePort,
|
|
31
44
|
disposePreparedAgentCandidateExecution,
|
|
@@ -38,8 +51,9 @@ import {
|
|
|
38
51
|
sealAgentCandidateBundle,
|
|
39
52
|
verifyAgentCandidateBundle,
|
|
40
53
|
} from '@tangle-network/agent-runtime/candidate-execution'
|
|
54
|
+
import { executeAgentCandidateExperimentCell } from '@tangle-network/agent-runtime/intelligence'
|
|
41
55
|
|
|
42
|
-
import {
|
|
56
|
+
import { createPierCandidateExecutionOptions } from '../src/pier-agent'
|
|
43
57
|
import { createPierResultGrader } from '../src/pier-result-grader'
|
|
44
58
|
import { FilePierCandidateTrialController } from '../src/pier-trial-controller'
|
|
45
59
|
|
|
@@ -260,6 +274,57 @@ function outputArtifactStore(graderBytes: Uint8Array): {
|
|
|
260
274
|
}
|
|
261
275
|
}
|
|
262
276
|
|
|
277
|
+
async function measuredKnowledge(bundle: AgentCandidateBundle) {
|
|
278
|
+
const root = path.join(scratch, 'curated-knowledge')
|
|
279
|
+
await initKnowledgeBase(root)
|
|
280
|
+
const source = await addSourceText(root, {
|
|
281
|
+
uri: 'inline://release-policy',
|
|
282
|
+
title: 'Release policy',
|
|
283
|
+
text: 'The status must be ready.',
|
|
284
|
+
})
|
|
285
|
+
const update = (directory: string, fact: string) =>
|
|
286
|
+
applyKnowledgeWriteBlocks(directory, `---FILE: knowledge/release-policy.md---
|
|
287
|
+
---
|
|
288
|
+
id: release-policy
|
|
289
|
+
title: Release policy
|
|
290
|
+
sources:
|
|
291
|
+
- ${source.id}
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
${fact}[^${source.id}#all]
|
|
295
|
+
---END FILE---`)
|
|
296
|
+
await update(root, 'The status must be pending.')
|
|
297
|
+
const judge = async ({ candidateRoot }: KnowledgeImprovementEvaluationInput) => {
|
|
298
|
+
const page = readFileSync(path.join(candidateRoot, 'knowledge', 'release-policy.md'), 'utf8')
|
|
299
|
+
const passed = page.includes(source.id) && page.includes('The status must be ready.')
|
|
300
|
+
return {
|
|
301
|
+
score: Number(passed),
|
|
302
|
+
passed,
|
|
303
|
+
provenance: { evaluator: 'fixture-release-policy', version: '1', method: 'deterministic' as const },
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
const result = await improveKnowledgeBase({
|
|
307
|
+
root,
|
|
308
|
+
goal: 'Correct the release policy from its recorded source',
|
|
309
|
+
implementationRef: sha256(Buffer.from(judge.toString())),
|
|
310
|
+
maxCandidates: 1,
|
|
311
|
+
enabledPhases: ['knowledge-update', 'promotion'],
|
|
312
|
+
updateKnowledge: async ({ candidateRoot }) => {
|
|
313
|
+
await update(candidateRoot, 'The status must be ready.')
|
|
314
|
+
return { applied: true, summary: 'Use the recorded status' }
|
|
315
|
+
},
|
|
316
|
+
evaluateDevelopment: judge,
|
|
317
|
+
evaluate: judge,
|
|
318
|
+
})
|
|
319
|
+
return buildKnowledgeImprovementExperimentBundles(
|
|
320
|
+
bundle,
|
|
321
|
+
await captureKnowledgeImprovementCandidatePair({
|
|
322
|
+
root,
|
|
323
|
+
candidate: knowledgeImprovementCandidateRef(result),
|
|
324
|
+
}),
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
263
328
|
try {
|
|
264
329
|
if (!prepareOnly) {
|
|
265
330
|
const pierHead = output('git', ['rev-parse', 'HEAD'], pierRepo)
|
|
@@ -319,10 +384,15 @@ try {
|
|
|
319
384
|
mkdirSync(candidateRoot)
|
|
320
385
|
mkdirSync(profileRoot)
|
|
321
386
|
const instruction = readFileSync(path.join(taskDir, 'instruction.md'), 'utf8')
|
|
322
|
-
const runner = `import pathlib, sys
|
|
387
|
+
const runner = `import json, os, pathlib, sys
|
|
323
388
|
task = pathlib.Path.cwd()
|
|
324
389
|
profile = task / 'AGENTS.md'
|
|
325
390
|
assert profile.is_file() and profile.read_text().strip()
|
|
391
|
+
knowledge = pathlib.Path(os.environ['TANGLE_CANDIDATE_KNOWLEDGE_ROOT'])
|
|
392
|
+
policy = (knowledge / 'knowledge/release-policy.md').read_text()
|
|
393
|
+
assert 'The status must be ready.' in policy
|
|
394
|
+
retrieval = pathlib.Path(os.environ['TANGLE_CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG'])
|
|
395
|
+
assert json.loads(retrieval.read_text()) == {'topK': 2}
|
|
326
396
|
assert sys.argv[-1] == ${JSON.stringify(instruction)}
|
|
327
397
|
${proofArm === 'success' ? "(task / 'src/status.txt').write_text('ready\\nowner=tangle\\n')" : ''}
|
|
328
398
|
`
|
|
@@ -381,7 +451,14 @@ ${proofArm === 'success' ? "(task / 'src/status.txt').write_text('ready\\nowner=
|
|
|
381
451
|
},
|
|
382
452
|
memory: { mode: 'disabled' as const },
|
|
383
453
|
}
|
|
384
|
-
const
|
|
454
|
+
const knowledge = await measuredKnowledge(sealAgentCandidateBundle(bundleWithoutDigest))
|
|
455
|
+
const retrievalConfig = embedded(Buffer.from('{"topK":2}', 'utf8'))
|
|
456
|
+
if (!knowledge.baseline.knowledge || !knowledge.candidate.knowledge)
|
|
457
|
+
throw new Error('Pier proof needs both measured Knowledge snapshots')
|
|
458
|
+
const bundle = sealAgentCandidateBundle({
|
|
459
|
+
...bundleWithoutDigest,
|
|
460
|
+
knowledge: { ...knowledge.candidate.knowledge, retrievalConfig },
|
|
461
|
+
})
|
|
385
462
|
const container: ResolvedAgentCandidateContainer = {
|
|
386
463
|
source: 'evaluator-task-container',
|
|
387
464
|
image: fixtureImage,
|
|
@@ -529,9 +606,9 @@ ${proofArm === 'success' ? "(task / 'src/status.txt').write_text('ready\\nowner=
|
|
|
529
606
|
},
|
|
530
607
|
}
|
|
531
608
|
|
|
532
|
-
const verified = await verifyAgentCandidateBundle(bundle, ports)
|
|
533
|
-
const prepared = await prepareAgentCandidateExecution(verified, task, ports)
|
|
534
609
|
if (prepareOnly) {
|
|
610
|
+
const verified = await verifyAgentCandidateBundle(bundle, ports)
|
|
611
|
+
const prepared = await prepareAgentCandidateExecution(verified, task, ports)
|
|
535
612
|
const disposal = await disposePreparedAgentCandidateExecution(prepared)
|
|
536
613
|
if (disposal.disposed !== true) throw new Error('prepared candidate was not disposed')
|
|
537
614
|
process.stdout.write(
|
|
@@ -647,32 +724,71 @@ ${proofArm === 'success' ? "(task / 'src/status.txt').write_text('ready\\nowner=
|
|
|
647
724
|
}
|
|
648
725
|
},
|
|
649
726
|
})
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
727
|
+
const experiment = sealCandidateExperiment({
|
|
728
|
+
kind: 'agent-candidate-experiment',
|
|
729
|
+
digestAlgorithm: 'rfc8785-sha256',
|
|
730
|
+
baseline: sealAgentCandidateBundle({
|
|
731
|
+
...bundleWithoutDigest,
|
|
732
|
+
profile: { ...bundleWithoutDigest.profile, name: 'pier-control-baseline' },
|
|
733
|
+
knowledge: { ...knowledge.baseline.knowledge, retrievalConfig },
|
|
734
|
+
}),
|
|
735
|
+
candidate: bundle,
|
|
736
|
+
candidateLineage: { source: 'human' },
|
|
737
|
+
benchmark,
|
|
738
|
+
policy: {
|
|
739
|
+
confidenceLevel: 0.95,
|
|
740
|
+
resamples: 500,
|
|
741
|
+
bootstrapSeed: 42,
|
|
742
|
+
deltaThreshold: 0,
|
|
743
|
+
minProductiveRuns: 3,
|
|
744
|
+
budgetUsd: 0,
|
|
745
|
+
criticalDimensions: [],
|
|
746
|
+
regressionTolerance: 0,
|
|
747
|
+
},
|
|
659
748
|
})
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
749
|
+
const evidence = await executeAgentCandidateExperimentCell({
|
|
750
|
+
experiment,
|
|
751
|
+
arm: 'candidate',
|
|
752
|
+
bundle,
|
|
753
|
+
task: benchmarkTask,
|
|
754
|
+
benchmarkCell: { suiteDigest: benchmark.suite.digest, taskIndex: 0, repetition: 0 },
|
|
755
|
+
seed: 42,
|
|
756
|
+
executionId,
|
|
757
|
+
executionRoots: task.executionRoots,
|
|
758
|
+
stagingRoots: task.stagingRoots,
|
|
759
|
+
ports,
|
|
760
|
+
execution: (prepared) =>
|
|
761
|
+
createPierCandidateExecutionOptions({
|
|
762
|
+
prepared,
|
|
763
|
+
directory: path.join(scratch, 'sealed'),
|
|
764
|
+
pierVersion: pinnedPierVersion,
|
|
765
|
+
traceStore,
|
|
766
|
+
claimStore,
|
|
767
|
+
outputArtifacts,
|
|
768
|
+
grader,
|
|
769
|
+
controller,
|
|
770
|
+
}),
|
|
771
|
+
})
|
|
772
|
+
const { materializationReceipt, receipt } = evidence
|
|
663
773
|
if (!acceptedRewards || !acceptedTrialPath) {
|
|
664
774
|
throw new Error('atomic Pier executor returned without accepted verifier evidence')
|
|
665
775
|
}
|
|
776
|
+
const patch = readFileSync(
|
|
777
|
+
path.join(jobsDir, path.dirname(acceptedTrialPath), 'artifacts', 'model.patch'),
|
|
778
|
+
'utf8',
|
|
779
|
+
)
|
|
780
|
+
if (patch.includes('.tangle/knowledge') || patch.includes('The status must be ready.'))
|
|
781
|
+
throw new Error('protected Knowledge leaked into the task patch')
|
|
666
782
|
if (
|
|
667
|
-
|
|
668
|
-
|
|
783
|
+
receipt.benchmarkResult.material.score !== expectedReward ||
|
|
784
|
+
receipt.benchmarkResult.material.passed !== (expectedReward === 1)
|
|
669
785
|
) {
|
|
670
786
|
throw new Error(
|
|
671
|
-
`runtime receipt rejected the official Pier result: ${JSON.stringify(
|
|
787
|
+
`runtime receipt rejected the official Pier result: ${JSON.stringify(receipt.benchmarkResult.material)}`,
|
|
672
788
|
)
|
|
673
789
|
}
|
|
674
790
|
assertTreeOmits(scratch, 'zero-model-proof')
|
|
675
|
-
const usage =
|
|
791
|
+
const usage = receipt.modelSettlement.material.usage
|
|
676
792
|
if (
|
|
677
793
|
usage.modelCalls !== 0 ||
|
|
678
794
|
usage.inputTokens !== 0 ||
|
|
@@ -680,7 +796,7 @@ ${proofArm === 'success' ? "(task / 'src/status.txt').write_text('ready\\nowner=
|
|
|
680
796
|
usage.cachedInputTokens !== 0 ||
|
|
681
797
|
usage.reasoningTokens !== 0 ||
|
|
682
798
|
usage.costUsdNanos !== 0 ||
|
|
683
|
-
|
|
799
|
+
receipt.trace.modelCallCount !== 0
|
|
684
800
|
) {
|
|
685
801
|
throw new Error(`runtime minted nonzero usage for a zero-model run: ${JSON.stringify(usage)}`)
|
|
686
802
|
}
|
|
@@ -703,9 +819,10 @@ ${proofArm === 'success' ? "(task / 'src/status.txt').write_text('ready\\nowner=
|
|
|
703
819
|
manifestDigest: identity.manifestDigest,
|
|
704
820
|
platform,
|
|
705
821
|
},
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
822
|
+
experimentDigest: experiment.digest,
|
|
823
|
+
executionPlanDigest: materializationReceipt.executionPlan.digest,
|
|
824
|
+
materializationReceiptDigest: materializationReceipt.digest,
|
|
825
|
+
runReceiptDigest: receipt.digest,
|
|
709
826
|
trial: acceptedTrialPath,
|
|
710
827
|
},
|
|
711
828
|
null,
|
package/src/adapters.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The benchmark registry — the single source of truth for every wired benchmark.
|
|
3
|
-
* One key per benchmark; the value is its `
|
|
3
|
+
* One key per benchmark; the value is its `RuntimeBenchmark` factory (an agent-eval `BenchmarkAdapter`). `runBenchmarks`
|
|
4
4
|
* (the unifier) maps over this; `run.ts`, `rsi.ts`, and `corpus-replay.mts` all read it
|
|
5
5
|
* here rather than each keeping their own copy.
|
|
6
6
|
*/
|
|
@@ -15,7 +15,6 @@ import { createCadGenBenchAdapter } from './benchmarks/cadgenbench'
|
|
|
15
15
|
import { createCommit0Adapter } from './benchmarks/commit0'
|
|
16
16
|
import { createCragAdapter } from './benchmarks/crag'
|
|
17
17
|
import { createDabstepAdapter } from './benchmarks/dabstep'
|
|
18
|
-
import { createEnterpriseOpsGymAdapter } from './benchmarks/enterpriseops-gym'
|
|
19
18
|
import { createFinResearchBenchAdapter } from './benchmarks/finresearchbench'
|
|
20
19
|
import { createFinsearchcompAdapter } from './benchmarks/finsearchcomp'
|
|
21
20
|
import { createFramesAdapter } from './benchmarks/frames'
|
|
@@ -37,13 +36,13 @@ import { createTerminalBenchAdapter } from './benchmarks/terminal-bench'
|
|
|
37
36
|
import { createToolLlmAdapter } from './benchmarks/toollm'
|
|
38
37
|
import { createTrataHedgeAdapter } from './benchmarks/trata-hedge'
|
|
39
38
|
import { createWebArenaVerifiedAdapter } from './benchmarks/webarena-verified'
|
|
40
|
-
import type {
|
|
39
|
+
import type { RuntimeBenchmark } from './benchmarks/types'
|
|
41
40
|
|
|
42
|
-
export const ADAPTERS: Record<string, () =>
|
|
41
|
+
export const ADAPTERS: Record<string, () => RuntimeBenchmark> = {
|
|
43
42
|
'swe-bench': createSweBenchAdapter,
|
|
44
43
|
'terminal-bench': createTerminalBenchAdapter,
|
|
45
44
|
// Code-benches sharing ./benchmarks/_harness (stage → external evaluator → report).
|
|
46
|
-
//
|
|
45
|
+
// loadAll fetches the REAL dataset (committed fixtures fallback offline); evaluate
|
|
47
46
|
// delegates to the benchmark's own harness and fails loud when it/Docker is absent.
|
|
48
47
|
'aec-bench': createAecBenchAdapter,
|
|
49
48
|
commit0: createCommit0Adapter,
|
|
@@ -59,7 +58,6 @@ export const ADAPTERS: Record<string, () => BenchmarkAdapter> = {
|
|
|
59
58
|
// AppWorld's native interactive protocol — the worker is the in-engine ReAct
|
|
60
59
|
// episode (execution feedback every turn), the mode published baselines use.
|
|
61
60
|
'appworld-react': createAppWorldReactAdapter,
|
|
62
|
-
'enterpriseops-gym': createEnterpriseOpsGymAdapter,
|
|
63
61
|
'cad-design': createCadDesignAdapter,
|
|
64
62
|
// Dimensioned mechanical parts: same OpenSCAD+xvfb judge deps as cad-design, but
|
|
65
63
|
// the spec is metric (bbox / volume / body count / point-in-solid hole probes)
|
|
@@ -90,7 +88,7 @@ export const ADAPTERS: Record<string, () => BenchmarkAdapter> = {
|
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
/** Resolve a benchmark key to its adapter, failing loud with the known keys. */
|
|
93
|
-
export function resolveAdapter(key: string):
|
|
91
|
+
export function resolveAdapter(key: string): RuntimeBenchmark {
|
|
94
92
|
const make = ADAPTERS[key]
|
|
95
93
|
if (!make) throw new Error(`unknown benchmark ${JSON.stringify(key)} (have: ${Object.keys(ADAPTERS).join(', ')})`)
|
|
96
94
|
return make()
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
benchRoot,
|
|
9
9
|
resolveBenchPython,
|
|
10
10
|
runStagedJudge,
|
|
11
|
+
runVenvScriptStdin,
|
|
11
12
|
venvBin,
|
|
12
13
|
venvBinAt,
|
|
13
14
|
} from './_harness'
|
|
@@ -94,7 +95,7 @@ test('runStagedJudge durably captures exact evaluator and process bytes with has
|
|
|
94
95
|
await readFile(join(dir, 'logs/run_evaluation/run/model/task/test_output.txt')),
|
|
95
96
|
perTestBytes,
|
|
96
97
|
)
|
|
97
|
-
return {
|
|
98
|
+
return { passed: true, score: 1, raw: {} }
|
|
98
99
|
},
|
|
99
100
|
})
|
|
100
101
|
|
|
@@ -191,3 +192,19 @@ test('runStagedJudge captures partial evaluator evidence before throwing', async
|
|
|
191
192
|
await rm(scratch, { recursive: true, force: true })
|
|
192
193
|
}
|
|
193
194
|
})
|
|
195
|
+
|
|
196
|
+
test('runVenvScriptStdin reports a driver that exits before reading its input, not the closed pipe', async () => {
|
|
197
|
+
const dir = await mkdtemp(join(tmpdir(), 'stdin-closed-'))
|
|
198
|
+
try {
|
|
199
|
+
const driver = join(dir, 'exits-at-once.mjs')
|
|
200
|
+
await writeFile(driver, "process.stderr.write('engine is not installed'); process.exit(3)\n")
|
|
201
|
+
// Larger than a pipe buffer, so the write is still pending when the driver exits.
|
|
202
|
+
const input = 'x'.repeat(8 * 1024 * 1024)
|
|
203
|
+
await assert.rejects(
|
|
204
|
+
() => runVenvScriptStdin(driver, [], input, { python: process.execPath }),
|
|
205
|
+
/engine is not installed/,
|
|
206
|
+
)
|
|
207
|
+
} finally {
|
|
208
|
+
await rm(dir, { recursive: true, force: true })
|
|
209
|
+
}
|
|
210
|
+
})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared code-bench harness. The "stage the artifact → run the benchmark's own
|
|
3
3
|
* evaluator in an external process (mkdtemp / execFile / .venv python / Docker)
|
|
4
|
-
* → read its JSON report → {
|
|
4
|
+
* → read its JSON report → { passed, score }" spine that swe-bench,
|
|
5
5
|
* terminal-bench, commit0, programbench and aec-bench all need. Factored out so
|
|
6
6
|
* the Docker/venv/report-reading logic lives in ONE place instead of being
|
|
7
7
|
* copy-pasted per adapter.
|
|
8
8
|
*
|
|
9
9
|
* It owns NO benchmark policy: each adapter passes the argv for its evaluator
|
|
10
|
-
* and a `parseReport` that maps that evaluator's report JSON → a
|
|
10
|
+
* and a `parseReport` that maps that evaluator's report JSON → a BenchEvaluation. The
|
|
11
11
|
* harness owns process spawning, temp-dir lifecycle, large-buffer/timeout config
|
|
12
12
|
* and fail-loud diagnostics.
|
|
13
13
|
*
|
|
@@ -36,7 +36,7 @@ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'nod
|
|
|
36
36
|
import { fileURLToPath } from 'node:url'
|
|
37
37
|
import { promisify } from 'node:util'
|
|
38
38
|
import type {
|
|
39
|
-
|
|
39
|
+
BenchEvaluation,
|
|
40
40
|
JudgeArtifactFileReceipt,
|
|
41
41
|
JudgeArtifactReceipt,
|
|
42
42
|
} from './types'
|
|
@@ -175,6 +175,11 @@ export function runVenvScriptStdin(
|
|
|
175
175
|
stderr += c.toString('utf8')
|
|
176
176
|
})
|
|
177
177
|
child.on('error', (err) => reject(err))
|
|
178
|
+
// A driver that exits before reading its input closes the pipe under a pending write. Its
|
|
179
|
+
// exit code and output, read at close, are the failure; the closed pipe is not a second one.
|
|
180
|
+
child.stdin.on('error', (err: NodeJS.ErrnoException) => {
|
|
181
|
+
if (err.code !== 'EPIPE') reject(err)
|
|
182
|
+
})
|
|
178
183
|
child.on('close', (code) => {
|
|
179
184
|
if (code === 0) resolve(stdout)
|
|
180
185
|
else reject(new Error((stderr || stdout || `exit ${code}`).slice(0, 1500)))
|
|
@@ -200,10 +205,10 @@ export interface StagedRunSpec {
|
|
|
200
205
|
/** Hard timeout for the evaluator (ms); 0 = none. */
|
|
201
206
|
timeoutMs?: number
|
|
202
207
|
/**
|
|
203
|
-
* Read the evaluator's report(s) out of `dir` and map to a
|
|
208
|
+
* Read the evaluator's report(s) out of `dir` and map to a BenchEvaluation. Throws
|
|
204
209
|
* if the expected report is absent/malformed (fail loud — no default score).
|
|
205
210
|
*/
|
|
206
|
-
parseReport(dir: string): Promise<
|
|
211
|
+
parseReport(dir: string): Promise<BenchEvaluation>
|
|
207
212
|
/**
|
|
208
213
|
* Copy the complete evaluator directory plus raw process stdout/stderr to this
|
|
209
214
|
* caller-owned directory before cleanup. The destination must not exist.
|
|
@@ -363,12 +368,12 @@ function processBytes(value: unknown): Buffer {
|
|
|
363
368
|
* cleanup. The evaluator's stdout/stderr is surfaced on failure; the temp dir is
|
|
364
369
|
* always removed in `finally` unless `keepTmp`.
|
|
365
370
|
*/
|
|
366
|
-
export async function runStagedJudge(spec: StagedRunSpec): Promise<
|
|
371
|
+
export async function runStagedJudge(spec: StagedRunSpec): Promise<BenchEvaluation> {
|
|
367
372
|
const dir = await mkdtemp(join(tmpdir(), spec.tmpPrefix))
|
|
368
373
|
let stdout: Buffer<ArrayBufferLike> = Buffer.alloc(0)
|
|
369
374
|
let stderr: Buffer<ArrayBufferLike> = Buffer.alloc(0)
|
|
370
375
|
let evaluatorSucceeded = false
|
|
371
|
-
let score:
|
|
376
|
+
let score: BenchEvaluation | undefined
|
|
372
377
|
let failure: unknown
|
|
373
378
|
try {
|
|
374
379
|
try {
|
|
@@ -12,42 +12,42 @@ process.env.AEC_FIXTURES = '1'
|
|
|
12
12
|
|
|
13
13
|
const id = 'electrical/catenary-sag'
|
|
14
14
|
|
|
15
|
-
test('
|
|
15
|
+
test('loadAll (fixtures) yields self-contained tasks with verifier metadata', async () => {
|
|
16
16
|
const a = createAecBenchAdapter()
|
|
17
|
-
const tasks = await a.
|
|
17
|
+
const tasks = await a.loadAll({ ids: [id] })
|
|
18
18
|
assert.equal(tasks.length, 1)
|
|
19
19
|
const t = tasks[0]
|
|
20
20
|
assert.equal(t.id, id)
|
|
21
|
-
assert.equal(t.
|
|
22
|
-
assert.ok(t.prompt.length > 0, 'prompt is the instruction.md')
|
|
21
|
+
assert.equal(t.payload.subset, 'electrical')
|
|
22
|
+
assert.ok(t.payload.prompt.length > 0, 'prompt is the instruction.md')
|
|
23
23
|
const md = t.metadata as Record<string, unknown>
|
|
24
24
|
assert.equal(typeof md.verifyPy, 'string')
|
|
25
25
|
assert.ok((md.verifyPy as string).length > 0)
|
|
26
26
|
assert.equal(typeof md.goldenPassMd, 'string')
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
test('
|
|
29
|
+
test('loadAll limit slices the fixture set', async () => {
|
|
30
30
|
const a = createAecBenchAdapter()
|
|
31
|
-
const tasks = await a.
|
|
31
|
+
const tasks = await a.loadAll({ limit: 1 })
|
|
32
32
|
assert.equal(tasks.length, 1)
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
test('judge: REAL verify.py — gold resolves with full per-field credit', async () => {
|
|
36
36
|
const a = createAecBenchAdapter()
|
|
37
|
-
const [t] = await a.
|
|
38
|
-
const gold = await a.goldArtifact(t)
|
|
37
|
+
const [t] = await a.loadAll({ ids: [id] })
|
|
38
|
+
const gold = await a.runtime.goldArtifact!(t)
|
|
39
39
|
assert.equal(typeof gold, 'string')
|
|
40
|
-
const score = await a.
|
|
41
|
-
assert.equal(score.
|
|
40
|
+
const score = await a.evaluate(t, gold as string)
|
|
41
|
+
assert.equal(score.passed, true)
|
|
42
42
|
assert.equal(score.score, 1)
|
|
43
|
-
const detail = JSON.parse(score.
|
|
43
|
+
const detail = JSON.parse(score.notes as string) as { fields: Record<string, number> }
|
|
44
44
|
for (const v of Object.values(detail.fields)) assert.equal(v, 1)
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
test('judge: REAL verify.py — empty artifact fails closed to 0 (no fabricated score)', async () => {
|
|
48
48
|
const a = createAecBenchAdapter()
|
|
49
|
-
const [t] = await a.
|
|
50
|
-
const score = await a.
|
|
51
|
-
assert.equal(score.
|
|
49
|
+
const [t] = await a.loadAll({ ids: [id] })
|
|
50
|
+
const score = await a.evaluate(t, '')
|
|
51
|
+
assert.equal(score.passed, false)
|
|
52
52
|
assert.equal(score.score, 0)
|
|
53
53
|
})
|