stitchkit 0.136.7 → 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 (358) hide show
  1. package/CHANGELOG.md +68 -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.d.ts +4 -4
  66. package/dist/entrypoints/cli/publish.d.ts.map +1 -1
  67. package/dist/entrypoints/cli/publish.js +160 -52
  68. package/dist/entrypoints/cli.d.ts +3 -1
  69. package/dist/entrypoints/cli.d.ts.map +1 -1
  70. package/dist/entrypoints/cli.js +520 -59
  71. package/dist/entrypoints/contract.d.ts +5 -1
  72. package/dist/entrypoints/contract.d.ts.map +1 -1
  73. package/dist/entrypoints/contract.js +25 -7
  74. package/dist/entrypoints/device-relay.js +20 -10
  75. package/dist/entrypoints/files/packaging.js +2 -2
  76. package/dist/entrypoints/files.js +10 -10
  77. package/dist/entrypoints/handler.d.ts +1 -1
  78. package/dist/entrypoints/handler.d.ts.map +1 -1
  79. package/dist/entrypoints/handler.js +12 -12
  80. package/dist/entrypoints/http.js +13 -12
  81. package/dist/entrypoints/index.js +36 -18
  82. package/dist/entrypoints/live.d.ts +2 -1
  83. package/dist/entrypoints/live.d.ts.map +1 -1
  84. package/dist/entrypoints/live.js +630 -1
  85. package/dist/entrypoints/node.d.ts +5 -0
  86. package/dist/entrypoints/node.d.ts.map +1 -1
  87. package/dist/entrypoints/node.js +36 -16
  88. package/dist/entrypoints/observability.js +25 -10
  89. package/dist/entrypoints/postgres.d.ts +4 -1
  90. package/dist/entrypoints/postgres.d.ts.map +1 -1
  91. package/dist/entrypoints/postgres.js +312 -0
  92. package/dist/entrypoints/primitives.js +11 -4
  93. package/dist/entrypoints/process.js +7 -7
  94. package/dist/entrypoints/react.js +1 -1
  95. package/dist/entrypoints/realtime.js +3 -3
  96. package/dist/entrypoints/remote.js +6 -29
  97. package/dist/entrypoints/server.d.ts +6 -1
  98. package/dist/entrypoints/server.d.ts.map +1 -1
  99. package/dist/entrypoints/server.js +93 -32
  100. package/dist/entrypoints/service-host/macos.js +6 -6
  101. package/dist/entrypoints/service-host/work.js +6 -6
  102. package/dist/entrypoints/service-host.js +10 -10
  103. package/dist/entrypoints/spend.js +2 -1
  104. package/dist/entrypoints/sync.js +5 -5
  105. package/dist/entrypoints/telegram.js +8 -8
  106. package/dist/entrypoints/testing.d.ts +1 -0
  107. package/dist/entrypoints/testing.d.ts.map +1 -1
  108. package/dist/entrypoints/testing.js +1501 -13
  109. package/dist/entrypoints/tools/agent.js +6 -7
  110. package/dist/entrypoints/tools/connections.js +9 -11
  111. package/dist/entrypoints/tools/contract.js +1 -2
  112. package/dist/entrypoints/tools/invoker.js +4 -5
  113. package/dist/entrypoints/tools/mcp.js +10 -11
  114. package/dist/entrypoints/tools/toolkit.d.ts +1 -1
  115. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -1
  116. package/dist/entrypoints/tools/toolkit.js +29 -24
  117. package/dist/entrypoints/tools.js +28 -30
  118. package/dist/entrypoints/tracking/contract.js +2 -1
  119. package/dist/entrypoints/xlsx.js +5 -8
  120. package/dist/{index-033tyx59.js → index-0zw0hcyg.js} +4 -1
  121. package/dist/{index-zcq3dby3.js → index-1bjwfnnj.js} +1 -1
  122. package/dist/{index-f103md2v.js → index-1cfacbe2.js} +88 -23
  123. package/dist/{index-gj4wdts6.js → index-1ckh9qx1.js} +1 -1
  124. package/dist/index-1pvwmbxp.js +1435 -0
  125. package/dist/{index-0s75mjh7.js → index-2e4hdh32.js} +1 -1
  126. package/dist/{index-3shdhzt6.js → index-2j0pqxkn.js} +12 -6
  127. package/dist/index-3k8w02se.js +28 -0
  128. package/dist/{index-7fjbdga8.js → index-3pb4ccj2.js} +8 -0
  129. package/dist/{index-w7e402wx.js → index-48kb4gqq.js} +46 -7
  130. package/dist/{index-cv9b7fz2.js → index-6rws2xf5.js} +8 -0
  131. package/dist/{index-bbpygynk.js → index-77w5vx0g.js} +1 -1
  132. package/dist/index-7dz1ngaf.js +35 -0
  133. package/dist/{index-y68gavb5.js → index-7n4atsm4.js} +1 -1
  134. package/dist/index-8ef1bfea.js +71 -0
  135. package/dist/{index-0x4mnwg5.js → index-8k3y9nd4.js} +6 -9
  136. package/dist/{index-ezwsqyad.js → index-8rkdkefj.js} +40 -23
  137. package/dist/{index-3cwq5byx.js → index-9nax7tkn.js} +2 -2
  138. package/dist/{index-dz6tstcp.js → index-9r6emjwz.js} +1 -1
  139. package/dist/{index-32ew02z1.js → index-c4b7d6ej.js} +5 -5
  140. package/dist/index-ceshyndf.js +284 -0
  141. package/dist/{index-w161azza.js → index-d13rw31w.js} +6 -6
  142. package/dist/{index-1h0dtfz3.js → index-dmm7vs3f.js} +1 -1
  143. package/dist/{index-ypm85xwe.js → index-dp8j2e77.js} +1 -1
  144. package/dist/{index-qqd979f7.js → index-edycjvrv.js} +9 -9
  145. package/dist/{index-18qdpbcq.js → index-egpf9dv0.js} +200 -1479
  146. package/dist/{index-fatke81t.js → index-ezgvsj9w.js} +2 -2
  147. package/dist/{index-chapre0y.js → index-f3e7tj1g.js} +1 -1
  148. package/dist/{index-df5xr2f9.js → index-frsd2a94.js} +16 -1
  149. package/dist/index-fy9mmek1.js +95 -0
  150. package/dist/{index-2331y2tf.js → index-g0gvfzrx.js} +12 -12
  151. package/dist/index-gpe8d1ka.js +19 -0
  152. package/dist/{index-4p2zx593.js → index-gyw4qd0m.js} +1 -1
  153. package/dist/index-gzqy81tw.js +172 -0
  154. package/dist/{index-yrhw10ef.js → index-h34c510q.js} +8 -4
  155. package/dist/{index-rr94xcj6.js → index-h527p1yj.js} +10 -4
  156. package/dist/{index-qj0sq69b.js → index-hgf1tbgz.js} +76 -16
  157. package/dist/{index-smvmnz5y.js → index-hvpan32x.js} +1 -1
  158. package/dist/{index-4gbybjg6.js → index-hxawqrb6.js} +2 -2
  159. package/dist/{index-0k1ba0ss.js → index-j91jffhv.js} +1 -1
  160. package/dist/{index-d01akj5n.js → index-jr4kwetx.js} +8 -8
  161. package/dist/{index-xqppqn97.js → index-ka6z48zc.js} +315 -69
  162. package/dist/{index-by8w2461.js → index-kw0segzt.js} +104 -3
  163. package/dist/{index-6f4fjygr.js → index-m5t4dr7h.js} +29 -7
  164. package/dist/{index-afaq0nc4.js → index-n0egp1ke.js} +1 -1
  165. package/dist/{index-9fzjgg86.js → index-n74rb1dq.js} +2 -2
  166. package/dist/{index-dwq6a6sq.js → index-pt25vmhc.js} +33 -16
  167. package/dist/{index-vwg0n3e6.js → index-pyazb8q4.js} +23 -14
  168. package/dist/{index-5md04mwc.js → index-qpjjbkc5.js} +4 -4
  169. package/dist/{index-08a3qfr8.js → index-r1qt6zgj.js} +1 -1
  170. package/dist/{index-ctaxjpa4.js → index-r709pqed.js} +1 -1
  171. package/dist/{index-2zrx0nzv.js → index-rzc40z6e.js} +3 -5
  172. package/dist/{index-gq35s3bm.js → index-s5axtd56.js} +2 -2
  173. package/dist/{index-edpkm3k7.js → index-scpcps66.js} +669 -16
  174. package/dist/{index-ry8m2mhg.js → index-sf2mt6wj.js} +1 -1
  175. package/dist/{index-tjhhsnjv.js → index-t1213r0t.js} +1 -1
  176. package/dist/{index-gvgtmt7a.js → index-t7efje30.js} +2 -2
  177. package/dist/{index-w3s79kcb.js → index-tzyk36dy.js} +1 -1
  178. package/dist/{index-8tn10tp6.js → index-v64bvwjr.js} +1 -1
  179. package/dist/{index-1fhbe4e4.js → index-vksbsqpb.js} +1 -1
  180. package/dist/{index-dxft2mnm.js → index-wdg7bswj.js} +1 -1
  181. package/dist/{index-ppy23bd2.js → index-wjx1zs2r.js} +7 -578
  182. package/dist/{index-efbzm2se.js → index-x2r0ma9t.js} +1 -1
  183. package/dist/{index-kd48gk7d.js → index-x8py72a3.js} +1 -1
  184. package/dist/index-xvydbxmk.js +1404 -0
  185. package/dist/index-xwaphv0d.js +31 -0
  186. package/dist/{index-a09r9ff0.js → index-y44j39yk.js} +1 -1
  187. package/dist/{index-7mjsb7zv.js → index-ybrrxjhb.js} +1 -1
  188. package/dist/{index-xsrma0jd.js → index-ysthxsa8.js} +6 -6
  189. package/dist/{index-6p5pshcd.js → index-yyh3ey4b.js} +1 -1
  190. package/dist/{index-mr3njw67.js → index-z6hq9j8j.js} +1 -1
  191. package/dist/{index-67mzzkdv.js → index-z72agxdn.js} +2 -2
  192. package/dist/{index-e4w0sfm1.js → index-z78mtc16.js} +1 -1
  193. package/dist/{index-7csn6pva.js → index-ze94h4ph.js} +5 -0
  194. package/dist/internal/json-stringify.d.ts +12 -0
  195. package/dist/internal/json-stringify.d.ts.map +1 -1
  196. package/dist/internal/unix-client-error.d.ts +4 -0
  197. package/dist/internal/unix-client-error.d.ts.map +1 -1
  198. package/dist/live/watch-contract.d.ts +4 -0
  199. package/dist/live/watch-contract.d.ts.map +1 -1
  200. package/dist/live/watch-fanout-frame.d.ts +81 -0
  201. package/dist/live/watch-fanout-frame.d.ts.map +1 -0
  202. package/dist/live/watch-fanout.d.ts +57 -0
  203. package/dist/live/watch-fanout.d.ts.map +1 -0
  204. package/dist/observability/audit.d.ts.map +1 -1
  205. package/dist/observability/spool-core.d.ts +1 -0
  206. package/dist/observability/spool-core.d.ts.map +1 -1
  207. package/dist/observability/spool-drain.d.ts +48 -0
  208. package/dist/observability/spool-drain.d.ts.map +1 -0
  209. package/dist/observability/spool.d.ts +12 -6
  210. package/dist/observability/spool.d.ts.map +1 -1
  211. package/dist/postgres/connection-config.d.ts +54 -0
  212. package/dist/postgres/connection-config.d.ts.map +1 -0
  213. package/dist/postgres/rollback-transaction.d.ts +61 -0
  214. package/dist/postgres/rollback-transaction.d.ts.map +1 -0
  215. package/dist/primitives/deadline.d.ts +4 -4
  216. package/dist/primitives/deadline.d.ts.map +1 -1
  217. package/dist/server/error-hook.d.ts +3 -32
  218. package/dist/server/error-hook.d.ts.map +1 -1
  219. package/dist/server/local-consent-key.d.ts +104 -0
  220. package/dist/server/local-consent-key.d.ts.map +1 -0
  221. package/dist/server/local-control-journal.d.ts +51 -0
  222. package/dist/server/local-control-journal.d.ts.map +1 -0
  223. package/dist/server/local-control-reporter.d.ts +32 -0
  224. package/dist/server/local-control-reporter.d.ts.map +1 -0
  225. package/dist/server/local-control.d.ts +48 -0
  226. package/dist/server/local-control.d.ts.map +1 -0
  227. package/dist/server/local-host-clients.d.ts +105 -0
  228. package/dist/server/local-host-clients.d.ts.map +1 -0
  229. package/dist/server/middleware/trust-fence.d.ts +20 -0
  230. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  231. package/dist/spend/receipt-spool.d.ts +9 -4
  232. package/dist/spend/receipt-spool.d.ts.map +1 -1
  233. package/dist/testing/tool-surface-checks.d.ts +89 -0
  234. package/dist/testing/tool-surface-checks.d.ts.map +1 -0
  235. package/dist/testing/tool-surface-cli-callable.d.ts +63 -0
  236. package/dist/testing/tool-surface-cli-callable.d.ts.map +1 -0
  237. package/dist/testing/tool-surface-dead-refs.d.ts +32 -0
  238. package/dist/testing/tool-surface-dead-refs.d.ts.map +1 -0
  239. package/dist/testing/tool-surface-gates.d.ts +72 -0
  240. package/dist/testing/tool-surface-gates.d.ts.map +1 -0
  241. package/dist/testing/tool-surface-parity-drivers.d.ts +56 -0
  242. package/dist/testing/tool-surface-parity-drivers.d.ts.map +1 -0
  243. package/dist/testing/tool-surface-parity.d.ts +28 -0
  244. package/dist/testing/tool-surface-parity.d.ts.map +1 -0
  245. package/dist/testing/tool-surface-ratchet.d.ts +71 -0
  246. package/dist/testing/tool-surface-ratchet.d.ts.map +1 -0
  247. package/dist/tools/agent-tools.d.ts +3 -0
  248. package/dist/tools/agent-tools.d.ts.map +1 -1
  249. package/dist/tools/cli/command.d.ts +3 -0
  250. package/dist/tools/cli/command.d.ts.map +1 -1
  251. package/dist/tools/cli/create-cli.d.ts.map +1 -1
  252. package/dist/tools/cli/distribution-config.d.ts +39 -1
  253. package/dist/tools/cli/distribution-config.d.ts.map +1 -1
  254. package/dist/tools/cli/distribution-routes.d.ts +4 -2
  255. package/dist/tools/cli/distribution-routes.d.ts.map +1 -1
  256. package/dist/tools/cli/format.d.ts +3 -6
  257. package/dist/tools/cli/format.d.ts.map +1 -1
  258. package/dist/tools/cli/invoke.d.ts +4 -0
  259. package/dist/tools/cli/invoke.d.ts.map +1 -1
  260. package/dist/tools/cli/local-key-command.d.ts +53 -0
  261. package/dist/tools/cli/local-key-command.d.ts.map +1 -0
  262. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  263. package/dist/tools/cli/publication-contract.d.ts +9 -2
  264. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  265. package/dist/tools/cli/publication.d.ts.map +1 -1
  266. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  267. package/dist/tools/cli/run-stream.d.ts.map +1 -1
  268. package/dist/tools/cli/runner.d.ts +8 -3
  269. package/dist/tools/cli/runner.d.ts.map +1 -1
  270. package/dist/tools/cli/secret.d.ts +55 -0
  271. package/dist/tools/cli/secret.d.ts.map +1 -0
  272. package/dist/tools/cli/session.d.ts +2 -2
  273. package/dist/tools/cli/session.d.ts.map +1 -1
  274. package/dist/tools/cli/signature.d.ts +23 -9
  275. package/dist/tools/cli/signature.d.ts.map +1 -1
  276. package/dist/tools/cli/stream.d.ts.map +1 -1
  277. package/dist/tools/cli/unix-outcome.d.ts +6 -0
  278. package/dist/tools/cli/unix-outcome.d.ts.map +1 -1
  279. package/dist/tools/cli/update.d.ts +6 -1
  280. package/dist/tools/cli/update.d.ts.map +1 -1
  281. package/dist/tools/execute-result.d.ts +20 -0
  282. package/dist/tools/execute-result.d.ts.map +1 -1
  283. package/dist/tools/execute.d.ts +3 -0
  284. package/dist/tools/execute.d.ts.map +1 -1
  285. package/dist/tools/internal/json-projection.d.ts +13 -9
  286. package/dist/tools/internal/json-projection.d.ts.map +1 -1
  287. package/dist/tools/internal/remote-error.d.ts +15 -0
  288. package/dist/tools/internal/remote-error.d.ts.map +1 -0
  289. package/dist/tools/internal/surface-projector.d.ts +2 -0
  290. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  291. package/dist/tools/invoker.d.ts +3 -0
  292. package/dist/tools/invoker.d.ts.map +1 -1
  293. package/dist/tools/mcp/handler.d.ts.map +1 -1
  294. package/dist/tools/mcp/lazy-discovery.d.ts +2 -0
  295. package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
  296. package/dist/tools/mcp/mount.d.ts +5 -0
  297. package/dist/tools/mcp/mount.d.ts.map +1 -1
  298. package/dist/tools/mcp/register.d.ts +2 -0
  299. package/dist/tools/mcp/register.d.ts.map +1 -1
  300. package/dist/tools/mcp/runtime-tools.d.ts +2 -0
  301. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  302. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  303. package/dist/tools/mount.d.ts +3 -0
  304. package/dist/tools/mount.d.ts.map +1 -1
  305. package/dist/tools/read-operation.d.ts +2 -6
  306. package/dist/tools/read-operation.d.ts.map +1 -1
  307. package/dist/tools/remote.d.ts.map +1 -1
  308. package/dist/tools/runtime-tool.d.ts.map +1 -1
  309. package/dist/tools/toolkit.d.ts +10 -3
  310. package/dist/tools/toolkit.d.ts.map +1 -1
  311. package/dist/xlsx/schema.d.ts.map +1 -1
  312. package/llms/cli-publish.txt +4 -1
  313. package/llms/cli.2.txt +42 -51
  314. package/llms/cli.3.txt +34 -1
  315. package/llms/cli.txt +18 -3
  316. package/llms/contract.txt +47 -5
  317. package/llms/handler.txt +1 -1
  318. package/llms/live.txt +82 -0
  319. package/llms/node.txt +5 -0
  320. package/llms/observability.2.txt +1 -1
  321. package/llms/observability.txt +6 -0
  322. package/llms/postgres.txt +14 -3
  323. package/llms/server.2.txt +206 -240
  324. package/llms/server.3.txt +242 -202
  325. package/llms/server.4.txt +202 -1025
  326. package/llms/server.5.txt +1053 -255
  327. package/llms/server.6.txt +274 -0
  328. package/llms/server.txt +32 -116
  329. package/llms/spend.txt +8 -7
  330. package/llms/stitchkit.2.txt +13 -35
  331. package/llms/stitchkit.3.txt +27 -0
  332. package/llms/stitchkit.txt +82 -82
  333. package/llms/testing.txt +40 -0
  334. package/llms/tools-toolkit.txt +2 -2
  335. package/llms/tools.2.txt +29 -20
  336. package/llms/{upgrading-0.128.0-0.129.0.txt → upgrading-0.128.0-0.131.0.txt} +101 -3
  337. package/llms/{upgrading-0.130.0-0.136.0.txt → upgrading-0.132.0-0.137.0.txt} +62 -101
  338. package/llms/upgrading.txt +2 -2
  339. package/llms-full.txt +641 -189
  340. package/llms.txt +14 -14
  341. package/package.json +3 -3
  342. package/dist/index-9118dw8d.js +0 -603
  343. package/dist/index-9vj869rx.js +0 -19
  344. package/dist/index-a1rjr381.js +0 -114
  345. package/dist/index-dacxr7nf.js +0 -17
  346. package/dist/index-dm50x3by.js +0 -63
  347. package/dist/index-dmrx8xma.js +0 -163
  348. package/dist/index-ednf2cxs.js +0 -37
  349. package/dist/{index-e4zt2x70.js → index-3czppvrr.js} +3 -3
  350. package/dist/{index-42n9jycn.js → index-3f79t32b.js} +3 -3
  351. package/dist/{index-mfe9a266.js → index-84n49vam.js} +0 -0
  352. package/dist/{index-f16b7rze.js → index-er1tp8de.js} +3 -3
  353. package/dist/{index-k137ezb6.js → index-f5d0fdcf.js} +3 -3
  354. package/dist/{index-65p8v81y.js → index-psz8qrz0.js} +3 -3
  355. package/dist/{index-kadgaw1s.js → index-r8cq86h1.js} +0 -0
  356. package/dist/{index-1yky29qg.js → index-tyyvbarf.js} +0 -0
  357. package/dist/{index-tjakdpf2.js → index-wq71v08n.js} +3 -3
  358. package/dist/{index-7an2fs5h.js → index-wswcpbm4.js} +3 -3
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Run an interactive database transaction that may intentionally roll back
3
+ * while still returning a typed payload — for dry runs, batch validation, or
4
+ * stop-on-first-failure workflows.
5
+ *
6
+ * Returning `rollback(value)` keeps the planned rollback out of user
7
+ * `try / catch` blocks inside `work`: the private `PlannedRollbackSignal` is
8
+ * only thrown after `work` returns, forcing the client's `$transaction` to roll
9
+ * back and catching strictly that invocation's signal on the outside. Real
10
+ * database errors, nested rollbacks, and rollback failures always propagate
11
+ * untouched with their original identity and `cause`.
12
+ *
13
+ * Structural and peer-free — works with Prisma's overloaded `$transaction` and
14
+ * any compatible interactive transaction client without importing Prisma or `pg`.
15
+ */
16
+ /**
17
+ * Structural client exposing an interactive `$transaction(fn, options?)` method.
18
+ * Compatible with Prisma's overloaded `$transaction` without importing Prisma.
19
+ */
20
+ export interface InteractiveTransactionClient<TTx, TOptions = never> {
21
+ $transaction<T>(fn: (tx: TTx) => Promise<T>, options?: TOptions): Promise<T>;
22
+ }
23
+ /**
24
+ * Branded token returned by `rollback(value)` inside `runRollbackTransaction`.
25
+ * Return this token from the transaction callback to trigger a planned rollback.
26
+ */
27
+ export interface PlannedRollback<T> {
28
+ readonly __stitchkitPlannedRollback: true;
29
+ readonly value: T;
30
+ }
31
+ /**
32
+ * Callback argument passed to `runRollbackTransaction`'s `work` function.
33
+ * Call `return rollback(value)` to roll back the transaction and resolve with
34
+ * `{ committed: false, value }`.
35
+ */
36
+ export type TransactionRollback = <T>(value: T) => PlannedRollback<T>;
37
+ type CommittedValue<TResult> = Exclude<TResult, PlannedRollback<unknown>>;
38
+ type RolledBackValue<TResult> = TResult extends PlannedRollback<infer TValue> ? TValue : never;
39
+ /** Discriminated result of {@link runRollbackTransaction}. */
40
+ export type RollbackTransactionResult<TCommitted, TRolledBack> = ([TCommitted] extends [never] ? never : {
41
+ readonly committed: true;
42
+ readonly value: TCommitted;
43
+ }) | ([TRolledBack] extends [never] ? never : {
44
+ readonly committed: false;
45
+ readonly value: TRolledBack;
46
+ });
47
+ /**
48
+ * Execute `work` inside `client.$transaction(...)` with a typed planned-rollback
49
+ * escape hatch.
50
+ *
51
+ * - Normal return `value` → commits and resolves `{ committed: true, value }`.
52
+ * - `return rollback(value)` → rolls back the transaction and resolves
53
+ * `{ committed: false, value }`.
54
+ * - Calling `rollback(value)` without returning its token throws a `TypeError`
55
+ * after `work` returns, rolling back the transaction instead of committing.
56
+ * - Any real error thrown inside `work` or by the rollback itself propagates as
57
+ * the exact same object with its `cause` intact.
58
+ */
59
+ export declare function runRollbackTransaction<TTx, TOptions = never, TResult = unknown>(client: InteractiveTransactionClient<TTx, TOptions>, work: (tx: TTx, rollback: TransactionRollback) => Promise<TResult>, options?: NoInfer<TOptions>): Promise<RollbackTransactionResult<CommittedValue<TResult>, RolledBackValue<TResult>>>;
60
+ export {};
61
+ //# sourceMappingURL=rollback-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollback-transaction.d.ts","sourceRoot":"","sources":["../../src/postgres/rollback-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH,MAAM,WAAW,4BAA4B,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK;IACjE,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9E;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,QAAQ,CAAC,0BAA0B,EAAE,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC;AAEtE,KAAK,cAAc,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1E,KAAK,eAAe,CAAC,OAAO,IAAI,OAAO,SAAS,eAAe,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/F,8DAA8D;AAC9D,MAAM,MAAM,yBAAyB,CAAC,UAAU,EAAE,WAAW,IACzD,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,GACzB,KAAK,GACL;IAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC,GAC7D,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,GAC1B,KAAK,GACL;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAgBpE;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,GAAG,OAAO,EAC7E,MAAM,EAAE,4BAA4B,CAAC,GAAG,EAAE,QAAQ,CAAC,EACnD,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,EAClE,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAC1B,OAAO,CAAC,yBAAyB,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC"}
@@ -17,14 +17,14 @@ export declare function defineDeadlinePolicy<const TOnTrack extends string, cons
17
17
  };
18
18
  }): Readonly<{
19
19
  definition: {
20
- readonly boundary: 'elapsed-day' | 'calendar-day';
21
- readonly timeZone: string;
22
- readonly warningDays: number;
23
- readonly categories: {
20
+ boundary: 'elapsed-day' | 'calendar-day';
21
+ warningDays: number;
22
+ categories: {
24
23
  readonly onTrack: TOnTrack;
25
24
  readonly warning: TWarning;
26
25
  readonly overdue: TOverdue;
27
26
  };
27
+ timeZone: string;
28
28
  };
29
29
  evaluate(input: {
30
30
  readonly anchorAt: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../src/primitives/deadline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB;;;;;iBAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AA8ElE,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,QAAQ,SAAS,MAAM,EAC7B,KAAK,CAAC,QAAQ,SAAS,MAAM,EAC7B,K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;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC5B,CAAC;CACH;;kBARoB,aAAa,GAAG,cAAc;qBAE3B,MAAM;oBACP;YACnB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;YAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;YAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;SAC5B;;;oBAgBiB;QACd,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;KACpB,GAAG,cAAc;uBAuBC,IAAI;;;;GAO1B"}
@@ -37,9 +37,10 @@
37
37
  * createServer({ services, hooks: { onError } });
38
38
  * ```
39
39
  */
40
- import { type StitchErrorCode } from '../contract/errors.js';
40
+ import { type ErrorCodeMapping } from '../contract/error-mapping.js';
41
41
  import type { RuntimeContext } from '../contract/runtime-context.js';
42
42
  import type { LifecycleHooks, MethodDef } from './types.js';
43
+ export type { ErrorCodeMapping };
43
44
  /** The normalised error handed to `render` — code already remapped. */
44
45
  export interface ResolvedError {
45
46
  /** Wire code — the app code from `codeMap` for a stitch error, else the thrown code. */
@@ -60,38 +61,8 @@ export interface ErrorHookBase {
60
61
  /** Observe the raw thrown value before rendering. */
61
62
  onError?: (error: unknown, info: ResolvedError, ctx: RuntimeContext, endpoint?: MethodDef) => unknown | Promise<unknown>;
62
63
  }
63
- /** Mapping strategy translating framework error codes to public wire error codes. */
64
- export type ErrorHookMapping<TWireCode extends string> = {
65
- /** A vocabulary returned by `defineErrors`; its generated map is canonical. */
66
- vocabulary: {
67
- readonly codeMap: Partial<Record<StitchErrorCode, TWireCode>>;
68
- };
69
- codeMap?: never;
70
- unmappedCode?: never;
71
- } | {
72
- vocabulary?: never;
73
- /**
74
- * Remap stitchkit's own error codes to your public wire codes.
75
- *
76
- * **Partial on purpose.** It once said "Exhaustive — `satisfies
77
- * Record<StitchErrorCode, …>` makes a new framework code a compile error
78
- * here", which stopped being true in 0.56.1 and kept shipping in the `.d.ts`
79
- * for a consumer to read on hover. The set grows in ordinary releases, so an
80
- * exhaustive map would break every consumer on an additive one; a code you
81
- * leave out falls through to `unmappedCode`. → ADR 0105
82
- *
83
- * Codes you threw yourself (not stitchkit's) pass through as-is.
84
- */
85
- codeMap?: Partial<Record<StitchErrorCode, TWireCode>>;
86
- /**
87
- * Wire code for every unmapped stitchkit code, or a resolver for grouping
88
- * them. Explicit `codeMap` entries win. Project-owned codes never use this
89
- * fallback and continue to pass through unchanged.
90
- */
91
- unmappedCode?: TWireCode | ((code: StitchErrorCode) => TWireCode);
92
- };
93
64
  /** Configuration options for `createErrorHook`. */
94
- export type ErrorHookConfig<TWireCode extends string = string> = ErrorHookBase & ErrorHookMapping<TWireCode>;
65
+ export type ErrorHookConfig<TWireCode extends string = string> = ErrorHookBase & ErrorCodeMapping<TWireCode>;
95
66
  /** Build an `onError` hook from a code map + envelope renderer. */
96
67
  export declare function createErrorHook<TWireCode extends string = string>(config: ErrorHookConfig<TWireCode>): NonNullable<LifecycleHooks['onError']>;
97
68
  //# sourceMappingURL=error-hook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-hook.d.ts","sourceRoot":"","sources":["../../src/server/error-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO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AAC;IAChC,qDAAqD;IACrD,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,aAAa,EACnB,GAAG,EAAE,cAAc,EACnB,QAAQ,CAAC,EAAE,SAAS,KACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,mDAAmD;AACnD,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,aAAa,GAC5E,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAE9B,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,EAC/D,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,GACjC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAyBxC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Host-side primitive for issuing a scoped local program key over a Unix
3
+ * control socket strictly after explicit human approval in a native dialog
4
+ * outside the web page. → ADR 0346.
5
+ *
6
+ * Security invariants:
7
+ * - Fail-closed session & role checks before touching `consent`:
8
+ * `callerCanManageKeys === true` (else `403 KEYS_MANAGE_REQUIRED`),
9
+ * `allowsKeyManagement === false` (else `403 ROLE_NOT_ALLOWED`).
10
+ * - Single-pending-prompt lock acquired synchronously after validation and
11
+ * authorization so malformed requests cannot DoS the lock while concurrent
12
+ * valid requests (and other guarded control routes) receive `409 CONSENT_PENDING`.
13
+ * - Bounded by `withSignalDeadline(consentTimeoutMs, request.signal)` +
14
+ * `raceAbort` so a slow or non-cooperative consent implementation cannot hang
15
+ * or issue an orphaned key after timeout (`408 INIT_TIMEOUT`, `retryable: false`)
16
+ * or client disconnect (`499 REQUEST_ABORTED`).
17
+ * - Successful responses set `Cache-Control: no-store` and return the issued
18
+ * key once.
19
+ */
20
+ import { z } from 'zod';
21
+ import { type ReportedClient, type ReportedClientOptions } from './local-control-reporter.js';
22
+ import type { RawRoute } from './types.js';
23
+ /** Default request body schema for {@link createLocalConsentKeyIssuance}. */
24
+ export declare const LocalConsentKeyRequestSchema: z.ZodObject<{
25
+ role: z.ZodString;
26
+ scope: z.ZodOptional<z.ZodString>;
27
+ name: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strict>;
29
+ /** Default parsed request type for {@link createLocalConsentKeyIssuance}. */
30
+ export type LocalConsentKeyRequest = z.infer<typeof LocalConsentKeyRequestSchema>;
31
+ /** Human decision returned by the native consent prompt port. */
32
+ export type LocalConsentDecision = 'approve' | 'deny' | 'timeout';
33
+ /** Fail-closed authorization verdict supplied by the host application. */
34
+ export interface LocalConsentAuthorization<TAuth = unknown> {
35
+ /** Must be strictly `true` — otherwise refused with `403 KEYS_MANAGE_REQUIRED`. */
36
+ readonly callerCanManageKeys: boolean;
37
+ /** Must be strictly `false` — roles able to manage keys are always refused (`403 ROLE_NOT_ALLOWED`). */
38
+ readonly allowsKeyManagement: boolean;
39
+ /** Human-readable summary presented in the native consent prompt. */
40
+ readonly summary: string;
41
+ /** Optional application-owned authorization details forwarded to `issueKey`. */
42
+ readonly authorized?: TAuth;
43
+ }
44
+ /** Prompt payload handed to the host's native consent port. */
45
+ export interface LocalConsentQuestion<TRequest> {
46
+ readonly request: TRequest;
47
+ readonly client: ReportedClient;
48
+ readonly summary: string;
49
+ }
50
+ /** Configuration for {@link createLocalConsentKeyIssuance}. */
51
+ export interface LocalConsentKeyConfig<TRequest = LocalConsentKeyRequest, TAuth = unknown, TIssued = unknown> {
52
+ /** Raw route path mounted on the Unix listener. Default `'/v1/init-key'`. */
53
+ readonly path?: string;
54
+ /** Optional custom Zod schema overriding {@link LocalConsentKeyRequestSchema}. */
55
+ readonly requestSchema?: z.ZodType<TRequest>;
56
+ /** Maximum JSON request body size in bytes. Default `16384` (16 KiB). */
57
+ readonly maxBodyBytes?: number;
58
+ /** Maximum milliseconds to wait for human consent before `408 INIT_TIMEOUT`. Default `60000`. */
59
+ readonly consentTimeoutMs?: number;
60
+ /** Self-reported client attribution header options. */
61
+ readonly reporter?: ReportedClientOptions;
62
+ /**
63
+ * Verify the current desktop session can manage keys and that the requested
64
+ * role cannot escalate to key management. Runs before `consent`.
65
+ */
66
+ readonly authorizeRequest: (input: {
67
+ readonly request: TRequest;
68
+ readonly client: ReportedClient;
69
+ readonly rawRequest: Request;
70
+ }) => LocalConsentAuthorization<TAuth> | Promise<LocalConsentAuthorization<TAuth>>;
71
+ /** Show the native out-of-page consent prompt and return the human decision. */
72
+ readonly consent: (question: LocalConsentQuestion<TRequest>, options: {
73
+ readonly signal: AbortSignal;
74
+ }) => LocalConsentDecision | Promise<LocalConsentDecision>;
75
+ /** Issue the scoped credential once after explicit approval. */
76
+ readonly issueKey: (input: {
77
+ readonly request: TRequest;
78
+ readonly authorization: LocalConsentAuthorization<TAuth>;
79
+ readonly client: ReportedClient;
80
+ }) => TIssued | Promise<TIssued>;
81
+ }
82
+ /** Local consent-gated key issuance route and shared pending-prompt guard. */
83
+ export interface LocalConsentKeyIssuance {
84
+ /** `POST` raw route to mount on `createServer({ unix, rawRoutes: [issuance.route, ...] })`. */
85
+ readonly route: RawRoute;
86
+ /** Whether a native consent prompt is currently awaiting human response. */
87
+ isConsentPending(): boolean;
88
+ /**
89
+ * Wrap another fetch handler so other local control routes fail closed with
90
+ * `409 CONSENT_PENDING` while a native consent prompt is open.
91
+ */
92
+ guardWhileConsentPending<TServer = unknown>(next: (request: Request, server: TServer) => Response | Promise<Response>): (request: Request, server: TServer) => Promise<Response>;
93
+ }
94
+ /**
95
+ * Create the local Unix-socket raw route and pending-consent guard for issuing
96
+ * a scoped program key strictly after native human approval.
97
+ */
98
+ export declare function createLocalConsentKeyIssuance<TAuth = unknown, TIssued = unknown>(config: Omit<LocalConsentKeyConfig<LocalConsentKeyRequest, TAuth, TIssued>, 'requestSchema'> & {
99
+ readonly requestSchema?: undefined;
100
+ }): LocalConsentKeyIssuance;
101
+ export declare function createLocalConsentKeyIssuance<TRequest, TAuth = unknown, TIssued = unknown>(config: LocalConsentKeyConfig<TRequest, TAuth, TIssued> & {
102
+ readonly requestSchema: z.ZodType<TRequest>;
103
+ }): LocalConsentKeyIssuance;
104
+ //# sourceMappingURL=local-consent-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-consent-key.d.ts","sourceRoot":"","sources":["../../src/server/local-consent-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMxC,6EAA6E;AAC7E,eAAO,MAAM,4BAA4B;;;;kBAIvC,CAAC;AAEH,6EAA6E;AAC7E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,iEAAiE;AACjE,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAElE,0EAA0E;AAC1E,MAAM,WAAW,yBAAyB,CAAC,KAAK,GAAG,OAAO;IACxD,mFAAmF;IACnF,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,wGAAwG;IACxG,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;CAC7B;AAED,+DAA+D;AAC/D,MAAM,WAAW,oBAAoB,CAAC,QAAQ;IAC5C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,+DAA+D;AAC/D,MAAM,WAAW,qBAAqB,CACpC,QAAQ,GAAG,sBA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uBAAuB;IACtC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,4EAA4E;IAC5E,gBAAgB,IAAI,OAAO,CAAC;IAC5B;;;OAGG;IACH,wBAAwB,CAAC,OAAO,GAAG,OAAO,EACxC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GACxE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC7D;AAiED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAC9E,MAAM,EAAE,IAAI,CACV,qBAAqB,CAAC,sBAAsB,EAAE,KAAK,EAAE,OAAO,CAAC,EAC7D,eAAe,CAChB,GAAG;IACF,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;CACpC,GACA,uBAAuB,CAAC;AAC3B,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACxF,MAAM,EAAE,qBAAqB,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG;IACxD,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC7C,GACA,uBAAuB,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ /** Zod schema for one local-control call-journal line. */
3
+ export declare const LocalControlJournalEntrySchema: z.ZodObject<{
4
+ at: z.ZodString;
5
+ method: z.ZodString;
6
+ path: z.ZodString;
7
+ status: z.ZodInt;
8
+ durationMs: z.ZodNumber;
9
+ errorCode: z.ZodOptional<z.ZodString>;
10
+ client: z.ZodObject<{
11
+ verified: z.ZodLiteral<false>;
12
+ client: z.ZodOptional<z.ZodString>;
13
+ harness: z.ZodOptional<z.ZodString>;
14
+ model: z.ZodOptional<z.ZodString>;
15
+ session: z.ZodOptional<z.ZodString>;
16
+ machine: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strict>;
18
+ }, z.core.$strict>;
19
+ /** One validated record written to a {@link LocalControlJournal}. */
20
+ export type LocalControlJournalEntry = z.infer<typeof LocalControlJournalEntrySchema>;
21
+ /** Options for {@link createLocalControlJournal}. */
22
+ export interface LocalControlJournalConfig {
23
+ /** Absolute or relative path of the JSONL journal file (`0600`). */
24
+ readonly path: string;
25
+ /** Maximum file size in bytes before rotating to `<path>.1`. Default 1 MiB. */
26
+ readonly maxFileBytes?: number;
27
+ /**
28
+ * Maximum number of pending writes (including the currently executing disk
29
+ * write) queued in memory before excess entries are dropped and reported to
30
+ * `onError`. Default `256`.
31
+ */
32
+ readonly maxPendingWrites?: number;
33
+ /** Optional observer invoked if writing, rotating, or queueing the journal fails. */
34
+ readonly onError?: (error: unknown) => void;
35
+ }
36
+ /** Serialized append-only JSONL journal for local control listeners. */
37
+ export interface LocalControlJournal {
38
+ readonly path: string;
39
+ /** Append one validated metadata entry, rotating to `<path>.1` when needed. */
40
+ append(entry: LocalControlJournalEntry): Promise<void>;
41
+ /** Wait for all queued appends and rotations to finish writing to disk. */
42
+ flush(): Promise<void>;
43
+ }
44
+ /**
45
+ * Create an append-only `0600` JSONL call journal with serialized writes and
46
+ * single-generation rotation (`<path>.1`). Survives restrictive process `umask`
47
+ * via explicit `fchmod(0o600)` on the opened descriptor and refuses symlinks or
48
+ * non-regular files at both `<path>` and `<path>.1`.
49
+ */
50
+ export declare function createLocalControlJournal(config: LocalControlJournalConfig): LocalControlJournal;
51
+ //# sourceMappingURL=local-control-journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-control-journal.d.ts","sourceRoot":"","sources":["../../src/server/local-control-journal.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,0DAA0D;AAC1D,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;kBAQzC,CAAC;AAEH,qEAAqE;AACrE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,qDAAqD;AACrD,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,qFAAqF;IACrF,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAED,wEAAwE;AACxE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,MAAM,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,2EAA2E;IAC3E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AA4CD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,GAChC,mBAAmB,CAqGrB"}
@@ -0,0 +1,32 @@
1
+ /** Attribution fields extracted from local-control request headers. */
2
+ export type ReportedClientField = 'client' | 'harness' | 'model' | 'session' | 'machine';
3
+ /**
4
+ * Self-reported client metadata extracted from request headers.
5
+ * Always carries `verified: false` — headers are caller-supplied and spoofable
6
+ * by any process running as the same OS user.
7
+ */
8
+ export interface ReportedClient {
9
+ readonly verified: false;
10
+ readonly client?: string;
11
+ readonly harness?: string;
12
+ readonly model?: string;
13
+ readonly session?: string;
14
+ readonly machine?: string;
15
+ }
16
+ /** Header-naming and sanitization options for {@link extractReportedClient}. */
17
+ export interface ReportedClientOptions {
18
+ /** Header prefix for `<prefix><field>` lookup (case-insensitive). Default `'x-client-'`. */
19
+ readonly headerPrefix?: string;
20
+ /** Explicit per-field header names overriding `headerPrefix`. */
21
+ readonly headers?: Partial<Record<ReportedClientField, string>>;
22
+ /** Maximum Unicode code points kept per field after stripping control chars. Default `128`. */
23
+ readonly maxFieldLength?: number;
24
+ }
25
+ /**
26
+ * Extract sanitized self-reported client attribution from `request` headers.
27
+ * Strips all C0/DEL control characters (`\r`, `\n`, `\t`, NUL, etc.), trims
28
+ * whitespace, truncates each field to `maxFieldLength`, and always marks
29
+ * `verified: false`.
30
+ */
31
+ export declare function extractReportedClient(request: Request, options?: ReportedClientOptions): ReportedClient;
32
+ //# sourceMappingURL=local-control-reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-control-reporter.d.ts","sourceRoot":"","sources":["../../src/server/local-control-reporter.ts"],"names":[],"mappings":"AAaA,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAUzF;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACpC,4FAA4F;IAC5F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,+FAA+F;IAC/F,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAaD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,qBAA0B,GAClC,cAAc,CA8BhB"}
@@ -0,0 +1,48 @@
1
+ import type { LocalControlJournal } from './local-control-journal.js';
2
+ import { type ReportedClientOptions } from './local-control-reporter.js';
3
+ /** Configuration for {@link createLocalControlGuard}. */
4
+ export interface LocalControlGuardConfig {
5
+ /**
6
+ * Maximum estimated UTF-8 bytes of the request line plus headers before
7
+ * refusing with `431 HEADERS_TOO_LARGE`. Default `8192` (8 KiB).
8
+ *
9
+ * Note: Bun's native HTTP parser enforces its own ceiling (~16 KiB) before
10
+ * `fetch` runs; values above that ceiling cannot raise Bun's native limit.
11
+ */
12
+ readonly maxHeaderBytes?: number;
13
+ /**
14
+ * Maximum declared `Content-Length` bytes before refusing with
15
+ * `413 REQUEST_TOO_LARGE`. Requests with `Transfer-Encoding` or a non-null
16
+ * body without `Content-Length` are refused with `400 BAD_REQUEST`, while
17
+ * body-less requests (`req.body === null` and no `Content-Length`, including
18
+ * body-less `POST` from `createUnixClientTransport`) are accepted as 0 bytes.
19
+ * Default `2 MiB`.
20
+ */
21
+ readonly maxBodyBytes?: number;
22
+ /**
23
+ * Maximum concurrent in-flight requests (including open `text/event-stream`
24
+ * and `application/x-ndjson` streams) before refusing with
25
+ * `503 CONTROL_API_BUSY`. Default `16`.
26
+ */
27
+ readonly maxConcurrentRequests?: number;
28
+ /** Header prefix / field mapping for self-reported client attribution. */
29
+ readonly reporter?: ReportedClientOptions;
30
+ /** Optional `0600` JSONL call journal recording metadata only (no bodies or `Authorization`). */
31
+ readonly journal?: LocalControlJournal;
32
+ /** Injectable monotonic clock in ms for tests. Default `Date.now`. */
33
+ readonly now?: () => number;
34
+ }
35
+ /** Local control-socket wrapper returned by {@link createLocalControlGuard}. */
36
+ export interface LocalControlGuard {
37
+ /** Wrap `createServer`'s fetch handler without replacing or cloning the `Request`. */
38
+ wrapFetch<TServer = unknown>(next: (request: Request, server: TServer) => Response | Promise<Response>): (request: Request, server: TServer) => Promise<Response>;
39
+ /** Current number of active requests (including open streaming responses). */
40
+ activeRequests(): number;
41
+ }
42
+ /**
43
+ * Create a local control-socket fetch guard enforcing header size, explicit
44
+ * body-length limits, bounded request/stream concurrency, and optional
45
+ * metadata-only call-journal logging.
46
+ */
47
+ export declare function createLocalControlGuard(config?: LocalControlGuardConfig): LocalControlGuard;
48
+ //# sourceMappingURL=local-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-control.d.ts","sourceRoot":"","sources":["../../src/server/local-control.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAQ7F,yDAAyD;AACzD,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IAC1C,iGAAiG;IACjG,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,sFAAsF;IACtF,SAAS,CAAC,OAAO,GAAG,OAAO,EACzB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GACxE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5D,8EAA8E;IAC9E,cAAc,IAAI,MAAM,CAAC;CAC1B;AAyJD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,GAAE,uBAA4B,GACnC,iBAAiB,CAsGnB"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Per-client identity, targeted delivery, and departure lifecycle for a
3
+ * multi-window local desktop host built on `createLocalHostGuard`,
4
+ * `createSocketIOServer`, and `bindRealtimeServer` (→ ADR 0008, ADR 0079, ADR 0303).
5
+ *
6
+ * Strictly peer-free (zero runtime imports of `socket.io`) and runtime-neutral
7
+ * across Bun (`stitchkit/server`) and Node (`stitchkit/node`).
8
+ */
9
+ import { z } from 'zod';
10
+ import type { StitchLogger } from '../internal/logger.js';
11
+ import type { RealtimeEmitArguments, RealtimeEventArguments, RealtimeEventRegistry } from '../realtime/contract.js';
12
+ import type { LocalHostGuard } from './local-host.js';
13
+ import type { RealtimeServer } from './realtime.js';
14
+ import type { SocketIOHandshakeConfig } from './socket-io-config.js';
15
+ /** Default HTTP header carrying a connected window's Socket.IO client id for `callerFromRequest`. */
16
+ export declare const DEFAULT_LOCAL_HOST_CLIENT_ID_HEADER = "x-stitchkit-client";
17
+ /** Immutable identity of one connected local-host client window. */
18
+ export interface HostClient<TLabel> {
19
+ readonly client: string;
20
+ readonly label: TLabel;
21
+ }
22
+ /** Socket handshake identity stored in `socket.data` by `LocalHostClientsSetup.handshake`. */
23
+ export interface LocalHostClientData<TLabel> {
24
+ readonly localHost?: true;
25
+ readonly label: TLabel;
26
+ }
27
+ /** Configuration for {@link createLocalHostClients}. */
28
+ export interface LocalHostClientsConfig<TLabel> {
29
+ /** Zod schema validating the client's self-identifying `label` in the Socket.IO handshake. */
30
+ readonly labelSchema: z.ZodType<TLabel>;
31
+ /**
32
+ * Optional `createLocalHostGuard` whose constant-time secret check and CORS
33
+ * origin allow-list are composed into `handshake`, `cors`, and `callerFromRequest`.
34
+ */
35
+ readonly guard?: LocalHostGuard;
36
+ /**
37
+ * HTTP header name carrying a connected client's `client` id (read from
38
+ * `realtimeClient.id`). Default `'x-stitchkit-client'`.
39
+ */
40
+ readonly clientIdHeader?: string;
41
+ /** Maximum concurrently tracked clients before new connections are closed. Default `64`. */
42
+ readonly maxClients?: number;
43
+ /** Invoked when a validated client connects and joins the live registry. */
44
+ readonly onClientConnected?: (caller: HostClient<TLabel>) => void | Promise<void>;
45
+ /** Invoked when any single connected client disconnects (after removal from the registry). */
46
+ readonly onClientGone?: (caller: HostClient<TLabel>) => void | Promise<void>;
47
+ /** Invoked strictly when the last connected client disconnects (`1 → 0`), after `onClientGone`. */
48
+ readonly onLastClientGone?: (lastCaller: HostClient<TLabel>) => void | Promise<void>;
49
+ /** Optional structured logger for isolated hook/handler failures and rejected connections. */
50
+ readonly logger?: StitchLogger;
51
+ }
52
+ /** Attached per-client registry, event router, and targeted sender bound to one `RealtimeServer`. */
53
+ export interface LocalHostClients<TServerToClient extends RealtimeEventRegistry, TClientToServer extends RealtimeEventRegistry, TLabel> {
54
+ /**
55
+ * Register a handler for a `clientToServer` event across every current and
56
+ * future connected client. `caller` is passed first so variadic event
57
+ * arguments and any trailing `ack` callback stay cleanly typed without casts.
58
+ */
59
+ on<TEvent extends keyof TClientToServer & string>(event: TEvent, handler: (caller: HostClient<TLabel>, ...args: RealtimeEventArguments<TClientToServer[TEvent]>) => void | Promise<void>): () => void;
60
+ /**
61
+ * Emit a `serverToClient` event directly to one connected client's own
62
+ * socket. Returns `false` without emitting when `client` is unknown or gone.
63
+ */
64
+ sendTo<TEvent extends keyof TServerToClient & string>(client: string, event: TEvent, ...args: RealtimeEmitArguments<TServerToClient[TEvent]>): boolean;
65
+ /** Snapshot of every currently connected client. */
66
+ clients(): readonly HostClient<TLabel>[];
67
+ /** Look up one currently connected client by id. */
68
+ get(client: string): HostClient<TLabel> | undefined;
69
+ /**
70
+ * Resolve a connected client from an HTTP request carrying `clientIdHeader`.
71
+ * Fail-closed: when `guard` is configured, requests failing `guard.check()`
72
+ * return `undefined`; unknown or disconnected ids always return `undefined`.
73
+ *
74
+ * Trust boundary: identifies a window among callers that already hold the
75
+ * shared local-host secret; not cryptographically bound to the TCP stream.
76
+ */
77
+ callerFromRequest(request: Request): HostClient<TLabel> | undefined;
78
+ /**
79
+ * Detach from the realtime server and remove all per-socket listeners
80
+ * without firing `onClientGone` or `onLastClientGone`. Idempotent.
81
+ */
82
+ detach(): void;
83
+ }
84
+ /** Stateless setup returned by {@link createLocalHostClients} before binding a `RealtimeServer`. */
85
+ export interface LocalHostClientsSetup<TLabel> {
86
+ /** Socket.IO `handshake` gate validating `labelSchema` (and `guard.handshake` when provided). */
87
+ readonly handshake: SocketIOHandshakeConfig<unknown, LocalHostClientData<TLabel>>;
88
+ /**
89
+ * CORS config extending `guard.cors` with `clientIdHeader` alongside
90
+ * `DEFAULT_CORS_ALLOW_HEADERS`, or `undefined` when `guard?.cors` is absent.
91
+ */
92
+ readonly cors: {
93
+ origin: string[];
94
+ credentials: false;
95
+ headers: string;
96
+ } | undefined;
97
+ /** Bind this client registry to one `RealtimeServer`. Refuses a second active `attach()` without `detach()`. */
98
+ attach<TServerToClient extends RealtimeEventRegistry, TClientToServer extends RealtimeEventRegistry>(realtime: RealtimeServer<TServerToClient, TClientToServer, LocalHostClientData<TLabel>>): LocalHostClients<TServerToClient, TClientToServer, TLabel>;
99
+ }
100
+ /**
101
+ * Create per-client handshake validation, CORS header extension, and a live
102
+ * client registry for a multi-window local desktop host (ADR 0303).
103
+ */
104
+ export declare function createLocalHostClients<TLabel>(config: LocalHostClientsConfig<TLabel>): LocalHostClientsSetup<TLabel>;
105
+ //# sourceMappingURL=local-host-clients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-host-clients.d.ts","sourceRoot":"","sources":["../../src/server/local-host-clients.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM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M,WAAW,qBAAqB,CAAC,MAAM;IAC3C,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACrF,gHAAgH;IAChH,MAAM,CACJ,eAAe,SAAS,qBAAqB,EAC7C,eAAe,SAAS,qBAAqB,EAE7C,QAAQ,EAAE,cAAc,CAAC,eAAe,EAAE,eAAe,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,GACtF,gBAAgB,CAAC,eAAe,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;CAC/D;AAyTD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAC3C,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,GACrC,qBAAqB,CAAC,MAAM,CAAC,CA8B/B"}
@@ -105,6 +105,26 @@ export interface TrustFenceConfig {
105
105
  * check.
106
106
  */
107
107
  readonly trustedOrigins?: readonly string[];
108
+ /**
109
+ * Optional predicate marking safe public read routes that may be requested
110
+ * cross-site on the HTTP lane without triggering `cross-site` or
111
+ * `origin-mismatch` refusals.
112
+ *
113
+ * Applied strictly **after** `trustedHosts` (`missing-host` /
114
+ * `untrusted-host` are never bypassed), **only** on `lane === 'http'`,
115
+ * **only** for exact `'GET'` or `'HEAD'` requests with no `Upgrade` header,
116
+ * and **only** when the request would otherwise be refused for `cross-site`
117
+ * or `origin-mismatch`. The Socket.IO lane (`allowRequest` / `'socket'`),
118
+ * WebSocket upgrades, `OPTIONS`, and every state-changing method never call
119
+ * or honour this predicate.
120
+ *
121
+ * Must be synchronous and return strictly `true` to admit; any thrown error,
122
+ * non-boolean value, or thenable fails closed to the normal 403 refusal and
123
+ * logs an error via `logger.error` (or `console.error`). Note that this only
124
+ * admits safe reads past the trust fence — it does not add CORS headers or
125
+ * exempt `OPTIONS` preflights.
126
+ */
127
+ readonly publicReads?: (request: Request) => boolean;
108
128
  /** Called on every refusal, before the 403 is written. */
109
129
  readonly onRefused?: (refusal: TrustRefusal) => void;
110
130
  /** Refusals are logged at `warn` when a logger is supplied. */
@@ -1 +1 @@
1
- {"version":3,"file":"trust-fence.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/trust-fence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,qCAAqC;AACrC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1C,MAAM,MAAM,kBAAkB;AAC5B,yEAAyE;AACvE,cAAc;AAChB,wEAAwE;GACtE,gBAAgB;AAClB,iEAAiE;GAC/D,iBAAiB;AACnB,4DAA4D;GAC1D,YAAY,CAAC;AAEjB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;;;;;;;;;;;;;;;;;OAmBG;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 @@ export interface SpooledSpendStoreConfig {
12
12
  error: unknown;
13
13
  }) => void;
14
14
  }
15
- /** A ledger whose writes reach disk before the database, with `recover` for what an earlier process left. */
15
+ /** A ledger whose writes reach disk before the database, with `flush` in-process and `recover` across restarts. */
16
16
  export interface SpooledSpendStore extends SpendLedgerStore {
17
17
  /**
18
- * Replay what an earlier process left undelivered, in the order it was written —
19
- * an attempt before its receipts — stopping at the first refusal. Call once at
20
- * startup, before the gateway is used.
18
+ * Redeliver undelivered attempts and receipts in this process, preserving per-attempt
19
+ * order and single-flight concurrency alongside live `begin()` / `settle()` calls.
20
+ */
21
+ flush(): Promise<SpoolRecovery>;
22
+ /**
23
+ * Replay what an earlier process left undelivered on disk, in the order it was written —
24
+ * an attempt before its receipts — stopping a group at its first refusal. Call once at
25
+ * startup, before the gateway is used; use `flush()` for explicit in-process redelivery.
21
26
  */
22
27
  recover(): Promise<SpoolRecovery>;
23
28
  pending(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"receipt-spool.d.ts","sourceRoot":"","sources":["../../src/spend/receipt-spool.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,KAAK,gBAAgB,EAGtB,MAAM,WAAW,CAAC;AAQnB,oEAAoE;AACpE,MAAM,WAAW,uBAAuB;IACtC,6EAA6E;IAC7E,KAAK,EAAE,gBAAgB,CAAC;IACxB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CACtD;AAED,6GAA6G;AAC7G,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAClC,O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