@tangle-network/agent-bench 0.4.1 → 0.4.3
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 +9 -0
- package/dist/adapters.d.ts +4 -11
- package/dist/adapters.js +78 -41
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +48 -66
- package/dist/benchmarks/_harness.js +329 -33
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +4 -25
- package/dist/benchmarks/aec-bench.js +242 -7
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +5 -13
- package/dist/benchmarks/agentbench.js +114 -9
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +9 -29
- package/dist/benchmarks/appworld.js +317 -12
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +5 -15
- package/dist/benchmarks/bfcl.js +264 -9
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +16 -41
- package/dist/benchmarks/cad-design.js +512 -6
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +4 -17
- package/dist/benchmarks/cadbench.js +2 -8
- package/dist/benchmarks/cadgenbench.d.ts +4 -20
- package/dist/benchmarks/cadgenbench.js +2 -8
- package/dist/benchmarks/commit0.d.ts +5 -27
- package/dist/benchmarks/commit0.js +187 -9
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +4 -12
- package/dist/benchmarks/crag.js +110 -8
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +5 -15
- package/dist/benchmarks/dabstep.js +177 -9
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +5 -34
- package/dist/benchmarks/enterpriseops-gym.js +236 -9
- package/dist/benchmarks/enterpriseops-gym.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -13
- package/dist/benchmarks/finresearchbench.js +218 -7
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +8 -39
- package/dist/benchmarks/finsearchcomp.js +267 -6
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +15 -37
- package/dist/benchmarks/frames.js +408 -11
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +4 -24
- package/dist/benchmarks/hotpotqa.js +250 -14
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +19 -37
- package/dist/benchmarks/humaneval.js +279 -16
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +7 -34
- package/dist/benchmarks/mind2web.js +257 -8
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +4 -13
- package/dist/benchmarks/nomiracl.js +146 -8
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +4 -12
- package/dist/benchmarks/open-rag-bench.js +110 -8
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +5 -29
- package/dist/benchmarks/programbench.js +161 -9
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +21 -20
- package/dist/benchmarks/rag-shared.js +245 -38
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +4 -14
- package/dist/benchmarks/ragbench.js +127 -8
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +17 -44
- package/dist/benchmarks/simpleqa.js +293 -10
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +23 -36
- package/dist/benchmarks/swe-bench.js +234 -13
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +4 -12
- package/dist/benchmarks/t2-ragbench.js +118 -8
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +14 -22
- package/dist/benchmarks/tau-bench-shared.js +169 -9
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +5 -5
- package/dist/benchmarks/tau2-bench.js +28 -10
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +4 -13
- package/dist/benchmarks/tau3-banking.js +28 -8
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +4 -22
- package/dist/benchmarks/terminal-bench.js +140 -7
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +5 -13
- package/dist/benchmarks/toollm.js +184 -9
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +4 -30
- package/dist/benchmarks/trata-hedge.js +336 -6
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +85 -94
- package/dist/benchmarks/types.js +1 -1
- package/dist/benchmarks/webarena-verified.d.ts +5 -13
- package/dist/benchmarks/webarena-verified.js +152 -9
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/cadbench-DpQWZHp4.js +285 -0
- package/dist/cadbench-DpQWZHp4.js.map +1 -0
- package/dist/cadgenbench-DRhczfsG.js +151 -0
- package/dist/cadgenbench-DRhczfsG.js.map +1 -0
- package/dist/index.d.ts +245 -293
- package/dist/index.js +1669 -1791
- package/dist/index.js.map +1 -1
- package/package.json +17 -14
- package/scripts/verify-packed-consumer.mjs +20 -17
- package/src/corpus.test.mts +13 -0
- package/src/corpus.ts +4 -0
- package/src/profile-coordinates.ts +2 -2
- package/src/rollout-ledger/backfill-swe-arena.mts +5 -1
- package/src/rollout-ledger/settle-capture.mts +7 -1
- package/src/search-bench/profiles.ts +1 -1
- package/src/skill-sandbox-smoke.mts +2 -1
- package/src/swe-arena/gepa-seat.mts +1 -1
- package/src/swe-arena/ledger-orphans.test.mts +36 -34
- package/dist/benchmarks/cadbench.js.map +0 -1
- package/dist/benchmarks/cadgenbench.js.map +0 -1
- package/dist/benchmarks/types.js.map +0 -1
- package/dist/chunk-53UPUNBZ.js +0 -325
- package/dist/chunk-53UPUNBZ.js.map +0 -1
- package/dist/chunk-5FEQDSCT.js +0 -211
- package/dist/chunk-5FEQDSCT.js.map +0 -1
- package/dist/chunk-5H5XV76F.js +0 -240
- package/dist/chunk-5H5XV76F.js.map +0 -1
- package/dist/chunk-67ACKDCX.js +0 -118
- package/dist/chunk-67ACKDCX.js.map +0 -1
- package/dist/chunk-7FKBWOQT.js +0 -147
- package/dist/chunk-7FKBWOQT.js.map +0 -1
- package/dist/chunk-BEN6IF2X.js +0 -221
- package/dist/chunk-BEN6IF2X.js.map +0 -1
- package/dist/chunk-BZY5QARD.js +0 -120
- package/dist/chunk-BZY5QARD.js.map +0 -1
- package/dist/chunk-C7T7WEK2.js +0 -103
- package/dist/chunk-C7T7WEK2.js.map +0 -1
- package/dist/chunk-CLIKAXKH.js +0 -276
- package/dist/chunk-CLIKAXKH.js.map +0 -1
- package/dist/chunk-CWIOBFSP.js +0 -197
- package/dist/chunk-CWIOBFSP.js.map +0 -1
- package/dist/chunk-CXDUTWQE.js +0 -318
- package/dist/chunk-CXDUTWQE.js.map +0 -1
- package/dist/chunk-DWALFME7.js +0 -182
- package/dist/chunk-DWALFME7.js.map +0 -1
- package/dist/chunk-EEOC6QPJ.js +0 -144
- package/dist/chunk-EEOC6QPJ.js.map +0 -1
- package/dist/chunk-EIETHPD5.js +0 -321
- package/dist/chunk-EIETHPD5.js.map +0 -1
- package/dist/chunk-GC2EPS6L.js +0 -130
- package/dist/chunk-GC2EPS6L.js.map +0 -1
- package/dist/chunk-GCHL6XPM.js +0 -169
- package/dist/chunk-GCHL6XPM.js.map +0 -1
- package/dist/chunk-HQ5HCCKF.js +0 -142
- package/dist/chunk-HQ5HCCKF.js.map +0 -1
- package/dist/chunk-HVW25KSX.js +0 -208
- package/dist/chunk-HVW25KSX.js.map +0 -1
- package/dist/chunk-INNOYXCP.js +0 -387
- package/dist/chunk-INNOYXCP.js.map +0 -1
- package/dist/chunk-J6BU3NTM.js +0 -251
- package/dist/chunk-J6BU3NTM.js.map +0 -1
- package/dist/chunk-JSQOUKXS.js +0 -149
- package/dist/chunk-JSQOUKXS.js.map +0 -1
- package/dist/chunk-JTHWEDEW.js +0 -32
- package/dist/chunk-JTHWEDEW.js.map +0 -1
- package/dist/chunk-NRMGT25X.js +0 -116
- package/dist/chunk-NRMGT25X.js.map +0 -1
- package/dist/chunk-PA2ZKHJC.js +0 -230
- package/dist/chunk-PA2ZKHJC.js.map +0 -1
- package/dist/chunk-PUIRNYI7.js +0 -189
- package/dist/chunk-PUIRNYI7.js.map +0 -1
- package/dist/chunk-QZZEAHWJ.js +0 -136
- package/dist/chunk-QZZEAHWJ.js.map +0 -1
- package/dist/chunk-SEVJPLZC.js +0 -260
- package/dist/chunk-SEVJPLZC.js.map +0 -1
- package/dist/chunk-TBKU5XQI.js +0 -228
- package/dist/chunk-TBKU5XQI.js.map +0 -1
- package/dist/chunk-UPAMRDX4.js +0 -233
- package/dist/chunk-UPAMRDX4.js.map +0 -1
- package/dist/chunk-VQRS7VUC.js +0 -342
- package/dist/chunk-VQRS7VUC.js.map +0 -1
- package/dist/chunk-WG7TM7UV.js +0 -30
- package/dist/chunk-WG7TM7UV.js.map +0 -1
- package/dist/chunk-X3BTXCJ4.js +0 -262
- package/dist/chunk-X3BTXCJ4.js.map +0 -1
- package/dist/chunk-XXFF3RRD.js +0 -162
- package/dist/chunk-XXFF3RRD.js.map +0 -1
- package/dist/chunk-ZFNOM7WR.js +0 -27
- package/dist/chunk-ZFNOM7WR.js.map +0 -1
- package/dist/chunk-ZNCCYTFG.js +0 -170
- package/dist/chunk-ZNCCYTFG.js.map +0 -1
package/dist/chunk-EEOC6QPJ.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createToolLlmAdapter
|
|
3
|
-
} from "./chunk-CWIOBFSP.js";
|
|
4
|
-
import {
|
|
5
|
-
createTrataHedgeAdapter
|
|
6
|
-
} from "./chunk-VQRS7VUC.js";
|
|
7
|
-
import {
|
|
8
|
-
createWebArenaVerifiedAdapter
|
|
9
|
-
} from "./chunk-XXFF3RRD.js";
|
|
10
|
-
import {
|
|
11
|
-
createRagBenchAdapter
|
|
12
|
-
} from "./chunk-HQ5HCCKF.js";
|
|
13
|
-
import {
|
|
14
|
-
createSimpleQaAdapter
|
|
15
|
-
} from "./chunk-SEVJPLZC.js";
|
|
16
|
-
import {
|
|
17
|
-
createSweBenchAdapter
|
|
18
|
-
} from "./chunk-J6BU3NTM.js";
|
|
19
|
-
import {
|
|
20
|
-
createT2RagBenchAdapter
|
|
21
|
-
} from "./chunk-GC2EPS6L.js";
|
|
22
|
-
import {
|
|
23
|
-
createTau2BenchAdapter
|
|
24
|
-
} from "./chunk-WG7TM7UV.js";
|
|
25
|
-
import {
|
|
26
|
-
createTau3BankingAdapter
|
|
27
|
-
} from "./chunk-ZFNOM7WR.js";
|
|
28
|
-
import {
|
|
29
|
-
createTerminalBenchAdapter
|
|
30
|
-
} from "./chunk-JSQOUKXS.js";
|
|
31
|
-
import {
|
|
32
|
-
createFramesAdapter
|
|
33
|
-
} from "./chunk-INNOYXCP.js";
|
|
34
|
-
import {
|
|
35
|
-
createHotpotqaAdapter
|
|
36
|
-
} from "./chunk-PA2ZKHJC.js";
|
|
37
|
-
import {
|
|
38
|
-
createHumanEvalAdapter
|
|
39
|
-
} from "./chunk-5H5XV76F.js";
|
|
40
|
-
import {
|
|
41
|
-
createMind2WebAdapter
|
|
42
|
-
} from "./chunk-TBKU5XQI.js";
|
|
43
|
-
import {
|
|
44
|
-
createNoMiraclAdapter
|
|
45
|
-
} from "./chunk-7FKBWOQT.js";
|
|
46
|
-
import {
|
|
47
|
-
createOpenRagBenchAdapter
|
|
48
|
-
} from "./chunk-BZY5QARD.js";
|
|
49
|
-
import {
|
|
50
|
-
createProgrambenchAdapter
|
|
51
|
-
} from "./chunk-QZZEAHWJ.js";
|
|
52
|
-
import {
|
|
53
|
-
createCadBenchAdapter
|
|
54
|
-
} from "./chunk-PUIRNYI7.js";
|
|
55
|
-
import {
|
|
56
|
-
createCadGenBenchAdapter
|
|
57
|
-
} from "./chunk-C7T7WEK2.js";
|
|
58
|
-
import {
|
|
59
|
-
createCommit0Adapter
|
|
60
|
-
} from "./chunk-ZNCCYTFG.js";
|
|
61
|
-
import {
|
|
62
|
-
createCragAdapter
|
|
63
|
-
} from "./chunk-NRMGT25X.js";
|
|
64
|
-
import {
|
|
65
|
-
createDabstepAdapter
|
|
66
|
-
} from "./chunk-DWALFME7.js";
|
|
67
|
-
import {
|
|
68
|
-
createEnterpriseOpsGymAdapter
|
|
69
|
-
} from "./chunk-5FEQDSCT.js";
|
|
70
|
-
import {
|
|
71
|
-
createFinResearchBenchAdapter
|
|
72
|
-
} from "./chunk-HVW25KSX.js";
|
|
73
|
-
import {
|
|
74
|
-
createFinsearchcompAdapter
|
|
75
|
-
} from "./chunk-UPAMRDX4.js";
|
|
76
|
-
import {
|
|
77
|
-
createAecBenchAdapter
|
|
78
|
-
} from "./chunk-BEN6IF2X.js";
|
|
79
|
-
import {
|
|
80
|
-
createAgentBenchAdapter
|
|
81
|
-
} from "./chunk-67ACKDCX.js";
|
|
82
|
-
import {
|
|
83
|
-
createAppWorldAdapter,
|
|
84
|
-
createAppWorldReactAdapter
|
|
85
|
-
} from "./chunk-CXDUTWQE.js";
|
|
86
|
-
import {
|
|
87
|
-
createBfclAdapter
|
|
88
|
-
} from "./chunk-CLIKAXKH.js";
|
|
89
|
-
import {
|
|
90
|
-
createCadDesignAdapter
|
|
91
|
-
} from "./chunk-53UPUNBZ.js";
|
|
92
|
-
|
|
93
|
-
// src/adapters.ts
|
|
94
|
-
var ADAPTERS = {
|
|
95
|
-
"swe-bench": createSweBenchAdapter,
|
|
96
|
-
"terminal-bench": createTerminalBenchAdapter,
|
|
97
|
-
// Code-benches sharing ./benchmarks/_harness (stage → external evaluator → report).
|
|
98
|
-
// loadTasks fetches the REAL dataset (committed fixtures fallback offline); judge
|
|
99
|
-
// delegates to the benchmark's own harness and fails loud when it/Docker is absent.
|
|
100
|
-
"aec-bench": createAecBenchAdapter,
|
|
101
|
-
commit0: createCommit0Adapter,
|
|
102
|
-
dabstep: createDabstepAdapter,
|
|
103
|
-
programbench: createProgrambenchAdapter,
|
|
104
|
-
"webarena-verified": createWebArenaVerifiedAdapter,
|
|
105
|
-
"tau2-bench": createTau2BenchAdapter,
|
|
106
|
-
"tau3-banking": createTau3BankingAdapter,
|
|
107
|
-
agentbench: createAgentBenchAdapter,
|
|
108
|
-
bfcl: createBfclAdapter,
|
|
109
|
-
toollm: createToolLlmAdapter,
|
|
110
|
-
appworld: createAppWorldAdapter,
|
|
111
|
-
// AppWorld's native interactive protocol — the worker is the in-engine ReAct
|
|
112
|
-
// episode (execution feedback every turn), the mode published baselines use.
|
|
113
|
-
"appworld-react": createAppWorldReactAdapter,
|
|
114
|
-
"enterpriseops-gym": createEnterpriseOpsGymAdapter,
|
|
115
|
-
"cad-design": createCadDesignAdapter,
|
|
116
|
-
cadbench: createCadBenchAdapter,
|
|
117
|
-
cadgenbench: createCadGenBenchAdapter,
|
|
118
|
-
frames: createFramesAdapter,
|
|
119
|
-
ragbench: createRagBenchAdapter,
|
|
120
|
-
crag: createCragAdapter,
|
|
121
|
-
nomiracl: createNoMiraclAdapter,
|
|
122
|
-
"open-rag-bench": createOpenRagBenchAdapter,
|
|
123
|
-
"t2-ragbench": createT2RagBenchAdapter,
|
|
124
|
-
finresearchbench: createFinResearchBenchAdapter,
|
|
125
|
-
finsearchcomp: createFinsearchcompAdapter,
|
|
126
|
-
simpleqa: createSimpleQaAdapter,
|
|
127
|
-
hotpotqa: createHotpotqaAdapter,
|
|
128
|
-
// Deployable-checker code domain: worker = router completion, judge = Docker test
|
|
129
|
-
// run (--network=none). The steering A/B counterpart to humaneval-gate.mts (selection).
|
|
130
|
-
humaneval: createHumanEvalAdapter,
|
|
131
|
-
mind2web: createMind2WebAdapter,
|
|
132
|
-
"trata-hedge": createTrataHedgeAdapter
|
|
133
|
-
};
|
|
134
|
-
function resolveAdapter(key) {
|
|
135
|
-
const make = ADAPTERS[key];
|
|
136
|
-
if (!make) throw new Error(`unknown benchmark ${JSON.stringify(key)} (have: ${Object.keys(ADAPTERS).join(", ")})`);
|
|
137
|
-
return make();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export {
|
|
141
|
-
ADAPTERS,
|
|
142
|
-
resolveAdapter
|
|
143
|
-
};
|
|
144
|
-
//# sourceMappingURL=chunk-EEOC6QPJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters.ts"],"sourcesContent":["/**\n * The benchmark registry — the single source of truth for every wired benchmark.\n * One key per benchmark; the value is its `BenchmarkAdapter` factory. `runBenchmarks`\n * (the unifier) maps over this; `run.ts`, `rsi.ts`, and `corpus-replay.mts` all read it\n * here rather than each keeping their own copy.\n */\n\nimport { createAecBenchAdapter } from './benchmarks/aec-bench'\nimport { createAgentBenchAdapter } from './benchmarks/agentbench'\nimport { createAppWorldAdapter, createAppWorldReactAdapter } from './benchmarks/appworld'\nimport { createBfclAdapter } from './benchmarks/bfcl'\nimport { createCadBenchAdapter } from './benchmarks/cadbench'\nimport { createCadDesignAdapter } from './benchmarks/cad-design'\nimport { createCadGenBenchAdapter } from './benchmarks/cadgenbench'\nimport { createCommit0Adapter } from './benchmarks/commit0'\nimport { createCragAdapter } from './benchmarks/crag'\nimport { createDabstepAdapter } from './benchmarks/dabstep'\nimport { createEnterpriseOpsGymAdapter } from './benchmarks/enterpriseops-gym'\nimport { createFinResearchBenchAdapter } from './benchmarks/finresearchbench'\nimport { createFinsearchcompAdapter } from './benchmarks/finsearchcomp'\nimport { createFramesAdapter } from './benchmarks/frames'\nimport { createHotpotqaAdapter } from './benchmarks/hotpotqa'\nimport { createHumanEvalAdapter } from './benchmarks/humaneval'\nimport { createMind2WebAdapter } from './benchmarks/mind2web'\nimport { createNoMiraclAdapter } from './benchmarks/nomiracl'\nimport { createOpenRagBenchAdapter } from './benchmarks/open-rag-bench'\nimport { createProgrambenchAdapter } from './benchmarks/programbench'\nimport { createRagBenchAdapter } from './benchmarks/ragbench'\nimport { createSimpleQaAdapter } from './benchmarks/simpleqa'\nimport { createSweBenchAdapter } from './benchmarks/swe-bench'\nimport { createT2RagBenchAdapter } from './benchmarks/t2-ragbench'\nimport { createTau2BenchAdapter } from './benchmarks/tau2-bench'\nimport { createTau3BankingAdapter } from './benchmarks/tau3-banking'\nimport { createTerminalBenchAdapter } from './benchmarks/terminal-bench'\nimport { createToolLlmAdapter } from './benchmarks/toollm'\nimport { createTrataHedgeAdapter } from './benchmarks/trata-hedge'\nimport { createWebArenaVerifiedAdapter } from './benchmarks/webarena-verified'\nimport type { BenchmarkAdapter } from './benchmarks/types'\n\nexport const ADAPTERS: Record<string, () => BenchmarkAdapter> = {\n 'swe-bench': createSweBenchAdapter,\n 'terminal-bench': createTerminalBenchAdapter,\n // Code-benches sharing ./benchmarks/_harness (stage → external evaluator → report).\n // loadTasks fetches the REAL dataset (committed fixtures fallback offline); judge\n // delegates to the benchmark's own harness and fails loud when it/Docker is absent.\n 'aec-bench': createAecBenchAdapter,\n commit0: createCommit0Adapter,\n dabstep: createDabstepAdapter,\n programbench: createProgrambenchAdapter,\n 'webarena-verified': createWebArenaVerifiedAdapter,\n 'tau2-bench': createTau2BenchAdapter,\n 'tau3-banking': createTau3BankingAdapter,\n agentbench: createAgentBenchAdapter,\n bfcl: createBfclAdapter,\n toollm: createToolLlmAdapter,\n appworld: createAppWorldAdapter,\n // AppWorld's native interactive protocol — the worker is the in-engine ReAct\n // episode (execution feedback every turn), the mode published baselines use.\n 'appworld-react': createAppWorldReactAdapter,\n 'enterpriseops-gym': createEnterpriseOpsGymAdapter,\n 'cad-design': createCadDesignAdapter,\n cadbench: createCadBenchAdapter,\n cadgenbench: createCadGenBenchAdapter,\n frames: createFramesAdapter,\n ragbench: createRagBenchAdapter,\n crag: createCragAdapter,\n nomiracl: createNoMiraclAdapter,\n 'open-rag-bench': createOpenRagBenchAdapter,\n 't2-ragbench': createT2RagBenchAdapter,\n finresearchbench: createFinResearchBenchAdapter,\n finsearchcomp: createFinsearchcompAdapter,\n simpleqa: createSimpleQaAdapter,\n hotpotqa: createHotpotqaAdapter,\n // Deployable-checker code domain: worker = router completion, judge = Docker test\n // run (--network=none). The steering A/B counterpart to humaneval-gate.mts (selection).\n humaneval: createHumanEvalAdapter,\n mind2web: createMind2WebAdapter,\n 'trata-hedge': createTrataHedgeAdapter,\n}\n\n/** Resolve a benchmark key to its adapter, failing loud with the known keys. */\nexport function resolveAdapter(key: string): BenchmarkAdapter {\n const make = ADAPTERS[key]\n if (!make) throw new Error(`unknown benchmark ${JSON.stringify(key)} (have: ${Object.keys(ADAPTERS).join(', ')})`)\n return make()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,IAAM,WAAmD;AAAA,EAC9D,aAAa;AAAA,EACb,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAIlB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,SAAS;AAAA,EACT,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA;AAAA;AAAA,EAGV,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,UAAU;AAAA,EACV,UAAU;AAAA;AAAA;AAAA,EAGV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AACjB;AAGO,SAAS,eAAe,KAA+B;AAC5D,QAAM,OAAO,SAAS,GAAG;AACzB,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,qBAAqB,KAAK,UAAU,GAAG,CAAC,WAAW,OAAO,KAAK,QAAQ,EAAE,KAAK,IAAI,CAAC,GAAG;AACjH,SAAO,KAAK;AACd;","names":[]}
|
package/dist/chunk-EIETHPD5.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
// src/benchmarks/_harness.ts
|
|
2
|
-
import { execFile, spawn } from "child_process";
|
|
3
|
-
import { createHash } from "crypto";
|
|
4
|
-
import { existsSync, readFileSync } from "fs";
|
|
5
|
-
import {
|
|
6
|
-
cp,
|
|
7
|
-
lstat,
|
|
8
|
-
mkdir,
|
|
9
|
-
mkdtemp,
|
|
10
|
-
readFile,
|
|
11
|
-
readlink,
|
|
12
|
-
readdir,
|
|
13
|
-
rename,
|
|
14
|
-
rm,
|
|
15
|
-
writeFile
|
|
16
|
-
} from "fs/promises";
|
|
17
|
-
import { tmpdir } from "os";
|
|
18
|
-
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
19
|
-
import { fileURLToPath } from "url";
|
|
20
|
-
import { promisify } from "util";
|
|
21
|
-
var execFileAsync = promisify(execFile);
|
|
22
|
-
function resolveBenchRoot(moduleUrl) {
|
|
23
|
-
let current = dirname(fileURLToPath(moduleUrl));
|
|
24
|
-
while (true) {
|
|
25
|
-
const manifestPath = join(current, "package.json");
|
|
26
|
-
if (existsSync(manifestPath)) {
|
|
27
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
28
|
-
if (manifest.name === "@tangle-network/agent-bench") return current;
|
|
29
|
-
}
|
|
30
|
-
const parent = dirname(current);
|
|
31
|
-
if (parent === current) {
|
|
32
|
-
throw new Error(`Unable to locate @tangle-network/agent-bench from ${moduleUrl}`);
|
|
33
|
-
}
|
|
34
|
-
current = parent;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
var benchRoot = resolveBenchRoot(import.meta.url);
|
|
38
|
-
function resolveBenchPython(env = process.env, root = benchRoot) {
|
|
39
|
-
const configured = env.AGENT_BENCH_PYTHON;
|
|
40
|
-
if (configured === void 0) return join(root, ".venv", "bin", "python");
|
|
41
|
-
if (!isAbsolute(configured)) {
|
|
42
|
-
throw new Error("AGENT_BENCH_PYTHON must be an absolute path");
|
|
43
|
-
}
|
|
44
|
-
return configured;
|
|
45
|
-
}
|
|
46
|
-
var venvPython = resolveBenchPython();
|
|
47
|
-
var venvPythonAt = (venvDir) => venvBinAt(venvDir, "python");
|
|
48
|
-
function venvBinAt(venvDir, name) {
|
|
49
|
-
return join(resolve(benchRoot, venvDir), "bin", name);
|
|
50
|
-
}
|
|
51
|
-
var bigBuffer = 1024 * 1024 * 256;
|
|
52
|
-
function venvBin(name) {
|
|
53
|
-
return venvBinAt(".venv", name);
|
|
54
|
-
}
|
|
55
|
-
async function runVenvPython(script, args = [], timeoutMs = 0, python = venvPython) {
|
|
56
|
-
const { stdout } = await execFileAsync(python, ["-c", script, ...args], {
|
|
57
|
-
maxBuffer: bigBuffer,
|
|
58
|
-
timeout: timeoutMs
|
|
59
|
-
});
|
|
60
|
-
return stdout;
|
|
61
|
-
}
|
|
62
|
-
async function preflightVenvImports(opts) {
|
|
63
|
-
const imports = opts.modules.filter((m) => m.length > 0);
|
|
64
|
-
const lines = [...imports.map((m) => `import ${m}`)];
|
|
65
|
-
if (opts.requireDocker) lines.push("import docker", "docker.from_env().ping()");
|
|
66
|
-
lines.push("print('ok')");
|
|
67
|
-
try {
|
|
68
|
-
await runVenvPython(lines.join("\n"), [], 0, opts.python ?? venvPython);
|
|
69
|
-
} catch (err) {
|
|
70
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
71
|
-
throw new Error(`${msg}
|
|
72
|
-
${opts.fix}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function runVenvScriptStdin(scriptPath, args, input, opts = {}) {
|
|
76
|
-
return new Promise((resolve2, reject) => {
|
|
77
|
-
const child = spawn(opts.python ?? venvPython, [scriptPath, ...args], {
|
|
78
|
-
cwd: opts.cwd ?? benchRoot,
|
|
79
|
-
...opts.timeoutMs ? { timeout: opts.timeoutMs } : {}
|
|
80
|
-
});
|
|
81
|
-
let stdout = "";
|
|
82
|
-
let stderr = "";
|
|
83
|
-
let bytes = 0;
|
|
84
|
-
child.stdout.on("data", (c) => {
|
|
85
|
-
bytes += c.length;
|
|
86
|
-
if (bytes <= bigBuffer) stdout += c.toString("utf8");
|
|
87
|
-
});
|
|
88
|
-
child.stderr.on("data", (c) => {
|
|
89
|
-
stderr += c.toString("utf8");
|
|
90
|
-
});
|
|
91
|
-
child.on("error", (err) => reject(err));
|
|
92
|
-
child.on("close", (code) => {
|
|
93
|
-
if (code === 0) resolve2(stdout);
|
|
94
|
-
else reject(new Error((stderr || stdout || `exit ${code}`).slice(0, 1500)));
|
|
95
|
-
});
|
|
96
|
-
child.stdin.end(input);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
var StagedJudgeError = class extends Error {
|
|
100
|
-
judgeArtifacts;
|
|
101
|
-
constructor(message, judgeArtifacts, options) {
|
|
102
|
-
super(message, options);
|
|
103
|
-
this.name = "StagedJudgeError";
|
|
104
|
-
this.judgeArtifacts = judgeArtifacts;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
function sha256(bytes) {
|
|
108
|
-
return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
109
|
-
}
|
|
110
|
-
function portablePath(path) {
|
|
111
|
-
return path.split(sep).join("/");
|
|
112
|
-
}
|
|
113
|
-
function compareText(left, right) {
|
|
114
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
115
|
-
}
|
|
116
|
-
async function collectArtifactFiles(root, current) {
|
|
117
|
-
const absolute = join(root, current);
|
|
118
|
-
const entries = await readdir(absolute, { withFileTypes: true });
|
|
119
|
-
const files = [];
|
|
120
|
-
for (const entry of entries.sort((left, right) => compareText(left.name, right.name))) {
|
|
121
|
-
const relativePath = join(current, entry.name);
|
|
122
|
-
const path = join(root, relativePath);
|
|
123
|
-
if (entry.isDirectory()) {
|
|
124
|
-
files.push(...await collectArtifactFiles(root, relativePath));
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
if (entry.isFile()) {
|
|
128
|
-
const bytes = await readFile(path);
|
|
129
|
-
files.push({
|
|
130
|
-
path: portablePath(relativePath),
|
|
131
|
-
byteLength: bytes.byteLength,
|
|
132
|
-
sha256: sha256(bytes),
|
|
133
|
-
kind: "file"
|
|
134
|
-
});
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (entry.isSymbolicLink()) {
|
|
138
|
-
const targetBytes = await readlink(path, { encoding: "buffer" });
|
|
139
|
-
files.push({
|
|
140
|
-
path: portablePath(relativePath),
|
|
141
|
-
byteLength: targetBytes.byteLength,
|
|
142
|
-
sha256: sha256(targetBytes),
|
|
143
|
-
kind: "symlink"
|
|
144
|
-
});
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
throw new Error(`staged judge capture does not support ${relativePath}`);
|
|
148
|
-
}
|
|
149
|
-
return files;
|
|
150
|
-
}
|
|
151
|
-
function isWithin(parent, candidate) {
|
|
152
|
-
const path = relative(parent, candidate);
|
|
153
|
-
return path === "" || !path.startsWith(`..${sep}`) && path !== ".." && !isAbsolute(path);
|
|
154
|
-
}
|
|
155
|
-
async function assertDestinationAbsent(destination) {
|
|
156
|
-
try {
|
|
157
|
-
await lstat(destination);
|
|
158
|
-
} catch (error) {
|
|
159
|
-
if (error.code === "ENOENT") return;
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
throw new Error(`staged judge capture destination already exists: ${destination}`);
|
|
163
|
-
}
|
|
164
|
-
async function captureStagedRun(sourceDirectory, spec, processOutput, evaluatorSucceeded) {
|
|
165
|
-
const source = resolve(sourceDirectory);
|
|
166
|
-
const destination = resolve(spec.destination);
|
|
167
|
-
if (isWithin(source, destination)) {
|
|
168
|
-
throw new Error("staged judge capture destination must be outside the evaluator directory");
|
|
169
|
-
}
|
|
170
|
-
await mkdir(dirname(destination), { recursive: true });
|
|
171
|
-
await assertDestinationAbsent(destination);
|
|
172
|
-
const staging = await mkdtemp(join(dirname(destination), `.${basename(destination)}-capture-`));
|
|
173
|
-
try {
|
|
174
|
-
await cp(source, join(staging, "evaluator"), {
|
|
175
|
-
recursive: true,
|
|
176
|
-
errorOnExist: true,
|
|
177
|
-
force: false,
|
|
178
|
-
preserveTimestamps: true,
|
|
179
|
-
verbatimSymlinks: true
|
|
180
|
-
});
|
|
181
|
-
await mkdir(join(staging, "process"));
|
|
182
|
-
await writeFile(join(staging, "process", "stdout.bin"), processOutput.stdout);
|
|
183
|
-
await writeFile(join(staging, "process", "stderr.bin"), processOutput.stderr);
|
|
184
|
-
const files = [
|
|
185
|
-
...await collectArtifactFiles(staging, "evaluator"),
|
|
186
|
-
...await collectArtifactFiles(staging, "process")
|
|
187
|
-
].sort((left, right) => compareText(left.path, right.path));
|
|
188
|
-
const byteLength = files.reduce((total, file) => total + file.byteLength, 0);
|
|
189
|
-
const treeBytes = Buffer.from(
|
|
190
|
-
files.map((file) => `${file.path}\0${file.kind}\0${file.byteLength}\0${file.sha256}
|
|
191
|
-
`).join(""),
|
|
192
|
-
"utf8"
|
|
193
|
-
);
|
|
194
|
-
const receipt = {
|
|
195
|
-
schema: "agent-bench/judge-artifacts/v1",
|
|
196
|
-
directory: destination,
|
|
197
|
-
evaluatorDirectory: join(destination, "evaluator"),
|
|
198
|
-
manifestPath: join(destination, "receipt.json"),
|
|
199
|
-
evaluatorSucceeded,
|
|
200
|
-
files,
|
|
201
|
-
fileCount: files.length,
|
|
202
|
-
byteLength,
|
|
203
|
-
treeSha256: sha256(treeBytes)
|
|
204
|
-
};
|
|
205
|
-
await writeFile(join(staging, "receipt.json"), `${JSON.stringify(receipt, null, 2)}
|
|
206
|
-
`);
|
|
207
|
-
await rename(staging, destination);
|
|
208
|
-
return receipt;
|
|
209
|
-
} catch (error) {
|
|
210
|
-
await rm(staging, { recursive: true, force: true }).catch(() => {
|
|
211
|
-
});
|
|
212
|
-
throw error;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
function processBytes(value) {
|
|
216
|
-
if (Buffer.isBuffer(value)) return value;
|
|
217
|
-
if (value === void 0 || value === null) return Buffer.alloc(0);
|
|
218
|
-
return Buffer.from(String(value), "utf8");
|
|
219
|
-
}
|
|
220
|
-
async function runStagedJudge(spec) {
|
|
221
|
-
const dir = await mkdtemp(join(tmpdir(), spec.tmpPrefix));
|
|
222
|
-
let stdout = Buffer.alloc(0);
|
|
223
|
-
let stderr = Buffer.alloc(0);
|
|
224
|
-
let evaluatorSucceeded = false;
|
|
225
|
-
let score;
|
|
226
|
-
let failure;
|
|
227
|
-
try {
|
|
228
|
-
try {
|
|
229
|
-
await spec.stage(dir);
|
|
230
|
-
const bin = spec.bin ?? venvPython;
|
|
231
|
-
const argv = spec.argv(dir);
|
|
232
|
-
try {
|
|
233
|
-
const output = await execFileAsync(bin, argv, {
|
|
234
|
-
cwd: spec.cwd ? spec.cwd(dir) : dir,
|
|
235
|
-
encoding: "buffer",
|
|
236
|
-
maxBuffer: bigBuffer,
|
|
237
|
-
...spec.timeoutMs ? { timeout: spec.timeoutMs } : {}
|
|
238
|
-
});
|
|
239
|
-
stdout = processBytes(output.stdout);
|
|
240
|
-
stderr = processBytes(output.stderr);
|
|
241
|
-
evaluatorSucceeded = true;
|
|
242
|
-
} catch (err) {
|
|
243
|
-
const e = err;
|
|
244
|
-
stdout = processBytes(e.stdout);
|
|
245
|
-
stderr = processBytes(e.stderr);
|
|
246
|
-
const detail = processBytes(e.stderr ?? e.stdout ?? e.message ?? String(err)).toString("utf8").slice(0, 2e3);
|
|
247
|
-
throw new Error(`${spec.tmpPrefix.replace(/-$/, "")} evaluator failed (${bin} ${argv.join(" ")}):
|
|
248
|
-
${detail}`);
|
|
249
|
-
}
|
|
250
|
-
score = await spec.parseReport(dir);
|
|
251
|
-
} catch (err) {
|
|
252
|
-
failure = err;
|
|
253
|
-
}
|
|
254
|
-
} finally {
|
|
255
|
-
let judgeArtifacts;
|
|
256
|
-
if (spec.capture) {
|
|
257
|
-
try {
|
|
258
|
-
judgeArtifacts = await captureStagedRun(
|
|
259
|
-
dir,
|
|
260
|
-
spec.capture,
|
|
261
|
-
{ stdout, stderr },
|
|
262
|
-
evaluatorSucceeded
|
|
263
|
-
);
|
|
264
|
-
} catch (captureError) {
|
|
265
|
-
failure = new Error(
|
|
266
|
-
`staged judge failed to capture evaluator artifacts: ${captureError instanceof Error ? captureError.message : captureError}`,
|
|
267
|
-
{ cause: failure ?? captureError }
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (!spec.keepTmp) await rm(dir, { recursive: true, force: true }).catch(() => {
|
|
272
|
-
});
|
|
273
|
-
if (failure) {
|
|
274
|
-
throw new StagedJudgeError(
|
|
275
|
-
failure instanceof Error ? failure.message : String(failure),
|
|
276
|
-
judgeArtifacts,
|
|
277
|
-
{ cause: failure }
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
if (!score) throw new StagedJudgeError("staged judge completed without a score", judgeArtifacts);
|
|
281
|
-
return judgeArtifacts ? { ...score, judgeArtifacts } : score;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
async function readJsonReport(path) {
|
|
285
|
-
let raw;
|
|
286
|
-
try {
|
|
287
|
-
raw = await readFile(path, "utf8");
|
|
288
|
-
} catch (err) {
|
|
289
|
-
throw new Error(`expected report not written: ${path} (${err instanceof Error ? err.message : err})`);
|
|
290
|
-
}
|
|
291
|
-
try {
|
|
292
|
-
return JSON.parse(raw);
|
|
293
|
-
} catch (err) {
|
|
294
|
-
throw new Error(`report not valid JSON at ${path}: ${err instanceof Error ? err.message : err}`);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
async function stageFile(path, content) {
|
|
298
|
-
await writeFile(path, content);
|
|
299
|
-
}
|
|
300
|
-
function safeRunId(prefix, id) {
|
|
301
|
-
return `${prefix}-${id}`.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
export {
|
|
305
|
-
benchRoot,
|
|
306
|
-
resolveBenchPython,
|
|
307
|
-
venvPython,
|
|
308
|
-
venvPythonAt,
|
|
309
|
-
venvBinAt,
|
|
310
|
-
bigBuffer,
|
|
311
|
-
venvBin,
|
|
312
|
-
runVenvPython,
|
|
313
|
-
preflightVenvImports,
|
|
314
|
-
runVenvScriptStdin,
|
|
315
|
-
StagedJudgeError,
|
|
316
|
-
runStagedJudge,
|
|
317
|
-
readJsonReport,
|
|
318
|
-
stageFile,
|
|
319
|
-
safeRunId
|
|
320
|
-
};
|
|
321
|
-
//# sourceMappingURL=chunk-EIETHPD5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/benchmarks/_harness.ts"],"sourcesContent":["/**\n * Shared code-bench harness. The \"stage the artifact → run the benchmark's own\n * evaluator in an external process (mkdtemp / execFile / .venv python / Docker)\n * → read its JSON report → { resolved, score }\" spine that swe-bench,\n * terminal-bench, commit0, programbench and aec-bench all need. Factored out so\n * the Docker/venv/report-reading logic lives in ONE place instead of being\n * copy-pasted per adapter.\n *\n * It owns NO benchmark policy: each adapter passes the argv for its evaluator\n * and a `parseReport` that maps that evaluator's report JSON → a BenchScore. The\n * harness owns process spawning, temp-dir lifecycle, large-buffer/timeout config\n * and fail-loud diagnostics.\n *\n * Fail-loud: an absent .venv / harness / Docker daemon THROWS from `preflight`\n * (the adapter passes the import line + the exact fix). A staged run that exits\n * nonzero throws with the captured stderr — never a fabricated score.\n */\n\nimport { execFile, spawn } from 'node:child_process'\nimport { createHash } from 'node:crypto'\nimport { existsSync, readFileSync } from 'node:fs'\nimport {\n cp,\n lstat,\n mkdir,\n mkdtemp,\n readFile,\n readlink,\n readdir,\n rename,\n rm,\n writeFile,\n} from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { promisify } from 'node:util'\nimport type {\n BenchScore,\n JudgeArtifactFileReceipt,\n JudgeArtifactReceipt,\n} from './types'\n\nconst execFileAsync = promisify(execFile)\n\n/** Locate the package by identity because source files and compiled chunks have different depths. */\nfunction resolveBenchRoot(moduleUrl: string): string {\n let current = dirname(fileURLToPath(moduleUrl))\n while (true) {\n const manifestPath = join(current, 'package.json')\n if (existsSync(manifestPath)) {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: unknown }\n if (manifest.name === '@tangle-network/agent-bench') return current\n }\n const parent = dirname(current)\n if (parent === current) {\n throw new Error(`Unable to locate @tangle-network/agent-bench from ${moduleUrl}`)\n }\n current = parent\n }\n}\n\n/** Package root for agent-bench, so `.venv`, scripts, and fixtures resolve. */\nexport const benchRoot = resolveBenchRoot(import.meta.url)\n\n/** Resolve the shared interpreter without requiring an installed package to contain a venv. */\nexport function resolveBenchPython(\n env: Readonly<{ AGENT_BENCH_PYTHON?: string }> = process.env,\n root: string = benchRoot,\n): string {\n const configured = env.AGENT_BENCH_PYTHON\n if (configured === undefined) return join(root, '.venv', 'bin', 'python')\n if (!isAbsolute(configured)) {\n throw new Error('AGENT_BENCH_PYTHON must be an absolute path')\n }\n return configured\n}\n\n/** The shared interpreter every Python-backed evaluator runs through. */\nexport const venvPython = resolveBenchPython()\n\n/** Interpreter for a NAMED isolated venv (e.g. `.venv-commit0`). Benches whose pip\n * deps conflict with the shared `.venv` (commit0 downgrades pydantic/sqlalchemy)\n * get their own venv and pass its python explicitly — keeping the shared one clean. */\nexport const venvPythonAt = (venvDir: string): string => venvBinAt(venvDir, 'python')\n\n/** Resolve an executable in an isolated venv. Relative venv paths are package-owned;\n * absolute paths allow installed consumers to keep large environments elsewhere. */\nexport function venvBinAt(venvDir: string, name: string): string {\n return join(resolve(benchRoot, venvDir), 'bin', name)\n}\n\n/** Report/transcript reads are large; 256 MiB matches the SWE harness budget. */\nexport const bigBuffer = 1024 * 1024 * 256\n\n/** Path to a named executable inside the bench venv (e.g. `venvBin('tb')`). */\nexport function venvBin(name: string): string {\n return venvBinAt('.venv', name)\n}\n\n/**\n * Run the bench venv python with an inline script (`-c`); return stdout. Throws\n * (with stderr) on a nonzero exit — the loaders rely on this to fail loud rather\n * than parse a partial dump.\n */\nexport async function runVenvPython(\n script: string,\n args: string[] = [],\n timeoutMs = 0,\n python: string = venvPython,\n): Promise<string> {\n const { stdout } = await execFileAsync(python, ['-c', script, ...args], {\n maxBuffer: bigBuffer,\n timeout: timeoutMs,\n })\n return stdout\n}\n\n/**\n * Preflight a python-backed harness: import the module(s) and (optionally) ping\n * Docker, all inside the bench venv. On failure THROWS the captured error joined\n * to the adapter's `fix` guidance — the contract every code-bench preflight wants.\n */\nexport async function preflightVenvImports(opts: {\n /** Module names to `import` (e.g. ['swebench']); '' entries are ignored. */\n modules: string[]\n /** Also `docker.from_env().ping()` — true for Docker-backed evaluators. */\n requireDocker?: boolean\n /** Actionable remediation appended to the thrown message. */\n fix: string\n /** Override the interpreter (e.g. an isolated `.venv-commit0`). Default: shared `.venv`. */\n python?: string\n}): Promise<void> {\n const imports = opts.modules.filter((m) => m.length > 0)\n const lines = [...imports.map((m) => `import ${m}`)]\n if (opts.requireDocker) lines.push('import docker', 'docker.from_env().ping()')\n lines.push(\"print('ok')\")\n try {\n await runVenvPython(lines.join('\\n'), [], 0, opts.python ?? venvPython)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n throw new Error(`${msg}\\n${opts.fix}`)\n }\n}\n\n/**\n * Run a bench-local python driver script (in the bench venv) while piping\n * `input` to its stdin, returning stdout. The driver's verdict JSON is its LAST\n * stdout line; callers parse that and inspect an `error` field (fail loud).\n *\n * Uses spawn + an explicit `stdin.end(input)` rather than promisify(execFile)'s\n * `input` option, because that option is NOT honored by async execFile — stdin\n * is left open and a driver that does `sys.stdin.read()` blocks forever. The\n * artifact-piping judges (commit0, appworld) MUST go through this.\n */\nexport function runVenvScriptStdin(\n scriptPath: string,\n args: string[],\n input: string,\n opts: { cwd?: string; timeoutMs?: number; python?: string } = {},\n): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const child = spawn(opts.python ?? venvPython, [scriptPath, ...args], {\n cwd: opts.cwd ?? benchRoot,\n ...(opts.timeoutMs ? { timeout: opts.timeoutMs } : {}),\n })\n let stdout = ''\n let stderr = ''\n let bytes = 0\n child.stdout.on('data', (c: Buffer) => {\n bytes += c.length\n if (bytes <= bigBuffer) stdout += c.toString('utf8')\n })\n child.stderr.on('data', (c: Buffer) => {\n stderr += c.toString('utf8')\n })\n child.on('error', (err) => reject(err))\n child.on('close', (code) => {\n if (code === 0) resolve(stdout)\n else reject(new Error((stderr || stdout || `exit ${code}`).slice(0, 1500)))\n })\n child.stdin.end(input)\n })\n}\n\nexport interface StagedRunSpec {\n /** mkdtemp prefix, e.g. 'swebench-' / 'commit0-'. */\n tmpPrefix: string\n /**\n * Write the artifact + any harness inputs into the temp dir. Returns nothing;\n * `argv`/`cwd` consume `dir` to point the evaluator at what was written.\n */\n stage(dir: string): Promise<void>\n /** The external evaluator to spawn. `bin` defaults to the bench venv python. */\n bin?: string\n /** argv for the evaluator, computed from the temp `dir`. */\n argv(dir: string): string[]\n /** Working directory for the evaluator. Defaults to the temp `dir`. */\n cwd?(dir: string): string\n /** Hard timeout for the evaluator (ms); 0 = none. */\n timeoutMs?: number\n /**\n * Read the evaluator's report(s) out of `dir` and map to a BenchScore. Throws\n * if the expected report is absent/malformed (fail loud — no default score).\n */\n parseReport(dir: string): Promise<BenchScore>\n /**\n * Copy the complete evaluator directory plus raw process stdout/stderr to this\n * caller-owned directory before cleanup. The destination must not exist.\n */\n capture?: StagedRunCaptureSpec\n /** Keep the temp dir on disk (debugging). Default false → always cleaned up. */\n keepTmp?: boolean\n}\n\nexport interface StagedRunCaptureSpec {\n /** Destination for `evaluator/`, `process/`, and the hashed `receipt.json`. */\n destination: string\n}\n\n/** A staged run failed after any requested evidence was durably retained. */\nexport class StagedJudgeError extends Error {\n readonly judgeArtifacts?: JudgeArtifactReceipt\n\n constructor(message: string, judgeArtifacts?: JudgeArtifactReceipt, options?: ErrorOptions) {\n super(message, options)\n this.name = 'StagedJudgeError'\n this.judgeArtifacts = judgeArtifacts\n }\n}\n\nfunction sha256(bytes: Uint8Array): `sha256:${string}` {\n return `sha256:${createHash('sha256').update(bytes).digest('hex')}`\n}\n\nfunction portablePath(path: string): string {\n return path.split(sep).join('/')\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0\n}\n\nasync function collectArtifactFiles(\n root: string,\n current: string,\n): Promise<JudgeArtifactFileReceipt[]> {\n const absolute = join(root, current)\n const entries = await readdir(absolute, { withFileTypes: true })\n const files: JudgeArtifactFileReceipt[] = []\n for (const entry of entries.sort((left, right) => compareText(left.name, right.name))) {\n const relativePath = join(current, entry.name)\n const path = join(root, relativePath)\n if (entry.isDirectory()) {\n files.push(...await collectArtifactFiles(root, relativePath))\n continue\n }\n if (entry.isFile()) {\n const bytes = await readFile(path)\n files.push({\n path: portablePath(relativePath),\n byteLength: bytes.byteLength,\n sha256: sha256(bytes),\n kind: 'file',\n })\n continue\n }\n if (entry.isSymbolicLink()) {\n const targetBytes = await readlink(path, { encoding: 'buffer' })\n files.push({\n path: portablePath(relativePath),\n byteLength: targetBytes.byteLength,\n sha256: sha256(targetBytes),\n kind: 'symlink',\n })\n continue\n }\n throw new Error(`staged judge capture does not support ${relativePath}`)\n }\n return files\n}\n\nfunction isWithin(parent: string, candidate: string): boolean {\n const path = relative(parent, candidate)\n return path === '' || (!path.startsWith(`..${sep}`) && path !== '..' && !isAbsolute(path))\n}\n\nasync function assertDestinationAbsent(destination: string): Promise<void> {\n try {\n await lstat(destination)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return\n throw error\n }\n throw new Error(`staged judge capture destination already exists: ${destination}`)\n}\n\nasync function captureStagedRun(\n sourceDirectory: string,\n spec: StagedRunCaptureSpec,\n processOutput: Readonly<{ stdout: Buffer; stderr: Buffer }>,\n evaluatorSucceeded: boolean,\n): Promise<JudgeArtifactReceipt> {\n const source = resolve(sourceDirectory)\n const destination = resolve(spec.destination)\n if (isWithin(source, destination)) {\n throw new Error('staged judge capture destination must be outside the evaluator directory')\n }\n await mkdir(dirname(destination), { recursive: true })\n await assertDestinationAbsent(destination)\n const staging = await mkdtemp(join(dirname(destination), `.${basename(destination)}-capture-`))\n try {\n await cp(source, join(staging, 'evaluator'), {\n recursive: true,\n errorOnExist: true,\n force: false,\n preserveTimestamps: true,\n verbatimSymlinks: true,\n })\n await mkdir(join(staging, 'process'))\n await writeFile(join(staging, 'process', 'stdout.bin'), processOutput.stdout)\n await writeFile(join(staging, 'process', 'stderr.bin'), processOutput.stderr)\n\n const files = [\n ...await collectArtifactFiles(staging, 'evaluator'),\n ...await collectArtifactFiles(staging, 'process'),\n ].sort((left, right) => compareText(left.path, right.path))\n const byteLength = files.reduce((total, file) => total + file.byteLength, 0)\n const treeBytes = Buffer.from(\n files\n .map((file) => `${file.path}\\0${file.kind}\\0${file.byteLength}\\0${file.sha256}\\n`)\n .join(''),\n 'utf8',\n )\n const receipt: JudgeArtifactReceipt = {\n schema: 'agent-bench/judge-artifacts/v1',\n directory: destination,\n evaluatorDirectory: join(destination, 'evaluator'),\n manifestPath: join(destination, 'receipt.json'),\n evaluatorSucceeded,\n files,\n fileCount: files.length,\n byteLength,\n treeSha256: sha256(treeBytes),\n }\n await writeFile(join(staging, 'receipt.json'), `${JSON.stringify(receipt, null, 2)}\\n`)\n await rename(staging, destination)\n return receipt\n } catch (error) {\n await rm(staging, { recursive: true, force: true }).catch(() => {})\n throw error\n }\n}\n\nfunction processBytes(value: unknown): Buffer {\n if (Buffer.isBuffer(value)) return value\n if (value === undefined || value === null) return Buffer.alloc(0)\n return Buffer.from(String(value), 'utf8')\n}\n\n/**\n * The shared judge body: mkdtemp → stage → spawn evaluator → parseReport →\n * cleanup. The evaluator's stdout/stderr is surfaced on failure; the temp dir is\n * always removed in `finally` unless `keepTmp`.\n */\nexport async function runStagedJudge(spec: StagedRunSpec): Promise<BenchScore> {\n const dir = await mkdtemp(join(tmpdir(), spec.tmpPrefix))\n let stdout: Buffer<ArrayBufferLike> = Buffer.alloc(0)\n let stderr: Buffer<ArrayBufferLike> = Buffer.alloc(0)\n let evaluatorSucceeded = false\n let score: BenchScore | undefined\n let failure: unknown\n try {\n try {\n await spec.stage(dir)\n const bin = spec.bin ?? venvPython\n const argv = spec.argv(dir)\n try {\n const output = await execFileAsync(bin, argv, {\n cwd: spec.cwd ? spec.cwd(dir) : dir,\n encoding: 'buffer',\n maxBuffer: bigBuffer,\n ...(spec.timeoutMs ? { timeout: spec.timeoutMs } : {}),\n })\n stdout = processBytes(output.stdout)\n stderr = processBytes(output.stderr)\n evaluatorSucceeded = true\n } catch (err) {\n const e = err as { stderr?: unknown; stdout?: unknown; message?: string }\n stdout = processBytes(e.stdout)\n stderr = processBytes(e.stderr)\n const detail = processBytes(e.stderr ?? e.stdout ?? e.message ?? String(err))\n .toString('utf8')\n .slice(0, 2000)\n throw new Error(`${spec.tmpPrefix.replace(/-$/, '')} evaluator failed (${bin} ${argv.join(' ')}):\\n${detail}`)\n }\n score = await spec.parseReport(dir)\n } catch (err) {\n failure = err\n }\n } finally {\n let judgeArtifacts: JudgeArtifactReceipt | undefined\n if (spec.capture) {\n try {\n judgeArtifacts = await captureStagedRun(\n dir,\n spec.capture,\n { stdout, stderr },\n evaluatorSucceeded,\n )\n } catch (captureError) {\n failure = new Error(\n `staged judge failed to capture evaluator artifacts: ${captureError instanceof Error ? captureError.message : captureError}`,\n { cause: failure ?? captureError },\n )\n }\n }\n if (!spec.keepTmp) await rm(dir, { recursive: true, force: true }).catch(() => {})\n if (failure) {\n throw new StagedJudgeError(\n failure instanceof Error ? failure.message : String(failure),\n judgeArtifacts,\n { cause: failure },\n )\n }\n if (!score) throw new StagedJudgeError('staged judge completed without a score', judgeArtifacts)\n return judgeArtifacts ? { ...score, judgeArtifacts } : score\n }\n}\n\n/** Read + JSON.parse a report file from a staged run; throws with the path on failure. */\nexport async function readJsonReport<T>(path: string): Promise<T> {\n let raw: string\n try {\n raw = await readFile(path, 'utf8')\n } catch (err) {\n throw new Error(`expected report not written: ${path} (${err instanceof Error ? err.message : err})`)\n }\n try {\n return JSON.parse(raw) as T\n } catch (err) {\n throw new Error(`report not valid JSON at ${path}: ${err instanceof Error ? err.message : err}`)\n }\n}\n\n/** Write a UTF-8 file into a staged dir (artifact / preds.json / attempt.sh / …). */\nexport async function stageFile(path: string, content: string): Promise<void> {\n await writeFile(path, content)\n}\n\n/** Sanitize an instance id into a filesystem/run-id-safe token. */\nexport function safeRunId(prefix: string, id: string): string {\n return `${prefix}-${id}`.replace(/[^a-zA-Z0-9_.-]/g, '_')\n}\n"],"mappings":";AAkBA,SAAS,UAAU,aAAa;AAChC,SAAS,kBAAkB;AAC3B,SAAS,YAAY,oBAAoB;AACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,UAAU,SAAS,YAAY,MAAM,UAAU,SAAS,WAAW;AAC5E,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAO1B,IAAM,gBAAgB,UAAU,QAAQ;AA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ER_SENTINEL,
|
|
3
|
-
allStrings,
|
|
4
|
-
answerScoreToBenchScore,
|
|
5
|
-
contextBlock,
|
|
6
|
-
contextsFrom,
|
|
7
|
-
firstString,
|
|
8
|
-
isObject,
|
|
9
|
-
ragAnswerOutput,
|
|
10
|
-
readJsonRows,
|
|
11
|
-
scoreAnswerArtifact,
|
|
12
|
-
selectTasks,
|
|
13
|
-
stringFrom
|
|
14
|
-
} from "./chunk-X3BTXCJ4.js";
|
|
15
|
-
import {
|
|
16
|
-
benchRoot
|
|
17
|
-
} from "./chunk-EIETHPD5.js";
|
|
18
|
-
|
|
19
|
-
// src/benchmarks/t2-ragbench.ts
|
|
20
|
-
import { readFile } from "fs/promises";
|
|
21
|
-
import { join } from "path";
|
|
22
|
-
var FIXTURES = join(benchRoot, "fixtures", "t2-ragbench.json");
|
|
23
|
-
var dataFile = () => process.env.T2_RAGBENCH_DATA_FILE;
|
|
24
|
-
function rowToTask(raw, index) {
|
|
25
|
-
if (!isObject(raw)) throw new Error(`T2-RAGBench row ${index} must be an object`);
|
|
26
|
-
const query = firstString(raw, ["question", "query", "prompt"]);
|
|
27
|
-
const goldAnswers = allStrings(raw, [
|
|
28
|
-
"program_answer",
|
|
29
|
-
"original_answer",
|
|
30
|
-
"answer",
|
|
31
|
-
"answers",
|
|
32
|
-
"reference",
|
|
33
|
-
"reference_answer",
|
|
34
|
-
"gold"
|
|
35
|
-
]);
|
|
36
|
-
if (!query) throw new Error(`T2-RAGBench row ${index} missing question/query`);
|
|
37
|
-
if (goldAnswers.length === 0) throw new Error(`T2-RAGBench row ${index} missing answer`);
|
|
38
|
-
const baseContexts = contextsFrom(raw.context).length > 0 ? contextsFrom(raw.context) : contextsFrom(raw.contexts).length > 0 ? contextsFrom(raw.contexts) : contextsFrom(raw.chunks).length > 0 ? contextsFrom(raw.chunks) : contextsFrom(raw.passages);
|
|
39
|
-
const table = stringFrom(raw.table) ?? stringFrom(raw.table_text);
|
|
40
|
-
const contexts = table ? [...baseContexts, { id: "table", title: "Table", text: table }] : baseContexts;
|
|
41
|
-
const subset = stringFrom(raw.subset) ?? stringFrom(raw.dataset) ?? "unknown";
|
|
42
|
-
const documentId = stringFrom(raw.context_id) ?? stringFrom(raw.document_id) ?? stringFrom(raw.doc_id) ?? stringFrom(raw.file_name) ?? "unknown";
|
|
43
|
-
const id = stringFrom(raw.id) ?? stringFrom(raw.qid) ?? stringFrom(raw.query_id) ?? `t2-ragbench-${index}`;
|
|
44
|
-
const meta = {
|
|
45
|
-
benchmark: "t2-ragbench",
|
|
46
|
-
query,
|
|
47
|
-
goldAnswers,
|
|
48
|
-
contexts,
|
|
49
|
-
subset,
|
|
50
|
-
documentId
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
id,
|
|
54
|
-
split: stringFrom(raw.split) ?? subset,
|
|
55
|
-
prompt: [
|
|
56
|
-
"Answer this T2-RAGBench text-and-table financial question.",
|
|
57
|
-
"Do the required numerical reasoning from the supplied context before giving the final value.",
|
|
58
|
-
"End with a single final line: `FINAL ANSWER: <answer>`.",
|
|
59
|
-
"",
|
|
60
|
-
`Question: ${query}`,
|
|
61
|
-
`Document: ${documentId}`,
|
|
62
|
-
`Subset: ${subset}`,
|
|
63
|
-
contexts.length > 0 ? `
|
|
64
|
-
Context:
|
|
65
|
-
${contextBlock(contexts)}` : void 0
|
|
66
|
-
].filter(Boolean).join("\n"),
|
|
67
|
-
metadata: meta
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
function readMeta(task) {
|
|
71
|
-
const md = task.metadata;
|
|
72
|
-
if (!md || !Array.isArray(md.goldAnswers)) {
|
|
73
|
-
throw new Error(`T2-RAGBench task ${task.id} missing metadata \u2014 loadTasks did not populate it`);
|
|
74
|
-
}
|
|
75
|
-
return md;
|
|
76
|
-
}
|
|
77
|
-
async function loadRows(path) {
|
|
78
|
-
const rows = await readJsonRows(path);
|
|
79
|
-
if (rows.length === 0) throw new Error(`T2-RAGBench: no rows in ${path}`);
|
|
80
|
-
return rows;
|
|
81
|
-
}
|
|
82
|
-
async function loadFixtures(opts) {
|
|
83
|
-
const rows = JSON.parse(await readFile(FIXTURES, "utf8"));
|
|
84
|
-
console.warn(`[t2-ragbench] T2_RAGBENCH_FIXTURES=1 \u2014 loading ${rows.length} adapter fixtures`);
|
|
85
|
-
return selectTasks(rows.map(rowToTask), opts, "T2-RAGBench");
|
|
86
|
-
}
|
|
87
|
-
function createT2RagBenchAdapter() {
|
|
88
|
-
const fixturesMode = process.env.T2_RAGBENCH_FIXTURES === "1";
|
|
89
|
-
return {
|
|
90
|
-
name: "t2-ragbench",
|
|
91
|
-
output: ragAnswerOutput,
|
|
92
|
-
async preflight() {
|
|
93
|
-
if (fixturesMode) {
|
|
94
|
-
await readFile(FIXTURES, "utf8");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const path = dataFile();
|
|
98
|
-
if (!path) {
|
|
99
|
-
throw new Error(
|
|
100
|
-
"T2_RAGBENCH_DATA_FILE is required. Fix: export T2-RAGBench rows to JSONL and set T2_RAGBENCH_DATA_FILE=/path/to/t2-ragbench.jsonl, or set T2_RAGBENCH_FIXTURES=1 for adapter plumbing."
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
await loadRows(path);
|
|
104
|
-
},
|
|
105
|
-
async loadTasks(opts = {}) {
|
|
106
|
-
if (fixturesMode) return loadFixtures(opts);
|
|
107
|
-
const path = dataFile();
|
|
108
|
-
if (!path) throw new Error("T2_RAGBENCH_DATA_FILE is required to load T2-RAGBench tasks");
|
|
109
|
-
return selectTasks((await loadRows(path)).map(rowToTask), opts, "T2-RAGBench");
|
|
110
|
-
},
|
|
111
|
-
async goldArtifact(task) {
|
|
112
|
-
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ""}`;
|
|
113
|
-
},
|
|
114
|
-
async judge(task, artifact) {
|
|
115
|
-
const meta = readMeta(task);
|
|
116
|
-
const score = scoreAnswerArtifact(artifact, meta.goldAnswers, { numericTolerance: 0.01 });
|
|
117
|
-
return answerScoreToBenchScore(score, {
|
|
118
|
-
benchmark: meta.benchmark,
|
|
119
|
-
subset: meta.subset,
|
|
120
|
-
documentId: meta.documentId,
|
|
121
|
-
contextCount: meta.contexts.length
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
createT2RagBenchAdapter
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=chunk-GC2EPS6L.js.map
|