@tangle-network/agent-bench 0.4.0 → 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.
Files changed (200) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/adapters.d.ts +4 -11
  3. package/dist/adapters.js +78 -41
  4. package/dist/adapters.js.map +1 -1
  5. package/dist/benchmarks/_harness.d.ts +51 -66
  6. package/dist/benchmarks/_harness.js +329 -31
  7. package/dist/benchmarks/_harness.js.map +1 -1
  8. package/dist/benchmarks/aec-bench.d.ts +4 -25
  9. package/dist/benchmarks/aec-bench.js +242 -7
  10. package/dist/benchmarks/aec-bench.js.map +1 -1
  11. package/dist/benchmarks/agentbench.d.ts +5 -13
  12. package/dist/benchmarks/agentbench.js +114 -9
  13. package/dist/benchmarks/agentbench.js.map +1 -1
  14. package/dist/benchmarks/appworld.d.ts +9 -29
  15. package/dist/benchmarks/appworld.js +317 -12
  16. package/dist/benchmarks/appworld.js.map +1 -1
  17. package/dist/benchmarks/bfcl.d.ts +5 -15
  18. package/dist/benchmarks/bfcl.js +264 -9
  19. package/dist/benchmarks/bfcl.js.map +1 -1
  20. package/dist/benchmarks/cad-design.d.ts +16 -41
  21. package/dist/benchmarks/cad-design.js +512 -6
  22. package/dist/benchmarks/cad-design.js.map +1 -1
  23. package/dist/benchmarks/cadbench.d.ts +4 -17
  24. package/dist/benchmarks/cadbench.js +2 -8
  25. package/dist/benchmarks/cadgenbench.d.ts +4 -20
  26. package/dist/benchmarks/cadgenbench.js +2 -8
  27. package/dist/benchmarks/commit0.d.ts +5 -27
  28. package/dist/benchmarks/commit0.js +187 -9
  29. package/dist/benchmarks/commit0.js.map +1 -1
  30. package/dist/benchmarks/crag.d.ts +4 -12
  31. package/dist/benchmarks/crag.js +110 -8
  32. package/dist/benchmarks/crag.js.map +1 -1
  33. package/dist/benchmarks/dabstep.d.ts +5 -15
  34. package/dist/benchmarks/dabstep.js +177 -9
  35. package/dist/benchmarks/dabstep.js.map +1 -1
  36. package/dist/benchmarks/enterpriseops-gym.d.ts +5 -34
  37. package/dist/benchmarks/enterpriseops-gym.js +236 -9
  38. package/dist/benchmarks/enterpriseops-gym.js.map +1 -1
  39. package/dist/benchmarks/finresearchbench.d.ts +4 -13
  40. package/dist/benchmarks/finresearchbench.js +218 -7
  41. package/dist/benchmarks/finresearchbench.js.map +1 -1
  42. package/dist/benchmarks/finsearchcomp.d.ts +8 -39
  43. package/dist/benchmarks/finsearchcomp.js +267 -6
  44. package/dist/benchmarks/finsearchcomp.js.map +1 -1
  45. package/dist/benchmarks/frames.d.ts +15 -37
  46. package/dist/benchmarks/frames.js +408 -11
  47. package/dist/benchmarks/frames.js.map +1 -1
  48. package/dist/benchmarks/hotpotqa.d.ts +4 -24
  49. package/dist/benchmarks/hotpotqa.js +250 -14
  50. package/dist/benchmarks/hotpotqa.js.map +1 -1
  51. package/dist/benchmarks/humaneval.d.ts +19 -37
  52. package/dist/benchmarks/humaneval.js +279 -16
  53. package/dist/benchmarks/humaneval.js.map +1 -1
  54. package/dist/benchmarks/mind2web.d.ts +7 -34
  55. package/dist/benchmarks/mind2web.js +257 -8
  56. package/dist/benchmarks/mind2web.js.map +1 -1
  57. package/dist/benchmarks/nomiracl.d.ts +4 -13
  58. package/dist/benchmarks/nomiracl.js +146 -8
  59. package/dist/benchmarks/nomiracl.js.map +1 -1
  60. package/dist/benchmarks/open-rag-bench.d.ts +4 -12
  61. package/dist/benchmarks/open-rag-bench.js +110 -8
  62. package/dist/benchmarks/open-rag-bench.js.map +1 -1
  63. package/dist/benchmarks/programbench.d.ts +5 -29
  64. package/dist/benchmarks/programbench.js +161 -9
  65. package/dist/benchmarks/programbench.js.map +1 -1
  66. package/dist/benchmarks/rag-shared.d.ts +21 -20
  67. package/dist/benchmarks/rag-shared.js +245 -38
  68. package/dist/benchmarks/rag-shared.js.map +1 -1
  69. package/dist/benchmarks/ragbench.d.ts +4 -14
  70. package/dist/benchmarks/ragbench.js +127 -8
  71. package/dist/benchmarks/ragbench.js.map +1 -1
  72. package/dist/benchmarks/simpleqa.d.ts +17 -44
  73. package/dist/benchmarks/simpleqa.js +293 -10
  74. package/dist/benchmarks/simpleqa.js.map +1 -1
  75. package/dist/benchmarks/swe-bench.d.ts +23 -36
  76. package/dist/benchmarks/swe-bench.js +234 -13
  77. package/dist/benchmarks/swe-bench.js.map +1 -1
  78. package/dist/benchmarks/t2-ragbench.d.ts +4 -12
  79. package/dist/benchmarks/t2-ragbench.js +118 -8
  80. package/dist/benchmarks/t2-ragbench.js.map +1 -1
  81. package/dist/benchmarks/tau-bench-shared.d.ts +14 -22
  82. package/dist/benchmarks/tau-bench-shared.js +169 -9
  83. package/dist/benchmarks/tau-bench-shared.js.map +1 -1
  84. package/dist/benchmarks/tau2-bench.d.ts +5 -5
  85. package/dist/benchmarks/tau2-bench.js +28 -10
  86. package/dist/benchmarks/tau2-bench.js.map +1 -1
  87. package/dist/benchmarks/tau3-banking.d.ts +4 -13
  88. package/dist/benchmarks/tau3-banking.js +28 -8
  89. package/dist/benchmarks/tau3-banking.js.map +1 -1
  90. package/dist/benchmarks/terminal-bench.d.ts +4 -22
  91. package/dist/benchmarks/terminal-bench.js +140 -7
  92. package/dist/benchmarks/terminal-bench.js.map +1 -1
  93. package/dist/benchmarks/toollm.d.ts +5 -13
  94. package/dist/benchmarks/toollm.js +184 -9
  95. package/dist/benchmarks/toollm.js.map +1 -1
  96. package/dist/benchmarks/trata-hedge.d.ts +4 -30
  97. package/dist/benchmarks/trata-hedge.js +336 -6
  98. package/dist/benchmarks/trata-hedge.js.map +1 -1
  99. package/dist/benchmarks/types.d.ts +85 -94
  100. package/dist/benchmarks/types.js +1 -1
  101. package/dist/benchmarks/webarena-verified.d.ts +5 -13
  102. package/dist/benchmarks/webarena-verified.js +152 -9
  103. package/dist/benchmarks/webarena-verified.js.map +1 -1
  104. package/dist/cadbench-DpQWZHp4.js +285 -0
  105. package/dist/cadbench-DpQWZHp4.js.map +1 -0
  106. package/dist/cadgenbench-DRhczfsG.js +151 -0
  107. package/dist/cadgenbench-DRhczfsG.js.map +1 -0
  108. package/dist/index.d.ts +245 -293
  109. package/dist/index.js +1669 -1791
  110. package/dist/index.js.map +1 -1
  111. package/package.json +17 -14
  112. package/pier_agents/candidate_contract.py +238 -24
  113. package/pier_agents/tangle_candidate.py +75 -5
  114. package/scripts/verify-packed-consumer.mjs +84 -17
  115. package/scripts/verify-pier-agent.mts +6 -4
  116. package/src/benchmarks/_harness.test.mts +16 -1
  117. package/src/benchmarks/_harness.ts +9 -2
  118. package/src/benchmarks/terminal-bench.ts +2 -1
  119. package/src/corpus.test.mts +13 -0
  120. package/src/corpus.ts +4 -0
  121. package/src/profile-coordinates.ts +2 -2
  122. package/src/rollout-ledger/backfill-swe-arena.mts +5 -1
  123. package/src/rollout-ledger/settle-capture.mts +7 -1
  124. package/src/search-bench/profiles.ts +1 -1
  125. package/src/skill-sandbox-smoke.mts +2 -1
  126. package/src/swe-arena/gepa-seat.mts +1 -1
  127. package/src/swe-arena/ledger-orphans.test.mts +36 -34
  128. package/dist/benchmarks/cadbench.js.map +0 -1
  129. package/dist/benchmarks/cadgenbench.js.map +0 -1
  130. package/dist/benchmarks/types.js.map +0 -1
  131. package/dist/chunk-3U5TXJZS.js +0 -251
  132. package/dist/chunk-3U5TXJZS.js.map +0 -1
  133. package/dist/chunk-53UPUNBZ.js +0 -325
  134. package/dist/chunk-53UPUNBZ.js.map +0 -1
  135. package/dist/chunk-5H5XV76F.js +0 -240
  136. package/dist/chunk-5H5XV76F.js.map +0 -1
  137. package/dist/chunk-7GRVHU22.js +0 -208
  138. package/dist/chunk-7GRVHU22.js.map +0 -1
  139. package/dist/chunk-C7T7WEK2.js +0 -103
  140. package/dist/chunk-C7T7WEK2.js.map +0 -1
  141. package/dist/chunk-HWST3SED.js +0 -162
  142. package/dist/chunk-HWST3SED.js.map +0 -1
  143. package/dist/chunk-IA2FBTWC.js +0 -318
  144. package/dist/chunk-IA2FBTWC.js.map +0 -1
  145. package/dist/chunk-IFVINJ4B.js +0 -142
  146. package/dist/chunk-IFVINJ4B.js.map +0 -1
  147. package/dist/chunk-INNOYXCP.js +0 -387
  148. package/dist/chunk-INNOYXCP.js.map +0 -1
  149. package/dist/chunk-IZ5M6OAC.js +0 -169
  150. package/dist/chunk-IZ5M6OAC.js.map +0 -1
  151. package/dist/chunk-JTHWEDEW.js +0 -32
  152. package/dist/chunk-JTHWEDEW.js.map +0 -1
  153. package/dist/chunk-K3BQGZCT.js +0 -221
  154. package/dist/chunk-K3BQGZCT.js.map +0 -1
  155. package/dist/chunk-KP5KD6EN.js +0 -276
  156. package/dist/chunk-KP5KD6EN.js.map +0 -1
  157. package/dist/chunk-MQMRLGOG.js +0 -136
  158. package/dist/chunk-MQMRLGOG.js.map +0 -1
  159. package/dist/chunk-NQG5XDSB.js +0 -147
  160. package/dist/chunk-NQG5XDSB.js.map +0 -1
  161. package/dist/chunk-PA2ZKHJC.js +0 -230
  162. package/dist/chunk-PA2ZKHJC.js.map +0 -1
  163. package/dist/chunk-PB64GYIG.js +0 -118
  164. package/dist/chunk-PB64GYIG.js.map +0 -1
  165. package/dist/chunk-PUIRNYI7.js +0 -189
  166. package/dist/chunk-PUIRNYI7.js.map +0 -1
  167. package/dist/chunk-RCYQEFNX.js +0 -30
  168. package/dist/chunk-RCYQEFNX.js.map +0 -1
  169. package/dist/chunk-RH5F53JT.js +0 -182
  170. package/dist/chunk-RH5F53JT.js.map +0 -1
  171. package/dist/chunk-SEVJPLZC.js +0 -260
  172. package/dist/chunk-SEVJPLZC.js.map +0 -1
  173. package/dist/chunk-SFLA7OH3.js +0 -27
  174. package/dist/chunk-SFLA7OH3.js.map +0 -1
  175. package/dist/chunk-SHM6MRRF.js +0 -130
  176. package/dist/chunk-SHM6MRRF.js.map +0 -1
  177. package/dist/chunk-SHYIRB7I.js +0 -120
  178. package/dist/chunk-SHYIRB7I.js.map +0 -1
  179. package/dist/chunk-SVR2LKYI.js +0 -116
  180. package/dist/chunk-SVR2LKYI.js.map +0 -1
  181. package/dist/chunk-TBKU5XQI.js +0 -228
  182. package/dist/chunk-TBKU5XQI.js.map +0 -1
  183. package/dist/chunk-UPAMRDX4.js +0 -233
  184. package/dist/chunk-UPAMRDX4.js.map +0 -1
  185. package/dist/chunk-V7AEBY6U.js +0 -144
  186. package/dist/chunk-V7AEBY6U.js.map +0 -1
  187. package/dist/chunk-VQRS7VUC.js +0 -342
  188. package/dist/chunk-VQRS7VUC.js.map +0 -1
  189. package/dist/chunk-WSKWVEQB.js +0 -317
  190. package/dist/chunk-WSKWVEQB.js.map +0 -1
  191. package/dist/chunk-X3BTXCJ4.js +0 -262
  192. package/dist/chunk-X3BTXCJ4.js.map +0 -1
  193. package/dist/chunk-XKEFIFIC.js +0 -197
  194. package/dist/chunk-XKEFIFIC.js.map +0 -1
  195. package/dist/chunk-XYA4XSNU.js +0 -148
  196. package/dist/chunk-XYA4XSNU.js.map +0 -1
  197. package/dist/chunk-YSMEKBTD.js +0 -211
  198. package/dist/chunk-YSMEKBTD.js.map +0 -1
  199. package/dist/chunk-Z4TZ76N7.js +0 -170
  200. package/dist/chunk-Z4TZ76N7.js.map +0 -1
@@ -1,14 +1,319 @@
1
- import {
2
- appworldSolutionOutput,
3
- appworldToolLoopClient,
4
- createAppWorldAdapter,
5
- createAppWorldReactAdapter
6
- } from "../chunk-IA2FBTWC.js";
7
- import "../chunk-WSKWVEQB.js";
8
- export {
9
- appworldSolutionOutput,
10
- appworldToolLoopClient,
11
- createAppWorldAdapter,
12
- createAppWorldReactAdapter
1
+ import { benchRoot, preflightVenvImports, runVenvScriptStdin, venvPython } from "./_harness.js";
2
+ import { join } from "node:path";
3
+ import { spawn } from "node:child_process";
4
+ import { createInterface } from "node:readline";
5
+ import { routerToolLoop } from "@tangle-network/agent-runtime/loops";
6
+ //#region src/benchmarks/appworld.ts
7
+ /**
8
+ * AppWorld adapter (StonyBrookNLP/appworld). Worker artifact = the agent's
9
+ * Python solution that calls the simulated apps' APIs (the same `apis.<app>.<fn>`
10
+ * surface AppWorld exposes inside `world.execute(...)`), ending in
11
+ * `apis.supervisor.complete_task()`. Judge = AppWorld's OWN programmatic
12
+ * evaluator: a driver runs the solution in a fresh `AppWorld(task_id=...)` world,
13
+ * then `world.evaluate().to_dict()` reports `success` (binary TGC), `num_tests`
14
+ * (per-requirement total) and the `passes`/`failures` lists. Score =
15
+ * passes / num_tests — GRADED; resolved = success. Fully deterministic — no LLM judge.
16
+ *
17
+ * loadTasks enumerates the real task suite via `load_task_ids(split)`
18
+ * (train|dev|test_normal|test_challenge); the prompt = `world.task.instruction`.
19
+ * The OutputAdapter is stream-only, so the worker emits its solution as a fenced
20
+ * ```python block which the driver executes.
21
+ *
22
+ * Requires for a live run: the bench `.venv` with `appworld` installed + the
23
+ * unpacked engine + downloaded data (`appworld install` ; `appworld download
24
+ * data`). preflight + loadTasks + judge all fail loud with the exact step when the
25
+ * engine/data is absent — never a fabricated score.
26
+ */
27
+ const DRIVER = join(benchRoot, "scripts", "appworld_driver.py");
28
+ /** AppWorld splits; only the test splits ship evaluation-only (no setup/solution). */
29
+ const DEFAULT_SPLIT = "test_normal";
30
+ /** Worker solution code = the last fenced ```python block, else the raw text. */
31
+ const appworldSolutionOutput = { parse(events) {
32
+ let text = "";
33
+ for (const ev of events) {
34
+ const d = ev?.data;
35
+ const t = d?.finalText ?? d?.text ?? d?.result;
36
+ if (typeof t === "string" && t.length > 0) text = t;
37
+ }
38
+ return ([...text.matchAll(/```(?:python|py)?\s*\n([\s\S]*?)```/g)].at(-1)?.[1] ?? text).trim();
39
+ } };
40
+ const WORKER_CONTRACT = [
41
+ "",
42
+ "Solve this by writing Python that calls the available app APIs (the `apis.<app>.<function>(...)` surface). You may inspect API docs with `apis.api_docs.show_api_descriptions(app_name=...)` and `apis.api_docs.show_api_doc(app_name=..., api_name=...)`.",
43
+ "Authenticate where needed via the supervisor-provided credentials, perform every step the task requires, and FINISH with `apis.supervisor.complete_task()`.",
44
+ "Emit your COMPLETE solution as the LAST thing in your reply, in a single fenced ```python block. Nothing after the closing fence."
45
+ ].join("\n");
46
+ function readMeta(task) {
47
+ const md = task.metadata;
48
+ if (!md || typeof md.taskId !== "string") throw new Error(`appworld task ${task.id} missing metadata.taskId — loadTasks did not populate it`);
49
+ return md;
50
+ }
51
+ /**
52
+ * Run the appworld engine driver with a subcommand; JSON on the LAST stdout line.
53
+ * The solution code (evaluate) is piped to stdin via the shared stdin-aware runner —
54
+ * execFile's `input` option is not honored async and hangs the driver's
55
+ * sys.stdin.read() forever. `load` ignores stdin, so an empty pipe is harmless.
56
+ */
57
+ async function driver(args, input = "") {
58
+ let stdout;
59
+ try {
60
+ stdout = await runVenvScriptStdin(DRIVER, args, input, { cwd: benchRoot });
61
+ } catch (err) {
62
+ const e = err;
63
+ throw new Error(`appworld driver failed (${args.join(" ")}): ${(e.message || String(err)).slice(0, 1500)}`);
64
+ }
65
+ const last = stdout.trim().split("\n").at(-1) ?? "{}";
66
+ const parsed = JSON.parse(last);
67
+ if (parsed.error) throw new Error(`appworld driver error: ${parsed.error}`);
68
+ return parsed;
69
+ }
70
+ function createAppWorldAdapter() {
71
+ return {
72
+ name: "appworld",
73
+ output: appworldSolutionOutput,
74
+ async preflight() {
75
+ await preflightVenvImports({
76
+ modules: ["appworld"],
77
+ requireDocker: false,
78
+ fix: "Fix: bench/.venv/bin/pip install appworld ; bench/.venv/bin/appworld install ; bench/.venv/bin/appworld download data (unpacks the engine + downloads the simulated-app data/tasks). Set APPWORLD_ROOT to the data root if not the default."
79
+ });
80
+ },
81
+ async loadTasks(opts = {}) {
82
+ const split = opts.split ?? DEFAULT_SPLIT;
83
+ const tasks = (await driver([
84
+ "load",
85
+ "--split",
86
+ split,
87
+ ...opts.limit !== void 0 ? ["--limit", String(opts.limit)] : [],
88
+ ...opts.ids ? ["--ids", opts.ids.join(",")] : []
89
+ ])).tasks ?? [];
90
+ if (tasks.length === 0) throw new Error(`appworld loadTasks returned no tasks for split=${split} ${JSON.stringify(opts)}`);
91
+ return tasks.map((t) => ({
92
+ id: t.task_id,
93
+ split,
94
+ prompt: t.instruction + WORKER_CONTRACT,
95
+ metadata: {
96
+ taskId: t.task_id,
97
+ split
98
+ }
99
+ }));
100
+ },
101
+ async goldArtifact() {},
102
+ async judge(task, artifact) {
103
+ const meta = readMeta(task);
104
+ const out = await driver([
105
+ "evaluate",
106
+ "--task-id",
107
+ meta.taskId,
108
+ "--split",
109
+ meta.split
110
+ ], artifact);
111
+ const passes = out.passes ?? 0;
112
+ const fails = out.fails ?? 0;
113
+ const total = out.num_tests ?? passes + fails;
114
+ const score = total > 0 ? passes / total : 0;
115
+ const failures = Array.isArray(out.failure_names) ? out.failure_names : [];
116
+ return {
117
+ resolved: out.success === true,
118
+ score,
119
+ detail: JSON.stringify({
120
+ taskId: meta.taskId,
121
+ success: out.success,
122
+ passes,
123
+ fails,
124
+ total,
125
+ ...failures.length ? { failures } : {}
126
+ })
127
+ };
128
+ }
129
+ };
130
+ }
131
+ const REACT_HEADER = /^@appworld-react (\S+) (\S+)\n?/;
132
+ const SESSION_SYSTEM = [
133
+ "You are completing a task in AppWorld, a simulated multi-app environment.",
134
+ "Use the execute_python tool to run Python that calls the app APIs (the `apis.<app>.<function>(...)` surface).",
135
+ "Inspect API docs with `apis.api_docs.show_api_descriptions(app_name=...)` and `apis.api_docs.show_api_doc(app_name=..., api_name=...)`.",
136
+ "Authenticate where needed via the supervisor-provided credentials (`apis.supervisor.show_account_passwords()`).",
137
+ "Work incrementally: small snippets, read each output, correct course.",
138
+ "When every step of the task is done, run `apis.supervisor.complete_task()` and then reply WITHOUT calling the tool again."
139
+ ].join("\n");
140
+ const EXECUTE_TOOL = {
141
+ type: "function",
142
+ function: {
143
+ name: "execute_python",
144
+ description: "Execute a Python snippet in the persistent AppWorld world. State persists across calls. Returns the execution output (API results or errors).",
145
+ parameters: {
146
+ type: "object",
147
+ properties: { code: {
148
+ type: "string",
149
+ description: "Python code calling apis.<app>.<fn>(...)"
150
+ } },
151
+ required: ["code"]
152
+ }
153
+ }
13
154
  };
155
+ /** One persistent world session: line-JSONL request/response over the driver. */
156
+ async function withWorldSession(taskId, split, fn) {
157
+ const child = spawn(venvPython, [
158
+ DRIVER,
159
+ "session",
160
+ "--task-id",
161
+ taskId,
162
+ "--split",
163
+ split
164
+ ], { cwd: benchRoot });
165
+ const rl = createInterface({ input: child.stdout });
166
+ const pending = [];
167
+ const backlog = [];
168
+ rl.on("line", (l) => {
169
+ const next = pending.shift();
170
+ if (next) next(l);
171
+ else backlog.push(l);
172
+ });
173
+ let stderr = "";
174
+ child.stderr.on("data", (c) => {
175
+ stderr += c.toString("utf8");
176
+ });
177
+ const nextLine = (timeoutMs) => new Promise((resolve, reject) => {
178
+ const fromBacklog = backlog.shift();
179
+ if (fromBacklog !== void 0) return resolve(fromBacklog);
180
+ const t = setTimeout(() => reject(/* @__PURE__ */ new Error(`appworld session: no response in ${timeoutMs}ms; stderr: ${stderr.slice(-400)}`)), timeoutMs);
181
+ const onExit = (code) => {
182
+ clearTimeout(t);
183
+ reject(/* @__PURE__ */ new Error(`appworld session exited (${code}); stderr: ${stderr.slice(-400)}`));
184
+ };
185
+ pending.push((l) => {
186
+ clearTimeout(t);
187
+ child.removeListener("exit", onExit);
188
+ resolve(l);
189
+ });
190
+ child.once("exit", onExit);
191
+ });
192
+ try {
193
+ const ready = JSON.parse(await nextLine(12e4));
194
+ if (!ready.ready) throw new Error(`appworld session failed to start: ${ready.error ?? "no ready line"}`);
195
+ const call = async (cmd) => {
196
+ child.stdin.write(`${JSON.stringify(cmd)}\n`);
197
+ const res = JSON.parse(await nextLine(18e4));
198
+ if (typeof res.error === "string") throw new Error(`appworld session op failed: ${res.error}`);
199
+ return res;
200
+ };
201
+ return await fn(call, ready.instruction ?? "");
202
+ } finally {
203
+ child.stdin.end();
204
+ child.kill("SIGTERM");
205
+ }
206
+ }
207
+ /** SandboxClient whose leaf is OUR routerToolLoop driving a persistent world session. */
208
+ function appworldToolLoopClient(cfg) {
209
+ const maxTurns = cfg.maxTurns ?? Number(process.env.REACT_MAX_TURNS ?? 40);
210
+ let seq = 0;
211
+ return { async create() {
212
+ return {
213
+ id: `appworld-toolloop-${seq++}`,
214
+ async *streamPrompt(prompt) {
215
+ const m = prompt.match(REACT_HEADER);
216
+ if (!m) throw new Error(`appworld-react leaf: prompt missing '@appworld-react <taskId> <split>' header — got: ${prompt.slice(0, 120)}`);
217
+ const [, taskId, split] = m;
218
+ const directive = prompt.replace(REACT_HEADER, "").trim();
219
+ const out = await withWorldSession(taskId, split, async (call, instruction) => {
220
+ const system = directive ? `${SESSION_SYSTEM}\n\n${directive}` : SESSION_SYSTEM;
221
+ const loop = await routerToolLoop({
222
+ routerBaseUrl: cfg.routerBaseUrl,
223
+ routerKey: cfg.routerKey,
224
+ model: cfg.model
225
+ }, system, `Task: ${instruction}`, [EXECUTE_TOOL], async (name, args) => {
226
+ if (name !== "execute_python") return `error: unknown tool ${name}`;
227
+ const res = await call({
228
+ op: "execute",
229
+ code: String(args.code ?? "")
230
+ });
231
+ const done = res.task_completed === true;
232
+ return `${String(res.output ?? "")}${done ? "\n\n[TASK MARKED COMPLETE — reply with a final summary and do not call the tool again]" : ""}`;
233
+ }, { maxTurns });
234
+ const verdict = await call({ op: "evaluate" });
235
+ const transcript = loop.toolTrace.slice(-3).map((t) => `CODE:\n${t.args.slice(0, 600)}\nOUTPUT:\n${t.result.slice(0, 600)}`).join("\n---\n").slice(0, 1600);
236
+ return {
237
+ ...verdict,
238
+ turns: loop.turns,
239
+ input_tokens: loop.usage.input,
240
+ output_tokens: loop.usage.output,
241
+ transcript
242
+ };
243
+ });
244
+ if (out.input_tokens || out.output_tokens) yield {
245
+ type: "llm_call",
246
+ data: {
247
+ tokensIn: out.input_tokens ?? 0,
248
+ tokensOut: out.output_tokens ?? 0,
249
+ model: cfg.model
250
+ }
251
+ };
252
+ yield {
253
+ type: "result",
254
+ data: { finalText: JSON.stringify(out) }
255
+ };
256
+ },
257
+ async delete() {}
258
+ };
259
+ } };
260
+ }
261
+ /** Artifact = the episode's evaluation JSON, verbatim (no fence extraction). */
262
+ const reactEpisodeOutput = { parse(events) {
263
+ let text = "";
264
+ for (const ev of events) {
265
+ const t = (ev?.data)?.finalText;
266
+ if (typeof t === "string" && t.length > 0) text = t;
267
+ }
268
+ return text;
269
+ } };
270
+ function createAppWorldReactAdapter() {
271
+ const base = createAppWorldAdapter();
272
+ return {
273
+ name: "appworld-react",
274
+ output: reactEpisodeOutput,
275
+ preflight: () => base.preflight(),
276
+ async loadTasks(opts = {}) {
277
+ return (await base.loadTasks(opts)).map((t) => {
278
+ const meta = readMeta(t);
279
+ return {
280
+ ...t,
281
+ prompt: `@appworld-react ${meta.taskId} ${meta.split}\n`
282
+ };
283
+ });
284
+ },
285
+ goldArtifact: () => Promise.resolve(void 0),
286
+ async judge(task, artifact) {
287
+ const meta = readMeta(task);
288
+ let out;
289
+ try {
290
+ out = JSON.parse(artifact);
291
+ } catch {
292
+ throw new Error(`appworld-react judge: artifact is not the episode's evaluation JSON (task ${meta.taskId}): ${artifact.slice(0, 200)}`);
293
+ }
294
+ if (typeof out.success !== "boolean" || typeof out.num_tests !== "number") throw new Error(`appworld-react judge: episode JSON missing success/num_tests (task ${meta.taskId}): ${artifact.slice(0, 200)}`);
295
+ const passes = out.passes ?? 0;
296
+ const total = out.num_tests;
297
+ const failures = Array.isArray(out.failure_names) ? out.failure_names : [];
298
+ return {
299
+ resolved: out.success === true,
300
+ score: total > 0 ? passes / total : 0,
301
+ detail: JSON.stringify({
302
+ taskId: meta.taskId,
303
+ success: out.success,
304
+ passes,
305
+ fails: out.fails ?? 0,
306
+ total,
307
+ turns: out.turns,
308
+ ...failures.length ? { failures } : {},
309
+ ...out.transcript ? { transcriptTail: out.transcript.slice(-800) } : {}
310
+ })
311
+ };
312
+ },
313
+ leafClient: (c) => appworldToolLoopClient(c)
314
+ };
315
+ }
316
+ //#endregion
317
+ export { appworldSolutionOutput, appworldToolLoopClient, createAppWorldAdapter, createAppWorldReactAdapter };
318
+
14
319
  //# sourceMappingURL=appworld.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"appworld.js","names":[],"sources":["../../src/benchmarks/appworld.ts"],"sourcesContent":["/**\n * AppWorld adapter (StonyBrookNLP/appworld). Worker artifact = the agent's\n * Python solution that calls the simulated apps' APIs (the same `apis.<app>.<fn>`\n * surface AppWorld exposes inside `world.execute(...)`), ending in\n * `apis.supervisor.complete_task()`. Judge = AppWorld's OWN programmatic\n * evaluator: a driver runs the solution in a fresh `AppWorld(task_id=...)` world,\n * then `world.evaluate().to_dict()` reports `success` (binary TGC), `num_tests`\n * (per-requirement total) and the `passes`/`failures` lists. Score =\n * passes / num_tests — GRADED; resolved = success. Fully deterministic — no LLM judge.\n *\n * loadTasks enumerates the real task suite via `load_task_ids(split)`\n * (train|dev|test_normal|test_challenge); the prompt = `world.task.instruction`.\n * The OutputAdapter is stream-only, so the worker emits its solution as a fenced\n * ```python block which the driver executes.\n *\n * Requires for a live run: the bench `.venv` with `appworld` installed + the\n * unpacked engine + downloaded data (`appworld install` ; `appworld download\n * data`). preflight + loadTasks + judge all fail loud with the exact step when the\n * engine/data is absent — never a fabricated score.\n */\n\nimport { spawn } from 'node:child_process'\nimport { join } from 'node:path'\nimport { createInterface } from 'node:readline'\nimport { type OutputAdapter, routerToolLoop, type ToolSpec } from '@tangle-network/agent-runtime/loops'\nimport { benchRoot, preflightVenvImports, runVenvScriptStdin, venvPython } from './_harness'\nimport type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'\n\nconst DRIVER = join(benchRoot, 'scripts', 'appworld_driver.py')\n\n/** AppWorld splits; only the test splits ship evaluation-only (no setup/solution). */\nconst DEFAULT_SPLIT = 'test_normal'\n\ninterface AppWorldMeta {\n taskId: string\n split: string\n}\n\n/** Worker solution code = the last fenced ```python block, else the raw text. */\nexport const appworldSolutionOutput: OutputAdapter<string> = {\n parse(events) {\n let text = ''\n for (const ev of events) {\n const d = (ev as { data?: Record<string, unknown> })?.data\n const t = d?.finalText ?? d?.text ?? d?.result\n if (typeof t === 'string' && t.length > 0) text = t\n }\n const fences = [...text.matchAll(/```(?:python|py)?\\s*\\n([\\s\\S]*?)```/g)]\n return (fences.at(-1)?.[1] ?? text).trim()\n },\n}\n\nconst WORKER_CONTRACT = [\n '',\n 'Solve this by writing Python that calls the available app APIs (the `apis.<app>.<function>(...)` surface). You may inspect API docs with `apis.api_docs.show_api_descriptions(app_name=...)` and `apis.api_docs.show_api_doc(app_name=..., api_name=...)`.',\n 'Authenticate where needed via the supervisor-provided credentials, perform every step the task requires, and FINISH with `apis.supervisor.complete_task()`.',\n 'Emit your COMPLETE solution as the LAST thing in your reply, in a single fenced ```python block. Nothing after the closing fence.',\n].join('\\n')\n\nfunction readMeta(task: BenchTask): AppWorldMeta {\n const md = task.metadata\n if (!md || typeof md.taskId !== 'string') {\n throw new Error(`appworld task ${task.id} missing metadata.taskId — loadTasks did not populate it`)\n }\n return md as unknown as AppWorldMeta\n}\n\n/**\n * Run the appworld engine driver with a subcommand; JSON on the LAST stdout line.\n * The solution code (evaluate) is piped to stdin via the shared stdin-aware runner —\n * execFile's `input` option is not honored async and hangs the driver's\n * sys.stdin.read() forever. `load` ignores stdin, so an empty pipe is harmless.\n */\nasync function driver(args: string[], input = ''): Promise<unknown> {\n let stdout: string\n try {\n stdout = await runVenvScriptStdin(DRIVER, args, input, { cwd: benchRoot })\n } catch (err) {\n const e = err as { message?: string }\n throw new Error(`appworld driver failed (${args.join(' ')}): ${(e.message || String(err)).slice(0, 1500)}`)\n }\n const last = stdout.trim().split('\\n').at(-1) ?? '{}'\n const parsed = JSON.parse(last) as { error?: string }\n if (parsed.error) throw new Error(`appworld driver error: ${parsed.error}`)\n return parsed\n}\n\nexport function createAppWorldAdapter(): BenchmarkAdapter {\n return {\n name: 'appworld',\n output: appworldSolutionOutput,\n\n async preflight() {\n await preflightVenvImports({\n modules: ['appworld'],\n requireDocker: false,\n fix:\n 'Fix: bench/.venv/bin/pip install appworld ; ' +\n 'bench/.venv/bin/appworld install ; bench/.venv/bin/appworld download data ' +\n '(unpacks the engine + downloads the simulated-app data/tasks). ' +\n 'Set APPWORLD_ROOT to the data root if not the default.',\n })\n },\n\n async loadTasks(opts: LoadOptions = {}): Promise<BenchTask[]> {\n const split = opts.split ?? DEFAULT_SPLIT\n const out = (await driver([\n 'load',\n '--split', split,\n ...(opts.limit !== undefined ? ['--limit', String(opts.limit)] : []),\n ...(opts.ids ? ['--ids', opts.ids.join(',')] : []),\n ])) as { tasks?: Array<{ task_id: string; instruction: string }> }\n const tasks = out.tasks ?? []\n if (tasks.length === 0) {\n throw new Error(`appworld loadTasks returned no tasks for split=${split} ${JSON.stringify(opts)}`)\n }\n return tasks.map(\n (t): BenchTask => ({\n id: t.task_id,\n split,\n prompt: t.instruction + WORKER_CONTRACT,\n metadata: { taskId: t.task_id, split } as unknown as Record<string, unknown>,\n }),\n )\n },\n\n async goldArtifact() {\n // Reference solution code ships only for train/dev, and only inside the\n // engine's decrypted `.bundle` (it is not a portable string this adapter can\n // emit across splits). The test splits are evaluation-only. So verify-judge\n // here requires a real solve on a train/dev task through the live engine\n // rather than a synthetic gold — returning a fabricated artifact would be a\n // fake. Returns undefined.\n return undefined\n },\n\n async judge(task: BenchTask, artifact: string): Promise<BenchScore> {\n const meta = readMeta(task)\n const out = (await driver(['evaluate', '--task-id', meta.taskId, '--split', meta.split], artifact)) as {\n success?: boolean\n passes?: number\n fails?: number\n num_tests?: number\n failure_names?: string[]\n }\n const passes = out.passes ?? 0\n const fails = out.fails ?? 0\n // num_tests is the evaluator's authoritative per-requirement count; prefer it\n // over passes+fails (which can disagree if a requirement neither passed nor\n // failed). Never default the total to a phantom denominator.\n const total = out.num_tests ?? passes + fails\n const score = total > 0 ? passes / total : 0\n // failure_names = WHICH sub-tests failed — the evidence a trace analyst\n // steers on. Carried in `detail` so it reaches the verdict's `notes`.\n const failures = Array.isArray(out.failure_names) ? out.failure_names : []\n return {\n resolved: out.success === true,\n score,\n detail: JSON.stringify({\n taskId: meta.taskId,\n success: out.success,\n passes,\n fails,\n total,\n ...(failures.length ? { failures } : {}),\n }),\n }\n },\n }\n}\n\n/**\n * AppWorld in its NATIVE protocol, run by OUR runtime: the worker is\n * `routerToolLoop` (the runtime's off-box agentic tool loop) with one tool —\n * `execute_python` — bound to a persistent AppWorld world session. The driver's\n * `session` subcommand is a dumb world shim (stdin JSONL: execute → output,\n * evaluate → verdict); every inference turn, the metering, and the typed\n * toolTrace the analyst steers on belong to the runtime, so runtime\n * improvements are what this benchmark measures.\n *\n * The one-shot codegen adapter above plays a strictly harder game (no execution\n * feedback — the first wrong API call kills the whole program at judge time),\n * which flatlines the score against ANY steering; this mode is what the\n * benchmark's published baselines use, where behavior can move sub-tests.\n *\n * Protocol: the round task string is `@appworld-react <taskId> <split>` on\n * line 1; everything after line 1 is the steer (an analyst correction, a push\n * directive) appended to the system prompt — so the existing arms steer this\n * worker without modification. The artifact is the episode evaluation JSON\n * (AppWorld's evaluator ran in-world); judge() parses it, never re-executes.\n */\n\ninterface ReactResult {\n success?: boolean\n passes?: number\n fails?: number\n num_tests?: number\n failure_names?: string[]\n turns?: number\n input_tokens?: number\n output_tokens?: number\n transcript?: string\n}\n\nconst REACT_HEADER = /^@appworld-react (\\S+) (\\S+)\\n?/\n\nconst SESSION_SYSTEM = [\n 'You are completing a task in AppWorld, a simulated multi-app environment.',\n 'Use the execute_python tool to run Python that calls the app APIs (the `apis.<app>.<function>(...)` surface).',\n 'Inspect API docs with `apis.api_docs.show_api_descriptions(app_name=...)` and `apis.api_docs.show_api_doc(app_name=..., api_name=...)`.',\n 'Authenticate where needed via the supervisor-provided credentials (`apis.supervisor.show_account_passwords()`).',\n 'Work incrementally: small snippets, read each output, correct course.',\n 'When every step of the task is done, run `apis.supervisor.complete_task()` and then reply WITHOUT calling the tool again.',\n].join('\\n')\n\nconst EXECUTE_TOOL: ToolSpec = {\n type: 'function',\n function: {\n name: 'execute_python',\n description:\n 'Execute a Python snippet in the persistent AppWorld world. State persists across calls. Returns the execution output (API results or errors).',\n parameters: {\n type: 'object',\n properties: { code: { type: 'string', description: 'Python code calling apis.<app>.<fn>(...)' } },\n required: ['code'],\n },\n },\n}\n\n/** One persistent world session: line-JSONL request/response over the driver. */\nasync function withWorldSession<T>(\n taskId: string,\n split: string,\n fn: (call: (cmd: Record<string, unknown>) => Promise<Record<string, unknown>>, instruction: string) => Promise<T>,\n): Promise<T> {\n const child = spawn(venvPython, [DRIVER, 'session', '--task-id', taskId, '--split', split], {\n cwd: benchRoot,\n })\n const rl = createInterface({ input: child.stdout })\n const pending: Array<(line: string) => void> = []\n const backlog: string[] = []\n rl.on('line', (l) => {\n const next = pending.shift()\n if (next) next(l)\n else backlog.push(l)\n })\n let stderr = ''\n child.stderr.on('data', (c: Buffer) => {\n stderr += c.toString('utf8')\n })\n const nextLine = (timeoutMs: number): Promise<string> =>\n new Promise((resolve, reject) => {\n const fromBacklog = backlog.shift()\n if (fromBacklog !== undefined) return resolve(fromBacklog)\n const t = setTimeout(\n () => reject(new Error(`appworld session: no response in ${timeoutMs}ms; stderr: ${stderr.slice(-400)}`)),\n timeoutMs,\n )\n // One exit listener per await leaks (25-turn episodes blow the listener\n // cap) — remove it on the resolve path.\n const onExit = (code: number | null): void => {\n clearTimeout(t)\n reject(new Error(`appworld session exited (${code}); stderr: ${stderr.slice(-400)}`))\n }\n pending.push((l) => {\n clearTimeout(t)\n child.removeListener('exit', onExit)\n resolve(l)\n })\n child.once('exit', onExit)\n })\n try {\n const ready = JSON.parse(await nextLine(120_000)) as { ready?: boolean; instruction?: string; error?: string }\n if (!ready.ready) throw new Error(`appworld session failed to start: ${ready.error ?? 'no ready line'}`)\n const call = async (cmd: Record<string, unknown>): Promise<Record<string, unknown>> => {\n child.stdin.write(`${JSON.stringify(cmd)}\\n`)\n const res = JSON.parse(await nextLine(180_000)) as Record<string, unknown>\n if (typeof res.error === 'string') throw new Error(`appworld session op failed: ${res.error}`)\n return res\n }\n return await fn(call, ready.instruction ?? '')\n } finally {\n child.stdin.end()\n child.kill('SIGTERM')\n }\n}\n\n/** SandboxClient whose leaf is OUR routerToolLoop driving a persistent world session. */\nexport function appworldToolLoopClient(cfg: {\n model: string\n routerBaseUrl: string\n routerKey: string\n maxTurns?: number\n}): unknown {\n const maxTurns = cfg.maxTurns ?? Number(process.env.REACT_MAX_TURNS ?? 40)\n let seq = 0\n return {\n async create() {\n const id = `appworld-toolloop-${seq++}`\n return {\n id,\n async *streamPrompt(prompt: string) {\n const m = prompt.match(REACT_HEADER)\n if (!m) {\n throw new Error(\n `appworld-react leaf: prompt missing '@appworld-react <taskId> <split>' header — got: ${prompt.slice(0, 120)}`,\n )\n }\n const [, taskId, split] = m\n const directive = prompt.replace(REACT_HEADER, '').trim()\n const out = await withWorldSession(taskId as string, split as string, async (call, instruction) => {\n const system = directive ? `${SESSION_SYSTEM}\\n\\n${directive}` : SESSION_SYSTEM\n const loop = await routerToolLoop(\n { routerBaseUrl: cfg.routerBaseUrl, routerKey: cfg.routerKey, model: cfg.model },\n system,\n `Task: ${instruction}`,\n [EXECUTE_TOOL],\n async (name, args) => {\n if (name !== 'execute_python') return `error: unknown tool ${name}`\n const res = await call({ op: 'execute', code: String(args.code ?? '') })\n const done = res.task_completed === true\n return `${String(res.output ?? '')}${done ? '\\n\\n[TASK MARKED COMPLETE — reply with a final summary and do not call the tool again]' : ''}`\n },\n { maxTurns },\n )\n const verdict = (await call({ op: 'evaluate' })) as unknown as ReactResult\n const transcript = loop.toolTrace\n .slice(-3)\n .map((t) => `CODE:\\n${t.args.slice(0, 600)}\\nOUTPUT:\\n${t.result.slice(0, 600)}`)\n .join('\\n---\\n')\n .slice(0, 1600)\n return {\n ...verdict,\n turns: loop.turns,\n input_tokens: loop.usage.input,\n output_tokens: loop.usage.output,\n transcript,\n } satisfies ReactResult\n })\n // Real usage from the episode — flat llm_call so the kernel meters it.\n if (out.input_tokens || out.output_tokens) {\n yield {\n type: 'llm_call',\n data: { tokensIn: out.input_tokens ?? 0, tokensOut: out.output_tokens ?? 0, model: cfg.model },\n }\n }\n yield { type: 'result', data: { finalText: JSON.stringify(out) } }\n },\n async delete() {},\n }\n },\n }\n}\n\n/** Artifact = the episode's evaluation JSON, verbatim (no fence extraction). */\nconst reactEpisodeOutput: OutputAdapter<string> = {\n parse(events) {\n let text = ''\n for (const ev of events) {\n const d = (ev as { data?: Record<string, unknown> })?.data\n const t = d?.finalText\n if (typeof t === 'string' && t.length > 0) text = t\n }\n return text\n },\n}\n\nexport function createAppWorldReactAdapter(): BenchmarkAdapter {\n const base = createAppWorldAdapter()\n return {\n name: 'appworld-react',\n output: reactEpisodeOutput,\n preflight: () => base.preflight(),\n\n async loadTasks(opts: LoadOptions = {}): Promise<BenchTask[]> {\n const tasks = await base.loadTasks(opts)\n return tasks.map((t) => {\n const meta = readMeta(t)\n return {\n ...t,\n // Header carries task identity to the leaf; the body (empty at round 0)\n // is the directive slot the arms append their steer into.\n prompt: `@appworld-react ${meta.taskId} ${meta.split}\\n`,\n }\n })\n },\n\n goldArtifact: () => Promise.resolve(undefined),\n\n async judge(task: BenchTask, artifact: string): Promise<BenchScore> {\n const meta = readMeta(task)\n let out: ReactResult\n try {\n out = JSON.parse(artifact) as ReactResult\n } catch {\n throw new Error(\n `appworld-react judge: artifact is not the episode's evaluation JSON (task ${meta.taskId}): ${artifact.slice(0, 200)}`,\n )\n }\n if (typeof out.success !== 'boolean' || typeof out.num_tests !== 'number') {\n throw new Error(\n `appworld-react judge: episode JSON missing success/num_tests (task ${meta.taskId}): ${artifact.slice(0, 200)}`,\n )\n }\n const passes = out.passes ?? 0\n const total = out.num_tests\n const failures = Array.isArray(out.failure_names) ? out.failure_names : []\n return {\n resolved: out.success === true,\n score: total > 0 ? passes / total : 0,\n detail: JSON.stringify({\n taskId: meta.taskId,\n success: out.success,\n passes,\n fails: out.fails ?? 0,\n total,\n turns: out.turns,\n ...(failures.length ? { failures } : {}),\n ...(out.transcript ? { transcriptTail: out.transcript.slice(-800) } : {}),\n }),\n }\n },\n\n leafClient: (c) => appworldToolLoopClient(c),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,SAAS,KAAK,WAAW,WAAW,oBAAoB;;AAG9D,MAAM,gBAAgB;;AAQtB,MAAa,yBAAgD,EAC3D,MAAM,QAAQ;CACZ,IAAI,OAAO;CACX,KAAK,MAAM,MAAM,QAAQ;EACvB,MAAM,IAAK,IAA2C;EACtD,MAAM,IAAI,GAAG,aAAa,GAAG,QAAQ,GAAG;EACxC,IAAI,OAAO,MAAM,YAAY,EAAE,SAAS,GAAG,OAAO;CACpD;CAEA,QAAQ,CADQ,GAAG,KAAK,SAAS,sCAAsC,CAC1D,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,KAAA,CAAM,KAAK;AAC3C,EACF;AAEA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,SAAS,SAAS,MAA+B;CAC/C,MAAM,KAAK,KAAK;CAChB,IAAI,CAAC,MAAM,OAAO,GAAG,WAAW,UAC9B,MAAM,IAAI,MAAM,iBAAiB,KAAK,GAAG,yDAAyD;CAEpG,OAAO;AACT;;;;;;;AAQA,eAAe,OAAO,MAAgB,QAAQ,IAAsB;CAClE,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,mBAAmB,QAAQ,MAAM,OAAO,EAAE,KAAK,UAAU,CAAC;CAC3E,SAAS,KAAK;EACZ,MAAM,IAAI;EACV,MAAM,IAAI,MAAM,2BAA2B,KAAK,KAAK,GAAG,EAAE,MAAM,EAAE,WAAW,OAAO,GAAG,EAAA,CAAG,MAAM,GAAG,IAAI,GAAG;CAC5G;CACA,MAAM,OAAO,OAAO,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK;CACjD,MAAM,SAAS,KAAK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C7C;AACF"}
@@ -1,18 +1,8 @@
1
- import { OutputAdapter } from '@tangle-network/agent-runtime/loops';
2
- import { BenchmarkAdapter } from './types.js';
3
-
4
- /**
5
- * Berkeley Function Calling Leaderboard adapter.
6
- *
7
- * Scope: deterministic function-call ground-truth categories from the official
8
- * BFCL data files. This is NOT the full live BFCL leaderboard evaluator: agentic
9
- * web-search/memory categories and BFCL's own model-response harness remain
10
- * upstream responsibilities. The adapter loads official JSONL rows plus their
11
- * `possible_answer` file and scores structured function-call artifacts against
12
- * allowed function/argument values.
13
- */
14
-
1
+ import { BenchmarkAdapter } from "./types.js";
2
+ import { OutputAdapter } from "@tangle-network/agent-runtime/loops";
3
+ //#region src/benchmarks/bfcl.d.ts
15
4
  declare const bfclOutput: OutputAdapter<string>;
16
5
  declare function createBfclAdapter(): BenchmarkAdapter;
17
-
6
+ //#endregion
18
7
  export { bfclOutput, createBfclAdapter };
8
+ //# sourceMappingURL=bfcl.d.ts.map