stitchkit 0.93.0 → 0.94.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1082) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/README.md +5 -2
  3. package/dist/agent-runtime/children-control.d.ts +6 -0
  4. package/dist/agent-runtime/children-control.d.ts.map +1 -0
  5. package/dist/agent-runtime/children-spawn.d.ts +6 -0
  6. package/dist/agent-runtime/children-spawn.d.ts.map +1 -0
  7. package/dist/agent-runtime/children-state.d.ts +46 -0
  8. package/dist/agent-runtime/children-state.d.ts.map +1 -0
  9. package/dist/agent-runtime/children-usage.d.ts +8 -0
  10. package/dist/agent-runtime/children-usage.d.ts.map +1 -0
  11. package/dist/agent-runtime/children.d.ts +11 -14
  12. package/dist/agent-runtime/children.d.ts.map +1 -1
  13. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  14. package/dist/agent-runtime/coding-tool-contract.d.ts +2 -1
  15. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  16. package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
  17. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  18. package/dist/agent-runtime/contained-darwin.d.ts +38 -0
  19. package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
  20. package/dist/agent-runtime/contained-files.d.ts +11 -26
  21. package/dist/agent-runtime/contained-files.d.ts.map +1 -1
  22. package/dist/agent-runtime/contained-scan.d.ts +21 -0
  23. package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
  24. package/dist/agent-runtime/contained-write.d.ts +9 -0
  25. package/dist/agent-runtime/contained-write.d.ts.map +1 -0
  26. package/dist/agent-runtime/deferred-tool-types.d.ts +4 -3
  27. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  28. package/dist/agent-runtime/events.d.ts +1 -1
  29. package/dist/agent-runtime/events.d.ts.map +1 -1
  30. package/dist/agent-runtime/harness-control.d.ts +0 -1
  31. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  32. package/dist/agent-runtime/harness.d.ts +0 -5
  33. package/dist/agent-runtime/harness.d.ts.map +1 -1
  34. package/dist/agent-runtime/managed-tools.d.ts +3 -2
  35. package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
  36. package/dist/agent-runtime/observability.d.ts +1 -1
  37. package/dist/agent-runtime/observability.d.ts.map +1 -1
  38. package/dist/agent-runtime/openrouter.d.ts +29 -0
  39. package/dist/agent-runtime/openrouter.d.ts.map +1 -0
  40. package/dist/agent-runtime/projections.d.ts +1 -1
  41. package/dist/agent-runtime/projections.d.ts.map +1 -1
  42. package/dist/agent-runtime/run-acquisition.d.ts +17 -0
  43. package/dist/agent-runtime/run-acquisition.d.ts.map +1 -0
  44. package/dist/agent-runtime/run-execution-state.d.ts +133 -0
  45. package/dist/agent-runtime/run-execution-state.d.ts.map +1 -0
  46. package/dist/agent-runtime/run-execution.d.ts +17 -33
  47. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  48. package/dist/agent-runtime/run-failure.d.ts +18 -0
  49. package/dist/agent-runtime/run-failure.d.ts.map +1 -0
  50. package/dist/agent-runtime/run-model-attempts.d.ts +6 -0
  51. package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -0
  52. package/dist/agent-runtime/run-prompt-history.d.ts +58 -0
  53. package/dist/agent-runtime/run-prompt-history.d.ts.map +1 -0
  54. package/dist/agent-runtime/run-provider-ledger.d.ts +26 -0
  55. package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -0
  56. package/dist/agent-runtime/run-stream-parts.d.ts +17 -0
  57. package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -0
  58. package/dist/agent-runtime/run-terminal.d.ts +11 -0
  59. package/dist/agent-runtime/run-terminal.d.ts.map +1 -0
  60. package/dist/agent-runtime/run-turn-preparation.d.ts +22 -0
  61. package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -0
  62. package/dist/agent-runtime/runtime-admission-gate.d.ts +29 -0
  63. package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -0
  64. package/dist/agent-runtime/runtime-control.d.ts +9 -0
  65. package/dist/agent-runtime/runtime-control.d.ts.map +1 -0
  66. package/dist/agent-runtime/runtime-recovery.d.ts +10 -0
  67. package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -0
  68. package/dist/agent-runtime/runtime-state.d.ts +36 -0
  69. package/dist/agent-runtime/runtime-state.d.ts.map +1 -0
  70. package/dist/agent-runtime/runtime-submit.d.ts +5 -0
  71. package/dist/agent-runtime/runtime-submit.d.ts.map +1 -0
  72. package/dist/agent-runtime/runtime.d.ts +10 -5
  73. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  74. package/dist/agent-runtime/schedule-records.d.ts +34 -0
  75. package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
  76. package/dist/agent-runtime/schedules.d.ts +34 -0
  77. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  78. package/dist/agent-runtime/sqlite-bun.d.ts +12 -0
  79. package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -0
  80. package/dist/agent-runtime/sqlite-events.d.ts +5 -0
  81. package/dist/agent-runtime/sqlite-events.d.ts.map +1 -0
  82. package/dist/agent-runtime/sqlite-history.d.ts +7 -0
  83. package/dist/agent-runtime/sqlite-history.d.ts.map +1 -0
  84. package/dist/agent-runtime/sqlite-ledger.d.ts +7 -0
  85. package/dist/agent-runtime/sqlite-ledger.d.ts.map +1 -0
  86. package/dist/agent-runtime/sqlite-node.d.ts +12 -0
  87. package/dist/agent-runtime/sqlite-node.d.ts.map +1 -0
  88. package/dist/agent-runtime/sqlite-reads.d.ts +14 -0
  89. package/dist/agent-runtime/sqlite-reads.d.ts.map +1 -0
  90. package/dist/agent-runtime/sqlite-rows.d.ts +178 -0
  91. package/dist/agent-runtime/sqlite-rows.d.ts.map +1 -0
  92. package/dist/agent-runtime/sqlite-schema.d.ts +7 -0
  93. package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -0
  94. package/dist/agent-runtime/sqlite-transactions.d.ts +25 -0
  95. package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -0
  96. package/dist/agent-runtime/sqlite.d.ts +10 -6
  97. package/dist/agent-runtime/sqlite.d.ts.map +1 -1
  98. package/dist/agent-runtime/store-archive.d.ts +16 -0
  99. package/dist/agent-runtime/store-archive.d.ts.map +1 -0
  100. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
  101. package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
  102. package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
  103. package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
  104. package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
  105. package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
  106. package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
  107. package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
  108. package/dist/agent-runtime/store-conformance.d.ts +40 -0
  109. package/dist/agent-runtime/store-conformance.d.ts.map +1 -0
  110. package/dist/agent-runtime/store-create.d.ts +11 -0
  111. package/dist/agent-runtime/store-create.d.ts.map +1 -0
  112. package/dist/agent-runtime/store-driver-contract.d.ts +814 -0
  113. package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -0
  114. package/dist/agent-runtime/store-events.d.ts +7 -89
  115. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  116. package/dist/agent-runtime/store-memory.d.ts +4 -0
  117. package/dist/agent-runtime/store-memory.d.ts.map +1 -0
  118. package/dist/agent-runtime/store-mutate.d.ts +13 -0
  119. package/dist/agent-runtime/store-mutate.d.ts.map +1 -0
  120. package/dist/agent-runtime/store-purge.d.ts +1 -1
  121. package/dist/agent-runtime/store-purge.d.ts.map +1 -1
  122. package/dist/agent-runtime/store-reads.d.ts +29 -0
  123. package/dist/agent-runtime/store-reads.d.ts.map +1 -0
  124. package/dist/agent-runtime/store-reduce-history.d.ts +10 -0
  125. package/dist/agent-runtime/store-reduce-history.d.ts.map +1 -0
  126. package/dist/agent-runtime/store-reduce-run.d.ts +14 -0
  127. package/dist/agent-runtime/store-reduce-run.d.ts.map +1 -0
  128. package/dist/agent-runtime/store-reduce-shared.d.ts +76 -0
  129. package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -0
  130. package/dist/agent-runtime/store-reduce-terminal.d.ts +6 -0
  131. package/dist/agent-runtime/store-reduce-terminal.d.ts.map +1 -0
  132. package/dist/agent-runtime/store-reducer.d.ts +24 -0
  133. package/dist/agent-runtime/store-reducer.d.ts.map +1 -0
  134. package/dist/agent-runtime/store-snapshot.d.ts +19 -0
  135. package/dist/agent-runtime/store-snapshot.d.ts.map +1 -0
  136. package/dist/agent-runtime/store.d.ts +1 -1
  137. package/dist/agent-runtime/store.d.ts.map +1 -1
  138. package/dist/application/admission-rate.d.ts +21 -0
  139. package/dist/application/admission-rate.d.ts.map +1 -0
  140. package/dist/application/admission-run.d.ts +8 -0
  141. package/dist/application/admission-run.d.ts.map +1 -0
  142. package/dist/application/admission.d.ts +1 -1
  143. package/dist/application/admission.d.ts.map +1 -1
  144. package/dist/application/diagnostic-journal-lock.d.ts +9 -34
  145. package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
  146. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  147. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  148. package/dist/application/events.d.ts +1 -1
  149. package/dist/application/events.d.ts.map +1 -1
  150. package/dist/application/file-state-store.d.ts +23 -0
  151. package/dist/application/file-state-store.d.ts.map +1 -0
  152. package/dist/application/health.d.ts +1 -1
  153. package/dist/application/health.d.ts.map +1 -1
  154. package/dist/application/kernel-admission.d.ts +8 -0
  155. package/dist/application/kernel-admission.d.ts.map +1 -0
  156. package/dist/application/kernel-contract.d.ts +142 -0
  157. package/dist/application/kernel-contract.d.ts.map +1 -0
  158. package/dist/application/kernel-resource-context.d.ts +24 -0
  159. package/dist/application/kernel-resource-context.d.ts.map +1 -0
  160. package/dist/application/kernel-restart.d.ts +5 -0
  161. package/dist/application/kernel-restart.d.ts.map +1 -0
  162. package/dist/application/kernel-rollback.d.ts +4 -0
  163. package/dist/application/kernel-rollback.d.ts.map +1 -0
  164. package/dist/application/kernel-shutdown.d.ts +6 -0
  165. package/dist/application/kernel-shutdown.d.ts.map +1 -0
  166. package/dist/application/kernel-start.d.ts +20 -0
  167. package/dist/application/kernel-start.d.ts.map +1 -0
  168. package/dist/application/kernel-state.d.ts +116 -0
  169. package/dist/application/kernel-state.d.ts.map +1 -0
  170. package/dist/application/kernel.d.ts +9 -140
  171. package/dist/application/kernel.d.ts.map +1 -1
  172. package/dist/application/latest-sink.d.ts +1 -1
  173. package/dist/application/latest-sink.d.ts.map +1 -1
  174. package/dist/application/notification-outbox.d.ts.map +1 -1
  175. package/dist/application/opentelemetry.d.ts +1 -1
  176. package/dist/application/opentelemetry.d.ts.map +1 -1
  177. package/dist/application/schedule.d.ts +0 -1
  178. package/dist/application/schedule.d.ts.map +1 -1
  179. package/dist/application/watch-hub-core.d.ts +122 -0
  180. package/dist/application/watch-hub-core.d.ts.map +1 -0
  181. package/dist/application/watch-hub.d.ts +3 -3
  182. package/dist/application/watch-hub.d.ts.map +1 -1
  183. package/dist/browser/client-executors.d.ts +14 -0
  184. package/dist/browser/client-executors.d.ts.map +1 -0
  185. package/dist/browser/client-multipart.d.ts +1 -1
  186. package/dist/browser/client-multipart.d.ts.map +1 -1
  187. package/dist/browser/client-url.d.ts +1 -1
  188. package/dist/browser/client-url.d.ts.map +1 -1
  189. package/dist/browser/client.d.ts +3 -2
  190. package/dist/browser/client.d.ts.map +1 -1
  191. package/dist/browser/contract-stream.d.ts +1 -1
  192. package/dist/browser/contract-stream.d.ts.map +1 -1
  193. package/dist/browser/http-fetch.d.ts +22 -0
  194. package/dist/browser/http-fetch.d.ts.map +1 -0
  195. package/dist/browser/http.d.ts +2 -4
  196. package/dist/browser/http.d.ts.map +1 -1
  197. package/dist/browser/live-state-core.d.ts +63 -0
  198. package/dist/browser/live-state-core.d.ts.map +1 -0
  199. package/dist/browser/live-state.d.ts.map +1 -1
  200. package/dist/browser/realtime-client.d.ts +26 -0
  201. package/dist/browser/realtime-client.d.ts.map +1 -0
  202. package/dist/browser/resumable.d.ts +1 -28
  203. package/dist/browser/resumable.d.ts.map +1 -1
  204. package/dist/browser/retained.d.ts.map +1 -0
  205. package/dist/browser/socket-io-connection.d.ts +82 -0
  206. package/dist/browser/socket-io-connection.d.ts.map +1 -0
  207. package/dist/browser/socket-io-peer.d.ts +20 -0
  208. package/dist/browser/socket-io-peer.d.ts.map +1 -0
  209. package/dist/browser/socket-io-trace.d.ts +31 -0
  210. package/dist/browser/socket-io-trace.d.ts.map +1 -0
  211. package/dist/browser/socket-io.d.ts +24 -18
  212. package/dist/browser/socket-io.d.ts.map +1 -1
  213. package/dist/browser/stream.d.ts +14 -2
  214. package/dist/browser/stream.d.ts.map +1 -1
  215. package/dist/contract/client-types.d.ts +134 -0
  216. package/dist/contract/client-types.d.ts.map +1 -0
  217. package/dist/contract/define-validation.d.ts +30 -0
  218. package/dist/contract/define-validation.d.ts.map +1 -0
  219. package/dist/contract/define.d.ts +47 -394
  220. package/dist/contract/define.d.ts.map +1 -1
  221. package/dist/contract/normalize.d.ts +56 -0
  222. package/dist/contract/normalize.d.ts.map +1 -0
  223. package/dist/contract/runtime-context.d.ts +131 -0
  224. package/dist/contract/runtime-context.d.ts.map +1 -0
  225. package/dist/contract/tool-options.d.ts +105 -0
  226. package/dist/contract/tool-options.d.ts.map +1 -0
  227. package/dist/contract/tool-view.d.ts +148 -0
  228. package/dist/contract/tool-view.d.ts.map +1 -0
  229. package/dist/declaration/declaration.d.ts.map +1 -0
  230. package/dist/durability/contract.d.ts +259 -0
  231. package/dist/durability/contract.d.ts.map +1 -0
  232. package/dist/durability/effect.d.ts +24 -0
  233. package/dist/durability/effect.d.ts.map +1 -0
  234. package/dist/durability/engine.d.ts +14 -0
  235. package/dist/durability/engine.d.ts.map +1 -0
  236. package/dist/durability/events.d.ts +103 -0
  237. package/dist/durability/events.d.ts.map +1 -0
  238. package/dist/durability/json.d.ts +3 -0
  239. package/dist/durability/json.d.ts.map +1 -0
  240. package/dist/durability/ledger.d.ts +27 -0
  241. package/dist/durability/ledger.d.ts.map +1 -0
  242. package/dist/durability/parks.d.ts +22 -0
  243. package/dist/durability/parks.d.ts.map +1 -0
  244. package/dist/durability/scheduler.d.ts +30 -0
  245. package/dist/durability/scheduler.d.ts.map +1 -0
  246. package/dist/entrypoints/agent-runtime/browser.d.ts +5 -0
  247. package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -0
  248. package/dist/entrypoints/agent-runtime/browser.js +124 -0
  249. package/dist/entrypoints/agent-runtime/coding-tools.d.ts +2 -0
  250. package/dist/entrypoints/agent-runtime/coding-tools.d.ts.map +1 -0
  251. package/dist/entrypoints/agent-runtime/coding-tools.js +22 -0
  252. package/dist/entrypoints/agent-runtime/harness.d.ts +2 -0
  253. package/dist/entrypoints/agent-runtime/harness.d.ts.map +1 -0
  254. package/dist/entrypoints/agent-runtime/harness.js +739 -0
  255. package/dist/entrypoints/agent-runtime/openrouter.d.ts +2 -0
  256. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -0
  257. package/dist/entrypoints/agent-runtime/openrouter.js +270 -0
  258. package/dist/entrypoints/agent-runtime/sandbox.d.ts +5 -0
  259. package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -0
  260. package/dist/entrypoints/agent-runtime/sandbox.js +797 -0
  261. package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts +2 -0
  262. package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts.map +1 -0
  263. package/dist/entrypoints/agent-runtime/sqlite/bun.js +44 -0
  264. package/dist/entrypoints/agent-runtime/sqlite/node.d.ts +2 -0
  265. package/dist/entrypoints/agent-runtime/sqlite/node.d.ts.map +1 -0
  266. package/dist/entrypoints/agent-runtime/sqlite/node.js +46 -0
  267. package/dist/entrypoints/agent-runtime/testing.d.ts +4 -0
  268. package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -0
  269. package/dist/entrypoints/agent-runtime/testing.js +1116 -0
  270. package/dist/entrypoints/agent-runtime.d.ts +42 -0
  271. package/dist/entrypoints/agent-runtime.d.ts.map +1 -0
  272. package/dist/entrypoints/agent-runtime.js +2670 -0
  273. package/dist/entrypoints/application/diagnostic-journal.d.ts +21 -0
  274. package/dist/entrypoints/application/diagnostic-journal.d.ts.map +1 -0
  275. package/dist/entrypoints/application/diagnostic-journal.js +492 -0
  276. package/dist/entrypoints/application/grammy.d.ts +2 -0
  277. package/dist/entrypoints/application/grammy.d.ts.map +1 -0
  278. package/dist/entrypoints/application/grammy.js +169 -0
  279. package/dist/entrypoints/application/opentelemetry.d.ts +2 -0
  280. package/dist/entrypoints/application/opentelemetry.d.ts.map +1 -0
  281. package/dist/entrypoints/application/opentelemetry.js +250 -0
  282. package/dist/entrypoints/application/schemas.d.ts +15 -0
  283. package/dist/entrypoints/application/schemas.d.ts.map +1 -0
  284. package/dist/entrypoints/application/schemas.js +27 -0
  285. package/dist/entrypoints/application.d.ts +23 -0
  286. package/dist/entrypoints/application.d.ts.map +1 -0
  287. package/dist/entrypoints/application.js +2016 -0
  288. package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -0
  289. package/dist/entrypoints/bin/upgrade-cli.js +177 -0
  290. package/dist/entrypoints/cli.d.ts +44 -0
  291. package/dist/entrypoints/cli.d.ts.map +1 -0
  292. package/dist/entrypoints/cli.js +773 -0
  293. package/dist/entrypoints/contract.d.ts +12 -0
  294. package/dist/entrypoints/contract.d.ts.map +1 -0
  295. package/dist/entrypoints/contract.js +64 -0
  296. package/dist/entrypoints/declaration.d.ts +2 -0
  297. package/dist/entrypoints/declaration.d.ts.map +1 -0
  298. package/dist/entrypoints/declaration.js +183 -0
  299. package/dist/entrypoints/files.d.ts +5 -0
  300. package/dist/entrypoints/files.d.ts.map +1 -0
  301. package/dist/entrypoints/files.js +111 -0
  302. package/dist/entrypoints/geo.d.ts +3 -0
  303. package/dist/entrypoints/geo.d.ts.map +1 -0
  304. package/dist/entrypoints/geo.js +245 -0
  305. package/dist/entrypoints/google.d.ts +2 -0
  306. package/dist/entrypoints/google.d.ts.map +1 -0
  307. package/dist/entrypoints/google.js +175 -0
  308. package/dist/entrypoints/index.d.ts +17 -0
  309. package/dist/entrypoints/index.d.ts.map +1 -0
  310. package/dist/entrypoints/index.js +764 -0
  311. package/dist/entrypoints/live.d.ts +19 -0
  312. package/dist/entrypoints/live.d.ts.map +1 -0
  313. package/dist/entrypoints/live.js +302 -0
  314. package/dist/entrypoints/node.d.ts +19 -0
  315. package/dist/entrypoints/node.d.ts.map +1 -0
  316. package/dist/entrypoints/node.js +308 -0
  317. package/dist/entrypoints/oauth.d.ts +2 -0
  318. package/dist/entrypoints/oauth.d.ts.map +1 -0
  319. package/dist/entrypoints/oauth.js +170 -0
  320. package/dist/entrypoints/observability.d.ts +19 -0
  321. package/dist/entrypoints/observability.d.ts.map +1 -0
  322. package/dist/entrypoints/observability.js +567 -0
  323. package/dist/entrypoints/primitives.d.ts +3 -0
  324. package/dist/entrypoints/primitives.d.ts.map +1 -0
  325. package/dist/entrypoints/primitives.js +749 -0
  326. package/dist/entrypoints/react.d.ts +5 -0
  327. package/dist/entrypoints/react.d.ts.map +1 -0
  328. package/dist/entrypoints/react.js +403 -0
  329. package/dist/entrypoints/release.d.ts +15 -0
  330. package/dist/entrypoints/release.d.ts.map +1 -0
  331. package/dist/entrypoints/release.js +196 -0
  332. package/dist/entrypoints/remote.d.ts +9 -0
  333. package/dist/entrypoints/remote.d.ts.map +1 -0
  334. package/dist/entrypoints/remote.js +66 -0
  335. package/dist/entrypoints/server.d.ts +39 -0
  336. package/dist/entrypoints/server.d.ts.map +1 -0
  337. package/dist/entrypoints/server.js +2009 -0
  338. package/dist/entrypoints/telegram.d.ts +3 -0
  339. package/dist/entrypoints/telegram.d.ts.map +1 -0
  340. package/dist/entrypoints/telegram.js +224 -0
  341. package/dist/entrypoints/testing.d.ts +10 -0
  342. package/dist/entrypoints/testing.d.ts.map +1 -0
  343. package/dist/entrypoints/testing.js +1377 -0
  344. package/dist/entrypoints/tools/connections.d.ts +19 -0
  345. package/dist/entrypoints/tools/connections.d.ts.map +1 -0
  346. package/dist/entrypoints/tools/connections.js +1110 -0
  347. package/dist/entrypoints/tools/contract.d.ts +29 -0
  348. package/dist/entrypoints/tools/contract.d.ts.map +1 -0
  349. package/dist/entrypoints/tools/contract.js +24 -0
  350. package/dist/entrypoints/tools/invoker.d.ts +9 -0
  351. package/dist/entrypoints/tools/invoker.d.ts.map +1 -0
  352. package/dist/entrypoints/tools/invoker.js +20 -0
  353. package/dist/entrypoints/tools.d.ts +54 -0
  354. package/dist/entrypoints/tools.d.ts.map +1 -0
  355. package/dist/entrypoints/tools.js +3009 -0
  356. package/dist/entrypoints/tracking/server.d.ts +15 -0
  357. package/dist/entrypoints/tracking/server.d.ts.map +1 -0
  358. package/dist/entrypoints/tracking.d.ts +24 -0
  359. package/dist/entrypoints/tracking.d.ts.map +1 -0
  360. package/dist/entrypoints/tracking.js +1140 -0
  361. package/dist/files/boundary.d.ts.map +1 -1
  362. package/dist/files/file-io.d.ts +14 -0
  363. package/dist/files/file-io.d.ts.map +1 -0
  364. package/dist/google/google.d.ts.map +1 -0
  365. package/dist/index-0b1ess5e.js +38 -0
  366. package/dist/index-1j8pm5t0.js +412 -0
  367. package/dist/index-1zbbzgfh.js +89 -0
  368. package/dist/index-2bxbyab0.js +47 -0
  369. package/dist/index-2gxzjvyr.js +266 -0
  370. package/dist/index-35mh5bhj.js +177 -0
  371. package/dist/index-48ffdxgk.js +6 -0
  372. package/dist/index-4gcnakhx.js +82 -0
  373. package/dist/index-55hkhm67.js +343 -0
  374. package/dist/index-79z7m7dt.js +675 -0
  375. package/dist/index-7f68ghdn.js +3618 -0
  376. package/dist/index-7p1f0vp2.js +154 -0
  377. package/dist/index-83bdg97s.js +16 -0
  378. package/dist/index-863ea9jb.js +154 -0
  379. package/dist/index-8p52kd5p.js +242 -0
  380. package/dist/index-d9pk3td4.js +326 -0
  381. package/dist/index-dce5wxcq.js +63 -0
  382. package/dist/index-e01r054k.js +105 -0
  383. package/dist/index-ensd0r74.js +595 -0
  384. package/dist/index-eqqvgdb3.js +46 -0
  385. package/dist/index-gxrt5h6v.js +341 -0
  386. package/dist/index-h6eeys1v.js +211 -0
  387. package/dist/index-ham5sz8m.js +734 -0
  388. package/dist/index-het2he5g.js +1387 -0
  389. package/dist/index-hffjpmq9.js +30 -0
  390. package/dist/index-hmp4800j.js +51 -0
  391. package/dist/index-k30h66yd.js +317 -0
  392. package/dist/index-k5hsfc3j.js +31 -0
  393. package/dist/index-khtgb21r.js +92 -0
  394. package/dist/index-m9zn6cpq.js +51 -0
  395. package/dist/index-ndddxtyx.js +324 -0
  396. package/dist/index-ngfhvfpd.js +30 -0
  397. package/dist/index-np4m8hd3.js +1205 -0
  398. package/dist/index-p3vsv1fb.js +3493 -0
  399. package/dist/index-p5r7qpdd.js +85 -0
  400. package/dist/index-p9e0w8hs.js +1084 -0
  401. package/dist/index-p9sh0xx4.js +64 -0
  402. package/dist/index-paz6sgdp.js +371 -0
  403. package/dist/index-px2gm2jp.js +448 -0
  404. package/dist/index-qwhynv6x.js +103 -0
  405. package/dist/index-s812ycat.js +65 -0
  406. package/dist/index-sp1tzwnb.js +281 -0
  407. package/dist/index-t9rhjr9f.js +2306 -0
  408. package/dist/index-v260df89.js +342 -0
  409. package/dist/index-w906953s.js +946 -0
  410. package/dist/index-wdkt63w3.js +214 -0
  411. package/dist/index-wqgjfstn.js +18 -0
  412. package/dist/index-wsm5w4ee.js +1023 -0
  413. package/dist/index-xw3s75nj.js +100 -0
  414. package/dist/index-yw4fzmdz.js +268 -0
  415. package/dist/index-zfrhfn82.js +85 -0
  416. package/dist/index-znfs20ss.js +98 -0
  417. package/dist/internal/atomic-file.d.ts +23 -2
  418. package/dist/internal/atomic-file.d.ts.map +1 -1
  419. package/dist/internal/backoff.d.ts +29 -0
  420. package/dist/internal/backoff.d.ts.map +1 -0
  421. package/dist/internal/canonical-json.d.ts +21 -11
  422. package/dist/internal/canonical-json.d.ts.map +1 -1
  423. package/dist/internal/channel.d.ts.map +1 -0
  424. package/dist/internal/exclusive-lock.d.ts +51 -0
  425. package/dist/internal/exclusive-lock.d.ts.map +1 -0
  426. package/dist/internal/logger.d.ts.map +1 -0
  427. package/dist/internal/process-identity.d.ts +47 -0
  428. package/dist/internal/process-identity.d.ts.map +1 -0
  429. package/dist/internal/request.d.ts.map +1 -0
  430. package/dist/internal/stable-digest.d.ts +0 -43
  431. package/dist/internal/stable-digest.d.ts.map +1 -1
  432. package/dist/internal/typed.d.ts +0 -8
  433. package/dist/internal/typed.d.ts.map +1 -1
  434. package/dist/internal/with-exclusive-lock.d.ts +67 -0
  435. package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
  436. package/dist/internal/zod-issues.d.ts +38 -0
  437. package/dist/internal/zod-issues.d.ts.map +1 -0
  438. package/dist/json-schema/dialect.d.ts +17 -0
  439. package/dist/json-schema/dialect.d.ts.map +1 -0
  440. package/dist/json-schema/json-schema.d.ts.map +1 -0
  441. package/dist/live/watch-client.d.ts.map +1 -1
  442. package/dist/live/watch-delta.d.ts.map +1 -1
  443. package/dist/oauth/authorization-code.d.ts +57 -0
  444. package/dist/oauth/authorization-code.d.ts.map +1 -0
  445. package/dist/observability/audit.d.ts +3 -3
  446. package/dist/observability/audit.d.ts.map +1 -1
  447. package/dist/observability/bounded-logger.d.ts +1 -1
  448. package/dist/observability/bounded-logger.d.ts.map +1 -1
  449. package/dist/observability/bounded-sink.d.ts +81 -0
  450. package/dist/observability/bounded-sink.d.ts.map +1 -0
  451. package/dist/observability/context.d.ts +1 -1
  452. package/dist/observability/context.d.ts.map +1 -1
  453. package/dist/observability/event.d.ts +2 -1
  454. package/dist/observability/event.d.ts.map +1 -1
  455. package/dist/observability/work.d.ts +1 -1
  456. package/dist/observability/work.d.ts.map +1 -1
  457. package/dist/primitives/audit.d.ts +1 -1
  458. package/dist/primitives/audit.d.ts.map +1 -1
  459. package/dist/primitives/export-operation.d.ts +4 -2
  460. package/dist/primitives/export-operation.d.ts.map +1 -1
  461. package/dist/realtime/registry.d.ts +0 -5
  462. package/dist/realtime/registry.d.ts.map +1 -1
  463. package/dist/realtime/socket.d.ts +1 -1
  464. package/dist/realtime/socket.d.ts.map +1 -1
  465. package/dist/server/bun.d.ts +0 -1
  466. package/dist/server/bun.d.ts.map +1 -1
  467. package/dist/server/context-contribution.d.ts +1 -1
  468. package/dist/server/context-contribution.d.ts.map +1 -1
  469. package/dist/server/context.d.ts +2 -2
  470. package/dist/server/context.d.ts.map +1 -1
  471. package/dist/server/contract-method.d.ts +15 -0
  472. package/dist/server/contract-method.d.ts.map +1 -0
  473. package/dist/server/contract-stream.d.ts +1 -1
  474. package/dist/server/contract-stream.d.ts.map +1 -1
  475. package/dist/server/create.d.ts +8 -0
  476. package/dist/server/create.d.ts.map +1 -1
  477. package/dist/server/endpoint-dispatch.d.ts +10 -0
  478. package/dist/server/endpoint-dispatch.d.ts.map +1 -0
  479. package/dist/server/endpoint-response.d.ts +19 -0
  480. package/dist/server/endpoint-response.d.ts.map +1 -0
  481. package/dist/server/error-dispatch.d.ts +17 -1
  482. package/dist/server/error-dispatch.d.ts.map +1 -1
  483. package/dist/server/error-hook.d.ts +2 -2
  484. package/dist/server/error-hook.d.ts.map +1 -1
  485. package/dist/server/handler-state.d.ts +44 -0
  486. package/dist/server/handler-state.d.ts.map +1 -0
  487. package/dist/server/implement-registry.d.ts +54 -0
  488. package/dist/server/implement-registry.d.ts.map +1 -0
  489. package/dist/server/implement.d.ts +9 -55
  490. package/dist/server/implement.d.ts.map +1 -1
  491. package/dist/server/middleware/auth.d.ts +1 -31
  492. package/dist/server/middleware/auth.d.ts.map +1 -1
  493. package/dist/server/middleware/cors.d.ts +17 -0
  494. package/dist/server/middleware/cors.d.ts.map +1 -1
  495. package/dist/server/middleware/jwt.d.ts +31 -0
  496. package/dist/server/middleware/jwt.d.ts.map +1 -0
  497. package/dist/server/middleware/trust-fence.d.ts +1 -1
  498. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  499. package/dist/server/multipart-reader.d.ts +22 -0
  500. package/dist/server/multipart-reader.d.ts.map +1 -0
  501. package/dist/server/multipart.d.ts +1 -1
  502. package/dist/server/multipart.d.ts.map +1 -1
  503. package/dist/server/oauth/cimd.d.ts +88 -0
  504. package/dist/server/oauth/cimd.d.ts.map +1 -0
  505. package/dist/server/oauth/endpoints.d.ts +39 -0
  506. package/dist/server/oauth/endpoints.d.ts.map +1 -0
  507. package/dist/server/oauth/metadata.d.ts +28 -0
  508. package/dist/server/oauth/metadata.d.ts.map +1 -0
  509. package/dist/server/oauth/provider.d.ts +117 -0
  510. package/dist/server/oauth/provider.d.ts.map +1 -0
  511. package/dist/server/realtime.d.ts +1 -1
  512. package/dist/server/realtime.d.ts.map +1 -1
  513. package/dist/server/request-completion.d.ts +16 -0
  514. package/dist/server/request-completion.d.ts.map +1 -0
  515. package/dist/server/response-metadata.d.ts +1 -1
  516. package/dist/server/response-metadata.d.ts.map +1 -1
  517. package/dist/server/route-table.d.ts +9 -0
  518. package/dist/server/route-table.d.ts.map +1 -0
  519. package/dist/server/stream.d.ts +0 -13
  520. package/dist/server/stream.d.ts.map +1 -1
  521. package/dist/server/streaming-pump.d.ts +66 -0
  522. package/dist/server/streaming-pump.d.ts.map +1 -0
  523. package/dist/server/streaming-route.d.ts +12 -5
  524. package/dist/server/streaming-route.d.ts.map +1 -1
  525. package/dist/server/types.d.ts +10 -4
  526. package/dist/server/types.d.ts.map +1 -1
  527. package/dist/server/unix-client-bun.d.ts.map +1 -1
  528. package/dist/server/unix-client-http1.d.ts +76 -0
  529. package/dist/server/unix-client-http1.d.ts.map +1 -0
  530. package/dist/server/unix-client.d.ts.map +1 -1
  531. package/dist/testing/handler-clients.d.ts +32 -0
  532. package/dist/testing/handler-clients.d.ts.map +1 -0
  533. package/dist/testing/managed-resource-conformance-scenarios.d.ts.map +1 -1
  534. package/dist/testing/realtime-probe.d.ts +33 -0
  535. package/dist/testing/realtime-probe.d.ts.map +1 -0
  536. package/dist/testing/surface-conformance.d.ts +2 -32
  537. package/dist/testing/surface-conformance.d.ts.map +1 -1
  538. package/dist/testing/surface-manifest-digest.d.ts +44 -0
  539. package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
  540. package/dist/testing/surface-manifest.d.ts +30 -4
  541. package/dist/testing/surface-manifest.d.ts.map +1 -1
  542. package/dist/tools/agent.d.ts +1 -1
  543. package/dist/tools/agent.d.ts.map +1 -1
  544. package/dist/tools/cli/args-fields.d.ts +31 -0
  545. package/dist/tools/cli/args-fields.d.ts.map +1 -0
  546. package/dist/tools/cli/args-route.d.ts +42 -0
  547. package/dist/tools/cli/args-route.d.ts.map +1 -0
  548. package/dist/tools/cli/args-view.d.ts +32 -0
  549. package/dist/tools/cli/args-view.d.ts.map +1 -0
  550. package/dist/tools/cli/args.d.ts +80 -0
  551. package/dist/tools/cli/args.d.ts.map +1 -0
  552. package/dist/tools/cli/argument-error.d.ts +5 -0
  553. package/dist/tools/cli/argument-error.d.ts.map +1 -0
  554. package/dist/tools/cli/checkpoint.d.ts +24 -0
  555. package/dist/tools/cli/checkpoint.d.ts.map +1 -0
  556. package/dist/tools/cli/command.d.ts +70 -0
  557. package/dist/tools/cli/command.d.ts.map +1 -0
  558. package/dist/tools/cli/config.d.ts +90 -0
  559. package/dist/tools/cli/config.d.ts.map +1 -0
  560. package/dist/tools/cli/create-cli.d.ts +36 -0
  561. package/dist/tools/cli/create-cli.d.ts.map +1 -0
  562. package/dist/tools/cli/download.d.ts +8 -0
  563. package/dist/tools/cli/download.d.ts.map +1 -0
  564. package/dist/tools/cli/format.d.ts +50 -0
  565. package/dist/tools/cli/format.d.ts.map +1 -0
  566. package/dist/tools/cli/help.d.ts +24 -0
  567. package/dist/tools/cli/help.d.ts.map +1 -0
  568. package/dist/tools/cli/installer.d.ts +34 -0
  569. package/dist/tools/cli/installer.d.ts.map +1 -0
  570. package/dist/tools/cli/invoke.d.ts +144 -0
  571. package/dist/tools/cli/invoke.d.ts.map +1 -0
  572. package/dist/tools/cli/io.d.ts +10 -0
  573. package/dist/tools/cli/io.d.ts.map +1 -0
  574. package/dist/tools/cli/managed-surface.d.ts +30 -0
  575. package/dist/tools/cli/managed-surface.d.ts.map +1 -0
  576. package/dist/tools/cli/manifest.d.ts +80 -0
  577. package/dist/tools/cli/manifest.d.ts.map +1 -0
  578. package/dist/tools/cli/policy.d.ts +27 -0
  579. package/dist/tools/cli/policy.d.ts.map +1 -0
  580. package/dist/tools/cli/prepare.d.ts +14 -0
  581. package/dist/tools/cli/prepare.d.ts.map +1 -0
  582. package/dist/tools/cli/profile.d.ts +40 -0
  583. package/dist/tools/cli/profile.d.ts.map +1 -0
  584. package/dist/tools/cli/run-managed.d.ts +5 -0
  585. package/dist/tools/cli/run-managed.d.ts.map +1 -0
  586. package/dist/tools/cli/run-native.d.ts +9 -0
  587. package/dist/tools/cli/run-native.d.ts.map +1 -0
  588. package/dist/tools/cli/session.d.ts +40 -0
  589. package/dist/tools/cli/session.d.ts.map +1 -0
  590. package/dist/tools/cli/signature.d.ts +81 -0
  591. package/dist/tools/cli/signature.d.ts.map +1 -0
  592. package/dist/tools/cli/stream.d.ts +93 -0
  593. package/dist/tools/cli/stream.d.ts.map +1 -0
  594. package/dist/tools/cli/update.d.ts +145 -0
  595. package/dist/tools/cli/update.d.ts.map +1 -0
  596. package/dist/tools/cli/view.d.ts +12 -0
  597. package/dist/tools/cli/view.d.ts.map +1 -0
  598. package/dist/tools/cli/wait.d.ts +54 -0
  599. package/dist/tools/cli/wait.d.ts.map +1 -0
  600. package/dist/tools/connections/runtime.d.ts +1 -1
  601. package/dist/tools/connections/runtime.d.ts.map +1 -1
  602. package/dist/tools/connections/types.d.ts +3 -3
  603. package/dist/tools/connections/types.d.ts.map +1 -1
  604. package/dist/tools/durability-context.d.ts +1 -1
  605. package/dist/tools/durability-context.d.ts.map +1 -1
  606. package/dist/tools/execute-args.d.ts +23 -0
  607. package/dist/tools/execute-args.d.ts.map +1 -0
  608. package/dist/tools/execute-hooks.d.ts +146 -0
  609. package/dist/tools/execute-hooks.d.ts.map +1 -0
  610. package/dist/tools/execute-result.d.ts +40 -0
  611. package/dist/tools/execute-result.d.ts.map +1 -0
  612. package/dist/tools/execute.d.ts +31 -193
  613. package/dist/tools/execute.d.ts.map +1 -1
  614. package/dist/tools/internal/surface-projector.d.ts +9 -6
  615. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  616. package/dist/tools/internal/tool-view.d.ts +41 -0
  617. package/dist/tools/internal/tool-view.d.ts.map +1 -0
  618. package/dist/tools/invoker.d.ts +13 -4
  619. package/dist/tools/invoker.d.ts.map +1 -1
  620. package/dist/tools/lifecycle.d.ts +1 -1
  621. package/dist/tools/lifecycle.d.ts.map +1 -1
  622. package/dist/tools/list-names.d.ts +3 -3
  623. package/dist/tools/list-names.d.ts.map +1 -1
  624. package/dist/tools/manifest.d.ts +2 -2
  625. package/dist/tools/manifest.d.ts.map +1 -1
  626. package/dist/tools/mcp/app.d.ts +62 -0
  627. package/dist/tools/mcp/app.d.ts.map +1 -0
  628. package/dist/tools/mcp/catalog.d.ts +68 -0
  629. package/dist/tools/mcp/catalog.d.ts.map +1 -0
  630. package/dist/tools/mcp/handler.d.ts +46 -0
  631. package/dist/tools/mcp/handler.d.ts.map +1 -0
  632. package/dist/tools/mcp/mount.d.ts +152 -0
  633. package/dist/tools/mcp/mount.d.ts.map +1 -0
  634. package/dist/tools/mcp/prepare.d.ts +76 -0
  635. package/dist/tools/mcp/prepare.d.ts.map +1 -0
  636. package/dist/tools/mcp/progress.d.ts +46 -0
  637. package/dist/tools/mcp/progress.d.ts.map +1 -0
  638. package/dist/tools/mcp/register.d.ts +36 -0
  639. package/dist/tools/mcp/register.d.ts.map +1 -0
  640. package/dist/tools/mcp/round-context.d.ts +38 -0
  641. package/dist/tools/mcp/round-context.d.ts.map +1 -0
  642. package/dist/tools/mcp/round-policy.d.ts +33 -0
  643. package/dist/tools/mcp/round-policy.d.ts.map +1 -0
  644. package/dist/tools/mcp/round.d.ts +53 -0
  645. package/dist/tools/mcp/round.d.ts.map +1 -0
  646. package/dist/tools/mcp/runtime-tools.d.ts +25 -0
  647. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -0
  648. package/dist/tools/mcp/stdio-signals.d.ts +33 -0
  649. package/dist/tools/mcp/stdio-signals.d.ts.map +1 -0
  650. package/dist/tools/mcp/stdio.d.ts +20 -0
  651. package/dist/tools/mcp/stdio.d.ts.map +1 -0
  652. package/dist/tools/mcp/trace.d.ts +12 -0
  653. package/dist/tools/mcp/trace.d.ts.map +1 -0
  654. package/dist/tools/mount.d.ts +14 -7
  655. package/dist/tools/mount.d.ts.map +1 -1
  656. package/dist/tools/native-definition.d.ts +4 -3
  657. package/dist/tools/native-definition.d.ts.map +1 -1
  658. package/dist/tools/operations/async-operation-binding-types.d.ts +127 -0
  659. package/dist/tools/operations/async-operation-binding-types.d.ts.map +1 -0
  660. package/dist/tools/operations/async-operation-binding.d.ts +28 -0
  661. package/dist/tools/operations/async-operation-binding.d.ts.map +1 -0
  662. package/dist/tools/operations/async-operation-canonical-types.d.ts +110 -0
  663. package/dist/tools/operations/async-operation-canonical-types.d.ts.map +1 -0
  664. package/dist/tools/operations/async-operation-canonical.d.ts +7 -0
  665. package/dist/tools/operations/async-operation-canonical.d.ts.map +1 -0
  666. package/dist/tools/operations/async-operation-contract.d.ts.map +1 -0
  667. package/dist/tools/operations/async-operation-id.d.ts +23 -0
  668. package/dist/tools/operations/async-operation-id.d.ts.map +1 -0
  669. package/dist/tools/operations/async-operation-runtime-tools.d.ts +41 -0
  670. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -0
  671. package/dist/tools/operations/async-operation-runtime-types.d.ts +69 -0
  672. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -0
  673. package/dist/tools/operations/async-operation-runtime.d.ts +5 -0
  674. package/dist/tools/operations/async-operation-runtime.d.ts.map +1 -0
  675. package/dist/tools/operations/define-wait-tool.d.ts +22 -0
  676. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -0
  677. package/dist/tools/operations/mount-wait.d.ts.map +1 -0
  678. package/dist/tools/operations/wait-core.d.ts.map +1 -0
  679. package/dist/tools/remote.d.ts +1 -1
  680. package/dist/tools/remote.d.ts.map +1 -1
  681. package/dist/tools/runtime-tool.d.ts +13 -4
  682. package/dist/tools/runtime-tool.d.ts.map +1 -1
  683. package/dist/tools/schema/coerce.d.ts.map +1 -0
  684. package/dist/tools/schema/flatten-join.d.ts.map +1 -0
  685. package/dist/tools/schema/flatten.d.ts.map +1 -0
  686. package/dist/tools/schema/portable-formats.d.ts.map +1 -0
  687. package/dist/tools/schema/presentation.d.ts +24 -0
  688. package/dist/tools/schema/presentation.d.ts.map +1 -0
  689. package/dist/tools/schema/schema.d.ts.map +1 -0
  690. package/dist/tools/schema/untyped-properties.d.ts.map +1 -0
  691. package/dist/tools/surface.d.ts +2 -3
  692. package/dist/tools/surface.d.ts.map +1 -1
  693. package/dist/tools/tool-logger.d.ts +1 -1
  694. package/dist/tools/tool-logger.d.ts.map +1 -1
  695. package/dist/tools/toolkit.d.ts +4 -4
  696. package/dist/tools/toolkit.d.ts.map +1 -1
  697. package/dist/tools/transfer/define-download-tool.d.ts +18 -0
  698. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -0
  699. package/dist/tools/transfer/define-upload-tool.d.ts +16 -0
  700. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -0
  701. package/dist/tools/transfer/define-view-file-tool.d.ts +10 -0
  702. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -0
  703. package/dist/tools/transfer/download-core.d.ts +20 -0
  704. package/dist/tools/transfer/download-core.d.ts.map +1 -0
  705. package/dist/tools/transfer/managed-file-error.d.ts +6 -0
  706. package/dist/tools/transfer/managed-file-error.d.ts.map +1 -0
  707. package/dist/tools/transfer/mount-download.d.ts +41 -0
  708. package/dist/tools/transfer/mount-download.d.ts.map +1 -0
  709. package/dist/tools/transfer/mount-upload.d.ts +21 -0
  710. package/dist/tools/transfer/mount-upload.d.ts.map +1 -0
  711. package/dist/tools/transfer/native-result.d.ts.map +1 -0
  712. package/dist/tools/transfer/upload-core.d.ts +4 -0
  713. package/dist/tools/transfer/upload-core.d.ts.map +1 -0
  714. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -0
  715. package/dist/tools/transfer/view-file.d.ts +62 -0
  716. package/dist/tools/transfer/view-file.d.ts.map +1 -0
  717. package/dist/tools/transports.d.ts +1 -1
  718. package/dist/tools/transports.d.ts.map +1 -1
  719. package/dist/tracking/client-listeners.d.ts +30 -0
  720. package/dist/tracking/client-listeners.d.ts.map +1 -0
  721. package/dist/tracking/client-visit.d.ts +61 -0
  722. package/dist/tracking/client-visit.d.ts.map +1 -0
  723. package/dist/tracking/client.d.ts +3 -2
  724. package/dist/tracking/client.d.ts.map +1 -1
  725. package/dist/tracking/contract.d.ts +1 -1
  726. package/dist/tracking/contract.d.ts.map +1 -1
  727. package/llms/agent-runtime-browser.txt +33 -0
  728. package/llms/agent-runtime-coding-tools.txt +58 -0
  729. package/llms/agent-runtime-harness.txt +45 -0
  730. package/llms/agent-runtime-openrouter.txt +22 -0
  731. package/llms/agent-runtime-sandbox.txt +159 -0
  732. package/llms/agent-runtime-sqlite-bun.txt +29 -0
  733. package/llms/agent-runtime-sqlite-node.txt +26 -0
  734. package/llms/agent-runtime-testing.txt +30 -0
  735. package/llms/agent-runtime.2.txt +550 -0
  736. package/llms/agent-runtime.3.txt +311 -0
  737. package/llms/agent-runtime.txt +893 -0
  738. package/llms/application-diagnostic-journal.txt +30 -0
  739. package/llms/application-grammy.txt +27 -0
  740. package/llms/application-opentelemetry.txt +27 -0
  741. package/llms/application-schemas.txt +42 -0
  742. package/llms/application.2.txt +487 -0
  743. package/llms/application.txt +886 -0
  744. package/llms/cli.2.txt +80 -0
  745. package/llms/cli.txt +948 -0
  746. package/llms/contract.txt +606 -0
  747. package/llms/declaration.txt +286 -0
  748. package/llms/files.txt +33 -0
  749. package/llms/geo.txt +114 -0
  750. package/llms/google.txt +27 -0
  751. package/llms/live.txt +471 -0
  752. package/llms/node.txt +43 -0
  753. package/llms/oauth.txt +136 -0
  754. package/llms/observability.txt +893 -0
  755. package/llms/primitives.txt +158 -0
  756. package/llms/react.txt +184 -0
  757. package/llms/release.txt +176 -0
  758. package/llms/remote.txt +25 -0
  759. package/llms/server.2.txt +361 -0
  760. package/llms/server.3.txt +1031 -0
  761. package/llms/server.4.txt +905 -0
  762. package/llms/server.5.txt +250 -0
  763. package/llms/server.txt +996 -0
  764. package/llms/stitchkit.2.txt +836 -0
  765. package/llms/stitchkit.3.txt +147 -0
  766. package/llms/stitchkit.txt +260 -0
  767. package/llms/telegram.txt +30 -0
  768. package/llms/testing.txt +676 -0
  769. package/llms/tools-connections.txt +45 -0
  770. package/llms/tools-contract.txt +9 -0
  771. package/llms/tools-invoker.txt +9 -0
  772. package/llms/tools.2.txt +647 -0
  773. package/llms/tools.3.txt +288 -0
  774. package/llms/tools.txt +966 -0
  775. package/llms/tracking-server.txt +32 -0
  776. package/llms/tracking.txt +263 -0
  777. package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
  778. package/llms/upgrading-0.53.0-0.67.0.txt +1174 -0
  779. package/llms/upgrading-0.68.0-0.94.0.txt +1159 -0
  780. package/llms/upgrading.txt +215 -0
  781. package/llms-full.txt +312 -77
  782. package/llms.txt +54 -5
  783. package/package.json +84 -83
  784. package/dist/agent-runtime/durability-contract.d.ts +0 -176
  785. package/dist/agent-runtime/durability-contract.d.ts.map +0 -1
  786. package/dist/agent-runtime/durability-json.d.ts +0 -3
  787. package/dist/agent-runtime/durability-json.d.ts.map +0 -1
  788. package/dist/agent-runtime/durability-ledger.d.ts +0 -16
  789. package/dist/agent-runtime/durability-ledger.d.ts.map +0 -1
  790. package/dist/agent-runtime/durability-scheduler.d.ts +0 -29
  791. package/dist/agent-runtime/durability-scheduler.d.ts.map +0 -1
  792. package/dist/agent-runtime/durability.d.ts +0 -14
  793. package/dist/agent-runtime/durability.d.ts.map +0 -1
  794. package/dist/agent-runtime/store-driver.d.ts +0 -814
  795. package/dist/agent-runtime/store-driver.d.ts.map +0 -1
  796. package/dist/agent-runtime-browser.d.ts +0 -5
  797. package/dist/agent-runtime-browser.d.ts.map +0 -1
  798. package/dist/agent-runtime-browser.js +0 -124
  799. package/dist/agent-runtime-coding-tools.d.ts +0 -2
  800. package/dist/agent-runtime-coding-tools.d.ts.map +0 -1
  801. package/dist/agent-runtime-coding-tools.js +0 -23
  802. package/dist/agent-runtime-harness.d.ts +0 -2
  803. package/dist/agent-runtime-harness.d.ts.map +0 -1
  804. package/dist/agent-runtime-harness.js +0 -729
  805. package/dist/agent-runtime-openrouter.d.ts +0 -29
  806. package/dist/agent-runtime-openrouter.d.ts.map +0 -1
  807. package/dist/agent-runtime-openrouter.js +0 -270
  808. package/dist/agent-runtime-sandbox.d.ts +0 -5
  809. package/dist/agent-runtime-sandbox.d.ts.map +0 -1
  810. package/dist/agent-runtime-sandbox.js +0 -798
  811. package/dist/agent-runtime-sqlite-bun.d.ts +0 -11
  812. package/dist/agent-runtime-sqlite-bun.d.ts.map +0 -1
  813. package/dist/agent-runtime-sqlite-bun.js +0 -42
  814. package/dist/agent-runtime-sqlite-node.d.ts +0 -11
  815. package/dist/agent-runtime-sqlite-node.d.ts.map +0 -1
  816. package/dist/agent-runtime-sqlite-node.js +0 -44
  817. package/dist/agent-runtime-testing.d.ts +0 -3
  818. package/dist/agent-runtime-testing.d.ts.map +0 -1
  819. package/dist/agent-runtime-testing.js +0 -156
  820. package/dist/agent-runtime.d.ts +0 -38
  821. package/dist/agent-runtime.d.ts.map +0 -1
  822. package/dist/agent-runtime.js +0 -2607
  823. package/dist/application/channel.d.ts.map +0 -1
  824. package/dist/application-diagnostic-journal.d.ts +0 -21
  825. package/dist/application-diagnostic-journal.d.ts.map +0 -1
  826. package/dist/application-diagnostic-journal.js +0 -632
  827. package/dist/application-grammy.d.ts +0 -2
  828. package/dist/application-grammy.d.ts.map +0 -1
  829. package/dist/application-grammy.js +0 -169
  830. package/dist/application-opentelemetry.d.ts +0 -2
  831. package/dist/application-opentelemetry.d.ts.map +0 -1
  832. package/dist/application-opentelemetry.js +0 -250
  833. package/dist/application-schemas.d.ts +0 -15
  834. package/dist/application-schemas.d.ts.map +0 -1
  835. package/dist/application-schemas.js +0 -27
  836. package/dist/application.d.ts +0 -22
  837. package/dist/application.d.ts.map +0 -1
  838. package/dist/application.js +0 -1977
  839. package/dist/cli.d.ts +0 -41
  840. package/dist/cli.d.ts.map +0 -1
  841. package/dist/cli.js +0 -753
  842. package/dist/contract/index.d.ts +0 -8
  843. package/dist/contract/index.d.ts.map +0 -1
  844. package/dist/contract/index.js +0 -55
  845. package/dist/declaration.d.ts.map +0 -1
  846. package/dist/declaration.js +0 -183
  847. package/dist/files.d.ts +0 -3
  848. package/dist/files.d.ts.map +0 -1
  849. package/dist/files.js +0 -15
  850. package/dist/geo.d.ts +0 -3
  851. package/dist/geo.d.ts.map +0 -1
  852. package/dist/geo.js +0 -245
  853. package/dist/google.d.ts.map +0 -1
  854. package/dist/google.js +0 -175
  855. package/dist/index-0a349c33.js +0 -470
  856. package/dist/index-0j3vcp5m.js +0 -28
  857. package/dist/index-2c2bjw3s.js +0 -51
  858. package/dist/index-2na0qrfn.js +0 -214
  859. package/dist/index-2qzskm8h.js +0 -63
  860. package/dist/index-3bmnp41g.js +0 -2169
  861. package/dist/index-3xwxfj4z.js +0 -334
  862. package/dist/index-4fpa9dy2.js +0 -51
  863. package/dist/index-6kyksz9y.js +0 -268
  864. package/dist/index-77fekveh.js +0 -44
  865. package/dist/index-7gnkny4z.js +0 -326
  866. package/dist/index-7zbps32p.js +0 -89
  867. package/dist/index-9f8ztey6.js +0 -588
  868. package/dist/index-a11g2kry.js +0 -866
  869. package/dist/index-a916km3r.js +0 -45
  870. package/dist/index-actkayzn.js +0 -367
  871. package/dist/index-bn2cjajt.js +0 -524
  872. package/dist/index-bx75zwt7.js +0 -63
  873. package/dist/index-cby4ar3v.js +0 -46
  874. package/dist/index-cnyk6te3.js +0 -77
  875. package/dist/index-cxqhvq21.js +0 -413
  876. package/dist/index-e0znv5gn.js +0 -176
  877. package/dist/index-e42wzzz5.js +0 -154
  878. package/dist/index-f477k430.js +0 -324
  879. package/dist/index-f9mb610r.js +0 -177
  880. package/dist/index-fadnxwna.js +0 -1046
  881. package/dist/index-fq77yfzc.js +0 -1303
  882. package/dist/index-h9etkkyk.js +0 -1126
  883. package/dist/index-hrbajay7.js +0 -1196
  884. package/dist/index-kw9t5ayn.js +0 -507
  885. package/dist/index-mzvgxp0n.js +0 -80
  886. package/dist/index-n0f51dfn.js +0 -3170
  887. package/dist/index-p13mwz16.js +0 -16
  888. package/dist/index-s8cnx02s.js +0 -90
  889. package/dist/index-sr93cwf9.js +0 -325
  890. package/dist/index-tmwcrptx.js +0 -85
  891. package/dist/index-v5573g1k.js +0 -142
  892. package/dist/index-vjpvjqpn.js +0 -86
  893. package/dist/index-vk3kq9sb.js +0 -3344
  894. package/dist/index-wc4x00bn.js +0 -103
  895. package/dist/index-wnfk50r0.js +0 -211
  896. package/dist/index-yewwh1w4.js +0 -647
  897. package/dist/index-yn8remb1.js +0 -290
  898. package/dist/index-ywd0y6m1.js +0 -394
  899. package/dist/index-zwkgfq1s.js +0 -345
  900. package/dist/index.d.ts +0 -14
  901. package/dist/index.d.ts.map +0 -1
  902. package/dist/index.js +0 -632
  903. package/dist/internal/errors.d.ts +0 -92
  904. package/dist/internal/errors.d.ts.map +0 -1
  905. package/dist/internal/observability-sink.d.ts +0 -81
  906. package/dist/internal/observability-sink.d.ts.map +0 -1
  907. package/dist/live.d.ts +0 -19
  908. package/dist/live.d.ts.map +0 -1
  909. package/dist/live.js +0 -282
  910. package/dist/logger.d.ts.map +0 -1
  911. package/dist/node.d.ts +0 -18
  912. package/dist/node.d.ts.map +0 -1
  913. package/dist/node.js +0 -303
  914. package/dist/oauth.d.ts +0 -57
  915. package/dist/oauth.d.ts.map +0 -1
  916. package/dist/oauth.js +0 -170
  917. package/dist/observability/index.d.ts +0 -19
  918. package/dist/observability/index.d.ts.map +0 -1
  919. package/dist/observability/index.js +0 -569
  920. package/dist/primitives.d.ts +0 -3
  921. package/dist/primitives.d.ts.map +0 -1
  922. package/dist/primitives.js +0 -754
  923. package/dist/react.d.ts +0 -5
  924. package/dist/react.d.ts.map +0 -1
  925. package/dist/react.js +0 -403
  926. package/dist/release.d.ts +0 -15
  927. package/dist/release.d.ts.map +0 -1
  928. package/dist/release.js +0 -196
  929. package/dist/remote.d.ts +0 -9
  930. package/dist/remote.d.ts.map +0 -1
  931. package/dist/remote.js +0 -88
  932. package/dist/retained.d.ts.map +0 -1
  933. package/dist/server/file-state-store.d.ts +0 -23
  934. package/dist/server/file-state-store.d.ts.map +0 -1
  935. package/dist/server/index.d.ts +0 -36
  936. package/dist/server/index.d.ts.map +0 -1
  937. package/dist/server/index.js +0 -1745
  938. package/dist/server/request.d.ts.map +0 -1
  939. package/dist/telegram.d.ts +0 -3
  940. package/dist/telegram.d.ts.map +0 -1
  941. package/dist/telegram.js +0 -224
  942. package/dist/testing/agent-store-conformance.d.ts +0 -40
  943. package/dist/testing/agent-store-conformance.d.ts.map +0 -1
  944. package/dist/testing.d.ts +0 -39
  945. package/dist/testing.d.ts.map +0 -1
  946. package/dist/testing.js +0 -2209
  947. package/dist/tool-invoker.d.ts +0 -9
  948. package/dist/tool-invoker.d.ts.map +0 -1
  949. package/dist/tool-invoker.js +0 -21
  950. package/dist/tools/async-operation-contract.d.ts.map +0 -1
  951. package/dist/tools/async-operation.d.ts +0 -332
  952. package/dist/tools/async-operation.d.ts.map +0 -1
  953. package/dist/tools/cli-args.d.ts +0 -143
  954. package/dist/tools/cli-args.d.ts.map +0 -1
  955. package/dist/tools/cli-checkpoint.d.ts +0 -24
  956. package/dist/tools/cli-checkpoint.d.ts.map +0 -1
  957. package/dist/tools/cli-command.d.ts +0 -70
  958. package/dist/tools/cli-command.d.ts.map +0 -1
  959. package/dist/tools/cli-format.d.ts +0 -49
  960. package/dist/tools/cli-format.d.ts.map +0 -1
  961. package/dist/tools/cli-installer.d.ts +0 -34
  962. package/dist/tools/cli-installer.d.ts.map +0 -1
  963. package/dist/tools/cli-invoke.d.ts +0 -143
  964. package/dist/tools/cli-invoke.d.ts.map +0 -1
  965. package/dist/tools/cli-manifest.d.ts +0 -80
  966. package/dist/tools/cli-manifest.d.ts.map +0 -1
  967. package/dist/tools/cli-policy.d.ts +0 -27
  968. package/dist/tools/cli-policy.d.ts.map +0 -1
  969. package/dist/tools/cli-profile.d.ts +0 -40
  970. package/dist/tools/cli-profile.d.ts.map +0 -1
  971. package/dist/tools/cli-signature.d.ts +0 -81
  972. package/dist/tools/cli-signature.d.ts.map +0 -1
  973. package/dist/tools/cli-stream.d.ts +0 -93
  974. package/dist/tools/cli-stream.d.ts.map +0 -1
  975. package/dist/tools/cli-update.d.ts +0 -126
  976. package/dist/tools/cli-update.d.ts.map +0 -1
  977. package/dist/tools/cli-view.d.ts +0 -12
  978. package/dist/tools/cli-view.d.ts.map +0 -1
  979. package/dist/tools/cli-wait.d.ts +0 -54
  980. package/dist/tools/cli-wait.d.ts.map +0 -1
  981. package/dist/tools/cli.d.ts +0 -94
  982. package/dist/tools/cli.d.ts.map +0 -1
  983. package/dist/tools/coerce.d.ts.map +0 -1
  984. package/dist/tools/connections/index.d.ts +0 -20
  985. package/dist/tools/connections/index.d.ts.map +0 -1
  986. package/dist/tools/connections/index.js +0 -1107
  987. package/dist/tools/define-download-tool.d.ts +0 -18
  988. package/dist/tools/define-download-tool.d.ts.map +0 -1
  989. package/dist/tools/define-upload-tool.d.ts +0 -16
  990. package/dist/tools/define-upload-tool.d.ts.map +0 -1
  991. package/dist/tools/define-view-file-tool.d.ts +0 -10
  992. package/dist/tools/define-view-file-tool.d.ts.map +0 -1
  993. package/dist/tools/define-wait-tool.d.ts +0 -22
  994. package/dist/tools/define-wait-tool.d.ts.map +0 -1
  995. package/dist/tools/download-core.d.ts +0 -20
  996. package/dist/tools/download-core.d.ts.map +0 -1
  997. package/dist/tools/flatten-join.d.ts.map +0 -1
  998. package/dist/tools/flatten.d.ts.map +0 -1
  999. package/dist/tools/json-schema-dialect.d.ts +0 -17
  1000. package/dist/tools/json-schema-dialect.d.ts.map +0 -1
  1001. package/dist/tools/json-schema.d.ts.map +0 -1
  1002. package/dist/tools/managed-file-error.d.ts +0 -6
  1003. package/dist/tools/managed-file-error.d.ts.map +0 -1
  1004. package/dist/tools/mcp-app.d.ts +0 -62
  1005. package/dist/tools/mcp-app.d.ts.map +0 -1
  1006. package/dist/tools/mcp-catalog.d.ts +0 -68
  1007. package/dist/tools/mcp-catalog.d.ts.map +0 -1
  1008. package/dist/tools/mcp-handler.d.ts +0 -46
  1009. package/dist/tools/mcp-handler.d.ts.map +0 -1
  1010. package/dist/tools/mcp-prepare.d.ts +0 -75
  1011. package/dist/tools/mcp-prepare.d.ts.map +0 -1
  1012. package/dist/tools/mcp-progress.d.ts +0 -46
  1013. package/dist/tools/mcp-progress.d.ts.map +0 -1
  1014. package/dist/tools/mcp-round-policy.d.ts +0 -33
  1015. package/dist/tools/mcp-round-policy.d.ts.map +0 -1
  1016. package/dist/tools/mcp-round.d.ts +0 -61
  1017. package/dist/tools/mcp-round.d.ts.map +0 -1
  1018. package/dist/tools/mcp-stdio-signals.d.ts +0 -33
  1019. package/dist/tools/mcp-stdio-signals.d.ts.map +0 -1
  1020. package/dist/tools/mcp-stdio.d.ts +0 -20
  1021. package/dist/tools/mcp-stdio.d.ts.map +0 -1
  1022. package/dist/tools/mcp-trace.d.ts +0 -12
  1023. package/dist/tools/mcp-trace.d.ts.map +0 -1
  1024. package/dist/tools/mcp.d.ts +0 -152
  1025. package/dist/tools/mcp.d.ts.map +0 -1
  1026. package/dist/tools/mount-download.d.ts +0 -41
  1027. package/dist/tools/mount-download.d.ts.map +0 -1
  1028. package/dist/tools/mount-upload.d.ts +0 -21
  1029. package/dist/tools/mount-upload.d.ts.map +0 -1
  1030. package/dist/tools/mount-wait.d.ts.map +0 -1
  1031. package/dist/tools/native-mcp.d.ts +0 -20
  1032. package/dist/tools/native-mcp.d.ts.map +0 -1
  1033. package/dist/tools/native-result.d.ts.map +0 -1
  1034. package/dist/tools/oauth-metadata.d.ts +0 -28
  1035. package/dist/tools/oauth-metadata.d.ts.map +0 -1
  1036. package/dist/tools/oauth-provider.d.ts +0 -184
  1037. package/dist/tools/oauth-provider.d.ts.map +0 -1
  1038. package/dist/tools/portable-formats.d.ts.map +0 -1
  1039. package/dist/tools/presentation.d.ts +0 -22
  1040. package/dist/tools/presentation.d.ts.map +0 -1
  1041. package/dist/tools/schema.d.ts.map +0 -1
  1042. package/dist/tools/untyped-properties.d.ts.map +0 -1
  1043. package/dist/tools/upload-core.d.ts +0 -4
  1044. package/dist/tools/upload-core.d.ts.map +0 -1
  1045. package/dist/tools/view-file-contract.d.ts.map +0 -1
  1046. package/dist/tools/view-file.d.ts +0 -62
  1047. package/dist/tools/view-file.d.ts.map +0 -1
  1048. package/dist/tools/wait-core.d.ts.map +0 -1
  1049. package/dist/tools-contract.d.ts +0 -29
  1050. package/dist/tools-contract.d.ts.map +0 -1
  1051. package/dist/tools-contract.js +0 -24
  1052. package/dist/tools.d.ts +0 -50
  1053. package/dist/tools.d.ts.map +0 -1
  1054. package/dist/tools.js +0 -2930
  1055. package/dist/tracking-server.d.ts +0 -15
  1056. package/dist/tracking-server.d.ts.map +0 -1
  1057. package/dist/tracking.d.ts +0 -24
  1058. package/dist/tracking.d.ts.map +0 -1
  1059. package/dist/tracking.js +0 -1092
  1060. package/dist/upgrade-cli.d.ts.map +0 -1
  1061. package/dist/upgrade-cli.js +0 -177
  1062. /package/dist/{retained.d.ts → browser/retained.d.ts} +0 -0
  1063. /package/dist/{declaration.d.ts → declaration/declaration.d.ts} +0 -0
  1064. /package/dist/{upgrade-cli.d.ts → entrypoints/bin/upgrade-cli.d.ts} +0 -0
  1065. /package/dist/{tracking-server.js → entrypoints/tracking/server.js} +0 -0
  1066. /package/dist/{google.d.ts → google/google.d.ts} +0 -0
  1067. /package/dist/{index-pq95qkbf.js → index-5jm36zv1.js} +0 -0
  1068. /package/dist/{application → internal}/channel.d.ts +0 -0
  1069. /package/dist/{logger.d.ts → internal/logger.d.ts} +0 -0
  1070. /package/dist/{server → internal}/request.d.ts +0 -0
  1071. /package/dist/{tools → json-schema}/json-schema.d.ts +0 -0
  1072. /package/dist/tools/{async-operation-contract.d.ts → operations/async-operation-contract.d.ts} +0 -0
  1073. /package/dist/tools/{mount-wait.d.ts → operations/mount-wait.d.ts} +0 -0
  1074. /package/dist/tools/{wait-core.d.ts → operations/wait-core.d.ts} +0 -0
  1075. /package/dist/tools/{coerce.d.ts → schema/coerce.d.ts} +0 -0
  1076. /package/dist/tools/{flatten-join.d.ts → schema/flatten-join.d.ts} +0 -0
  1077. /package/dist/tools/{flatten.d.ts → schema/flatten.d.ts} +0 -0
  1078. /package/dist/tools/{portable-formats.d.ts → schema/portable-formats.d.ts} +0 -0
  1079. /package/dist/tools/{schema.d.ts → schema/schema.d.ts} +0 -0
  1080. /package/dist/tools/{untyped-properties.d.ts → schema/untyped-properties.d.ts} +0 -0
  1081. /package/dist/tools/{native-result.d.ts → transfer/native-result.d.ts} +0 -0
  1082. /package/dist/tools/{view-file-contract.d.ts → transfer/view-file-contract.d.ts} +0 -0
@@ -0,0 +1,893 @@
1
+ # stitchkit/observability — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: Guide: Observability (docs/guide/observability.md) · API reference: `stitchkit/observability` (docs/api/reference.md)
7
+
8
+ ==============================================================================
9
+ # Guide: Observability (docs/guide/observability.md)
10
+ ==============================================================================
11
+
12
+ # Observability
13
+
14
+ A request reaches your app through one of two surfaces — an HTTP route or a
15
+ tool call (MCP / agent). Observability is the same question on both: *what
16
+ happened, how long did it take, who made it, did it fail.*
17
+
18
+ stitchkit answers this at two levels.
19
+
20
+ - **The raw hooks** — `LifecycleHooks` and `ToolCallHooks`. Every request and
21
+ every tool call passes through a point you can observe. The lowest level;
22
+ always available. [Jump ↓](#the-raw-hooks)
23
+ - **`stitchkit/observability`** — framework-owned HTTP completion plus canonical
24
+ tool hooks: W3C trace context, an `AsyncLocalStorage` request context, payload
25
+ sanitisation and `createObservability` with independent request/tool sinks.
26
+ [Start here ↓](#the-observability-module)
27
+
28
+ stitchkit still ships no logger and no audit store, and auditing stays opt-in —
29
+ those are the app's choice (→ ADR 0012, reaffirmed in ADR 0184). What it ships is
30
+ the machinery that turns a completed call into a clean, normalised record, keeps
31
+ the ones worth keeping, and does not lose them when the store is down.
32
+
33
+ ## The observability module
34
+
35
+ `stitchkit/observability` is server-only. It has three parts — a trace context,
36
+ a request context, and event projections — and you usually touch only the last.
37
+
38
+ ### createObservability
39
+
40
+ `createObservability` configures request and tool projections independently.
41
+ Every completed application call is normalised into one `RequestEvent`; HTTP
42
+ completion is owned directly by `createHandler`, while MCP/Agent completion uses
43
+ the canonical `ToolCallHooks` runner. Confirmed HTTP client cancellation stays
44
+ in the access log by default and becomes a structured event only when the
45
+ request sink opts in. There is no nested HTTP audit wrapper.
46
+
47
+ ```ts
48
+ import { createObservability } from 'stitchkit/observability'
49
+
50
+ const write = (event) => db.auditLog.create({ data: {
51
+ traceId: event.traceId,
52
+ source: event.source,
53
+ method: event.method,
54
+ path: event.path,
55
+ ok: event.ok,
56
+ statusCode: event.statusCode,
57
+ durationMs: event.durationMs,
58
+ userId: event.userId,
59
+ payload: event.payload,
60
+ }})
61
+
62
+ export const observability = createObservability({
63
+ request: {
64
+ write,
65
+ includePayload: false, // default: no Request.clone(), payload is null
66
+ includeCancelled: false, // default: keep client closes in access logs only
67
+ filter: (event) => event.method !== 'GET', // see the note on jobs below
68
+ },
69
+ tools: {
70
+ write,
71
+ filter: (event) => event.source === 'mcp' || event.source === 'agent',
72
+ },
73
+ })
74
+ ```
75
+
76
+ Wire each projection where its completion is owned:
77
+
78
+ ```ts
79
+ createServer({ services, observability: observability.request })
80
+
81
+ createMcpHandler({ /* … */ hooks: observability.toolCall })
82
+ mountAgent(service, { hooks: observability.toolCall })
83
+ ```
84
+
85
+ Each sink runs fire-and-forget and fails independently: a slow or broken request
86
+ sink cannot block the response, suppress operational logging or break the tool
87
+ sink.
88
+
89
+ #### Client cancellation
90
+
91
+ A physical client close is classified only when the request's own signal is
92
+ aborted and the thrown value is either an `AbortError` or contains the exact
93
+ `request.signal.reason` by identity at the top level or within at most eight
94
+ standard `cause` links. Cause traversal is cycle-safe. No message or error-code
95
+ matching is used; active requests and unrelated/deeper causes remain application
96
+ failures. The access completion is always `499/info`, without application error
97
+ fields or project `onError`.
98
+
99
+ Structured request sinks are default-preserving: existing sinks receive no row
100
+ for this outcome. Opt in when cancellation frequency belongs in the durable
101
+ stream:
102
+
103
+ ```ts
104
+ const observability = createObservability({
105
+ request: {
106
+ includeCancelled: true,
107
+ write: (event) => {
108
+ if (event.outcome === 'cancelled') return recordClientClose(event)
109
+ return recordApplicationRequest(event)
110
+ },
111
+ },
112
+ })
113
+ ```
114
+
115
+ An opted-in row has `outcome: 'cancelled'`, `ok: false`, `statusCode: 499`, the
116
+ ordinary identity/trace/timing fields and no `errorCode`, `errorMessage` or
117
+ `errorDetail`. `ok` remains the legacy success bit: branch on `outcome` first.
118
+ Cancellation rows use the same filter, capacity, diagnostics, ordering,
119
+ `flush()` and `close()` machinery as every request event. MCP protocol
120
+ cancellation remains represented by `event.mcp.outcome`; Agent and CLI have no
121
+ generic client-disconnect signal and are not inferred from error text.
122
+
123
+ The fire-and-forget work has an explicit bounded lifecycle:
124
+
125
+ ```ts
126
+ export const observability = createObservability({
127
+ request: {
128
+ maxPending: 1_000,
129
+ write: persistRequestEvent,
130
+ onSinkError: ({ error, event }) => reportAuditFailure(error, event),
131
+ onDrop: ({ reason, event, pending }) => {
132
+ reportAuditDrop({ reason, traceId: event.traceId, pending })
133
+ },
134
+ },
135
+ tools: {
136
+ maxPending: 500,
137
+ write: persistToolEvent,
138
+ onSinkError: ({ error, event }) => reportToolAuditFailure(error, event),
139
+ onDrop: reportToolAuditDrop,
140
+ },
141
+ })
142
+
143
+ const status = observability.getStatus()
144
+ const report = await observability.close({ timeoutMs: 5_000 })
145
+ ```
146
+
147
+ `maxPending` defaults to `1000` per sink and must be a positive safe integer.
148
+ Filtering and sanitisation happen before a write occupies a pending slot. At
149
+ capacity, a new event is rejected with `onDrop({ reason: 'capacity', ... })`;
150
+ after close, admission reports `reason: 'closed'`. Existing writes are never
151
+ cancelled. Sink, filter and diagnostic-callback failures remain isolated from
152
+ the observed request or tool call and are reported through `onSinkError` when
153
+ configured; `onSinkError`/`onDrop` cannot create unhandled rejections.
154
+
155
+ `getStatus()` returns immutable per-surface and aggregate counters: capacity,
156
+ received, accepted, filtered, completed, dropped, failed, preparation failures,
157
+ preparing/pending work and the closed flag. Read it from readiness or metrics
158
+ without parsing callback logs.
159
+
160
+ `flush()` snapshots the current generation and waits only for events admitted
161
+ up to that call. `close()` atomically stops admission, drains every accepted
162
+ generation and returns the final counters plus `durationMs`; repeated unbounded
163
+ calls return the same report. Graceful shutdown order is therefore:
164
+
165
+ 1. stop HTTP/MCP admission;
166
+ 2. wait for active requests and tool calls;
167
+ 3. `await observability.close({ timeoutMs })`;
168
+ 4. close the database/storage connection used by the sinks.
169
+
170
+ ### Give the drain a bound in a shutdown budget
171
+
172
+ Unbounded, `close()` waits for every accepted event however long the sink takes.
173
+ That is right when the sink is healthy and fatal when it is not: one write that
174
+ never settles — a database that has stopped answering — holds the drain forever,
175
+ and a shutdown that gives every other step a deadline then spends its entire
176
+ budget here and exits by force. A drain that cannot be bounded cannot take part
177
+ in a shutdown budget: it either fits, or it cancels the budget.
178
+
179
+ Both `flush` and `close` take `{ timeoutMs?, signal? }`:
180
+
181
+ ```ts
182
+ const report = await observability.close({ timeoutMs: 5_000 })
183
+ if (!report.drained) {
184
+ const t = report.total
185
+ logger.warn('audit drain incomplete', {
186
+ stillWriting: t.pending + t.preparing,
187
+ neverWritten: t.received - t.filtered - t.completed,
188
+ })
189
+ }
190
+ ```
191
+
192
+ Those are two different numbers and the difference matters. `pending +
193
+ preparing` is what the drain was still waiting for when the bound expired —
194
+ events handed to `write` that may yet succeed. `received - filtered -
195
+ completed` is every event the sink has not written **for any reason**: those,
196
+ plus the ones already lost to `failed`, `dropped` and `preparationFailed`. A
197
+ shutdown log that wants to state how much audit was lost wants the second; one
198
+ that wants to explain why the drain did not finish wants the first.
199
+
200
+ `drained` is read from the counters, not from which side of the race won, so a
201
+ bound that expires on a sink that has in fact finished — a shutdown signal
202
+ already aborted by an earlier step — reports `true` rather than a false alarm.
203
+
204
+ The bound ends the **waiting**, not the writes: a sink's `write` is handed no
205
+ cancellation, so an outstanding one keeps running against whatever the consumer
206
+ closes next. It is a bound on waiting for I/O, not on wall time — no bound can
207
+ preempt a `write` that occupies the event loop. Racing `close()` against your
208
+ own timer looks equivalent and is not: it discards the report along with the
209
+ wait.
210
+
211
+ `flush(bound?)` takes the same bound and returns whether the generation it
212
+ waited on settled. That outcome is returned rather than left to `getStatus()`,
213
+ which cannot answer it: flush waits on the events admitted before the call while
214
+ the status counts everything alive right now, so a complete flush and an expired
215
+ one look identical there.
216
+
217
+ Every other sink in the framework takes the same bound —
218
+ `createApplicationEventSink`, `createApplicationSnapshotSink`,
219
+ `createAgentRuntimeEventSink`, `createAgentObservability`. The hazard was never
220
+ specific to the audit sink; it was specific to waiting without a limit.
221
+
222
+ The drain itself is started once and shared, so a second `close` with a shorter
223
+ bound observes the same drain under its own limit rather than starting another.
224
+ Passing no bound keeps the previous behaviour exactly, including the identical
225
+ returned promise.
226
+
227
+ Stitchkit manages only in-process delivery. If process-crash durability matters,
228
+ make `write` enqueue into a consumer-owned durable outbox and let that adapter
229
+ own retry, replay and storage policy:
230
+
231
+ ```ts
232
+ interface AuditOutbox {
233
+ enqueue(event: RequestEvent): Promise<void>
234
+ }
235
+
236
+ const observability = createObservability({
237
+ request: { write: (event) => outbox.enqueue(event) },
238
+ tools: { write: (event) => outbox.enqueue(event) },
239
+ })
240
+ ```
241
+
242
+ The core intentionally contains no retry scheduler, database dependency or
243
+ disk queue. A durable adapter can use `(traceId, spanId, source, toolPhase)` as
244
+ its idempotency identity.
245
+
246
+ ### RequestEvent
247
+
248
+ Every surface produces the same shape — so a single audit table stays
249
+ queryable across all three:
250
+
251
+ | Field | Notes |
252
+ |-------|-------|
253
+ | `source` | `http` \| `mcp` \| `agent` \| `job` |
254
+ | `kind` | `request` \| `job` — written on **every** row, so a filter never has to read it off an absent `method` |
255
+ | `name` | what the work is, on a job (`agent-loop`, `broadcast-send`); absent on a request, which its method and path name |
256
+ | `method` / `path` | the verb + path, or `TOOL` + `/{source}/{tool}` — **absent** on a job, which arrived over no transport |
257
+ | `serviceName` / `action` | stable contract identity of the operation (→ ADR 0022) — from the contract, not parsed from `path`; set on every surface, present even on a pre-handler 400 |
258
+ | `toolName` | tool calls only |
259
+ | `httpMethod` | the contract verb on **tool** events (their `method` is `TOOL`) — filter reads vs writes across both surfaces with `(event.httpMethod ?? event.method) !== 'GET'` |
260
+ | `dimensions` | app-defined domain dimensions (tenant / project / entity id) — see [request context](#request-context) |
261
+ | `traceId` / `spanId` / `parentSpanId` | [W3C trace context](#trace-context) |
262
+ | `outcome` | optional `'cancelled'` on explicitly enabled HTTP client-close rows; ordinary rows omit it |
263
+ | `ok` / `statusCode` | legacy success bit plus real HTTP status, or `200`/`400` for a tool; an opted-in cancellation is `false` / `499`. `statusCode` is **absent** on a job — it had no transport to have a status on, and inventing one would be the same defect as the `method: 'AGENT'` this replaced. A job's outcome is `ok`, plus `errorCode` when it failed |
264
+ | `durationMs` / `startedAt` | timing |
265
+ | `errorCode` / `errorMessage` / `errorDetail` | failures only — `errorDetail` carries the structure the message flattens (e.g. Zod issues) |
266
+ | `payload` | sanitised tool arguments; HTTP is `null` unless request `includePayload` is enabled |
267
+ | `resultSize` / `responseBytes` | result item count + serialised size |
268
+ | `userId` / `ipAddress` / `userAgent` | identity |
269
+
270
+ ### Work that is not a request — `runUnitOfWork`
271
+
272
+ An agent loop launched fire-and-forget, a scheduled broadcast, a scenario engine
273
+ tick: each has a start, a duration and an outcome, and none of them arrived over
274
+ a transport. Run one inside a context and it is audited like everything else:
275
+
276
+ ```ts
277
+ await runUnitOfWork({ name: 'broadcast-send', observability }, async () => {
278
+ setRequestDimensions({ projectId })
279
+ await send()
280
+ })
281
+ ```
282
+
283
+ The row carries `kind: 'job'`, the `name`, the duration and the outcome, and
284
+ carries **no** `method`, `path` or `statusCode`, because the work had none. That
285
+ absence is the point. The alternative is what consuming code had to do before —
286
+ write `method: 'AGENT'` into the field for verbs — and a row that names a verb
287
+ nobody used is worse than a row that names none, because a filter reading
288
+ `method !== 'GET'` counts it as a write and nothing looks wrong.
289
+
290
+ Which is why **a filter on `method` needs a decision about jobs.** `auditChanges`
291
+ makes it explicitly: a row with no verb is kept, because whether it changed
292
+ anything cannot be answered from the row, and an audit that drops what it did not
293
+ examine reports zero and looks exactly like a system in which nothing happened.
294
+ A hand-written `event.method !== 'GET'` keeps jobs too (`undefined !== 'GET'`);
295
+ `event.kind === 'request' && event.method !== 'GET'` is how you exclude them on
296
+ purpose.
297
+
298
+ Without an `observability` the work still runs inside a context, so trace ids,
299
+ `setRequestDimensions` and the bounded logger behave — recording is a separate
300
+ decision from having a context. `traceparent` continues the trace of whatever
301
+ scheduled the work, instead of starting an unrelated one.
302
+
303
+ ### Write the calls that changed something
304
+
305
+ `auditChanges` is the filter most projects end up writing, shipped so they do not
306
+ have to write it six ways:
307
+
308
+ ```ts
309
+ import { auditChanges, createObservability } from 'stitchkit/observability';
310
+
311
+ createObservability({
312
+ request: { write: saveAuditRow, filter: auditChanges },
313
+ tools: { write: saveAuditRow, filter: auditChanges },
314
+ });
315
+ ```
316
+
317
+ It drops `GET`, `HEAD` and `OPTIONS`, keeps everything else, and keeps `401` and
318
+ `403` **whatever the verb was** — a refused read is the row an audit exists to
319
+ hold, and a filter that drops every `GET` drops exactly that. An unrecognised
320
+ verb is kept: an extra row costs bytes, a missing one costs the answer to "who
321
+ changed this", silently and only later.
322
+
323
+ One filter across HTTP, MCP and agent calls, because a tool call carries its
324
+ contract verb in `httpMethod` while its `method` is the literal `TOOL`.
325
+
326
+ Narrower policy stays yours — compose it:
327
+
328
+ ```ts
329
+ filter: (event) => auditChanges(event) && event.serviceName !== 'health',
330
+ ```
331
+
332
+ ### Keeping the row when the store is down
333
+
334
+ A sink is fire-and-forget, so an unreachable store means the event is simply
335
+ gone — and a store is most likely to be unreachable during an incident, which is
336
+ the window whose rows someone will later want most.
337
+
338
+ `createSpooledSink` writes the row to a local append-only file first, offers it
339
+ to the store second, and marks it delivered third. What a previous process left
340
+ unmarked is replayed:
341
+
342
+ ```ts
343
+ import { createSpooledSink } from 'stitchkit/observability';
344
+
345
+ const audit = createSpooledSink({
346
+ path: '/var/lib/app/audit.ndjson',
347
+ write: saveAuditRow,
348
+ });
349
+
350
+ // Once, at startup, before the sink is wired — and await it.
351
+ const { replayed, failed } = await audit.recover();
352
+
353
+ createObservability({ request: { write: audit.write, filter: auditChanges } });
354
+ ```
355
+
356
+ The guarantee is **at least once**. A crash between the store accepting a row and
357
+ the file recording that it did replays the row, so **the store must be idempotent
358
+ on the record key** — `event.spanId` by default, unique per call. A unique index
359
+ on it turns the duplicate into a no-op; without one, replay writes the row twice.
360
+ Exactly-once would need the file and the database to share a transaction. They do
361
+ not.
362
+
363
+ One process, one path. Two processes pointed at the same file replay each other's
364
+ records: harmless against an idempotent store, wasteful always.
365
+
366
+ ### Request context
367
+
368
+ When request observability is configured, `createHandler` establishes the
369
+ `AsyncLocalStorage` request context itself and uses the same completion snapshot
370
+ for operational logging and `RequestEvent`. No `wrapFetch` composition is
371
+ needed:
372
+
373
+ ```ts
374
+ createServer({ services, logging, observability: observability.request })
375
+ ```
376
+
377
+ `wrapInRequestContext` remains available for a custom fetch pipeline that does
378
+ not use `createHandler`; it is no longer part of built-in HTTP audit wiring:
379
+
380
+ ```ts
381
+ Bun.serve({ fetch: wrapInRequestContext(customFetch) })
382
+ ```
383
+
384
+ Some fields are filled in late. Set them from the hooks that know:
385
+
386
+ ```ts
387
+ import {
388
+ setRequestDimensions,
389
+ setRequestError,
390
+ setRequestUser,
391
+ } from 'stitchkit/observability'
392
+
393
+ createAuthHook({ /* … */ inject: (ctx, user) => user && setRequestUser(user.id) })
394
+ // ↑ on the HTTP path. Inside a tool call this writes to that call's own context
395
+ // (→ ADR 0045); a tool row takes its identity from the mount's `context`.
396
+ // only to override what the framework already recorded — see below:
397
+ setRequestError({ code: err.code, message: err.message, details: err.issues })
398
+ ```
399
+
400
+ **The failure is recorded for you.** Every error travels one path inside the
401
+ framework, and that path writes `{ code, message, details }` onto the context —
402
+ so an audited failure names its cause whether or not you wrote an `onError`, and
403
+ whether or not your `onError` returns its own `Response`. Where the envelope was
404
+ scrubbed to `INTERNAL_SERVER_ERROR`, the row gets the **real** message rather than
405
+ the placeholder; the caller still receives the scrubbed one. → ADR 0043
406
+
407
+ `setRequestError` is therefore an **override**, not the wiring: call it when you
408
+ want the row to say something other than what the framework derived (a domain
409
+ code, a curated message, structured issues). The framework writes only when the
410
+ context carries nothing yet, so your value always wins.
411
+
412
+ **Endpoint identity is automatic — for contract operations.** The framework
413
+ writes the matched operation's `(serviceName, action)` into the context at
414
+ route-match, *before* validation, so both are present on every event for a
415
+ request that matched a contract route, including a pre-handler 400. Nothing to
416
+ wire.
417
+
418
+ Raw routes may opt into the same context with `serviceName` and optional
419
+ `action` on their `RawRoute` declaration. Without that declaration they remain
420
+ absent, as they do for a request short-circuited by `onRequest` and an unmatched
421
+ 404 or 405. Both fields therefore remain optional in `RequestEvent`; a sink
422
+ with a `NOT NULL` column on either still has to account for unattributed paths.
423
+
424
+ When failure attribution itself is asynchronous, use `createErrorHook`'s
425
+ `onError(error, info, ctx, endpoint)` observer. The framework awaits it before
426
+ calling `render`, so identity or audit enrichment is visible to both the final
427
+ error envelope and the request event. `endpoint` is the matched `MethodDef`, or
428
+ `undefined` when routing failed before a method was selected.
429
+
430
+ **Domain dimensions** — attach your own tenant / project / entity id with
431
+ `setRequestDimensions`. It is an opaque `Record<string, string>` the core gives no
432
+ meaning to (→ ADR 0021). Resolve it cheaply from `ctx.params` / headers in
433
+ `beforeHandle` (success) or `onError` (a pre-handler failure — `ctx.params` /
434
+ `ctx.req` are available there) and it lands on `event.dimensions` for the request
435
+ either way, so your sink reads it as a column instead of re-parsing the path:
436
+
437
+ > **On the tool path it lands on that call's own event, not the request's.** The
438
+ > same hooks object is assignable to `ToolLifecycle`, so this recipe is the one
439
+ > people apply to tools — and since ADR 0045 each tool call runs in its own
440
+ > context. Read the value off the tool row (`event.toolName != null`); both rows
441
+ > carry the same `traceId`, so recovering the enclosing request is one filter:
442
+ >
443
+ > ```bash
444
+ > jq -s '[.[] | select(.dimensions.botId == "B7") | .traceId] as $t
445
+ > | .[] | select(.traceId | IN($t[]))' audit.jsonl
446
+ > ```
447
+ >
448
+ > Worth checking your **runbooks** as well as your code when this lands: a
449
+ > dimension filter written against request rows keeps parsing and starts
450
+ > returning nothing.
451
+
452
+ ```ts
453
+ // beforeHandle (success) and onError (failure) alike:
454
+ const projectId = ctx.req?.headers.get('x-project') ?? String(ctx.params?.projectId ?? '')
455
+ if (projectId) setRequestDimensions({ projectId })
456
+ ```
457
+
458
+ Make the framework router share this trace id — so request logs and your
459
+ application logs carry one id — by passing `getTraceId` as the resolver:
460
+
461
+ ```ts
462
+ createHandler({ /* … */ traceId: getTraceId })
463
+ ```
464
+
465
+ `getTraceId` returns `undefined` outside an active context, and the framework
466
+ falls back to its own resolver — a trusted inbound `x-request-id` / `x-trace-id`,
467
+ else a fresh id — so the line never carries the string `"undefined"`.
468
+
469
+ Inside a **tool call** the context is that call's own (→ ADR 0045), so the
470
+ enrichment a request log picks up describes the request, not the call.
471
+
472
+ `getRequestContext()` / `getTraceId()` then return the active values from
473
+ anywhere in the call — stamp `getTraceId()` onto every line your logger writes.
474
+ The **request log picks the context up on its own**: with a context active, each
475
+ completion line carries `userId`, `serviceName`, `action` and `dimensions`
476
+ without any configuration.
477
+
478
+ ⚠️ In the **structured** output only — the `json` line and a custom `logger`'s
479
+ `data`. The `pretty` `←` line is a line to read, not a record to query, and
480
+ never carries them (nor `enrich`'s fields). Set
481
+ [`logging.format: 'json'`](./server.md#two-formats-and-who-chooses) to see them
482
+ locally; you do not need to change `NODE_ENV` or deploy.
483
+
484
+ ### Correlating with a reverse proxy
485
+
486
+ Every response the stitchkit handler produces carries the resolved id as
487
+ **`x-request-id`**. With `cors` configured it is in the default
488
+ `Access-Control-Expose-Headers`, so a browser client can read it and quote it in
489
+ a bug report. Stitchkit browser clients retain it as `ApiError.traceId` on
490
+ response-backed failures. Note the deliberate asymmetry: inbound the id may arrive as
491
+ `X-Trace-Id` *or* `X-Request-Id`; outbound there is one name and no alias.
492
+
493
+ Log the same id from nginx and the two logs join on one key. `log_format` and
494
+ `map` are `http {}`-context directives — put the block there, not inside
495
+ `server {}`:
496
+
497
+ ```nginx
498
+ log_format stitch '$remote_addr $status $request_time rid=$rid "$request"';
499
+
500
+ # Fall back to nginx's own id for responses stitchkit never produced — Bun's
501
+ # native `routes`, a throwing `onRequest` (which escapes before any response
502
+ # exists), a redirect whose headers are immutable.
503
+ map $upstream_http_x_request_id $rid {
504
+ "" $request_id;
505
+ default $upstream_http_x_request_id;
506
+ }
507
+
508
+ access_log /var/log/nginx/access.log stitch;
509
+ ```
510
+
511
+ `grep rid=<id>` across both logs then reconstructs the whole request. Tool calls
512
+ join too: `createToolLogger`'s record carries `traceId`, so an MCP or agent call
513
+ made inside a request lines up with it.
514
+
515
+ ### Trace context
516
+
517
+ stitchkit speaks [W3C Trace Context](https://www.w3.org/TR/trace-context/). An
518
+ inbound `traceparent` header is continued — its trace id is kept, its span
519
+ becomes the parent — so a trace spans the front-end call, your HTTP handler and
520
+ every tool call underneath it. With no inbound header a fresh root trace is
521
+ minted. Each tool call opens a [`childSpan`](#trace-context) of the request it
522
+ runs in.
523
+
524
+ You rarely call the trace functions directly — `createHandler` request
525
+ observability and `wrapInRequestContext` use them for you. They are exported (`resolveTraceContext`,
526
+ `parseTraceparent`, `formatTraceparent`, `childSpan`) for when you need to
527
+ propagate a `traceparent` onward to another service.
528
+
529
+ The browser side starts the trace:
530
+ [`createHttpClient({ trace: true })`](./client.md#httpclientconfig) emits a
531
+ fresh root `traceparent` on every request, which the server then continues. The
532
+ trace helpers themselves are browser-safe and also exported from the root
533
+ `stitchkit` entry — a custom client can format its own header.
534
+
535
+ The default CORS allow-list already permits `traceparent` / `tracestate`, so a
536
+ cross-origin `trace: true` client works out of the box. If you set a custom
537
+ `cors.headers`, extend `DEFAULT_CORS_ALLOW_HEADERS` rather than replacing it, or
538
+ the preflight will reject the trace header.
539
+
540
+ MCP tools use the same context. On a modern HTTP or stdio `tools/call`, the
541
+ official SDK exposes W3C propagation values from request `_meta`; Stitchkit
542
+ continues a valid `_meta.traceparent` before validation, lifecycle and hooks.
543
+ If MCP metadata omits `traceparent`, an HTTP call keeps its ambient HTTP trace
544
+ and a stdio call starts a new root. If the key is present but malformed or
545
+ all-zero, the call still runs under a fresh local trace instead of trusting the
546
+ ambient one. This makes explicit MCP propagation authoritative without allowing
547
+ invalid input to break the tool.
548
+
549
+ Bounded `tracestate` and `baggage` are available through
550
+ `getRequestContext()?.trace` for outbound propagation. Their contents are not
551
+ copied into the standard `RequestEvent`; never use them for auth, RBAC, tenant
552
+ selection or rate-limit identity. Every MRTR attempt reads its current request
553
+ metadata, so callers that want one trace across rounds must propagate it on
554
+ each request.
555
+
556
+ > **Span ids live in the request context, not on `ctx`.** The handler `ctx`
557
+ > carries a single `traceId`; the full
558
+ > `{ traceId, spanId, parentSpanId, tracestate?, baggage? }` is on
559
+ > the observability request context. To stamp `spanId` / `parentSpanId` into an
560
+ > audit row read `getRequestContext()?.trace`, not `ctx.spanId`:
561
+ >
562
+ > ```ts
563
+ > const trace = getRequestContext()?.trace
564
+ > audit({ traceId: trace?.traceId, spanId: trace?.spanId, parentSpanId: trace?.parentSpanId })
565
+ > ```
566
+
567
+ ### Sanitisation
568
+
569
+ A payload goes into an audit row only after `sanitizePayload`:
570
+
571
+ - **secret-named keys are masked** — a key whose words include a secret term is
572
+ redacted (`password`, `sessionToken`, `X-Api-Key`, `authorization`, `cookie`,
573
+ …), while identifiers that merely contain one (`authorId`, `sessionCount`,
574
+ `tokenizer`) survive. This applies wherever a key exists — an object field and
575
+ a `Map` entry alike, at any depth. A `Set` member has no key, so nothing there
576
+ is masked by name;
577
+ - **binary blobs** (`Uint8Array`, `Blob`, `FormData`) collapse to metadata —
578
+ never the bytes;
579
+ - the result is **capped** — anything over the byte limit becomes a preview.
580
+
581
+ `createObservability` runs it on every emitted event; tune each sink separately:
582
+
583
+ ```ts
584
+ createObservability({
585
+ request: {
586
+ write,
587
+ includePayload: true,
588
+ sanitize: { maxBytes: 8_000, sensitiveKeys: /password|token|pin/i },
589
+ },
590
+ tools: {
591
+ write,
592
+ sanitize: { maxBytes: 8_000, sensitiveKeys: /password|token|pin/i },
593
+ },
594
+ })
595
+ ```
596
+
597
+ `redact`, `truncatePreview` and `measureSize` are exported on their own if you
598
+ need to sanitise something outside the audit path.
599
+
600
+ ## The raw hooks
601
+
602
+ Tool observability is built on hooks you can also use directly — for a one-off
603
+ metric, a custom log line, anything that is not a full audit row.
604
+
605
+ | Surface | Hook | Fires |
606
+ |---------|------|-------|
607
+ | HTTP | `LifecycleHooks.afterHandle` / `onError` | after each HTTP request |
608
+ | MCP & agent tools | `ToolCallHooks.afterToolCall` | after each tool call |
609
+ | MCP & agent tools | `ToolCallHooks.onToolError` | when executable parsing, extension resolution, lifecycle or the handler throws |
610
+
611
+ `afterHandle(ctx, result, endpoint)` runs after a handler returns;
612
+ `onError(ctx, error, endpoint)` when one throws. `afterToolCall(options)` runs
613
+ after every tool call —
614
+ success and error alike — carrying the tool name, the arguments, the result, the
615
+ duration, the call context, the endpoint identity, and (only when the call failed
616
+ by throwing) the raw thrown value.
617
+
618
+ A confirmed HTTP client disconnect is the exception to the raw-hook table: it
619
+ is transport cancellation, so neither `afterHandle` nor project `onError` runs.
620
+ Use the `499/info` access completion or opt-in request cancellation event above.
621
+
622
+ ```ts
623
+ createMcpHandler({
624
+ serverInfo, auth, services,
625
+ hooks: {
626
+ afterToolCall: ({ toolName, result, durationMs }) => {
627
+ metrics.timing(`tool.${toolName}`, durationMs, { ok: String(result.ok) })
628
+ },
629
+ },
630
+ })
631
+ ```
632
+
633
+ Log **after** completion — a record is of a *finished* call; you need the
634
+ outcome and the duration, neither of which exists before the handler runs.
635
+
636
+ ### The cause behind a failed tool call
637
+
638
+ `afterToolCall` gives you the `ToolResult`, and for a thrown `AppError` that is
639
+ the whole story — `code` and `details` are yours to route. For anything else it
640
+ is not: an unexpected throw (a dropped connection, a `TypeError`) is scrubbed to
641
+ a bare `INTERNAL_SERVER_ERROR` with the message `Internal server error`, because
642
+ a raw `Error.message` can carry a connection string or a file path. The result
643
+ your sink receives says nothing about why.
644
+
645
+ `onToolError` is where that value still exists — **as thrown**, before
646
+ normalisation, stack and `cause` intact:
647
+
648
+ ```ts
649
+ createMcpHandler({
650
+ serverInfo, auth, services,
651
+ hooks: {
652
+ onToolError: ({ toolName, error, endpoint }) => {
653
+ reportToolFailure({
654
+ tool: toolName,
655
+ action: endpoint.key,
656
+ message: error instanceof Error ? error.message : String(error),
657
+ stack: error instanceof Error ? error.stack : undefined,
658
+ })
659
+ },
660
+ },
661
+ })
662
+ ```
663
+
664
+ It fires for a throw from executable params/input/`ToolExtend` parsing,
665
+ extension resolution, `beforeHandle`, the handler or `afterHandle` — every span
666
+ where information is destroyed — and runs **before** `afterToolCall`. It does
667
+ not fire for an ordinary validation result, an output-schema mismatch or a
668
+ `beforeToolCall` rejection: each is already described in full by its
669
+ `ToolResult`.
670
+
671
+ It observes, it does not handle: the tool envelope is always the framework's, a
672
+ returned value is ignored, and a throw from the hook itself is reported to
673
+ `console.error` and swallowed rather than replacing the failure it was called to
674
+ observe. (This is also why it lives on `ToolCallHooks` rather than being an
675
+ `onError` twin on `ToolLifecycle` — `LifecycleHooks.onError` returns a
676
+ `Response`, which a tool call has no use for, and a whole `createServer` hooks
677
+ object must stay assignable to `ToolLifecycle`.)
678
+
679
+ ### Compose lifecycle policy explicitly
680
+
681
+ When auth, a feature policy and audit identity are independent modules, compose
682
+ their existing hooks instead of forwarding each phase by hand:
683
+
684
+ ```ts
685
+ import { composeLifecycleHooks } from 'stitchkit/server'
686
+ import { composeToolLifecycle } from 'stitchkit/tools'
687
+
688
+ const httpLifecycle = composeLifecycleHooks(authLifecycle, featurePolicy, auditIdentity)
689
+ const toolLifecycle = composeToolLifecycle(authHook, featureToolPolicy, auditToolIdentity)
690
+ ```
691
+
692
+ Phases run left to right. `onRequest` stops on the first `Response`; `onError`
693
+ falls through until a hook handles it; after transforms feed the current value
694
+ forward and preserve it when a hook returns `undefined`. Throws remain owned by
695
+ the existing outer error boundary, and the original context/signal identity is
696
+ never replaced.
697
+
698
+ **Do not reach for `setRequestError` here.** It writes to the *request* context,
699
+ which the built-in **tool** row does not read: a tool event takes
700
+ `errorCode` / `errorMessage` / `errorDetail` from the `ToolResult`, and only
701
+ identity and `dimensions` from the context. Calling it in `onToolError` would
702
+ leave the tool row exactly as scrubbed as before. It is right for the **HTTP**
703
+ path, where the request *is* the record. (Since ADR 0045 a tool call runs in its
704
+ own context, so it can no longer write into the enclosing `/mcp` request's row
705
+ either — the call is simply not where that helper belongs.)
706
+
707
+ ### One row that names the cause
708
+
709
+ You do not need to correlate the two hooks yourself. `afterToolCall` receives the
710
+ same raw value as the named `error` field, so one hook can build one record:
711
+
712
+ ```ts
713
+ hooks: {
714
+ afterToolCall: ({ toolName, result, durationMs, endpoint, error }) => {
715
+ void writeRow({ toolName, result, durationMs, cause: error, endpoint })
716
+ },
717
+ }
718
+ ```
719
+
720
+ `error` is present only when the call failed by **throwing** — a
721
+ validation failure or a `beforeToolCall` rejection leaves it `undefined`, because
722
+ neither ever had a raw value to lose. Consumers destructure only the fields they
723
+ use; future optional fields do not change callback arity.
724
+
725
+ `createObservability({ tools })` uses it already. Where the envelope was scrubbed to
726
+ `INTERNAL_SERVER_ERROR`, the row's `errorMessage` becomes the real message
727
+ instead of the placeholder; a truthful envelope (a thrown `AppError`, a
728
+ `ZodError`) is left alone, `errorCode` and `errorDetail` are untouched, and the
729
+ stack is not written — that is `onToolError`'s job, for a tracker that wants it.
730
+ The caller still receives the scrubbed envelope in every case: the raw text
731
+ reaches your server-side record, never the response. → ADR 0042
732
+
733
+ So the two hooks divide by **purpose**, not by capability — `onToolError` for a
734
+ sink of your own (a tracker, a stack, an alert), `afterToolCall` for the record.
735
+
736
+ ### Keying a row on (service, action)
737
+
738
+ Built-in observability keys every event by **service** and **action**
739
+ (`event.serviceName` / `event.action`, → ADR 0029) — reach for the raw hook only
740
+ when you also need the handler **output**, which the audit wrapper never sees. For
741
+ that, read the endpoint identity off the `OperationIdentity` the tool hook
742
+ receives — `endpoint.serviceName` and `endpoint.key` (the endpoint key or native
743
+ action,
744
+ e.g. `updatePartial`). They are stable and always present (→ ADR 0022); the action
745
+ is not in the URL and `toolName` is absent on HTTP-only endpoints, so this is the
746
+ only reliable pair. Contract operations are full `MethodDef` values; native MCP
747
+ operations intentionally have no HTTP `path`. `afterHandle` also gives you the handler `result` — so it is
748
+ the home for a rich mutation audit that records output:
749
+
750
+ ```ts
751
+ hooks: {
752
+ afterHandle: (ctx, result, endpoint) => {
753
+ void logMutation({
754
+ service: endpoint.serviceName,
755
+ action: endpoint.key,
756
+ input: ctx.input,
757
+ output: result,
758
+ userId: ctx.userId,
759
+ traceId: ctx.traceId,
760
+ })
761
+ return result // don't transform
762
+ },
763
+ }
764
+ ```
765
+
766
+ > **Why HTTP observability is framework-owned, not a lifecycle hook.**
767
+ > `LifecycleHooks` has a single `onError`; an audit built on it would compete
768
+ > with the app's error renderer and miss raw/unmatched exits. `createHandler`
769
+ > sees the final response on every path and emits one completion without
770
+ > consuming an application hook.
771
+
772
+ Keep any sink **asynchronous and self-contained**: a slow or failing write must
773
+ never block or break the request. Swallow the sink's own errors.
774
+
775
+ ## Typed dimensions and bounded loggers
776
+
777
+ `createDimensionsProjector` keeps endpoint metadata opaque. Configure typed
778
+ request, result and error projections, then call its phase methods from the
779
+ corresponding lifecycle hooks. Every projection writes through
780
+ `setRequestDimensions`; repeated keys follow the declared `overwrite`,
781
+ `preserve` or `error` policy. Two of its inputs are programming errors and
782
+ throw, which fails the request rather than recording a lie: a repeated key
783
+ under `collision: 'error'`, and a key named `__proto__` (it would set the
784
+ bag's prototype — it can only arrive from parsed input, never from an object
785
+ literal, which has no such own key).
786
+
787
+ `createBoundedLogger` decorates the existing `StitchLogger` interface, so Pino,
788
+ console and application sinks keep their ownership. It reuses the same
789
+ sanitizer as request audit: sensitive keys, configured paths, URL fragments and
790
+ `Error` fields are redacted before string/collection/depth/total-byte bounds are
791
+ applied. Active trace, span, user and dimensions are reserved framework fields;
792
+ caller data cannot overwrite them. A throwing getter, cyclic value or failing
793
+ sink never escapes into application code.
794
+
795
+ One string bound for the whole record cuts an error's stack from the bottom —
796
+ which is exactly where your own frames are. Raise the ceiling for that key alone,
797
+ wherever it sits (`stack` at the top of one record and under `errorDetail` in the
798
+ next is the same field), without touching the bound for everything else:
799
+
800
+ ```ts
801
+ createBoundedLogger({
802
+ sink,
803
+ bounds: { stringLength: 4_000, stringLengthByKey: { stack: 32_000 } },
804
+ })
805
+ // or directly: redact(value, { maxStringLength: 4_000, maxStringLengthByKey: { stack: 32_000 } })
806
+ ```
807
+
808
+ Keyed by name, not by path — the question is "what is this field", not "where is
809
+ it". The entry ceiling (`entryBytes`) keeps the last word: a record that does not
810
+ fit still collapses, but the decision is made for the record, not by cutting one
811
+ field short in advance.
812
+
813
+ ==============================================================================
814
+ # API reference: `stitchkit/observability` (docs/api/reference.md)
815
+ ==============================================================================
816
+
817
+ ## `stitchkit/observability`
818
+
819
+ Server-only. The audit layer one level above the raw hooks — W3C trace context,
820
+ an `AsyncLocalStorage` request context, payload sanitisation and a normalised
821
+ audit event. See the [Observability guide](../guide/observability.md).
822
+
823
+ ### Events
824
+
825
+ | Export | Kind | Summary |
826
+ |--------|------|---------|
827
+ | `createObservability` | function | configure framework-owned request completion and canonical tool event sinks — [guide](../guide/observability.md#createobservability) |
828
+ | `auditChanges` | function | the sink `filter` most projects write themselves — drops `GET`/`HEAD`/`OPTIONS`, keeps `401`/`403` whatever the verb, keeps an unrecognised verb |
829
+ | `createSpooledSink` / `SpooledSink` / `SpooledSinkConfig` / `SpoolRecovery` | function / _types_ | spool the row to an append-only file before the store and replay what a previous process left undelivered — at least once, keyed on `spanId` |
830
+ | `createDimensionsProjector` / `DimensionsProjector` / `DimensionsProjectorConfig` / `ProjectedDimensions` | function / _type_ | typed request/result/error attribution projected into the existing request context |
831
+ | `DimensionCollision` / `SetRequestDimensionsOptions` | _type_ | explicit overwrite, preserve or error policy for dimension keys |
832
+ | `createBoundedLogger` | function | decorate a `StitchLogger` with request context, shared sanitisation, redaction and total bounds |
833
+ | `DEFAULT_REDACT_PATHS` | constant | baseline credential/token paths added to the sanitizer's sensitive-key policy |
834
+ | `BoundedLoggerBounds` / `BoundedLoggerOptions` | _type_ | per-value and total record ceilings (`stringLengthByKey` raises the string bound for named keys such as `stack`) plus sink/redaction configuration |
835
+ | `RequestEvent` | _type_ | the normalised audit event handed to the sink; opt-in HTTP cancellation rows carry `outcome: 'cancelled'` |
836
+ | `runUnitOfWork` / `RunUnitOfWorkOptions` | function / _type_ | run work that did not arrive over a transport — an agent loop, a scheduled broadcast — inside one context, with the same completion record a request gets |
837
+ | `RequestContextKind` | _type_ | `'request'` \| `'job'` — what the row describes, written on every event so a filter never has to read it off an absent `method` |
838
+ | `ObservabilityConfig` | _type_ | independent request and tool sink configuration |
839
+ | `Observability` | _type_ | `{ request?, toolCall, getStatus(), flush(bound?): Promise<boolean>, close(bound?) }` with bounded sink lifecycle |
840
+ | `ObservabilityDrainBound` | _type_ | `timeoutMs` and/or `signal` limiting how long `flush`/`close` wait; the wait ends, outstanding writes do not |
841
+ | `ObservabilitySinkStatus` | _type_ | immutable counters for one bounded request/tool sink |
842
+ | `ObservabilityStatus` | _type_ | per-surface plus aggregate operational snapshot |
843
+ | `ObservabilityDrainReport` | _type_ | final closed/drained snapshot, `durationMs` (the shared drain's age, not this call's wait), and `drained` — read from the counters, `false` only when `total.pending + total.preparing` is nonzero |
844
+ | `ObservabilitySinkStatusSchema` / `ObservabilityStatusSchema` / `ObservabilityDrainReportSchema` | schema | runtime schemas for status/report integration boundaries |
845
+ | `RequestEventSinkConfig` | _type_ | `write`, filter/sanitisation, `maxPending`, `onSinkError` and `onDrop` |
846
+ | `RequestObservabilityConfig` | _type_ | request sink plus opt-in payload capture and default-off `includeCancelled` rows |
847
+ | `SinkDropReason` | _type_ | `'capacity' \| 'closed'` |
848
+ | `SinkError` | _type_ | isolated sink/projection failure and optional event |
849
+ | `SinkDrop` | _type_ | rejected event, reason and current pending count |
850
+ | `HttpRequestCompletion` | _type_ | the single framework-owned HTTP outcome, including optional neutral cancellation, projected to logging and request events |
851
+ | `HttpRequestObserver` | _type_ | server-facing projection consumed by `HandlerConfig.observability` |
852
+
853
+ ### Request context
854
+
855
+ | Export | Kind | Summary |
856
+ |--------|------|---------|
857
+ | `WrapRequestContextOptions` | _type_ | options for `wrapInRequestContext` |
858
+ | `wrapInRequestContext` | function | run a fetch handler inside a request context — [guide](../guide/observability.md#request-context) |
859
+ | `getRequestContext` | function | the active request context |
860
+ | `getTraceId` | function | the active trace id — pass as `traceId` to `createServer` |
861
+ | `getUserId` | function | the active user id, once auth has resolved it |
862
+ | `setRequestUser` | function | attach the resolved user to the active context |
863
+ | `setRequestEndpoint` | function | attach the resolved endpoint identity to the active context |
864
+ | `setRequestDimensions` | function | attach custom audit dimensions to the active context |
865
+ | `setRequestError` | function | record the error outcome on the active context |
866
+ | `runWithRequestContext` | function | run a function inside a given context |
867
+ | `RequestContext` | _type_ | the per-request record |
868
+
869
+ ### Trace context
870
+
871
+ | Export | Kind | Summary |
872
+ |--------|------|---------|
873
+ | `resolveTraceContext` | function | the trace for a request — `traceparent` continued or fresh |
874
+ | `resolvePropagationContext` | function | continue bounded MCP/W3C propagation metadata with optional ambient fallback |
875
+ | `parseTraceparent` | function | parse a `traceparent` header |
876
+ | `formatTraceparent` | function | render a `traceparent` header value |
877
+ | `createTraceContext` | function | a fresh root trace |
878
+ | `childSpan` | function | a child span of a parent trace |
879
+ | `TraceContext` | _type_ | `{ traceId, spanId, parentSpanId?, tracestate?, baggage? }` |
880
+
881
+ ### Sanitisation
882
+
883
+ | Export | Kind | Summary |
884
+ |--------|------|---------|
885
+ | `sanitizePayload` | function | redact secrets and cap size — [guide](../guide/observability.md#sanitisation) |
886
+ | `redact` | function | mask secret-named keys, drop binary blobs |
887
+ | `truncatePreview` | function | cap a value by serialised size |
888
+ | `measureSize` | function | item count + byte size of a result |
889
+ | `JsonValue` | _type_ | a JSON-serialisable value |
890
+ | `SanitizeOptions` | _type_ | tuning for `redact` / `sanitizePayload` — `maxStringLengthByKey` bounds a named key wherever it sits without changing the record-wide bound |
891
+ | `SizeMeasure` | _type_ | the result of `measureSize` |
892
+
893
+ ---