stitchkit 0.125.0 → 0.127.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 (1249) hide show
  1. package/CHANGELOG.md +1707 -1
  2. package/README.md +12 -4
  3. package/dist/agent-executor/acp/scenarios.d.ts +4 -0
  4. package/dist/agent-executor/acp/scenarios.d.ts.map +1 -0
  5. package/dist/agent-executor/acp/v1-connect.d.ts +89 -0
  6. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -0
  7. package/dist/agent-executor/acp/v1-driver.d.ts +31 -0
  8. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -0
  9. package/dist/agent-executor/acp/v1-map.d.ts +41 -0
  10. package/dist/agent-executor/acp/v1-map.d.ts.map +1 -0
  11. package/dist/agent-executor/acp/v1-protocol.d.ts +270 -0
  12. package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -0
  13. package/dist/agent-executor/acp/v1-session.d.ts +22 -0
  14. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -0
  15. package/dist/agent-executor/acp/v1-turn.d.ts +25 -0
  16. package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -0
  17. package/dist/agent-executor/claude/classify.d.ts +54 -0
  18. package/dist/agent-executor/claude/classify.d.ts.map +1 -0
  19. package/dist/agent-executor/claude/cli-driver.d.ts +27 -0
  20. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -0
  21. package/dist/agent-executor/claude/limits.d.ts +8 -0
  22. package/dist/agent-executor/claude/limits.d.ts.map +1 -0
  23. package/dist/agent-executor/claude/protocol.d.ts +188 -0
  24. package/dist/agent-executor/claude/protocol.d.ts.map +1 -0
  25. package/dist/agent-executor/claude/scenarios.d.ts +4 -0
  26. package/dist/agent-executor/claude/scenarios.d.ts.map +1 -0
  27. package/dist/agent-executor/claude/session.d.ts +22 -0
  28. package/dist/agent-executor/claude/session.d.ts.map +1 -0
  29. package/dist/agent-executor/claude/transcript.d.ts +33 -0
  30. package/dist/agent-executor/claude/transcript.d.ts.map +1 -0
  31. package/dist/agent-executor/claude-sdk/driver.d.ts +31 -0
  32. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -0
  33. package/dist/agent-executor/claude-sdk/session.d.ts +10 -0
  34. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -0
  35. package/dist/agent-executor/codex/classify.d.ts +28 -0
  36. package/dist/agent-executor/codex/classify.d.ts.map +1 -0
  37. package/dist/agent-executor/codex/driver.d.ts +23 -0
  38. package/dist/agent-executor/codex/driver.d.ts.map +1 -0
  39. package/dist/agent-executor/codex/limits.d.ts +4 -0
  40. package/dist/agent-executor/codex/limits.d.ts.map +1 -0
  41. package/dist/agent-executor/codex/protocol.d.ts +152 -0
  42. package/dist/agent-executor/codex/protocol.d.ts.map +1 -0
  43. package/dist/agent-executor/codex/scenarios.d.ts +4 -0
  44. package/dist/agent-executor/codex/scenarios.d.ts.map +1 -0
  45. package/dist/agent-executor/codex/session.d.ts +41 -0
  46. package/dist/agent-executor/codex/session.d.ts.map +1 -0
  47. package/dist/agent-executor/contract.d.ts +454 -0
  48. package/dist/agent-executor/contract.d.ts.map +1 -0
  49. package/dist/agent-executor/dispatch.d.ts +41 -0
  50. package/dist/agent-executor/dispatch.d.ts.map +1 -0
  51. package/dist/agent-executor/engine-process.d.ts +45 -0
  52. package/dist/agent-executor/engine-process.d.ts.map +1 -0
  53. package/dist/agent-executor/engine-requests.d.ts +63 -0
  54. package/dist/agent-executor/engine-requests.d.ts.map +1 -0
  55. package/dist/agent-executor/engine.d.ts +64 -0
  56. package/dist/agent-executor/engine.d.ts.map +1 -0
  57. package/dist/agent-executor/executor-contract.d.ts +387 -0
  58. package/dist/agent-executor/executor-contract.d.ts.map +1 -0
  59. package/dist/agent-executor/executor-machine.d.ts +50 -0
  60. package/dist/agent-executor/executor-machine.d.ts.map +1 -0
  61. package/dist/agent-executor/hello.d.ts +235 -0
  62. package/dist/agent-executor/hello.d.ts.map +1 -0
  63. package/dist/agent-executor/json-rpc-peer.d.ts +48 -0
  64. package/dist/agent-executor/json-rpc-peer.d.ts.map +1 -0
  65. package/dist/agent-executor/leases.d.ts +159 -0
  66. package/dist/agent-executor/leases.d.ts.map +1 -0
  67. package/dist/agent-executor/plan-limits.d.ts +25 -0
  68. package/dist/agent-executor/plan-limits.d.ts.map +1 -0
  69. package/dist/agent-executor/profile.d.ts +52 -0
  70. package/dist/agent-executor/profile.d.ts.map +1 -0
  71. package/dist/agent-executor/projection.d.ts +14 -0
  72. package/dist/agent-executor/projection.d.ts.map +1 -0
  73. package/dist/agent-executor/session-primitives.d.ts +72 -0
  74. package/dist/agent-executor/session-primitives.d.ts.map +1 -0
  75. package/dist/agent-executor/testing/conformance.d.ts +55 -0
  76. package/dist/agent-executor/testing/conformance.d.ts.map +1 -0
  77. package/dist/agent-executor/testing/fake-claude-engine.d.ts +18 -0
  78. package/dist/agent-executor/testing/fake-claude-engine.d.ts.map +1 -0
  79. package/dist/agent-executor/testing/fake-engine.d.ts +52 -0
  80. package/dist/agent-executor/testing/fake-engine.d.ts.map +1 -0
  81. package/dist/agent-executor/turn-phases.d.ts +10 -0
  82. package/dist/agent-executor/turn-phases.d.ts.map +1 -0
  83. package/dist/agent-executor/vocabulary.d.ts +353 -0
  84. package/dist/agent-executor/vocabulary.d.ts.map +1 -0
  85. package/dist/agent-parts/parts.d.ts +160 -0
  86. package/dist/agent-parts/parts.d.ts.map +1 -0
  87. package/dist/agent-runtime/agent-tool.d.ts +1 -1
  88. package/dist/agent-runtime/agent-tool.d.ts.map +1 -1
  89. package/dist/agent-runtime/archive-projection.d.ts +5 -0
  90. package/dist/agent-runtime/archive-projection.d.ts.map +1 -1
  91. package/dist/agent-runtime/branch-contract.d.ts +63 -1
  92. package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
  93. package/dist/agent-runtime/branch-events.d.ts +7 -0
  94. package/dist/agent-runtime/branch-events.d.ts.map +1 -1
  95. package/dist/agent-runtime/branch-identities.d.ts +53 -1
  96. package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
  97. package/dist/agent-runtime/branch-messages.d.ts +15 -26
  98. package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
  99. package/dist/agent-runtime/branch-observations.d.ts +138 -28
  100. package/dist/agent-runtime/branch-observations.d.ts.map +1 -1
  101. package/dist/agent-runtime/branch-provider.d.ts +32 -51
  102. package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
  103. package/dist/agent-runtime/branch-refusal.d.ts +60 -0
  104. package/dist/agent-runtime/branch-refusal.d.ts.map +1 -0
  105. package/dist/agent-runtime/branch-runtime-tools.d.ts +14 -0
  106. package/dist/agent-runtime/branch-runtime-tools.d.ts.map +1 -0
  107. package/dist/agent-runtime/branch-source.d.ts +7 -2
  108. package/dist/agent-runtime/branch-source.d.ts.map +1 -1
  109. package/dist/agent-runtime/branch-transitions.d.ts.map +1 -1
  110. package/dist/agent-runtime/browser-control-contract.d.ts +2 -2
  111. package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
  112. package/dist/agent-runtime/child-blocking.d.ts +17 -6
  113. package/dist/agent-runtime/child-blocking.d.ts.map +1 -1
  114. package/dist/agent-runtime/child-budget-policy.d.ts +4 -9
  115. package/dist/agent-runtime/child-budget-policy.d.ts.map +1 -1
  116. package/dist/agent-runtime/child-tools.d.ts +19 -8
  117. package/dist/agent-runtime/child-tools.d.ts.map +1 -1
  118. package/dist/agent-runtime/children-contract.d.ts +84 -3
  119. package/dist/agent-runtime/children-contract.d.ts.map +1 -1
  120. package/dist/agent-runtime/children-control.d.ts +23 -2
  121. package/dist/agent-runtime/children-control.d.ts.map +1 -1
  122. package/dist/agent-runtime/children-spawn.d.ts +9 -0
  123. package/dist/agent-runtime/children-spawn.d.ts.map +1 -1
  124. package/dist/agent-runtime/children-state.d.ts +121 -19
  125. package/dist/agent-runtime/children-state.d.ts.map +1 -1
  126. package/dist/agent-runtime/children-usage.d.ts +10 -1
  127. package/dist/agent-runtime/children-usage.d.ts.map +1 -1
  128. package/dist/agent-runtime/children.d.ts +3 -3
  129. package/dist/agent-runtime/children.d.ts.map +1 -1
  130. package/dist/agent-runtime/{sandbox-coding.d.ts → coding-sandbox.d.ts} +2 -9
  131. package/dist/agent-runtime/coding-sandbox.d.ts.map +1 -0
  132. package/dist/agent-runtime/coding-shell-process.d.ts +2 -0
  133. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  134. package/dist/agent-runtime/coding-tool-contract.d.ts +32 -1
  135. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  136. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  137. package/dist/agent-runtime/coding-tools.d.ts.map +1 -1
  138. package/dist/agent-runtime/compaction.d.ts.map +1 -1
  139. package/dist/agent-runtime/companion-host.d.ts +38 -0
  140. package/dist/agent-runtime/companion-host.d.ts.map +1 -0
  141. package/dist/agent-runtime/context-issue.d.ts +5 -0
  142. package/dist/agent-runtime/context-issue.d.ts.map +1 -0
  143. package/dist/agent-runtime/control-schema.d.ts +2 -2
  144. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  145. package/dist/agent-runtime/conversations.d.ts.map +1 -1
  146. package/dist/agent-runtime/coordinator.d.ts.map +1 -1
  147. package/dist/agent-runtime/deferred-tool-types.d.ts +17 -5
  148. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  149. package/dist/agent-runtime/deferred-tools-internal.d.ts +2 -0
  150. package/dist/agent-runtime/deferred-tools-internal.d.ts.map +1 -1
  151. package/dist/agent-runtime/deferred-tools.d.ts.map +1 -1
  152. package/dist/agent-runtime/event-durability.d.ts +8 -0
  153. package/dist/agent-runtime/event-durability.d.ts.map +1 -0
  154. package/dist/agent-runtime/event-schema.d.ts +13 -5
  155. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  156. package/dist/agent-runtime/event-search-postgres.d.ts +38 -0
  157. package/dist/agent-runtime/event-search-postgres.d.ts.map +1 -0
  158. package/dist/agent-runtime/event-search-terms.d.ts +37 -0
  159. package/dist/agent-runtime/event-search-terms.d.ts.map +1 -0
  160. package/dist/agent-runtime/event-search-tools.d.ts +64 -4
  161. package/dist/agent-runtime/event-search-tools.d.ts.map +1 -1
  162. package/dist/agent-runtime/event-search.d.ts +16 -3
  163. package/dist/agent-runtime/event-search.d.ts.map +1 -1
  164. package/dist/agent-runtime/fault-bench.d.ts.map +1 -1
  165. package/dist/agent-runtime/harness-control.d.ts +8 -0
  166. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  167. package/dist/agent-runtime/harness-realtime.d.ts +0 -2
  168. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
  169. package/dist/agent-runtime/invocation-read.d.ts.map +1 -1
  170. package/dist/agent-runtime/invocation-schema.d.ts +23 -0
  171. package/dist/agent-runtime/invocation-schema.d.ts.map +1 -1
  172. package/dist/agent-runtime/invocation-spend.d.ts +9 -0
  173. package/dist/agent-runtime/invocation-spend.d.ts.map +1 -0
  174. package/dist/agent-runtime/invocations.d.ts.map +1 -1
  175. package/dist/agent-runtime/managed-tools.d.ts +2 -2
  176. package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
  177. package/dist/agent-runtime/observability.d.ts +42 -4
  178. package/dist/agent-runtime/observability.d.ts.map +1 -1
  179. package/dist/agent-runtime/openrouter-admission.d.ts +81 -0
  180. package/dist/agent-runtime/openrouter-admission.d.ts.map +1 -0
  181. package/dist/agent-runtime/openrouter-catalog.d.ts +83 -0
  182. package/dist/agent-runtime/openrouter-catalog.d.ts.map +1 -0
  183. package/dist/agent-runtime/openrouter-models.d.ts +66 -0
  184. package/dist/agent-runtime/openrouter-models.d.ts.map +1 -0
  185. package/dist/agent-runtime/openrouter-options.d.ts +106 -0
  186. package/dist/agent-runtime/openrouter-options.d.ts.map +1 -0
  187. package/dist/agent-runtime/openrouter-route.d.ts +50 -0
  188. package/dist/agent-runtime/openrouter-route.d.ts.map +1 -0
  189. package/dist/agent-runtime/openrouter-spend.d.ts +24 -0
  190. package/dist/agent-runtime/openrouter-spend.d.ts.map +1 -0
  191. package/dist/agent-runtime/openrouter.d.ts +23 -2
  192. package/dist/agent-runtime/openrouter.d.ts.map +1 -1
  193. package/dist/agent-runtime/owned-provider-stream.d.ts.map +1 -1
  194. package/dist/agent-runtime/postgres-schema.d.ts +34 -0
  195. package/dist/agent-runtime/postgres-schema.d.ts.map +1 -0
  196. package/dist/agent-runtime/postgres-transactions.d.ts +54 -0
  197. package/dist/agent-runtime/postgres-transactions.d.ts.map +1 -0
  198. package/dist/agent-runtime/postgres.d.ts +72 -0
  199. package/dist/agent-runtime/postgres.d.ts.map +1 -0
  200. package/dist/agent-runtime/projections.d.ts +57 -17
  201. package/dist/agent-runtime/projections.d.ts.map +1 -1
  202. package/dist/agent-runtime/provider-journal.d.ts +57 -0
  203. package/dist/agent-runtime/provider-journal.d.ts.map +1 -1
  204. package/dist/agent-runtime/purge.d.ts.map +1 -1
  205. package/dist/agent-runtime/retry-policy.d.ts +6 -0
  206. package/dist/agent-runtime/retry-policy.d.ts.map +1 -1
  207. package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
  208. package/dist/agent-runtime/run-execution-state.d.ts +26 -2
  209. package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
  210. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  211. package/dist/agent-runtime/run-failure.d.ts.map +1 -1
  212. package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
  213. package/dist/agent-runtime/run-provider-ledger.d.ts +2 -0
  214. package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -1
  215. package/dist/agent-runtime/run-step-barriers.d.ts +72 -0
  216. package/dist/agent-runtime/run-step-barriers.d.ts.map +1 -0
  217. package/dist/agent-runtime/run-step-spend.d.ts +319 -0
  218. package/dist/agent-runtime/run-step-spend.d.ts.map +1 -0
  219. package/dist/agent-runtime/run-stream-parts.d.ts +2 -0
  220. package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -1
  221. package/dist/agent-runtime/{tool-progress.d.ts → run-tool-progress.d.ts} +1 -1
  222. package/dist/agent-runtime/run-tool-progress.d.ts.map +1 -0
  223. package/dist/agent-runtime/run-turn-preparation.d.ts +3 -1
  224. package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -1
  225. package/dist/agent-runtime/runtime-admission-gate.d.ts +0 -14
  226. package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -1
  227. package/dist/agent-runtime/runtime-internals.d.ts +6 -0
  228. package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
  229. package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
  230. package/dist/agent-runtime/runtime.d.ts +31 -2
  231. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  232. package/dist/agent-runtime/sandbox-binding.d.ts +10 -0
  233. package/dist/agent-runtime/sandbox-binding.d.ts.map +1 -0
  234. package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts.map +1 -1
  235. package/dist/agent-runtime/sandbox-contract.d.ts +1 -1
  236. package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
  237. package/dist/agent-runtime/sandbox.d.ts +5 -0
  238. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  239. package/dist/agent-runtime/schedule-contract.d.ts +3 -2
  240. package/dist/agent-runtime/schedule-contract.d.ts.map +1 -1
  241. package/dist/agent-runtime/schedule-dispatch.d.ts +3 -2
  242. package/dist/agent-runtime/schedule-dispatch.d.ts.map +1 -1
  243. package/dist/agent-runtime/schedule-records.d.ts +6 -6
  244. package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
  245. package/dist/agent-runtime/schedule-tools.d.ts +19 -8
  246. package/dist/agent-runtime/schedule-tools.d.ts.map +1 -1
  247. package/dist/agent-runtime/schedules.d.ts +13 -3
  248. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  249. package/dist/agent-runtime/schemas-message.d.ts +118 -0
  250. package/dist/agent-runtime/schemas-message.d.ts.map +1 -0
  251. package/dist/agent-runtime/schemas-provider.d.ts +8 -0
  252. package/dist/agent-runtime/schemas-provider.d.ts.map +1 -0
  253. package/dist/agent-runtime/schemas-records.d.ts +5 -0
  254. package/dist/agent-runtime/schemas-records.d.ts.map +1 -0
  255. package/dist/agent-runtime/schemas-run.d.ts +487 -0
  256. package/dist/agent-runtime/schemas-run.d.ts.map +1 -0
  257. package/dist/agent-runtime/schemas-usage.d.ts +129 -0
  258. package/dist/agent-runtime/schemas-usage.d.ts.map +1 -0
  259. package/dist/agent-runtime/schemas.d.ts +11 -886
  260. package/dist/agent-runtime/schemas.d.ts.map +1 -1
  261. package/dist/agent-runtime/spill.d.ts +9 -7
  262. package/dist/agent-runtime/spill.d.ts.map +1 -1
  263. package/dist/agent-runtime/sql-events.d.ts +6 -0
  264. package/dist/agent-runtime/sql-events.d.ts.map +1 -0
  265. package/dist/agent-runtime/sql-history.d.ts +8 -0
  266. package/dist/agent-runtime/sql-history.d.ts.map +1 -0
  267. package/dist/agent-runtime/sql-ledger.d.ts +5 -0
  268. package/dist/agent-runtime/sql-ledger.d.ts.map +1 -0
  269. package/dist/agent-runtime/sql-purge.d.ts +13 -0
  270. package/dist/agent-runtime/sql-purge.d.ts.map +1 -0
  271. package/dist/agent-runtime/sql-reads.d.ts +16 -0
  272. package/dist/agent-runtime/sql-reads.d.ts.map +1 -0
  273. package/dist/agent-runtime/{sqlite-rows.d.ts → sql-rows.d.ts} +24 -10
  274. package/dist/agent-runtime/sql-rows.d.ts.map +1 -0
  275. package/dist/agent-runtime/sql-session.d.ts +71 -0
  276. package/dist/agent-runtime/sql-session.d.ts.map +1 -0
  277. package/dist/agent-runtime/sqlite-bun.d.ts +1 -1
  278. package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -1
  279. package/dist/agent-runtime/sqlite-node.d.ts +1 -1
  280. package/dist/agent-runtime/sqlite-node.d.ts.map +1 -1
  281. package/dist/agent-runtime/sqlite-purge.d.ts +2 -3
  282. package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
  283. package/dist/agent-runtime/sqlite-schema.d.ts +1 -1
  284. package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -1
  285. package/dist/agent-runtime/sqlite-transactions.d.ts +10 -6
  286. package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -1
  287. package/dist/agent-runtime/sqlite.d.ts +10 -29
  288. package/dist/agent-runtime/sqlite.d.ts.map +1 -1
  289. package/dist/agent-runtime/state-tools.d.ts +8 -4
  290. package/dist/agent-runtime/state-tools.d.ts.map +1 -1
  291. package/dist/agent-runtime/store-archive.d.ts.map +1 -1
  292. package/dist/agent-runtime/store-branch.d.ts +6 -1
  293. package/dist/agent-runtime/store-branch.d.ts.map +1 -1
  294. package/dist/agent-runtime/store-capabilities.d.ts +42 -0
  295. package/dist/agent-runtime/store-capabilities.d.ts.map +1 -0
  296. package/dist/agent-runtime/store-conformance-branch.d.ts +5 -2
  297. package/dist/agent-runtime/store-conformance-branch.d.ts.map +1 -1
  298. package/dist/agent-runtime/store-conformance-capabilities.d.ts +6 -0
  299. package/dist/agent-runtime/store-conformance-capabilities.d.ts.map +1 -0
  300. package/dist/agent-runtime/store-conformance-event-once.d.ts +12 -0
  301. package/dist/agent-runtime/store-conformance-event-once.d.ts.map +1 -0
  302. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  303. package/dist/agent-runtime/store-conformance-seed.d.ts +8 -0
  304. package/dist/agent-runtime/store-conformance-seed.d.ts.map +1 -0
  305. package/dist/agent-runtime/store-conformance.d.ts +31 -8
  306. package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
  307. package/dist/agent-runtime/store-create.d.ts +1 -1
  308. package/dist/agent-runtime/store-create.d.ts.map +1 -1
  309. package/dist/agent-runtime/store-driver-contract.d.ts +15 -8
  310. package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
  311. package/dist/agent-runtime/store-event-once.d.ts.map +1 -1
  312. package/dist/agent-runtime/store-events.d.ts +114 -0
  313. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  314. package/dist/agent-runtime/store-memory-archive.d.ts +2 -0
  315. package/dist/agent-runtime/store-memory-archive.d.ts.map +1 -1
  316. package/dist/agent-runtime/store-memory.d.ts +2 -2
  317. package/dist/agent-runtime/store-memory.d.ts.map +1 -1
  318. package/dist/agent-runtime/store-mutate.d.ts.map +1 -1
  319. package/dist/agent-runtime/store-reduce-shared.d.ts +2 -1
  320. package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -1
  321. package/dist/agent-runtime/store-reducer.d.ts.map +1 -1
  322. package/dist/agent-runtime/store-replay.d.ts.map +1 -1
  323. package/dist/agent-runtime/store.d.ts +15 -2
  324. package/dist/agent-runtime/store.d.ts.map +1 -1
  325. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  326. package/dist/application/admission-run.d.ts.map +1 -1
  327. package/dist/application/admission.d.ts.map +1 -1
  328. package/dist/application/change-subscription.d.ts.map +1 -1
  329. package/dist/application/decisions.d.ts.map +1 -1
  330. package/dist/application/diagnostic-journal-lock-format.d.ts +9 -0
  331. package/dist/application/diagnostic-journal-lock-format.d.ts.map +1 -0
  332. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  333. package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
  334. package/dist/application/grammy-update-admission.d.ts.map +1 -1
  335. package/dist/application/health.d.ts.map +1 -1
  336. package/dist/application/kernel-admission.d.ts.map +1 -1
  337. package/dist/application/kernel-contract.d.ts.map +1 -1
  338. package/dist/application/kernel-restart.d.ts.map +1 -1
  339. package/dist/application/kernel-rollback.d.ts.map +1 -1
  340. package/dist/application/kernel-shutdown.d.ts.map +1 -1
  341. package/dist/application/kernel-state.d.ts.map +1 -1
  342. package/dist/application/notification-outbox-state.d.ts.map +1 -1
  343. package/dist/application/notification-outbox.d.ts +1 -1
  344. package/dist/application/notification-outbox.d.ts.map +1 -1
  345. package/dist/application/revision-signal.d.ts.map +1 -1
  346. package/dist/application/schedule-run.d.ts.map +1 -1
  347. package/dist/application/schedule.d.ts.map +1 -1
  348. package/dist/application/sqlite-migrations.d.ts +104 -0
  349. package/dist/application/sqlite-migrations.d.ts.map +1 -0
  350. package/dist/application/watch-hub-core.d.ts +2 -1
  351. package/dist/application/watch-hub-core.d.ts.map +1 -1
  352. package/dist/application/watch-hub-source.d.ts +2 -0
  353. package/dist/application/watch-hub-source.d.ts.map +1 -1
  354. package/dist/application/watch-hub.d.ts +20 -1
  355. package/dist/application/watch-hub.d.ts.map +1 -1
  356. package/dist/browser/bridge-errors.d.ts +24 -0
  357. package/dist/browser/bridge-errors.d.ts.map +1 -0
  358. package/dist/browser/bridge-fetch.d.ts +30 -0
  359. package/dist/browser/bridge-fetch.d.ts.map +1 -0
  360. package/dist/browser/bridge-inbound.d.ts +28 -0
  361. package/dist/browser/bridge-inbound.d.ts.map +1 -0
  362. package/dist/browser/cancellation.d.ts +10 -2
  363. package/dist/browser/cancellation.d.ts.map +1 -1
  364. package/dist/browser/chunked-upload.d.ts +1 -1
  365. package/dist/browser/chunked-upload.d.ts.map +1 -1
  366. package/dist/browser/client-call-arguments.d.ts +31 -0
  367. package/dist/browser/client-call-arguments.d.ts.map +1 -0
  368. package/dist/browser/client-executors.d.ts +6 -0
  369. package/dist/browser/client-executors.d.ts.map +1 -1
  370. package/dist/browser/client.d.ts +9 -0
  371. package/dist/browser/client.d.ts.map +1 -1
  372. package/dist/browser/http.d.ts +17 -2
  373. package/dist/browser/http.d.ts.map +1 -1
  374. package/dist/browser/realtime-client.d.ts +0 -5
  375. package/dist/browser/realtime-client.d.ts.map +1 -1
  376. package/dist/browser/session-credentials-storage.d.ts +48 -0
  377. package/dist/browser/session-credentials-storage.d.ts.map +1 -0
  378. package/dist/browser/session-credentials.d.ts +26 -5
  379. package/dist/browser/session-credentials.d.ts.map +1 -1
  380. package/dist/browser/session-refresh-policy.d.ts +124 -0
  381. package/dist/browser/session-refresh-policy.d.ts.map +1 -0
  382. package/dist/browser/session-refresh-timer.d.ts +30 -0
  383. package/dist/browser/session-refresh-timer.d.ts.map +1 -0
  384. package/dist/browser/session.d.ts.map +1 -1
  385. package/dist/browser/socket-io-connection.d.ts.map +1 -1
  386. package/dist/browser/socket-io-explicit-peer.d.ts +0 -1
  387. package/dist/browser/socket-io-explicit-peer.d.ts.map +1 -1
  388. package/dist/browser/stream.d.ts +1 -1
  389. package/dist/browser/stream.d.ts.map +1 -1
  390. package/dist/browser/upload-progress.d.ts +3 -0
  391. package/dist/browser/upload-progress.d.ts.map +1 -1
  392. package/dist/contract/bridge-envelope.d.ts +155 -0
  393. package/dist/contract/bridge-envelope.d.ts.map +1 -0
  394. package/dist/contract/define-validation.d.ts +2 -0
  395. package/dist/contract/define-validation.d.ts.map +1 -1
  396. package/dist/contract/define.d.ts +3 -0
  397. package/dist/contract/define.d.ts.map +1 -1
  398. package/dist/contract/errors.d.ts +4 -4
  399. package/dist/contract/errors.d.ts.map +1 -1
  400. package/dist/contract/normalize.d.ts +3 -1
  401. package/dist/contract/normalize.d.ts.map +1 -1
  402. package/dist/contract/operation-effect.d.ts +29 -0
  403. package/dist/contract/operation-effect.d.ts.map +1 -0
  404. package/dist/contract/runtime-context.d.ts +2 -0
  405. package/dist/contract/runtime-context.d.ts.map +1 -1
  406. package/dist/contract/tool-options.d.ts +7 -0
  407. package/dist/contract/tool-options.d.ts.map +1 -1
  408. package/dist/declaration/command.d.ts +26 -0
  409. package/dist/declaration/command.d.ts.map +1 -0
  410. package/dist/declaration/declaration.d.ts +4 -22
  411. package/dist/declaration/declaration.d.ts.map +1 -1
  412. package/dist/declaration/machine-names.d.ts +11 -0
  413. package/dist/declaration/machine-names.d.ts.map +1 -0
  414. package/dist/durability/effect.d.ts.map +1 -1
  415. package/dist/durability/engine.d.ts.map +1 -1
  416. package/dist/durability/events.d.ts +5 -8
  417. package/dist/durability/events.d.ts.map +1 -1
  418. package/dist/durability/parks.d.ts +0 -5
  419. package/dist/durability/parks.d.ts.map +1 -1
  420. package/dist/durability/scheduler.d.ts +5 -0
  421. package/dist/durability/scheduler.d.ts.map +1 -1
  422. package/dist/entrypoints/agent-executor/acp.d.ts +4 -0
  423. package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -0
  424. package/dist/entrypoints/agent-executor/acp.js +910 -0
  425. package/dist/entrypoints/agent-executor/claude-sdk.d.ts +2 -0
  426. package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -0
  427. package/dist/entrypoints/agent-executor/claude-sdk.js +309 -0
  428. package/dist/entrypoints/agent-executor/claude.d.ts +5 -0
  429. package/dist/entrypoints/agent-executor/claude.d.ts.map +1 -0
  430. package/dist/entrypoints/agent-executor/claude.js +403 -0
  431. package/dist/entrypoints/agent-executor/codex.d.ts +4 -0
  432. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -0
  433. package/dist/entrypoints/agent-executor/codex.js +798 -0
  434. package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
  435. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -0
  436. package/dist/entrypoints/agent-executor/testing.js +375 -0
  437. package/dist/entrypoints/agent-executor.d.ts +15 -0
  438. package/dist/entrypoints/agent-executor.d.ts.map +1 -0
  439. package/dist/entrypoints/agent-executor.js +455 -0
  440. package/dist/entrypoints/agent-runtime/browser.d.ts +1 -0
  441. package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -1
  442. package/dist/entrypoints/agent-runtime/browser.js +60 -30
  443. package/dist/entrypoints/agent-runtime/coding-tools.js +9 -12
  444. package/dist/entrypoints/agent-runtime/harness.js +35 -22
  445. package/dist/entrypoints/agent-runtime/openrouter.d.ts +6 -0
  446. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
  447. package/dist/entrypoints/agent-runtime/openrouter.js +675 -45
  448. package/dist/entrypoints/agent-runtime/postgres.d.ts +4 -0
  449. package/dist/entrypoints/agent-runtime/postgres.d.ts.map +1 -0
  450. package/dist/entrypoints/agent-runtime/postgres.js +330 -0
  451. package/dist/entrypoints/agent-runtime/realtime.js +46 -49
  452. package/dist/entrypoints/agent-runtime/sandbox.d.ts +3 -1
  453. package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -1
  454. package/dist/entrypoints/agent-runtime/sandbox.js +74 -67
  455. package/dist/entrypoints/agent-runtime/sqlite/bun.js +18 -18
  456. package/dist/entrypoints/agent-runtime/sqlite/node.js +18 -18
  457. package/dist/entrypoints/agent-runtime/testing.d.ts +1 -1
  458. package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -1
  459. package/dist/entrypoints/agent-runtime/testing.js +419 -96
  460. package/dist/entrypoints/agent-runtime.d.ts +21 -13
  461. package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
  462. package/dist/entrypoints/agent-runtime.js +1280 -1086
  463. package/dist/entrypoints/application/diagnostic-journal.js +16 -11
  464. package/dist/entrypoints/application/directory-inbox.js +20 -14
  465. package/dist/entrypoints/application/grammy.js +11 -8
  466. package/dist/entrypoints/application/opentelemetry.js +3 -3
  467. package/dist/entrypoints/application.d.ts +5 -3
  468. package/dist/entrypoints/application.d.ts.map +1 -1
  469. package/dist/entrypoints/application.js +464 -116
  470. package/dist/entrypoints/bin/upgrade-cli.d.ts +0 -12
  471. package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
  472. package/dist/entrypoints/bin/upgrade-cli.js +13 -7
  473. package/dist/entrypoints/cli/publish.js +10 -9
  474. package/dist/entrypoints/cli.d.ts +10 -3
  475. package/dist/entrypoints/cli.d.ts.map +1 -1
  476. package/dist/entrypoints/cli.js +91 -29
  477. package/dist/entrypoints/contract.d.ts +2 -1
  478. package/dist/entrypoints/contract.d.ts.map +1 -1
  479. package/dist/entrypoints/contract.js +13 -7
  480. package/dist/entrypoints/declaration.d.ts +2 -0
  481. package/dist/entrypoints/declaration.d.ts.map +1 -1
  482. package/dist/entrypoints/declaration.js +55 -44
  483. package/dist/entrypoints/files/packaging.js +8 -5
  484. package/dist/entrypoints/files.d.ts +5 -0
  485. package/dist/entrypoints/files.d.ts.map +1 -1
  486. package/dist/entrypoints/files.js +236 -47
  487. package/dist/entrypoints/geo.js +9 -4
  488. package/dist/entrypoints/google.js +14 -13
  489. package/dist/entrypoints/handler.d.ts +12 -0
  490. package/dist/entrypoints/handler.d.ts.map +1 -0
  491. package/dist/entrypoints/handler.js +350 -0
  492. package/dist/entrypoints/http.d.ts +4 -0
  493. package/dist/entrypoints/http.d.ts.map +1 -1
  494. package/dist/entrypoints/http.js +411 -5
  495. package/dist/entrypoints/index.d.ts +2 -0
  496. package/dist/entrypoints/index.d.ts.map +1 -1
  497. package/dist/entrypoints/index.js +664 -91
  498. package/dist/entrypoints/live.js +22 -12
  499. package/dist/entrypoints/node.d.ts +2 -1
  500. package/dist/entrypoints/node.d.ts.map +1 -1
  501. package/dist/entrypoints/node.js +34 -24
  502. package/dist/entrypoints/observability.d.ts +2 -0
  503. package/dist/entrypoints/observability.d.ts.map +1 -1
  504. package/dist/entrypoints/observability.js +205 -131
  505. package/dist/entrypoints/primitives.js +152 -14
  506. package/dist/entrypoints/process/owner-loss.js +2 -2
  507. package/dist/entrypoints/process.js +18 -92
  508. package/dist/entrypoints/react.js +6 -5
  509. package/dist/entrypoints/realtime.d.ts +1 -0
  510. package/dist/entrypoints/realtime.d.ts.map +1 -1
  511. package/dist/entrypoints/realtime.js +6 -3
  512. package/dist/entrypoints/release.js +4 -0
  513. package/dist/entrypoints/remote.js +7 -6
  514. package/dist/entrypoints/server.d.ts +4 -2
  515. package/dist/entrypoints/server.d.ts.map +1 -1
  516. package/dist/entrypoints/server.js +300 -199
  517. package/dist/entrypoints/service-host/macos.d.ts +16 -0
  518. package/dist/entrypoints/service-host/macos.d.ts.map +1 -0
  519. package/dist/entrypoints/service-host/macos.js +1998 -0
  520. package/dist/entrypoints/service-host.d.ts +23 -0
  521. package/dist/entrypoints/service-host.d.ts.map +1 -0
  522. package/dist/entrypoints/service-host.js +2544 -0
  523. package/dist/entrypoints/spend/testing.d.ts +2 -0
  524. package/dist/entrypoints/spend/testing.d.ts.map +1 -0
  525. package/dist/entrypoints/spend/testing.js +442 -0
  526. package/dist/entrypoints/spend.d.ts +8 -0
  527. package/dist/entrypoints/spend.d.ts.map +1 -0
  528. package/dist/entrypoints/spend.js +593 -0
  529. package/dist/entrypoints/sync/postgres.d.ts +12 -0
  530. package/dist/entrypoints/sync/postgres.d.ts.map +1 -0
  531. package/dist/entrypoints/sync/postgres.js +737 -0
  532. package/dist/entrypoints/sync.d.ts +12 -0
  533. package/dist/entrypoints/sync.d.ts.map +1 -0
  534. package/dist/entrypoints/sync.js +782 -0
  535. package/dist/entrypoints/telegram/grammy.js +5 -5
  536. package/dist/entrypoints/telegram/html.d.ts +2 -0
  537. package/dist/entrypoints/telegram/html.d.ts.map +1 -1
  538. package/dist/entrypoints/telegram/html.js +839 -2
  539. package/dist/entrypoints/telegram/screens.js +13 -15
  540. package/dist/entrypoints/telegram.d.ts +1 -1
  541. package/dist/entrypoints/telegram.d.ts.map +1 -1
  542. package/dist/entrypoints/telegram.js +286 -76
  543. package/dist/entrypoints/testing.js +33 -41
  544. package/dist/entrypoints/tools/agent.js +12 -9
  545. package/dist/entrypoints/tools/connections.js +664 -63
  546. package/dist/entrypoints/tools/contract.d.ts +2 -2
  547. package/dist/entrypoints/tools/contract.js +4 -1
  548. package/dist/entrypoints/tools/invoker.js +9 -7
  549. package/dist/entrypoints/tools/mcp.js +16 -11
  550. package/dist/entrypoints/tools/toolkit.js +21 -16
  551. package/dist/entrypoints/tools.d.ts +3 -1
  552. package/dist/entrypoints/tools.d.ts.map +1 -1
  553. package/dist/entrypoints/tools.js +107 -94
  554. package/dist/entrypoints/tracking/contract.js +2 -1
  555. package/dist/entrypoints/tracking/performance.js +4 -0
  556. package/dist/entrypoints/tracking.js +6 -1
  557. package/dist/entrypoints/voice.js +3 -3
  558. package/dist/entrypoints/xlsx.js +1 -1
  559. package/dist/files/boundary.d.ts.map +1 -1
  560. package/dist/files/chunk-spool.d.ts +27 -0
  561. package/dist/files/chunk-spool.d.ts.map +1 -1
  562. package/dist/files/directory-appearance.d.ts +44 -0
  563. package/dist/files/directory-appearance.d.ts.map +1 -0
  564. package/dist/files/file-io.d.ts.map +1 -1
  565. package/dist/files/file-stamp.d.ts +35 -0
  566. package/dist/files/file-stamp.d.ts.map +1 -0
  567. package/dist/files/json-file-reading.d.ts +37 -0
  568. package/dist/files/json-file-reading.d.ts.map +1 -0
  569. package/dist/files/native-packaging.d.ts.map +1 -1
  570. package/dist/files/polled-json.d.ts +121 -0
  571. package/dist/files/polled-json.d.ts.map +1 -0
  572. package/dist/files/regular-file.d.ts +125 -0
  573. package/dist/files/regular-file.d.ts.map +1 -0
  574. package/dist/geo/index.d.ts +2 -1
  575. package/dist/geo/index.d.ts.map +1 -1
  576. package/dist/geo/resolver.d.ts.map +1 -1
  577. package/dist/geo/types.d.ts +0 -1
  578. package/dist/geo/types.d.ts.map +1 -1
  579. package/dist/google/google.d.ts +6 -0
  580. package/dist/google/google.d.ts.map +1 -1
  581. package/dist/{index-w0eqdhyd.js → index-09f7w2qq.js} +6 -1
  582. package/dist/index-0djnptn8.js +501 -0
  583. package/dist/index-0hdm5sx6.js +1457 -0
  584. package/dist/{index-t05a2ry4.js → index-0p0s5hrj.js} +8 -14
  585. package/dist/{index-1c945ten.js → index-0r15pkjq.js} +1 -1
  586. package/dist/{index-v1swr26p.js → index-0tyt97nk.js} +2 -2
  587. package/dist/{index-332d0m9g.js → index-0x4mnwg5.js} +4 -0
  588. package/dist/index-118aebbg.js +48 -0
  589. package/dist/index-1q0n6zek.js +184 -0
  590. package/dist/index-27hck3z2.js +307 -0
  591. package/dist/index-2rf33y2h.js +77 -0
  592. package/dist/index-360j58vb.js +63 -0
  593. package/dist/{index-tt30h7mr.js → index-39n02e0q.js} +1 -1
  594. package/dist/index-3agqmmrg.js +42 -0
  595. package/dist/{index-n6hvd1r2.js → index-3b31z0pc.js} +22 -15
  596. package/dist/index-3djgv3ch.js +472 -0
  597. package/dist/{index-mfntvj58.js → index-3dq8466w.js} +1 -1
  598. package/dist/index-3gwp8ez6.js +200 -0
  599. package/dist/{index-x2d51zay.js → index-3ypvpkwr.js} +309 -345
  600. package/dist/index-4gk6k3zc.js +248 -0
  601. package/dist/index-4qvyhn23.js +40 -0
  602. package/dist/index-4s2w4g37.js +647 -0
  603. package/dist/index-4ynw5ktx.js +78 -0
  604. package/dist/index-5awtbyns.js +19 -0
  605. package/dist/{index-kxff9e9w.js → index-5e0zsbf7.js} +5 -4
  606. package/dist/{index-nz06qw5a.js → index-5jyjb4s0.js} +1 -1
  607. package/dist/{index-7q05ag0z.js → index-5ptwb6ka.js} +1 -1
  608. package/dist/{index-w3nv6kr8.js → index-5q0qpw3v.js} +54 -9
  609. package/dist/{index-mm89hd8v.js → index-5t4fpdct.js} +1 -1
  610. package/dist/{index-0v9xb8pz.js → index-5y7j383h.js} +5 -5
  611. package/dist/index-5zwac8ft.js +221 -0
  612. package/dist/{index-v62cpkx3.js → index-6g85s734.js} +1 -1
  613. package/dist/{index-sqc6ezrb.js → index-6kec3b14.js} +17 -4
  614. package/dist/{index-kqnd6a85.js → index-7416mhyh.js} +1 -1
  615. package/dist/{index-m0wsfmrc.js → index-7csn6pva.js} +37 -24
  616. package/dist/{index-dqpesdck.js → index-7grgs8cx.js} +25 -5
  617. package/dist/{index-gdqawggb.js → index-7kfcb576.js} +143 -39
  618. package/dist/{index-cvjddnvd.js → index-7xp05h20.js} +19 -10
  619. package/dist/{index-fgzbc06j.js → index-83n766x4.js} +91 -50
  620. package/dist/{index-ss67fxhj.js → index-877e9y8r.js} +7 -7
  621. package/dist/{index-aw6kx2e6.js → index-8gmmdz7k.js} +1 -1
  622. package/dist/{index-wt6rw7rf.js → index-8xr2eq99.js} +29 -21
  623. package/dist/{index-rz3z13e9.js → index-97q9kykw.js} +1 -1
  624. package/dist/index-97rp94ff.js +8 -0
  625. package/dist/{index-0w0hxp7n.js → index-9pv126eh.js} +3 -9
  626. package/dist/{index-x2rvpbtj.js → index-9wh98cpa.js} +110 -16
  627. package/dist/{index-egg0yp2j.js → index-9xr44d2g.js} +86 -210
  628. package/dist/{index-b2sey031.js → index-9y0afd5f.js} +24 -23
  629. package/dist/index-a725ayvz.js +405 -0
  630. package/dist/{index-nmaqxdx7.js → index-ac5rj3d4.js} +203 -90
  631. package/dist/{index-wqzw3qg9.js → index-agy5fqgf.js} +32 -13
  632. package/dist/index-ajmtxsky.js +193 -0
  633. package/dist/{index-ndjzbt2v.js → index-akf0xkrm.js} +4 -3
  634. package/dist/index-akfgymyr.js +8 -0
  635. package/dist/index-apv5xfef.js +13 -0
  636. package/dist/index-ax3wns1a.js +93 -0
  637. package/dist/{index-0sg3wnzr.js → index-bbzvrq66.js} +1670 -340
  638. package/dist/index-bh4pmtr9.js +317 -0
  639. package/dist/{index-fa53vygr.js → index-bmaz3jzy.js} +3 -3
  640. package/dist/{index-8kzct1d6.js → index-bn2baakz.js} +143 -143
  641. package/dist/{index-m8ddk770.js → index-brhhaygm.js} +1 -1
  642. package/dist/index-caywx1c0.js +199 -0
  643. package/dist/index-cbhxhma2.js +90 -0
  644. package/dist/index-cfnmvcq8.js +11 -0
  645. package/dist/index-cv9b7fz2.js +42 -0
  646. package/dist/index-d4svrknj.js +156 -0
  647. package/dist/{index-a3z56mtn.js → index-d96c1n1q.js} +5 -3
  648. package/dist/{index-3ymcmpa9.js → index-dvd1qdwa.js} +33 -163
  649. package/dist/{index-v7rbjatr.js → index-dwa6pskj.js} +1837 -1151
  650. package/dist/{index-ne4j9998.js → index-e06z0tkb.js} +123 -94
  651. package/dist/{index-99nnsz39.js → index-en8e5zsj.js} +15 -135
  652. package/dist/index-fcw255hd.js +929 -0
  653. package/dist/{index-20hn8pbh.js → index-fmzg39a8.js} +1 -1
  654. package/dist/{index-fvd6pvw3.js → index-g1q7fwn9.js} +2 -2
  655. package/dist/index-g56ht6qf.js +98 -0
  656. package/dist/{index-f56ct5gb.js → index-gj1rjf78.js} +4 -3
  657. package/dist/{index-g6a3na27.js → index-gnjgkecx.js} +7 -3
  658. package/dist/index-hy4653g4.js +345 -0
  659. package/dist/index-j13gzgdv.js +403 -0
  660. package/dist/{index-r8swbw1x.js → index-j516jaaz.js} +37 -11
  661. package/dist/{index-t8jz0e20.js → index-j903yhp4.js} +30 -38
  662. package/dist/{index-9ypczvpj.js → index-jb4m241t.js} +2 -0
  663. package/dist/index-jrka9029.js +177 -0
  664. package/dist/{index-cjzaj7ev.js → index-jxtg307y.js} +23 -21
  665. package/dist/index-kmbpej2y.js +1152 -0
  666. package/dist/{index-bz9cmnqq.js → index-kt6dh1n6.js} +4 -4
  667. package/dist/index-ky3ardqn.js +80 -0
  668. package/dist/index-kyejf658.js +14 -0
  669. package/dist/{index-zyc64nbh.js → index-kynwa08q.js} +52 -47
  670. package/dist/index-kzavdze2.js +15 -0
  671. package/dist/{index-pq7rkwkk.js → index-mbd92r1w.js} +67 -12
  672. package/dist/index-mxt0wfjy.js +58 -0
  673. package/dist/{index-9cxxfkhb.js → index-n20tybgk.js} +14 -9
  674. package/dist/index-nbv44x0x.js +250 -0
  675. package/dist/index-ngwf1s3c.js +51 -0
  676. package/dist/{index-zfncctjp.js → index-nk0cy9g1.js} +5 -4
  677. package/dist/index-p1m9djt6.js +108 -0
  678. package/dist/{index-hs76yzt7.js → index-paff5y0r.js} +17 -11
  679. package/dist/{index-qaet40b2.js → index-prf6ayhf.js} +5 -7
  680. package/dist/{index-hkxgennw.js → index-ps3djm8d.js} +7 -1
  681. package/dist/{index-1v3k5zgx.js → index-qnzhmk2s.js} +528 -1129
  682. package/dist/{index-3bzk2645.js → index-r9kq5ark.js} +1 -1
  683. package/dist/{index-hkw233vx.js → index-rbd2rq3z.js} +2 -2
  684. package/dist/{index-r0xr7y4m.js → index-rhb33thr.js} +138 -33
  685. package/dist/{index-kffm4r8w.js → index-rj32hkkp.js} +2 -2
  686. package/dist/index-rptj3qnc.js +96 -0
  687. package/dist/{index-hqsbtvta.js → index-rpyn7geq.js} +11 -3
  688. package/dist/{index-m9hb9wnk.js → index-sfzfd2m2.js} +2 -2
  689. package/dist/{index-sqkttz7z.js → index-sv5svtq7.js} +1 -1
  690. package/dist/{index-srs8hj9c.js → index-sx3g49y2.js} +5 -1
  691. package/dist/{index-9mjrnqxs.js → index-t1a2jrg7.js} +21 -91
  692. package/dist/{index-568w258r.js → index-tazm4dxf.js} +1 -1
  693. package/dist/{index-b51tzcgh.js → index-tf70nm22.js} +2 -2
  694. package/dist/index-ttexdtjj.js +28 -0
  695. package/dist/{index-gbj964dt.js → index-v37b2cd6.js} +1970 -3142
  696. package/dist/{index-0ndz5r8z.js → index-v59pxmf1.js} +17 -9
  697. package/dist/{index-rfkh44ss.js → index-vgytj9wp.js} +1 -1
  698. package/dist/{index-tnnmekgb.js → index-wa6h4tz6.js} +3 -3
  699. package/dist/{index-8wzhmgpa.js → index-wavv538x.js} +211 -196
  700. package/dist/{index-1szhrfsf.js → index-wbnpa8z6.js} +7 -5
  701. package/dist/index-werjqesf.js +43 -0
  702. package/dist/{index-7qyv50r4.js → index-wv8dqy7q.js} +2 -2
  703. package/dist/index-wz392jyz.js +10 -0
  704. package/dist/{index-1d7s7da0.js → index-x6sp5vpa.js} +36 -5
  705. package/dist/{index-bqzgaj57.js → index-x90w78yz.js} +183 -61
  706. package/dist/index-xgae0bn7.js +37 -0
  707. package/dist/index-xmr47znh.js +160 -0
  708. package/dist/{index-ftk3838x.js → index-xq4s9mka.js} +7 -2
  709. package/dist/{index-ww3gss55.js → index-xrgn784x.js} +1 -1
  710. package/dist/{index-fpwbskp2.js → index-xtby8rj3.js} +1 -1
  711. package/dist/index-xtkw9866.js +107 -0
  712. package/dist/{index-btjwc7xr.js → index-xypxnzhp.js} +15 -14
  713. package/dist/{index-yex7eg1v.js → index-y7sy1xdp.js} +6 -2
  714. package/dist/index-z4k0hqp9.js +476 -0
  715. package/dist/{index-a7ebd769.js → index-zwgwyvdt.js} +3 -3
  716. package/dist/internal/abort-error.d.ts +9 -0
  717. package/dist/internal/abort-error.d.ts.map +1 -0
  718. package/dist/internal/abort-race.d.ts +47 -4
  719. package/dist/internal/abort-race.d.ts.map +1 -1
  720. package/dist/internal/atomic-file.d.ts +19 -0
  721. package/dist/internal/atomic-file.d.ts.map +1 -1
  722. package/dist/internal/backoff.d.ts.map +1 -1
  723. package/dist/internal/bounded-body.d.ts +37 -1
  724. package/dist/internal/bounded-body.d.ts.map +1 -1
  725. package/dist/internal/bounded-file-read.d.ts +31 -15
  726. package/dist/internal/bounded-file-read.d.ts.map +1 -1
  727. package/dist/internal/bun-command.d.ts +11 -0
  728. package/dist/internal/bun-command.d.ts.map +1 -1
  729. package/dist/internal/channel.d.ts.map +1 -1
  730. package/dist/internal/coalesced-task.d.ts +14 -2
  731. package/dist/internal/coalesced-task.d.ts.map +1 -1
  732. package/dist/internal/darwin-binding-error.d.ts.map +1 -1
  733. package/dist/internal/darwin-binding.d.ts +10 -0
  734. package/dist/internal/darwin-binding.d.ts.map +1 -1
  735. package/dist/internal/deadline.d.ts +22 -2
  736. package/dist/internal/deadline.d.ts.map +1 -1
  737. package/dist/internal/exclusive-lock-owner.d.ts +20 -1
  738. package/dist/internal/exclusive-lock-owner.d.ts.map +1 -1
  739. package/dist/internal/exclusive-lock-read.d.ts +2 -0
  740. package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
  741. package/dist/internal/exclusive-lock.d.ts +26 -0
  742. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  743. package/dist/internal/file-observation.d.ts +49 -0
  744. package/dist/internal/file-observation.d.ts.map +1 -1
  745. package/dist/internal/json-response.d.ts +10 -0
  746. package/dist/internal/json-response.d.ts.map +1 -0
  747. package/dist/internal/open-descriptors.d.ts +5 -0
  748. package/dist/internal/open-descriptors.d.ts.map +1 -1
  749. package/dist/internal/optional-peer.d.ts.map +1 -1
  750. package/dist/internal/pinned-http.d.ts.map +1 -1
  751. package/dist/internal/positive-integer.d.ts +14 -6
  752. package/dist/internal/positive-integer.d.ts.map +1 -1
  753. package/dist/internal/postgres-query.d.ts +16 -0
  754. package/dist/internal/postgres-query.d.ts.map +1 -0
  755. package/dist/internal/process-identity.d.ts +21 -1
  756. package/dist/internal/process-identity.d.ts.map +1 -1
  757. package/dist/internal/process-instance.d.ts +6 -0
  758. package/dist/internal/process-instance.d.ts.map +1 -1
  759. package/dist/internal/request.d.ts +4 -0
  760. package/dist/internal/request.d.ts.map +1 -1
  761. package/dist/internal/secret-equal.d.ts +11 -0
  762. package/dist/internal/secret-equal.d.ts.map +1 -0
  763. package/dist/internal/secure-fetch.d.ts.map +1 -1
  764. package/dist/internal/sqlite.d.ts +8 -0
  765. package/dist/internal/sqlite.d.ts.map +1 -1
  766. package/dist/internal/timers.d.ts +20 -0
  767. package/dist/internal/timers.d.ts.map +1 -1
  768. package/dist/internal/typed.d.ts +11 -0
  769. package/dist/internal/typed.d.ts.map +1 -1
  770. package/dist/internal/unix-client-error.d.ts +21 -0
  771. package/dist/internal/unix-client-error.d.ts.map +1 -0
  772. package/dist/internal/unix-socket-lock.d.ts +23 -0
  773. package/dist/internal/unix-socket-lock.d.ts.map +1 -0
  774. package/dist/internal/unix-socket.d.ts +60 -0
  775. package/dist/internal/unix-socket.d.ts.map +1 -1
  776. package/dist/internal/upgrade-affects.d.ts +3 -3
  777. package/dist/internal/upgrade-affects.d.ts.map +1 -1
  778. package/dist/internal/upgrade-plan.d.ts.map +1 -1
  779. package/dist/json-schema/dialect.d.ts +0 -6
  780. package/dist/json-schema/dialect.d.ts.map +1 -1
  781. package/dist/json-schema/keywords.d.ts +116 -0
  782. package/dist/json-schema/keywords.d.ts.map +1 -0
  783. package/dist/json-schema/string-format.d.ts.map +1 -1
  784. package/dist/live/events.d.ts.map +1 -1
  785. package/dist/live/watch-client.d.ts.map +1 -1
  786. package/dist/observability/bounded-logger.d.ts +3 -0
  787. package/dist/observability/bounded-logger.d.ts.map +1 -1
  788. package/dist/observability/bounded-sink.d.ts.map +1 -1
  789. package/dist/observability/context.d.ts +12 -2
  790. package/dist/observability/context.d.ts.map +1 -1
  791. package/dist/observability/event-loop-delay.d.ts +62 -0
  792. package/dist/observability/event-loop-delay.d.ts.map +1 -0
  793. package/dist/observability/json-logger.d.ts.map +1 -1
  794. package/dist/observability/log-repeat.d.ts +44 -0
  795. package/dist/observability/log-repeat.d.ts.map +1 -0
  796. package/dist/observability/spool-core.d.ts +95 -0
  797. package/dist/observability/spool-core.d.ts.map +1 -0
  798. package/dist/observability/spool-file.d.ts +46 -0
  799. package/dist/observability/spool-file.d.ts.map +1 -0
  800. package/dist/observability/spool.d.ts +14 -8
  801. package/dist/observability/spool.d.ts.map +1 -1
  802. package/dist/observability/trace.d.ts.map +1 -1
  803. package/dist/observability/work.d.ts.map +1 -1
  804. package/dist/primitives/index.d.ts +1 -0
  805. package/dist/primitives/index.d.ts.map +1 -1
  806. package/dist/primitives/order-key.d.ts +37 -0
  807. package/dist/primitives/order-key.d.ts.map +1 -0
  808. package/dist/process/bun-child.d.ts.map +1 -1
  809. package/dist/process/command-owner.d.ts.map +1 -1
  810. package/dist/process/contract.d.ts +4 -3
  811. package/dist/process/contract.d.ts.map +1 -1
  812. package/dist/process/group-presence.d.ts.map +1 -1
  813. package/dist/process/group-settlement.d.ts +2 -0
  814. package/dist/process/group-settlement.d.ts.map +1 -1
  815. package/dist/process/group.d.ts +5 -1
  816. package/dist/process/group.d.ts.map +1 -1
  817. package/dist/process/launch.d.ts +5 -3
  818. package/dist/process/launch.d.ts.map +1 -1
  819. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  820. package/dist/react/cache-bridge.d.ts.map +1 -1
  821. package/dist/release/watcher.d.ts.map +1 -1
  822. package/dist/server/bridge-host.d.ts +51 -0
  823. package/dist/server/bridge-host.d.ts.map +1 -0
  824. package/dist/server/bun.d.ts +4 -4
  825. package/dist/server/bun.d.ts.map +1 -1
  826. package/dist/server/context-contribution.d.ts.map +1 -1
  827. package/dist/server/context.d.ts +2 -2
  828. package/dist/server/context.d.ts.map +1 -1
  829. package/dist/server/contract-method.d.ts.map +1 -1
  830. package/dist/server/create.d.ts +1 -0
  831. package/dist/server/create.d.ts.map +1 -1
  832. package/dist/server/endpoint-dispatch.d.ts.map +1 -1
  833. package/dist/server/endpoint-response.d.ts.map +1 -1
  834. package/dist/server/error-dispatch.d.ts +4 -0
  835. package/dist/server/error-dispatch.d.ts.map +1 -1
  836. package/dist/server/error-hook.d.ts +2 -0
  837. package/dist/server/error-hook.d.ts.map +1 -1
  838. package/dist/server/handler-state.d.ts +16 -2
  839. package/dist/server/handler-state.d.ts.map +1 -1
  840. package/dist/server/implement.d.ts +1 -0
  841. package/dist/server/implement.d.ts.map +1 -1
  842. package/dist/server/local-host.d.ts +47 -0
  843. package/dist/server/local-host.d.ts.map +1 -0
  844. package/dist/server/logger.d.ts +20 -3
  845. package/dist/server/logger.d.ts.map +1 -1
  846. package/dist/server/logging.d.ts +2 -1
  847. package/dist/server/logging.d.ts.map +1 -1
  848. package/dist/server/middleware/cors.d.ts +49 -3
  849. package/dist/server/middleware/cors.d.ts.map +1 -1
  850. package/dist/server/middleware/signed-link.d.ts +42 -0
  851. package/dist/server/middleware/signed-link.d.ts.map +1 -0
  852. package/dist/server/multipart-reader.d.ts +3 -1
  853. package/dist/server/multipart-reader.d.ts.map +1 -1
  854. package/dist/server/multipart.d.ts.map +1 -1
  855. package/dist/server/oauth/cimd.d.ts.map +1 -1
  856. package/dist/server/oauth/endpoints.d.ts.map +1 -1
  857. package/dist/server/openapi.d.ts.map +1 -1
  858. package/dist/server/protocol-outcome.d.ts +17 -0
  859. package/dist/server/protocol-outcome.d.ts.map +1 -0
  860. package/dist/server/raw.d.ts.map +1 -1
  861. package/dist/server/request-completion.d.ts +3 -1
  862. package/dist/server/request-completion.d.ts.map +1 -1
  863. package/dist/server/shutdown.d.ts.map +1 -1
  864. package/dist/server/socket-io-config.d.ts +1 -1
  865. package/dist/server/socket-io-config.d.ts.map +1 -1
  866. package/dist/server/streaming-route.d.ts.map +1 -1
  867. package/dist/server/types.d.ts +20 -11
  868. package/dist/server/types.d.ts.map +1 -1
  869. package/dist/server/unix-client-body.d.ts +4 -1
  870. package/dist/server/unix-client-body.d.ts.map +1 -1
  871. package/dist/server/unix-client-bun.d.ts.map +1 -1
  872. package/dist/server/unix-client.d.ts +1 -1
  873. package/dist/server/unix-client.d.ts.map +1 -1
  874. package/dist/service-host/artifact-activation.d.ts +58 -0
  875. package/dist/service-host/artifact-activation.d.ts.map +1 -0
  876. package/dist/service-host/artifact-manifest.d.ts +68 -0
  877. package/dist/service-host/artifact-manifest.d.ts.map +1 -0
  878. package/dist/service-host/artifact.d.ts +43 -0
  879. package/dist/service-host/artifact.d.ts.map +1 -0
  880. package/dist/service-host/config-reloader-contract.d.ts +66 -0
  881. package/dist/service-host/config-reloader-contract.d.ts.map +1 -0
  882. package/dist/service-host/config-reloader-helpers.d.ts +32 -0
  883. package/dist/service-host/config-reloader-helpers.d.ts.map +1 -0
  884. package/dist/service-host/config-reloader-source.d.ts +47 -0
  885. package/dist/service-host/config-reloader-source.d.ts.map +1 -0
  886. package/dist/service-host/config-reloader.d.ts +6 -0
  887. package/dist/service-host/config-reloader.d.ts.map +1 -0
  888. package/dist/service-host/host-adapter.d.ts +72 -0
  889. package/dist/service-host/host-adapter.d.ts.map +1 -0
  890. package/dist/service-host/identity-unix-socket.d.ts +101 -0
  891. package/dist/service-host/identity-unix-socket.d.ts.map +1 -0
  892. package/dist/service-host/identity.d.ts +117 -0
  893. package/dist/service-host/identity.d.ts.map +1 -0
  894. package/dist/service-host/launchd-plist.d.ts +77 -0
  895. package/dist/service-host/launchd-plist.d.ts.map +1 -0
  896. package/dist/service-host/launchd-render.d.ts +91 -0
  897. package/dist/service-host/launchd-render.d.ts.map +1 -0
  898. package/dist/service-host/launchd.d.ts +82 -0
  899. package/dist/service-host/launchd.d.ts.map +1 -0
  900. package/dist/service-host/macos/bundle-plist.d.ts +50 -0
  901. package/dist/service-host/macos/bundle-plist.d.ts.map +1 -0
  902. package/dist/service-host/macos/bundle.d.ts +66 -0
  903. package/dist/service-host/macos/bundle.d.ts.map +1 -0
  904. package/dist/service-host/macos/codesign.d.ts +95 -0
  905. package/dist/service-host/macos/codesign.d.ts.map +1 -0
  906. package/dist/service-host/macos/icon.d.ts +93 -0
  907. package/dist/service-host/macos/icon.d.ts.map +1 -0
  908. package/dist/service-host/macos/launch-services.d.ts +88 -0
  909. package/dist/service-host/macos/launch-services.d.ts.map +1 -0
  910. package/dist/service-host/macos/launcher.d.ts +59 -0
  911. package/dist/service-host/macos/launcher.d.ts.map +1 -0
  912. package/dist/service-host/macos/responsibility.d.ts +90 -0
  913. package/dist/service-host/macos/responsibility.d.ts.map +1 -0
  914. package/dist/service-host/macos/runner.d.ts +69 -0
  915. package/dist/service-host/macos/runner.d.ts.map +1 -0
  916. package/dist/service-host/plist-xml.d.ts +48 -0
  917. package/dist/service-host/plist-xml.d.ts.map +1 -0
  918. package/dist/service-host/process-evidence.d.ts +17 -0
  919. package/dist/service-host/process-evidence.d.ts.map +1 -0
  920. package/dist/service-host/systemd-inspect.d.ts +126 -0
  921. package/dist/service-host/systemd-inspect.d.ts.map +1 -0
  922. package/dist/service-host/systemd-links.d.ts +23 -0
  923. package/dist/service-host/systemd-links.d.ts.map +1 -0
  924. package/dist/service-host/systemd-render.d.ts +93 -0
  925. package/dist/service-host/systemd-render.d.ts.map +1 -0
  926. package/dist/service-host/systemd.d.ts +50 -0
  927. package/dist/service-host/systemd.d.ts.map +1 -0
  928. package/dist/spend/attribution.d.ts +17 -0
  929. package/dist/spend/attribution.d.ts.map +1 -0
  930. package/dist/spend/coverage-guard.d.ts +60 -0
  931. package/dist/spend/coverage-guard.d.ts.map +1 -0
  932. package/dist/spend/coverage-lexer.d.ts +20 -0
  933. package/dist/spend/coverage-lexer.d.ts.map +1 -0
  934. package/dist/spend/facts.d.ts +23 -0
  935. package/dist/spend/facts.d.ts.map +1 -0
  936. package/dist/spend/gateway-stream.d.ts +25 -0
  937. package/dist/spend/gateway-stream.d.ts.map +1 -0
  938. package/dist/spend/gateway.d.ts +64 -0
  939. package/dist/spend/gateway.d.ts.map +1 -0
  940. package/dist/spend/receipt-merge.d.ts +13 -0
  941. package/dist/spend/receipt-merge.d.ts.map +1 -0
  942. package/dist/spend/receipt-spool.d.ts +35 -0
  943. package/dist/spend/receipt-spool.d.ts.map +1 -0
  944. package/dist/spend/reconcile.d.ts +45 -0
  945. package/dist/spend/reconcile.d.ts.map +1 -0
  946. package/dist/spend/schemas.d.ts +249 -0
  947. package/dist/spend/schemas.d.ts.map +1 -0
  948. package/dist/sync/outbox.d.ts +131 -0
  949. package/dist/sync/outbox.d.ts.map +1 -0
  950. package/dist/sync/overlay.d.ts +59 -0
  951. package/dist/sync/overlay.d.ts.map +1 -0
  952. package/dist/sync/protocol.d.ts +132 -0
  953. package/dist/sync/protocol.d.ts.map +1 -0
  954. package/dist/sync/server-store-check.d.ts +10 -0
  955. package/dist/sync/server-store-check.d.ts.map +1 -0
  956. package/dist/sync/server-store-memory.d.ts +14 -0
  957. package/dist/sync/server-store-memory.d.ts.map +1 -0
  958. package/dist/sync/server-store-postgres.d.ts +25 -0
  959. package/dist/sync/server-store-postgres.d.ts.map +1 -0
  960. package/dist/sync/server-store.d.ts +139 -0
  961. package/dist/sync/server-store.d.ts.map +1 -0
  962. package/dist/sync/session-machine.d.ts +79 -0
  963. package/dist/sync/session-machine.d.ts.map +1 -0
  964. package/dist/sync/session-snapshot.d.ts +19 -0
  965. package/dist/sync/session-snapshot.d.ts.map +1 -0
  966. package/dist/sync/session-steps.d.ts +15 -0
  967. package/dist/sync/session-steps.d.ts.map +1 -0
  968. package/dist/sync/session.d.ts +142 -0
  969. package/dist/sync/session.d.ts.map +1 -0
  970. package/dist/sync/tombstones.d.ts +53 -0
  971. package/dist/sync/tombstones.d.ts.map +1 -0
  972. package/dist/telegram/bot-api.d.ts.map +1 -1
  973. package/dist/telegram/broadcast-failure.d.ts.map +1 -1
  974. package/dist/telegram/budget-transformer.d.ts.map +1 -1
  975. package/dist/telegram/crypto.d.ts +2 -10
  976. package/dist/telegram/crypto.d.ts.map +1 -1
  977. package/dist/telegram/html/markdown-inline.d.ts +19 -0
  978. package/dist/telegram/html/markdown-inline.d.ts.map +1 -0
  979. package/dist/telegram/html/markdown-lines.d.ts +51 -0
  980. package/dist/telegram/html/markdown-lines.d.ts.map +1 -0
  981. package/dist/telegram/html/markdown-split.d.ts +49 -0
  982. package/dist/telegram/html/markdown-split.d.ts.map +1 -0
  983. package/dist/telegram/html/markdown.d.ts +14 -0
  984. package/dist/telegram/html/markdown.d.ts.map +1 -0
  985. package/dist/telegram/html/nodes.d.ts +26 -4
  986. package/dist/telegram/html/nodes.d.ts.map +1 -1
  987. package/dist/telegram/html/parse.d.ts.map +1 -1
  988. package/dist/telegram/html/render.d.ts.map +1 -1
  989. package/dist/telegram/init-data.d.ts.map +1 -1
  990. package/dist/telegram/local-files.d.ts.map +1 -1
  991. package/dist/telegram/operator-channel.d.ts +15 -2
  992. package/dist/telegram/operator-channel.d.ts.map +1 -1
  993. package/dist/telegram/outbound-budget.d.ts.map +1 -1
  994. package/dist/telegram/outbound-cost.d.ts +9 -1
  995. package/dist/telegram/outbound-cost.d.ts.map +1 -1
  996. package/dist/telegram/outbound-queue.d.ts +2 -1
  997. package/dist/telegram/outbound-queue.d.ts.map +1 -1
  998. package/dist/telegram/screens/outcome.d.ts.map +1 -1
  999. package/dist/telegram/send-failure.d.ts.map +1 -1
  1000. package/dist/telegram/transport-connect.d.ts.map +1 -1
  1001. package/dist/telegram/transport.d.ts.map +1 -1
  1002. package/dist/telegram/update-intake.d.ts.map +1 -1
  1003. package/dist/telegram/update-store-postgres.d.ts +2 -2
  1004. package/dist/telegram/update-store-postgres.d.ts.map +1 -1
  1005. package/dist/telegram/webhook.d.ts.map +1 -1
  1006. package/dist/testing/managed-resource-conformance.d.ts.map +1 -1
  1007. package/dist/testing/surface-conformance.d.ts.map +1 -1
  1008. package/dist/testing/surface-manifest.d.ts +2 -0
  1009. package/dist/testing/surface-manifest.d.ts.map +1 -1
  1010. package/dist/tools/access.d.ts +34 -0
  1011. package/dist/tools/access.d.ts.map +1 -0
  1012. package/dist/tools/agent.d.ts +14 -6
  1013. package/dist/tools/agent.d.ts.map +1 -1
  1014. package/dist/tools/cli/args-classify.d.ts +154 -0
  1015. package/dist/tools/cli/args-classify.d.ts.map +1 -0
  1016. package/dist/tools/cli/args-fields.d.ts +14 -7
  1017. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  1018. package/dist/tools/cli/args-json.d.ts +1 -1
  1019. package/dist/tools/cli/args-json.d.ts.map +1 -1
  1020. package/dist/tools/cli/args-route.d.ts +4 -48
  1021. package/dist/tools/cli/args-route.d.ts.map +1 -1
  1022. package/dist/tools/cli/args-scan.d.ts +70 -0
  1023. package/dist/tools/cli/args-scan.d.ts.map +1 -0
  1024. package/dist/tools/cli/args-tokens.d.ts +2 -1
  1025. package/dist/tools/cli/args-tokens.d.ts.map +1 -1
  1026. package/dist/tools/cli/args.d.ts +31 -19
  1027. package/dist/tools/cli/args.d.ts.map +1 -1
  1028. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  1029. package/dist/tools/cli/command-shape.d.ts +5 -0
  1030. package/dist/tools/cli/command-shape.d.ts.map +1 -1
  1031. package/dist/tools/cli/command.d.ts +57 -2
  1032. package/dist/tools/cli/command.d.ts.map +1 -1
  1033. package/dist/tools/cli/config.d.ts +15 -58
  1034. package/dist/tools/cli/config.d.ts.map +1 -1
  1035. package/dist/tools/cli/create-cli.d.ts +7 -3
  1036. package/dist/tools/cli/create-cli.d.ts.map +1 -1
  1037. package/dist/tools/cli/format.d.ts.map +1 -1
  1038. package/dist/tools/cli/help.d.ts.map +1 -1
  1039. package/dist/tools/cli/invoke.d.ts +70 -20
  1040. package/dist/tools/cli/invoke.d.ts.map +1 -1
  1041. package/dist/tools/cli/io.d.ts.map +1 -1
  1042. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  1043. package/dist/tools/cli/notices.d.ts.map +1 -1
  1044. package/dist/tools/cli/policy.d.ts +66 -10
  1045. package/dist/tools/cli/policy.d.ts.map +1 -1
  1046. package/dist/tools/cli/prepare.d.ts +5 -4
  1047. package/dist/tools/cli/prepare.d.ts.map +1 -1
  1048. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  1049. package/dist/tools/cli/run-native.d.ts.map +1 -1
  1050. package/dist/tools/cli/run-stream.d.ts.map +1 -1
  1051. package/dist/tools/cli/runner.d.ts +28 -0
  1052. package/dist/tools/cli/runner.d.ts.map +1 -0
  1053. package/dist/tools/cli/session.d.ts +12 -6
  1054. package/dist/tools/cli/session.d.ts.map +1 -1
  1055. package/dist/tools/cli/stream-surface.d.ts.map +1 -1
  1056. package/dist/tools/cli/stream.d.ts.map +1 -1
  1057. package/dist/tools/cli/unavailable.d.ts +2 -0
  1058. package/dist/tools/cli/unavailable.d.ts.map +1 -1
  1059. package/dist/tools/cli/unix-outcome.d.ts +8 -0
  1060. package/dist/tools/cli/unix-outcome.d.ts.map +1 -0
  1061. package/dist/tools/cli/update.d.ts.map +1 -1
  1062. package/dist/tools/cli/view-columns.d.ts +18 -0
  1063. package/dist/tools/cli/view-columns.d.ts.map +1 -0
  1064. package/dist/tools/cli/view.d.ts.map +1 -1
  1065. package/dist/tools/connections/define.d.ts.map +1 -1
  1066. package/dist/tools/connections/foreign-schema-join.d.ts +28 -0
  1067. package/dist/tools/connections/foreign-schema-join.d.ts.map +1 -0
  1068. package/dist/tools/connections/foreign-schema.d.ts +9 -0
  1069. package/dist/tools/connections/foreign-schema.d.ts.map +1 -0
  1070. package/dist/tools/connections/limits.d.ts +1 -1
  1071. package/dist/tools/connections/limits.d.ts.map +1 -1
  1072. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  1073. package/dist/tools/connections/mcp.d.ts.map +1 -1
  1074. package/dist/tools/connections/openapi.d.ts.map +1 -1
  1075. package/dist/tools/connections/runtime.d.ts +18 -6
  1076. package/dist/tools/connections/runtime.d.ts.map +1 -1
  1077. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  1078. package/dist/tools/connections/types.d.ts +12 -2
  1079. package/dist/tools/connections/types.d.ts.map +1 -1
  1080. package/dist/tools/execute.d.ts.map +1 -1
  1081. package/dist/tools/internal/expose.d.ts +6 -0
  1082. package/dist/tools/internal/expose.d.ts.map +1 -0
  1083. package/dist/tools/internal/json-projection.d.ts +17 -0
  1084. package/dist/tools/internal/json-projection.d.ts.map +1 -0
  1085. package/dist/tools/internal/surface-projector.d.ts +18 -4
  1086. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  1087. package/dist/tools/invoker.d.ts +9 -2
  1088. package/dist/tools/invoker.d.ts.map +1 -1
  1089. package/dist/tools/lifecycle.d.ts +8 -2
  1090. package/dist/tools/lifecycle.d.ts.map +1 -1
  1091. package/dist/tools/list-names.d.ts +1 -1
  1092. package/dist/tools/list-names.d.ts.map +1 -1
  1093. package/dist/tools/manifest.d.ts +2 -0
  1094. package/dist/tools/manifest.d.ts.map +1 -1
  1095. package/dist/tools/mcp/handler.d.ts.map +1 -1
  1096. package/dist/tools/mcp/mount.d.ts +26 -14
  1097. package/dist/tools/mcp/mount.d.ts.map +1 -1
  1098. package/dist/tools/mcp/prepare.d.ts +2 -0
  1099. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  1100. package/dist/tools/mcp/register.d.ts.map +1 -1
  1101. package/dist/tools/mcp/runtime-tools.d.ts +1 -1
  1102. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  1103. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  1104. package/dist/tools/mount.d.ts +7 -2
  1105. package/dist/tools/mount.d.ts.map +1 -1
  1106. package/dist/tools/native-definition.d.ts +1 -1
  1107. package/dist/tools/native-definition.d.ts.map +1 -1
  1108. package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -2
  1109. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  1110. package/dist/tools/operations/async-operation-runtime-types.d.ts +1 -1
  1111. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  1112. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
  1113. package/dist/tools/operations/mount-wait.d.ts.map +1 -1
  1114. package/dist/tools/operations/wait-core.d.ts.map +1 -1
  1115. package/dist/tools/read-operation.d.ts +6 -4
  1116. package/dist/tools/read-operation.d.ts.map +1 -1
  1117. package/dist/tools/registry.d.ts.map +1 -1
  1118. package/dist/tools/runtime-tool-declaration.d.ts +4 -1
  1119. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -1
  1120. package/dist/tools/runtime-tool.d.ts +6 -1
  1121. package/dist/tools/runtime-tool.d.ts.map +1 -1
  1122. package/dist/tools/schema/coerce.d.ts.map +1 -1
  1123. package/dist/tools/schema/inline-references.d.ts +7 -0
  1124. package/dist/tools/schema/inline-references.d.ts.map +1 -0
  1125. package/dist/tools/schema/json-schema-origin.d.ts +1 -1
  1126. package/dist/tools/schema/json-schema-origin.d.ts.map +1 -1
  1127. package/dist/tools/schema/presentation.d.ts +6 -0
  1128. package/dist/tools/schema/presentation.d.ts.map +1 -1
  1129. package/dist/tools/schema/schema.d.ts +2 -0
  1130. package/dist/tools/schema/schema.d.ts.map +1 -1
  1131. package/dist/tools/schema/untyped-properties.d.ts.map +1 -1
  1132. package/dist/tools/surface.d.ts.map +1 -1
  1133. package/dist/tools/toolkit.d.ts +6 -3
  1134. package/dist/tools/toolkit.d.ts.map +1 -1
  1135. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
  1136. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
  1137. package/dist/tools/transfer/define-view-file-tool.d.ts +2 -1
  1138. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
  1139. package/dist/tools/transfer/mount-download.d.ts.map +1 -1
  1140. package/dist/tools/transfer/view-file-contract.d.ts +2 -2
  1141. package/dist/tools/transfer/view-file.d.ts +1 -2
  1142. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  1143. package/dist/tracking/client.d.ts +0 -13
  1144. package/dist/tracking/client.d.ts.map +1 -1
  1145. package/dist/tracking/delivery.d.ts.map +1 -1
  1146. package/dist/tracking/performance/collector.d.ts.map +1 -1
  1147. package/llms/agent-executor-acp.txt +51 -0
  1148. package/llms/agent-executor-claude-sdk.txt +31 -0
  1149. package/llms/agent-executor-claude.txt +29 -0
  1150. package/llms/agent-executor-codex.txt +25 -0
  1151. package/llms/agent-executor-testing.txt +26 -0
  1152. package/llms/agent-executor.txt +40 -0
  1153. package/llms/agent-runtime-harness.txt +68 -5
  1154. package/llms/agent-runtime-openrouter.txt +8 -2
  1155. package/llms/agent-runtime-postgres.txt +30 -0
  1156. package/llms/agent-runtime-react.txt +1 -1
  1157. package/llms/agent-runtime-realtime.txt +1 -1
  1158. package/llms/agent-runtime-sandbox.txt +5 -2
  1159. package/llms/agent-runtime-sqlite-bun.txt +2 -2
  1160. package/llms/agent-runtime-sqlite-node.txt +2 -2
  1161. package/llms/agent-runtime-testing.txt +2 -1
  1162. package/llms/agent-runtime.2.txt +475 -496
  1163. package/llms/agent-runtime.3.txt +229 -267
  1164. package/llms/agent-runtime.4.txt +23 -242
  1165. package/llms/agent-runtime.5.txt +1 -1
  1166. package/llms/agent-runtime.txt +551 -2
  1167. package/llms/application-diagnostic-journal.txt +2 -0
  1168. package/llms/application.2.txt +3 -0
  1169. package/llms/application.3.txt +30 -7
  1170. package/llms/application.txt +4 -1
  1171. package/llms/cli.2.txt +259 -99
  1172. package/llms/cli.3.txt +90 -0
  1173. package/llms/cli.txt +95 -184
  1174. package/llms/contract.txt +7 -6
  1175. package/llms/declaration.txt +1 -1
  1176. package/llms/files.txt +11 -0
  1177. package/llms/handler.txt +25 -0
  1178. package/llms/http.txt +18 -1
  1179. package/llms/live.txt +28 -1
  1180. package/llms/node.txt +3 -2
  1181. package/llms/observability.2.txt +105 -0
  1182. package/llms/observability.txt +14 -90
  1183. package/llms/primitives.txt +27 -0
  1184. package/llms/process.2.txt +2 -2
  1185. package/llms/process.txt +10 -9
  1186. package/llms/realtime.txt +11 -0
  1187. package/llms/server.2.txt +355 -0
  1188. package/llms/server.3.txt +2 -1
  1189. package/llms/server.4.txt +45 -6
  1190. package/llms/server.5.txt +9 -2
  1191. package/llms/server.txt +185 -255
  1192. package/llms/service-host-macos.txt +53 -0
  1193. package/llms/service-host.txt +69 -0
  1194. package/llms/spend-testing.txt +21 -0
  1195. package/llms/spend.txt +173 -0
  1196. package/llms/stitchkit.2.txt +368 -42
  1197. package/llms/stitchkit.3.txt +164 -13
  1198. package/llms/stitchkit.txt +95 -417
  1199. package/llms/sync-postgres.txt +31 -0
  1200. package/llms/sync.txt +396 -0
  1201. package/llms/telegram-html.txt +4 -1
  1202. package/llms/telegram.2.txt +4 -4
  1203. package/llms/telegram.txt +105 -14
  1204. package/llms/testing.txt +4 -3
  1205. package/llms/tools-connections.txt +4 -4
  1206. package/llms/tools.2.txt +78 -17
  1207. package/llms/tools.3.txt +12 -8
  1208. package/llms/tools.txt +85 -78
  1209. package/llms/{upgrading-0.106.0-0.125.0.txt → upgrading-0.106.0-0.126.0.txt} +42 -3
  1210. package/llms/upgrading-0.127.0.txt +1059 -0
  1211. package/llms/upgrading.txt +2 -1
  1212. package/llms-full.txt +3692 -518
  1213. package/llms.txt +45 -29
  1214. package/native/darwin-arm64.node +0 -0
  1215. package/native/darwin-x64.node +0 -0
  1216. package/native-assets.json +4 -4
  1217. package/package.json +69 -11
  1218. package/dist/agent-runtime/sandbox-coding.d.ts.map +0 -1
  1219. package/dist/agent-runtime/sqlite-events.d.ts +0 -5
  1220. package/dist/agent-runtime/sqlite-events.d.ts.map +0 -1
  1221. package/dist/agent-runtime/sqlite-history.d.ts +0 -7
  1222. package/dist/agent-runtime/sqlite-history.d.ts.map +0 -1
  1223. package/dist/agent-runtime/sqlite-ledger.d.ts +0 -7
  1224. package/dist/agent-runtime/sqlite-ledger.d.ts.map +0 -1
  1225. package/dist/agent-runtime/sqlite-reads.d.ts +0 -14
  1226. package/dist/agent-runtime/sqlite-reads.d.ts.map +0 -1
  1227. package/dist/agent-runtime/sqlite-rows.d.ts.map +0 -1
  1228. package/dist/agent-runtime/tool-progress.d.ts.map +0 -1
  1229. package/dist/entrypoints/application/schemas.d.ts +0 -15
  1230. package/dist/entrypoints/application/schemas.d.ts.map +0 -1
  1231. package/dist/entrypoints/application/schemas.js +0 -27
  1232. package/dist/index-0s4xebbg.js +0 -8
  1233. package/dist/index-5dmk54h9.js +0 -256
  1234. package/dist/index-7cn66qdk.js +0 -92
  1235. package/dist/index-8x0q6yfb.js +0 -247
  1236. package/dist/index-a5qr2rj6.js +0 -26
  1237. package/dist/index-b0kddvzw.js +0 -35
  1238. package/dist/index-cj5f0x4y.js +0 -1150
  1239. package/dist/index-drcjjhy1.js +0 -40
  1240. package/dist/index-eemvahkc.js +0 -21
  1241. package/dist/index-gfk7nrht.js +0 -0
  1242. package/dist/index-jp2qd9jb.js +0 -108
  1243. package/dist/index-nx6eazt0.js +0 -160
  1244. package/dist/index-wxadzdb7.js +0 -55
  1245. package/dist/internal/until-aborted.d.ts +0 -9
  1246. package/dist/internal/until-aborted.d.ts.map +0 -1
  1247. package/dist/server/unix-client-error.d.ts +0 -9
  1248. package/dist/server/unix-client-error.d.ts.map +0 -1
  1249. package/llms/application-schemas.txt +0 -42
package/CHANGELOG.md CHANGED
@@ -15,6 +15,1712 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.127.0] - 2026-11-25
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ **Who must act:** every caller of `branchConversation` that passes `applicationKeys`
23
+ ([migration](docs/guide/upgrading.md#branch-application-key-modes)), every host that
24
+ creates a built-in runtime tool, a child manager or a schedule service
25
+ ([migration](docs/guide/upgrading.md#runtime-tools-take-the-run)), every caller
26
+ that reads `agentUsageProjection`
27
+ ([migration](docs/guide/upgrading.md#agent-usage-projection-v2)), every caller
28
+ of `createSessionCredentials`
29
+ ([migration](docs/guide/upgrading.md#session-credentials-refresh-ahead)), and
30
+ every runtime reading `RequestContext.startedAt` or running on Node `< 22.3` /
31
+ Bun `< 1.4` ([migration](docs/guide/upgrading.md#portable-handler-and-runtime-floor)),
32
+ and every caller passing `cost` to `agentChildBudgetStopPolicy` or reading
33
+ `AgentStepFinishedEvent.response` as always present
34
+ ([migration](docs/guide/upgrading.md#step-spend-and-child-budget-policy)),
35
+ and CLI/connection callers affected by broken boolean boundaries, pre-call view
36
+ column checks, native view handling, `createCliInvoker` global option errors or
37
+ top-level foreign schema unions
38
+ ([migration](docs/guide/upgrading.md#cli-broken-boolean-boundary)),
39
+ every host that mounts discovered MCP or OpenAPI tools whose schemas carry
40
+ non-standard keywords
41
+ ([migration](docs/guide/upgrading.md#connections-unknown-schema-keywords)),
42
+ every server and client on a unix socket outside a directory its own user owns
43
+ ([migration](docs/guide/upgrading.md#unix-socket-ownership-checks)),
44
+ every reader of `tool-status` events
45
+ ([migration](docs/guide/upgrading.md#durable-tool-status)), every SQLite companion
46
+ host caller ([migration](docs/guide/upgrading.md#companions-take-the-host)), every
47
+ custom `AgentRuntimeStore` driver
48
+ ([migration](docs/guide/upgrading.md#store-driver-contract-step-2)), every caller of
49
+ `openRouterProvider` passing policy keys in `extraBody`
50
+ ([migration](docs/guide/upgrading.md#openrouter-extra-body-policy-keys)),
51
+ and every project affected by the planned `0.127.0` breaking boundary cleanup
52
+ (`access: { gate } | { open }`, `transports` → `expose`, `CliConfig.commandSettings`,
53
+ removal of `appError` and `stitchkit/application/schemas`, sandbox-probe relocation,
54
+ store driver contract step 1, async `listSchedules`, and discovered MCP `structuredContent`
55
+ — [migration](docs/guide/upgrading.md#application-schemas-and-renames)), callers
56
+ switching exhaustively on `NativeCommandError.reason`
57
+ ([migration](docs/guide/upgrading.md#native-command-stdin-budget-reason)) or mapping every
58
+ `StitchErrorCode` ([migration](docs/guide/upgrading.md#discovered-mcp-structured-content)) or
59
+ `UnixClientTransportErrorCode` ([migration](docs/guide/upgrading.md#unix-socket-ownership-checks)), every
60
+ caller of `listChildBlocking`, of `respondToChildBlocking` or `sendMessage` on a slow
61
+ child host, or of two `spawnChild` of one id at once
62
+ ([migration](docs/guide/upgrading.md#child-blocking-unavailable)), every entry point
63
+ that calls `routeCliArgv` with a default command, parses a pure boolean with
64
+ `parseCliArgs`, branches on the exit code of an unknown command or declares native
65
+ commands `createCli` refuses to `createCliInvoker`
66
+ ([migration](docs/guide/upgrading.md#cli-public-projections)), every CLI that declares a
67
+ command named in option syntax or a script that writes a command option before the
68
+ command name ([migration](docs/guide/upgrading.md#cli-option-before-command)), every
69
+ reader of `TelegramOperatorDrop.reason` that switches exhaustively
70
+ ([migration](docs/guide/upgrading.md#operator-channel-flood-wait)), every caller that
71
+ catches the refusal of an out-of-range timer option — `reconcileTimeoutMs`, a
72
+ connection `timeoutMs` / `idleTimeoutMs`, a streaming route `heartbeatMs`, an
73
+ observability drain `timeoutMs`, a conformance `watchdogTimeoutMs`, a surface probe
74
+ `timeoutMs`, a realtime request `timeoutMs`, `authorizationTimeoutMs`, an HTTP client,
75
+ endpoint or request `timeout`, `reconnectOnServerDisconnect`, `uploadInChunks`'
76
+ `retryDelayMs`, a `BackoffPolicy`, a cache bridge `freshWindow`, a managed file
77
+ boundary `inspectionTimeoutMs`, a unix client `headersTimeoutMs`, a credit window wait
78
+ `timeoutMs`, an agent session or runtime `close` budget, a Telegram update intake
79
+ `leaseMs` / `sweepEveryMs`, a wait tool `defaultTimeout` or a wait `timeoutSec`, and the
80
+ timer options of `stitchkit/application`, `stitchkit/telegram`, `stitchkit/cli`,
81
+ `stitchkit/agent-runtime`, `stitchkit/tools`, `stitchkit/live`, `stitchkit/geo`, `stitchkit/release`
82
+ and `stitchkit/tracking` listed below — by its class, and every caller passing a fractional,
83
+ negative or `NaN` count, size or age to `createChunkSpool` or `createTelegramOperatorChannel`
84
+ ([migration](docs/guide/upgrading.md#timer-options-one-rule)), every script that branches on
85
+ the exit code of a CLI command over a unix socket
86
+ ([migration](docs/guide/upgrading.md#cli-unix-delivery-exit-codes)), every caller of
87
+ `createDeferredAgentToolSurface().mount` that passes `extend` or `flattenUnionInput`
88
+ ([migration](docs/guide/upgrading.md#deferred-surface-projection)), every runtime whose
89
+ `loop.retry.maxAttempts` is not a positive integer
90
+ ([migration](docs/guide/upgrading.md#retry-max-attempts)), and every caller of
91
+ `sanitizeTelegramHtml`, `parseTelegramHtml`, `splitTelegramHtml` or
92
+ `truncateTelegramHtml` that passes links with raw whitespace or a bare `tg:` or
93
+ `mailto:` ([migration](docs/guide/upgrading.md#telegram-html-link-rules)), every caller
94
+ of `splitTelegramHtml` whose markup can hold a custom emoji or a `tg-time` longer than
95
+ its limit ([migration](docs/guide/upgrading.md#telegram-html-split-atom)), every
96
+ `createSpooledSink` whose spool file is past its `maxFileBytes`, that watches `recover()`,
97
+ or whose store can be down for longer than `maxPendingEntries` records
98
+ ([migration](docs/guide/upgrading.md#spool-file-over-its-bound)), and every caller that
99
+ branches on the class of a SQLite store's transaction failure or of a failed
100
+ `createSessionCredentials().login()`
101
+ ([migration](docs/guide/upgrading.md#double-failure-aggregate-error)).
102
+
103
+ - `stitchkit/agent-runtime` `branchConversation` declares each application key
104
+ once with a mode. An application's record of the past — the run that took an
105
+ input, the IDs a read of its own data returned — names the source conversation,
106
+ and a declared key refused it, so such a conversation could not be branched.
107
+ `sourceIdentity: 'retain'` carries a value naming the source conversation, a run
108
+ or a message byte for byte and never as a reference of the destination; a value
109
+ naming a spill, an application file or another runtime identity still refuses,
110
+ as does any source identity under the default `'refuse'`. A key is one of the
111
+ runtime reference names, declared once, and a refusal names the key's path in
112
+ the payload. `applicationKeys: ['messageId']` →
113
+ `applicationKeys: [{ key: 'messageId' }, { key: 'runId', sourceIdentity: 'retain' }]`.
114
+ → ADR 0300
115
+ **Affects:** `stitchkit/agent-runtime` BranchAgentConversationInputSchema(applicationKeys), BranchAgentConversationInput(applicationKeys); `stitchkit/agent-runtime` behaviour
116
+ - `stitchkit/agent-runtime` `createAgentChildTools`, `createAgentScheduleTools`,
117
+ `createAgentStateTools` and `createAgentEventSearchTools` take the run context
118
+ `tools()` receives. The child and schedule tools took the conversation to act
119
+ for from the model's input, so a model that knew another conversation's ID could
120
+ spend its child budget, message or interrupt its children and place or cancel
121
+ its schedules; the state and event search tools took it from a free host
122
+ argument that nothing tied to the run. Every tool now acts for the conversation
123
+ of the run that called it, the model's input carries no conversation address, a
124
+ child of another parent is refused, and a run context no runtime issued is
125
+ refused by the factory. The factories' config types are exported
126
+ (`AgentChildToolsConfig`, `AgentScheduleToolsConfig`, `AgentStateToolsConfig`,
127
+ `AgentEventSearchToolsConfig`).
128
+ `createAgentChildTools(manager)` → `tools: (run) => mountAgent([], { access: { gate: run.toolFenceLifecycle }, runtimeTools: createAgentChildTools({ manager, run }) })`;
129
+ the same `{ …, run }` replaces `service`, `{ conversationId, state }` and
130
+ `{ conversationId, search, store }`. → ADR 0300
131
+ **Affects:** `stitchkit/agent-runtime` createAgentChildTools, createAgentScheduleTools, createAgentStateTools, createAgentEventSearchTools
132
+ - `stitchkit/agent-runtime` `createSqliteAgentChildManager` and the schedule
133
+ service require their limits. The model chose how many children to spawn and,
134
+ without `remainingBudget`, what budget each got; a schedule could repeat every
135
+ millisecond, and a conversation could hold any number of them.
136
+ `remainingBudget` and `maxActiveChildren` are required: a child past the
137
+ limit, a budget that names no limit and a spent parent are refused. The
138
+ service takes `maxActivePerConversation` and `minIntervalMs`. Both limits are
139
+ counted in the transaction that records the row, so they hold between
140
+ processes. The tools add no limits of their own. The remainder's shape is
141
+ exported as `AgentChildRemainingBudget`.
142
+ `createSqliteAgentChildManager({ sqlite, spawn })` →
143
+ `createAgentChildManager({ store: sqlite.store, host: sqlite.host, spawn, remainingBudget, maxActiveChildren: 4 })`;
144
+ `createAgentScheduleService({ sqlite, dispatch })` →
145
+ `createAgentScheduleService({ host: sqlite.host, dispatch, maxActivePerConversation: 20, minIntervalMs: 60_000 })`.
146
+ **Affects:** `stitchkit/agent-runtime` createSqliteAgentChildManager, SqliteAgentChildManagerConfig(remainingBudget, maxActiveChildren), createAgentScheduleService
147
+ - `stitchkit/agent-runtime` `createSqliteAgentSpillStore` no longer takes
148
+ `toolCallId`: the store is created once and serves many calls, so a fixed id
149
+ attributed every spill to one call. Each spill records the call whose output it
150
+ holds. `createSqliteAgentSpillStore({ sqlite, conversationId, toolCallId })` →
151
+ `createAgentSpillStore({ host: sqlite.host, conversationId })`.
152
+ **Affects:** `stitchkit/agent-runtime` createSqliteAgentSpillStore(toolCallId)
153
+ - `stitchkit/agent-runtime`, `stitchkit/agent-runtime/sqlite/bun` and `stitchkit/agent-runtime/sqlite/node` the runtime companions run on a store's companion
154
+ host, on SQLite and on Postgres alike, and their reads return promises.
155
+ They took the SQLite handle and wrote through its raw connection, so they ran
156
+ on SQLite only, and a second store could not have them. The SQLite and
157
+ Postgres stores now give `host`, one transaction of the store with the purge
158
+ check and the event append inside it, and every companion is written once
159
+ against it. `createSqliteAgentChildManager`, `createSqliteAgentSpillStore`,
160
+ `createSqliteAgentProjectionStore` and `createSqliteAgentEventSearch` are
161
+ `createAgentChildManager`, `createAgentSpillStore`,
162
+ `createAgentProjectionStore` and `createAgentEventSearch`, and take
163
+ `{ host }` (the child manager and the projection store `{ store, host }`);
164
+ `SqliteAgentChildManagerConfig` is `AgentChildManagerConfig`. The SQLite
165
+ store's `database` and `transaction` are gone: a companion's row goes through
166
+ `host.transaction(conversationId, work)`, a read through `host.read(work)`.
167
+ `manager.listChildren`, `projections.load` / `list`, a spill store's
168
+ `authorization` / `search` and `service.start()` return promises; await them.
169
+ The event search runs on both: FTS5 on SQLite, a `tsvector` index on
170
+ Postgres (see Added). `AgentCompanionHost`, `AgentCompanionScope`, `AgentSqlSession`,
171
+ `AgentSqlTables` and `AgentSqlValue` are exported for a companion of the
172
+ application's own (the surface of `stitchkit/agent-runtime` grows by five). `createSqliteAgentProjectionStore({ sqlite })` →
173
+ `createAgentProjectionStore({ store: sqlite.store, host: sqlite.host })`;
174
+ `createSqliteAgentEventSearch({ database: sqlite.database })` →
175
+ `createAgentEventSearch({ host: sqlite.host })`;
176
+ `manager.listChildren(parent)` → `await manager.listChildren(parent)`. → ADR 0314
177
+ **Affects:** `stitchkit/agent-runtime` createSqliteAgentChildManager, createSqliteAgentSpillStore, createSqliteAgentProjectionStore, createSqliteAgentEventSearch, SqliteAgentChildManagerConfig, AgentChildManager(listChildren), AgentScheduleService(start); `stitchkit/agent-runtime/sqlite/bun` SqliteAgentRuntimeStore(database, transaction), SqliteStoreTransaction; `stitchkit/agent-runtime/sqlite/node` SqliteAgentRuntimeStore(database, transaction), SqliteStoreTransaction
178
+ - `stitchkit/agent-runtime` `AgentChildManager.listChildBlocking` returns
179
+ `{ pending, unavailable }` instead of the bare pending list. Each live child is
180
+ asked for its blocking events within the stop bound; a child that did not answer
181
+ in time was read as one with nothing pending, and one whose host threw or
182
+ rejected failed the whole list for every sibling. Such a child is now named in
183
+ `unavailable` (`reason: 'timeout'`, or `'failed'` with the `cause` — a throw, a
184
+ rejection or a malformed report), and the other children are still presented.
185
+ `const pending = await children.listChildBlocking(parentId)` →
186
+ `const { pending, unavailable } = await children.listChildBlocking(parentId)`.
187
+ [migration](docs/guide/upgrading.md#child-blocking-unavailable)
188
+ **Affects:** `stitchkit/agent-runtime` AgentChildManager(listChildBlocking), createAgentChildManager(listChildBlocking), createSqliteAgentChildManager(listChildBlocking)
189
+ - `stitchkit/agent-runtime` `createAgentChildManager` gives a child's host 10 s — the
190
+ bound a stop already had — to answer a blocking response or a message:
191
+ `respondToChildBlocking` and `sendMessage` reject when it does not, where they waited
192
+ without end. An unanswered response leaves its request pending to answer again; an
193
+ unanswered message records no `message-sent` event. The bound is fixed, and it ends
194
+ the wait, not the host's work: while an answer or a message that outlived it is still
195
+ with the host, a second answer to that request is refused (`TypeError`) instead of
196
+ being delivered twice, and another message to that child is refused while any
197
+ message that outlived the bound is still with its host — counted one by one, so the
198
+ first of two to land does not lift the guard for the second; one the host takes late
199
+ retires the request, or is journaled as `message-sent`, when it lands. A second
200
+ `spawnChild` of a child id still being spawned is refused with a `TypeError` before
201
+ its host is asked to start it, where both reached the host.
202
+ `await children.sendMessage(parentId, childId, text)` →
203
+ `await children.sendMessage(parentId, childId, text).catch(reportUnreachableChild)`.
204
+ [migration](docs/guide/upgrading.md#child-blocking-unavailable)
205
+ **Affects:** `stitchkit/agent-runtime` AgentChildManager(respondToChildBlocking, sendMessage, spawnChild), createAgentChildManager(behaviour)
206
+ - `stitchkit/agent-runtime` a record id containing NUL (`\0`) is refused by the
207
+ schema. Postgres cannot store it in `text`, so an id the SQLite and memory
208
+ stores accepted failed only on the way into Postgres, in the middle of moving
209
+ an archive. Every store now refuses it alike. `{ conversationId: 'a\0b' }`
210
+ → a different id.
211
+ **Affects:** `stitchkit/agent-runtime` AgentRecordIdSchema, AgentStoreEventEnvelopeSchema, AppendAgentStoreEventSchema
212
+ - `stitchkit/agent-runtime` `agentUsageProjection` (bumped to `version: 2`) folds
213
+ canonical `AgentUsage` records from terminal `runtime/transition` events,
214
+ abandoned `recover` events with checkpointed spend and standalone
215
+ `provider/response` receipts instead of non-existent top-level numeric fields
216
+ that always summed to zero. Its projected state changes from
217
+ `{ inputTokens, outputTokens, cost, sources }` to `{ records, usage }`
218
+ (`AgentUsage` with per-field `provenance`), so unreported tokens and prices stay
219
+ `unavailable` instead of collapsing into zero; persisted `version: 1` rows
220
+ re-fold from sequence 1 on the next `advance()`. A run that did not complete,
221
+ measured nothing and holds no part of a provider answer (a refused connection,
222
+ an oversized context, a cancel before the request) is not a record: it leaves
223
+ the cost of the paid runs around it known.
224
+ `projected.value.inputTokens` / `projected.value.cost` →
225
+ `projected.value.usage.inputTokens.value` / `projected.value.usage.cost?.value`
226
+ (checking `provenance`).
227
+ **Affects:** `stitchkit/agent-runtime` agentUsageProjection
228
+ - `stitchkit` `SessionCredentialsConfig.storage` requires
229
+ `read(): Promise<{ session; credentials } | null>` so `restore()` can
230
+ distinguish an unreadable keychain from an absent session without clearing
231
+ storage or scope.
232
+ `storage: { write, clear }` → `storage: { read, write, clear }`. → ADR 0306
233
+ **Affects:** `stitchkit` createSessionCredentials(storage.read), SessionCredentialsConfig(storage.read)
234
+ - `stitchkit` `createSessionCredentials().refresh()` resolves with the newly
235
+ rotated credentials when post-rotation `storage.write()` fails or times out,
236
+ emits `'storage-failed'` through `onEvent`, retries persistence every
237
+ `storageRetryMs` and refuses to rotate again until flushed; `login()` still
238
+ rejects on storage errors.
239
+ `await expect(auth.refresh(op)).rejects.toThrow('storageTimeoutMs')` →
240
+ `const next = await auth.refresh(op)` and observe `onEvent` (`'storage-failed'`).
241
+ → ADR 0306
242
+ **Affects:** `stitchkit` createSessionCredentials(behaviour), SessionCredentials(refresh)
243
+ - `stitchkit/observability` `RequestContext.startedAt` changes from `bigint`
244
+ (`process.hrtime.bigint()` nanoseconds) to `number` (`performance.now()`
245
+ milliseconds) so the handler pipeline uses one monotonic clock across Node,
246
+ Bun, browsers and React Native / Hermes without `process.hrtime`.
247
+ `Number(process.hrtime.bigint() - ctx.startedAt) / 1e6` →
248
+ `performance.now() - ctx.startedAt`. → ADR 0307
249
+ **Affects:** `stitchkit/observability` RequestContext(startedAt); `stitchkit/server` behaviour; `stitchkit/node` behaviour
250
+ - `stitchkit` Minimum supported runtimes rise from `node >=22` / `bun >=1.2.0`
251
+ to `node >=22.3.0` / `bun >=1.4.0` because `RequestContext` loads
252
+ `AsyncLocalStorage` lazily through `process.getBuiltinModule('async_hooks')`
253
+ instead of statically importing `node:async_hooks`. → ADR 0307
254
+ **Affects:** `stitchkit` behaviour; `stitchkit/observability` behaviour; `stitchkit/server` behaviour; `stitchkit/node` behaviour
255
+ - `stitchkit/agent-runtime` `agentChildBudgetStopPolicy` no longer takes a `cost`
256
+ callback and `AgentStepFinishedEventSchema.response` is now optional. The child
257
+ budget stop policy reads provider-normalized usage (including USD cost from
258
+ adapters such as `openRouterProvider`) through `selectedModel` on
259
+ `AgentRuntimeRunContext`, using the same normalization path as `onStepSpend`,
260
+ while compaction spend emits `step-finished` events without a provider response
261
+ envelope. Every `step-finished` event carries `phase` and `attempt`; a
262
+ `step` or `abandoned-attempt` always names its `modelId`, `provider` and
263
+ `response`, a `compaction` names none of them and carries the number of the
264
+ step it prepared, so model steps are counted by `phase === 'step'`.
265
+ `AgentStepSpendSchema` is the same split as a union on `phase`.
266
+ `agentChildBudgetStopPolicy({ manager, childConversationId, cost })` →
267
+ `agentChildBudgetStopPolicy({ manager, childConversationId })`.
268
+ **Affects:** `stitchkit/agent-runtime` agentChildBudgetStopPolicy(cost), AgentStepFinishedEventSchema(response), AgentStepFinishedEvent(response)
269
+ - `stitchkit/cli` a bare boolean framework flag separated from a trailing `true`
270
+ or `false` token by a stripped command name or application option (e.g.
271
+ `--dry-run inspect false`, `inspect --dry-run --profile demo false`, or before the
272
+ command `--quiet --profile demo true inspect`, which exited `1` with
273
+ `Unknown command "true"`) now
274
+ fails with `CliArgumentError` (exit code 2, zero handler calls) and a hint to
275
+ write `--flag=false` or `-- false`, replacing silent boundary rewriting. A bare
276
+ `--help` or `--schema` parted that way asks for nothing, so the line is refused
277
+ instead of answered: `myapp --schema --profile demo false` exits `2` (it exited
278
+ `1` with `Unknown command "false"`).
279
+ Adjacent `--flag false` remains a boolean value. The projections refuse the
280
+ argv they can no longer write: `routeCliArgv` returns the refusal in `error`
281
+ with an empty `commandArgv`, and `extractCliGlobalOptions` still returns
282
+ `globals` but throws `CliArgumentError` when `argv` is read after a lifted
283
+ global stood between a bare framework boolean and `true` or `false`
284
+ (non-framework option boundaries return in `separatedBefore`). A line that
285
+ starts with `--` names no command: `routeCliArgv` reports `A command is
286
+ required before "--"` instead of `command: "--"`. → ADR 0310
287
+ **Affects:** `stitchkit/cli` parseCliArgs, extractCliGlobalOptions, routeCliArgv, scanCliInvocation; `stitchkit/cli` behaviour
288
+ - `stitchkit/cli` view column flags (`--table`, `--sort`, `--sum`, `--count-by`,
289
+ `--top --by`) are now validated against the output schema before calling the
290
+ handler whenever the schema defines an unambiguous object collection, so an
291
+ unknown column fails with exit code 2 and zero handler calls — including when
292
+ the handler would return an empty collection (previously exit code 0). Open or
293
+ ambiguous output schemas retain post-call validation. → ADR 0310
294
+ **Affects:** `stitchkit/cli` behaviour
295
+ - `stitchkit/cli` native commands now honour view flags (`--table`, `--sort`,
296
+ `--sum`, `--count-by`, `--top`) when they declare an `output` schema and fail
297
+ with exit code 2 (zero handler calls) when view flags are passed to a native
298
+ command without `output`, instead of silently ignoring those flags. → ADR 0310
299
+ **Affects:** `stitchkit/cli` defineCliCommand; `stitchkit/cli` behaviour
300
+ - `stitchkit/cli` `createCliInvoker` now parses global option values through the
301
+ same schema-aware coercer as `createCli` (accepting JSON strings for
302
+ structured globals) and throws `CliArgumentError` on invalid globals instead of
303
+ raw `ZodError`. → ADR 0310
304
+ **Affects:** `stitchkit/cli` createCliInvoker
305
+ - `stitchkit/cli` the public projections read a line with the grammar `createCli` reads it with, so an
306
+ entry point that lifts, routes and parses argv itself (`extractCliGlobalOptions` → `routeCliArgv` →
307
+ `parseCliArgs` → `createCliInvoker`) reaches the same refusal, arguments, exit code and handler calls.
308
+ `routeCliArgv(argv, defaultCommand)` → `routeCliArgv(argv, { defaultCommand, separatedBefore })`: it
309
+ takes the `separatedBefore` that `extractCliGlobalOptions` returned and returns `separatedBefore`
310
+ indexed by `commandArgv`, so `inspect --verbose --profile demo false` parses as
311
+ `{ verbose: true, text: 'false' }` on both paths (it was `{ verbose: false }` through the chain), and a
312
+ separated value option no longer takes the token after the boundary. `extractCliGlobalOptions` keeps a
313
+ `--` that stands before the command in `argv` (it was dropped, so the route ran the command `createCli`
314
+ refuses), and a line answered by help, `--version` or `--schema` reports no application global's error
315
+ (`--profile --help` shows help instead of throwing). `routeCliArgv` returns `error` for a line that
316
+ fails before a command is named (`--json=maybe`). It also returns `error` for every other line
317
+ `createCli` refuses before a command runs, a repeated or malformed framework option on either side of
318
+ the command included (`nosuch --json --json` is that refusal, exit `2`, not an unknown command), unless
319
+ help, `--version` or `--schema` answers the line (`--verbose --schema` lists the commands, as
320
+ `createCli` does). A line help or `--schema` answers is routed even when removing the
321
+ command parts a bare framework boolean from `true` or `false` (`--json inspect true --help`):
322
+ the word is kept apart in `separatedBefore`, so `parseCliArgs` reads `--json` as written and
323
+ answers help, as 0.126 and `createCli` do. `parseCliArgs` refuses a pure boolean written inline
324
+ with a word that is not a boolean (`--verbose=maybe`) with `CliArgumentError`, as `createCli` does,
325
+ instead of leaving the string for Zod; a line that asks for help or `--schema` is still answered, before
326
+ any argument it cannot read (`parseCliArgs(['--verbose=maybe', '--help'], schema).options.help` is
327
+ `true`, with empty `toolArgs`, as it was `true` in 0.126; `-x --help` and `--count abc --help` answer
328
+ help too, where 0.126 threw), and a bare framework boolean that `separatedBefore` parts from
329
+ `true`/`false` is refused instead of read as either. `ParsedCliArgs.options` carries `schema`
330
+ (`--schema`). `createCli` exits `4` (`UNKNOWN_OPERATION`, overridable through `exitCodes`) for an
331
+ unknown command, the code `createCliInvoker` already returned; it exited `1`.
332
+ `routeCliArgv(argv, 'help')` → `routeCliArgv(argv, { defaultCommand: 'help' })`. → ADR 0310
333
+ [migration](docs/guide/upgrading.md#cli-public-projections)
334
+ **Affects:** `stitchkit/cli` routeCliArgv(defaultCommand), CliArgvRoute(separatedBefore), CliRouteOptions, parseCliArgs, CliRunOptions(schema), ParsedCliArgs(options), extractCliGlobalOptions, createCli; `stitchkit/cli` behaviour
335
+ - `stitchkit/cli` `createCliInvoker` checks its native commands as `createCli` does, when it is
336
+ created: a command name declared twice or shared with a managed command, `commandSettings` aliases or
337
+ positionals that name a field the command does not have, and an alias of its passthrough field throw
338
+ instead of being accepted, the later declaration silently replacing the earlier one.
339
+ `invoker.commands` no longer lists a managed command that cannot run (one with an `unavailableReason`).
340
+ `createCliInvoker({ commands: [inspect, inspect] })` → one `inspect`. → ADR 0310
341
+ [migration](docs/guide/upgrading.md#cli-public-projections)
342
+ **Affects:** `stitchkit/cli` createCliInvoker, CliInvoker(commands)
343
+ - `stitchkit/cli` on a CLI without a default command, a command option written where
344
+ the command name belongs (`myapp --verbose inspect`, `myapp --verbose=maybe inspect`)
345
+ is a usage error, exit `2`: "`--verbose is an option of a command, not a command: put
346
+ it after the command name (<command> --verbose)`". It exited `4` with
347
+ `Unknown command "--verbose"`. `createCli` and `routeCliArgv` (as `error`, no
348
+ `command`) answer it alike; help and `--version` still answer such a line, and
349
+ framework options before the command (`myapp --json inspect`) are unchanged. A
350
+ command name in option syntax (`--custom`, `-x`) is now reserved and refused when
351
+ declared: no projection can tell it from an option.
352
+ `myapp --verbose inspect` → `myapp inspect --verbose`. → ADR 0310
353
+ [migration](docs/guide/upgrading.md#cli-option-before-command)
354
+ **Affects:** `stitchkit/cli` createCli, createCliInvoker, routeCliArgv; `stitchkit/cli` behaviour
355
+ - `stitchkit/server` and `stitchkit/node` `createServer({ unix })` and
356
+ `createUnixClientTransport` now reject socket paths exceeding **103 UTF-8
357
+ bytes** (cross-OS `sun_path` limit) and verify parent directory ownership and
358
+ permissions (real directory, not symlink, owner uid, `(mode & 0o022) === 0`);
359
+ `createUnixClientTransport` also verifies the target socket's owner before
360
+ connecting and throws non-retryable `UNIX_TARGET_REFUSED` (`delivery:
361
+ 'not-dispatched'`) on refusal. A socket in a shared directory such as `/tmp`,
362
+ a socket owned by another user and a system daemon's socket under a
363
+ root-owned directory are refused for every caller that is not that owner;
364
+ there is no option that turns the check off.
365
+ Before: `createServer({ unix: '/tmp/app.sock' })`. After:
366
+ `createServer({ unix: join(runtimeDir, 'app.sock') })`, where `runtimeDir` is a
367
+ directory the same user owns with mode `0700`. → ADR 0318
368
+ An exhaustive switch on `UnixClientTransportErrorCode` adds `'UNIX_TARGET_REFUSED'`.
369
+ **Affects:** `stitchkit/server` createServer, createUnixClientTransport, UnixClientTransportErrorCode; `stitchkit/node` createUnixClientTransport, UnixClientTransportErrorCode
370
+ - `stitchkit/tools/connections` a discovered MCP or OpenAPI tool whose input or
371
+ output schema carries a keyword outside JSON Schema draft-07, draft 2020-12
372
+ and the OpenAPI 3.0 Schema Object is no longer mounted: it is reported through
373
+ `onSkippedTool` with the keyword's name. Vendor annotations such as `enumNames`,
374
+ `markdownDescription` and `propertyOrdering` are such keywords, and so are the
375
+ refused `$anchor`, `$dynamicRef` and `$dynamicAnchor`; `x-*` extensions pass.
376
+ A tool that mounted and accepted any value under those keywords is now absent
377
+ until its schema is written in standard keywords. → ADR 0310
378
+ **Affects:** `stitchkit/tools/connections` behaviour
379
+ - `stitchkit/tools/connections` top-level `oneOf`/`anyOf` object schemas in
380
+ discovered MCP and OpenAPI tools now merge their object branches (with any root
381
+ `properties`/`required`, preserving `$schema`) instead of collapsing into an
382
+ unvalidated `z.looseObject({})`, while non-object branches fail closed into
383
+ `onSkippedTool`. A root object schema that carries `allOf`, `minProperties`,
384
+ `maxProperties`, `propertyNames`, `patternProperties`, or `oneOf`/`anyOf` beside
385
+ other keywords keeps its properties, its required fields and those constraints the
386
+ same way, and a root that cannot be read as one object is refused instead of
387
+ accepted. The constraints are checked locally, on every mount, before the call
388
+ reaches the server: an argument that breaks one is refused here, where it was sent.
389
+ [migration](docs/guide/upgrading.md#connections-top-level-union) → ADR 0310
390
+ **Affects:** `stitchkit/tools/connections` behaviour
391
+ - `stitchkit/application` and `stitchkit/application/schemas` removed the redundant
392
+ `stitchkit/application/schemas` entrypoint (all canonical schemas are already
393
+ browser-clean on `stitchkit/application`), renamed `notificationOutboxStateSchema`
394
+ to `createNotificationOutboxStateSchema`, and tightened
395
+ `public-surface-budget.test.ts` to refuse limits or overlaps naming nonexistent
396
+ entrypoints. → ADR 0311
397
+ **Affects:** `stitchkit/application` createNotificationOutboxStateSchema, notificationOutboxStateSchema; `stitchkit/application/schemas` *
398
+ - `stitchkit/telegram` renamed `postgresTelegramUpdateStoreSchema` to
399
+ `postgresTelegramUpdateStoreDdl`. → ADR 0311
400
+ **Affects:** `stitchkit/telegram` postgresTelegramUpdateStoreSchema, postgresTelegramUpdateStoreDdl
401
+ - `stitchkit/telegram/html` decides which `href` stays a link by fixed rules,
402
+ the same in every runtime, instead of the runtime's `URL`: 0.126 called
403
+ `URL.canParse`, which React Native does not have, and React Native's `URL`
404
+ accepts what a WHATWG parser refuses, so one input gave two outputs. An `href`
405
+ is kept when it is trimmed of whitespace and holds no whitespace or control
406
+ character anywhere, its scheme is `http:`, `https:`, `tg:` or `mailto:`, an
407
+ `http:`/`https:` link names a host (a bracketed IPv6 address or a name without
408
+ the characters a host forbids; optional user info; a port up to 65535), and a
409
+ `tg:`/`mailto:` link has something after its scheme. Newly refused, so the
410
+ words stay and the tag goes: an `href` with a raw space or tab inside
411
+ (`https://x.test/a b`, previously percent-encoded or stripped by `URL`), and a
412
+ bare `tg:` or `mailto:`. Newly kept: a dotted host that `URL` refused as an
413
+ invalid IPv4 address (`https://1.2.3.999`), an `xn--` label `URL` could not
414
+ decode, a host with U+FFFD. Encode a space as `%20` before it reaches the
415
+ parser: `<a href="https://x.test/a b">` → `<a href="https://x.test/a%20b">`.
416
+ [migration](docs/guide/upgrading.md#telegram-html-link-rules)
417
+ **Affects:** `stitchkit/telegram/html` parseTelegramHtml(href), sanitizeTelegramHtml(href), splitTelegramHtml(href), truncateTelegramHtml(href)
418
+ - `stitchkit/telegram/html` `splitTelegramHtml` refuses a custom emoji or a
419
+ `tg-time` longer than the limit, which cannot be cut, with a `RangeError`. It
420
+ returned that atom as a part over the limit, followed by an empty part, and
421
+ Telegram refuses both. A custom emoji or a time whose text begins with a space or
422
+ a line break is no longer dropped with the break a cut is made at, leaving an
423
+ empty part: the cut goes before it, and a part whose visible text is blank but
424
+ holds one is sent (`'abcd<tg-emoji emoji-id="1"> xy</tg-emoji> efgh'` at limit 5
425
+ gave `['abcd', '', 'efgh']`, now `['abcd', '<tg-emoji emoji-id="1"> xy</tg-emoji>', 'efgh']`).
426
+ `truncateTelegramHtml` already cut before an atom and is unchanged. `splitTelegramHtml('ab <tg-emoji emoji-id="1">abcdefghij</tg-emoji> cd', { limit: 5 })`:
427
+ `['ab', '<tg-emoji emoji-id="1">abcdefghij</tg-emoji>', '', 'cd']` → `RangeError`;
428
+ pass a limit the longest atom fits in.
429
+ [migration](docs/guide/upgrading.md#telegram-html-split-atom)
430
+ **Affects:** `stitchkit/telegram/html` splitTelegramHtml(limit)
431
+ - `stitchkit/observability` `createSpooledSink` keeps a spool file within
432
+ `maxFileBytes` (default 64 MiB) instead of reading it whole. `recover()` and
433
+ compaction read it line by line, holding at most `maxFileBytes` and
434
+ `maxPendingEntries` of it. A debt that does not fit the bound — a file a long
435
+ outage left under 0.126, or one whose bound was lowered — is moved to
436
+ `<path>.<milliseconds>.overflow`, named by the new `SpoolRecovery.quarantined` and
437
+ reported as `SPOOL_QUARANTINED`; the spool goes on with an empty file, so new
438
+ records are spooled instead of refused behind an old debt. Records of a file too
439
+ large to read within the bound are not offered to the store: the quarantined file
440
+ is owed work, replayed by a spool at its path with a bound it fits. A file over its
441
+ bound is compacted once per process even with nothing delivered. A spool file that
442
+ cannot be read (anything but missing) is no longer answered
443
+ `{ replayed: 0, failed: 0 }`: `recover()` sets `unread: true`, reports
444
+ `SPOOL_UNREADABLE` with the read error as `cause`, and leaves the file as it is. A
445
+ record past `maxPendingEntries` (default 10 000) or `maxFileBytes` is no longer
446
+ spooled — 0.126 spooled every record while the store was down. It is still offered
447
+ to the store; when the store refuses it too it is kept nowhere, and `write` rejects
448
+ with code `SPOOL_UNSPOOLED` and the store's error as `cause`, where a row on disk
449
+ rejects with the store's own error. `onSpoolError` reports `SPOOL_FULL` with the
450
+ bound (`entries` or `bytes`).
451
+ `const { failed } = await sink.recover()` →
452
+ `const { failed, quarantined, unread } = await sink.recover()`.
453
+ [migration](docs/guide/upgrading.md#spool-file-over-its-bound). → ADR 0323
454
+ **Affects:** `stitchkit/observability` createSpooledSink(behaviour), SpooledSink(write), SpoolRecovery(quarantined, unread)
455
+ - `stitchkit` `stitchkit/agent-runtime/sqlite/bun` `stitchkit/agent-runtime/sqlite/node`
456
+ two failures of one operation reject with one `AggregateError` — the first failure
457
+ first in `errors` and as its `cause`, then the second — instead of one of them
458
+ alone. A SQLite store transaction or schema initialization whose `ROLLBACK` fails
459
+ for a reason other than "no transaction is active" threw the rollback's error and
460
+ lost the failure that ended the transaction; the connection could be left inside
461
+ the transaction, and the next `BEGIN` failed for a reason nobody saw.
462
+ `createSessionCredentials().login()` whose storage write fails and whose clear of
463
+ the stored session it replaced fails too rejects with the `AggregateError`, where
464
+ it rejected with the write failure. Code that branches on the class of such a
465
+ rejection reads the first failure from `cause`.
466
+ `catch (error) { if (error instanceof X) … }`
467
+ → `catch (error) { const first = error instanceof AggregateError ? error.cause : error; if (first instanceof X) … }`.
468
+ [migration](docs/guide/upgrading.md#double-failure-aggregate-error). → ADR 0326
469
+ **Affects:** `stitchkit` SessionCredentials(login); `stitchkit/agent-runtime/sqlite/bun` behaviour; `stitchkit/agent-runtime/sqlite/node` behaviour
470
+ - `stitchkit/telegram` the operator channel waits Telegram's `retry_after` only up to
471
+ `maxRetryAfterMs` (new option, default 60 000 ms — the minute over which Telegram
472
+ counts a group's messages). A longer flood wait would hold every queued message
473
+ behind one, so that message is dropped with the new reason `flood-wait` (with its
474
+ classified failure) and the next one is tried at the usual pace. It waited as long
475
+ as Telegram asked. A `switch` over `TelegramOperatorDrop['reason']` gains a case:
476
+ `case 'over-budget':` → `case 'over-budget': case 'flood-wait':`.
477
+ [migration](docs/guide/upgrading.md#operator-channel-flood-wait)
478
+ **Affects:** `stitchkit/telegram` TelegramOperatorDrop(reason), TelegramOperatorChannelConfig(maxRetryAfterMs), createTelegramOperatorChannel; `stitchkit/telegram` behaviour
479
+ - `stitchkit/agent-runtime` relocated the seven process-sandbox probe exports
480
+ (`AgentSandboxGradeSchema`, `AgentSandboxGrade`, `AgentSandboxRestrictionSchema`,
481
+ `AgentSandboxRestriction`, `probeAgentProcessSandbox`,
482
+ `missingSandboxRestrictions`, `recordAgentSandboxProbe`) to
483
+ `stitchkit/agent-runtime/sandbox`. → ADR 0311
484
+ **Affects:** `stitchkit/agent-runtime` probeAgentProcessSandbox, recordAgentSandboxProbe, missingSandboxRestrictions, AgentSandboxGradeSchema, AgentSandboxGrade, AgentSandboxRestrictionSchema, AgentSandboxRestriction
485
+ - `stitchkit`, `stitchkit/contract`, `stitchkit/server` and `stitchkit/node` removed
486
+ `appError`; `new AppError(code, options?)` now derives its default HTTP status from
487
+ `STITCH_ERROR_STATUS[code]` (falling back to `500` when unknown, with explicit
488
+ `status` winning). → ADR 0311
489
+ **Affects:** `stitchkit` AppError, appError; `stitchkit/contract` AppError, appError; `stitchkit/server` AppError, appError; `stitchkit/node` AppError, appError
490
+ - `stitchkit/agent-runtime` and `stitchkit/agent-runtime/testing` store driver
491
+ contract step 1 makes `history.hasMessage` and `events.find` required (removing
492
+ fallback scans) and `AgentScheduleService.listSchedules` async
493
+ (`Promise<readonly AgentSchedule[]>`); `AgentStoreConformanceConfig` now requires
494
+ explicit `capabilities: { branch, planBranch }` and
495
+ `commitConflict: { arm() } | { impossible: 'single-writer' }`. → ADR 0311
496
+ **Affects:** `stitchkit/agent-runtime` AgentScheduleService(listSchedules), AgentRuntimeStoreDriver; `stitchkit/agent-runtime/testing` runAgentStoreConformance, AgentStoreConformanceConfig
497
+ - `stitchkit/agent-runtime` and `stitchkit/agent-runtime/testing` store driver
498
+ contract step 2: a store built by `createAgentRuntimeStore` reports
499
+ `store.capabilities` (`{ archive, historyRestore, purge }`, frozen) for its
500
+ driver's optional members, and an operation that needs a missing one is refused
501
+ with `AgentStoreUnsupportedCapabilityError` (a `TypeError` with `.capability`
502
+ `'archive' | 'historyRestore'`) before it writes. Before, `importConversation`
503
+ without `driver.archive` dropped an archive's spills and companion projections,
504
+ and without `driver.history.restore` it turned compacted baseline rows back into
505
+ active history; `planConversationBranch` answered `ready` for a branch that would
506
+ then fail. A half-implemented `driver.archive` is refused when the store is
507
+ built. The memory store keeps companion projections through import and export.
508
+ `stitchkit/agent-runtime/testing` `capabilities` now also declares `archive` and
509
+ `historyRestore`, compared with `store.capabilities` and proven by behaviour:
510
+ `// before: capabilities: { branch: true, planBranch: true }` →
511
+ `// after: capabilities: { branch: true, planBranch: true, archive: true, historyRestore: true }`.
512
+ → ADR 0311
513
+ **Affects:** `stitchkit/agent-runtime` AgentRuntimeStore(importConversation), AgentRuntimeStore(branchConversation), AgentRuntimeStore(planConversationBranch), createAgentRuntimeStore; `stitchkit/agent-runtime` behaviour; `stitchkit/agent-runtime/testing` runAgentStoreConformance, AgentStoreConformanceConfig
514
+ - `stitchkit/agent-runtime` and `stitchkit/agent-runtime/browser` `tool-status` events
515
+ are durable: each is published right after the checkpoint that holds its call (or
516
+ its result) and carries `eventId` and `snapshotVersion` instead of `runtimeEpoch`
517
+ and `sequence`, so a reader that reconnects finds the call (or its result) in the
518
+ snapshot and the cursor drops a repeat. `// before: { type: 'tool-status', runtimeEpoch, sequence, … }` →
519
+ `// after: { type: 'tool-status', eventId, snapshotVersion, … }`.
520
+ **Affects:** `stitchkit/agent-runtime` AgentToolStatusEventSchema, AgentRuntimeEvent; `stitchkit/agent-runtime/browser` AgentToolStatusEventSchema, AgentRuntimeEvent
521
+ - `stitchkit/tools`, `stitchkit/tools/connections` and `stitchkit/agent-runtime/coding-tools`
522
+ renamed `transports` to `expose` on runtime tool definitions, managed native tool
523
+ factories, async-operation capability maps, `ToolNameEntry.expose`, coding tool
524
+ definitions, and MCP/OpenAPI client connection configs; passing the removed
525
+ `transports` key now throws a `TypeError` at definition/mount time. → ADR 0311
526
+ **Affects:** `stitchkit/tools` defineRuntimeTool, defineDownloadTool, defineUploadTool, defineWaitTool, defineViewFileTool, ToolNameEntry; `stitchkit/tools/connections` defineMcpClientConnection, defineOpenApiConnection, McpClientConnectionConfig, OpenApiConnectionConfig; `stitchkit/agent-runtime/coding-tools` AgentCodingToolDefinition
527
+ - `stitchkit/cli` consolidated top-level `optionAliases`, `positionals`,
528
+ `results`, `passthrough`, and `wait` (and duplicate `lifecycle`) into one typed
529
+ `CliConfig.commandSettings` map (`CliCommandName`, `CliCommandSettings`),
530
+ validated uniformly with runtime `TypeError` on removed top-level keys; CLI
531
+ success output now shares the safe JSON projection used by MCP (`bigint` and
532
+ cycles never crash `JSON.stringify`). `parseCliArgs` takes the same word: its
533
+ `optionAliases` map is `aliases`. → ADR 0311
534
+ **Affects:** `stitchkit/cli` createCli, createCliInvoker, CliConfig, CliInvokerConfig, CliPresentationPolicyConfig(optionAliases, positionals, results), parseCliArgs(optionAliases)
535
+ - `stitchkit/tools/connections`, `stitchkit`, `stitchkit/contract` and `stitchkit/server`
536
+ discovered MCP tools advertising an object `outputSchema` now validate and return `result.structuredContent` across MCP,
537
+ Agent and CLI mounts (charging `outputSchema` bytes to `maxSchemaBytes`) and
538
+ fail loudly with `MCP_STRUCTURED_CONTENT_MISSING` (`502`) when an upstream
539
+ server omits `structuredContent` on a non-error response. For such a tool the
540
+ structured value is the whole answer on every transport: the `content` parts
541
+ the server sent beside it (text, images) are no longer passed through. The
542
+ value is checked with the local verdict its input gets, on every mount (a
543
+ re-exposed MCP tool and an agent tool included), so a format the remote server
544
+ judges (`uri-reference` with a relative path) does not fail the call. The code joins
545
+ `StitchErrorCode` and `STITCH_ERROR_STATUS`, so a map written as
546
+ `satisfies Record<StitchErrorCode, …>` adds `MCP_STRUCTURED_CONTENT_MISSING`. → ADR 0311
547
+ **Affects:** `stitchkit/tools/connections` behaviour; `stitchkit` StitchErrorCode, STITCH_ERROR_STATUS; `stitchkit/contract` StitchErrorCode, STITCH_ERROR_STATUS; `stitchkit/server` StitchErrorCode, STITCH_ERROR_STATUS
548
+ - `stitchkit/tools`, `stitchkit/tools/mcp`, `stitchkit/tools/agent`,
549
+ `stitchkit/tools/invoker`, `stitchkit/tools/toolkit`, `stitchkit/cli` and
550
+ `stitchkit/agent-runtime` replaced optional `lifecycle` with mandatory mount-time
551
+ `access: { gate: ToolGate } | { open: ToolOpenReason; afterHandle? }`
552
+ (`ToolAccess`, `ToolGate`, `ToolOpenReason`) on `mountAgent`, `mountMcp`,
553
+ `buildMcpServer`, `createMcpHandler`, `createStdioMcpServer`, `createToolInvoker`
554
+ (moved from per-call `ToolInvocationOptions`),
555
+ `createDeferredAgentToolSurface().mount`,
556
+ `createToolkit().{mountMcp,mountAgent,createCli}`, and managed
557
+ `createCli` / `createCliInvoker` (native-only CLIs without
558
+ `services`/`runtimeTools` omit `access`), with runtime `TypeError` before the
559
+ first call and stricter `composeToolLifecycle(gate, ...rest): ToolGate` rejecting
560
+ `undefined`. → ADR 0311
561
+ **Affects:** `stitchkit/tools` composeToolLifecycle, createToolInvoker, ToolInvokerConfig, ToolInvocationOptions; `stitchkit/tools/mcp` mountMcp, buildMcpServer, createMcpHandler, createStdioMcpServer; `stitchkit/tools/agent` mountAgent; `stitchkit/tools/invoker` createToolInvoker; `stitchkit/tools/toolkit` createToolkit; `stitchkit/cli` createCli, createCliInvoker, CliConfig, CliInvokerConfig; `stitchkit/agent-runtime` createDeferredAgentToolSurface
562
+ - `stitchkit/agent-runtime` `createDeferredAgentToolSurface` takes the input
563
+ projection (`extend`, `flattenUnionInput`, `inputRecursionDepth`); `mount` refuses
564
+ it with a `TypeError`. The manifest the selector ranked and
565
+ `activation.maxSchemaBytes` measured was built without the projection `mount`
566
+ applied, so the ceiling did not bound the schemas the model received (`extend`
567
+ fields and flattened unions were never counted). The manifest, the ceilings and
568
+ the mount now use the surface's one projection.
569
+ `deferred.mount(runContext, { access, extend, flattenUnionInput: true })`
570
+ → `createDeferredAgentToolSurface({ …, extend, flattenUnionInput: true })` and
571
+ `deferred.mount(runContext, { access })`.
572
+ [migration](docs/guide/upgrading.md#deferred-surface-projection)
573
+ **Affects:** `stitchkit/agent-runtime` createDeferredAgentToolSurface(extend, flattenUnionInput, inputRecursionDepth), DeferredAgentToolMountConfig(extend, flattenUnionInput), DeferredAgentToolCommonConfig
574
+ - `stitchkit/agent-runtime` `createAgentRuntime` refuses a `loop.retry.maxAttempts`
575
+ that is not a positive safe integer, and so does `recordAgentRetryDecision`
576
+ (`TypeError`). `Infinity` retried a retryable provider failure, each attempt paid,
577
+ without end; `NaN`, `0`, a negative number or a fraction silently meant "never
578
+ retry". `loop: { retry: { maxAttempts: 0, delayMs } }`
579
+ → `loop: { retry: { maxAttempts: 1, delayMs } }`.
580
+ [migration](docs/guide/upgrading.md#retry-max-attempts)
581
+ **Affects:** `stitchkit/agent-runtime` createAgentRuntime(loop), recordAgentRetryDecision, AgentRetryPolicy(maxAttempts)
582
+ - `stitchkit/agent-runtime/openrouter` `openRouterProvider(settings, access?)` now
583
+ refuses `settings.extraBody` keys owned by the request policy (`provider`,
584
+ `reasoning`, `session_id`, `usage`) with a `TypeError` so provider-level
585
+ `extraBody` cannot silently overwrite per-request routing, reasoning or usage
586
+ policies.
587
+ `openRouterProvider({ apiKey, extraBody: { provider: { order: ['anthropic'] } } })`
588
+ → `openRouterProvider({ apiKey }, { defaultPolicy: { provider: { order: ['anthropic'] } } })`.
589
+ **Affects:** `stitchkit/agent-runtime/openrouter` openRouterProvider(extraBody)
590
+ - `stitchkit/process` `NativeCommandError.reason` (when `code === 'COMMAND_LIMIT'`)
591
+ adds `'stdin-budget'` for streamed `stdin` (`ReadableStream<Uint8Array>`) in
592
+ `runNativeCommand` and `streamNativeCommand` exceeding `maxStdinBytes`
593
+ (previously thrown as an untyped `Error`). Exhaustive switches on
594
+ `NativeCommandError.reason` must add a `'stdin-budget'` branch.
595
+ `case 'deadline': case 'output-budget':` → `case 'deadline': case 'output-budget': case 'stdin-budget':`.
596
+ **Affects:** `stitchkit/process` NativeCommandError(reason)
597
+ - `stitchkit/tools` and `stitchkit/tools/connections` a timer option is refused by the
598
+ one timer rule every other component uses: an integer from 1 to 2147483647
599
+ milliseconds. `effect(…, { reconcileTimeoutMs })` refused an out-of-range value
600
+ with a `TypeError` and accepted a fraction such as `1.5`; it now refuses both with a
601
+ `RangeError`. A connection's `timeoutMs` and `idleTimeoutMs` that are not numbers
602
+ (a string read from JSON) are a `TypeError` instead of a `RangeError`; numbers out
603
+ of range stay a `RangeError`. Every refusal names the option and the value it
604
+ received. `catch (error) { if (error instanceof TypeError) … } // reconcileTimeoutMs: 0`
605
+ → `catch (error) { if (error instanceof RangeError) … } // reconcileTimeoutMs: 0, 1.5`.
606
+ [migration](docs/guide/upgrading.md#timer-options-one-rule). → ADR 0320
607
+ **Affects:** `stitchkit/tools` EffectRunOptions(reconcileTimeoutMs); `stitchkit/tools/connections` defineMcpClientConnection(timeoutMs, idleTimeoutMs), defineOpenApiConnection(timeoutMs, idleTimeoutMs)
608
+ - `stitchkit` `stitchkit/http` `stitchkit/realtime` `stitchkit/contract` `stitchkit/react`
609
+ `stitchkit/files` `stitchkit/server` `stitchkit/node` `stitchkit/tools`
610
+ `stitchkit/observability` `stitchkit/testing` `stitchkit/application`
611
+ `stitchkit/application/diagnostic-journal` `stitchkit/telegram`
612
+ `stitchkit/telegram/screens` `stitchkit/cli` `stitchkit/agent-runtime`
613
+ `stitchkit/agent-runtime/browser` `stitchkit/agent-runtime/realtime`
614
+ `stitchkit/agent-runtime/testing` `stitchkit/agent-runtime/openrouter` `stitchkit/live`
615
+ `stitchkit/google` `stitchkit/geo` `stitchkit/release` `stitchkit/tracking`
616
+ `stitchkit/tracking/performance` every other timer option follows the same timer
617
+ rule: an integer from 1 (0 for a drain bound, a run timeout or a retry delay) to
618
+ 2147483647 milliseconds, refused before anything starts. A value past 2147483647
619
+ used to pass and fire at once; it is now a `RangeError`. A value these options
620
+ refused with a `TypeError` — 0, a negative or a fractional number — is now a
621
+ `RangeError`: a streaming route's `heartbeatMs` (`sseRoute`, `ndjsonRoute`,
622
+ `streamingRoute`), the drain `timeoutMs` of `createObservability().flush()`/`close()`,
623
+ `runManagedResourceConformance`'s `watchdogTimeoutMs`, `runSurfaceProbes`'
624
+ `timeoutMs` (checked before any driver runs), `createBoundedAdmission`'s
625
+ `drain({ timeoutMs })` and `run(…, { timeoutMs })`, the diagnostic journal's
626
+ `flush`/`close` `timeoutMs`, `createTelegramBotTransport`'s `connectAttemptMs`,
627
+ `connectBudgetMs` and `responseTimeoutMs`, `createAgentRuntime`'s
628
+ `loop.idleTimeoutMs`, a retry policy's `delayMs` result, `createAgentController`'s
629
+ `timeoutMs`, `createAgentRaceBarrier`'s timeout, the `timeoutMs` of
630
+ `openRouterModelCatalog` (now checked when the catalog is created, not on its first
631
+ `load()`) and of `createOpenRouterSpendReconciler`, and `bindAgentHarnessRealtime`'s
632
+ `authorizationTimeoutMs` (now checked before it creates the control server or binds
633
+ the realtime contract), `createManagedFileBoundary`'s `inspectionTimeoutMs` (now
634
+ checked before it binds its root) and `createUnixClientTransport`'s
635
+ `headersTimeoutMs`. The `gracePeriodMs` / `forceTimeoutMs` of `AgentRuntime.close()`
636
+ and `createAgentSessionCoordinator().close()` refused a negative, fractional or `NaN`
637
+ value with a `TypeError` and now with a `RangeError` (0 allowed), still before
638
+ admission closes. `heartbeatMs`, a drain `timeoutMs` and a realtime request
639
+ `timeoutMs` accepted a fraction and now refuse it. A value that is not a number is a
640
+ `TypeError` where it was a `RangeError`: a realtime request `timeoutMs`,
641
+ `ScreenOutcome.notice`'s `expiresInMs`, the `maxWaitMs` call option of
642
+ `telegramOutboundBudget`, `applyCliUpdate`'s `verifyTimeoutMs` and
643
+ `createTelegramUpdateIntake`'s `leaseMs` and `sweepEveryMs`; a number out of range
644
+ stays a `RangeError`. `createCacheBridge`'s `freshWindow` refused a negative or
645
+ non-finite value with a plain `Error`, and a credit window's
646
+ `acquire(bytes, { timeoutMs })` refused with a `ZodError`; both now answer by the
647
+ timer rule (`freshWindow` 0 allowed), a fraction refused too. Options that reached a
648
+ timer with no check are now refused where they are taken, before anything is sent,
649
+ scheduled or opened — 0, a negative, `NaN` or a value past the ceiling used to fire
650
+ at once: `createHttpClient`'s and `createClient`'s `timeout`, a contract endpoint's
651
+ `timeout` (at `defineContract`), a request's `timeout` (before the request is sent),
652
+ `createSocketIOClient`'s `reconnectOnServerDisconnect` (0 allowed) and
653
+ `uploadInChunks`' `retryDelayMs` (0 allowed, before the first part).
654
+ `BackoffPolicySchema` refuses a `minDelayMs` or `maxDelayMs` past the ceiling with
655
+ its `ZodError`. A wait timeout in seconds follows the rule in seconds: `defineWaitTool`
656
+ and `mountWait` refuse a `defaultTimeout` that is negative, not finite or longer than
657
+ 2147483.647 seconds when they are defined, and a wait refuses such a per-call
658
+ `timeoutSec` — from `timeoutFromInput`, `timeoutFromArgs`, `timeoutFromId`,
659
+ `--wait-timeout` or a CLI wait's `timeout` — before its first poll; a fraction and 0
660
+ stay valid. Such a timeout used to abort every poll at once. The download and
661
+ view-file tools (`defineDownloadTool`, `mountDownload`, `defineViewFileTool`,
662
+ `mountViewFile`) refuse `timeoutMs` when they are defined, with a `RangeError`, where
663
+ they refused it at the first fetch with a plain `Error`;
664
+ `createSecureClientMetadataFetcher`'s `timeoutMs`, a contract stream endpoint's
665
+ `lifetimeMs` and `heartbeatMs`, a `defineEvents` topic's `listenerTimeoutMs` and
666
+ `createDecisionPipeline`'s `policyTimeoutMs` are a `RangeError` (a `TypeError` when
667
+ not a number) where they were a plain `Error`, and each refuses a fraction too;
668
+ `applyCliUpdate` refuses `timeoutMs`, `idleTimeoutMs` and `verifyTimeoutMs` before it
669
+ downloads anything (a `verifyTimeoutMs` was checked only after the download).
670
+ `createGoogleOidcClient` keeps answering a bad `timeoutMs` with
671
+ `GoogleOidcError('MISCONFIGURED')`, now also past the range, with the timer refusal as
672
+ its `cause`. More options that reached their timer with no check are refused where
673
+ they are taken: `createWatchClient`'s `holdMs` (0 allowed) and `openTimeoutMs`, before
674
+ a watch opens; `createWatchHub`'s `holdMs` (0 allowed), at construction instead of at
675
+ the first release, and its `backoff`, parsed with `BackoffPolicySchema` at
676
+ construction instead of at the first failed read; `createGeoIpResolver`'s
677
+ `reload.intervalMs`, at creation (an `intervalMs` of 0 or below used to turn reloading
678
+ off silently; `reload: false` does that); `createReleaseWatcher`'s `maxDeferMs`
679
+ (0 allowed); `createTrackingClient`'s `heartbeatMs`, `deliverTrackingBatch`'s
680
+ `retryDelayMs` (0 allowed, before the first request) and
681
+ `createPerformanceCollector`'s `earlyDelayMs` (0 allowed). A schema field that becomes
682
+ a timer states the ceiling: `ShutdownOptionsSchema` (`gracePeriodMs`,
683
+ `realtimeCloseTimeoutMs`, `forceTimeoutMs`), `ApplicationRestartInputSchema`
684
+ (`gracePeriodMs`, `forceTimeoutMs`), `createNotificationOutbox`'s `pollIntervalMs` and
685
+ a fault plan's `timeout-before-first-byte` `milliseconds` refuse a value past
686
+ 2147483647 with their `ZodError`. Every refusal names the option and the value it
687
+ received. A drain or a journal `close` refused this way no
688
+ longer stops admission first.
689
+ `catch (error) { if (error instanceof TypeError) … } // sseRoute({ heartbeatMs: 0 })`
690
+ → `catch (error) { if (error instanceof RangeError) … } // sseRoute({ heartbeatMs: 0 })`.
691
+ `mountWait(server, { …, defaultTimeout: 30 * 86_400 })`
692
+ → `mountWait(server, { …, defaultTimeout: 24 * 86_400 })`.
693
+ [migration](docs/guide/upgrading.md#timer-options-one-rule). → ADR 0320
694
+ **Affects:** `stitchkit` bindRealtimeClient(behaviour), createHttpClient(timeout), createClient(behaviour), createSocketIOClient(reconnectOnServerDisconnect), uploadInChunks(retryDelayMs), BackoffPolicySchema(minDelayMs, maxDelayMs), defineContract(behaviour); `stitchkit/http` createHttpClient(timeout), createClient(behaviour), uploadInChunks(retryDelayMs); `stitchkit/realtime` createSocketIOClient(reconnectOnServerDisconnect); `stitchkit/contract` defineContract(behaviour); `stitchkit/react` createCacheBridge(freshWindow); `stitchkit/files` createManagedFileBoundary(inspectionTimeoutMs); `stitchkit/server` sseRoute(heartbeatMs), ndjsonRoute(heartbeatMs), streamingRoute(heartbeatMs), createUnixClientTransport(headersTimeoutMs), ShutdownOptionsSchema(gracePeriodMs, realtimeCloseTimeoutMs, forceTimeoutMs); `stitchkit/node` createUnixClientTransport(headersTimeoutMs), ShutdownOptionsSchema(gracePeriodMs, realtimeCloseTimeoutMs, forceTimeoutMs); `stitchkit/tools` defineWaitTool(defaultTimeout), mountWait(defaultTimeout), defineDownloadTool(timeoutMs), mountDownload(timeoutMs), defineViewFileTool(timeoutMs), mountViewFile(timeoutMs), createSecureClientMetadataFetcher(timeoutMs); `stitchkit/observability` createObservability(behaviour); `stitchkit/testing` runManagedResourceConformance(watchdogTimeoutMs), runSurfaceProbes(timeoutMs); `stitchkit/application` createBoundedAdmission(behaviour), createCreditWindow(behaviour), createDecisionPipeline(policyTimeoutMs), ApplicationRestartInputSchema(gracePeriodMs, forceTimeoutMs), createWatchHub(holdMs, backoff), createNotificationOutbox(pollIntervalMs); `stitchkit/application/diagnostic-journal` createDiagnosticJournal(behaviour); `stitchkit/telegram` createTelegramBotTransport(connectAttemptMs, connectBudgetMs, responseTimeoutMs), telegramOutboundBudget(maxWaitMs), createTelegramUpdateIntake(leaseMs, sweepEveryMs); `stitchkit/telegram/screens` ScreenOutcome(notice); `stitchkit/cli` applyCliUpdate(verifyTimeoutMs, timeoutMs, idleTimeoutMs), pollUntilDone(behaviour); `stitchkit/agent-runtime` createAgentRuntime(loop, close), createAgentSessionCoordinator(behaviour), AgentRetryPolicy(delayMs); `stitchkit/agent-runtime/browser` createAgentController(timeoutMs); `stitchkit/agent-runtime/realtime` bindAgentHarnessRealtime(authorizationTimeoutMs); `stitchkit/agent-runtime/testing` createAgentRaceBarrier(behaviour), defineAgentFaultPlan(behaviour), AgentFaultStepSchema(behaviour); `stitchkit/agent-runtime/openrouter` openRouterModelCatalog(timeoutMs), createOpenRouterSpendReconciler(timeoutMs); `stitchkit/live` defineEvents(behaviour), createWatchClient(holdMs, openTimeoutMs); `stitchkit/google` createGoogleOidcClient(timeoutMs); `stitchkit/geo` createGeoIpResolver(reload); `stitchkit/release` createReleaseWatcher(maxDeferMs); `stitchkit/tracking` createTrackingClient(heartbeatMs), deliverTrackingBatch(retryDelayMs); `stitchkit/tracking/performance` createPerformanceCollector(earlyDelayMs)
695
+ - `stitchkit/files` `stitchkit/telegram` a count, a byte size or an age is a safe
696
+ integer, refused when the factory is created, where it was used as written:
697
+ `createChunkSpool` refuses a `maxFileBytes` that is not a positive safe integer and
698
+ a `staleAfterMs` that is not a non-negative one (`TypeError`) — a `NaN`
699
+ `staleAfterMs` made `sweep()` remove every upload; `createTelegramOperatorChannel`
700
+ refuses a `maxQueued` or `maxAttempts` that is not a positive safe integer
701
+ (`TypeError`) — `maxAttempts: NaN` retried forever, `maxQueued: NaN` queued
702
+ without bound — and a `minIntervalMs` outside the timer rule (`RangeError`, 0
703
+ allowed), which a negative or `NaN` value silently became 0. A fraction computed
704
+ from another value (`hours * 3.6e6`) is refused too.
705
+ `createChunkSpool({ …, staleAfterMs: hours * 3.6e6 })` →
706
+ `createChunkSpool({ …, staleAfterMs: Math.round(hours * 3.6e6) })`.
707
+ [migration](docs/guide/upgrading.md#timer-options-one-rule) → ADR 0324
708
+ **Affects:** `stitchkit/files` createChunkSpool(maxFileBytes, staleAfterMs), ChunkSpoolConfig(maxFileBytes, staleAfterMs); `stitchkit/telegram` createTelegramOperatorChannel(maxQueued, maxAttempts, minIntervalMs), TelegramOperatorChannelConfig(maxQueued, maxAttempts, minIntervalMs)
709
+ - `stitchkit/cli` a command that fails on `createUnixClientTransport` answers the
710
+ transport's `UNIX_*` code and exits by delivery: `9` when the request never left
711
+ (`UNIX_CONNECT_FAILED`, `UNIX_TARGET_REFUSED`, `UNIX_CLIENT_CLOSED`,
712
+ `UNIX_CONNECTION_LIMIT`, `UNIX_REQUEST_TOO_LARGE`; the message names the socket),
713
+ `10` when it may have reached the application (`UNIX_DELIVERY_UNCERTAIN`,
714
+ `UNIX_HEADERS_TIMEOUT`; "Outcome unknown, not retried"), and `1` when an answer
715
+ came back. Every such failure exited `1`. `exitCodes` overrides each.
716
+ `if [ $? -eq 1 ]; then start-app; fi` → `if [ $? -eq 9 ]; then start-app; fi`.
717
+ [migration](docs/guide/upgrading.md#cli-unix-delivery-exit-codes) → ADR 0325
718
+ **Affects:** `stitchkit/cli` DEFAULT_EXIT_CODES, createCli(behaviour)
719
+
720
+ ### Added
721
+
722
+ - `stitchkit/telegram/html` adds zero-dependency `markdownToTelegramHtml` and
723
+ `splitTelegramMarkdown` (`TelegramMarkdownSplitOptions`,
724
+ `TelegramMarkdownSplitError`, `TelegramMarkdownSplitRefusal`): GitHub-flavored
725
+ Markdown (inline formatting, safe `http`/`https`/`tg`/`mailto` links, fenced
726
+ code blocks, GFM tables in `<pre>`, headings, lists/checkboxes, blockquotes,
727
+ `<details>`/`<summary>` with the body's blank lines preserved) compiles through the canonical HTML AST so every
728
+ output passes `checkTelegramHtml` and is a `sanitizeTelegramHtml` fixed point.
729
+ Conversion is linear in the text and never recurses on its depth: quotes,
730
+ `<details>` and inline styles nested deeper than 32 stay text. For Telegram
731
+ HTML, convert first and cut with `splitTelegramHtml`, which counts what the
732
+ reader sees — a table aligned in `<pre>` can be several times longer than its
733
+ Markdown. `splitTelegramMarkdown` is for text that stays Markdown: its `limit`
734
+ counts Markdown, a fenced block split across chunks is closed and reopened,
735
+ and a table split across chunks repeats its header row and separator.
736
+ Plain text stays plain: every emphasis delimiter (`*`, `**`, `_`, `__`, `~~`,
737
+ `||`) opens only where no letter or digit stands before it and closes only
738
+ where none follows, so `2*3*4`, `a*b or c*d` and `snake_case` convert to
739
+ themselves. A link whose destination the link rules refuse stays its source
740
+ text — `[click](javascript:alert(1))` reads exactly so — instead of losing its
741
+ destination; it never becomes a link. A literal double quote in a Markdown
742
+ destination is refused; `%22` is accepted, as are quotes in the label or title.
743
+ `parseTelegramHtml` / `sanitizeTelegramHtml` also allow `code`, `a`, `pre`,
744
+ `tg-emoji` and `tg-time` inside `blockquote` (matching Telegram Bot API).
745
+
746
+ - `stitchkit/agent-runtime` `loop.stepBarriers` guards each model step: a bound on
747
+ tool calls (`maxToolCallsPerStep`: the extra call is refused to the model as a
748
+ `STEP_TOOL_CALL_LIMIT` tool error and is not put to approval), call order by
749
+ entity (`toolDependencies`, with `createToolDependencyResolver` over the
750
+ `effect` of contract endpoints under their mounted tool names: a read waits for
751
+ the step's earlier write of its entity, a write for the earlier reads and
752
+ writes), a bound on reasoning (`maxReasoningCharsPerStep`, `policy_stop`), and
753
+ `stepText: 'after-tools'` (a step's text shown only after its tool calls all
754
+ succeeded). A bound no step could meet is refused by `createAgentRuntime`. The
755
+ browser controller and `useAgent` are no longer marked experimental; both stay
756
+ `evolving`.
757
+ - `stitchkit/spend` (new, evolving, server-only, peer-free) — one gateway `fetch`
758
+ per paid model provider (`createSpendGateway(...).fetchFor(name)`): the attempt
759
+ is recorded before the request is sent and closed on every outcome — success,
760
+ HTTP error, broken or cancelled stream, transport failure; credentials only for
761
+ the provider's origin, the caller's credential headers dropped, redirects
762
+ refused, `x-request-id` = attempt id; attribution required
763
+ (`runWithSpendAttribution`); usage read from the response
764
+ (`openAiCompatibleUsage`); a spooled ledger (`createSpooledSpendStore`; a record
765
+ that could be neither spooled nor stored rejects with `SPOOL_UNSPOOLED`, the
766
+ database's error as `cause`), the
767
+ monotone receipt merge (`mergeSpendReceipt`), `reconcilePendingSpend` and
768
+ `closeOrphanedSpend`. A cost is set only when the provider reported it.
769
+ `admit` refuses a call before it is sent and records it as `refused`; a
770
+ receipt whose attempt the database has not taken waits on disk with it, and
771
+ `reconcilePendingSpend` reports a receipt it cannot merge through `onError`
772
+ and goes on with the rest. The labels of the current attribution are merged
773
+ with those of the gateway's `context()` instead of replacing them.
774
+ `stitchkit/spend/testing` adds `assertSpendCoverage`, red on a model SDK
775
+ import (subpaths and `@scope/*` included), a provider key or a provider host
776
+ outside the gateway files, which reads a declaration without a closing `;` as
777
+ its own statement rather than joining it to the import after it. `stitchkit/agent-runtime`
778
+ `modelInvocationSpendAttribution` fills a gateway's attribution from the
779
+ current model attempt. → ADR 0317
780
+ - `stitchkit/agent-runtime/openrouter` — one access layer for OpenRouter models:
781
+ a request policy (`OpenRouterRequestPolicySchema`: `sessionId` or
782
+ `provider.order`, routing, `maxPrice`, `reasoning.effort` up to `max`,
783
+ `looseTools`) applied by `openRouterProvider(settings, { defaultPolicy,
784
+ resolvePolicy, sessionPerConversation })`, which delivers `looseTools`'
785
+ `strict: false` for every tool on the wire; a route pinned per thread
786
+ (`createOpenRouterRouteResolver`, bounded `createMemoryOpenRouterRouteStore`); a
787
+ stored catalog snapshot with endpoints (`loadOpenRouterCatalogSnapshot`,
788
+ `fetchOpenRouterModelEndpoints`) and admission from it
789
+ (`evaluateOpenRouterModelAdmission`: admitted, unverified or rejected with a
790
+ reason, as a schema; floating aliases and `openrouter/auto` always refused; an
791
+ unknown price never zero, and a stated price over the policy's limit rejects the
792
+ model even when the other price is unknown); and the
793
+ `stitchkit/spend` provider and reconciler (`openRouterSpendProvider`,
794
+ `createOpenRouterSpendReconciler`). The catalog requests refuse redirects and
795
+ bound their bodies; `openRouterModelCatalog` leaves out a price OpenRouter does
796
+ not know instead of failing, and its HTTP error names the request path.
797
+ - `stitchkit/agent-executor` — the contract between an executor that drives
798
+ external coding agents and the server that hands it turns: hello with
799
+ engines and private profiles, thread leases under a fence, turn phases and
800
+ reports applied once, interrupts and answers to an engine's requests, over
801
+ `defineContract` and the realtime contract. Deltas extend the message parts,
802
+ which moved to a neutral part the runtime shares; `projectExecutorDeltas`
803
+ folds them into a message. A lease refusal (`ExecutorLeaseRefusal`) is an
804
+ `AppError` with status 409 and a code of `EXECUTOR_ERRORS`, so an operation
805
+ that returns the service's promise answers
806
+ `409 { error: { code: 'EXECUTOR_FENCE_STALE' } }` without a mapper of its own.
807
+ A turn carries the `turnOrdinal` the server offered it under (`TurnOfferSchema`,
808
+ `TurnReportSchema`, `ExecutorResumableTurnSchema`). `createExecutorLeases` keeps
809
+ receipts for each thread's last `retainedTurns` turns (default 64, at most 1024)
810
+ and the highest ordinal it let go, so the lease state is bounded by threads, not
811
+ by history. A report is acknowledged `{ outcome: 'applied' | 'duplicate', ackedSeq }`;
812
+ a report of a turn at or below the ordinal let go — its first report included — is
813
+ `{ outcome: 'not-retained' }`, never applied again; a report whose turn belongs to
814
+ another thread or was offered under another ordinal is refused with
815
+ `EXECUTOR_UNKNOWN_TURN`. `resume(resumable)` answers a hello the same way: each
816
+ resumable turn is `{ outcome: 'acked', ackedSeq }` (0 for a turn never seen) or
817
+ `{ outcome: 'not-retained' }` (`ExecutorHelloAckSchema.resumable`). A hello takes the same ids a report takes (at most 256
818
+ characters) and bounds its lists (engines, profiles, resumable turns, credential
819
+ names, model ids, plan windows).
820
+ `ExecutorEngineInfo.models` names which fact it is: `{ answer: 'listed', ids }`
821
+ (an empty list — the engine offers none), `{ answer: 'not-asked' }` (the Claude
822
+ and Codex drivers do not ask their engine) or `{ answer: 'failed', error }`.
823
+ An ACP profile's `home` is its agent's `HOME` unless `profile.env` sets one, so
824
+ two profiles with two homes are two sign-ins. Evolving. → ADR 0316
825
+ - The engine drivers, each a leaf the base entrypoint does not know:
826
+ `stitchkit/agent-executor/claude` (`createClaudeCliDriver`, the unmodified
827
+ CLI over `stream-json`), `stitchkit/agent-executor/claude-sdk`
828
+ (`createClaudeSdkDriver`, the Agent SDK's `query` passed in by the
829
+ application, read by the same classifier; the SDK is an optional peer whose
830
+ types alone the leaf names), `stitchkit/agent-executor/codex`
831
+ (`createCodexDriver`, `codex app-server`) and `stitchkit/agent-executor/acp`
832
+ (`createAcpDriver`, an Agent Client Protocol v1 agent: model, thought level
833
+ and mode set by category, images when the agent takes them, MCP servers,
834
+ `session/resume` or `session/load`, `session/list`; protocol 2 refused at
835
+ hello, a pending permission answered `cancelled` on interrupt, no
836
+ reconcile; `requestTimeoutMs`, `maxFrameBytes` and `maxImageBytes` out of
837
+ range are refused when the driver is created, before any agent is spawned).
838
+ Every driver answers an interrupt alike: a request the engine sends after
839
+ `interrupt()` is refused at once (ACP `cancelled`, Claude deny, Codex
840
+ `cancel`), a request the Claude CLI sends between turns is denied, and every
841
+ request an interrupt, the turn's end or a lost engine answers is closed with a
842
+ `request-resolved` delta. A session whose engine died on its own fails its turn
843
+ and lets go of the caller's signal; `close()` only collects what it left. An
844
+ answer the engine could not take leaves its request held and open to another
845
+ answer. A failure to stop the engine after opening failed is
846
+ thrown with that failure as one `AggregateError` whose `cause` is the opening
847
+ failure. The Claude drivers read `loginExpiresAt` as the ISO-8601 time the CLI
848
+ writes (any other form is `login: unknown`) and refuse a resume whose
849
+ transcript cannot be opened for a reason other than absence. A driver refuses a
850
+ profile whose `engine` is not its own with a `TypeError`, before it reads a file
851
+ or starts the engine: the profile's home is kept under that engine's variable,
852
+ so another engine would run on the executor's own account.
853
+ `spawnEngineProcess` bounds queued stdin (`maxPendingStdinBytes`) and
854
+ `createJsonRpcPeer` bounds its local waits (`JSON_RPC_LOCAL_TIMEOUT`). Every
855
+ option of `spawnEngineProcess` is checked before the engine is started, and
856
+ `maxStdinBytes` (default 256 MiB) bounds what one connection writes over its
857
+ life: `send()` refuses a line past it with a `RangeError` and the engine keeps
858
+ running.
859
+ A `control_request` of a subtype the Claude driver does not know is answered
860
+ with the CLI's `ControlErrorResponse` and still reaches the consumer as an
861
+ `unhandled` error, so the turn does not wait on it.
862
+ `stitchkit/agent-executor/testing` holds the conformance kit and the
863
+ scripted engine every driver is proven against;
864
+ `AgentEngineDialectScenarios.requestAfterInterrupt()` proves the interrupt
865
+ rule on every dialect; `requestAtTurnEnd()` and `requestThenCrash()` prove that
866
+ a request still held when the turn ends is closed with `request-resolved` before
867
+ the end, and that neither it nor one held by an engine that died is left open to
868
+ the consumer's answer. `AgentEngineConformanceConfig.open()` also returns
869
+ `answered(request)`, how the kit sees that the engine itself was answered when a
870
+ turn ended with its request held. `runFakeClaudeEngine` plays a scenario as Claude Code
871
+ does on `stream-json` (Codex and ACP are played by their own fakes); the
872
+ scenario schemas (`FakeEngineScenarioSchema`, `FakeEngineStepSchema`) stay
873
+ dialect-neutral. Evolving. → ADR 0316
874
+
875
+ - `stitchkit/agent-runtime/postgres` — the agent store on Postgres.
876
+ `createPostgresAgentRuntimeStore({ transaction, query })` gives the store,
877
+ the conversation reader and the companion host over the application's own
878
+ client (Bun SQL, Prisma, `pg`): SERIALIZABLE write transactions retried on a
879
+ serialization conflict, at a statement or at `COMMIT`, up to `maxAttempts` (32; a
880
+ value that is not a positive safe integer is refused with `TypeError`); a versioned schema
881
+ created under an advisory lock or checked when migrations own it
882
+ (`createTables: false`, `postgresAgentRuntimeStoreDdl(prefix)`, which seeds
883
+ its own schema version); the schema is created in `READ COMMITTED` whatever
884
+ the database's default isolation; every
885
+ companion — schedules, children, spills, projections — on the same tables.
886
+ `createPostgresAgentRuntimeStoreDriver` is the driver alone. Evolving. → ADR 0314
887
+ - `stitchkit/agent-runtime` `createAgentEventSearch` searches the Postgres store
888
+ too, with the SQLite semantics: every word of the query, in any order, and a
889
+ query of punctuation refused. Each event gets a `tsvector` (`simple`) in
890
+ its own table, indexed when a search needs it rather than inside
891
+ `appendEvent`, so an event of any size is stored; a document past the
892
+ `tsvector` limit is indexed from fewer characters. `postgres` options:
893
+ `diacritics` (`preserve`, or `unaccent` through the extension, refused
894
+ without it), `maxIndexedChars` (65 536) and `maxSyncEvents` (10 000; a search
895
+ further behind indexes that many and refuses, the next continues).
896
+ `PostgresAgentEventSearchConfig` is exported. → ADR 0315
897
+ - `stitchkit/server` `createLocalHostGuard` (also on `stitchkit/node`): a desktop
898
+ app's host is an ordinary server on loopback that answers only its own windows.
899
+ Loopback keeps other machines out but not a web page on the same machine, which
900
+ can call the port and open a WebSocket there, nor a DNS-rebinding page. The guard
901
+ refuses a non-loopback `Host`, an `Origin` outside its list and a missing or wrong
902
+ Bearer secret (compared in constant time, length included), as `hooks.onRequest`
903
+ on every route and as Socket.IO `allowRequest` and `handshake`; `guard.cors` allows
904
+ the same origins, so a window in a webview passes its preflight and reads every
905
+ answer, and is `undefined` when `origins` is empty, which `createHandler` and
906
+ `createServer` take as no CORS. → ADR 0303
907
+ - `stitchkit` A call that got no answer — a dropped connection, not a response — is
908
+ sent again only when that is safe, and the endpoint says when: `idempotent: true`
909
+ whatever the method, a `GET`/`HEAD` that does not say `idempotent: false` and does
910
+ not declare `effect: 'write'` (both clients read the declared effect before
911
+ falling back to the method). The bare
912
+ `createClient` now repeats such a call up to `ClientConfig.retry.limit` times
913
+ (default 2; a value that is not a non-negative integer is refused), and a
914
+ cancellation during the pause ends the call at once; a client on
915
+ `createHttpClient` passes the endpoint's `idempotent` to its transport retry
916
+ through the new `RequestOptions.idempotent`, and repeats an unflagged `HEAD` like a
917
+ `GET`. → ADR 0303
918
+ - `stitchkit/sync` (new, evolving): the client half of an offline-first sync, with
919
+ no driver and no domain, for a browser, Hermes and Bun. `decideOutboxBatch` says
920
+ which outbox rows leave next — FIFO across pages, a row ripe when no earlier
921
+ unresolved row shares one of its keys (`keysOf`, by default its entity), a waiting
922
+ row holding all its keys, exact message bytes; a quarantined or held row holds its
923
+ keys until a person retries or discards it, unless the policy says
924
+ `setAside: 'releases-keys'`. `replaceableOutboxRow` says a row may take another edit
925
+ only before it ever left, and `coveredOutboxIds` lets a `confirmed` row leave once
926
+ the cursor covers the version its change got. `deriveOverlay` keeps pending local
927
+ edits on top of remote rows until acknowledged; `decideRemoteRow`,
928
+ `staleAfterFullSync` and `orphansOf` keep a local delete winning and clean only
929
+ what a complete snapshot allows; `createSyncSession` runs one cursor session at a
930
+ time with catch-up, deferred and server-forced full snapshots, the same page again
931
+ after a dropped transport and a generation check after every wait, on synchronous
932
+ or asynchronous ports; a full snapshot saves the version it began at and catches
933
+ up from there, so an entity deleted while it was paged still disappears. A full
934
+ snapshot may be paged by an opaque `nextToken`; an interrupted full snapshot —
935
+ paged by version or by token — continues from a saved `SyncSnapshotResume`
936
+ (`{ snapshot, after, from }` or `{ snapshot, token, from }`) after a restart, so
937
+ its last page still rebases pending changes and its catch-up starts at the
938
+ version it began at, deletes made while it ran included. Every full snapshot has
939
+ an id: `apply(page, { current, snapshot })` names it on each of its pages (`null`
940
+ in an incremental session), `rebasePending(snapshot)` after its last one, and a
941
+ snapshot continued after a restart keeps it. Mark the rows a snapshot page writes
942
+ with it: the rows marked with the id are the `server` set of
943
+ `staleAfterFullSync`, so a snapshot continued in a new process does not call the
944
+ rows of the one before stale; a `stale_cursor` refusal
945
+ (`SYNC_STALE_CURSOR`) loads a full snapshot at once, a server-forced snapshot that
946
+ cannot begin is reported as `begin_failed` and retried as a full sync, and after
947
+ every full snapshot `rebasePending` merges the pending changes onto it before its
948
+ cursor is saved; `saveProgress` saves where the session stands after every page
949
+ that has more — the next cursor of an incremental session, a `SyncSnapshotResume`
950
+ in a full snapshot — and `readCursor` returns it; there is one progress port, no
951
+ `saveSnapshotToken`. `createSyncSession` refuses a `deadlineMs` outside the timer
952
+ range, and `decideOutboxBatch` a policy whose `emptyEnvelopeBytes`, `maxBytes` or
953
+ `maxChanges` is not a positive safe integer or whose `retryAfterMs` is not a timer
954
+ delay (`RangeError`; a `retryAfterMs` that is not a number is a `TypeError`),
955
+ before anything is sent or decided.
956
+ Push results are read one by one with an open outcome vocabulary
957
+ (`classifyChangeResults`): each says `acknowledge` (with the `version` the change
958
+ got), `retry` or `hold` — a rejection is held for a person unless
959
+ `rejected: 'acknowledge'`, a failure after `holdAfterFailures`, an unknown outcome
960
+ within a bound, instead of dropping the acknowledgements beside it.
961
+ `syncPushRequestSchema` requires push limits. The client half works against a
962
+ server of the app's own as well. → ADR 0304
963
+ - `stitchkit/sync/postgres` (new, evolving): the server half inside the
964
+ application's own transaction. `allocateVersions` and `publish` number every
965
+ writer of a stream from a counter row locked until commit, so versions commit in
966
+ their order and a reader never skips one; `push` runs each change once by a
967
+ `(scope, replicaId, changeId)` ledger with a content fingerprint and the stored
968
+ outcome — an applied or replayed change answers the newest version its transaction
969
+ took, so the client keeps it on top until its cursor covers it; a rejection rolls back
970
+ what the change wrote and is recorded on its own,
971
+ a failure returns its cause for the server's log; `changesAfter` pages a feed of
972
+ one row per entity; `prune` forgets old ledger records of one scope or all.
973
+ `memorySyncStore`, `createSyncServerStore` for another database, and
974
+ `checkSyncStore`, the rules every store keeps, concurrent writers included.
975
+ → ADR 0304
976
+ - `stitchkit/application` `runSqliteMigrations` and `runSqliteMigrationsAsync`:
977
+ ordered SQLite migrations with a `schema_migrations` ledger and a 32-bit FNV-1a
978
+ checksum — the shape offline-first apps already ship, so their databases read as
979
+ theirs. Ordering does not mutate the caller's list or require `Array.prototype.toSorted`
980
+ on React Native. Every applied migration is checked before anything runs
981
+ (`SqliteMigrationLedgerMismatchError`), a ledger ahead of the code is not an
982
+ error, and each migration is one transaction that the synchronous runner never
983
+ awaits inside; a failure is `SqliteMigrationFailedError` naming the scope and
984
+ version, with the driver's error as `cause`; a ledger row whose version is not a
985
+ positive safe integer, or a version recorded twice, is
986
+ `SqliteMigrationLedgerUnreadableError`. The ledger is read again inside
987
+ each transaction, so two connections that open one file at the same moment
988
+ both finish: the later one skips what the first already applied. A `ROLLBACK`
989
+ that fails for a reason other than "no transaction is active" is not swallowed:
990
+ the `SqliteMigrationFailedError`'s cause is an `AggregateError` of the migration
991
+ error and the rollback error. `ledger` names the table one list is recorded in
992
+ (default `schema_migrations`), so independent lists share one database — a
993
+ queue's tables and a replica's — and each numbers its versions from 1; a ledger
994
+ name that is not a plain SQL identifier is a `TypeError` before anything runs. A
995
+ `begin` other than `DEFERRED`, `IMMEDIATE` or `EXCLUSIVE` is a `TypeError` before
996
+ the ledger is created; it never reaches the SQL.
997
+ The sync guide's synchronous `expo-sqlite` wrapper binds through
998
+ `getFirstSync`/`getAllSync`/`runSync`, so no prepared statement stays open, and
999
+ refuses a `bigint`, which `expo-sqlite` does not bind. → ADR 0304
1000
+ - `stitchkit/agent-runtime` `branchConversation` answers every refusal at once,
1001
+ with its address. A branch stopped at the first refusal and named no event, so a
1002
+ host with an archive of hundreds of events learnt what to declare one attempt at
1003
+ a time. Every refusal a declaration or an authorization lifts is now collected
1004
+ into `AgentConversationBranchRefusedError` (a `TypeError`): its `refusals` each
1005
+ carry a `code`, the event `seq` and `eventKind`, the `messageId`, the `toolName`
1006
+ and the key `path`, never a value; a source the branch cannot read stops it at
1007
+ once as an `integrity` refusal with the same address.
1008
+ `store.planConversationBranch(input)` returns the same list without writing, with
1009
+ every attachment reference to grant and declare and the keys to declare. Every
1010
+ identity is defined before any value is judged, so the answer no longer depends on
1011
+ the order the source recorded them in. → ADR 0301
1012
+ - `stitchkit/contract` `RuntimeContext.toolCallId` names the provider's id of the
1013
+ call on the agent transport, where it was already set without a declared type.
1014
+ Like every transport-owned field it is reserved: an auth rule that contributes
1015
+ `toolCallId` to the context is refused instead of replacing the call's identity.
1016
+ - `stitchkit/agent-runtime/coding-tools` `AgentCodingArtifactStore.write` receives
1017
+ the `toolCallId` of the call whose output it holds; the shell tool passes it.
1018
+ - `stitchkit` `createSessionCredentials` adds opt-in proactive refresh
1019
+ (`refreshAhead`, `SessionRefreshAhead`, `refreshIfDue`), startup `restore()`
1020
+ (`SessionRestoreResult`), `refresh(op, { rejected })` (`SessionRefreshOptions`),
1021
+ refresh-endpoint failure classification (`defaultClassifyRefreshFailure`,
1022
+ `SessionRefreshFailure`, `SessionRefreshRejectedError`,
1023
+ `classifyRefreshFailure`), monotonic backoff retries (`retry`), deferred
1024
+ post-rotation write retry (`storageRetryMs`), lifecycle events (`onEvent`,
1025
+ `SessionCredentialsEvent`) and clock injection (`clock`, `SessionClock`).
1026
+ → ADR 0306
1027
+ - `stitchkit/handler` (new, evolving, browser & React Native/Hermes safe):
1028
+ portable `createHandler`, `implement`, `createImplement`, `createErrorHook`,
1029
+ error helpers and `serveBridge` with zero Node built-ins; pairs with
1030
+ `createBridgeFetch`, `BridgeFailureError` and the v1 bridge frame schemas on
1031
+ `stitchkit/http` so a WebView / Expo DOM window calls an in-process React
1032
+ Native host through the same typed client and replay rules. `createBridgeFetch`
1033
+ bounds a request body by `maxFrameBytes` while reading it, not after buffering
1034
+ it. Both halves refuse bytes that are not UTF-8 with `failure: 'unsupported'`
1035
+ instead of decoding them with U+FFFD, whatever the type says
1036
+ (`text/plain; charset=windows-1251`, `application/json` with a `0xff` byte) and
1037
+ without a type (fetch gives a string body `text/plain`, so an untyped body was
1038
+ built from bytes); UTF-8 bytes travel unchanged under their own `Content-Type`. A
1039
+ React Native host without a body stream reads a typed body with its own `text()`,
1040
+ and without `TextDecoder` passes an untyped body only when it is ASCII. A
1041
+ streaming response (`text/event-stream`, `application/x-ndjson`: a contract
1042
+ `stream` or a raw route) is refused with `unsupported` as soon as the host sees its
1043
+ type, and its stream is cancelled; one frame carries one whole response. A reply
1044
+ frame the window's `Headers` or `Response` refuses (a header value that is not a
1045
+ ByteString, such as a `Content-Disposition` with a Cyrillic file name from a host
1046
+ whose `Headers` does not check values) rejects the call with a `TypeError` instead
1047
+ of leaving it pending past its abort and timeout, and the client does not replay
1048
+ it, nor an invoke reply that is not a reply frame or answers another id. A reply
1049
+ the window drops — over its own `maxFrameBytes`, or not valid for it (a failure
1050
+ code from a newer host) — still ends the call it names, with `frame-too-large` or
1051
+ a `TypeError`, instead of leaving it to the caller's timeout. `createBridgeFetch`
1052
+ takes a `windowInstance` of 1–128 characters and refuses a longer one with a
1053
+ `TypeError` when it is created, so every id the window sends can be found at the
1054
+ head of a reply too large to parse. A string `init.body`
1055
+ follows the type rule a `Request` body follows (`application/octet-stream`,
1056
+ `application/x-ndjson` and `text/event-stream` are refused before sending), and a
1057
+ UTF-8 byte order mark reaches the window as the handler wrote it. → ADR 0307
1058
+ - `stitchkit/files` adds non-blocking regular-file and bounded polled JSON
1059
+ config primitives (`readRegularFile`, `readRegularFileSync`, `fileIdentity`,
1060
+ `RegularFileError`, `JsonValueRefusal`, `DEFAULT_JSON_FILE_BYTES`, `parseJsonBytes`,
1061
+ `readJsonFileSync`, `readJsonOnce`, `PolledJsonFile`, `PolledJsonFiles`, `PolledJsonEntry`,
1062
+ `MAX_POLLED_JSON_CACHE_BYTES`, `JsonFileReading`, `JsonValueSchema`) refusing
1063
+ FIFOs, directories, sockets and concurrent modifications while decoding strict
1064
+ fatal UTF-8. Reads take `{ limit, noFollow, accept }` (plus `signal`
1065
+ async) and refuse with a typed `RegularFileError.reason`: `noFollow` refuses a
1066
+ symbolic link as the last path component through `O_NOFOLLOW`, and `accept`
1067
+ checks the `fstat` of the descriptor the bytes come from before reading them,
1068
+ sync and async, admitting the file only on `true`. Bytes that are not the value
1069
+ are refused too, with the original failure as `cause`: `encoding` (not strict
1070
+ UTF-8), `syntax` (not JSON, or a `__proto__` key at any depth — refused, never
1071
+ dropped) and `schema` (refused or thrown); an error of the operating system keeps
1072
+ its own `code`. A polled reading tells them apart the same way: `unreadable` when
1073
+ the file could not be read, `invalid` with that `reason` when its bytes are not the
1074
+ value. `PolledJsonFiles.refresh(entries)` tracks a set of `{ path, options }` that
1075
+ changes as it runs — each path with its own read options, so explicit files that
1076
+ follow links and drop-ins read with `noFollow` and `accept` share one set — reports
1077
+ `removed` for a path that left it, refuses a path listed twice and refuses rather
1078
+ than evicts past `MAX_POLLED_JSON_PATHS`; `refreshAsync(entries, { signal })` does the
1079
+ same without holding the event loop and commits nothing when aborted. The
1080
+ unchanged-identity shortcut answers from metadata only for a file read at least
1081
+ 3 s after its last change (newer of ctime and an mtime not ahead of the clock): a
1082
+ younger file is read and
1083
+ compared again on each poll, since a same-length rewrite inside one tick of a
1084
+ coarse filesystem clock (vfat, FUSE, 9p, kernels without fine-grained timestamps)
1085
+ leaves size, mtime and ctime as they were. `maxCacheBytes` counts the bytes each
1086
+ cached file held when read.
1087
+ `waitForDirectory` resolves when a directory appears, watching its nearest existing
1088
+ ancestor instead of polling; `keepAlive: false` lets the process exit while it waits,
1089
+ and a watch the system refuses with `ENOENT`/`ENOTDIR` is retried after `settleMs`.
1090
+ → ADR 0308
1091
+ - `stitchkit/observability` adds `repeatLimited` (`RepeatLimitOptions`,
1092
+ `DEFAULT_REPEAT_WINDOW_MS`, `DEFAULT_REPEAT_MAX_KINDS`) and optional `repeat`
1093
+ integration on `createBoundedLogger` and `createJsonLogger` for bounded
1094
+ per-kind suppression of repeated `warn`/`error` entries with
1095
+ `repeatedSinceLastWrite` and LRU eviction flush, applied after redaction and
1096
+ before `entryBytes` bounding. A kind is the level, the message and the stable
1097
+ data fields with every number as `#` — an attempt, a duration or a status is the
1098
+ same kind whatever its value — and the reason under `cause` or `error`: its `name`,
1099
+ its `code`, and its `message` unless the message names a code that is a name, as a
1100
+ system error's does (`ENOENT: no such file or directory, open '/path'`) — so one
1101
+ `ENOENT` for many paths is one kind, while two failures under one category code
1102
+ (`INTERNAL_ERROR`, `COMMAND_FAILED`) or one numeric code (an exit status `1`, an
1103
+ HTTP `500`) with different messages stay apart.
1104
+ `kindOf(level, message, data)` names the kind instead, for a string field such as
1105
+ a path; levels never merge. The count of a kind that stops repeating is written
1106
+ when its window ends. A kind holds the data of its last suppressed entry only
1107
+ until that count is written. → ADR 0308
1108
+ - `stitchkit/contract` (and `stitchkit`) adds closed `OperationEffect`
1109
+ (`'read' | 'write'`), `OperationEffectSchema`, optional `effect` on
1110
+ `defineContract` endpoints (validated at definition time),
1111
+ `contractOperationEffects` and fail-closed `requireContractOperationEffects`.
1112
+ The declared effect reaches hooks and tools as `OperationIdentity.effect` and
1113
+ `RuntimeToolIdentity.effect`, and decides whether a call is a repeatable read
1114
+ before the method does: `effect: 'read'` on a `POST` is one unless it is marked
1115
+ destructive, `effect: 'write'` on a `GET` never is.
1116
+ → ADR 0308
1117
+ - `stitchkit/service-host` (new, evolving, peer-free server entrypoint) adds
1118
+ host service supervision primitives: manifest-verified artifact directories
1119
+ and atomic versioned `releases/` + `current` activation/rollback
1120
+ (`verifyArtifactDirectory`, `activateVersionedArtifact`,
1121
+ `rollbackVersionedArtifact`), Linux `systemd` unit rendering/inspection/reload
1122
+ with foreign `UnitPath` drop-in detection and stability-window rollback
1123
+ (`renderSystemdServiceUnit`, `checkSystemdUnit`, `installAndStartSystemdUnit`,
1124
+ `reloadSystemdUnit`, `systemdUnitActive`, `systemdMainPid`), macOS `launchd`
1125
+ plist rendering and `bootout` + `bootstrap` reload with rollback
1126
+ (`renderLaunchdPlist`, `parseLaunchctlPrint`, `inspectLaunchdJob`,
1127
+ `reloadLaunchdJob`; an argument or environment value with a line break is
1128
+ refused, since `launchctl print` shows it unescaped and it could name another
1129
+ program), and live PID / Unix-socket ownership verification with
1130
+ post-check `probeProcessOwner` TOCTOU protection (`verifySupervisedProcess`,
1131
+ `parseProcNetUnixListeningSockets`). A socket path is matched by the
1132
+ filesystem node it resolves to (read with `ss`), so a listener whose name was
1133
+ unlinked does not own the path another process took, and a server that binds
1134
+ one name and publishes another by hard link owns the published one. A socket
1135
+ counts only where `/proc/net/unix` and `ss` agree on it — an `@abstract` name
1136
+ included, which now needs `ss` too — and every line of both tables must be a
1137
+ record: a socket name holding a line break, which would write records of its own,
1138
+ makes the check `socket-unverifiable`; the `ss` name field is read greedily, so a
1139
+ name that spells another socket's node does not claim it. Any other character is
1140
+ part of the name — a carriage return, U+2028, U+2029, a trailing space.
1141
+ Installing a systemd unit refuses a name systemd loads from another file or
1142
+ has masked (`FOREIGN_FRAGMENT`, checked before the write and again after
1143
+ `daemon-reload`) and a `Type=oneshot` unit (`UNSUPPORTED_UNIT_TYPE`);
1144
+ reloading a launchd job refuses a plist whose `Label` is not the job's, and a
1145
+ job of that label loaded from another plist (`FOREIGN_FRAGMENT`, before
1146
+ `bootout`). The path a manager reports is compared with `plistPath` or
1147
+ `unitPath` after resolving the links in their directories, so a file under a
1148
+ linked directory — `/tmp` → `/private/tmp`, `/var`, `/etc` on macOS — is the job's
1149
+ or unit's own; a link at the path itself is still refused. `checkSystemdUnit`
1150
+ reports it as `fragmentIsUnitPath`, and `verifySupervisedProcess` matches
1151
+ `expectedExe` against the kernel's fully resolved executable path. Host adapters
1152
+ carry `canonicalPath(path)` and the process identity adapter
1153
+ `resolveExecutablePath(path)`; a custom adapter implements them. `checkSystemdUnit` answers `missing` only when nothing else
1154
+ answers for the name: a vendor, transient or generated unit, or one loaded
1155
+ with no unit file, is `fragment-mismatch`. Both roll back to the bytes that
1156
+ were there and to the state the service was in: a stopped unit stays stopped,
1157
+ the enable links of the unit and of the units its `[Install]` names in `Also=` are
1158
+ read before an `enable`, and every link it added is removed again — whatever the
1159
+ `[Install]` text says, and also after an `enable` or `bootstrap` that answered an
1160
+ error — the links must then be the ones found before and `is-enabled` must read
1161
+ the state found then; a launchd job ends loaded or not loaded as it was found; a
1162
+ rollback reports `rolledBack: true` only when every step of it succeeded.
1163
+ Host commands run by absolute path (`/usr/bin/systemctl`, `/bin/launchctl`,
1164
+ `/usr/bin/plutil`, iproute2 `ss` at `/usr/bin/ss` or `/usr/sbin/ss`) with a
1165
+ declared environment (`PATH=/usr/sbin:/usr/bin:/sbin:/bin`, `HOME`,
1166
+ `XDG_RUNTIME_DIR`, `DBUS_SESSION_BUS_ADDRESS`); a socket check on a host
1167
+ without `ss`, or whose socket table cannot be read, answers
1168
+ `runtime-unavailable` with reason `socket-unverifiable`. The executable
1169
+ of `execStart` and `execStartPre` may not begin with a systemd prefix
1170
+ (`-`, `@`, `:`, `+`, `!`), and an activated release is writable by its owner
1171
+ only. A relative or unnormalised `unitPath` or `plistPath` (`//`, `/./`, `/../`, a
1172
+ trailing `/`) is `INVALID_CONFIG` before any command. A symbolic link or another
1173
+ non-regular node at `unitPath` or `plistPath` is refused with `FOREIGN_FRAGMENT`
1174
+ (`rolledBack: false`) before anything is read, written or unloaded — the target is
1175
+ not ours to replace — and a rollback puts the previous file back with the mode it
1176
+ had, not the candidate's. Both host adapters carry `inspectPath(path)`
1177
+ (`ServiceHostPathState`: `missing`, `file` with its `mode`, `symlink` with its
1178
+ `target`, `other`, by `lstat`); a custom `SystemdHostAdapter` or
1179
+ `LaunchdHostAdapter` implements it. Activation fsyncs every
1180
+ release file and directory before `current` names the release, and the directory
1181
+ of `current` after each switch. → ADR 0309
1182
+ - `stitchkit/agent-runtime` unified per-step spend accounting
1183
+ (`AgentStepSpendSchema`, `AgentStepSpend`, `AgentStepSpendPhaseSchema`,
1184
+ `AgentStepSpendPhase`) with `AgentRuntimeConfig.onStepSpend`,
1185
+ `onStepSpendError`, and `stepSpendTimeoutMs` (default `5000`). Fires after
1186
+ `provider/response` is persisted for every completed model step (`step`),
1187
+ billed retried attempt (`abandoned-attempt`), and compaction call
1188
+ (`compaction`); non-audited `provider/response` records now persist `usage`,
1189
+ and `observe` `step-finished` events emit from the same fact with `phase`,
1190
+ `attempt`, `provider`, and isolated `spendHookError` diagnostics.
1191
+ `onStepSpendError` is awaited up to the same `stepSpendTimeoutMs` as
1192
+ `onStepSpend`, so a store that hangs both cannot hold the step; a reporter that
1193
+ times out is carried on `step-finished` as `reportFailed` with the timeout as
1194
+ `reportError`.
1195
+ - `stitchkit/cli` `scanCliInvocation` (with `CliInvocationScanOptions`,
1196
+ `CliInvocationScan`, and `CliFrameworkOptions`): single-pass CLI argv scanner
1197
+ backing `createCli`, `routeCliArgv`, `extractCliGlobalOptions`, and early
1198
+ profile notice suppression. → ADR 0310
1199
+ - `stitchkit/files` `writeFileAtomic` and `writeFileAtomicSync` add explicit
1200
+ opt-in `idempotent: true` for `{ replace: false }` (rejected with `TypeError`
1201
+ otherwise): byte-identical existing regular files with matching `0o7777` mode
1202
+ succeed without replacing the inode, using `O_NOFOLLOW`, 1 bounded
1203
+ `EEXIST → ENOENT` retry, staged cleanup and directory sync; `readRegularFile`
1204
+ now also detects `mode` changes during its retry check. → ADR 0312
1205
+ - `stitchkit/service-host` adds `startConfigReloader` and
1206
+ `createPolledJsonConfigSource` (`ConfigReloader`, `ConfigReloaderOptions`,
1207
+ `ConfigReloaderShutdownOptions`, `ShutdownTarget` compatible with
1208
+ `bindProcessSignals`): validates new config before stopping the active handle,
1209
+ coalesces burst reloads to 1 pending slot, deduplicates invalid config digests
1210
+ and rolls back on start failure. While nothing is running, each poll starts
1211
+ the last config again, so a transient start failure heals without a file
1212
+ change. A `stop` that outlives `stopTimeoutMs` stays the only `stop` of its
1213
+ handle: later reloads and `shutdown()` wait for it, and the config that waited
1214
+ behind it starts when it ends. `checkSystemdUnit` adds `expectedDigest`,
1215
+ allows trusted `<dir>/service.d/*.conf` and template drop-ins, and handles
1216
+ `LoadState=masked`; `verifySupervisedProcess` re-snapshots `/proc/net/unix`
1217
+ and re-runs `probeProcessOwner` across in-process reloads. → ADR 0312
1218
+ - `stitchkit/observability` adds windowed `createEventLoopDelayMonitor`
1219
+ (`EventLoopDelayMonitorOptions`, `EventLoopDelaySnapshot`) over lazy
1220
+ `perf_hooks.monitorEventLoopDelay` with an O(1) ring buffer, Node empty-histogram
1221
+ and Bun `p99 <= max` guards, and an `unref()` bucket timer; browser-safe
1222
+ `repeatLimited` is also re-exported from root `stitchkit`. → ADR 0312
1223
+ - `stitchkit/application` adds browser-clean exhaustive
1224
+ `formatDiagnosticJournalLockDiagnosis` over `DiagnosticJournalLockDiagnosis`.
1225
+ → ADR 0312
1226
+ - `stitchkit/service-host` extends macOS `launchd` helpers with `lintLaunchdPlist`,
1227
+ `readLaunchdPlist` (`PLUTIL_PATH`, guarding `Code=257`), `bootoutLaunchdJob`,
1228
+ `ReloadLaunchdJobOptions.validatePlist`, `AssociatedBundleIdentifiers` and
1229
+ `LimitLoadToSessionType`. → ADR 0313
1230
+ - `stitchkit/declaration` `ProjectDeclarationSchema` adds optional strict
1231
+ `starter: { version }` (semantic version recorded by `create-stitchkit` when
1232
+ scaffolding a repository; omitted legitimately by non-starter projects).
1233
+ → ADR 0311
1234
+ - `stitchkit/service-host/macos` (new, evolving, peer-free server entrypoint)
1235
+ adds fail-closed Developer ID `codesign` (`findDeveloperIds`,
1236
+ `resolveSigningIdentity`, `signBundle`, `verifySignedBundle`, which has
1237
+ `codesign` evaluate a requirement anchored in Apple's root with the Developer
1238
+ ID markers and the team, so a self-made chain carrying Apple's names is
1239
+ refused), strict C11
1240
+ `.app` launcher generation/compilation (`renderMacosLauncherSource`,
1241
+ `compileMacosLauncher`), Apple 824×824 squircle `AppIcon.icns` generation
1242
+ (`generateAppIconIcns`, `renderAppleSquircleSvg`, `assertSafeSvg`), idempotent
1243
+ atomic `.app` bundle installation with `RENAME_SWAP` rollback via Darwin N-API
1244
+ (`ensureSignedBundle`, `swapDirectoriesDarwin`, `renderBundleInfoPlist`,
1245
+ `computeBundleSpecDigest`), streaming LaunchServices maintenance
1246
+ (`registerBundle`, `forgetRegistration`, `scanLsregisterDump`,
1247
+ `forgetStaleRegistrations`, `forgetBuildTree`), and TCC responsibility
1248
+ inspection (`inspectResponsibleProcess`, `verifyProcessSubtreeResponsibility`,
1249
+ `MacosResponsibilityReason`; a native lookup that failed without an errno asks
1250
+ the process table whether the process is gone instead of reading it as `ESRCH`).
1251
+ `createDefaultMacosCommandRunner` runs every command with a declared environment
1252
+ only: `PATH=/usr/bin:/bin:/usr/sbin:/sbin`, the caller's `HOME`, `TMPDIR`,
1253
+ `DEVELOPER_DIR`, `SDKROOT` and `TOOLCHAINS` when set, and the call's `env` on top,
1254
+ so a host tool never sees a secret the process happens to hold.
1255
+ → ADR 0313
1256
+ - `stitchkit/primitives` `orderKeyBetween`, `isOrderKey`, `OrderKeySchema`, `OrderKeyError`:
1257
+ a fractional order key strictly between two keys (`null` is an open end), sorted by plain
1258
+ string comparison — JavaScript's `<`, `COLLATE "C"`, SQLite's default collation — so a list
1259
+ is never renumbered. The format and, for the same ascending bounds, the keys are those of the
1260
+ `fractional-indexing` package's default alphabets, so keys an application already stores
1261
+ read as well-formed; below the integer next to the smallest one the key carries a fraction
1262
+ where the package returns one it then refuses. Bounds not strictly ascending or not
1263
+ well-formed throw `OrderKeyError` with `reason` `order` or `malformed`. Plain JavaScript,
1264
+ browser- and Hermes-safe.
1265
+ - `stitchkit/realtime` exports `bindRealtimeClient` and its types
1266
+ `RealtimeClientTransport`, `BoundRealtimeClient` and `BindRealtimeClientOptions`
1267
+ (the root's one binding, shared by both entrypoints). A React Native/Hermes app
1268
+ binds a contract to the socket it already created with `createSocketIOClient`,
1269
+ so watched reads and an agent controller share one connection without importing
1270
+ the root entry, whose default peer loader is a computed `import()` the Hermes
1271
+ compiler refuses. The consumer lane walks the installed subpath module by module
1272
+ as Metro does, compiles it with `hermesc` and runs the binding in the Hermes V1 VM.
1273
+ - `stitchkit/server` `signLink` and `verifySignedLink`: a short-lived link for a request that
1274
+ cannot carry a header (`<audio src>`, `<img src>`). `signLink` appends `expires` and an
1275
+ HMAC-SHA-256 `signature` over the method, the path and every query parameter, for 1 second
1276
+ to `MAX_SIGNED_LINK_SECONDS` (seven days); `verifySignedLink(request, { secret })` compares
1277
+ the signature in constant time, then the expiry, and returns `{ ok: true, expiresAt }` or a
1278
+ `reason` (`unsigned`, `malformed`, `forged`, `expired`). Called from `createAuthHook`'s
1279
+ `resolve`, a `rawResponse` endpoint stays behind the auth gate with no guard of its own.
1280
+ Web Crypto only; nothing is stored.
1281
+ - `stitchkit/tools`, `stitchkit/tools/agent`, `stitchkit/tools/mcp`, `stitchkit/contract`
1282
+ `inputRecursionDepth` advertises a tool input with no `$ref`, `definitions` or `$defs`.
1283
+ Some model providers refuse a whole request when one tool carries a reference cycle
1284
+ (`z.lazy`, `z.json()`), others never read a definition behind `allOf: [{ $ref }]`. With
1285
+ the option every reference is written out in place, each recursive definition is
1286
+ unrolled the declared number of levels, and the last level becomes an open node typed by
1287
+ every JSON type the definition accepts (`{ type: 'object' }`, `{ type: 'array', items: {} }`,
1288
+ or an `anyOf` of them), so the document still accepts every value the contract does; the
1289
+ handler parses the contract's own recursive schema. Declare it on a surface — `mountAgent`,
1290
+ `mountMcp`, `buildMcpServer`, `createMcpHandler`, `validateMcpSchemas`, `buildToolManifest`,
1291
+ `describeToolCatalog`, `collectTools`, `createToolInvoker`,
1292
+ `createDeferredAgentToolSurface` and `buildSurfaceManifest` (`toolSurfaces.AGENT`, `mcpPreparation`) — and per tool
1293
+ in the endpoint's `tool` group, where `tool.inputRecursionDepth` wins over the surface's
1294
+ value. A value that is not a positive integer is refused where it is declared. With the
1295
+ option, an `allowUntyped` path for a property inside a recursive definition is reported
1296
+ from its full path. Without it every document is unchanged, byte for byte.
1297
+ `mountAgent(services, { access, inputRecursionDepth: 1 })`;
1298
+ `tool: { name: 'formula_create', inputRecursionDepth: 3 }`. → ADR 0319
1299
+
1300
+ ### Changed
1301
+
1302
+ - `stitchkit/agent-runtime/browser` `createAgentController` keeps the last
1303
+ snapshot on screen across a reconnect, where it showed an empty view, until the
1304
+ new attach answers; that answer replaces it whatever its version.
1305
+ **Affects:** `stitchkit/agent-runtime/browser` createAgentController
1306
+ - `stitchkit/observability` `createSpooledSink` keeps its spool file `0o600`
1307
+ (an existing file is narrowed too) and bounded — `maxPendingEntries` (default
1308
+ 10 000) and `maxFileBytes` (default 64 MiB, compacting first; → ADR 0323, and what
1309
+ a writer sees at a bound is under ⚠️ Breaking changes) — closes off a
1310
+ line torn by a crash before appending, and keeps a line it cannot decode
1311
+ through compaction instead of erasing it. Compaction replaces the file
1312
+ atomically and leaves no temporary file behind when the rename fails. What
1313
+ `recover()` does with a file past `maxFileBytes`, or one it cannot read, is under
1314
+ ⚠️ Breaking changes ([migration](docs/guide/upgrading.md#spool-file-over-its-bound)).
1315
+ The spool mechanism is shared with
1316
+ `stitchkit/spend`.
1317
+ **Affects:** `stitchkit/observability` createSpooledSink(behaviour), SpooledSinkConfig
1318
+
1319
+ - Maturity-table breaking-change cadence figures in `docs/guide/getting-started.md`
1320
+ now cover every core entrypoint over the window since `0.94.0`
1321
+ (`BREAKING_METADATA_SINCE`), derived from breaking-item leading entrypoints
1322
+ instead of the previous 0.56.2 keyword list.
1323
+ - `stitchkit/telegram` The outbound budget fails closed: a Bot API method it does
1324
+ not know costs one message instead of nothing, and a 429 on it pauses its chat
1325
+ (or the whole token when no `chat_id` is present). A send method Telegram added
1326
+ after the budget's list was written previously went out unbudgeted into flood
1327
+ waits. Every method and deprecated alias grammY's types name is now classified
1328
+ as a send or as free (`FREE_METHODS`: reads, edits of a sent message,
1329
+ administration, `sendChatAction`, `answerWidgetQuery`, `editSharedWidgetData`),
1330
+ and `sendRichMessageDraft` and `sendChatJoinRequestWebApp` count as sends.
1331
+ → ADR 0305 (amends ADR 0274)
1332
+ **Affects:** `stitchkit/telegram` behaviour
1333
+ - `stitchkit/cli` `CliSurfaceSource` factories (`services` and `runtimeTools`)
1334
+ now receive `(auth, globals)` so a local CLI can compute a variant's unix
1335
+ socket path from parsed global options. Its exit codes for a unix-socket failure
1336
+ are under ⚠️ Breaking changes ([migration](docs/guide/upgrading.md#cli-unix-delivery-exit-codes)).
1337
+ - `stitchkit/cli` removed the ADR 0296 transitional exit-2 refusal for leading
1338
+ framework flags before a native command in a CLI with a managed factory and no
1339
+ `defaultCommand`; leading framework flags now route identically across all CLI
1340
+ profiles. → ADR 0310 (amends ADR 0296)
1341
+ **Affects:** `stitchkit/cli` behaviour
1342
+ - `release:check` refuses an `**Affects:**` line that names an export its entrypoint does not
1343
+ have, from 0.127.0 on. A breaking item's names are looked up in the tree's export snapshot and
1344
+ in the previous core release, since a breaking change may remove the export it names; a fix's
1345
+ names in the tree only, since a fix ships in this release and removes nothing. A misspelt or
1346
+ stale name never matches a consumer's import in `stitchkit upgrade`; the refusal lists each one
1347
+ with where the name is exported now.
1348
+ - Signals are linked one way across the framework: the durability parks and effects, the
1349
+ directory inbox, change subscriptions, the surface probes, file inspection, the OpenRouter
1350
+ catalog and spend reads, model invocations, authorization hooks and each provider attempt of a
1351
+ run link a caller's signal for as long as their work runs and detach from it when it ends,
1352
+ instead of `AbortSignal.any`, whose listeners some runtimes keep on a long-lived source until it
1353
+ aborts.
1354
+
1355
+ ### Fixed
1356
+
1357
+ - `stitchkit/agent-runtime/harness` control replies no longer leave an unobserved
1358
+ rejection of the run result behind when the run fails.
1359
+ **Affects:** `stitchkit/agent-runtime/harness` createAgentHarnessControlServer
1360
+ - `stitchkit/agent-runtime/harness` `stitchkit/agent-runtime/realtime` a control
1361
+ request the harness rejects still answers `REQUEST_REJECTED`, and its cause now
1362
+ reaches `onError` (new on `AgentHarnessControlServerConfig`;
1363
+ `AgentHarnessRealtimeConfig` inherits it, so its `onError` also sees rejected
1364
+ requests), else `console.error`; it was dropped.
1365
+ **Affects:** `stitchkit/agent-runtime/harness` createAgentHarnessControlServer(onError); `stitchkit/agent-runtime/realtime` bindAgentHarnessRealtime(onError)
1366
+ - `stitchkit/agent-runtime/realtime` `bindAgentHarnessRealtime` keeps no entry per
1367
+ revoked conversation on a socket: `revoke()` without `matches` added one to every
1368
+ socket, never removed. A revoke now marks only the authorizations in flight.
1369
+ **Affects:** `stitchkit/agent-runtime/realtime` bindAgentHarnessRealtime(behaviour)
1370
+ - `stitchkit/tools` `resolveMedia`, `mountViewFile` and `defineViewFileTool` cancel
1371
+ the body of a URL answered with a status that is not 2xx before refusing it with
1372
+ `VIEW_HTTP_ERROR`, as they already did for a video or an oversized answer, so the
1373
+ pinned connection is released at once instead of when the response is collected.
1374
+ **Affects:** `stitchkit/tools` resolveMedia(behaviour), mountViewFile(behaviour), defineViewFileTool(behaviour)
1375
+
1376
+ - `stitchkit` `createHttpClient` on Bun repeats a `GET` whose connection closed
1377
+ before any answer came (`ECONNRESET`, `ConnectionClosed`), as it always did for a
1378
+ refused one. The transport retry promised for network failures recognised only a
1379
+ refused connection there, so a host that restarted mid-call failed every read.
1380
+ Both `createClient` and `createHttpClient` now also classify
1381
+ `UnixClientTransportError` by code and delivery state — retrying idempotent
1382
+ calls only on `UNIX_CONNECT_FAILED` (`not-dispatched`) and
1383
+ `UNIX_DELIVERY_UNCERTAIN` (`possibly-dispatched`) and never retrying
1384
+ `UNIX_RESPONSE_TOO_LARGE` or other post-response failures — while on Node
1385
+ `createUnixClientTransport` classifies `HPE_*` parser failures as
1386
+ `UNIX_RESPONSE_ABORTED` (`response-received`) and in-flight `close()` as
1387
+ `UNIX_CLIENT_CLOSED` without retrying.
1388
+ **Affects:** `stitchkit` behaviour; `stitchkit/server` createUnixClientTransport; `stitchkit/node` createUnixClientTransport
1389
+ - `stitchkit/server` `createServer({ unix })` no longer removes a live sibling's
1390
+ unix socket on concurrent starts or shutdown: startup probe, reclaim and bind
1391
+ serialize under a per-socket lock, publish via an atomic staged hard link so
1392
+ Bun's `server.stop()` never unlinks a replaced path, unlink only the `(dev, ino)`
1393
+ recorded at bind time, treat only `ECONNREFUSED` and `ENOENT` as stale (refusing
1394
+ `ENAMETOOLONG`, `EINVAL`, `EACCES` and probe errors without unlinking), and run
1395
+ the liveness probe via `process.execPath` with `BUN_BE_BUN=1` and
1396
+ `--config=/dev/null` so compiled binaries work without `bun` on `PATH` and
1397
+ without `bunfig.toml`/`BUN_OPTIONS` interference. The staging name of the hard
1398
+ link fits the platform's `sun_path` (at most 107 bytes on Linux, 103 on Darwin).
1399
+ The startup lock (`.<name>.lock` beside the socket) records and judges its holder
1400
+ by the exclusive lock's rule, not a bare PID: the record names this machine and
1401
+ one process lifetime, so a lock left by a process that has exited, whose PID now
1402
+ names a different process, or whose boot is over is taken at once, under a guard
1403
+ file that lets only one start take it, and a holder that is still running is
1404
+ waited for (5 s). A lock with no readable owner record is taken once it is 30 s
1405
+ old. On macOS the lock loads the packaged Darwin addon for process identity, like
1406
+ `withExclusiveLock`. A failure to remove the lock after the socket is bound
1407
+ (`EIO`, `EBUSY`, …) is logged with its cause and does not replace the outcome:
1408
+ `createServer` returns the listening server, and the next start takes the lock
1409
+ this process left with no descriptor open on it.
1410
+ **Affects:** `stitchkit/server` createServer(unix)
1411
+ - `stitchkit/server` Malformed percent-encoding in URL query parameters now
1412
+ answers `400 BAD_REQUEST` instead of crashing with an uncaught `URIError`
1413
+ (500) on React Native / Hermes and Node/Bun. → ADR 0307
1414
+ **Affects:** `stitchkit/server` createHandler; `stitchkit/node` createHandler; `stitchkit/handler` createHandler
1415
+ - `stitchkit/files` declarations resolve without `@types/node`: `fileIdentity`
1416
+ and the `accept` callback of `readRegularFileSync` take `FileIdentityStats`
1417
+ and `FileStatsView`, which `fs.Stats` and `fs.BigIntStats` satisfy, instead of
1418
+ naming `node:fs`; a project that type-checks without Node types can import the
1419
+ entrypoint again. The two types are exported from `stitchkit/files`.
1420
+ **Affects:** `stitchkit/files` fileIdentity, readRegularFileSync, FileIdentityStats, FileStatsView
1421
+ - `stitchkit/http` a call that outlives its `timeout` rejects with
1422
+ `REQUEST_TIMEOUT` in React Native. The timeout aborted with a `DOMException`,
1423
+ a global React Native does not have, so the timer threw and the call never
1424
+ settled; uploads and aborted streams raised the same error the same way.
1425
+ Abort and timeout errors are now an `Error` named `AbortError` or
1426
+ `TimeoutError` wherever `DOMException` is missing. An upload that reports
1427
+ progress (`onUploadProgress`) no longer requires the `TextEncoder` and
1428
+ `ReadableStream` globals. Reading a Unicode JSON reply with upload progress
1429
+ enabled preserves the same text as the ordinary call; binary replies stay bytes.
1430
+ **Affects:** `stitchkit/http` behaviour; `stitchkit` behaviour
1431
+ - `stitchkit` `createSessionScope` starts an operation in React Native and on a
1432
+ page served over plain HTTP: the operation id no longer comes from
1433
+ `crypto.randomUUID`, which neither has, so `login()` no longer throws there.
1434
+ A refresh that outlives `refreshTimeoutMs` rejects with a `TimeoutError`.
1435
+ **Affects:** `stitchkit` createSessionScope, createSessionCredentials
1436
+ - `stitchkit/tools/connections` OpenAPI 3.0 `nullable: true` now validates `null`
1437
+ (passing `dialect: 'openapi-3.0'` for OpenAPI 3.0.x specs and normalizing
1438
+ `nullable: true` for MCP and 2020-12 schemas). → ADR 0310
1439
+ **Affects:** `stitchkit/tools/connections` behaviour
1440
+ - `stitchkit/tools/connections` discovered tools using `not`, `if`/`then`/`else`,
1441
+ `dependentRequired`, `dependentSchemas`, `unevaluatedProperties`,
1442
+ `unevaluatedItems`, or draft-07 `dependencies` now mount instead of being
1443
+ dropped, stripping those keywords locally and delegating enforcement to the
1444
+ remote server via `markRemoteSchemaVerdict`. → ADR 0310
1445
+ **Affects:** `stitchkit/tools/connections` behaviour
1446
+ - `stitchkit/cli` invalid inline boolean framework flags such as `--quiet=maybe`
1447
+ now refuse with exit code 2 before any profile notice is printed (instead of
1448
+ silently evaluating to `false` in early notice checks). → ADR 0310
1449
+ **Affects:** `stitchkit/cli` behaviour
1450
+ - `stitchkit/cli` boolean flag words (`true`/`false`, `TRUE`/`FALSE`) are now
1451
+ matched case-insensitively across routing, framework flags, application
1452
+ globals, and command fields so `--quiet TRUE cmd` routes to `cmd` consistently.
1453
+ → ADR 0310
1454
+ **Affects:** `stitchkit/cli` behaviour
1455
+ - `stitchkit/agent-runtime` `branchConversation` carries the runtime's own
1456
+ records by their type. A conversation whose ledger held model invocation
1457
+ records (`invocations`) could not be branched at all, and one whose history
1458
+ held a deferred tool selection receipt or an event search call branched only
1459
+ when the host declared the runtime's reference names with
1460
+ `sourceIdentity: 'retain'`. Invocation records now cross as inert receipts that
1461
+ still name the conversation and run that made the call, without the encrypted
1462
+ payload body; a tool selection receipt follows its run; what `session_search`,
1463
+ `session_trace` and `session_event` were asked and answered crosses as the
1464
+ model read it, payload bodies removed. An event kind without a branch rule no
1465
+ longer compiles. → ADR 0300
1466
+ **Affects:** `stitchkit/agent-runtime` behaviour
1467
+ - `stitchkit/agent-runtime` `branchConversation` reads a child's events through
1468
+ the schema the child manager writes them with, so their usage and stop fields
1469
+ (`usage`, `overrun`, `policyName`, `enforced`, `stopDurationMs`) no longer fail
1470
+ the branch with `ZodError: unrecognized_keys`: a conversation whose children
1471
+ reported usage or were stopped can be branched. A spill is read back and exported through
1472
+ the one archive spill schema instead of a looser copy, so a malformed stored
1473
+ spill (an `authorization` of `false`) is refused instead of travelling into an
1474
+ archive.
1475
+ **Affects:** `stitchkit/agent-runtime` AgentRuntimeStore(branchConversation), AgentRuntimeStore(planConversationBranch), createAgentSpillStore
1476
+ - `stitchkit/agent-runtime` `createAgentChildManager` no longer writes `stopped`
1477
+ over a child that finished while it was being stopped. A host that answers a
1478
+ stop by finishing the child resolved its result before the stop returned, and
1479
+ `stopChildren` or `interruptChild` then rewrote the finished row to `stopped`,
1480
+ dropped its `resultReference` and journalled a second terminal state. A child
1481
+ now moves out of `spawned`/`running` in one write transaction that reads and
1482
+ updates the row, and the event is appended only when the row moved, on SQLite
1483
+ and Postgres, from one process or two; a result that arrived before the stop
1484
+ returned is recorded first. A late `recordStepUsage` of an ended child is still
1485
+ counted, and its event names the state the row is in rather than `running`.
1486
+ **Affects:** `stitchkit/agent-runtime` createAgentChildManager(stopChildren, interruptChild, recordStepUsage)
1487
+ - `stitchkit/agent-runtime` `interruptChild` and the cleanup of a spawn whose
1488
+ record failed ask the child's host to stop within the same stop bound as
1489
+ `stopChildren`: a host that never answered held the `interrupt_child` tool and
1490
+ `spawnChild` forever, and a host that threw escaped `interruptChild` with the
1491
+ child left live. An unconfirmed stop records `lost` with `reason`
1492
+ (`stop-timeout`, `stop-failed`, or `unreachable` for a cascade over a child this
1493
+ process cannot reach), not `stopped`; `waitChild` resolves once a stop has
1494
+ recorded how the child ended — `stopped`, or `lost` for a host that did not confirm
1495
+ or could not be reached — also for a waiter that came before the stop, such as the
1496
+ `subagent` tool, without waiting for a host that never reports a result, and a
1497
+ failed spawn cleanup rejects with an `AggregateError` of the record
1498
+ failure (also its `cause`) and each cleanup failure. A child-budget stop asks the
1499
+ child's stop policy once within the bound (a policy that threw or timed out was
1500
+ asked again, doubling the wait), and its journal entry says `enforced` as the
1501
+ stop ended. A child-budget stop the host confirms records the child `stopped`, as
1502
+ an interrupt does: `recordStepUsage` returned `enforced: true` and left the row
1503
+ `running`, so the child held its place under `maxActiveChildren` until its host
1504
+ reported a result, and the next spawn was refused. Stops that meet on one child
1505
+ while its host is answering — an interrupt and the parent's cascade, a budget stop
1506
+ and either — share one delivery: the host is asked once and each records the same
1507
+ outcome, where a second stop asked the host again and a quick refusal of it could
1508
+ record `lost` over a stop still being confirmed.
1509
+ **Affects:** `stitchkit/agent-runtime` createAgentChildManager(interruptChild, spawnChild, stopChildren, waitChild, recordStepUsage), agentChildBudgetStopPolicy(behaviour), createAgentChildTools(behaviour)
1510
+ - `stitchkit/agent-runtime` `createAgentChildManager` stops a child whatever point of
1511
+ its spawn the parent's stop meets. `stopChildren` found a child whose row was
1512
+ written but whose handle was not yet held and recorded it `lost` (`unreachable`)
1513
+ while it kept running and spending; earlier still — while the spawn checked the
1514
+ limit, asked `remainingBudget` or read the seed history — it did not see the child
1515
+ at all, and the spawn went on to start it. A spawn is now visible to a stop from its
1516
+ first line: stopped before the host is asked to start the child, `spawnChild`
1517
+ rejects and no child exists; stopped after, the child is stopped through
1518
+ `stopPolicy` as soon as its handle is held and `spawnChild` returns the state that
1519
+ stop recorded. `stopChildren` waits for a spawn in flight within the stop bound. The
1520
+ `subagent` and `subagent_fork` tools of a run whose signal has aborted refuse before
1521
+ spawning.
1522
+ **Affects:** `stitchkit/agent-runtime` createAgentChildManager(spawnChild, stopChildren), createAgentChildTools(behaviour)
1523
+ - `stitchkit/agent-runtime` `createAgentChildManager` keeps one blocking relay queue
1524
+ per parent. There was one queue for every parent, so a child host that never
1525
+ answered held `listChildBlocking` and `respondToChildBlocking` of every other
1526
+ parent too.
1527
+ **Affects:** `stitchkit/agent-runtime` createAgentChildManager(behaviour)
1528
+ - `stitchkit/agent-runtime` a streaming tool (`async *execute`) records one
1529
+ `tool-result` and one `completed` tool status — its final value. Each
1530
+ intermediate value was persisted as another result of the same call. Under
1531
+ `stepBarriers.toolDependencies` an `execute` that returns a promise of an async
1532
+ iterable ends in its last value too, whether or not the call waited for another.
1533
+ **Affects:** `stitchkit/agent-runtime` createAgentRuntime(behaviour)
1534
+ - `stitchkit/cli` a value piped on stdin into a positional field
1535
+ (`commandSettings.<command>.positionals`) that the field cannot take (`---`,
1536
+ `--hello`, or `abc` for a number) is refused with exit code `2` on native,
1537
+ managed and discovered commands alike, instead of an uncaught
1538
+ `CliArgumentError`.
1539
+ **Affects:** `stitchkit/cli` createCli
1540
+ - `stitchkit/cli` a field declared with `.readonly()` parses and shows as the
1541
+ schema it wraps — a boolean is a flag, a number is coerced, a view column is
1542
+ found — as it does without `.readonly()`, and `--no-<name>` sets a boolean
1543
+ `<name>` to `false` only when no field is itself named `no-<name>`.
1544
+ **Affects:** `stitchkit/cli` createCli, createCliInvoker, parseCliArgs
1545
+ - `stitchkit` `createSessionCredentials().login()` whose `storage.write()` fails
1546
+ or times out leaves no session behind: the scope is cleared, its timers are
1547
+ stopped and `read()` no longer returns credentials that were never stored. A
1548
+ `login()` or `logout()` that replaced the operation in the meantime is left
1549
+ as it is. Storage is cleared too, of the stored session the login replaced, so
1550
+ a restart no longer restores the previous account the app saw signed out (what
1551
+ `login()` rejects with when that clear fails too is under ⚠️ Breaking changes).
1552
+ **Affects:** `stitchkit` createSessionCredentials, SessionCredentials(login)
1553
+ - `stitchkit`, `stitchkit/http` a long-lived caller signal no longer collects one
1554
+ listener per request on React Native, whose `AbortSignal.any` keeps its
1555
+ listeners until a source aborts. A request's link to the caller is released when
1556
+ the call settles, a stream's when the stream ends, the session refresh
1557
+ deadline's when the exchange settles. A caller abort still ends a stream or raw
1558
+ body that outlived its open.
1559
+ **Affects:** `stitchkit` createClient(behaviour), createHttpClient(behaviour), createSessionCredentials(refresh); `stitchkit/http` createClient(behaviour), createHttpClient(behaviour)
1560
+ - `stitchkit/tools/mcp` runtime tools take the surface's `flattenUnionInput` on
1561
+ MCP, as contract tools do: `buildMcpServer` / `createMcpHandler` prepared
1562
+ runtime tools (discovered connection tools included) without it, so a
1563
+ discriminated union in a runtime tool's input was listed as `oneOf` while
1564
+ `buildSurfaceManifest` showed it flattened.
1565
+ **Affects:** `stitchkit/tools/mcp` buildMcpServer, createMcpHandler
1566
+ - `stitchkit/tools/mcp` the `requireTypedProperties` refusal that recommends
1567
+ `z.json()` now says that its schema refers to itself and that a surface whose
1568
+ model provider refuses recursive schemas also sets `inputRecursionDepth`.
1569
+ **Affects:** `stitchkit/tools/mcp` validateMcpSchemas, createMcpHandler, mountMcp
1570
+ - `stitchkit/server`, `stitchkit/node` `createUnixClientTransport` rejects a call
1571
+ with `UNIX_CLIENT_CLOSED` when `close()` lands while the request body is being
1572
+ read (`not-dispatched`, nothing is sent) or after the request went out
1573
+ (`response-received`), on Bun and Node. It checked `closed` only before reading
1574
+ the body and sent the request anyway.
1575
+ **Affects:** `stitchkit/server` createUnixClientTransport; `stitchkit/node` createUnixClientTransport
1576
+ - `stitchkit/files` `createChunkSpool` publishes a spool file once through the
1577
+ atomic writer with mode `0o600`, and a failure to remove its staging file no
1578
+ longer replaces the outcome of the publish.
1579
+ **Affects:** `stitchkit/files` createChunkSpool
1580
+ - `stitchkit/telegram/html` parses markup in time linear in its length and no
1581
+ longer overflows the stack on deep nesting: `sanitizeTelegramHtml` of 16 000
1582
+ nested `<b>` threw `RangeError`, and a tag with a long run of spaces, a long
1583
+ run of line breaks, or thousands of open `<span>`s took seconds. An element
1584
+ nested more than 32 deep keeps its words and loses its tag. `splitTelegramHtml`
1585
+ and `truncateTelegramHtml` measure the tree once instead of walking and
1586
+ re-measuring it for each part, so a long text cut into many parts no longer
1587
+ takes time that grows with both (400 000 characters of markup cut at 64: 2.4 s →
1588
+ 0.17 s). The parts are unchanged.
1589
+ **Affects:** `stitchkit/telegram/html` parseTelegramHtml, sanitizeTelegramHtml, splitTelegramHtml, truncateTelegramHtml, checkTelegramHtml
1590
+ - `stitchkit/telegram` `stitchkit/telegram/grammy` `stitchkit/files` `stitchkit/tools`
1591
+ `stitchkit/tools/connections` `stitchkit/agent-runtime` a signal aborted without a
1592
+ reason fails a wait with an
1593
+ `AbortError`, never with `undefined` or a substitute error: in `telegramOutboundBudget`
1594
+ and `callTelegramBotApi`, the grammY `telegramBudgetTransformer`
1595
+ (`'The operation was aborted'`, was `'This operation was aborted'`), the managed file
1596
+ boundary, `withExclusiveLock` (also while its machine identity command runs), the
1597
+ view-file tool (was the read error) and agent-runtime compaction.
1598
+ `createTelegramBotTransport` parsed the bytes received so far as the answer; it now
1599
+ rejects with an `AbortError`. An MCP connection over SSE closes an aborted request's
1600
+ session with the signal's reason, an `AbortError` when it has none, instead of a
1601
+ generic session-closed error. A platform `AbortController` always gives a reason,
1602
+ so only a hand-made signal-like object sees this.
1603
+ **Affects:** `stitchkit/telegram` telegramOutboundBudget(behaviour), callTelegramBotApi(behaviour), createTelegramBotTransport(behaviour); `stitchkit/telegram/grammy` telegramBudgetTransformer(behaviour); `stitchkit/files` createManagedFileBoundary(behaviour), withExclusiveLock(behaviour); `stitchkit/tools` defineViewFileTool(behaviour), mountViewFile(behaviour); `stitchkit/tools/connections` defineMcpClientConnection(behaviour); `stitchkit/agent-runtime` behaviour
1604
+ - `stitchkit/observability` `createSpooledSink`: a record written while `recover()`
1605
+ ran and refused by the store was dropped from memory when the replay finished, so
1606
+ the next record of its group could reach the store first; it now stays undelivered
1607
+ behind what the file still owes. A spooled spend ledger shares the spool and keeps
1608
+ the same order.
1609
+ **Affects:** `stitchkit/observability` createSpooledSink(behaviour)
1610
+ - `stitchkit/application` a managed schedule whose period, first delay or drain
1611
+ deadline is past 2147483647 ms waits for it in steps of that ceiling instead of a
1612
+ timer that fired at once — `createManagedSchedule({ everyMs })` of more than 24.8
1613
+ days used to tick at once.
1614
+ **Affects:** `stitchkit/application` createManagedSchedule(everyMs, startAfterMs)
1615
+ - `stitchkit/application` the application kernel waits for a force deadline — the
1616
+ grace period plus the force timeout — in steps of the longest a timer holds. With
1617
+ both budgets near 2147483647 ms their sum fired at once and aborted the close of a
1618
+ startup rollback, a restart, or the force of a shutdown forced by its signal, before
1619
+ either budget had run.
1620
+ **Affects:** `stitchkit/application` createApplication(behaviour)
1621
+ - `stitchkit` `stitchkit/http` `uploadInChunks` doubles its retry pause up to
1622
+ 2147483647 ms instead of past it, where the timer fired at once and the repeats of a
1623
+ part ran back to back.
1624
+ **Affects:** `stitchkit` uploadInChunks(retryDelayMs); `stitchkit/http` uploadInChunks(retryDelayMs)
1625
+ - `stitchkit/tools/mcp` `stitchkit/server` the request line of an MCP endpoint
1626
+ (`createMcpHandler` mounted by `createMcpHttpRoute`) logs the `405` it answers to
1627
+ the `GET` that opens a Streamable HTTP event stream, and to the `DELETE` that ends
1628
+ a session, at `info` instead of `warn`: the protocol names `405` as the answer
1629
+ "not offered here" and the official client carries on. The handler marks such a
1630
+ response and the line reads the mark, never a path or method, so the `401` of a
1631
+ missing token, a `405` to any other method and every other `4xx` stay `warn`, and
1632
+ a `5xx` stays `error`; the line's format and fields are unchanged, on the built-in
1633
+ sink and on `logging.logger`.
1634
+ **Affects:** `stitchkit/tools/mcp` createMcpHandler(behaviour), createMcpHttpRoute(behaviour); `stitchkit/server` createServer(behaviour), createHandler(behaviour); `stitchkit/node` createHandler(behaviour); `stitchkit/handler` createHandler(behaviour)
1635
+
1636
+ ### Security
1637
+
1638
+ - `stitchkit/agent-runtime` the child and schedule tools act only for the conversation of
1639
+ the run that called them. They took the conversation from the model's input, so a model
1640
+ that knew another conversation's ID could spend that conversation's child budget,
1641
+ message or interrupt its children and place or cancel its schedules; the state and event
1642
+ search tools read a conversation nothing tied to the run. The change and its migration
1643
+ are the breaking item on `createAgentChildTools` above
1644
+ ([migration](docs/guide/upgrading.md#runtime-tools-take-the-run)).
1645
+ **Affects:** `stitchkit/agent-runtime` createAgentChildTools, createAgentScheduleTools, createAgentStateTools, createAgentEventSearchTools
1646
+ - `stitchkit/server` and `stitchkit/node` a unix socket is bound and dialled only inside a
1647
+ directory its own user owns, and a client connects only to a socket with that owner. A
1648
+ socket in a shared directory such as `/tmp` could be replaced by another user, who then
1649
+ received the requests or answered them. The change and its migration are the breaking
1650
+ item on `createServer({ unix })` above
1651
+ ([migration](docs/guide/upgrading.md#unix-socket-ownership-checks)).
1652
+ **Affects:** `stitchkit/server` createServer, createUnixClientTransport; `stitchkit/node` createUnixClientTransport
1653
+
1654
+ ## [0.126.0] - 2026-11-21
1655
+
1656
+ ### ⚠️ Breaking changes
1657
+
1658
+ **Who must act:** every server that passes `read` to `createWatchHub`
1659
+ ([migration](docs/guide/upgrading.md#watch-read-request)), and authors of a hand-written
1660
+ agent store that branches on its own and runs the conformance kit
1661
+ ([migration](docs/guide/upgrading.md#branch-conformance-application-files)).
1662
+
1663
+ - `stitchkit/application` `createWatchHub` passes `read` one request object
1664
+ with a per-read `signal`. A shared read kept running after its last subscriber
1665
+ left, and a subscriber arriving before it settled received its stale answer as
1666
+ current. The signal aborts when the last subscriber leaves or the hub closes;
1667
+ an aborted read's outcome is dropped without an `unavailable` state, a log line
1668
+ or backoff, and the next read of the key starts after it settles.
1669
+ `read: (operation, args, scope) => …` → `read: ({ operation, args, scope, signal }) => …`.
1670
+ → ADR 0297
1671
+ **Affects:** `stitchkit/application` createWatchHub(read), WatchHubConfig(read)
1672
+ - `stitchkit/agent-runtime/testing` `runAgentStoreConformance` checks
1673
+ application-owned file parts when a store implements `branchConversation`: a
1674
+ declared `applicationFiles` reference must reach the branch under its destination
1675
+ reference, and an undeclared one must refuse before any write. A hand-written store
1676
+ that branches on its own must accept the new field; stores built on the shipped
1677
+ planner pass unchanged. See the
1678
+ [migration](docs/guide/upgrading.md#branch-conformance-application-files). → ADR 0298
1679
+ **Affects:** `stitchkit/agent-runtime/testing` runAgentStoreConformance
1680
+
1681
+ ### Added
1682
+
1683
+ - `stitchkit/server` decides CORS per request origin. `cors.origin` may be a
1684
+ function answering each exact origin with `{ credentials: true }`,
1685
+ `{ credentials: false }` or `false`, sync or async, so a server can allow
1686
+ partner pages without cookies beside its own pages with them. The answer is
1687
+ reached once per request and used by every exit, every response varies by
1688
+ `Origin`, and a failing or malformed answer grants nothing and runs nothing.
1689
+ A `safelistedBody` text body is read only from an origin granted with
1690
+ credentials. Types `CorsOriginPolicy` and `CorsOriginDecision`. → ADR 0299
1691
+
1692
+ ### Fixed
1693
+
1694
+ - `stitchkit/application` `createWatchHub` keeps the pause after a failed read
1695
+ across subscriber churn. A subscriber that left and returned while the source
1696
+ was down got a new read at once, at the rate of its reconnects instead of the
1697
+ backoff. The pause now belongs to the key: the returning subscriber is told the
1698
+ known state and waits out the rest, an abandoned read does not reset the count,
1699
+ and a failed key is kept until its pause ends. → ADR 0297
1700
+ **Affects:** `stitchkit/application` behaviour
1701
+ - `stitchkit/agent-runtime` `branchConversation` takes `applicationKeys`. A
1702
+ conversation whose tool output or message metadata held the application's own
1703
+ `messageId`, `reference` or another name the runtime reserves for its
1704
+ references could not be branched at all. Declared names cross as data; a
1705
+ declared key whose value names a source identity still refuses, and the order
1706
+ of `applicationKeys` and `applicationFiles` no longer changes the request
1707
+ fingerprint. → ADR 0298
1708
+ **Affects:** `stitchkit/agent-runtime` BranchAgentConversationInputSchema, BranchAgentConversationInput; `stitchkit/agent-runtime` behaviour
1709
+ - `stitchkit/process` confirms a stopped process group with the kernel before
1710
+ taking a process-table snapshot. Every stop of a group spawned `ps` once, which
1711
+ took about 30 ms on an idle host and outlasted a short cleanup budget on a busy
1712
+ one, failing the command with `COMMAND_CLEANUP` after its work had succeeded.
1713
+ **Affects:** `stitchkit/process` behaviour; `stitchkit/agent-runtime/coding-tools` behaviour
1714
+ - `stitchkit/agent-runtime` branches and restores conversations whose file parts
1715
+ reference files the application stores. Every file part was read as a runtime
1716
+ spill, so an uploaded image refused the whole branch with `Branch contains a
1717
+ foreign or missing spill reference`. `branchConversation` takes
1718
+ `applicationFiles`, each `{ reference, destinationReference }` naming the
1719
+ reference the host already granted the destination; an undeclared file part
1720
+ still refuses, now with `Branch contains a foreign or missing file reference`.
1721
+ → ADR 0298
1722
+ **Affects:** `stitchkit/agent-runtime` BranchAgentConversationInputSchema, BranchAgentConversationInput; `stitchkit/agent-runtime` behaviour
1723
+
18
1724
  ## [0.125.0] - 2026-11-19
19
1725
 
20
1726
  ### ⚠️ Breaking changes
@@ -548,7 +2254,7 @@ default command. See the [migration](docs/guide/upgrading.md#cli-framework-optio
548
2254
  Every filesystem tool pins root before either policy; an ordinary command enters its pinned
549
2255
  cwd through the descriptor's `/proc` link on Linux and through an isolated fchdir guard on
550
2256
  macOS. Symlink cwd descendants refuse; custom sandbox launchers own cwd capture.
551
- **Affects:** `stitchkit/agent-runtime/coding-tools` createAgentCodingTools, AgentCodingToolLimitsSchema, AgentCodingToolLimits, behaviour
2257
+ **Affects:** `stitchkit/agent-runtime/coding-tools` createAgentCodingTools, AgentCodingToolLimitsSchema, AgentCodingToolLimits; `stitchkit/agent-runtime/coding-tools` behaviour
552
2258
 
553
2259
  ### Fixed
554
2260