stitchkit 0.136.8 → 0.137.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 (342) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/agent-runtime/stores/branch-observations.d.ts +19 -19
  3. package/dist/agent-runtime/stores/schedule-contract.d.ts.map +1 -1
  4. package/dist/agent-runtime/stores/schedule-records.d.ts.map +1 -1
  5. package/dist/agent-runtime/stores/schedule-tools.d.ts.map +1 -1
  6. package/dist/agent-runtime/stores/sql-rows.d.ts +36 -36
  7. package/dist/agent-runtime/terminal-commit.d.ts +5 -5
  8. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +52 -52
  9. package/dist/agent-runtime/testing/store-conformance-support.d.ts +26 -26
  10. package/dist/browser/client-executors.d.ts +2 -3
  11. package/dist/browser/client-executors.d.ts.map +1 -1
  12. package/dist/browser/realtime-client.d.ts +6 -1
  13. package/dist/browser/realtime-client.d.ts.map +1 -1
  14. package/dist/browser/socket-io-client.d.ts.map +1 -1
  15. package/dist/browser/socket-io-contract.d.ts +2 -0
  16. package/dist/browser/socket-io-contract.d.ts.map +1 -1
  17. package/dist/contract/define-validation.d.ts +6 -0
  18. package/dist/contract/define-validation.d.ts.map +1 -1
  19. package/dist/contract/define.d.ts +1 -1
  20. package/dist/contract/define.d.ts.map +1 -1
  21. package/dist/contract/error-mapping.d.ts +71 -0
  22. package/dist/contract/error-mapping.d.ts.map +1 -0
  23. package/dist/contract/errors.d.ts +8 -0
  24. package/dist/contract/errors.d.ts.map +1 -1
  25. package/dist/contract/factory.d.ts +8 -0
  26. package/dist/contract/factory.d.ts.map +1 -1
  27. package/dist/contract/fragments.d.ts +45 -0
  28. package/dist/contract/fragments.d.ts.map +1 -0
  29. package/dist/contract/normalize.d.ts +6 -3
  30. package/dist/contract/normalize.d.ts.map +1 -1
  31. package/dist/contract/operation-read.d.ts +38 -0
  32. package/dist/contract/operation-read.d.ts.map +1 -0
  33. package/dist/contract/stream.d.ts.map +1 -1
  34. package/dist/contract/time-zone.d.ts +31 -0
  35. package/dist/contract/time-zone.d.ts.map +1 -0
  36. package/dist/contract/tool-options.d.ts +1 -1
  37. package/dist/contract/tool-options.d.ts.map +1 -1
  38. package/dist/device-relay/hub.d.ts +1 -1
  39. package/dist/device-relay/hub.d.ts.map +1 -1
  40. package/dist/entrypoints/agent-executor/acp.js +9 -9
  41. package/dist/entrypoints/agent-executor/claude-sdk.js +11 -11
  42. package/dist/entrypoints/agent-executor/claude.js +8 -8
  43. package/dist/entrypoints/agent-executor/codex.js +15 -15
  44. package/dist/entrypoints/agent-executor/testing.js +11 -11
  45. package/dist/entrypoints/agent-executor.js +14 -13
  46. package/dist/entrypoints/agent-runtime/ai-sdk.js +5 -5
  47. package/dist/entrypoints/agent-runtime/anthropic.js +1 -1
  48. package/dist/entrypoints/agent-runtime/browser.js +5 -5
  49. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  50. package/dist/entrypoints/agent-runtime/harness.js +14 -15
  51. package/dist/entrypoints/agent-runtime/openai.js +1 -1
  52. package/dist/entrypoints/agent-runtime/openrouter.js +7 -7
  53. package/dist/entrypoints/agent-runtime/postgres.js +5 -5
  54. package/dist/entrypoints/agent-runtime/realtime.js +8 -8
  55. package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
  56. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  57. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  58. package/dist/entrypoints/agent-runtime/testing.js +5 -5
  59. package/dist/entrypoints/agent-runtime.js +33 -29
  60. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  61. package/dist/entrypoints/application/directory-inbox.js +1 -1
  62. package/dist/entrypoints/application/grammy.js +1 -1
  63. package/dist/entrypoints/application/opentelemetry.js +2 -2
  64. package/dist/entrypoints/application.js +10 -10
  65. package/dist/entrypoints/cli/publish.js +8 -8
  66. package/dist/entrypoints/cli.d.ts +2 -0
  67. package/dist/entrypoints/cli.d.ts.map +1 -1
  68. package/dist/entrypoints/cli.js +518 -59
  69. package/dist/entrypoints/contract.d.ts +5 -1
  70. package/dist/entrypoints/contract.d.ts.map +1 -1
  71. package/dist/entrypoints/contract.js +25 -7
  72. package/dist/entrypoints/device-relay.js +20 -10
  73. package/dist/entrypoints/files/packaging.js +2 -2
  74. package/dist/entrypoints/files.js +10 -10
  75. package/dist/entrypoints/handler.d.ts +1 -1
  76. package/dist/entrypoints/handler.d.ts.map +1 -1
  77. package/dist/entrypoints/handler.js +12 -12
  78. package/dist/entrypoints/http.js +13 -12
  79. package/dist/entrypoints/index.js +36 -18
  80. package/dist/entrypoints/live.d.ts +2 -1
  81. package/dist/entrypoints/live.d.ts.map +1 -1
  82. package/dist/entrypoints/live.js +630 -1
  83. package/dist/entrypoints/node.d.ts +5 -0
  84. package/dist/entrypoints/node.d.ts.map +1 -1
  85. package/dist/entrypoints/node.js +36 -16
  86. package/dist/entrypoints/observability.js +25 -10
  87. package/dist/entrypoints/postgres.d.ts +1 -0
  88. package/dist/entrypoints/postgres.d.ts.map +1 -1
  89. package/dist/entrypoints/postgres.js +66 -0
  90. package/dist/entrypoints/primitives.js +11 -4
  91. package/dist/entrypoints/process.js +7 -7
  92. package/dist/entrypoints/react.js +1 -1
  93. package/dist/entrypoints/realtime.js +3 -3
  94. package/dist/entrypoints/remote.js +6 -29
  95. package/dist/entrypoints/server.d.ts +6 -1
  96. package/dist/entrypoints/server.d.ts.map +1 -1
  97. package/dist/entrypoints/server.js +93 -32
  98. package/dist/entrypoints/service-host/macos.js +6 -6
  99. package/dist/entrypoints/service-host/work.js +6 -6
  100. package/dist/entrypoints/service-host.js +10 -10
  101. package/dist/entrypoints/spend.js +2 -1
  102. package/dist/entrypoints/sync.js +5 -5
  103. package/dist/entrypoints/telegram.js +8 -8
  104. package/dist/entrypoints/testing.d.ts +1 -0
  105. package/dist/entrypoints/testing.d.ts.map +1 -1
  106. package/dist/entrypoints/testing.js +1501 -13
  107. package/dist/entrypoints/tools/agent.js +6 -7
  108. package/dist/entrypoints/tools/connections.js +9 -11
  109. package/dist/entrypoints/tools/contract.js +1 -2
  110. package/dist/entrypoints/tools/invoker.js +4 -5
  111. package/dist/entrypoints/tools/mcp.js +10 -11
  112. package/dist/entrypoints/tools/toolkit.d.ts +1 -1
  113. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -1
  114. package/dist/entrypoints/tools/toolkit.js +29 -24
  115. package/dist/entrypoints/tools.js +28 -30
  116. package/dist/entrypoints/tracking/contract.js +2 -1
  117. package/dist/entrypoints/xlsx.js +5 -8
  118. package/dist/{index-033tyx59.js → index-0zw0hcyg.js} +4 -1
  119. package/dist/{index-zcq3dby3.js → index-1bjwfnnj.js} +1 -1
  120. package/dist/{index-3zt0r4y0.js → index-1cfacbe2.js} +4 -4
  121. package/dist/{index-gj4wdts6.js → index-1ckh9qx1.js} +1 -1
  122. package/dist/index-1pvwmbxp.js +1435 -0
  123. package/dist/{index-0s75mjh7.js → index-2e4hdh32.js} +1 -1
  124. package/dist/{index-3shdhzt6.js → index-2j0pqxkn.js} +12 -6
  125. package/dist/index-3k8w02se.js +28 -0
  126. package/dist/{index-7fjbdga8.js → index-3pb4ccj2.js} +8 -0
  127. package/dist/{index-w7e402wx.js → index-48kb4gqq.js} +46 -7
  128. package/dist/{index-cv9b7fz2.js → index-6rws2xf5.js} +8 -0
  129. package/dist/{index-bbpygynk.js → index-77w5vx0g.js} +1 -1
  130. package/dist/index-7dz1ngaf.js +35 -0
  131. package/dist/{index-y68gavb5.js → index-7n4atsm4.js} +1 -1
  132. package/dist/index-8ef1bfea.js +71 -0
  133. package/dist/{index-0x4mnwg5.js → index-8k3y9nd4.js} +6 -9
  134. package/dist/{index-ezwsqyad.js → index-8rkdkefj.js} +40 -23
  135. package/dist/{index-3cwq5byx.js → index-9nax7tkn.js} +2 -2
  136. package/dist/{index-dz6tstcp.js → index-9r6emjwz.js} +1 -1
  137. package/dist/{index-32ew02z1.js → index-c4b7d6ej.js} +5 -5
  138. package/dist/index-ceshyndf.js +284 -0
  139. package/dist/{index-w161azza.js → index-d13rw31w.js} +6 -6
  140. package/dist/{index-1h0dtfz3.js → index-dmm7vs3f.js} +1 -1
  141. package/dist/{index-ypm85xwe.js → index-dp8j2e77.js} +1 -1
  142. package/dist/{index-qqd979f7.js → index-edycjvrv.js} +9 -9
  143. package/dist/{index-18qdpbcq.js → index-egpf9dv0.js} +200 -1479
  144. package/dist/{index-fatke81t.js → index-ezgvsj9w.js} +2 -2
  145. package/dist/{index-chapre0y.js → index-f3e7tj1g.js} +1 -1
  146. package/dist/{index-df5xr2f9.js → index-frsd2a94.js} +16 -1
  147. package/dist/index-fy9mmek1.js +95 -0
  148. package/dist/{index-2331y2tf.js → index-g0gvfzrx.js} +12 -12
  149. package/dist/index-gpe8d1ka.js +19 -0
  150. package/dist/{index-4p2zx593.js → index-gyw4qd0m.js} +1 -1
  151. package/dist/index-gzqy81tw.js +172 -0
  152. package/dist/{index-yrhw10ef.js → index-h34c510q.js} +8 -4
  153. package/dist/{index-rr94xcj6.js → index-h527p1yj.js} +10 -4
  154. package/dist/{index-qj0sq69b.js → index-hgf1tbgz.js} +76 -16
  155. package/dist/{index-smvmnz5y.js → index-hvpan32x.js} +1 -1
  156. package/dist/{index-4gbybjg6.js → index-hxawqrb6.js} +2 -2
  157. package/dist/{index-0k1ba0ss.js → index-j91jffhv.js} +1 -1
  158. package/dist/{index-d01akj5n.js → index-jr4kwetx.js} +8 -8
  159. package/dist/{index-xqppqn97.js → index-ka6z48zc.js} +315 -69
  160. package/dist/{index-by8w2461.js → index-kw0segzt.js} +104 -3
  161. package/dist/{index-6f4fjygr.js → index-m5t4dr7h.js} +29 -7
  162. package/dist/{index-afaq0nc4.js → index-n0egp1ke.js} +1 -1
  163. package/dist/{index-9fzjgg86.js → index-n74rb1dq.js} +2 -2
  164. package/dist/{index-dwq6a6sq.js → index-pt25vmhc.js} +33 -16
  165. package/dist/{index-vwg0n3e6.js → index-pyazb8q4.js} +23 -14
  166. package/dist/{index-5md04mwc.js → index-qpjjbkc5.js} +4 -4
  167. package/dist/{index-08a3qfr8.js → index-r1qt6zgj.js} +1 -1
  168. package/dist/{index-ctaxjpa4.js → index-r709pqed.js} +1 -1
  169. package/dist/{index-2zrx0nzv.js → index-rzc40z6e.js} +3 -5
  170. package/dist/{index-gq35s3bm.js → index-s5axtd56.js} +2 -2
  171. package/dist/{index-edpkm3k7.js → index-scpcps66.js} +669 -16
  172. package/dist/{index-ry8m2mhg.js → index-sf2mt6wj.js} +1 -1
  173. package/dist/{index-tjhhsnjv.js → index-t1213r0t.js} +1 -1
  174. package/dist/{index-gvgtmt7a.js → index-t7efje30.js} +2 -2
  175. package/dist/{index-w3s79kcb.js → index-tzyk36dy.js} +1 -1
  176. package/dist/{index-8tn10tp6.js → index-v64bvwjr.js} +1 -1
  177. package/dist/{index-1fhbe4e4.js → index-vksbsqpb.js} +1 -1
  178. package/dist/{index-dxft2mnm.js → index-wdg7bswj.js} +1 -1
  179. package/dist/{index-ppy23bd2.js → index-wjx1zs2r.js} +7 -578
  180. package/dist/{index-efbzm2se.js → index-x2r0ma9t.js} +1 -1
  181. package/dist/{index-kd48gk7d.js → index-x8py72a3.js} +1 -1
  182. package/dist/index-xvydbxmk.js +1404 -0
  183. package/dist/index-xwaphv0d.js +31 -0
  184. package/dist/{index-a09r9ff0.js → index-y44j39yk.js} +1 -1
  185. package/dist/{index-7mjsb7zv.js → index-ybrrxjhb.js} +1 -1
  186. package/dist/{index-xsrma0jd.js → index-ysthxsa8.js} +6 -6
  187. package/dist/{index-6p5pshcd.js → index-yyh3ey4b.js} +1 -1
  188. package/dist/{index-mr3njw67.js → index-z6hq9j8j.js} +1 -1
  189. package/dist/{index-67mzzkdv.js → index-z72agxdn.js} +2 -2
  190. package/dist/{index-e4w0sfm1.js → index-z78mtc16.js} +1 -1
  191. package/dist/{index-7csn6pva.js → index-ze94h4ph.js} +5 -0
  192. package/dist/internal/json-stringify.d.ts +12 -0
  193. package/dist/internal/json-stringify.d.ts.map +1 -1
  194. package/dist/internal/unix-client-error.d.ts +4 -0
  195. package/dist/internal/unix-client-error.d.ts.map +1 -1
  196. package/dist/live/watch-contract.d.ts +4 -0
  197. package/dist/live/watch-contract.d.ts.map +1 -1
  198. package/dist/live/watch-fanout-frame.d.ts +81 -0
  199. package/dist/live/watch-fanout-frame.d.ts.map +1 -0
  200. package/dist/live/watch-fanout.d.ts +57 -0
  201. package/dist/live/watch-fanout.d.ts.map +1 -0
  202. package/dist/observability/audit.d.ts.map +1 -1
  203. package/dist/observability/spool-core.d.ts +1 -0
  204. package/dist/observability/spool-core.d.ts.map +1 -1
  205. package/dist/observability/spool-drain.d.ts +48 -0
  206. package/dist/observability/spool-drain.d.ts.map +1 -0
  207. package/dist/observability/spool.d.ts +12 -6
  208. package/dist/observability/spool.d.ts.map +1 -1
  209. package/dist/postgres/rollback-transaction.d.ts +61 -0
  210. package/dist/postgres/rollback-transaction.d.ts.map +1 -0
  211. package/dist/primitives/deadline.d.ts +4 -4
  212. package/dist/primitives/deadline.d.ts.map +1 -1
  213. package/dist/server/error-hook.d.ts +3 -32
  214. package/dist/server/error-hook.d.ts.map +1 -1
  215. package/dist/server/local-consent-key.d.ts +104 -0
  216. package/dist/server/local-consent-key.d.ts.map +1 -0
  217. package/dist/server/local-control-journal.d.ts +51 -0
  218. package/dist/server/local-control-journal.d.ts.map +1 -0
  219. package/dist/server/local-control-reporter.d.ts +32 -0
  220. package/dist/server/local-control-reporter.d.ts.map +1 -0
  221. package/dist/server/local-control.d.ts +48 -0
  222. package/dist/server/local-control.d.ts.map +1 -0
  223. package/dist/server/local-host-clients.d.ts +105 -0
  224. package/dist/server/local-host-clients.d.ts.map +1 -0
  225. package/dist/server/middleware/trust-fence.d.ts +20 -0
  226. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  227. package/dist/spend/receipt-spool.d.ts +9 -4
  228. package/dist/spend/receipt-spool.d.ts.map +1 -1
  229. package/dist/testing/tool-surface-checks.d.ts +89 -0
  230. package/dist/testing/tool-surface-checks.d.ts.map +1 -0
  231. package/dist/testing/tool-surface-cli-callable.d.ts +63 -0
  232. package/dist/testing/tool-surface-cli-callable.d.ts.map +1 -0
  233. package/dist/testing/tool-surface-dead-refs.d.ts +32 -0
  234. package/dist/testing/tool-surface-dead-refs.d.ts.map +1 -0
  235. package/dist/testing/tool-surface-gates.d.ts +72 -0
  236. package/dist/testing/tool-surface-gates.d.ts.map +1 -0
  237. package/dist/testing/tool-surface-parity-drivers.d.ts +56 -0
  238. package/dist/testing/tool-surface-parity-drivers.d.ts.map +1 -0
  239. package/dist/testing/tool-surface-parity.d.ts +28 -0
  240. package/dist/testing/tool-surface-parity.d.ts.map +1 -0
  241. package/dist/testing/tool-surface-ratchet.d.ts +71 -0
  242. package/dist/testing/tool-surface-ratchet.d.ts.map +1 -0
  243. package/dist/tools/agent-tools.d.ts +3 -0
  244. package/dist/tools/agent-tools.d.ts.map +1 -1
  245. package/dist/tools/cli/command.d.ts +3 -0
  246. package/dist/tools/cli/command.d.ts.map +1 -1
  247. package/dist/tools/cli/create-cli.d.ts.map +1 -1
  248. package/dist/tools/cli/format.d.ts +3 -6
  249. package/dist/tools/cli/format.d.ts.map +1 -1
  250. package/dist/tools/cli/invoke.d.ts +4 -0
  251. package/dist/tools/cli/invoke.d.ts.map +1 -1
  252. package/dist/tools/cli/local-key-command.d.ts +53 -0
  253. package/dist/tools/cli/local-key-command.d.ts.map +1 -0
  254. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  255. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  256. package/dist/tools/cli/run-stream.d.ts.map +1 -1
  257. package/dist/tools/cli/runner.d.ts +8 -3
  258. package/dist/tools/cli/runner.d.ts.map +1 -1
  259. package/dist/tools/cli/secret.d.ts +55 -0
  260. package/dist/tools/cli/secret.d.ts.map +1 -0
  261. package/dist/tools/cli/session.d.ts +2 -2
  262. package/dist/tools/cli/session.d.ts.map +1 -1
  263. package/dist/tools/cli/stream.d.ts.map +1 -1
  264. package/dist/tools/cli/unix-outcome.d.ts +6 -0
  265. package/dist/tools/cli/unix-outcome.d.ts.map +1 -1
  266. package/dist/tools/execute-result.d.ts +20 -0
  267. package/dist/tools/execute-result.d.ts.map +1 -1
  268. package/dist/tools/execute.d.ts +3 -0
  269. package/dist/tools/execute.d.ts.map +1 -1
  270. package/dist/tools/internal/json-projection.d.ts +13 -9
  271. package/dist/tools/internal/json-projection.d.ts.map +1 -1
  272. package/dist/tools/internal/remote-error.d.ts +15 -0
  273. package/dist/tools/internal/remote-error.d.ts.map +1 -0
  274. package/dist/tools/internal/surface-projector.d.ts +2 -0
  275. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  276. package/dist/tools/invoker.d.ts +3 -0
  277. package/dist/tools/invoker.d.ts.map +1 -1
  278. package/dist/tools/mcp/handler.d.ts.map +1 -1
  279. package/dist/tools/mcp/lazy-discovery.d.ts +2 -0
  280. package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
  281. package/dist/tools/mcp/mount.d.ts +5 -0
  282. package/dist/tools/mcp/mount.d.ts.map +1 -1
  283. package/dist/tools/mcp/register.d.ts +2 -0
  284. package/dist/tools/mcp/register.d.ts.map +1 -1
  285. package/dist/tools/mcp/runtime-tools.d.ts +2 -0
  286. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  287. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  288. package/dist/tools/mount.d.ts +3 -0
  289. package/dist/tools/mount.d.ts.map +1 -1
  290. package/dist/tools/read-operation.d.ts +2 -6
  291. package/dist/tools/read-operation.d.ts.map +1 -1
  292. package/dist/tools/remote.d.ts.map +1 -1
  293. package/dist/tools/runtime-tool.d.ts.map +1 -1
  294. package/dist/tools/toolkit.d.ts +10 -3
  295. package/dist/tools/toolkit.d.ts.map +1 -1
  296. package/dist/xlsx/schema.d.ts.map +1 -1
  297. package/llms/cli.2.txt +10 -8
  298. package/llms/cli.3.txt +2 -0
  299. package/llms/cli.txt +18 -3
  300. package/llms/contract.txt +47 -5
  301. package/llms/handler.txt +1 -1
  302. package/llms/live.txt +82 -0
  303. package/llms/node.txt +5 -0
  304. package/llms/observability.2.txt +1 -1
  305. package/llms/observability.txt +6 -0
  306. package/llms/postgres.txt +1 -0
  307. package/llms/server.2.txt +206 -240
  308. package/llms/server.3.txt +242 -202
  309. package/llms/server.4.txt +202 -1025
  310. package/llms/server.5.txt +1053 -255
  311. package/llms/server.6.txt +274 -0
  312. package/llms/server.txt +32 -116
  313. package/llms/spend.txt +8 -7
  314. package/llms/stitchkit.2.txt +13 -35
  315. package/llms/stitchkit.3.txt +27 -0
  316. package/llms/stitchkit.txt +81 -81
  317. package/llms/testing.txt +40 -0
  318. package/llms/tools-toolkit.txt +2 -2
  319. package/llms/tools.2.txt +29 -20
  320. package/llms/{upgrading-0.128.0-0.129.0.txt → upgrading-0.128.0-0.131.0.txt} +101 -3
  321. package/llms/{upgrading-0.130.0-0.136.0.txt → upgrading-0.132.0-0.137.0.txt} +62 -101
  322. package/llms/upgrading.txt +2 -2
  323. package/llms-full.txt +590 -171
  324. package/llms.txt +13 -13
  325. package/package.json +1 -1
  326. package/dist/index-9118dw8d.js +0 -603
  327. package/dist/index-9vj869rx.js +0 -19
  328. package/dist/index-a1rjr381.js +0 -114
  329. package/dist/index-dacxr7nf.js +0 -17
  330. package/dist/index-dm50x3by.js +0 -63
  331. package/dist/index-dmrx8xma.js +0 -163
  332. package/dist/index-ednf2cxs.js +0 -37
  333. package/dist/{index-e4zt2x70.js → index-3czppvrr.js} +3 -3
  334. package/dist/{index-42n9jycn.js → index-3f79t32b.js} +3 -3
  335. package/dist/{index-mfe9a266.js → index-84n49vam.js} +0 -0
  336. package/dist/{index-f16b7rze.js → index-er1tp8de.js} +3 -3
  337. package/dist/{index-k137ezb6.js → index-f5d0fdcf.js} +3 -3
  338. package/dist/{index-65p8v81y.js → index-psz8qrz0.js} +3 -3
  339. package/dist/{index-kadgaw1s.js → index-r8cq86h1.js} +0 -0
  340. package/dist/{index-1yky29qg.js → index-tyyvbarf.js} +0 -0
  341. package/dist/{index-tjakdpf2.js → index-wq71v08n.js} +3 -3
  342. package/dist/{index-7an2fs5h.js → index-wswcpbm4.js} +3 -3
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { z } from 'zod';
7
7
  import type { Transport, TransportSource } from '../contract/define.js';
8
+ import { type ErrorCodeMapping } from '../contract/error-mapping.js';
8
9
  import type { ServiceDef } from '../server/types.js';
9
10
  import { type ToolExecutionOptions, type ToolOperation } from './execute.js';
10
11
  import type { ErrorHintFn, ToolCallHooks, ToolLifecycle } from './execute-hooks.js';
@@ -86,6 +87,8 @@ export interface ToolRunnerConfig {
86
87
  * it is not a model and gets the full answer, as HTTP does. → ADR 0196.
87
88
  */
88
89
  toolSurface?: boolean;
90
+ /** Shared error-code vocabulary or map applied to every failure produced by this runner. */
91
+ errors?: ErrorCodeMapping;
89
92
  }
90
93
  /**
91
94
  * Build the call executor for a mount — resolve the extend context, strip the
@@ -1 +1 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/tools/mount.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAEL,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,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@@ import type { OperationIdentity } from '../server/types.js';
3
3
  type Operation = Pick<OperationIdentity, 'method' | 'effect' | 'annotations'>;
4
4
  /**
5
5
  * Whether calling the operation again returns its answer without a new effect.
6
- *
7
- * Precedence:
8
- * 1. An explicit `annotations.readOnlyHint` decides in either direction.
9
- * 2. `effect === 'write'` returns `false` (blocking fallback to `GET`).
10
- * 3. `effect === 'read'` returns `true` unless `annotations.destructiveHint === true`.
11
- * 4. Without `effect`, `GET` is the fallback read unless `destructiveHint === true`.
6
+ * Delegates to the single canonical {@link isReadOnlyOperation} rule shared
7
+ * with HTTP client replay and surface gates (ADR 0345).
12
8
  */
13
9
  export declare function isRepeatableRead(operation: Operation): boolean;
14
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"read-operation.d.ts","sourceRoot":"","sources":["../../src/tools/read-operation.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,KAAK,SAAS,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC,CAAC;AAE9E;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,GACnB,uBAAuB,GAAG,SAAS,CAIrC;AAeD,qGAAqG;AACrG,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,OAAO,GACX,uBAAuB,GAAG,SAAS,CAYrC"}
1
+ {"version":3,"file":"read-operation.d.ts","sourceRoot":"","sources":["../../src/tools/read-operation.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,KAAK,SAAS,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,GACnB,uBAAuB,GAAG,SAAS,CAIrC;AAeD,qGAAqG;AACrG,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,OAAO,GACX,uBAAuB,GAAG,SAAS,CAYrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/tools/remote.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKnE,OAAO,KAAK,EAAa,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkE7D,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,aAAa,CAAC,EAAE,CACd,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjE;AAYD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnE,QAAQ,EAAE,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,EAChC,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,UAAU,CAwEZ"}
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/tools/remote.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAA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Q,CAAC,GACzC,kBAAkB,CAAC,QAAQ,CAAC,CAiE9B;AAED,KAAK,cAAc,GAAG,CACpB,MAAM,EAAE,OAAO,KACZ,oBAAoB,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAY9D,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,qBAAqB,GAChC,cAAc,GAAG,SAAS,CAG5B;AAyBD,gGAAgG;AAChG,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,GACrD,aAAa,CAef;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,kCAAkC,EAAE,GACnD,SAAS,qBAAqB,EAAE,CAgBlC"}
@@ -20,6 +20,7 @@
20
20
  */
21
21
  import type { McpServer } from '@modelcontextprotocol/server';
22
22
  import type { ZodObject } from 'zod';
23
+ import { type ErrorCodeMapping } from '../contract/error-mapping.js';
23
24
  import type { ServiceDef } from '../server/types.js';
24
25
  import { type AgentMountConfig, type AgentToolSet } from './agent-tools.js';
25
26
  import type { CliCommandDefinition } from './cli/command.js';
@@ -38,6 +39,11 @@ type WithStaticContext<C, TContext extends Record<string, unknown>> = C extends
38
39
  type WithAuthContext<C, TAuth, TContext extends Record<string, unknown>> = C extends unknown ? Omit<C, 'context'> & {
39
40
  context?: (auth: TAuth) => TContext;
40
41
  } : never;
42
+ /** Shared defaults applied across every surface created through a `Toolkit`. */
43
+ export interface ToolkitConfig {
44
+ /** Shared error-code vocabulary or map applied by default to MCP, agent tools, and CLI. */
45
+ errors?: ErrorCodeMapping;
46
+ }
41
47
  /** The context-pinned tool surface returned by `createToolkit`. */
42
48
  export interface Toolkit<TContext extends Record<string, unknown>> {
43
49
  mountMcp(server: McpServer, services: ServiceDef | ServiceDef[], config: WithStaticContext<McpMountConfig, TContext>): void;
@@ -50,9 +56,10 @@ export interface Toolkit<TContext extends Record<string, unknown>> {
50
56
  }
51
57
  /**
52
58
  * Fix the tool-handler context type once. `const tools =
53
- * createToolkit<AppContext>()` — then `tools.createCli`, `tools.mountMcp`, … all
54
- * type-check their injected `context` against `AppContext`.
59
+ * createToolkit<AppContext>({ errors })` — then `tools.createCli`,
60
+ * `tools.mountMcp`, … all type-check their injected `context` against
61
+ * `AppContext` and share default tool policies such as `errors`.
55
62
  */
56
- export declare function createToolkit<TContext extends Record<string, unknown>>(): Toolkit<TContext>;
63
+ export declare function createToolkit<TContext extends Record<string, unknown>>(defaults?: ToolkitConfig): Toolkit<TContext>;
57
64
  export {};
58
65
  //# sourceMappingURL=toolkit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../src/tools/toolkit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAmB,MAAM,eAAe,CAAC;AAC1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAoB,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAE1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,sFAAsF;AACtF,KAAK,iBA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AAO,CAAC,QAAQ,CAAC,CA2EnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/xlsx/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAqB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAK1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/xlsx/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAqB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAK1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
package/llms/cli.2.txt CHANGED
@@ -95,14 +95,16 @@ and `details.resultOnStdout` states which case occurred:
95
95
  | has an effect | the complete original result in the normal JSON format (`--json` still selects compact output) | reading stdout — never by repeating the mutation |
96
96
  | only reads | nothing | repeating the command with a corrected view |
97
97
 
98
- A managed command only reads by the same four-step rule used for `readOnlyHint`:
99
- an explicit `annotations.readOnlyHint` decides in either direction; otherwise
100
- `effect: 'write'` marks a non-read (even on `GET`); otherwise `effect: 'read'`
101
- marks a read unless `destructiveHint: true`; otherwise `GET` is the fallback read
102
- unless `destructiveHint: true`. `readOnlyHint: false`, `effect: 'write'` without
103
- `readOnlyHint`, or `destructiveHint: true` without `readOnlyHint` keeps the result
104
- on stdout. A native `defineCliCommand` declares none of those facts, so a failed
105
- `present` always keeps the validated result on stdout.
98
+ A managed command only reads by the single canonical `isReadOnlyOperation` rule
99
+ shared with MCP `readOnlyHint` and HTTP client network-failure replay
100
+ ([MCP & agents → `readOnlyHint`](./mcp-and-agents.md#saying-which-tools-only-read--readonlyhint),
101
+ [Client → calls that never got an answer](./client.md#calls-that-never-got-an-answer)):
102
+ `effect: 'write'` or `destructiveHint: true` is never a read; otherwise an
103
+ explicit `annotations.readOnlyHint` decides in either direction; otherwise
104
+ `effect: 'read'` is a read; otherwise `GET`/`HEAD` defaults to a read.
105
+ `readOnlyHint: false`, `effect: 'write'`, or `destructiveHint: true` keeps the
106
+ result on stdout. A native `defineCliCommand` declares none of those facts, so a
107
+ failed `present` always keeps the validated result on stdout.
106
108
 
107
109
  A CLI that mounts a server's tools through `defineMcpClientConnection` never sees the
108
110
  method or contract `effect` — every MCP call is a `POST` — so it reads the `readOnlyHint`
package/llms/cli.3.txt CHANGED
@@ -128,6 +128,8 @@ SDK nor the `ai` peer.
128
128
  | `CliArgumentError` | class | the refusal `parseCliArgs` and the view flags raise; a CLI reports it and exits `2` |
129
129
  | `renderCliView` | function | compute an aggregate over a result (`--count-by`, `--sum`, `--top`, `--table`) — [guide](../guide/cli.md#aggregate-views) |
130
130
  | `createCliProfileStore` | function | named `0600` credential profiles resolved by name, with the never-substitute rule built in — [guide](../guide/cli.md#named-profiles) |
131
+ | `readSecret` / `readSecretFile` / `ReadSecretOptions` / `ReadSecretFileOptions` / `SecretInputStream` | functions / _types_ | read a secret from a TTY in raw mode without echo (restoring terminal mode in `finally`) or piped stdin, or from a `0600` regular file via `O_NOFOLLOW | O_NONBLOCK` — [guide](../guide/cli.md#native-binary-commands) |
132
+ | `defineLocalKeyInitCommand` / `LocalKeyInitCommandConfig` / `LocalKeyInitOutput` / `LocalKeyInitOutputSchema` | function / _types_ / schema | native CLI command requesting a consent-gated local program key over a `0600` Unix control socket without retries and saving it to a `0600` profile without printing the secret |
131
133
  | `CliProfileError` | class | an `AppError` refusing a named profile that is missing, unreadable or shared between users |
132
134
  | `renderCliInstaller` | function | generate the one-line installer from a build manifest, with the URL and digest substituted — [guide](../guide/cli.md#distribution-and-self-update) |
133
135
  | `checkCliUpdate` | function | bounded, interval-limited, never-throwing check for a newer published build |
package/llms/cli.txt CHANGED
@@ -165,16 +165,25 @@ Login, self-update, diagnostics, integration setup and shell completion belong
165
165
  to the executable, not to HTTP/MCP/Agent. Define them with `defineCliCommand`:
166
166
 
167
167
  ```ts
168
- import { createCli, defineCliCommand } from 'stitchkit/cli'
168
+ import { createCli, defineCliCommand, readSecret, readSecretFile } from 'stitchkit/cli'
169
169
  import { z } from 'zod'
170
170
 
171
171
  const login = defineCliCommand({
172
172
  name: 'login',
173
173
  description: 'Store credentials for later managed commands',
174
- input: z.object({ token: z.string() }),
174
+ input: z.object({
175
+ keyFile: z.string().optional().describe('Read token from a 0600 file instead of prompting'),
176
+ }),
175
177
  output: z.object({ configured: z.boolean() }),
176
178
  handler: async ({ input }) => {
177
- await saveToken(input.token)
179
+ // Never accept tokens as CLI arguments (--token): arguments end up in shell
180
+ // history and process listings (`ps`). `readSecret` disables TTY echo and
181
+ // restores terminal mode in `finally`, or reads piped stdin; `readSecretFile`
182
+ // refuses symlinks, FIFOs, and any file readable by group or others (`chmod 600`).
183
+ const token = input.keyFile
184
+ ? readSecretFile(input.keyFile)
185
+ : await readSecret({ prompt: 'API token: ' })
186
+ await saveToken(token)
178
187
  return { configured: true }
179
188
  },
180
189
  })
@@ -189,6 +198,12 @@ await createCli({
189
198
  })
190
199
  ```
191
200
 
201
+ For local daemons that issue a scoped program key only after interactive operator
202
+ consent over a `0600` Unix control socket, `defineLocalKeyInitCommand` pairs with
203
+ `createLocalConsentKeyIssuance` from `stitchkit/server`: it requests a key over the
204
+ local socket without retries, waits for the operator prompt, and writes the returned
205
+ key directly to the local profile file (`0600`) without printing the secret.
206
+
192
207
  Native commands receive only typed `input`, parsed global `options` and the
193
208
  configured stdout/stderr writers. They reuse help, argv/stdin parsing,
194
209
  validation, dry-run, error envelopes and exit mapping, but deliberately have no
package/llms/contract.txt CHANGED
@@ -78,7 +78,7 @@ export const users = defineContract({ prefix: 'users' }, {
78
78
  | `multipart` | no | typed file fields, cardinality, delivery and upload policy — see [below](#file-uploads) |
79
79
  | `maxJsonBodyBytes` | no | per-route JSON body ceiling; overrides the server default |
80
80
  | `timeout` | no | per-endpoint client timeout in ms, for slow endpoints |
81
- | `idempotent` | no | safe to call twice with the same input (like `PUT`/`DELETE`); the typed client repeats a call that got no answer only when it is set, or for a `GET`/`HEAD` without `idempotent: false` or `effect: 'write'` — see [Client](./client.md#calls-that-never-got-an-answer); a retrying transport reads it too — see [Realtime](./realtime.md#bring-your-own-transport) |
81
+ | `idempotent` | no | safe to call twice with the same input (like `PUT`/`DELETE`); explicit `idempotent` wins for network-failure replay, otherwise `isReadOnlyOperation` decides (so `effect: 'write'`, `tool.annotations.readOnlyHint: false` and `destructiveHint: true` disable replay on `GET`/`HEAD`, while `effect: 'read'` and `readOnlyHint: true` enable it on `POST`) — see [Client](./client.md#calls-that-never-got-an-answer) and [MCP & agents](./mcp-and-agents.md#saying-which-tools-only-read--readonlyhint); a retrying transport reads it too — see [Realtime](./realtime.md#bring-your-own-transport) |
82
82
  | `meta` | no | opaque app metadata — read in hooks / on tool mounts, never in OpenAPI ([below](#endpoint-metadata-meta)) |
83
83
  | `rawResponse` | no | the handler returns the `Response` itself — a download, a file, an SSE stream. HTTP-only, never a tool, no `output`. See [Raw-response endpoints](./server.md#raw-response-endpoints) |
84
84
  | `rawBody` | no | retain original JSON text for a signed HTTP webhook. See [Signed JSON webhooks](./server.md#signed-json-webhooks) |
@@ -204,12 +204,51 @@ possible effective exposures rather than claiming an unfiltered default tuple.
204
204
  The same holds for an endpoint whose own type is broad, with or without a factory:
205
205
  a value annotated as `EndpointDef` or `FactoryScopedEndpoint<Scope>` carries
206
206
  `expose?: readonly Transport[]`, which may hold no HTTP, so it has no client method
207
- or URL. A helper that builds endpoints keeps their literal type with a const generic:
207
+ or URL. To split a large contract across multiple files while keeping literal types,
208
+ use `defineEndpoints` (or the factory's scoped `defineEndpoints`) in each fragment
209
+ module and combine them with `composeEndpoints`:
208
210
 
209
211
  ```ts
210
- const endpoint = <const Endpoint extends FactoryScopedEndpoint<AppScope>>(value: Endpoint) => value
212
+ // contracts/documents-query.ts
213
+ import { defineEndpoints } from 'stitchkit/contract' // or appFactory.defineEndpoints
214
+
215
+ export const documentQueryEndpoints = defineEndpoints({
216
+ search: { method: 'GET', path: '/search', desc: 'Search documents', output: SearchResult },
217
+ })
218
+
219
+ // contracts/documents.ts
220
+ import { composeEndpoints } from 'stitchkit/contract'
221
+ import { documentQueryEndpoints } from './documents-query'
222
+
223
+ export const documents = defineContract(
224
+ { prefix: 'documents', scope: 'member' },
225
+ composeEndpoints(
226
+ defineEndpoints({ get: { method: 'GET', path: '/:id', desc: 'Read a document', output: Doc } }),
227
+ documentQueryEndpoints,
228
+ ),
229
+ )
211
230
  ```
212
231
 
232
+ `defineEndpoints` catches misspelled or unknown endpoint fields (and unknown scopes on a
233
+ factory's `defineEndpoints`) right in the fragment file, and `composeEndpoints` refuses
234
+ duplicate operation names both at compile time and at runtime instead of silently
235
+ overwriting an earlier fragment.
236
+
237
+ ### IANA time zones (`IanaTimeZoneSchema` and `canonicalizeIanaTimeZone`)
238
+
239
+ `stitchkit/contract` (and `stitchkit`) exports `DEFAULT_TIME_ZONE` (`'UTC'`),
240
+ `IanaTimeZoneSchema`, `IanaTimeZone`, and `canonicalizeIanaTimeZone` so contracts and
241
+ servers do not mix form validation with runtime `tzdata` existence checks:
242
+
243
+ - Use `IanaTimeZoneSchema` in contract schemas and offline storage: it validates IANA
244
+ syntax (up to 64 characters, 1–3 slash-separated segments, rejecting bare UTC offsets
245
+ such as `'+08:00'`) without calling `Intl`, so clients with older `tzdata` never fail
246
+ reading stored or served records.
247
+ - Call `canonicalizeIanaTimeZone(value)` on the server before storing or scheduling: it
248
+ checks `IanaTimeZoneSchema` first and then resolves canonical casing through `Intl`
249
+ (`'asia/kuala_lumpur'` → `'Asia/Kuala_Lumpur'`), returning `null` for unknown zones
250
+ such as `'Mars/Olympus'` or bare offsets.
251
+
213
252
  For a curated tool surface use `toolExposure: { default: ['HTTP'] }`, then name
214
253
  tool transports only on endpoints that intentionally join them. An empty default
215
254
  is legal. Each `configure` snapshots its array independently; it does not change
@@ -529,6 +568,9 @@ from the root `stitchkit`.
529
568
  | Export | Kind | Summary |
530
569
  |--------|------|---------|
531
570
  | `defineContract` | function | declare a contract — [guide](../guide/contracts.md#definecontract) |
571
+ | `defineEndpoints` / `composeEndpoints` / `ScopedDefineEndpoints` | functions / _type_ | split a large contract across files with declaration-site excess-property/scope checks and compile-time + runtime duplicate operation refusal — [guide](../guide/contracts.md) |
572
+ | `DEFAULT_TIME_ZONE` / `IanaTimeZoneSchema` / `IanaTimeZone` / `canonicalizeIanaTimeZone` | const / schema / _type_ / function | browser- and server-safe IANA time zone schema (`'UTC'` default, rejecting bare offsets like `'+08:00'`) and runtime `Intl` canonicalizer |
573
+ | `isReadOnlyOperation` / `OperationReadClassification` | function / _type_ | canonical read-only predicate shared by HTTP client replay, MCP `readOnlyHint` publication, CLI refused-view withholding, and tool surface gates — [ADR 0345](../decisions/0345-one-read-rule-across-client-replay-and-tool-surfaces.md) |
532
574
  | `ConfiguredScopedDefineContract` | _type_ | scoped authoring parameterized by the exact default transport tuple; explicit endpoint exposure replaces it |
533
575
  | `ConfiguredToolExposureEndpoints` | _type_ | endpoint map with materialized exposure; a second generic selects defaults (HTTP when omitted), preserving explicit, optional and conditional overrides |
534
576
  | `createContractFactory` | function | a `defineContract` whose scope — on the contract **and** on any endpoint override — is required and held to your union, retaining each concrete literal — [guide](../guide/contracts.md#scope) |
@@ -588,16 +630,16 @@ from the root `stitchkit`.
588
630
  | `MultipartDescriptor` | _type_ | file fields, cardinality, delivery and request/text limits |
589
631
  | `MultipartFilePolicy` | _type_ | required/multiple, per-file bytes/count and declared MIME policy |
590
632
  | `MultipartBufferedFiles` | _type_ | `File` map inferred from a multipart descriptor |
591
- | `EndpointToolAnnotations` | _type_ | MCP behavioural hints on an endpoint (`readOnlyHint` / `destructiveHint` / `title`); omitted `readOnlyHint` derives `true` when `effect: 'read'` (or `GET` without `effect: 'write'`) and `destructiveHint !== true` |
633
+ | `EndpointToolAnnotations` | _type_ | MCP behavioural hints on an endpoint (`readOnlyHint` / `destructiveHint` / `title`); omitted `readOnlyHint` derives `true` when `effect: 'read'` (or `GET` / `HEAD` without `effect: 'write'`) and `destructiveHint !== true` |
592
634
  | `EndpointUiMeta` | _type_ | MCP Apps widget metadata on an endpoint |
593
635
  | `EndpointMcpInputRequired` | _type_ | typed MCP multi-round input request (`key`, message and Zod object schema) |
594
636
  | `EndpointMcpPolicy` | _type_ | MCP-only endpoint policy containing `inputRequired` |
595
637
 
596
638
  ### Errors
597
639
 
598
- | `ErrorVocabularyCode` / `ErrorVocabularyMapping` / `VocabularyCodeMap` | _type_ | application-code union, partial/exhaustive framework mapping input and resolved wire map returned by `defineErrors` |
599
640
  | Export | Kind | Summary |
600
641
  |--------|------|---------|
642
+ | `ErrorVocabularyCode` / `ErrorVocabularyMapping` / `VocabularyCodeMap` / `ErrorCodeMapping` | _type_ | application-code union, partial/exhaustive framework mapping input, resolved wire map returned by `defineErrors`, and transport-neutral error-code mapping shared across HTTP, MCP, AGENT, CLI, and `createToolkit` |
601
643
  | `AppError` | class | the framework error — `code` / `status` / `details` / `hint` |
602
644
  | `ErrorEnvelope` | _type_ | the JSON shape of an error response, preserving optional declared boolean `error.retryable` without changing HTTP retry policy |
603
645
  | `notFound` | function | throw `404 NOT_FOUND` — [guide](../guide/auth-and-errors.md#throwing-errors) |
package/llms/handler.txt CHANGED
@@ -17,7 +17,7 @@ Portable Fetch handler and `postMessage` bridge host without Node built-ins; usa
17
17
  |--------|------|---------|
18
18
  | `createHandler` | function | build a Fetch `(req) => Promise<Response>` contract router without Node built-ins |
19
19
  | `implement` / `createImplement` | function | bind typed contract handlers (`ImplementOptions`, `MissingHandlerPolicy`) |
20
- | `createErrorHook` | function | build a composable error hook (`ErrorHookBase`, `ErrorHookConfig`, `ErrorHookMapping`, `ResolvedError`) |
20
+ | `createErrorHook` | function | build a composable error hook (`ErrorHookBase`, `ErrorHookConfig`, `ErrorCodeMapping`, `ResolvedError`) |
21
21
  | `serveBridge` | function | serve a `FetchHandler` over a string-only `postMessage` bridge port with origin trust, optional constant-time secret, `maxFrameBytes` before `JSON.parse` and `maxInFlight` |
22
22
  | `BridgeHostConfig` / `BridgeHostHandle` / `BridgeHostPort` / `BridgeHostStats` / `BridgeInboundMessage` | _types_ | configuration, handle, port, diagnostic counters and inbound container message for `serveBridge` |
23
23
  | `AppError` / `badRequest` / `unauthorized` / `forbidden` / `notFound` / `conflict` / `rateLimited` / `isStitchErrorCode` / `STITCH_ERROR_STATUS` / `StitchErrorCode` | class / function / const / _type_ | shared error vocabulary re-exported for portable handlers |
package/llms/live.txt CHANGED
@@ -260,6 +260,51 @@ has not moved. That needs the key to still exist on the server — set `holdMs`
260
260
  past your reconnect delay, or the last detach releases the source and the page
261
261
  pays the whole value once.
262
262
 
263
+ ### Relaying watches to multiple local windows (`createWatchFanout`)
264
+
265
+ When one local desktop host holds a single upstream watch socket to the cloud and
266
+ serves several local windows, forwarding raw `WATCH_OPEN` and `WATCH_CLOSE` frames
267
+ breaks twice: a second window opening an already-held key receives `{ accepted: true }`
268
+ with no value frame, and one window closing a key drops it for every other window.
269
+
270
+ `createWatchFanout` (`stitchkit/live`) multiplexes one shared upstream subscription per
271
+ `(service, action, digest)` across any number of downstream clients while preserving
272
+ each client's own `WatchKey.instance`, maintaining a verified host copy (`applyWatchDelta`
273
+ + fingerprint check), translating upstream revision resets onto a monotonic downstream
274
+ counter so windows stay live across a cloud restart, and resyncing upstream if a delta
275
+ base mismatches without corrupting the host copy:
276
+
277
+ ```ts
278
+ import {
279
+ createWatchFanout,
280
+ WATCH_CLOSE,
281
+ WATCH_OPEN,
282
+ WATCH_STATE,
283
+ WATCH_VALUE,
284
+ } from 'stitchkit/live'
285
+
286
+ const fanout = createWatchFanout<string>({
287
+ upstream: {
288
+ open: (input) => cloudSocket.request(WATCH_OPEN, input, { timeoutMs: 10_000 }),
289
+ close: (key) => cloudSocket.emit(WATCH_CLOSE, { key }),
290
+ },
291
+ deliver: {
292
+ value: (client, frame) => hostClients.sendTo(client, WATCH_VALUE, frame),
293
+ state: (client, frame) => hostClients.sendTo(client, WATCH_STATE, frame),
294
+ },
295
+ })
296
+
297
+ // Wire downstream open/close/disconnect and upstream frames/reconnect:
298
+ hostClients.on(WATCH_OPEN, async (caller, input, ack) => ack(await fanout.open(caller.client, input)))
299
+ hostClients.on(WATCH_CLOSE, (caller, payload) => fanout.close(caller.client, payload.key))
300
+ cloudSocket.on(WATCH_VALUE, (frame) => fanout.value(frame))
301
+ cloudSocket.on(WATCH_STATE, (frame) => fanout.state(frame))
302
+ cloudSocket.onConnectionChange((connected) => {
303
+ if (!connected) fanout.forget('upstream disconnected')
304
+ else void fanout.reopen()
305
+ })
306
+ ```
307
+
263
308
  ### Large answers cross as differences
264
309
 
265
310
  A frame carries the value, a **difference** to a revision this subscriber already
@@ -407,6 +452,41 @@ Same entry format as `trustedHosts`, compared against the `Origin`'s authority.
407
452
  Declaring one does not widen anything else: an undeclared origin is still
408
453
  refused, and `trustedHosts` still decides which authority the server answers on.
409
454
 
455
+ ### Cross-site public read routes (`publicReads`)
456
+
457
+ Some HTTP routes are meant to be opened from any site — signed download URLs,
458
+ public avatars, or read-only shared resources whose capability token travels in
459
+ the URL or a header. Rather than stripping `Origin` and `Sec-Fetch-Site` in a
460
+ manual wrapper around `fence.check`, declare a synchronous predicate on the
461
+ fence:
462
+
463
+ ```ts
464
+ createTrustFence({
465
+ trustedHosts: ['app.example'],
466
+ publicReads: (request) => {
467
+ const { pathname } = new URL(request.url);
468
+ return pathname.startsWith('/api/public/');
469
+ },
470
+ });
471
+ ```
472
+
473
+ When `publicReads(request)` returns strictly `true`, `cross-site` and
474
+ `origin-mismatch` are skipped — under strict fail-closed boundaries:
475
+
476
+ - **`Host` is always enforced first:** `missing-host` and `untrusted-host` are
477
+ never bypassed, so DNS rebinding remains refused.
478
+ - **HTTP safe reads only:** evaluated only on the HTTP lane for exact `GET` and
479
+ `HEAD` requests with no `Upgrade` header. `POST`, `PUT`, `PATCH`, `DELETE`,
480
+ `OPTIONS`, raw WebSocket `Upgrade` handshakes, and the entire Socket.IO lane
481
+ (`allowRequest` / `'socket'`) ignore `publicReads` and never call it.
482
+ - **Fail-closed on error:** if the predicate throws or returns anything other
483
+ than `true` (including a `Promise`), the request falls through to the normal
484
+ bare 403 refusal and logs an error via `logger.error` (or `console.error`).
485
+ - **Not CORS:** `publicReads` only admits `GET`/`HEAD` past the trust fence; it
486
+ does not add `Access-Control-Allow-Origin` headers or exempt `OPTIONS`
487
+ preflights. Configure `cors` alongside the fence when cross-site browser code
488
+ reads the response or sends custom headers.
489
+
410
490
  It is worth knowing what the `Origin` check is for, because it is not what most
411
491
  people assume. It is **not** the DNS-rebinding defence — that attack is
412
492
  same-origin by construction, so it sends a matching `Origin` or none at all, and
@@ -483,6 +563,8 @@ realtime contract from `stitchkit`, and the server halves live in `stitchkit/app
483
563
  | `watchContract` | const | the four-event realtime contract a watched read travels on |
484
564
  | `WATCH_OPEN` / `WATCH_CLOSE` / `WATCH_VALUE` / `WATCH_STATE` | const | the event names of that contract |
485
565
  | `WatchKey` / `WatchKeySchema` / `watchKeyString` | type / schema / function | `(service, action, arguments digest)` — the identity both ends compute the same way |
566
+ | `WatchOpenInput` / `WatchAccepted` | _types_ | Zod-inferred payload (`{ key, args, have? }`) and acknowledgement (`{ accepted, reason? }`) for `WATCH_OPEN` |
567
+ | `createWatchFanout` / `WatchFanout` / `WatchFanoutConfig` / `WatchFanoutUpstream` / `WatchFanoutDelivery` | function / _types_ | multi-client watch relay sharing one upstream subscription per `(service, action, digest)` across local windows while preserving per-client `WatchKey.instance`, host copy verification, monotonic downstream revisions across cloud restarts, resync on bad deltas, and `forget` / `reopen` — [guide](../guide/live.md#relaying-watches-to-multiple-local-windows-createwatchfanout) |
486
568
  | `WatchValueFrame` / `WatchValueSchema` / `WatchStateFrame` / `WatchStateSchema` | _types_ | one answer — `full`, `delta` or `unchanged`, with its monotonic revision and fingerprint — and a phase from `LiveStatePhase` with the read's own code and message |
487
569
  | `WatchHave` / `WatchHaveSchema` | type / schema | what a reconnecting subscriber already holds, offered on `open`: a revision and the fingerprint that proves it |
488
570
  | `WatchDelta` / `WatchDeltaSchema` / `WatchArrayOp` / `WatchArrayOpSchema` | _types_ / schemas | a structural difference over parsed JSON — objects by changed and dropped key, arrays by runs copied from the previous value |
package/llms/node.txt CHANGED
@@ -27,6 +27,11 @@ runtime-agnostic pieces of `stitchkit/server` and the error helpers.
27
27
  | `serveNode` | function | build the router and start a Node HTTP server (via `srvx`) |
28
28
  | `createHandler` | function | the router as a bare `(req) => Response` (same as `/server`) |
29
29
  | `createLocalHostGuard` / `LocalHostGuard` / `LocalHostGuardConfig` / `LocalHostRefusal` | function / _types_ | the local-host guard for `serveNode` (same as `/server`) |
30
+ | `createLocalHostClients` / `DEFAULT_LOCAL_HOST_CLIENT_ID_HEADER` / `HostClient` / `LocalHostClientData` / `LocalHostClients` / `LocalHostClientsConfig` / `LocalHostClientsSetup` | function / const / _types_ | multi-window local-host client identity, `sendTo`, `callerFromRequest`, and departure hooks for `serveNode` (same as `/server`) |
31
+ | `extractReportedClient` / `ReportedClient` / `ReportedClientField` / `ReportedClientOptions` | function / _types_ | extract sanitized caller-supplied attribution headers tagged `verified: false` for local control sockets (same as `/server`) |
32
+ | `createLocalControlJournal` / `LocalControlJournal` / `LocalControlJournalConfig` / `LocalControlJournalEntry` / `LocalControlJournalEntrySchema` | function / _types_ / schema | append-only `0600` metadata-only JSONL call journal with serialized `.1` rotation and bounded `maxPendingWrites` backpressure queue (same as `/server`) |
33
+ | `createLocalControlGuard` / `LocalControlGuard` / `LocalControlGuardConfig` | function / _types_ | local control-socket fetch guard with header, body, concurrency, and journal limits (same as `/server`) |
34
+ | `createLocalConsentKeyIssuance` / `LocalConsentAuthorization` / `LocalConsentDecision` / `LocalConsentKeyConfig` / `LocalConsentKeyIssuance` / `LocalConsentKeyRequest` / `LocalConsentKeyRequestSchema` / `LocalConsentQuestion` | function / _types_ / schema | fail-closed native-consent program key issuance route plus `guardWhileConsentPending` (same as `/server`) |
30
35
  | `createSocketIOServer` | function | the typed Node Socket.IO server (`io` + `attach`; no Bun engine declarations) |
31
36
  | `createUnixClientTransport` | function | the same fail-closed Bun/Node Unix client adapter exported by `stitchkit/server` (including optional `expectedOwnerUid`) |
32
37
  | `implement` / `createImplement` / `createScopedImplement` / `createScopedImplementRegistry` / `createMultipartStream` | function | bind a contract to typed handlers, optionally typed per endpoint scope (same as `/server`) |
@@ -26,7 +26,7 @@ audit event. See the [Observability guide](../guide/observability.md).
26
26
  |--------|------|---------|
27
27
  | `createObservability` | function | configure framework-owned request completion and canonical tool event sinks — [guide](../guide/observability.md#createobservability) |
28
28
  | `auditChanges` | function | the sink `filter` most projects write themselves — drops `GET`/`HEAD`/`OPTIONS`, keeps `401`/`403` whatever the verb, keeps an unrecognised verb |
29
- | `createSpooledSink` / `SpooledSink` / `SpooledSinkConfig` / `SpoolRecovery` | function / _types_ | spool the row to an append-only file before the store and replay what a previous process left undelivered — at least once, keyed on `spanId`; `recover()` reads the file line by line, and a debt over `maxFileBytes` goes to `<path>.<ms>.overflow`, named by `SpoolRecovery.quarantined` and reported as `SPOOL_QUARANTINED`, so new records still spool; a file that cannot be read sets `unread: true` and reports `SPOOL_UNREADABLE` with its `cause`, never `{ replayed: 0, failed: 0 }`; a row past `maxPendingEntries` or `maxFileBytes` that the store also refuses rejects `write` with `SPOOL_UNSPOOLED` (store error as `cause`) and `onSpoolError` reports `SPOOL_FULL` (ADR 0323) |
29
+ | `createSpooledSink` / `SpooledSink` / `SpooledSinkConfig` / `SpoolRecovery` | function / _types_ | spool the row to an append-only file before the store, replay what a previous process left undelivered (`recover()`), and redeliver spooled rows in the same process via bounded single-flight auto-drain once the store accepts a write again plus explicit `flush(): Promise<SpoolRecovery>` — at least once, keyed on `spanId`; `recover()` reads the file line by line, and a debt over `maxFileBytes` goes to `<path>.<ms>.overflow`, named by `SpoolRecovery.quarantined` and reported as `SPOOL_QUARANTINED`, so new records still spool; a file that cannot be read sets `unread: true` and reports `SPOOL_UNREADABLE` with its `cause`, never `{ replayed: 0, failed: 0 }`; a row past `maxPendingEntries` or `maxFileBytes` that the store also refuses rejects `write` with `SPOOL_UNSPOOLED` (store error as `cause`) and `onSpoolError` reports `SPOOL_FULL` (ADR 0323) |
30
30
  | `createDimensionsProjector` / `DimensionsProjector` / `DimensionsProjectorConfig` / `ProjectedDimensions` | function / _type_ | typed request/result/error attribution projected into the existing request context |
31
31
  | `DimensionCollision` / `SetRequestDimensionsOptions` | _type_ | explicit overwrite, preserve or error policy for dimension keys |
32
32
  | `createBoundedLogger` | function | decorate a `StitchLogger` with request context, shared sanitisation, redaction and total bounds |
@@ -383,6 +383,12 @@ const audit = createSpooledSink({
383
383
  const { replayed, failed } = await audit.recover();
384
384
 
385
385
  createObservability({ request: { write: audit.write, filter: auditChanges } });
386
+
387
+ // After a transient outage in the same process, the next successful `write`
388
+ // triggers a single-flight background redelivery pass automatically; call
389
+ // `await audit.flush()` to explicitly drain undelivered rows alongside live
390
+ // writes (for example on a timer or graceful shutdown).
391
+ await audit.flush();
386
392
  ```
387
393
 
388
394
  The guarantee is **at least once**. A crash between the store accepting a row and
package/llms/postgres.txt CHANGED
@@ -43,5 +43,6 @@ const prisma = new PrismaClient({ adapter });
43
43
  | `PrismaDriverAdapterFactory` | _type_ | minimal structural Prisma SQL driver adapter factory (`provider`, `adapterName`, `connect`, optional `connectToShadowDb`) accepted by `withSerializedPrismaTransactions` |
44
44
  | `PrismaDriverAdapter` | _type_ | minimal structural connected Prisma SQL driver adapter (`startTransaction`) |
45
45
  | `PrismaDriverTransaction` | _type_ | minimal structural interactive transaction handle (`queryRaw`, `executeRaw`, `commit`, `rollback` and optional savepoints) |
46
+ | `runRollbackTransaction` / `InteractiveTransactionClient` / `PlannedRollback` / `TransactionRollback` / `RollbackTransactionResult` | function / _types_ | peer-free planned-rollback interactive transaction helper (`return rollback(value)`) for dry-run and stop-on-first-failure flows without swallowing real database errors |
46
47
 
47
48
  ---