stitchkit 0.94.0 → 0.94.1

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 (346) hide show
  1. package/CHANGELOG.md +64 -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/runtime.d.ts +1 -1
  22. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  23. package/dist/agent-runtime/schedule-records.d.ts +34 -0
  24. package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
  25. package/dist/agent-runtime/schedules.d.ts +34 -0
  26. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  27. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
  28. package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
  29. package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
  30. package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
  31. package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
  32. package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
  33. package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
  34. package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
  35. package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
  36. package/dist/application/admission-rate.d.ts +21 -0
  37. package/dist/application/admission-rate.d.ts.map +1 -0
  38. package/dist/application/admission-run.d.ts +8 -0
  39. package/dist/application/admission-run.d.ts.map +1 -0
  40. package/dist/application/admission.d.ts.map +1 -1
  41. package/dist/application/diagnostic-journal-lock.d.ts +9 -34
  42. package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
  43. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  44. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  45. package/dist/application/kernel-resource-context.d.ts.map +1 -1
  46. package/dist/application/notification-outbox.d.ts.map +1 -1
  47. package/dist/application/schedule.d.ts +0 -1
  48. package/dist/application/schedule.d.ts.map +1 -1
  49. package/dist/application/watch-hub-core.d.ts +122 -0
  50. package/dist/application/watch-hub-core.d.ts.map +1 -0
  51. package/dist/application/watch-hub.d.ts +2 -2
  52. package/dist/application/watch-hub.d.ts.map +1 -1
  53. package/dist/browser/client-executors.d.ts +14 -0
  54. package/dist/browser/client-executors.d.ts.map +1 -0
  55. package/dist/browser/client-multipart.d.ts +1 -1
  56. package/dist/browser/client-multipart.d.ts.map +1 -1
  57. package/dist/browser/client.d.ts +3 -2
  58. package/dist/browser/client.d.ts.map +1 -1
  59. package/dist/browser/http-fetch.d.ts +22 -0
  60. package/dist/browser/http-fetch.d.ts.map +1 -0
  61. package/dist/browser/http.d.ts +1 -3
  62. package/dist/browser/http.d.ts.map +1 -1
  63. package/dist/browser/live-state-core.d.ts +63 -0
  64. package/dist/browser/live-state-core.d.ts.map +1 -0
  65. package/dist/browser/live-state.d.ts.map +1 -1
  66. package/dist/browser/realtime-client.d.ts +26 -0
  67. package/dist/browser/realtime-client.d.ts.map +1 -0
  68. package/dist/browser/socket-io-connection.d.ts +82 -0
  69. package/dist/browser/socket-io-connection.d.ts.map +1 -0
  70. package/dist/browser/socket-io-peer.d.ts +20 -0
  71. package/dist/browser/socket-io-peer.d.ts.map +1 -0
  72. package/dist/browser/socket-io-trace.d.ts +31 -0
  73. package/dist/browser/socket-io-trace.d.ts.map +1 -0
  74. package/dist/browser/socket-io.d.ts +2 -18
  75. package/dist/browser/socket-io.d.ts.map +1 -1
  76. package/dist/contract/client-types.d.ts +134 -0
  77. package/dist/contract/client-types.d.ts.map +1 -0
  78. package/dist/contract/define-validation.d.ts +30 -0
  79. package/dist/contract/define-validation.d.ts.map +1 -0
  80. package/dist/contract/define.d.ts +3 -357
  81. package/dist/contract/define.d.ts.map +1 -1
  82. package/dist/contract/runtime-context.d.ts +131 -0
  83. package/dist/contract/runtime-context.d.ts.map +1 -0
  84. package/dist/contract/tool-options.d.ts +105 -0
  85. package/dist/contract/tool-options.d.ts.map +1 -0
  86. package/dist/contract/tool-view.d.ts +15 -2
  87. package/dist/contract/tool-view.d.ts.map +1 -1
  88. package/dist/durability/contract.d.ts +83 -0
  89. package/dist/durability/contract.d.ts.map +1 -1
  90. package/dist/durability/effect.d.ts +24 -0
  91. package/dist/durability/effect.d.ts.map +1 -0
  92. package/dist/durability/engine.d.ts +2 -2
  93. package/dist/durability/engine.d.ts.map +1 -1
  94. package/dist/durability/events.d.ts +2 -0
  95. package/dist/durability/events.d.ts.map +1 -1
  96. package/dist/durability/ledger.d.ts +11 -0
  97. package/dist/durability/ledger.d.ts.map +1 -1
  98. package/dist/durability/parks.d.ts +22 -0
  99. package/dist/durability/parks.d.ts.map +1 -0
  100. package/dist/durability/scheduler.d.ts +1 -0
  101. package/dist/durability/scheduler.d.ts.map +1 -1
  102. package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
  103. package/dist/entrypoints/agent-runtime/harness.js +127 -116
  104. package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
  105. package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
  106. package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
  107. package/dist/entrypoints/agent-runtime/testing.js +246 -214
  108. package/dist/entrypoints/agent-runtime.js +224 -203
  109. package/dist/entrypoints/application/diagnostic-journal.js +63 -203
  110. package/dist/entrypoints/application/opentelemetry.js +1 -1
  111. package/dist/entrypoints/application.js +361 -324
  112. package/dist/entrypoints/cli.d.ts +4 -1
  113. package/dist/entrypoints/cli.d.ts.map +1 -1
  114. package/dist/entrypoints/cli.js +57 -35
  115. package/dist/entrypoints/contract.d.ts +5 -2
  116. package/dist/entrypoints/contract.d.ts.map +1 -1
  117. package/dist/entrypoints/contract.js +3 -2
  118. package/dist/entrypoints/files.d.ts +2 -0
  119. package/dist/entrypoints/files.d.ts.map +1 -1
  120. package/dist/entrypoints/files.js +98 -2
  121. package/dist/entrypoints/index.d.ts +4 -2
  122. package/dist/entrypoints/index.d.ts.map +1 -1
  123. package/dist/entrypoints/index.js +348 -282
  124. package/dist/entrypoints/live.js +89 -71
  125. package/dist/entrypoints/node.d.ts +2 -1
  126. package/dist/entrypoints/node.d.ts.map +1 -1
  127. package/dist/entrypoints/node.js +13 -12
  128. package/dist/entrypoints/react.js +1 -1
  129. package/dist/entrypoints/remote.js +4 -4
  130. package/dist/entrypoints/server.d.ts +4 -2
  131. package/dist/entrypoints/server.d.ts.map +1 -1
  132. package/dist/entrypoints/server.js +293 -79
  133. package/dist/entrypoints/testing.d.ts +2 -1
  134. package/dist/entrypoints/testing.d.ts.map +1 -1
  135. package/dist/entrypoints/testing.js +288 -281
  136. package/dist/entrypoints/tools/connections.js +2 -2
  137. package/dist/entrypoints/tools/invoker.js +4 -4
  138. package/dist/entrypoints/tools.d.ts +6 -3
  139. package/dist/entrypoints/tools.d.ts.map +1 -1
  140. package/dist/entrypoints/tools.js +245 -202
  141. package/dist/entrypoints/tracking.js +325 -274
  142. package/dist/files/boundary.d.ts.map +1 -1
  143. package/dist/files/file-io.d.ts +14 -0
  144. package/dist/files/file-io.d.ts.map +1 -0
  145. package/dist/index-1j8pm5t0.js +412 -0
  146. package/dist/{index-kvj7f4hq.js → index-2bxbyab0.js} +10 -2
  147. package/dist/{index-xnj9bgxe.js → index-2gxzjvyr.js} +2 -162
  148. package/dist/index-4gcnakhx.js +82 -0
  149. package/dist/{index-j05z5gn4.js → index-55hkhm67.js} +136 -119
  150. package/dist/{index-cq4qfycf.js → index-79z7m7dt.js} +227 -59
  151. package/dist/{index-97ac4gph.js → index-7f68ghdn.js} +3 -3
  152. package/dist/{index-r7nmqpsg.js → index-7p1f0vp2.js} +1 -1
  153. package/dist/{index-dcpdvjsc.js → index-863ea9jb.js} +4 -4
  154. package/dist/index-8p52kd5p.js +242 -0
  155. package/dist/{index-2qzskm8h.js → index-dce5wxcq.js} +1 -1
  156. package/dist/index-e01r054k.js +105 -0
  157. package/dist/{index-sees8yf8.js → index-ensd0r74.js} +118 -111
  158. package/dist/{index-1nd48tm9.js → index-gxrt5h6v.js} +2 -1
  159. package/dist/{index-e87kakm4.js → index-ham5sz8m.js} +112 -110
  160. package/dist/{index-kj2wbeta.js → index-het2he5g.js} +280 -196
  161. package/dist/{index-vcvkq30w.js → index-hmp4800j.js} +3 -3
  162. package/dist/{index-gyr48nzg.js → index-k30h66yd.js} +71 -151
  163. package/dist/{index-2cr1cqhn.js → index-khtgb21r.js} +2 -2
  164. package/dist/{index-x4799c19.js → index-ndddxtyx.js} +11 -11
  165. package/dist/{index-dydjcp8z.js → index-np4m8hd3.js} +38 -36
  166. package/dist/{index-p81267c2.js → index-p3vsv1fb.js} +621 -357
  167. package/dist/{index-mp5sn43f.js → index-p9e0w8hs.js} +2 -2
  168. package/dist/{index-rewkc2hj.js → index-p9sh0xx4.js} +3 -3
  169. package/dist/{index-70yj2ebz.js → index-paz6sgdp.js} +107 -103
  170. package/dist/{index-bn2cjajt.js → index-px2gm2jp.js} +26 -102
  171. package/dist/index-s812ycat.js +65 -0
  172. package/dist/{index-xsqjkha9.js → index-sp1tzwnb.js} +2 -2
  173. package/dist/{index-n6hxg8as.js → index-t9rhjr9f.js} +615 -566
  174. package/dist/{index-zeemqhqx.js → index-v260df89.js} +88 -80
  175. package/dist/{index-fdp6hdxn.js → index-w906953s.js} +5 -1
  176. package/dist/{index-mdzh02yc.js → index-wdkt63w3.js} +1 -1
  177. package/dist/{index-58k4fp34.js → index-wsm5w4ee.js} +1 -1
  178. package/dist/{index-v38qyerb.js → index-xw3s75nj.js} +1 -1
  179. package/dist/internal/atomic-file.d.ts +23 -2
  180. package/dist/internal/atomic-file.d.ts.map +1 -1
  181. package/dist/internal/exclusive-lock.d.ts +51 -0
  182. package/dist/internal/exclusive-lock.d.ts.map +1 -0
  183. package/dist/internal/process-identity.d.ts +47 -0
  184. package/dist/internal/process-identity.d.ts.map +1 -0
  185. package/dist/internal/with-exclusive-lock.d.ts +67 -0
  186. package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
  187. package/dist/live/watch-client.d.ts.map +1 -1
  188. package/dist/observability/audit.d.ts +2 -2
  189. package/dist/observability/audit.d.ts.map +1 -1
  190. package/dist/observability/event.d.ts +2 -1
  191. package/dist/observability/event.d.ts.map +1 -1
  192. package/dist/primitives/export-operation.d.ts +1 -1
  193. package/dist/primitives/export-operation.d.ts.map +1 -1
  194. package/dist/realtime/registry.d.ts +0 -5
  195. package/dist/realtime/registry.d.ts.map +1 -1
  196. package/dist/server/bun.d.ts +0 -1
  197. package/dist/server/bun.d.ts.map +1 -1
  198. package/dist/server/context-contribution.d.ts +1 -1
  199. package/dist/server/context-contribution.d.ts.map +1 -1
  200. package/dist/server/context.d.ts +1 -1
  201. package/dist/server/context.d.ts.map +1 -1
  202. package/dist/server/endpoint-response.d.ts +2 -1
  203. package/dist/server/endpoint-response.d.ts.map +1 -1
  204. package/dist/server/error-dispatch.d.ts +1 -1
  205. package/dist/server/error-dispatch.d.ts.map +1 -1
  206. package/dist/server/error-hook.d.ts +1 -1
  207. package/dist/server/error-hook.d.ts.map +1 -1
  208. package/dist/server/handler-state.d.ts +1 -1
  209. package/dist/server/handler-state.d.ts.map +1 -1
  210. package/dist/server/implement-registry.d.ts +54 -0
  211. package/dist/server/implement-registry.d.ts.map +1 -0
  212. package/dist/server/implement.d.ts +9 -55
  213. package/dist/server/implement.d.ts.map +1 -1
  214. package/dist/server/middleware/auth.d.ts +1 -31
  215. package/dist/server/middleware/auth.d.ts.map +1 -1
  216. package/dist/server/middleware/jwt.d.ts +31 -0
  217. package/dist/server/middleware/jwt.d.ts.map +1 -0
  218. package/dist/server/multipart-reader.d.ts +22 -0
  219. package/dist/server/multipart-reader.d.ts.map +1 -0
  220. package/dist/server/multipart.d.ts +1 -1
  221. package/dist/server/multipart.d.ts.map +1 -1
  222. package/dist/server/oauth/cimd.d.ts +88 -0
  223. package/dist/server/oauth/cimd.d.ts.map +1 -0
  224. package/dist/server/oauth/endpoints.d.ts +39 -0
  225. package/dist/server/oauth/endpoints.d.ts.map +1 -0
  226. package/dist/server/oauth/provider.d.ts +1 -68
  227. package/dist/server/oauth/provider.d.ts.map +1 -1
  228. package/dist/server/streaming-pump.d.ts +66 -0
  229. package/dist/server/streaming-pump.d.ts.map +1 -0
  230. package/dist/server/streaming-route.d.ts +12 -5
  231. package/dist/server/streaming-route.d.ts.map +1 -1
  232. package/dist/server/types.d.ts +4 -1
  233. package/dist/server/types.d.ts.map +1 -1
  234. package/dist/server/unix-client-bun.d.ts.map +1 -1
  235. package/dist/server/unix-client-http1.d.ts +76 -0
  236. package/dist/server/unix-client-http1.d.ts.map +1 -0
  237. package/dist/server/unix-client.d.ts.map +1 -1
  238. package/dist/testing/handler-clients.d.ts +2 -1
  239. package/dist/testing/handler-clients.d.ts.map +1 -1
  240. package/dist/testing/realtime-probe.d.ts +33 -0
  241. package/dist/testing/realtime-probe.d.ts.map +1 -0
  242. package/dist/testing/surface-conformance.d.ts +0 -31
  243. package/dist/testing/surface-conformance.d.ts.map +1 -1
  244. package/dist/testing/surface-manifest-digest.d.ts +44 -0
  245. package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
  246. package/dist/testing/surface-manifest.d.ts.map +1 -1
  247. package/dist/tools/agent.d.ts +1 -1
  248. package/dist/tools/agent.d.ts.map +1 -1
  249. package/dist/tools/cli/args-fields.d.ts +31 -0
  250. package/dist/tools/cli/args-fields.d.ts.map +1 -0
  251. package/dist/tools/cli/args-route.d.ts +42 -0
  252. package/dist/tools/cli/args-route.d.ts.map +1 -0
  253. package/dist/tools/cli/args-view.d.ts +32 -0
  254. package/dist/tools/cli/args-view.d.ts.map +1 -0
  255. package/dist/tools/cli/args.d.ts +2 -65
  256. package/dist/tools/cli/args.d.ts.map +1 -1
  257. package/dist/tools/cli/argument-error.d.ts +5 -0
  258. package/dist/tools/cli/argument-error.d.ts.map +1 -0
  259. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  260. package/dist/tools/cli/command.d.ts +1 -1
  261. package/dist/tools/cli/command.d.ts.map +1 -1
  262. package/dist/tools/cli/config.d.ts +1 -1
  263. package/dist/tools/cli/config.d.ts.map +1 -1
  264. package/dist/tools/cli/format.d.ts +2 -1
  265. package/dist/tools/cli/format.d.ts.map +1 -1
  266. package/dist/tools/cli/invoke.d.ts +2 -1
  267. package/dist/tools/cli/invoke.d.ts.map +1 -1
  268. package/dist/tools/cli/managed-surface.d.ts +1 -1
  269. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  270. package/dist/tools/cli/policy.d.ts +1 -1
  271. package/dist/tools/cli/policy.d.ts.map +1 -1
  272. package/dist/tools/cli/prepare.d.ts.map +1 -1
  273. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  274. package/dist/tools/cli/session.d.ts +1 -1
  275. package/dist/tools/cli/session.d.ts.map +1 -1
  276. package/dist/tools/cli/update.d.ts +19 -0
  277. package/dist/tools/cli/update.d.ts.map +1 -1
  278. package/dist/tools/cli/view.d.ts +1 -1
  279. package/dist/tools/cli/view.d.ts.map +1 -1
  280. package/dist/tools/cli/wait.d.ts +1 -1
  281. package/dist/tools/cli/wait.d.ts.map +1 -1
  282. package/dist/tools/connections/runtime.d.ts +1 -1
  283. package/dist/tools/connections/runtime.d.ts.map +1 -1
  284. package/dist/tools/execute-args.d.ts +23 -0
  285. package/dist/tools/execute-args.d.ts.map +1 -0
  286. package/dist/tools/execute-hooks.d.ts +146 -0
  287. package/dist/tools/execute-hooks.d.ts.map +1 -0
  288. package/dist/tools/execute-result.d.ts +40 -0
  289. package/dist/tools/execute-result.d.ts.map +1 -0
  290. package/dist/tools/execute.d.ts +4 -193
  291. package/dist/tools/execute.d.ts.map +1 -1
  292. package/dist/tools/internal/surface-projector.d.ts +2 -1
  293. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  294. package/dist/tools/invoker.d.ts +2 -1
  295. package/dist/tools/invoker.d.ts.map +1 -1
  296. package/dist/tools/lifecycle.d.ts +1 -1
  297. package/dist/tools/lifecycle.d.ts.map +1 -1
  298. package/dist/tools/mcp/mount.d.ts +1 -1
  299. package/dist/tools/mcp/mount.d.ts.map +1 -1
  300. package/dist/tools/mcp/prepare.d.ts +2 -1
  301. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  302. package/dist/tools/mcp/progress.d.ts +1 -1
  303. package/dist/tools/mcp/progress.d.ts.map +1 -1
  304. package/dist/tools/mcp/register.d.ts +3 -2
  305. package/dist/tools/mcp/register.d.ts.map +1 -1
  306. package/dist/tools/mcp/round-context.d.ts +38 -0
  307. package/dist/tools/mcp/round-context.d.ts.map +1 -0
  308. package/dist/tools/mcp/round-policy.d.ts +1 -1
  309. package/dist/tools/mcp/round-policy.d.ts.map +1 -1
  310. package/dist/tools/mcp/round.d.ts +3 -11
  311. package/dist/tools/mcp/round.d.ts.map +1 -1
  312. package/dist/tools/mcp/runtime-tools.d.ts +2 -1
  313. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  314. package/dist/tools/mount.d.ts +3 -1
  315. package/dist/tools/mount.d.ts.map +1 -1
  316. package/dist/tools/native-definition.d.ts +2 -1
  317. package/dist/tools/native-definition.d.ts.map +1 -1
  318. package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -1
  319. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  320. package/dist/tools/operations/async-operation-runtime-types.d.ts +2 -1
  321. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  322. package/dist/tools/remote.d.ts.map +1 -1
  323. package/dist/tools/runtime-tool.d.ts +3 -1
  324. package/dist/tools/runtime-tool.d.ts.map +1 -1
  325. package/dist/tools/tool-logger.d.ts +1 -1
  326. package/dist/tools/tool-logger.d.ts.map +1 -1
  327. package/dist/tracking/client-listeners.d.ts +30 -0
  328. package/dist/tracking/client-listeners.d.ts.map +1 -0
  329. package/dist/tracking/client-visit.d.ts +61 -0
  330. package/dist/tracking/client-visit.d.ts.map +1 -0
  331. package/dist/tracking/client.d.ts +3 -2
  332. package/dist/tracking/client.d.ts.map +1 -1
  333. package/llms/application.2.txt +266 -2
  334. package/llms/application.txt +8 -266
  335. package/llms/cli.2.txt +80 -0
  336. package/llms/cli.txt +45 -74
  337. package/llms/contract.txt +3 -3
  338. package/llms/files.txt +3 -0
  339. package/llms/tools.2.txt +88 -279
  340. package/llms/tools.3.txt +288 -0
  341. package/llms/tools.txt +27 -65
  342. package/llms-full.txt +108 -12
  343. package/llms.txt +5 -5
  344. package/package.json +1 -1
  345. package/dist/index-e2z3ahw9.js +0 -325
  346. package/dist/index-mkm15s49.js +0 -394
package/llms/cli.txt CHANGED
@@ -1,9 +1,12 @@
1
- # stitchkit/cli — stitchkit docs slice
1
+ # stitchkit/cli — stitchkit docs slice, part 1 of 2
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/cli.2.txt`.
5
6
 
6
- Contains: Guide: CLI (docs/guide/cli.md) · API reference: `stitchkit/cli` (docs/api/reference.md)
7
+ Parts of this slice:
8
+ - `llms/cli.txt`: Guide: CLI (docs/guide/cli.md)
9
+ - `llms/cli.2.txt`: API reference: `stitchkit/cli` (docs/api/reference.md)
7
10
 
8
11
  ==============================================================================
9
12
  # Guide: CLI (docs/guide/cli.md)
@@ -202,6 +205,15 @@ fields in declaration order, so `myapp generate "a fox"` is
202
205
  `--prompt "a fox"`. A piped value fills the first required unset field:
203
206
  `echo "a fox" | myapp generate`.
204
207
 
208
+ A token is an option only when it is a long form (`--name`, `--name=value`,
209
+ `--`) or `-` followed by a letter. Anything else that starts with `-` is data:
210
+ `myapp note a "- item"` fills a positional, and after an option that expects a
211
+ value the next token is that value — `--grep -foo`, `--count -5`. The next
212
+ token is refused as a value only when it is itself an option, so `--grep --json`
213
+ still reports that `--grep` requires a value. A value that cannot be read as
214
+ its field's type is refused naming the flag and what was typed:
215
+ `--tail expects a whole number, got "abc"`.
216
+
205
217
  For a stable shell grammar, declare the default command, short aliases and the
206
218
  exact positional fields on `createCli`:
207
219
 
@@ -674,6 +686,37 @@ nothing to keep, which is not a failure.
674
686
  happens to be at the backup path is a second install of an unverified binary,
675
687
  and the day it is used is the day nobody is in a position to check.
676
688
 
689
+ ### Run it before it replaces anything — `verify`
690
+
691
+ A digest proves the bytes are the ones published, not that they load. A tool
692
+ that updates itself unattended — a daemon — and installs a build that does not
693
+ start takes its own updater down with it, and every machine is then repaired by
694
+ hand. `verify` is the step between "digest matched" and "target replaced":
695
+
696
+ ```ts
697
+ await applyCliUpdate({
698
+ asset, targetPath, backupPath,
699
+ verify: async (candidate, signal) => {
700
+ const child = Bun.spawn(['bun', candidate, 'version'], { signal, stdout: 'pipe' })
701
+ const printed = (await new Response(child.stdout).text()).trim()
702
+ if ((await child.exited) !== 0 || printed !== check.version) {
703
+ throw new Error(`printed ${printed}, expected ${check.version}`)
704
+ }
705
+ },
706
+ verifyTimeoutMs: 15_000, // default 30 000
707
+ })
708
+ ```
709
+
710
+ The verified bytes are written beside the target as an executable candidate
711
+ with the target's extension, and `verify` gets its path — a path rather than a
712
+ command, because a JavaScript bundle is started through its runtime. It runs
713
+ before the backup and the replacement. If it throws or outlives
714
+ `verifyTimeoutMs` (its `signal` aborts at the deadline), the candidate is
715
+ removed, the target and any earlier backup are untouched, and the update is
716
+ refused with the reason as its cause. The target is written from the checked
717
+ bytes in memory, never from the candidate file, so nothing the candidate did
718
+ while it ran can change what is installed.
719
+
677
720
  ### Two release tracks
678
721
 
679
722
  `assertCliPublishable` takes one manifest **or every manifest already
@@ -903,75 +946,3 @@ File-upload (`multipart`) contract endpoints remain CLI-invisible, the same as
903
946
  on MCP/Agent: their wire body is not a JSON tool form. Model file-oriented
904
947
  application behavior as a managed pathless command, or binary-only behavior as
905
948
  a native command. Streaming (SSE) output is not yet piped to stdout.
906
-
907
- ==============================================================================
908
- # API reference: `stitchkit/cli` (docs/api/reference.md)
909
- ==============================================================================
910
-
911
- ## `stitchkit/cli`
912
-
913
- Server-only. Composes contract/runtime managed operations and CLI-only native
914
- commands into one command-line program. Light by design: needs neither the MCP
915
- SDK nor the `ai` peer.
916
-
917
- | Export | Kind | Summary |
918
- |--------|------|---------|
919
- | `createCli` | function | build and run a CLI from contracts — [guide](../guide/cli.md) |
920
- | `defineCliCommand` | function | define one Zod-typed CLI-only executable command with optional validated-result presentation/exit policy |
921
- | `parseCliArgs` | function | argv → typed tool args against a schema (advanced) |
922
- | `routeCliArgv` | function | select the command out of argv without duplicating the global-option grammar (advanced) |
923
- | `extractCliGlobalOptions` | function | lift the application's own global options out of argv before routing (advanced) |
924
- | `coerceJsonArgs` | function | the second half of `parseCliArgs` — parse array/object values a consumer sends itself, without the `stitchkit/tools` barrel |
925
- | `CliArgumentError` | class | the refusal `parseCliArgs` and the view flags raise; a CLI reports it and exits `2` |
926
- | `renderCliView` | function | compute an aggregate over a result (`--count-by`, `--sum`, `--top`, `--table`) — [guide](../guide/cli.md#aggregate-views) |
927
- | `createCliProfileStore` | function | named `0600` credential profiles resolved by name, with the never-substitute rule built in — [guide](../guide/cli.md#named-profiles) |
928
- | `CliProfileError` | class | an `AppError` refusing a named profile that is missing, unreadable or shared between users |
929
- | `renderCliInstaller` | function | generate the one-line installer from a build manifest, with the URL and digest substituted — [guide](../guide/cli.md#distribution-and-self-update) |
930
- | `checkCliUpdate` | function | bounded, interval-limited, never-throwing check for a newer published build |
931
- | `applyCliUpdate` | function | download, verify the decompressed digest and replace the binary by rename |
932
- | `assertCliPublishable` | function | refuse republishing one version from a different commit — takes one manifest or every manifest already published, because the promise a version makes does not stop at a channel boundary |
933
- | `rollbackCliUpdate` / `CliRollbackConfig` / `RolledBackCliUpdate` | function / _types_ | put the kept previous build back, digest-checked first and written by the same atomic rename the update uses |
934
- | `signCliManifest` / `verifyCliManifest` / `cliManifestSigningPayload` | function | Ed25519 over `{name, version, commit, builtAt, assets[]}` — every asset's digest included, so the chain closes on the file that executes |
935
- | `cliSignatureAccepted` / `CliSignatureVerdict` | function / _type_ | `valid` \| `unenforced` \| `missing` \| `unknown-key` \| `invalid`; `unenforced` keeps an unpinned build updating while making the absence of a check visible |
936
- | `CliTrustRoot` / `CliSigningKey` / `CliBuildSignature` / `CliBuildSignatureSchema` | _types_ / schema | the keys a build trusts, by id, and the detached signature a manifest carries |
937
- | `selectCliBuildAsset` | function | the asset for one target, or `undefined` |
938
- | `currentCliBuildTarget` | function | `{ platform, arch }` of the running process |
939
- | `formatCliBuildStamp` | function | one line saying what the running build is |
940
- | `compareCliVersions` | function | compare two versions, or `undefined` when they are not comparable |
941
- | `CliBuildManifestSchema` / `CliBuildManifest` | schema / _type_ | name, version, commit, build time and assets |
942
- | `CliBuildAssetSchema` / `CliBuildAsset` | schema / _type_ | one download; `size` and `sha256` describe the **decompressed** bytes |
943
- | `CliBuildTargetSchema` / `CliBuildTarget` | schema / _type_ | `{ platform, arch }` |
944
- | `CliBuildStampSchema` / `CliBuildStamp` | schema / _type_ | the version/commit/build time carried inside a binary |
945
- | `CliInstallerConfig` | _type_ | manifest, binary name, default install directory, and an optional `asset` — omit it for one script that selects the target by `uname` |
946
- | `CliUpdateCheckConfig` / `CliUpdateCheck` | _type_ | check inputs, and its four answers — `skipped`, `current`, `outdated`, `unknown` |
947
- | `CliUpdateApplyConfig` / `AppliedCliUpdate` | _type_ | apply inputs and the replaced path, byte count and digest |
948
- | `CliProfileStore` / `CliProfileStoreConfig` / `ResolvedCliProfile` | _type_ | the profile store, its directory/schema/hint config, and one resolution |
949
- | `CliResultView` | _type_ | the requested view — `count`, `sum`, or `records` (ordered and/or table-rendered) |
950
- | `CliViewOutput` | _type_ | a JSON value, or the one human-facing text shape |
951
- | `CliGlobalOptionsParse` | _type_ | `{ argv, globals }` returned by `extractCliGlobalOptions` |
952
- | `CliArgvRoute` | _type_ | `{ command, commandArgv, topLevelHelp, version, error? }` returned by `routeCliArgv` |
953
- | `pollUntilDone` | function | the generic `--wait` poller (advanced) |
954
- | `emitResult` | function | write a pretty or compact `ToolResult` record to stdout/stderr + exit code (advanced) |
955
- | `cliExitCode` | function | the exit code a result earns, from the same table, without writing anything — so an in-process run and the printed path cannot disagree |
956
- | `createCliInvoker` / `CliInvoker` / `CliInvokerConfig` / `CliInvocationResult` / `CliInvokerCommand` / `cliInvocationResult` | function / _types_ | compile the managed surface once and run parsed calls against it in process — no argv round-trip, no child process, no writing |
957
- | `defineCliStreamCommand` / `CliStreamCommandConfig` / `CliStreamAnswer` / `CliStreamHooks` / `runCliStream` | function / _types_ | one operation per JSON line of stdin, answered with the same `id`; a bad line answers and the stream continues |
958
- | `defineCliBatchCommand` / `CliBatchCommandConfig` | function / _type_ | the same loop, resumable: a recorded line replays, a line whose content changed under the same id is refused |
959
- | `readCliCheckpoint` / `writeCliCheckpoint` / `CliCheckpoint` / `CliCheckpointEntry` | function / _types_ | the batch's record — id plus a digest of the line, written by atomic rename after every line |
960
- | `DEFAULT_EXIT_CODES` | const | the default `ToolResult.code` → exit-code map |
961
- | `CliConfig` | _type_ | config for `createCli`; `defaultCommand`, `globalOptions`, `optionAliases` and `positionals` define the shared command presentation policy |
962
- | `CliPresentationPolicyConfig` | _type_ | shared command presentation-policy subset of `CliConfig` |
963
- | `CliSurfaceSource` | _type_ | static service/runtime array or identity-dependent factory |
964
- | `CliCommandDefinition` | _type_ | native command definition union |
965
- | `CliCommandDefinitionBase` | _type_ | native command name, description and input schema |
966
- | `CliCommandDefinitionWithOutput` | _type_ | native command with validated declared output and typed optional `present` / successful `exitCode` callbacks |
967
- | `CliCommandDefinitionWithoutOutput` | _type_ | native void command without an output contract |
968
- | `CliCommandContext` | _type_ | parsed input, framework run options, the application's `globals` and stdout/stderr writers |
969
- | `CliRunOptions` | _type_ | parsed global flags (`--json` compacts success/error records, `--wait`, …) |
970
- | `ParsedCliArgs` | _type_ | result of `parseCliArgs` |
971
- | `CliWaitConfig` | _type_ | per-command `--wait` polling config; optional `failed(result)` maps a terminal domain failure to `WAIT_FAILED` and a non-zero exit |
972
- | `ExitCodeMap` | _type_ | `ToolResult.code` → process exit code |
973
- | `PollParams` | _type_ | params for `pollUntilDone` |
974
- | `CliWriters` | _type_ | stdout/stderr sinks for `emitResult` |
975
- | `EmitOptions` | _type_ | options for `emitResult` |
976
-
977
- ---
package/llms/contract.txt CHANGED
@@ -213,7 +213,7 @@ endpoint that can never be a tool (a raw response, a stream, `responseMeta`,
213
213
  | `tool.` | Purpose |
214
214
  |---------|---------|
215
215
  | `name` | explicit tool name (default: a verb-aware derivation, below) |
216
- | `view` | a different answer on MCP / agent / CLI — input defaults and a projected, separately validated output; declared only with `withToolView` — see [MCP & agents](./mcp-and-agents.md#a-different-answer-for-tools--withtoolview) |
216
+ | `view` | a different call or answer on MCP / agent / CLI — input defaults alone, or with a projected, separately validated output; declared only with `withToolView` — see [MCP & agents](./mcp-and-agents.md#a-different-answer-for-tools--withtoolview) |
217
217
  | `ui` | MCP Apps widget for the tool's results — see [MCP & agents](./mcp-and-agents.md) |
218
218
  | `annotations` | MCP behavioural hints (`readOnlyHint`, `destructiveHint`, `title`, …) |
219
219
  | `mcp` | elicitation rounds asked before the handler runs (`inputRequired`) |
@@ -518,12 +518,12 @@ from the root `stitchkit`.
518
518
  | `PathParams` | _type_ | infer named `:segments` and a terminal `*wildcard` from a path literal as string params |
519
519
  | `ContractMeta` | _type_ | a contract's `prefix` + optional `scope` and `meta` (a default every endpoint shallow-merges over) |
520
520
  | `EndpointDef` | _type_ | a single endpoint definition; `output` declares JSON response presence (`null` is data, `undefined` is invalid); `safelistedBody: true` admits the JSON body as `text/plain` from an allow-listed `Origin` — [guide](../guide/server.md#safelisted-request-bodies-beacons) |
521
- | `withToolView` | function | declare an endpoint's answer on the tool surface (MCP, AGENT, CLI): input `defaults`, a view `output` and an optional `project`, typed against the endpoint's own schemas; HTTP keeps the full answer — [guide](../guide/mcp-and-agents.md#a-different-answer-for-tools--withtoolview) |
521
+ | `withToolView` | function | declare an endpoint's call and answer on the tool surface (MCP, AGENT, CLI): input `defaults`, and optionally a view `output` and a `project`, typed against the endpoint's own schemas; HTTP keeps the full answer — [guide](../guide/mcp-and-agents.md#a-different-answer-for-tools--withtoolview) |
522
522
  | `EndpointToolOptions` | _type_ | an endpoint's `tool` group — `name`, `view`, `ui`, `annotations`, `mcp`: what the tool surfaces read that HTTP does not |
523
523
  | `EndpointToolView` | _type_ | the stored shape of a tool view (`MethodDef.toolView`) |
524
524
  | `DeclaredToolView` | _type_ | a tool view as `withToolView` produces it — the only form `tool.view` accepts |
525
525
  | `WithToolView` | _type_ | the endpoint `withToolView` returns: its own tool options plus the declared view in `tool.view` — name it when a helper returns such an endpoint |
526
- | `ProjectedToolView` / `ReshapedToolView` / `SlicedToolView` | _type_ | the three forms `withToolView` accepts: own schema + `project`, `project` inside the full schema, a slice by `output` |
526
+ | `DefaultsOnlyToolView` / `ProjectedToolView` / `ReshapedToolView` / `SlicedToolView` | _type_ | the four forms `withToolView` accepts: input `defaults` alone with the full answer, own schema + `project`, `project` inside the full schema, a slice by `output` |
527
527
  | `ToolViewCall` | _type_ | what `project` is told besides the full result: the parsed `input` and the `source` |
528
528
  | `ToolViewSliceMismatch` | _type_ | the compile-time refusal of a slice whose schema does not accept the full output |
529
529
  | `ToolViewNeedsToolTransport` | _type_ | the compile-time refusal of a view on an `expose: ['HTTP']` endpoint |
package/llms/files.txt CHANGED
@@ -26,5 +26,8 @@ available from `stitchkit/contract`.
26
26
  | `ManagedFileError` / `ManagedFileErrorCode` | class / _type_ | stable boundary failures; registered `FILE_*` mistakes are caller-safe while `FILE_IO_ERROR` remains internal |
27
27
  | `ManagedFileInspector` | _type_ | bounded-prefix read/write inspection callback with a finite cancellation signal that cannot own path or size |
28
28
  | `ManagedFileInspectionInput` / `ManagedFileInspection` | _type_ | inspector prefix/name/declared media/signal input and validated metadata-only result |
29
+ | `writeFileAtomic` / `writeFileAtomicSync` / `WriteFileAtomicOptions` | function / _type_ | replace a file atomically: a random staging name created exclusively (never through a planted link), the mode set on the descriptor before the file is visible (default `0o600`, not masked by the umask), `fsync`, rename; a failure leaves the target and no staging file. The asynchronous form keeps the event loop running |
30
+ | `withExclusiveLock` / `ExclusiveLockOptions` / `ExclusiveLock` / `ExclusiveLockOwner` | function / _type_ | run work under an exclusive lock between processes — a file recording its owner (pid, host, machine identity, time); waits up to `timeoutMs` (default 10 s) and stops on `signal`; a dead owner on this machine is taken over, a live, slow or foreign one never is; an ownerless lock only after `ownerlessGraceMs` |
31
+ | `ExclusiveLockError` | class | `LOCK_TIMEOUT` naming the resource and its holder, or `LOCK_ABORTED` with the signal's reason |
29
32
 
30
33
  ---
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
- ---