@tangle-network/agent-bench 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +13 -1
  3. package/dist/adapters.d.ts +15 -0
  4. package/dist/adapters.js +43 -0
  5. package/dist/adapters.js.map +1 -0
  6. package/dist/benchmarks/_harness.d.ts +125 -0
  7. package/dist/benchmarks/_harness.js +33 -0
  8. package/dist/benchmarks/_harness.js.map +1 -0
  9. package/dist/benchmarks/aec-bench.d.ts +27 -0
  10. package/dist/benchmarks/aec-bench.js +8 -0
  11. package/dist/benchmarks/aec-bench.js.map +1 -0
  12. package/dist/benchmarks/agentbench.d.ts +16 -0
  13. package/dist/benchmarks/agentbench.js +10 -0
  14. package/dist/benchmarks/agentbench.js.map +1 -0
  15. package/dist/benchmarks/appworld.d.ts +37 -0
  16. package/dist/benchmarks/appworld.js +14 -0
  17. package/dist/benchmarks/appworld.js.map +1 -0
  18. package/dist/benchmarks/bfcl.d.ts +18 -0
  19. package/dist/benchmarks/bfcl.js +10 -0
  20. package/dist/benchmarks/bfcl.js.map +1 -0
  21. package/dist/benchmarks/cad-design.d.ts +45 -0
  22. package/dist/benchmarks/cad-design.js +7 -0
  23. package/dist/benchmarks/cad-design.js.map +1 -0
  24. package/dist/benchmarks/cadbench.d.ts +19 -0
  25. package/dist/benchmarks/cadbench.js +8 -0
  26. package/dist/benchmarks/cadbench.js.map +1 -0
  27. package/dist/benchmarks/cadgenbench.d.ts +22 -0
  28. package/dist/benchmarks/cadgenbench.js +8 -0
  29. package/dist/benchmarks/cadgenbench.js.map +1 -0
  30. package/dist/benchmarks/commit0.d.ts +31 -0
  31. package/dist/benchmarks/commit0.js +10 -0
  32. package/dist/benchmarks/commit0.js.map +1 -0
  33. package/dist/benchmarks/crag.d.ts +14 -0
  34. package/dist/benchmarks/crag.js +9 -0
  35. package/dist/benchmarks/crag.js.map +1 -0
  36. package/dist/benchmarks/dabstep.d.ts +18 -0
  37. package/dist/benchmarks/dabstep.js +10 -0
  38. package/dist/benchmarks/dabstep.js.map +1 -0
  39. package/dist/benchmarks/enterpriseops-gym.d.ts +38 -0
  40. package/dist/benchmarks/enterpriseops-gym.js +10 -0
  41. package/dist/benchmarks/enterpriseops-gym.js.map +1 -0
  42. package/dist/benchmarks/finresearchbench.d.ts +15 -0
  43. package/dist/benchmarks/finresearchbench.js +8 -0
  44. package/dist/benchmarks/finresearchbench.js.map +1 -0
  45. package/dist/benchmarks/finsearchcomp.d.ts +49 -0
  46. package/dist/benchmarks/finsearchcomp.js +7 -0
  47. package/dist/benchmarks/finsearchcomp.js.map +1 -0
  48. package/dist/benchmarks/frames.d.ts +59 -0
  49. package/dist/benchmarks/frames.js +13 -0
  50. package/dist/benchmarks/frames.js.map +1 -0
  51. package/dist/benchmarks/hotpotqa.d.ts +48 -0
  52. package/dist/benchmarks/hotpotqa.js +15 -0
  53. package/dist/benchmarks/hotpotqa.js.map +1 -0
  54. package/dist/benchmarks/humaneval.d.ts +62 -0
  55. package/dist/benchmarks/humaneval.js +17 -0
  56. package/dist/benchmarks/humaneval.js.map +1 -0
  57. package/dist/benchmarks/mind2web.d.ts +41 -0
  58. package/dist/benchmarks/mind2web.js +9 -0
  59. package/dist/benchmarks/mind2web.js.map +1 -0
  60. package/dist/benchmarks/nomiracl.d.ts +15 -0
  61. package/dist/benchmarks/nomiracl.js +9 -0
  62. package/dist/benchmarks/nomiracl.js.map +1 -0
  63. package/dist/benchmarks/open-rag-bench.d.ts +14 -0
  64. package/dist/benchmarks/open-rag-bench.js +9 -0
  65. package/dist/benchmarks/open-rag-bench.js.map +1 -0
  66. package/dist/benchmarks/programbench.d.ts +38 -0
  67. package/dist/benchmarks/programbench.js +10 -0
  68. package/dist/benchmarks/programbench.js.map +1 -0
  69. package/dist/benchmarks/rag-shared.d.ts +42 -0
  70. package/dist/benchmarks/rag-shared.js +39 -0
  71. package/dist/benchmarks/rag-shared.js.map +1 -0
  72. package/dist/benchmarks/ragbench.d.ts +16 -0
  73. package/dist/benchmarks/ragbench.js +9 -0
  74. package/dist/benchmarks/ragbench.js.map +1 -0
  75. package/dist/benchmarks/simpleqa.d.ts +64 -0
  76. package/dist/benchmarks/simpleqa.js +11 -0
  77. package/dist/benchmarks/simpleqa.js.map +1 -0
  78. package/dist/benchmarks/swe-bench.d.ts +56 -0
  79. package/dist/benchmarks/swe-bench.js +14 -0
  80. package/dist/benchmarks/swe-bench.js.map +1 -0
  81. package/dist/benchmarks/t2-ragbench.d.ts +14 -0
  82. package/dist/benchmarks/t2-ragbench.js +9 -0
  83. package/dist/benchmarks/t2-ragbench.js.map +1 -0
  84. package/dist/benchmarks/tau-bench-shared.d.ts +26 -0
  85. package/dist/benchmarks/tau-bench-shared.js +10 -0
  86. package/dist/benchmarks/tau-bench-shared.js.map +1 -0
  87. package/dist/benchmarks/tau2-bench.d.ts +7 -0
  88. package/dist/benchmarks/tau2-bench.js +11 -0
  89. package/dist/benchmarks/tau2-bench.js.map +1 -0
  90. package/dist/benchmarks/tau3-banking.d.ts +15 -0
  91. package/dist/benchmarks/tau3-banking.js +9 -0
  92. package/dist/benchmarks/tau3-banking.js.map +1 -0
  93. package/dist/benchmarks/terminal-bench.d.ts +24 -0
  94. package/dist/benchmarks/terminal-bench.js +8 -0
  95. package/dist/benchmarks/terminal-bench.js.map +1 -0
  96. package/dist/benchmarks/toollm.d.ts +16 -0
  97. package/dist/benchmarks/toollm.js +10 -0
  98. package/dist/benchmarks/toollm.js.map +1 -0
  99. package/dist/benchmarks/trata-hedge.d.ts +32 -0
  100. package/dist/benchmarks/trata-hedge.js +7 -0
  101. package/dist/benchmarks/trata-hedge.js.map +1 -0
  102. package/dist/benchmarks/types.d.ts +107 -0
  103. package/dist/benchmarks/types.js +1 -0
  104. package/dist/benchmarks/types.js.map +1 -0
  105. package/dist/benchmarks/webarena-verified.d.ts +16 -0
  106. package/dist/benchmarks/webarena-verified.js +10 -0
  107. package/dist/benchmarks/webarena-verified.js.map +1 -0
  108. package/dist/chunk-2PVVP7GN.js +197 -0
  109. package/dist/chunk-2PVVP7GN.js.map +1 -0
  110. package/dist/chunk-2XU6OGEN.js +170 -0
  111. package/dist/chunk-2XU6OGEN.js.map +1 -0
  112. package/dist/chunk-53UPUNBZ.js +325 -0
  113. package/dist/chunk-53UPUNBZ.js.map +1 -0
  114. package/dist/chunk-5H5XV76F.js +240 -0
  115. package/dist/chunk-5H5XV76F.js.map +1 -0
  116. package/dist/chunk-7WSD27QQ.js +118 -0
  117. package/dist/chunk-7WSD27QQ.js.map +1 -0
  118. package/dist/chunk-C7T7WEK2.js +103 -0
  119. package/dist/chunk-C7T7WEK2.js.map +1 -0
  120. package/dist/chunk-CKUVRZ2T.js +251 -0
  121. package/dist/chunk-CKUVRZ2T.js.map +1 -0
  122. package/dist/chunk-HBSWHQNJ.js +30 -0
  123. package/dist/chunk-HBSWHQNJ.js.map +1 -0
  124. package/dist/chunk-HHXFIHXC.js +116 -0
  125. package/dist/chunk-HHXFIHXC.js.map +1 -0
  126. package/dist/chunk-IFAV6KEM.js +276 -0
  127. package/dist/chunk-IFAV6KEM.js.map +1 -0
  128. package/dist/chunk-INNOYXCP.js +387 -0
  129. package/dist/chunk-INNOYXCP.js.map +1 -0
  130. package/dist/chunk-J3KDJNX2.js +182 -0
  131. package/dist/chunk-J3KDJNX2.js.map +1 -0
  132. package/dist/chunk-JRWWGMK7.js +148 -0
  133. package/dist/chunk-JRWWGMK7.js.map +1 -0
  134. package/dist/chunk-JTHWEDEW.js +32 -0
  135. package/dist/chunk-JTHWEDEW.js.map +1 -0
  136. package/dist/chunk-KDIKRJGB.js +120 -0
  137. package/dist/chunk-KDIKRJGB.js.map +1 -0
  138. package/dist/chunk-LRRD7NAG.js +301 -0
  139. package/dist/chunk-LRRD7NAG.js.map +1 -0
  140. package/dist/chunk-ODT47UAY.js +221 -0
  141. package/dist/chunk-ODT47UAY.js.map +1 -0
  142. package/dist/chunk-PA2ZKHJC.js +230 -0
  143. package/dist/chunk-PA2ZKHJC.js.map +1 -0
  144. package/dist/chunk-PUIRNYI7.js +189 -0
  145. package/dist/chunk-PUIRNYI7.js.map +1 -0
  146. package/dist/chunk-PWQVGAJB.js +144 -0
  147. package/dist/chunk-PWQVGAJB.js.map +1 -0
  148. package/dist/chunk-R36V2VP7.js +169 -0
  149. package/dist/chunk-R36V2VP7.js.map +1 -0
  150. package/dist/chunk-R67DFVLO.js +142 -0
  151. package/dist/chunk-R67DFVLO.js.map +1 -0
  152. package/dist/chunk-SEVJPLZC.js +260 -0
  153. package/dist/chunk-SEVJPLZC.js.map +1 -0
  154. package/dist/chunk-SYDW647C.js +318 -0
  155. package/dist/chunk-SYDW647C.js.map +1 -0
  156. package/dist/chunk-TBKU5XQI.js +228 -0
  157. package/dist/chunk-TBKU5XQI.js.map +1 -0
  158. package/dist/chunk-TSWPNOYM.js +147 -0
  159. package/dist/chunk-TSWPNOYM.js.map +1 -0
  160. package/dist/chunk-UAIOHCUK.js +27 -0
  161. package/dist/chunk-UAIOHCUK.js.map +1 -0
  162. package/dist/chunk-UPAMRDX4.js +233 -0
  163. package/dist/chunk-UPAMRDX4.js.map +1 -0
  164. package/dist/chunk-VQRS7VUC.js +342 -0
  165. package/dist/chunk-VQRS7VUC.js.map +1 -0
  166. package/dist/chunk-X3BTXCJ4.js +262 -0
  167. package/dist/chunk-X3BTXCJ4.js.map +1 -0
  168. package/dist/chunk-X5YKXC6V.js +211 -0
  169. package/dist/chunk-X5YKXC6V.js.map +1 -0
  170. package/dist/chunk-Y6O2OCUO.js +130 -0
  171. package/dist/chunk-Y6O2OCUO.js.map +1 -0
  172. package/dist/chunk-YCGY7UIZ.js +208 -0
  173. package/dist/chunk-YCGY7UIZ.js.map +1 -0
  174. package/dist/chunk-Z7ML6L77.js +162 -0
  175. package/dist/chunk-Z7ML6L77.js.map +1 -0
  176. package/dist/chunk-ZEWMTR5M.js +136 -0
  177. package/dist/chunk-ZEWMTR5M.js.map +1 -0
  178. package/dist/index.d.ts +355 -0
  179. package/dist/index.js +1908 -0
  180. package/dist/index.js.map +1 -0
  181. package/package.json +26 -9
  182. package/scripts/run-package-tests.mjs +30 -8
  183. package/scripts/verify-packed-consumer.mjs +12 -1
  184. package/scripts/verify-pier-agent.mts +1 -0
  185. package/src/benchmarks/humaneval.test.mts +122 -0
  186. package/src/benchmarks/humaneval.ts +100 -27
  187. package/src/david-attribution.mts +78 -0
  188. package/src/david-goliath.mts +149 -0
  189. package/src/hev-improve.mts +25 -6
  190. package/src/humaneval-object-ablation.mts +201 -0
  191. package/src/live-improve-campaign-mbpp.mts +641 -0
  192. package/src/live-improve-campaign.mts +500 -0
  193. package/src/mbpp-structural.mts +12 -7
  194. package/src/stream-observe.py +45 -0
  195. package/src/stream-observe.tpl.html +247 -0
  196. package/src/supervisor-arena.mts +816 -0
  197. package/src/swe-arena/analyze.ts +211 -0
  198. package/src/swe-arena/arms.ts +788 -0
  199. package/src/swe-arena/bootstrap-meta.mts +188 -0
  200. package/src/swe-arena/bootstrap-meta.test.mts +51 -0
  201. package/src/swe-arena/calibrate.ts +116 -0
  202. package/src/swe-arena/capabilities.mts +76 -0
  203. package/src/swe-arena/capabilities.test.mts +57 -0
  204. package/src/swe-arena/capacity.ts +194 -0
  205. package/src/swe-arena/cell-evidence.mts +405 -0
  206. package/src/swe-arena/cell-evidence.test.mts +248 -0
  207. package/src/swe-arena/diagnosis-ensemble.test.mts +210 -0
  208. package/src/swe-arena/diagnosis-ensemble.ts +520 -0
  209. package/src/swe-arena/execution.test.mts +1170 -0
  210. package/src/swe-arena/fixtures/analyze.py +80 -0
  211. package/src/swe-arena/fixtures/excludes.txt +8 -0
  212. package/src/swe-arena/fixtures/gen1-salvage/README.md +45 -0
  213. package/src/swe-arena/fixtures/gen1-salvage/cand0-e6d7361.diff +116 -0
  214. package/src/swe-arena/fixtures/gen1-salvage/cand1-76a8590.diff +293 -0
  215. package/src/swe-arena/fixtures/holdout-preregister.log +12 -0
  216. package/src/swe-arena/fixtures/holdout.json +44 -0
  217. package/src/swe-arena/fixtures/instances.json +146 -0
  218. package/src/swe-arena/fixtures/ledger.jsonl +12 -0
  219. package/src/swe-arena/fixtures/patches/pallets__flask-5014.solo.patch +36 -0
  220. package/src/swe-arena/fixtures/patches/pydata__xarray-4687.sup.patch +33 -0
  221. package/src/swe-arena/fixtures/rejudge.jsonl +15 -0
  222. package/src/swe-arena/fixtures/rematch.jsonl +3 -0
  223. package/src/swe-arena/fixtures/rematch2.jsonl +3 -0
  224. package/src/swe-arena/fixtures/rematch3.jsonl +3 -0
  225. package/src/swe-arena/fixtures/sup-journal-true.json +19 -0
  226. package/src/swe-arena/fixtures/verify/astropy__astropy-13033.sh +48 -0
  227. package/src/swe-arena/fixtures/verify/django__django-11532.sh +50 -0
  228. package/src/swe-arena/fixtures/verify/matplotlib__matplotlib-20826.sh +76 -0
  229. package/src/swe-arena/fixtures/verify/pydata__xarray-4687.sh +44 -0
  230. package/src/swe-arena/fixtures/verify/pytest-dev__pytest-6197.sh +32 -0
  231. package/src/swe-arena/fixtures/verify/sphinx-doc__sphinx-9658.sh +51 -0
  232. package/src/swe-arena/fixtures/worker-tokens.json +42 -0
  233. package/src/swe-arena/fixtures.ts +104 -0
  234. package/src/swe-arena/holdout-certify.mts +408 -0
  235. package/src/swe-arena/holdout-certify.test.mts +160 -0
  236. package/src/swe-arena/judge-child.mts +37 -0
  237. package/src/swe-arena/manifest.mts +293 -0
  238. package/src/swe-arena/manifest.test.mts +169 -0
  239. package/src/swe-arena/materialize.ts +142 -0
  240. package/src/swe-arena/outer-loop.mts +2145 -0
  241. package/src/swe-arena/outer-loop.test.mts +696 -0
  242. package/src/swe-arena/parity.test.mts +87 -0
  243. package/src/swe-arena/proc.test.mts +174 -0
  244. package/src/swe-arena/proc.ts +260 -0
  245. package/src/swe-arena/profiles/default-author.profile.json +4 -0
  246. package/src/swe-arena/proposer-fanout.mts +489 -0
  247. package/src/swe-arena/proposer-fanout.test.mts +372 -0
  248. package/src/swe-arena/reconcile.ts +0 -0
  249. package/src/swe-arena/replay.mts +183 -0
  250. package/src/swe-arena/replay.test.mts +300 -0
  251. package/src/swe-arena/run-experiment.mts +361 -0
  252. package/src/swe-arena/run-supervisor.mjs +297 -0
  253. package/src/swe-arena/run-supervisor.test.mts +498 -0
  254. package/src/swe-arena/serialized-judge.ts +414 -0
  255. package/src/swe-arena/types.ts +166 -0
  256. package/src/swe-code-improve.mts +328 -0
  257. package/src/swe-emit-patch.mts +104 -0
  258. package/src/swe-improve.mts +232 -0
  259. package/src/swe-jail.ts +2 -2
  260. package/src/swe-local-proof.mts +169 -0
  261. package/src/swe-repro-calibrate.mts +446 -0
  262. package/src/swe-stream.mts +1497 -0
@@ -0,0 +1,355 @@
1
+ export { ADAPTERS, resolveAdapter } from './adapters.js';
2
+ export { createCragAdapter } from './benchmarks/crag.js';
3
+ export { createNoMiraclAdapter } from './benchmarks/nomiracl.js';
4
+ export { createOpenRagBenchAdapter } from './benchmarks/open-rag-bench.js';
5
+ export { createRagBenchAdapter } from './benchmarks/ragbench.js';
6
+ export { FINAL_ANSWER_SENTINEL, RagAnswerScore, RagContext, answerScoreToBenchScore, contextBlock, contextsFrom, normalizeAnswer, parseCitations, parseFinalAnswer, ragAnswerOutput, scoreAnswerArtifact, tokenF1 } from './benchmarks/rag-shared.js';
7
+ export { createT2RagBenchAdapter } from './benchmarks/t2-ragbench.js';
8
+ export { SweBenchAdapterOptions, SweBenchArtifactCaptureContext, SweBenchCacheLevel, createSweBenchAdapter, scoreSweReport, sweEvaluationArgv, swePatchOutput } from './benchmarks/swe-bench.js';
9
+ export { StagedJudgeError, StagedRunCaptureSpec, StagedRunSpec, runStagedJudge } from './benchmarks/_harness.js';
10
+ import { BenchmarkAdapter, BenchTask } from './benchmarks/types.js';
11
+ export { BenchScore, JudgeArtifactFileReceipt, JudgeArtifactReceipt, LoadOptions } from './benchmarks/types.js';
12
+ import { SandboxClient, AgentProfile } from '@tangle-network/agent-runtime/loops';
13
+ import { PreparedAgentCandidateExecution, AgentCandidateExecutionClaimStore, AgentCandidateOutputArtifactPort, AgentCandidateBenchmarkGraderPort, AgentCandidateExecutorRequest, AgentCandidateExecutorStopRequest, AgentCandidateExecutorPort, AgentCandidateRunFinalization } from '@tangle-network/agent-runtime';
14
+ import { TraceStore } from '@tangle-network/agent-eval';
15
+
16
+ /**
17
+ * The ONE harness → worker-client mapping for the bench layer. Every bench entrypoint
18
+ * (rsi.ts, run.ts, …) derives the `SandboxClient` the kernel's `runLoop` drives from a single
19
+ * selector instead of hand-rolling the branch:
20
+ *
21
+ * - `router` → OFF-BOX: a router chat-completion as the leaf executor, presented
22
+ * as a SandboxClient (no sandbox dependency). For deployable-checker
23
+ * domains whose worker is a completion, or where box egress is blocked.
24
+ * - `router` + searchProvider → OFF-BOX `router-tools`: the same off-box loop with a live
25
+ * `web_search` tool (the capability axis research benches need).
26
+ * - `bridge` → OFF-BOX: a local cli-bridge fronting a harness CLI
27
+ * (opencode/kimi-code/…) as the leaf executor. Same resumable
28
+ * `bridgeExecutor` the supervisor uses; harness+model ride the
29
+ * bridge `model` id (`${harness}/${model}`).
30
+ * - anything else (`sandbox`/a BackendType) → IN-BOX: a real `Sandbox`. The in-box backend
31
+ * TYPE (opencode/codex/…) is set separately on the `AgentRunSpec`;
32
+ * this only decides off-box-vs-in-box transport for `runLoop`.
33
+ *
34
+ * Centralizing it here means a new entrypoint gets the full off-box/in-box matrix for free and
35
+ * the mapping can't drift between callers.
36
+ */
37
+
38
+ interface ResolveBenchClientOptions {
39
+ /** The selector (the `BACKEND` env value): `router` = off-box; anything else = in-box Sandbox. */
40
+ backend: string;
41
+ routerBaseUrl: string;
42
+ routerKey: string;
43
+ model: string;
44
+ /** When set on the `router` backend, the off-box worker becomes a `router-tools` agentic loop
45
+ * with a live `web_search` tool backed by this provider (`you`/`exa`/…). */
46
+ searchProvider?: string;
47
+ sandboxBaseUrl?: string;
48
+ /** In-box sandbox timeout (ms). Also the per-turn deadline for the `bridge` backend. */
49
+ timeoutMs?: number;
50
+ /** `bridge` backend: cli-bridge base URL. Defaults to `http://127.0.0.1:3355`. */
51
+ bridgeUrl?: string;
52
+ /** `bridge` backend: bearer the bridge requires. Falls back to `routerKey` when unset. */
53
+ bridgeBearer?: string;
54
+ }
55
+ declare function resolveBenchClient(opts: ResolveBenchClientOptions): SandboxClient;
56
+
57
+ /**
58
+ * `runBenchmarks` — the bench unifier.
59
+ *
60
+ * `gate.ts` runs ONE adapter as a diverse-vs-blind research gate through the recursive atom.
61
+ * This is the other half it references: run a SUBSET of the registry's benchmarks over a MATRIX of
62
+ * agent cells (harness × model × persona), each scored by the benchmark's OWN deterministic judge,
63
+ * and return a ranked leaderboard. It is the "which harness/model/persona combination wins on which
64
+ * benchmark" question, answered over an arbitrary subset in one call.
65
+ *
66
+ * It owns no new mechanism. Each cell is one `openSandboxRun` shot (the same per-run primitive the
67
+ * SWE worker uses) driven by `resolveBenchClient` (off-box router completion OR in-box Sandbox; the
68
+ * harness rides `sandboxOverrides.backend.type`). The deliverable is the adapter's OWN parser
69
+ * (`adapter.output`), defaulting to the final answer text — so `runBenchmarks` needs no
70
+ * per-benchmark branching. Concurrency is the shared `runPool`. The number comes from
71
+ * `adapter.judge`, never a self-authored judge.
72
+ *
73
+ * Subset = the `benchmarks` and `cells` arrays plus `n`/`ids`/`split`. A benchmark whose
74
+ * `preflight()` fails (missing Docker/venv/dataset) is recorded as unavailable and skipped — the
75
+ * sweep never aborts because one bench's harness is absent.
76
+ *
77
+ * const report = await runBenchmarks({
78
+ * benchmarks: ['humaneval', 'swe-bench'],
79
+ * cells: [
80
+ * { label: 'opencode/glm-4.6', model: 'glm-4.6', harness: 'opencode' },
81
+ * { label: 'codex/gpt-5', model: 'gpt-5', harness: 'codex' },
82
+ * ],
83
+ * routerBaseUrl, routerKey, n: 20,
84
+ * })
85
+ */
86
+
87
+ /** One agent under test: a profile (prompt/tools/persona) plus the harness + model that run it. */
88
+ interface BenchCell {
89
+ /** Leaderboard row label, e.g. `opencode/glm-4.6` or `tax-agent@v1`. */
90
+ readonly label: string;
91
+ /** Model id for this cell. */
92
+ readonly model: string;
93
+ /** Coding harness for the in-box path (`opencode`/`codex`/`claude-code`/`kimi-code`). Defaults to
94
+ * `profile.metadata.backendType`, then `opencode`. Ignored on the `router` transport. */
95
+ readonly harness?: string;
96
+ /** Transport: `router` (off-box completion, default), `sandbox`, or a BackendType for in-box. */
97
+ readonly backend?: string;
98
+ /** Web-search provider for the `router` transport (turns the leaf into a `router-tools` loop). */
99
+ readonly searchProvider?: string;
100
+ /** The agent under test. Defaults to a minimal `{ name, metadata.backendType }` profile. */
101
+ readonly profile?: AgentProfile;
102
+ }
103
+ /** Runs one (adapter, task, cell) shot and returns the deliverable text. The default uses
104
+ * `openSandboxRun`; tests inject a deterministic stub so the matrix runs offline. */
105
+ type BenchShot = (input: {
106
+ readonly adapter: BenchmarkAdapter;
107
+ readonly task: BenchTask;
108
+ readonly cell: BenchCell;
109
+ /** Prompt to hand to the worker. Defaults to `task.prompt`; looped runs pass revised prompts. */
110
+ readonly prompt?: string;
111
+ /** 1-based attempt index for looped runs. */
112
+ readonly attempt?: number;
113
+ readonly routerBaseUrl: string;
114
+ readonly routerKey: string;
115
+ readonly bridgeUrl?: string;
116
+ readonly bridgeBearer?: string;
117
+ readonly sandboxBaseUrl?: string;
118
+ readonly timeoutMs?: number;
119
+ readonly resolveClient?: typeof resolveBenchClient;
120
+ }) => Promise<{
121
+ artifact: string;
122
+ ok: boolean;
123
+ detail?: string;
124
+ }>;
125
+ interface RunBenchmarksOptions {
126
+ /** Registry keys (`resolveAdapter`) — the benchmark subset to run. */
127
+ readonly benchmarks: readonly string[];
128
+ /** The agent cells to rank. */
129
+ readonly cells: readonly BenchCell[];
130
+ readonly routerBaseUrl: string;
131
+ readonly routerKey: string;
132
+ readonly bridgeUrl?: string;
133
+ readonly bridgeBearer?: string;
134
+ readonly sandboxBaseUrl?: string;
135
+ /** Tasks per benchmark (the n). */
136
+ readonly n?: number;
137
+ readonly ids?: string[];
138
+ readonly split?: string;
139
+ /** Replicates per (benchmark × cell × task). Default 1. */
140
+ readonly reps?: number;
141
+ /** Bounded concurrency across all shots. Default 4. */
142
+ readonly concurrency?: number;
143
+ /** Per-shot wall-clock (ms). */
144
+ readonly timeoutMs?: number;
145
+ /** Test seam: resolve the runtime transport. Defaults to `resolveBenchClient`. */
146
+ readonly resolveClient?: typeof resolveBenchClient;
147
+ /** Max attempts per (benchmark × cell × task). Default 1. Attempts after the first receive
148
+ * non-answer checker feedback and the previous artifacts; the loop stops early on pass. */
149
+ readonly loopAttempts?: number;
150
+ /** Self-verify each benchmark's judge against its gold artifact on the first task before spending
151
+ * model tokens; a benchmark whose judge rejects its own gold is recorded unavailable. Default true. */
152
+ readonly verifyJudge?: boolean;
153
+ /** Test seam: a deterministic shot runner. Defaults to the `openSandboxRun` leaf. */
154
+ readonly runShot?: BenchShot;
155
+ /** Test seam: resolve a benchmark key to an adapter. Defaults to the registry `resolveAdapter`. */
156
+ readonly resolveAdapter?: (key: string) => BenchmarkAdapter;
157
+ readonly onResult?: (r: BenchCellTaskResult) => void;
158
+ }
159
+ interface BenchCellTaskResult {
160
+ readonly benchmark: string;
161
+ readonly cell: string;
162
+ readonly taskId: string;
163
+ readonly rep: number;
164
+ readonly resolved: boolean;
165
+ readonly score: number;
166
+ /** false = the shot threw or produced no artifact (infra/empty), excluded from the resolve
167
+ * denominator so a harness outage can't masquerade as a 0% capability result. */
168
+ readonly ok: boolean;
169
+ readonly detail?: string;
170
+ readonly wallMs: number;
171
+ }
172
+ interface BenchLeaderboardRow {
173
+ readonly benchmark: string;
174
+ readonly cell: string;
175
+ readonly n: number;
176
+ readonly resolved: number;
177
+ readonly errored: number;
178
+ /** resolved / (n - errored). */
179
+ readonly resolveRate: number;
180
+ /** Mean graded score over non-errored shots (partial credit where the judge supports it). */
181
+ readonly meanScore: number;
182
+ }
183
+ interface RunBenchmarksReport {
184
+ /** One row per (benchmark × cell), sorted by benchmark then descending resolveRate. */
185
+ readonly rows: readonly BenchLeaderboardRow[];
186
+ readonly perTask: readonly BenchCellTaskResult[];
187
+ readonly benchmarks: readonly string[];
188
+ readonly cells: readonly string[];
189
+ /** Benchmarks skipped because `preflight`/judge-self-check failed, with the reason. */
190
+ readonly unavailable: ReadonlyArray<{
191
+ readonly benchmark: string;
192
+ readonly reason: string;
193
+ }>;
194
+ }
195
+ declare function runBenchmarks(opts: RunBenchmarksOptions): Promise<RunBenchmarksReport>;
196
+ /** Render the leaderboard as a fixed-width table for a CLI/log. */
197
+ declare function printBenchmarksReport(report: RunBenchmarksReport): string;
198
+
199
+ interface StagePreparedPierCandidateOptions {
200
+ readonly prepared: PreparedAgentCandidateExecution;
201
+ /** Evaluator-owned directory persisted with the Pier trial. */
202
+ readonly directory: string;
203
+ /** Exact Pier package version pinned by the experiment contract. */
204
+ readonly pierVersion: string;
205
+ }
206
+ interface StagedPierCandidateExecution {
207
+ readonly executionId: string;
208
+ readonly directory: string;
209
+ readonly taskDirectory: string;
210
+ readonly candidateDirectory?: string;
211
+ readonly profileDirectory: string;
212
+ readonly planPath: string;
213
+ readonly receiptPath: string;
214
+ readonly agentArgs: readonly string[];
215
+ /** Executor-only model and trace bindings; never present on the prepared object or disk. */
216
+ readonly evaluatorEnv: Readonly<Record<string, string>>;
217
+ /** One prepared execution is exactly one Pier trial attempt. */
218
+ readonly attemptArgs: readonly ['--n-attempts', '1', '--max-retries', '0'];
219
+ }
220
+ interface PierCandidateTerminationAcknowledgement {
221
+ /** The Pier process has exited and has been reaped. */
222
+ readonly processExited: true;
223
+ /** Every task container created for this one trial has been removed. */
224
+ readonly containersRemoved: true;
225
+ }
226
+ interface PierCandidateTrialHandle {
227
+ /** Non-secret durable identity shared with a fresh evaluator process. */
228
+ readonly identity: PierCandidateTrialIdentity;
229
+ /** Resolves only after the Pier process exits and its task container is gone. */
230
+ readonly result: Promise<PierCandidateTrialResult>;
231
+ /** Idempotently kill/reap Pier and remove its task container, then acknowledge their death. */
232
+ readonly terminateAndWait: () => Promise<PierCandidateTerminationAcknowledgement>;
233
+ }
234
+ type PierCandidateTrialIdentity = Readonly<AgentCandidateExecutorStopRequest>;
235
+ /**
236
+ * Evaluator-owned lifecycle whose stop path works without the process-local
237
+ * handle returned by `start`.
238
+ */
239
+ interface PierCandidateTrialController {
240
+ start(staged: StagedPierCandidateExecution, context: {
241
+ readonly request: AgentCandidateExecutorRequest;
242
+ readonly traceStore: TraceStore;
243
+ readonly signal: AbortSignal;
244
+ readonly deadlineAtMs: number;
245
+ }): PierCandidateTrialHandle;
246
+ terminateAndWait(identity: PierCandidateTrialIdentity): Promise<PierCandidateTerminationAcknowledgement>;
247
+ /** Read immutable official bytes after termination; undefined proves no result was emitted. */
248
+ captureResult(identity: PierCandidateTrialIdentity): Promise<PierCandidateTrialResult | undefined>;
249
+ }
250
+ /** Evaluator-owned bytes captured from one completed official Pier trial. */
251
+ interface PierCandidateTrialResult {
252
+ /** Parsed value of the exact `result.json` bytes. */
253
+ readonly value: unknown;
254
+ /** Exact official `result.json` bytes used as grader evidence. */
255
+ readonly resultBytes: Uint8Array;
256
+ /** Exact `/logs/artifacts/model.patch` bytes emitted before official tests. */
257
+ readonly taskPatch: Uint8Array;
258
+ }
259
+ interface PierCandidateOfficialResult {
260
+ readonly value: unknown;
261
+ readonly bytes: Uint8Array;
262
+ }
263
+ type RuntimeGraderInput = Parameters<AgentCandidateBenchmarkGraderPort['run']>[0];
264
+ type RuntimeGraderResult = Awaited<ReturnType<AgentCandidateBenchmarkGraderPort['run']>>;
265
+ /** Executes the exact admitted grader bytes against the official Pier result. */
266
+ interface PierCandidateGraderPort {
267
+ readonly name: string;
268
+ readonly version: string;
269
+ readonly artifact: AgentCandidateBenchmarkGraderPort['artifact'];
270
+ run(input: RuntimeGraderInput & {
271
+ readonly officialResult: PierCandidateOfficialResult;
272
+ }): Promise<RuntimeGraderResult>;
273
+ }
274
+ interface ExecutePreparedPierCandidateOptions extends StagePreparedPierCandidateOptions {
275
+ readonly traceStore: TraceStore;
276
+ /** Durable one-shot store shared by every process capable of running this benchmark. */
277
+ readonly claimStore: AgentCandidateExecutionClaimStore;
278
+ readonly outputArtifacts: AgentCandidateOutputArtifactPort;
279
+ readonly grader: PierCandidateGraderPort;
280
+ /**
281
+ * Starts exactly one Pier trial synchronously and persists its non-secret
282
+ * process/container identity before returning.
283
+ */
284
+ readonly controller: PierCandidateTrialController;
285
+ }
286
+ /** Recovery-only runtime executor for an expired attempt owned by another process. */
287
+ declare function createPierCandidateRecoveryExecutor(controller: PierCandidateTrialController): AgentCandidateExecutorPort;
288
+ /** Execute and finalize through the runtime's only gradable candidate path. */
289
+ declare function executePreparedPierCandidate(options: ExecutePreparedPierCandidateOptions): Promise<AgentCandidateRunFinalization>;
290
+
291
+ interface PierCandidateProcessSpec {
292
+ /** Returns launch data only. The controller, not this callback, starts the process. */
293
+ readonly command: string;
294
+ readonly args: readonly string[];
295
+ readonly cwd: string;
296
+ /** Exact Pier child environment. The controller adds its Docker connection variables. */
297
+ readonly env: Readonly<Record<string, string | undefined>>;
298
+ readonly jobsDirectory: string;
299
+ /** Must be unique: the controller atomically reserves this Pier job directory. */
300
+ readonly jobName: string;
301
+ readonly dockerCommand?: string;
302
+ /** Called only by the originating process after the supervisor reports clean exit. */
303
+ readonly readResult: () => Promise<PierCandidateTrialResult>;
304
+ }
305
+ interface PierDockerConnection {
306
+ /** Stable, non-secret name that every recovery worker maps to the same Docker endpoint. */
307
+ readonly id: string;
308
+ /** Exact variables needed by both Pier and Docker cleanup; values are never persisted. */
309
+ readonly env: Readonly<Record<string, string | undefined>>;
310
+ }
311
+ interface FilePierCandidateTrialControllerOptions {
312
+ /** Shared evaluator-owned control root, available to crash-recovery workers. */
313
+ readonly directory: string;
314
+ readonly launch?: (staged: StagedPierCandidateExecution, context: {
315
+ readonly request: AgentCandidateExecutorRequest;
316
+ readonly traceStore: TraceStore;
317
+ readonly signal: AbortSignal;
318
+ readonly deadlineAtMs: number;
319
+ }) => PierCandidateProcessSpec;
320
+ /** Restart-safe reader for immutable official bytes under the persisted Pier job identity. */
321
+ readonly readResult?: (input: {
322
+ readonly jobsDirectory: string;
323
+ readonly jobName: string;
324
+ }) => Promise<PierCandidateTrialResult | undefined>;
325
+ /** Omit only for the default local Docker socket with no environment variables. */
326
+ readonly dockerConnection?: PierDockerConnection;
327
+ readonly supervisorPath?: string;
328
+ readonly pollIntervalMs?: number;
329
+ }
330
+ declare class FilePierCandidateTrialController implements PierCandidateTrialController {
331
+ private readonly directory;
332
+ private readonly launch?;
333
+ private readonly readResult?;
334
+ private readonly dockerConnection;
335
+ private readonly supervisorPath;
336
+ private readonly pollIntervalMs;
337
+ constructor(options: FilePierCandidateTrialControllerOptions);
338
+ start(staged: StagedPierCandidateExecution, context: {
339
+ readonly request: AgentCandidateExecutorRequest;
340
+ readonly traceStore: TraceStore;
341
+ readonly signal: AbortSignal;
342
+ readonly deadlineAtMs: number;
343
+ }): PierCandidateTrialHandle;
344
+ terminateAndWait(requested: PierCandidateTrialIdentity): Promise<PierCandidateTerminationAcknowledgement>;
345
+ captureResult(requested: PierCandidateTrialIdentity): Promise<PierCandidateTrialResult | undefined>;
346
+ private controlDirectory;
347
+ private assertDockerConnection;
348
+ private validateSpec;
349
+ private waitForResult;
350
+ private forceRecovery;
351
+ }
352
+
353
+ declare function createPierResultGrader(descriptor: Pick<PierCandidateGraderPort, 'name' | 'version' | 'artifact'>): PierCandidateGraderPort;
354
+
355
+ export { type BenchCell, type BenchCellTaskResult, type BenchLeaderboardRow, type BenchShot, BenchTask, BenchmarkAdapter, type ExecutePreparedPierCandidateOptions, FilePierCandidateTrialController, type FilePierCandidateTrialControllerOptions, type PierCandidateGraderPort, type PierCandidateOfficialResult, type PierCandidateProcessSpec, type PierCandidateTerminationAcknowledgement, type PierCandidateTrialController, type PierCandidateTrialHandle, type PierCandidateTrialIdentity, type PierCandidateTrialResult, type PierDockerConnection, type RunBenchmarksOptions, type RunBenchmarksReport, type StagedPierCandidateExecution, createPierCandidateRecoveryExecutor, createPierResultGrader, executePreparedPierCandidate, printBenchmarksReport, runBenchmarks };