stitchkit 0.136.7 → 0.137.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/agent-runtime/stores/branch-observations.d.ts +19 -19
  3. package/dist/agent-runtime/stores/schedule-contract.d.ts.map +1 -1
  4. package/dist/agent-runtime/stores/schedule-records.d.ts.map +1 -1
  5. package/dist/agent-runtime/stores/schedule-tools.d.ts.map +1 -1
  6. package/dist/agent-runtime/stores/sql-rows.d.ts +36 -36
  7. package/dist/agent-runtime/terminal-commit.d.ts +5 -5
  8. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +52 -52
  9. package/dist/agent-runtime/testing/store-conformance-support.d.ts +26 -26
  10. package/dist/browser/client-executors.d.ts +2 -3
  11. package/dist/browser/client-executors.d.ts.map +1 -1
  12. package/dist/browser/realtime-client.d.ts +6 -1
  13. package/dist/browser/realtime-client.d.ts.map +1 -1
  14. package/dist/browser/socket-io-client.d.ts.map +1 -1
  15. package/dist/browser/socket-io-contract.d.ts +2 -0
  16. package/dist/browser/socket-io-contract.d.ts.map +1 -1
  17. package/dist/contract/define-validation.d.ts +6 -0
  18. package/dist/contract/define-validation.d.ts.map +1 -1
  19. package/dist/contract/define.d.ts +1 -1
  20. package/dist/contract/define.d.ts.map +1 -1
  21. package/dist/contract/error-mapping.d.ts +71 -0
  22. package/dist/contract/error-mapping.d.ts.map +1 -0
  23. package/dist/contract/errors.d.ts +8 -0
  24. package/dist/contract/errors.d.ts.map +1 -1
  25. package/dist/contract/factory.d.ts +8 -0
  26. package/dist/contract/factory.d.ts.map +1 -1
  27. package/dist/contract/fragments.d.ts +45 -0
  28. package/dist/contract/fragments.d.ts.map +1 -0
  29. package/dist/contract/normalize.d.ts +6 -3
  30. package/dist/contract/normalize.d.ts.map +1 -1
  31. package/dist/contract/operation-read.d.ts +38 -0
  32. package/dist/contract/operation-read.d.ts.map +1 -0
  33. package/dist/contract/stream.d.ts.map +1 -1
  34. package/dist/contract/time-zone.d.ts +31 -0
  35. package/dist/contract/time-zone.d.ts.map +1 -0
  36. package/dist/contract/tool-options.d.ts +1 -1
  37. package/dist/contract/tool-options.d.ts.map +1 -1
  38. package/dist/device-relay/hub.d.ts +1 -1
  39. package/dist/device-relay/hub.d.ts.map +1 -1
  40. package/dist/entrypoints/agent-executor/acp.js +9 -9
  41. package/dist/entrypoints/agent-executor/claude-sdk.js +11 -11
  42. package/dist/entrypoints/agent-executor/claude.js +8 -8
  43. package/dist/entrypoints/agent-executor/codex.js +15 -15
  44. package/dist/entrypoints/agent-executor/testing.js +11 -11
  45. package/dist/entrypoints/agent-executor.js +14 -13
  46. package/dist/entrypoints/agent-runtime/ai-sdk.js +5 -5
  47. package/dist/entrypoints/agent-runtime/anthropic.js +1 -1
  48. package/dist/entrypoints/agent-runtime/browser.js +5 -5
  49. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  50. package/dist/entrypoints/agent-runtime/harness.js +14 -15
  51. package/dist/entrypoints/agent-runtime/openai.js +1 -1
  52. package/dist/entrypoints/agent-runtime/openrouter.js +7 -7
  53. package/dist/entrypoints/agent-runtime/postgres.js +5 -5
  54. package/dist/entrypoints/agent-runtime/realtime.js +8 -8
  55. package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
  56. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  57. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  58. package/dist/entrypoints/agent-runtime/testing.js +5 -5
  59. package/dist/entrypoints/agent-runtime.js +33 -29
  60. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  61. package/dist/entrypoints/application/directory-inbox.js +1 -1
  62. package/dist/entrypoints/application/grammy.js +1 -1
  63. package/dist/entrypoints/application/opentelemetry.js +2 -2
  64. package/dist/entrypoints/application.js +10 -10
  65. package/dist/entrypoints/cli/publish.d.ts +4 -4
  66. package/dist/entrypoints/cli/publish.d.ts.map +1 -1
  67. package/dist/entrypoints/cli/publish.js +160 -52
  68. package/dist/entrypoints/cli.d.ts +3 -1
  69. package/dist/entrypoints/cli.d.ts.map +1 -1
  70. package/dist/entrypoints/cli.js +520 -59
  71. package/dist/entrypoints/contract.d.ts +5 -1
  72. package/dist/entrypoints/contract.d.ts.map +1 -1
  73. package/dist/entrypoints/contract.js +25 -7
  74. package/dist/entrypoints/device-relay.js +20 -10
  75. package/dist/entrypoints/files/packaging.js +2 -2
  76. package/dist/entrypoints/files.js +10 -10
  77. package/dist/entrypoints/handler.d.ts +1 -1
  78. package/dist/entrypoints/handler.d.ts.map +1 -1
  79. package/dist/entrypoints/handler.js +12 -12
  80. package/dist/entrypoints/http.js +13 -12
  81. package/dist/entrypoints/index.js +36 -18
  82. package/dist/entrypoints/live.d.ts +2 -1
  83. package/dist/entrypoints/live.d.ts.map +1 -1
  84. package/dist/entrypoints/live.js +630 -1
  85. package/dist/entrypoints/node.d.ts +5 -0
  86. package/dist/entrypoints/node.d.ts.map +1 -1
  87. package/dist/entrypoints/node.js +36 -16
  88. package/dist/entrypoints/observability.js +25 -10
  89. package/dist/entrypoints/postgres.d.ts +4 -1
  90. package/dist/entrypoints/postgres.d.ts.map +1 -1
  91. package/dist/entrypoints/postgres.js +312 -0
  92. package/dist/entrypoints/primitives.js +11 -4
  93. package/dist/entrypoints/process.js +7 -7
  94. package/dist/entrypoints/react.js +1 -1
  95. package/dist/entrypoints/realtime.js +3 -3
  96. package/dist/entrypoints/remote.js +6 -29
  97. package/dist/entrypoints/server.d.ts +6 -1
  98. package/dist/entrypoints/server.d.ts.map +1 -1
  99. package/dist/entrypoints/server.js +93 -32
  100. package/dist/entrypoints/service-host/macos.js +6 -6
  101. package/dist/entrypoints/service-host/work.js +6 -6
  102. package/dist/entrypoints/service-host.js +10 -10
  103. package/dist/entrypoints/spend.js +2 -1
  104. package/dist/entrypoints/sync.js +5 -5
  105. package/dist/entrypoints/telegram.js +8 -8
  106. package/dist/entrypoints/testing.d.ts +1 -0
  107. package/dist/entrypoints/testing.d.ts.map +1 -1
  108. package/dist/entrypoints/testing.js +1501 -13
  109. package/dist/entrypoints/tools/agent.js +6 -7
  110. package/dist/entrypoints/tools/connections.js +9 -11
  111. package/dist/entrypoints/tools/contract.js +1 -2
  112. package/dist/entrypoints/tools/invoker.js +4 -5
  113. package/dist/entrypoints/tools/mcp.js +10 -11
  114. package/dist/entrypoints/tools/toolkit.d.ts +1 -1
  115. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -1
  116. package/dist/entrypoints/tools/toolkit.js +29 -24
  117. package/dist/entrypoints/tools.js +28 -30
  118. package/dist/entrypoints/tracking/contract.js +2 -1
  119. package/dist/entrypoints/xlsx.js +5 -8
  120. package/dist/{index-033tyx59.js → index-0zw0hcyg.js} +4 -1
  121. package/dist/{index-zcq3dby3.js → index-1bjwfnnj.js} +1 -1
  122. package/dist/{index-f103md2v.js → index-1cfacbe2.js} +88 -23
  123. package/dist/{index-gj4wdts6.js → index-1ckh9qx1.js} +1 -1
  124. package/dist/index-1pvwmbxp.js +1435 -0
  125. package/dist/{index-0s75mjh7.js → index-2e4hdh32.js} +1 -1
  126. package/dist/{index-3shdhzt6.js → index-2j0pqxkn.js} +12 -6
  127. package/dist/index-3k8w02se.js +28 -0
  128. package/dist/{index-7fjbdga8.js → index-3pb4ccj2.js} +8 -0
  129. package/dist/{index-w7e402wx.js → index-48kb4gqq.js} +46 -7
  130. package/dist/{index-cv9b7fz2.js → index-6rws2xf5.js} +8 -0
  131. package/dist/{index-bbpygynk.js → index-77w5vx0g.js} +1 -1
  132. package/dist/index-7dz1ngaf.js +35 -0
  133. package/dist/{index-y68gavb5.js → index-7n4atsm4.js} +1 -1
  134. package/dist/index-8ef1bfea.js +71 -0
  135. package/dist/{index-0x4mnwg5.js → index-8k3y9nd4.js} +6 -9
  136. package/dist/{index-ezwsqyad.js → index-8rkdkefj.js} +40 -23
  137. package/dist/{index-3cwq5byx.js → index-9nax7tkn.js} +2 -2
  138. package/dist/{index-dz6tstcp.js → index-9r6emjwz.js} +1 -1
  139. package/dist/{index-32ew02z1.js → index-c4b7d6ej.js} +5 -5
  140. package/dist/index-ceshyndf.js +284 -0
  141. package/dist/{index-w161azza.js → index-d13rw31w.js} +6 -6
  142. package/dist/{index-1h0dtfz3.js → index-dmm7vs3f.js} +1 -1
  143. package/dist/{index-ypm85xwe.js → index-dp8j2e77.js} +1 -1
  144. package/dist/{index-qqd979f7.js → index-edycjvrv.js} +9 -9
  145. package/dist/{index-18qdpbcq.js → index-egpf9dv0.js} +200 -1479
  146. package/dist/{index-fatke81t.js → index-ezgvsj9w.js} +2 -2
  147. package/dist/{index-chapre0y.js → index-f3e7tj1g.js} +1 -1
  148. package/dist/{index-df5xr2f9.js → index-frsd2a94.js} +16 -1
  149. package/dist/index-fy9mmek1.js +95 -0
  150. package/dist/{index-2331y2tf.js → index-g0gvfzrx.js} +12 -12
  151. package/dist/index-gpe8d1ka.js +19 -0
  152. package/dist/{index-4p2zx593.js → index-gyw4qd0m.js} +1 -1
  153. package/dist/index-gzqy81tw.js +172 -0
  154. package/dist/{index-yrhw10ef.js → index-h34c510q.js} +8 -4
  155. package/dist/{index-rr94xcj6.js → index-h527p1yj.js} +10 -4
  156. package/dist/{index-qj0sq69b.js → index-hgf1tbgz.js} +76 -16
  157. package/dist/{index-smvmnz5y.js → index-hvpan32x.js} +1 -1
  158. package/dist/{index-4gbybjg6.js → index-hxawqrb6.js} +2 -2
  159. package/dist/{index-0k1ba0ss.js → index-j91jffhv.js} +1 -1
  160. package/dist/{index-d01akj5n.js → index-jr4kwetx.js} +8 -8
  161. package/dist/{index-xqppqn97.js → index-ka6z48zc.js} +315 -69
  162. package/dist/{index-by8w2461.js → index-kw0segzt.js} +104 -3
  163. package/dist/{index-6f4fjygr.js → index-m5t4dr7h.js} +29 -7
  164. package/dist/{index-afaq0nc4.js → index-n0egp1ke.js} +1 -1
  165. package/dist/{index-9fzjgg86.js → index-n74rb1dq.js} +2 -2
  166. package/dist/{index-dwq6a6sq.js → index-pt25vmhc.js} +33 -16
  167. package/dist/{index-vwg0n3e6.js → index-pyazb8q4.js} +23 -14
  168. package/dist/{index-5md04mwc.js → index-qpjjbkc5.js} +4 -4
  169. package/dist/{index-08a3qfr8.js → index-r1qt6zgj.js} +1 -1
  170. package/dist/{index-ctaxjpa4.js → index-r709pqed.js} +1 -1
  171. package/dist/{index-2zrx0nzv.js → index-rzc40z6e.js} +3 -5
  172. package/dist/{index-gq35s3bm.js → index-s5axtd56.js} +2 -2
  173. package/dist/{index-edpkm3k7.js → index-scpcps66.js} +669 -16
  174. package/dist/{index-ry8m2mhg.js → index-sf2mt6wj.js} +1 -1
  175. package/dist/{index-tjhhsnjv.js → index-t1213r0t.js} +1 -1
  176. package/dist/{index-gvgtmt7a.js → index-t7efje30.js} +2 -2
  177. package/dist/{index-w3s79kcb.js → index-tzyk36dy.js} +1 -1
  178. package/dist/{index-8tn10tp6.js → index-v64bvwjr.js} +1 -1
  179. package/dist/{index-1fhbe4e4.js → index-vksbsqpb.js} +1 -1
  180. package/dist/{index-dxft2mnm.js → index-wdg7bswj.js} +1 -1
  181. package/dist/{index-ppy23bd2.js → index-wjx1zs2r.js} +7 -578
  182. package/dist/{index-efbzm2se.js → index-x2r0ma9t.js} +1 -1
  183. package/dist/{index-kd48gk7d.js → index-x8py72a3.js} +1 -1
  184. package/dist/index-xvydbxmk.js +1404 -0
  185. package/dist/index-xwaphv0d.js +31 -0
  186. package/dist/{index-a09r9ff0.js → index-y44j39yk.js} +1 -1
  187. package/dist/{index-7mjsb7zv.js → index-ybrrxjhb.js} +1 -1
  188. package/dist/{index-xsrma0jd.js → index-ysthxsa8.js} +6 -6
  189. package/dist/{index-6p5pshcd.js → index-yyh3ey4b.js} +1 -1
  190. package/dist/{index-mr3njw67.js → index-z6hq9j8j.js} +1 -1
  191. package/dist/{index-67mzzkdv.js → index-z72agxdn.js} +2 -2
  192. package/dist/{index-e4w0sfm1.js → index-z78mtc16.js} +1 -1
  193. package/dist/{index-7csn6pva.js → index-ze94h4ph.js} +5 -0
  194. package/dist/internal/json-stringify.d.ts +12 -0
  195. package/dist/internal/json-stringify.d.ts.map +1 -1
  196. package/dist/internal/unix-client-error.d.ts +4 -0
  197. package/dist/internal/unix-client-error.d.ts.map +1 -1
  198. package/dist/live/watch-contract.d.ts +4 -0
  199. package/dist/live/watch-contract.d.ts.map +1 -1
  200. package/dist/live/watch-fanout-frame.d.ts +81 -0
  201. package/dist/live/watch-fanout-frame.d.ts.map +1 -0
  202. package/dist/live/watch-fanout.d.ts +57 -0
  203. package/dist/live/watch-fanout.d.ts.map +1 -0
  204. package/dist/observability/audit.d.ts.map +1 -1
  205. package/dist/observability/spool-core.d.ts +1 -0
  206. package/dist/observability/spool-core.d.ts.map +1 -1
  207. package/dist/observability/spool-drain.d.ts +48 -0
  208. package/dist/observability/spool-drain.d.ts.map +1 -0
  209. package/dist/observability/spool.d.ts +12 -6
  210. package/dist/observability/spool.d.ts.map +1 -1
  211. package/dist/postgres/connection-config.d.ts +54 -0
  212. package/dist/postgres/connection-config.d.ts.map +1 -0
  213. package/dist/postgres/rollback-transaction.d.ts +61 -0
  214. package/dist/postgres/rollback-transaction.d.ts.map +1 -0
  215. package/dist/primitives/deadline.d.ts +4 -4
  216. package/dist/primitives/deadline.d.ts.map +1 -1
  217. package/dist/server/error-hook.d.ts +3 -32
  218. package/dist/server/error-hook.d.ts.map +1 -1
  219. package/dist/server/local-consent-key.d.ts +104 -0
  220. package/dist/server/local-consent-key.d.ts.map +1 -0
  221. package/dist/server/local-control-journal.d.ts +51 -0
  222. package/dist/server/local-control-journal.d.ts.map +1 -0
  223. package/dist/server/local-control-reporter.d.ts +32 -0
  224. package/dist/server/local-control-reporter.d.ts.map +1 -0
  225. package/dist/server/local-control.d.ts +48 -0
  226. package/dist/server/local-control.d.ts.map +1 -0
  227. package/dist/server/local-host-clients.d.ts +105 -0
  228. package/dist/server/local-host-clients.d.ts.map +1 -0
  229. package/dist/server/middleware/trust-fence.d.ts +20 -0
  230. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  231. package/dist/spend/receipt-spool.d.ts +9 -4
  232. package/dist/spend/receipt-spool.d.ts.map +1 -1
  233. package/dist/testing/tool-surface-checks.d.ts +89 -0
  234. package/dist/testing/tool-surface-checks.d.ts.map +1 -0
  235. package/dist/testing/tool-surface-cli-callable.d.ts +63 -0
  236. package/dist/testing/tool-surface-cli-callable.d.ts.map +1 -0
  237. package/dist/testing/tool-surface-dead-refs.d.ts +32 -0
  238. package/dist/testing/tool-surface-dead-refs.d.ts.map +1 -0
  239. package/dist/testing/tool-surface-gates.d.ts +72 -0
  240. package/dist/testing/tool-surface-gates.d.ts.map +1 -0
  241. package/dist/testing/tool-surface-parity-drivers.d.ts +56 -0
  242. package/dist/testing/tool-surface-parity-drivers.d.ts.map +1 -0
  243. package/dist/testing/tool-surface-parity.d.ts +28 -0
  244. package/dist/testing/tool-surface-parity.d.ts.map +1 -0
  245. package/dist/testing/tool-surface-ratchet.d.ts +71 -0
  246. package/dist/testing/tool-surface-ratchet.d.ts.map +1 -0
  247. package/dist/tools/agent-tools.d.ts +3 -0
  248. package/dist/tools/agent-tools.d.ts.map +1 -1
  249. package/dist/tools/cli/command.d.ts +3 -0
  250. package/dist/tools/cli/command.d.ts.map +1 -1
  251. package/dist/tools/cli/create-cli.d.ts.map +1 -1
  252. package/dist/tools/cli/distribution-config.d.ts +39 -1
  253. package/dist/tools/cli/distribution-config.d.ts.map +1 -1
  254. package/dist/tools/cli/distribution-routes.d.ts +4 -2
  255. package/dist/tools/cli/distribution-routes.d.ts.map +1 -1
  256. package/dist/tools/cli/format.d.ts +3 -6
  257. package/dist/tools/cli/format.d.ts.map +1 -1
  258. package/dist/tools/cli/invoke.d.ts +4 -0
  259. package/dist/tools/cli/invoke.d.ts.map +1 -1
  260. package/dist/tools/cli/local-key-command.d.ts +53 -0
  261. package/dist/tools/cli/local-key-command.d.ts.map +1 -0
  262. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  263. package/dist/tools/cli/publication-contract.d.ts +9 -2
  264. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  265. package/dist/tools/cli/publication.d.ts.map +1 -1
  266. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  267. package/dist/tools/cli/run-stream.d.ts.map +1 -1
  268. package/dist/tools/cli/runner.d.ts +8 -3
  269. package/dist/tools/cli/runner.d.ts.map +1 -1
  270. package/dist/tools/cli/secret.d.ts +55 -0
  271. package/dist/tools/cli/secret.d.ts.map +1 -0
  272. package/dist/tools/cli/session.d.ts +2 -2
  273. package/dist/tools/cli/session.d.ts.map +1 -1
  274. package/dist/tools/cli/signature.d.ts +23 -9
  275. package/dist/tools/cli/signature.d.ts.map +1 -1
  276. package/dist/tools/cli/stream.d.ts.map +1 -1
  277. package/dist/tools/cli/unix-outcome.d.ts +6 -0
  278. package/dist/tools/cli/unix-outcome.d.ts.map +1 -1
  279. package/dist/tools/cli/update.d.ts +6 -1
  280. package/dist/tools/cli/update.d.ts.map +1 -1
  281. package/dist/tools/execute-result.d.ts +20 -0
  282. package/dist/tools/execute-result.d.ts.map +1 -1
  283. package/dist/tools/execute.d.ts +3 -0
  284. package/dist/tools/execute.d.ts.map +1 -1
  285. package/dist/tools/internal/json-projection.d.ts +13 -9
  286. package/dist/tools/internal/json-projection.d.ts.map +1 -1
  287. package/dist/tools/internal/remote-error.d.ts +15 -0
  288. package/dist/tools/internal/remote-error.d.ts.map +1 -0
  289. package/dist/tools/internal/surface-projector.d.ts +2 -0
  290. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  291. package/dist/tools/invoker.d.ts +3 -0
  292. package/dist/tools/invoker.d.ts.map +1 -1
  293. package/dist/tools/mcp/handler.d.ts.map +1 -1
  294. package/dist/tools/mcp/lazy-discovery.d.ts +2 -0
  295. package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
  296. package/dist/tools/mcp/mount.d.ts +5 -0
  297. package/dist/tools/mcp/mount.d.ts.map +1 -1
  298. package/dist/tools/mcp/register.d.ts +2 -0
  299. package/dist/tools/mcp/register.d.ts.map +1 -1
  300. package/dist/tools/mcp/runtime-tools.d.ts +2 -0
  301. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  302. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  303. package/dist/tools/mount.d.ts +3 -0
  304. package/dist/tools/mount.d.ts.map +1 -1
  305. package/dist/tools/read-operation.d.ts +2 -6
  306. package/dist/tools/read-operation.d.ts.map +1 -1
  307. package/dist/tools/remote.d.ts.map +1 -1
  308. package/dist/tools/runtime-tool.d.ts.map +1 -1
  309. package/dist/tools/toolkit.d.ts +10 -3
  310. package/dist/tools/toolkit.d.ts.map +1 -1
  311. package/dist/xlsx/schema.d.ts.map +1 -1
  312. package/llms/cli-publish.txt +4 -1
  313. package/llms/cli.2.txt +42 -51
  314. package/llms/cli.3.txt +34 -1
  315. package/llms/cli.txt +18 -3
  316. package/llms/contract.txt +47 -5
  317. package/llms/handler.txt +1 -1
  318. package/llms/live.txt +82 -0
  319. package/llms/node.txt +5 -0
  320. package/llms/observability.2.txt +1 -1
  321. package/llms/observability.txt +6 -0
  322. package/llms/postgres.txt +14 -3
  323. package/llms/server.2.txt +206 -240
  324. package/llms/server.3.txt +242 -202
  325. package/llms/server.4.txt +202 -1025
  326. package/llms/server.5.txt +1053 -255
  327. package/llms/server.6.txt +274 -0
  328. package/llms/server.txt +32 -116
  329. package/llms/spend.txt +8 -7
  330. package/llms/stitchkit.2.txt +13 -35
  331. package/llms/stitchkit.3.txt +27 -0
  332. package/llms/stitchkit.txt +82 -82
  333. package/llms/testing.txt +40 -0
  334. package/llms/tools-toolkit.txt +2 -2
  335. package/llms/tools.2.txt +29 -20
  336. package/llms/{upgrading-0.128.0-0.129.0.txt → upgrading-0.128.0-0.131.0.txt} +101 -3
  337. package/llms/{upgrading-0.130.0-0.136.0.txt → upgrading-0.132.0-0.137.0.txt} +62 -101
  338. package/llms/upgrading.txt +2 -2
  339. package/llms-full.txt +641 -189
  340. package/llms.txt +14 -14
  341. package/package.json +3 -3
  342. package/dist/index-9118dw8d.js +0 -603
  343. package/dist/index-9vj869rx.js +0 -19
  344. package/dist/index-a1rjr381.js +0 -114
  345. package/dist/index-dacxr7nf.js +0 -17
  346. package/dist/index-dm50x3by.js +0 -63
  347. package/dist/index-dmrx8xma.js +0 -163
  348. package/dist/index-ednf2cxs.js +0 -37
  349. package/dist/{index-e4zt2x70.js → index-3czppvrr.js} +3 -3
  350. package/dist/{index-42n9jycn.js → index-3f79t32b.js} +3 -3
  351. package/dist/{index-mfe9a266.js → index-84n49vam.js} +0 -0
  352. package/dist/{index-f16b7rze.js → index-er1tp8de.js} +3 -3
  353. package/dist/{index-k137ezb6.js → index-f5d0fdcf.js} +3 -3
  354. package/dist/{index-65p8v81y.js → index-psz8qrz0.js} +3 -3
  355. package/dist/{index-kadgaw1s.js → index-r8cq86h1.js} +0 -0
  356. package/dist/{index-1yky29qg.js → index-tyyvbarf.js} +0 -0
  357. package/dist/{index-tjakdpf2.js → index-wq71v08n.js} +3 -3
  358. package/dist/{index-7an2fs5h.js → index-wswcpbm4.js} +3 -3
@@ -1,17 +1,18 @@
1
1
  import {
2
- joinRoutePath
2
+ joinRoutePath,
3
+ parseRoutePattern
3
4
  } from "../index-m38ej7e5.js";
4
5
  import"../index-q46b16xz.js";
5
- import"../index-yrhw10ef.js";
6
- import"../index-d01akj5n.js";
6
+ import"../index-h34c510q.js";
7
+ import"../index-jr4kwetx.js";
7
8
  import {
8
9
  createClient2,
9
10
  createClients2
10
- } from "../index-6f4fjygr.js";
11
+ } from "../index-m5t4dr7h.js";
11
12
  import"../index-5xsxvk2x.js";
12
13
  import {
13
14
  createApplication2
14
- } from "../index-6p5pshcd.js";
15
+ } from "../index-yyh3ey4b.js";
15
16
  import"../index-w5s3xftz.js";
16
17
  import {
17
18
  RealtimeRequestTimeoutError2,
@@ -21,8 +22,8 @@ import {
21
22
  import {
22
23
  TOOL_TRANSPORTS2
23
24
  } from "../index-yt1gg11x.js";
25
+ import"../index-kw0segzt.js";
24
26
  import"../index-werjqesf.js";
25
- import"../index-dmrx8xma.js";
26
27
  import {
27
28
  RealtimeRejectDirectionSchema,
28
29
  RealtimeRejectPhaseSchema,
@@ -34,21 +35,48 @@ import {
34
35
  toJsonSchema
35
36
  } from "../index-d1pdv8qc.js";
36
37
  import {
38
+ resolveOptionalCliToolAccess,
39
+ applyToolViewDefaults,
40
+ projectToolView,
41
+ toolErrorMessageFromResult,
42
+ toToolName,
43
+ buildToolPresentationSchema,
37
44
  projectToolSurface
38
- } from "../index-edpkm3k7.js";
39
- import"../index-dm50x3by.js";
45
+ } from "../index-scpcps66.js";
46
+ import"../index-hgf1tbgz.js";
47
+ import"../index-dsa676h8.js";
48
+ import {
49
+ collectCliStreams,
50
+ buildManagedSurface,
51
+ createCliSession
52
+ } from "../index-egpf9dv0.js";
40
53
  import {
41
54
  staticInputRounds,
42
55
  mcpProjectionCandidate,
43
56
  prepareProjectedMcpTools
44
- } from "../index-efbzm2se.js";
57
+ } from "../index-x2r0ma9t.js";
58
+ import {
59
+ findUntypedProperties2
60
+ } from "../index-3kb8dw48.js";
61
+ import {
62
+ writeFileAtomic2
63
+ } from "../index-2rs7ze0q.js";
64
+ import"../index-rzc40z6e.js";
65
+ import"../index-ze94h4ph.js";
66
+ import {
67
+ inputIsQuery
68
+ } from "../index-xhzq2qvj.js";
69
+ import"../index-8ef1bfea.js";
70
+ import {
71
+ isReadOnlyOperation2
72
+ } from "../index-3k8w02se.js";
73
+ import {
74
+ errnoOf
75
+ } from "../index-jj9228tt.js";
45
76
  import {
46
77
  compareCodeUnits,
47
78
  serializeCanonicalJson
48
79
  } from "../index-fmzg39a8.js";
49
- import {
50
- assertPositiveSafeInteger
51
- } from "../index-gr0kxymw.js";
52
80
  import {
53
81
  assertTimerMs
54
82
  } from "../index-e1y74yra.js";
@@ -56,6 +84,9 @@ import {
56
84
  raceAbort,
57
85
  linkAbortSignals
58
86
  } from "../index-rptj3qnc.js";
87
+ import {
88
+ assertPositiveSafeInteger
89
+ } from "../index-gr0kxymw.js";
59
90
  import {
60
91
  isRecord
61
92
  } from "../index-ps3djm8d.js";
@@ -1469,6 +1500,1452 @@ expected: ${expected}
1469
1500
  actual: ${actual}`);
1470
1501
  }
1471
1502
  }
1503
+ // src/testing/tool-surface-checks.ts
1504
+ import { z as z4 } from "zod";
1505
+ var TOOL_SURFACE_CHECK_NAMES = [
1506
+ "getReads",
1507
+ "cliCallable",
1508
+ "noRefs",
1509
+ "outputJsonSchema",
1510
+ "transportParity",
1511
+ "deadReferences",
1512
+ "schemaRatchet"
1513
+ ];
1514
+ var ToolSurfaceCheckNameSchema = z4.enum(TOOL_SURFACE_CHECK_NAMES);
1515
+ var ToolSurfaceFindingSchema = z4.strictObject({
1516
+ check: ToolSurfaceCheckNameSchema,
1517
+ subject: z4.string().min(1),
1518
+ message: z4.string().min(1),
1519
+ hint: z4.string().min(1).optional()
1520
+ });
1521
+ var ToolSurfaceGetReadsRegistrySchema = z4.strictObject({
1522
+ reads: z4.array(z4.string()),
1523
+ debts: z4.record(z4.string(), z4.string()).default({})
1524
+ });
1525
+ function finding(check, subject, message, hint) {
1526
+ return { check, subject, message, ...hint !== undefined && { hint } };
1527
+ }
1528
+ function collectSurfaceOperations(services, runtimeTools, mcpSurfaces) {
1529
+ const operations = [];
1530
+ const seenKeys = new Set;
1531
+ const add = (svcList, rtList) => {
1532
+ for (const service of svcList) {
1533
+ for (const [action, methodDef] of Object.entries(service.methods)) {
1534
+ const key = `${methodDef.serviceName}.${action}`;
1535
+ if (seenKeys.has(key))
1536
+ continue;
1537
+ seenKeys.add(key);
1538
+ operations.push({
1539
+ key,
1540
+ kind: "contract",
1541
+ service,
1542
+ methodDef,
1543
+ runtimeDef: undefined
1544
+ });
1545
+ }
1546
+ }
1547
+ for (const runtimeDef of rtList) {
1548
+ const key = `${runtimeDef.identity.serviceName}.${runtimeDef.identity.action}`;
1549
+ if (seenKeys.has(key))
1550
+ continue;
1551
+ seenKeys.add(key);
1552
+ operations.push({
1553
+ key,
1554
+ kind: "runtime",
1555
+ service: undefined,
1556
+ methodDef: undefined,
1557
+ runtimeDef
1558
+ });
1559
+ }
1560
+ };
1561
+ add(services, runtimeTools);
1562
+ for (const surfaceName of Object.keys(mcpSurfaces ?? {}).sort(compareCodeUnits)) {
1563
+ const surface = mcpSurfaces?.[surfaceName];
1564
+ if (!surface)
1565
+ continue;
1566
+ add(surface.services ?? [], surface.runtimeTools ?? []);
1567
+ }
1568
+ return operations.sort((left, right) => compareCodeUnits(left.key, right.key));
1569
+ }
1570
+ function runGetReadsCheck(services, runtimeTools, config, mcpSurfaces) {
1571
+ const findings = [];
1572
+ const parsed = ToolSurfaceGetReadsRegistrySchema.safeParse(config.registry);
1573
+ if (!parsed.success) {
1574
+ const details = parsed.error.issues.map((issue) => issue.message).join("; ");
1575
+ return [finding("getReads", "registry", `Invalid GET reads registry: ${details}`)];
1576
+ }
1577
+ const reads = new Set;
1578
+ for (const entry of parsed.data.reads) {
1579
+ if (reads.has(entry)) {
1580
+ findings.push(finding("getReads", entry, `Duplicate entry "${entry}" in GET reads registry`));
1581
+ }
1582
+ reads.add(entry);
1583
+ }
1584
+ const debts = parsed.data.debts;
1585
+ for (const [entry, reason] of Object.entries(debts)) {
1586
+ if (reason.trim().length === 0) {
1587
+ findings.push(finding("getReads", entry, `GET debt "${entry}" must state a non-empty reason`));
1588
+ }
1589
+ if (reads.has(entry)) {
1590
+ findings.push(finding("getReads", entry, `GET operation "${entry}" appears in both reads and debts`));
1591
+ }
1592
+ }
1593
+ const liveGets = new Set;
1594
+ for (const op of collectSurfaceOperations(services, runtimeTools, mcpSurfaces)) {
1595
+ const httpMethod = op.methodDef ? op.methodDef.method : op.runtimeDef?.identity.method;
1596
+ if (httpMethod !== "GET")
1597
+ continue;
1598
+ liveGets.add(op.key);
1599
+ const effect = op.methodDef ? op.methodDef.effect : op.runtimeDef?.identity.effect;
1600
+ const annotations = op.methodDef ? op.methodDef.annotations : op.runtimeDef?.annotations;
1601
+ const inReads = reads.has(op.key);
1602
+ const inDebts = Object.hasOwn(debts, op.key);
1603
+ if (effect === "write") {
1604
+ if (inReads || inDebts) {
1605
+ findings.push(finding("getReads", op.key, `GET operation "${op.key}" declares effect: 'write' and must not also be listed in reads/debts`));
1606
+ }
1607
+ continue;
1608
+ }
1609
+ if (!isReadOnlyOperation2({ method: "GET", effect, annotations })) {
1610
+ if (inReads) {
1611
+ findings.push(finding("getReads", op.key, `Non-read-only GET "${op.key}" must be in debts, not reads`));
1612
+ }
1613
+ if (!inDebts) {
1614
+ findings.push(finding("getReads", op.key, `Non-read-only GET "${op.key}" without effect: 'write' is missing a reasoned entry in debts`));
1615
+ }
1616
+ continue;
1617
+ }
1618
+ if (inDebts) {
1619
+ findings.push(finding("getReads", op.key, `Read-only GET "${op.key}" must move from debts to reads`));
1620
+ } else if (!inReads) {
1621
+ findings.push(finding("getReads", op.key, `GET operation "${op.key}" is missing from audited reads (or declare effect: 'write')`));
1622
+ }
1623
+ }
1624
+ for (const entry of [...reads].sort(compareCodeUnits)) {
1625
+ if (!liveGets.has(entry)) {
1626
+ findings.push(finding("getReads", entry, `Stale GET reads entry "${entry}"`));
1627
+ }
1628
+ }
1629
+ for (const entry of Object.keys(debts).sort(compareCodeUnits)) {
1630
+ if (!liveGets.has(entry)) {
1631
+ findings.push(finding("getReads", entry, `Stale GET debt entry "${entry}"`));
1632
+ }
1633
+ }
1634
+ return findings;
1635
+ }
1636
+ function findSchemaRefKeywords(value, path = "") {
1637
+ if (Array.isArray(value)) {
1638
+ return value.flatMap((entry, index) => findSchemaRefKeywords(entry, `${path}[${index}]`));
1639
+ }
1640
+ if (!isRecord(value))
1641
+ return [];
1642
+ const hits = [];
1643
+ for (const [key, child] of Object.entries(value)) {
1644
+ const nextPath = path ? `${path}.${key}` : key;
1645
+ if (key === "$ref" || key === "$defs" || key === "definitions") {
1646
+ hits.push({ path: nextPath, keyword: key });
1647
+ }
1648
+ hits.push(...findSchemaRefKeywords(child, nextPath));
1649
+ }
1650
+ return hits;
1651
+ }
1652
+ function runNoRefsCheck(options) {
1653
+ const findings = [];
1654
+ const inspect = (label, transport, services, runtimeTools, projection) => {
1655
+ let projected;
1656
+ try {
1657
+ projected = projectToolSurface({ services, runtimeTools }, transport, projection ? {
1658
+ extend: projection.extend,
1659
+ flattenUnionInput: projection.flattenUnionInput,
1660
+ inputRecursionDepth: projection.inputRecursionDepth,
1661
+ inputNestingDepth: projection.inputNestingDepth
1662
+ } : {});
1663
+ } catch (error) {
1664
+ const msg = error instanceof Error ? error.message : String(error);
1665
+ findings.push(finding("noRefs", label, `${label} surface projection threw: ${msg}`));
1666
+ return;
1667
+ }
1668
+ for (const tool of projected) {
1669
+ const hits = findSchemaRefKeywords(tool.presentationSchema);
1670
+ if (hits.length === 0)
1671
+ continue;
1672
+ const summary = hits.slice(0, 5).map((hit) => `${hit.keyword} at ${hit.path}`).join(", ");
1673
+ findings.push(finding("noRefs", `${label}:${tool.name}`, `${label} tool "${tool.name}" input schema still contains references (${summary})`, "Set tool.inputRecursionDepth on the endpoint or inputRecursionDepth on the surface projection to inline $ref/$defs."));
1674
+ }
1675
+ };
1676
+ if (options.mcpSurfaces && Object.keys(options.mcpSurfaces).length > 0) {
1677
+ for (const surfaceName of Object.keys(options.mcpSurfaces).sort(compareCodeUnits)) {
1678
+ const surface = options.mcpSurfaces[surfaceName];
1679
+ if (!surface)
1680
+ continue;
1681
+ inspect(`MCP:${surfaceName}`, "MCP", surface.services ?? options.services, surface.runtimeTools ?? options.runtimeTools, surface.projection ?? options.mcpProjection);
1682
+ }
1683
+ } else {
1684
+ inspect("MCP", "MCP", options.services, options.runtimeTools, options.mcpProjection);
1685
+ }
1686
+ inspect("AGENT", "AGENT", options.services, options.runtimeTools, options.agentProjection);
1687
+ return findings;
1688
+ }
1689
+ function runOutputJsonSchemaCheck(services, runtimeTools, mcpSurfaces) {
1690
+ const findings = [];
1691
+ for (const op of collectSurfaceOperations(services, runtimeTools, mcpSurfaces)) {
1692
+ const output = op.methodDef ? op.methodDef.outputSchema : op.runtimeDef?.output;
1693
+ if (output) {
1694
+ try {
1695
+ toJsonSchema(output, "output", "throw");
1696
+ } catch (error) {
1697
+ const msg = error instanceof Error ? error.message : String(error);
1698
+ findings.push(finding("outputJsonSchema", `${op.key}.output`, `"${op.key}" output invalid: ${msg}`));
1699
+ }
1700
+ }
1701
+ const viewOutput = op.methodDef?.toolView?.output;
1702
+ if (viewOutput) {
1703
+ try {
1704
+ toJsonSchema(viewOutput, "output", "throw");
1705
+ } catch (error) {
1706
+ const msg = error instanceof Error ? error.message : String(error);
1707
+ findings.push(finding("outputJsonSchema", `${op.key}.toolView.output`, `"${op.key}" toolView.output invalid: ${msg}`));
1708
+ }
1709
+ }
1710
+ }
1711
+ return findings;
1712
+ }
1713
+
1714
+ // src/testing/tool-surface-cli-callable.ts
1715
+ var SILENT_CLI_IO = {
1716
+ stdout: () => {
1717
+ return;
1718
+ },
1719
+ stdoutWhileOpen: () => true,
1720
+ stderr: () => {
1721
+ return;
1722
+ },
1723
+ exit: () => {
1724
+ return;
1725
+ },
1726
+ readStdin: async () => null
1727
+ };
1728
+ function cliFinding(subject, message) {
1729
+ return { check: "cliCallable", subject, message };
1730
+ }
1731
+ function toRuntimeCliConfig(config) {
1732
+ const { resolveAuth, context, services, runtimeTools, access, ...rest } = config;
1733
+ const adaptedResolveAuth = resolveAuth ? (globals) => Reflect.apply(resolveAuth, config, [globals]) : undefined;
1734
+ const adaptedContext = context ? (auth, globals) => {
1735
+ const value = Reflect.apply(context, config, [auth, globals]);
1736
+ return isRecord(value) ? value : {};
1737
+ } : undefined;
1738
+ const adaptedServices = typeof services === "function" ? (auth, globals) => Reflect.apply(services, config, [auth, globals]) : services;
1739
+ const adaptedRuntimeTools = typeof runtimeTools === "function" ? (auth, globals) => Reflect.apply(runtimeTools, config, [auth, globals]) : runtimeTools;
1740
+ if (adaptedServices === undefined && adaptedRuntimeTools === undefined) {
1741
+ return {
1742
+ ...rest,
1743
+ ...adaptedResolveAuth !== undefined && { resolveAuth: adaptedResolveAuth },
1744
+ ...adaptedContext !== undefined && { context: adaptedContext },
1745
+ ...access !== undefined && { access }
1746
+ };
1747
+ }
1748
+ if (access === undefined) {
1749
+ resolveOptionalCliToolAccess("createCliSession", config);
1750
+ throw new TypeError("createCliSession: access is required — pass { gate } with the auth hook, { open }, or { inspect: true }");
1751
+ }
1752
+ return {
1753
+ ...rest,
1754
+ ...adaptedResolveAuth !== undefined && { resolveAuth: adaptedResolveAuth },
1755
+ ...adaptedContext !== undefined && { context: adaptedContext },
1756
+ ...adaptedServices !== undefined && { services: adaptedServices },
1757
+ ...adaptedRuntimeTools !== undefined && { runtimeTools: adaptedRuntimeTools },
1758
+ access
1759
+ };
1760
+ }
1761
+ async function runCliCallableCheck(config) {
1762
+ let cliConfig;
1763
+ try {
1764
+ cliConfig = typeof config.config === "function" ? await config.config() : config.config;
1765
+ } catch (error) {
1766
+ const msg = error instanceof Error ? error.message : String(error);
1767
+ return [cliFinding("cli.config", `CLI config factory threw: ${msg}`)];
1768
+ }
1769
+ let session;
1770
+ try {
1771
+ session = createCliSession(toRuntimeCliConfig(cliConfig), SILENT_CLI_IO);
1772
+ } catch (error) {
1773
+ const msg = error instanceof Error ? error.message : String(error);
1774
+ return [cliFinding(cliConfig.name || "cli", `CLI startup failed: ${msg}`)];
1775
+ }
1776
+ let typedGlobals = {};
1777
+ if (cliConfig.globalOptions) {
1778
+ const parsed = cliConfig.globalOptions.safeParse(config.globals ?? {});
1779
+ if (!parsed.success) {
1780
+ const details = parsed.error.issues.map((issue) => issue.message).join("; ");
1781
+ return [
1782
+ cliFinding(`${cliConfig.name}.globalOptions`, `CLI globals invalid: ${details}`)
1783
+ ];
1784
+ }
1785
+ typedGlobals = parsed.data;
1786
+ }
1787
+ let managed;
1788
+ try {
1789
+ managed = await buildManagedSurface(session, typedGlobals, false);
1790
+ } catch (error) {
1791
+ const msg = error instanceof Error ? error.message : String(error);
1792
+ return [cliFinding(cliConfig.name || "cli", `CLI surface build threw: ${msg}`)];
1793
+ }
1794
+ if (!managed.resolved) {
1795
+ return [
1796
+ cliFinding(cliConfig.name || "cli", `CLI managed surface did not resolve: ${managed.reason}`)
1797
+ ];
1798
+ }
1799
+ const findings = [];
1800
+ for (const commandName of [...managed.help.keys()].sort(compareCodeUnits)) {
1801
+ const descriptor = managed.help.get(commandName);
1802
+ if (descriptor?.unavailableReason !== undefined) {
1803
+ findings.push(cliFinding(commandName, `CLI command "${commandName}" is [unavailable]: ${descriptor.unavailableReason}`));
1804
+ }
1805
+ }
1806
+ return findings;
1807
+ }
1808
+
1809
+ // src/testing/tool-surface-dead-refs.ts
1810
+ import { readdir, readFile, stat } from "node:fs/promises";
1811
+ import { join, relative, resolve } from "node:path";
1812
+ var DEFAULT_TOKEN_PATTERN = /\b[a-z][a-z0-9]*(?:_[a-z0-9]+)+\b/g;
1813
+ var SKIPPED_DIRS = new Set([".git", "node_modules"]);
1814
+ function escapeRegexChar(ch) {
1815
+ return ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1816
+ }
1817
+ function splitBraceGroup(pattern, openIndex) {
1818
+ let depth = 0;
1819
+ let partStart = openIndex + 1;
1820
+ const alternatives = [];
1821
+ for (let i = openIndex;i < pattern.length; i += 1) {
1822
+ const ch = pattern[i];
1823
+ if (ch === "{") {
1824
+ depth += 1;
1825
+ } else if (ch === "}") {
1826
+ depth -= 1;
1827
+ if (depth === 0) {
1828
+ alternatives.push(pattern.slice(partStart, i));
1829
+ return { closeIndex: i, alternatives };
1830
+ }
1831
+ } else if (ch === "," && depth === 1) {
1832
+ alternatives.push(pattern.slice(partStart, i));
1833
+ partStart = i + 1;
1834
+ }
1835
+ }
1836
+ return;
1837
+ }
1838
+ function compileGlobBody(pattern) {
1839
+ let regex = "";
1840
+ let index = 0;
1841
+ while (index < pattern.length) {
1842
+ const ch = pattern[index];
1843
+ if (ch === "*") {
1844
+ if (pattern[index + 1] === "*") {
1845
+ if (pattern[index + 2] === "/") {
1846
+ regex += "(?:.*/)?";
1847
+ index += 3;
1848
+ } else {
1849
+ regex += ".*";
1850
+ index += 2;
1851
+ }
1852
+ } else {
1853
+ regex += "[^/]*";
1854
+ index += 1;
1855
+ }
1856
+ } else if (ch === "?") {
1857
+ regex += "[^/]";
1858
+ index += 1;
1859
+ } else if (ch === "{") {
1860
+ const group = splitBraceGroup(pattern, index);
1861
+ if (group && group.alternatives.length > 1) {
1862
+ regex += `(?:${group.alternatives.map((alt) => compileGlobBody(alt)).join("|")})`;
1863
+ index = group.closeIndex + 1;
1864
+ } else {
1865
+ regex += "\\{";
1866
+ index += 1;
1867
+ }
1868
+ } else if (ch !== undefined) {
1869
+ regex += escapeRegexChar(ch);
1870
+ index += 1;
1871
+ }
1872
+ }
1873
+ return regex;
1874
+ }
1875
+ function globToRegExp(pattern) {
1876
+ const normalized = pattern.replaceAll("\\", "/").replace(/^\.\//, "");
1877
+ return new RegExp(`^${compileGlobBody(normalized)}$`);
1878
+ }
1879
+ function staticGlobPrefix(pattern) {
1880
+ const normalized = pattern.replaceAll("\\", "/").replace(/^\.\//, "");
1881
+ const segments = normalized.split("/");
1882
+ const prefix = [];
1883
+ for (const segment of segments) {
1884
+ if (/[*?{}[\]]/.test(segment))
1885
+ break;
1886
+ prefix.push(segment);
1887
+ }
1888
+ return prefix.join("/");
1889
+ }
1890
+ function isEnoent(error) {
1891
+ const code = errnoOf(error);
1892
+ return code === "ENOENT" || code === "ENOTDIR";
1893
+ }
1894
+ async function walkFilesPortable(root, prefixes) {
1895
+ const collected = new Set;
1896
+ const visit = async (dir) => {
1897
+ const entries = await readdir(dir, { withFileTypes: true });
1898
+ for (const entry of entries) {
1899
+ if (entry.isDirectory()) {
1900
+ if (SKIPPED_DIRS.has(entry.name))
1901
+ continue;
1902
+ await visit(join(dir, entry.name));
1903
+ } else if (entry.isFile()) {
1904
+ collected.add(join(dir, entry.name));
1905
+ }
1906
+ }
1907
+ };
1908
+ const uniqueTargets = prefixes.includes("") ? [""] : [...new Set(prefixes)];
1909
+ for (const prefix of uniqueTargets) {
1910
+ const target = prefix ? join(root, prefix) : root;
1911
+ try {
1912
+ const info = await stat(target);
1913
+ if (info.isFile()) {
1914
+ collected.add(target);
1915
+ } else if (info.isDirectory()) {
1916
+ await visit(target);
1917
+ }
1918
+ } catch (error) {
1919
+ if (isEnoent(error))
1920
+ continue;
1921
+ throw error;
1922
+ }
1923
+ }
1924
+ return [...collected].sort(compareCodeUnits);
1925
+ }
1926
+ function collectLiveToolNames(services, runtimeTools, mcpSurfaces, extraKnownTools) {
1927
+ const names = new Set(extraKnownTools ?? []);
1928
+ const collect = (svc, rt) => {
1929
+ for (const transport of ["MCP", "AGENT", "CLI"]) {
1930
+ for (const tool of projectToolSurface({ services: svc, runtimeTools: rt }, transport, {
1931
+ assertNames: false,
1932
+ assertUniqueNames: false
1933
+ })) {
1934
+ names.add(tool.name);
1935
+ }
1936
+ }
1937
+ for (const streamName of collectCliStreams(svc).keys()) {
1938
+ names.add(streamName);
1939
+ }
1940
+ };
1941
+ collect(services, runtimeTools);
1942
+ for (const surface of Object.values(mcpSurfaces ?? {})) {
1943
+ collect(surface.services ?? services, surface.runtimeTools ?? runtimeTools);
1944
+ }
1945
+ return names;
1946
+ }
1947
+ async function runDeadReferencesCheck(options) {
1948
+ const { config } = options;
1949
+ const findings = [];
1950
+ const liveTools = collectLiveToolNames(options.services, options.runtimeTools, options.mcpSurfaces, config.extraKnownTools);
1951
+ const ignore = config.ignore ?? {};
1952
+ const usedIgnore = new Set;
1953
+ for (const [word, reason] of Object.entries(ignore).sort(([a], [b]) => compareCodeUnits(a, b))) {
1954
+ if (reason.trim().length === 0) {
1955
+ findings.push({
1956
+ check: "deadReferences",
1957
+ subject: word,
1958
+ message: `Ignore entry "${word}" must state a non-empty reason`
1959
+ });
1960
+ }
1961
+ if (liveTools.has(word)) {
1962
+ findings.push({
1963
+ check: "deadReferences",
1964
+ subject: word,
1965
+ message: `Ignore entry "${word}" is now a real tool name — remove it from ignore`
1966
+ });
1967
+ }
1968
+ }
1969
+ const texts = new Map;
1970
+ if (config.globs && config.globs.length > 0) {
1971
+ const root = resolve(config.cwd ?? process.cwd());
1972
+ let rootExists = true;
1973
+ try {
1974
+ const info = await stat(root);
1975
+ if (!info.isDirectory())
1976
+ rootExists = false;
1977
+ } catch (error) {
1978
+ if (isEnoent(error))
1979
+ rootExists = false;
1980
+ else
1981
+ throw error;
1982
+ }
1983
+ if (!rootExists) {
1984
+ findings.push({
1985
+ check: "deadReferences",
1986
+ subject: root,
1987
+ message: `deadReferences cwd "${root}" does not exist or is not a directory`
1988
+ });
1989
+ } else {
1990
+ const globEntries = config.globs.map((pattern) => ({
1991
+ pattern,
1992
+ prefix: staticGlobPrefix(pattern),
1993
+ matcher: globToRegExp(pattern),
1994
+ matched: 0
1995
+ }));
1996
+ const allFiles = await walkFilesPortable(root, globEntries.map((entry) => entry.prefix));
1997
+ for (const file of allFiles) {
1998
+ const rel = relative(root, file).replaceAll("\\", "/");
1999
+ let hit = false;
2000
+ for (const entry of globEntries) {
2001
+ if (entry.matcher.test(rel)) {
2002
+ entry.matched += 1;
2003
+ hit = true;
2004
+ }
2005
+ }
2006
+ if (!hit)
2007
+ continue;
2008
+ texts.set(rel, await readFile(file, "utf8"));
2009
+ }
2010
+ for (const entry of globEntries) {
2011
+ if (entry.matched === 0) {
2012
+ findings.push({
2013
+ check: "deadReferences",
2014
+ subject: entry.pattern,
2015
+ message: `deadReferences matched 0 files under "${root}" for glob "${entry.pattern}"`
2016
+ });
2017
+ }
2018
+ }
2019
+ }
2020
+ }
2021
+ for (const [label, content] of Object.entries(config.sources ?? {})) {
2022
+ texts.set(label, content);
2023
+ }
2024
+ if (config.includeDescriptions ?? true) {
2025
+ for (const op of collectSurfaceOperations(options.services, options.runtimeTools, options.mcpSurfaces)) {
2026
+ const desc = op.methodDef ? op.methodDef.desc : op.runtimeDef?.description;
2027
+ if (desc)
2028
+ texts.set(`description:${op.key}`, desc);
2029
+ }
2030
+ }
2031
+ if (texts.size === 0) {
2032
+ findings.push({
2033
+ check: "deadReferences",
2034
+ subject: "sources",
2035
+ message: "deadReferences scanned 0 sources — pass globs, sources, or enable includeDescriptions"
2036
+ });
2037
+ return findings;
2038
+ }
2039
+ const basePattern = config.tokenPattern ?? DEFAULT_TOKEN_PATTERN;
2040
+ const flags = basePattern.flags.includes("g") ? basePattern.flags : `${basePattern.flags}g`;
2041
+ for (const label of [...texts.keys()].sort(compareCodeUnits)) {
2042
+ const raw = texts.get(label) ?? "";
2043
+ const text = config.preprocess ? config.preprocess(raw, label) : raw;
2044
+ const regex = new RegExp(basePattern.source, flags);
2045
+ const unknownInSource = new Set;
2046
+ for (const match of text.matchAll(regex)) {
2047
+ const token = match[0];
2048
+ if (!token)
2049
+ continue;
2050
+ if (liveTools.has(token))
2051
+ continue;
2052
+ if (Object.hasOwn(ignore, token)) {
2053
+ usedIgnore.add(token);
2054
+ continue;
2055
+ }
2056
+ unknownInSource.add(token);
2057
+ }
2058
+ for (const token of [...unknownInSource].sort(compareCodeUnits)) {
2059
+ findings.push({
2060
+ check: "deadReferences",
2061
+ subject: `${label}:${token}`,
2062
+ message: `Unknown tool reference "${token}" in ${label}`,
2063
+ hint: "Fix the tool name or add a reasoned entry to deadReferences.ignore."
2064
+ });
2065
+ }
2066
+ }
2067
+ for (const word of Object.keys(ignore).sort(compareCodeUnits)) {
2068
+ if (!liveTools.has(word) && !usedIgnore.has(word)) {
2069
+ findings.push({
2070
+ check: "deadReferences",
2071
+ subject: word,
2072
+ message: `Unused deadReferences ignore entry "${word}" did not appear in any scanned source — remove it`
2073
+ });
2074
+ }
2075
+ }
2076
+ return findings;
2077
+ }
2078
+
2079
+ // src/testing/tool-surface-parity-drivers.ts
2080
+ function resolveHeaders(input) {
2081
+ const headers = new Headers;
2082
+ const entries = typeof input === "function" ? input() : input;
2083
+ if (entries) {
2084
+ for (const [key, value] of Object.entries(entries))
2085
+ headers.set(key, value);
2086
+ }
2087
+ return headers;
2088
+ }
2089
+ function toWireJson(value) {
2090
+ if (value === undefined)
2091
+ return;
2092
+ return JSON.parse(JSON.stringify(value));
2093
+ }
2094
+ function extractWireError(payload) {
2095
+ if (!isRecord(payload))
2096
+ return {};
2097
+ const hasStructuredDetailsWithoutMessage = isRecord(payload.details) && !("message" in payload.details) && Object.keys(payload.details).length > 0;
2098
+ const detailsMessage = isRecord(payload.details) && typeof payload.details.message === "string" ? payload.details.message : undefined;
2099
+ if (typeof payload.error === "string") {
2100
+ const message = typeof payload.message === "string" ? payload.message : detailsMessage;
2101
+ return {
2102
+ code: payload.error,
2103
+ ...message !== undefined && { message },
2104
+ ...message === undefined && payload.message === undefined && hasStructuredDetailsWithoutMessage && { omittedMessageForStructuredDetails: true }
2105
+ };
2106
+ }
2107
+ if (isRecord(payload.error)) {
2108
+ const nestedDetailsMsg = isRecord(payload.error.details) && typeof payload.error.details.message === "string" ? payload.error.details.message : undefined;
2109
+ const message = typeof payload.error.message === "string" ? payload.error.message : nestedDetailsMsg;
2110
+ return {
2111
+ ...typeof payload.error.code === "string" && { code: payload.error.code },
2112
+ ...message !== undefined && { message }
2113
+ };
2114
+ }
2115
+ if (typeof payload.code === "string") {
2116
+ const message = typeof payload.message === "string" ? payload.message : detailsMessage;
2117
+ return {
2118
+ code: payload.code,
2119
+ ...message !== undefined && { message }
2120
+ };
2121
+ }
2122
+ return {};
2123
+ }
2124
+ function interpolateRoutePath(template, params, args) {
2125
+ const consumedKeys = new Set;
2126
+ const routeParams = parseRoutePattern(template);
2127
+ let path = template;
2128
+ for (const param of routeParams) {
2129
+ const hasExplicit = Object.hasOwn(params, param.name);
2130
+ const raw = hasExplicit ? params[param.name] : args[param.name];
2131
+ if (!hasExplicit && Object.hasOwn(args, param.name))
2132
+ consumedKeys.add(param.name);
2133
+ const value = raw === undefined ? "" : String(raw);
2134
+ if (param.kind === "wildcard") {
2135
+ const encoded = value.split("/").map((segment) => encodeURIComponent(segment)).join("/");
2136
+ path = path.replace(`*${param.name}`, encoded);
2137
+ } else {
2138
+ path = path.replace(`:${param.name}`, encodeURIComponent(value));
2139
+ }
2140
+ }
2141
+ return { path, consumedKeys };
2142
+ }
2143
+ async function callHttpParityTarget(target, service, action, methodDef, params, rawArgs) {
2144
+ const scopePrefix = methodDef.scope ? target.scopePrefixes?.[methodDef.scope] : undefined;
2145
+ const template = joinRoutePath(target.pathPrefix, scopePrefix, service.prefix, methodDef.path);
2146
+ const { path, consumedKeys } = interpolateRoutePath(template, params, rawArgs);
2147
+ const bodyOrQueryArgs = {};
2148
+ for (const [key, value] of Object.entries(rawArgs)) {
2149
+ if (!consumedKeys.has(key))
2150
+ bodyOrQueryArgs[key] = value;
2151
+ }
2152
+ const httpArgs = methodDef.toolView?.defaults ? applyToolViewDefaults(bodyOrQueryArgs, methodDef.toolView.defaults) : bodyOrQueryArgs;
2153
+ const url = new URL(path, target.origin ?? "http://127.0.0.1");
2154
+ const headers = resolveHeaders(target.headers);
2155
+ let request;
2156
+ if (inputIsQuery(methodDef.method)) {
2157
+ for (const [key, value] of Object.entries(httpArgs)) {
2158
+ if (value === undefined)
2159
+ continue;
2160
+ if (Array.isArray(value)) {
2161
+ for (const item of value) {
2162
+ url.searchParams.append(key, typeof item === "object" && item !== null ? JSON.stringify(item) : String(item));
2163
+ }
2164
+ } else if (typeof value === "object" && value !== null) {
2165
+ url.searchParams.set(key, JSON.stringify(value));
2166
+ } else {
2167
+ url.searchParams.set(key, String(value));
2168
+ }
2169
+ }
2170
+ request = new Request(url.toString(), { method: methodDef.method, headers });
2171
+ } else {
2172
+ if (!headers.has("content-type"))
2173
+ headers.set("content-type", "application/json");
2174
+ request = new Request(url.toString(), {
2175
+ method: methodDef.method,
2176
+ headers,
2177
+ body: JSON.stringify(httpArgs)
2178
+ });
2179
+ }
2180
+ const response = await target.handler(request, undefined);
2181
+ const text = await response.text();
2182
+ let parsed;
2183
+ if (text.length > 0) {
2184
+ try {
2185
+ parsed = JSON.parse(text);
2186
+ } catch {
2187
+ parsed = text;
2188
+ }
2189
+ }
2190
+ if (!response.ok) {
2191
+ const err = extractWireError(parsed);
2192
+ return {
2193
+ transport: "HTTP",
2194
+ ok: false,
2195
+ code: err.code ?? `HTTP_${response.status}`,
2196
+ ...err.message !== undefined && { message: err.message }
2197
+ };
2198
+ }
2199
+ let data = parsed;
2200
+ if (methodDef.toolView && methodDef.outputSchema) {
2201
+ const parsedInput = methodDef.inputSchema?.safeParse(httpArgs);
2202
+ const viewInput = parsedInput?.success ? parsedInput.data : httpArgs;
2203
+ const projected = projectToolView({
2204
+ view: methodDef.toolView,
2205
+ fullSchema: methodDef.outputSchema,
2206
+ full: data,
2207
+ call: { input: viewInput, source: "mcp" },
2208
+ operation: `${service.name}.${action}`
2209
+ });
2210
+ if (!projected.ok) {
2211
+ return {
2212
+ transport: "HTTP",
2213
+ ok: false,
2214
+ code: "TOOL_VIEW_PROJECTION_ERROR",
2215
+ message: projected.message
2216
+ };
2217
+ }
2218
+ data = projected.data;
2219
+ }
2220
+ return { transport: "HTTP", ok: true, data: toWireJson(data) };
2221
+ }
2222
+ function invokeMcpHandler(target, request) {
2223
+ return typeof target.handler === "function" ? target.handler(request, undefined) : target.handler.fetch(request);
2224
+ }
2225
+ async function parseMcpJsonRpcResponse(response, id) {
2226
+ const contentType = (response.headers.get("content-type") ?? "").toLowerCase();
2227
+ const body = await response.text();
2228
+ if (contentType.includes("text/event-stream")) {
2229
+ let matched;
2230
+ let last;
2231
+ for (const line of body.split(/\r?\n/)) {
2232
+ if (!line.startsWith("data:"))
2233
+ continue;
2234
+ const raw = line.slice(5).trim();
2235
+ if (!raw)
2236
+ continue;
2237
+ try {
2238
+ const msg = JSON.parse(raw);
2239
+ last = msg;
2240
+ if (isRecord(msg) && msg.id === id)
2241
+ matched = msg;
2242
+ } catch {}
2243
+ }
2244
+ return matched ?? last;
2245
+ }
2246
+ if (!body)
2247
+ return;
2248
+ try {
2249
+ return JSON.parse(body);
2250
+ } catch {
2251
+ return body;
2252
+ }
2253
+ }
2254
+ async function ensureMcpInitialized(target, state) {
2255
+ if (state.initialized)
2256
+ return;
2257
+ state.initialized = true;
2258
+ const url = target.url ?? "http://127.0.0.1/mcp";
2259
+ const protocolVersion = target.protocolVersion ?? "2025-03-26";
2260
+ const headers = resolveHeaders(target.headers);
2261
+ headers.set("content-type", "application/json");
2262
+ headers.set("accept", "application/json, text/event-stream");
2263
+ headers.set("mcp-protocol-version", protocolVersion);
2264
+ const initId = state.nextId++;
2265
+ const initRes = await invokeMcpHandler(target, new Request(url, {
2266
+ method: "POST",
2267
+ headers,
2268
+ body: JSON.stringify({
2269
+ jsonrpc: "2.0",
2270
+ id: initId,
2271
+ method: "initialize",
2272
+ params: {
2273
+ protocolVersion,
2274
+ capabilities: {},
2275
+ clientInfo: { name: "stitchkit-surface-parity", version: "1.0.0" }
2276
+ }
2277
+ })
2278
+ }));
2279
+ const sessionId = initRes.headers.get("mcp-session-id") ?? undefined;
2280
+ await initRes.text().catch(() => {
2281
+ return;
2282
+ });
2283
+ if (sessionId) {
2284
+ state.sessionId = sessionId;
2285
+ const notifyHeaders = resolveHeaders(target.headers);
2286
+ notifyHeaders.set("content-type", "application/json");
2287
+ notifyHeaders.set("accept", "application/json, text/event-stream");
2288
+ notifyHeaders.set("mcp-protocol-version", protocolVersion);
2289
+ notifyHeaders.set("mcp-session-id", sessionId);
2290
+ const notifyRes = await invokeMcpHandler(target, new Request(url, {
2291
+ method: "POST",
2292
+ headers: notifyHeaders,
2293
+ body: JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })
2294
+ }));
2295
+ await notifyRes.text().catch(() => {
2296
+ return;
2297
+ });
2298
+ }
2299
+ }
2300
+ async function callMcpParityTarget(target, state, toolName, toolArgs) {
2301
+ await ensureMcpInitialized(target, state);
2302
+ const url = target.url ?? "http://127.0.0.1/mcp";
2303
+ const protocolVersion = target.protocolVersion ?? "2025-03-26";
2304
+ const headers = resolveHeaders(target.headers);
2305
+ headers.set("content-type", "application/json");
2306
+ headers.set("accept", "application/json, text/event-stream");
2307
+ headers.set("mcp-protocol-version", protocolVersion);
2308
+ if (state.sessionId)
2309
+ headers.set("mcp-session-id", state.sessionId);
2310
+ const id = state.nextId++;
2311
+ const response = await invokeMcpHandler(target, new Request(url, {
2312
+ method: "POST",
2313
+ headers,
2314
+ body: JSON.stringify({
2315
+ jsonrpc: "2.0",
2316
+ id,
2317
+ method: "tools/call",
2318
+ params: { name: toolName, arguments: toolArgs }
2319
+ })
2320
+ }));
2321
+ const rpc = await parseMcpJsonRpcResponse(response, id);
2322
+ if (!response.ok && !isRecord(rpc)) {
2323
+ return { transport: "MCP", ok: false, code: `HTTP_${response.status}` };
2324
+ }
2325
+ if (isRecord(rpc) && isRecord(rpc.error)) {
2326
+ return {
2327
+ transport: "MCP",
2328
+ ok: false,
2329
+ code: String(rpc.error.code ?? "MCP_RPC_ERROR"),
2330
+ ...typeof rpc.error.message === "string" && { message: rpc.error.message }
2331
+ };
2332
+ }
2333
+ const result = isRecord(rpc) && isRecord(rpc.result) ? rpc.result : undefined;
2334
+ if (!result) {
2335
+ return {
2336
+ transport: "MCP",
2337
+ ok: false,
2338
+ code: "MCP_INVALID_RESPONSE",
2339
+ message: "MCP response omitted result envelope"
2340
+ };
2341
+ }
2342
+ const content = Array.isArray(result.content) ? result.content : [];
2343
+ const firstText = content.find((block) => isRecord(block) && block.type === "text" && typeof block.text === "string")?.text;
2344
+ if (result.isError === true) {
2345
+ let parsedErr = firstText;
2346
+ if (firstText !== undefined) {
2347
+ try {
2348
+ parsedErr = JSON.parse(firstText);
2349
+ } catch {
2350
+ parsedErr = firstText;
2351
+ }
2352
+ }
2353
+ const err = extractWireError(parsedErr);
2354
+ return {
2355
+ transport: "MCP",
2356
+ ok: false,
2357
+ code: err.code ?? "MCP_TOOL_ERROR",
2358
+ ...err.message !== undefined ? { message: err.message } : err.omittedMessageForStructuredDetails ? { omittedMessageForStructuredDetails: true } : err.code === undefined && typeof firstText === "string" ? { message: firstText } : {}
2359
+ };
2360
+ }
2361
+ if (result.structuredContent !== undefined) {
2362
+ return { transport: "MCP", ok: true, data: toWireJson(result.structuredContent) };
2363
+ }
2364
+ if (firstText !== undefined) {
2365
+ try {
2366
+ return { transport: "MCP", ok: true, data: toWireJson(JSON.parse(firstText)) };
2367
+ } catch {
2368
+ return { transport: "MCP", ok: true, data: firstText };
2369
+ }
2370
+ }
2371
+ return { transport: "MCP", ok: true, data: undefined };
2372
+ }
2373
+ async function callAgentParityTarget(target, toolName, toolArgs) {
2374
+ const result = await target.invoker.invoke(toolName, toolArgs, target.options);
2375
+ if (result.ok) {
2376
+ return { transport: "AGENT", ok: true, data: toWireJson(result.data) };
2377
+ }
2378
+ const message = toolErrorMessageFromResult(result);
2379
+ return {
2380
+ transport: "AGENT",
2381
+ ok: false,
2382
+ code: result.code,
2383
+ ...message !== undefined && { message }
2384
+ };
2385
+ }
2386
+ async function callCliParityTarget(target, commandName, toolArgs) {
2387
+ const result = await target.invoker.invoke(commandName, toolArgs);
2388
+ if (result.ok) {
2389
+ return { transport: "CLI", ok: true, data: toWireJson(result.data) };
2390
+ }
2391
+ return {
2392
+ transport: "CLI",
2393
+ ok: false,
2394
+ code: result.error?.code ?? `CLI_EXIT_${result.exitCode}`,
2395
+ ...result.error?.message !== undefined && { message: result.error.message }
2396
+ };
2397
+ }
2398
+
2399
+ // src/testing/tool-surface-parity.ts
2400
+ function compareParityOutcomes(caseLabel, testCase, outcomes) {
2401
+ const findings = [];
2402
+ if (testCase.expect === "ok") {
2403
+ for (const item of outcomes) {
2404
+ if (!item.ok) {
2405
+ findings.push({
2406
+ check: "transportParity",
2407
+ subject: `${caseLabel}:${item.transport}`,
2408
+ message: `${item.transport} failed (code=${item.code ?? "unknown"}, message=${item.message ?? ""}) when case expected ok`
2409
+ });
2410
+ }
2411
+ }
2412
+ const succeeded = outcomes.filter((item) => item.ok);
2413
+ const reference = succeeded[0];
2414
+ if (reference && succeeded.length >= 2) {
2415
+ const expectedCanonical = serializeCanonicalJson(reference.data);
2416
+ for (const candidate of succeeded.slice(1)) {
2417
+ const actualCanonical = serializeCanonicalJson(candidate.data);
2418
+ if (actualCanonical !== expectedCanonical) {
2419
+ findings.push({
2420
+ check: "transportParity",
2421
+ subject: `${caseLabel}:${reference.transport}/${candidate.transport}`,
2422
+ message: `${candidate.transport} returned different wire data than ${reference.transport}: ${actualCanonical} !== ${expectedCanonical}`
2423
+ });
2424
+ }
2425
+ }
2426
+ }
2427
+ return findings;
2428
+ }
2429
+ for (const item of outcomes) {
2430
+ if (item.ok) {
2431
+ findings.push({
2432
+ check: "transportParity",
2433
+ subject: `${caseLabel}:${item.transport}`,
2434
+ message: `${item.transport} succeeded when case expected ${testCase.expect}`
2435
+ });
2436
+ }
2437
+ }
2438
+ const failed = outcomes.filter((item) => !item.ok);
2439
+ if (testCase.expectedCode !== undefined) {
2440
+ for (const item of failed) {
2441
+ if (item.code !== testCase.expectedCode) {
2442
+ findings.push({
2443
+ check: "transportParity",
2444
+ subject: `${caseLabel}:${item.transport}`,
2445
+ message: `${item.transport} returned error code "${item.code ?? ""}", expected "${testCase.expectedCode}"`
2446
+ });
2447
+ }
2448
+ }
2449
+ }
2450
+ const firstFailed = failed[0];
2451
+ if (firstFailed && failed.length >= 2) {
2452
+ for (const candidate of failed.slice(1)) {
2453
+ if (candidate.code !== firstFailed.code) {
2454
+ findings.push({
2455
+ check: "transportParity",
2456
+ subject: `${caseLabel}:${firstFailed.transport}/${candidate.transport}`,
2457
+ message: `Error code mismatch: ${firstFailed.transport}="${firstFailed.code ?? ""}" vs ${candidate.transport}="${candidate.code ?? ""}"`
2458
+ });
2459
+ }
2460
+ }
2461
+ }
2462
+ if (testCase.expect === "app_error") {
2463
+ if (testCase.expectedMessage !== undefined) {
2464
+ for (const item of failed) {
2465
+ if (item.omittedMessageForStructuredDetails)
2466
+ continue;
2467
+ if (item.message !== testCase.expectedMessage) {
2468
+ findings.push({
2469
+ check: "transportParity",
2470
+ subject: `${caseLabel}:${item.transport}`,
2471
+ message: `${item.transport} returned message ${item.message === undefined ? "<missing>" : `"${item.message}"`}, expected "${testCase.expectedMessage}"`
2472
+ });
2473
+ }
2474
+ }
2475
+ }
2476
+ const firstWithMessage = failed.find((item) => item.message !== undefined && item.message.length > 0);
2477
+ if (firstWithMessage && failed.length >= 2) {
2478
+ for (const candidate of failed) {
2479
+ if (candidate === firstWithMessage)
2480
+ continue;
2481
+ if (candidate.omittedMessageForStructuredDetails)
2482
+ continue;
2483
+ if (candidate.message !== firstWithMessage.message) {
2484
+ findings.push({
2485
+ check: "transportParity",
2486
+ subject: `${caseLabel}:${firstWithMessage.transport}/${candidate.transport}`,
2487
+ message: `Application error message mismatch: ${firstWithMessage.transport}="${firstWithMessage.message}" vs ${candidate.transport}=${candidate.message === undefined ? "<missing>" : `"${candidate.message}"`}`
2488
+ });
2489
+ }
2490
+ }
2491
+ }
2492
+ }
2493
+ return findings;
2494
+ }
2495
+ async function runTransportParityCheck(services, config) {
2496
+ const findings = [];
2497
+ const configured = [];
2498
+ if (config.http)
2499
+ configured.push("HTTP");
2500
+ if (config.mcp)
2501
+ configured.push("MCP");
2502
+ if (config.agent)
2503
+ configured.push("AGENT");
2504
+ if (config.cli)
2505
+ configured.push("CLI");
2506
+ if (configured.length < 2) {
2507
+ return [
2508
+ {
2509
+ check: "transportParity",
2510
+ subject: "transports",
2511
+ message: `transportParity requires at least two configured transports, got ${configured.length}`
2512
+ }
2513
+ ];
2514
+ }
2515
+ if (config.cases.length === 0) {
2516
+ return [
2517
+ {
2518
+ check: "transportParity",
2519
+ subject: "cases",
2520
+ message: "transportParity requires at least one test case"
2521
+ }
2522
+ ];
2523
+ }
2524
+ const serviceMap = new Map(services.map((service) => [service.name, service]));
2525
+ const mcpState = { initialized: false, nextId: 1 };
2526
+ for (const [index, testCase] of config.cases.entries()) {
2527
+ const opKey = `${testCase.service}.${testCase.action}`;
2528
+ const caseLabel = testCase.name ? `${testCase.name} (${opKey})` : `${opKey}#${index + 1}`;
2529
+ const service = serviceMap.get(testCase.service);
2530
+ const methodDef = service?.methods[testCase.action];
2531
+ if (!service || !methodDef) {
2532
+ findings.push({
2533
+ check: "transportParity",
2534
+ subject: caseLabel,
2535
+ message: `Unknown contract operation "${opKey}" in transportParity case`
2536
+ });
2537
+ continue;
2538
+ }
2539
+ const toolName = methodDef.toolName ?? toToolName(service.name, testCase.action);
2540
+ const toolArgs = {
2541
+ ...testCase.params ?? {},
2542
+ ...testCase.args ?? {}
2543
+ };
2544
+ const requested = testCase.transports ?? configured;
2545
+ const uniqueTransports = [];
2546
+ const seenTransports = new Set;
2547
+ for (const transport of requested) {
2548
+ if (seenTransports.has(transport)) {
2549
+ findings.push({
2550
+ check: "transportParity",
2551
+ subject: `${caseLabel}:${transport}`,
2552
+ message: `Duplicate transport "${transport}" in transportParity case`
2553
+ });
2554
+ continue;
2555
+ }
2556
+ seenTransports.add(transport);
2557
+ uniqueTransports.push(transport);
2558
+ }
2559
+ if (uniqueTransports.length < 2) {
2560
+ findings.push({
2561
+ check: "transportParity",
2562
+ subject: `${caseLabel}:transports`,
2563
+ message: `transportParity case requires at least two distinct transports, got ${uniqueTransports.length}`
2564
+ });
2565
+ continue;
2566
+ }
2567
+ const transports = uniqueTransports.sort(compareCodeUnits);
2568
+ const outcomes = [];
2569
+ for (const transport of transports) {
2570
+ if (testCase.beforeEach)
2571
+ await testCase.beforeEach();
2572
+ if (transport === "HTTP") {
2573
+ if (!config.http) {
2574
+ findings.push({
2575
+ check: "transportParity",
2576
+ subject: `${caseLabel}:HTTP`,
2577
+ message: "HTTP transport requested by case but not configured in transportParity"
2578
+ });
2579
+ continue;
2580
+ }
2581
+ outcomes.push(await callHttpParityTarget(config.http, service, testCase.action, methodDef, testCase.params ?? {}, testCase.args ?? {}));
2582
+ } else if (transport === "MCP") {
2583
+ if (!config.mcp) {
2584
+ findings.push({
2585
+ check: "transportParity",
2586
+ subject: `${caseLabel}:MCP`,
2587
+ message: "MCP transport requested by case but not configured in transportParity"
2588
+ });
2589
+ continue;
2590
+ }
2591
+ outcomes.push(await callMcpParityTarget(config.mcp, mcpState, toolName, toolArgs));
2592
+ } else if (transport === "AGENT") {
2593
+ if (!config.agent) {
2594
+ findings.push({
2595
+ check: "transportParity",
2596
+ subject: `${caseLabel}:AGENT`,
2597
+ message: "AGENT transport requested by case but not configured in transportParity"
2598
+ });
2599
+ continue;
2600
+ }
2601
+ outcomes.push(await callAgentParityTarget(config.agent, toolName, toolArgs));
2602
+ } else if (transport === "CLI") {
2603
+ if (!config.cli) {
2604
+ findings.push({
2605
+ check: "transportParity",
2606
+ subject: `${caseLabel}:CLI`,
2607
+ message: "CLI transport requested by case but not configured in transportParity"
2608
+ });
2609
+ continue;
2610
+ }
2611
+ outcomes.push(await callCliParityTarget(config.cli, toolName, toolArgs));
2612
+ }
2613
+ }
2614
+ findings.push(...compareParityOutcomes(caseLabel, testCase, outcomes));
2615
+ }
2616
+ return findings;
2617
+ }
2618
+
2619
+ // src/testing/tool-surface-ratchet.ts
2620
+ import { readFile as readFile2 } from "node:fs/promises";
2621
+ import { z as z5 } from "zod";
2622
+ var ToolSurfaceRatchetBaselineSchema = z5.strictObject({
2623
+ agentSchemaBytes: z5.number().int().nonnegative(),
2624
+ untypedProperties: z5.array(z5.string()),
2625
+ envelopeViolations: z5.array(z5.string())
2626
+ });
2627
+ var DEFAULT_UPDATE_HINT = "Run the baseline update script and commit the updated JSON.";
2628
+ function utf8Length(value) {
2629
+ return new TextEncoder().encode(JSON.stringify(value)).byteLength;
2630
+ }
2631
+ function defaultIsListOperation(op) {
2632
+ if (op.action === "list" || /^list[A-Z_]/.test(op.action) || /_list$|List$/.test(op.action)) {
2633
+ return true;
2634
+ }
2635
+ if (op.toolName && (/^list_/.test(op.toolName) || /_list$/.test(op.toolName))) {
2636
+ return true;
2637
+ }
2638
+ return false;
2639
+ }
2640
+ function inspectEnvelope(schema, subject, mustBeListEnvelope) {
2641
+ const json = toJsonSchema(schema, "output", "any");
2642
+ const violations = [];
2643
+ if (json.type === "array") {
2644
+ violations.push(`${subject}: root output must be an object envelope, not a bare array`);
2645
+ return violations;
2646
+ }
2647
+ if (!mustBeListEnvelope)
2648
+ return violations;
2649
+ const properties = isRecord(json.properties) ? json.properties : undefined;
2650
+ const itemsProp = properties?.items;
2651
+ const hasArrayItems = isRecord(itemsProp) && (itemsProp.type === "array" || Array.isArray(itemsProp.anyOf) && itemsProp.anyOf.some((branch) => isRecord(branch) && branch.type === "array"));
2652
+ if (json.type !== "object" || !hasArrayItems) {
2653
+ violations.push(`${subject}: list operation must return an object envelope with an array "items" property`);
2654
+ }
2655
+ return violations;
2656
+ }
2657
+ function computeToolSurfaceRatchet(options) {
2658
+ const runtimeTools = options.runtimeTools ?? [];
2659
+ const allowedUntyped = new Set(options.allowUntyped ?? []);
2660
+ const isList = options.isListOperation ?? defaultIsListOperation;
2661
+ const agentTools = projectToolSurface({ services: options.services, runtimeTools }, "AGENT", options.agentProjection ? {
2662
+ extend: options.agentProjection.extend,
2663
+ flattenUnionInput: options.agentProjection.flattenUnionInput,
2664
+ inputRecursionDepth: options.agentProjection.inputRecursionDepth,
2665
+ inputNestingDepth: options.agentProjection.inputNestingDepth
2666
+ } : {});
2667
+ const sizes = [];
2668
+ let agentSchemaBytes = 0;
2669
+ const untypedSet = new Set;
2670
+ const collectUntyped = (transport, services, surfaceRuntimeTools, projection) => {
2671
+ const projected = projectToolSurface({ services, runtimeTools: surfaceRuntimeTools }, transport, projection ? {
2672
+ extend: projection.extend,
2673
+ flattenUnionInput: projection.flattenUnionInput,
2674
+ inputRecursionDepth: projection.inputRecursionDepth,
2675
+ inputNestingDepth: projection.inputNestingDepth
2676
+ } : {});
2677
+ for (const tool of projected) {
2678
+ const opened = new Set;
2679
+ const schema = tool.kind === "contract" ? buildToolPresentationSchema({
2680
+ paramsSchema: tool.source.paramsSchema,
2681
+ inputSchema: tool.source.inputSchema,
2682
+ defaults: tool.source.toolView?.defaults,
2683
+ extendSchema: tool.shouldExtend ? projection?.extend?.schema : undefined,
2684
+ flattenUnionInput: projection?.flattenUnionInput,
2685
+ inputRecursionDepth: tool.source.inputRecursionDepth ?? projection?.inputRecursionDepth,
2686
+ inputNestingDepth: tool.source.inputNestingDepth ?? projection?.inputNestingDepth,
2687
+ onInputNestingOpened: (path) => opened.add(path),
2688
+ unrepresentable: "any"
2689
+ }) : buildToolPresentationSchema({
2690
+ inputSchema: tool.source.input,
2691
+ flattenUnionInput: projection?.flattenUnionInput,
2692
+ inputRecursionDepth: projection?.inputRecursionDepth,
2693
+ inputNestingDepth: projection?.inputNestingDepth,
2694
+ onInputNestingOpened: (path) => opened.add(path),
2695
+ unrepresentable: "any"
2696
+ });
2697
+ for (const entry of findUntypedProperties2(schema)) {
2698
+ if (opened.has(entry.path))
2699
+ continue;
2700
+ const fullPath = `${tool.name}.${entry.path}`;
2701
+ if (!allowedUntyped.has(fullPath))
2702
+ untypedSet.add(fullPath);
2703
+ }
2704
+ }
2705
+ };
2706
+ for (const tool of agentTools) {
2707
+ const bytes = utf8Length(tool.presentationSchema);
2708
+ agentSchemaBytes += bytes;
2709
+ sizes.push({ name: tool.name, bytes });
2710
+ }
2711
+ collectUntyped("AGENT", options.services, runtimeTools, options.agentProjection);
2712
+ if (options.mcpSurfaces && Object.keys(options.mcpSurfaces).length > 0) {
2713
+ for (const surfaceName of Object.keys(options.mcpSurfaces).sort(compareCodeUnits)) {
2714
+ const surface = options.mcpSurfaces[surfaceName];
2715
+ if (!surface)
2716
+ continue;
2717
+ collectUntyped("MCP", surface.services ?? options.services, surface.runtimeTools ?? runtimeTools, surface.projection ?? options.mcpProjection);
2718
+ }
2719
+ } else {
2720
+ collectUntyped("MCP", options.services, runtimeTools, options.mcpProjection);
2721
+ }
2722
+ const envelopeViolations = new Set;
2723
+ for (const op of collectSurfaceOperations(options.services, runtimeTools, options.mcpSurfaces)) {
2724
+ const action = op.methodDef ? op.methodDef.key : op.runtimeDef?.identity.action ?? "";
2725
+ const toolName = op.methodDef ? op.methodDef.toolName : op.runtimeDef?.name;
2726
+ const listOp = isList({
2727
+ key: op.key,
2728
+ action,
2729
+ ...toolName !== undefined && { toolName }
2730
+ });
2731
+ const output = op.methodDef ? op.methodDef.outputSchema : op.runtimeDef?.output;
2732
+ if (output) {
2733
+ for (const violation of inspectEnvelope(output, op.key, listOp)) {
2734
+ envelopeViolations.add(violation);
2735
+ }
2736
+ }
2737
+ const viewOutput = op.methodDef?.toolView?.output;
2738
+ if (viewOutput) {
2739
+ for (const violation of inspectEnvelope(viewOutput, `${op.key} (toolView)`, listOp)) {
2740
+ envelopeViolations.add(violation);
2741
+ }
2742
+ }
2743
+ }
2744
+ const topTools = sizes.sort((left, right) => right.bytes - left.bytes || compareCodeUnits(left.name, right.name)).slice(0, 5);
2745
+ return {
2746
+ baseline: {
2747
+ agentSchemaBytes,
2748
+ untypedProperties: [...untypedSet].sort(compareCodeUnits),
2749
+ envelopeViolations: [...envelopeViolations].sort(compareCodeUnits)
2750
+ },
2751
+ topTools
2752
+ };
2753
+ }
2754
+ async function writeToolSurfaceBaseline(path, baseline) {
2755
+ const parsed = ToolSurfaceRatchetBaselineSchema.parse(baseline);
2756
+ const normalized = {
2757
+ agentSchemaBytes: parsed.agentSchemaBytes,
2758
+ untypedProperties: [...new Set(parsed.untypedProperties)].sort(compareCodeUnits),
2759
+ envelopeViolations: [...new Set(parsed.envelopeViolations)].sort(compareCodeUnits)
2760
+ };
2761
+ await writeFileAtomic2(path, `${JSON.stringify(normalized, null, 2)}
2762
+ `, { mode: 420 });
2763
+ }
2764
+ function diffSortedLists(baseline, actual) {
2765
+ const baseSet = new Set(baseline);
2766
+ const actualSet = new Set(actual);
2767
+ const added = actual.filter((item) => !baseSet.has(item)).sort(compareCodeUnits);
2768
+ const removed = baseline.filter((item) => !actualSet.has(item)).sort(compareCodeUnits);
2769
+ return { added, removed };
2770
+ }
2771
+ async function runSchemaRatchetCheck(options) {
2772
+ const snapshot = computeToolSurfaceRatchet({
2773
+ services: options.services,
2774
+ runtimeTools: options.runtimeTools,
2775
+ agentProjection: options.agentProjection,
2776
+ mcpProjection: options.mcpProjection,
2777
+ mcpSurfaces: options.mcpSurfaces,
2778
+ allowUntyped: options.config.allowUntyped,
2779
+ isListOperation: options.config.isListOperation
2780
+ });
2781
+ const hint = options.config.updateCommand ? `Update baseline with: ${options.config.updateCommand}` : DEFAULT_UPDATE_HINT;
2782
+ let rawBaseline = options.config.baseline;
2783
+ let baselineSubject = "schemaRatchet.baseline";
2784
+ if ("path" in options.config.baseline) {
2785
+ baselineSubject = options.config.baseline.path;
2786
+ try {
2787
+ rawBaseline = JSON.parse(await readFile2(options.config.baseline.path, "utf8"));
2788
+ } catch (error) {
2789
+ return {
2790
+ snapshot,
2791
+ findings: [
2792
+ {
2793
+ check: "schemaRatchet",
2794
+ subject: baselineSubject,
2795
+ message: `Cannot read schema ratchet baseline "${baselineSubject}": ${error instanceof Error ? error.message : String(error)}`,
2796
+ hint
2797
+ }
2798
+ ]
2799
+ };
2800
+ }
2801
+ }
2802
+ const parsed = ToolSurfaceRatchetBaselineSchema.safeParse(rawBaseline);
2803
+ if (!parsed.success) {
2804
+ return {
2805
+ snapshot,
2806
+ findings: [
2807
+ {
2808
+ check: "schemaRatchet",
2809
+ subject: baselineSubject,
2810
+ message: `Invalid schema ratchet baseline: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`,
2811
+ hint
2812
+ }
2813
+ ]
2814
+ };
2815
+ }
2816
+ const findings = [];
2817
+ const expected = parsed.data;
2818
+ const actual = snapshot.baseline;
2819
+ if (actual.agentSchemaBytes !== expected.agentSchemaBytes) {
2820
+ const direction = actual.agentSchemaBytes > expected.agentSchemaBytes ? "grew" : "shrank";
2821
+ const top = snapshot.topTools.map((tool) => `${tool.name} (${tool.bytes} B)`).join(", ");
2822
+ findings.push({
2823
+ check: "schemaRatchet",
2824
+ subject: "agentSchemaBytes",
2825
+ message: `agentSchemaBytes ${direction} from ${expected.agentSchemaBytes} to ${actual.agentSchemaBytes} (top tools: ${top || "none"})`,
2826
+ hint
2827
+ });
2828
+ }
2829
+ const untypedDiff = diffSortedLists(expected.untypedProperties, actual.untypedProperties);
2830
+ if (untypedDiff.added.length > 0 || untypedDiff.removed.length > 0) {
2831
+ const parts = [];
2832
+ if (untypedDiff.added.length > 0)
2833
+ parts.push(`added: ${untypedDiff.added.join(", ")}`);
2834
+ if (untypedDiff.removed.length > 0)
2835
+ parts.push(`removed: ${untypedDiff.removed.join(", ")}`);
2836
+ findings.push({
2837
+ check: "schemaRatchet",
2838
+ subject: "untypedProperties",
2839
+ message: `untypedProperties drifted from baseline (${parts.join("; ")})`,
2840
+ hint
2841
+ });
2842
+ }
2843
+ const envelopeDiff = diffSortedLists(expected.envelopeViolations, actual.envelopeViolations);
2844
+ if (envelopeDiff.added.length > 0 || envelopeDiff.removed.length > 0) {
2845
+ const parts = [];
2846
+ if (envelopeDiff.added.length > 0)
2847
+ parts.push(`added: ${envelopeDiff.added.join(", ")}`);
2848
+ if (envelopeDiff.removed.length > 0)
2849
+ parts.push(`removed: ${envelopeDiff.removed.join(", ")}`);
2850
+ findings.push({
2851
+ check: "schemaRatchet",
2852
+ subject: "envelopeViolations",
2853
+ message: `envelopeViolations drifted from baseline (${parts.join("; ")})`,
2854
+ hint
2855
+ });
2856
+ }
2857
+ return { findings, snapshot };
2858
+ }
2859
+
2860
+ // src/testing/tool-surface-gates.ts
2861
+ function formatToolSurfaceReport(report) {
2862
+ if (report.ok)
2863
+ return "Tool surface checks passed (0 findings).";
2864
+ const lines = [
2865
+ `Tool surface check failed (${report.findings.length} finding${report.findings.length === 1 ? "" : "s"}):`
2866
+ ];
2867
+ for (const name of TOOL_SURFACE_CHECK_NAMES) {
2868
+ const outcome = report.checks[name];
2869
+ if (outcome.status !== "fail")
2870
+ continue;
2871
+ lines.push(`- [${name}] (${outcome.findings.length}):`);
2872
+ for (const item of outcome.findings) {
2873
+ const suffix = item.hint ? ` — ${item.hint}` : "";
2874
+ lines.push(` • ${item.subject}: ${item.message}${suffix}`);
2875
+ }
2876
+ }
2877
+ return lines.join(`
2878
+ `);
2879
+ }
2880
+
2881
+ class ToolSurfaceError extends Error {
2882
+ report;
2883
+ constructor(report) {
2884
+ super(formatToolSurfaceReport(report));
2885
+ this.name = "ToolSurfaceError";
2886
+ this.report = report;
2887
+ }
2888
+ }
2889
+ function outcomeOf2(findings) {
2890
+ return { status: findings.length === 0 ? "pass" : "fail", findings };
2891
+ }
2892
+ async function checkToolSurface(config) {
2893
+ const runtimeTools = config.runtimeTools ?? [];
2894
+ const skipped = { status: "skipped", findings: [] };
2895
+ const getReadsOutcome = config.getReads ? outcomeOf2(runGetReadsCheck(config.services, runtimeTools, config.getReads, config.mcpSurfaces)) : skipped;
2896
+ const cliCallableOutcome = config.cliCallable ? outcomeOf2(await runCliCallableCheck(config.cliCallable)) : skipped;
2897
+ const noRefsOutcome = config.noRefs === false ? skipped : outcomeOf2(runNoRefsCheck({
2898
+ services: config.services,
2899
+ runtimeTools,
2900
+ mcpProjection: config.mcpProjection,
2901
+ agentProjection: config.agentProjection,
2902
+ mcpSurfaces: config.mcpSurfaces
2903
+ }));
2904
+ const outputJsonSchemaOutcome = config.outputJsonSchema === false ? skipped : outcomeOf2(runOutputJsonSchemaCheck(config.services, runtimeTools, config.mcpSurfaces));
2905
+ const transportParityOutcome = config.transportParity ? outcomeOf2(await runTransportParityCheck(config.services, config.transportParity)) : skipped;
2906
+ const deadReferencesOutcome = config.deadReferences ? outcomeOf2(await runDeadReferencesCheck({
2907
+ services: config.services,
2908
+ runtimeTools,
2909
+ mcpSurfaces: config.mcpSurfaces,
2910
+ config: config.deadReferences
2911
+ })) : skipped;
2912
+ let schemaRatchetOutcome = skipped;
2913
+ let ratchet;
2914
+ if (config.schemaRatchet) {
2915
+ const result = await runSchemaRatchetCheck({
2916
+ services: config.services,
2917
+ runtimeTools,
2918
+ agentProjection: config.agentProjection,
2919
+ mcpProjection: config.mcpProjection,
2920
+ mcpSurfaces: config.mcpSurfaces,
2921
+ config: config.schemaRatchet
2922
+ });
2923
+ schemaRatchetOutcome = outcomeOf2(result.findings);
2924
+ ratchet = result.snapshot;
2925
+ }
2926
+ const checks = {
2927
+ getReads: getReadsOutcome,
2928
+ cliCallable: cliCallableOutcome,
2929
+ noRefs: noRefsOutcome,
2930
+ outputJsonSchema: outputJsonSchemaOutcome,
2931
+ transportParity: transportParityOutcome,
2932
+ deadReferences: deadReferencesOutcome,
2933
+ schemaRatchet: schemaRatchetOutcome
2934
+ };
2935
+ const findings = TOOL_SURFACE_CHECK_NAMES.flatMap((name) => checks[name].findings);
2936
+ return {
2937
+ ok: findings.length === 0,
2938
+ checks,
2939
+ findings,
2940
+ ...ratchet !== undefined && { ratchet }
2941
+ };
2942
+ }
2943
+ async function assertToolSurface(config) {
2944
+ const report = await checkToolSurface(config);
2945
+ if (!report.ok)
2946
+ throw new ToolSurfaceError(report);
2947
+ return report;
2948
+ }
1472
2949
  export {
1473
2950
  ManagedResourceConformanceError,
1474
2951
  ManagedResourceConformancePhaseSchema,
@@ -1491,15 +2968,26 @@ export {
1491
2968
  SurfaceManifestToolSurfaceSchema,
1492
2969
  SurfaceRealtimeSchemaPairSchema,
1493
2970
  SurfaceSchemaDigestsSchema,
2971
+ TOOL_SURFACE_CHECK_NAMES,
2972
+ ToolSurfaceCheckNameSchema,
2973
+ ToolSurfaceError,
2974
+ ToolSurfaceFindingSchema,
2975
+ ToolSurfaceGetReadsRegistrySchema,
2976
+ ToolSurfaceRatchetBaselineSchema,
1494
2977
  TransportObservationSchema,
1495
2978
  assertSurfaceDiscovery,
1496
2979
  assertSurfaceManifestSnapshot,
2980
+ assertToolSurface,
1497
2981
  buildSurfaceManifest,
2982
+ checkToolSurface,
2983
+ computeToolSurfaceRatchet,
1498
2984
  createHandlerTestClient,
1499
2985
  createHandlerTestClients,
1500
2986
  createManualClock,
1501
2987
  createRealtimeProbeDriver,
1502
2988
  defineRealtimeProbe,
2989
+ formatToolSurfaceReport,
1503
2990
  runManagedResourceConformance,
1504
- runSurfaceProbes
2991
+ runSurfaceProbes,
2992
+ writeToolSurfaceBaseline
1505
2993
  };