stitchkit 0.135.0 → 0.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +25 -11
  3. package/dist/agent-executor/acp/v1-session-build.d.ts +51 -0
  4. package/dist/agent-executor/acp/v1-session-build.d.ts.map +1 -0
  5. package/dist/agent-executor/acp/v1-session.d.ts +1 -1
  6. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  7. package/dist/agent-executor/claude/classify.d.ts +1 -1
  8. package/dist/agent-executor/claude/classify.d.ts.map +1 -1
  9. package/dist/agent-executor/claude/events-wire.d.ts +13 -0
  10. package/dist/agent-executor/claude/events-wire.d.ts.map +1 -0
  11. package/dist/agent-executor/claude/events.d.ts +1 -11
  12. package/dist/agent-executor/claude/events.d.ts.map +1 -1
  13. package/dist/agent-executor/codex/protocol.d.ts +0 -143
  14. package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
  15. package/dist/agent-executor/codex/request-answers.d.ts +1 -1
  16. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
  17. package/dist/agent-executor/codex/server-requests.d.ts +150 -0
  18. package/dist/agent-executor/codex/server-requests.d.ts.map +1 -0
  19. package/dist/agent-executor/image-input.d.ts +10 -3
  20. package/dist/agent-executor/image-input.d.ts.map +1 -1
  21. package/dist/agent-executor/testing/replay-scenarios.d.ts.map +1 -1
  22. package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -1
  23. package/dist/agent-runtime/browser/browser-control-contract.d.ts +4 -0
  24. package/dist/agent-runtime/browser/browser-control-contract.d.ts.map +1 -1
  25. package/dist/agent-runtime/browser/control-schema.d.ts +4 -0
  26. package/dist/agent-runtime/browser/control-schema.d.ts.map +1 -1
  27. package/dist/agent-runtime/browser/control-view.d.ts.map +1 -1
  28. package/dist/agent-runtime/event-schema.d.ts +16 -3
  29. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  30. package/dist/agent-runtime/loop/deferred-tools.d.ts.map +1 -1
  31. package/dist/agent-runtime/loop/invocation-payload.d.ts.map +1 -1
  32. package/dist/agent-runtime/loop/invocation-stream.d.ts +9 -1
  33. package/dist/agent-runtime/loop/invocation-stream.d.ts.map +1 -1
  34. package/dist/agent-runtime/loop/provider-stream-parts.d.ts +6 -0
  35. package/dist/agent-runtime/loop/provider-stream-parts.d.ts.map +1 -1
  36. package/dist/agent-runtime/loop/provider-stream-segments.d.ts +1 -1
  37. package/dist/agent-runtime/loop/provider-stream-segments.d.ts.map +1 -1
  38. package/dist/agent-runtime/loop/run-acquisition.d.ts.map +1 -1
  39. package/dist/agent-runtime/loop/run-approval-signature.d.ts +34 -0
  40. package/dist/agent-runtime/loop/run-approval-signature.d.ts.map +1 -0
  41. package/dist/agent-runtime/loop/run-approval.d.ts +0 -28
  42. package/dist/agent-runtime/loop/run-approval.d.ts.map +1 -1
  43. package/dist/agent-runtime/loop/run-complete-port.d.ts +24 -0
  44. package/dist/agent-runtime/loop/run-complete-port.d.ts.map +1 -0
  45. package/dist/agent-runtime/loop/run-complete-stream.d.ts +7 -2
  46. package/dist/agent-runtime/loop/run-complete-stream.d.ts.map +1 -1
  47. package/dist/agent-runtime/loop/run-complete-types.d.ts +14 -1
  48. package/dist/agent-runtime/loop/run-complete-types.d.ts.map +1 -1
  49. package/dist/agent-runtime/loop/run-complete.d.ts +2 -2
  50. package/dist/agent-runtime/loop/run-complete.d.ts.map +1 -1
  51. package/dist/agent-runtime/loop/run-execution-state.d.ts +8 -0
  52. package/dist/agent-runtime/loop/run-execution-state.d.ts.map +1 -1
  53. package/dist/agent-runtime/loop/run-model-call.d.ts +44 -0
  54. package/dist/agent-runtime/loop/run-model-call.d.ts.map +1 -0
  55. package/dist/agent-runtime/loop/run-model-step.d.ts +25 -28
  56. package/dist/agent-runtime/loop/run-model-step.d.ts.map +1 -1
  57. package/dist/agent-runtime/loop/run-model-steps.d.ts +6 -0
  58. package/dist/agent-runtime/loop/run-model-steps.d.ts.map +1 -0
  59. package/dist/agent-runtime/loop/run-model-stream.d.ts +3 -1
  60. package/dist/agent-runtime/loop/run-model-stream.d.ts.map +1 -1
  61. package/dist/agent-runtime/loop/run-operation-lifecycle.d.ts +0 -2
  62. package/dist/agent-runtime/loop/run-operation-lifecycle.d.ts.map +1 -1
  63. package/dist/agent-runtime/loop/run-step-loop.d.ts +19 -0
  64. package/dist/agent-runtime/loop/run-step-loop.d.ts.map +1 -0
  65. package/dist/agent-runtime/loop/run-step-port.d.ts +175 -0
  66. package/dist/agent-runtime/loop/run-step-port.d.ts.map +1 -0
  67. package/dist/agent-runtime/loop/run-stream-parts.d.ts.map +1 -1
  68. package/dist/agent-runtime/loop/run-stream-step-text.d.ts.map +1 -1
  69. package/dist/agent-runtime/loop/run-tool-approval-flow.d.ts +2 -1
  70. package/dist/agent-runtime/loop/run-tool-approval-flow.d.ts.map +1 -1
  71. package/dist/agent-runtime/loop/run-tool-call-input.d.ts +39 -0
  72. package/dist/agent-runtime/loop/run-tool-call-input.d.ts.map +1 -0
  73. package/dist/agent-runtime/loop/run-tool-call.d.ts +2 -31
  74. package/dist/agent-runtime/loop/run-tool-call.d.ts.map +1 -1
  75. package/dist/agent-runtime/loop/run-tool-errors.d.ts +5 -0
  76. package/dist/agent-runtime/loop/run-tool-errors.d.ts.map +1 -1
  77. package/dist/agent-runtime/loop/run-tool-executor.d.ts +1 -1
  78. package/dist/agent-runtime/loop/run-tool-executor.d.ts.map +1 -1
  79. package/dist/agent-runtime/loop/run-tool-slots.d.ts +2 -1
  80. package/dist/agent-runtime/loop/run-tool-slots.d.ts.map +1 -1
  81. package/dist/agent-runtime/loop/runtime-state.d.ts.map +1 -1
  82. package/dist/agent-runtime/loop/runtime.d.ts +0 -5
  83. package/dist/agent-runtime/loop/runtime.d.ts.map +1 -1
  84. package/dist/agent-runtime/providers/ai-sdk-convert.d.ts +1 -5
  85. package/dist/agent-runtime/providers/ai-sdk-convert.d.ts.map +1 -1
  86. package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts +11 -0
  87. package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts.map +1 -0
  88. package/dist/agent-runtime/providers/ai-sdk-tools.d.ts +11 -0
  89. package/dist/agent-runtime/providers/ai-sdk-tools.d.ts.map +1 -0
  90. package/dist/agent-runtime/providers/ai-sdk.d.ts +1 -9
  91. package/dist/agent-runtime/providers/ai-sdk.d.ts.map +1 -1
  92. package/dist/agent-runtime/providers/anthropic-sse.d.ts.map +1 -1
  93. package/dist/agent-runtime/providers/openrouter-admission.d.ts.map +1 -1
  94. package/dist/agent-runtime/providers/openrouter-audio.d.ts +164 -0
  95. package/dist/agent-runtime/providers/openrouter-audio.d.ts.map +1 -0
  96. package/dist/agent-runtime/providers/openrouter-catalog-cache.d.ts.map +1 -1
  97. package/dist/agent-runtime/providers/openrouter-catalog-query.d.ts.map +1 -1
  98. package/dist/agent-runtime/providers/openrouter-catalog.d.ts +4 -2
  99. package/dist/agent-runtime/providers/openrouter-catalog.d.ts.map +1 -1
  100. package/dist/agent-runtime/providers/openrouter-client.d.ts +37 -0
  101. package/dist/agent-runtime/providers/openrouter-client.d.ts.map +1 -0
  102. package/dist/agent-runtime/providers/openrouter-http.d.ts +120 -0
  103. package/dist/agent-runtime/providers/openrouter-http.d.ts.map +1 -0
  104. package/dist/agent-runtime/providers/openrouter-media.d.ts +174 -0
  105. package/dist/agent-runtime/providers/openrouter-media.d.ts.map +1 -0
  106. package/dist/agent-runtime/providers/openrouter-models.d.ts +2 -23
  107. package/dist/agent-runtime/providers/openrouter-models.d.ts.map +1 -1
  108. package/dist/agent-runtime/providers/openrouter-options.d.ts +4 -0
  109. package/dist/agent-runtime/providers/openrouter-options.d.ts.map +1 -1
  110. package/dist/agent-runtime/providers/openrouter-request.d.ts +23 -0
  111. package/dist/agent-runtime/providers/openrouter-request.d.ts.map +1 -0
  112. package/dist/agent-runtime/providers/openrouter-response.d.ts.map +1 -1
  113. package/dist/agent-runtime/providers/openrouter-retrieval.d.ts +145 -0
  114. package/dist/agent-runtime/providers/openrouter-retrieval.d.ts.map +1 -0
  115. package/dist/agent-runtime/providers/openrouter-speech.d.ts +90 -0
  116. package/dist/agent-runtime/providers/openrouter-speech.d.ts.map +1 -0
  117. package/dist/agent-runtime/providers/openrouter-spend.d.ts +7 -3
  118. package/dist/agent-runtime/providers/openrouter-spend.d.ts.map +1 -1
  119. package/dist/agent-runtime/providers/openrouter-stream.d.ts +29 -0
  120. package/dist/agent-runtime/providers/openrouter-stream.d.ts.map +1 -0
  121. package/dist/agent-runtime/providers/openrouter-systemone.d.ts +137 -0
  122. package/dist/agent-runtime/providers/openrouter-systemone.d.ts.map +1 -0
  123. package/dist/agent-runtime/providers/openrouter-url.d.ts +19 -0
  124. package/dist/agent-runtime/providers/openrouter-url.d.ts.map +1 -0
  125. package/dist/agent-runtime/providers/openrouter-wire.d.ts +45 -0
  126. package/dist/agent-runtime/providers/openrouter-wire.d.ts.map +1 -0
  127. package/dist/agent-runtime/providers/openrouter.d.ts +5 -4
  128. package/dist/agent-runtime/providers/openrouter.d.ts.map +1 -1
  129. package/dist/agent-runtime/providers/provider-http.d.ts +29 -3
  130. package/dist/agent-runtime/providers/provider-http.d.ts.map +1 -1
  131. package/dist/agent-runtime/providers/provider-json-schema-strip.d.ts.map +1 -1
  132. package/dist/agent-runtime/providers/provider-json-schema.d.ts.map +1 -1
  133. package/dist/agent-runtime/providers/provider-openai-chat-sse.d.ts.map +1 -1
  134. package/dist/agent-runtime/providers/provider-openai-chat-state.d.ts +42 -0
  135. package/dist/agent-runtime/providers/provider-openai-chat-state.d.ts.map +1 -0
  136. package/dist/agent-runtime/providers/provider-usage.d.ts +9 -0
  137. package/dist/agent-runtime/providers/provider-usage.d.ts.map +1 -1
  138. package/dist/agent-runtime/sandbox/sandbox-bubblewrap-args.d.ts +9 -0
  139. package/dist/agent-runtime/sandbox/sandbox-bubblewrap-args.d.ts.map +1 -1
  140. package/dist/agent-runtime/sandbox/sandbox-bubblewrap.d.ts +6 -0
  141. package/dist/agent-runtime/sandbox/sandbox-bubblewrap.d.ts.map +1 -1
  142. package/dist/agent-runtime/sandbox/sandbox-contract.d.ts.map +1 -1
  143. package/dist/agent-runtime/sandbox/sandbox-process-linux.d.ts.map +1 -1
  144. package/dist/agent-runtime/sandbox/sandbox-process-spec.d.ts +5 -1
  145. package/dist/agent-runtime/sandbox/sandbox-process-spec.d.ts.map +1 -1
  146. package/dist/agent-runtime/sandbox/sandbox-process-wrapper.d.ts.map +1 -1
  147. package/dist/agent-runtime/stores/branch-messages.d.ts.map +1 -1
  148. package/dist/agent-runtime/stores/sql-rows.d.ts +10 -10
  149. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  150. package/dist/agent-runtime/testing/fault-bench.d.ts +5 -1
  151. package/dist/agent-runtime/testing/fault-bench.d.ts.map +1 -1
  152. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  153. package/dist/browser/client-executors.d.ts.map +1 -1
  154. package/dist/browser/client-url.d.ts.map +1 -1
  155. package/dist/contract/define.d.ts +3 -7
  156. package/dist/contract/define.d.ts.map +1 -1
  157. package/dist/contract/normalize.d.ts +17 -5
  158. package/dist/contract/normalize.d.ts.map +1 -1
  159. package/dist/entrypoints/agent-executor/acp.js +4 -2
  160. package/dist/entrypoints/agent-executor/claude-sdk.js +20 -20
  161. package/dist/entrypoints/agent-executor/claude.js +7 -7
  162. package/dist/entrypoints/agent-executor/codex.d.ts +2 -1
  163. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
  164. package/dist/entrypoints/agent-executor/codex.js +129 -35
  165. package/dist/entrypoints/agent-executor/testing/claude-sdk.js +2 -2
  166. package/dist/entrypoints/agent-executor/testing.js +17 -13
  167. package/dist/entrypoints/agent-executor.js +1 -1
  168. package/dist/entrypoints/agent-runtime/ai-sdk.d.ts +2 -1
  169. package/dist/entrypoints/agent-runtime/ai-sdk.d.ts.map +1 -1
  170. package/dist/entrypoints/agent-runtime/ai-sdk.js +10 -12
  171. package/dist/entrypoints/agent-runtime/anthropic.js +13 -10
  172. package/dist/entrypoints/agent-runtime/browser.js +8 -4
  173. package/dist/entrypoints/agent-runtime/harness.js +18 -19
  174. package/dist/entrypoints/agent-runtime/openai.js +5 -5
  175. package/dist/entrypoints/agent-runtime/openrouter.d.ts +11 -2
  176. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
  177. package/dist/entrypoints/agent-runtime/openrouter.js +1940 -496
  178. package/dist/entrypoints/agent-runtime/postgres.js +2 -2
  179. package/dist/entrypoints/agent-runtime/realtime.js +5 -5
  180. package/dist/entrypoints/agent-runtime/sandbox.js +167 -139
  181. package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
  182. package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
  183. package/dist/entrypoints/agent-runtime/testing.js +3 -3
  184. package/dist/entrypoints/agent-runtime.js +246 -360
  185. package/dist/entrypoints/application.js +2 -2
  186. package/dist/entrypoints/cli.js +36 -15
  187. package/dist/entrypoints/contract.js +12 -10
  188. package/dist/entrypoints/geo.js +1 -1
  189. package/dist/entrypoints/handler.js +5 -6
  190. package/dist/entrypoints/http.d.ts +2 -0
  191. package/dist/entrypoints/http.d.ts.map +1 -1
  192. package/dist/entrypoints/http.js +16 -4
  193. package/dist/entrypoints/index.js +26 -35
  194. package/dist/entrypoints/live.js +3 -3
  195. package/dist/entrypoints/node.js +7 -7
  196. package/dist/entrypoints/observability.js +9 -7
  197. package/dist/entrypoints/process.js +3 -3
  198. package/dist/entrypoints/remote.js +5 -5
  199. package/dist/entrypoints/server.js +29 -16
  200. package/dist/entrypoints/telegram/grammy.d.ts +1 -1
  201. package/dist/entrypoints/telegram/grammy.d.ts.map +1 -1
  202. package/dist/entrypoints/telegram/grammy.js +39 -5
  203. package/dist/entrypoints/telegram/screens.js +3 -0
  204. package/dist/entrypoints/telegram.d.ts +1 -1
  205. package/dist/entrypoints/telegram.d.ts.map +1 -1
  206. package/dist/entrypoints/telegram.js +19 -6
  207. package/dist/entrypoints/testing.js +10 -11
  208. package/dist/entrypoints/tools/agent.js +8 -9
  209. package/dist/entrypoints/tools/connections.js +27 -57
  210. package/dist/entrypoints/tools/contract.js +4 -4
  211. package/dist/entrypoints/tools/invoker.js +7 -8
  212. package/dist/entrypoints/tools/mcp.js +9 -10
  213. package/dist/entrypoints/tools/toolkit.js +11 -12
  214. package/dist/entrypoints/tools.js +20 -20
  215. package/dist/entrypoints/tracking/contract.js +1 -1
  216. package/dist/entrypoints/tracking/performance.js +1 -1
  217. package/dist/entrypoints/tracking.js +1 -1
  218. package/dist/{index-3czc3ykr.js → index-08a3qfr8.js} +1 -1
  219. package/dist/{index-grhhsrd5.js → index-1en7k3q5.js} +2 -1
  220. package/dist/{index-pdcbjd6a.js → index-1yky29qg.js} +6 -3
  221. package/dist/{index-b4c9dpzm.js → index-252den5a.js} +10 -11
  222. package/dist/{index-xtby8rj3.js → index-28kbdn63.js} +5 -47
  223. package/dist/{index-57sbckhv.js → index-36mtj8xm.js} +2 -2
  224. package/dist/{index-dm84tsd5.js → index-3kb8dw48.js} +1 -1
  225. package/dist/index-3tb82xr7.js +11 -0
  226. package/dist/{index-c24bj2r1.js → index-4243301z.js} +2 -2
  227. package/dist/{index-nr4fhfn4.js → index-4p2zx593.js} +2 -0
  228. package/dist/{index-q86qnzzf.js → index-54wp467c.js} +4 -4
  229. package/dist/{index-mcv7b2n0.js → index-63ctzjp4.js} +497 -495
  230. package/dist/{index-y0a4gt1s.js → index-65p8v81y.js} +3 -2
  231. package/dist/{index-z72vazf5.js → index-6y3eae97.js} +27 -83
  232. package/dist/{index-5awtbyns.js → index-9vj869rx.js} +1 -1
  233. package/dist/{index-5q0qpw3v.js → index-aqm7e864.js} +23 -8
  234. package/dist/{index-d4at0q09.js → index-b9mj31q7.js} +90 -88
  235. package/dist/{index-baba8ehy.js → index-bjrcbcn2.js} +2 -2
  236. package/dist/{index-fsw9wxk9.js → index-c9j8441q.js} +1 -103
  237. package/dist/{index-wdb5jhas.js → index-d1pdv8qc.js} +1 -1
  238. package/dist/{index-73wq9abg.js → index-df5xr2f9.js} +13 -59
  239. package/dist/{index-n9358ydy.js → index-dm50x3by.js} +1 -1
  240. package/dist/{index-zyyerdny.js → index-dmrx8xma.js} +3 -0
  241. package/dist/{index-78da4g74.js → index-dwq6a6sq.js} +17 -13
  242. package/dist/{index-9be3tf6r.js → index-e413q2cj.js} +49 -22
  243. package/dist/{index-g4gstmp1.js → index-ednf2cxs.js} +1 -1
  244. package/dist/{index-84tp547a.js → index-edpkm3k7.js} +29 -97
  245. package/dist/{index-gs0jw0hy.js → index-efbzm2se.js} +3 -3
  246. package/dist/{index-de7b0kvz.js → index-epwvp88y.js} +1 -1
  247. package/dist/{index-asnd4h2k.js → index-f0dzyskg.js} +27 -4
  248. package/dist/{index-xbb8ysmq.js → index-fatke81t.js} +2 -2
  249. package/dist/{index-6nzzj7qr.js → index-gq35s3bm.js} +1 -1
  250. package/dist/index-gvgtmt7a.js +102 -0
  251. package/dist/{index-m2b49tvc.js → index-h08xqfw9.js} +20 -21
  252. package/dist/{index-gk6dq9ay.js → index-ha1tv70k.js} +3 -26
  253. package/dist/{index-wsv11dhg.js → index-hberxns4.js} +1 -1
  254. package/dist/{index-rkphknhx.js → index-hpzhz1vm.js} +1 -1
  255. package/dist/{index-npfdymav.js → index-j5vzhj3d.js} +1 -1
  256. package/dist/{index-d3s070eh.js → index-jperyn0c.js} +1 -1
  257. package/dist/{index-yhwx4fwk.js → index-kzsetgh9.js} +1 -1
  258. package/dist/{index-x6sp5vpa.js → index-q4tr9vnf.js} +1 -1
  259. package/dist/{index-hce3hbdg.js → index-qj0sq69b.js} +6 -2
  260. package/dist/{index-v0j22shs.js → index-rg08syp1.js} +9 -6
  261. package/dist/{index-8vzh5wpv.js → index-rw1caff2.js} +14 -26
  262. package/dist/index-s8af9jqw.js +6 -0
  263. package/dist/{index-bgj9hbm3.js → index-sdppfbrh.js} +30 -16
  264. package/dist/{index-y0mwkgkf.js → index-shte29pg.js} +1086 -1055
  265. package/dist/{index-fec05c9k.js → index-ta0e2daw.js} +9 -7
  266. package/dist/{index-zfrysr1e.js → index-tb36xawm.js} +110 -75
  267. package/dist/{index-c0yym4a0.js → index-w7e402wx.js} +11 -105
  268. package/dist/{index-bvpevwt6.js → index-xnqab06h.js} +207 -202
  269. package/dist/index-xrbrvn15.js +147 -0
  270. package/dist/{index-ac3rfec5.js → index-y6wzzk2e.js} +21 -1
  271. package/dist/{index-3d2c45jn.js → index-yjx5jna7.js} +2 -2
  272. package/dist/internal/loopback-host.d.ts +8 -0
  273. package/dist/internal/loopback-host.d.ts.map +1 -0
  274. package/dist/internal/own-member.d.ts +7 -0
  275. package/dist/internal/own-member.d.ts.map +1 -0
  276. package/dist/internal/request.d.ts +17 -8
  277. package/dist/internal/request.d.ts.map +1 -1
  278. package/dist/internal/secret-shapes.d.ts +33 -4
  279. package/dist/internal/secret-shapes.d.ts.map +1 -1
  280. package/dist/json-schema/dialect.d.ts.map +1 -1
  281. package/dist/json-schema/keywords.d.ts +25 -6
  282. package/dist/json-schema/keywords.d.ts.map +1 -1
  283. package/dist/json-schema/string-format.d.ts.map +1 -1
  284. package/dist/live/events.d.ts.map +1 -1
  285. package/dist/live/watch-client.d.ts.map +1 -1
  286. package/dist/live/watch-delta.d.ts.map +1 -1
  287. package/dist/observability/context.d.ts +4 -3
  288. package/dist/observability/context.d.ts.map +1 -1
  289. package/dist/observability/sanitize.d.ts.map +1 -1
  290. package/dist/observability/secret-values.d.ts +0 -9
  291. package/dist/observability/secret-values.d.ts.map +1 -1
  292. package/dist/server/context.d.ts +3 -2
  293. package/dist/server/context.d.ts.map +1 -1
  294. package/dist/server/error-hook.d.ts +4 -3
  295. package/dist/server/error-hook.d.ts.map +1 -1
  296. package/dist/server/event-bus.d.ts.map +1 -1
  297. package/dist/server/file.d.ts +11 -3
  298. package/dist/server/file.d.ts.map +1 -1
  299. package/dist/server/handler-state.d.ts +2 -2
  300. package/dist/server/handler-state.d.ts.map +1 -1
  301. package/dist/server/middleware/jwt.d.ts +12 -1
  302. package/dist/server/middleware/jwt.d.ts.map +1 -1
  303. package/dist/server/middleware/trust-fence.d.ts +4 -0
  304. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  305. package/dist/server/multipart.d.ts +2 -3
  306. package/dist/server/multipart.d.ts.map +1 -1
  307. package/dist/server/raw.d.ts.map +1 -1
  308. package/dist/server/request-body.d.ts +12 -1
  309. package/dist/server/request-body.d.ts.map +1 -1
  310. package/dist/server/request-completion.d.ts.map +1 -1
  311. package/dist/server/types.d.ts +14 -9
  312. package/dist/server/types.d.ts.map +1 -1
  313. package/dist/telegram/crypto.d.ts.map +1 -1
  314. package/dist/telegram/init-data.d.ts +4 -4
  315. package/dist/telegram/init-data.d.ts.map +1 -1
  316. package/dist/telegram/outbound-cost.d.ts.map +1 -1
  317. package/dist/telegram/screens/test-chat.d.ts.map +1 -1
  318. package/dist/telegram/widget-api.d.ts +85 -13
  319. package/dist/telegram/widget-api.d.ts.map +1 -1
  320. package/dist/telegram/widget.d.ts +46 -2
  321. package/dist/telegram/widget.d.ts.map +1 -1
  322. package/dist/tools/cli/args-classify.d.ts +4 -74
  323. package/dist/tools/cli/args-classify.d.ts.map +1 -1
  324. package/dist/tools/cli/args-framework.d.ts +79 -0
  325. package/dist/tools/cli/args-framework.d.ts.map +1 -0
  326. package/dist/tools/cli/args-scan.d.ts.map +1 -1
  327. package/dist/tools/cli/args-tokens.d.ts.map +1 -1
  328. package/dist/tools/cli/checkpoint.d.ts +5 -0
  329. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  330. package/dist/tools/cli/stream.d.ts.map +1 -1
  331. package/dist/tools/connections/foreign-schema-join.d.ts.map +1 -1
  332. package/dist/tools/connections/openapi.d.ts.map +1 -1
  333. package/dist/tools/connections/runtime.d.ts.map +1 -1
  334. package/dist/tools/execute-handler.d.ts +24 -0
  335. package/dist/tools/execute-handler.d.ts.map +1 -0
  336. package/dist/tools/execute.d.ts.map +1 -1
  337. package/dist/tools/mcp/round.d.ts.map +1 -1
  338. package/dist/tools/schema/coerce.d.ts.map +1 -1
  339. package/dist/tools/schema/flatten.d.ts.map +1 -1
  340. package/dist/tools/schema/inline-references.d.ts.map +1 -1
  341. package/dist/tools/schema/nesting-limit.d.ts.map +1 -1
  342. package/dist/tools/schema/presentation.d.ts.map +1 -1
  343. package/dist/tracking/privacy.d.ts.map +1 -1
  344. package/llms/agent-runtime-openrouter.txt +14 -5
  345. package/llms/agent-runtime-sandbox.txt +50 -11
  346. package/llms/agent-runtime-testing.txt +1 -1
  347. package/llms/agent-runtime.2.txt +342 -230
  348. package/llms/agent-runtime.3.txt +225 -380
  349. package/llms/agent-runtime.4.txt +387 -158
  350. package/llms/agent-runtime.5.txt +157 -152
  351. package/llms/agent-runtime.6.txt +164 -0
  352. package/llms/agent-runtime.txt +307 -362
  353. package/llms/application.txt +3 -1
  354. package/llms/http.txt +1 -1
  355. package/llms/live.txt +3 -1
  356. package/llms/observability.txt +16 -9
  357. package/llms/server.2.txt +13 -8
  358. package/llms/server.4.txt +23 -11
  359. package/llms/server.5.txt +5 -5
  360. package/llms/server.txt +54 -1
  361. package/llms/spend.txt +18 -1
  362. package/llms/stitchkit.2.txt +4 -2
  363. package/llms/stitchkit.txt +113 -93
  364. package/llms/telegram-grammy.txt +3 -2
  365. package/llms/telegram.2.txt +3 -1
  366. package/llms/telegram.txt +35 -10
  367. package/llms/upgrading-0.128.0-0.129.0.txt +175 -0
  368. package/llms/{upgrading-0.128.0-0.135.0.txt → upgrading-0.130.0-0.136.0.txt} +353 -169
  369. package/llms/upgrading.txt +2 -1
  370. package/llms-full.txt +1035 -208
  371. package/llms.txt +14 -13
  372. package/package.json +6 -6
  373. package/dist/agent-runtime/loop/deferred-tools-internal.d.ts +0 -19
  374. package/dist/agent-runtime/loop/deferred-tools-internal.d.ts.map +0 -1
  375. package/dist/agent-runtime/loop/run-complete-retry.d.ts +0 -24
  376. package/dist/agent-runtime/loop/run-complete-retry.d.ts.map +0 -1
  377. package/dist/agent-runtime/loop/run-model-attempts.d.ts +0 -6
  378. package/dist/agent-runtime/loop/run-model-attempts.d.ts.map +0 -1
  379. package/dist/index-sznqf8fx.js +0 -20
  380. /package/dist/{index-fthw8dwa.js → index-4gbybjg6.js} +0 -0
@@ -0,0 +1,102 @@
1
+ import {
2
+ resolveRouteParamsSchema
3
+ } from "./index-m38ej7e5.js";
4
+ import {
5
+ defineContract2
6
+ } from "./index-dmrx8xma.js";
7
+ import {
8
+ describeRefusals
9
+ } from "./index-dxft2mnm.js";
10
+ import {
11
+ canonicalDigest
12
+ } from "./index-3dq8466w.js";
13
+ import {
14
+ typedEntries,
15
+ isRecord
16
+ } from "./index-ps3djm8d.js";
17
+
18
+ // src/contract/fingerprint.ts
19
+ import { z } from "zod";
20
+ var ContractFingerprintSchema2 = z.strictObject({
21
+ fingerprint: z.string(),
22
+ operations: z.record(z.string(), z.string())
23
+ });
24
+ var ANNOTATIONS = new Set(["description", "title", "examples", "deprecated", "$comment"]);
25
+ function constraintsOf(schema) {
26
+ if (Array.isArray(schema))
27
+ return schema.map(constraintsOf);
28
+ if (!isRecord(schema))
29
+ return schema;
30
+ const constraints = {};
31
+ for (const [key, value] of Object.entries(schema)) {
32
+ if (ANNOTATIONS.has(key))
33
+ continue;
34
+ constraints[key] = key === "required" && Array.isArray(value) ? [...value].sort() : key === "properties" && isRecord(value) ? Object.fromEntries(Object.entries(value).map(([name, property]) => [name, constraintsOf(property)])) : constraintsOf(value);
35
+ }
36
+ return constraints;
37
+ }
38
+ function schemaIdentity(schema, io) {
39
+ if (schema === undefined)
40
+ return null;
41
+ return constraintsOf(z.toJSONSchema(schema, { io, unrepresentable: "any", cycles: "ref" }));
42
+ }
43
+ function refusalIdentity(refuses) {
44
+ return [...refuses].sort((left, right) => left.code < right.code ? -1 : left.code > right.code ? 1 : 0).map((refusal) => ({
45
+ code: refusal.code,
46
+ status: refusal.status,
47
+ details: schemaIdentity(refusal.details, "output")
48
+ }));
49
+ }
50
+ function fingerprintOperations(operations) {
51
+ const digests = {};
52
+ for (const operation of operations) {
53
+ if (Object.hasOwn(digests, operation.name)) {
54
+ throw new Error(`[stitchkit] contract fingerprint: duplicate operation "${operation.name}"`);
55
+ }
56
+ digests[operation.name] = canonicalDigest({
57
+ method: operation.method,
58
+ path: operation.path,
59
+ params: schemaIdentity(operation.params, "input"),
60
+ input: schemaIdentity(operation.input, "input"),
61
+ output: schemaIdentity(operation.output, "output"),
62
+ item: schemaIdentity(operation.item, "output"),
63
+ ...operation.refuses && { refuses: refusalIdentity(operation.refuses) }
64
+ });
65
+ }
66
+ return { fingerprint: canonicalDigest(digests), operations: digests };
67
+ }
68
+ function contractFingerprint2(contracts) {
69
+ const list = Array.isArray(contracts) ? contracts : [contracts];
70
+ return fingerprintOperations(list.flatMap(contractOperations));
71
+ }
72
+ function contractOperations(contract) {
73
+ const operations = [];
74
+ for (const [key, endpoint] of typedEntries(contract.endpoints)) {
75
+ if (endpoint.expose && !endpoint.expose.includes("HTTP"))
76
+ continue;
77
+ operations.push({
78
+ name: `${contract.meta.prefix}.${key}`,
79
+ method: endpoint.method,
80
+ path: endpoint.path,
81
+ params: resolveRouteParamsSchema(endpoint.path, endpoint.params),
82
+ input: endpoint.input,
83
+ output: endpoint.output,
84
+ item: "stream" in endpoint ? endpoint.stream?.item : undefined,
85
+ refuses: describeRefusals(endpoint.refuses)
86
+ });
87
+ }
88
+ return operations;
89
+ }
90
+
91
+ // src/contract/identity.ts
92
+ var contractIdentityContract2 = defineContract2({ prefix: "contract-identity", scope: "public" }, {
93
+ read: {
94
+ method: "GET",
95
+ path: "/",
96
+ desc: "The fingerprint of the contract operations this server answers",
97
+ expose: ["HTTP"],
98
+ output: ContractFingerprintSchema2
99
+ }
100
+ });
101
+
102
+ export { ContractFingerprintSchema2, fingerprintOperations, contractFingerprint2, contractIdentityContract2 };
@@ -9,12 +9,6 @@ import {
9
9
  joinRoutePath,
10
10
  parseTrailingWildcard
11
11
  } from "./index-m38ej7e5.js";
12
- import {
13
- errorCode2,
14
- recordedErrorMessage,
15
- normalizeError2,
16
- validateDeclaredOutput
17
- } from "./index-78da4g74.js";
18
12
  import {
19
13
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
20
14
  readContractStreamItems,
@@ -38,7 +32,7 @@ import {
38
32
  runWithRequestContext2,
39
33
  getRequestContext2,
40
34
  setRequestEndpoint2
41
- } from "./index-x6sp5vpa.js";
35
+ } from "./index-q4tr9vnf.js";
42
36
  import {
43
37
  resolveTraceId2,
44
38
  resolveSocketIp2,
@@ -46,7 +40,14 @@ import {
46
40
  getClientInfo2,
47
41
  MalformedQueryError,
48
42
  parseQueryParams
49
- } from "./index-5q0qpw3v.js";
43
+ } from "./index-aqm7e864.js";
44
+ import {
45
+ errorCode2,
46
+ parseContractInput,
47
+ recordedErrorMessage,
48
+ normalizeError2,
49
+ validateDeclaredOutput
50
+ } from "./index-dwq6a6sq.js";
50
51
  import {
51
52
  mediaTypeEssence
52
53
  } from "./index-zs8cze4j.js";
@@ -1091,7 +1092,7 @@ async function parseMultipart2(req, descriptor, fieldsSchema, receivers) {
1091
1092
  }
1092
1093
  return {
1093
1094
  files,
1094
- fields: fieldsSchema ? fieldsSchema.parse(fields) : fields,
1095
+ fields: fieldsSchema ? parseContractInput(fieldsSchema, fields) : fields,
1095
1096
  rollback
1096
1097
  };
1097
1098
  } catch (error) {
@@ -1104,11 +1105,10 @@ async function parseMultipart2(req, descriptor, fieldsSchema, receivers) {
1104
1105
  }
1105
1106
 
1106
1107
  // src/server/request-body.ts
1107
- async function readRequestText(req, maxBytes) {
1108
+ var DEFAULT_REQUEST_BODY_BYTES = 1024 * 1024;
1109
+ async function readRequestText(req, maxBytes = DEFAULT_REQUEST_BODY_BYTES) {
1108
1110
  if (req.signal.aborted)
1109
1111
  throw abortReason(req.signal);
1110
- if (maxBytes === undefined)
1111
- return req.text();
1112
1112
  assertPositiveSafeInteger("maxJsonBodyBytes", maxBytes, Error);
1113
1113
  const result = await readBoundedText(req, { maxBytes, signal: req.signal });
1114
1114
  if (result.kind === "over-limit")
@@ -1162,7 +1162,7 @@ function buildBaseContext(req, url, pathParams, traceId, clientIp) {
1162
1162
  }
1163
1163
  function parsePathParamsInto(ctx, method) {
1164
1164
  if (method.paramsSchema) {
1165
- ctx.params = method.paramsSchema.parse(ctx.params);
1165
+ ctx.params = parseContractInput(method.paramsSchema, ctx.params);
1166
1166
  }
1167
1167
  }
1168
1168
  async function parseRequestPayloadInto(ctx, req, url, method, maxJsonBodyBytes, cors) {
@@ -1174,21 +1174,21 @@ async function parseRequestPayloadInto(ctx, req, url, method, maxJsonBodyBytes,
1174
1174
  }
1175
1175
  if (method.inputSchema) {
1176
1176
  if (req.method === "GET") {
1177
- ctx.input = method.inputSchema.parse(parseQueryParams(url));
1177
+ ctx.input = parseContractInput(method.inputSchema, parseQueryParams(url));
1178
1178
  } else if (req.method === "DELETE") {
1179
1179
  if (mediaTypeEssence(req.headers.get("content-type")) === "application/json") {
1180
1180
  const text = await readRequestText(req, method.maxJsonBodyBytes ?? maxJsonBodyBytes);
1181
1181
  if (method.rawBody)
1182
1182
  ctx.rawBody = text;
1183
- ctx.input = method.inputSchema.parse(parseJsonBody(req, text, method, cors));
1183
+ ctx.input = parseContractInput(method.inputSchema, parseJsonBody(req, text, method, cors));
1184
1184
  } else {
1185
- ctx.input = method.inputSchema.parse(parseQueryParams(url));
1185
+ ctx.input = parseContractInput(method.inputSchema, parseQueryParams(url));
1186
1186
  }
1187
1187
  } else {
1188
1188
  const text = await readRequestText(req, method.maxJsonBodyBytes ?? maxJsonBodyBytes);
1189
1189
  if (method.rawBody)
1190
1190
  ctx.rawBody = text;
1191
- ctx.input = method.inputSchema.parse(parseJsonBody(req, text, method, cors));
1191
+ ctx.input = parseContractInput(method.inputSchema, parseJsonBody(req, text, method, cors));
1192
1192
  }
1193
1193
  }
1194
1194
  return;
@@ -2067,7 +2067,6 @@ function logOutgoing(entry) {
2067
2067
 
2068
2068
  // src/server/request-completion.ts
2069
2069
  var BODY_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
2070
- var DEFAULT_PAYLOAD_LOG_BYTES = 1024 * 1024;
2071
2070
  async function readPayload(clone, maxBytes) {
2072
2071
  try {
2073
2072
  const result = await readBoundedText(clone, { maxBytes, signal: clone.signal });
@@ -2082,7 +2081,7 @@ function openRequestCompletion(state, window) {
2082
2081
  const { logConfig, customLogger, useDefaultLog, observability } = state;
2083
2082
  const { req, url, traceId, startedAt, ipAddress } = window;
2084
2083
  const shouldLogRequest = logConfig !== null && shouldLog(url.pathname, req.method) && !shouldSkipLog(logConfig, req, url);
2085
- const payloadRead = observability?.includePayload && BODY_METHODS.has(req.method) ? readPayload(req.clone(), observability.payloadMaxBytes ?? state.config.maxJsonBodyBytes ?? DEFAULT_PAYLOAD_LOG_BYTES) : undefined;
2084
+ const payloadRead = observability?.includePayload && BODY_METHODS.has(req.method) ? readPayload(req.clone(), observability.payloadMaxBytes ?? state.config.maxJsonBodyBytes ?? DEFAULT_REQUEST_BODY_BYTES) : undefined;
2086
2085
  const logFormat = resolveLogFormat(logConfig?.format);
2087
2086
  let reqLog;
2088
2087
  if (shouldLogRequest && useDefaultLog) {
@@ -2183,7 +2182,7 @@ function writeCompletionLine(state, logConfig, window, line) {
2183
2182
 
2184
2183
  // src/server/create.ts
2185
2184
  function createHandler2(config) {
2186
- const { trustProxy = false, observability } = config;
2185
+ const { trustProxy, observability } = config;
2187
2186
  const state = createHandlerState(config);
2188
2187
  const handler = async (req, server) => {
2189
2188
  const url = new URL(req.url, "http://localhost");
@@ -2340,4 +2339,4 @@ async function dispatch(state, req, url, traceId, server, clientIp, startedAt, c
2340
2339
  return dispatchEndpoint(state, request, match);
2341
2340
  }
2342
2341
 
2343
- export { isTrustProxyHandler, contextContributionDelta, prepareContextContribution, mergeContextContribution, parseMultipart2, DEFAULT_STREAM_HEARTBEAT_MS2, streamingRoute2, ndjsonRoute2, sseRoute2, createHandler2 };
2342
+ export { isTrustProxyHandler, contextContributionDelta, prepareContextContribution, mergeContextContribution, parseMultipart2, DEFAULT_REQUEST_BODY_BYTES, DEFAULT_STREAM_HEARTBEAT_MS2, streamingRoute2, ndjsonRoute2, sseRoute2, createHandler2 };
@@ -1,11 +1,6 @@
1
1
  import {
2
- SCHEMA_KEYWORDS,
3
- SCHEMA_LIST_KEYWORDS,
4
- SCHEMA_MAP_KEYWORDS
5
- } from "./index-9be3tf6r.js";
6
- import {
7
- isRecord
8
- } from "./index-ps3djm8d.js";
2
+ mapSubschemas
3
+ } from "./index-e413q2cj.js";
9
4
 
10
5
  // src/json-schema/string-format.ts
11
6
  import { z } from "zod";
@@ -32,29 +27,11 @@ var STANDARD_STRING_FORMATS = new Set([
32
27
  ]);
33
28
  var SERVED_FORMAT = "x-stitchkit-served-format";
34
29
  function withServedFormats(schema) {
35
- const carried = {};
36
- for (const [key, child] of Object.entries(schema)) {
37
- if (SCHEMA_KEYWORDS.includes(key)) {
38
- carried[key] = Array.isArray(child) ? child.map(carriedSchema) : carriedSchema(child);
39
- } else if (SCHEMA_LIST_KEYWORDS.includes(key) && Array.isArray(child)) {
40
- carried[key] = child.map(carriedSchema);
41
- } else if (SCHEMA_MAP_KEYWORDS.includes(key) && isRecord(child)) {
42
- carried[key] = Object.fromEntries(Object.entries(child).map(([name, member]) => [name, carriedSchema(member)]));
43
- } else if (key === "dependencies" && isRecord(child)) {
44
- carried[key] = Object.fromEntries(Object.entries(child).map(([name, member]) => [
45
- name,
46
- isRecord(member) ? carriedSchema(member) : member
47
- ]));
48
- } else
49
- carried[key] = child;
50
- }
30
+ const carried = mapSubschemas(schema, { schema: withServedFormats });
51
31
  if (typeof schema.format === "string")
52
32
  carried[SERVED_FORMAT] = schema.format;
53
33
  return carried;
54
34
  }
55
- function carriedSchema(schema) {
56
- return isRecord(schema) ? withServedFormats(schema) : schema;
57
- }
58
35
  var readerExpressions = new Map;
59
36
  function readerExpression(format) {
60
37
  if (!readerExpressions.has(format)) {
@@ -26,7 +26,7 @@ import {
26
26
  isRuntimeSnapshotEntry,
27
27
  appendEventIn,
28
28
  ArchiveSpillSchema
29
- } from "./index-v0j22shs.js";
29
+ } from "./index-rg08syp1.js";
30
30
  import {
31
31
  InvocationExpiredPayloadSchema,
32
32
  parsePayloadPurgeCutoff,
@@ -9,7 +9,7 @@ import {
9
9
  AgentControlRequestSchema2,
10
10
  AgentControlResponseSchema2,
11
11
  AgentControlDeliverySchema2
12
- } from "./index-yhwx4fwk.js";
12
+ } from "./index-kzsetgh9.js";
13
13
 
14
14
  // src/agent-runtime/browser/browser-control-contract.ts
15
15
  import { z } from "zod";
@@ -23,7 +23,7 @@ import {
23
23
  replaceMessage,
24
24
  ArchiveSpillSchema,
25
25
  createAgentRuntimeStore2
26
- } from "./index-v0j22shs.js";
26
+ } from "./index-rg08syp1.js";
27
27
 
28
28
  // src/agent-runtime/stores/store-memory.ts
29
29
  import { z as z2 } from "zod";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-7an2fs5h.js";
4
4
  import {
5
5
  AgentRuntimeEventSchema2
6
- } from "./index-grhhsrd5.js";
6
+ } from "./index-1en7k3q5.js";
7
7
 
8
8
  // src/agent-runtime/events.ts
9
9
  function createAgentRuntimeEventSink2(config) {
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  isDurableAgentRuntimeEvent,
12
12
  AgentRuntimeEventSchema2
13
- } from "./index-grhhsrd5.js";
13
+ } from "./index-1en7k3q5.js";
14
14
 
15
15
  // src/agent-runtime/browser/control-schema.ts
16
16
  import { z as z2 } from "zod";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveSocketIp2,
3
3
  getClientInfo2
4
- } from "./index-5q0qpw3v.js";
4
+ } from "./index-aqm7e864.js";
5
5
  import {
6
6
  isUnsafeKey
7
7
  } from "./index-zsarb5xp.js";
@@ -3,10 +3,13 @@ import {
3
3
  } from "./index-dsa676h8.js";
4
4
  import {
5
5
  unwrapZodWrappers
6
- } from "./index-n9358ydy.js";
6
+ } from "./index-dm50x3by.js";
7
7
  import {
8
8
  safeJsonParse
9
9
  } from "./index-zsarb5xp.js";
10
+ import {
11
+ setOwnMember
12
+ } from "./index-3tb82xr7.js";
10
13
  import {
11
14
  isRecord
12
15
  } from "./index-ps3djm8d.js";
@@ -100,7 +103,8 @@ function coerceValue(value, schema, path) {
100
103
  const shape = base.shape;
101
104
  const out = {};
102
105
  for (const [key, item] of Object.entries(current)) {
103
- out[key] = coerceValue(item, shape[key], [...path, key]);
106
+ const field = Object.hasOwn(shape, key) ? shape[key] : undefined;
107
+ setOwnMember(out, key, coerceValue(item, field, [...path, key]));
104
108
  }
105
109
  return out;
106
110
  }
@@ -70,6 +70,9 @@ import {
70
70
  import {
71
71
  assistantStatus
72
72
  } from "./index-kgj8j7bv.js";
73
+ import {
74
+ setOwnMember
75
+ } from "./index-3tb82xr7.js";
73
76
  import {
74
77
  assertPositiveSafeInteger
75
78
  } from "./index-gr0kxymw.js";
@@ -2108,7 +2111,7 @@ function branchOpaqueRecord(ids, value, path = "") {
2108
2111
  for (const [key, entry] of Object.entries(value)) {
2109
2112
  const at = path ? `${path}.${key}` : key;
2110
2113
  if (!RUNTIME_REFERENCE_KEYS.has(key)) {
2111
- out[key] = branchOpaqueJson(ids, entry, at);
2114
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2112
2115
  continue;
2113
2116
  }
2114
2117
  const mode = ids.applicationKey(key);
@@ -2119,14 +2122,14 @@ function branchOpaqueRecord(ids, value, path = "") {
2119
2122
  key,
2120
2123
  path: at
2121
2124
  });
2122
- out[key] = branchOpaqueJson(ids, entry, at);
2125
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2123
2126
  continue;
2124
2127
  }
2125
2128
  if (mode === "rekey-spill") {
2126
2129
  if (typeof entry === "string") {
2127
2130
  const kinds = ids.sourceIdentitiesOf(entry);
2128
2131
  if (kinds.size === 1 && kinds.has("spill")) {
2129
- out[key] = ids.reference("spill", entry);
2132
+ setOwnMember(out, key, ids.reference("spill", entry));
2130
2133
  } else {
2131
2134
  ids.refuse({
2132
2135
  code: "application-key-source-identity",
@@ -2134,10 +2137,10 @@ function branchOpaqueRecord(ids, value, path = "") {
2134
2137
  key,
2135
2138
  path: at
2136
2139
  });
2137
- out[key] = entry;
2140
+ setOwnMember(out, key, entry);
2138
2141
  }
2139
2142
  } else {
2140
- out[key] = branchOpaqueJson(ids, entry, at);
2143
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2141
2144
  }
2142
2145
  continue;
2143
2146
  }
@@ -2154,7 +2157,7 @@ function branchOpaqueRecord(ids, value, path = "") {
2154
2157
  break;
2155
2158
  }
2156
2159
  }
2157
- out[key] = branchOpaqueJson(ids, entry, at);
2160
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2158
2161
  }
2159
2162
  return out;
2160
2163
  }
@@ -1,40 +1,28 @@
1
+ import {
2
+ isSecretQueryName,
3
+ maskKeyShapes,
4
+ maskAuthorizationValues,
5
+ maskUrlPasswords
6
+ } from "./index-xrbrvn15.js";
7
+
1
8
  // src/tracking/privacy.ts
2
9
  var MASK = "[masked]";
3
10
  var MAX_REDACTED_CHARS = 16384;
4
11
  var TELEGRAM_SIGNED_FIELD = "tgwebappdata";
5
- var PASSWORD_FIELD = /^(?:current|new|old|confirm|repeat|repeated)?(?:password|passwd|pwd)(?:confirmation)?$/;
6
- var CREDENTIAL_FIELDS = new Set([
7
- "token",
8
- "accesstoken",
9
- "idtoken",
10
- "refreshtoken",
11
- "authtoken",
12
- "sessiontoken",
13
- "csrftoken",
14
- "resettoken",
15
- "magictoken",
16
- "secret",
17
- "clientsecret",
18
- "apikey",
19
- "privatekey",
20
- "authorization",
21
- "signature",
22
- "xamzsignature"
23
- ]);
24
12
  var OAUTH_FIELDS = new Set(["code", "state", "sessionstate"]);
25
13
  var SIGNED_LOGIN_FIELDS = new Set(["hash"]);
26
14
  var PARAMETER = /([?&#])([^=&#?\s]+)=([^&#\s]*)/g;
27
- var URL_PASSWORD = /(https?:\/\/[^\s/:@]+:)[^\s/@]+(@)/gi;
28
- var BEARER = /\b(bearer\s+)[^\s,;]+/gi;
29
15
  var ASSIGNMENT = /(^|[^\w?&#/-])("[^"\n]+"|'[^'\n]+'|[\w.$[\]-]+)(\s*[:=]\s*)("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;}]+)/g;
16
+ function lastFieldName(key) {
17
+ return key.replace(/^amp;/, "").split(/[.[\]]/).filter((part) => part !== "" && !/^\d+$/.test(part)).at(-1) ?? "";
18
+ }
30
19
  function fieldName(key) {
31
- const field = key.replace(/^amp;/, "").split(/[.[\]]/).filter((part) => part !== "" && !/^\d+$/.test(part)).at(-1) ?? "";
32
- return field.replace(/[-_\s]/g, "").toLowerCase();
20
+ return lastFieldName(key).replace(/[-_\s]/g, "").toLowerCase();
33
21
  }
34
22
  function isSecretField(key, context) {
35
- const field = fieldName(key);
36
- if (PASSWORD_FIELD.test(field) || CREDENTIAL_FIELDS.has(field))
23
+ if (isSecretQueryName(lastFieldName(key)))
37
24
  return true;
25
+ const field = fieldName(key);
38
26
  if (field === TELEGRAM_SIGNED_FIELD)
39
27
  return true;
40
28
  if (context?.oauth && OAUTH_FIELDS.has(field))
@@ -58,7 +46,7 @@ function secretContextOf(input) {
58
46
  function redactTrackingText2(input) {
59
47
  const text = input.slice(0, MAX_REDACTED_CHARS);
60
48
  const context = secretContextOf(text);
61
- return text.replace(URL_PASSWORD, `$1${MASK}$2`).replace(BEARER, `$1${MASK}`).replace(PARAMETER, (whole, separator, key, value) => {
49
+ return maskAuthorizationValues(maskUrlPasswords(maskKeyShapes(text, MASK), MASK), MASK).replace(PARAMETER, (whole, separator, key, value) => {
62
50
  try {
63
51
  if (isSecretField(decodeKey(key), context))
64
52
  return `${separator}${key}=${MASK}`;
@@ -0,0 +1,6 @@
1
+ // src/internal/loopback-host.ts
2
+ function isLoopbackHostname(hostname) {
3
+ return hostname === "localhost" || hostname === "[::1]" || /^127(?:\.\d{1,3}){3}$/u.test(hostname);
4
+ }
5
+
6
+ export { isLoopbackHostname };
@@ -58,6 +58,19 @@ var TelegramWidgetMessageSchema2 = z.looseObject({
58
58
  chat_data: z.string().optional()
59
59
  })
60
60
  });
61
+ var QueryTypeSchema = z.discriminatedUnion("type", [
62
+ z.looseObject({ type: z.literal("data"), wallet_card: z.looseObject({}).optional() }),
63
+ z.looseObject({
64
+ type: z.literal("sign_data"),
65
+ wallet: WalletSchema,
66
+ sign_data: z.string()
67
+ }),
68
+ z.looseObject({
69
+ type: z.literal("sent_transaction"),
70
+ wallet: WalletSchema,
71
+ msg_hash: z.string()
72
+ })
73
+ ]);
61
74
  var TelegramWidgetQuerySchema2 = z.looseObject({
62
75
  id: z.string().min(1),
63
76
  from: z.looseObject({ id: z.int() }),
@@ -66,28 +79,29 @@ var TelegramWidgetQuerySchema2 = z.looseObject({
66
79
  inline_message_id: z.string().optional(),
67
80
  chat_instance: z.string(),
68
81
  chat_type: z.string().optional(),
69
- type: z.discriminatedUnion("type", [
70
- z.looseObject({ type: z.literal("data"), wallet_card: z.looseObject({}).optional() }),
71
- z.looseObject({
72
- type: z.literal("sign_data"),
73
- wallet: WalletSchema,
74
- sign_data: z.string()
75
- }),
76
- z.looseObject({
77
- type: z.literal("sent_transaction"),
78
- wallet: WalletSchema,
79
- msg_hash: z.string()
80
- })
81
- ]),
82
+ type: QueryTypeSchema,
82
83
  data: QueryDataSchema,
83
84
  widget_id: z.string().optional()
84
85
  });
85
- function parseTelegramWidgetQuery2(value) {
86
- const parsed = TelegramWidgetQuerySchema2.safeParse(value);
86
+ var TelegramSharedWidgetQuerySchema2 = z.looseObject({
87
+ id: z.string().min(1),
88
+ from: z.looseObject({ id: z.int() }),
89
+ type: QueryTypeSchema,
90
+ data: QueryDataSchema,
91
+ widget_id: z.string().min(1)
92
+ });
93
+ function parseQuery(schema, value) {
94
+ const parsed = schema.safeParse(value);
87
95
  if (parsed.success)
88
96
  return { query: parsed.data };
89
97
  const id = typeof value === "object" && value !== null ? Reflect.get(value, "id") : undefined;
90
98
  return typeof id === "string" && id.length > 0 ? { id, error: parsed.error } : undefined;
91
99
  }
100
+ function parseTelegramWidgetQuery2(value) {
101
+ return parseQuery(TelegramWidgetQuerySchema2, value);
102
+ }
103
+ function parseTelegramSharedWidgetQuery2(value) {
104
+ return parseQuery(TelegramSharedWidgetQuerySchema2, value);
105
+ }
92
106
 
93
- export { TELEGRAM_WIDGET_LIMITS2, TelegramWidgetHtmlSchema2, TelegramWidgetDataSchema2, TelegramWidgetMessageSchema2, TelegramWidgetQuerySchema2, parseTelegramWidgetQuery2 };
107
+ export { TELEGRAM_WIDGET_LIMITS2, TelegramWidgetHtmlSchema2, TelegramWidgetDataSchema2, TelegramWidgetMessageSchema2, TelegramWidgetQuerySchema2, TelegramSharedWidgetQuerySchema2, parseTelegramWidgetQuery2, parseTelegramSharedWidgetQuery2 };