ui-gateway 0.1.1 → 0.1.2

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 (362) hide show
  1. package/AGENTS.md +41 -6
  2. package/BENCHMARK.md +141 -0
  3. package/CHANGELOG.md +200 -2
  4. package/CONTRIBUTING.md +48 -6
  5. package/NON-GOALS.md +9 -6
  6. package/README.md +136 -41
  7. package/SECURITY.md +22 -1
  8. package/SKILL.md +71 -17
  9. package/action.yml +90 -0
  10. package/dist/evals/src/baseline.d.ts +4 -1
  11. package/dist/evals/src/baseline.d.ts.map +1 -1
  12. package/dist/evals/src/baseline.js +28 -6
  13. package/dist/evals/src/baseline.js.map +1 -1
  14. package/dist/evals/src/metrics.d.ts +35 -0
  15. package/dist/evals/src/metrics.d.ts.map +1 -1
  16. package/dist/evals/src/metrics.js +24 -0
  17. package/dist/evals/src/metrics.js.map +1 -1
  18. package/dist/packages/adapters/src/angular/index.js +2 -2
  19. package/dist/packages/adapters/src/angular/manifest.d.ts.map +1 -1
  20. package/dist/packages/adapters/src/angular/manifest.js +2 -8
  21. package/dist/packages/adapters/src/angular/manifest.js.map +1 -1
  22. package/dist/packages/adapters/src/antd/index.js +2 -2
  23. package/dist/packages/adapters/src/antd/manifest.d.ts.map +1 -1
  24. package/dist/packages/adapters/src/antd/manifest.js +2 -8
  25. package/dist/packages/adapters/src/antd/manifest.js.map +1 -1
  26. package/dist/packages/adapters/src/bootstrap/index.js +2 -2
  27. package/dist/packages/adapters/src/bootstrap/manifest.d.ts.map +1 -1
  28. package/dist/packages/adapters/src/bootstrap/manifest.js +2 -8
  29. package/dist/packages/adapters/src/bootstrap/manifest.js.map +1 -1
  30. package/dist/packages/adapters/src/chakra/index.d.ts.map +1 -1
  31. package/dist/packages/adapters/src/chakra/index.js +30 -5
  32. package/dist/packages/adapters/src/chakra/index.js.map +1 -1
  33. package/dist/packages/adapters/src/chakra/manifest.d.ts.map +1 -1
  34. package/dist/packages/adapters/src/chakra/manifest.js +309 -10
  35. package/dist/packages/adapters/src/chakra/manifest.js.map +1 -1
  36. package/dist/packages/adapters/src/index.d.ts +4 -0
  37. package/dist/packages/adapters/src/index.d.ts.map +1 -1
  38. package/dist/packages/adapters/src/index.js +18 -14
  39. package/dist/packages/adapters/src/index.js.map +1 -1
  40. package/dist/packages/adapters/src/local.d.ts.map +1 -1
  41. package/dist/packages/adapters/src/local.js +4 -2
  42. package/dist/packages/adapters/src/local.js.map +1 -1
  43. package/dist/packages/adapters/src/mantine/index.js +3 -3
  44. package/dist/packages/adapters/src/mantine/manifest.d.ts.map +1 -1
  45. package/dist/packages/adapters/src/mantine/manifest.js +8 -21
  46. package/dist/packages/adapters/src/mantine/manifest.js.map +1 -1
  47. package/dist/packages/adapters/src/mui/index.js +3 -3
  48. package/dist/packages/adapters/src/mui/manifest.d.ts.map +1 -1
  49. package/dist/packages/adapters/src/mui/manifest.js +2 -11
  50. package/dist/packages/adapters/src/mui/manifest.js.map +1 -1
  51. package/dist/packages/adapters/src/nuxt-ui/index.d.ts +5 -0
  52. package/dist/packages/adapters/src/nuxt-ui/index.d.ts.map +1 -0
  53. package/dist/packages/adapters/src/nuxt-ui/index.js +79 -0
  54. package/dist/packages/adapters/src/nuxt-ui/index.js.map +1 -0
  55. package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts +3 -0
  56. package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts.map +1 -0
  57. package/dist/packages/adapters/src/nuxt-ui/manifest.js +295 -0
  58. package/dist/packages/adapters/src/nuxt-ui/manifest.js.map +1 -0
  59. package/dist/packages/adapters/src/radix/index.d.ts +5 -0
  60. package/dist/packages/adapters/src/radix/index.d.ts.map +1 -0
  61. package/dist/packages/adapters/src/radix/index.js +71 -0
  62. package/dist/packages/adapters/src/radix/index.js.map +1 -0
  63. package/dist/packages/adapters/src/radix/manifest.d.ts +3 -0
  64. package/dist/packages/adapters/src/radix/manifest.d.ts.map +1 -0
  65. package/dist/packages/adapters/src/radix/manifest.js +331 -0
  66. package/dist/packages/adapters/src/radix/manifest.js.map +1 -0
  67. package/dist/packages/adapters/src/registry.d.ts +1 -1
  68. package/dist/packages/adapters/src/registry.d.ts.map +1 -1
  69. package/dist/packages/adapters/src/registry.js +16 -12
  70. package/dist/packages/adapters/src/registry.js.map +1 -1
  71. package/dist/packages/adapters/src/shadcn/index.js +3 -3
  72. package/dist/packages/adapters/src/shadcn/manifest.d.ts.map +1 -1
  73. package/dist/packages/adapters/src/shadcn/manifest.js +2 -11
  74. package/dist/packages/adapters/src/shadcn/manifest.js.map +1 -1
  75. package/dist/packages/adapters/src/solid/index.js +2 -2
  76. package/dist/packages/adapters/src/solid/manifest.d.ts.map +1 -1
  77. package/dist/packages/adapters/src/solid/manifest.js +2 -8
  78. package/dist/packages/adapters/src/solid/manifest.js.map +1 -1
  79. package/dist/packages/adapters/src/svelte/index.js +2 -2
  80. package/dist/packages/adapters/src/svelte/manifest.d.ts.map +1 -1
  81. package/dist/packages/adapters/src/svelte/manifest.js +2 -8
  82. package/dist/packages/adapters/src/svelte/manifest.js.map +1 -1
  83. package/dist/packages/adapters/src/vue/index.js +2 -2
  84. package/dist/packages/adapters/src/vue/manifest.d.ts.map +1 -1
  85. package/dist/packages/adapters/src/vue/manifest.js +2 -8
  86. package/dist/packages/adapters/src/vue/manifest.js.map +1 -1
  87. package/dist/packages/design-md/src/compile.js +2 -2
  88. package/dist/packages/design-md/src/derive.d.ts +41 -0
  89. package/dist/packages/design-md/src/derive.d.ts.map +1 -0
  90. package/dist/packages/design-md/src/derive.js +341 -0
  91. package/dist/packages/design-md/src/derive.js.map +1 -0
  92. package/dist/packages/design-md/src/index.d.ts +1 -0
  93. package/dist/packages/design-md/src/index.d.ts.map +1 -1
  94. package/dist/packages/design-md/src/index.js +6 -5
  95. package/dist/packages/design-md/src/index.js.map +1 -1
  96. package/dist/packages/gateway/src/confidence.d.ts +51 -1
  97. package/dist/packages/gateway/src/confidence.d.ts.map +1 -1
  98. package/dist/packages/gateway/src/confidence.js +198 -6
  99. package/dist/packages/gateway/src/confidence.js.map +1 -1
  100. package/dist/packages/gateway/src/gateway.d.ts +10 -2
  101. package/dist/packages/gateway/src/gateway.d.ts.map +1 -1
  102. package/dist/packages/gateway/src/gateway.js +190 -14
  103. package/dist/packages/gateway/src/gateway.js.map +1 -1
  104. package/dist/packages/gateway/src/index.d.ts +1 -0
  105. package/dist/packages/gateway/src/index.d.ts.map +1 -1
  106. package/dist/packages/gateway/src/index.js +7 -6
  107. package/dist/packages/gateway/src/index.js.map +1 -1
  108. package/dist/packages/gateway/src/preview.d.ts +12 -0
  109. package/dist/packages/gateway/src/preview.d.ts.map +1 -0
  110. package/dist/packages/gateway/src/preview.js +113 -0
  111. package/dist/packages/gateway/src/preview.js.map +1 -0
  112. package/dist/packages/gateway/src/validate.d.ts +5 -2
  113. package/dist/packages/gateway/src/validate.d.ts.map +1 -1
  114. package/dist/packages/gateway/src/validate.js +46 -18
  115. package/dist/packages/gateway/src/validate.js.map +1 -1
  116. package/dist/packages/kb/src/bundle-size.d.ts +8 -9
  117. package/dist/packages/kb/src/bundle-size.d.ts.map +1 -1
  118. package/dist/packages/kb/src/bundle-size.js +14 -12
  119. package/dist/packages/kb/src/bundle-size.js.map +1 -1
  120. package/dist/packages/kb/src/entry.d.ts +19 -1
  121. package/dist/packages/kb/src/entry.d.ts.map +1 -1
  122. package/dist/packages/kb/src/entry.js +13 -1
  123. package/dist/packages/kb/src/entry.js.map +1 -1
  124. package/dist/packages/kb/src/freshness.d.ts +76 -0
  125. package/dist/packages/kb/src/freshness.d.ts.map +1 -0
  126. package/dist/packages/kb/src/freshness.js +186 -0
  127. package/dist/packages/kb/src/freshness.js.map +1 -0
  128. package/dist/packages/kb/src/index.d.ts +2 -1
  129. package/dist/packages/kb/src/index.d.ts.map +1 -1
  130. package/dist/packages/kb/src/index.js +6 -5
  131. package/dist/packages/kb/src/index.js.map +1 -1
  132. package/dist/packages/kb/src/ingest.d.ts +3 -0
  133. package/dist/packages/kb/src/ingest.d.ts.map +1 -1
  134. package/dist/packages/kb/src/ingest.js +7 -1
  135. package/dist/packages/kb/src/ingest.js.map +1 -1
  136. package/dist/packages/kb/src/kb.d.ts +5 -0
  137. package/dist/packages/kb/src/kb.d.ts.map +1 -1
  138. package/dist/packages/kb/src/kb.js +5 -2
  139. package/dist/packages/kb/src/kb.js.map +1 -1
  140. package/dist/packages/matcher/src/anthropic.js +1 -1
  141. package/dist/packages/matcher/src/index.d.ts +8 -1
  142. package/dist/packages/matcher/src/index.d.ts.map +1 -1
  143. package/dist/packages/matcher/src/index.js +21 -11
  144. package/dist/packages/matcher/src/index.js.map +1 -1
  145. package/dist/packages/matcher/src/scaffold.d.ts.map +1 -1
  146. package/dist/packages/matcher/src/scaffold.js +62 -19
  147. package/dist/packages/matcher/src/scaffold.js.map +1 -1
  148. package/dist/packages/matcher/src/score.d.ts +8 -1
  149. package/dist/packages/matcher/src/score.d.ts.map +1 -1
  150. package/dist/packages/matcher/src/score.js +90 -25
  151. package/dist/packages/matcher/src/score.js.map +1 -1
  152. package/dist/packages/matcher/src/select.d.ts +15 -1
  153. package/dist/packages/matcher/src/select.d.ts.map +1 -1
  154. package/dist/packages/matcher/src/select.js +53 -3
  155. package/dist/packages/matcher/src/select.js.map +1 -1
  156. package/dist/packages/orchestrator/src/figma.d.ts +12 -0
  157. package/dist/packages/orchestrator/src/figma.d.ts.map +1 -0
  158. package/dist/packages/orchestrator/src/figma.js +102 -0
  159. package/dist/packages/orchestrator/src/figma.js.map +1 -0
  160. package/dist/packages/orchestrator/src/index.d.ts +1 -0
  161. package/dist/packages/orchestrator/src/index.d.ts.map +1 -1
  162. package/dist/packages/orchestrator/src/index.js +3 -2
  163. package/dist/packages/orchestrator/src/index.js.map +1 -1
  164. package/dist/packages/orchestrator/src/orchestrator.d.ts.map +1 -1
  165. package/dist/packages/orchestrator/src/orchestrator.js +14 -3
  166. package/dist/packages/orchestrator/src/orchestrator.js.map +1 -1
  167. package/dist/packages/profile/src/detect.d.ts +9 -0
  168. package/dist/packages/profile/src/detect.d.ts.map +1 -1
  169. package/dist/packages/profile/src/detect.js +52 -5
  170. package/dist/packages/profile/src/detect.js.map +1 -1
  171. package/dist/packages/profile/src/index.js +7 -7
  172. package/dist/packages/profile/src/local-components.d.ts.map +1 -1
  173. package/dist/packages/profile/src/local-components.js +70 -1
  174. package/dist/packages/profile/src/local-components.js.map +1 -1
  175. package/dist/packages/profile/src/registry.d.ts.map +1 -1
  176. package/dist/packages/profile/src/registry.js +3 -1
  177. package/dist/packages/profile/src/registry.js.map +1 -1
  178. package/dist/packages/profile/src/skills.js +1 -1
  179. package/dist/packages/protocol/src/errors.js +1 -1
  180. package/dist/packages/protocol/src/errors.js.map +1 -1
  181. package/dist/packages/protocol/src/event-log.d.ts.map +1 -1
  182. package/dist/packages/protocol/src/event-log.js +11 -5
  183. package/dist/packages/protocol/src/event-log.js.map +1 -1
  184. package/dist/packages/protocol/src/events.js +5 -5
  185. package/dist/packages/protocol/src/hashing.d.ts +6 -0
  186. package/dist/packages/protocol/src/hashing.d.ts.map +1 -1
  187. package/dist/packages/protocol/src/hashing.js +8 -2
  188. package/dist/packages/protocol/src/hashing.js.map +1 -1
  189. package/dist/packages/protocol/src/index.js +12 -12
  190. package/dist/packages/protocol/src/lease.js +2 -2
  191. package/dist/packages/protocol/src/schemas.d.ts +2803 -116
  192. package/dist/packages/protocol/src/schemas.d.ts.map +1 -1
  193. package/dist/packages/protocol/src/schemas.js +54 -4
  194. package/dist/packages/protocol/src/schemas.js.map +1 -1
  195. package/dist/packages/protocol/src/semantic.js +1 -1
  196. package/dist/packages/protocol/src/state-machine.js +1 -1
  197. package/dist/packages/transports/src/check.d.ts +30 -0
  198. package/dist/packages/transports/src/check.d.ts.map +1 -0
  199. package/dist/packages/transports/src/check.js +190 -0
  200. package/dist/packages/transports/src/check.js.map +1 -0
  201. package/dist/packages/transports/src/cli.d.ts +1 -1
  202. package/dist/packages/transports/src/cli.js +278 -25
  203. package/dist/packages/transports/src/cli.js.map +1 -1
  204. package/dist/packages/transports/src/exit-codes.d.ts +8 -0
  205. package/dist/packages/transports/src/exit-codes.d.ts.map +1 -0
  206. package/dist/packages/transports/src/exit-codes.js +19 -0
  207. package/dist/packages/transports/src/exit-codes.js.map +1 -0
  208. package/dist/packages/transports/src/http.js +2 -2
  209. package/dist/packages/transports/src/http.js.map +1 -1
  210. package/dist/packages/transports/src/index.d.ts +5 -0
  211. package/dist/packages/transports/src/index.d.ts.map +1 -1
  212. package/dist/packages/transports/src/index.js +11 -6
  213. package/dist/packages/transports/src/index.js.map +1 -1
  214. package/dist/packages/transports/src/init.d.ts +32 -0
  215. package/dist/packages/transports/src/init.d.ts.map +1 -0
  216. package/dist/packages/transports/src/init.js +110 -0
  217. package/dist/packages/transports/src/init.js.map +1 -0
  218. package/dist/packages/transports/src/mcp-config.d.ts +27 -0
  219. package/dist/packages/transports/src/mcp-config.d.ts.map +1 -0
  220. package/dist/packages/transports/src/mcp-config.js +99 -0
  221. package/dist/packages/transports/src/mcp-config.js.map +1 -0
  222. package/dist/packages/transports/src/mcp.js +3 -3
  223. package/dist/packages/transports/src/paths.d.ts +9 -0
  224. package/dist/packages/transports/src/paths.d.ts.map +1 -0
  225. package/dist/packages/transports/src/paths.js +32 -0
  226. package/dist/packages/transports/src/paths.js.map +1 -0
  227. package/dist/packages/transports/src/receipt.d.ts +8 -0
  228. package/dist/packages/transports/src/receipt.d.ts.map +1 -0
  229. package/dist/packages/transports/src/receipt.js +87 -0
  230. package/dist/packages/transports/src/receipt.js.map +1 -0
  231. package/dist/packages/transports/src/resources.js +3 -3
  232. package/dist/packages/transports/src/resources.js.map +1 -1
  233. package/dist/packages/transports/src/tools.d.ts.map +1 -1
  234. package/dist/packages/transports/src/tools.js +284 -10
  235. package/dist/packages/transports/src/tools.js.map +1 -1
  236. package/dist/packages/verifier/src/index.js +7 -7
  237. package/dist/packages/verifier/src/lint.js +1 -1
  238. package/dist/packages/verifier/src/page.js +2 -2
  239. package/dist/packages/verifier/src/render-axe.js +1 -1
  240. package/dist/packages/verifier/src/verify.js +4 -4
  241. package/dist/scripts/build-site.d.ts +2 -0
  242. package/dist/scripts/build-site.d.ts.map +1 -0
  243. package/dist/scripts/build-site.js +254 -0
  244. package/dist/scripts/build-site.js.map +1 -0
  245. package/dist/scripts/calibration.js +33 -2
  246. package/dist/scripts/calibration.js.map +1 -1
  247. package/dist/scripts/fix-imports.js +32 -2
  248. package/dist/scripts/fix-imports.js.map +1 -1
  249. package/dist/scripts/generate-kb.d.ts +3 -0
  250. package/dist/scripts/generate-kb.d.ts.map +1 -0
  251. package/dist/scripts/generate-kb.js +195 -0
  252. package/dist/scripts/generate-kb.js.map +1 -0
  253. package/dist/scripts/generate-refusal-catalog.d.ts +3 -0
  254. package/dist/scripts/generate-refusal-catalog.d.ts.map +1 -0
  255. package/dist/scripts/generate-refusal-catalog.js +50 -0
  256. package/dist/scripts/generate-refusal-catalog.js.map +1 -0
  257. package/dist/scripts/generate-tool-docs.d.ts +3 -0
  258. package/dist/scripts/generate-tool-docs.d.ts.map +1 -0
  259. package/dist/scripts/generate-tool-docs.js +24 -0
  260. package/dist/scripts/generate-tool-docs.js.map +1 -0
  261. package/dist/scripts/mcp-config.js +28 -60
  262. package/dist/scripts/mcp-config.js.map +1 -1
  263. package/docs/archive/UI Gateway Final Project Roadmap.md +285 -0
  264. package/docs/benchmarks/external-repos.json +26 -0
  265. package/docs/benchmarks/local-gemma3-1b-stride32.json +455 -0
  266. package/docs/calibration.svg +44 -0
  267. package/docs/design-import.md +19 -0
  268. package/docs/design-md.md +109 -0
  269. package/docs/distribution.md +41 -0
  270. package/docs/engineering-principles.md +152 -0
  271. package/docs/layers-plan.md +372 -0
  272. package/docs/metrics.md +153 -0
  273. package/docs/modes.md +22 -0
  274. package/docs/parking-lot.md +25 -0
  275. package/docs/quickstart.md +72 -0
  276. package/docs/refusal-catalog.md +32 -0
  277. package/docs/spike-source-discovery.md +36 -0
  278. package/docs/telemetry.md +26 -0
  279. package/evals/fixtures/external-repos.json +55 -0
  280. package/evals/fixtures/kb-generated/angular.json +72 -0
  281. package/evals/fixtures/kb-generated/antd.json +72 -0
  282. package/evals/fixtures/kb-generated/bootstrap.json +72 -0
  283. package/evals/fixtures/kb-generated/chakra.json +14939 -0
  284. package/evals/fixtures/kb-generated/mantine.json +192 -0
  285. package/evals/fixtures/kb-generated/mui.json +8997 -0
  286. package/evals/fixtures/kb-generated/shadcn.json +192 -0
  287. package/evals/fixtures/kb-generated/solid.json +72 -0
  288. package/evals/fixtures/kb-generated/svelte.json +72 -0
  289. package/evals/fixtures/kb-generated/vue.json +72 -0
  290. package/evals/fixtures/projects/existing-chakra-v3/package.json +10 -0
  291. package/evals/fixtures/projects/existing-nuxt-ui/package.json +9 -0
  292. package/evals/fixtures/projects/existing-radix/package.json +9 -0
  293. package/evals/out/agent-report.json +190 -11
  294. package/evals/out/baseline-report.json +1441 -387
  295. package/evals/out/calibration.json +387 -42
  296. package/evals/out/external-repos-report.json +112 -0
  297. package/evals/out/local-benchmark-report.json +455 -0
  298. package/evals/src/agent-eval.test.ts +3 -0
  299. package/evals/src/agent-eval.ts +26 -4
  300. package/evals/src/baseline.ts +48 -7
  301. package/evals/src/blind-labeling-cli.ts +5 -0
  302. package/evals/src/blind-labeling.ts +46 -0
  303. package/evals/src/external-repos.ts +179 -0
  304. package/evals/src/metrics.ts +70 -0
  305. package/evals/src/mutations.ts +6 -6
  306. package/evals/src/page-a11y-eval.ts +37 -36
  307. package/evals/src/page-real-eval.ts +8 -7
  308. package/evals/src/plain-agent.test.ts +14 -0
  309. package/evals/src/plain-agent.ts +240 -0
  310. package/evals/src/run-agent-evals.ts +3 -0
  311. package/evals/src/run-external-repos.ts +43 -0
  312. package/evals/src/run-local-benchmark.ts +105 -0
  313. package/evals/src/run-plain-agent.ts +81 -0
  314. package/examples/README.md +32 -0
  315. package/examples/build-handoff.ts +106 -0
  316. package/examples/design-md.md +24 -0
  317. package/examples/handoff-input.json +59 -0
  318. package/examples/handoff.json +216 -0
  319. package/examples/layer-operations.json +18 -0
  320. package/examples/website-demo-handoff.json +580 -0
  321. package/package.json +29 -6
  322. package/references/design-md.md +3 -1
  323. package/references/errors.md +1 -1
  324. package/references/handoff.md +16 -1
  325. package/references/outcomes.md +60 -11
  326. package/references/patterns.md +3 -3
  327. package/references/tools.md +86 -27
  328. package/scripts/action-review.mjs +59 -0
  329. package/scripts/bench-latency.ts +90 -0
  330. package/scripts/build-site.ts +324 -0
  331. package/scripts/calibration.ts +50 -14
  332. package/scripts/fix-imports.ts +31 -2
  333. package/scripts/generate-kb.ts +214 -0
  334. package/scripts/generate-refusal-catalog.ts +58 -0
  335. package/scripts/generate-tool-docs.ts +31 -0
  336. package/scripts/mcp-config.ts +26 -83
  337. package/scripts/package-plugin.mjs +50 -0
  338. package/scripts/sbom.mjs +46 -0
  339. package/scripts/visual-diff.mjs +52 -0
  340. package/site/data.json +187 -0
  341. package/site/index.html +151 -0
  342. package/skills/ui-gateway-cli/SKILL.md +41 -0
  343. package/templates/next-shadcn/.github/workflows/ui-check.yml +14 -0
  344. package/templates/next-shadcn/.mcp.json +8 -0
  345. package/templates/next-shadcn/DESIGN.md +35 -0
  346. package/templates/next-shadcn/README.md +14 -0
  347. package/templates/next-shadcn/app/page.tsx +8 -0
  348. package/templates/next-shadcn/package.json +19 -0
  349. package/templates/vite-mantine/.github/workflows/ui-check.yml +14 -0
  350. package/templates/vite-mantine/.mcp.json +8 -0
  351. package/templates/vite-mantine/DESIGN.md +30 -0
  352. package/templates/vite-mantine/README.md +7 -0
  353. package/templates/vite-mantine/package.json +21 -0
  354. package/templates/vite-mantine/src/App.tsx +10 -0
  355. package/templates/vite-mui/.github/workflows/ui-check.yml +14 -0
  356. package/templates/vite-mui/.mcp.json +8 -0
  357. package/templates/vite-mui/DESIGN.md +30 -0
  358. package/templates/vite-mui/README.md +8 -0
  359. package/templates/vite-mui/package.json +22 -0
  360. package/templates/vite-mui/src/App.tsx +12 -0
  361. package/scripts/fetch-bundle-sizes.ts +0 -106
  362. package/scripts/test-bundlephobia.ts +0 -11
@@ -0,0 +1,455 @@
1
+ {
2
+ "generated_at": "2026-11-28T17:43:15.612Z",
3
+ "model_info": {
4
+ "provider": "ollama",
5
+ "id": "gemma3:1b",
6
+ "base_url": "http://localhost:11434"
7
+ },
8
+ "sample": {
9
+ "stride": 32,
10
+ "gateway_items": 6,
11
+ "plain_agent_items": 6,
12
+ "note": "Stratified subset, not the full 172-item set. These are local Ollama numbers; they are not DeepSeek or Claude numbers."
13
+ },
14
+ "gateway": {
15
+ "thresholds_passed": false,
16
+ "arms": [
17
+ {
18
+ "name": "full_skill",
19
+ "metrics": {
20
+ "n": 6,
21
+ "schema_validity": 1,
22
+ "hallucination_rate": 0,
23
+ "constraint_violation_rate": 0,
24
+ "acceptable_set_hit_rate": 0.667,
25
+ "acceptable_set_hit_interval": {
26
+ "low": 0.3,
27
+ "high": 0.903,
28
+ "center": 0.602
29
+ },
30
+ "silent_wrong_rate": 0,
31
+ "abstention_rate": 0.333,
32
+ "invalid_import_rate": 0,
33
+ "invalid_prop_rate": 0,
34
+ "turns_to_green": 0,
35
+ "refusal_precision": 1,
36
+ "unsafe_accept_rate": 0,
37
+ "counts": {
38
+ "hits": 4,
39
+ "hallucinations": 0,
40
+ "predicted": 4,
41
+ "silent_wrong": 0,
42
+ "abstained": 2,
43
+ "invalid_imports": 0,
44
+ "invalid_props": 0,
45
+ "refusals": 0,
46
+ "correct_refusals": 0,
47
+ "unsafe_accepts": 0
48
+ }
49
+ }
50
+ },
51
+ {
52
+ "name": "no_retrieval",
53
+ "metrics": {
54
+ "n": 6,
55
+ "schema_validity": 1,
56
+ "hallucination_rate": 0,
57
+ "constraint_violation_rate": 0,
58
+ "acceptable_set_hit_rate": 0,
59
+ "acceptable_set_hit_interval": {
60
+ "low": 0,
61
+ "high": 0.39,
62
+ "center": 0.195
63
+ },
64
+ "silent_wrong_rate": 0,
65
+ "abstention_rate": 1,
66
+ "invalid_import_rate": 0,
67
+ "invalid_prop_rate": 0,
68
+ "turns_to_green": 0,
69
+ "refusal_precision": 0,
70
+ "unsafe_accept_rate": 0,
71
+ "counts": {
72
+ "hits": 0,
73
+ "hallucinations": 0,
74
+ "predicted": 0,
75
+ "silent_wrong": 0,
76
+ "abstained": 6,
77
+ "invalid_imports": 0,
78
+ "invalid_props": 0,
79
+ "refusals": 6,
80
+ "correct_refusals": 0,
81
+ "unsafe_accepts": 0
82
+ }
83
+ }
84
+ },
85
+ {
86
+ "name": "plain_generation",
87
+ "metrics": {
88
+ "n": 6,
89
+ "schema_validity": 1,
90
+ "hallucination_rate": 1,
91
+ "constraint_violation_rate": 0,
92
+ "acceptable_set_hit_rate": 0,
93
+ "acceptable_set_hit_interval": {
94
+ "low": 0,
95
+ "high": 0.39,
96
+ "center": 0.195
97
+ },
98
+ "silent_wrong_rate": 1,
99
+ "abstention_rate": 0,
100
+ "invalid_import_rate": 0,
101
+ "invalid_prop_rate": 0,
102
+ "turns_to_green": 0,
103
+ "refusal_precision": 1,
104
+ "unsafe_accept_rate": 1,
105
+ "counts": {
106
+ "hits": 0,
107
+ "hallucinations": 6,
108
+ "predicted": 6,
109
+ "silent_wrong": 6,
110
+ "abstained": 0,
111
+ "invalid_imports": 0,
112
+ "invalid_props": 0,
113
+ "refusals": 0,
114
+ "correct_refusals": 0,
115
+ "unsafe_accepts": 6
116
+ }
117
+ }
118
+ },
119
+ {
120
+ "name": "vendor_mcp_tsc",
121
+ "metrics": {
122
+ "n": 6,
123
+ "schema_validity": 1,
124
+ "hallucination_rate": 0,
125
+ "constraint_violation_rate": 0,
126
+ "acceptable_set_hit_rate": 0,
127
+ "acceptable_set_hit_interval": {
128
+ "low": 0,
129
+ "high": 0.39,
130
+ "center": 0.195
131
+ },
132
+ "silent_wrong_rate": 1,
133
+ "abstention_rate": 0,
134
+ "invalid_import_rate": 0,
135
+ "invalid_prop_rate": 0,
136
+ "turns_to_green": 1,
137
+ "refusal_precision": 1,
138
+ "unsafe_accept_rate": 1,
139
+ "counts": {
140
+ "hits": 0,
141
+ "hallucinations": 0,
142
+ "predicted": 6,
143
+ "silent_wrong": 6,
144
+ "abstained": 0,
145
+ "invalid_imports": 0,
146
+ "invalid_props": 0,
147
+ "refusals": 0,
148
+ "correct_refusals": 0,
149
+ "unsafe_accepts": 6
150
+ }
151
+ }
152
+ }
153
+ ],
154
+ "task_outcomes": {
155
+ "n": 6,
156
+ "compile_rate": 1,
157
+ "compile_interval": {
158
+ "low": 0.51,
159
+ "high": 1,
160
+ "center": 0.755
161
+ },
162
+ "lint_clean_rate": 1,
163
+ "a11y_clean_rate": 1,
164
+ "constraint_free_rate": 1,
165
+ "library_compliance_rate": 1,
166
+ "token_match_rate": null,
167
+ "acceptable_set_hit_rate": 0.667,
168
+ "mean_tool_calls": 1,
169
+ "mean_tokens": null,
170
+ "mean_wall_ms": 5629.167
171
+ },
172
+ "calibration": {
173
+ "total": 6,
174
+ "answered": 4,
175
+ "abstained": 2,
176
+ "coverage": 0.667,
177
+ "bins": [
178
+ {
179
+ "lower": 0,
180
+ "upper": 0.1,
181
+ "count": 0,
182
+ "count_correct": 0,
183
+ "count_incorrect": 0,
184
+ "mean_confidence": null,
185
+ "accuracy": null,
186
+ "gap": null
187
+ },
188
+ {
189
+ "lower": 0.1,
190
+ "upper": 0.2,
191
+ "count": 0,
192
+ "count_correct": 0,
193
+ "count_incorrect": 0,
194
+ "mean_confidence": null,
195
+ "accuracy": null,
196
+ "gap": null
197
+ },
198
+ {
199
+ "lower": 0.2,
200
+ "upper": 0.3,
201
+ "count": 0,
202
+ "count_correct": 0,
203
+ "count_incorrect": 0,
204
+ "mean_confidence": null,
205
+ "accuracy": null,
206
+ "gap": null
207
+ },
208
+ {
209
+ "lower": 0.3,
210
+ "upper": 0.4,
211
+ "count": 0,
212
+ "count_correct": 0,
213
+ "count_incorrect": 0,
214
+ "mean_confidence": null,
215
+ "accuracy": null,
216
+ "gap": null
217
+ },
218
+ {
219
+ "lower": 0.4,
220
+ "upper": 0.5,
221
+ "count": 0,
222
+ "count_correct": 0,
223
+ "count_incorrect": 0,
224
+ "mean_confidence": null,
225
+ "accuracy": null,
226
+ "gap": null
227
+ },
228
+ {
229
+ "lower": 0.5,
230
+ "upper": 0.6,
231
+ "count": 0,
232
+ "count_correct": 0,
233
+ "count_incorrect": 0,
234
+ "mean_confidence": null,
235
+ "accuracy": null,
236
+ "gap": null
237
+ },
238
+ {
239
+ "lower": 0.6,
240
+ "upper": 0.7,
241
+ "count": 0,
242
+ "count_correct": 0,
243
+ "count_incorrect": 0,
244
+ "mean_confidence": null,
245
+ "accuracy": null,
246
+ "gap": null
247
+ },
248
+ {
249
+ "lower": 0.7,
250
+ "upper": 0.8,
251
+ "count": 0,
252
+ "count_correct": 0,
253
+ "count_incorrect": 0,
254
+ "mean_confidence": null,
255
+ "accuracy": null,
256
+ "gap": null
257
+ },
258
+ {
259
+ "lower": 0.8,
260
+ "upper": 0.9,
261
+ "count": 0,
262
+ "count_correct": 0,
263
+ "count_incorrect": 0,
264
+ "mean_confidence": null,
265
+ "accuracy": null,
266
+ "gap": null
267
+ },
268
+ {
269
+ "lower": 0.9,
270
+ "upper": 1,
271
+ "count": 4,
272
+ "count_correct": 4,
273
+ "count_incorrect": 0,
274
+ "mean_confidence": 0.948,
275
+ "accuracy": 1,
276
+ "gap": 0.052
277
+ }
278
+ ],
279
+ "ece": 0.052,
280
+ "brier": 0.003,
281
+ "mean_confidence": 0.948,
282
+ "accuracy": 1
283
+ },
284
+ "n_sample_agreement": {
285
+ "total_blind_items": 0,
286
+ "samples_per_item": 1,
287
+ "agreements": [],
288
+ "overall_agreement_rate": 1,
289
+ "notes": [
290
+ "No blind items found in golden set; self-agreement not measured."
291
+ ]
292
+ }
293
+ },
294
+ "plain_agent": {
295
+ "arm": "plain_agent_no_gateway",
296
+ "description": "Same model, same project and normal read/write/tsc toolset, no gateway; outcome measured by the project verifier",
297
+ "generated_at": "2026-11-28T17:43:15.611Z",
298
+ "n": 6,
299
+ "outcomes": {
300
+ "n": 6,
301
+ "compile_rate": 0.167,
302
+ "compile_interval": {
303
+ "low": 0.03,
304
+ "high": 0.564,
305
+ "center": 0.297
306
+ },
307
+ "lint_clean_rate": 0.167,
308
+ "a11y_clean_rate": 0.5,
309
+ "constraint_free_rate": 0.833,
310
+ "library_compliance_rate": 1,
311
+ "token_match_rate": 0.167,
312
+ "acceptable_set_hit_rate": 0,
313
+ "mean_tool_calls": 1,
314
+ "mean_tokens": null,
315
+ "mean_wall_ms": 24268.167
316
+ },
317
+ "records": [
318
+ {
319
+ "item_id": "dev-01",
320
+ "compiles": false,
321
+ "lint_clean": false,
322
+ "a11y_clean": false,
323
+ "constraints_ok": true,
324
+ "libraries_allowed": true,
325
+ "tokens_matched": false,
326
+ "tool_calls": 1,
327
+ "tokens": null,
328
+ "wall_ms": 11956,
329
+ "predicted": [],
330
+ "acceptable": [
331
+ "shadcn/button"
332
+ ],
333
+ "code": "import React from 'react';\nimport { Button } from '@/components/ui';\n\nfunction SubmitButton({ title, onClick, children }) {\n return (\n <Button onClick={onClick}>\n {children}\n </Button>\n );\n}\n\nexport default SubmitButton;",
334
+ "issues": [
335
+ "UNUSED_IMPORT: \"React\" is imported from \"react\" but never used",
336
+ "UNLABELED_CONTROL: <Button> has no accessible name (add text, aria-label or aria-labelledby)",
337
+ "COMPILE_ERROR: tsc reported errors in generated scaffolds; first diagnostic: Component.tsx(4,25): error TS7031: Binding element 'title' implicitly has an 'any' type."
338
+ ]
339
+ },
340
+ {
341
+ "item_id": "dev-28",
342
+ "compiles": false,
343
+ "lint_clean": false,
344
+ "a11y_clean": true,
345
+ "constraints_ok": true,
346
+ "libraries_allowed": true,
347
+ "tokens_matched": false,
348
+ "tool_calls": 1,
349
+ "tokens": null,
350
+ "wall_ms": 12993,
351
+ "predicted": [],
352
+ "acceptable": [
353
+ "shadcn/textarea"
354
+ ],
355
+ "code": "import React from 'react';\nimport { Input, Style } from '@/components/ui';\n\nfunction DeliveryInstructionsForm({ deliveryNotes }) {\n return (\n <Style>\n <Input\n type=\"text\"\n placeholder=\"Delivery Notes\"\n value={deliveryNotes}\n onChange={(e) => {\n // Placeholder for handling input changes\n console.log('Input value:', e.target.value);\n }}\n />\n </Style>\n );\n}\n\nexport default DeliveryInstructionsForm;",
356
+ "issues": [
357
+ "UNUSED_IMPORT: \"React\" is imported from \"react\" but never used",
358
+ "COMPILE_ERROR: tsc reported errors in generated scaffolds; first diagnostic: Component.tsx(4,37): error TS7031: Binding element 'deliveryNotes' implicitly has an 'any' type."
359
+ ]
360
+ },
361
+ {
362
+ "item_id": "dev-60",
363
+ "compiles": false,
364
+ "lint_clean": false,
365
+ "a11y_clean": false,
366
+ "constraints_ok": true,
367
+ "libraries_allowed": true,
368
+ "tokens_matched": false,
369
+ "tool_calls": 1,
370
+ "tokens": null,
371
+ "wall_ms": 25718,
372
+ "predicted": [],
373
+ "acceptable": [
374
+ "shadcn/badge"
375
+ ],
376
+ "code": "import React from 'react';\nimport { Style } from '@/components/ui';\n\nfunction Badge({ content, attributes }) {\n return (\n <Style>\n <div style={{ color: attributes.color.primary, fontSize: '16px', padding: '16px' }}>\n <div style={{ color: attributes.color.muted, fontSize: '16px', padding: '16px' }}>\n <div style={{ color: attributes.color.surface, fontSize: '16px', padding: '16px' }}>\n <div style={{ color: attributes.color.text, fontSize: '16px', padding: '16px' }}>\n <div style={{ color: attributes.color.surface, fontSize: '16px', padding: '16px' }}>\n <div style={{ color: attributes.color.muted, fontSize: '16px', padding: '16px' }}>\n <div style={{ color: attributes.color.primary, fontSize: '16px', padding: '16px' }}>\n Badge\n </div>\n </div>\n </div>\n </div>\n </div>\n </Style>\n </div>\n </Style>\n );\n}\n\nexport default Badge;",
377
+ "issues": [
378
+ "SYNTAX_ERROR: Expected corresponding JSX closing tag for 'div'.",
379
+ "UNUSED_IMPORT: \"React\" is imported from \"react\" but never used",
380
+ "COMPILE_ERROR: tsc reported errors in generated scaffolds; first diagnostic: Component.tsx(20,11): error TS17002: Expected corresponding JSX closing tag for 'div'."
381
+ ]
382
+ },
383
+ {
384
+ "item_id": "test-17",
385
+ "compiles": false,
386
+ "lint_clean": false,
387
+ "a11y_clean": true,
388
+ "constraints_ok": true,
389
+ "libraries_allowed": true,
390
+ "tokens_matched": false,
391
+ "tool_calls": 1,
392
+ "tokens": null,
393
+ "wall_ms": 11373,
394
+ "predicted": [],
395
+ "acceptable": [
396
+ "shadcn/avatar"
397
+ ],
398
+ "code": "import React from 'react';\n\nfunction AssigneeAvatar({ contentSize }) {\n return (\n <img src={contentSize} alt=\"Avatar\" width=\"50\" height=\"50\" />\n );\n}\n\nexport default AssigneeAvatar;",
399
+ "issues": [
400
+ "UNUSED_IMPORT: \"React\" is imported from \"react\" but never used",
401
+ "COMPILE_ERROR: tsc reported errors in generated scaffolds; first diagnostic: Component.tsx(3,27): error TS7031: Binding element 'contentSize' implicitly has an 'any' type."
402
+ ]
403
+ },
404
+ {
405
+ "item_id": "dev-97",
406
+ "compiles": false,
407
+ "lint_clean": false,
408
+ "a11y_clean": false,
409
+ "constraints_ok": false,
410
+ "libraries_allowed": true,
411
+ "tokens_matched": true,
412
+ "tool_calls": 1,
413
+ "tokens": null,
414
+ "wall_ms": 75546,
415
+ "predicted": [],
416
+ "acceptable": [
417
+ "mui/app-bar"
418
+ ],
419
+ "code": "```typescript\nimport React from 'react';\n\nfunction AppBarHeader() {\n return (\n <div style={{ width: '100%', padding: '20px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#ffffff', border: '1px solid #1565c0', borderRadius: '4px' }}>\n <div style={{ width: '100%', backgroundColor: '#1565c0', border: '",
420
+ "issues": [
421
+ "SYNTAX_ERROR: Unterminated template literal.",
422
+ "COMPILE_ERROR: tsc reported errors in generated scaffolds; first diagnostic: Component.tsx(34,128): error TS1160: Unterminated template literal.",
423
+ "FORBIDDEN_PATTERN: inline-style"
424
+ ]
425
+ },
426
+ {
427
+ "item_id": "dev-157",
428
+ "compiles": true,
429
+ "lint_clean": true,
430
+ "a11y_clean": true,
431
+ "constraints_ok": true,
432
+ "libraries_allowed": true,
433
+ "tokens_matched": false,
434
+ "tool_calls": 1,
435
+ "tokens": null,
436
+ "wall_ms": 8023,
437
+ "predicted": [],
438
+ "acceptable": [
439
+ "mantine/checkbox"
440
+ ],
441
+ "code": "import React from 'react';\n\nfunction IncludeArchived() {\n const [include, setInclude] = React.useState(false);\n\n const handleToggle = () => {\n setInclude(!include);\n };\n\n return (\n <div>\n <label>\n <input\n type=\"checkbox\"\n checked={include}\n onChange={handleToggle}\n />\n Archived Tickets\n </label>\n </div>\n );\n}\n\nexport default IncludeArchived;",
442
+ "issues": []
443
+ }
444
+ ],
445
+ "model_info": {
446
+ "provider": "ollama",
447
+ "id": "gemma3:1b"
448
+ },
449
+ "notes": [
450
+ "This arm is the competitor: it may import any installed library and write any code.",
451
+ "compiles is the project verifier's TypeScript sandbox result; lint/a11y/constraints come from the same verifier.",
452
+ "token_match means at least half of the Design MD token values sampled appear in the generated code."
453
+ ]
454
+ }
455
+ }
@@ -12,6 +12,9 @@ describe("agent tool contract", () => {
12
12
  expect(report.validated).toBe(5);
13
13
  expect(report.submitted).toBe(5);
14
14
  expect(report.mapped_rate).toBeGreaterThanOrEqual(0.7);
15
+ // Build + submit per item: the contract path should not need retries.
16
+ expect(report.tool_calls_per_item).toBe(2);
17
+ expect(report.max_tool_calls).toBe(2);
15
18
  },
16
19
  30000,
17
20
  );
@@ -21,6 +21,8 @@ export interface AgentEvalRecord {
21
21
  outcome: string | null;
22
22
  mapped_ids: string[];
23
23
  matched: boolean;
24
+ /** Tool calls this item needed (build, then submit). Efficiency, not pass/fail. */
25
+ tool_calls: number;
24
26
  errors: string[];
25
27
  }
26
28
 
@@ -33,6 +35,10 @@ export interface AgentEvalReport {
33
35
  submitted: number;
34
36
  mapped: number;
35
37
  mapped_rate: number;
38
+ /** Rounds: total agent tool calls across the run, and the mean/max per item. */
39
+ tool_calls_total: number;
40
+ tool_calls_per_item: number;
41
+ max_tool_calls: number;
36
42
  failures: string[];
37
43
  passed: boolean;
38
44
  records: AgentEvalRecord[];
@@ -43,7 +49,7 @@ interface BuildResult {
43
49
  handoff?: Record<string, unknown>;
44
50
  validation?: {
45
51
  ok?: boolean;
46
- errors?: string[];
52
+ errors?: Array<{ code: string; message: string }>;
47
53
  design_errors?: Array<{ line: number; message: string }>;
48
54
  contradictions?: Array<{ detail: string }>;
49
55
  };
@@ -118,8 +124,10 @@ export async function runAgentEval(options: AgentEvalOptions = {}): Promise<Agen
118
124
  let outcome: string | null = null;
119
125
  let mappedIds: string[] = [];
120
126
  let handoff: Record<string, unknown> | undefined;
127
+ let toolCalls = 0;
121
128
 
122
129
  try {
130
+ toolCalls += 1;
123
131
  const builtResult = (await callTool(
124
132
  "build_handoff",
125
133
  {
@@ -141,7 +149,7 @@ export async function runAgentEval(options: AgentEvalOptions = {}): Promise<Agen
141
149
  validationOk = Boolean(validation?.ok);
142
150
  if (!validationOk) {
143
151
  const details = [
144
- ...(validation?.errors ?? []),
152
+ ...(validation?.errors ?? []).map((error) => error.message),
145
153
  ...(validation?.design_errors ?? []).map(
146
154
  (error) => `Design MD line ${error.line}: ${error.message}`,
147
155
  ),
@@ -152,13 +160,16 @@ export async function runAgentEval(options: AgentEvalOptions = {}): Promise<Agen
152
160
  }
153
161
 
154
162
  if (validationOk && handoff) {
163
+ toolCalls += 1;
155
164
  const submittedResult = (await callTool(
156
165
  "submit_handoff",
157
166
  { handoff },
158
167
  runtime,
159
168
  )) as SubmitResult;
160
- submitted = submittedResult.ok;
161
- if (submittedResult.ok && submittedResult.result) {
169
+ // "Submitted" means the gateway processed the handoff and returned a
170
+ // result; the outcome itself is recorded separately.
171
+ submitted = Boolean(submittedResult.result);
172
+ if (submittedResult.result) {
162
173
  outcome = submittedResult.result.outcome;
163
174
  mappedIds = submittedResult.result.intents.flatMap((intent) =>
164
175
  intent.mappings.map((mapping) => mapping.component_id),
@@ -189,6 +200,7 @@ export async function runAgentEval(options: AgentEvalOptions = {}): Promise<Agen
189
200
  outcome,
190
201
  mapped_ids: mappedIds,
191
202
  matched,
203
+ tool_calls: toolCalls,
192
204
  errors,
193
205
  });
194
206
 
@@ -213,6 +225,16 @@ export async function runAgentEval(options: AgentEvalOptions = {}): Promise<Agen
213
225
  submitted: records.filter((record) => record.submitted).length,
214
226
  mapped,
215
227
  mapped_rate: mappedRate,
228
+ tool_calls_total: records.reduce((sum, record) => sum + record.tool_calls, 0),
229
+ tool_calls_per_item:
230
+ records.length === 0
231
+ ? 0
232
+ : Number(
233
+ (
234
+ records.reduce((sum, record) => sum + record.tool_calls, 0) / records.length
235
+ ).toFixed(2),
236
+ ),
237
+ max_tool_calls: records.reduce((max, record) => Math.max(max, record.tool_calls), 0),
216
238
  failures,
217
239
  passed: failures.length === 0,
218
240
  records,