stitchkit 0.94.0 → 0.95.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 (360) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  3. package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
  4. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  5. package/dist/agent-runtime/contained-darwin.d.ts +38 -0
  6. package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
  7. package/dist/agent-runtime/contained-files.d.ts +11 -26
  8. package/dist/agent-runtime/contained-files.d.ts.map +1 -1
  9. package/dist/agent-runtime/contained-scan.d.ts +21 -0
  10. package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
  11. package/dist/agent-runtime/contained-write.d.ts +9 -0
  12. package/dist/agent-runtime/contained-write.d.ts.map +1 -0
  13. package/dist/agent-runtime/deferred-tool-types.d.ts +3 -2
  14. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  15. package/dist/agent-runtime/harness-control.d.ts +0 -1
  16. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  17. package/dist/agent-runtime/harness.d.ts +0 -5
  18. package/dist/agent-runtime/harness.d.ts.map +1 -1
  19. package/dist/agent-runtime/managed-tools.d.ts +3 -2
  20. package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
  21. package/dist/agent-runtime/provider-origin.d.ts +7 -0
  22. package/dist/agent-runtime/provider-origin.d.ts.map +1 -1
  23. package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
  24. package/dist/agent-runtime/runtime.d.ts +1 -1
  25. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  26. package/dist/agent-runtime/schedule-records.d.ts +34 -0
  27. package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
  28. package/dist/agent-runtime/schedules.d.ts +34 -0
  29. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  30. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
  31. package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
  32. package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
  33. package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
  34. package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
  35. package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
  36. package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
  37. package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
  38. package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
  39. package/dist/application/admission-rate.d.ts +21 -0
  40. package/dist/application/admission-rate.d.ts.map +1 -0
  41. package/dist/application/admission-run.d.ts +8 -0
  42. package/dist/application/admission-run.d.ts.map +1 -0
  43. package/dist/application/admission.d.ts.map +1 -1
  44. package/dist/application/diagnostic-journal-lock.d.ts +9 -34
  45. package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
  46. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  47. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  48. package/dist/application/kernel-resource-context.d.ts.map +1 -1
  49. package/dist/application/notification-outbox.d.ts.map +1 -1
  50. package/dist/application/process-lifecycle-transitions.d.ts +175 -0
  51. package/dist/application/process-lifecycle-transitions.d.ts.map +1 -0
  52. package/dist/application/process-lifecycle.d.ts +3 -131
  53. package/dist/application/process-lifecycle.d.ts.map +1 -1
  54. package/dist/application/schedule.d.ts +0 -1
  55. package/dist/application/schedule.d.ts.map +1 -1
  56. package/dist/application/watch-hub-core.d.ts +122 -0
  57. package/dist/application/watch-hub-core.d.ts.map +1 -0
  58. package/dist/application/watch-hub.d.ts +2 -2
  59. package/dist/application/watch-hub.d.ts.map +1 -1
  60. package/dist/browser/client-executors.d.ts +14 -0
  61. package/dist/browser/client-executors.d.ts.map +1 -0
  62. package/dist/browser/client-multipart.d.ts +1 -1
  63. package/dist/browser/client-multipart.d.ts.map +1 -1
  64. package/dist/browser/client.d.ts +3 -2
  65. package/dist/browser/client.d.ts.map +1 -1
  66. package/dist/browser/http-fetch.d.ts +22 -0
  67. package/dist/browser/http-fetch.d.ts.map +1 -0
  68. package/dist/browser/http.d.ts +1 -3
  69. package/dist/browser/http.d.ts.map +1 -1
  70. package/dist/browser/live-state-core.d.ts +63 -0
  71. package/dist/browser/live-state-core.d.ts.map +1 -0
  72. package/dist/browser/live-state.d.ts.map +1 -1
  73. package/dist/browser/realtime-client.d.ts +26 -0
  74. package/dist/browser/realtime-client.d.ts.map +1 -0
  75. package/dist/browser/socket-io-connection.d.ts +82 -0
  76. package/dist/browser/socket-io-connection.d.ts.map +1 -0
  77. package/dist/browser/socket-io-peer.d.ts +20 -0
  78. package/dist/browser/socket-io-peer.d.ts.map +1 -0
  79. package/dist/browser/socket-io-trace.d.ts +31 -0
  80. package/dist/browser/socket-io-trace.d.ts.map +1 -0
  81. package/dist/browser/socket-io.d.ts +2 -18
  82. package/dist/browser/socket-io.d.ts.map +1 -1
  83. package/dist/contract/client-types.d.ts +134 -0
  84. package/dist/contract/client-types.d.ts.map +1 -0
  85. package/dist/contract/define-validation.d.ts +30 -0
  86. package/dist/contract/define-validation.d.ts.map +1 -0
  87. package/dist/contract/define.d.ts +3 -357
  88. package/dist/contract/define.d.ts.map +1 -1
  89. package/dist/contract/runtime-context.d.ts +131 -0
  90. package/dist/contract/runtime-context.d.ts.map +1 -0
  91. package/dist/contract/tool-options.d.ts +105 -0
  92. package/dist/contract/tool-options.d.ts.map +1 -0
  93. package/dist/contract/tool-view.d.ts +15 -2
  94. package/dist/contract/tool-view.d.ts.map +1 -1
  95. package/dist/durability/contract.d.ts +83 -0
  96. package/dist/durability/contract.d.ts.map +1 -1
  97. package/dist/durability/effect.d.ts +24 -0
  98. package/dist/durability/effect.d.ts.map +1 -0
  99. package/dist/durability/engine.d.ts +2 -2
  100. package/dist/durability/engine.d.ts.map +1 -1
  101. package/dist/durability/events.d.ts +2 -0
  102. package/dist/durability/events.d.ts.map +1 -1
  103. package/dist/durability/ledger.d.ts +11 -0
  104. package/dist/durability/ledger.d.ts.map +1 -1
  105. package/dist/durability/parks.d.ts +22 -0
  106. package/dist/durability/parks.d.ts.map +1 -0
  107. package/dist/durability/scheduler.d.ts +1 -0
  108. package/dist/durability/scheduler.d.ts.map +1 -1
  109. package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
  110. package/dist/entrypoints/agent-runtime/harness.js +127 -116
  111. package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
  112. package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
  113. package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
  114. package/dist/entrypoints/agent-runtime/testing.js +246 -214
  115. package/dist/entrypoints/agent-runtime.js +224 -203
  116. package/dist/entrypoints/application/diagnostic-journal.js +63 -203
  117. package/dist/entrypoints/application/opentelemetry.js +1 -1
  118. package/dist/entrypoints/application.d.ts +2 -1
  119. package/dist/entrypoints/application.d.ts.map +1 -1
  120. package/dist/entrypoints/application.js +506 -380
  121. package/dist/entrypoints/cli.d.ts +4 -1
  122. package/dist/entrypoints/cli.d.ts.map +1 -1
  123. package/dist/entrypoints/cli.js +57 -35
  124. package/dist/entrypoints/contract.d.ts +5 -2
  125. package/dist/entrypoints/contract.d.ts.map +1 -1
  126. package/dist/entrypoints/contract.js +3 -2
  127. package/dist/entrypoints/files.d.ts +2 -0
  128. package/dist/entrypoints/files.d.ts.map +1 -1
  129. package/dist/entrypoints/files.js +98 -2
  130. package/dist/entrypoints/index.d.ts +4 -2
  131. package/dist/entrypoints/index.d.ts.map +1 -1
  132. package/dist/entrypoints/index.js +348 -282
  133. package/dist/entrypoints/live.js +89 -71
  134. package/dist/entrypoints/node.d.ts +2 -1
  135. package/dist/entrypoints/node.d.ts.map +1 -1
  136. package/dist/entrypoints/node.js +13 -12
  137. package/dist/entrypoints/react.js +1 -1
  138. package/dist/entrypoints/remote.js +4 -4
  139. package/dist/entrypoints/server.d.ts +4 -2
  140. package/dist/entrypoints/server.d.ts.map +1 -1
  141. package/dist/entrypoints/server.js +293 -79
  142. package/dist/entrypoints/testing.d.ts +2 -1
  143. package/dist/entrypoints/testing.d.ts.map +1 -1
  144. package/dist/entrypoints/testing.js +288 -281
  145. package/dist/entrypoints/tools/connections.js +2 -2
  146. package/dist/entrypoints/tools/invoker.js +4 -4
  147. package/dist/entrypoints/tools.d.ts +6 -3
  148. package/dist/entrypoints/tools.d.ts.map +1 -1
  149. package/dist/entrypoints/tools.js +245 -202
  150. package/dist/entrypoints/tracking.js +325 -274
  151. package/dist/files/boundary.d.ts.map +1 -1
  152. package/dist/files/file-io.d.ts +14 -0
  153. package/dist/files/file-io.d.ts.map +1 -0
  154. package/dist/index-1j8pm5t0.js +412 -0
  155. package/dist/{index-kvj7f4hq.js → index-2bxbyab0.js} +10 -2
  156. package/dist/{index-xnj9bgxe.js → index-2gxzjvyr.js} +2 -162
  157. package/dist/index-4gcnakhx.js +82 -0
  158. package/dist/{index-j05z5gn4.js → index-55hkhm67.js} +136 -119
  159. package/dist/{index-cq4qfycf.js → index-79z7m7dt.js} +227 -59
  160. package/dist/{index-r7nmqpsg.js → index-7p1f0vp2.js} +1 -1
  161. package/dist/{index-dcpdvjsc.js → index-863ea9jb.js} +4 -4
  162. package/dist/index-8p52kd5p.js +242 -0
  163. package/dist/{index-97ac4gph.js → index-8zja4pkf.js} +26 -4
  164. package/dist/{index-2qzskm8h.js → index-dce5wxcq.js} +1 -1
  165. package/dist/index-e01r054k.js +105 -0
  166. package/dist/{index-sees8yf8.js → index-ensd0r74.js} +118 -111
  167. package/dist/{index-1nd48tm9.js → index-gxrt5h6v.js} +2 -1
  168. package/dist/{index-e87kakm4.js → index-ham5sz8m.js} +112 -110
  169. package/dist/{index-kj2wbeta.js → index-het2he5g.js} +280 -196
  170. package/dist/{index-vcvkq30w.js → index-hmp4800j.js} +3 -3
  171. package/dist/{index-gyr48nzg.js → index-k30h66yd.js} +71 -151
  172. package/dist/{index-2cr1cqhn.js → index-khtgb21r.js} +2 -2
  173. package/dist/{index-x4799c19.js → index-ndddxtyx.js} +11 -11
  174. package/dist/{index-dydjcp8z.js → index-np4m8hd3.js} +38 -36
  175. package/dist/{index-p81267c2.js → index-p3vsv1fb.js} +621 -357
  176. package/dist/{index-mp5sn43f.js → index-p9e0w8hs.js} +2 -2
  177. package/dist/{index-rewkc2hj.js → index-p9sh0xx4.js} +3 -3
  178. package/dist/{index-70yj2ebz.js → index-paz6sgdp.js} +107 -103
  179. package/dist/{index-bn2cjajt.js → index-px2gm2jp.js} +26 -102
  180. package/dist/index-s812ycat.js +65 -0
  181. package/dist/{index-xsqjkha9.js → index-sp1tzwnb.js} +2 -2
  182. package/dist/{index-n6hxg8as.js → index-t9rhjr9f.js} +615 -566
  183. package/dist/{index-zeemqhqx.js → index-v260df89.js} +88 -80
  184. package/dist/{index-fdp6hdxn.js → index-w906953s.js} +5 -1
  185. package/dist/{index-mdzh02yc.js → index-wdkt63w3.js} +1 -1
  186. package/dist/{index-58k4fp34.js → index-wsm5w4ee.js} +1 -1
  187. package/dist/{index-v38qyerb.js → index-xw3s75nj.js} +1 -1
  188. package/dist/internal/atomic-file.d.ts +23 -2
  189. package/dist/internal/atomic-file.d.ts.map +1 -1
  190. package/dist/internal/exclusive-lock.d.ts +51 -0
  191. package/dist/internal/exclusive-lock.d.ts.map +1 -0
  192. package/dist/internal/process-identity.d.ts +47 -0
  193. package/dist/internal/process-identity.d.ts.map +1 -0
  194. package/dist/internal/with-exclusive-lock.d.ts +67 -0
  195. package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
  196. package/dist/live/watch-client.d.ts.map +1 -1
  197. package/dist/observability/audit.d.ts +2 -2
  198. package/dist/observability/audit.d.ts.map +1 -1
  199. package/dist/observability/event.d.ts +2 -1
  200. package/dist/observability/event.d.ts.map +1 -1
  201. package/dist/primitives/export-operation.d.ts +1 -1
  202. package/dist/primitives/export-operation.d.ts.map +1 -1
  203. package/dist/realtime/registry.d.ts +0 -5
  204. package/dist/realtime/registry.d.ts.map +1 -1
  205. package/dist/server/bun.d.ts +0 -1
  206. package/dist/server/bun.d.ts.map +1 -1
  207. package/dist/server/context-contribution.d.ts +1 -1
  208. package/dist/server/context-contribution.d.ts.map +1 -1
  209. package/dist/server/context.d.ts +1 -1
  210. package/dist/server/context.d.ts.map +1 -1
  211. package/dist/server/endpoint-response.d.ts +2 -1
  212. package/dist/server/endpoint-response.d.ts.map +1 -1
  213. package/dist/server/error-dispatch.d.ts +1 -1
  214. package/dist/server/error-dispatch.d.ts.map +1 -1
  215. package/dist/server/error-hook.d.ts +1 -1
  216. package/dist/server/error-hook.d.ts.map +1 -1
  217. package/dist/server/handler-state.d.ts +1 -1
  218. package/dist/server/handler-state.d.ts.map +1 -1
  219. package/dist/server/implement-registry.d.ts +54 -0
  220. package/dist/server/implement-registry.d.ts.map +1 -0
  221. package/dist/server/implement.d.ts +9 -55
  222. package/dist/server/implement.d.ts.map +1 -1
  223. package/dist/server/middleware/auth.d.ts +1 -31
  224. package/dist/server/middleware/auth.d.ts.map +1 -1
  225. package/dist/server/middleware/jwt.d.ts +31 -0
  226. package/dist/server/middleware/jwt.d.ts.map +1 -0
  227. package/dist/server/multipart-reader.d.ts +22 -0
  228. package/dist/server/multipart-reader.d.ts.map +1 -0
  229. package/dist/server/multipart.d.ts +1 -1
  230. package/dist/server/multipart.d.ts.map +1 -1
  231. package/dist/server/oauth/cimd.d.ts +88 -0
  232. package/dist/server/oauth/cimd.d.ts.map +1 -0
  233. package/dist/server/oauth/endpoints.d.ts +39 -0
  234. package/dist/server/oauth/endpoints.d.ts.map +1 -0
  235. package/dist/server/oauth/provider.d.ts +1 -68
  236. package/dist/server/oauth/provider.d.ts.map +1 -1
  237. package/dist/server/streaming-pump.d.ts +66 -0
  238. package/dist/server/streaming-pump.d.ts.map +1 -0
  239. package/dist/server/streaming-route.d.ts +12 -5
  240. package/dist/server/streaming-route.d.ts.map +1 -1
  241. package/dist/server/types.d.ts +4 -1
  242. package/dist/server/types.d.ts.map +1 -1
  243. package/dist/server/unix-client-bun.d.ts.map +1 -1
  244. package/dist/server/unix-client-http1.d.ts +76 -0
  245. package/dist/server/unix-client-http1.d.ts.map +1 -0
  246. package/dist/server/unix-client.d.ts.map +1 -1
  247. package/dist/testing/handler-clients.d.ts +2 -1
  248. package/dist/testing/handler-clients.d.ts.map +1 -1
  249. package/dist/testing/realtime-probe.d.ts +33 -0
  250. package/dist/testing/realtime-probe.d.ts.map +1 -0
  251. package/dist/testing/surface-conformance.d.ts +0 -31
  252. package/dist/testing/surface-conformance.d.ts.map +1 -1
  253. package/dist/testing/surface-manifest-digest.d.ts +44 -0
  254. package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
  255. package/dist/testing/surface-manifest.d.ts.map +1 -1
  256. package/dist/tools/agent.d.ts +1 -1
  257. package/dist/tools/agent.d.ts.map +1 -1
  258. package/dist/tools/cli/args-fields.d.ts +31 -0
  259. package/dist/tools/cli/args-fields.d.ts.map +1 -0
  260. package/dist/tools/cli/args-route.d.ts +42 -0
  261. package/dist/tools/cli/args-route.d.ts.map +1 -0
  262. package/dist/tools/cli/args-view.d.ts +32 -0
  263. package/dist/tools/cli/args-view.d.ts.map +1 -0
  264. package/dist/tools/cli/args.d.ts +2 -65
  265. package/dist/tools/cli/args.d.ts.map +1 -1
  266. package/dist/tools/cli/argument-error.d.ts +5 -0
  267. package/dist/tools/cli/argument-error.d.ts.map +1 -0
  268. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  269. package/dist/tools/cli/command.d.ts +1 -1
  270. package/dist/tools/cli/command.d.ts.map +1 -1
  271. package/dist/tools/cli/config.d.ts +1 -1
  272. package/dist/tools/cli/config.d.ts.map +1 -1
  273. package/dist/tools/cli/format.d.ts +2 -1
  274. package/dist/tools/cli/format.d.ts.map +1 -1
  275. package/dist/tools/cli/invoke.d.ts +2 -1
  276. package/dist/tools/cli/invoke.d.ts.map +1 -1
  277. package/dist/tools/cli/managed-surface.d.ts +1 -1
  278. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  279. package/dist/tools/cli/policy.d.ts +1 -1
  280. package/dist/tools/cli/policy.d.ts.map +1 -1
  281. package/dist/tools/cli/prepare.d.ts.map +1 -1
  282. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  283. package/dist/tools/cli/session.d.ts +1 -1
  284. package/dist/tools/cli/session.d.ts.map +1 -1
  285. package/dist/tools/cli/update.d.ts +19 -0
  286. package/dist/tools/cli/update.d.ts.map +1 -1
  287. package/dist/tools/cli/view.d.ts +1 -1
  288. package/dist/tools/cli/view.d.ts.map +1 -1
  289. package/dist/tools/cli/wait.d.ts +1 -1
  290. package/dist/tools/cli/wait.d.ts.map +1 -1
  291. package/dist/tools/connections/runtime.d.ts +1 -1
  292. package/dist/tools/connections/runtime.d.ts.map +1 -1
  293. package/dist/tools/execute-args.d.ts +23 -0
  294. package/dist/tools/execute-args.d.ts.map +1 -0
  295. package/dist/tools/execute-hooks.d.ts +146 -0
  296. package/dist/tools/execute-hooks.d.ts.map +1 -0
  297. package/dist/tools/execute-result.d.ts +40 -0
  298. package/dist/tools/execute-result.d.ts.map +1 -0
  299. package/dist/tools/execute.d.ts +4 -193
  300. package/dist/tools/execute.d.ts.map +1 -1
  301. package/dist/tools/internal/surface-projector.d.ts +2 -1
  302. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  303. package/dist/tools/invoker.d.ts +2 -1
  304. package/dist/tools/invoker.d.ts.map +1 -1
  305. package/dist/tools/lifecycle.d.ts +1 -1
  306. package/dist/tools/lifecycle.d.ts.map +1 -1
  307. package/dist/tools/mcp/mount.d.ts +1 -1
  308. package/dist/tools/mcp/mount.d.ts.map +1 -1
  309. package/dist/tools/mcp/prepare.d.ts +2 -1
  310. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  311. package/dist/tools/mcp/progress.d.ts +1 -1
  312. package/dist/tools/mcp/progress.d.ts.map +1 -1
  313. package/dist/tools/mcp/register.d.ts +3 -2
  314. package/dist/tools/mcp/register.d.ts.map +1 -1
  315. package/dist/tools/mcp/round-context.d.ts +38 -0
  316. package/dist/tools/mcp/round-context.d.ts.map +1 -0
  317. package/dist/tools/mcp/round-policy.d.ts +1 -1
  318. package/dist/tools/mcp/round-policy.d.ts.map +1 -1
  319. package/dist/tools/mcp/round.d.ts +3 -11
  320. package/dist/tools/mcp/round.d.ts.map +1 -1
  321. package/dist/tools/mcp/runtime-tools.d.ts +2 -1
  322. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  323. package/dist/tools/mount.d.ts +3 -1
  324. package/dist/tools/mount.d.ts.map +1 -1
  325. package/dist/tools/native-definition.d.ts +2 -1
  326. package/dist/tools/native-definition.d.ts.map +1 -1
  327. package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -1
  328. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  329. package/dist/tools/operations/async-operation-runtime-types.d.ts +2 -1
  330. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  331. package/dist/tools/remote.d.ts.map +1 -1
  332. package/dist/tools/runtime-tool.d.ts +3 -1
  333. package/dist/tools/runtime-tool.d.ts.map +1 -1
  334. package/dist/tools/tool-logger.d.ts +1 -1
  335. package/dist/tools/tool-logger.d.ts.map +1 -1
  336. package/dist/tracking/client-listeners.d.ts +30 -0
  337. package/dist/tracking/client-listeners.d.ts.map +1 -0
  338. package/dist/tracking/client-visit.d.ts +61 -0
  339. package/dist/tracking/client-visit.d.ts.map +1 -0
  340. package/dist/tracking/client.d.ts +3 -2
  341. package/dist/tracking/client.d.ts.map +1 -1
  342. package/llms/application.2.txt +271 -7
  343. package/llms/application.txt +66 -289
  344. package/llms/cli.2.txt +80 -0
  345. package/llms/cli.txt +45 -74
  346. package/llms/contract.txt +3 -3
  347. package/llms/files.txt +3 -0
  348. package/llms/stitchkit.txt +3 -3
  349. package/llms/tools.2.txt +88 -279
  350. package/llms/tools.3.txt +288 -0
  351. package/llms/tools.txt +27 -65
  352. package/llms/{upgrading-0.37.0-0.50.0.txt → upgrading-0.37.0-0.53.0.txt} +25 -3
  353. package/llms/{upgrading-0.53.0-0.67.0.txt → upgrading-0.55.0-0.68.0.txt} +53 -25
  354. package/llms/{upgrading-0.68.0-0.94.0.txt → upgrading-0.69.0-0.95.0.txt} +45 -53
  355. package/llms/upgrading.txt +3 -3
  356. package/llms-full.txt +216 -43
  357. package/llms.txt +8 -8
  358. package/package.json +1 -1
  359. package/dist/index-e2z3ahw9.js +0 -325
  360. package/dist/index-mkm15s49.js +0 -394
package/llms/tools.2.txt CHANGED
@@ -1,16 +1,102 @@
1
- # stitchkit/tools — stitchkit docs slice, part 2 of 2
1
+ # stitchkit/tools — stitchkit docs slice, part 2 of 3
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
+ > Continues in `llms/tools.3.txt`.
5
6
 
6
7
  Parts of this slice:
7
8
  - `llms/tools.txt`: Guide: MCP & agents (docs/guide/mcp-and-agents.md)
8
- - `llms/tools.2.txt`: Guide: MCP & agents (docs/guide/mcp-and-agents.md) · API reference: `stitchkit/tools` (docs/api/reference.md)
9
+ - `llms/tools.2.txt`: Guide: MCP & agents (docs/guide/mcp-and-agents.md)
10
+ - `llms/tools.3.txt`: API reference: `stitchkit/tools` (docs/api/reference.md)
9
11
 
10
12
  ==============================================================================
11
13
  # Guide: MCP & agents (docs/guide/mcp-and-agents.md) (continued)
12
14
  ==============================================================================
13
15
 
16
+ ## A different answer for tools — `withToolView`
17
+
18
+ An admin page wants the full record; a model wants a card. Every byte of a
19
+ tool result enters the model's context and stays in its history, and personal
20
+ fields a task does not need are better never shown to it. Two endpoints on one
21
+ path (one `expose: ['HTTP']`, one for the tools) duplicate the description, the
22
+ schemas and the handler; branching on `ctx.source` teaches every handler about
23
+ transports and still advertises the full output schema.
24
+
25
+ A **tool view** declares the difference on the endpoint instead. Most often the
26
+ difference is only the call — a model needs a lighter one, and the answer keeps
27
+ its one shape:
28
+
29
+ ```ts
30
+ import { defineContract, withToolView } from 'stitchkit';
31
+
32
+ export const items = defineContract({ prefix: 'items' }, {
33
+ list: withToolView(
34
+ {
35
+ method: 'GET', path: '/:slug/items', desc: 'List items', tool: { name: 'db_items' },
36
+ input: ItemsQuery, // include: z.array(...).default(['relations'])
37
+ output: ItemsResponse, // one answer on HTTP and on the tools
38
+ },
39
+ { defaults: { include: [] } }, // what a tool call gets when it passes nothing
40
+ ),
41
+ });
42
+ ```
43
+
44
+ When the answer itself differs, the view carries its own schema too:
45
+
46
+ ```ts
47
+ import { defineContract, withToolView } from 'stitchkit';
48
+
49
+ export const users = defineContract({ prefix: 'users' }, {
50
+ list: withToolView(
51
+ {
52
+ method: 'GET', path: '/', desc: 'List users', tool: { name: 'user_list' },
53
+ input: UserListQuery, // include: z.array(...).default(['profile', 'stats'])
54
+ output: UserListResponse, // HTTP, OpenAPI and the typed client — unchanged
55
+ },
56
+ {
57
+ defaults: { include: [] }, // what a tool call gets when it passes nothing
58
+ output: UserCardList, // the tool answer and its schema
59
+ project: (full, { input }) => ({ items: full.items.map(toCard) }), // optional: without it, `output` slices
60
+ },
61
+ ),
62
+ });
63
+ ```
64
+
65
+ - **One handler, one parser.** `defaults` joins the tool call's arguments
66
+ *before* the endpoint's own `input` parses them, so the handler receives an
67
+ ordinary `input` — `include: []` from a tool, the HTTP default from HTTP — and
68
+ loads only what was asked for. An explicit argument wins over the default.
69
+ - **The answer is derived, then checked.** The handler's result is validated
70
+ against the full `output` first, as always; then `project` (a pure,
71
+ synchronous function of the full result and the parsed input) or a slice by
72
+ the view's `output`, then validation against the view's schema. A projection
73
+ that throws, returns a Promise or breaks its schema is `INTERNAL_SERVER_ERROR`
74
+ — a server fault, like any output mismatch.
75
+ - **Where it applies.** The MCP, agent and CLI mounts answer with the view;
76
+ `outputSchema`, `structuredContent`, the advertised input `default`, the
77
+ catalog stamp and the surface snapshot follow it. HTTP, OpenAPI, the typed
78
+ client and the in-process [`createToolInvoker`](#in-process-calls--createtoolinvoker)
79
+ keep the full answer — code, not a model, is calling there.
80
+ - **Four forms, one helper.** With `defaults` alone the call changes and the
81
+ answer is the full `output`, validated by it and advertised as it. With
82
+ `output` and `project` the answer has its own schema. With `project` alone it
83
+ reshapes values inside the full schema. With `output` alone it is a slice, and
84
+ the full result must fit that schema — `withToolView` refuses the endpoint at
85
+ compile time when it does not.
86
+ - **Exposure.** A view needs a tool transport. With `createContractFactory({
87
+ toolExposure: 'explicit' })` an endpoint without `expose` is HTTP-only, so an
88
+ endpoint with a view names its tool transports in `expose`.
89
+ - **What it refuses.** `defineContract` rejects a view on an endpoint with no
90
+ tool transport or no full `output`, on a raw, `rawBody`, multipart,
91
+ `responseMeta` or streaming endpoint, a view that declares no `defaults`,
92
+ `output` or `project` — it would change nothing — and a default for a key the input does not have, for a path
93
+ param, or with a value the input would reject.
94
+
95
+ A projection adds nothing the full result does not carry: a field the tool
96
+ answer needs belongs in the full answer, loaded by the handler. Keys a
97
+ projection returns beyond its schema are reported by `onOutputStrip`; a slice
98
+ removes keys on purpose and is not reported. → [ADR 0196](../decisions/0196-a-tool-answer-is-a-declared-view.md)
99
+
14
100
  ## AI agents — `mountAgent`
15
101
 
16
102
  `mountAgent` remains the low-level path when the application owns its own model
@@ -559,280 +645,3 @@ A contract handler runs the same for an HTTP request, an MCP tool call and an
559
645
  agent tool call. `ctx.source` (`'http'` · `'mcp'` · `'agent'`) tells it which —
560
646
  the rest of the context (`params`, `input`, anything `context` injects) is
561
647
  identical. Write the handler once; it serves every surface.
562
-
563
- ==============================================================================
564
- # API reference: `stitchkit/tools` (docs/api/reference.md)
565
- ==============================================================================
566
-
567
- ## `stitchkit/tools`
568
-
569
- Server-only. Turns contracts into MCP and AI-agent tools. MCP server surfaces
570
- need the `@modelcontextprotocol/server` v2 peer; MCP hosts/tests use the separate
571
- `@modelcontextprotocol/client` package. Agent surfaces need the `ai` peer.
572
-
573
- Framework-owned MCP tools advertise the exact declared output schema and return
574
- the validated value unchanged as `structuredContent`, including arrays, scalars
575
- and `null`. Tools without an output contract advertise and return no structured
576
- payload.
577
-
578
- | Export | Kind | Summary |
579
- |--------|------|---------|
580
- | `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
581
- | `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
582
- | `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
583
- | `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
584
- | `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
585
- | `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
586
- | `mountAgent` | function | a Vercel AI SDK `ToolSet` from a service; failed executions reject through the SDK tool-error channel with a safe typed envelope, while successful output is never classified by field name — [guide](../guide/mcp-and-agents.md#ai-agents--mountagent) |
587
- | `defineRuntimeTool` | function | define one validated pathless operation for explicit MCP, Agent and/or CLI surfaces — [guide](../guide/mcp-and-agents.md#pathless-runtime-tools-and-multimodal-results) |
588
- | `createRuntimeToolFactory` | function | bind shared identity and Zod-validated per-call context for runtime tools — [guide](../guide/mcp-and-agents.md#pathless-runtime-tools-and-multimodal-results) |
589
- | `createToolInvoker` | function | compile an exposure-aware in-process dispatcher over the canonical tool runner; use peer-free `stitchkit/tools/invoker`, or the full `stitchkit/tools` adapter barrel — [guide](../guide/mcp-and-agents.md#in-process-calls--createtoolinvoker) |
590
- | `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
591
- | `mountViewFile` | function | a native multimodal "view file" MCP tool |
592
- | `resolveMedia` | function | resolve a media reference for a tool result |
593
- | `validateMcpSchemas` | function | object-shaped assertion over the exact advertised schema surface — compatibility, typed properties and portable formats ([guide](../guide/mcp-and-agents.md#mcp-schema-validation-profile)) |
594
- | `listToolNames` | function | every contract/runtime tool name with origin, identity and transports — for stable snapshots — [guide](../guide/mcp-and-agents.md#pinning-tool-names--listtoolnames) |
595
- | `listContractToolNames` | function | the same listing straight from contracts — no handlers or stub services needed |
596
- | `describeToolCatalog` | function | inspect the exact model-facing names, source identities, schema byte sizes and deferred state; an explicit total byte budget fails closed |
597
- | `ToolCatalogConfig` / `ToolCatalogEntry` | _type_ | catalog source, transport, optional explicit schema budget and one inspectable result row |
598
- | `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
599
- | `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
600
- | `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
601
- | `McpHttpSecurityConfig` | _type_ | Fetch-boundary Host and Origin allowlists |
602
- | `McpLegacyPolicy` | _type_ | `'serve' \| 'reject'` protocol-era compatibility policy |
603
- | `McpStdioHandle` | _type_ | closeable official stdio transport handle |
604
- | `StdioMcpServerConfig` | _type_ | config for `createStdioMcpServer` |
605
- | `StdioCloseTarget` | _type_ | minimal close-only target accepted by `bindStdioProcessSignals` |
606
- | `StdioProcessSignalsOptions` | _type_ | signal source, close callbacks and phased error reporting |
607
- | `StdioProcessSignalsBinding` | _type_ | close-only signal binding with observed `promise` and listener `close()` |
608
- | `StdioProcessSignalsErrorPhase` | _type_ | `'prepare' \| 'close' \| 'complete'` reporting phase |
609
- | `McpServerBuildConfig` | _type_ | shared config for `buildMcpServer` |
610
- | `McpServerSharedConfig` | _type_ | transport-neutral options shared by direct and finite surface configs |
611
- | `McpServer` | _type_ | official split-SDK server instance accepted by raw extension points |
612
- | `DirectMcpSurfaceConfig` | _type_ | static or identity-dynamic `services` / `runtimeTools` source |
613
- | `FiniteMcpSurfaceConfig` | _type_ | bounded `surfaces` registry plus typed selector |
614
- | `McpSurfaceDefinition` | _type_ | one immutable `{ services, runtimeTools }` MCP surface |
615
- | `McpSurfaceRegistry` | _type_ | finite keyed surface registry for eager preparation |
616
- | `StdioAuthConfig` | _type_ | startup identity composed into `StdioMcpServerConfig` |
617
- | `McpMountConfig` | _type_ | config for `mountMcp` |
618
- | `McpSchemaValidationConfig` | _type_ | shared `{ policy, requireTypedProperties, allowUntyped, requirePortableFormats, allowFormats }` profile |
619
- | `ValidateMcpSchemasConfig` | _type_ | standalone validation profile plus `services`, `extend`, flattening and logger |
620
- | `RuntimeToolDefinition` | _type_ | transport-neutral pathless operation with identity, schemas, handler and optional presenters |
621
- | `RuntimeToolDefinitionBase` | _type_ | common name, identity, input, exposure and MCP metadata fields |
622
- | `RuntimeToolDefinitionWithOutput` | _type_ | runtime definition whose handler and presenters share a validated output type |
623
- | `RuntimeToolDefinitionWithoutOutput` | _type_ | runtime definition with a void handler and no presentation callbacks |
624
- | `RuntimeToolFactory` | _type_ | identity/context-bound runtime-tool definition factory |
625
- | `RuntimeToolFactoryConfig` | _type_ | factory service identity and context schema |
626
- | `RuntimeToolFactoryDefinitionWithOutput` | _type_ | factory-authored runtime tool with a validated output schema |
627
- | `RuntimeToolFactoryDefinitionWithoutOutput` | _type_ | factory-authored void runtime tool without presenters |
628
- | `RuntimeToolFactoryHandlerContext` | _type_ | parsed factory context plus parsed tool input |
629
- | `RuntimeToolFactoryIdentityFields` | _type_ | per-tool action, semantic method and optional identity metadata |
630
- | `RuntimeToolIdentity` | _type_ | `{ serviceName, action, scope?, method, meta? }` for runtime lifecycle/audit |
631
- | `RuntimeToolHandlerContext` | _type_ | runtime context with the definition's parsed input |
632
- | `RuntimeToolOutput` | _type_ | output inferred from a runtime tool's optional Zod schema |
633
- | `RuntimeToolPresenters` | _type_ | optional MCP and AI SDK `toModelOutput` presentation callbacks |
634
- | `RuntimeMcpPresentation` | _type_ | MCP content/metadata result without framework-owned `structuredContent` or `isError` |
635
- | `RuntimeMcpInput` | _type_ | typed accepted multi-round input for an opted-in runtime tool |
636
- | `OAuthClientRegistrationConfig` | _type_ | deterministic pre-registered → CIMD → explicit-DCR client resolution |
637
- | `CimdClientMetadata` | _type_ | validated Client ID Metadata Document |
638
- | `CimdClientMetadataFetcher` | _type_ | injectable secure network boundary for metadata loading |
639
- | `CimdFetchResponse` | _type_ | bounded metadata fetch result passed across the injectable network boundary |
640
- | `CimdFetchPolicy` | _type_ | CIMD timeout, redirect and size limits |
641
- | `CimdCachePolicy` | _type_ | bounded HTTP-aware cache policy: separate positive/negative pools (`maxEntries`), per-client and server-wide resolution rate limits (`maxResolutionsPerClient` / `maxResolutions` per `resolutionWindowMs`) |
642
- | `CimdCacheEvent` | _type_ | observable CIMD cache hit, miss, revalidation and eviction event |
643
- | `createSecureClientMetadataFetcher` | function | production HTTPS, DNS/IP-pinned CIMD fetcher |
644
- | `RuntimeAgentModelOutput` | _type_ | AI SDK model-facing text/JSON/content output returned by `present.agent` |
645
- | `AgentMountConfig` | _type_ | config for `mountAgent` |
646
- | `AgentToolRegistry` / `AgentToolRegistryBuilder` / `AgentToolRegistryInput` | _type_ | the composed runtime surface and its builder: declared defaults, `replace`/`disable` by name, and the exact `{ tools, names }` a mount receives |
647
- | `defineToolRegistry` | function | compose runtime tools over one declared default set; an unknown `replace`/`disable` name is refused instead of silently leaving the default in place |
648
- | `AgentContext` | _type_ | the context merged into agent tool handlers |
649
- | `Toolkit` | _type_ | the context-pinned tool surface from `createToolkit` |
650
- | `ToolExtend` | _type_ | extra-args extension for `mountMcp` / `mountAgent` |
651
- | `ToolLifecycle` | _type_ | `beforeHandle` / `afterHandle` gate for tool calls — [guide](../guide/mcp-and-agents.md#guarding-tools--lifecycle) |
652
- | `ToolExecutionControlReason` | _type_ | internal managed-execution stop reason: stale run or requested interruption |
653
- | `ToolExecutionControlError` | class | control-flow error used to unwind a superseded managed tool call without presenting it as a model-facing tool failure |
654
- | `isToolExecutionControlError` | function | narrow an unknown thrown value to the managed execution control error |
655
- | `ToolOperation` | _type_ | executable path-free operation shape shared by contract and framework-native runners |
656
- | `ToolCallHooks` | _type_ | object-shaped `beforeToolCall` / `afterToolCall` / `onToolError` observability hooks; the raw thrown value reaches the last two as `error` ([guide](../guide/observability.md#the-cause-behind-a-failed-tool-call)) |
657
- | `BeforeToolCallOptions` | _type_ | `{ toolName, args, context, endpoint }` passed before execution |
658
- | `AfterToolCallOptions` | _type_ | completed call options plus `{ result, durationMs, error? }` |
659
- | `ToolErrorOptions` | _type_ | `{ toolName, error, context, endpoint }` for a thrown handler-path value |
660
- | `ErrorHintFn` | _type_ | `(toolName, errorCode) => string \| null` — a per-tool recovery hint, shared by every mount |
661
- | `ToolResult` | _type_ | the result of one tool call |
662
- | `ToolInvoker` | _type_ | immutable compiled dispatcher (`names`, envelope `invoke`, throwing `invokeOrThrow`) |
663
- | `ToolInvokerConfig` | _type_ | compile-time exposure, extension and presentation options |
664
- | `ToolInvocationOptions` | _type_ | per-call source, context, lifecycle, hooks and output-strip reporter |
665
- | `ToolCallContext` | _type_ | the context every tool hook receives — `{ source, mcp? }` plus whatever the mount's `context` added |
666
- | `ViewFileOptions` | _type_ | shared URL/managed-file-boundary policy for `defineViewFileTool`, `mountViewFile` and `resolveMedia` |
667
- | `ViewFileOutput` | _type_ | neutral managed batch result with multimodal `content` and per-item `errors` |
668
- | `ViewFileInputSchema` | constant | fixed one-or-many media path/URL input schema |
669
- | `ViewFileOutputSchema` | constant | Zod schema for the neutral managed view-file batch result |
670
- | `ViewFileErrorSchema` | constant | Zod schema for one structured per-item view failure |
671
- | `McpAnnotations` | _type_ | MCP annotations on a media result |
672
- | `McpAnnotationsSchema` | constant | Zod schema for MCP media annotations |
673
- | `McpMediaContentSchema` | constant | Zod schema for text/image/audio media content |
674
- | `CollectToolsConfig` | _type_ | options for `collectTools` |
675
- | `findUntypedProperties` | function | every property in a JSON Schema with no `type`/`enum`/`$ref` — what a model is shown and cannot obey ([guide](../guide/mcp-and-agents.md)) |
676
- | `UntypedProperty` | _type_ | one such property — `{ path, description? }` |
677
- | `findNonPortableFormats` | function | deep finder for formats outside the portable MCP/AJV baseline |
678
- | `NonPortableFormat` | _type_ | one `{ path, format }` portability finding |
679
- | `PORTABLE_JSON_SCHEMA_FORMATS` | constant | portable-format baseline used by MCP validation |
680
- | `ToolNameEntry` | _type_ | one `listToolNames` row — `{ kind, name, service, method, transports }` |
681
- | `IncompatibleSchemaPolicy` | _type_ | `'throw' \| 'skip' \| 'warn'` |
682
- | `McpMediaContent` | _type_ | a multimodal MCP content item |
683
-
684
- ### Native tools
685
-
686
- Generic host-supplied operations — managed definitions for the canonical
687
- runtime-tool runner, plus deliberate raw MCP adapters over the same mechanics.
688
-
689
- | Export | Kind | Summary |
690
- |--------|------|---------|
691
- | `defineDownloadTool` | function | define a guarded, size-capped managed download for MCP/Agent `runtimeTools` |
692
- | `defineUploadTool` | function | define a typed managed local-file upload for MCP/Agent `runtimeTools` |
693
- | `defineWaitTool` | function | define a typed, cancellable managed polling operation for MCP/Agent `runtimeTools` |
694
- | `defineViewFileTool` | function | define a guarded, batch-capped managed multimodal operation for MCP/Agent `runtimeTools` |
695
- | `DefineDownloadToolConfig` | _type_ | Zod input, stable identity, URL resolver, storage policy and presenters for `defineDownloadTool` |
696
- | `DefineUploadToolConfig` | _type_ | stable identity, typed output, upload callback and presenters for `defineUploadTool` |
697
- | `DefineWaitToolConfig` | _type_ | Zod input/state, identity, poll/done/timeout policy and presenters for `defineWaitTool` |
698
- | `DefineViewFileToolConfig` | _type_ | identity, media security policy and optional presenters for `defineViewFileTool` |
699
- | `ManagedNativeToolConfig` | _type_ | shared name, description, identity, exposure and annotations for managed native factories |
700
- | `NativeToolIdentity` | _type_ | pathless service/action/scope/meta identity; semantic method is factory-owned |
701
- | `ManagedWaitRender` | _type_ | optional managed wait terminal text and failure classification |
702
- | `UploadToolInputSchema` | constant | fixed `{ path: string }` input schema for `defineUploadTool` |
703
- | `defineAsyncOperation` | function | runtime-only start/status/wait plus configured cancel/result/artifacts definitions; see the [durable application-owned recipe](../guide/mcp-and-agents.md#durable-application-owned-execution) |
704
- | `defineAsyncOperationContract` | function | define one canonical Zod-first HTTP contract for start/status/wait plus optional capabilities; execution and recovery remain application-owned |
705
- | `bindContractAsyncOperation` | function | bind literal methods from an existing contract without creating another HTTP surface |
706
- | `createAsyncOperationSnapshotSchema` | function | canonical pending/running/succeeded/failed/cancelled Zod snapshot |
707
- | `AsyncOperationSnapshotSchema` | _type_ | the snapshot union `createAsyncOperationSnapshotSchema` returns when no `progress` schema is configured |
708
- | `AsyncOperationSnapshotSchemaWithProgress` | _type_ | the same union with the configured `progress` schema optional on every phase |
709
- | `AsyncOperationCancelResultSchema` | constant | validated accepted/already_terminal/rejected cancellation result |
710
- | `AsyncOperationCancelResult` | _type_ | validated cancel capability result |
711
- | `AsyncOperationCancelCapability` | _type_ | optional typed domain cancellation callback |
712
- | `AsyncOperationCapability` | _type_ | generated capability-name union |
713
- | `AsyncOperationStartDefinition` / `AsyncOperationFollowDefinition` | _type_ | generated runtime definition types |
714
- | `AsyncOperationIdentity` | _type_ | shared service/action/scope/meta identity for an operation |
715
- | `AsyncOperationOutputCapability` | _type_ | optional result/artifact schema plus handler |
716
- | `RuntimeAsyncOperationConfig` | _type_ | runtime-only descriptor configuration |
717
- | `RuntimeAsyncOperation` | _type_ | inferred generated definitions and schemas |
718
- | `AsyncOperationContractConfig` | _type_ | canonical contract config where start returns the operation id; optional `expose` names the transports per capability, because this contract is built inside the framework and never passes through a consumer's `toolExposure: 'explicit'` factory |
719
- | `AsyncOperationContractWithStartOutputConfig` | _type_ | canonical contract config with an application start envelope and typed id extractor |
720
- | `DefinedAsyncOperationContract` | _type_ | generated contract, capability keys, schemas and parsed adapters |
721
- | `ContractAsyncOperationConfig` | _type_ | literal contract method binding and handlers |
722
- | `AdaptedContractAsyncOperationConfig` | _type_ | existing-contract binding with explicit id and per-capability input adapters |
723
- | `BoundAdaptedContractAsyncOperation` | _type_ | inferred adapted binding with parsed id/input projectors |
724
- | `AdaptedContractAsyncOperationStartKey` | _type_ | existing-contract keys with a declared start output |
725
- | `AdaptedContractAsyncOperationFollowKey` | _type_ | existing-contract keys with both input and output schemas |
726
- | `AdaptedContractAsyncOperationWaitKey` | _type_ | adapted follow-up keys whose output matches the selected status snapshot |
727
- | `ContractAsyncOperationInputAdapters` | _type_ | guaranteed direct-binding status/wait input adapters plus configured optional capabilities |
728
- | `ContractAsyncOperationKeys` | _type_ | literal method-key union of a bound contract |
729
- | `ContractAsyncOperationStartKey` | _type_ | direct-binding start keys whose declared ID schema has stable input/output |
730
- | `ContractAsyncOperationFollowKey` | _type_ | contract keys whose input schema type matches the selected start output |
731
- | `ContractAsyncOperationWaitKey` | _type_ | follow-up keys whose output schema type also matches the selected status output |
732
- | `composeToolLifecycle` | function | ordered composition of tool before/after phases |
733
- | `mountDownload` | function | raw MCP "download a URL to disk" adapter (SSRF-guarded, size-capped) |
734
- | `mountUpload` | function | raw MCP "upload a local file" adapter |
735
- | `mountWait` | function | raw MCP generic `--wait`-style polling adapter |
736
- | `DownloadToolConfig` | _type_ | config for `mountDownload` |
737
- | `UploadToolConfig` | _type_ | config for `mountUpload` |
738
- | `WaitToolConfig` | _type_ | config for `mountWait` |
739
-
740
- ### OAuth 2.1 provider
741
-
742
- A native remote-connector auth surface for MCP — [guide](../guide/mcp-and-agents.md#oauth-21--a-native-remote-connector).
743
-
744
- | Export | Kind | Summary |
745
- |--------|------|---------|
746
- | `mountOAuthProvider` | function | the OAuth 2.1 provider routes (DCR, PKCE, token) |
747
- | `oauthProtectedResourceRoute` | function | the RFC 9728 protected-resource-metadata route |
748
- | `protectedResourceMetadataUrl` | function | build the metadata URL for a resource |
749
- | `wwwAuthenticateHeader` | function | build the `WWW-Authenticate` challenge header |
750
- | `PROTECTED_RESOURCE_PATH` | const | the well-known metadata path |
751
- | `OAuthProviderConfig` | _type_ | config for `mountOAuthProvider` |
752
- | `ProtectedResourceConfig` | _type_ | config for `oauthProtectedResourceRoute` |
753
- | `ApplicationType` | _type_ | DCR `application_type` — `'native'` (loopback allowed) \| `'web'` (https only) |
754
- | `AuthCodeData` | _type_ | a stored authorization-code record |
755
- | `AuthRequest` | _type_ | a parsed authorization request |
756
- | `ClientMetadata` | _type_ | dynamic-client-registration metadata |
757
- | `RefreshData` | _type_ | a stored refresh-token record |
758
- | `RegisteredClient` | _type_ | a registered OAuth client |
759
-
760
- ### Durable tool bodies
761
-
762
- A mounted tool body can be made restartable without adopting `agent-runtime`: declare a
763
- factory and `step` / `sleep` / `waitFor` appear in the handler context, backed by whatever
764
- ledger the application already has.
765
-
766
- ```ts
767
- mountAgent(services, { durability: (toolCallId) => myLedgerFor(toolCallId) });
768
- ```
769
-
770
- | Export | Kind | Summary |
771
- |--------|------|---------|
772
- | `ToolDurability` | _type_ | the port a tool body needs: `step`, `sleep`, `waitFor` |
773
- | `ToolDurabilityFactory` | _type_ | `(toolCallId, signal) => ToolDurability`, called once per call |
774
- | `DurableJsonValue` | _type_ | what a durable step result may hold — a record is read back in another process, so it must be JSON |
775
- | `createLocalStepDurability` | function | the durability engine — replay, absolute deadlines, park/deliver — over a two-method ledger the application owns |
776
- | `StepDurabilityLedger` | _type_ | the two methods an engine needs: `appendEvent`, `readEvents` |
777
- | `LocalStepDurability` | _type_ | what the engine returns; satisfies `ToolDurability` and adds `deliver` and record introspection for the ledger's owner |
778
- | `LocalStepDurabilityOptions` | _type_ | `{ store, conversationId, runId, signal?, subscribe?, clock? }` |
779
- | `AppendAgentStoreEvent` / `ReadAgentStoreEvents` / `AgentStoreEventEnvelope` / `AgentStoreEventPage` | _type_ | the ledger's row shapes, re-exported so a ledger is typed from the entrypoint that consumes it |
780
- | `AgentToolError` | class | the model-safe envelope a failed agent tool throws |
781
- | `isAgentToolError` | function | brand check for it — a consumer running its own loop no longer parses the message |
782
-
783
- ### Catalog stamp
784
-
785
- Every advertised tool and every tool result carries the fingerprint of the catalog it came
786
- from, so a long-lived consumer can see that its own copy is stale **without making a
787
- request for it**. `createMcpHandler` is stateless by construction and therefore has no
788
- retained session to push `notifications/tools/list_changed` down; the stamp needs none.
789
-
790
- Store the stamp beside the tools when you list them, compare it against the one on every
791
- result, and re-list when they differ — including on a refusal, which is exactly when a
792
- stale catalog is the likeliest explanation and the least visible one. The server side
793
- needs no wiring: every mount stamps what it advertises.
794
-
795
- | Export | Kind | Summary |
796
- |--------|------|---------|
797
- | `readMcpCatalogStamp` | function | read a peer's stamp out of `_meta`, or `null` when there is none |
798
- | `mcpCatalogMeta` | function | the `_meta` fragment a stamped tool or result carries |
799
- | `MCP_CATALOG_META_KEY` | const | the namespaced `_meta` key (`stitchkit/catalog`) |
800
- | `McpCatalogStamp` | _type_ | `{ digest, tools }` — the catalog fingerprint and its tool count |
801
-
802
- ### MCP Apps (widgets)
803
-
804
- Interactive MCP resources — [ADR 0019](../decisions/0019-generic-native-tools.md).
805
-
806
- | Export | Kind | Summary |
807
- |--------|------|---------|
808
- | `mountMcpResource` | function | mount an MCP Apps widget resource |
809
- | `inlineMcpAppBundle` | function | inline a built widget bundle into a resource |
810
- | `EXT_APPS_BUNDLE_PLACEHOLDER` | const | the placeholder token `inlineMcpAppBundle` replaces |
811
- | `RESOURCE_MIME_TYPE` | const | the MCP Apps resource MIME type |
812
- | `McpResourceDef` | _type_ | an MCP Apps resource definition |
813
- | `McpAppResourceMeta` | _type_ | resource `_meta` for an MCP App |
814
- | `McpAppCsp` | _type_ | the widget content-security policy |
815
-
816
- ### Introspection & internals
817
-
818
- Advanced building blocks — the shared machinery the mounts are built on.
819
-
820
- | Export | Kind | Summary |
821
- |--------|------|---------|
822
- | `collectTools` | function | resolve a service's methods to mountable tools (the shared resolver) |
823
- | `createToolLogger` | function | a ready `afterToolCall` that logs every tool call — [guide](../guide/mcp-and-agents.md#logging-tool-calls--createtoollogger) |
824
- | `summarizeTransports` | function | mixed contract/runtime operation counts and per-source breakdown for a boot-time summary |
825
- | `buildToolManifest` | function | transport-aware searchable `{ name, description, inputSchema }` rows from a mixed surface |
826
- | `ToolLoggerConfig` | _type_ | config for `createToolLogger` |
827
- | `ToolCallRecord` | _type_ | the structured record `createToolLogger` passes to `onRecord` |
828
- | `TransportSummary` | _type_ | `{ contractServices, runtimeTools, totals, sources }` from `summarizeTransports` |
829
- | `TransportCounts` | _type_ | per-transport counts (`{ HTTP, MCP, AGENT, CLI }`) |
830
- | `ToolSurfaceDefinition` | _type_ | shared object-shaped `{ services?, runtimeTools? }` introspection surface |
831
- | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
832
- | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments |
833
- | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; divergent fields retain every provable base kind in a deterministic `type` array, and the projection never executes validation |
834
- | `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
835
- | `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
836
- | `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
837
-
838
- ---