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
@@ -3,7 +3,7 @@ import {
3
3
  isAbsoluteNormalPath,
4
4
  sameHostPath,
5
5
  createBaseServiceHostAdapter
6
- } from "./index-67mzzkdv.js";
6
+ } from "./index-z72agxdn.js";
7
7
  import {
8
8
  errnoOf
9
9
  } from "./index-jj9228tt.js";
@@ -1,15 +1,18 @@
1
1
  import {
2
2
  resolveToolAccess,
3
+ toolResultFromError,
4
+ applyToolErrorMapping,
3
5
  toolErrorFromResult,
6
+ assertUniqueToolName,
4
7
  collectTools2,
5
8
  createToolRunner
6
- } from "./index-9118dw8d.js";
9
+ } from "./index-scpcps66.js";
7
10
  import {
8
- assertUniqueToolName
9
- } from "./index-edpkm3k7.js";
11
+ assertErrorCodeMapping
12
+ } from "./index-fy9mmek1.js";
10
13
  import {
11
14
  AppError2
12
- } from "./index-7fjbdga8.js";
15
+ } from "./index-3pb4ccj2.js";
13
16
  import {
14
17
  isRecord
15
18
  } from "./index-ps3djm8d.js";
@@ -17,6 +20,7 @@ import {
17
20
  // src/tools/invoker.ts
18
21
  function createToolInvoker2(services, config) {
19
22
  const lifecycle = resolveToolAccess("createToolInvoker", config);
23
+ assertErrorCodeMapping("createToolInvoker", config.errors);
20
24
  const serviceList = Array.isArray(services) ? services : [services];
21
25
  const tools = new Map;
22
26
  for (const service of serviceList) {
@@ -35,7 +39,7 @@ function createToolInvoker2(services, config) {
35
39
  const tool = tools.get(name);
36
40
  if (tool)
37
41
  return tool;
38
- throw new AppError2("UNKNOWN_OPERATION", {
42
+ const unknown = new AppError2("UNKNOWN_OPERATION", {
39
43
  message: `Unknown tool: ${name}`,
40
44
  status: 404,
41
45
  details: {
@@ -43,6 +47,7 @@ function createToolInvoker2(services, config) {
43
47
  available: names
44
48
  }
45
49
  });
50
+ throw config.errors ? toolErrorFromResult(applyToolErrorMapping(toolResultFromError(unknown), config.errors)) : unknown;
46
51
  };
47
52
  const run = (name, args, options = {}) => {
48
53
  if (isRecord(options) && Object.hasOwn(options, "lifecycle")) {
@@ -56,7 +61,8 @@ function createToolInvoker2(services, config) {
56
61
  extend: config.extend,
57
62
  coerceJsonArgs: config.coerceJsonArgs,
58
63
  onOutputStrip: options.onOutputStrip,
59
- toolSurface: config.toolSurface ?? false
64
+ toolSurface: config.toolSurface ?? false,
65
+ errors: config.errors
60
66
  });
61
67
  return runTool(operation(name), args);
62
68
  };
@@ -0,0 +1,28 @@
1
+ // src/contract/operation-read.ts
2
+ function isReadOnlyOperation2(operation) {
3
+ if (operation.effect === "write")
4
+ return false;
5
+ const annotations = operation.annotations ?? operation.tool?.annotations;
6
+ if (annotations?.destructiveHint === true)
7
+ return false;
8
+ if (annotations?.readOnlyHint !== undefined)
9
+ return annotations.readOnlyHint;
10
+ if (operation.effect === "read")
11
+ return true;
12
+ return operation.method === "GET" || operation.method === "HEAD";
13
+ }
14
+ function assertOperationReadConsistency(subject, effect, annotations, annotationsPath = "tool.annotations") {
15
+ if (effect === undefined || annotations === undefined)
16
+ return;
17
+ if (effect === "read" && annotations.readOnlyHint === false) {
18
+ throw new Error(`${subject} contradicts itself: effect "read" cannot be combined with ${annotationsPath}.readOnlyHint: false`);
19
+ }
20
+ if (effect === "write" && annotations.readOnlyHint === true) {
21
+ throw new Error(`${subject} contradicts itself: effect "write" cannot be combined with ${annotationsPath}.readOnlyHint: true`);
22
+ }
23
+ if (effect === "read" && annotations.destructiveHint === true) {
24
+ throw new Error(`${subject} contradicts itself: effect "read" cannot be combined with ${annotationsPath}.destructiveHint: true`);
25
+ }
26
+ }
27
+
28
+ export { isReadOnlyOperation2, assertOperationReadConsistency };
@@ -98,6 +98,14 @@ var STITCH_ERROR_STATUS2 = {
98
98
  SANDBOX_UNAVAILABLE: 503,
99
99
  SANDBOX_INSUFFICIENT: 503,
100
100
  SPILL_REFERENCE_UNKNOWN: 404,
101
+ HEADERS_TOO_LARGE: 431,
102
+ REQUEST_TOO_LARGE: 413,
103
+ CONTROL_API_BUSY: 503,
104
+ ROLE_NOT_ALLOWED: 403,
105
+ KEYS_MANAGE_REQUIRED: 403,
106
+ INIT_DENIED: 403,
107
+ INIT_TIMEOUT: 408,
108
+ CONSENT_PENDING: 409,
101
109
  INTERNAL_SERVER_ERROR: 500
102
110
  };
103
111
  function isRetryableStatus2(status) {
@@ -2,20 +2,27 @@ import {
2
2
  ExposureSchema,
3
3
  isHttpOnlyEndpoint
4
4
  } from "./index-yt1gg11x.js";
5
- import {
6
- defineContract2
7
- } from "./index-dmrx8xma.js";
8
5
  import {
9
6
  bytesToBase64Url,
10
7
  base64UrlToBytes
11
8
  } from "./index-dwfv9a85.js";
9
+ import {
10
+ defineContract2
11
+ } from "./index-8ef1bfea.js";
12
+ import {
13
+ isUnsafeKey
14
+ } from "./index-zsarb5xp.js";
12
15
  import {
13
16
  AppError2,
14
17
  STITCH_ERROR_STATUS2,
15
18
  isStitchErrorCode2
16
- } from "./index-7fjbdga8.js";
19
+ } from "./index-3pb4ccj2.js";
20
+ import {
21
+ setOwnMember
22
+ } from "./index-3tb82xr7.js";
17
23
  import {
18
24
  typedEntries,
25
+ isRecord,
19
26
  transportResult,
20
27
  mapObjectTypeBoundary
21
28
  } from "./index-ps3djm8d.js";
@@ -140,6 +147,7 @@ function createContractFactory2(...args) {
140
147
  meta: { ...meta, prefix: meta.prefix, scope: meta.scope }
141
148
  };
142
149
  };
150
+ const defineScopedEndpoints = (endpoints) => endpoints;
143
151
  function configure(config) {
144
152
  const defaults = ContractFactoryConfigSchema.parse(config).toolExposure.default;
145
153
  const httpDefaults = Object.freeze(defaults.filter((transport) => transport === "HTTP"));
@@ -150,9 +158,40 @@ function createContractFactory2(...args) {
150
158
  });
151
159
  return scoped(meta, materialized);
152
160
  };
153
- return { defineContract: configured };
161
+ return { defineContract: configured, defineEndpoints: defineScopedEndpoints };
162
+ }
163
+ return { defineContract: scoped, defineEndpoints: defineScopedEndpoints, configure };
164
+ }
165
+ // src/contract/fragments.ts
166
+ function defineEndpoints2(endpoints) {
167
+ return endpoints;
168
+ }
169
+ function composeEndpoints2(...fragments) {
170
+ const merged = {};
171
+ const seen = new Set;
172
+ for (const fragment of fragments) {
173
+ if (!isRecord(fragment)) {
174
+ throw new TypeError("[stitchkit] composeEndpoints: every fragment must be a plain object");
175
+ }
176
+ const proto = Object.getPrototypeOf(fragment);
177
+ if (proto !== Object.prototype && proto !== null) {
178
+ throw new TypeError("[stitchkit] composeEndpoints: every fragment must be a plain object");
179
+ }
180
+ for (const key of Object.keys(fragment)) {
181
+ if (isUnsafeKey(key) || key === "constructor" || key === "prototype") {
182
+ throw new TypeError(`[stitchkit] composeEndpoints: forbidden endpoint name "${key}"`);
183
+ }
184
+ if (seen.has(key)) {
185
+ throw new Error(`[stitchkit] composeEndpoints: duplicate endpoint name "${key}"`);
186
+ }
187
+ seen.add(key);
188
+ const endpoint = fragment[key];
189
+ if (endpoint !== undefined) {
190
+ setOwnMember(merged, key, endpoint);
191
+ }
192
+ }
154
193
  }
155
- return { defineContract: scoped, configure };
194
+ return merged;
156
195
  }
157
196
  // src/contract/pagination.ts
158
197
  import { z as z3 } from "zod";
@@ -181,4 +220,4 @@ function decodeCursor2(cursor, schema) {
181
220
  return null;
182
221
  }
183
222
  }
184
- export { defineErrors2, createContractFactory2, paginatedSchema2, encodeCursor2, decodeCursor2 };
223
+ export { defineErrors2, createContractFactory2, defineEndpoints2, composeEndpoints2, paginatedSchema2, encodeCursor2, decodeCursor2 };
@@ -18,6 +18,7 @@ var UNIX_CLIENT_DELIVERY_STATES = [
18
18
  "possibly-dispatched",
19
19
  "response-received"
20
20
  ];
21
+ var UNIX_CLIENT_TRANSPORT_ERROR_BRAND = Symbol.for("stitchkit.UnixClientTransportError");
21
22
 
22
23
  class UnixClientTransportError2 extends Error {
23
24
  code;
@@ -30,6 +31,13 @@ class UnixClientTransportError2 extends Error {
30
31
  this.name = UNIX_CLIENT_TRANSPORT_ERROR_NAME;
31
32
  if (options?.socketPath !== undefined)
32
33
  this.socketPath = options.socketPath;
34
+ Object.defineProperty(this, UNIX_CLIENT_TRANSPORT_ERROR_BRAND, { value: true });
35
+ }
36
+ static is(error) {
37
+ return typeof error === "object" && error !== null && Object.hasOwn(error, UNIX_CLIENT_TRANSPORT_ERROR_BRAND);
38
+ }
39
+ static [Symbol.hasInstance](value) {
40
+ return UnixClientTransportError2.is(value);
33
41
  }
34
42
  }
35
43
  function unixTransportError(socketPath, code, message, delivery = "possibly-dispatched", cause) {
@@ -7,7 +7,7 @@ import {
7
7
  decodeJsonText,
8
8
  parseJsonText,
9
9
  validateJsonValue
10
- } from "./index-ctaxjpa4.js";
10
+ } from "./index-r709pqed.js";
11
11
  import {
12
12
  messageOf
13
13
  } from "./index-r9kq5ark.js";
@@ -0,0 +1,35 @@
1
+ import {
2
+ AppError2,
3
+ STITCH_ERROR_STATUS2
4
+ } from "./index-3pb4ccj2.js";
5
+ import {
6
+ isRecord
7
+ } from "./index-ps3djm8d.js";
8
+
9
+ // src/tools/internal/remote-error.ts
10
+ function projectRemoteError(err) {
11
+ if (err.code === "HTTP_ERROR" || err.code === "UNKNOWN_ERROR") {
12
+ const answered = err.status > 0;
13
+ const projected = new AppError2(answered ? "HTTP_ERROR" : "CONNECTION_REQUEST_FAILED", {
14
+ message: answered ? "Remote service answered with an error" : "Remote request failed",
15
+ status: answered ? err.status : STITCH_ERROR_STATUS2.CONNECTION_REQUEST_FAILED,
16
+ traceId: err.traceId
17
+ });
18
+ projected.cause = err;
19
+ return projected;
20
+ }
21
+ const cancelled = err.status === 0 && err.code === "REQUEST_ABORTED";
22
+ const timedOut = err.status === 0 && err.code === "REQUEST_TIMEOUT";
23
+ const projected = new AppError2(err.code, {
24
+ message: err.message,
25
+ status: cancelled ? 499 : timedOut ? 408 : err.status > 0 ? err.status : undefined,
26
+ details: isRecord(err.details) ? err.details : undefined,
27
+ hint: err.hint,
28
+ traceId: err.traceId,
29
+ retryable: err.retryable
30
+ });
31
+ projected.cause = err;
32
+ return projected;
33
+ }
34
+
35
+ export { projectRemoteError };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createValidatedRealtimeSocket
3
- } from "./index-0k1ba0ss.js";
3
+ } from "./index-j91jffhv.js";
4
4
 
5
5
  // src/server/realtime.ts
6
6
  function bindRealtimeServer2(contract, handle, options = {}) {
@@ -0,0 +1,71 @@
1
+ import {
2
+ resolveRouteParamsSchema
3
+ } from "./index-m38ej7e5.js";
4
+ import {
5
+ assertEndpointExposure
6
+ } from "./index-yt1gg11x.js";
7
+ import {
8
+ assertMultipartEndpoint,
9
+ assertRawEndpoint,
10
+ assertStreamingResponseEndpoint,
11
+ assertNoUngroupedToolOptions,
12
+ assertHeadEndpoint,
13
+ assertRawBodyEndpoint,
14
+ assertSafelistedBodyEndpoint,
15
+ assertResponseMetaEndpoint,
16
+ assertContractToolOptions
17
+ } from "./index-kw0segzt.js";
18
+ import {
19
+ assertEndpointEffect
20
+ } from "./index-werjqesf.js";
21
+ import {
22
+ assertEndpointRefusals
23
+ } from "./index-wdg7bswj.js";
24
+ import {
25
+ assertTimerMs
26
+ } from "./index-e1y74yra.js";
27
+ import {
28
+ assertPositiveSafeInteger
29
+ } from "./index-gr0kxymw.js";
30
+
31
+ // src/contract/define.ts
32
+ function defineContract2(meta, endpoints) {
33
+ const materializedEndpoints = {};
34
+ for (const [key, endpoint] of Object.entries(endpoints)) {
35
+ const params = resolveRouteParamsSchema(endpoint.path, endpoint.params);
36
+ materializedEndpoints[key] = params === endpoint.params ? endpoint : { ...endpoint, params };
37
+ }
38
+ const toolTransports = new Map;
39
+ for (const [key, ep] of Object.entries(materializedEndpoints)) {
40
+ assertEndpointExposure(meta.prefix, key, ep);
41
+ assertEndpointEffect(meta.prefix, key, ep);
42
+ assertEndpointRefusals(`Contract "${meta.prefix}": endpoint "${key}"`, ep.refuses);
43
+ if (typeof ep.desc !== "string") {
44
+ throw new Error(`Contract "${meta.prefix}": endpoint "${key}" requires desc`);
45
+ }
46
+ if (ep.desc.trim() === "") {
47
+ throw new Error(`Contract "${meta.prefix}": endpoint "${key}" has an empty desc`);
48
+ }
49
+ assertPositiveSafeInteger(`Contract "${meta.prefix}": endpoint "${key}" maxJsonBodyBytes`, ep.maxJsonBodyBytes, Error);
50
+ assertTimerMs(`Contract "${meta.prefix}": endpoint "${key}" timeout`, ep.timeout);
51
+ if (ep.multipart)
52
+ assertMultipartEndpoint(meta.prefix, key, ep);
53
+ if (ep.rawResponse)
54
+ assertRawEndpoint(meta.prefix, key, ep);
55
+ if ("stream" in ep)
56
+ assertStreamingResponseEndpoint(meta.prefix, key, ep);
57
+ if (ep.method === "HEAD")
58
+ assertHeadEndpoint(meta.prefix, key, ep);
59
+ if (ep.rawBody)
60
+ assertRawBodyEndpoint(meta.prefix, key, ep);
61
+ if (ep.safelistedBody)
62
+ assertSafelistedBodyEndpoint(meta.prefix, key, ep);
63
+ if ("responseMeta" in ep)
64
+ assertResponseMetaEndpoint(meta.prefix, key, ep);
65
+ assertNoUngroupedToolOptions(meta.prefix, key, ep);
66
+ assertContractToolOptions(meta.prefix, key, ep, toolTransports);
67
+ }
68
+ return { meta, endpoints: materializedEndpoints };
69
+ }
70
+
71
+ export { defineContract2 };
@@ -1,18 +1,15 @@
1
+ import {
2
+ isReadOnlyOperation2
3
+ } from "./index-3k8w02se.js";
4
+
1
5
  // src/tools/read-operation.ts
2
6
  import { z } from "zod";
3
7
  function isRepeatableRead(operation) {
4
- const declared = operation.annotations;
5
- if (declared?.readOnlyHint !== undefined)
6
- return declared.readOnlyHint;
7
- if (operation.effect === "write")
8
- return false;
9
- if (operation.effect === "read")
10
- return declared?.destructiveHint !== true;
11
- return operation.method === "GET" && declared?.destructiveHint !== true;
8
+ return isReadOnlyOperation2(operation);
12
9
  }
13
10
  function publishedToolAnnotations(operation) {
14
11
  const declared = operation.annotations;
15
- if (declared?.readOnlyHint !== undefined || !isRepeatableRead(operation))
12
+ if (declared?.readOnlyHint !== undefined || !isReadOnlyOperation2(operation))
16
13
  return declared;
17
14
  return { ...declared, readOnlyHint: true };
18
15
  }
@@ -7,26 +7,25 @@ import {
7
7
  import {
8
8
  inspectOnlyError,
9
9
  resolveToolAccess,
10
+ toolSurfaceOutputSchema,
10
11
  parseToolCallArguments,
11
12
  toolResultFromError,
13
+ applyToolErrorMapping,
12
14
  observed,
15
+ presentationMetadata,
13
16
  collectTools2,
14
17
  createToolRunner,
15
18
  formatToolError
16
- } from "./index-9118dw8d.js";
17
- import {
18
- toolSurfaceOutputSchema,
19
- presentationMetadata
20
- } from "./index-edpkm3k7.js";
19
+ } from "./index-scpcps66.js";
21
20
  import {
22
21
  publishedToolAnnotations
23
- } from "./index-0x4mnwg5.js";
22
+ } from "./index-8k3y9nd4.js";
24
23
  import {
25
24
  staticInputRounds,
26
25
  validateMcpRoundPolicy,
27
26
  validateResolvedInputRounds,
28
27
  prepareProjectedMcpTools
29
- } from "./index-efbzm2se.js";
28
+ } from "./index-x2r0ma9t.js";
30
29
  import {
31
30
  markProtocolOutcome
32
31
  } from "./index-cfnmvcq8.js";
@@ -40,7 +39,7 @@ import {
40
39
  wwwAuthenticateHeader2,
41
40
  mcpProgressToken,
42
41
  createMcpProgressReporter
43
- } from "./index-a09r9ff0.js";
42
+ } from "./index-y44j39yk.js";
44
43
  import {
45
44
  MCP_CATALOG_HEADER,
46
45
  mcpCatalogMeta2,
@@ -48,20 +47,23 @@ import {
48
47
  } from "./index-5t4fpdct.js";
49
48
  import {
50
49
  projectJsonSafe
51
- } from "./index-9vj869rx.js";
50
+ } from "./index-gzqy81tw.js";
52
51
  import {
53
52
  collectToolSurface
54
- } from "./index-2zrx0nzv.js";
53
+ } from "./index-rzc40z6e.js";
54
+ import {
55
+ assertErrorCodeMapping
56
+ } from "./index-fy9mmek1.js";
55
57
  import {
56
58
  runWithRequestContext2,
57
59
  getRequestContext2
58
60
  } from "./index-q4tr9vnf.js";
59
61
  import {
60
62
  defineRuntimeTool2
61
- } from "./index-7csn6pva.js";
63
+ } from "./index-ze94h4ph.js";
62
64
  import {
63
65
  AppError2
64
- } from "./index-7fjbdga8.js";
66
+ } from "./index-3pb4ccj2.js";
65
67
  import {
66
68
  argumentsDigest
67
69
  } from "./index-3dq8466w.js";
@@ -72,12 +74,12 @@ import {
72
74
  import {
73
75
  resolvePropagationContext2
74
76
  } from "./index-y7sy1xdp.js";
75
- import {
76
- assertPositiveSafeInteger
77
- } from "./index-gr0kxymw.js";
78
77
  import {
79
78
  raceAbort
80
79
  } from "./index-rptj3qnc.js";
80
+ import {
81
+ assertPositiveSafeInteger
82
+ } from "./index-gr0kxymw.js";
81
83
  import {
82
84
  isRecord
83
85
  } from "./index-ps3djm8d.js";
@@ -600,8 +602,9 @@ function registerMcpTool(server, presentation, descriptor, config) {
600
602
  const format = config.formatResult;
601
603
  return server.registerTool(name, stampToolRegistration(toolConfig, config.catalog), async (rawArgs, mcpContext) => stampToolResult(await runInMcpRequestContext(mcpContext, name, async () => {
602
604
  const inspectErr = inspectOnlyError(config.lifecycle);
603
- if (inspectErr)
604
- return format(toolResultFromError(inspectErr), "none", name);
605
+ if (inspectErr) {
606
+ return format(applyToolErrorMapping(toolResultFromError(inspectErr), config.errors), "none", name);
607
+ }
605
608
  const args = isRecord(rawArgs) ? rawArgs : {};
606
609
  const startedAt = Date.now();
607
610
  try {
@@ -612,7 +615,7 @@ function registerMcpTool(server, presentation, descriptor, config) {
612
615
  policy: mountable.method.mcp,
613
616
  runtime: config.multiRoundRuntime,
614
617
  runTool: config.runTool,
615
- formatFailure: (result) => format(result, "none", name)
618
+ formatFailure: (result) => format(result.ok ? result : applyToolErrorMapping(result, config.errors), "none", name)
616
619
  });
617
620
  if (round.kind === "response")
618
621
  return round.response;
@@ -659,7 +662,7 @@ function registerMcpTool(server, presentation, descriptor, config) {
659
662
  ...transportContext(mcpContext, name),
660
663
  source: "mcp"
661
664
  };
662
- const result = toolResultFromError(err);
665
+ const result = applyToolErrorMapping(toolResultFromError(err), config.errors);
663
666
  await observed("onToolError", () => config.hooks?.onToolError?.({
664
667
  toolName: name,
665
668
  error: err,
@@ -692,7 +695,8 @@ function mountPreparedRuntimeMcp(server, tools, config) {
692
695
  hooks: config.hooks,
693
696
  lifecycle: config.lifecycle,
694
697
  coerceJsonArgs: config.coerceJsonArgs,
695
- onOutputStrip: config.onOutputStrip
698
+ onOutputStrip: config.onOutputStrip,
699
+ errors: config.errors
696
700
  });
697
701
  for (const { definition, descriptor } of tools) {
698
702
  const { present: presenters } = definition;
@@ -709,7 +713,8 @@ function mountPreparedRuntimeMcp(server, tools, config) {
709
713
  multiRoundRuntime: config.multiRoundRuntime,
710
714
  hooks: config.hooks,
711
715
  lifecycle: config.lifecycle,
712
- context: config.context
716
+ context: config.context,
717
+ errors: config.errors
713
718
  });
714
719
  }
715
720
  }
@@ -825,6 +830,7 @@ function applyMcpLazyDiscovery(input) {
825
830
  hooks: input.hooks,
826
831
  lifecycle: input.lifecycle,
827
832
  coerceJsonArgs: input.coerceJsonArgs,
833
+ errors: input.errors,
828
834
  onOutputStrip: input.onOutputStrip,
829
835
  formatResult: (result, mode, toolName) => formatMcpResult(result, mode, toolName, input.errorHint)
830
836
  });
@@ -843,6 +849,7 @@ function validateMcpSchemas2(config) {
843
849
  }
844
850
  function mountMcp2(mcpServer, services, config) {
845
851
  resolveToolAccess("mountMcp", config);
852
+ assertErrorCodeMapping("mountMcp", config.errors);
846
853
  const prepared = prepareMcpSurface(services, {
847
854
  extend: config.extend,
848
855
  flattenUnionInput: config.flattenUnionInput,
@@ -858,6 +865,7 @@ function mountMcp2(mcpServer, services, config) {
858
865
  }
859
866
  function mountPreparedMcp(mcpServer, prepared, config) {
860
867
  const lifecycle = resolveToolAccess("mountPreparedMcp", config);
868
+ assertErrorCodeMapping("mountPreparedMcp", config.errors);
861
869
  const validatedDiscovery = config.discovery !== undefined ? validateMcpLazyDiscovery(config.discovery, prepared.map((descriptor) => descriptor.mountable.name), config.reservedToolNames) : undefined;
862
870
  const catalog = validatedDiscovery === undefined ? config.catalog : undefined;
863
871
  const runTool = createToolRunner({
@@ -868,7 +876,8 @@ function mountPreparedMcp(mcpServer, prepared, config) {
868
876
  hooks: config.hooks,
869
877
  lifecycle,
870
878
  coerceJsonArgs: config.coerceJsonArgs,
871
- onOutputStrip: config.onOutputStrip
879
+ onOutputStrip: config.onOutputStrip,
880
+ errors: config.errors
872
881
  });
873
882
  const registeredTools = [];
874
883
  for (const descriptor of prepared) {
@@ -884,7 +893,8 @@ function mountPreparedMcp(mcpServer, prepared, config) {
884
893
  multiRoundRuntime: config.multiRoundRuntime,
885
894
  hooks: config.hooks,
886
895
  lifecycle,
887
- context: config.context
896
+ context: config.context,
897
+ errors: config.errors
888
898
  });
889
899
  registeredTools.push({ name, description: method.desc, registered });
890
900
  }
@@ -899,6 +909,7 @@ function mountPreparedMcp(mcpServer, prepared, config) {
899
909
  catalog,
900
910
  coerceJsonArgs: config.coerceJsonArgs,
901
911
  errorHint: config.errorHint,
912
+ errors: config.errors,
902
913
  onOutputStrip: config.onOutputStrip
903
914
  });
904
915
  }
@@ -908,6 +919,7 @@ function buildMcpServer2(config, auth) {
908
919
  if (!isMcpServerBuildConfig(config)) {
909
920
  throw new TypeError("[stitchkit] buildMcpServer requires a valid config object");
910
921
  }
922
+ assertErrorCodeMapping("buildMcpServer", config.errors);
911
923
  let surface;
912
924
  if (config.surfaces) {
913
925
  const key = config.selectSurface(auth);
@@ -946,6 +958,7 @@ function servedMcpCatalog(server) {
946
958
  }
947
959
  function buildMcpServerFromPrepared(config, auth, prepared) {
948
960
  const lifecycle = resolveToolAccess("buildMcpServerFromPrepared", config);
961
+ assertErrorCodeMapping("buildMcpServerFromPrepared", config.errors);
949
962
  let roundCodec;
950
963
  if (config.multiRound) {
951
964
  const principal = config.multiRound.state.principal(auth);
@@ -986,6 +999,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
986
999
  inputRecursionDepth: config.inputRecursionDepth,
987
1000
  inputNestingDepth: config.inputNestingDepth,
988
1001
  errorHint: config.errorHint,
1002
+ errors: config.errors,
989
1003
  onOutputStrip: config.onOutputStrip,
990
1004
  discovery: config.discovery,
991
1005
  reservedToolNames: prepared.runtimeTools.map((entry) => entry.definition.name),
@@ -1002,6 +1016,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
1002
1016
  hooks: config.hooks,
1003
1017
  lifecycle,
1004
1018
  coerceJsonArgs: config.coerceJsonArgs,
1019
+ errors: config.errors,
1005
1020
  onOutputStrip: config.onOutputStrip,
1006
1021
  formatResult: (result, mode, toolName) => formatMcpResult(result, mode, toolName, config.errorHint),
1007
1022
  ...roundCodec !== undefined && {
@@ -1090,6 +1105,7 @@ function prepareStaticSurface(config) {
1090
1105
  }
1091
1106
  function createMcpHandler2(config) {
1092
1107
  resolveToolAccess("createMcpHandler", config);
1108
+ assertErrorCodeMapping("createMcpHandler", config.errors);
1093
1109
  if ("discovery" in config && config.discovery !== undefined) {
1094
1110
  throw new TypeError("[stitchkit] createMcpHandler: lazy tool discovery requires a stateful MCP session; use createStdioMcpServer, buildMcpServer, or mountMcp instead");
1095
1111
  }
@@ -1199,6 +1215,7 @@ function createMcpHttpRoute2(config) {
1199
1215
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
1200
1216
  async function createStdioMcpServer2(config) {
1201
1217
  resolveToolAccess("createStdioMcpServer", config);
1218
+ assertErrorCodeMapping("createStdioMcpServer", config.errors);
1202
1219
  const auth = await config.auth;
1203
1220
  return serveStdio(() => buildMcpServer2(config, auth), {
1204
1221
  legacy: config.legacy ?? "serve",
@@ -9,7 +9,7 @@ import {
9
9
  nextEventSeqByMaximum,
10
10
  agentSqlTables,
11
11
  createAgentRuntimeStore2
12
- } from "./index-8tn10tp6.js";
12
+ } from "./index-v64bvwjr.js";
13
13
  import {
14
14
  canonicalAgentJson2
15
15
  } from "./index-kaq9nb7h.js";
@@ -24,7 +24,7 @@ import {
24
24
  scanSqlRecoverable,
25
25
  listSqlConversations,
26
26
  pageSqlConversationMessages
27
- } from "./index-zcq3dby3.js";
27
+ } from "./index-1bjwfnnj.js";
28
28
  import {
29
29
  rollbackSqliteFailure
30
30
  } from "./index-ttexdtjj.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readBoundedChunks
3
- } from "./index-f16b7rze.js";
3
+ } from "./index-er1tp8de.js";
4
4
  import {
5
5
  assertTimerMs,
6
6
  startIdleTimer
@@ -1,17 +1,17 @@
1
+ import {
2
+ isSecretKeyName,
3
+ maskSecretShapes
4
+ } from "./index-xrbrvn15.js";
1
5
  import {
2
6
  sanitizeSurrogates,
3
7
  AgentProviderError2,
4
8
  AgentProviderStreamCutError2
5
9
  } from "./index-knqye3gv.js";
6
- import {
7
- isSecretKeyName,
8
- maskSecretShapes
9
- } from "./index-xrbrvn15.js";
10
10
  import {
11
11
  readBoundedChunks,
12
12
  concatChunks,
13
13
  readBoundedText
14
- } from "./index-f16b7rze.js";
14
+ } from "./index-er1tp8de.js";
15
15
  import {
16
16
  chunksOf
17
17
  } from "./index-sk03xe0n.js";