stitchkit 0.93.0 → 0.94.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 (791) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +5 -2
  3. package/dist/agent-runtime/children-control.d.ts +6 -0
  4. package/dist/agent-runtime/children-control.d.ts.map +1 -0
  5. package/dist/agent-runtime/children-spawn.d.ts +6 -0
  6. package/dist/agent-runtime/children-spawn.d.ts.map +1 -0
  7. package/dist/agent-runtime/children-state.d.ts +46 -0
  8. package/dist/agent-runtime/children-state.d.ts.map +1 -0
  9. package/dist/agent-runtime/children-usage.d.ts +8 -0
  10. package/dist/agent-runtime/children-usage.d.ts.map +1 -0
  11. package/dist/agent-runtime/children.d.ts +11 -14
  12. package/dist/agent-runtime/children.d.ts.map +1 -1
  13. package/dist/agent-runtime/coding-tool-contract.d.ts +2 -1
  14. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  15. package/dist/agent-runtime/deferred-tool-types.d.ts +2 -2
  16. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  17. package/dist/agent-runtime/events.d.ts +1 -1
  18. package/dist/agent-runtime/events.d.ts.map +1 -1
  19. package/dist/agent-runtime/managed-tools.d.ts +1 -1
  20. package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
  21. package/dist/agent-runtime/observability.d.ts +1 -1
  22. package/dist/agent-runtime/observability.d.ts.map +1 -1
  23. package/dist/{agent-runtime-openrouter.d.ts → agent-runtime/openrouter.d.ts} +3 -3
  24. package/dist/agent-runtime/openrouter.d.ts.map +1 -0
  25. package/dist/agent-runtime/projections.d.ts +1 -1
  26. package/dist/agent-runtime/projections.d.ts.map +1 -1
  27. package/dist/agent-runtime/run-acquisition.d.ts +17 -0
  28. package/dist/agent-runtime/run-acquisition.d.ts.map +1 -0
  29. package/dist/agent-runtime/run-execution-state.d.ts +133 -0
  30. package/dist/agent-runtime/run-execution-state.d.ts.map +1 -0
  31. package/dist/agent-runtime/run-execution.d.ts +17 -33
  32. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  33. package/dist/agent-runtime/run-failure.d.ts +18 -0
  34. package/dist/agent-runtime/run-failure.d.ts.map +1 -0
  35. package/dist/agent-runtime/run-model-attempts.d.ts +6 -0
  36. package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -0
  37. package/dist/agent-runtime/run-prompt-history.d.ts +58 -0
  38. package/dist/agent-runtime/run-prompt-history.d.ts.map +1 -0
  39. package/dist/agent-runtime/run-provider-ledger.d.ts +26 -0
  40. package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -0
  41. package/dist/agent-runtime/run-stream-parts.d.ts +17 -0
  42. package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -0
  43. package/dist/agent-runtime/run-terminal.d.ts +11 -0
  44. package/dist/agent-runtime/run-terminal.d.ts.map +1 -0
  45. package/dist/agent-runtime/run-turn-preparation.d.ts +22 -0
  46. package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -0
  47. package/dist/agent-runtime/runtime-admission-gate.d.ts +29 -0
  48. package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -0
  49. package/dist/agent-runtime/runtime-control.d.ts +9 -0
  50. package/dist/agent-runtime/runtime-control.d.ts.map +1 -0
  51. package/dist/agent-runtime/runtime-recovery.d.ts +10 -0
  52. package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -0
  53. package/dist/agent-runtime/runtime-state.d.ts +36 -0
  54. package/dist/agent-runtime/runtime-state.d.ts.map +1 -0
  55. package/dist/agent-runtime/runtime-submit.d.ts +5 -0
  56. package/dist/agent-runtime/runtime-submit.d.ts.map +1 -0
  57. package/dist/agent-runtime/runtime.d.ts +9 -4
  58. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  59. package/dist/{agent-runtime-sqlite-bun.d.ts → agent-runtime/sqlite-bun.d.ts} +5 -4
  60. package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -0
  61. package/dist/agent-runtime/sqlite-events.d.ts +5 -0
  62. package/dist/agent-runtime/sqlite-events.d.ts.map +1 -0
  63. package/dist/agent-runtime/sqlite-history.d.ts +7 -0
  64. package/dist/agent-runtime/sqlite-history.d.ts.map +1 -0
  65. package/dist/agent-runtime/sqlite-ledger.d.ts +7 -0
  66. package/dist/agent-runtime/sqlite-ledger.d.ts.map +1 -0
  67. package/dist/{agent-runtime-sqlite-node.d.ts → agent-runtime/sqlite-node.d.ts} +5 -4
  68. package/dist/agent-runtime/sqlite-node.d.ts.map +1 -0
  69. package/dist/agent-runtime/sqlite-reads.d.ts +14 -0
  70. package/dist/agent-runtime/sqlite-reads.d.ts.map +1 -0
  71. package/dist/agent-runtime/sqlite-rows.d.ts +178 -0
  72. package/dist/agent-runtime/sqlite-rows.d.ts.map +1 -0
  73. package/dist/agent-runtime/sqlite-schema.d.ts +7 -0
  74. package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -0
  75. package/dist/agent-runtime/sqlite-transactions.d.ts +25 -0
  76. package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -0
  77. package/dist/agent-runtime/sqlite.d.ts +10 -6
  78. package/dist/agent-runtime/sqlite.d.ts.map +1 -1
  79. package/dist/agent-runtime/store-archive.d.ts +16 -0
  80. package/dist/agent-runtime/store-archive.d.ts.map +1 -0
  81. package/dist/{testing/agent-store-conformance.d.ts → agent-runtime/store-conformance.d.ts} +2 -2
  82. package/dist/agent-runtime/store-conformance.d.ts.map +1 -0
  83. package/dist/agent-runtime/store-create.d.ts +11 -0
  84. package/dist/agent-runtime/store-create.d.ts.map +1 -0
  85. package/dist/agent-runtime/{store-driver.d.ts → store-driver-contract.d.ts} +7 -7
  86. package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -0
  87. package/dist/agent-runtime/store-events.d.ts +7 -89
  88. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  89. package/dist/agent-runtime/store-memory.d.ts +4 -0
  90. package/dist/agent-runtime/store-memory.d.ts.map +1 -0
  91. package/dist/agent-runtime/store-mutate.d.ts +13 -0
  92. package/dist/agent-runtime/store-mutate.d.ts.map +1 -0
  93. package/dist/agent-runtime/store-purge.d.ts +1 -1
  94. package/dist/agent-runtime/store-purge.d.ts.map +1 -1
  95. package/dist/agent-runtime/store-reads.d.ts +29 -0
  96. package/dist/agent-runtime/store-reads.d.ts.map +1 -0
  97. package/dist/agent-runtime/store-reduce-history.d.ts +10 -0
  98. package/dist/agent-runtime/store-reduce-history.d.ts.map +1 -0
  99. package/dist/agent-runtime/store-reduce-run.d.ts +14 -0
  100. package/dist/agent-runtime/store-reduce-run.d.ts.map +1 -0
  101. package/dist/agent-runtime/store-reduce-shared.d.ts +76 -0
  102. package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -0
  103. package/dist/agent-runtime/store-reduce-terminal.d.ts +6 -0
  104. package/dist/agent-runtime/store-reduce-terminal.d.ts.map +1 -0
  105. package/dist/agent-runtime/store-reducer.d.ts +24 -0
  106. package/dist/agent-runtime/store-reducer.d.ts.map +1 -0
  107. package/dist/agent-runtime/store-snapshot.d.ts +19 -0
  108. package/dist/agent-runtime/store-snapshot.d.ts.map +1 -0
  109. package/dist/agent-runtime/store.d.ts +1 -1
  110. package/dist/agent-runtime/store.d.ts.map +1 -1
  111. package/dist/application/admission.d.ts +1 -1
  112. package/dist/application/admission.d.ts.map +1 -1
  113. package/dist/application/events.d.ts +1 -1
  114. package/dist/application/events.d.ts.map +1 -1
  115. package/dist/{server → application}/file-state-store.d.ts +1 -1
  116. package/dist/application/file-state-store.d.ts.map +1 -0
  117. package/dist/application/health.d.ts +1 -1
  118. package/dist/application/health.d.ts.map +1 -1
  119. package/dist/application/kernel-admission.d.ts +8 -0
  120. package/dist/application/kernel-admission.d.ts.map +1 -0
  121. package/dist/application/kernel-contract.d.ts +142 -0
  122. package/dist/application/kernel-contract.d.ts.map +1 -0
  123. package/dist/application/kernel-resource-context.d.ts +24 -0
  124. package/dist/application/kernel-resource-context.d.ts.map +1 -0
  125. package/dist/application/kernel-restart.d.ts +5 -0
  126. package/dist/application/kernel-restart.d.ts.map +1 -0
  127. package/dist/application/kernel-rollback.d.ts +4 -0
  128. package/dist/application/kernel-rollback.d.ts.map +1 -0
  129. package/dist/application/kernel-shutdown.d.ts +6 -0
  130. package/dist/application/kernel-shutdown.d.ts.map +1 -0
  131. package/dist/application/kernel-start.d.ts +20 -0
  132. package/dist/application/kernel-start.d.ts.map +1 -0
  133. package/dist/application/kernel-state.d.ts +116 -0
  134. package/dist/application/kernel-state.d.ts.map +1 -0
  135. package/dist/application/kernel.d.ts +9 -140
  136. package/dist/application/kernel.d.ts.map +1 -1
  137. package/dist/application/latest-sink.d.ts +1 -1
  138. package/dist/application/latest-sink.d.ts.map +1 -1
  139. package/dist/application/opentelemetry.d.ts +1 -1
  140. package/dist/application/opentelemetry.d.ts.map +1 -1
  141. package/dist/application/watch-hub.d.ts +2 -2
  142. package/dist/application/watch-hub.d.ts.map +1 -1
  143. package/dist/browser/client-multipart.d.ts +1 -1
  144. package/dist/browser/client-multipart.d.ts.map +1 -1
  145. package/dist/browser/client-url.d.ts +1 -1
  146. package/dist/browser/client-url.d.ts.map +1 -1
  147. package/dist/browser/client.d.ts +1 -1
  148. package/dist/browser/client.d.ts.map +1 -1
  149. package/dist/browser/contract-stream.d.ts +1 -1
  150. package/dist/browser/contract-stream.d.ts.map +1 -1
  151. package/dist/browser/http.d.ts +1 -1
  152. package/dist/browser/http.d.ts.map +1 -1
  153. package/dist/browser/resumable.d.ts +1 -28
  154. package/dist/browser/resumable.d.ts.map +1 -1
  155. package/dist/browser/retained.d.ts.map +1 -0
  156. package/dist/browser/socket-io.d.ts +23 -1
  157. package/dist/browser/socket-io.d.ts.map +1 -1
  158. package/dist/browser/stream.d.ts +14 -2
  159. package/dist/browser/stream.d.ts.map +1 -1
  160. package/dist/contract/define.d.ts +72 -65
  161. package/dist/contract/define.d.ts.map +1 -1
  162. package/dist/{internal/errors.d.ts → contract/normalize.d.ts} +3 -39
  163. package/dist/contract/normalize.d.ts.map +1 -0
  164. package/dist/contract/tool-view.d.ts +135 -0
  165. package/dist/contract/tool-view.d.ts.map +1 -0
  166. package/dist/declaration/declaration.d.ts.map +1 -0
  167. package/dist/{agent-runtime/durability-contract.d.ts → durability/contract.d.ts} +2 -2
  168. package/dist/durability/contract.d.ts.map +1 -0
  169. package/dist/{agent-runtime/durability.d.ts → durability/engine.d.ts} +4 -4
  170. package/dist/durability/engine.d.ts.map +1 -0
  171. package/dist/durability/events.d.ts +101 -0
  172. package/dist/durability/events.d.ts.map +1 -0
  173. package/dist/{agent-runtime/durability-json.d.ts → durability/json.d.ts} +1 -1
  174. package/dist/durability/json.d.ts.map +1 -0
  175. package/dist/{agent-runtime/durability-ledger.d.ts → durability/ledger.d.ts} +2 -2
  176. package/dist/durability/ledger.d.ts.map +1 -0
  177. package/dist/{agent-runtime/durability-scheduler.d.ts → durability/scheduler.d.ts} +2 -2
  178. package/dist/durability/scheduler.d.ts.map +1 -0
  179. package/dist/entrypoints/agent-runtime/browser.d.ts +5 -0
  180. package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -0
  181. package/dist/{agent-runtime-browser.js → entrypoints/agent-runtime/browser.js} +3 -3
  182. package/dist/{agent-runtime-coding-tools.d.ts → entrypoints/agent-runtime/coding-tools.d.ts} +2 -2
  183. package/dist/entrypoints/agent-runtime/coding-tools.d.ts.map +1 -0
  184. package/dist/entrypoints/agent-runtime/coding-tools.js +22 -0
  185. package/dist/{agent-runtime-harness.d.ts → entrypoints/agent-runtime/harness.d.ts} +2 -2
  186. package/dist/entrypoints/agent-runtime/harness.d.ts.map +1 -0
  187. package/dist/{agent-runtime-harness.js → entrypoints/agent-runtime/harness.js} +24 -25
  188. package/dist/entrypoints/agent-runtime/openrouter.d.ts +2 -0
  189. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -0
  190. package/dist/{agent-runtime-openrouter.js → entrypoints/agent-runtime/openrouter.js} +3 -3
  191. package/dist/{agent-runtime-sandbox.d.ts → entrypoints/agent-runtime/sandbox.d.ts} +5 -5
  192. package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -0
  193. package/dist/{agent-runtime-sandbox.js → entrypoints/agent-runtime/sandbox.js} +11 -12
  194. package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts +2 -0
  195. package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts.map +1 -0
  196. package/dist/{agent-runtime-sqlite-bun.js → entrypoints/agent-runtime/sqlite/bun.js} +8 -6
  197. package/dist/entrypoints/agent-runtime/sqlite/node.d.ts +2 -0
  198. package/dist/entrypoints/agent-runtime/sqlite/node.d.ts.map +1 -0
  199. package/dist/{agent-runtime-sqlite-node.js → entrypoints/agent-runtime/sqlite/node.js} +8 -6
  200. package/dist/entrypoints/agent-runtime/testing.d.ts +4 -0
  201. package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -0
  202. package/dist/entrypoints/agent-runtime/testing.js +1084 -0
  203. package/dist/{agent-runtime.d.ts → entrypoints/agent-runtime.d.ts} +41 -37
  204. package/dist/entrypoints/agent-runtime.d.ts.map +1 -0
  205. package/dist/{agent-runtime.js → entrypoints/agent-runtime.js} +408 -366
  206. package/dist/{application-diagnostic-journal.d.ts → entrypoints/application/diagnostic-journal.d.ts} +2 -2
  207. package/dist/entrypoints/application/diagnostic-journal.d.ts.map +1 -0
  208. package/dist/{application-diagnostic-journal.js → entrypoints/application/diagnostic-journal.js} +3 -3
  209. package/dist/{application-grammy.d.ts → entrypoints/application/grammy.d.ts} +2 -2
  210. package/dist/entrypoints/application/grammy.d.ts.map +1 -0
  211. package/dist/{application-grammy.js → entrypoints/application/grammy.js} +2 -2
  212. package/dist/{application-opentelemetry.d.ts → entrypoints/application/opentelemetry.d.ts} +2 -2
  213. package/dist/entrypoints/application/opentelemetry.d.ts.map +1 -0
  214. package/dist/{application-opentelemetry.js → entrypoints/application/opentelemetry.js} +4 -4
  215. package/dist/{application-schemas.d.ts → entrypoints/application/schemas.d.ts} +2 -2
  216. package/dist/entrypoints/application/schemas.d.ts.map +1 -0
  217. package/dist/{application-schemas.js → entrypoints/application/schemas.js} +2 -2
  218. package/dist/{application.d.ts → entrypoints/application.d.ts} +22 -21
  219. package/dist/entrypoints/application.d.ts.map +1 -0
  220. package/dist/{application.js → entrypoints/application.js} +24 -22
  221. package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -0
  222. package/dist/{upgrade-cli.js → entrypoints/bin/upgrade-cli.js} +3 -3
  223. package/dist/{cli.d.ts → entrypoints/cli.d.ts} +15 -15
  224. package/dist/entrypoints/cli.d.ts.map +1 -0
  225. package/dist/{cli.js → entrypoints/cli.js} +30 -32
  226. package/dist/entrypoints/contract.d.ts +9 -0
  227. package/dist/entrypoints/contract.d.ts.map +1 -0
  228. package/dist/{contract/index.js → entrypoints/contract.js} +14 -6
  229. package/dist/entrypoints/declaration.d.ts +2 -0
  230. package/dist/entrypoints/declaration.d.ts.map +1 -0
  231. package/dist/{declaration.js → entrypoints/declaration.js} +1 -1
  232. package/dist/{files.d.ts → entrypoints/files.d.ts} +2 -2
  233. package/dist/entrypoints/files.d.ts.map +1 -0
  234. package/dist/{files.js → entrypoints/files.js} +3 -3
  235. package/dist/{geo.d.ts → entrypoints/geo.d.ts} +1 -1
  236. package/dist/entrypoints/geo.d.ts.map +1 -0
  237. package/dist/{geo.js → entrypoints/geo.js} +4 -4
  238. package/dist/entrypoints/google.d.ts +2 -0
  239. package/dist/entrypoints/google.d.ts.map +1 -0
  240. package/dist/{google.js → entrypoints/google.js} +1 -1
  241. package/dist/{index.d.ts → entrypoints/index.d.ts} +14 -13
  242. package/dist/entrypoints/index.d.ts.map +1 -0
  243. package/dist/{index.js → entrypoints/index.js} +99 -33
  244. package/dist/{live.d.ts → entrypoints/live.d.ts} +4 -4
  245. package/dist/entrypoints/live.d.ts.map +1 -0
  246. package/dist/{live.js → entrypoints/live.js} +6 -4
  247. package/dist/{node.d.ts → entrypoints/node.d.ts} +11 -11
  248. package/dist/entrypoints/node.d.ts.map +1 -0
  249. package/dist/{node.js → entrypoints/node.js} +20 -16
  250. package/dist/entrypoints/oauth.d.ts +2 -0
  251. package/dist/entrypoints/oauth.d.ts.map +1 -0
  252. package/dist/{oauth.js → entrypoints/oauth.js} +3 -3
  253. package/dist/{observability/index.d.ts → entrypoints/observability.d.ts} +11 -11
  254. package/dist/entrypoints/observability.d.ts.map +1 -0
  255. package/dist/{observability/index.js → entrypoints/observability.js} +9 -11
  256. package/dist/entrypoints/primitives.d.ts +3 -0
  257. package/dist/entrypoints/primitives.d.ts.map +1 -0
  258. package/dist/{primitives.js → entrypoints/primitives.js} +1 -6
  259. package/dist/{react.d.ts → entrypoints/react.d.ts} +4 -4
  260. package/dist/entrypoints/react.d.ts.map +1 -0
  261. package/dist/{react.js → entrypoints/react.js} +3 -3
  262. package/dist/{release.d.ts → entrypoints/release.d.ts} +4 -4
  263. package/dist/entrypoints/release.d.ts.map +1 -0
  264. package/dist/{release.js → entrypoints/release.js} +1 -1
  265. package/dist/{remote.d.ts → entrypoints/remote.d.ts} +1 -1
  266. package/dist/entrypoints/remote.d.ts.map +1 -0
  267. package/dist/entrypoints/remote.js +66 -0
  268. package/dist/{server/index.d.ts → entrypoints/server.d.ts} +35 -34
  269. package/dist/entrypoints/server.d.ts.map +1 -0
  270. package/dist/{server/index.js → entrypoints/server.js} +294 -244
  271. package/dist/{telegram.d.ts → entrypoints/telegram.d.ts} +2 -2
  272. package/dist/entrypoints/telegram.d.ts.map +1 -0
  273. package/dist/{telegram.js → entrypoints/telegram.js} +1 -1
  274. package/dist/entrypoints/testing.d.ts +9 -0
  275. package/dist/entrypoints/testing.d.ts.map +1 -0
  276. package/dist/{testing.js → entrypoints/testing.js} +80 -919
  277. package/dist/{tools/connections/index.d.ts → entrypoints/tools/connections.d.ts} +6 -7
  278. package/dist/entrypoints/tools/connections.d.ts.map +1 -0
  279. package/dist/{tools/connections/index.js → entrypoints/tools/connections.js} +7 -4
  280. package/dist/{tools-contract.d.ts → entrypoints/tools/contract.d.ts} +5 -5
  281. package/dist/entrypoints/tools/contract.d.ts.map +1 -0
  282. package/dist/{tools-contract.js → entrypoints/tools/contract.js} +4 -4
  283. package/dist/{tool-invoker.d.ts → entrypoints/tools/invoker.d.ts} +2 -2
  284. package/dist/entrypoints/tools/invoker.d.ts.map +1 -0
  285. package/dist/entrypoints/tools/invoker.js +20 -0
  286. package/dist/entrypoints/tools.d.ts +51 -0
  287. package/dist/entrypoints/tools.d.ts.map +1 -0
  288. package/dist/{tools.js → entrypoints/tools.js} +1787 -1751
  289. package/dist/{tracking-server.d.ts → entrypoints/tracking/server.d.ts} +8 -8
  290. package/dist/entrypoints/tracking/server.d.ts.map +1 -0
  291. package/dist/{tracking.d.ts → entrypoints/tracking.d.ts} +15 -15
  292. package/dist/entrypoints/tracking.d.ts.map +1 -0
  293. package/dist/{tracking.js → entrypoints/tracking.js} +5 -8
  294. package/dist/google/google.d.ts.map +1 -0
  295. package/dist/{index-a916km3r.js → index-0b1ess5e.js} +6 -13
  296. package/dist/{index-zwkgfq1s.js → index-1nd48tm9.js} +113 -118
  297. package/dist/{index-7zbps32p.js → index-1zbbzgfh.js} +2 -2
  298. package/dist/{index-mzvgxp0n.js → index-2cr1cqhn.js} +16 -4
  299. package/dist/{index-f9mb610r.js → index-35mh5bhj.js} +2 -2
  300. package/dist/index-48ffdxgk.js +6 -0
  301. package/dist/index-58k4fp34.js +1023 -0
  302. package/dist/{index-p13mwz16.js → index-83bdg97s.js} +1 -1
  303. package/dist/index-97ac4gph.js +3618 -0
  304. package/dist/{index-kw9t5ayn.js → index-cq4qfycf.js} +5 -5
  305. package/dist/{index-7gnkny4z.js → index-d9pk3td4.js} +1 -1
  306. package/dist/{index-e42wzzz5.js → index-dcpdvjsc.js} +7 -7
  307. package/dist/{index-h9etkkyk.js → index-dydjcp8z.js} +102 -25
  308. package/dist/{index-sr93cwf9.js → index-e2z3ahw9.js} +2 -2
  309. package/dist/{index-yewwh1w4.js → index-e87kakm4.js} +96 -11
  310. package/dist/{index-cby4ar3v.js → index-eqqvgdb3.js} +1 -1
  311. package/dist/index-fdp6hdxn.js +942 -0
  312. package/dist/{index-0a349c33.js → index-gyr48nzg.js} +125 -198
  313. package/dist/{index-wnfk50r0.js → index-h6eeys1v.js} +1 -1
  314. package/dist/{index-77fekveh.js → index-hffjpmq9.js} +1 -15
  315. package/dist/{index-yn8remb1.js → index-j05z5gn4.js} +50 -14
  316. package/dist/index-k5hsfc3j.js +31 -0
  317. package/dist/{index-fq77yfzc.js → index-kj2wbeta.js} +1 -1
  318. package/dist/index-kvj7f4hq.js +39 -0
  319. package/dist/{index-4fpa9dy2.js → index-m9zn6cpq.js} +2 -2
  320. package/dist/{index-2na0qrfn.js → index-mdzh02yc.js} +7 -7
  321. package/dist/{index-ywd0y6m1.js → index-mkm15s49.js} +1 -1
  322. package/dist/index-mp5sn43f.js +1084 -0
  323. package/dist/{index-3bmnp41g.js → index-n6hxg8as.js} +507 -419
  324. package/dist/index-ngfhvfpd.js +30 -0
  325. package/dist/{index-e0znv5gn.js → index-p5r7qpdd.js} +2 -93
  326. package/dist/{index-n0f51dfn.js → index-p81267c2.js} +608 -549
  327. package/dist/{index-wc4x00bn.js → index-qwhynv6x.js} +1 -1
  328. package/dist/index-r7nmqpsg.js +154 -0
  329. package/dist/{index-bx75zwt7.js → index-rewkc2hj.js} +5 -4
  330. package/dist/{index-9f8ztey6.js → index-sees8yf8.js} +2 -2
  331. package/dist/{index-vjpvjqpn.js → index-v38qyerb.js} +16 -2
  332. package/dist/{index-2c2bjw3s.js → index-vcvkq30w.js} +3 -3
  333. package/dist/index-wqgjfstn.js +18 -0
  334. package/dist/{index-f477k430.js → index-x4799c19.js} +1 -1
  335. package/dist/{index-cxqhvq21.js → index-xnj9bgxe.js} +142 -129
  336. package/dist/index-xsqjkha9.js +281 -0
  337. package/dist/{index-6kyksz9y.js → index-yw4fzmdz.js} +1 -1
  338. package/dist/{index-3xwxfj4z.js → index-zeemqhqx.js} +1 -1
  339. package/dist/{index-tmwcrptx.js → index-zfrhfn82.js} +1 -1
  340. package/dist/index-znfs20ss.js +98 -0
  341. package/dist/internal/backoff.d.ts +29 -0
  342. package/dist/internal/backoff.d.ts.map +1 -0
  343. package/dist/internal/canonical-json.d.ts +21 -11
  344. package/dist/internal/canonical-json.d.ts.map +1 -1
  345. package/dist/internal/channel.d.ts.map +1 -0
  346. package/dist/internal/logger.d.ts.map +1 -0
  347. package/dist/internal/request.d.ts.map +1 -0
  348. package/dist/internal/stable-digest.d.ts +0 -43
  349. package/dist/internal/stable-digest.d.ts.map +1 -1
  350. package/dist/internal/typed.d.ts +0 -8
  351. package/dist/internal/typed.d.ts.map +1 -1
  352. package/dist/internal/zod-issues.d.ts +38 -0
  353. package/dist/internal/zod-issues.d.ts.map +1 -0
  354. package/dist/{tools/json-schema-dialect.d.ts → json-schema/dialect.d.ts} +1 -1
  355. package/dist/json-schema/dialect.d.ts.map +1 -0
  356. package/dist/json-schema/json-schema.d.ts.map +1 -0
  357. package/dist/live/watch-delta.d.ts.map +1 -1
  358. package/dist/{oauth.d.ts → oauth/authorization-code.d.ts} +1 -1
  359. package/dist/oauth/authorization-code.d.ts.map +1 -0
  360. package/dist/observability/audit.d.ts +2 -2
  361. package/dist/observability/audit.d.ts.map +1 -1
  362. package/dist/observability/bounded-logger.d.ts +1 -1
  363. package/dist/observability/bounded-logger.d.ts.map +1 -1
  364. package/dist/{internal/observability-sink.d.ts → observability/bounded-sink.d.ts} +2 -2
  365. package/dist/observability/bounded-sink.d.ts.map +1 -0
  366. package/dist/observability/context.d.ts +1 -1
  367. package/dist/observability/context.d.ts.map +1 -1
  368. package/dist/observability/event.d.ts +1 -1
  369. package/dist/observability/event.d.ts.map +1 -1
  370. package/dist/observability/work.d.ts +1 -1
  371. package/dist/observability/work.d.ts.map +1 -1
  372. package/dist/primitives/audit.d.ts +1 -1
  373. package/dist/primitives/audit.d.ts.map +1 -1
  374. package/dist/primitives/export-operation.d.ts +4 -2
  375. package/dist/primitives/export-operation.d.ts.map +1 -1
  376. package/dist/realtime/socket.d.ts +1 -1
  377. package/dist/realtime/socket.d.ts.map +1 -1
  378. package/dist/server/context-contribution.d.ts +1 -1
  379. package/dist/server/context-contribution.d.ts.map +1 -1
  380. package/dist/server/context.d.ts +2 -2
  381. package/dist/server/context.d.ts.map +1 -1
  382. package/dist/server/contract-method.d.ts +15 -0
  383. package/dist/server/contract-method.d.ts.map +1 -0
  384. package/dist/server/contract-stream.d.ts +1 -1
  385. package/dist/server/contract-stream.d.ts.map +1 -1
  386. package/dist/server/create.d.ts +8 -0
  387. package/dist/server/create.d.ts.map +1 -1
  388. package/dist/server/endpoint-dispatch.d.ts +10 -0
  389. package/dist/server/endpoint-dispatch.d.ts.map +1 -0
  390. package/dist/server/endpoint-response.d.ts +18 -0
  391. package/dist/server/endpoint-response.d.ts.map +1 -0
  392. package/dist/server/error-dispatch.d.ts +17 -1
  393. package/dist/server/error-dispatch.d.ts.map +1 -1
  394. package/dist/server/error-hook.d.ts +2 -2
  395. package/dist/server/error-hook.d.ts.map +1 -1
  396. package/dist/server/handler-state.d.ts +44 -0
  397. package/dist/server/handler-state.d.ts.map +1 -0
  398. package/dist/server/implement.d.ts +1 -1
  399. package/dist/server/implement.d.ts.map +1 -1
  400. package/dist/server/middleware/auth.d.ts +1 -1
  401. package/dist/server/middleware/auth.d.ts.map +1 -1
  402. package/dist/server/middleware/cors.d.ts +17 -0
  403. package/dist/server/middleware/cors.d.ts.map +1 -1
  404. package/dist/server/middleware/trust-fence.d.ts +1 -1
  405. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  406. package/dist/server/multipart.d.ts +1 -1
  407. package/dist/server/multipart.d.ts.map +1 -1
  408. package/dist/{tools/oauth-metadata.d.ts → server/oauth/metadata.d.ts} +2 -2
  409. package/dist/server/oauth/metadata.d.ts.map +1 -0
  410. package/dist/{tools/oauth-provider.d.ts → server/oauth/provider.d.ts} +2 -2
  411. package/dist/server/oauth/provider.d.ts.map +1 -0
  412. package/dist/server/realtime.d.ts +1 -1
  413. package/dist/server/realtime.d.ts.map +1 -1
  414. package/dist/server/request-completion.d.ts +16 -0
  415. package/dist/server/request-completion.d.ts.map +1 -0
  416. package/dist/server/response-metadata.d.ts +1 -1
  417. package/dist/server/response-metadata.d.ts.map +1 -1
  418. package/dist/server/route-table.d.ts +9 -0
  419. package/dist/server/route-table.d.ts.map +1 -0
  420. package/dist/server/stream.d.ts +0 -13
  421. package/dist/server/stream.d.ts.map +1 -1
  422. package/dist/server/types.d.ts +7 -4
  423. package/dist/server/types.d.ts.map +1 -1
  424. package/dist/testing/handler-clients.d.ts +31 -0
  425. package/dist/testing/handler-clients.d.ts.map +1 -0
  426. package/dist/testing/managed-resource-conformance-scenarios.d.ts.map +1 -1
  427. package/dist/testing/surface-conformance.d.ts +2 -1
  428. package/dist/testing/surface-conformance.d.ts.map +1 -1
  429. package/dist/testing/surface-manifest.d.ts +30 -4
  430. package/dist/testing/surface-manifest.d.ts.map +1 -1
  431. package/dist/tools/{cli-args.d.ts → cli/args.d.ts} +1 -1
  432. package/dist/tools/cli/args.d.ts.map +1 -0
  433. package/dist/tools/{cli-checkpoint.d.ts → cli/checkpoint.d.ts} +1 -1
  434. package/dist/tools/cli/checkpoint.d.ts.map +1 -0
  435. package/dist/tools/{cli-command.d.ts → cli/command.d.ts} +4 -4
  436. package/dist/tools/cli/command.d.ts.map +1 -0
  437. package/dist/tools/{cli.d.ts → cli/config.d.ts} +5 -9
  438. package/dist/tools/cli/config.d.ts.map +1 -0
  439. package/dist/tools/cli/create-cli.d.ts +36 -0
  440. package/dist/tools/cli/create-cli.d.ts.map +1 -0
  441. package/dist/tools/cli/download.d.ts +8 -0
  442. package/dist/tools/cli/download.d.ts.map +1 -0
  443. package/dist/tools/{cli-format.d.ts → cli/format.d.ts} +2 -2
  444. package/dist/tools/cli/format.d.ts.map +1 -0
  445. package/dist/tools/cli/help.d.ts +24 -0
  446. package/dist/tools/cli/help.d.ts.map +1 -0
  447. package/dist/tools/{cli-installer.d.ts → cli/installer.d.ts} +2 -2
  448. package/dist/tools/cli/installer.d.ts.map +1 -0
  449. package/dist/tools/{cli-invoke.d.ts → cli/invoke.d.ts} +8 -8
  450. package/dist/tools/cli/invoke.d.ts.map +1 -0
  451. package/dist/tools/cli/io.d.ts +10 -0
  452. package/dist/tools/cli/io.d.ts.map +1 -0
  453. package/dist/tools/cli/managed-surface.d.ts +30 -0
  454. package/dist/tools/cli/managed-surface.d.ts.map +1 -0
  455. package/dist/tools/{cli-manifest.d.ts → cli/manifest.d.ts} +1 -1
  456. package/dist/tools/cli/manifest.d.ts.map +1 -0
  457. package/dist/tools/{cli-policy.d.ts → cli/policy.d.ts} +2 -2
  458. package/dist/tools/cli/policy.d.ts.map +1 -0
  459. package/dist/tools/cli/prepare.d.ts +14 -0
  460. package/dist/tools/cli/prepare.d.ts.map +1 -0
  461. package/dist/tools/{cli-profile.d.ts → cli/profile.d.ts} +2 -2
  462. package/dist/tools/cli/profile.d.ts.map +1 -0
  463. package/dist/tools/cli/run-managed.d.ts +5 -0
  464. package/dist/tools/cli/run-managed.d.ts.map +1 -0
  465. package/dist/tools/cli/run-native.d.ts +9 -0
  466. package/dist/tools/cli/run-native.d.ts.map +1 -0
  467. package/dist/tools/cli/session.d.ts +40 -0
  468. package/dist/tools/cli/session.d.ts.map +1 -0
  469. package/dist/tools/{cli-signature.d.ts → cli/signature.d.ts} +2 -2
  470. package/dist/tools/cli/signature.d.ts.map +1 -0
  471. package/dist/tools/{cli-stream.d.ts → cli/stream.d.ts} +4 -4
  472. package/dist/tools/cli/stream.d.ts.map +1 -0
  473. package/dist/tools/{cli-update.d.ts → cli/update.d.ts} +3 -3
  474. package/dist/tools/cli/update.d.ts.map +1 -0
  475. package/dist/tools/{cli-view.d.ts → cli/view.d.ts} +2 -2
  476. package/dist/tools/cli/view.d.ts.map +1 -0
  477. package/dist/tools/{cli-wait.d.ts → cli/wait.d.ts} +2 -2
  478. package/dist/tools/cli/wait.d.ts.map +1 -0
  479. package/dist/tools/connections/runtime.d.ts +1 -1
  480. package/dist/tools/connections/runtime.d.ts.map +1 -1
  481. package/dist/tools/connections/types.d.ts +3 -3
  482. package/dist/tools/connections/types.d.ts.map +1 -1
  483. package/dist/tools/durability-context.d.ts +1 -1
  484. package/dist/tools/durability-context.d.ts.map +1 -1
  485. package/dist/tools/execute.d.ts +30 -3
  486. package/dist/tools/execute.d.ts.map +1 -1
  487. package/dist/tools/internal/surface-projector.d.ts +8 -6
  488. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  489. package/dist/tools/internal/tool-view.d.ts +41 -0
  490. package/dist/tools/internal/tool-view.d.ts.map +1 -0
  491. package/dist/tools/invoker.d.ts +11 -3
  492. package/dist/tools/invoker.d.ts.map +1 -1
  493. package/dist/tools/list-names.d.ts +3 -3
  494. package/dist/tools/list-names.d.ts.map +1 -1
  495. package/dist/tools/manifest.d.ts +2 -2
  496. package/dist/tools/manifest.d.ts.map +1 -1
  497. package/dist/tools/{mcp-app.d.ts → mcp/app.d.ts} +1 -1
  498. package/dist/tools/mcp/app.d.ts.map +1 -0
  499. package/dist/tools/{mcp-catalog.d.ts → mcp/catalog.d.ts} +2 -2
  500. package/dist/tools/mcp/catalog.d.ts.map +1 -0
  501. package/dist/tools/{mcp-handler.d.ts → mcp/handler.d.ts} +5 -5
  502. package/dist/tools/mcp/handler.d.ts.map +1 -0
  503. package/dist/tools/{mcp.d.ts → mcp/mount.d.ts} +9 -9
  504. package/dist/tools/mcp/mount.d.ts.map +1 -0
  505. package/dist/tools/{mcp-prepare.d.ts → mcp/prepare.d.ts} +9 -9
  506. package/dist/tools/mcp/prepare.d.ts.map +1 -0
  507. package/dist/tools/{mcp-progress.d.ts → mcp/progress.d.ts} +2 -2
  508. package/dist/tools/mcp/progress.d.ts.map +1 -0
  509. package/dist/tools/mcp/register.d.ts +35 -0
  510. package/dist/tools/mcp/register.d.ts.map +1 -0
  511. package/dist/tools/{mcp-round-policy.d.ts → mcp/round-policy.d.ts} +2 -2
  512. package/dist/tools/mcp/round-policy.d.ts.map +1 -0
  513. package/dist/tools/{mcp-round.d.ts → mcp/round.d.ts} +4 -4
  514. package/dist/tools/mcp/round.d.ts.map +1 -0
  515. package/dist/tools/mcp/runtime-tools.d.ts +24 -0
  516. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -0
  517. package/dist/tools/{mcp-stdio-signals.d.ts → mcp/stdio-signals.d.ts} +3 -3
  518. package/dist/tools/mcp/stdio-signals.d.ts.map +1 -0
  519. package/dist/tools/{mcp-stdio.d.ts → mcp/stdio.d.ts} +4 -4
  520. package/dist/tools/mcp/stdio.d.ts.map +1 -0
  521. package/dist/tools/{mcp-trace.d.ts → mcp/trace.d.ts} +1 -1
  522. package/dist/tools/mcp/trace.d.ts.map +1 -0
  523. package/dist/tools/mount.d.ts +12 -7
  524. package/dist/tools/mount.d.ts.map +1 -1
  525. package/dist/tools/native-definition.d.ts +3 -3
  526. package/dist/tools/native-definition.d.ts.map +1 -1
  527. package/dist/tools/operations/async-operation-binding-types.d.ts +127 -0
  528. package/dist/tools/operations/async-operation-binding-types.d.ts.map +1 -0
  529. package/dist/tools/operations/async-operation-binding.d.ts +28 -0
  530. package/dist/tools/operations/async-operation-binding.d.ts.map +1 -0
  531. package/dist/tools/operations/async-operation-canonical-types.d.ts +110 -0
  532. package/dist/tools/operations/async-operation-canonical-types.d.ts.map +1 -0
  533. package/dist/tools/operations/async-operation-canonical.d.ts +7 -0
  534. package/dist/tools/operations/async-operation-canonical.d.ts.map +1 -0
  535. package/dist/tools/operations/async-operation-contract.d.ts.map +1 -0
  536. package/dist/tools/operations/async-operation-id.d.ts +23 -0
  537. package/dist/tools/operations/async-operation-id.d.ts.map +1 -0
  538. package/dist/tools/operations/async-operation-runtime-tools.d.ts +40 -0
  539. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -0
  540. package/dist/tools/operations/async-operation-runtime-types.d.ts +68 -0
  541. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -0
  542. package/dist/tools/operations/async-operation-runtime.d.ts +5 -0
  543. package/dist/tools/operations/async-operation-runtime.d.ts.map +1 -0
  544. package/dist/tools/{define-wait-tool.d.ts → operations/define-wait-tool.d.ts} +2 -2
  545. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -0
  546. package/dist/tools/operations/mount-wait.d.ts.map +1 -0
  547. package/dist/tools/operations/wait-core.d.ts.map +1 -0
  548. package/dist/tools/remote.d.ts +1 -1
  549. package/dist/tools/remote.d.ts.map +1 -1
  550. package/dist/tools/runtime-tool.d.ts +11 -4
  551. package/dist/tools/runtime-tool.d.ts.map +1 -1
  552. package/dist/tools/schema/coerce.d.ts.map +1 -0
  553. package/dist/tools/schema/flatten-join.d.ts.map +1 -0
  554. package/dist/tools/schema/flatten.d.ts.map +1 -0
  555. package/dist/tools/schema/portable-formats.d.ts.map +1 -0
  556. package/dist/tools/{presentation.d.ts → schema/presentation.d.ts} +2 -0
  557. package/dist/tools/schema/presentation.d.ts.map +1 -0
  558. package/dist/tools/schema/schema.d.ts.map +1 -0
  559. package/dist/tools/schema/untyped-properties.d.ts.map +1 -0
  560. package/dist/tools/surface.d.ts +2 -3
  561. package/dist/tools/surface.d.ts.map +1 -1
  562. package/dist/tools/toolkit.d.ts +4 -4
  563. package/dist/tools/toolkit.d.ts.map +1 -1
  564. package/dist/tools/{define-download-tool.d.ts → transfer/define-download-tool.d.ts} +4 -4
  565. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -0
  566. package/dist/tools/{define-upload-tool.d.ts → transfer/define-upload-tool.d.ts} +3 -3
  567. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -0
  568. package/dist/tools/{define-view-file-tool.d.ts → transfer/define-view-file-tool.d.ts} +2 -2
  569. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -0
  570. package/dist/tools/{download-core.d.ts → transfer/download-core.d.ts} +2 -2
  571. package/dist/tools/transfer/download-core.d.ts.map +1 -0
  572. package/dist/tools/{managed-file-error.d.ts → transfer/managed-file-error.d.ts} +1 -1
  573. package/dist/tools/transfer/managed-file-error.d.ts.map +1 -0
  574. package/dist/tools/{mount-download.d.ts → transfer/mount-download.d.ts} +1 -1
  575. package/dist/tools/transfer/mount-download.d.ts.map +1 -0
  576. package/dist/tools/{mount-upload.d.ts → transfer/mount-upload.d.ts} +1 -1
  577. package/dist/tools/transfer/mount-upload.d.ts.map +1 -0
  578. package/dist/tools/transfer/native-result.d.ts.map +1 -0
  579. package/dist/tools/{upload-core.d.ts → transfer/upload-core.d.ts} +1 -1
  580. package/dist/tools/transfer/upload-core.d.ts.map +1 -0
  581. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -0
  582. package/dist/tools/{view-file.d.ts → transfer/view-file.d.ts} +1 -1
  583. package/dist/tools/transfer/view-file.d.ts.map +1 -0
  584. package/dist/tools/transports.d.ts +1 -1
  585. package/dist/tools/transports.d.ts.map +1 -1
  586. package/dist/tracking/contract.d.ts +1 -1
  587. package/dist/tracking/contract.d.ts.map +1 -1
  588. package/llms/agent-runtime-browser.txt +33 -0
  589. package/llms/agent-runtime-coding-tools.txt +58 -0
  590. package/llms/agent-runtime-harness.txt +45 -0
  591. package/llms/agent-runtime-openrouter.txt +22 -0
  592. package/llms/agent-runtime-sandbox.txt +159 -0
  593. package/llms/agent-runtime-sqlite-bun.txt +29 -0
  594. package/llms/agent-runtime-sqlite-node.txt +26 -0
  595. package/llms/agent-runtime-testing.txt +30 -0
  596. package/llms/agent-runtime.2.txt +550 -0
  597. package/llms/agent-runtime.3.txt +311 -0
  598. package/llms/agent-runtime.txt +893 -0
  599. package/llms/application-diagnostic-journal.txt +30 -0
  600. package/llms/application-grammy.txt +27 -0
  601. package/llms/application-opentelemetry.txt +27 -0
  602. package/llms/application-schemas.txt +42 -0
  603. package/llms/application.2.txt +223 -0
  604. package/llms/application.txt +1144 -0
  605. package/llms/cli.txt +977 -0
  606. package/llms/contract.txt +606 -0
  607. package/llms/declaration.txt +286 -0
  608. package/llms/files.txt +30 -0
  609. package/llms/geo.txt +114 -0
  610. package/llms/google.txt +27 -0
  611. package/llms/live.txt +471 -0
  612. package/llms/node.txt +43 -0
  613. package/llms/oauth.txt +136 -0
  614. package/llms/observability.txt +893 -0
  615. package/llms/primitives.txt +158 -0
  616. package/llms/react.txt +184 -0
  617. package/llms/release.txt +176 -0
  618. package/llms/remote.txt +25 -0
  619. package/llms/server.2.txt +361 -0
  620. package/llms/server.3.txt +1031 -0
  621. package/llms/server.4.txt +905 -0
  622. package/llms/server.5.txt +250 -0
  623. package/llms/server.txt +996 -0
  624. package/llms/stitchkit.2.txt +836 -0
  625. package/llms/stitchkit.3.txt +147 -0
  626. package/llms/stitchkit.txt +260 -0
  627. package/llms/telegram.txt +30 -0
  628. package/llms/testing.txt +676 -0
  629. package/llms/tools-connections.txt +45 -0
  630. package/llms/tools-contract.txt +9 -0
  631. package/llms/tools-invoker.txt +9 -0
  632. package/llms/tools.2.txt +838 -0
  633. package/llms/tools.txt +1004 -0
  634. package/llms/tracking-server.txt +32 -0
  635. package/llms/tracking.txt +263 -0
  636. package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
  637. package/llms/upgrading-0.53.0-0.67.0.txt +1174 -0
  638. package/llms/upgrading-0.68.0-0.94.0.txt +1159 -0
  639. package/llms/upgrading.txt +215 -0
  640. package/llms-full.txt +214 -75
  641. package/llms.txt +54 -5
  642. package/package.json +84 -83
  643. package/dist/agent-runtime/durability-contract.d.ts.map +0 -1
  644. package/dist/agent-runtime/durability-json.d.ts.map +0 -1
  645. package/dist/agent-runtime/durability-ledger.d.ts.map +0 -1
  646. package/dist/agent-runtime/durability-scheduler.d.ts.map +0 -1
  647. package/dist/agent-runtime/durability.d.ts.map +0 -1
  648. package/dist/agent-runtime/store-driver.d.ts.map +0 -1
  649. package/dist/agent-runtime-browser.d.ts +0 -5
  650. package/dist/agent-runtime-browser.d.ts.map +0 -1
  651. package/dist/agent-runtime-coding-tools.d.ts.map +0 -1
  652. package/dist/agent-runtime-coding-tools.js +0 -23
  653. package/dist/agent-runtime-harness.d.ts.map +0 -1
  654. package/dist/agent-runtime-openrouter.d.ts.map +0 -1
  655. package/dist/agent-runtime-sandbox.d.ts.map +0 -1
  656. package/dist/agent-runtime-sqlite-bun.d.ts.map +0 -1
  657. package/dist/agent-runtime-sqlite-node.d.ts.map +0 -1
  658. package/dist/agent-runtime-testing.d.ts +0 -3
  659. package/dist/agent-runtime-testing.d.ts.map +0 -1
  660. package/dist/agent-runtime-testing.js +0 -156
  661. package/dist/agent-runtime.d.ts.map +0 -1
  662. package/dist/application/channel.d.ts.map +0 -1
  663. package/dist/application-diagnostic-journal.d.ts.map +0 -1
  664. package/dist/application-grammy.d.ts.map +0 -1
  665. package/dist/application-opentelemetry.d.ts.map +0 -1
  666. package/dist/application-schemas.d.ts.map +0 -1
  667. package/dist/application.d.ts.map +0 -1
  668. package/dist/cli.d.ts.map +0 -1
  669. package/dist/contract/index.d.ts +0 -8
  670. package/dist/contract/index.d.ts.map +0 -1
  671. package/dist/declaration.d.ts.map +0 -1
  672. package/dist/files.d.ts.map +0 -1
  673. package/dist/geo.d.ts.map +0 -1
  674. package/dist/google.d.ts.map +0 -1
  675. package/dist/index-0j3vcp5m.js +0 -28
  676. package/dist/index-a11g2kry.js +0 -866
  677. package/dist/index-cnyk6te3.js +0 -77
  678. package/dist/index-fadnxwna.js +0 -1046
  679. package/dist/index-hrbajay7.js +0 -1196
  680. package/dist/index-s8cnx02s.js +0 -90
  681. package/dist/index-v5573g1k.js +0 -142
  682. package/dist/index-vk3kq9sb.js +0 -3344
  683. package/dist/index.d.ts.map +0 -1
  684. package/dist/internal/errors.d.ts.map +0 -1
  685. package/dist/internal/observability-sink.d.ts.map +0 -1
  686. package/dist/live.d.ts.map +0 -1
  687. package/dist/logger.d.ts.map +0 -1
  688. package/dist/node.d.ts.map +0 -1
  689. package/dist/oauth.d.ts.map +0 -1
  690. package/dist/observability/index.d.ts.map +0 -1
  691. package/dist/primitives.d.ts +0 -3
  692. package/dist/primitives.d.ts.map +0 -1
  693. package/dist/react.d.ts.map +0 -1
  694. package/dist/release.d.ts.map +0 -1
  695. package/dist/remote.d.ts.map +0 -1
  696. package/dist/remote.js +0 -88
  697. package/dist/retained.d.ts.map +0 -1
  698. package/dist/server/file-state-store.d.ts.map +0 -1
  699. package/dist/server/index.d.ts.map +0 -1
  700. package/dist/server/request.d.ts.map +0 -1
  701. package/dist/telegram.d.ts.map +0 -1
  702. package/dist/testing/agent-store-conformance.d.ts.map +0 -1
  703. package/dist/testing.d.ts +0 -39
  704. package/dist/testing.d.ts.map +0 -1
  705. package/dist/tool-invoker.d.ts.map +0 -1
  706. package/dist/tool-invoker.js +0 -21
  707. package/dist/tools/async-operation-contract.d.ts.map +0 -1
  708. package/dist/tools/async-operation.d.ts +0 -332
  709. package/dist/tools/async-operation.d.ts.map +0 -1
  710. package/dist/tools/cli-args.d.ts.map +0 -1
  711. package/dist/tools/cli-checkpoint.d.ts.map +0 -1
  712. package/dist/tools/cli-command.d.ts.map +0 -1
  713. package/dist/tools/cli-format.d.ts.map +0 -1
  714. package/dist/tools/cli-installer.d.ts.map +0 -1
  715. package/dist/tools/cli-invoke.d.ts.map +0 -1
  716. package/dist/tools/cli-manifest.d.ts.map +0 -1
  717. package/dist/tools/cli-policy.d.ts.map +0 -1
  718. package/dist/tools/cli-profile.d.ts.map +0 -1
  719. package/dist/tools/cli-signature.d.ts.map +0 -1
  720. package/dist/tools/cli-stream.d.ts.map +0 -1
  721. package/dist/tools/cli-update.d.ts.map +0 -1
  722. package/dist/tools/cli-view.d.ts.map +0 -1
  723. package/dist/tools/cli-wait.d.ts.map +0 -1
  724. package/dist/tools/cli.d.ts.map +0 -1
  725. package/dist/tools/coerce.d.ts.map +0 -1
  726. package/dist/tools/connections/index.d.ts.map +0 -1
  727. package/dist/tools/define-download-tool.d.ts.map +0 -1
  728. package/dist/tools/define-upload-tool.d.ts.map +0 -1
  729. package/dist/tools/define-view-file-tool.d.ts.map +0 -1
  730. package/dist/tools/define-wait-tool.d.ts.map +0 -1
  731. package/dist/tools/download-core.d.ts.map +0 -1
  732. package/dist/tools/flatten-join.d.ts.map +0 -1
  733. package/dist/tools/flatten.d.ts.map +0 -1
  734. package/dist/tools/json-schema-dialect.d.ts.map +0 -1
  735. package/dist/tools/json-schema.d.ts.map +0 -1
  736. package/dist/tools/managed-file-error.d.ts.map +0 -1
  737. package/dist/tools/mcp-app.d.ts.map +0 -1
  738. package/dist/tools/mcp-catalog.d.ts.map +0 -1
  739. package/dist/tools/mcp-handler.d.ts.map +0 -1
  740. package/dist/tools/mcp-prepare.d.ts.map +0 -1
  741. package/dist/tools/mcp-progress.d.ts.map +0 -1
  742. package/dist/tools/mcp-round-policy.d.ts.map +0 -1
  743. package/dist/tools/mcp-round.d.ts.map +0 -1
  744. package/dist/tools/mcp-stdio-signals.d.ts.map +0 -1
  745. package/dist/tools/mcp-stdio.d.ts.map +0 -1
  746. package/dist/tools/mcp-trace.d.ts.map +0 -1
  747. package/dist/tools/mcp.d.ts.map +0 -1
  748. package/dist/tools/mount-download.d.ts.map +0 -1
  749. package/dist/tools/mount-upload.d.ts.map +0 -1
  750. package/dist/tools/mount-wait.d.ts.map +0 -1
  751. package/dist/tools/native-mcp.d.ts +0 -20
  752. package/dist/tools/native-mcp.d.ts.map +0 -1
  753. package/dist/tools/native-result.d.ts.map +0 -1
  754. package/dist/tools/oauth-metadata.d.ts.map +0 -1
  755. package/dist/tools/oauth-provider.d.ts.map +0 -1
  756. package/dist/tools/portable-formats.d.ts.map +0 -1
  757. package/dist/tools/presentation.d.ts.map +0 -1
  758. package/dist/tools/schema.d.ts.map +0 -1
  759. package/dist/tools/untyped-properties.d.ts.map +0 -1
  760. package/dist/tools/upload-core.d.ts.map +0 -1
  761. package/dist/tools/view-file-contract.d.ts.map +0 -1
  762. package/dist/tools/view-file.d.ts.map +0 -1
  763. package/dist/tools/wait-core.d.ts.map +0 -1
  764. package/dist/tools-contract.d.ts.map +0 -1
  765. package/dist/tools.d.ts +0 -50
  766. package/dist/tools.d.ts.map +0 -1
  767. package/dist/tracking-server.d.ts.map +0 -1
  768. package/dist/tracking.d.ts.map +0 -1
  769. package/dist/upgrade-cli.d.ts.map +0 -1
  770. package/dist/{retained.d.ts → browser/retained.d.ts} +0 -0
  771. package/dist/{declaration.d.ts → declaration/declaration.d.ts} +0 -0
  772. package/dist/{upgrade-cli.d.ts → entrypoints/bin/upgrade-cli.d.ts} +0 -0
  773. package/dist/{tracking-server.js → entrypoints/tracking/server.js} +0 -0
  774. package/dist/{google.d.ts → google/google.d.ts} +0 -0
  775. package/dist/{index-pq95qkbf.js → index-5jm36zv1.js} +0 -0
  776. package/dist/{index-actkayzn.js → index-70yj2ebz.js} +3 -3
  777. /package/dist/{application → internal}/channel.d.ts +0 -0
  778. /package/dist/{logger.d.ts → internal/logger.d.ts} +0 -0
  779. /package/dist/{server → internal}/request.d.ts +0 -0
  780. /package/dist/{tools → json-schema}/json-schema.d.ts +0 -0
  781. /package/dist/tools/{async-operation-contract.d.ts → operations/async-operation-contract.d.ts} +0 -0
  782. /package/dist/tools/{mount-wait.d.ts → operations/mount-wait.d.ts} +0 -0
  783. /package/dist/tools/{wait-core.d.ts → operations/wait-core.d.ts} +0 -0
  784. /package/dist/tools/{coerce.d.ts → schema/coerce.d.ts} +0 -0
  785. /package/dist/tools/{flatten-join.d.ts → schema/flatten-join.d.ts} +0 -0
  786. /package/dist/tools/{flatten.d.ts → schema/flatten.d.ts} +0 -0
  787. /package/dist/tools/{portable-formats.d.ts → schema/portable-formats.d.ts} +0 -0
  788. /package/dist/tools/{schema.d.ts → schema/schema.d.ts} +0 -0
  789. /package/dist/tools/{untyped-properties.d.ts → schema/untyped-properties.d.ts} +0 -0
  790. /package/dist/tools/{native-result.d.ts → transfer/native-result.d.ts} +0 -0
  791. /package/dist/tools/{view-file-contract.d.ts → transfer/view-file-contract.d.ts} +0 -0
@@ -0,0 +1,836 @@
1
+ # stitchkit — stitchkit docs slice, part 2 of 3
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+ > Continues in `llms/stitchkit.3.txt`.
6
+
7
+ Parts of this slice:
8
+ - `llms/stitchkit.txt`: Guide: Getting started (docs/guide/getting-started.md)
9
+ - `llms/stitchkit.2.txt`: Guide: Typed client (docs/guide/client.md)
10
+ - `llms/stitchkit.3.txt`: API reference: `stitchkit` (docs/api/reference.md)
11
+
12
+ Also read:
13
+ - see `llms/contract.txt` for the Contracts guide
14
+ - see `llms/server.txt` for the Realtime guide
15
+ - see `llms/server.txt` for the Auth & errors guide
16
+
17
+ ==============================================================================
18
+ # Guide: Typed client (docs/guide/client.md)
19
+ ==============================================================================
20
+
21
+ # Typed client
22
+
23
+ From a contract, `createClient` builds a fully-typed client — one method per
24
+ endpoint, arguments and result inferred from the schemas. There is no codegen
25
+ step: the types come straight from the contract import.
26
+
27
+ ## `createHttpClient`
28
+
29
+ The HTTP client is the transport. It wraps [`ky`](https://github.com/sindresorhus/ky)
30
+ and adds cookie auth, SSR cookie forwarding, error parsing into `ApiError`, a
31
+ `401 → unauthorized` event stream and safe transport retry.
32
+
33
+ ```ts
34
+ import { contractEndpointMatchers, createHttpClient } from 'stitchkit'
35
+ import { publicAuth } from '../shared/contracts'
36
+
37
+ const http = createHttpClient({
38
+ baseUrl: '/api',
39
+ suppressUnauthorizedFor: contractEndpointMatchers(publicAuth, ['complete', 'verify']),
40
+ })
41
+ ```
42
+
43
+ The returned `ConfiguredHttpClient` keeps that `baseUrl` as a readonly public
44
+ field. Besides executing requests, it can therefore seed contract URL builders
45
+ without repeating transport configuration.
46
+
47
+ ### `HttpClientConfig`
48
+
49
+ | Field | Default | Purpose |
50
+ |-------|---------|---------|
51
+ | `baseUrl` | — | URL prefix for every request |
52
+ | `timeout` | `30000` | request timeout, ms |
53
+ | `credentials` | `'include'` | fetch credentials mode |
54
+ | `retry` | 2 retries after the initial GET; network errors only | transport retry policy |
55
+ | `headers` | — | extra headers — an object, or a function re-run per request |
56
+ | `suppressUnauthorizedFor` | `[]` | exact contract-derived operation matchers whose expected 401 does not emit `unauthorized` |
57
+ | `parseError` | built-in | map an error body to `{ code, message, details, hint }` |
58
+ | `trace` | `false` | emit a W3C `traceparent` header on every request |
59
+ | `unix` | — | dial a unix domain socket instead of TCP (Bun only, see below) |
60
+
61
+ `headers` as a function is the hook for runtime tokens — a bearer token or any
62
+ short-lived credential — re-evaluated on every request.
63
+
64
+ Expected 401 policy is explicit and contract-driven. Name the operations you
65
+ mean with `contractEndpointMatchers(contract, ['login'])`, or omit the second
66
+ argument to select every HTTP operation in that contract. Pass the same
67
+ `ContractClientConfig` as the typed client when routes use a static or dynamic
68
+ `pathPrefix`; dynamic matchers require `stripPrefixKeys`, so the helper can
69
+ compile the prefix structure without a concrete tenant id.
70
+
71
+ **Matching is by PATH, not by operation.** Each named operation compiles to its
72
+ path pattern, matched exactly by segments including params and trailing
73
+ wildcards — so a shared *prefix* never suppresses a neighbour, but two
74
+ operations on the **same path** are one matcher. If `login` is `POST /session`
75
+ and `session` is `GET /session`, naming `login` suppresses the expected-401
76
+ signal for both, and a real expired session stops raising `unauthorized`. Give
77
+ an operation you must distinguish a path of its own, or narrow the policy with
78
+ your own `(pathname) => boolean`.
79
+
80
+ ### Unix domain sockets
81
+
82
+ The same typed client dials a local daemon's socket file through an explicit,
83
+ owned Bun/Node transport ([server side](server.md#local-daemon-over-a-unix-socket)):
84
+
85
+ ```ts
86
+ import { createHttpClient } from 'stitchkit'
87
+ import { createUnixClientTransport } from 'stitchkit/server' // or stitchkit/node
88
+
89
+ const transport = createUnixClientTransport({
90
+ socketPath: '/run/my-daemon.sock',
91
+ maxRequestBytes: 4 * 1024 * 1024,
92
+ maxResponseBytes: 16 * 1024 * 1024,
93
+ })
94
+ const http = createHttpClient({
95
+ baseUrl: 'http://my-daemon', // URL/Host source; never dialled as TCP
96
+ fetch: transport.fetch,
97
+ retry: { limit: 0 },
98
+ })
99
+ const daemon = createClient(daemonContract, http)
100
+
101
+ // At application shutdown:
102
+ await transport.close()
103
+ ```
104
+
105
+ `baseUrl` stays required because it supplies the URL and `Host` header. The
106
+ adapter structurally owns dispatch: relative and absolute redirects use the same
107
+ socket, and a missing socket cannot fall through to that host over TCP. Defaults
108
+ are 16 MiB request/response bodies, 64 KiB headers, 30 s to response headers,
109
+ eight connections and five redirects.
110
+
111
+ `maxHeaderBytes` is enforced before exposing a response. Bun's owned parser
112
+ counts the complete response head in wire bytes, including the status line and
113
+ terminating blank line. Node passes the same configured integer unchanged to
114
+ `http.request({ maxHeaderSize })`, so its native parser's documented header-size
115
+ accounting is authoritative there. Exceeding either ceiling yields
116
+ `UNIX_HEADERS_TOO_LARGE` with `delivery: 'response-received'`. A stalled body
117
+ pauses its socket, and resuming preserves the exact chunked body.
118
+
119
+ `UnixClientTransportError` carries a stable `code` and `delivery`:
120
+ `not-dispatched`, `possibly-dispatched` or `response-received`. Only the first
121
+ proves that the remote operation did not begin; Stitchkit never silently retries
122
+ an ambiguous write. Response consumption/cancellation belongs to the operation,
123
+ and `close()` interrupts active work and destroys owned connections.
124
+
125
+ **A caller's cancellation reaches the server on both lanes.** The transport picks
126
+ a raw-socket lane under Bun and `node:http` elsewhere, and both propagate
127
+ `AbortSignal` the same way: aborting the request tears the connection down, and
128
+ the handler's `ctx.signal` fires — measured at roughly 300 ms for a 200 ms abort
129
+ over either lane, matching plain TCP. `close()` is a different thing: it ends the
130
+ *transport*, not one request, and a request-level abort does not close it.
131
+
132
+ The one way to see cancellation appear not to work is to pass the signal to the
133
+ plain callable — `api.thing(args, { signal })` — where options are ignored in
134
+ silence. See [per-call cancellation](#per-call-cancellation): `withOptions` is the
135
+ only door.
136
+
137
+ The response total is a unary-body policy, not a stream-buffer measurement. A
138
+ long-lived NDJSON/SSE client opts into streaming explicitly instead of choosing
139
+ an arbitrarily large integer:
140
+
141
+ ```ts
142
+ const streamTransport = createUnixClientTransport({
143
+ socketPath: '/run/my-daemon.sock',
144
+ responseBodyMode: 'streaming',
145
+ })
146
+ const streamClient = createClient(streamContract, {
147
+ baseUrl: 'http://my-daemon',
148
+ fetch: streamTransport.fetch,
149
+ })
150
+ ```
151
+
152
+ `streaming` removes only the cumulative lifetime response limit. It cannot be
153
+ combined with `maxResponseBytes`; request/header/connection bounds, socket
154
+ pause/resume, cancellation and strict HTTP framing remain active. The stream
155
+ descriptor's `maxFrameBytes` bounds each protocol frame, and the application
156
+ still owns any queue it builds after consuming those frames. Use a separate
157
+ default transport for finite calls that must retain the 16 MiB unary ceiling.
158
+ The adapter never infers this policy from `Content-Type`. → ADR 0125.
159
+
160
+ The legacy `createHttpClient({ unix: '/absolute/path' })` spelling remains a
161
+ Bun-only convenience. On a non-Bun runtime it now refuses before dispatch
162
+ instead of ignoring the selection and dialing TCP. `unix` and an injected
163
+ `fetch` are mutually exclusive; use `createUnixClientTransport` for portable,
164
+ explicit lifecycle ownership. → ADR 0116.
165
+
166
+ `trace: true` mints a fresh root trace per request. The stitchkit server
167
+ [continues an inbound `traceparent`](./observability.md#trace-context), so the
168
+ browser call, the HTTP handler and every nested tool call share one trace id
169
+ end-to-end. A `traceparent` you set yourself (via `headers`) always wins.
170
+
171
+ Retry is deliberately conservative: only a connection that never landed (a
172
+ network error), only on idempotent `GET`. A server that *responded* with a 5xx
173
+ is the data layer's call (TanStack Query), not the transport's — retrying in
174
+ both places multiplies attempts. `retry.limit` counts retries after the initial
175
+ attempt, so the default `2` permits at most three total attempts. The default
176
+ `statusCodes: []` does not replay HTTP responses; explicit `methods` or
177
+ `statusCodes` expand that policy when a project has a proven idempotent case.
178
+
179
+ Inside Next.js 16 server rendering, the first attempt still uses Next's normal
180
+ request memoization. If Ky authorizes a retry after a network rejection,
181
+ Stitchkit passes that retry's current `Request.signal` in the second fetch
182
+ argument and materializes the current Request as URL + init. Next 16.3 otherwise
183
+ merges `init` into a Request before its dedupe layer and loses the explicit
184
+ signal opt-out. The retry therefore performs a new network attempt instead of
185
+ returning the cached rejection. This adapter does not broaden retry policy: POST, unconfigured HTTP
186
+ statuses, cancellation and exhausted budgets retain the rules above.
187
+
188
+ ## `createClient`
189
+
190
+ ```ts
191
+ import { createClient } from 'stitchkit'
192
+ import { users } from '../shared/contracts'
193
+
194
+ export const api = createClient(users, http)
195
+
196
+ await api.list() // GET /users
197
+ await api.create({ name: 'Max' }) // POST /users body: { name }
198
+ await api.get({ id: '1' }) // GET /users/1
199
+ await api.update({ id: '1', name: 'M' }) // PUT /users/1 body: { name }
200
+ await api.delete({ id: '1' }) // DELETE /users/1
201
+ ```
202
+
203
+ The client follows response presence from the contract, not from the HTTP
204
+ status or a truthy runtime value. An endpoint with nullable `output` resolves
205
+ JSON `null` as `null`; an endpoint without `output` resolves `undefined`,
206
+ including an explicitly declared empty `200` or `205`. A missing body for a
207
+ declared output, or a body for an endpoint with no output, fails loudly instead
208
+ of changing the typed result.
209
+
210
+ Validation runs in one direction. The response is checked against the endpoint's
211
+ `output` schema before it reaches the caller; arguments are **not** checked
212
+ against `input` or `params` before the request is sent. A value the contract
213
+ forbids travels to the server and comes back as a `VALIDATION_ERROR` — `400`,
214
+ naming every offending field in the `message` and again in `details.issues` as
215
+ `{ path, code, message }`. That holds for a JSON body, a query string and a path
216
+ parameter alike, so a rejected argument always costs a round trip.
217
+
218
+ It is tempting to close that gap locally: the schemas are on the contract object,
219
+ and `input` is the very Zod object the server validates with, so parsing it before
220
+ the call looks free. **It is not, and it fails in the direction that breaks
221
+ working code.** A call's arguments and the server's `input` are not the same
222
+ value, for two independent reasons.
223
+
224
+ An argument object is typed as the intersection of `params`, `input` and any
225
+ multipart fields, so `input` covers one factor of it. Parsed over the whole
226
+ object it silently strips the keys it does not own — or, being `.strict()`,
227
+ refuses them:
228
+
229
+ ```ts
230
+ // params: { id }, input: z.object({ text }).strict()
231
+ contract.endpoints.update.input.safeParse({ id: 'item-1', text: 'hello' })
232
+ // → refused: unrecognized_keys: ["id"] the server accepts this call
233
+ ```
234
+
235
+ And on a query string or a multipart body the wire carries strings while the
236
+ caller holds live values, so a coercing schema answers differently on each side:
237
+
238
+ ```ts
239
+ // input: z.object({ flag: z.coerce.boolean() })
240
+ api.list({ flag: false })
241
+ // local safeParse({ flag: false }) → false
242
+ // server safeParse({ flag: 'false' }) → true z.coerce.boolean()('false') is true
243
+ ```
244
+
245
+ And a plain JSON body is not the safe exception it looks like, because it still
246
+ crosses `JSON.stringify`. A schema holding any type that does not survive that
247
+ round trip — `z.date()`, `z.map()`, `z.set()`, `z.bigint()`, `z.instanceof(...)`,
248
+ or `NaN` / `Infinity` inside a `z.number()` — agrees locally and refuses on the
249
+ server:
250
+
251
+ ```ts
252
+ // input: z.object({ when: z.date() }), POST, no path params
253
+ check({ when: new Date() }) // accepted: a live Date
254
+ // server // refused: expected date, received string
255
+ ```
256
+
257
+ This one fails in the safe direction — nothing valid is blocked — but "safe" is
258
+ about traffic, not about diagnostics. The check stays silent exactly where it
259
+ promised to speak: the refusal then arrives from the server, through a different
260
+ path and without the field names the local gate would have given. A gate that
261
+ lets through what it was added to catch is not a cheap gate, it is a quiet one.
262
+
263
+ One schema, one call, opposite answers — inside a single release, with no version
264
+ skew involved. Argument validation therefore stays on the server, which is the
265
+ only side that sees what was actually sent. A rejected argument costs a round
266
+ trip, and the refusal names every offending field.
267
+
268
+ An explicit contract `HEAD` operation is exposed like any other typed method.
269
+ Because HEAD endpoints are `rawResponse`, it resolves to the untouched
270
+ `Response`, giving the caller direct access to status and headers without JSON
271
+ parsing:
272
+
273
+ ```ts
274
+ const response = await assets.head({ name: 'clip.mp4' })
275
+ console.log(response.headers.get('content-length'))
276
+ ```
277
+
278
+ Each call takes one argument object. The client routes each field by the
279
+ contract:
280
+
281
+ - a **path param** (`:id`) is substituted into the URL,
282
+ - a named terminal wildcard (`/*filePath`) consumes that field and preserves its
283
+ path segments (`{ filePath: 'a/b' }` → `/a/b`, not `/%2Fa%2Fb` or a query field),
284
+ - for `GET` / `DELETE`, the remaining fields become the **query string**
285
+ (arrays become repeated keys),
286
+ - for `POST` / `PUT` / `PATCH`, they become the **JSON body**,
287
+ - a single `multipart.files` field is a `Blob` (web / Bun) or platform
288
+ `FileDescriptor` (`{ uri, name, type }`, React Native / Expo); a multiple
289
+ field is an array and is appended under the same form field name in order.
290
+ The exported `MultipartFile` / `FileDescriptor` types let you annotate your
291
+ own upload helpers.
292
+
293
+ ### Per-call cancellation
294
+
295
+ Every endpoint callable exposes a `withOptions` method accepting required
296
+ `ClientRequestOptions`. The ordinary callable contains only contract arguments,
297
+ so it can be passed directly to callback APIs such as `react-query-kit` without
298
+ mistaking their callback context for Stitchkit transport options.
299
+
300
+ **That safety has a cost worth knowing before it bites you.** `api.thing(args,
301
+ { signal })` — the shape everyone reaches for first — is not an error: the second
302
+ argument is ignored, in silence, and the request runs to completion while the
303
+ caller believes it was cancelled or bounded. TypeScript refuses the extra
304
+ argument at a typed call site and says nothing at an untyped one, which is where
305
+ the mistake actually happens. Nothing can catch it at runtime **on the bare
306
+ callable**: probing its second argument is exactly what the callback safety above
307
+ forbids, since reading a foreign object's `signal` may execute someone else's
308
+ getter. So the rule is simply this — **per-call options only ever go through
309
+ `withOptions`**, and a cancellation that appears to do nothing is the first thing
310
+ to check.
311
+
312
+ `withOptions` itself is guarded, because there the count settles it without
313
+ reading anything. Its arity depends on the endpoint — one argument when there is
314
+ no contract input, two when there is — and a call carrying more throws a
315
+ `TypeError` naming the endpoint and the correct shape. That guard exists because
316
+ the silent version of this mistake is expensive: the options are dropped, the
317
+ request goes out uncancelled, the caller still receives `REQUEST_ABORTED`
318
+ (cancellation is decided from the signal it was handed, not from what the
319
+ transport did), and the server runs the operation to its own deadline. Every
320
+ symptom then points at the transport, and the investigation goes there.
321
+
322
+ ```ts
323
+ const controller = new AbortController()
324
+
325
+ const pending = api.upload.withOptions(
326
+ { file: selectedFile, title: 'Draft' },
327
+ { signal: controller.signal },
328
+ )
329
+
330
+ controller.abort()
331
+ await pending
332
+ ```
333
+
334
+ Caller cancellation and the endpoint/client timeout are composed; whichever
335
+ fires first owns the result. Both the bare-fetch and Ky-backed clients expose
336
+ the same client-only errors:
337
+
338
+ | Failure | `ApiError.code` | `status` |
339
+ |---------|-----------------|----------|
340
+ | arguments refused before sending | `VALIDATION_ERROR` | `0` |
341
+ | caller `AbortSignal` | `REQUEST_ABORTED` | `0` |
342
+ | endpoint/client timeout | `REQUEST_TIMEOUT` | `0` |
343
+ | other transport failure | `UNKNOWN_ERROR` | `0` |
344
+
345
+ `status: 0` is what separates a refusal made here from one made by the server:
346
+ the same `VALIDATION_ERROR` arrives with `400` when the server refused, and
347
+ `details.issues` is the same `{ path, code, message }` array either way, so one
348
+ rendering serves both. A refusal raised here is always a **rejection** — on both
349
+ transports, for every call shape — and it never reaches the server. The client
350
+ refuses this way for a missing path param, a missing scoped prefix key, a
351
+ non-flat field in a `GET` input, and a missing or invalid multipart file. → ADR
352
+ 0148.
353
+
354
+ Abort and timeout do not emit `network_error` and are not retried. The same
355
+ options work for query, JSON, multipart and raw-response calls. Stitchkit does
356
+ not expose upload progress: Fetch has no portable upload-progress primitive.
357
+
358
+ An injected transport failure is normalized to `UNKNOWN_ERROR` while its exact
359
+ object remains available as `ApiError.cause`. This is how a bounded adapter can
360
+ preserve facts the generic client cannot invent — for example a Unix transport's
361
+ `not-dispatched`, `possibly-dispatched` or `response-received` state. Never replay
362
+ an effect from `UNKNOWN_ERROR` alone; inspect the owned adapter's cause and retry
363
+ only when it proves that dispatch did not happen.
364
+
365
+ For an endpoint without contract arguments, pass only the options object:
366
+
367
+ ```ts
368
+ await api.health.withOptions({ signal: controller.signal })
369
+ ```
370
+
371
+ ### Injected delivery adapters
372
+
373
+ `ClientFetch` is the narrow composition seam for application-owned delivery.
374
+ The contract still owns operation identity, request serialization and response
375
+ validation; the adapter owns I/O, bounds and dispatch certainty:
376
+
377
+ ```ts
378
+ import { type ClientFetch, createClient } from 'stitchkit'
379
+
380
+ const delivery: ClientFetch = async (input, init) => {
381
+ // Fixed deployment destination and policy are chosen here, not by caller data.
382
+ return boundedFetch(input, { ...init, signal: init?.signal })
383
+ }
384
+
385
+ const query = createClient(queryContract, {
386
+ baseUrl: 'https://service.internal',
387
+ fetch: delivery,
388
+ })
389
+ const work = createClient(requestWorkContract, {
390
+ baseUrl: 'https://service.internal',
391
+ fetch: delivery,
392
+ })
393
+ ```
394
+
395
+ The same adapter accepts unrelated contract shapes without learning their DTOs
396
+ or operation inventory. `createClient` chooses method/path from the contract,
397
+ forwards `.withOptions(..., { signal })` and validates the response through the
398
+ endpoint's output schema. A caller payload cannot replace the configured base URL
399
+ or reserved operation path.
400
+
401
+ It does **not** filter your arguments down to the declared ones. Keys the contract
402
+ does not declare are consumed for the path where they belong there and otherwise
403
+ sent as they are — `api.list({ q: 'hello', note: 'internal' })` puts
404
+ `?q=hello&note=internal` on the wire, and the server drops `note` only because its
405
+ schema is not `.strict()`. Nothing was validated away on this side: pass the
406
+ object the contract declares, not a wider one it happens to contain.
407
+
408
+ Contract metadata describes an effect; it does not authorize one. Authentication,
409
+ scope and destination policy remain in the application/server boundary. A schema
410
+ mismatch is an explicit validation failure and is not retried automatically. A
411
+ timeout means the caller stopped waiting, not that the remote effect did not run.
412
+
413
+ Published declarations are checked from a clean tarball under both bundler and
414
+ NodeNext resolution. The HTTP-only NodeNext proof uses `skipLibCheck: false` and
415
+ installs no Socket.IO peer. → ADR 0120.
416
+
417
+ ### Many contracts at once
418
+
419
+ ```ts
420
+ import { createClients } from 'stitchkit'
421
+
422
+ export const api = createClients({ users, posts, billing }, http)
423
+ await api.users.list()
424
+ await api.posts.create({ title: 'Hi' })
425
+ ```
426
+
427
+ When contracts use different path-prefix rules, route the same registry by the
428
+ scope already declared in each contract. An array composes contracts with
429
+ different scopes into one logical namespace:
430
+
431
+ ```ts
432
+ const api = createScopedClients(
433
+ { auth: [publicAuth, authenticatedAuth], widgets },
434
+ http,
435
+ {
436
+ public: {},
437
+ user: {},
438
+ tenant: {
439
+ stripPrefixKeys: ['tenantId'],
440
+ pathPrefix: ({ tenantId }) => `tenants/${tenantId}`,
441
+ },
442
+ },
443
+ )
444
+
445
+ await api.auth.login()
446
+ await api.auth.me()
447
+ await api.widgets.list({ tenantId: 't1' })
448
+ ```
449
+
450
+ Every scope present in the registry needs a config. Unknown/missing scopes and
451
+ duplicate method names inside a composed namespace fail before a request runs.
452
+
453
+ `createClients` builds one typed client per contract from a registry — list the
454
+ contracts once, get the whole API typed. It accepts the same optional scoped
455
+ config as `createClient`, so a whole registry can share one resource prefix:
456
+
457
+ ```ts
458
+ const tenantApi = createClients({ users, posts }, http, {
459
+ stripPrefixKeys: ['tenantId'],
460
+ pathPrefix: ({ tenantId }) => `tenants/${tenantId}`,
461
+ })
462
+ ```
463
+
464
+ Every method now requires `tenantId`, and the callback sees it as a `string`.
465
+ The batch form delegates to the same single-contract client runtime, including
466
+ HTTP exposure filtering, multipart, raw responses and output validation.
467
+
468
+ ## Contract URL builders
469
+
470
+ Browser-native consumers such as `<img src>`, downloads and navigation need a
471
+ URL, not a fetched response. `createUrlBuilder` derives those URLs from the same
472
+ contract path planner used by both typed-client transports:
473
+
474
+ ```ts
475
+ import { createScopedUrlBuilders, createUrlBuilder, createUrlBuilders } from 'stitchkit'
476
+
477
+ const mediaUrls = createUrlBuilder(media, http, {
478
+ stripPrefixKeys: ['tenantId'],
479
+ pathPrefix: ({ tenantId }) => `tenants/${tenantId}`,
480
+ })
481
+
482
+ const src = mediaUrls.file({
483
+ tenantId: 't_123',
484
+ fileId: 'f_456',
485
+ thumbnail: true,
486
+ })
487
+
488
+ // Body and multipart fields are intentionally absent: only the URL-bound
489
+ // params are accepted by URL functions.
490
+ const formAction = mediaUrls.replace({ tenantId: 't_123', fileId: 'f_456' })
491
+ const beaconUrl = mediaUrls.track({ tenantId: 't_123' })
492
+
493
+ const urls = createUrlBuilders({ media, exports }, http)
494
+ ```
495
+
496
+ When contracts use different dynamic prefixes, route the registry by the same
497
+ literal `contract.meta.scope` model as `createScopedClients`:
498
+
499
+ ```ts
500
+ const urls = createScopedUrlBuilders(
501
+ {
502
+ assets: publicAssets,
503
+ media: [tenantFiles, tenantMetadata], // one composed namespace
504
+ },
505
+ http,
506
+ {
507
+ public: {},
508
+ tenant: {
509
+ stripPrefixKeys: ['tenantId'],
510
+ pathPrefix: ({ tenantId }) => `tenants/${tenantId}`,
511
+ },
512
+ },
513
+ )
514
+
515
+ urls.assets.logo()
516
+ urls.media.file({ tenantId: 't1', fileId: 'f' })
517
+ ```
518
+
519
+ Every reachable scope needs a config. A missing config or duplicate method in a
520
+ composed namespace fails while the registry is built; URL generation itself
521
+ continues to use the same request planner as `createClient`.
522
+
523
+ Every HTTP-exposed endpoint appears on a URL builder, including body, multipart
524
+ and raw-response operations. Path and scoped-prefix keys are consumed by the
525
+ path. `GET` and `DELETE` input becomes the query string, including repeated keys
526
+ for arrays; body-method input and multipart files are not URL arguments and are
527
+ never serialized into the URL. Passing such a field through an untyped boundary
528
+ fails before a URL is returned.
529
+
530
+ Building a URL is synchronous and performs no request, auth event, header
531
+ resolution or output validation. A `ConfiguredHttpClient` created by
532
+ `createHttpClient` supplies its base URL; custom transports can pass an explicit
533
+ `{ baseUrl: 'https://api.example.com' }` instead. Relative bases produce relative
534
+ URLs.
535
+
536
+ ## `ApiError`
537
+
538
+ A non-2xx response is thrown as an `ApiError`:
539
+
540
+ ```ts
541
+ import { ApiError } from 'stitchkit'
542
+
543
+ try {
544
+ await api.get({ id: 'missing' })
545
+ } catch (err) {
546
+ if (ApiError.is(err)) {
547
+ err.code // 'NOT_FOUND'
548
+ err.status // 404
549
+ err.message // 'Note not found'
550
+ err.details // structured details, if any
551
+ err.hint // optional hint
552
+ err.traceId // x-request-id — correlate this failure with backend logs
553
+ err.cause // concrete injected transport failure, when delivery failed
554
+ }
555
+ }
556
+ ```
557
+
558
+ `traceId` is present when the server returned `x-request-id`. A network error,
559
+ timeout or abort without an HTTP response cannot carry one. Cross-origin
560
+ browser code can read it through Stitchkit's default CORS expose list; a custom
561
+ `cors.exposeHeaders` policy must keep `x-request-id` exposed.
562
+
563
+ The error model is shared with the server — see [Auth & errors](./auth-and-errors.md).
564
+
565
+ ## Auth events
566
+
567
+ The HTTP client emits events your app can react to globally:
568
+
569
+ ```ts
570
+ const unsubscribe = http.subscribe((event) => {
571
+ if (event.type === 'unauthorized') redirectToLogin() // a non-suppressed 401
572
+ if (event.type === 'network_error') showOfflineBanner()
573
+ })
574
+
575
+ http.logout() // mark logged out — suppresses further unauthorized events
576
+ http.resetLogoutState() // clear it after a fresh login
577
+ ```
578
+
579
+ ## Server-side rendering
580
+
581
+ For SSR, forward the incoming request's cookies so the API call runs as the
582
+ logged-in user:
583
+
584
+ ```ts
585
+ http.setServerContext(request.headers.get('cookie') ?? '')
586
+ ```
587
+
588
+ ## A bare fetch client
589
+
590
+ If you do not need cookie auth, retry or the event stream, pass a plain config
591
+ instead of an `HttpClient` — `createClient` then builds a minimal `fetch`-based
592
+ client:
593
+
594
+ ```ts
595
+ const api = createClient(users, {
596
+ baseUrl: 'https://api.example.com',
597
+ headers: () => ({ Authorization: `Bearer ${token()}` }),
598
+ onError: (status, body) => console.warn(status, body),
599
+ })
600
+ ```
601
+
602
+ ## `ContractClientConfig` — per-tenant / resource-scoped clients
603
+
604
+ `createClient` takes an optional **third** argument that prepends a dynamic
605
+ segment to every URL — the client half of a multi-tenant API
606
+ ([Route groups → param prefixes](./server.md#param-prefixes-resource-scoped-paths)):
607
+
608
+ ```ts
609
+ interface ContractClientConfig {
610
+ /** Prepended to every request URL. A function is called per request with the
611
+ * call's argument object, so the prefix can depend on the arguments. */
612
+ pathPrefix?: string | ((args: { [K in ConsumedKey]: string }) => string)
613
+ /** Argument keys consumed by `pathPrefix` — stripped from the query/body so
614
+ * they are not also sent there (the endpoint's own path `:params` are
615
+ * stripped automatically; list any *extra* keys here). */
616
+ stripPrefixKeys?: string[]
617
+ }
618
+ ```
619
+
620
+ A per-tenant client — `tenantId` goes into the URL, not the body:
621
+
622
+ ```ts
623
+ const widgets = createClient(widgetsContract, http, {
624
+ stripPrefixKeys: ['tenantId'],
625
+ pathPrefix: ({ tenantId }) => `tenants/${tenantId}/`,
626
+ })
627
+
628
+ widgets.list({ tenantId: 't_123' }) // GET /tenants/t_123/widgets
629
+ widgets.create({ tenantId: 't_123', name: 'A' }) // POST /tenants/t_123/widgets body: { name }
630
+ ```
631
+
632
+ "Keys it consumes" = a key the `pathPrefix` function reads (here `tenantId`).
633
+ List it in `stripPrefixKeys` so it lands in the URL **and is removed from the
634
+ query/body** — otherwise it would be sent twice. Endpoint path `:params` are
635
+ stripped for you; only extra prefix keys need listing.
636
+
637
+ ## React data layer
638
+
639
+ stitchkit does not ship a hook engine. Pair the typed client with
640
+ [`react-query-kit`](https://github.com/liaoliao666/react-query-kit) — wrap the
641
+ client methods directly:
642
+
643
+ ```ts
644
+ import { createQuery, createMutation } from 'react-query-kit'
645
+ import { api } from './api'
646
+
647
+ export const useUsers = createQuery({ queryKey: ['users'], fetcher: () => api.list() })
648
+ export const useCreateUser = createMutation({ mutationFn: api.create })
649
+ ```
650
+
651
+ Generated methods intentionally keep their ordinary call signature limited to
652
+ contract variables. Use `api.create.withOptions(variables, { signal })` only for
653
+ an imperative call that needs per-request cancellation.
654
+
655
+ ### Cursor pagination
656
+
657
+ For a cursor-paginated list, `createCursorQuery` is the canonical helper:
658
+
659
+ ```ts
660
+ import { createCursorQuery } from 'stitchkit/react'
661
+ import { api } from './api'
662
+
663
+ export const useFeed = createCursorQuery({
664
+ queryKey: ['feed'],
665
+ endpoint: api.feed, // the contract method
666
+ })
667
+ ```
668
+
669
+ It injects `cursor` from the page param and bakes in `getNextPageParam` /
670
+ `initialPageParam` — an infinite hook is just `queryKey + endpoint`. The page
671
+ size is the server's call (the contract's `limit` default); the client never
672
+ sends one. The result keeps the full `react-query-kit` surface (`.getKey()`,
673
+ `useSuspenseInfiniteQuery`, every option). The endpoint must return the
674
+ `{ items, nextCursor }` envelope — see [Contracts → pagination](./contracts.md#pagination).
675
+
676
+ ## Contract-first streams
677
+
678
+ When an endpoint declares `stream`, `createClient` returns a schema-derived
679
+ owned iterator rather than an untyped `Response`:
680
+
681
+ ```ts
682
+ const Progress = z.discriminatedUnion('kind', [
683
+ z.object({ kind: z.literal('line'), text: z.string() }),
684
+ z.object({ kind: z.literal('complete'), count: z.number().int() }),
685
+ ])
686
+
687
+ const contract = defineContract({ prefix: 'reports' }, {
688
+ watch: {
689
+ method: 'GET', path: '/:id/watch', desc: 'Watch one report',
690
+ params: z.object({ id: z.string() }),
691
+ stream: {
692
+ item: Progress,
693
+ format: 'ndjson', // default; `sse` is also supported
694
+ maxFrameBytes: 64 * 1024, // default 256 KiB
695
+ terminal: z.object({ kind: z.literal('complete') }).loose(),
696
+ },
697
+ },
698
+ })
699
+
700
+ const stream = await createClient(contract, http).watch({ id: 'r-1' })
701
+ for await (const item of stream) console.log(item) // inferred from Progress
702
+ ```
703
+
704
+ The iterator validates every frame and item. Normal completion requires the
705
+ wire `end` frame and, when declared, at least one matching terminal item; EOF is
706
+ `STREAM_TRUNCATED`, and a missing terminal is `STREAM_TERMINAL_MISSING`.
707
+ `return()`/`break`, caller abort, producer failure and optional `lifetimeMs`
708
+ converge on the request operation. See the
709
+ [server half](./server.md#contract-first-streams). → ADR 0117.
710
+
711
+ The request deadline bounds the wait for response headers. Once headers arrive,
712
+ that timer is cleared, while the caller signal remains attached to the response
713
+ body until it ends or is cancelled. This is the same for a Fetch-config client,
714
+ `createHttpClient`, the Bun-only `unix` convenience and an injected portable
715
+ Unix transport. Cancelling a quiet stream therefore releases its server source
716
+ and transport connection instead of only settling the local iterator.
717
+
718
+ An established NDJSON protocol may keep its item schema as the complete wire
719
+ frame. This mode requires a terminal item because an unwrapped response has no
720
+ separate safe error/end envelope:
721
+
722
+ ```ts
723
+ stream: {
724
+ item: Progress,
725
+ framing: 'item',
726
+ completion: 'terminal',
727
+ terminal: z.object({ kind: z.literal('complete') }).loose(),
728
+ finalLine: 'require-newline',
729
+ }
730
+ ```
731
+
732
+ The matching terminal item ends the operation. Before `next()` returns that
733
+ item, the client aborts the owned request and cancels its body reader; trailing
734
+ frames are not read. EOF first is `STREAM_TERMINAL_MISSING`. The defaults remain
735
+ `framing: 'envelope'`, `completion: 'stream-end'` and `finalLine: 'allow'`.
736
+ → ADR 0126.
737
+
738
+ ## SSE
739
+
740
+ For a streaming endpoint, consume the response with `parseSSE`:
741
+
742
+ ```ts
743
+ import { parseSSE } from 'stitchkit'
744
+
745
+ const res = await fetch('/api/chat/stream', { method: 'POST', body })
746
+ for await (const event of parseSSE(res)) {
747
+ console.log(event.data)
748
+ }
749
+ ```
750
+
751
+ The server side is [`streamSSE`](./server.md#sse-streaming), or
752
+ [`sseRoute`](./server.md#long-lived-subscriptions) for a subscription that stays
753
+ open. One line is bounded by `maxLineBytes` (default 1 MiB), UTF-8 is decoded
754
+ strictly and malformed input throws. Supply `onParseError` only when
755
+ skip-and-report is an explicit application policy.
756
+
757
+ ## NDJSON
758
+
759
+ `parseNDJSON` reads a newline-delimited JSON body — the client half of
760
+ [`ndjsonRoute`](./server.md#long-lived-subscriptions):
761
+
762
+ ```ts
763
+ import { parseNDJSON } from 'stitchkit'
764
+
765
+ const subscription = new AbortController()
766
+ const res = await fetch('/api/events/subscribe', { signal: subscription.signal })
767
+ for await (const event of parseNDJSON(res)) {
768
+ console.log(event)
769
+ }
770
+
771
+ // ...to unsubscribe:
772
+ subscription.abort()
773
+ ```
774
+
775
+ **Use the `AbortController` for a subscription.** Leaving the loop with `break`
776
+ cancels the body, and on a stream that ends that is enough — but it is not a
777
+ reliable way to tell the *server* you are gone: measured against Bun today, the
778
+ source stayed alive for seconds after a client-side cancel. Aborting the request
779
+ reaches [`context.signal`](./server.md#long-lived-subscriptions) on the other
780
+ end at once, which is what actually ends the work.
781
+
782
+ **Blank lines are skipped**, and that is the contract rather than a
783
+ convenience: a long-lived stream must send something while it is idle or
784
+ intermediaries drop it, and an empty line is the natural pulse for this framing.
785
+ Writing the rule down on both sides is what stops it being a verbal agreement —
786
+ the server's keep-alive and the reader's skip are one decision with two
787
+ implementations. One line is bounded by `maxLineBytes` (default 1 MiB), UTF-8 is
788
+ decoded strictly and malformed input throws. Passing `onParseError` explicitly
789
+ selects tolerant skip-and-report behaviour.
790
+
791
+ Set `finalLine: 'require-newline'` when the final newline is part of the
792
+ protocol's truncation proof. The default `allow` continues to accept one valid
793
+ final JSON document without a newline.
794
+
795
+ ## Resumable streams
796
+
797
+ A stream that survives a dropped connection needs four things beyond opening it:
798
+ re-open, back off before retrying, resume from where it stopped rather than
799
+ restart, and stop for good on a terminal item. `resumableIterator` owns those
800
+ four; your code keeps every decision that is about your data.
801
+
802
+ ```ts
803
+ import { resumableIterator } from 'stitchkit'
804
+
805
+ for await (const event of resumableIterator<Event, string>({
806
+ async open(cursor) {
807
+ const url = cursor ? `/api/events?after=${cursor}` : '/api/events'
808
+ return parseNDJSON(await fetch(url, { signal }))
809
+ },
810
+ advance: (event) => event.id, // what "where it stopped" means
811
+ isTerminal: (event) => event.done, // which item ends the stream
812
+ retry: { minDelayMs: 500, maxDelayMs: 30_000, jitter: 0.5 },
813
+ signal,
814
+ onAttempt: ({ number, delayMs, error }) => log.warn({ number, delayMs, error }),
815
+ })) {
816
+ render(event)
817
+ }
818
+ ```
819
+
820
+ `open` receives the cursor produced by the last **delivered** item, so a source
821
+ that fails after three items re-opens after the third, not from the beginning.
822
+ A source that simply ends without a terminal item is treated as a dropped
823
+ connection — that is the case a hand-written loop usually mistakes for
824
+ completion, and it is why the stream stops resuming.
825
+
826
+ **Jitter is not a detail.** Without it every consumer that lost the same server
827
+ retries at the same instant and the fleet arrives together on a server that has
828
+ just come back. The randomisation only ever *shortens* a delay, so `maxDelayMs`
829
+ stays a real ceiling. `createBackoff({ minDelayMs, maxDelayMs, jitter })` is the
830
+ same policy as a standalone value — `next()` and `reset()` — when you need the
831
+ delays without the iterator.
832
+
833
+ A delivered item resets the backoff, so a stream that reconnects, works for an
834
+ hour and drops again starts its next retry at `minDelayMs` rather than the
835
+ ceiling it reached last time. Aborting the signal ends the iteration promptly,
836
+ including in the middle of a wait.