stitchkit 0.104.2 → 0.105.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 (430) hide show
  1. package/CHANGELOG.md +401 -13
  2. package/darwin-native.cjs +4 -2
  3. package/dist/agent-runtime/browser-control-contract.d.ts +32 -2
  4. package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
  5. package/dist/agent-runtime/browser-controller.d.ts +21 -3
  6. package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
  7. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  8. package/dist/agent-runtime/coding-tool-refusals.d.ts +1 -0
  9. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  10. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  11. package/dist/agent-runtime/compaction.d.ts.map +1 -1
  12. package/dist/agent-runtime/contained-write.d.ts.map +1 -1
  13. package/dist/agent-runtime/control-schema.d.ts +48 -1
  14. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  15. package/dist/agent-runtime/deferred-tool-search.d.ts +3 -2
  16. package/dist/agent-runtime/deferred-tool-search.d.ts.map +1 -1
  17. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  18. package/dist/agent-runtime/harness-realtime.d.ts +34 -4
  19. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
  20. package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -1
  21. package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
  22. package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
  23. package/dist/agent-runtime/sandbox-process-owner.d.ts +9 -1
  24. package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
  25. package/dist/agent-runtime/sandbox.d.ts +32 -1
  26. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  27. package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
  28. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  29. package/dist/agent-runtime/store-events.d.ts +9 -4
  30. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  31. package/dist/agent-runtime/testing.d.ts.map +1 -1
  32. package/dist/application/diagnostic-journal-contract.d.ts +50 -0
  33. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  34. package/dist/application/diagnostic-journal-generations.d.ts +24 -0
  35. package/dist/application/diagnostic-journal-generations.d.ts.map +1 -0
  36. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  37. package/dist/application/diagnostic-journal-open.d.ts +10 -0
  38. package/dist/application/diagnostic-journal-open.d.ts.map +1 -0
  39. package/dist/application/diagnostic-journal-quarantine.d.ts +28 -0
  40. package/dist/application/diagnostic-journal-quarantine.d.ts.map +1 -0
  41. package/dist/application/diagnostic-journal-read-contract.d.ts +73 -3
  42. package/dist/application/diagnostic-journal-read-contract.d.ts.map +1 -1
  43. package/dist/application/diagnostic-journal-reader.d.ts +17 -2
  44. package/dist/application/diagnostic-journal-reader.d.ts.map +1 -1
  45. package/dist/application/diagnostic-journal-recovery.d.ts +18 -2
  46. package/dist/application/diagnostic-journal-recovery.d.ts.map +1 -1
  47. package/dist/application/diagnostic-journal-storage.d.ts +6 -2
  48. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  49. package/dist/application/diagnostic-journal-tail.d.ts +12 -0
  50. package/dist/application/diagnostic-journal-tail.d.ts.map +1 -0
  51. package/dist/application/diagnostic-journal.d.ts +3 -0
  52. package/dist/application/diagnostic-journal.d.ts.map +1 -1
  53. package/dist/application/directory-inbox-accept.d.ts +3 -3
  54. package/dist/application/directory-inbox-accept.d.ts.map +1 -1
  55. package/dist/application/directory-inbox-contract.d.ts +38 -10
  56. package/dist/application/directory-inbox-contract.d.ts.map +1 -1
  57. package/dist/application/directory-inbox-delivery.d.ts +3 -3
  58. package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
  59. package/dist/application/directory-inbox-files.d.ts +17 -2
  60. package/dist/application/directory-inbox-files.d.ts.map +1 -1
  61. package/dist/application/directory-inbox-state.d.ts +1 -1
  62. package/dist/application/directory-inbox-state.d.ts.map +1 -1
  63. package/dist/application/directory-inbox.d.ts +1 -1
  64. package/dist/application/directory-inbox.d.ts.map +1 -1
  65. package/dist/application/file-state-store.d.ts +21 -1
  66. package/dist/application/file-state-store.d.ts.map +1 -1
  67. package/dist/application/grammy.d.ts.map +1 -1
  68. package/dist/application/kernel-contract.d.ts.map +1 -1
  69. package/dist/application/revision-signal.d.ts.map +1 -1
  70. package/dist/application/state-store.d.ts +3 -0
  71. package/dist/application/state-store.d.ts.map +1 -1
  72. package/dist/browser/api-error.d.ts +38 -0
  73. package/dist/browser/api-error.d.ts.map +1 -0
  74. package/dist/browser/chunked-upload.d.ts.map +1 -1
  75. package/dist/browser/client-executors.d.ts.map +1 -1
  76. package/dist/browser/client-url.d.ts.map +1 -1
  77. package/dist/browser/contract-stream.d.ts.map +1 -1
  78. package/dist/browser/http.d.ts +0 -25
  79. package/dist/browser/http.d.ts.map +1 -1
  80. package/dist/browser/resumable.d.ts.map +1 -1
  81. package/dist/contract/define-validation.d.ts +0 -1
  82. package/dist/contract/define-validation.d.ts.map +1 -1
  83. package/dist/contract/define.d.ts.map +1 -1
  84. package/dist/contract/errors-factory.d.ts.map +1 -1
  85. package/dist/contract/errors.d.ts +15 -18
  86. package/dist/contract/errors.d.ts.map +1 -1
  87. package/dist/contract/normalize.d.ts.map +1 -1
  88. package/dist/durability/effect.d.ts.map +1 -1
  89. package/dist/durability/scheduler.d.ts.map +1 -1
  90. package/dist/entrypoints/agent-runtime/browser.js +29 -18
  91. package/dist/entrypoints/agent-runtime/coding-tools.js +8 -7
  92. package/dist/entrypoints/agent-runtime/harness.js +15 -14
  93. package/dist/entrypoints/agent-runtime/realtime.d.ts +1 -1
  94. package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -1
  95. package/dist/entrypoints/agent-runtime/realtime.js +119 -54
  96. package/dist/entrypoints/agent-runtime/sandbox.js +23 -17
  97. package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -3
  98. package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -3
  99. package/dist/entrypoints/agent-runtime/testing.js +8 -6
  100. package/dist/entrypoints/agent-runtime.js +37 -38
  101. package/dist/entrypoints/application/diagnostic-journal.js +305 -111
  102. package/dist/entrypoints/application/directory-inbox.js +174 -77
  103. package/dist/entrypoints/application/grammy.js +5 -2
  104. package/dist/entrypoints/application/opentelemetry.js +2 -2
  105. package/dist/entrypoints/application.d.ts +2 -2
  106. package/dist/entrypoints/application.d.ts.map +1 -1
  107. package/dist/entrypoints/application.js +17 -8
  108. package/dist/entrypoints/cli/publish.d.ts +16 -0
  109. package/dist/entrypoints/cli/publish.d.ts.map +1 -0
  110. package/dist/entrypoints/cli/publish.js +527 -0
  111. package/dist/entrypoints/cli.d.ts +1 -2
  112. package/dist/entrypoints/cli.d.ts.map +1 -1
  113. package/dist/entrypoints/cli.js +59 -966
  114. package/dist/entrypoints/contract.js +3 -3
  115. package/dist/entrypoints/files/packaging.js +161 -66
  116. package/dist/entrypoints/files.d.ts +1 -0
  117. package/dist/entrypoints/files.d.ts.map +1 -1
  118. package/dist/entrypoints/files.js +17 -10
  119. package/dist/entrypoints/index.d.ts +2 -1
  120. package/dist/entrypoints/index.d.ts.map +1 -1
  121. package/dist/entrypoints/index.js +31 -60
  122. package/dist/entrypoints/node.js +8 -8
  123. package/dist/entrypoints/observability.js +3 -3
  124. package/dist/entrypoints/primitives.js +67 -83
  125. package/dist/entrypoints/process.d.ts +1 -1
  126. package/dist/entrypoints/process.d.ts.map +1 -1
  127. package/dist/entrypoints/process.js +2 -2
  128. package/dist/entrypoints/react.js +4 -2
  129. package/dist/entrypoints/remote.js +37 -13
  130. package/dist/entrypoints/server.js +18 -16
  131. package/dist/entrypoints/telegram/screens.js +5 -3
  132. package/dist/entrypoints/telegram.js +31 -46
  133. package/dist/entrypoints/testing.d.ts +1 -1
  134. package/dist/entrypoints/testing.d.ts.map +1 -1
  135. package/dist/entrypoints/testing.js +444 -448
  136. package/dist/entrypoints/tools/connections.js +268 -105
  137. package/dist/entrypoints/tools/contract.js +2 -2
  138. package/dist/entrypoints/tools/invoker.js +8 -7
  139. package/dist/entrypoints/tools/mcp.d.ts +2 -2
  140. package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
  141. package/dist/entrypoints/tools/mcp.js +10 -9
  142. package/dist/entrypoints/tools.d.ts +0 -1
  143. package/dist/entrypoints/tools.d.ts.map +1 -1
  144. package/dist/entrypoints/tools.js +118 -53
  145. package/dist/entrypoints/tracking.js +2 -3
  146. package/dist/files/boundary.d.ts +2 -2
  147. package/dist/files/boundary.d.ts.map +1 -1
  148. package/dist/files/chunk-spool.d.ts.map +1 -1
  149. package/dist/files/file-io.d.ts +2 -2
  150. package/dist/files/file-io.d.ts.map +1 -1
  151. package/dist/files/native-packaging-layout.d.ts +50 -4
  152. package/dist/files/native-packaging-layout.d.ts.map +1 -1
  153. package/dist/files/native-packaging.d.ts +78 -17
  154. package/dist/files/native-packaging.d.ts.map +1 -1
  155. package/dist/{index-r5hsgkz5.js → index-0gs4ymfj.js} +6 -3
  156. package/dist/{index-zax7resm.js → index-0gxvns6s.js} +1 -13
  157. package/dist/index-0s4xebbg.js +8 -0
  158. package/dist/{index-r4r70zmh.js → index-12zsej7b.js} +5 -2
  159. package/dist/{index-269zqj8m.js → index-1ptj98e0.js} +28 -12
  160. package/dist/{index-kemm0ej5.js → index-1pwwan01.js} +65 -22
  161. package/dist/{index-vgkbcnkc.js → index-299sm5tr.js} +1 -1
  162. package/dist/{index-2vnh05w4.js → index-2k91mewf.js} +31 -74
  163. package/dist/{index-wh0ecvyk.js → index-37asdw3a.js} +1 -1
  164. package/dist/index-3h0ztg0z.js +285 -0
  165. package/dist/{index-g95fk660.js → index-4vsby8n8.js} +8 -15
  166. package/dist/index-556g5hsh.js +17 -0
  167. package/dist/{index-f330qqyg.js → index-5c26631f.js} +244 -67
  168. package/dist/{index-adhgd4pe.js → index-5p55xreg.js} +2 -2
  169. package/dist/index-5w6t91ze.js +47 -0
  170. package/dist/{index-9pw0a51a.js → index-6yxhe58g.js} +40 -7
  171. package/dist/{index-6d9xaxw1.js → index-8ks9b85e.js} +33 -5
  172. package/dist/{index-bhb950qs.js → index-916yh4e2.js} +25 -12
  173. package/dist/index-9tqbxv5p.js +44 -0
  174. package/dist/{index-5csmzesf.js → index-azx12jgv.js} +4 -3
  175. package/dist/{index-mbnnw3f2.js → index-b0kddvzw.js} +15 -5
  176. package/dist/{index-n5yqxd3d.js → index-b0w7rbpt.js} +23 -2
  177. package/dist/index-b56nnscm.js +132 -0
  178. package/dist/{index-0ndk4555.js → index-c0hffcmj.js} +2 -2
  179. package/dist/{index-pptyv13k.js → index-c17xcx4k.js} +42 -6
  180. package/dist/index-cazts87s.js +105 -0
  181. package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
  182. package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
  183. package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
  184. package/dist/index-drs41arz.js +455 -0
  185. package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
  186. package/dist/index-eemvahkc.js +21 -0
  187. package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
  188. package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
  189. package/dist/{index-fk18k56k.js → index-gr5g3xfw.js} +11 -18
  190. package/dist/{index-jn9g8xdt.js → index-hjvje0pf.js} +6 -4
  191. package/dist/index-j4zh647a.js +59 -0
  192. package/dist/{index-x928baz2.js → index-j9gxbztg.js} +18 -14
  193. package/dist/index-kfjkb396.js +37 -0
  194. package/dist/{index-6drst9sg.js → index-ksfagmyz.js} +45 -345
  195. package/dist/index-m616f0yz.js +120 -0
  196. package/dist/{index-fm1c1a08.js → index-m6w6jtda.js} +40 -21
  197. package/dist/{index-bakgedh8.js → index-msfpyy2f.js} +2 -4
  198. package/dist/{index-ywppsaby.js → index-n1nszyk0.js} +23 -34
  199. package/dist/{index-v14qqmys.js → index-n4689krb.js} +1 -1
  200. package/dist/{index-a0zzh8ak.js → index-pz3y6b6g.js} +3 -3
  201. package/dist/{index-43p08g7t.js → index-pzb63z66.js} +12 -8
  202. package/dist/{index-h97tqqp1.js → index-qaet40b2.js} +5 -3
  203. package/dist/{index-t1sr4aks.js → index-qaqbdm7s.js} +52 -6
  204. package/dist/{index-77nxk6ay.js → index-r393tnfp.js} +16 -10
  205. package/dist/{index-kb8styz3.js → index-rpzewktb.js} +15 -5
  206. package/dist/{index-27a2pj09.js → index-sj28htvf.js} +1 -1
  207. package/dist/{index-hbd32c6a.js → index-w8etpm8j.js} +38 -89
  208. package/dist/{index-2hyavjjj.js → index-wbhdzxar.js} +3 -3
  209. package/dist/{index-4e0ah203.js → index-wdy68sh6.js} +47 -24
  210. package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
  211. package/dist/{index-ptn0g0gj.js → index-y7k2cdgv.js} +21 -20
  212. package/dist/{index-20yvtn9a.js → index-yt7gyg5x.js} +1 -1
  213. package/dist/{index-cvda079a.js → index-yvfk3y36.js} +12 -2
  214. package/dist/{index-5z6jn897.js → index-z23rfxhj.js} +1 -1
  215. package/dist/internal/abort-race.d.ts +8 -2
  216. package/dist/internal/abort-race.d.ts.map +1 -1
  217. package/dist/internal/atomic-file.d.ts +55 -9
  218. package/dist/internal/atomic-file.d.ts.map +1 -1
  219. package/dist/internal/atomic-publication.d.ts +39 -4
  220. package/dist/internal/atomic-publication.d.ts.map +1 -1
  221. package/dist/internal/atomic-staging.d.ts +47 -0
  222. package/dist/internal/atomic-staging.d.ts.map +1 -0
  223. package/dist/internal/bounded-file-read.d.ts +19 -11
  224. package/dist/internal/bounded-file-read.d.ts.map +1 -1
  225. package/dist/internal/bounded-lines.d.ts.map +1 -1
  226. package/dist/internal/close-after.d.ts +11 -0
  227. package/dist/internal/close-after.d.ts.map +1 -0
  228. package/dist/internal/deadline.d.ts +10 -0
  229. package/dist/internal/deadline.d.ts.map +1 -1
  230. package/dist/internal/exclusive-lock-read.d.ts +10 -12
  231. package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
  232. package/dist/internal/exclusive-lock.d.ts +2 -2
  233. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  234. package/dist/internal/file-observation.d.ts +14 -0
  235. package/dist/internal/file-observation.d.ts.map +1 -0
  236. package/dist/internal/json-data.d.ts +22 -5
  237. package/dist/internal/json-data.d.ts.map +1 -1
  238. package/dist/internal/positive-integer.d.ts +9 -0
  239. package/dist/internal/positive-integer.d.ts.map +1 -0
  240. package/dist/internal/process-instance.d.ts +35 -5
  241. package/dist/internal/process-instance.d.ts.map +1 -1
  242. package/dist/internal/secure-fetch.d.ts.map +1 -1
  243. package/dist/internal/timers.d.ts +11 -0
  244. package/dist/internal/timers.d.ts.map +1 -0
  245. package/dist/internal/with-exclusive-lock.d.ts +5 -4
  246. package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
  247. package/dist/observability/bounded-sink.d.ts.map +1 -1
  248. package/dist/primitives/canonical-json.d.ts +23 -2
  249. package/dist/primitives/canonical-json.d.ts.map +1 -1
  250. package/dist/primitives/delivery.d.ts.map +1 -1
  251. package/dist/primitives/index.d.ts +1 -1
  252. package/dist/primitives/index.d.ts.map +1 -1
  253. package/dist/primitives/money.d.ts.map +1 -1
  254. package/dist/process/cleanup.d.ts +7 -2
  255. package/dist/process/cleanup.d.ts.map +1 -1
  256. package/dist/process/command-lifetime.d.ts +6 -1
  257. package/dist/process/command-lifetime.d.ts.map +1 -1
  258. package/dist/process/command-owner.d.ts +1 -0
  259. package/dist/process/command-owner.d.ts.map +1 -1
  260. package/dist/process/command.d.ts +4 -0
  261. package/dist/process/command.d.ts.map +1 -1
  262. package/dist/process/contract.d.ts +68 -2
  263. package/dist/process/contract.d.ts.map +1 -1
  264. package/dist/process/group.d.ts +42 -3
  265. package/dist/process/group.d.ts.map +1 -1
  266. package/dist/process/launch.d.ts +12 -1
  267. package/dist/process/launch.d.ts.map +1 -1
  268. package/dist/process/terminate.d.ts +40 -0
  269. package/dist/process/terminate.d.ts.map +1 -0
  270. package/dist/react/query-client.d.ts.map +1 -1
  271. package/dist/realtime/rejection.d.ts.map +1 -1
  272. package/dist/server/contract-stream.d.ts.map +1 -1
  273. package/dist/server/handler-state.d.ts.map +1 -1
  274. package/dist/server/implement.d.ts.map +1 -1
  275. package/dist/server/request-body.d.ts +0 -1
  276. package/dist/server/request-body.d.ts.map +1 -1
  277. package/dist/server/unix-client.d.ts.map +1 -1
  278. package/dist/telegram/broadcast-delivery.d.ts.map +1 -1
  279. package/dist/telegram/broadcast-failure.d.ts +10 -2
  280. package/dist/telegram/broadcast-failure.d.ts.map +1 -1
  281. package/dist/telegram/operator-channel.d.ts.map +1 -1
  282. package/dist/telegram/screens/outcome.d.ts.map +1 -1
  283. package/dist/testing/surface-conformance.d.ts +1 -1
  284. package/dist/testing/surface-conformance.d.ts.map +1 -1
  285. package/dist/testing/surface-manifest.d.ts +0 -6
  286. package/dist/testing/surface-manifest.d.ts.map +1 -1
  287. package/dist/tools/agent.d.ts +1 -1
  288. package/dist/tools/agent.d.ts.map +1 -1
  289. package/dist/tools/cli/args.d.ts +1 -1
  290. package/dist/tools/cli/args.d.ts.map +1 -1
  291. package/dist/tools/cli/help.d.ts.map +1 -1
  292. package/dist/tools/cli/invoke.d.ts +2 -2
  293. package/dist/tools/cli/invoke.d.ts.map +1 -1
  294. package/dist/tools/cli/profile.d.ts.map +1 -1
  295. package/dist/tools/cli/publication-assets.d.ts.map +1 -1
  296. package/dist/tools/cli/publication-contract.d.ts +8 -0
  297. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  298. package/dist/tools/cli/publication-control.d.ts.map +1 -1
  299. package/dist/tools/cli/publication-storage.d.ts +23 -2
  300. package/dist/tools/cli/publication-storage.d.ts.map +1 -1
  301. package/dist/tools/cli/publication.d.ts +8 -1
  302. package/dist/tools/cli/publication.d.ts.map +1 -1
  303. package/dist/tools/connections/errors.d.ts +18 -6
  304. package/dist/tools/connections/errors.d.ts.map +1 -1
  305. package/dist/tools/connections/limits.d.ts +8 -2
  306. package/dist/tools/connections/limits.d.ts.map +1 -1
  307. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  308. package/dist/tools/connections/mcp-envelope.d.ts.map +1 -1
  309. package/dist/tools/connections/openapi.d.ts.map +1 -1
  310. package/dist/tools/connections/schema-budget.d.ts +1 -1
  311. package/dist/tools/connections/schema-budget.d.ts.map +1 -1
  312. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  313. package/dist/tools/execute-args.d.ts.map +1 -1
  314. package/dist/tools/execute-result.d.ts.map +1 -1
  315. package/dist/tools/internal/surface-projector.d.ts +17 -3
  316. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  317. package/dist/tools/internal/tool-error-projection.d.ts +16 -0
  318. package/dist/tools/internal/tool-error-projection.d.ts.map +1 -0
  319. package/dist/tools/internal/tool-view.d.ts.map +1 -1
  320. package/dist/tools/invoker.d.ts.map +1 -1
  321. package/dist/tools/list-names.d.ts +3 -2
  322. package/dist/tools/list-names.d.ts.map +1 -1
  323. package/dist/tools/manifest.d.ts +3 -2
  324. package/dist/tools/manifest.d.ts.map +1 -1
  325. package/dist/tools/mcp/handler.d.ts +7 -0
  326. package/dist/tools/mcp/handler.d.ts.map +1 -1
  327. package/dist/tools/mcp/mount.d.ts +18 -2
  328. package/dist/tools/mcp/mount.d.ts.map +1 -1
  329. package/dist/tools/mcp/prepare.d.ts +3 -3
  330. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  331. package/dist/tools/mcp/register.d.ts.map +1 -1
  332. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  333. package/dist/tools/mcp/stdio-signals.d.ts +14 -0
  334. package/dist/tools/mcp/stdio-signals.d.ts.map +1 -1
  335. package/dist/tools/mcp/stdio.d.ts +7 -0
  336. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  337. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  338. package/dist/tools/operations/async-operation-runtime-types.d.ts +3 -3
  339. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  340. package/dist/tools/operations/define-wait-tool.d.ts +1 -1
  341. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
  342. package/dist/tools/operations/wait-core.d.ts +0 -6
  343. package/dist/tools/operations/wait-core.d.ts.map +1 -1
  344. package/dist/tools/registry.d.ts +1 -1
  345. package/dist/tools/registry.d.ts.map +1 -1
  346. package/dist/tools/remote.d.ts +1 -1
  347. package/dist/tools/remote.d.ts.map +1 -1
  348. package/dist/tools/{runtime-tool-execution.d.ts → runtime-tool-declaration.d.ts} +32 -9
  349. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -0
  350. package/dist/tools/runtime-tool-mcp.d.ts +6 -15
  351. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -1
  352. package/dist/tools/runtime-tool.d.ts +14 -12
  353. package/dist/tools/runtime-tool.d.ts.map +1 -1
  354. package/dist/tools/schema/coerce.d.ts +4 -0
  355. package/dist/tools/schema/coerce.d.ts.map +1 -1
  356. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  357. package/dist/tools/surface.d.ts +7 -11
  358. package/dist/tools/surface.d.ts.map +1 -1
  359. package/dist/tools/transfer/define-download-tool.d.ts +1 -1
  360. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
  361. package/dist/tools/transfer/define-upload-tool.d.ts +1 -1
  362. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
  363. package/dist/tools/transfer/define-view-file-tool.d.ts +1 -1
  364. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
  365. package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
  366. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
  367. package/dist/tools/transfer/view-file.d.ts +1 -1
  368. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  369. package/dist/tools/transports.d.ts +3 -2
  370. package/dist/tools/transports.d.ts.map +1 -1
  371. package/llms/agent-runtime-browser.txt +10 -4
  372. package/llms/agent-runtime-harness.txt +32 -31
  373. package/llms/agent-runtime-react.txt +1 -1
  374. package/llms/agent-runtime-realtime.txt +14 -5
  375. package/llms/agent-runtime-sandbox.txt +3 -11
  376. package/llms/agent-runtime.3.txt +2 -2
  377. package/llms/agent-runtime.txt +0 -9
  378. package/llms/application.2.txt +3 -12
  379. package/llms/application.3.txt +7 -4
  380. package/llms/application.txt +44 -15
  381. package/llms/cli-publish.txt +29 -0
  382. package/llms/cli.2.txt +9 -11
  383. package/llms/cli.txt +26 -14
  384. package/llms/declaration.txt +0 -9
  385. package/llms/files-packaging.txt +18 -8
  386. package/llms/files.txt +4 -2
  387. package/llms/geo.txt +0 -9
  388. package/llms/live.txt +4 -13
  389. package/llms/observability.txt +31 -5
  390. package/llms/primitives.txt +38 -20
  391. package/llms/process.txt +324 -160
  392. package/llms/react-keyboard.txt +0 -9
  393. package/llms/react.txt +0 -18
  394. package/llms/server.4.txt +1 -1
  395. package/llms/server.5.txt +1 -1
  396. package/llms/server.txt +1 -1
  397. package/llms/stitchkit.txt +6 -7
  398. package/llms/telegram-screens.txt +2 -2
  399. package/llms/testing.txt +0 -1
  400. package/llms/tools-mcp.txt +2 -3
  401. package/llms/tools.2.txt +12 -0
  402. package/llms/tools.3.txt +5 -6
  403. package/llms/tools.txt +6 -4
  404. package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
  405. package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.53.0-0.67.0.txt} +576 -506
  406. package/llms/{upgrading-0.62.0-0.80.0.txt → upgrading-0.68.0-0.94.0.txt} +562 -576
  407. package/llms/{upgrading-0.81.0-0.104.0.txt → upgrading-0.95.0-0.105.0.txt} +452 -567
  408. package/llms/upgrading.txt +4 -4
  409. package/llms-full.txt +1068 -412
  410. package/llms.txt +24 -24
  411. package/native-assets.json +11 -3
  412. package/package.json +6 -6
  413. package/dist/agent-runtime/harness-tools.d.ts +0 -11
  414. package/dist/agent-runtime/harness-tools.d.ts.map +0 -1
  415. package/dist/entrypoints/agent-runtime/harness-tools.d.ts +0 -2
  416. package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +0 -1
  417. package/dist/entrypoints/agent-runtime/harness-tools.js +0 -32
  418. package/dist/index-1a6jtnd9.js +0 -88
  419. package/dist/index-8a9ksm91.js +0 -95
  420. package/dist/index-a3wma1hk.js +0 -48
  421. package/dist/index-jd470k6q.js +0 -109
  422. package/dist/index-n1dqr7gf.js +0 -20
  423. package/dist/index-nggfa2yn.js +0 -34
  424. package/dist/index-s4evrmp5.js +0 -98
  425. package/dist/index-ze1eph1k.js +0 -20
  426. package/dist/tools/connections/error-projection.d.ts +0 -4
  427. package/dist/tools/connections/error-projection.d.ts.map +0 -1
  428. package/dist/tools/runtime-tool-execution.d.ts.map +0 -1
  429. package/llms/agent-runtime-harness-tools.txt +0 -25
  430. package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
@@ -0,0 +1,29 @@
1
+ # stitchkit/cli/publish — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/cli/publish` (docs/api/reference.md)
7
+
8
+ Also read:
9
+ - see `llms/cli.txt` for the CLI guide
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/cli/publish` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/cli/publish`
16
+
17
+ Build and release tooling, evolving. Publishes a CLI distribution into a local
18
+ application-owned directory; the manifest, signatures, installer and updater it
19
+ writes for stay in `stitchkit/cli` — [guide](../guide/cli.md#publishing-a-complete-version),
20
+ [ADR 0245](../decisions/0245-cli-publication-is-an-evolving-leaf.md).
21
+
22
+ | Export | Kind | Summary |
23
+ |--------|------|---------|
24
+ | `publishCli` | function | optional bounded builder/admission over one immutable name/version/commit stamp; commit verified assets before the manifest pointer, recover exact completed versions, retain verified history |
25
+ | `CliPublicationOptions` | _type_ | identity, storage root, base URL, targets, limits, retention, the `admit` and `build` callbacks, optional signing and trust |
26
+ | `CliPublicationPhase` | _type_ | the step `admit` is asked about — `prepare`, `build`, `commit` or `promote` |
27
+ | `CliPublicationResult` | _type_ | `published` or `existing`, with the manifest ready to serve |
28
+
29
+ ---
package/llms/cli.2.txt CHANGED
@@ -38,7 +38,7 @@ await createCli({ name: 'myapp', version, runtimeTools: discovered, commands: [.
38
38
  commands, and a connection without it still contributes nothing to the CLI —
39
39
  exposure stays explicit, as it is everywhere else in the framework.
40
40
 
41
- One unconvertible schema no longer takes the connection down with it. The tool
41
+ One unconvertible schema does not take the connection down. The tool
42
42
  is skipped and **named** (`onSkippedTool`, or a stderr line by default), so a
43
43
  surface of two hundred tools is not lost to one.
44
44
 
@@ -71,13 +71,12 @@ credential, body, identity and stack stay with the original in-process cause in
71
71
  Unknown throws remain `INTERNAL_SERVER_ERROR`. A timeout is not proof that a
72
72
  write did not happen: verify the remote outcome before repeating an operation.
73
73
 
74
- **A remote refusal keeps its code.** A failed `tools/call` used to become a
75
- one-sentence `Error` with the result discarded, which cost three things at once:
76
- the code (so `exitCodes` had nothing to map and every remote failure exited `1`),
77
- the message the operator needed, and the error's own class — a plain `Error` is
78
- an *unexpected* error to the runner, so it printed a code frame of the framework
79
- bundle before the JSON failure and was then scrubbed to `INTERNAL_SERVER_ERROR`.
80
- A structured `{ error, details }` body is now relayed as the contract error it
74
+ **A remote refusal keeps its code.** A failed `tools/call` must keep three things:
75
+ the code (so `exitCodes` can map it instead of every remote failure exiting `1`),
76
+ the message the operator needs, and the error's own class — a plain `Error` is
77
+ an *unexpected* error to the runner, which would print a code frame of the framework
78
+ bundle before the JSON failure and scrub it to `INTERNAL_SERVER_ERROR`.
79
+ A structured `{ error, details }` body is relayed as the contract error it
81
80
  is, on every transport; anything else fails as `UPSTREAM_TOOL_ERROR` carrying
82
81
  what the server did send. Not `INTERNAL_SERVER_ERROR`, because nothing of ours
83
82
  broke.
@@ -172,7 +171,6 @@ SDK nor the `ai` peer.
172
171
  | `checkCliUpdate` | function | bounded, interval-limited, never-throwing check for a newer published build |
173
172
  | `applyCliUpdate` | function | download, verify the decompressed digest and replace the binary by rename |
174
173
  | `assertCliPublishable` | function | refuse republishing one version from a different commit — takes one manifest or every manifest already published, because the promise a version makes does not stop at a channel boundary |
175
- | `publishCli` / `CliPublicationOptions` / `CliPublicationPhase` / `CliPublicationResult` | function / _type_ | optional bounded builder/admission over one immutable name/version/commit stamp; commit verified assets before the manifest pointer, recover exact completed versions, retain verified history; existing signatures/installer/updater own the wire contract |
176
174
  | `rollbackCliUpdate` / `CliRollbackConfig` / `RolledBackCliUpdate` | function / _types_ | put the kept previous build back, digest-checked first and written by the same atomic rename the update uses |
177
175
  | `signCliManifest` / `verifyCliManifest` / `cliManifestSigningPayload` | function | Ed25519 over `{name, version, commit, builtAt, assets[]}` — every asset's digest included, so the chain closes on the file that executes |
178
176
  | `cliSignatureAccepted` / `CliSignatureVerdict` | function / _type_ | `valid` \| `unenforced` \| `missing` \| `unknown-key` \| `invalid`; `unenforced` keeps an unpinned build updating while making the absence of a check visible |
@@ -204,8 +202,8 @@ SDK nor the `ai` peer.
204
202
  | `CliConfig` | _type_ | config for `createCli`; `defaultCommand`, `globalOptions`, `optionAliases` and `positionals` define the shared command presentation policy |
205
203
  | `CliPresentationPolicyConfig` | _type_ | shared command presentation-policy subset of `CliConfig` |
206
204
  | `CliSurfaceSource` | _type_ | static service/runtime array or identity-dependent factory |
207
- | `RuntimeToolExecution` | _type_ | neutral heterogeneous runtime-tool registration; handlers execute through the schema-validating managed runner |
208
- | `RuntimeToolExecutionWithOutput` | _type_ | strict neutral managed definition with schema-derived handler input/output; construct before adding to CLI `runtimeTools` |
205
+ | `RuntimeToolDefinition` | _type_ | neutral heterogeneous runtime-tool registration; an inline handler is contextually typed, and handlers execute through the schema-validating managed runner |
206
+ | `RuntimeToolDefinitionWithOutput` | _type_ | strict neutral managed definition with schema-derived handler input/output, the same declaration `stitchkit/tools` constructs with presenters |
209
207
  | `RuntimeToolDefinitionWithoutOutput` | _type_ | strict neutral managed void definition without an output contract or transport presenters |
210
208
  | `CliCommandDefinition` | _type_ | native command definition union |
211
209
  | `CliCommandDefinitionBase` | _type_ | native command name, description and input schema |
package/llms/cli.txt CHANGED
@@ -33,9 +33,10 @@ declarations do not require `ai`, the MCP SDK or Bun globals. Node consumers can
33
33
  use strict `NodeNext` resolution with `skipLibCheck: false` and ordinary Node
34
34
  types; the package keeps its required dependencies separate from optional SDKs.
35
35
 
36
- CLI runtime tools use the shared executable contract: identity, input and output
37
- schemas, handler, and explicit CLI exposure. SDK presenters belong to the MCP/AI
38
- definitions in `stitchkit/tools`, which require the corresponding peers. A typed
36
+ CLI runtime tools use the one runtime-tool declaration: identity, input and output
37
+ schemas, handler, and explicit CLI exposure. SDK presenters are the adapter's extension
38
+ of that declaration (the fourth type argument of `RuntimeToolDefinitionWithOutput`, or
39
+ `defineRuntimeTool` in `stitchkit/tools`), which requires the corresponding peers. A typed
39
40
  definition returned by `defineRuntimeTool` or `createRuntimeToolFactory` can be
40
41
  passed directly to both CLI and SDK mounts.
41
42
 
@@ -49,7 +50,7 @@ For a CLI-only managed tool, use the neutral generic construction contract to
49
50
  infer the handler from its schemas:
50
51
 
51
52
  ```ts
52
- import type { RuntimeToolExecutionWithOutput } from 'stitchkit/cli'
53
+ import type { RuntimeToolDefinitionWithOutput } from 'stitchkit/cli'
53
54
  import { z } from 'zod'
54
55
 
55
56
  const input = z.object({ text: z.string() })
@@ -59,12 +60,14 @@ const measure = {
59
60
  identity: { serviceName: 'text', action: 'measure', method: 'POST' },
60
61
  transports: ['CLI'], input, output,
61
62
  handler: ({ input }) => ({ size: input.text.length }),
62
- } satisfies RuntimeToolExecutionWithOutput<typeof input, typeof output>
63
+ } satisfies RuntimeToolDefinitionWithOutput<typeof input, typeof output>
63
64
  ```
64
65
 
65
- Pass `measure` to `runtimeTools`. The heterogeneous registration type preserves
66
- the definition without inventing a common handler input; execute it through
67
- `createCli` or `createCliInvoker` so validation remains on the canonical path.
66
+ Pass `measure` to `runtimeTools`. `RuntimeToolDefinition`, the heterogeneous
67
+ registration type, accepts it unchanged, and types an inline handler written directly
68
+ in `runtimeTools` by the parsed object (use the construction type above to type the
69
+ input from the schema). Execute it through `createCli` or `createCliInvoker` so
70
+ validation remains on the canonical path.
68
71
 
69
72
  ## Exposure is opt-in
70
73
 
@@ -254,7 +257,9 @@ the values agree. Duplicates are refused before command execution. Array
254
257
  options accumulate across long and short forms; unknown non-dotted passthrough
255
258
  options retain their raw-list grammar. Tokens after `--` are literal data.
256
259
  Command `--help` and `-h` keep their diagnostic precedence over malformed
257
- operation arguments; application globals are validated before routing.
260
+ operation arguments; application globals are validated before routing. Help is a
261
+ request, not a setting, so repeating it in any spelling (`-h -h`, `-h --help`) asks once
262
+ and never errors.
258
263
 
259
264
  Without presentation configuration, positional arguments fill non-boolean
260
265
  fields in declaration order, so `myapp generate "a fox"` is
@@ -481,8 +486,10 @@ Declared aliases render beside their canonical options, for example
481
486
  The argument table and `Application options:` show bounds from their JSON Schema,
482
487
  for example `<integer> [>=1, <=50]`, `<string> [length >=1, length <=12]`, and
483
488
  `<value…> [items >=2, items <=4]`. Numeric `>` and `<` are exclusive, while `>=`
484
- and `<=` include the endpoint; a zero limit is displayed too. Unbounded fields
485
- keep just their type and description. Bounds on an array's items are not bounds
489
+ and `<=` include the endpoint; a zero limit is displayed too. Only limits the
490
+ schema declares are shown: the safe-integer range every `z.int()` carries is the
491
+ type, not a bound, so a bare integer prints `<integer>`, `.min(1)` prints `>=1` and
492
+ `.positive()` prints `>0`. Unbounded fields keep just their type and description. Bounds on an array's items are not bounds
486
493
  on the array itself.
487
494
 
488
495
  Composed schemas retain their meaning: `any of:` and `one of:` separate
@@ -710,11 +717,16 @@ exists to distrust.
710
717
 
711
718
  `publishCli` is an opt-in publisher for a local application-owned distribution
712
719
  directory. It commits every target and its version manifest before atomically
713
- replacing the public `manifest.json`. Your application selects the CLI source
714
- identity and admits that snapshot at each phase:
720
+ replacing the public `manifest.json`. It ships from its own evolving entrypoint,
721
+ `stitchkit/cli/publish`: release infrastructure follows how distributions are
722
+ published, so it is not held to the stable promise of `stitchkit/cli`
723
+ ([ADR 0245](../decisions/0245-cli-publication-is-an-evolving-leaf.md)). The
724
+ manifest, signatures, installer and updater it writes for stay in
725
+ `stitchkit/cli`. Your application selects the CLI source identity and admits
726
+ that snapshot at each phase:
715
727
 
716
728
  ```ts
717
- import { publishCli } from 'stitchkit/cli'
729
+ import { publishCli } from 'stitchkit/cli/publish'
718
730
 
719
731
  const result = await publishCli({
720
732
  storageRoot: '/srv/myapp/cli',
@@ -9,15 +9,6 @@ Contains: Guide: Project declaration (docs/guide/declaration.md) · API referen
9
9
  # Guide: Project declaration (docs/guide/declaration.md)
10
10
  ==============================================================================
11
11
 
12
- ---
13
- title: Project declaration
14
- description: One machine-readable statement a repository makes about itself — identity, roles, build, requirements, release steps and the names of the values a deployment supplies.
15
- type: architecture
16
- status: active
17
- created: 2026-08-25
18
- updated: 2026-08-30
19
- ---
20
-
21
12
  # Project declaration
22
13
 
23
14
  > **Maturity: evolving.** This surface is still finding its shape and may be
@@ -16,19 +16,29 @@ Also read:
16
16
 
17
17
  `stitchkit/files/packaging` owns `createNativePackaging` and the types
18
18
  `NativePackagingOptions`, `NativePackagingAsset`, `NativePackagingPlugin`, `NativePackagingResult`.
19
- It resolves the installed package's target/version and original addon SHA256.
20
- `platform`, `architecture`, `delivery`, `entryPath` and `assetPath` are explicit public inputs.
21
- The result is `ready` with assets and a structural Bun plugin, or `unsupported`/`missing` with a safe code.
22
- Malformed options/metadata and other filesystem errors fail rather than masquerade as missing.
19
+ It resolves the installed package's target/version, reads each selected addon once and checks it
20
+ against the `size` and `sha256` published in the package's `native-assets.json` (`formatVersion: 2`,
21
+ written when Stitchkit is built). Call it once per build and reuse the result.
22
+ `platform`, `architecture`, `delivery`, `entryPath` and `assetPath` are explicit public inputs;
23
+ `assetPath` accepts one template, `[hash]`, replaced by the first 16 hex digits of the addon's
24
+ published SHA256;
25
+ `platform` is the closed set `'darwin'`, and another name is a type error and a schema refusal.
26
+ The result is `ready` with verified assets and a structural Bun plugin, or `unsupported` /
27
+ `missing` / `mismatch` with the safe code `NATIVE_TARGET_UNSUPPORTED`, `NATIVE_ASSET_MISSING` or
28
+ `NATIVE_ASSET_DIGEST_MISMATCH`. A `mismatch` names the first differing `architecture` with
29
+ `expected` (published) and `actual` (installed) `{ size, sha256 }`.
30
+ Malformed options, a manifest of another `formatVersion` and other filesystem errors throw rather
31
+ than masquerade as missing.
23
32
  Companion accepts a single `architecture` string with an `assetPath` string, or an architecture
24
33
  array with an exact per-architecture `assetPath` map. `NativePackagingOptions<true>` and
25
34
  `NativePackagingResult<true>` describe the array form; default types preserve single-target signatures.
26
35
  A ready array-form result carries the architecture array; `NativePackagingAsset<true>` identifies
27
- each asset architecture. Default asset types and single-target runtime objects retain their three fields.
36
+ each asset architecture. A single-target asset has four fields: `outputPath`, the verified `bytes`,
37
+ and the published `size` and `sha256`.
28
38
  Targets must be unique; entry and all asset paths must be disjoint. One lazy loader chooses only
29
39
  the actual runtime architecture, with no fallback.
30
- Companion mode places external addons relative to the emitted entry; embedded mode lets
31
- Bun compile retain the matching addon. Keep JS builds without splitting, preserve every output,
32
- and copy each original asset to its `outputPath` after verifying `sha256`.
40
+ Companion mode places external addons relative to the emitted entry; embedded mode gives
41
+ Bun compile the verified bytes of the matching addon. Keep JS builds without splitting, preserve
42
+ every output, and write each asset's `bytes` to its `outputPath`.
33
43
  This evolving entrypoint is a build dependency; runtime imports do not reach it.
34
44
  The detailed recipe is in [native IO](../guide/native-io.md#public-native-packaging).
package/llms/files.txt CHANGED
@@ -29,8 +29,10 @@ available from `stitchkit/contract`.
29
29
  | `ManagedFileError` / `ManagedFileErrorCode` | class / _type_ | stable boundary failures; registered `FILE_*` mistakes are caller-safe while `FILE_IO_ERROR` remains internal |
30
30
  | `ManagedFileInspector` | _type_ | bounded-prefix read/write inspection callback with a finite cancellation signal that cannot own path or size |
31
31
  | `ManagedFileInspectionInput` / `ManagedFileInspection` | _type_ | inspector prefix/name/declared media/signal input and validated metadata-only result |
32
- | `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 |
33
- | `withExclusiveLock` / `ExclusiveLockOptions` / `ExclusiveLock` / `ExclusiveLockOwner` | function / _type_ | run work under an exclusive lock between processes — a file recording its owner (pid, host, machine identity, time and nullable kernel process identity); 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` (default 5000 ms, `null` disables age-based reclaim including guards); exact `mode` is independent of umask; shared readers need a common group and traversable directories |
32
+ | `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. A process killed before publication leaves its staging file; sweeping it is the caller's job |
33
+ | `isAtomicStagingName` | function | true for a staging file name of an atomic write of this library (`.stitchkit-<24 lowercase hex>.tmp`, also used by the managed writer and the chunk spool); the form is a stable contract, and changing it is a breaking change ([ADR 0242](../decisions/0242-atomic-staging-name-is-a-public-contract.md)) |
34
+ | `sweepAtomicStaging` / `SweepAtomicStagingOptions` | function / _type_ | remove abandoned staging files from one `directory`: only regular files matching `isAtomicStagingName` and older than the required `olderThanMs`, never following a symlink or entering a subdirectory; stops on `signal`; returns the removed names, `[]` for a `directory` that does not exist |
35
+ | `withExclusiveLock` / `ExclusiveLockOptions` / `ExclusiveLock` / `ExclusiveLockOwner` | function / _type_ | run work under an exclusive lock between processes — a file recording its owner (pid, host, machine identity, time and nullable kernel process identity); 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; the lock is published with its owner already recorded (temporary file plus hard link), so a stalled holder is never displaced; a legacy empty lock file is taken by age only when `ownerlessGraceMs` is a number (default `null`: never; an abandoned empty reclaim guard is taken after 5 000 ms unless a value is set); exact `mode` is independent of umask; shared readers need a common group and traversable directories |
34
36
  | `ExclusiveLockError` | class | `LOCK_TIMEOUT` naming the resource and its holder, or `LOCK_ABORTED` with the signal's reason |
35
37
  | `createChunkSpool` | function | the server half of a chunked upload: parts on disk under `owner` + client-minted `uploadId`, each with a size+sha256 receipt; idempotent `open` and `put`, the first writer of a part wins across processes, `assemble` in order once every part is in, `sweep` of untouched uploads — [guide](../guide/client.md#chunked-uploads) |
36
38
  | `ChunkSpool` / `ChunkSpoolConfig` / `ChunkSpoolKey` / `ChunkSpoolOpen` / `ChunkSpoolPart` / `ChunkSpoolAssembly` | _type_ | the spool, its directory, part size, file limit, meta schema and age; an upload's key; its declaration; one part; the assembled parts with a concatenating `stream()` |
package/llms/geo.txt CHANGED
@@ -9,15 +9,6 @@ Contains: Guide: GeoIP (docs/guide/geo.md) · API reference: `stitchkit/geo` (
9
9
  # Guide: GeoIP (docs/guide/geo.md)
10
10
  ==============================================================================
11
11
 
12
- ---
13
- title: GeoIP
14
- description: A server-only managed GeoIP reader with three observable states and last-known-good generation reloads.
15
- type: guide
16
- status: active
17
- created: 2026-09-06
18
- updated: 2026-09-06
19
- ---
20
-
21
12
  # GeoIP
22
13
 
23
14
  `stitchkit/geo` is a server-only, evolving entrypoint for reading local GeoIP
package/llms/live.txt CHANGED
@@ -9,15 +9,6 @@ Contains: Guide: Live data (docs/guide/live.md) · API reference: `stitchkit/li
9
9
  # Guide: Live data (docs/guide/live.md)
10
10
  ==============================================================================
11
11
 
12
- ---
13
- title: Live data — announcements, watched reads, keyspaces and the trust fence
14
- description: How to declare events beside the operation contract, share one server-side read between every browser asking the same question, keep authoritative memory in front of a durable backend, and refuse a request whose authority you never agreed to answer on.
15
- type: guide
16
- status: active
17
- created: 2026-09-02
18
- updated: 2026-09-02
19
- ---
20
-
21
12
  # Live data
22
13
 
23
14
  Four things an application builds by hand the second time it needs them.
@@ -429,11 +420,11 @@ Every refusal answers the same bare 403. A response that said *which* rule
429
420
  refused would let a caller learn your trusted list one guess at a time; the
430
421
  reason goes to `onRefused` and the log, where you are.
431
422
 
432
- ### One thing that changed
423
+ ### Group hooks
433
424
 
434
- A route group can no longer declare `onRequest`. It never worked — the framework
435
- dispatched only the server-level hook — and it could not be made to work without
436
- matching group prefixes a second time, ahead of the real router. Use the
425
+ A route group cannot declare `onRequest`: the framework dispatches only the
426
+ server-level hook, and a group hook would need group prefixes matched a second
427
+ time, ahead of the real router. Use the
437
428
  server-level `hooks.onRequest` to refuse before dispatch, or the group's
438
429
  `authorize` to gate once the endpoint is known.
439
430
 
@@ -303,6 +303,32 @@ Without an `observability` the work still runs inside a context, so trace ids,
303
303
  decision from having a context. `traceparent` continues the trace of whatever
304
304
  scheduled the work, instead of starting an unrelated one.
305
305
 
306
+ ### CPU is not attributed to work
307
+
308
+ Request rows, `runUnitOfWork` rows and schedule status carry durations and
309
+ counts, never CPU. One JavaScript thread interleaves every operation, so a
310
+ `process.cpuUsage()` delta across an operation's start and end measures
311
+ everything the process ran in that time — a long wait reads as the CPU of the
312
+ timers that fired during it. The correct basis is the synchronous segment, and
313
+ Bun gives no callback when a continuation is entered or left
314
+ ([ADR 0244](../decisions/0244-cpu-is-not-attributed-to-operations.md)).
315
+
316
+ Process CPU per window is the number you can observe:
317
+
318
+ ```ts
319
+ let last = process.cpuUsage()
320
+ setInterval(() => {
321
+ const now = process.cpuUsage() // cumulative { user, system } in µs
322
+ logger.info('cpu', { cpuUserUs: now.user - last.user, cpuSystemUs: now.system - last.system })
323
+ last = now
324
+ }, 60_000)
325
+ ```
326
+
327
+ If you build attribution yourself: credit an operation only the CPU of the
328
+ synchronous segments it ran, never its waiting time; put everything outside those
329
+ segments into `unattributed`; never credit a window to the one operation in
330
+ flight — that operation is usually the one waiting.
331
+
306
332
  ### Write the calls that changed something
307
333
 
308
334
  `auditChanges` is the filter most projects end up writing, shipped so they do not
@@ -377,8 +403,8 @@ needed:
377
403
  createServer({ services, logging, observability: observability.request })
378
404
  ```
379
405
 
380
- `wrapInRequestContext` remains available for a custom fetch pipeline that does
381
- not use `createHandler`; it is no longer part of built-in HTTP audit wiring:
406
+ `wrapInRequestContext` serves a custom fetch pipeline that does not use
407
+ `createHandler`; built-in HTTP audit wiring does not use it:
382
408
 
383
409
  ```ts
384
410
  Bun.serve({ fetch: wrapInRequestContext(customFetch) })
@@ -715,9 +741,9 @@ which the built-in **tool** row does not read: a tool event takes
715
741
  `errorCode` / `errorMessage` / `errorDetail` from the `ToolResult`, and only
716
742
  identity and `dimensions` from the context. Calling it in `onToolError` would
717
743
  leave the tool row exactly as scrubbed as before. It is right for the **HTTP**
718
- path, where the request *is* the record. (Since ADR 0045 a tool call runs in its
719
- own context, so it can no longer write into the enclosing `/mcp` request's row
720
- either — the call is simply not where that helper belongs.)
744
+ path, where the request *is* the record. (A tool call runs in its own context, ADR 0045,
745
+ so it cannot write into the enclosing `/mcp` request's row either — the call is
746
+ simply not where that helper belongs.)
721
747
 
722
748
  ### One row that names the cause
723
749
 
@@ -9,15 +9,6 @@ Contains: Guide: Generic application primitives (docs/guide/primitives.md) · A
9
9
  # Guide: Generic application primitives (docs/guide/primitives.md)
10
10
  ==============================================================================
11
11
 
12
- ---
13
- title: Generic application primitives
14
- description: Declare lifecycle, access, exact values, audit, delivery and exports without moving application infrastructure into Stitchkit.
15
- type: guide
16
- status: active
17
- created: 2026-09-01
18
- updated: 2026-10-01 21:03 +07:00
19
- ---
20
-
21
12
  # Generic application primitives
22
13
 
23
14
  `stitchkit/primitives` is an optional browser-safe leaf. It declares values and policies; it does
@@ -120,18 +111,44 @@ const bytes = canonicalJson({ '2': 'two', '10': 'ten', optional: undefined, nest
120
111
  // Native crypto or browser WebCrypto hashes these same UTF-8 bytes.
121
112
  ```
122
113
 
123
- `canonicalJson` использует единый serializer исторических digest: object keys в UTF-16 code-unit
124
- order, включая integer-like keys; array order сохраняется. Optional object members с undefined
125
- опускаются. Top-level/array undefined, sparse arrays, functions/symbols/BigInt, non-finite numbers,
126
- negative zero, cycles, user prototypes, accessors, non-enumerable/symbol members отказаны до
127
- serialization. Приложение валидирует свою schema первым; canonical boundary не заменяет её.
114
+ `canonicalJson` is the one serializer behind the digests: object keys sort by UTF-16 code unit,
115
+ integer-like keys included; array order is kept; object members that are `undefined` are omitted.
116
+ It refuses, before serializing, a top-level or array `undefined`, sparse arrays, functions, symbols,
117
+ BigInt, non-finite numbers, negative zero, cycles, user prototypes, accessors and non-enumerable or
118
+ symbol members. Validate your own schema first; the canonical boundary does not replace it.
119
+
120
+ Defaults: depth 100 (the maximum), nodes 100 000, UTF-8 bytes 1 MiB. Invalid options throw a Zod
121
+ validation error. A refused value throws `CanonicalJsonError`, a `TypeError` whose `reason` is a
122
+ `CanonicalJsonRefusal`; branch on the reason, never on the message:
123
+
124
+ | `reason` | Meaning |
125
+ |---|---|
126
+ | `depth` | The value is nested deeper than `maxDepth`. |
127
+ | `nodes` | The value has more nodes than `maxNodes`. |
128
+ | `bytes` | The output is longer than `maxBytes` in UTF-8. |
129
+ | `cycle` | The value contains a cycle. |
130
+ | `negative-zero` | The value contains `-0`, which JSON cannot carry. |
131
+ | `not-json` | The value is not bounded plain JSON: sparse arrays, non-finite numbers, non-plain objects, accessors. |
132
+
133
+ `depth`, `nodes` and `bytes` are the caller's limits being exceeded; the other three say the value is
134
+ not JSON data at all.
135
+
136
+ ```ts
137
+ import { CanonicalJsonError, canonicalJson } from 'stitchkit/primitives'
138
+
139
+ try {
140
+ canonicalJson(payload, { maxBytes: 4096 })
141
+ } catch (error) {
142
+ if (error instanceof CanonicalJsonError && error.reason === 'bytes') {
143
+ // too large: reject the request
144
+ } else throw error
145
+ }
146
+ ```
128
147
 
129
- Defaults: depth 100 (maximum 100), nodes 100 000, UTF-8 bytes 1 MiB. Превышение или не-JSON data —
130
- TypeError; неверные options — Zod validation error. Это browser-safe leaf без Node/Bun/crypto,
131
- agent-runtime/testing или optional peers. Native и browser используют один algorithm; hashing
132
- остаётся platform adapter. Переносите только serializer recursion, сохраняя proof schemas и
133
- verification boundary. Существующие внутренние historical normalization/digest fixtures не меняются;
134
- новый public boundary сознательно отказывает неоднозначным values вместо фиктивной совместимости.
148
+ The leaf is browser-safe: no Node, Bun or crypto, no `agent-runtime/testing`, no optional peers. Native
149
+ and browser code run the same algorithm; hashing stays a platform adapter. A consumer that needs the
150
+ same bytes moves only the serializer recursion and keeps its own proof schemas and verification
151
+ boundary.
135
152
 
136
153
  ==============================================================================
137
154
  # API reference: `stitchkit/primitives` (docs/api/reference.md)
@@ -186,3 +203,4 @@ schedules, transports and file generation remain application-owned.
186
203
  |---|---|---|
187
204
  | `canonicalJson` | function | bounded plain JSON, UTF-16 key sort, optional object members omitted |
188
205
  | `CanonicalJsonOptions` | type | inferred depth/node/UTF-8 bytes limits |
206
+ | `CanonicalJsonError` / `CanonicalJsonRefusal` | class / _type_ | the `TypeError` of a refusal and its `reason`: `cycle`, `negative-zero`, `depth`, `nodes`, `bytes` or `not-json` |