stitchkit 0.104.2 → 0.105.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 (429) hide show
  1. package/CHANGELOG.md +372 -13
  2. package/darwin-native.cjs +4 -2
  3. package/dist/agent-runtime/browser-control-contract.d.ts +32 -2
  4. package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
  5. package/dist/agent-runtime/browser-controller.d.ts +21 -3
  6. package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
  7. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  8. package/dist/agent-runtime/coding-tool-refusals.d.ts +1 -0
  9. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  10. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  11. package/dist/agent-runtime/compaction.d.ts.map +1 -1
  12. package/dist/agent-runtime/contained-write.d.ts.map +1 -1
  13. package/dist/agent-runtime/control-schema.d.ts +48 -1
  14. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  15. package/dist/agent-runtime/deferred-tool-search.d.ts +3 -2
  16. package/dist/agent-runtime/deferred-tool-search.d.ts.map +1 -1
  17. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  18. package/dist/agent-runtime/harness-realtime.d.ts +34 -4
  19. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
  20. package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -1
  21. package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
  22. package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
  23. package/dist/agent-runtime/sandbox-process-owner.d.ts +9 -1
  24. package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
  25. package/dist/agent-runtime/sandbox.d.ts +32 -1
  26. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  27. package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
  28. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  29. package/dist/agent-runtime/store-events.d.ts +9 -4
  30. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  31. package/dist/agent-runtime/testing.d.ts.map +1 -1
  32. package/dist/application/diagnostic-journal-contract.d.ts +50 -0
  33. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  34. package/dist/application/diagnostic-journal-generations.d.ts +24 -0
  35. package/dist/application/diagnostic-journal-generations.d.ts.map +1 -0
  36. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  37. package/dist/application/diagnostic-journal-open.d.ts +10 -0
  38. package/dist/application/diagnostic-journal-open.d.ts.map +1 -0
  39. package/dist/application/diagnostic-journal-quarantine.d.ts +28 -0
  40. package/dist/application/diagnostic-journal-quarantine.d.ts.map +1 -0
  41. package/dist/application/diagnostic-journal-read-contract.d.ts +73 -3
  42. package/dist/application/diagnostic-journal-read-contract.d.ts.map +1 -1
  43. package/dist/application/diagnostic-journal-reader.d.ts +17 -2
  44. package/dist/application/diagnostic-journal-reader.d.ts.map +1 -1
  45. package/dist/application/diagnostic-journal-recovery.d.ts +18 -2
  46. package/dist/application/diagnostic-journal-recovery.d.ts.map +1 -1
  47. package/dist/application/diagnostic-journal-storage.d.ts +6 -2
  48. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  49. package/dist/application/diagnostic-journal-tail.d.ts +12 -0
  50. package/dist/application/diagnostic-journal-tail.d.ts.map +1 -0
  51. package/dist/application/diagnostic-journal.d.ts +3 -0
  52. package/dist/application/diagnostic-journal.d.ts.map +1 -1
  53. package/dist/application/directory-inbox-accept.d.ts +3 -3
  54. package/dist/application/directory-inbox-accept.d.ts.map +1 -1
  55. package/dist/application/directory-inbox-contract.d.ts +38 -10
  56. package/dist/application/directory-inbox-contract.d.ts.map +1 -1
  57. package/dist/application/directory-inbox-delivery.d.ts +3 -3
  58. package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
  59. package/dist/application/directory-inbox-files.d.ts +17 -2
  60. package/dist/application/directory-inbox-files.d.ts.map +1 -1
  61. package/dist/application/directory-inbox-state.d.ts +1 -1
  62. package/dist/application/directory-inbox-state.d.ts.map +1 -1
  63. package/dist/application/directory-inbox.d.ts +1 -1
  64. package/dist/application/directory-inbox.d.ts.map +1 -1
  65. package/dist/application/file-state-store.d.ts +21 -1
  66. package/dist/application/file-state-store.d.ts.map +1 -1
  67. package/dist/application/grammy.d.ts.map +1 -1
  68. package/dist/application/kernel-contract.d.ts.map +1 -1
  69. package/dist/application/revision-signal.d.ts.map +1 -1
  70. package/dist/application/state-store.d.ts +3 -0
  71. package/dist/application/state-store.d.ts.map +1 -1
  72. package/dist/browser/api-error.d.ts +38 -0
  73. package/dist/browser/api-error.d.ts.map +1 -0
  74. package/dist/browser/chunked-upload.d.ts.map +1 -1
  75. package/dist/browser/client-executors.d.ts.map +1 -1
  76. package/dist/browser/client-url.d.ts.map +1 -1
  77. package/dist/browser/contract-stream.d.ts.map +1 -1
  78. package/dist/browser/http.d.ts +0 -25
  79. package/dist/browser/http.d.ts.map +1 -1
  80. package/dist/browser/resumable.d.ts.map +1 -1
  81. package/dist/contract/define-validation.d.ts +0 -1
  82. package/dist/contract/define-validation.d.ts.map +1 -1
  83. package/dist/contract/define.d.ts.map +1 -1
  84. package/dist/contract/errors-factory.d.ts.map +1 -1
  85. package/dist/contract/errors.d.ts +15 -18
  86. package/dist/contract/errors.d.ts.map +1 -1
  87. package/dist/contract/normalize.d.ts.map +1 -1
  88. package/dist/durability/effect.d.ts.map +1 -1
  89. package/dist/durability/scheduler.d.ts.map +1 -1
  90. package/dist/entrypoints/agent-runtime/browser.js +29 -18
  91. package/dist/entrypoints/agent-runtime/coding-tools.js +8 -7
  92. package/dist/entrypoints/agent-runtime/harness.js +15 -14
  93. package/dist/entrypoints/agent-runtime/realtime.d.ts +1 -1
  94. package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -1
  95. package/dist/entrypoints/agent-runtime/realtime.js +119 -54
  96. package/dist/entrypoints/agent-runtime/sandbox.js +23 -17
  97. package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -3
  98. package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -3
  99. package/dist/entrypoints/agent-runtime/testing.js +8 -6
  100. package/dist/entrypoints/agent-runtime.js +37 -38
  101. package/dist/entrypoints/application/diagnostic-journal.js +305 -111
  102. package/dist/entrypoints/application/directory-inbox.js +174 -77
  103. package/dist/entrypoints/application/grammy.js +5 -2
  104. package/dist/entrypoints/application/opentelemetry.js +2 -2
  105. package/dist/entrypoints/application.d.ts +2 -2
  106. package/dist/entrypoints/application.d.ts.map +1 -1
  107. package/dist/entrypoints/application.js +17 -8
  108. package/dist/entrypoints/cli/publish.d.ts +16 -0
  109. package/dist/entrypoints/cli/publish.d.ts.map +1 -0
  110. package/dist/entrypoints/cli/publish.js +527 -0
  111. package/dist/entrypoints/cli.d.ts +1 -2
  112. package/dist/entrypoints/cli.d.ts.map +1 -1
  113. package/dist/entrypoints/cli.js +59 -966
  114. package/dist/entrypoints/contract.js +3 -3
  115. package/dist/entrypoints/files/packaging.js +153 -64
  116. package/dist/entrypoints/files.d.ts +1 -0
  117. package/dist/entrypoints/files.d.ts.map +1 -1
  118. package/dist/entrypoints/files.js +17 -10
  119. package/dist/entrypoints/index.d.ts +2 -1
  120. package/dist/entrypoints/index.d.ts.map +1 -1
  121. package/dist/entrypoints/index.js +31 -60
  122. package/dist/entrypoints/node.js +8 -8
  123. package/dist/entrypoints/observability.js +3 -3
  124. package/dist/entrypoints/primitives.js +67 -83
  125. package/dist/entrypoints/process.d.ts +1 -1
  126. package/dist/entrypoints/process.d.ts.map +1 -1
  127. package/dist/entrypoints/process.js +2 -2
  128. package/dist/entrypoints/react.js +4 -2
  129. package/dist/entrypoints/remote.js +37 -13
  130. package/dist/entrypoints/server.js +18 -16
  131. package/dist/entrypoints/telegram/screens.js +5 -3
  132. package/dist/entrypoints/telegram.js +31 -46
  133. package/dist/entrypoints/testing.d.ts +1 -1
  134. package/dist/entrypoints/testing.d.ts.map +1 -1
  135. package/dist/entrypoints/testing.js +444 -448
  136. package/dist/entrypoints/tools/connections.js +268 -105
  137. package/dist/entrypoints/tools/contract.js +2 -2
  138. package/dist/entrypoints/tools/invoker.js +8 -7
  139. package/dist/entrypoints/tools/mcp.d.ts +2 -2
  140. package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
  141. package/dist/entrypoints/tools/mcp.js +10 -9
  142. package/dist/entrypoints/tools.d.ts +0 -1
  143. package/dist/entrypoints/tools.d.ts.map +1 -1
  144. package/dist/entrypoints/tools.js +118 -53
  145. package/dist/entrypoints/tracking.js +2 -3
  146. package/dist/files/boundary.d.ts +2 -2
  147. package/dist/files/boundary.d.ts.map +1 -1
  148. package/dist/files/chunk-spool.d.ts.map +1 -1
  149. package/dist/files/file-io.d.ts +2 -2
  150. package/dist/files/file-io.d.ts.map +1 -1
  151. package/dist/files/native-packaging-layout.d.ts +50 -4
  152. package/dist/files/native-packaging-layout.d.ts.map +1 -1
  153. package/dist/files/native-packaging.d.ts +78 -17
  154. package/dist/files/native-packaging.d.ts.map +1 -1
  155. package/dist/{index-r5hsgkz5.js → index-0gs4ymfj.js} +6 -3
  156. package/dist/{index-zax7resm.js → index-0gxvns6s.js} +1 -13
  157. package/dist/index-0s4xebbg.js +8 -0
  158. package/dist/{index-r4r70zmh.js → index-12zsej7b.js} +5 -2
  159. package/dist/{index-kemm0ej5.js → index-1pwwan01.js} +65 -22
  160. package/dist/{index-vgkbcnkc.js → index-299sm5tr.js} +1 -1
  161. package/dist/{index-2vnh05w4.js → index-2k91mewf.js} +31 -74
  162. package/dist/{index-269zqj8m.js → index-2rc6jd9n.js} +28 -12
  163. package/dist/{index-wh0ecvyk.js → index-37asdw3a.js} +1 -1
  164. package/dist/index-3h0ztg0z.js +285 -0
  165. package/dist/{index-g95fk660.js → index-4vsby8n8.js} +8 -15
  166. package/dist/index-556g5hsh.js +17 -0
  167. package/dist/{index-adhgd4pe.js → index-5p55xreg.js} +2 -2
  168. package/dist/index-5w6t91ze.js +47 -0
  169. package/dist/{index-9pw0a51a.js → index-6yxhe58g.js} +40 -7
  170. package/dist/{index-6d9xaxw1.js → index-8ks9b85e.js} +33 -5
  171. package/dist/{index-bhb950qs.js → index-916yh4e2.js} +25 -12
  172. package/dist/index-9tqbxv5p.js +44 -0
  173. package/dist/{index-5csmzesf.js → index-azx12jgv.js} +4 -3
  174. package/dist/{index-mbnnw3f2.js → index-b0kddvzw.js} +15 -5
  175. package/dist/{index-n5yqxd3d.js → index-b0w7rbpt.js} +23 -2
  176. package/dist/index-b56nnscm.js +132 -0
  177. package/dist/{index-0ndk4555.js → index-c0hffcmj.js} +2 -2
  178. package/dist/{index-pptyv13k.js → index-c17xcx4k.js} +42 -6
  179. package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
  180. package/dist/index-cq59agna.js +51 -0
  181. package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
  182. package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
  183. package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
  184. package/dist/index-eemvahkc.js +21 -0
  185. package/dist/index-ef8gdaq0.js +105 -0
  186. package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
  187. package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
  188. package/dist/{index-f330qqyg.js → index-g2vfg7ak.js} +217 -63
  189. package/dist/{index-fk18k56k.js → index-gr5g3xfw.js} +11 -18
  190. package/dist/{index-jn9g8xdt.js → index-hjvje0pf.js} +6 -4
  191. package/dist/{index-x928baz2.js → index-j9gxbztg.js} +18 -14
  192. package/dist/index-kfjkb396.js +37 -0
  193. package/dist/{index-6drst9sg.js → index-ksfagmyz.js} +45 -345
  194. package/dist/index-m616f0yz.js +120 -0
  195. package/dist/{index-fm1c1a08.js → index-m6w6jtda.js} +40 -21
  196. package/dist/{index-ptn0g0gj.js → index-ma963wz7.js} +21 -20
  197. package/dist/{index-bakgedh8.js → index-msfpyy2f.js} +2 -4
  198. package/dist/{index-ywppsaby.js → index-n1nszyk0.js} +23 -34
  199. package/dist/{index-v14qqmys.js → index-n4689krb.js} +1 -1
  200. package/dist/{index-a0zzh8ak.js → index-pz3y6b6g.js} +3 -3
  201. package/dist/{index-43p08g7t.js → index-pzb63z66.js} +12 -8
  202. package/dist/{index-h97tqqp1.js → index-qaet40b2.js} +5 -3
  203. package/dist/{index-t1sr4aks.js → index-qaqbdm7s.js} +52 -6
  204. package/dist/{index-77nxk6ay.js → index-r393tnfp.js} +16 -10
  205. package/dist/{index-kb8styz3.js → index-rpzewktb.js} +15 -5
  206. package/dist/{index-27a2pj09.js → index-sj28htvf.js} +1 -1
  207. package/dist/index-szybbezc.js +455 -0
  208. package/dist/{index-2hyavjjj.js → index-wbhdzxar.js} +3 -3
  209. package/dist/{index-4e0ah203.js → index-wdy68sh6.js} +47 -24
  210. package/dist/{index-hbd32c6a.js → index-wqmvtnkp.js} +38 -89
  211. package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
  212. package/dist/{index-20yvtn9a.js → index-yt7gyg5x.js} +1 -1
  213. package/dist/{index-cvda079a.js → index-yvfk3y36.js} +12 -2
  214. package/dist/{index-5z6jn897.js → index-z23rfxhj.js} +1 -1
  215. package/dist/internal/abort-race.d.ts +8 -2
  216. package/dist/internal/abort-race.d.ts.map +1 -1
  217. package/dist/internal/atomic-file.d.ts +55 -9
  218. package/dist/internal/atomic-file.d.ts.map +1 -1
  219. package/dist/internal/atomic-publication.d.ts +39 -4
  220. package/dist/internal/atomic-publication.d.ts.map +1 -1
  221. package/dist/internal/atomic-staging.d.ts +46 -0
  222. package/dist/internal/atomic-staging.d.ts.map +1 -0
  223. package/dist/internal/bounded-file-read.d.ts +19 -11
  224. package/dist/internal/bounded-file-read.d.ts.map +1 -1
  225. package/dist/internal/bounded-lines.d.ts.map +1 -1
  226. package/dist/internal/close-after.d.ts +11 -0
  227. package/dist/internal/close-after.d.ts.map +1 -0
  228. package/dist/internal/deadline.d.ts +10 -0
  229. package/dist/internal/deadline.d.ts.map +1 -1
  230. package/dist/internal/exclusive-lock-read.d.ts +10 -12
  231. package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
  232. package/dist/internal/exclusive-lock.d.ts +2 -2
  233. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  234. package/dist/internal/file-observation.d.ts +14 -0
  235. package/dist/internal/file-observation.d.ts.map +1 -0
  236. package/dist/internal/json-data.d.ts +22 -5
  237. package/dist/internal/json-data.d.ts.map +1 -1
  238. package/dist/internal/positive-integer.d.ts +9 -0
  239. package/dist/internal/positive-integer.d.ts.map +1 -0
  240. package/dist/internal/process-instance.d.ts +35 -5
  241. package/dist/internal/process-instance.d.ts.map +1 -1
  242. package/dist/internal/secure-fetch.d.ts.map +1 -1
  243. package/dist/internal/timers.d.ts +11 -0
  244. package/dist/internal/timers.d.ts.map +1 -0
  245. package/dist/internal/with-exclusive-lock.d.ts +5 -4
  246. package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
  247. package/dist/observability/bounded-sink.d.ts.map +1 -1
  248. package/dist/primitives/canonical-json.d.ts +23 -2
  249. package/dist/primitives/canonical-json.d.ts.map +1 -1
  250. package/dist/primitives/delivery.d.ts.map +1 -1
  251. package/dist/primitives/index.d.ts +1 -1
  252. package/dist/primitives/index.d.ts.map +1 -1
  253. package/dist/primitives/money.d.ts.map +1 -1
  254. package/dist/process/cleanup.d.ts +6 -1
  255. package/dist/process/cleanup.d.ts.map +1 -1
  256. package/dist/process/command-lifetime.d.ts +4 -0
  257. package/dist/process/command-lifetime.d.ts.map +1 -1
  258. package/dist/process/command-owner.d.ts.map +1 -1
  259. package/dist/process/command.d.ts +4 -0
  260. package/dist/process/command.d.ts.map +1 -1
  261. package/dist/process/contract.d.ts +67 -2
  262. package/dist/process/contract.d.ts.map +1 -1
  263. package/dist/process/group.d.ts +40 -3
  264. package/dist/process/group.d.ts.map +1 -1
  265. package/dist/process/launch.d.ts +12 -1
  266. package/dist/process/launch.d.ts.map +1 -1
  267. package/dist/process/terminate.d.ts +39 -0
  268. package/dist/process/terminate.d.ts.map +1 -0
  269. package/dist/react/query-client.d.ts.map +1 -1
  270. package/dist/realtime/rejection.d.ts.map +1 -1
  271. package/dist/server/contract-stream.d.ts.map +1 -1
  272. package/dist/server/handler-state.d.ts.map +1 -1
  273. package/dist/server/implement.d.ts.map +1 -1
  274. package/dist/server/request-body.d.ts +0 -1
  275. package/dist/server/request-body.d.ts.map +1 -1
  276. package/dist/server/unix-client.d.ts.map +1 -1
  277. package/dist/telegram/broadcast-delivery.d.ts.map +1 -1
  278. package/dist/telegram/broadcast-failure.d.ts +10 -2
  279. package/dist/telegram/broadcast-failure.d.ts.map +1 -1
  280. package/dist/telegram/operator-channel.d.ts.map +1 -1
  281. package/dist/telegram/screens/outcome.d.ts.map +1 -1
  282. package/dist/testing/surface-conformance.d.ts +1 -1
  283. package/dist/testing/surface-conformance.d.ts.map +1 -1
  284. package/dist/testing/surface-manifest.d.ts +0 -6
  285. package/dist/testing/surface-manifest.d.ts.map +1 -1
  286. package/dist/tools/agent.d.ts +1 -1
  287. package/dist/tools/agent.d.ts.map +1 -1
  288. package/dist/tools/cli/args.d.ts +1 -1
  289. package/dist/tools/cli/args.d.ts.map +1 -1
  290. package/dist/tools/cli/help.d.ts.map +1 -1
  291. package/dist/tools/cli/invoke.d.ts +2 -2
  292. package/dist/tools/cli/invoke.d.ts.map +1 -1
  293. package/dist/tools/cli/profile.d.ts.map +1 -1
  294. package/dist/tools/cli/publication-assets.d.ts.map +1 -1
  295. package/dist/tools/cli/publication-contract.d.ts +8 -0
  296. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  297. package/dist/tools/cli/publication-control.d.ts.map +1 -1
  298. package/dist/tools/cli/publication-storage.d.ts +23 -2
  299. package/dist/tools/cli/publication-storage.d.ts.map +1 -1
  300. package/dist/tools/cli/publication.d.ts +8 -1
  301. package/dist/tools/cli/publication.d.ts.map +1 -1
  302. package/dist/tools/connections/errors.d.ts +18 -6
  303. package/dist/tools/connections/errors.d.ts.map +1 -1
  304. package/dist/tools/connections/limits.d.ts +8 -2
  305. package/dist/tools/connections/limits.d.ts.map +1 -1
  306. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  307. package/dist/tools/connections/mcp-envelope.d.ts.map +1 -1
  308. package/dist/tools/connections/openapi.d.ts.map +1 -1
  309. package/dist/tools/connections/schema-budget.d.ts +1 -1
  310. package/dist/tools/connections/schema-budget.d.ts.map +1 -1
  311. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  312. package/dist/tools/execute-args.d.ts.map +1 -1
  313. package/dist/tools/execute-result.d.ts.map +1 -1
  314. package/dist/tools/internal/surface-projector.d.ts +17 -3
  315. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  316. package/dist/tools/internal/tool-error-projection.d.ts +16 -0
  317. package/dist/tools/internal/tool-error-projection.d.ts.map +1 -0
  318. package/dist/tools/internal/tool-view.d.ts.map +1 -1
  319. package/dist/tools/invoker.d.ts.map +1 -1
  320. package/dist/tools/list-names.d.ts +3 -2
  321. package/dist/tools/list-names.d.ts.map +1 -1
  322. package/dist/tools/manifest.d.ts +3 -2
  323. package/dist/tools/manifest.d.ts.map +1 -1
  324. package/dist/tools/mcp/handler.d.ts +7 -0
  325. package/dist/tools/mcp/handler.d.ts.map +1 -1
  326. package/dist/tools/mcp/mount.d.ts +18 -2
  327. package/dist/tools/mcp/mount.d.ts.map +1 -1
  328. package/dist/tools/mcp/prepare.d.ts +3 -3
  329. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  330. package/dist/tools/mcp/register.d.ts.map +1 -1
  331. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  332. package/dist/tools/mcp/stdio-signals.d.ts +14 -0
  333. package/dist/tools/mcp/stdio-signals.d.ts.map +1 -1
  334. package/dist/tools/mcp/stdio.d.ts +7 -0
  335. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  336. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  337. package/dist/tools/operations/async-operation-runtime-types.d.ts +3 -3
  338. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  339. package/dist/tools/operations/define-wait-tool.d.ts +1 -1
  340. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
  341. package/dist/tools/operations/wait-core.d.ts +0 -6
  342. package/dist/tools/operations/wait-core.d.ts.map +1 -1
  343. package/dist/tools/registry.d.ts +1 -1
  344. package/dist/tools/registry.d.ts.map +1 -1
  345. package/dist/tools/remote.d.ts +1 -1
  346. package/dist/tools/remote.d.ts.map +1 -1
  347. package/dist/tools/{runtime-tool-execution.d.ts → runtime-tool-declaration.d.ts} +32 -9
  348. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -0
  349. package/dist/tools/runtime-tool-mcp.d.ts +6 -15
  350. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -1
  351. package/dist/tools/runtime-tool.d.ts +14 -12
  352. package/dist/tools/runtime-tool.d.ts.map +1 -1
  353. package/dist/tools/schema/coerce.d.ts +4 -0
  354. package/dist/tools/schema/coerce.d.ts.map +1 -1
  355. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  356. package/dist/tools/surface.d.ts +7 -11
  357. package/dist/tools/surface.d.ts.map +1 -1
  358. package/dist/tools/transfer/define-download-tool.d.ts +1 -1
  359. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
  360. package/dist/tools/transfer/define-upload-tool.d.ts +1 -1
  361. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
  362. package/dist/tools/transfer/define-view-file-tool.d.ts +1 -1
  363. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
  364. package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
  365. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
  366. package/dist/tools/transfer/view-file.d.ts +1 -1
  367. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  368. package/dist/tools/transports.d.ts +3 -2
  369. package/dist/tools/transports.d.ts.map +1 -1
  370. package/llms/agent-runtime-browser.txt +10 -4
  371. package/llms/agent-runtime-harness.txt +32 -31
  372. package/llms/agent-runtime-react.txt +1 -1
  373. package/llms/agent-runtime-realtime.txt +14 -5
  374. package/llms/agent-runtime-sandbox.txt +3 -11
  375. package/llms/agent-runtime.3.txt +2 -2
  376. package/llms/agent-runtime.txt +0 -9
  377. package/llms/application.2.txt +3 -12
  378. package/llms/application.3.txt +7 -4
  379. package/llms/application.txt +44 -15
  380. package/llms/cli-publish.txt +29 -0
  381. package/llms/cli.2.txt +9 -11
  382. package/llms/cli.txt +26 -14
  383. package/llms/declaration.txt +0 -9
  384. package/llms/files-packaging.txt +16 -8
  385. package/llms/files.txt +4 -2
  386. package/llms/geo.txt +0 -9
  387. package/llms/live.txt +4 -13
  388. package/llms/observability.txt +31 -5
  389. package/llms/primitives.txt +38 -20
  390. package/llms/process.txt +287 -157
  391. package/llms/react-keyboard.txt +0 -9
  392. package/llms/react.txt +0 -18
  393. package/llms/server.4.txt +1 -1
  394. package/llms/server.5.txt +1 -1
  395. package/llms/server.txt +1 -1
  396. package/llms/stitchkit.txt +6 -7
  397. package/llms/telegram-screens.txt +2 -2
  398. package/llms/testing.txt +0 -1
  399. package/llms/tools-mcp.txt +2 -3
  400. package/llms/tools.2.txt +12 -0
  401. package/llms/tools.3.txt +5 -6
  402. package/llms/tools.txt +6 -4
  403. package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
  404. package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.53.0-0.67.0.txt} +576 -506
  405. package/llms/{upgrading-0.62.0-0.80.0.txt → upgrading-0.68.0-0.94.0.txt} +562 -576
  406. package/llms/{upgrading-0.81.0-0.104.0.txt → upgrading-0.95.0-0.105.0.txt} +452 -567
  407. package/llms/upgrading.txt +4 -4
  408. package/llms-full.txt +1029 -409
  409. package/llms.txt +24 -24
  410. package/native-assets.json +11 -3
  411. package/package.json +6 -6
  412. package/dist/agent-runtime/harness-tools.d.ts +0 -11
  413. package/dist/agent-runtime/harness-tools.d.ts.map +0 -1
  414. package/dist/entrypoints/agent-runtime/harness-tools.d.ts +0 -2
  415. package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +0 -1
  416. package/dist/entrypoints/agent-runtime/harness-tools.js +0 -32
  417. package/dist/index-1a6jtnd9.js +0 -88
  418. package/dist/index-8a9ksm91.js +0 -95
  419. package/dist/index-a3wma1hk.js +0 -48
  420. package/dist/index-jd470k6q.js +0 -109
  421. package/dist/index-n1dqr7gf.js +0 -20
  422. package/dist/index-nggfa2yn.js +0 -34
  423. package/dist/index-s4evrmp5.js +0 -98
  424. package/dist/index-ze1eph1k.js +0 -20
  425. package/dist/tools/connections/error-projection.d.ts +0 -4
  426. package/dist/tools/connections/error-projection.d.ts.map +0 -1
  427. package/dist/tools/runtime-tool-execution.d.ts.map +0 -1
  428. package/llms/agent-runtime-harness-tools.txt +0 -25
  429. package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
@@ -1,98 +0,0 @@
1
- import {
2
- publishAtomicFile,
3
- publishAtomicFileSync
4
- } from "./index-8a9ksm91.js";
5
-
6
- // src/internal/atomic-file.ts
7
- import { randomBytes } from "node:crypto";
8
- import { closeSync, fchmodSync, fsyncSync, openSync, unlinkSync, writeSync } from "node:fs";
9
- import { open, unlink } from "node:fs/promises";
10
- import { basename, dirname, join } from "node:path";
11
- var DEFAULT_MODE = 384;
12
- function stagingPath(target) {
13
- return join(dirname(target), `.${basename(target)}.${randomBytes(12).toString("hex")}.tmp`);
14
- }
15
- function bytesOf(data) {
16
- return typeof data === "string" ? new TextEncoder().encode(data) : data;
17
- }
18
- async function writeFileAtomic2(target, data, options = {}) {
19
- return writeAtomicFileData(target, data, options);
20
- }
21
- async function writeAtomicFileData(target, data, options, io = { open, unlink, publish: publishAtomicFile }) {
22
- const mode = options.mode ?? DEFAULT_MODE;
23
- const staged = stagingPath(target);
24
- const handle = await io.open(staged, "wx", mode);
25
- try {
26
- let failed = false;
27
- let failure;
28
- try {
29
- await handle.writeFile(bytesOf(data));
30
- await handle.chmod(mode);
31
- if (options.durability !== "none")
32
- await handle.sync();
33
- } catch (error) {
34
- failed = true;
35
- failure = error;
36
- } finally {
37
- try {
38
- await handle.close();
39
- } catch (error) {
40
- if (!failed) {
41
- failed = true;
42
- failure = error;
43
- }
44
- }
45
- }
46
- if (failed)
47
- throw failure;
48
- await io.publish(staged, target, options.replace ?? true, options.durability === "directory");
49
- } catch (error) {
50
- await io.unlink(staged).catch(() => {
51
- return;
52
- });
53
- throw error;
54
- }
55
- }
56
- function writeFileAtomicSync2(target, data, options = {}) {
57
- const mode = options.mode ?? DEFAULT_MODE;
58
- const bytes = bytesOf(data);
59
- const staged = stagingPath(target);
60
- const handle = openSync(staged, "wx", mode);
61
- try {
62
- let failed = false;
63
- let failure;
64
- try {
65
- for (let offset = 0;offset < bytes.byteLength; ) {
66
- const written = writeSync(handle, bytes, offset, bytes.byteLength - offset);
67
- if (written === 0)
68
- throw new Error("zero-byte atomic-file write");
69
- offset += written;
70
- }
71
- fchmodSync(handle, mode);
72
- if (options.durability !== "none")
73
- fsyncSync(handle);
74
- } catch (error) {
75
- failed = true;
76
- failure = error;
77
- } finally {
78
- try {
79
- closeSync(handle);
80
- } catch (error) {
81
- if (!failed) {
82
- failed = true;
83
- failure = error;
84
- }
85
- }
86
- }
87
- if (failed)
88
- throw failure;
89
- publishAtomicFileSync(staged, target, options.replace ?? true, options.durability === "directory");
90
- } catch (error) {
91
- try {
92
- unlinkSync(staged);
93
- } catch {}
94
- throw error;
95
- }
96
- }
97
-
98
- export { writeFileAtomic2, writeAtomicFileData, writeFileAtomicSync2 };
@@ -1,20 +0,0 @@
1
- // src/tools/lifecycle.ts
2
- function composeToolLifecycle2(...hooks) {
3
- return {
4
- beforeHandle: async (ctx, endpoint) => {
5
- for (const hook of hooks)
6
- await hook?.beforeHandle?.(ctx, endpoint);
7
- },
8
- afterHandle: async (ctx, result, endpoint) => {
9
- let current = result;
10
- for (const hook of hooks) {
11
- const transformed = await hook?.afterHandle?.(ctx, current, endpoint);
12
- if (transformed !== undefined)
13
- current = transformed;
14
- }
15
- return current;
16
- }
17
- };
18
- }
19
-
20
- export { composeToolLifecycle2 };
@@ -1,4 +0,0 @@
1
- import { AppError } from '../../contract/errors.js';
2
- /** Only fixed diagnostic fields cross the tool boundary; the runner retains the raw cause. */
3
- export declare function connectionToolError(error: unknown): AppError | undefined;
4
- //# sourceMappingURL=error-projection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-projection.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/error-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0C,MAAM,uBAAuB,CAAC;AAUzF,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CA0GxE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-tool-execution.d.ts","sourceRoot":"","sources":["../../src/tools/runtime-tool-execution.ts"],"names":[],"mappings":"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"}
@@ -1,25 +0,0 @@
1
- # stitchkit/agent-runtime/harness-tools — stitchkit docs slice
2
-
3
- > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
- > `llms.txt` in this package.
5
-
6
- Contains: API reference: `stitchkit/agent-runtime/harness-tools` (docs/api/reference.md)
7
-
8
- Also read:
9
- - see `llms/agent-runtime.txt` for the Agent application runtime guide
10
- - see `llms/agent-runtime-harness.txt` for the Agent composition guide
11
-
12
- ==============================================================================
13
- # API reference: `stitchkit/agent-runtime/harness-tools` (docs/api/reference.md)
14
- ==============================================================================
15
-
16
- ## `stitchkit/agent-runtime/harness-tools`
17
-
18
- Optional evolving composition of the full `mountAgent` configuration with the runtime
19
- fence. Its runtime peer is `ai`; its full tool presenter declarations also require
20
- `@modelcontextprotocol/server`, as `stitchkit/tools` does. The base harness retains its
21
- AI-only peer boundary. Existing custom tool callbacks need no new import.
22
-
23
- | Export | Kind | Summary |
24
- |--------|------|---------|
25
- | `createAgentHarnessTools` / `AgentHarnessToolsConfig` | function / _type_ | async per-run full mount configuration (`services` plus all `AgentMountConfig` options); composes application lifecycle then runtime fence exactly once |
@@ -1,444 +0,0 @@
1
- # Upgrading 0.37.0 → 0.44.0 — stitchkit docs slice
2
-
3
- > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
- > `llms.txt` in this package.
5
-
6
- Contains: Guide: Upgrading, 0.37.0 → 0.44.0 (docs/guide/upgrading.md)
7
-
8
- ==============================================================================
9
- # Guide: Upgrading, 0.37.0 → 0.44.0 (docs/guide/upgrading.md)
10
- ==============================================================================
11
-
12
- ## Historical breaking migrations through 0.44.0
13
-
14
- HTTP observability now completes inside the framework handler instead of a
15
- nested fetch wrapper. Configure request and tool sinks explicitly:
16
-
17
- ```ts
18
- // before
19
- const audit = createAuditHook({ write })
20
- createServer({
21
- services,
22
- wrapFetch: (handler) => wrapInRequestContext(audit.http(handler)),
23
- })
24
- mountAgent(services, { hooks: audit.toolCall })
25
-
26
- // after
27
- const observability = createObservability({
28
- request: { write, includePayload: true },
29
- tools: { write },
30
- })
31
- createServer({ services, observability: observability.request })
32
- mountAgent(services, { hooks: observability.toolCall })
33
- ```
34
-
35
- Body capture changed from always-on for body methods to opt-in. Set
36
- `includePayload: true` only when the request sink needs the sanitized JSON body.
37
- There is no `createAuditHook` or `audit.http` compatibility path;
38
- `wrapInRequestContext` remains only for custom fetch pipelines.
39
-
40
- Tool introspection now accepts one object-shaped contract/runtime surface. Stop
41
- calling the internal contract collector or merging a locally converted runtime
42
- manifest:
43
-
44
- ```ts
45
- // before
46
- buildToolManifest(services.flatMap((service) => collectTools(service, 'AGENT')))
47
- listToolNames(services)
48
- summarizeTransports(services)
49
-
50
- // after
51
- const surface = { services, runtimeTools }
52
- buildToolManifest({ ...surface, transport: 'AGENT' })
53
- listToolNames(surface)
54
- summarizeTransports(surface)
55
- ```
56
-
57
- `ToolNameEntry` adds `kind: 'contract' | 'runtime'`. `TransportSummary` is now
58
- `{ contractServices, runtimeTools, totals, sources }`; replace `services` and
59
- `perService` reads with the explicit counts and mixed-source breakdown. There
60
- is no positional overload and no `buildRuntimeToolManifest`: Stitchkit owns the
61
- combined order, transport filtering, canonical presentation schema and
62
- cross-origin collision checks.
63
-
64
- `defineErrors` now uses one Zod-first definition object and returns constructors
65
- instead of positional throwers. Add explicit `throw`, move message/details/hint
66
- into one options object, and declare a details schema when that code carries
67
- structured context:
68
-
69
- ```ts
70
- // before
71
- const { errors } = defineErrors({ QUOTA_EXCEEDED: 429 })
72
- errors.QUOTA_EXCEEDED('Try later', { retryAfterSeconds: 30 }, 'Wait')
73
-
74
- // after
75
- const { errors, definitions } = defineErrors({
76
- QUOTA_EXCEEDED: {
77
- status: 429,
78
- details: z.object({ retryAfterSeconds: z.number().positive() }),
79
- },
80
- })
81
- throw errors.QUOTA_EXCEEDED({
82
- message: 'Try later',
83
- details: { retryAfterSeconds: 30 },
84
- hint: 'Wait',
85
- })
86
- ```
87
-
88
- There is no positional overload. A code without `details` forbids them; use an
89
- optional object schema when the details object itself is optional. Read status
90
- and schemas from the frozen `definitions` registry instead of maintaining a
91
- parallel map.
92
-
93
- Managed MCP runtime tools are now declared as immutable data. Move protected
94
- registrar calls to `runtimeTools`; rename deliberate raw SDK registration to
95
- `rawTools`. There is no registrar alias:
96
-
97
- ```ts
98
- // before — protected
99
- createMcpHandler({
100
- services,
101
- nativeTools: ({ registerTool }) => registerTool(preview),
102
- })
103
-
104
- // after — protected and prepared with the rest of the surface
105
- createMcpHandler({ services, runtimeTools: [preview] })
106
-
107
- // before — deliberate raw SDK opt-out
108
- nativeTools: ({ rawServer }, auth) => mountRaw(rawServer, auth)
109
-
110
- // after — still a deliberate raw SDK opt-out
111
- rawTools: (server, auth) => mountRaw(server, auth)
112
- ```
113
-
114
- When identity selects from a bounded set, replace a repeatedly prepared
115
- `services(auth)` factory with a finite registry:
116
-
117
- ```ts
118
- createMcpHandler({
119
- surfaces: {
120
- admin: { services: allServices, runtimeTools: [preview] },
121
- member: { services: memberServices, runtimeTools: [preview] },
122
- },
123
- selectSurface: (auth) => auth.isAdmin ? 'admin' : 'member',
124
- })
125
- ```
126
-
127
- Keep direct `services(auth)` / `runtimeTools(auth)` only for genuinely
128
- unbounded definitions; Stitchkit intentionally does not cache arbitrary auth
129
- values.
130
-
131
- Contract success bodies are now determined by the presence of `output`, not by
132
- the handler's runtime value. A nullable output returns JSON `null` with status
133
- `200`; `undefined` with a declared output and non-null data without an output
134
- schema are contract violations:
135
-
136
- ```ts
137
- // nullable JSON data: 200 with body `null`
138
- session: {
139
- method: 'GET', path: '/session', desc: 'Current session',
140
- output: SessionSchema.nullable(),
141
- }
142
-
143
- // bodyless operation: 204 with no body
144
- logout: {
145
- method: 'POST', path: '/logout', desc: 'End the session',
146
- }
147
- ```
148
-
149
- Add an output schema to every handler that returns data. Omit `output` and
150
- return nothing for bodyless operations; runtime tools follow the same rule and
151
- type no-output handlers as `void`.
152
-
153
- `createToolInvoker` now separates immutable registry preparation from per-call
154
- runtime state. Move source/context/lifecycle/hooks/output-strip reporting from
155
- the factory config to the third invocation argument. Use `invokeOrThrow` when a
156
- nested operation should preserve the normalized `AppError` instead of returning
157
- a model-facing failure envelope:
158
-
159
- ```ts
160
- // before
161
- const invoker = createToolInvoker(services, {
162
- transport: 'AGENT', context: { identity }, lifecycle, hooks,
163
- })
164
- const result = await invoker.invoke(name, args)
165
-
166
- // after
167
- const invoker = createToolInvoker(services, { transport: 'AGENT' })
168
- const result = await invoker.invoke(name, args, {
169
- context: { identity }, lifecycle, hooks,
170
- })
171
- const data = await invoker.invokeOrThrow(name, args, {
172
- context: { identity }, lifecycle, hooks,
173
- })
174
- ```
175
-
176
- There is no static runtime-config overload: request identity must not be retained
177
- by a reusable compiled registry.
178
-
179
- Entity cache handlers now require the cached list shape and CRUD policies. Move
180
- `listKey` under `list`, make detail keys event-aware, and state the list-item
181
- identity/projection explicitly:
182
-
183
- ```ts
184
- // before
185
- createEntityCacheHandlers<Entity>({
186
- getId,
187
- listKey: ['entities'],
188
- detailKey: (id) => ['entities', id],
189
- })
190
-
191
- // after
192
- createEntityCacheHandlers<Entity, EntityListItem>({
193
- getId,
194
- getListItemId: (item) => item.id,
195
- toListItem: (entity) => ({ id: entity.id, name: entity.name }),
196
- list: {
197
- key: ['entities'],
198
- shape: 'paginated',
199
- createAt: 'start',
200
- updateMissing: 'skip',
201
- },
202
- detailKey: (event) => ['entities', event.id],
203
- })
204
- ```
205
-
206
- Choose `array`, `paginated`, `infinite-array` or `infinite-paginated` to match
207
- the actual cached data. A dynamic `list.key` / `detailKey` receives a
208
- discriminated event and can derive scoped keys from the created/updated entity
209
- or deleted payload. Add `compare` only when the backend has a canonical order;
210
- the framework does not guess it or mutate pagination metadata.
211
-
212
- Protected native MCP operations now use the transport-neutral runtime tool
213
- definition. Return the schema-owned value from the handler and move MCP content
214
- or metadata into `present.mcp`; `structuredContent` and `isError` are
215
- framework-owned:
216
-
217
- ```ts
218
- // before
219
- registerTool({ input, output, handler: async () => ({
220
- content: [{ type: 'image', data, mimeType: 'image/png' }],
221
- structuredContent: { assetId },
222
- }) })
223
-
224
- // after
225
- const preview = defineRuntimeTool({
226
- name: 'render_preview', description, identity, input, output,
227
- handler: async () => ({ assetId, data }),
228
- present: {
229
- mcp: (result) => ({
230
- content: [{ type: 'image', data: result.data, mimeType: 'image/png' }],
231
- }),
232
- },
233
- })
234
- runtimeTools: [preview]
235
- ```
236
-
237
- The removed `NativeMcp*` types have no aliases. Use `RuntimeToolDefinition`,
238
- `RuntimeToolIdentity`, `RuntimeToolHandlerContext` and
239
- `RuntimeMcpPresentation`. The same definition can now be passed to
240
- `mountAgent(services, { runtimeTools: [preview] })`; add `present.agent` only
241
- when the model needs rich text/file content instead of the neutral JSON result.
242
-
243
- Trailing wildcards must be named consistently across the path and params schema:
244
-
245
- ```ts
246
- // before
247
- path: '/app/:slug/*'
248
- params: z.object({ slug: z.string(), '*': z.string() })
249
- ctx.params['*']
250
- api.app({ slug: 'foo', '*': 'a/b' })
251
-
252
- // after
253
- path: '/app/:slug/*filePath'
254
- params: z.object({ slug: z.string(), filePath: z.string() })
255
- ctx.params.filePath
256
- api.app({ slug: 'foo', filePath: 'a/b' })
257
- ```
258
-
259
- Bare wildcards have no compatibility alias; raw routes use the same named form.
260
-
261
- ### Expected-401 matchers
262
-
263
- `HttpClientConfig.authEndpoints` is removed. Replace manual path prefixes with
264
- the operations whose 401 response is expected:
265
-
266
- ```ts
267
- // before
268
- createHttpClient({ baseUrl, authEndpoints: ['/api/auth/'] })
269
-
270
- // after
271
- createHttpClient({
272
- baseUrl,
273
- suppressUnauthorizedFor: contractEndpointMatchers(authContract, ['login', 'verify']),
274
- })
275
- ```
276
-
277
- There is no implicit `/auth/` suppression. Omit `suppressUnauthorizedFor` when
278
- every 401 should emit the global `unauthorized` event.
279
-
280
- ## The 0.37 migration
281
-
282
- Tool presentation is no longer an executable Zod parser. Replace the removed
283
- flatten helpers with the JSON Schema compiler, and choose the explicit
284
- `MountableTool` surface when using the advanced collection API:
285
-
286
- ```ts
287
- // before
288
- const flat = flattenUnionsDeep(zodSchema)
289
- mountable.schema
290
-
291
- // after
292
- const flat = flattenToolJsonSchema(
293
- z.toJSONSchema(zodSchema, { target: 'draft-07', io: 'input' }),
294
- )
295
- mountable.presentationSchema // model/MCP/manifest JSON Schema
296
- mountable.argumentSchema // executable CLI argument adapter only
297
- ```
298
-
299
- Contract and native handlers keep their original Zod schemas; MCP and agent SDK
300
- adapters now forward raw arguments so defaults, coercions, refinements and
301
- transforms execute exactly once inside Stitchkit. There are no compatibility
302
- exports for `flattenDiscriminatedUnion`, `flattenUnionsDeep` or
303
- `MountableTool.schema`. → ADR 0050
304
-
305
- Tool-call hooks now take one options object. Migrate all three callbacks; there
306
- are no positional overloads:
307
-
308
- ```ts
309
- // before
310
- beforeToolCall: (toolName, args, context, endpoint) => {}
311
- afterToolCall: (toolName, args, result, durationMs, context, endpoint, error) => {}
312
- onToolError: (toolName, error, context, endpoint) => {}
313
-
314
- // after
315
- beforeToolCall: ({ toolName, args, context, endpoint }) => {}
316
- afterToolCall: ({ toolName, args, result, durationMs, context, endpoint, error }) => {}
317
- onToolError: ({ toolName, error, context, endpoint }) => {}
318
- ```
319
-
320
- ### MCP schema validation
321
-
322
- The standalone validator now takes one object and live MCP configs carry the
323
- same rules under `schemaValidation`. Migrate every positional call and every
324
- `onIncompatibleSchema` field; there is no old-shape overload:
325
-
326
- ```ts
327
- // before
328
- validateMcpSchemas(services, 'throw', logger, { requireTypedProperties: true })
329
- createMcpHandler({ services, onIncompatibleSchema: 'throw' })
330
-
331
- // after
332
- validateMcpSchemas({ services, policy: 'throw', logger, requireTypedProperties: true })
333
- createMcpHandler({ services, schemaValidation: { policy: 'throw' } })
334
- ```
335
-
336
- Put `extend` and `flattenUnionInput` beside `services`, not inside
337
- `schemaValidation`. The handler applies the profile to the exact prepared schema
338
- it advertises. Add `requirePortableFormats: true` when every custom JSON Schema
339
- format must be rejected before a client sees it.
340
-
341
- Native MCP registration also changed shape in 0.37. Move protected tools to the
342
- framework registrar; keep an SDK-raw tool only by naming the opt-out:
343
-
344
- ```ts
345
- // before
346
- nativeTools: (server, auth) => server.registerTool(name, config, handler)
347
-
348
- // after — lifecycle, hooks and schema policy apply
349
- nativeTools: ({ registerTool }, auth) => registerTool({
350
- name, description, identity, input, output, handler,
351
- })
352
-
353
- // after — intentionally raw
354
- nativeTools: ({ rawServer }, auth) => rawServer.registerTool(name, config, handler)
355
- ```
356
-
357
- If a tool hook annotated `endpoint` as `MethodDef`, remove that annotation or
358
- use `OperationIdentity`: native operations have service/action/scope/method but
359
- no HTTP path.
360
-
361
- ### Node-facing server types
362
-
363
- `stitchkit/server` remains Bun-concrete: an explicitly annotated `RawRoute`
364
- still receives `BunServer`. `stitchkit/node` no longer drags Bun declarations
365
- into a Node project. Its raw routes default the host server to `unknown`, and
366
- its Socket.IO handle exposes only Node capabilities:
367
-
368
- ```ts
369
- // before — Node entry still leaked Bun-only fields and ambient types
370
- const route: RawRoute = { handler: (_req, ctx) => ctx.server?.upgrade(...) }
371
- const socket = await createSocketIOServer(config)
372
- socket.websocket
373
-
374
- // after — name a custom embedding host only when one exists
375
- const route: RawRoute<MyHostServer> = {
376
- handler: (_req, ctx) => useHost(ctx.server),
377
- }
378
- const socket = await createSocketIOServer(config)
379
- socket.io
380
- socket.attach(nodeHttpServer)
381
- ```
382
-
383
- Node consumers can remove `@types/bun` unless another dependency independently
384
- requires it.
385
-
386
- ### Managed server shutdown
387
-
388
- `createServer()` and `serveNode()` now return the same structural managed
389
- lifecycle. Replace every direct runtime stop and parallel Socket.IO close:
390
-
391
- ```ts
392
- // before — split ownership
393
- const socket = await createSocketIOServer(config)
394
- const server = createServer({
395
- services,
396
- websocket: socket.websocket,
397
- rawRoutes: [socket.route],
398
- })
399
- server.stop()
400
- await socket.io.close()
401
-
402
- // after — one owner and one total deadline
403
- const socket = await createSocketIOServer(config)
404
- const server = createServer({ services, socket })
405
- const result = await server.shutdown({ gracePeriodMs: 30_000 })
406
- ```
407
-
408
- On Node, keep the same `socket` field and replace `handle.close()` with
409
- `handle.shutdown()`. Runtime-specific diagnostics move under `handle.runtime`;
410
- do not use it as a second shutdown path. Standalone CLI/tools that create a
411
- Socket.IO handle without an HTTP server call `await socket.close()`.
412
-
413
- If Bun Socket.IO shares the port with a raw lane, keep the explicit composition
414
- but let the server mount the Socket.IO route:
415
-
416
- ```ts
417
- createServer({
418
- services,
419
- socket,
420
- websocket: composeWebSocketHandlers([
421
- webSocketLane({ match: isRaw, handlers: rawHandlers }),
422
- socketIoLane(socket.websocket),
423
- ]),
424
- rawRoutes: [rawUpgradeRoute],
425
- })
426
- ```
427
-
428
- Move native Bun `routes` entries to `rawRoutes`. Native routes run before the
429
- Fetch handler and therefore cannot participate in admission or drain. Wire
430
- `SIGTERM`/`SIGINT` in the application; the first signal starts `shutdown()`, and
431
- a later signal may abort the same controller. Close MCP, databases and queues
432
- after the server result—those resources remain application-owned.
433
-
434
- Move a handshake policy from the Node-only callback shape inside
435
- `serverOptions` to the runtime-neutral top-level policy. It receives a Web
436
- `Request`, may be async, and returns whether to admit the handshake:
437
-
438
- ```ts
439
- // before
440
- serverOptions: { allowRequest: (request, done) => done(null, allowed(request)) }
441
-
442
- // after
443
- allowRequest: (request) => allowed(request)
444
- ```