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,10 +3,10 @@ import {
3
3
  } from "./index-yt1gg11x.js";
4
4
  import {
5
5
  projectToolSurface
6
- } from "./index-edpkm3k7.js";
6
+ } from "./index-scpcps66.js";
7
7
  import {
8
8
  contractOnlyService
9
- } from "./index-gq35s3bm.js";
9
+ } from "./index-s5axtd56.js";
10
10
 
11
11
  // src/tools/list-names.ts
12
12
  function listToolNames2(surface) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runNativeCommand2
3
- } from "./index-afaq0nc4.js";
3
+ } from "./index-n0egp1ke.js";
4
4
 
5
5
  // src/service-host/macos/runner.ts
6
6
  import { realpath } from "node:fs/promises";
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  mapSubschemas
3
3
  } from "./index-e413q2cj.js";
4
+ import {
5
+ AppError2
6
+ } from "./index-3pb4ccj2.js";
4
7
  import {
5
8
  setOwnMember
6
9
  } from "./index-3tb82xr7.js";
@@ -11,6 +14,18 @@ import {
11
14
  isRecord
12
15
  } from "./index-ps3djm8d.js";
13
16
 
17
+ // src/tools/internal/tool-error-projection.ts
18
+ var TOOL_ERROR_PROJECTION = Symbol.for("stitchkit.toolErrorProjection");
19
+ function projectedToolError(error) {
20
+ if (typeof error !== "object" || error === null)
21
+ return;
22
+ const project = Reflect.get(error, TOOL_ERROR_PROJECTION);
23
+ if (typeof project !== "function")
24
+ return;
25
+ const projected = Reflect.apply(project, error, []);
26
+ return AppError2.is(projected) ? projected : undefined;
27
+ }
28
+
14
29
  // src/json-schema/dialect.ts
15
30
  var DRAFT_07_MARKER = "draft-07";
16
31
  var DRAFT_07_KEYWORD = "definitions";
@@ -318,4 +333,4 @@ function mergePropertySchemas(properties, discriminator) {
318
333
  return merged;
319
334
  }
320
335
 
321
- export { declaresDraft07, withDraft2020Keywords, stringValues, mergePropertySchemas };
336
+ export { TOOL_ERROR_PROJECTION, projectedToolError, declaresDraft07, withDraft2020Keywords, stringValues, mergePropertySchemas };
@@ -0,0 +1,95 @@
1
+ import {
2
+ isStitchErrorCode2
3
+ } from "./index-3pb4ccj2.js";
4
+ import {
5
+ isRecord
6
+ } from "./index-ps3djm8d.js";
7
+
8
+ // src/contract/error-mapping.ts
9
+ function assertErrorCodeMapping(caller, mapping) {
10
+ if (mapping === undefined)
11
+ return;
12
+ if (!isRecord(mapping)) {
13
+ throw new TypeError(`[stitchkit] ${caller}: \`errors\` must be an object`);
14
+ }
15
+ const hasVocabulary = mapping.vocabulary !== undefined;
16
+ if (hasVocabulary && (mapping.codeMap !== undefined || mapping.unmappedCode !== undefined)) {
17
+ throw new Error(`[stitchkit] ${caller}: \`vocabulary\` carries the wire map — it cannot be combined with \`codeMap\` or \`unmappedCode\``);
18
+ }
19
+ if (hasVocabulary && (!isRecord(mapping.vocabulary) || !isRecord(mapping.vocabulary.codeMap))) {
20
+ throw new TypeError(`[stitchkit] ${caller}: \`vocabulary\` must be an object with a \`codeMap\` record`);
21
+ }
22
+ if (mapping.codeMap !== undefined && !isRecord(mapping.codeMap)) {
23
+ throw new TypeError(`[stitchkit] ${caller}: \`codeMap\` must be an object`);
24
+ }
25
+ const configuredMap = hasVocabulary ? mapping.vocabulary.codeMap : mapping.codeMap;
26
+ if (configuredMap !== undefined) {
27
+ const mapLabel = hasVocabulary ? "vocabulary.codeMap" : "codeMap";
28
+ for (const [key, value] of Object.entries(configuredMap)) {
29
+ if (value !== undefined && (typeof value !== "string" || value.trim().length === 0)) {
30
+ throw new TypeError(`[stitchkit] ${caller}: \`${mapLabel}["${key}"]\` must be a non-empty string`);
31
+ }
32
+ }
33
+ }
34
+ if (mapping.unmappedCode !== undefined && typeof mapping.unmappedCode !== "string" && typeof mapping.unmappedCode !== "function") {
35
+ throw new TypeError(`[stitchkit] ${caller}: \`unmappedCode\` must be a string or a function`);
36
+ }
37
+ if (typeof mapping.unmappedCode === "string" && mapping.unmappedCode.trim().length === 0) {
38
+ throw new TypeError(`[stitchkit] ${caller}: \`unmappedCode\` must be a non-empty string`);
39
+ }
40
+ if (mapping.redact !== undefined) {
41
+ if (!isRecord(mapping.redact)) {
42
+ throw new TypeError(`[stitchkit] ${caller}: \`redact\` must be an object`);
43
+ }
44
+ for (const [key, value] of Object.entries(mapping.redact)) {
45
+ if (value !== undefined && typeof value !== "string") {
46
+ throw new TypeError(`[stitchkit] ${caller}: \`redact["${key}"]\` must be a string`);
47
+ }
48
+ }
49
+ }
50
+ }
51
+ function resolveWireErrorCode(canonicalCode, mapping) {
52
+ if (mapping === undefined)
53
+ return canonicalCode;
54
+ const stitchCode = isStitchErrorCode2(canonicalCode) ? canonicalCode : undefined;
55
+ const configuredMap = mapping.vocabulary?.codeMap ?? mapping.codeMap;
56
+ const mapped = stitchCode !== undefined && configuredMap !== undefined && Object.hasOwn(configuredMap, stitchCode) ? configuredMap[stitchCode] : undefined;
57
+ const fallback = mapped === undefined && stitchCode !== undefined ? typeof mapping.unmappedCode === "function" ? mapping.unmappedCode(stitchCode) : mapping.unmappedCode : undefined;
58
+ return mapped ?? fallback ?? canonicalCode;
59
+ }
60
+ function resolveWireError(appErr, mapping) {
61
+ const code = resolveWireErrorCode(appErr.code, mapping);
62
+ const redactedMessage = mapping?.redact !== undefined && Object.hasOwn(mapping.redact, code) ? mapping.redact[code] : undefined;
63
+ if (redactedMessage !== undefined) {
64
+ return {
65
+ code,
66
+ status: appErr.status,
67
+ message: redactedMessage,
68
+ details: undefined,
69
+ hint: undefined,
70
+ redacted: true
71
+ };
72
+ }
73
+ return {
74
+ code,
75
+ status: appErr.status,
76
+ message: appErr.message,
77
+ details: appErr.details,
78
+ hint: appErr.hint,
79
+ redacted: false
80
+ };
81
+ }
82
+ var canonicalErrorCodes = new WeakMap;
83
+ var canonicalErrors = new WeakMap;
84
+ function rememberCanonicalError(target, canonical) {
85
+ canonicalErrors.set(target, canonical);
86
+ canonicalErrorCodes.set(target, canonical.code);
87
+ }
88
+ function canonicalErrorFor(target) {
89
+ return canonicalErrors.get(target);
90
+ }
91
+ function canonicalErrorCodeFor(target, fallback) {
92
+ return canonicalErrorCodes.get(target) ?? fallback;
93
+ }
94
+
95
+ export { assertErrorCodeMapping, resolveWireError, rememberCanonicalError, canonicalErrorFor, canonicalErrorCodeFor };
@@ -46,7 +46,7 @@ import {
46
46
  import {
47
47
  ToolExecutionControlError2,
48
48
  isToolExecutionControlError2
49
- } from "./index-9118dw8d.js";
49
+ } from "./index-scpcps66.js";
50
50
  import {
51
51
  AGENT_TOOL_PROGRESS_MESSAGE_MAX2,
52
52
  agentDurableEventId2
@@ -72,11 +72,6 @@ import {
72
72
  mergeModelTotals,
73
73
  createIdleDeadline
74
74
  } from "./index-xaa3603f.js";
75
- import {
76
- describeJsonRefusal,
77
- projectJson,
78
- recordedJson
79
- } from "./index-a1rjr381.js";
80
75
  import {
81
76
  createToolChronology,
82
77
  advanceToolChronology,
@@ -93,10 +88,10 @@ import {
93
88
  } from "./index-knqye3gv.js";
94
89
  import {
95
90
  listContractToolNames2
96
- } from "./index-fatke81t.js";
91
+ } from "./index-ezgvsj9w.js";
97
92
  import {
98
93
  finalizeAgentToolOutput
99
- } from "./index-vwg0n3e6.js";
94
+ } from "./index-pyazb8q4.js";
100
95
  import {
101
96
  AgentToolError2,
102
97
  isAgentToolError2
@@ -104,16 +99,17 @@ import {
104
99
  import {
105
100
  createMutationQueue
106
101
  } from "./index-sykb5ag7.js";
102
+ import {
103
+ describeJsonRefusal,
104
+ projectJson,
105
+ recordedJson
106
+ } from "./index-ceshyndf.js";
107
107
  import {
108
108
  setOwnMember
109
109
  } from "./index-3tb82xr7.js";
110
110
  import {
111
111
  serializeCanonicalJson
112
112
  } from "./index-fmzg39a8.js";
113
- import {
114
- assertPositiveSafeInteger,
115
- assertNonNegativeSafeInteger
116
- } from "./index-gr0kxymw.js";
117
113
  import {
118
114
  assertTimerMs,
119
115
  withDeadline
@@ -125,6 +121,10 @@ import {
125
121
  raceAbort,
126
122
  linkAbortSignals
127
123
  } from "./index-rptj3qnc.js";
124
+ import {
125
+ assertPositiveSafeInteger,
126
+ assertNonNegativeSafeInteger
127
+ } from "./index-gr0kxymw.js";
128
128
  import {
129
129
  isRecord,
130
130
  isAsyncIterable
@@ -0,0 +1,19 @@
1
+ // src/contract/time-zone.ts
2
+ import { z } from "zod";
3
+ var DEFAULT_TIME_ZONE2 = "UTC";
4
+ var IANA_TIME_ZONE_PATTERN = /^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/;
5
+ var IanaTimeZoneSchema2 = z.string().min(1, "expected an IANA time zone").max(64, "IANA time zone must be at most 64 characters").regex(IANA_TIME_ZONE_PATTERN, "expected an IANA time zone");
6
+ function canonicalizeIanaTimeZone2(value) {
7
+ if (!IanaTimeZoneSchema2.safeParse(value).success)
8
+ return null;
9
+ try {
10
+ const resolved = new Intl.DateTimeFormat("en-US", {
11
+ timeZone: value
12
+ }).resolvedOptions().timeZone;
13
+ return IanaTimeZoneSchema2.safeParse(resolved).success ? resolved : null;
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+
19
+ export { DEFAULT_TIME_ZONE2, IanaTimeZoneSchema2, canonicalizeIanaTimeZone2 };
@@ -10,7 +10,7 @@ import {
10
10
  } from "./index-zsarb5xp.js";
11
11
  import {
12
12
  unauthorized2
13
- } from "./index-7fjbdga8.js";
13
+ } from "./index-3pb4ccj2.js";
14
14
  import {
15
15
  isRecord
16
16
  } from "./index-ps3djm8d.js";
@@ -0,0 +1,172 @@
1
+ import {
2
+ isUnsafeKey
3
+ } from "./index-zsarb5xp.js";
4
+ import {
5
+ isRecord
6
+ } from "./index-ps3djm8d.js";
7
+
8
+ // src/tools/internal/json-projection.ts
9
+ var MAX_FALLBACK_DEPTH = 64;
10
+ var MAX_FALLBACK_NODES = 1e5;
11
+ var ERROR_CORE_KEYS = new Set(["_type", "name", "message", "stack", "cause"]);
12
+ function readErrorProperty(error, name) {
13
+ try {
14
+ return Reflect.get(error, name);
15
+ } catch {
16
+ return "[unreadable]";
17
+ }
18
+ }
19
+ function projectError(error, depth, walk) {
20
+ const stack = readErrorProperty(error, "stack");
21
+ const cause = readErrorProperty(error, "cause");
22
+ const own = {};
23
+ let keys;
24
+ try {
25
+ keys = Object.keys(error);
26
+ } catch {
27
+ keys = [];
28
+ }
29
+ for (const key of keys) {
30
+ if (isUnsafeKey(key) || ERROR_CORE_KEYS.has(key))
31
+ continue;
32
+ try {
33
+ const entry = Reflect.get(error, key);
34
+ if (entry === undefined)
35
+ continue;
36
+ own[key] = walk(entry, depth + 1);
37
+ } catch {
38
+ own[key] = "[unreadable]";
39
+ }
40
+ }
41
+ return {
42
+ _type: "error",
43
+ name: String(readErrorProperty(error, "name")),
44
+ message: String(readErrorProperty(error, "message")),
45
+ ...stack !== undefined && { stack: String(stack) },
46
+ ...cause !== undefined && { cause: walk(cause, depth + 1) },
47
+ ...own
48
+ };
49
+ }
50
+ function projectJsonFallback(value) {
51
+ const ancestors = new Set;
52
+ let visited = 0;
53
+ const walk = (input, depth) => {
54
+ if (depth > MAX_FALLBACK_DEPTH)
55
+ return "[max depth]";
56
+ visited += 1;
57
+ if (visited > MAX_FALLBACK_NODES)
58
+ return "[node budget]";
59
+ if (input === null || input === undefined)
60
+ return null;
61
+ if (typeof input === "string" || typeof input === "boolean")
62
+ return input;
63
+ if (typeof input === "number")
64
+ return Number.isFinite(input) ? input + 0 : null;
65
+ if (typeof input !== "object")
66
+ return String(input);
67
+ if (input instanceof Uint8Array || input instanceof ArrayBuffer) {
68
+ return { _type: "binary", size: input.byteLength };
69
+ }
70
+ if (input instanceof Blob) {
71
+ return { _type: "blob", size: input.size, mime: input.type };
72
+ }
73
+ if (typeof FormData !== "undefined" && input instanceof FormData) {
74
+ return { _type: "formdata", keys: [...input.keys()] };
75
+ }
76
+ if (input instanceof Date) {
77
+ return Number.isNaN(input.getTime()) ? "[invalid date]" : input.toISOString();
78
+ }
79
+ if (input instanceof URL)
80
+ return input.href;
81
+ if (ancestors.has(input))
82
+ return "[circular]";
83
+ ancestors.add(input);
84
+ try {
85
+ if (input instanceof Map) {
86
+ return {
87
+ _type: "map",
88
+ entries: [...input.entries()].map(([k, v]) => [
89
+ walk(k, depth + 1),
90
+ walk(v, depth + 1)
91
+ ])
92
+ };
93
+ }
94
+ if (input instanceof Set) {
95
+ return {
96
+ _type: "set",
97
+ values: [...input].map((item) => walk(item, depth + 1))
98
+ };
99
+ }
100
+ if (input instanceof Error) {
101
+ return projectError(input, depth, walk);
102
+ }
103
+ if (Array.isArray(input)) {
104
+ const result = [];
105
+ for (let index = 0;index < input.length; index += 1) {
106
+ try {
107
+ result.push(walk(Reflect.get(input, index), depth + 1));
108
+ } catch {
109
+ result.push("[unreadable]");
110
+ }
111
+ }
112
+ return result;
113
+ }
114
+ if (isRecord(input)) {
115
+ let keys;
116
+ try {
117
+ keys = Object.keys(input);
118
+ } catch {
119
+ return "[unreadable]";
120
+ }
121
+ const out = {};
122
+ for (const key of keys) {
123
+ if (isUnsafeKey(key))
124
+ continue;
125
+ try {
126
+ const entry = Reflect.get(input, key);
127
+ if (entry === undefined)
128
+ continue;
129
+ out[key] = walk(entry, depth + 1);
130
+ } catch {
131
+ out[key] = "[unreadable]";
132
+ }
133
+ }
134
+ return out;
135
+ }
136
+ return String(input);
137
+ } finally {
138
+ ancestors.delete(input);
139
+ }
140
+ };
141
+ return walk(value, 0);
142
+ }
143
+ function projectJsonSafe(value, space) {
144
+ try {
145
+ const serialized = JSON.stringify(value, null, space);
146
+ if (serialized === undefined) {
147
+ return { value: null, text: "null" };
148
+ }
149
+ let strippedUnsafe = false;
150
+ const parsed = JSON.parse(serialized, (key, entry) => {
151
+ if (isUnsafeKey(key)) {
152
+ strippedUnsafe = true;
153
+ return;
154
+ }
155
+ return entry;
156
+ });
157
+ const text = strippedUnsafe ? JSON.stringify(parsed, null, space) ?? "null" : serialized;
158
+ return { value: parsed, text };
159
+ } catch {}
160
+ const safe = projectJsonFallback(value);
161
+ const text = JSON.stringify(safe, null, space) ?? "null";
162
+ return { value: safe, text };
163
+ }
164
+ function stringifyJsonSafe(value, space) {
165
+ try {
166
+ const serialized = JSON.stringify(value, null, space);
167
+ return serialized ?? "null";
168
+ } catch {}
169
+ return JSON.stringify(projectJsonFallback(value), null, space) ?? "null";
170
+ }
171
+
172
+ export { projectJsonSafe, stringifyJsonSafe };
@@ -1,6 +1,9 @@
1
+ import {
2
+ omitUndefinedProperties
3
+ } from "./index-ceshyndf.js";
1
4
  import {
2
5
  AppError2
3
- } from "./index-7fjbdga8.js";
6
+ } from "./index-3pb4ccj2.js";
4
7
  import {
5
8
  raceAbort
6
9
  } from "./index-rptj3qnc.js";
@@ -21,7 +24,7 @@ var ContractStreamFrameSchema2 = z.discriminatedUnion("type", [
21
24
  z.object({ type: z.literal("end") }).strict()
22
25
  ]);
23
26
  function checkContractStreamItem(descriptor, value) {
24
- const parsed = descriptor.item.safeParse(value);
27
+ const parsed = descriptor.item.safeParse(omitUndefinedProperties(value));
25
28
  if (!parsed.success) {
26
29
  console.error("[stitchkit] contract stream item failed validation:", parsed.error);
27
30
  throw new AppError2("STREAM_ITEM_INVALID", {
@@ -29,9 +32,10 @@ function checkContractStreamItem(descriptor, value) {
29
32
  status: 500
30
33
  });
31
34
  }
35
+ const item = omitUndefinedProperties(parsed.data);
32
36
  return {
33
- item: parsed.data,
34
- terminal: descriptor.terminal?.safeParse(parsed.data).success ?? false
37
+ item,
38
+ terminal: descriptor.terminal?.safeParse(item).success ?? false
35
39
  };
36
40
  }
37
41
  async function* readContractStreamItems(iterator, descriptor, signal, observe) {
@@ -9,13 +9,13 @@ import {
9
9
  realtimeRequestTraces,
10
10
  createRequestTracer,
11
11
  bindRealtimeClient2
12
- } from "./index-033tyx59.js";
13
- import {
14
- assertNonNegativeSafeInteger
15
- } from "./index-gr0kxymw.js";
12
+ } from "./index-0zw0hcyg.js";
16
13
  import {
17
14
  assertTimerMs
18
15
  } from "./index-e1y74yra.js";
16
+ import {
17
+ assertNonNegativeSafeInteger
18
+ } from "./index-gr0kxymw.js";
19
19
 
20
20
  // src/browser/retained.ts
21
21
  function createRetainedTopics2() {
@@ -254,6 +254,9 @@ function createRealtimeClientWithPeer(contract, { onRejected, logger, onRequestP
254
254
  get connected() {
255
255
  return bound.connected;
256
256
  },
257
+ get id() {
258
+ return bound.id;
259
+ },
257
260
  connect: transport.connect,
258
261
  disconnect: transport.disconnect
259
262
  };
@@ -359,6 +362,9 @@ function createSocketIOClientInternal(config, defaultIo, onRequestPhase) {
359
362
  get connected() {
360
363
  return socket?.connected ?? false;
361
364
  },
365
+ get id() {
366
+ return socket?.connected ? socket.id : undefined;
367
+ },
362
368
  connect() {
363
369
  if (socket?.connected || desiredConnected)
364
370
  return;
@@ -2,8 +2,8 @@ import {
2
2
  jsonSchemaObjectCoercionMembers
3
3
  } from "./index-dsa676h8.js";
4
4
  import {
5
- unwrapZodWrappers
6
- } from "./index-dm50x3by.js";
5
+ toJsonSchema
6
+ } from "./index-d1pdv8qc.js";
7
7
  import {
8
8
  safeJsonParse
9
9
  } from "./index-zsarb5xp.js";
@@ -15,32 +15,92 @@ import {
15
15
  } from "./index-ps3djm8d.js";
16
16
 
17
17
  // src/tools/schema/coerce.ts
18
+ import { z as z2 } from "zod";
19
+
20
+ // src/tools/schema/schema.ts
18
21
  import { z } from "zod";
22
+ function unwrapZodWrappers(field) {
23
+ if (field instanceof z.ZodOptional || field instanceof z.ZodNullable || field instanceof z.ZodDefault || field instanceof z.ZodReadonly) {
24
+ return unwrapZodWrappers(field.unwrap());
25
+ }
26
+ return field;
27
+ }
28
+ function objectShapeKeys(schema) {
29
+ const base = schema ? unwrapZodWrappers(schema) : undefined;
30
+ return base instanceof z.ZodObject ? Object.keys(base.shape) : [];
31
+ }
32
+ function keyPolicyOf(schema) {
33
+ return schema.def.catchall;
34
+ }
35
+ function rebuildObject(source, shape) {
36
+ return withKeyPolicy(z.object(shape), keyPolicyOf(source));
37
+ }
38
+ function withKeyPolicy(object, policy) {
39
+ if (policy === undefined)
40
+ return object;
41
+ return object.catchall(representable(policy));
42
+ }
43
+ function representable(policy) {
44
+ if (policy instanceof z.ZodNever || policy instanceof z.ZodUnknown)
45
+ return policy;
46
+ if (!(policy instanceof z.ZodType))
47
+ return z.unknown();
48
+ try {
49
+ toJsonSchema(policy, "input");
50
+ return policy;
51
+ } catch {
52
+ return z.unknown();
53
+ }
54
+ }
55
+ function mergeSchemas(paramsSchema, inputSchema) {
56
+ if (paramsSchema && !(paramsSchema instanceof z.ZodObject)) {
57
+ throw new Error("Tool params schema must be a z.object()");
58
+ }
59
+ const paramsObject = paramsSchema instanceof z.ZodObject ? paramsSchema : undefined;
60
+ if (!inputSchema) {
61
+ return paramsObject ?? z.object({});
62
+ }
63
+ if (inputSchema instanceof z.ZodObject) {
64
+ if (paramsObject) {
65
+ const conflicts = Object.keys(paramsObject.shape).filter((key) => (key in inputSchema.shape));
66
+ if (conflicts.length > 0) {
67
+ throw new Error(`Schema merge conflict: ${conflicts.join(", ")} appear in both params and input`);
68
+ }
69
+ }
70
+ return rebuildObject(inputSchema, {
71
+ ...paramsObject?.shape ?? {},
72
+ ...inputSchema.shape
73
+ });
74
+ }
75
+ return paramsObject ? z.intersection(paramsObject, inputSchema) : inputSchema;
76
+ }
77
+
78
+ // src/tools/schema/coerce.ts
19
79
  function needsJsonCoercion(schema) {
20
80
  const base = unwrapZodWrappers(schema);
21
- return base instanceof z.ZodArray || base instanceof z.ZodObject || base instanceof z.ZodRecord || base instanceof z.ZodTuple || base instanceof z.ZodUnion;
81
+ return base instanceof z2.ZodArray || base instanceof z2.ZodObject || base instanceof z2.ZodRecord || base instanceof z2.ZodTuple || base instanceof z2.ZodUnion;
22
82
  }
23
83
  function acceptsRawString(schema) {
24
84
  const base = unwrapZodWrappers(schema);
25
85
  const type = base._zod.def.type;
26
86
  if (type === "string" || type === "template_literal")
27
87
  return true;
28
- if (base instanceof z.ZodLiteral) {
88
+ if (base instanceof z2.ZodLiteral) {
29
89
  return base.def.values.some((value) => typeof value === "string");
30
90
  }
31
- if (base instanceof z.ZodEnum) {
91
+ if (base instanceof z2.ZodEnum) {
32
92
  return base.options.some((value) => typeof value === "string");
33
93
  }
34
- if (base instanceof z.ZodUnion) {
94
+ if (base instanceof z2.ZodUnion) {
35
95
  return base.def.options.some((option) => acceptsRawString(option));
36
96
  }
37
97
  return false;
38
98
  }
39
99
  function arrayMembers(schema) {
40
100
  const base = unwrapZodWrappers(schema);
41
- if (base instanceof z.ZodArray)
101
+ if (base instanceof z2.ZodArray)
42
102
  return [base];
43
- if (base instanceof z.ZodUnion) {
103
+ if (base instanceof z2.ZodUnion) {
44
104
  return base.def.options.flatMap((option) => arrayMembers(option));
45
105
  }
46
106
  return [];
@@ -60,12 +120,12 @@ function matchingVariant(union, value) {
60
120
  const disc = union.def.discriminator;
61
121
  const tag = value[disc];
62
122
  for (const option of union.def.options) {
63
- if (!(option instanceof z.ZodObject))
123
+ if (!(option instanceof z2.ZodObject))
64
124
  continue;
65
125
  const field = option.shape[disc];
66
- if (field instanceof z.ZodLiteral && field.def.values.some((v) => v === tag))
126
+ if (field instanceof z2.ZodLiteral && field.def.values.some((v) => v === tag))
67
127
  return option;
68
- if (field instanceof z.ZodEnum && field.options.some((v) => v === tag))
128
+ if (field instanceof z2.ZodEnum && field.options.some((v) => v === tag))
69
129
  return option;
70
130
  }
71
131
  return;
@@ -82,7 +142,7 @@ function coerceValue(value, schema, path) {
82
142
  if (typeof current === "string" && needsJsonCoercion(base)) {
83
143
  if (acceptsRawString(base)) {
84
144
  if (writtenAsList(current, base)) {
85
- throw new z.ZodError([
145
+ throw new z2.ZodError([
86
146
  {
87
147
  code: "custom",
88
148
  path: [...path],
@@ -99,7 +159,7 @@ function coerceValue(value, schema, path) {
99
159
  return value;
100
160
  }
101
161
  }
102
- if (base instanceof z.ZodObject && isRecord(current)) {
162
+ if (base instanceof z2.ZodObject && isRecord(current)) {
103
163
  const shape = base.shape;
104
164
  const out = {};
105
165
  for (const [key, item] of Object.entries(current)) {
@@ -108,10 +168,10 @@ function coerceValue(value, schema, path) {
108
168
  }
109
169
  return out;
110
170
  }
111
- if (base instanceof z.ZodArray && Array.isArray(current)) {
171
+ if (base instanceof z2.ZodArray && Array.isArray(current)) {
112
172
  return current.map((item, index) => coerceValue(item, base.element, [...path, index]));
113
173
  }
114
- if (base instanceof z.ZodDiscriminatedUnion && isRecord(current)) {
174
+ if (base instanceof z2.ZodDiscriminatedUnion && isRecord(current)) {
115
175
  const variant = matchingVariant(base, current);
116
176
  return variant ? coerceValue(current, variant, path) : current;
117
177
  }
@@ -122,4 +182,4 @@ function coerceJsonArgs2(args, schema) {
122
182
  return isRecord(coerced) ? coerced : args;
123
183
  }
124
184
 
125
- export { coerceJsonArgs2 };
185
+ export { unwrapZodWrappers, objectShapeKeys, rebuildObject, mergeSchemas, coerceJsonArgs2 };
@@ -2,7 +2,7 @@ import {
2
2
  assertUnixSocketPathLength,
3
3
  assertExpectedOwnerUid,
4
4
  unixSocketDirectoryViolation
5
- } from "./index-kd48gk7d.js";
5
+ } from "./index-x8py72a3.js";
6
6
  import {
7
7
  errnoOf
8
8
  } from "./index-jj9228tt.js";
@@ -7,11 +7,11 @@ import {
7
7
  } from "./index-m38ej7e5.js";
8
8
  import {
9
9
  describeRefusals
10
- } from "./index-dxft2mnm.js";
10
+ } from "./index-wdg7bswj.js";
11
11
  import {
12
12
  AppError2,
13
13
  isStitchErrorCode2
14
- } from "./index-7fjbdga8.js";
14
+ } from "./index-3pb4ccj2.js";
15
15
 
16
16
  // src/contract/runtime-context.ts
17
17
  function mergeMeta(contractMeta, endpointMeta) {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-1eeqpadm.js";
8
8
  import {
9
9
  AppError2
10
- } from "./index-7fjbdga8.js";
10
+ } from "./index-3pb4ccj2.js";
11
11
 
12
12
  // src/realtime/rejected-frame.ts
13
13
  var REALTIME_REJECTION_KEY2 = "@stitchkit/realtime-rejected";