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
@@ -0,0 +1,288 @@
1
+ # stitchkit/tools — stitchkit docs slice, part 3 of 3
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Parts of this slice:
7
+ - `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)
9
+ - `llms/tools.3.txt`: API reference: `stitchkit/tools` (docs/api/reference.md)
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/tools` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/tools`
16
+
17
+ Server-only. Turns contracts into MCP and AI-agent tools. MCP server surfaces
18
+ need the `@modelcontextprotocol/server` v2 peer; MCP hosts/tests use the separate
19
+ `@modelcontextprotocol/client` package. Agent surfaces need the `ai` peer.
20
+
21
+ Framework-owned MCP tools advertise the exact declared output schema and return
22
+ the validated value unchanged as `structuredContent`, including arrays, scalars
23
+ and `null`. Tools without an output contract advertise and return no structured
24
+ payload.
25
+
26
+ | Export | Kind | Summary |
27
+ |--------|------|---------|
28
+ | `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
29
+ | `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
30
+ | `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
31
+ | `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
32
+ | `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
33
+ | `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
34
+ | `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) |
35
+ | `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) |
36
+ | `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) |
37
+ | `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) |
38
+ | `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
39
+ | `mountViewFile` | function | a native multimodal "view file" MCP tool |
40
+ | `resolveMedia` | function | resolve a media reference for a tool result |
41
+ | `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)) |
42
+ | `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) |
43
+ | `listContractToolNames` | function | the same listing straight from contracts — no handlers or stub services needed |
44
+ | `describeToolCatalog` | function | inspect the exact model-facing names, source identities, schema byte sizes and deferred state; an explicit total byte budget fails closed |
45
+ | `ToolCatalogConfig` / `ToolCatalogEntry` | _type_ | catalog source, transport, optional explicit schema budget and one inspectable result row |
46
+ | `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
47
+ | `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
48
+ | `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
49
+ | `McpHttpSecurityConfig` | _type_ | Fetch-boundary Host and Origin allowlists |
50
+ | `McpLegacyPolicy` | _type_ | `'serve' \| 'reject'` protocol-era compatibility policy |
51
+ | `McpStdioHandle` | _type_ | closeable official stdio transport handle |
52
+ | `StdioMcpServerConfig` | _type_ | config for `createStdioMcpServer` |
53
+ | `StdioCloseTarget` | _type_ | minimal close-only target accepted by `bindStdioProcessSignals` |
54
+ | `StdioProcessSignalsOptions` | _type_ | signal source, close callbacks and phased error reporting |
55
+ | `StdioProcessSignalsBinding` | _type_ | close-only signal binding with observed `promise` and listener `close()` |
56
+ | `StdioProcessSignalsErrorPhase` | _type_ | `'prepare' \| 'close' \| 'complete'` reporting phase |
57
+ | `McpServerBuildConfig` | _type_ | shared config for `buildMcpServer` |
58
+ | `McpServerSharedConfig` | _type_ | transport-neutral options shared by direct and finite surface configs |
59
+ | `McpServer` | _type_ | official split-SDK server instance accepted by raw extension points |
60
+ | `DirectMcpSurfaceConfig` | _type_ | static or identity-dynamic `services` / `runtimeTools` source |
61
+ | `FiniteMcpSurfaceConfig` | _type_ | bounded `surfaces` registry plus typed selector |
62
+ | `McpSurfaceDefinition` | _type_ | one immutable `{ services, runtimeTools }` MCP surface |
63
+ | `McpSurfaceRegistry` | _type_ | finite keyed surface registry for eager preparation |
64
+ | `StdioAuthConfig` | _type_ | startup identity composed into `StdioMcpServerConfig` |
65
+ | `McpMountConfig` | _type_ | config for `mountMcp` |
66
+ | `McpSchemaValidationConfig` | _type_ | shared `{ policy, requireTypedProperties, allowUntyped, requirePortableFormats, allowFormats }` profile |
67
+ | `ValidateMcpSchemasConfig` | _type_ | standalone validation profile plus `services`, `extend`, flattening and logger |
68
+ | `RuntimeToolDefinition` | _type_ | transport-neutral pathless operation with identity, schemas, handler and optional presenters |
69
+ | `RuntimeToolDefinitionBase` | _type_ | common name, identity, input, exposure and MCP metadata fields |
70
+ | `RuntimeToolDefinitionWithOutput` | _type_ | runtime definition whose handler and presenters share a validated output type |
71
+ | `RuntimeToolDefinitionWithoutOutput` | _type_ | runtime definition with a void handler and no presentation callbacks |
72
+ | `RuntimeToolFactory` | _type_ | identity/context-bound runtime-tool definition factory |
73
+ | `RuntimeToolFactoryConfig` | _type_ | factory service identity and context schema |
74
+ | `RuntimeToolFactoryDefinitionWithOutput` | _type_ | factory-authored runtime tool with a validated output schema |
75
+ | `RuntimeToolFactoryDefinitionWithoutOutput` | _type_ | factory-authored void runtime tool without presenters |
76
+ | `RuntimeToolFactoryHandlerContext` | _type_ | parsed factory context plus parsed tool input |
77
+ | `RuntimeToolFactoryIdentityFields` | _type_ | per-tool action, semantic method and optional identity metadata |
78
+ | `RuntimeToolIdentity` | _type_ | `{ serviceName, action, scope?, method, meta? }` for runtime lifecycle/audit |
79
+ | `RuntimeToolHandlerContext` | _type_ | runtime context with the definition's parsed input |
80
+ | `RuntimeToolOutput` | _type_ | output inferred from a runtime tool's optional Zod schema |
81
+ | `RuntimeToolPresenters` | _type_ | optional MCP and AI SDK `toModelOutput` presentation callbacks |
82
+ | `RuntimeMcpPresentation` | _type_ | MCP content/metadata result without framework-owned `structuredContent` or `isError` |
83
+ | `RuntimeMcpInput` | _type_ | typed accepted multi-round input for an opted-in runtime tool |
84
+ | `OAuthClientRegistrationConfig` | _type_ | deterministic pre-registered → CIMD → explicit-DCR client resolution |
85
+ | `CimdClientMetadata` | _type_ | validated Client ID Metadata Document |
86
+ | `CimdClientMetadataFetcher` | _type_ | injectable secure network boundary for metadata loading |
87
+ | `CimdFetchResponse` | _type_ | bounded metadata fetch result passed across the injectable network boundary |
88
+ | `CimdFetchPolicy` | _type_ | CIMD timeout, redirect and size limits |
89
+ | `CimdCachePolicy` | _type_ | bounded HTTP-aware cache policy: separate positive/negative pools (`maxEntries`), per-client and server-wide resolution rate limits (`maxResolutionsPerClient` / `maxResolutions` per `resolutionWindowMs`) |
90
+ | `CimdCacheEvent` | _type_ | observable CIMD cache hit, miss, revalidation and eviction event |
91
+ | `createSecureClientMetadataFetcher` | function | production HTTPS, DNS/IP-pinned CIMD fetcher |
92
+ | `RuntimeAgentModelOutput` | _type_ | AI SDK model-facing text/JSON/content output returned by `present.agent` |
93
+ | `AgentMountConfig` | _type_ | config for `mountAgent` |
94
+ | `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 |
95
+ | `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 |
96
+ | `AgentContext` | _type_ | the context merged into agent tool handlers |
97
+ | `Toolkit` | _type_ | the context-pinned tool surface from `createToolkit` |
98
+ | `ToolExtend` | _type_ | extra-args extension for `mountMcp` / `mountAgent` |
99
+ | `ToolLifecycle` | _type_ | `beforeHandle` / `afterHandle` gate for tool calls — [guide](../guide/mcp-and-agents.md#guarding-tools--lifecycle) |
100
+ | `ToolExecutionControlReason` | _type_ | internal managed-execution stop reason: stale run or requested interruption |
101
+ | `ToolExecutionControlError` | class | control-flow error used to unwind a superseded managed tool call without presenting it as a model-facing tool failure |
102
+ | `isToolExecutionControlError` | function | narrow an unknown thrown value to the managed execution control error |
103
+ | `ToolOperation` | _type_ | executable path-free operation shape shared by contract and framework-native runners |
104
+ | `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)) |
105
+ | `BeforeToolCallOptions` | _type_ | `{ toolName, args, context, endpoint }` passed before execution |
106
+ | `AfterToolCallOptions` | _type_ | completed call options plus `{ result, durationMs, error? }` |
107
+ | `ToolErrorOptions` | _type_ | `{ toolName, error, context, endpoint }` for a thrown handler-path value |
108
+ | `ErrorHintFn` | _type_ | `(toolName, errorCode) => string \| null` — a per-tool recovery hint, shared by every mount |
109
+ | `ToolResult` | _type_ | the result of one tool call |
110
+ | `ToolInvoker` | _type_ | immutable compiled dispatcher (`names`, envelope `invoke`, throwing `invokeOrThrow`) |
111
+ | `ToolInvokerConfig` | _type_ | compile-time exposure, extension and presentation options |
112
+ | `ToolInvocationOptions` | _type_ | per-call source, context, lifecycle, hooks and output-strip reporter |
113
+ | `ToolCallContext` | _type_ | the context every tool hook receives — `{ source, mcp? }` plus whatever the mount's `context` added |
114
+ | `ViewFileOptions` | _type_ | shared URL/managed-file-boundary policy for `defineViewFileTool`, `mountViewFile` and `resolveMedia` |
115
+ | `ViewFileOutput` | _type_ | neutral managed batch result with multimodal `content` and per-item `errors` |
116
+ | `ViewFileInputSchema` | constant | fixed one-or-many media path/URL input schema |
117
+ | `ViewFileOutputSchema` | constant | Zod schema for the neutral managed view-file batch result |
118
+ | `ViewFileErrorSchema` | constant | Zod schema for one structured per-item view failure |
119
+ | `McpAnnotations` | _type_ | MCP annotations on a media result |
120
+ | `McpAnnotationsSchema` | constant | Zod schema for MCP media annotations |
121
+ | `McpMediaContentSchema` | constant | Zod schema for text/image/audio media content |
122
+ | `CollectToolsConfig` | _type_ | options for `collectTools` |
123
+ | `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)) |
124
+ | `UntypedProperty` | _type_ | one such property — `{ path, description? }` |
125
+ | `findNonPortableFormats` | function | deep finder for formats outside the portable MCP/AJV baseline |
126
+ | `NonPortableFormat` | _type_ | one `{ path, format }` portability finding |
127
+ | `PORTABLE_JSON_SCHEMA_FORMATS` | constant | portable-format baseline used by MCP validation |
128
+ | `ToolNameEntry` | _type_ | one `listToolNames` row — `{ kind, name, service, method, transports }` |
129
+ | `IncompatibleSchemaPolicy` | _type_ | `'throw' \| 'skip' \| 'warn'` |
130
+ | `McpMediaContent` | _type_ | a multimodal MCP content item |
131
+
132
+ ### Native tools
133
+
134
+ Generic host-supplied operations — managed definitions for the canonical
135
+ runtime-tool runner, plus deliberate raw MCP adapters over the same mechanics.
136
+
137
+ | Export | Kind | Summary |
138
+ |--------|------|---------|
139
+ | `defineDownloadTool` | function | define a guarded, size-capped managed download for MCP/Agent `runtimeTools` |
140
+ | `defineUploadTool` | function | define a typed managed local-file upload for MCP/Agent `runtimeTools` |
141
+ | `defineWaitTool` | function | define a typed, cancellable managed polling operation for MCP/Agent `runtimeTools` |
142
+ | `defineViewFileTool` | function | define a guarded, batch-capped managed multimodal operation for MCP/Agent `runtimeTools` |
143
+ | `DefineDownloadToolConfig` | _type_ | Zod input, stable identity, URL resolver, storage policy and presenters for `defineDownloadTool` |
144
+ | `DefineUploadToolConfig` | _type_ | stable identity, typed output, upload callback and presenters for `defineUploadTool` |
145
+ | `DefineWaitToolConfig` | _type_ | Zod input/state, identity, poll/done/timeout policy and presenters for `defineWaitTool` |
146
+ | `DefineViewFileToolConfig` | _type_ | identity, media security policy and optional presenters for `defineViewFileTool` |
147
+ | `ManagedNativeToolConfig` | _type_ | shared name, description, identity, exposure and annotations for managed native factories |
148
+ | `NativeToolIdentity` | _type_ | pathless service/action/scope/meta identity; semantic method is factory-owned |
149
+ | `ManagedWaitRender` | _type_ | optional managed wait terminal text and failure classification |
150
+ | `UploadToolInputSchema` | constant | fixed `{ path: string }` input schema for `defineUploadTool` |
151
+ | `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) |
152
+ | `defineAsyncOperationContract` | function | define one canonical Zod-first HTTP contract for start/status/wait plus optional capabilities; execution and recovery remain application-owned |
153
+ | `bindContractAsyncOperation` | function | bind literal methods from an existing contract without creating another HTTP surface |
154
+ | `createAsyncOperationSnapshotSchema` | function | canonical pending/running/succeeded/failed/cancelled Zod snapshot |
155
+ | `AsyncOperationSnapshotSchema` | _type_ | the snapshot union `createAsyncOperationSnapshotSchema` returns when no `progress` schema is configured |
156
+ | `AsyncOperationSnapshotSchemaWithProgress` | _type_ | the same union with the configured `progress` schema optional on every phase |
157
+ | `AsyncOperationCancelResultSchema` | constant | validated accepted/already_terminal/rejected cancellation result |
158
+ | `AsyncOperationCancelResult` | _type_ | validated cancel capability result |
159
+ | `AsyncOperationCancelCapability` | _type_ | optional typed domain cancellation callback |
160
+ | `AsyncOperationCapability` | _type_ | generated capability-name union |
161
+ | `AsyncOperationStartDefinition` / `AsyncOperationFollowDefinition` | _type_ | generated runtime definition types |
162
+ | `AsyncOperationIdentity` | _type_ | shared service/action/scope/meta identity for an operation |
163
+ | `AsyncOperationOutputCapability` | _type_ | optional result/artifact schema plus handler |
164
+ | `RuntimeAsyncOperationConfig` | _type_ | runtime-only descriptor configuration |
165
+ | `RuntimeAsyncOperation` | _type_ | inferred generated definitions and schemas |
166
+ | `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 |
167
+ | `AsyncOperationContractWithStartOutputConfig` | _type_ | canonical contract config with an application start envelope and typed id extractor |
168
+ | `DefinedAsyncOperationContract` | _type_ | generated contract, capability keys, schemas and parsed adapters |
169
+ | `ContractAsyncOperationConfig` | _type_ | literal contract method binding and handlers |
170
+ | `AdaptedContractAsyncOperationConfig` | _type_ | existing-contract binding with explicit id and per-capability input adapters |
171
+ | `BoundAdaptedContractAsyncOperation` | _type_ | inferred adapted binding with parsed id/input projectors |
172
+ | `AdaptedContractAsyncOperationStartKey` | _type_ | existing-contract keys with a declared start output |
173
+ | `AdaptedContractAsyncOperationFollowKey` | _type_ | existing-contract keys with both input and output schemas |
174
+ | `AdaptedContractAsyncOperationWaitKey` | _type_ | adapted follow-up keys whose output matches the selected status snapshot |
175
+ | `ContractAsyncOperationInputAdapters` | _type_ | guaranteed direct-binding status/wait input adapters plus configured optional capabilities |
176
+ | `ContractAsyncOperationKeys` | _type_ | literal method-key union of a bound contract |
177
+ | `ContractAsyncOperationStartKey` | _type_ | direct-binding start keys whose declared ID schema has stable input/output |
178
+ | `ContractAsyncOperationFollowKey` | _type_ | contract keys whose input schema type matches the selected start output |
179
+ | `ContractAsyncOperationWaitKey` | _type_ | follow-up keys whose output schema type also matches the selected status output |
180
+ | `composeToolLifecycle` | function | ordered composition of tool before/after phases |
181
+ | `mountDownload` | function | raw MCP "download a URL to disk" adapter (SSRF-guarded, size-capped) |
182
+ | `mountUpload` | function | raw MCP "upload a local file" adapter |
183
+ | `mountWait` | function | raw MCP generic `--wait`-style polling adapter |
184
+ | `DownloadToolConfig` | _type_ | config for `mountDownload` |
185
+ | `UploadToolConfig` | _type_ | config for `mountUpload` |
186
+ | `WaitToolConfig` | _type_ | config for `mountWait` |
187
+
188
+ ### OAuth 2.1 provider
189
+
190
+ A native remote-connector auth surface for MCP — [guide](../guide/mcp-and-agents.md#oauth-21--a-native-remote-connector).
191
+
192
+ | Export | Kind | Summary |
193
+ |--------|------|---------|
194
+ | `mountOAuthProvider` | function | the OAuth 2.1 provider routes (DCR, PKCE, token) |
195
+ | `oauthProtectedResourceRoute` | function | the RFC 9728 protected-resource-metadata route |
196
+ | `protectedResourceMetadataUrl` | function | build the metadata URL for a resource |
197
+ | `wwwAuthenticateHeader` | function | build the `WWW-Authenticate` challenge header |
198
+ | `PROTECTED_RESOURCE_PATH` | const | the well-known metadata path |
199
+ | `OAuthProviderConfig` | _type_ | config for `mountOAuthProvider` |
200
+ | `ProtectedResourceConfig` | _type_ | config for `oauthProtectedResourceRoute` |
201
+ | `ApplicationType` | _type_ | DCR `application_type` — `'native'` (loopback allowed) \| `'web'` (https only) |
202
+ | `AuthCodeData` | _type_ | a stored authorization-code record |
203
+ | `AuthRequest` | _type_ | a parsed authorization request |
204
+ | `ClientMetadata` | _type_ | dynamic-client-registration metadata |
205
+ | `RefreshData` | _type_ | a stored refresh-token record |
206
+ | `RegisteredClient` | _type_ | a registered OAuth client |
207
+
208
+ ### Durable tool bodies
209
+
210
+ A mounted tool body can be made restartable without adopting `agent-runtime`: declare a
211
+ factory and `step` / `sleep` / `waitFor` appear in the handler context, backed by whatever
212
+ ledger the application already has.
213
+
214
+ ```ts
215
+ mountAgent(services, { durability: (toolCallId) => myLedgerFor(toolCallId) });
216
+ ```
217
+
218
+ | Export | Kind | Summary |
219
+ |--------|------|---------|
220
+ | `ToolDurability` | _type_ | the port a tool body needs: `step`, `sleep`, `waitFor` |
221
+ | `ToolDurabilityFactory` | _type_ | `(toolCallId, signal) => ToolDurability`, called once per call |
222
+ | `DurableJsonValue` | _type_ | what a durable step result may hold — a record is read back in another process, so it must be JSON |
223
+ | `createLocalStepDurability` | function | the durability engine — replay, absolute deadlines, park/deliver — over a two-method ledger the application owns |
224
+ | `StepDurabilityLedger` | _type_ | the two methods an engine needs: `appendEvent`, `readEvents` |
225
+ | `LocalStepDurability` | _type_ | what the engine returns; satisfies `ToolDurability` and adds `deliver`, `effect` and record introspection for the ledger's owner |
226
+ | `EffectHandlers` / `EffectOutcome` / `EffectRunOptions` | _type_ | `effect(name, { run, reconcile }, { signal, reconcileTimeoutMs })`: the intent is recorded before `run`, an intent without an outcome is settled by `reconcile` and never run again; `accepted` with the proof or a recorded, final `uncertain` → ADR 0200 |
227
+ | `EffectUnresolvedError` | class | an effect whose outcome this call could not settle — `run` or `reconcile` threw, `reconcile` overran, the proof was not recordable; the intent stands and the next call reconciles |
228
+ | `LocalStepDurabilityOptions` | _type_ | `{ store, conversationId, runId, signal?, subscribe?, clock? }` |
229
+ | `AppendAgentStoreEvent` / `ReadAgentStoreEvents` / `AgentStoreEventEnvelope` / `AgentStoreEventPage` | _type_ | the ledger's row shapes, re-exported so a ledger is typed from the entrypoint that consumes it |
230
+ | `AgentToolError` | class | the model-safe envelope a failed agent tool throws |
231
+ | `isAgentToolError` | function | brand check for it — a consumer running its own loop no longer parses the message |
232
+
233
+ ### Catalog stamp
234
+
235
+ Every advertised tool and every tool result carries the fingerprint of the catalog it came
236
+ from, so a long-lived consumer can see that its own copy is stale **without making a
237
+ request for it**. `createMcpHandler` is stateless by construction and therefore has no
238
+ retained session to push `notifications/tools/list_changed` down; the stamp needs none.
239
+
240
+ Store the stamp beside the tools when you list them, compare it against the one on every
241
+ result, and re-list when they differ — including on a refusal, which is exactly when a
242
+ stale catalog is the likeliest explanation and the least visible one. The server side
243
+ needs no wiring: every mount stamps what it advertises.
244
+
245
+ | Export | Kind | Summary |
246
+ |--------|------|---------|
247
+ | `readMcpCatalogStamp` | function | read a peer's stamp out of `_meta`, or `null` when there is none |
248
+ | `mcpCatalogMeta` | function | the `_meta` fragment a stamped tool or result carries |
249
+ | `MCP_CATALOG_META_KEY` | const | the namespaced `_meta` key (`stitchkit/catalog`) |
250
+ | `McpCatalogStamp` | _type_ | `{ digest, tools }` — the catalog fingerprint and its tool count |
251
+
252
+ ### MCP Apps (widgets)
253
+
254
+ Interactive MCP resources — [ADR 0019](../decisions/0019-generic-native-tools.md).
255
+
256
+ | Export | Kind | Summary |
257
+ |--------|------|---------|
258
+ | `mountMcpResource` | function | mount an MCP Apps widget resource |
259
+ | `inlineMcpAppBundle` | function | inline a built widget bundle into a resource |
260
+ | `EXT_APPS_BUNDLE_PLACEHOLDER` | const | the placeholder token `inlineMcpAppBundle` replaces |
261
+ | `RESOURCE_MIME_TYPE` | const | the MCP Apps resource MIME type |
262
+ | `McpResourceDef` | _type_ | an MCP Apps resource definition |
263
+ | `McpAppResourceMeta` | _type_ | resource `_meta` for an MCP App |
264
+ | `McpAppCsp` | _type_ | the widget content-security policy |
265
+
266
+ ### Introspection & internals
267
+
268
+ Advanced building blocks — the shared machinery the mounts are built on.
269
+
270
+ | Export | Kind | Summary |
271
+ |--------|------|---------|
272
+ | `collectTools` | function | resolve a service's methods to mountable tools (the shared resolver) |
273
+ | `createToolLogger` | function | a ready `afterToolCall` that logs every tool call — [guide](../guide/mcp-and-agents.md#logging-tool-calls--createtoollogger) |
274
+ | `summarizeTransports` | function | mixed contract/runtime operation counts and per-source breakdown for a boot-time summary |
275
+ | `buildToolManifest` | function | transport-aware searchable `{ name, description, inputSchema }` rows from a mixed surface |
276
+ | `ToolLoggerConfig` | _type_ | config for `createToolLogger` |
277
+ | `ToolCallRecord` | _type_ | the structured record `createToolLogger` passes to `onRecord` |
278
+ | `TransportSummary` | _type_ | `{ contractServices, runtimeTools, totals, sources }` from `summarizeTransports` |
279
+ | `TransportCounts` | _type_ | per-transport counts (`{ HTTP, MCP, AGENT, CLI }`) |
280
+ | `ToolSurfaceDefinition` | _type_ | shared object-shaped `{ services?, runtimeTools? }` introspection surface |
281
+ | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
282
+ | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments |
283
+ | `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 |
284
+ | `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
285
+ | `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
286
+ | `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
287
+
288
+ ---
package/llms/tools.txt CHANGED
@@ -1,4 +1,4 @@
1
- # stitchkit/tools — stitchkit docs slice, part 1 of 2
1
+ # stitchkit/tools — stitchkit docs slice, part 1 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.
@@ -6,7 +6,8 @@
6
6
 
7
7
  Parts of this slice:
8
8
  - `llms/tools.txt`: Guide: MCP & agents (docs/guide/mcp-and-agents.md)
9
- - `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)
10
11
 
11
12
  ==============================================================================
12
13
  # Guide: MCP & agents (docs/guide/mcp-and-agents.md)
@@ -406,6 +407,30 @@ enters the `stitchkit/tools` graph. An application that *does* run on
406
407
  `agent-runtime` gets durability through the run context and needs no option;
407
408
  where both exist the runtime's wins, because the run is recorded in its ledger.
408
409
 
410
+ #### An effect in another system — `effect`, at most once
411
+
412
+ `step` records its result **after** the body, so a body cut short by a crash
413
+ runs again. For sending a message or starting a turn at a provider, a repeat is
414
+ worse than a loss. The engine's `effect` records the intent **before** it runs:
415
+
416
+ ```ts
417
+ const sent = await engine.effect('reply', {
418
+ run: () => chat.send({ clientId, text }), // → { messageId }
419
+ reconcile: (signal) => chat.findByClientId(clientId, { signal }), // → { messageId } | null
420
+ })
421
+ if (sent.outcome === 'uncertain') reportPossiblyLost(clientId)
422
+ ```
423
+
424
+ A later call — the same process or a restarted one — that finds the intent with
425
+ no outcome calls `reconcile`, never `run`. Found is `accepted` with the proof;
426
+ not found is `uncertain`. Both are recorded and final: `run` is never called for
427
+ that name again, and `uncertain` is not asked again — it is the honest third
428
+ answer, and retrying it is the caller's decision under a new name. A `run` that
429
+ throws, or a `reconcile` that throws or overruns `reconcileTimeoutMs` (default
430
+ 30 s), rejects with `EffectUnresolvedError` and leaves the intent for the next
431
+ call. The proof is JSON of at most 64 KiB — the identity the recipient assigned,
432
+ not a payload. → [ADR 0200](../decisions/0200-an-effect-is-recorded-before-it-runs.md)
433
+
409
434
  ### Typed MCP call metadata
410
435
 
411
436
  Contract handlers, runtime-tool handlers/factories, lifecycle and tool hooks all
@@ -939,66 +964,3 @@ official SDK.
939
964
  A tool without an output contract advertises no `outputSchema` and returns no
940
965
  invented structured value. Its successful MCP result has an empty `content`
941
966
  list.
942
-
943
- ## A different answer for tools — `withToolView`
944
-
945
- An admin page wants the full record; a model wants a card. Every byte of a
946
- tool result enters the model's context and stays in its history, and personal
947
- fields a task does not need are better never shown to it. Two endpoints on one
948
- path (one `expose: ['HTTP']`, one for the tools) duplicate the description, the
949
- schemas and the handler; branching on `ctx.source` teaches every handler about
950
- transports and still advertises the full output schema.
951
-
952
- A **tool view** declares the difference on the endpoint instead:
953
-
954
- ```ts
955
- import { defineContract, withToolView } from 'stitchkit';
956
-
957
- export const users = defineContract({ prefix: 'users' }, {
958
- list: withToolView(
959
- {
960
- method: 'GET', path: '/', desc: 'List users', tool: { name: 'user_list' },
961
- input: UserListQuery, // include: z.array(...).default(['profile', 'stats'])
962
- output: UserListResponse, // HTTP, OpenAPI and the typed client — unchanged
963
- },
964
- {
965
- defaults: { include: [] }, // what a tool call gets when it passes nothing
966
- output: UserCardList, // the tool answer and its schema
967
- project: (full, { input }) => ({ items: full.items.map(toCard) }), // optional: without it, `output` slices
968
- },
969
- ),
970
- });
971
- ```
972
-
973
- - **One handler, one parser.** `defaults` joins the tool call's arguments
974
- *before* the endpoint's own `input` parses them, so the handler receives an
975
- ordinary `input` — `include: []` from a tool, the HTTP default from HTTP — and
976
- loads only what was asked for. An explicit argument wins over the default.
977
- - **The answer is derived, then checked.** The handler's result is validated
978
- against the full `output` first, as always; then `project` (a pure,
979
- synchronous function of the full result and the parsed input) or a slice by
980
- the view's `output`, then validation against the view's schema. A projection
981
- that throws, returns a Promise or breaks its schema is `INTERNAL_SERVER_ERROR`
982
- — a server fault, like any output mismatch.
983
- - **Where it applies.** The MCP, agent and CLI mounts answer with the view;
984
- `outputSchema`, `structuredContent`, the advertised input `default`, the
985
- catalog stamp and the surface snapshot follow it. HTTP, OpenAPI, the typed
986
- client and the in-process [`createToolInvoker`](#in-process-calls--createtoolinvoker)
987
- keep the full answer — code, not a model, is calling there.
988
- - **Three forms, one helper.** With `output` and `project` the answer has its
989
- own schema. With `project` alone it reshapes values inside the full schema.
990
- With `output` alone it is a slice, and the full result must fit that schema —
991
- `withToolView` refuses the endpoint at compile time when it does not.
992
- - **Exposure.** A view needs a tool transport. With `createContractFactory({
993
- toolExposure: 'explicit' })` an endpoint without `expose` is HTTP-only, so an
994
- endpoint with a view names its tool transports in `expose`.
995
- - **What it refuses.** `defineContract` rejects a view on an endpoint with no
996
- tool transport or no full `output`, on a raw, `rawBody`, multipart,
997
- `responseMeta` or streaming endpoint, a view that declares neither `output`
998
- nor `project`, and a default for a key the input does not have, for a path
999
- param, or with a value the input would reject.
1000
-
1001
- A projection adds nothing the full result does not carry: a field the tool
1002
- answer needs belongs in the full answer, loaded by the handler. Keys a
1003
- projection returns beyond its schema are reported by `onOutputStrip`; a slice
1004
- removes keys on purpose and is not reported. → [ADR 0196](../decisions/0196-a-tool-answer-is-a-declared-view.md)
package/llms-full.txt CHANGED
@@ -820,7 +820,7 @@ endpoint that can never be a tool (a raw response, a stream, `responseMeta`,
820
820
  | `tool.` | Purpose |
821
821
  |---------|---------|
822
822
  | `name` | explicit tool name (default: a verb-aware derivation, below) |
823
- | `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) |
823
+ | `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) |
824
824
  | `ui` | MCP Apps widget for the tool's results — see [MCP & agents](./mcp-and-agents.md) |
825
825
  | `annotations` | MCP behavioural hints (`readOnlyHint`, `destructiveHint`, `title`, …) |
826
826
  | `mcp` | elicitation rounds asked before the handler runs (`inputRequired`) |
@@ -3642,6 +3642,30 @@ enters the `stitchkit/tools` graph. An application that *does* run on
3642
3642
  `agent-runtime` gets durability through the run context and needs no option;
3643
3643
  where both exist the runtime's wins, because the run is recorded in its ledger.
3644
3644
 
3645
+ #### An effect in another system — `effect`, at most once
3646
+
3647
+ `step` records its result **after** the body, so a body cut short by a crash
3648
+ runs again. For sending a message or starting a turn at a provider, a repeat is
3649
+ worse than a loss. The engine's `effect` records the intent **before** it runs:
3650
+
3651
+ ```ts
3652
+ const sent = await engine.effect('reply', {
3653
+ run: () => chat.send({ clientId, text }), // → { messageId }
3654
+ reconcile: (signal) => chat.findByClientId(clientId, { signal }), // → { messageId } | null
3655
+ })
3656
+ if (sent.outcome === 'uncertain') reportPossiblyLost(clientId)
3657
+ ```
3658
+
3659
+ A later call — the same process or a restarted one — that finds the intent with
3660
+ no outcome calls `reconcile`, never `run`. Found is `accepted` with the proof;
3661
+ not found is `uncertain`. Both are recorded and final: `run` is never called for
3662
+ that name again, and `uncertain` is not asked again — it is the honest third
3663
+ answer, and retrying it is the caller's decision under a new name. A `run` that
3664
+ throws, or a `reconcile` that throws or overruns `reconcileTimeoutMs` (default
3665
+ 30 s), rejects with `EffectUnresolvedError` and leaves the intent for the next
3666
+ call. The proof is JSON of at most 64 KiB — the identity the recipient assigned,
3667
+ not a payload. → [ADR 0200](../decisions/0200-an-effect-is-recorded-before-it-runs.md)
3668
+
3645
3669
  ### Typed MCP call metadata
3646
3670
 
3647
3671
  Contract handlers, runtime-tool handlers/factories, lifecycle and tool hooks all
@@ -4185,7 +4209,26 @@ path (one `expose: ['HTTP']`, one for the tools) duplicate the description, the
4185
4209
  schemas and the handler; branching on `ctx.source` teaches every handler about
4186
4210
  transports and still advertises the full output schema.
4187
4211
 
4188
- A **tool view** declares the difference on the endpoint instead:
4212
+ A **tool view** declares the difference on the endpoint instead. Most often the
4213
+ difference is only the call — a model needs a lighter one, and the answer keeps
4214
+ its one shape:
4215
+
4216
+ ```ts
4217
+ import { defineContract, withToolView } from 'stitchkit';
4218
+
4219
+ export const items = defineContract({ prefix: 'items' }, {
4220
+ list: withToolView(
4221
+ {
4222
+ method: 'GET', path: '/:slug/items', desc: 'List items', tool: { name: 'db_items' },
4223
+ input: ItemsQuery, // include: z.array(...).default(['relations'])
4224
+ output: ItemsResponse, // one answer on HTTP and on the tools
4225
+ },
4226
+ { defaults: { include: [] } }, // what a tool call gets when it passes nothing
4227
+ ),
4228
+ });
4229
+ ```
4230
+
4231
+ When the answer itself differs, the view carries its own schema too:
4189
4232
 
4190
4233
  ```ts
4191
4234
  import { defineContract, withToolView } from 'stitchkit';
@@ -4221,17 +4264,19 @@ export const users = defineContract({ prefix: 'users' }, {
4221
4264
  catalog stamp and the surface snapshot follow it. HTTP, OpenAPI, the typed
4222
4265
  client and the in-process [`createToolInvoker`](#in-process-calls--createtoolinvoker)
4223
4266
  keep the full answer — code, not a model, is calling there.
4224
- - **Three forms, one helper.** With `output` and `project` the answer has its
4225
- own schema. With `project` alone it reshapes values inside the full schema.
4226
- With `output` alone it is a slice, and the full result must fit that schema —
4227
- `withToolView` refuses the endpoint at compile time when it does not.
4267
+ - **Four forms, one helper.** With `defaults` alone the call changes and the
4268
+ answer is the full `output`, validated by it and advertised as it. With
4269
+ `output` and `project` the answer has its own schema. With `project` alone it
4270
+ reshapes values inside the full schema. With `output` alone it is a slice, and
4271
+ the full result must fit that schema — `withToolView` refuses the endpoint at
4272
+ compile time when it does not.
4228
4273
  - **Exposure.** A view needs a tool transport. With `createContractFactory({
4229
4274
  toolExposure: 'explicit' })` an endpoint without `expose` is HTTP-only, so an
4230
4275
  endpoint with a view names its tool transports in `expose`.
4231
4276
  - **What it refuses.** `defineContract` rejects a view on an endpoint with no
4232
4277
  tool transport or no full `output`, on a raw, `rawBody`, multipart,
4233
- `responseMeta` or streaming endpoint, a view that declares neither `output`
4234
- nor `project`, and a default for a key the input does not have, for a path
4278
+ `responseMeta` or streaming endpoint, a view that declares no `defaults`,
4279
+ `output` or `project` — it would change nothing — and a default for a key the input does not have, for a path
4235
4280
  param, or with a value the input would reject.
4236
4281
 
4237
4282
  A projection adds nothing the full result does not carry: a field the tool
@@ -6409,6 +6454,12 @@ answered the question, and the answer stands. (It used to be overwritten — and
6409
6454
  the example above hides that, because `healthy` is the same value that
6410
6455
  overwrote it.)
6411
6456
 
6457
+ **Reporting the same health again is not a change.** A resource may confirm its
6458
+ health on a timer; a report with the value it already reported publishes
6459
+ nothing — no new revision, no `changedAt`, no subscriber call. A change of value
6460
+ publishes once, as does the first report that confirms the `healthy` the kernel
6461
+ assumed at readiness.
6462
+
6412
6463
  **A resource is required unless you write `required: false`.** That default is
6413
6464
  what makes the next sentence bite.
6414
6465
 
@@ -7781,6 +7832,15 @@ fields in declaration order, so `myapp generate "a fox"` is
7781
7832
  `--prompt "a fox"`. A piped value fills the first required unset field:
7782
7833
  `echo "a fox" | myapp generate`.
7783
7834
 
7835
+ A token is an option only when it is a long form (`--name`, `--name=value`,
7836
+ `--`) or `-` followed by a letter. Anything else that starts with `-` is data:
7837
+ `myapp note a "- item"` fills a positional, and after an option that expects a
7838
+ value the next token is that value — `--grep -foo`, `--count -5`. The next
7839
+ token is refused as a value only when it is itself an option, so `--grep --json`
7840
+ still reports that `--grep` requires a value. A value that cannot be read as
7841
+ its field's type is refused naming the flag and what was typed:
7842
+ `--tail expects a whole number, got "abc"`.
7843
+
7784
7844
  For a stable shell grammar, declare the default command, short aliases and the
7785
7845
  exact positional fields on `createCli`:
7786
7846
 
@@ -8253,6 +8313,37 @@ nothing to keep, which is not a failure.
8253
8313
  happens to be at the backup path is a second install of an unverified binary,
8254
8314
  and the day it is used is the day nobody is in a position to check.
8255
8315
 
8316
+ ### Run it before it replaces anything — `verify`
8317
+
8318
+ A digest proves the bytes are the ones published, not that they load. A tool
8319
+ that updates itself unattended — a daemon — and installs a build that does not
8320
+ start takes its own updater down with it, and every machine is then repaired by
8321
+ hand. `verify` is the step between "digest matched" and "target replaced":
8322
+
8323
+ ```ts
8324
+ await applyCliUpdate({
8325
+ asset, targetPath, backupPath,
8326
+ verify: async (candidate, signal) => {
8327
+ const child = Bun.spawn(['bun', candidate, 'version'], { signal, stdout: 'pipe' })
8328
+ const printed = (await new Response(child.stdout).text()).trim()
8329
+ if ((await child.exited) !== 0 || printed !== check.version) {
8330
+ throw new Error(`printed ${printed}, expected ${check.version}`)
8331
+ }
8332
+ },
8333
+ verifyTimeoutMs: 15_000, // default 30 000
8334
+ })
8335
+ ```
8336
+
8337
+ The verified bytes are written beside the target as an executable candidate
8338
+ with the target's extension, and `verify` gets its path — a path rather than a
8339
+ command, because a JavaScript bundle is started through its runtime. It runs
8340
+ before the backup and the replacement. If it throws or outlives
8341
+ `verifyTimeoutMs` (its `signal` aborts at the deadline), the candidate is
8342
+ removed, the target and any earlier backup are untouched, and the update is
8343
+ refused with the reason as its cause. The target is written from the checked
8344
+ bytes in memory, never from the candidate file, so nothing the candidate did
8345
+ while it ran can change what is installed.
8346
+
8256
8347
  ### Two release tracks
8257
8348
 
8258
8349
  `assertCliPublishable` takes one manifest **or every manifest already
@@ -16393,12 +16484,12 @@ from the root `stitchkit`.
16393
16484
  | `PathParams` | _type_ | infer named `:segments` and a terminal `*wildcard` from a path literal as string params |
16394
16485
  | `ContractMeta` | _type_ | a contract's `prefix` + optional `scope` and `meta` (a default every endpoint shallow-merges over) |
16395
16486
  | `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) |
16396
- | `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) |
16487
+ | `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) |
16397
16488
  | `EndpointToolOptions` | _type_ | an endpoint's `tool` group — `name`, `view`, `ui`, `annotations`, `mcp`: what the tool surfaces read that HTTP does not |
16398
16489
  | `EndpointToolView` | _type_ | the stored shape of a tool view (`MethodDef.toolView`) |
16399
16490
  | `DeclaredToolView` | _type_ | a tool view as `withToolView` produces it — the only form `tool.view` accepts |
16400
16491
  | `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 |
16401
- | `ProjectedToolView` / `ReshapedToolView` / `SlicedToolView` | _type_ | the three forms `withToolView` accepts: own schema + `project`, `project` inside the full schema, a slice by `output` |
16492
+ | `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` |
16402
16493
  | `ToolViewCall` | _type_ | what `project` is told besides the full result: the parsed `input` and the `source` |
16403
16494
  | `ToolViewSliceMismatch` | _type_ | the compile-time refusal of a slice whose schema does not accept the full output |
16404
16495
  | `ToolViewNeedsToolTransport` | _type_ | the compile-time refusal of a view on an `expose: ['HTTP']` endpoint |
@@ -17817,7 +17908,9 @@ mountAgent(services, { durability: (toolCallId) => myLedgerFor(toolCallId) });
17817
17908
  | `DurableJsonValue` | _type_ | what a durable step result may hold — a record is read back in another process, so it must be JSON |
17818
17909
  | `createLocalStepDurability` | function | the durability engine — replay, absolute deadlines, park/deliver — over a two-method ledger the application owns |
17819
17910
  | `StepDurabilityLedger` | _type_ | the two methods an engine needs: `appendEvent`, `readEvents` |
17820
- | `LocalStepDurability` | _type_ | what the engine returns; satisfies `ToolDurability` and adds `deliver` and record introspection for the ledger's owner |
17911
+ | `LocalStepDurability` | _type_ | what the engine returns; satisfies `ToolDurability` and adds `deliver`, `effect` and record introspection for the ledger's owner |
17912
+ | `EffectHandlers` / `EffectOutcome` / `EffectRunOptions` | _type_ | `effect(name, { run, reconcile }, { signal, reconcileTimeoutMs })`: the intent is recorded before `run`, an intent without an outcome is settled by `reconcile` and never run again; `accepted` with the proof or a recorded, final `uncertain` → ADR 0200 |
17913
+ | `EffectUnresolvedError` | class | an effect whose outcome this call could not settle — `run` or `reconcile` threw, `reconcile` overran, the proof was not recordable; the intent stands and the next call reconciles |
17821
17914
  | `LocalStepDurabilityOptions` | _type_ | `{ store, conversationId, runId, signal?, subscribe?, clock? }` |
17822
17915
  | `AppendAgentStoreEvent` / `ReadAgentStoreEvents` / `AgentStoreEventEnvelope` / `AgentStoreEventPage` | _type_ | the ledger's row shapes, re-exported so a ledger is typed from the entrypoint that consumes it |
17823
17916
  | `AgentToolError` | class | the model-safe envelope a failed agent tool throws |
@@ -17996,6 +18089,9 @@ available from `stitchkit/contract`.
17996
18089
  | `ManagedFileError` / `ManagedFileErrorCode` | class / _type_ | stable boundary failures; registered `FILE_*` mistakes are caller-safe while `FILE_IO_ERROR` remains internal |
17997
18090
  | `ManagedFileInspector` | _type_ | bounded-prefix read/write inspection callback with a finite cancellation signal that cannot own path or size |
17998
18091
  | `ManagedFileInspectionInput` / `ManagedFileInspection` | _type_ | inspector prefix/name/declared media/signal input and validated metadata-only result |
18092
+ | `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 |
18093
+ | `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` |
18094
+ | `ExclusiveLockError` | class | `LOCK_TIMEOUT` naming the resource and its holder, or `LOCK_ABORTED` with the signal's reason |
17999
18095
 
18000
18096
  ---
18001
18097
 
@@ -18276,7 +18372,7 @@ SDK nor the `ai` peer.
18276
18372
  | `CliBuildStampSchema` / `CliBuildStamp` | schema / _type_ | the version/commit/build time carried inside a binary |
18277
18373
  | `CliInstallerConfig` | _type_ | manifest, binary name, default install directory, and an optional `asset` — omit it for one script that selects the target by `uname` |
18278
18374
  | `CliUpdateCheckConfig` / `CliUpdateCheck` | _type_ | check inputs, and its four answers — `skipped`, `current`, `outdated`, `unknown` |
18279
- | `CliUpdateApplyConfig` / `AppliedCliUpdate` | _type_ | apply inputs and the replaced path, byte count and digest |
18375
+ | `CliUpdateApplyConfig` / `AppliedCliUpdate` | _type_ | apply inputs — including `verify`, run on an executable candidate beside the target before the backup and the replacement, within `verifyTimeoutMs` — and the replaced path, byte count and digest |
18280
18376
  | `CliProfileStore` / `CliProfileStoreConfig` / `ResolvedCliProfile` | _type_ | the profile store, its directory/schema/hint config, and one resolution |
18281
18377
  | `CliResultView` | _type_ | the requested view — `count`, `sum`, or `records` (ordered and/or table-rendered) |
18282
18378
  | `CliViewOutput` | _type_ | a JSON value, or the one human-facing text shape |