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,37 @@
1
+ import { openRouterAudioTranscription } from './openrouter-audio.js';
2
+ import { type OpenRouterTransportOptions, openRouterRequestJson } from './openrouter-http.js';
3
+ import { openRouterDownloadVideo, openRouterGenerateImages, openRouterGetVideo, openRouterSubmitVideo } from './openrouter-media.js';
4
+ import { openRouterEmbeddings, openRouterRerank } from './openrouter-retrieval.js';
5
+ import { openRouterAudioSpeech } from './openrouter-speech.js';
6
+ import { openRouterRequestStream } from './openrouter-stream.js';
7
+ import { openRouterSystemOne } from './openrouter-systemone.js';
8
+ /**
9
+ * Transport settings a {@link createOpenRouterClient} client applies to every call. A call's own value
10
+ * wins; `headers` and `providerApiKeys` are merged key by key, the call's entries over the client's.
11
+ */
12
+ export type OpenRouterClientOptions = Omit<OpenRouterTransportOptions, 'signal'>;
13
+ /**
14
+ * The OpenRouter non-chat clients with shared transport settings bound once. Each method is the
15
+ * function of the same name (`audioTranscription` → `openRouterAudioTranscription`) called with the
16
+ * client's settings under the call's input.
17
+ */
18
+ export interface OpenRouterClient {
19
+ readonly audioTranscription: typeof openRouterAudioTranscription;
20
+ readonly audioSpeech: typeof openRouterAudioSpeech;
21
+ readonly systemOne: typeof openRouterSystemOne;
22
+ readonly generateImages: typeof openRouterGenerateImages;
23
+ readonly submitVideo: typeof openRouterSubmitVideo;
24
+ readonly getVideo: typeof openRouterGetVideo;
25
+ readonly downloadVideo: typeof openRouterDownloadVideo;
26
+ readonly embeddings: typeof openRouterEmbeddings;
27
+ readonly rerank: typeof openRouterRerank;
28
+ readonly requestJson: typeof openRouterRequestJson;
29
+ readonly requestStream: typeof openRouterRequestStream;
30
+ }
31
+ /**
32
+ * Create one OpenRouter client for the non-chat endpoints: `apiKey`, `baseUrl`, `fetch`, headers,
33
+ * attribution, BYOK keys and limits are stated once instead of on every call. An invalid `baseUrl` or
34
+ * static `apiKey` is refused here, before any call; `headers` and `providerApiKeys` are copied.
35
+ */
36
+ export declare function createOpenRouterClient(options?: OpenRouterClientOptions): OpenRouterClient;
37
+ //# sourceMappingURL=openrouter-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openrouter-client.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAIL,KAAK,0BAA0B,EAC/B,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAIL,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,4BAA4B,CAAC;IACjE,QAAQ,CAAC,WAAW,EAAE,OAAO,qBAAqB,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,mBAAmB,CAAC;IAC/C,QAAQ,CAAC,cAAc,EAAE,OAAO,wBAAwB,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,OAAO,qBAAqB,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,OAAO,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,OAAO,uBAAuB,CAAC;IACvD,QAAQ,CAAC,UAAU,EAAE,OAAO,oBAAoB,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,OAAO,gBAAgB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,OAAO,qBAAqB,CAAC;IACnD,QAAQ,CAAC,aAAa,EAAE,OAAO,uBAAuB,CAAC;CACxD;AA+BD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAmDlB"}
@@ -0,0 +1,120 @@
1
+ import type { z } from 'zod';
2
+ import { type OpenRouterQueryParams } from './openrouter-url.js';
3
+ /** The `timeoutMs` of an OpenRouter request that states none. */
4
+ export declare const DEFAULT_OPENROUTER_REQUEST_TIMEOUT_MS = 30000;
5
+ /** A JSON media type (`application/json`, `application/problem+json`, with or without parameters). */
6
+ export declare const JSON_CONTENT_TYPE: RegExp;
7
+ /**
8
+ * Web Fetch-compatible transport every OpenRouter path accepts — chat, catalog, spend and non-chat
9
+ * endpoints. It receives the resolved request `URL`; global `fetch` and `gateway.fetchFor('openrouter')` fit.
10
+ */
11
+ export type OpenRouterFetch = (input: URL, init?: RequestInit) => Promise<Response>;
12
+ /** Supported HTTP methods for generic OpenRouter non-chat requests. */
13
+ export type OpenRouterHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
14
+ /** Shared transport options for non-chat OpenRouter HTTP calls. */
15
+ export interface OpenRouterTransportOptions {
16
+ /** Static API key or per-call resolver; omit when `fetch` injects credentials (for example `gateway.fetchFor('openrouter')`). */
17
+ readonly apiKey?: string | (() => string | Promise<string>);
18
+ /** OpenRouter API v1 root URL override (defaults to `OPENROUTER_API_BASE_URL`). */
19
+ readonly baseUrl?: string;
20
+ /** Additional HTTP headers merged after OpenRouter attribution headers. */
21
+ readonly headers?: Readonly<Record<string, string>>;
22
+ /** Optional `X-OpenRouter-Title` attribution header. */
23
+ readonly appName?: string;
24
+ /** Optional `HTTP-Referer` attribution header. */
25
+ readonly appUrl?: string;
26
+ /** Optional BYOK upstream keys sent in `X-Provider-API-Keys`. */
27
+ readonly providerApiKeys?: Readonly<Record<string, string>>;
28
+ /** Injected Web Fetch transport (defaults to global `fetch`). */
29
+ readonly fetch?: OpenRouterFetch;
30
+ /** Caller cancellation signal. */
31
+ readonly signal?: AbortSignal;
32
+ /** Request timeout in milliseconds (validated via `assertTimerMs`, default 30 s). */
33
+ readonly timeoutMs?: number;
34
+ /** Maximum error response bytes read for diagnostics (default 64 KiB). */
35
+ readonly maxErrorBytes?: number;
36
+ }
37
+ /** Input options for {@link openRouterRequestJson}. */
38
+ export interface OpenRouterRequestJsonOptions extends OpenRouterTransportOptions {
39
+ /** Relative OpenRouter API v1 path such as `'/systemone'`, `'/credits'`, or `'/embeddings'`. */
40
+ readonly path: string;
41
+ /** HTTP method (defaults to `'POST'` when `body` is supplied, otherwise `'GET'`). */
42
+ readonly method?: OpenRouterHttpMethod;
43
+ /** Optional query string parameters merged onto the resolved URL. */
44
+ readonly query?: OpenRouterQueryParams;
45
+ /** JSON-serializable body or `FormData` multipart payload. */
46
+ readonly body?: unknown;
47
+ /** Optional Zod schema that validates and types the parsed JSON response body. */
48
+ readonly schema?: z.ZodType;
49
+ /** Maximum JSON response size in bytes (default 16 MiB). */
50
+ readonly maxResponseBytes?: number;
51
+ }
52
+ /** Parsed response and OpenRouter metadata returned by {@link openRouterRequestJson}. */
53
+ export interface OpenRouterJsonResponse<T = unknown> {
54
+ readonly data: T;
55
+ readonly status: number;
56
+ readonly generationId?: string;
57
+ readonly requestId?: string;
58
+ readonly costUsd?: number;
59
+ readonly headers: Readonly<Record<string, string>>;
60
+ }
61
+ /** Validate that a required string parameter is non-empty after trimming. */
62
+ export declare function assertNonEmptyOpenRouterField(caller: string, name: string, value: string): string;
63
+ /** Pick shared transport fields from a typed endpoint input object. */
64
+ export declare function pickOpenRouterTransport(input: OpenRouterTransportOptions & {
65
+ readonly maxResponseBytes?: number;
66
+ }): OpenRouterTransportOptions & {
67
+ readonly maxResponseBytes?: number;
68
+ };
69
+ /** Validate a static OpenRouter API key eagerly before any network call. */
70
+ export declare function assertValidOpenRouterApiKey(apiKey: string | (() => string | Promise<string>) | undefined): void;
71
+ /** Resolve a static or async OpenRouter API key when supplied. */
72
+ export declare function resolveOptionalOpenRouterApiKey(apiKey: string | (() => string | Promise<string>) | undefined): Promise<string | undefined>;
73
+ /**
74
+ * Fail fast, before any request, when a paid OpenRouter endpoint would be called without credentials:
75
+ * no `apiKey`, no `Authorization` header, no custom `fetch`, and a `baseUrl` that is OpenRouter's own
76
+ * host (omitted, or `OPENROUTER_API_BASE_URL`). A `baseUrl` on another host may inject credentials itself.
77
+ */
78
+ export declare function assertOpenRouterDirectAuth(input: OpenRouterTransportOptions): void;
79
+ /** Assemble OpenRouter authentication and attribution headers (shared across chat and non-chat transports). */
80
+ export declare function buildOpenRouterBaseHeaders(settings: {
81
+ readonly appUrl?: string;
82
+ readonly appName?: string;
83
+ readonly providerApiKeys?: Readonly<Record<string, string>>;
84
+ }, apiKey?: string): Record<string, string>;
85
+ export interface PreparedOpenRouterRequest {
86
+ readonly url: URL;
87
+ readonly method: OpenRouterHttpMethod;
88
+ readonly isFormData: boolean;
89
+ readonly serializedBody?: string | FormData;
90
+ readonly timeoutMs: number;
91
+ readonly maxErrorBytes: number;
92
+ readonly fetch?: OpenRouterFetch;
93
+ }
94
+ export declare function prepareOpenRouterRequest(input: OpenRouterTransportOptions & {
95
+ readonly path: string;
96
+ readonly method?: OpenRouterHttpMethod;
97
+ readonly query?: OpenRouterQueryParams;
98
+ readonly body?: unknown;
99
+ }): PreparedOpenRouterRequest;
100
+ export declare function assembleOpenRouterRequestHeaders(input: OpenRouterTransportOptions, prepared: PreparedOpenRouterRequest, apiKey: string | undefined, defaultAccept: string | undefined): Headers;
101
+ /** The wire exchange of a prepared request under the signal that bounds it. */
102
+ export declare function openRouterExchange(prepared: PreparedOpenRouterRequest, headers: Headers, signal: AbortSignal): {
103
+ url: URL;
104
+ method: OpenRouterHttpMethod;
105
+ headers: Headers;
106
+ body?: string | FormData | undefined;
107
+ signal: AbortSignal;
108
+ fetch?: OpenRouterFetch | undefined;
109
+ maxErrorBytes: number;
110
+ };
111
+ export declare function extractOpenRouterGenerationId(headers: Headers, parsedBody?: unknown): string | undefined;
112
+ /** Issue a validated JSON or multipart request to any OpenRouter API v1 endpoint, returning schema-parsed data and metadata. */
113
+ export declare function openRouterRequestJson<T>(input: OpenRouterRequestJsonOptions & {
114
+ readonly schema: z.ZodType<T>;
115
+ }): Promise<OpenRouterJsonResponse<T>>;
116
+ /** Issue a validated JSON or multipart request to any OpenRouter API v1 endpoint, returning parsed JSON data and metadata. */
117
+ export declare function openRouterRequestJson(input: OpenRouterRequestJsonOptions & {
118
+ readonly schema?: undefined;
119
+ }): Promise<OpenRouterJsonResponse<unknown>>;
120
+ //# sourceMappingURL=openrouter-http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openrouter-http.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAS7B,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,kBAAkB,CAAC;AAU1B,iEAAiE;AACjE,eAAO,MAAM,qCAAqC,QAAS,CAAC;AAC5D,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,QAAsD,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEpF,uEAAuE;AACvE,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/E,mEAAmE;AACnE,MAAM,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MAAM,EAAE,WAAW;;;;;;;;EAWpB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,OAAO,EAChB,UAAU,CAAC,EAAE,OAAO,GACnB,MAAM,GAAG,SAAS,CAYpB;AAQD,gIAAgI;AAChI,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,4BAA4B,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,GACtE,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,8HAA8H;AAC9H,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,4BAA4B,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,GACpE,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,174 @@
1
+ import { z } from 'zod';
2
+ import { type OpenRouterTransportOptions } from './openrouter-http.js';
3
+ import { type OpenRouterStreamResponse } from './openrouter-stream.js';
4
+ import { type OpenRouterResponseMeta } from './openrouter-wire.js';
5
+ /** Zod schema validating OpenRouter's `POST /images` Unified Image API response envelope. */
6
+ export declare const OpenRouterImageGenerationResponseSchema: z.ZodObject<{
7
+ created: z.ZodOptional<z.ZodInt>;
8
+ data: z.ZodArray<z.ZodObject<{
9
+ b64_json: z.ZodOptional<z.ZodString>;
10
+ url: z.ZodOptional<z.ZodString>;
11
+ media_type: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$loose>>;
13
+ expires_at: z.ZodOptional<z.ZodInt>;
14
+ usage: z.ZodOptional<z.ZodObject<{
15
+ prompt_tokens: z.ZodOptional<z.ZodInt>;
16
+ completion_tokens: z.ZodOptional<z.ZodInt>;
17
+ input_tokens: z.ZodOptional<z.ZodInt>;
18
+ output_tokens: z.ZodOptional<z.ZodInt>;
19
+ total_tokens: z.ZodOptional<z.ZodInt>;
20
+ seconds: z.ZodOptional<z.ZodNumber>;
21
+ cost: z.ZodOptional<z.ZodNumber>;
22
+ is_byok: z.ZodOptional<z.ZodBoolean>;
23
+ }, z.core.$loose>>;
24
+ }, z.core.$loose>;
25
+ /** Parsed OpenRouter `POST /images` wire response inferred from `OpenRouterImageGenerationResponseSchema`. */
26
+ export type OpenRouterImageGenerationResponse = z.infer<typeof OpenRouterImageGenerationResponseSchema>;
27
+ declare const ImageGenerationRequestSchema: z.ZodObject<{
28
+ model: z.ZodString;
29
+ prompt: z.ZodString;
30
+ n: z.ZodOptional<z.ZodCustom<number, number>>;
31
+ aspectRatio: z.ZodOptional<z.ZodString>;
32
+ resolution: z.ZodOptional<z.ZodString>;
33
+ responseFormat: z.ZodOptional<z.ZodEnum<{
34
+ b64_json: "b64_json";
35
+ url: "url";
36
+ }>>;
37
+ inputReferences: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodUnknown>>>;
38
+ provider: z.ZodOptional<z.ZodObject<{
39
+ order: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ only: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ allowFallbacks: z.ZodOptional<z.ZodBoolean>;
43
+ requireParameters: z.ZodOptional<z.ZodBoolean>;
44
+ dataCollection: z.ZodOptional<z.ZodEnum<{
45
+ allow: "allow";
46
+ deny: "deny";
47
+ }>>;
48
+ zdr: z.ZodOptional<z.ZodBoolean>;
49
+ sort: z.ZodOptional<z.ZodEnum<{
50
+ latency: "latency";
51
+ price: "price";
52
+ throughput: "throughput";
53
+ }>>;
54
+ quantizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
56
+ }, z.core.$strict>>;
57
+ extraBody: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
58
+ }, z.core.$strip>;
59
+ /** Input options for {@link openRouterGenerateImages} (`POST /images`): the request fields plus the shared transport. */
60
+ export type OpenRouterImageGenerationInput = z.input<typeof ImageGenerationRequestSchema> & OpenRouterTransportOptions & {
61
+ /** Maximum JSON response size in bytes (default 16 MiB). */
62
+ readonly maxResponseBytes?: number;
63
+ };
64
+ /** Generated image entries and OpenRouter metadata returned by {@link openRouterGenerateImages}. */
65
+ export interface OpenRouterImageGenerationResult extends OpenRouterResponseMeta {
66
+ readonly created?: number;
67
+ readonly images: OpenRouterImageGenerationResponse['data'];
68
+ readonly expiresAt?: number;
69
+ readonly usage?: OpenRouterImageGenerationResponse['usage'];
70
+ readonly raw: OpenRouterImageGenerationResponse;
71
+ }
72
+ /** Generate images through OpenRouter's Unified Image API (`POST /images`). */
73
+ export declare function openRouterGenerateImages(input: OpenRouterImageGenerationInput): Promise<OpenRouterImageGenerationResult>;
74
+ /** Zod schema validating OpenRouter's `POST /videos` submit response. */
75
+ export declare const OpenRouterVideoSubmitResponseSchema: z.ZodObject<{
76
+ id: z.ZodString;
77
+ status: z.ZodString;
78
+ polling_url: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$loose>;
80
+ /** Parsed OpenRouter `POST /videos` submit wire response inferred from `OpenRouterVideoSubmitResponseSchema`. */
81
+ export type OpenRouterVideoSubmitResponse = z.infer<typeof OpenRouterVideoSubmitResponseSchema>;
82
+ /** Zod schema validating OpenRouter's `GET /videos/{jobId}` status response. */
83
+ export declare const OpenRouterVideoStatusResponseSchema: z.ZodObject<{
84
+ id: z.ZodString;
85
+ status: z.ZodString;
86
+ generation_id: z.ZodOptional<z.ZodString>;
87
+ urls: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ unsigned_urls: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
+ expires_at: z.ZodOptional<z.ZodInt>;
90
+ usage: z.ZodOptional<z.ZodObject<{
91
+ prompt_tokens: z.ZodOptional<z.ZodInt>;
92
+ completion_tokens: z.ZodOptional<z.ZodInt>;
93
+ input_tokens: z.ZodOptional<z.ZodInt>;
94
+ output_tokens: z.ZodOptional<z.ZodInt>;
95
+ total_tokens: z.ZodOptional<z.ZodInt>;
96
+ seconds: z.ZodOptional<z.ZodNumber>;
97
+ cost: z.ZodOptional<z.ZodNumber>;
98
+ is_byok: z.ZodOptional<z.ZodBoolean>;
99
+ }, z.core.$loose>>;
100
+ error: z.ZodOptional<z.ZodUnknown>;
101
+ }, z.core.$loose>;
102
+ /** Parsed OpenRouter `GET /videos/{jobId}` status wire response inferred from `OpenRouterVideoStatusResponseSchema`. */
103
+ export type OpenRouterVideoStatusResponse = z.infer<typeof OpenRouterVideoStatusResponseSchema>;
104
+ declare const VideoSubmitRequestSchema: z.ZodObject<{
105
+ model: z.ZodString;
106
+ prompt: z.ZodString;
107
+ duration: z.ZodOptional<z.ZodCustom<number, number>>;
108
+ aspectRatio: z.ZodOptional<z.ZodString>;
109
+ resolution: z.ZodOptional<z.ZodString>;
110
+ generateAudio: z.ZodOptional<z.ZodBoolean>;
111
+ frameImages: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodUnknown>>>;
112
+ inputReferences: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodUnknown>>>;
113
+ callbackUrl: z.ZodOptional<z.ZodString>;
114
+ provider: z.ZodOptional<z.ZodObject<{
115
+ order: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
+ only: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
+ allowFallbacks: z.ZodOptional<z.ZodBoolean>;
119
+ requireParameters: z.ZodOptional<z.ZodBoolean>;
120
+ dataCollection: z.ZodOptional<z.ZodEnum<{
121
+ allow: "allow";
122
+ deny: "deny";
123
+ }>>;
124
+ zdr: z.ZodOptional<z.ZodBoolean>;
125
+ sort: z.ZodOptional<z.ZodEnum<{
126
+ latency: "latency";
127
+ price: "price";
128
+ throughput: "throughput";
129
+ }>>;
130
+ quantizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
132
+ }, z.core.$strict>>;
133
+ extraBody: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
134
+ }, z.core.$strip>;
135
+ /** Input options for {@link openRouterSubmitVideo} (`POST /videos`): the request fields plus the shared transport. */
136
+ export type OpenRouterVideoSubmitInput = z.input<typeof VideoSubmitRequestSchema> & OpenRouterTransportOptions & {
137
+ /** Maximum JSON response size in bytes (default 16 MiB). */
138
+ readonly maxResponseBytes?: number;
139
+ };
140
+ /** Submitted async video job handle returned by {@link openRouterSubmitVideo}. */
141
+ export interface OpenRouterVideoSubmitResult extends OpenRouterResponseMeta {
142
+ readonly id: string;
143
+ readonly jobStatus: string;
144
+ readonly pollingUrl?: string;
145
+ readonly raw: OpenRouterVideoSubmitResponse;
146
+ }
147
+ declare const VideoJobRequestSchema: z.ZodObject<{
148
+ jobId: z.ZodString;
149
+ index: z.ZodOptional<z.ZodCustom<number, number>>;
150
+ }, z.core.$strip>;
151
+ /** Input options for {@link openRouterGetVideo} and {@link openRouterDownloadVideo}: the job fields plus the shared transport. */
152
+ export type OpenRouterVideoJobInput = z.input<typeof VideoJobRequestSchema> & OpenRouterTransportOptions & {
153
+ /** Maximum JSON response size in bytes (used by {@link openRouterGetVideo}, default 16 MiB). */
154
+ readonly maxResponseBytes?: number;
155
+ };
156
+ /** Polled async video job status, signed URLs, and usage returned by {@link openRouterGetVideo}. */
157
+ export interface OpenRouterVideoStatusResult extends OpenRouterResponseMeta {
158
+ readonly id: string;
159
+ readonly jobStatus: string;
160
+ readonly urls?: readonly string[];
161
+ readonly unsignedUrls?: readonly string[];
162
+ readonly expiresAt?: number;
163
+ readonly usage?: OpenRouterVideoStatusResponse['usage'];
164
+ readonly error?: unknown;
165
+ readonly raw: OpenRouterVideoStatusResponse;
166
+ }
167
+ /** Submit an asynchronous video generation job through OpenRouter's `POST /videos` endpoint. */
168
+ export declare function openRouterSubmitVideo(input: OpenRouterVideoSubmitInput): Promise<OpenRouterVideoSubmitResult>;
169
+ /** Poll the status, output URLs, and cost of an OpenRouter video generation job (`GET /videos/{jobId}`). */
170
+ export declare function openRouterGetVideo(input: Omit<OpenRouterVideoJobInput, 'index'>): Promise<OpenRouterVideoStatusResult>;
171
+ /** Stream the completed binary video bytes through OpenRouter's authenticated `GET /videos/{jobId}/content` endpoint. */
172
+ export declare function openRouterDownloadVideo(input: Omit<OpenRouterVideoJobInput, 'maxResponseBytes'>): Promise<OpenRouterStreamResponse>;
173
+ export {};
174
+ //# sourceMappingURL=openrouter-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openrouter-media.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAGL,KAAK,0BAA0B,EAGhC,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,KAAK,wBAAwB,EAA2B,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAEL,KAAK,sBAAsB,EAK5B,MAAM,mBAAmB,CAAC;AAoC3B,6FAA6F;AAC7F,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;iBAO1C,CAAC;AAEX,8GAA8G;AAC9G,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AAEF,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBhC,CAAC;AAEH,yHAAyH;AACzH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,GACvF,0BAA0B,GAAG;IAC3B,4DAA4D;IAC5D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEJ,oGAAoG;AACpG,MAAM,W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<z.ZodString>>;
99
99
  }, z.core.$loose>>;
100
100
  }, z.core.$strip>;
101
- /** How the leaf reaches OpenRouter; `fetch` by default. */
102
- export type OpenRouterCatalogFetch = (input: URL, init?: RequestInit) => Promise<Response>;
103
101
  /**
104
102
  * Run OpenRouter requests under a timeout shared by catalog and endpoint reads, linked to a
105
103
  * caller signal only while they run. `timeoutMs` is refused before any timer exists.
106
104
  */
107
105
  export declare function withOpenRouterTimeout<T>(timeoutMs: number, signal: AbortSignal | undefined, requests: (signal: AbortSignal) => Promise<T>): Promise<T>;
108
- /** Validate a static `apiKey` eagerly before any network call; functions are validated when resolved. */
109
- export declare function assertValidStaticOpenRouterApiKey(apiKey: string | (() => string | Promise<string>) | undefined): void;
110
- /**
111
- * One JSON read from OpenRouter: redirects refused (an API key goes to openrouter.ai and
112
- * nowhere else), the body bounded, a non-2xx status thrown, and `Authorization` omitted when
113
- * no key is provided.
114
- */
115
- export declare function openRouterJson(input: {
116
- fetcher: OpenRouterCatalogFetch;
117
- url: URL;
118
- apiKey?: string | (() => string | Promise<string>);
119
- signal: AbortSignal;
120
- maxBytes?: number;
121
- }): Promise<unknown>;
122
- /** A non-2xx answer from OpenRouter; `status` lets a caller tell "not yet" (404) from a failure. */
123
- export declare class OpenRouterHttpError extends Error {
124
- readonly status: number;
125
- constructor(status: number, path: string);
126
- }
127
106
  /** USD per token as OpenRouter writes it (a decimal string) → USD per million, or `undefined` when not a real price. */
128
107
  export declare function usdPerMillion(perToken: string | null | undefined): number | undefined;
129
108
  /** USD as written (a decimal string) → a number, or `undefined` when not a real price. */
130
109
  export declare function usd(value: string | null | undefined): number | undefined;
131
- /** Build the validated OpenRouter `/models/{author}/{slug}/endpoints` URL. */
132
- export declare function openRouterEndpointsUrl(modelId: string): URL;
110
+ /** The validated OpenRouter `/models/{author}/{slug}/endpoints` path of one model id. */
111
+ export declare function openRouterEndpointsPath(modelId: string): string;
133
112
  /** Validate every model id in `endpointsFor` eagerly before any network request. */
134
113
  export declare function assertValidOpenRouterEndpointsFor(endpointsFor: readonly string[] | undefined): void;
135
114
  /** OpenRouter's `/models/{author}/{slug}/endpoints` wire response envelope. */
@@ -1 +1 @@
1
- {"version":3,"file":"openrouter-models.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,qFAAqF;AACrF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2DxB,CAAC;AAEX,+FAA+F;AAC/F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgCvC,CAAC;AAEL,2DAA2D;AAC3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3F;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAC5C,OAAO,CAAC,CAAC,CAAC,CAGZ;AAED,yGAAyG;AACzG,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,GAC5D,IAAI,CAKN;AAiBD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,OAAO,EAAE,sBAAsB,CAAC;IAChC,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,MAAM,EAAE,WAAW,CAAC;I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,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAQtF;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK1F;AAED,MAAM,MAAM,iCAAiC,GACzC,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,OAAO,GACP,WAAW,GACX,YAAY,GACZ,cAAc,CAAC;AAEnB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC;CAC7C;AAED,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,iCAAiC,EAAE,CAAC;CACrE;AAmGD,+GAA+G;AAC/G,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS;;8BAjHpB,MAAM;kCACF,MAAM;qBACnB,MAAM;mBACR,MAAM;iCACQ,MAAM;kCACL,MAAM;oCACJ,MAAM;;;;;;;EAoJ5C"}
@@ -41,6 +41,7 @@ export declare const OpenRouterProviderRoutingSchema: z.ZodObject<{
41
41
  throughput: "throughput";
42
42
  }>>;
43
43
  quantizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
44
45
  }, z.core.$strict>;
45
46
  /** Upstream provider routing preferences inferred from `OpenRouterProviderRoutingSchema`. */
46
47
  export type OpenRouterProviderRouting = z.infer<typeof OpenRouterProviderRoutingSchema>;
@@ -84,6 +85,7 @@ export declare const OpenRouterRequestPolicySchema: z.ZodObject<{
84
85
  throughput: "throughput";
85
86
  }>>;
86
87
  quantizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
87
89
  }, z.core.$strict>>;
88
90
  maxPrice: z.ZodOptional<z.ZodObject<{
89
91
  promptUsdPerMillion: z.ZodOptional<z.ZodNumber>;
@@ -115,6 +117,8 @@ export interface OpenRouterWirePolicy {
115
117
  readonly looseTools: boolean;
116
118
  readonly cacheControl?: AgentCacheControl;
117
119
  }
120
+ /** Validate and project `OpenRouterProviderRouting` into OpenRouter snake_case wire fields. */
121
+ export declare function serializeOpenRouterProviderRouting(raw: OpenRouterProviderRouting): Record<string, unknown> | undefined;
118
122
  /** Validate and project `OpenRouterRequestPolicy` into OpenRouter wire fields. */
119
123
  export declare function resolveOpenRouterWirePolicy(raw: OpenRouterRequestPolicy): OpenRouterWirePolicy;
120
124
  export interface MergedOpenRouterStepPolicy {
@@ -1 +1 @@
1
- {"version":3,"file":"openrouter-options.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAIjC,wGAAwG;AACxG,eAAO,MAAM,sBAAsB,YACjC,UAAU,EACV,WAAW,EACX,YAAY,EACZ,OAAO,EACP,eAAe,EACf,OAAO,EACP,QAAQ,EACR,UAAU,EACV,iBAAiB,EACj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AAC,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAC3C;AAED,+FAA+F;AAC/F,wBAAgB,kCAAkC,CAChD,GAAG,EAAE,yBAAyB,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAiBrC;AAED,kFAAkF;AAClF,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,uBAAuB,GAC3B,oBAAoB,CAsCtB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,iBAAiB,CAAC;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC5D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,oBAAoB,EAC1B,eAAe,EAAE,yBAAyB,GAAG,SAAS,GACrD,0BAA0B,CAkE5B"}
@@ -0,0 +1,23 @@
1
+ import type { OpenRouterFetch } from './openrouter-http.js';
2
+ /** One OpenRouter HTTP exchange: what goes on the wire, already resolved and validated. */
3
+ export interface OpenRouterExchange {
4
+ /** Resolved by `resolveOpenRouterUrl`, so it already passed the baseUrl rule. */
5
+ readonly url: URL;
6
+ readonly method: string;
7
+ readonly headers: Headers;
8
+ readonly body?: string | FormData;
9
+ readonly signal: AbortSignal;
10
+ /** Injected Web Fetch transport; global `fetch` when omitted. */
11
+ readonly fetch?: OpenRouterFetch;
12
+ /** Largest error body prefix read for diagnostics (default 64 KiB). */
13
+ readonly maxErrorBytes?: number;
14
+ }
15
+ /**
16
+ * The one place an OpenRouter request reaches the network — chat, catalog, spend and every
17
+ * non-chat endpoint. Redirects are refused (the key goes to the configured origin and nowhere
18
+ * else), a response that lands after the signal is cancelled, and a non-2xx answer becomes an
19
+ * `AgentProviderError` with a bounded, redacted body, `statusCode`, `Retry-After` and request id.
20
+ * Returns the 2xx response with its body unread.
21
+ */
22
+ export declare function sendOpenRouterRequest(exchange: OpenRouterExchange): Promise<Response>;
23
+ //# sourceMappingURL=openrouter-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openrouter-request.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASzD,2FAA2F;AAC3F,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,uEAAuE;IACvE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAqBD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA+B3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"openrouter-response.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA+C/F;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,OAAO,GACjB,qBAAqB,CAyDvB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,gBAAgB,CAAC,EAAE,OAAO,GACzB,UAAU,CAEZ;AAgGD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,SAAK,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,qBAAqB,CAyCvB"}
1
+ {"version":3,"file":"openrouter-response.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA+C/F;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,OAAO,GACjB,qBAAqB,CA+DvB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,gBAAgB,CAAC,EAAE,OAAO,GACzB,UAAU,CAEZ;AAgGD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,SAAK,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,qBAAqB,CAyCvB"}
@@ -0,0 +1,145 @@
1
+ import { z } from 'zod';
2
+ import { type OpenRouterTransportOptions } from './openrouter-http.js';
3
+ import { type OpenRouterResponseMeta } from './openrouter-wire.js';
4
+ /** Zod schema validating OpenRouter's `POST /embeddings` response envelope. */
5
+ export declare const OpenRouterEmbeddingsResponseSchema: z.ZodObject<{
6
+ model: z.ZodOptional<z.ZodString>;
7
+ data: z.ZodArray<z.ZodObject<{
8
+ index: z.ZodInt;
9
+ embedding: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodString]>;
10
+ }, z.core.$loose>>;
11
+ usage: z.ZodOptional<z.ZodObject<{
12
+ prompt_tokens: z.ZodOptional<z.ZodInt>;
13
+ completion_tokens: z.ZodOptional<z.ZodInt>;
14
+ input_tokens: z.ZodOptional<z.ZodInt>;
15
+ output_tokens: z.ZodOptional<z.ZodInt>;
16
+ total_tokens: z.ZodOptional<z.ZodInt>;
17
+ seconds: z.ZodOptional<z.ZodNumber>;
18
+ cost: z.ZodOptional<z.ZodNumber>;
19
+ is_byok: z.ZodOptional<z.ZodBoolean>;
20
+ }, z.core.$loose>>;
21
+ }, z.core.$loose>;
22
+ /** Parsed OpenRouter `POST /embeddings` wire response inferred from `OpenRouterEmbeddingsResponseSchema`. */
23
+ export type OpenRouterEmbeddingsResponse = z.infer<typeof OpenRouterEmbeddingsResponseSchema>;
24
+ declare const EmbeddingsRequestSchema: z.ZodObject<{
25
+ model: z.ZodString;
26
+ input: z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString>>]>;
27
+ encodingFormat: z.ZodOptional<z.ZodEnum<{
28
+ base64: "base64";
29
+ float: "float";
30
+ }>>;
31
+ dimensions: z.ZodOptional<z.ZodCustom<number, number>>;
32
+ user: z.ZodOptional<z.ZodString>;
33
+ provider: z.ZodOptional<z.ZodObject<{
34
+ order: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ only: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ allowFallbacks: z.ZodOptional<z.ZodBoolean>;
38
+ requireParameters: z.ZodOptional<z.ZodBoolean>;
39
+ dataCollection: z.ZodOptional<z.ZodEnum<{
40
+ allow: "allow";
41
+ deny: "deny";
42
+ }>>;
43
+ zdr: z.ZodOptional<z.ZodBoolean>;
44
+ sort: z.ZodOptional<z.ZodEnum<{
45
+ latency: "latency";
46
+ price: "price";
47
+ throughput: "throughput";
48
+ }>>;
49
+ quantizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
51
+ }, z.core.$strict>>;
52
+ extraBody: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
53
+ }, z.core.$strip>;
54
+ /** Input options for {@link openRouterEmbeddings} (`POST /embeddings`): the request fields plus the shared transport. */
55
+ export type OpenRouterEmbeddingsInput = z.input<typeof EmbeddingsRequestSchema> & OpenRouterTransportOptions & {
56
+ /** Maximum JSON response size in bytes (default 16 MiB). */
57
+ readonly maxResponseBytes?: number;
58
+ };
59
+ /** Generated embedding vectors and OpenRouter metadata returned by {@link openRouterEmbeddings}. */
60
+ export interface OpenRouterEmbeddingsResult extends OpenRouterResponseMeta {
61
+ readonly model?: string;
62
+ readonly data: OpenRouterEmbeddingsResponse['data'];
63
+ readonly usage?: OpenRouterEmbeddingsResponse['usage'];
64
+ readonly raw: OpenRouterEmbeddingsResponse;
65
+ }
66
+ /** Generate vector embeddings through OpenRouter's `POST /embeddings` endpoint. */
67
+ export declare function openRouterEmbeddings(input: OpenRouterEmbeddingsInput): Promise<OpenRouterEmbeddingsResult>;
68
+ /** The input document echoed back in a rerank result (text and/or image). */
69
+ declare const RerankResultDocumentSchema: z.ZodObject<{
70
+ text: z.ZodOptional<z.ZodString>;
71
+ image: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$loose>;
73
+ /** Zod schema validating OpenRouter's `POST /rerank` response envelope. */
74
+ export declare const OpenRouterRerankResponseSchema: z.ZodObject<{
75
+ results: z.ZodArray<z.ZodObject<{
76
+ index: z.ZodInt;
77
+ relevance_score: z.ZodNumber;
78
+ document: z.ZodOptional<z.ZodObject<{
79
+ text: z.ZodOptional<z.ZodString>;
80
+ image: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$loose>>;
82
+ }, z.core.$loose>>;
83
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
84
+ usage: z.ZodOptional<z.ZodObject<{
85
+ prompt_tokens: z.ZodOptional<z.ZodInt>;
86
+ completion_tokens: z.ZodOptional<z.ZodInt>;
87
+ input_tokens: z.ZodOptional<z.ZodInt>;
88
+ output_tokens: z.ZodOptional<z.ZodInt>;
89
+ total_tokens: z.ZodOptional<z.ZodInt>;
90
+ seconds: z.ZodOptional<z.ZodNumber>;
91
+ cost: z.ZodOptional<z.ZodNumber>;
92
+ is_byok: z.ZodOptional<z.ZodBoolean>;
93
+ }, z.core.$loose>>;
94
+ }, z.core.$loose>;
95
+ /** Parsed OpenRouter `POST /rerank` wire response inferred from `OpenRouterRerankResponseSchema`. */
96
+ export type OpenRouterRerankResponse = z.infer<typeof OpenRouterRerankResponseSchema>;
97
+ declare const RerankRequestSchema: z.ZodObject<{
98
+ model: z.ZodString;
99
+ query: z.ZodString;
100
+ documents: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
101
+ text: z.ZodOptional<z.ZodString>;
102
+ image: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strict>]>>>;
104
+ topN: z.ZodOptional<z.ZodCustom<number, number>>;
105
+ provider: z.ZodOptional<z.ZodObject<{
106
+ order: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ only: z.ZodOptional<z.ZodArray<z.ZodString>>;
108
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ allowFallbacks: z.ZodOptional<z.ZodBoolean>;
110
+ requireParameters: z.ZodOptional<z.ZodBoolean>;
111
+ dataCollection: z.ZodOptional<z.ZodEnum<{
112
+ allow: "allow";
113
+ deny: "deny";
114
+ }>>;
115
+ zdr: z.ZodOptional<z.ZodBoolean>;
116
+ sort: z.ZodOptional<z.ZodEnum<{
117
+ latency: "latency";
118
+ price: "price";
119
+ throughput: "throughput";
120
+ }>>;
121
+ quantizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
123
+ }, z.core.$strict>>;
124
+ extraBody: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
125
+ }, z.core.$strip>;
126
+ /** Input options for {@link openRouterRerank} (`POST /rerank`): the request fields plus the shared transport. */
127
+ export type OpenRouterRerankInput = z.input<typeof RerankRequestSchema> & OpenRouterTransportOptions & {
128
+ /** Maximum JSON response size in bytes (default 16 MiB). */
129
+ readonly maxResponseBytes?: number;
130
+ };
131
+ /** Ranked relevance results and OpenRouter metadata returned by {@link openRouterRerank}. */
132
+ export interface OpenRouterRerankResult extends OpenRouterResponseMeta {
133
+ readonly results: readonly {
134
+ readonly index: number;
135
+ readonly relevanceScore: number;
136
+ readonly document?: z.infer<typeof RerankResultDocumentSchema>;
137
+ }[];
138
+ readonly meta?: OpenRouterRerankResponse['meta'];
139
+ readonly usage?: OpenRouterRerankResponse['usage'];
140
+ readonly raw: OpenRouterRerankResponse;
141
+ }
142
+ /** Rerank candidate documents against a query through OpenRouter's `POST /rerank` endpoint. */
143
+ export declare function openRouterRerank(input: OpenRouterRerankInput): Promise<OpenRouterRerankResult>;
144
+ export {};
145
+ //# sourceMappingURL=openrouter-retrieval.d.ts.map