stitchkit 0.94.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  3. package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
  4. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  5. package/dist/agent-runtime/contained-darwin.d.ts +38 -0
  6. package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
  7. package/dist/agent-runtime/contained-files.d.ts +11 -26
  8. package/dist/agent-runtime/contained-files.d.ts.map +1 -1
  9. package/dist/agent-runtime/contained-scan.d.ts +21 -0
  10. package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
  11. package/dist/agent-runtime/contained-write.d.ts +9 -0
  12. package/dist/agent-runtime/contained-write.d.ts.map +1 -0
  13. package/dist/agent-runtime/deferred-tool-types.d.ts +3 -2
  14. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  15. package/dist/agent-runtime/harness-control.d.ts +0 -1
  16. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  17. package/dist/agent-runtime/harness.d.ts +0 -5
  18. package/dist/agent-runtime/harness.d.ts.map +1 -1
  19. package/dist/agent-runtime/managed-tools.d.ts +3 -2
  20. package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
  21. package/dist/agent-runtime/provider-origin.d.ts +7 -0
  22. package/dist/agent-runtime/provider-origin.d.ts.map +1 -1
  23. package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
  24. package/dist/agent-runtime/runtime.d.ts +1 -1
  25. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  26. package/dist/agent-runtime/schedule-records.d.ts +34 -0
  27. package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
  28. package/dist/agent-runtime/schedules.d.ts +34 -0
  29. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  30. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
  31. package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
  32. package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
  33. package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
  34. package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
  35. package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
  36. package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
  37. package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
  38. package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
  39. package/dist/application/admission-rate.d.ts +21 -0
  40. package/dist/application/admission-rate.d.ts.map +1 -0
  41. package/dist/application/admission-run.d.ts +8 -0
  42. package/dist/application/admission-run.d.ts.map +1 -0
  43. package/dist/application/admission.d.ts.map +1 -1
  44. package/dist/application/diagnostic-journal-lock.d.ts +9 -34
  45. package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
  46. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  47. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  48. package/dist/application/kernel-resource-context.d.ts.map +1 -1
  49. package/dist/application/notification-outbox.d.ts.map +1 -1
  50. package/dist/application/process-lifecycle-transitions.d.ts +175 -0
  51. package/dist/application/process-lifecycle-transitions.d.ts.map +1 -0
  52. package/dist/application/process-lifecycle.d.ts +3 -131
  53. package/dist/application/process-lifecycle.d.ts.map +1 -1
  54. package/dist/application/schedule.d.ts +0 -1
  55. package/dist/application/schedule.d.ts.map +1 -1
  56. package/dist/application/watch-hub-core.d.ts +122 -0
  57. package/dist/application/watch-hub-core.d.ts.map +1 -0
  58. package/dist/application/watch-hub.d.ts +2 -2
  59. package/dist/application/watch-hub.d.ts.map +1 -1
  60. package/dist/browser/client-executors.d.ts +14 -0
  61. package/dist/browser/client-executors.d.ts.map +1 -0
  62. package/dist/browser/client-multipart.d.ts +1 -1
  63. package/dist/browser/client-multipart.d.ts.map +1 -1
  64. package/dist/browser/client.d.ts +3 -2
  65. package/dist/browser/client.d.ts.map +1 -1
  66. package/dist/browser/http-fetch.d.ts +22 -0
  67. package/dist/browser/http-fetch.d.ts.map +1 -0
  68. package/dist/browser/http.d.ts +1 -3
  69. package/dist/browser/http.d.ts.map +1 -1
  70. package/dist/browser/live-state-core.d.ts +63 -0
  71. package/dist/browser/live-state-core.d.ts.map +1 -0
  72. package/dist/browser/live-state.d.ts.map +1 -1
  73. package/dist/browser/realtime-client.d.ts +26 -0
  74. package/dist/browser/realtime-client.d.ts.map +1 -0
  75. package/dist/browser/socket-io-connection.d.ts +82 -0
  76. package/dist/browser/socket-io-connection.d.ts.map +1 -0
  77. package/dist/browser/socket-io-peer.d.ts +20 -0
  78. package/dist/browser/socket-io-peer.d.ts.map +1 -0
  79. package/dist/browser/socket-io-trace.d.ts +31 -0
  80. package/dist/browser/socket-io-trace.d.ts.map +1 -0
  81. package/dist/browser/socket-io.d.ts +2 -18
  82. package/dist/browser/socket-io.d.ts.map +1 -1
  83. package/dist/contract/client-types.d.ts +134 -0
  84. package/dist/contract/client-types.d.ts.map +1 -0
  85. package/dist/contract/define-validation.d.ts +30 -0
  86. package/dist/contract/define-validation.d.ts.map +1 -0
  87. package/dist/contract/define.d.ts +3 -357
  88. package/dist/contract/define.d.ts.map +1 -1
  89. package/dist/contract/runtime-context.d.ts +131 -0
  90. package/dist/contract/runtime-context.d.ts.map +1 -0
  91. package/dist/contract/tool-options.d.ts +105 -0
  92. package/dist/contract/tool-options.d.ts.map +1 -0
  93. package/dist/contract/tool-view.d.ts +15 -2
  94. package/dist/contract/tool-view.d.ts.map +1 -1
  95. package/dist/durability/contract.d.ts +83 -0
  96. package/dist/durability/contract.d.ts.map +1 -1
  97. package/dist/durability/effect.d.ts +24 -0
  98. package/dist/durability/effect.d.ts.map +1 -0
  99. package/dist/durability/engine.d.ts +2 -2
  100. package/dist/durability/engine.d.ts.map +1 -1
  101. package/dist/durability/events.d.ts +2 -0
  102. package/dist/durability/events.d.ts.map +1 -1
  103. package/dist/durability/ledger.d.ts +11 -0
  104. package/dist/durability/ledger.d.ts.map +1 -1
  105. package/dist/durability/parks.d.ts +22 -0
  106. package/dist/durability/parks.d.ts.map +1 -0
  107. package/dist/durability/scheduler.d.ts +1 -0
  108. package/dist/durability/scheduler.d.ts.map +1 -1
  109. package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
  110. package/dist/entrypoints/agent-runtime/harness.js +127 -116
  111. package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
  112. package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
  113. package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
  114. package/dist/entrypoints/agent-runtime/testing.js +246 -214
  115. package/dist/entrypoints/agent-runtime.js +224 -203
  116. package/dist/entrypoints/application/diagnostic-journal.js +63 -203
  117. package/dist/entrypoints/application/opentelemetry.js +1 -1
  118. package/dist/entrypoints/application.d.ts +2 -1
  119. package/dist/entrypoints/application.d.ts.map +1 -1
  120. package/dist/entrypoints/application.js +506 -380
  121. package/dist/entrypoints/cli.d.ts +4 -1
  122. package/dist/entrypoints/cli.d.ts.map +1 -1
  123. package/dist/entrypoints/cli.js +57 -35
  124. package/dist/entrypoints/contract.d.ts +5 -2
  125. package/dist/entrypoints/contract.d.ts.map +1 -1
  126. package/dist/entrypoints/contract.js +3 -2
  127. package/dist/entrypoints/files.d.ts +2 -0
  128. package/dist/entrypoints/files.d.ts.map +1 -1
  129. package/dist/entrypoints/files.js +98 -2
  130. package/dist/entrypoints/index.d.ts +4 -2
  131. package/dist/entrypoints/index.d.ts.map +1 -1
  132. package/dist/entrypoints/index.js +348 -282
  133. package/dist/entrypoints/live.js +89 -71
  134. package/dist/entrypoints/node.d.ts +2 -1
  135. package/dist/entrypoints/node.d.ts.map +1 -1
  136. package/dist/entrypoints/node.js +13 -12
  137. package/dist/entrypoints/react.js +1 -1
  138. package/dist/entrypoints/remote.js +4 -4
  139. package/dist/entrypoints/server.d.ts +4 -2
  140. package/dist/entrypoints/server.d.ts.map +1 -1
  141. package/dist/entrypoints/server.js +293 -79
  142. package/dist/entrypoints/testing.d.ts +2 -1
  143. package/dist/entrypoints/testing.d.ts.map +1 -1
  144. package/dist/entrypoints/testing.js +288 -281
  145. package/dist/entrypoints/tools/connections.js +2 -2
  146. package/dist/entrypoints/tools/invoker.js +4 -4
  147. package/dist/entrypoints/tools.d.ts +6 -3
  148. package/dist/entrypoints/tools.d.ts.map +1 -1
  149. package/dist/entrypoints/tools.js +245 -202
  150. package/dist/entrypoints/tracking.js +325 -274
  151. package/dist/files/boundary.d.ts.map +1 -1
  152. package/dist/files/file-io.d.ts +14 -0
  153. package/dist/files/file-io.d.ts.map +1 -0
  154. package/dist/index-1j8pm5t0.js +412 -0
  155. package/dist/{index-kvj7f4hq.js → index-2bxbyab0.js} +10 -2
  156. package/dist/{index-xnj9bgxe.js → index-2gxzjvyr.js} +2 -162
  157. package/dist/index-4gcnakhx.js +82 -0
  158. package/dist/{index-j05z5gn4.js → index-55hkhm67.js} +136 -119
  159. package/dist/{index-cq4qfycf.js → index-79z7m7dt.js} +227 -59
  160. package/dist/{index-r7nmqpsg.js → index-7p1f0vp2.js} +1 -1
  161. package/dist/{index-dcpdvjsc.js → index-863ea9jb.js} +4 -4
  162. package/dist/index-8p52kd5p.js +242 -0
  163. package/dist/{index-97ac4gph.js → index-8zja4pkf.js} +26 -4
  164. package/dist/{index-2qzskm8h.js → index-dce5wxcq.js} +1 -1
  165. package/dist/index-e01r054k.js +105 -0
  166. package/dist/{index-sees8yf8.js → index-ensd0r74.js} +118 -111
  167. package/dist/{index-1nd48tm9.js → index-gxrt5h6v.js} +2 -1
  168. package/dist/{index-e87kakm4.js → index-ham5sz8m.js} +112 -110
  169. package/dist/{index-kj2wbeta.js → index-het2he5g.js} +280 -196
  170. package/dist/{index-vcvkq30w.js → index-hmp4800j.js} +3 -3
  171. package/dist/{index-gyr48nzg.js → index-k30h66yd.js} +71 -151
  172. package/dist/{index-2cr1cqhn.js → index-khtgb21r.js} +2 -2
  173. package/dist/{index-x4799c19.js → index-ndddxtyx.js} +11 -11
  174. package/dist/{index-dydjcp8z.js → index-np4m8hd3.js} +38 -36
  175. package/dist/{index-p81267c2.js → index-p3vsv1fb.js} +621 -357
  176. package/dist/{index-mp5sn43f.js → index-p9e0w8hs.js} +2 -2
  177. package/dist/{index-rewkc2hj.js → index-p9sh0xx4.js} +3 -3
  178. package/dist/{index-70yj2ebz.js → index-paz6sgdp.js} +107 -103
  179. package/dist/{index-bn2cjajt.js → index-px2gm2jp.js} +26 -102
  180. package/dist/index-s812ycat.js +65 -0
  181. package/dist/{index-xsqjkha9.js → index-sp1tzwnb.js} +2 -2
  182. package/dist/{index-n6hxg8as.js → index-t9rhjr9f.js} +615 -566
  183. package/dist/{index-zeemqhqx.js → index-v260df89.js} +88 -80
  184. package/dist/{index-fdp6hdxn.js → index-w906953s.js} +5 -1
  185. package/dist/{index-mdzh02yc.js → index-wdkt63w3.js} +1 -1
  186. package/dist/{index-58k4fp34.js → index-wsm5w4ee.js} +1 -1
  187. package/dist/{index-v38qyerb.js → index-xw3s75nj.js} +1 -1
  188. package/dist/internal/atomic-file.d.ts +23 -2
  189. package/dist/internal/atomic-file.d.ts.map +1 -1
  190. package/dist/internal/exclusive-lock.d.ts +51 -0
  191. package/dist/internal/exclusive-lock.d.ts.map +1 -0
  192. package/dist/internal/process-identity.d.ts +47 -0
  193. package/dist/internal/process-identity.d.ts.map +1 -0
  194. package/dist/internal/with-exclusive-lock.d.ts +67 -0
  195. package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
  196. package/dist/live/watch-client.d.ts.map +1 -1
  197. package/dist/observability/audit.d.ts +2 -2
  198. package/dist/observability/audit.d.ts.map +1 -1
  199. package/dist/observability/event.d.ts +2 -1
  200. package/dist/observability/event.d.ts.map +1 -1
  201. package/dist/primitives/export-operation.d.ts +1 -1
  202. package/dist/primitives/export-operation.d.ts.map +1 -1
  203. package/dist/realtime/registry.d.ts +0 -5
  204. package/dist/realtime/registry.d.ts.map +1 -1
  205. package/dist/server/bun.d.ts +0 -1
  206. package/dist/server/bun.d.ts.map +1 -1
  207. package/dist/server/context-contribution.d.ts +1 -1
  208. package/dist/server/context-contribution.d.ts.map +1 -1
  209. package/dist/server/context.d.ts +1 -1
  210. package/dist/server/context.d.ts.map +1 -1
  211. package/dist/server/endpoint-response.d.ts +2 -1
  212. package/dist/server/endpoint-response.d.ts.map +1 -1
  213. package/dist/server/error-dispatch.d.ts +1 -1
  214. package/dist/server/error-dispatch.d.ts.map +1 -1
  215. package/dist/server/error-hook.d.ts +1 -1
  216. package/dist/server/error-hook.d.ts.map +1 -1
  217. package/dist/server/handler-state.d.ts +1 -1
  218. package/dist/server/handler-state.d.ts.map +1 -1
  219. package/dist/server/implement-registry.d.ts +54 -0
  220. package/dist/server/implement-registry.d.ts.map +1 -0
  221. package/dist/server/implement.d.ts +9 -55
  222. package/dist/server/implement.d.ts.map +1 -1
  223. package/dist/server/middleware/auth.d.ts +1 -31
  224. package/dist/server/middleware/auth.d.ts.map +1 -1
  225. package/dist/server/middleware/jwt.d.ts +31 -0
  226. package/dist/server/middleware/jwt.d.ts.map +1 -0
  227. package/dist/server/multipart-reader.d.ts +22 -0
  228. package/dist/server/multipart-reader.d.ts.map +1 -0
  229. package/dist/server/multipart.d.ts +1 -1
  230. package/dist/server/multipart.d.ts.map +1 -1
  231. package/dist/server/oauth/cimd.d.ts +88 -0
  232. package/dist/server/oauth/cimd.d.ts.map +1 -0
  233. package/dist/server/oauth/endpoints.d.ts +39 -0
  234. package/dist/server/oauth/endpoints.d.ts.map +1 -0
  235. package/dist/server/oauth/provider.d.ts +1 -68
  236. package/dist/server/oauth/provider.d.ts.map +1 -1
  237. package/dist/server/streaming-pump.d.ts +66 -0
  238. package/dist/server/streaming-pump.d.ts.map +1 -0
  239. package/dist/server/streaming-route.d.ts +12 -5
  240. package/dist/server/streaming-route.d.ts.map +1 -1
  241. package/dist/server/types.d.ts +4 -1
  242. package/dist/server/types.d.ts.map +1 -1
  243. package/dist/server/unix-client-bun.d.ts.map +1 -1
  244. package/dist/server/unix-client-http1.d.ts +76 -0
  245. package/dist/server/unix-client-http1.d.ts.map +1 -0
  246. package/dist/server/unix-client.d.ts.map +1 -1
  247. package/dist/testing/handler-clients.d.ts +2 -1
  248. package/dist/testing/handler-clients.d.ts.map +1 -1
  249. package/dist/testing/realtime-probe.d.ts +33 -0
  250. package/dist/testing/realtime-probe.d.ts.map +1 -0
  251. package/dist/testing/surface-conformance.d.ts +0 -31
  252. package/dist/testing/surface-conformance.d.ts.map +1 -1
  253. package/dist/testing/surface-manifest-digest.d.ts +44 -0
  254. package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
  255. package/dist/testing/surface-manifest.d.ts.map +1 -1
  256. package/dist/tools/agent.d.ts +1 -1
  257. package/dist/tools/agent.d.ts.map +1 -1
  258. package/dist/tools/cli/args-fields.d.ts +31 -0
  259. package/dist/tools/cli/args-fields.d.ts.map +1 -0
  260. package/dist/tools/cli/args-route.d.ts +42 -0
  261. package/dist/tools/cli/args-route.d.ts.map +1 -0
  262. package/dist/tools/cli/args-view.d.ts +32 -0
  263. package/dist/tools/cli/args-view.d.ts.map +1 -0
  264. package/dist/tools/cli/args.d.ts +2 -65
  265. package/dist/tools/cli/args.d.ts.map +1 -1
  266. package/dist/tools/cli/argument-error.d.ts +5 -0
  267. package/dist/tools/cli/argument-error.d.ts.map +1 -0
  268. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  269. package/dist/tools/cli/command.d.ts +1 -1
  270. package/dist/tools/cli/command.d.ts.map +1 -1
  271. package/dist/tools/cli/config.d.ts +1 -1
  272. package/dist/tools/cli/config.d.ts.map +1 -1
  273. package/dist/tools/cli/format.d.ts +2 -1
  274. package/dist/tools/cli/format.d.ts.map +1 -1
  275. package/dist/tools/cli/invoke.d.ts +2 -1
  276. package/dist/tools/cli/invoke.d.ts.map +1 -1
  277. package/dist/tools/cli/managed-surface.d.ts +1 -1
  278. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  279. package/dist/tools/cli/policy.d.ts +1 -1
  280. package/dist/tools/cli/policy.d.ts.map +1 -1
  281. package/dist/tools/cli/prepare.d.ts.map +1 -1
  282. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  283. package/dist/tools/cli/session.d.ts +1 -1
  284. package/dist/tools/cli/session.d.ts.map +1 -1
  285. package/dist/tools/cli/update.d.ts +19 -0
  286. package/dist/tools/cli/update.d.ts.map +1 -1
  287. package/dist/tools/cli/view.d.ts +1 -1
  288. package/dist/tools/cli/view.d.ts.map +1 -1
  289. package/dist/tools/cli/wait.d.ts +1 -1
  290. package/dist/tools/cli/wait.d.ts.map +1 -1
  291. package/dist/tools/connections/runtime.d.ts +1 -1
  292. package/dist/tools/connections/runtime.d.ts.map +1 -1
  293. package/dist/tools/execute-args.d.ts +23 -0
  294. package/dist/tools/execute-args.d.ts.map +1 -0
  295. package/dist/tools/execute-hooks.d.ts +146 -0
  296. package/dist/tools/execute-hooks.d.ts.map +1 -0
  297. package/dist/tools/execute-result.d.ts +40 -0
  298. package/dist/tools/execute-result.d.ts.map +1 -0
  299. package/dist/tools/execute.d.ts +4 -193
  300. package/dist/tools/execute.d.ts.map +1 -1
  301. package/dist/tools/internal/surface-projector.d.ts +2 -1
  302. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  303. package/dist/tools/invoker.d.ts +2 -1
  304. package/dist/tools/invoker.d.ts.map +1 -1
  305. package/dist/tools/lifecycle.d.ts +1 -1
  306. package/dist/tools/lifecycle.d.ts.map +1 -1
  307. package/dist/tools/mcp/mount.d.ts +1 -1
  308. package/dist/tools/mcp/mount.d.ts.map +1 -1
  309. package/dist/tools/mcp/prepare.d.ts +2 -1
  310. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  311. package/dist/tools/mcp/progress.d.ts +1 -1
  312. package/dist/tools/mcp/progress.d.ts.map +1 -1
  313. package/dist/tools/mcp/register.d.ts +3 -2
  314. package/dist/tools/mcp/register.d.ts.map +1 -1
  315. package/dist/tools/mcp/round-context.d.ts +38 -0
  316. package/dist/tools/mcp/round-context.d.ts.map +1 -0
  317. package/dist/tools/mcp/round-policy.d.ts +1 -1
  318. package/dist/tools/mcp/round-policy.d.ts.map +1 -1
  319. package/dist/tools/mcp/round.d.ts +3 -11
  320. package/dist/tools/mcp/round.d.ts.map +1 -1
  321. package/dist/tools/mcp/runtime-tools.d.ts +2 -1
  322. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  323. package/dist/tools/mount.d.ts +3 -1
  324. package/dist/tools/mount.d.ts.map +1 -1
  325. package/dist/tools/native-definition.d.ts +2 -1
  326. package/dist/tools/native-definition.d.ts.map +1 -1
  327. package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -1
  328. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  329. package/dist/tools/operations/async-operation-runtime-types.d.ts +2 -1
  330. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  331. package/dist/tools/remote.d.ts.map +1 -1
  332. package/dist/tools/runtime-tool.d.ts +3 -1
  333. package/dist/tools/runtime-tool.d.ts.map +1 -1
  334. package/dist/tools/tool-logger.d.ts +1 -1
  335. package/dist/tools/tool-logger.d.ts.map +1 -1
  336. package/dist/tracking/client-listeners.d.ts +30 -0
  337. package/dist/tracking/client-listeners.d.ts.map +1 -0
  338. package/dist/tracking/client-visit.d.ts +61 -0
  339. package/dist/tracking/client-visit.d.ts.map +1 -0
  340. package/dist/tracking/client.d.ts +3 -2
  341. package/dist/tracking/client.d.ts.map +1 -1
  342. package/llms/application.2.txt +271 -7
  343. package/llms/application.txt +66 -289
  344. package/llms/cli.2.txt +80 -0
  345. package/llms/cli.txt +45 -74
  346. package/llms/contract.txt +3 -3
  347. package/llms/files.txt +3 -0
  348. package/llms/stitchkit.txt +3 -3
  349. package/llms/tools.2.txt +88 -279
  350. package/llms/tools.3.txt +288 -0
  351. package/llms/tools.txt +27 -65
  352. package/llms/{upgrading-0.37.0-0.50.0.txt → upgrading-0.37.0-0.53.0.txt} +25 -3
  353. package/llms/{upgrading-0.53.0-0.67.0.txt → upgrading-0.55.0-0.68.0.txt} +53 -25
  354. package/llms/{upgrading-0.68.0-0.94.0.txt → upgrading-0.69.0-0.95.0.txt} +45 -53
  355. package/llms/upgrading.txt +3 -3
  356. package/llms-full.txt +216 -43
  357. package/llms.txt +8 -8
  358. package/package.json +1 -1
  359. package/dist/index-e2z3ahw9.js +0 -325
  360. package/dist/index-mkm15s49.js +0 -394
@@ -1,14 +1,56 @@
1
- # Upgrading 0.68.0 → 0.94.0 — stitchkit docs slice
1
+ # Upgrading 0.69.0 → 0.95.0 — stitchkit docs slice
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
5
 
6
- Contains: Guide: Upgrading, 0.68.0 → 0.94.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.69.0 → 0.95.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.68.0 → 0.94.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.69.0 → 0.95.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.95.0
13
+
14
+ One breaking change in `stitchkit/application`: the process lifecycle ledger
15
+ counts downtime as the window nobody answered in, and gains the `draining`
16
+ phase and the `startup-failed` outcome. A ledger file written by an earlier
17
+ version loads unchanged — the new `unavailableAt` reads as `null`.
18
+
19
+ 1. **Read downtime from the ready fact.** **Who must act:** a project that
20
+ reads `downtimeMs` from a `started` fact. It is gone from `StartFact`; the
21
+ number it carried is `processGapMs`. The downtime now arrives with the new
22
+ run's readiness:
23
+
24
+ ```ts
25
+ // before
26
+ ledger.subscribe((fact) => {
27
+ if (fact.type === 'started') report(fact.previousExit, fact.downtimeMs);
28
+ });
29
+ // after
30
+ ledger.subscribe((fact) => {
31
+ if (fact.type === 'started') previousExit = fact.previousExit;
32
+ if (fact.type === 'ready') report(previousExit, fact.downtimeMs);
33
+ });
34
+ ```
35
+
36
+ 2. **Handle the new values.** **Who must act:** a project that switches
37
+ exhaustively over `LifecycleTermination` (new: `draining`,
38
+ `startup-failed`), `PreviousExit` (new: `startup-failed`) or
39
+ `ProcessLifecycleFact` (new: `DrainingFact`, `type: 'draining'`). The type
40
+ checker names each switch. An open run is `active` or `draining`; a check
41
+ written as `termination === 'active'` to mean "still running" becomes
42
+ `termination === 'active' || termination === 'draining'`.
43
+ `TransitionReadyInput` is renamed `TransitionRunInput` — the same fields,
44
+ now also taken by `transitionProcessDraining`; rename the import.
45
+
46
+ 3. **Record the drain and the readiness when driving the ledger by hand.**
47
+ **Who must act:** only a project that calls `createProcessLifecycleLedger`
48
+ methods itself instead of mounting `lifecycleLedgerResource`. Call
49
+ `recordDraining()` where the application stops admitting work, before it
50
+ drains; without it downtime is counted from the recorded stop. Call
51
+ `recordReady()` when the run serves; a run stopped without it now ends
52
+ `startup-failed`, not `clean`.
53
+
12
54
  ## Released migration: 0.94.0
13
55
 
14
56
  One breaking minor that consolidates: tool options move into one group, and
@@ -1107,53 +1149,3 @@ else renderExistingRole(message)
1107
1149
 
1108
1150
  No data migration is needed. The schema still accepts all earlier records, and applications that
1109
1151
  do not exhaustively branch over these unions compile unchanged.
1110
-
1111
- ## Released migration: 0.68.0
1112
-
1113
- ### Make Unix transport selection explicit outside Bun
1114
-
1115
- The legacy `unix` option remains a Bun convenience, but on Node or another
1116
- runtime it now fails before dispatch. Replace it with the owned adapter and close
1117
- that adapter with the application:
1118
-
1119
- ```ts
1120
- // before — unsafe outside Bun: an unsupported fetch could dial baseUrl over TCP
1121
- const http = createHttpClient({ baseUrl, unix: '/run/service.sock' })
1122
-
1123
- // after — Bun and Node; every dispatch and redirect stays on the socket
1124
- import { createUnixClientTransport } from 'stitchkit/server' // or stitchkit/node
1125
- const transport = createUnixClientTransport({ socketPath: '/run/service.sock' })
1126
- const http = createHttpClient({ baseUrl, fetch: transport.fetch })
1127
- // during shutdown
1128
- await transport.close()
1129
- ```
1130
-
1131
- Do not automatically replay `possibly-dispatched`: a timeout or connection loss
1132
- after bytes left the process does not prove that a write did not happen.
1133
-
1134
- ### Choose tolerant stream parsing explicitly
1135
-
1136
- `parseNDJSON` and `parseSSE` now throw on malformed JSON, invalid UTF-8 and an
1137
- over-limit line. The default line ceiling is 1 MiB. If a feed deliberately skips
1138
- bad records, retain that policy explicitly:
1139
-
1140
- ```ts
1141
- // before — malformed input disappeared implicitly
1142
- parseNDJSON(response)
1143
-
1144
- // after — ordinary fail-closed path
1145
- parseNDJSON(response, { maxLineBytes: 256 * 1024 })
1146
-
1147
- // after — deliberately tolerant path
1148
- parseNDJSON(response, { onParseError: (raw, error) => report(raw, error) })
1149
- ```
1150
-
1151
- ### Extend exhaustive framework-error handling
1152
-
1153
- If a switch makes `StitchErrorCode` exhaustive, add
1154
- `STREAM_ITEM_INVALID`, `STREAM_FRAME_TOO_LARGE`,
1155
- `STREAM_TERMINAL_MISSING` and `STREAM_LIFETIME_EXCEEDED`. A partial application
1156
- status map needs no change (ADR 0105).
1157
-
1158
- The admission/channel APIs and endpoint `stream` descriptor are additive; raw
1159
- responses and raw `streamingRoute` remain supported.
@@ -11,9 +11,9 @@ Contains: Guide: Upgrading, general (docs/guide/upgrading.md)
11
11
 
12
12
  Load this slice, then every range slice between your installed version and the target:
13
13
 
14
- - 0.68.0 → 0.94.0: `llms/upgrading-0.68.0-0.94.0.txt`
15
- - 0.53.0 → 0.67.0: `llms/upgrading-0.53.0-0.67.0.txt`
16
- - 0.37.0 → 0.50.0: `llms/upgrading-0.37.0-0.50.0.txt`
14
+ - 0.69.0 → 0.95.0: `llms/upgrading-0.69.0-0.95.0.txt`
15
+ - 0.55.0 → 0.68.0: `llms/upgrading-0.55.0-0.68.0.txt`
16
+ - 0.37.0 → 0.53.0: `llms/upgrading-0.37.0-0.53.0.txt`
17
17
 
18
18
  # Upgrading stitchkit
19
19
 
package/llms-full.txt CHANGED
@@ -67,11 +67,11 @@ own, recorded as an ADR.
67
67
  | `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
68
68
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
69
69
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
70
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 39 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
70
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 40 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
71
71
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the managed-resource conformance kit |
72
72
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
73
73
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
74
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 21 of the 39 minors since 0.56.2, most recently 0.94.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
74
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 21 of the 40 minors since 0.56.2, most recently 0.94.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
75
75
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
76
76
  | `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
77
77
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -81,7 +81,7 @@ own, recorded as an ADR.
81
81
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
82
82
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
83
83
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
84
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the 39 minors since 0.56.2, most recently 0.83.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
84
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 8 of the 40 minors since 0.56.2, most recently 0.95.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
85
85
  | `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
86
86
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
87
87
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -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
 
@@ -7010,39 +7061,74 @@ application-owned.
7010
7061
  ## Durable process facts and owner notifications
7011
7062
 
7012
7063
  `createProcessLifecycleLedger` records a bounded versioned list of process runs.
7013
- Start, readiness and shutdown target both `runId` and `pid`, so hot reload and
7014
- PID reuse cannot close the wrong generation. A start classifies what happened to
7015
- the newest run before it, and the classification is decided by three facts —
7016
- whether that run recorded its own exit, whether the pid is the same, and whether
7017
- the version changed:
7064
+ Start, readiness, draining and shutdown target both `runId` and `pid`, so hot
7065
+ reload and PID reuse cannot close the wrong generation. `lifecycleLedgerResource`
7066
+ drives it from the kernel's phases: `start` records the start, `activate` the
7067
+ readiness, `stopAdmission` the drain — the run's `unavailableAt`, the moment it
7068
+ stops answering new work — and `close` / `force` the stop. A run that stops
7069
+ without ever becoming ready (a failed startup rolls back with `close` only)
7070
+ ends as `startup-failed`, not `clean`.
7071
+
7072
+ A start classifies what happened to the newest run before it, and the
7073
+ classification is decided by four facts — whether that run recorded its own
7074
+ exit, whether the pid is the same, whether the version changed and whether it
7075
+ ever became ready:
7018
7076
 
7019
7077
  | newest run | same pid | version | `previousExit` | predecessor's `termination` |
7020
7078
  |---|---|---|---|---|
7021
7079
  | none | — | — | `first-boot` | — |
7022
- | recorded `stoppedAt` | — | — | `clean` / `forced` / `abnormal` as recorded | unchanged |
7023
- | still `active` | yes | — | `hot-reload` | `hot-reload`, closed at the new start |
7024
- | still `active` | no | changed | `handoff` | stays `active`; it records its own stop later |
7025
- | still `active` | no | same | `abnormal` (default) | `abnormal`, closed at the new start — an upper bound, the crash time is unknown |
7080
+ | recorded `stoppedAt` | — | — | `clean` / `forced` / `startup-failed` / `abnormal` as recorded | unchanged |
7081
+ | still open | yes | — | `hot-reload` | `hot-reload`, closed at the new start |
7082
+ | still open | no | changed | `handoff` | stays open; it records its own stop later |
7083
+ | still open, was ready | no | same | `abnormal` (default) | `abnormal`, closed at the new start — an upper bound, the crash time is unknown |
7084
+ | still open, never ready | no | same | `startup-failed` (default) | `startup-failed`, closed at the new start |
7085
+
7086
+ Every other open run the start finds was abandoned too and is closed the same
7087
+ way — two crashes in a row leave two open runs, and both are closed, not only
7088
+ the newest. Open means `active` or `draining`.
7026
7089
 
7027
7090
  A version of `unknown` on either side is never a version change, so a dev build
7028
7091
  after a crashed release reads `abnormal`, not `handoff`. `forced` means the
7029
7092
  process itself acknowledged a kill; `abnormal` means a successor found it dead.
7030
7093
 
7031
- The last row is a choice, and the default is the single-process deployment:
7094
+ ### Downtime is the window nobody answered in
7095
+
7096
+ `ReadyFact.downtimeMs` is `readyAt` of the new run minus `unavailableAt` of the
7097
+ last run that served — the predecessor's drain plus the successor's boot. A
7098
+ 110 s forced drain followed by a 4 s boot is 114 s of downtime; the gap between
7099
+ the two processes alone would read 4 s before and after that defect was fixed.
7100
+ Runs that never became ready answered nobody, so the count passes them: after a
7101
+ failed start it still opens where the last serving run stopped answering. It is
7102
+ `0` when that run still answers (a handoff whose predecessor has not drained
7103
+ yet) and `null` on first boot and when the end was never timed — a crash or a
7104
+ hot reload records no `unavailableAt`. `unavailableSince` names the moment it is
7105
+ counted from. The gap between two processes is still there, under its own
7106
+ name: `StartFact.processGapMs` is the start minus the predecessor's recorded
7107
+ stop.
7108
+
7109
+ The ledger records what the process says while it can say it. stitchkit never
7110
+ calls `process.exit` (ADR 0074), so a stop is recorded on the kernel's `close`
7111
+ or `force` path, both awaited. An application that exits the process on its
7112
+ own before its shutdown settles loses that last write; the successor then
7113
+ finds the run open and closes it as `abnormal`, keeping the `unavailableAt`
7114
+ already recorded — which is why the drain moment is written first, at
7115
+ `stopAdmission`, and the downtime survives a stop that was never recorded.
7116
+
7117
+ The `abnormal` default is a choice, and it is the single-process deployment:
7032
7118
  one process per build, a new pid of the same build means the old one stopped
7033
- answering. Where two processes of **one** build overlap on purpose — a
7034
- cluster, a zero-downtime reload of the same build — pass
7035
- `sameVersionOverlap: 'handoff'` to the ledger, and the predecessor stays
7036
- `active` until it records its own shutdown. The cost of that setting is
7037
- symmetric: a real crash under it is reported as a handoff and the dead run
7038
- stays `active` in the ledger until retention drops it. The list is kept in the
7039
- order the transitions wrote it — every write goes through one atomic update,
7040
- so that order is the causal one, and a successor whose clock lags its
7041
- predecessor still finds it at the head; `startedAt` is data, not the sort key.
7042
- Retention (`retain`, default 20) drops finished runs first and an active one —
7043
- a live handoff predecessor — only when nothing finished is left. Facts are
7044
- published through the ledger's own subscription and resource value;
7045
- `ApplicationEventSink` remains the strict application-state stream.
7119
+ answering. Where processes of **one** build overlap on purpose — a cluster, a
7120
+ zero-downtime reload of the same build — pass `sameVersionOverlap: 'handoff'`
7121
+ to the ledger, and every open run stays open until it records its own
7122
+ shutdown. The cost of that setting is symmetric: a real crash under it is
7123
+ reported as a handoff and the dead run stays open in the ledger until
7124
+ retention drops it. The list is kept in the order the transitions wrote it —
7125
+ every write goes through one atomic update, so that order is the causal one,
7126
+ and a successor whose clock lags its predecessor still finds it at the head;
7127
+ `startedAt` is data, not the sort key. Retention (`retain`, default 20) drops
7128
+ finished runs first and an open one — a live handoff predecessor — only when
7129
+ nothing finished is left. Facts are published through the ledger's own
7130
+ subscription and resource value; `ApplicationEventSink` remains the strict
7131
+ application-state stream.
7046
7132
 
7047
7133
  `createNotificationOutbox` is the transport-neutral durable delivery side. It
7048
7134
  persists before send, claims an item with an expiring lease, carries one stable
@@ -7781,6 +7867,15 @@ fields in declaration order, so `myapp generate "a fox"` is
7781
7867
  `--prompt "a fox"`. A piped value fills the first required unset field:
7782
7868
  `echo "a fox" | myapp generate`.
7783
7869
 
7870
+ A token is an option only when it is a long form (`--name`, `--name=value`,
7871
+ `--`) or `-` followed by a letter. Anything else that starts with `-` is data:
7872
+ `myapp note a "- item"` fills a positional, and after an option that expects a
7873
+ value the next token is that value — `--grep -foo`, `--count -5`. The next
7874
+ token is refused as a value only when it is itself an option, so `--grep --json`
7875
+ still reports that `--grep` requires a value. A value that cannot be read as
7876
+ its field's type is refused naming the flag and what was typed:
7877
+ `--tail expects a whole number, got "abc"`.
7878
+
7784
7879
  For a stable shell grammar, declare the default command, short aliases and the
7785
7880
  exact positional fields on `createCli`:
7786
7881
 
@@ -8253,6 +8348,37 @@ nothing to keep, which is not a failure.
8253
8348
  happens to be at the backup path is a second install of an unverified binary,
8254
8349
  and the day it is used is the day nobody is in a position to check.
8255
8350
 
8351
+ ### Run it before it replaces anything — `verify`
8352
+
8353
+ A digest proves the bytes are the ones published, not that they load. A tool
8354
+ that updates itself unattended — a daemon — and installs a build that does not
8355
+ start takes its own updater down with it, and every machine is then repaired by
8356
+ hand. `verify` is the step between "digest matched" and "target replaced":
8357
+
8358
+ ```ts
8359
+ await applyCliUpdate({
8360
+ asset, targetPath, backupPath,
8361
+ verify: async (candidate, signal) => {
8362
+ const child = Bun.spawn(['bun', candidate, 'version'], { signal, stdout: 'pipe' })
8363
+ const printed = (await new Response(child.stdout).text()).trim()
8364
+ if ((await child.exited) !== 0 || printed !== check.version) {
8365
+ throw new Error(`printed ${printed}, expected ${check.version}`)
8366
+ }
8367
+ },
8368
+ verifyTimeoutMs: 15_000, // default 30 000
8369
+ })
8370
+ ```
8371
+
8372
+ The verified bytes are written beside the target as an executable candidate
8373
+ with the target's extension, and `verify` gets its path — a path rather than a
8374
+ command, because a JavaScript bundle is started through its runtime. It runs
8375
+ before the backup and the replacement. If it throws or outlives
8376
+ `verifyTimeoutMs` (its `signal` aborts at the deadline), the candidate is
8377
+ removed, the target and any earlier backup are untouched, and the update is
8378
+ refused with the reason as its cause. The target is written from the checked
8379
+ bytes in memory, never from the candidate file, so nothing the candidate did
8380
+ while it ran can change what is installed.
8381
+
8256
8382
  ### Two release tracks
8257
8383
 
8258
8384
  `assertCliPublishable` takes one manifest **or every manifest already
@@ -12573,6 +12699,48 @@ analytics policy belong to the application.
12573
12699
 
12574
12700
  # Upgrading stitchkit
12575
12701
 
12702
+ ## Released migration: 0.95.0
12703
+
12704
+ One breaking change in `stitchkit/application`: the process lifecycle ledger
12705
+ counts downtime as the window nobody answered in, and gains the `draining`
12706
+ phase and the `startup-failed` outcome. A ledger file written by an earlier
12707
+ version loads unchanged — the new `unavailableAt` reads as `null`.
12708
+
12709
+ 1. **Read downtime from the ready fact.** **Who must act:** a project that
12710
+ reads `downtimeMs` from a `started` fact. It is gone from `StartFact`; the
12711
+ number it carried is `processGapMs`. The downtime now arrives with the new
12712
+ run's readiness:
12713
+
12714
+ ```ts
12715
+ // before
12716
+ ledger.subscribe((fact) => {
12717
+ if (fact.type === 'started') report(fact.previousExit, fact.downtimeMs);
12718
+ });
12719
+ // after
12720
+ ledger.subscribe((fact) => {
12721
+ if (fact.type === 'started') previousExit = fact.previousExit;
12722
+ if (fact.type === 'ready') report(previousExit, fact.downtimeMs);
12723
+ });
12724
+ ```
12725
+
12726
+ 2. **Handle the new values.** **Who must act:** a project that switches
12727
+ exhaustively over `LifecycleTermination` (new: `draining`,
12728
+ `startup-failed`), `PreviousExit` (new: `startup-failed`) or
12729
+ `ProcessLifecycleFact` (new: `DrainingFact`, `type: 'draining'`). The type
12730
+ checker names each switch. An open run is `active` or `draining`; a check
12731
+ written as `termination === 'active'` to mean "still running" becomes
12732
+ `termination === 'active' || termination === 'draining'`.
12733
+ `TransitionReadyInput` is renamed `TransitionRunInput` — the same fields,
12734
+ now also taken by `transitionProcessDraining`; rename the import.
12735
+
12736
+ 3. **Record the drain and the readiness when driving the ledger by hand.**
12737
+ **Who must act:** only a project that calls `createProcessLifecycleLedger`
12738
+ methods itself instead of mounting `lifecycleLedgerResource`. Call
12739
+ `recordDraining()` where the application stops admitting work, before it
12740
+ drains; without it downtime is counted from the recorded stop. Call
12741
+ `recordReady()` when the run serves; a run stopped without it now ends
12742
+ `startup-failed`, not `clean`.
12743
+
12576
12744
  ## Released migration: 0.94.0
12577
12745
 
12578
12746
  One breaking minor that consolidates: tool options move into one group, and
@@ -16393,12 +16561,12 @@ from the root `stitchkit`.
16393
16561
  | `PathParams` | _type_ | infer named `:segments` and a terminal `*wildcard` from a path literal as string params |
16394
16562
  | `ContractMeta` | _type_ | a contract's `prefix` + optional `scope` and `meta` (a default every endpoint shallow-merges over) |
16395
16563
  | `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) |
16564
+ | `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
16565
  | `EndpointToolOptions` | _type_ | an endpoint's `tool` group — `name`, `view`, `ui`, `annotations`, `mcp`: what the tool surfaces read that HTTP does not |
16398
16566
  | `EndpointToolView` | _type_ | the stored shape of a tool view (`MethodDef.toolView`) |
16399
16567
  | `DeclaredToolView` | _type_ | a tool view as `withToolView` produces it — the only form `tool.view` accepts |
16400
16568
  | `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` |
16569
+ | `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
16570
  | `ToolViewCall` | _type_ | what `project` is told besides the full result: the parsed `input` and the `source` |
16403
16571
  | `ToolViewSliceMismatch` | _type_ | the compile-time refusal of a slice whose schema does not accept the full output |
16404
16572
  | `ToolViewNeedsToolTransport` | _type_ | the compile-time refusal of a view on an `expose: ['HTTP']` endpoint |
@@ -16801,11 +16969,11 @@ cutovers are covered by the executable
16801
16969
  | `createApplication` | function | compose a validated resource DAG into one startup, readiness, admission and shutdown state machine |
16802
16970
  | `StateStore` / `StateStoreUpdate` | _type_ | async atomic read/update boundary shared by durable application state machines |
16803
16971
  | `createProcessLifecycleLedger` / `ProcessLifecycleLedger` / `ProcessLifecycleLedgerConfig` | function / _type_ | durable bounded run history and typed fact subscription |
16804
- | `LifecycleRunSchema` / `LifecycleRun` / `LifecycleStateSchema` / `LifecycleState` / `LifecycleTerminationSchema` / `LifecycleTermination` | schema / _type_ | versioned process-run state and termination vocabulary |
16805
- | `PreviousExitSchema` / `PreviousExit` / `StartFact` / `ReadyFact` / `ShutdownFact` / `ProcessLifecycleFact` | schema / _type_ | first-boot, hot-reload, clean, forced, handoff and abnormal lifecycle facts |
16806
- | `transitionProcessStart` / `transitionProcessReady` / `transitionProcessShutdown` | function | pure idempotent runId+pid-owned transitions |
16807
- | `LifecycleTransition` / `TransitionStartInput` / `TransitionReadyInput` / `TransitionShutdownInput` / `SameVersionOverlap` | _type_ | pure transition inputs, the same-build overlap policy (`abnormal` default / `handoff`) and state+fact result |
16808
- | `lifecycleLedgerResource` / `LifecycleLedgerResource` / `LifecycleLedgerResourceConfig` | function / _type_ | managed-resource adapter that records start, readiness and shutdown |
16972
+ | `LifecycleRunSchema` / `LifecycleRun` / `LifecycleStateSchema` / `LifecycleState` / `LifecycleTerminationSchema` / `LifecycleTermination` | schema / _type_ | versioned process-run state — open (`active`, `draining` with `unavailableAt`) and ended (`clean`, `forced`, `startup-failed`, `hot-reload`, `abnormal`) |
16973
+ | `PreviousExitSchema` / `PreviousExit` / `StartFact` / `ReadyFact` / `DrainingFact` / `ShutdownFact` / `ProcessLifecycleFact` | schema / _type_ | first-boot, hot-reload, clean, forced, startup-failed, handoff and abnormal lifecycle facts; `processGapMs` on start, `downtimeMs` (unavailable → ready) on ready |
16974
+ | `transitionProcessStart` / `transitionProcessReady` / `transitionProcessDraining` / `transitionProcessShutdown` | function | pure idempotent runId+pid-owned transitions |
16975
+ | `LifecycleTransition` / `TransitionStartInput` / `TransitionRunInput` / `TransitionShutdownInput` / `SameVersionOverlap` | _type_ | pure transition inputs (`TransitionRunInput` for ready and draining, extended with `forced` for shutdown), the same-build overlap policy (`abnormal` default / `handoff`) and state+fact result |
16976
+ | `lifecycleLedgerResource` / `LifecycleLedgerResource` / `LifecycleLedgerResourceConfig` | function / _type_ | managed-resource adapter that records start, readiness, admission stop (draining) and shutdown |
16809
16977
  | `createNotificationOutbox` / `NotificationOutbox` / `NotificationOutboxConfig` | function / _type_ | bounded at-least-once queue with durable claims, leases, retries and supersede |
16810
16978
  | `NotificationOutboxItem` / `NotificationOutboxReceipt` / `NotificationOutboxState` / `NotificationSend` / `NotificationFailureClassification` / `DroppedNotification` / `EnqueueNotification` | _type_ | versioned queue records, stable send identity and delivery decisions |
16811
16979
  | `notificationOutboxStateSchema` | function | strict persisted-state schema over an application payload schema |
@@ -17817,7 +17985,9 @@ mountAgent(services, { durability: (toolCallId) => myLedgerFor(toolCallId) });
17817
17985
  | `DurableJsonValue` | _type_ | what a durable step result may hold — a record is read back in another process, so it must be JSON |
17818
17986
  | `createLocalStepDurability` | function | the durability engine — replay, absolute deadlines, park/deliver — over a two-method ledger the application owns |
17819
17987
  | `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 |
17988
+ | `LocalStepDurability` | _type_ | what the engine returns; satisfies `ToolDurability` and adds `deliver`, `effect` and record introspection for the ledger's owner |
17989
+ | `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 |
17990
+ | `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
17991
  | `LocalStepDurabilityOptions` | _type_ | `{ store, conversationId, runId, signal?, subscribe?, clock? }` |
17822
17992
  | `AppendAgentStoreEvent` / `ReadAgentStoreEvents` / `AgentStoreEventEnvelope` / `AgentStoreEventPage` | _type_ | the ledger's row shapes, re-exported so a ledger is typed from the entrypoint that consumes it |
17823
17993
  | `AgentToolError` | class | the model-safe envelope a failed agent tool throws |
@@ -17996,6 +18166,9 @@ available from `stitchkit/contract`.
17996
18166
  | `ManagedFileError` / `ManagedFileErrorCode` | class / _type_ | stable boundary failures; registered `FILE_*` mistakes are caller-safe while `FILE_IO_ERROR` remains internal |
17997
18167
  | `ManagedFileInspector` | _type_ | bounded-prefix read/write inspection callback with a finite cancellation signal that cannot own path or size |
17998
18168
  | `ManagedFileInspectionInput` / `ManagedFileInspection` | _type_ | inspector prefix/name/declared media/signal input and validated metadata-only result |
18169
+ | `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 |
18170
+ | `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` |
18171
+ | `ExclusiveLockError` | class | `LOCK_TIMEOUT` naming the resource and its holder, or `LOCK_ABORTED` with the signal's reason |
17999
18172
 
18000
18173
  ---
18001
18174
 
@@ -18276,7 +18449,7 @@ SDK nor the `ai` peer.
18276
18449
  | `CliBuildStampSchema` / `CliBuildStamp` | schema / _type_ | the version/commit/build time carried inside a binary |
18277
18450
  | `CliInstallerConfig` | _type_ | manifest, binary name, default install directory, and an optional `asset` — omit it for one script that selects the target by `uname` |
18278
18451
  | `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 |
18452
+ | `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
18453
  | `CliProfileStore` / `CliProfileStoreConfig` / `ResolvedCliProfile` | _type_ | the profile store, its directory/schema/hint config, and one resolution |
18281
18454
  | `CliResultView` | _type_ | the requested view — `count`, `sum`, or `records` (ordered and/or table-rendered) |
18282
18455
  | `CliViewOutput` | _type_ | a JSON value, or the one human-facing text shape |
package/llms.txt CHANGED
@@ -12,13 +12,13 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
12
12
  - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 15.1 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 35.0 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 14.2 KB
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.6 KB
15
- - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 47.2 KB → [llms/tools.2.txt](llms/tools.2.txt) 46.2 KB
15
+ - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 44.9 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.3 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.4 KB
16
16
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
17
17
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
18
18
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.1 KB
19
- - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 46.9 KB
19
+ - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 41.3 KB → [llms/cli.2.txt](llms/cli.2.txt) 8.1 KB
20
20
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
21
- - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 31.8 KB
21
+ - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 31.9 KB
22
22
  - **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 9.3 KB
23
23
  - **stitchkit/server**: [llms/server.txt](llms/server.txt) 45.3 KB → [llms/server.2.txt](llms/server.2.txt) 14.6 KB → [llms/server.3.txt](llms/server.3.txt) 42.7 KB → [llms/server.4.txt](llms/server.4.txt) 37.3 KB → [llms/server.5.txt](llms/server.5.txt) 21.8 KB
24
24
  - **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 42.8 KB
@@ -30,14 +30,14 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
30
30
  - **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 1.1 KB
31
31
  - **stitchkit/agent-runtime/sqlite/bun**: [llms/agent-runtime-sqlite-bun.txt](llms/agent-runtime-sqlite-bun.txt) 1.8 KB
32
32
  - **stitchkit/agent-runtime/sqlite/node**: [llms/agent-runtime-sqlite-node.txt](llms/agent-runtime-sqlite-node.txt) 1.7 KB
33
- - **stitchkit/application**: [llms/application.txt](llms/application.txt) 47.3 KB → [llms/application.2.txt](llms/application.2.txt) 22.0 KB
33
+ - **stitchkit/application**: [llms/application.txt](llms/application.txt) 40.1 KB → [llms/application.2.txt](llms/application.2.txt) 31.9 KB
34
34
  - **stitchkit/application/grammy**: [llms/application-grammy.txt](llms/application-grammy.txt) 1.5 KB
35
35
  - **stitchkit/application/opentelemetry**: [llms/application-opentelemetry.txt](llms/application-opentelemetry.txt) 1.6 KB
36
36
  - **stitchkit/application/diagnostic-journal**: [llms/application-diagnostic-journal.txt](llms/application-diagnostic-journal.txt) 1.4 KB
37
37
  - **stitchkit/application/schemas**: [llms/application-schemas.txt](llms/application-schemas.txt) 1.8 KB
38
38
  - **stitchkit/testing**: [llms/testing.txt](llms/testing.txt) 30.8 KB
39
39
  - **stitchkit/agent-runtime/sandbox**: [llms/agent-runtime-sandbox.txt](llms/agent-runtime-sandbox.txt) 8.1 KB
40
- - **stitchkit/files**: [llms/files.txt](llms/files.txt) 2.0 KB
40
+ - **stitchkit/files**: [llms/files.txt](llms/files.txt) 2.9 KB
41
41
  - **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt) 2.0 KB
42
42
  - **stitchkit/tracking**: [llms/tracking.txt](llms/tracking.txt) 16.8 KB
43
43
  - **stitchkit/release**: [llms/release.txt](llms/release.txt) 8.9 KB
@@ -50,9 +50,9 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
50
50
 
51
51
  ## Upgrading slices
52
52
  - **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 10.3 KB
53
- - **Upgrading 0.68.0 → 0.94.0**: [llms/upgrading-0.68.0-0.94.0.txt](llms/upgrading-0.68.0-0.94.0.txt) 46.5 KB
54
- - **Upgrading 0.53.0 → 0.67.0**: [llms/upgrading-0.53.0-0.67.0.txt](llms/upgrading-0.53.0-0.67.0.txt) 46.1 KB
55
- - **Upgrading 0.37.0 → 0.50.0**: [llms/upgrading-0.37.0-0.50.0.txt](llms/upgrading-0.37.0-0.50.0.txt) 31.6 KB
53
+ - **Upgrading 0.69.0 → 0.95.0**: [llms/upgrading-0.69.0-0.95.0.txt](llms/upgrading-0.69.0-0.95.0.txt) 46.6 KB
54
+ - **Upgrading 0.55.0 → 0.68.0**: [llms/upgrading-0.55.0-0.68.0.txt](llms/upgrading-0.55.0-0.68.0.txt) 47.0 KB
55
+ - **Upgrading 0.37.0 → 0.53.0**: [llms/upgrading-0.37.0-0.53.0.txt](llms/upgrading-0.37.0-0.53.0.txt) 32.6 KB
56
56
 
57
57
  ## Guide (web)
58
58
  - [Getting started](https://github.com/max-listov/stitchkit/blob/master/docs/guide/getting-started.md): install, entrypoints, and a first contract → server → client app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",