maka-agent 0.2.0-dev.62.20260928 → 0.2.0-dev.64.20260929

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 (723) hide show
  1. package/LICENSE +15 -15
  2. package/THIRD_PARTY_NOTICES.txt +26 -26
  3. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  4. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +12 -12
  5. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +52 -0
  6. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +5 -4
  7. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +7 -0
  8. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +51 -8
  9. package/node_modules/@agentclientprotocol/sdk/package.json +2 -2
  10. package/node_modules/@agentclientprotocol/sdk/schema/schema.json +90 -2
  11. package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +103 -12
  12. package/node_modules/@ai-sdk/anthropic/CHANGELOG.md +140 -0
  13. package/node_modules/@ai-sdk/anthropic/README.md +1 -1
  14. package/node_modules/@ai-sdk/anthropic/dist/index.js +1622 -868
  15. package/node_modules/@ai-sdk/anthropic/dist/internal/index.js +1516 -763
  16. package/node_modules/@ai-sdk/anthropic/docs/05-anthropic.mdx +483 -62
  17. package/node_modules/@ai-sdk/anthropic/package.json +4 -4
  18. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/approval-continuation.js +0 -1
  19. package/node_modules/@ai-sdk/code-mode/dist/code-mode-tool.js +59 -0
  20. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/errors.js +0 -8
  21. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/interrupt-continuation.js +0 -2
  22. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/tool-prompt.js +43 -15
  23. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/package.json +3 -3
  24. package/node_modules/@ai-sdk/cohere/CHANGELOG.md +99 -0
  25. package/node_modules/@ai-sdk/cohere/README.md +1 -1
  26. package/node_modules/@ai-sdk/cohere/dist/index.js +35 -49
  27. package/node_modules/@ai-sdk/cohere/docs/25-cohere.mdx +11 -9
  28. package/node_modules/@ai-sdk/cohere/package.json +4 -4
  29. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/CHANGELOG.md +183 -0
  30. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/README.md +1 -1
  31. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/dist/index.js +587 -245
  32. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/docs/00-ai-gateway.mdx +235 -30
  33. package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/package.json +4 -4
  34. package/node_modules/@ai-sdk/google/CHANGELOG.md +180 -0
  35. package/node_modules/@ai-sdk/google/README.md +1 -1
  36. package/node_modules/@ai-sdk/google/dist/index.js +1147 -1130
  37. package/node_modules/@ai-sdk/google/dist/internal/index.js +809 -889
  38. package/node_modules/@ai-sdk/google/docs/15-google.mdx +224 -41
  39. package/node_modules/@ai-sdk/google/package.json +4 -4
  40. package/node_modules/@ai-sdk/open-responses/CHANGELOG.md +109 -0
  41. package/node_modules/@ai-sdk/open-responses/dist/index.js +419 -183
  42. package/node_modules/@ai-sdk/open-responses/docs/06-open-responses.mdx +121 -6
  43. package/node_modules/@ai-sdk/open-responses/package.json +4 -4
  44. package/node_modules/@ai-sdk/openai/CHANGELOG.md +147 -0
  45. package/node_modules/@ai-sdk/openai/README.md +27 -2
  46. package/node_modules/@ai-sdk/openai/dist/index.js +2445 -1828
  47. package/node_modules/@ai-sdk/openai/dist/internal/index.js +2170 -2041
  48. package/node_modules/@ai-sdk/openai/docs/03-openai.mdx +311 -102
  49. package/node_modules/@ai-sdk/openai/package.json +4 -4
  50. package/node_modules/@ai-sdk/openai-compatible/CHANGELOG.md +110 -0
  51. package/node_modules/@ai-sdk/openai-compatible/dist/index.js +120 -130
  52. package/node_modules/@ai-sdk/openai-compatible/dist/internal/index.js +22 -14
  53. package/node_modules/@ai-sdk/openai-compatible/docs/index.mdx +2 -0
  54. package/node_modules/@ai-sdk/openai-compatible/package.json +4 -4
  55. package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → provider}/CHANGELOG.md +47 -0
  56. package/node_modules/@ai-sdk/{cohere/node_modules/@ai-sdk/provider → provider}/dist/index.js +127 -102
  57. package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → provider}/package.json +1 -1
  58. package/node_modules/@ai-sdk/provider-utils/CHANGELOG.md +99 -0
  59. package/node_modules/@ai-sdk/provider-utils/dist/experimental-evaluation/index.js +1618 -0
  60. package/node_modules/@ai-sdk/provider-utils/dist/index.js +470 -268
  61. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +3 -1
  62. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/Dispatcher.md +1 -0
  63. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/request.js +23 -2
  64. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
  65. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h1.js +23 -8
  66. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h2.js +84 -19
  67. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client.js +6 -2
  68. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js +21 -5
  69. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/retry-handler.js +109 -23
  70. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/cache.js +20 -1
  71. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js +338 -46
  72. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/dump.js +10 -23
  73. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
  74. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/connection.js +19 -9
  75. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  76. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  77. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/package.json +1 -1
  78. package/node_modules/@ai-sdk/provider-utils/package.json +7 -2
  79. package/node_modules/@earendil-works/pi-tui/README.md +8 -2
  80. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +18 -11
  81. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +7 -6
  82. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +23 -22
  83. package/node_modules/@earendil-works/pi-tui/dist/index.js +2 -0
  84. package/node_modules/@earendil-works/pi-tui/dist/latex.js +109 -16
  85. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +3 -44
  86. package/node_modules/@earendil-works/pi-tui/dist/native-platform.js +42 -0
  87. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +2 -20
  88. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +25 -6
  89. package/node_modules/@earendil-works/pi-tui/dist/utils.js +4 -0
  90. package/node_modules/@earendil-works/pi-tui/native/clipboard.h +170 -0
  91. package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +8 -6
  92. package/node_modules/@earendil-works/pi-tui/native/darwin/build.sh +12 -5
  93. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
  94. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/{darwin-modifiers.node → darwin-platform.node} +0 -0
  95. package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-platform.m +93 -0
  96. package/node_modules/@earendil-works/pi-tui/native/linux/README.md +23 -0
  97. package/node_modules/@earendil-works/pi-tui/native/linux/build.sh +65 -0
  98. package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  99. package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  100. package/node_modules/@earendil-works/pi-tui/native/linux/src/clipboard-worker.h +70 -0
  101. package/node_modules/@earendil-works/pi-tui/native/linux/src/linux-platform-x11.c +274 -0
  102. package/node_modules/@earendil-works/pi-tui/native/napi.h +89 -0
  103. package/node_modules/@earendil-works/pi-tui/native/win32/README.md +16 -7
  104. package/node_modules/@earendil-works/pi-tui/native/win32/build.mjs +7 -4
  105. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  106. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  107. package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-platform.c +241 -0
  108. package/node_modules/@earendil-works/pi-tui/package.json +11 -4
  109. package/node_modules/@larksuiteoapi/node-sdk/README.md +20 -0
  110. package/node_modules/@larksuiteoapi/node-sdk/README.zh.md +20 -0
  111. package/node_modules/@larksuiteoapi/node-sdk/es/index.js +33 -1
  112. package/node_modules/@larksuiteoapi/node-sdk/lib/index.js +33 -1
  113. package/node_modules/@larksuiteoapi/node-sdk/package.json +1 -1
  114. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +17 -0
  115. package/node_modules/@maka/acp-executor-plugin/package.json +1 -1
  116. package/node_modules/@maka/core/dist/model-web-search.js +2 -3
  117. package/node_modules/@maka/core/dist/relative-time.js +19 -20
  118. package/node_modules/@maka/eval/harbor/egress_filter.py +64 -47
  119. package/node_modules/@maka/eval/harbor/eval_framework.py +3 -3
  120. package/node_modules/@maka/eval/harbor/run_trial.py +2 -2
  121. package/node_modules/@maka/eval/node_modules/undici/README.md +10 -1
  122. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Agent.md +8 -8
  123. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
  124. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
  125. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Errors.md +25 -0
  126. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Fetch.md +10 -0
  127. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
  128. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Pool.md +5 -6
  129. package/node_modules/@maka/eval/node_modules/undici/docs/docs/index.md +10 -1
  130. package/node_modules/@maka/eval/node_modules/undici/lib/api/readable.js +1 -2
  131. package/node_modules/@maka/eval/node_modules/undici/lib/core/request.js +23 -2
  132. package/node_modules/@maka/eval/node_modules/undici/lib/core/util.js +0 -39
  133. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
  134. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
  135. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +6 -1
  136. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
  137. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
  138. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool.js +90 -7
  139. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
  140. package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
  141. package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +5 -0
  142. package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +72 -13
  143. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/cache.js +4 -1
  144. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/decompress.js +236 -69
  145. package/node_modules/@maka/eval/node_modules/undici/lib/web/cache/cache.js +17 -8
  146. package/node_modules/@maka/eval/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
  147. package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/index.js +19 -7
  148. package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/util.js +3 -1
  149. package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
  150. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/body.js +22 -15
  151. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  152. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/formdata.js +30 -36
  153. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/headers.js +34 -31
  154. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/index.js +46 -25
  155. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/request.js +74 -79
  156. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/response.js +43 -44
  157. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/util.js +7 -7
  158. package/node_modules/@maka/eval/node_modules/undici/lib/web/infra/index.js +16 -1
  159. package/node_modules/@maka/eval/node_modules/undici/lib/web/webidl/index.js +2 -14
  160. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/connection.js +33 -12
  161. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/events.js +43 -26
  162. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/receiver.js +2 -0
  163. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
  164. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
  165. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/websocket.js +44 -41
  166. package/node_modules/@maka/eval/node_modules/undici/package.json +1 -1
  167. package/node_modules/@maka/mcp/package.json +1 -1
  168. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +15 -3
  169. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +33 -3
  170. package/node_modules/@maka/runtime/dist/deepseek-web-search-codec.js +71 -0
  171. package/node_modules/@maka/runtime/dist/history-compaction.js +11 -4
  172. package/node_modules/@maka/runtime/dist/model-adapter.js +9 -5
  173. package/node_modules/@maka/runtime/dist/model-factory.js +4 -0
  174. package/node_modules/@maka/runtime/dist/plugin-agent-service.js +5 -13
  175. package/node_modules/@maka/runtime/dist/plugin-attachment-service.js +5 -13
  176. package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +26 -36
  177. package/node_modules/@maka/runtime/dist/plugin-data-services.js +9 -26
  178. package/node_modules/@maka/runtime/dist/plugin-fs-service.js +5 -13
  179. package/node_modules/@maka/runtime/dist/plugin-goal-service.js +5 -13
  180. package/node_modules/@maka/runtime/dist/plugin-internals.js +78 -0
  181. package/node_modules/@maka/runtime/dist/plugin-llm-service.js +5 -13
  182. package/node_modules/@maka/runtime/dist/plugin-runtime.js +4 -32
  183. package/node_modules/@maka/runtime/dist/plugin-session-query-service.js +5 -13
  184. package/node_modules/@maka/runtime/dist/plugin-shell-service.js +5 -13
  185. package/node_modules/@maka/runtime/dist/plugin-web-service.js +5 -13
  186. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +3 -3
  187. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +161 -104
  188. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +3 -1
  189. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/Dispatcher.md +1 -0
  190. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/request.js +23 -2
  191. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
  192. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h1.js +23 -8
  193. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h2.js +84 -19
  194. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client.js +6 -2
  195. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/cache-handler.js +21 -5
  196. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/retry-handler.js +109 -23
  197. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/cache.js +20 -1
  198. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/decompress.js +338 -46
  199. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/dump.js +10 -23
  200. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
  201. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/connection.js +19 -9
  202. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  203. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  204. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/package.json +1 -1
  205. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +1 -1
  206. package/node_modules/@maka/runtime/node_modules/undici/README.md +10 -1
  207. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Agent.md +8 -8
  208. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
  209. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
  210. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Errors.md +25 -0
  211. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Fetch.md +10 -0
  212. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
  213. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Pool.md +5 -6
  214. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/index.md +10 -1
  215. package/node_modules/@maka/runtime/node_modules/undici/lib/api/readable.js +1 -2
  216. package/node_modules/@maka/runtime/node_modules/undici/lib/core/request.js +23 -2
  217. package/node_modules/@maka/runtime/node_modules/undici/lib/core/util.js +0 -39
  218. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
  219. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
  220. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +6 -1
  221. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
  222. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
  223. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool.js +90 -7
  224. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
  225. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
  226. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +5 -0
  227. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +72 -13
  228. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/cache.js +4 -1
  229. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/decompress.js +236 -69
  230. package/node_modules/@maka/runtime/node_modules/undici/lib/web/cache/cache.js +17 -8
  231. package/node_modules/@maka/runtime/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
  232. package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/index.js +19 -7
  233. package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/util.js +3 -1
  234. package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
  235. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/body.js +22 -15
  236. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  237. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/formdata.js +30 -36
  238. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/headers.js +34 -31
  239. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/index.js +46 -25
  240. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/request.js +74 -79
  241. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/response.js +43 -44
  242. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/util.js +7 -7
  243. package/node_modules/@maka/runtime/node_modules/undici/lib/web/infra/index.js +16 -1
  244. package/node_modules/@maka/runtime/node_modules/undici/lib/web/webidl/index.js +2 -14
  245. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/connection.js +33 -12
  246. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/events.js +43 -26
  247. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/receiver.js +2 -0
  248. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
  249. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
  250. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/websocket.js +44 -41
  251. package/node_modules/@maka/runtime/node_modules/undici/package.json +1 -1
  252. package/node_modules/@maka/runtime/package.json +11 -11
  253. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +3 -7
  254. package/node_modules/@maka/runtime-host/dist/candidate-cli.js +7 -7
  255. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +20 -8
  256. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +107 -63
  257. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -3
  258. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +51 -16
  259. package/node_modules/@maka/runtime-host/package.json +2 -2
  260. package/node_modules/@maka/storage/dist/project-catalog.js +13 -20
  261. package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +1 -0
  262. package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +1 -0
  263. package/node_modules/@modelcontextprotocol/client/dist/index.cjs +375 -60
  264. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
  265. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
  266. package/node_modules/@modelcontextprotocol/client/dist/index.mjs +369 -61
  267. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
  268. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
  269. package/node_modules/@modelcontextprotocol/client/dist/{src-NAgB4Mp8.cjs → src-D0qEN74R.cjs} +111 -38
  270. package/node_modules/@modelcontextprotocol/client/dist/{src-D_zzAWoS.mjs → src-DDAAhLnO.mjs} +106 -33
  271. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +8 -2
  272. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +1 -1
  273. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +1 -1
  274. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +8 -2
  275. package/node_modules/@modelcontextprotocol/{core/dist/auth-hYtaIUZm.d.cts.map → client/node_modules/@modelcontextprotocol/core/dist/auth--n_Yzytt.d.cts.map} +1 -1
  276. package/node_modules/@modelcontextprotocol/{core/dist/auth-CfDMXiII.cjs → client/node_modules/@modelcontextprotocol/core/dist/auth-4-zilcqg.cjs} +3 -2
  277. package/node_modules/@modelcontextprotocol/{core/dist/auth-CUe6YdwF.mjs → client/node_modules/@modelcontextprotocol/core/dist/auth-CGP0BDVq.mjs} +3 -2
  278. package/node_modules/@modelcontextprotocol/{core/dist/auth-BWdKR39I.d.mts.map → client/node_modules/@modelcontextprotocol/core/dist/auth-YUQV3RRv.d.mts.map} +1 -1
  279. package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/index.cjs +1 -1
  280. package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/index.mjs +1 -1
  281. package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.cjs +1 -1
  282. package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.mjs +1 -1
  283. package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/package.json +1 -1
  284. package/node_modules/@modelcontextprotocol/client/package.json +4 -4
  285. package/node_modules/@types/node/README.md +2 -2
  286. package/node_modules/@types/node/package.json +2 -17
  287. package/node_modules/{@maka/runtime/node_modules/ai → ai}/CHANGELOG.md +311 -0
  288. package/node_modules/{@maka/runtime/node_modules/ai → ai}/README.md +6 -6
  289. package/node_modules/{@maka/runtime/node_modules/ai → ai}/dist/index.js +4830 -1974
  290. package/node_modules/{@maka/runtime/node_modules/ai → ai}/dist/internal/index.js +694 -332
  291. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/00-introduction/index.mdx +1 -1
  292. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/02-providers-and-models.mdx +5 -0
  293. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/03-prompts.mdx +1 -1
  294. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/04-tools.mdx +2 -2
  295. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/06-provider-options.mdx +11 -11
  296. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/00-choosing-a-provider.mdx +4 -4
  297. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/02-nextjs-app-router.mdx +3 -3
  298. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/03-nextjs-pages-router.mdx +4 -4
  299. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/04-svelte.mdx +7 -7
  300. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/05-nuxt.mdx +8 -8
  301. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/06-nodejs.mdx +3 -3
  302. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/07-expo.mdx +10 -3
  303. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/08-tanstack-start.mdx +3 -3
  304. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/09-coding-agents.mdx +1 -1
  305. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/02-building-agents.mdx +2 -2
  306. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/03-workflows.mdx +2 -2
  307. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/04-loop-control.mdx +1 -1
  308. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/05-configuring-call-options.mdx +4 -2
  309. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-memory.mdx +2 -2
  310. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-policy-tool-approvals.mdx +2 -2
  311. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-tool-approvals.mdx +16 -0
  312. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/07-workflow-agent.mdx +12 -12
  313. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/08-terminal-ui.mdx +14 -10
  314. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/05-generating-text.mdx +2 -2
  315. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +6 -1
  316. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/16-mcp-tools.mdx +31 -0
  317. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/17-mcp-apps.mdx +2 -2
  318. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/18-code-mode.mdx +50 -0
  319. package/node_modules/ai/docs/03-ai-sdk-core/19-tool-search.mdx +82 -0
  320. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
  321. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/26-reasoning.mdx +15 -14
  322. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/31-reranking.mdx +12 -10
  323. package/node_modules/ai/docs/03-ai-sdk-core/32-evaluation.mdx +287 -0
  324. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/35-image-generation.mdx +40 -2
  325. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/36-realtime.mdx +41 -18
  326. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/36-transcription.mdx +1 -0
  327. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/37-speech.mdx +8 -6
  328. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/39-file-uploads.mdx +1 -1
  329. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/40-middleware.mdx +92 -7
  330. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/41-skill-uploads.mdx +1 -1
  331. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/42-batch.mdx +2 -3
  332. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/45-provider-management.mdx +31 -21
  333. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/55-testing.mdx +75 -0
  334. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/60-telemetry.mdx +57 -4
  335. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/65-devtools.mdx +3 -3
  336. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +132 -7
  337. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/index.mdx +6 -0
  338. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/01-overview.mdx +3 -2
  339. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +151 -112
  340. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/03-tools.mdx +47 -22
  341. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/04-skills.mdx +0 -4
  342. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +3 -3
  343. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +43 -9
  344. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/07-ui.mdx +33 -30
  345. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/08-terminal-ui.mdx +8 -6
  346. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/01-overview.mdx +1 -1
  347. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/02-chatbot.mdx +47 -21
  348. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +46 -3
  349. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +11 -4
  350. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +10 -1
  351. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/05-completion.mdx +1 -1
  352. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/08-object-generation.mdx +4 -1
  353. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/21-error-handling.mdx +28 -2
  354. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/21-transport.mdx +1 -1
  355. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/02-streaming-react-components.mdx +5 -5
  356. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/04-multistep-interfaces.mdx +2 -2
  357. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/06-loading-state.mdx +1 -1
  358. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +3 -3
  359. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/02-stopping-streams.mdx +8 -0
  360. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/04-caching.mdx +2 -1
  361. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/11-secure-url-fetching.mdx +47 -2
  362. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +13 -4
  363. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +16 -7
  364. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +5 -5
  365. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +1 -1
  366. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +3 -3
  367. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/14-evaluate.mdx +74 -0
  368. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +4 -2
  369. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +1 -1
  370. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/20-tool.mdx +7 -0
  371. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +7 -0
  372. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/23-tool-search.mdx +76 -0
  373. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/32-validate-ui-messages.mdx +30 -0
  374. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/33-safe-validate-ui-messages.mdx +12 -0
  375. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +19 -1
  376. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +22 -4
  377. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +1 -1
  378. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +17 -2
  379. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/index.mdx +6 -0
  380. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +1 -1
  381. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/03-use-object.mdx +4 -1
  382. package/node_modules/ai/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +563 -0
  383. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-messages.mdx +12 -0
  384. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +9 -3
  385. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/50-direct-chat-transport.mdx +3 -3
  386. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +2 -1
  387. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/02-create-ai.mdx +1 -1
  388. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/03-create-streamable-ui.mdx +1 -1
  389. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +8 -8
  390. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/02-workflow-chat-transport.mdx +4 -4
  391. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-api-call-error.mdx +4 -0
  392. package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-evaluation-unsupported-question-type-error.mdx +31 -0
  393. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-model-error.mdx +4 -0
  394. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-error.mdx +4 -0
  395. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-ui-message-stream-error.mdx +6 -2
  396. package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/index.mdx +138 -0
  397. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +13 -9
  398. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/29-migration-guide-4-0.mdx +5 -5
  399. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/37-migration-guide-3-3.mdx +1 -1
  400. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/11-use-chat-custom-request-options.mdx +3 -3
  401. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +2 -2
  402. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/17-use-chat-stale-body-data.mdx +1 -1
  403. package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +2 -2
  404. package/node_modules/{@maka/runtime/node_modules/ai → ai}/package.json +13 -13
  405. package/node_modules/image-dimensions/cli.js +18 -3
  406. package/node_modules/image-dimensions/index.js +7 -5
  407. package/node_modules/image-dimensions/package.json +4 -1
  408. package/node_modules/image-dimensions/readme.md +2 -1
  409. package/node_modules/image-dimensions/types/avif.js +2 -24
  410. package/node_modules/image-dimensions/types/heic.js +2 -24
  411. package/node_modules/image-dimensions/types/jpeg.js +28 -7
  412. package/node_modules/image-dimensions/types/png.js +13 -2
  413. package/node_modules/image-dimensions/types/webp.js +20 -36
  414. package/node_modules/image-dimensions/utilities.js +184 -60
  415. package/node_modules/ip-address/README.md +145 -135
  416. package/node_modules/ip-address/dist/common.js +48 -0
  417. package/node_modules/ip-address/dist/ipv4.js +117 -11
  418. package/node_modules/ip-address/dist/ipv6.js +162 -48
  419. package/node_modules/ip-address/dist/v4/constants.js +40 -1
  420. package/node_modules/ip-address/dist/v6/constants.js +47 -1
  421. package/node_modules/ip-address/package.json +1 -1
  422. package/node_modules/marked/README.md +1 -0
  423. package/node_modules/marked/lib/marked.esm.js +30 -29
  424. package/node_modules/marked/lib/marked.umd.js +30 -29
  425. package/node_modules/marked/man/marked.1 +1 -1
  426. package/node_modules/marked/package.json +11 -11
  427. package/node_modules/systeminformation/lib/battery.js +32 -11
  428. package/node_modules/systeminformation/lib/cpu.js +23 -23
  429. package/node_modules/systeminformation/lib/filesystem.js +14 -8
  430. package/node_modules/systeminformation/lib/memory.js +3 -5
  431. package/node_modules/systeminformation/lib/network.js +8 -2
  432. package/node_modules/systeminformation/lib/osinfo.js +17 -3
  433. package/node_modules/systeminformation/lib/util.js +7 -0
  434. package/node_modules/systeminformation/package.json +1 -1
  435. package/node_modules/undici/README.md +10 -1
  436. package/node_modules/undici/docs/docs/api/Agent.md +8 -8
  437. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
  438. package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
  439. package/node_modules/undici/docs/docs/api/Errors.md +25 -0
  440. package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
  441. package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
  442. package/node_modules/undici/docs/docs/api/Pool.md +5 -6
  443. package/node_modules/undici/docs/docs/index.md +10 -1
  444. package/node_modules/undici/lib/api/readable.js +1 -2
  445. package/node_modules/undici/lib/core/request.js +23 -2
  446. package/node_modules/undici/lib/core/util.js +0 -39
  447. package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
  448. package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
  449. package/node_modules/undici/lib/dispatcher/client.js +6 -1
  450. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
  451. package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
  452. package/node_modules/undici/lib/dispatcher/pool.js +90 -7
  453. package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
  454. package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
  455. package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
  456. package/node_modules/undici/lib/handler/retry-handler.js +72 -13
  457. package/node_modules/undici/lib/interceptor/cache.js +4 -1
  458. package/node_modules/undici/lib/interceptor/decompress.js +236 -69
  459. package/node_modules/undici/lib/web/cache/cache.js +17 -8
  460. package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
  461. package/node_modules/undici/lib/web/cookies/index.js +19 -7
  462. package/node_modules/undici/lib/web/cookies/util.js +3 -1
  463. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
  464. package/node_modules/undici/lib/web/fetch/body.js +22 -15
  465. package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  466. package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
  467. package/node_modules/undici/lib/web/fetch/headers.js +34 -31
  468. package/node_modules/undici/lib/web/fetch/index.js +46 -25
  469. package/node_modules/undici/lib/web/fetch/request.js +74 -79
  470. package/node_modules/undici/lib/web/fetch/response.js +43 -44
  471. package/node_modules/undici/lib/web/fetch/util.js +7 -7
  472. package/node_modules/undici/lib/web/infra/index.js +16 -1
  473. package/node_modules/undici/lib/web/webidl/index.js +2 -14
  474. package/node_modules/undici/lib/web/websocket/connection.js +33 -12
  475. package/node_modules/undici/lib/web/websocket/events.js +43 -26
  476. package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
  477. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
  478. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
  479. package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
  480. package/node_modules/undici/package.json +1 -1
  481. package/package.json +4 -4
  482. package/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  483. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  484. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/README.md +0 -1
  485. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/package.json +0 -63
  486. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  487. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/README.md +0 -1
  488. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  489. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/package.json +0 -63
  490. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  491. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/README.md +0 -1
  492. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  493. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/package.json +0 -63
  494. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  495. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/LICENSE +0 -13
  496. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/README.md +0 -1
  497. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  498. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/package.json +0 -63
  499. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  500. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/LICENSE +0 -13
  501. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/README.md +0 -1
  502. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  503. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/package.json +0 -63
  504. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  505. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/LICENSE +0 -13
  506. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/README.md +0 -1
  507. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  508. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +0 -63
  509. package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-modifiers.c +0 -70
  510. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  511. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  512. package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-console-mode.c +0 -119
  513. package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/LICENSE +0 -13
  514. package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/dist/code-mode-tool.js +0 -40
  515. package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/LICENSE +0 -13
  516. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
  517. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/LICENSE +0 -13
  518. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/README.md +0 -1
  519. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/dist/index.js +0 -426
  520. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/package.json +0 -63
  521. package/node_modules/@maka/runtime/node_modules/ai/LICENSE +0 -13
  522. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +0 -247
  523. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/index.mdx +0 -43
  524. package/node_modules/@modelcontextprotocol/client/dist/index-CHhhk6PQ.d.cts.map +0 -1
  525. package/node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts.map +0 -1
  526. /package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → code-mode}/LICENSE +0 -0
  527. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/README.md +0 -0
  528. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/approval.js +0 -0
  529. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/continuation-capability.js +0 -0
  530. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/direct-tool-call.js +0 -0
  531. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/host-interrupt.js +0 -0
  532. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/index.js +0 -0
  533. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/run-code-mode.js +0 -0
  534. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/tool-invocation.js +0 -0
  535. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/types.js +0 -0
  536. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/utils/serialization.js +0 -0
  537. /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/src/tsconfig.json +0 -0
  538. /package/node_modules/@ai-sdk/{cohere/node_modules/@ai-sdk/provider → gateway}/LICENSE +0 -0
  539. /package/node_modules/@ai-sdk/{google/node_modules/@ai-sdk/provider → provider}/LICENSE +0 -0
  540. /package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → provider}/README.md +0 -0
  541. /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/LICENSE +0 -0
  542. /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/README.md +0 -0
  543. /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.d.cts.map +0 -0
  544. /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.d.mts.map +0 -0
  545. /package/node_modules/{@ai-sdk/open-responses/node_modules/@ai-sdk/provider → ai}/LICENSE +0 -0
  546. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/01-overview.mdx +0 -0
  547. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/05-streaming.mdx +0 -0
  548. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/index.mdx +0 -0
  549. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/01-navigating-the-library.mdx +0 -0
  550. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/index.mdx +0 -0
  551. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/01-overview.mdx +0 -0
  552. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-subagents.mdx +0 -0
  553. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/index.mdx +0 -0
  554. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/01-overview.mdx +0 -0
  555. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/10-generating-structured-data.mdx +0 -0
  556. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +0 -0
  557. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/25-settings.mdx +0 -0
  558. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/30-embeddings.mdx +0 -0
  559. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/36-translation.mdx +0 -0
  560. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/38-video-generation.mdx +0 -0
  561. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/50-error-handling.mdx +0 -0
  562. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/index.mdx +0 -0
  563. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/04-generative-user-interfaces.mdx +0 -0
  564. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/20-streaming-data.mdx +0 -0
  565. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/24-reading-ui-message-streams.mdx +0 -0
  566. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/25-message-metadata.mdx +0 -0
  567. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/50-stream-protocol.mdx +0 -0
  568. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/index.mdx +0 -0
  569. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/01-overview.mdx +0 -0
  570. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/03-generative-ui-state.mdx +0 -0
  571. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/03-saving-and-restoring-states.mdx +0 -0
  572. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/05-streaming-values.mdx +0 -0
  573. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/08-error-handling.mdx +0 -0
  574. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/09-authentication.mdx +0 -0
  575. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/index.mdx +0 -0
  576. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/01-prompt-engineering.mdx +0 -0
  577. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/03-backpressure.mdx +0 -0
  578. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/05-multiple-streamables.mdx +0 -0
  579. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/06-rate-limiting.mdx +0 -0
  580. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/07-rendering-ui-with-language-models.mdx +0 -0
  581. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/08-model-as-router.mdx +0 -0
  582. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/09-multistep-interfaces.mdx +0 -0
  583. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/09-sequential-generations.mdx +0 -0
  584. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/10-vercel-deployment-guide.mdx +0 -0
  585. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/index.mdx +0 -0
  586. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/05-embed.mdx +0 -0
  587. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/06-embed-many.mdx +0 -0
  588. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/10-generate-image.mdx +0 -0
  589. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/11-stream-transcribe.mdx +0 -0
  590. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/11-stream-translate.mdx +0 -0
  591. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +0 -0
  592. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/14-upload-file.mdx +0 -0
  593. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/14-upload-skill.mdx +0 -0
  594. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/15-agent.mdx +0 -0
  595. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/17-create-agent-ui-stream.mdx +0 -0
  596. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/18-create-agent-ui-stream-response.mdx +0 -0
  597. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/18-pipe-agent-ui-stream-to-response.mdx +0 -0
  598. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/21-get-batch-status.mdx +0 -0
  599. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/22-get-batch-results.mdx +0 -0
  600. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/23-cancel-batch.mdx +0 -0
  601. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +0 -0
  602. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/23-get-realtime-tool-definitions.mdx +0 -0
  603. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/24-list-batches.mdx +0 -0
  604. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/24-mcp-apps.mdx +0 -0
  605. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/24-mcp-stdio-transport.mdx +0 -0
  606. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/25-json-schema.mdx +0 -0
  607. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/26-zod-schema.mdx +0 -0
  608. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/27-valibot-schema.mdx +0 -0
  609. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/28-output.mdx +0 -0
  610. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/29-filter-active-tools.mdx +0 -0
  611. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/30-model-message.mdx +0 -0
  612. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/31-ui-message.mdx +0 -0
  613. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/34-sandbox.mdx +0 -0
  614. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/50-cosine-similarity.mdx +0 -0
  615. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/65-language-model-v2-middleware.mdx +0 -0
  616. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/66-extract-reasoning-middleware.mdx +0 -0
  617. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/67-simulate-streaming-middleware.mdx +0 -0
  618. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/68-default-instructions-middleware.mdx +0 -0
  619. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/68-default-settings-middleware.mdx +0 -0
  620. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/69-add-tool-input-examples-middleware.mdx +0 -0
  621. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/70-extract-json-middleware.mdx +0 -0
  622. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/70-is-step-count.mdx +0 -0
  623. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/71-has-tool-call.mdx +0 -0
  624. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/72-loop-finished.mdx +0 -0
  625. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/75-simulate-readable-stream.mdx +0 -0
  626. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/80-smooth-stream.mdx +0 -0
  627. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/90-generate-id.mdx +0 -0
  628. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/91-create-id-generator.mdx +0 -0
  629. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/92-default-generated-file.mdx +0 -0
  630. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/02-use-completion.mdx +0 -0
  631. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/32-prune-messages.mdx +0 -0
  632. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/41-create-ui-message-stream-response.mdx +0 -0
  633. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/42-pipe-ui-message-stream-to-response.mdx +0 -0
  634. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/43-read-ui-message-stream.mdx +0 -0
  635. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/46-infer-ui-tools.mdx +0 -0
  636. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/47-infer-ui-tool.mdx +0 -0
  637. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/48-mcp-app-renderer.mdx +0 -0
  638. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/index.mdx +0 -0
  639. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/04-create-streamable-value.mdx +0 -0
  640. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/05-read-streamable-value.mdx +0 -0
  641. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/06-get-ai-state.mdx +0 -0
  642. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/07-get-mutable-ai-state.mdx +0 -0
  643. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/08-use-ai-state.mdx +0 -0
  644. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/09-use-actions.mdx +0 -0
  645. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/10-use-ui-state.mdx +0 -0
  646. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/11-use-streamable-value.mdx +0 -0
  647. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/20-render.mdx +0 -0
  648. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/index.mdx +0 -0
  649. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/03-generate-video.mdx +0 -0
  650. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/index.mdx +0 -0
  651. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-download-error.mdx +0 -0
  652. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-empty-response-body-error.mdx +0 -0
  653. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-argument-error.mdx +0 -0
  654. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-data-content-error.mdx +0 -0
  655. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-message-role-error.mdx +0 -0
  656. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-prompt-error.mdx +0 -0
  657. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-response-data-error.mdx +0 -0
  658. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-approval-error.mdx +0 -0
  659. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-approval-signature-error.mdx +0 -0
  660. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-input-error.mdx +0 -0
  661. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-json-parse-error.mdx +0 -0
  662. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-load-api-key-error.mdx +0 -0
  663. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-load-setting-error.mdx +0 -0
  664. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-message-conversion-error.mdx +0 -0
  665. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-content-generated-error.mdx +0 -0
  666. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-image-generated-error.mdx +0 -0
  667. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-object-generated-error.mdx +0 -0
  668. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-output-generated-error.mdx +0 -0
  669. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-speech-generated-error.mdx +0 -0
  670. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-reference-error.mdx +0 -0
  671. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-tool-error.mdx +0 -0
  672. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-transcript-generated-error.mdx +0 -0
  673. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-translation-generated-error.mdx +0 -0
  674. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-video-generated-error.mdx +0 -0
  675. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-retry-error.mdx +0 -0
  676. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-stream-provider-error.mdx +0 -0
  677. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-too-many-embedding-values-for-call-error.mdx +0 -0
  678. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-call-not-found-for-approval-error.mdx +0 -0
  679. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-call-repair-error.mdx +0 -0
  680. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-choice-violation-error.mdx +0 -0
  681. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-type-validation-error.mdx +0 -0
  682. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-unsupported-functionality-error.mdx +0 -0
  683. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/06-ai-sdk-tui/index.mdx +0 -0
  684. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/index.mdx +0 -0
  685. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/00-versioning.mdx +0 -0
  686. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/23-migration-guide-7-0.mdx +0 -0
  687. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/24-migration-guide-6-0.mdx +0 -0
  688. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/25-migration-guide-5-0-data.mdx +0 -0
  689. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/26-migration-guide-5-0.mdx +0 -0
  690. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/27-migration-guide-4-2.mdx +0 -0
  691. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/28-migration-guide-4-1.mdx +0 -0
  692. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/36-migration-guide-3-4.mdx +0 -0
  693. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/38-migration-guide-3-2.mdx +0 -0
  694. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/39-migration-guide-3-1.mdx +0 -0
  695. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/index.mdx +0 -0
  696. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/01-azure-stream-slow.mdx +0 -0
  697. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/03-server-actions-in-client-components.mdx +0 -0
  698. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/04-strange-stream-output.mdx +0 -0
  699. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/05-streamable-ui-errors.mdx +0 -0
  700. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/05-tool-invocation-missing-result.mdx +0 -0
  701. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/06-streaming-not-working-when-deployed.mdx +0 -0
  702. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/06-streaming-not-working-when-proxied.mdx +0 -0
  703. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/06-timeout-on-vercel.mdx +0 -0
  704. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/07-unclosed-streams.mdx +0 -0
  705. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/08-use-chat-failed-to-parse-stream.mdx +0 -0
  706. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/09-client-stream-error.mdx +0 -0
  707. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/10-use-chat-tools-no-response.mdx +0 -0
  708. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/12-typescript-performance-zod.mdx +0 -0
  709. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/12-use-chat-an-error-occurred.mdx +0 -0
  710. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/14-stream-abort-handling.mdx +0 -0
  711. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/14-tool-calling-with-structured-outputs.mdx +0 -0
  712. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/15-abort-breaks-resumable-streams.mdx +0 -0
  713. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/15-stream-text-not-working.mdx +0 -0
  714. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/16-streaming-status-delay.mdx +0 -0
  715. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/18-ontoolcall-type-narrowing.mdx +0 -0
  716. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/19-unsupported-model-version.mdx +0 -0
  717. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/20-no-object-generated-content-filter.mdx +0 -0
  718. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/21-missing-tool-results-error.mdx +0 -0
  719. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/30-model-is-not-assignable-to-type.mdx +0 -0
  720. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/40-typescript-cannot-find-namespace-jsx.mdx +0 -0
  721. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/50-react-maximum-update-depth-exceeded.mdx +0 -0
  722. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/60-jest-cannot-find-module-ai-rsc.mdx +0 -0
  723. /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/index.mdx +0 -0
@@ -8,7 +8,7 @@ function combineHeaders(...headers) {
8
8
  return headers.reduce(
9
9
  (combinedHeaders, currentHeaders) => ({
10
10
  ...combinedHeaders,
11
- ...currentHeaders != null ? currentHeaders : {}
11
+ ...currentHeaders
12
12
  }),
13
13
  {}
14
14
  );
@@ -24,11 +24,11 @@ function removeUndefinedEntries(record) {
24
24
  // src/delay.ts
25
25
  async function delay(delayInMs, options) {
26
26
  if (delayInMs == null) {
27
- return Promise.resolve();
27
+ return;
28
28
  }
29
- const signal = options == null ? void 0 : options.abortSignal;
29
+ const signal = options?.abortSignal;
30
30
  return new Promise((resolve2, reject) => {
31
- if (signal == null ? void 0 : signal.aborted) {
31
+ if (signal?.aborted) {
32
32
  reject(createAbortError());
33
33
  return;
34
34
  }
@@ -38,13 +38,13 @@ async function delay(delayInMs, options) {
38
38
  }, delayInMs);
39
39
  const cleanup = () => {
40
40
  clearTimeout(timeoutId);
41
- signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
41
+ signal?.removeEventListener("abort", onAbort);
42
42
  };
43
43
  const onAbort = () => {
44
44
  cleanup();
45
45
  reject(createAbortError());
46
46
  };
47
- signal == null ? void 0 : signal.addEventListener("abort", onAbort);
47
+ signal?.addEventListener("abort", onAbort);
48
48
  });
49
49
  }
50
50
  function createAbortError() {
@@ -53,7 +53,7 @@ function createAbortError() {
53
53
 
54
54
  // src/websocket.ts
55
55
  function getWebSocketConstructor(webSocket) {
56
- const WebSocketConstructor = webSocket != null ? webSocket : globalThis.WebSocket;
56
+ const WebSocketConstructor = webSocket ?? globalThis.WebSocket;
57
57
  if (WebSocketConstructor == null) {
58
58
  throw new Error("No WebSocket implementation available.");
59
59
  }
@@ -86,9 +86,8 @@ async function waitForWebSocketBufferDrain(socket, {
86
86
  pollIntervalMs = 20,
87
87
  abortSignal
88
88
  } = {}) {
89
- var _a3;
90
- while (socket.readyState === WEBSOCKET_OPEN_STATE && ((_a3 = socket.bufferedAmount) != null ? _a3 : 0) > highWaterMark) {
91
- if ((abortSignal == null ? void 0 : abortSignal.aborted) === true) {
89
+ while (socket.readyState === WEBSOCKET_OPEN_STATE && (socket.bufferedAmount ?? 0) > highWaterMark) {
90
+ if (abortSignal?.aborted === true) {
92
91
  return;
93
92
  }
94
93
  await delay(pollIntervalMs);
@@ -109,43 +108,39 @@ function connectToWebSocket({
109
108
  onClose,
110
109
  onAbort
111
110
  }) {
112
- var _a3;
113
111
  let socket;
114
112
  let abortListener;
115
113
  const close = (code) => {
116
114
  if (abortListener != null) {
117
- abortSignal == null ? void 0 : abortSignal.removeEventListener("abort", abortListener);
115
+ abortSignal?.removeEventListener("abort", abortListener);
118
116
  abortListener = void 0;
119
117
  }
120
118
  try {
121
- socket == null ? void 0 : socket.close(code);
122
- } catch (e) {
119
+ socket?.close(code);
120
+ } catch {
123
121
  }
124
122
  };
125
- if (abortSignal == null ? void 0 : abortSignal.aborted) {
126
- onAbort == null ? void 0 : onAbort((_a3 = abortSignal.reason) != null ? _a3 : new Error("Aborted"));
123
+ if (abortSignal?.aborted) {
124
+ onAbort?.(abortSignal.reason ?? new Error("Aborted"));
127
125
  return { socket: void 0, close };
128
126
  }
129
127
  try {
130
128
  const WebSocketConstructor = getWebSocketConstructor(webSocket);
131
129
  socket = new WebSocketConstructor(url, protocols, {
132
- headers: removeUndefinedEntries(headers != null ? headers : {})
130
+ headers: removeUndefinedEntries(headers ?? {})
133
131
  });
134
132
  } catch (error) {
135
133
  onProcessingError(error);
136
134
  return { socket: void 0, close };
137
135
  }
138
136
  if (abortSignal != null && onAbort != null) {
139
- abortListener = () => {
140
- var _a4;
141
- return onAbort((_a4 = abortSignal.reason) != null ? _a4 : new Error("Aborted"));
142
- };
137
+ abortListener = () => onAbort(abortSignal.reason ?? new Error("Aborted"));
143
138
  abortSignal.addEventListener("abort", abortListener, { once: true });
144
139
  }
145
140
  const openedSocket = socket;
146
141
  socket.onopen = () => {
147
142
  try {
148
- onOpen == null ? void 0 : onOpen(openedSocket);
143
+ onOpen?.(openedSocket);
149
144
  } catch (error) {
150
145
  onProcessingError(error);
151
146
  }
@@ -155,13 +150,13 @@ function connectToWebSocket({
155
150
  tail = tail.then(() => readWebSocketMessageText(event.data)).then((text) => onMessageText(text)).catch(onProcessingError);
156
151
  };
157
152
  socket.onerror = () => {
158
- tail = tail.then(() => onSocketError == null ? void 0 : onSocketError()).catch(onProcessingError);
153
+ tail = tail.then(() => onSocketError?.()).catch(onProcessingError);
159
154
  };
160
155
  socket.onclose = (event) => {
161
156
  const closeEvent = event;
162
- const code = typeof (closeEvent == null ? void 0 : closeEvent.code) === "number" ? closeEvent.code : void 0;
163
- const reason = typeof (closeEvent == null ? void 0 : closeEvent.reason) === "string" ? closeEvent.reason : void 0;
164
- tail = tail.then(() => onClose == null ? void 0 : onClose({ code, reason })).catch(onProcessingError);
157
+ const code = typeof closeEvent?.code === "number" ? closeEvent.code : void 0;
158
+ const reason = typeof closeEvent?.reason === "string" ? closeEvent.reason : void 0;
159
+ tail = tail.then(() => onClose?.({ code, reason })).catch(onProcessingError);
165
160
  };
166
161
  return { socket, close };
167
162
  }
@@ -197,7 +192,7 @@ function convertAsyncIteratorToReadableStream(iterator) {
197
192
  if (iterator.return) {
198
193
  try {
199
194
  await iterator.return(reason);
200
- } catch (e) {
195
+ } catch {
201
196
  }
202
197
  }
203
198
  }
@@ -285,8 +280,8 @@ function createLanguageModelResponseMetadata({
285
280
  created
286
281
  }) {
287
282
  return {
288
- id: id != null ? id : void 0,
289
- modelId: model != null ? model : void 0,
283
+ id: id ?? void 0,
284
+ modelId: model ?? void 0,
290
285
  timestamp: created != null ? new Date(created * 1e3) : void 0
291
286
  };
292
287
  }
@@ -324,14 +319,8 @@ function createToolNameMapping({
324
319
  }
325
320
  }
326
321
  return {
327
- toProviderToolName: (customToolName) => {
328
- var _a3;
329
- return (_a3 = customToolNameToProviderToolName[customToolName]) != null ? _a3 : customToolName;
330
- },
331
- toCustomToolName: (providerToolName) => {
332
- var _a3;
333
- return (_a3 = providerToolNameToCustomToolName[providerToolName]) != null ? _a3 : providerToolName;
334
- }
322
+ toProviderToolName: (customToolName) => customToolNameToProviderToolName[customToolName] ?? customToolName,
323
+ toCustomToolName: (providerToolName) => providerToolNameToCustomToolName[providerToolName] ?? providerToolName
335
324
  };
336
325
  }
337
326
 
@@ -383,17 +372,15 @@ var DelayedPromise = class {
383
372
  return this._promise;
384
373
  }
385
374
  resolve(value) {
386
- var _a3;
387
375
  this.status = { type: "resolved", value };
388
376
  if (this._promise) {
389
- (_a3 = this._resolve) == null ? void 0 : _a3.call(this, value);
377
+ this._resolve?.(value);
390
378
  }
391
379
  }
392
380
  reject(error) {
393
- var _a3;
394
381
  this.status = { type: "rejected", error };
395
382
  if (this._promise) {
396
- (_a3 = this._reject) == null ? void 0 : _a3.call(this, error);
383
+ this._reject?.(error);
397
384
  }
398
385
  }
399
386
  isResolved() {
@@ -417,20 +404,16 @@ function extractResponseHeaders(response) {
417
404
 
418
405
  // src/get-runtime-environment-user-agent.ts
419
406
  function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
420
- var _a3, _b3, _c;
421
- if (globalThisAny.window) {
422
- return `runtime/browser`;
423
- }
424
- if ((_a3 = globalThisAny.navigator) == null ? void 0 : _a3.userAgent) {
425
- return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
407
+ if (globalThisAny.navigator?.userAgent) {
408
+ return globalThisAny.navigator.userAgent.toLowerCase();
426
409
  }
427
- if ((_c = (_b3 = globalThisAny.process) == null ? void 0 : _b3.versions) == null ? void 0 : _c.node) {
428
- return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
410
+ if (globalThisAny.process?.versions?.node) {
411
+ return `node.js/${globalThisAny.process.version}`;
429
412
  }
430
413
  if (globalThisAny.EdgeRuntime) {
431
- return `runtime/vercel-edge`;
414
+ return "vercel-edge";
432
415
  }
433
- return "runtime/unknown";
416
+ return "";
434
417
  }
435
418
 
436
419
  // src/handle-fetch-error.ts
@@ -438,7 +421,7 @@ import { APICallError } from "@ai-sdk/provider";
438
421
 
439
422
  // src/is-abort-error.ts
440
423
  function isAbortError(error) {
441
- return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
424
+ return (error instanceof Error || typeof DOMException === "function" && error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
442
425
  error.name === "TimeoutError");
443
426
  }
444
427
 
@@ -468,7 +451,6 @@ function findNetworkError(error) {
468
451
  }
469
452
  current = current.cause;
470
453
  }
471
- return void 0;
472
454
  }
473
455
  function handleFetchError({
474
456
  error,
@@ -518,7 +500,7 @@ function handleFetchError({
518
500
  }
519
501
 
520
502
  // src/version.ts
521
- var VERSION = true ? "5.0.40" : "0.0.0-test";
503
+ var VERSION = true ? "5.0.51" : "0.0.0-test";
522
504
 
523
505
  // src/normalize-headers.ts
524
506
  function normalizeHeaders(headers) {
@@ -569,7 +551,7 @@ var deleteFromApi = async ({
569
551
  method: "DELETE",
570
552
  headers: withUserAgentSuffix(
571
553
  headers,
572
- `ai-sdk/provider-utils/${VERSION}`,
554
+ `ai-sdk-provider-utils/${VERSION}`,
573
555
  getRuntimeEnvironmentUserAgent()
574
556
  ),
575
557
  signal: abortSignal
@@ -684,7 +666,8 @@ var imageMediaTypeSignatures = [
684
666
  0,
685
667
  0,
686
668
  0,
687
- 32,
669
+ null,
670
+ // box size (variable)
688
671
  102,
689
672
  116,
690
673
  121,
@@ -701,7 +684,8 @@ var imageMediaTypeSignatures = [
701
684
  0,
702
685
  0,
703
686
  0,
704
- 32,
687
+ null,
688
+ // box size (variable)
705
689
  102,
706
690
  116,
707
691
  121,
@@ -721,6 +705,26 @@ var documentMediaTypeSignatures = [
721
705
  }
722
706
  ];
723
707
  var audioMediaTypeSignaturesWithoutMp4 = [
708
+ {
709
+ mediaType: "audio/aac",
710
+ bytesPrefix: [255, 240]
711
+ // MPEG-4 ADTS with CRC
712
+ },
713
+ {
714
+ mediaType: "audio/aac",
715
+ bytesPrefix: [255, 241]
716
+ // MPEG-4 ADTS without CRC
717
+ },
718
+ {
719
+ mediaType: "audio/aac",
720
+ bytesPrefix: [255, 248]
721
+ // MPEG-2 ADTS with CRC
722
+ },
723
+ {
724
+ mediaType: "audio/aac",
725
+ bytesPrefix: [255, 249]
726
+ // MPEG-2 ADTS without CRC
727
+ },
724
728
  {
725
729
  mediaType: "audio/mpeg",
726
730
  bytesPrefix: [255, 251]
@@ -884,7 +888,6 @@ function detectMediaTypeBySignatures({
884
888
  return signature.mediaType;
885
889
  }
886
890
  }
887
- return void 0;
888
891
  }
889
892
  var topLevelSignatureTables = {
890
893
  image: imageMediaTypeSignatures,
@@ -930,10 +933,9 @@ function isFullMediaType(mediaType) {
930
933
 
931
934
  // src/cancel-response-body.ts
932
935
  async function cancelResponseBody(response) {
933
- var _a3;
934
936
  try {
935
- await ((_a3 = response.body) == null ? void 0 : _a3.cancel());
936
- } catch (e) {
937
+ await response.body?.cancel();
938
+ } catch {
937
939
  }
938
940
  }
939
941
 
@@ -971,7 +973,7 @@ function isBrowserRuntime(globalThisAny = globalThis) {
971
973
  function isSameOrigin(url, baseUrl) {
972
974
  try {
973
975
  return new URL(url).origin === new URL(baseUrl).origin;
974
- } catch (e) {
976
+ } catch {
975
977
  return false;
976
978
  }
977
979
  }
@@ -981,7 +983,7 @@ function validateDownloadUrl(url) {
981
983
  let parsed;
982
984
  try {
983
985
  parsed = new URL(url);
984
- } catch (e) {
986
+ } catch {
985
987
  throw new DownloadError({
986
988
  url,
987
989
  message: `Invalid URL: ${url}`
@@ -1026,7 +1028,6 @@ function validateDownloadUrl(url) {
1026
1028
  message: `URL with IP address ${hostname} is not allowed`
1027
1029
  });
1028
1030
  }
1029
- return;
1030
1031
  }
1031
1032
  }
1032
1033
  function validateDownloadAddress({
@@ -1167,32 +1168,21 @@ function createSafeLookup(lookup) {
1167
1168
  });
1168
1169
  }
1169
1170
  var safeNodeFetchPromise;
1170
- var initialGlobalFetch = globalThis.fetch;
1171
- var initialGlobalFetchIsNodeDefault = isNodeDefaultFetch(initialGlobalFetch);
1172
1171
  function isNodeRuntime() {
1173
- var _a3, _b3;
1174
1172
  const runtimeProcess = globalThis.process;
1175
- return ((_a3 = runtimeProcess == null ? void 0 : runtimeProcess.release) == null ? void 0 : _a3.name) === "node" && ((_b3 = runtimeProcess.versions) == null ? void 0 : _b3.bun) == null;
1173
+ return runtimeProcess?.release?.name === "node" && runtimeProcess.versions?.bun == null && runtimeProcess.versions?.deno == null && runtimeProcess.title !== "workerd" && globalThis.EdgeRuntime == null;
1176
1174
  }
1177
1175
  async function getDefaultDownloadFetch() {
1178
- if (!isNodeRuntime() || !initialGlobalFetchIsNodeDefault || globalThis.fetch !== initialGlobalFetch) {
1176
+ if (!isNodeRuntime()) {
1179
1177
  return globalThis.fetch;
1180
1178
  }
1181
- return safeNodeFetchPromise != null ? safeNodeFetchPromise : safeNodeFetchPromise = Promise.resolve().then(createSafeNodeFetch);
1182
- }
1183
- function isNodeDefaultFetch(fetch) {
1184
- if (typeof fetch !== "function") {
1185
- return false;
1186
- }
1187
- const source = Function.prototype.toString.call(fetch);
1188
- return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
1179
+ return safeNodeFetchPromise ??= Promise.resolve().then(createSafeNodeFetch);
1189
1180
  }
1190
1181
  function createSafeNodeFetch() {
1191
- const { createRequire } = loadBuiltinModule("node:module");
1182
+ const module = loadBuiltinModule("node:module");
1192
1183
  const { lookup } = loadBuiltinModule("node:dns");
1193
- const { Agent, fetch } = createRequire(getCurrentModulePath())(
1194
- "undici"
1195
- );
1184
+ const nodeRequire = module.createRequire(getCurrentModulePath());
1185
+ const { Agent, fetch } = nodeRequire("undici");
1196
1186
  const dispatcher = new Agent({
1197
1187
  connect: {
1198
1188
  lookup: createSafeLookup(lookup)
@@ -1207,9 +1197,8 @@ function createSafeNodeFetch() {
1207
1197
  ));
1208
1198
  }
1209
1199
  function loadBuiltinModule(id) {
1210
- var _a3;
1211
1200
  const processWithBuiltins = globalThis.process;
1212
- const builtinModule = (_a3 = processWithBuiltins == null ? void 0 : processWithBuiltins.getBuiltinModule) == null ? void 0 : _a3.call(processWithBuiltins, id);
1201
+ const builtinModule = processWithBuiltins?.getBuiltinModule?.(id);
1213
1202
  if (builtinModule == null) {
1214
1203
  throw new Error(`Node.js built-in module ${id} is unavailable`);
1215
1204
  }
@@ -1222,7 +1211,7 @@ function getCurrentModulePath() {
1222
1211
  const error = new Error("Capture current module path");
1223
1212
  Error.captureStackTrace(error, getCurrentModulePath);
1224
1213
  const [caller] = error.stack;
1225
- const fileName = caller == null ? void 0 : caller.getFileName();
1214
+ const fileName = caller?.getFileName();
1226
1215
  if (fileName == null) {
1227
1216
  throw new Error("Unable to determine the current module path");
1228
1217
  }
@@ -1300,7 +1289,6 @@ async function fetchWithValidatedRedirects({
1300
1289
  fetch: customFetch,
1301
1290
  trustedOrigin
1302
1291
  }) {
1303
- var _a3;
1304
1292
  let currentHeaders = headers === void 0 ? void 0 : sanitizeRequestHeaders(headers);
1305
1293
  const perHopInit = (redirect) => {
1306
1294
  const init = { signal: abortSignal, redirect };
@@ -1326,9 +1314,9 @@ async function fetchWithValidatedRedirects({
1326
1314
  }
1327
1315
  return await fetch(currentUrl, perHopInit("follow"));
1328
1316
  }
1329
- const location = (_a3 = response.headers) == null ? void 0 : _a3.get("location");
1317
+ const location = response.headers?.get("location");
1330
1318
  if (REDIRECT_STATUS_CODES.has(response.status) && location) {
1331
- await cancelResponseBody(response);
1319
+ void cancelResponseBody(response);
1332
1320
  const nextUrl = new URL(location, currentUrl).toString();
1333
1321
  if (currentHeaders !== void 0 && !isSameOrigin(nextUrl, currentUrl)) {
1334
1322
  const userAgent = currentHeaders.get("user-agent");
@@ -1347,6 +1335,52 @@ async function fetchWithValidatedRedirects({
1347
1335
  });
1348
1336
  }
1349
1337
 
1338
+ // src/fetch-untrusted-url.ts
1339
+ var SAFE_UNTRUSTED_FIRST_HOP_HEADERS = /* @__PURE__ */ new Set([
1340
+ "accept",
1341
+ "accept-language",
1342
+ "baggage",
1343
+ "cache-control",
1344
+ "idempotency-key",
1345
+ "if-match",
1346
+ "if-modified-since",
1347
+ "if-none-match",
1348
+ "if-range",
1349
+ "if-unmodified-since",
1350
+ "pragma",
1351
+ "range",
1352
+ "traceparent",
1353
+ "tracestate",
1354
+ "user-agent",
1355
+ "x-correlation-id",
1356
+ "x-request-id"
1357
+ ]);
1358
+ async function fetchUntrustedUrl({
1359
+ headers,
1360
+ credentialedOrigin,
1361
+ untrustedFirstHopHeaders,
1362
+ ...options
1363
+ }) {
1364
+ let firstHopHeaders;
1365
+ if (headers !== void 0) {
1366
+ firstHopHeaders = sanitizeRequestHeaders(headers);
1367
+ const origin = credentialedOrigin ?? options.trustedOrigin;
1368
+ if (origin === void 0 || !isSameOrigin(options.url, origin)) {
1369
+ const allowedHeaders = /* @__PURE__ */ new Set([
1370
+ ...SAFE_UNTRUSTED_FIRST_HOP_HEADERS,
1371
+ ...(untrustedFirstHopHeaders ?? []).map((name3) => name3.toLowerCase())
1372
+ ]);
1373
+ firstHopHeaders = new Headers(
1374
+ [...firstHopHeaders].filter(([name3]) => allowedHeaders.has(name3))
1375
+ );
1376
+ }
1377
+ }
1378
+ return fetchWithValidatedRedirects({
1379
+ ...options,
1380
+ headers: firstHopHeaders
1381
+ });
1382
+ }
1383
+
1350
1384
  // src/read-response-with-size-limit.ts
1351
1385
  var DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
1352
1386
  async function readResponseWithSizeLimit({
@@ -1390,7 +1424,7 @@ async function readResponseWithSizeLimit({
1390
1424
  } finally {
1391
1425
  try {
1392
1426
  await reader.cancel();
1393
- } catch (e) {
1427
+ } catch {
1394
1428
  } finally {
1395
1429
  reader.releaseLock();
1396
1430
  }
@@ -1406,11 +1440,10 @@ async function readResponseWithSizeLimit({
1406
1440
 
1407
1441
  // src/download-blob.ts
1408
1442
  async function downloadBlob(url, options) {
1409
- var _a3, _b3;
1410
1443
  try {
1411
- const response = await fetchWithValidatedRedirects({
1444
+ const response = await fetchUntrustedUrl({
1412
1445
  url,
1413
- abortSignal: options == null ? void 0 : options.abortSignal
1446
+ abortSignal: options?.abortSignal
1414
1447
  });
1415
1448
  if (!response.ok) {
1416
1449
  await cancelResponseBody(response);
@@ -1423,9 +1456,9 @@ async function downloadBlob(url, options) {
1423
1456
  const data = await readResponseWithSizeLimit({
1424
1457
  response,
1425
1458
  url,
1426
- maxBytes: (_a3 = options == null ? void 0 : options.maxBytes) != null ? _a3 : DEFAULT_MAX_DOWNLOAD_SIZE
1459
+ maxBytes: options?.maxBytes ?? DEFAULT_MAX_DOWNLOAD_SIZE
1427
1460
  });
1428
- const contentType = (_b3 = response.headers.get("content-type")) != null ? _b3 : void 0;
1461
+ const contentType = response.headers.get("content-type") ?? void 0;
1429
1462
  return new Blob([data], contentType ? { type: contentType } : void 0);
1430
1463
  } catch (error) {
1431
1464
  if (DownloadError.isInstance(error)) {
@@ -1439,6 +1472,9 @@ async function downloadBlob(url, options) {
1439
1472
  var EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL = /* @__PURE__ */ Symbol.for(
1440
1473
  "vercel.ai.embeddingModel.maxInputBytesPerCall"
1441
1474
  );
1475
+ var EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER = /* @__PURE__ */ Symbol.for(
1476
+ "vercel.ai.embeddingModel.providerOptionsTransformer"
1477
+ );
1442
1478
 
1443
1479
  // src/extract-lines.ts
1444
1480
  function extractLines({
@@ -1449,8 +1485,8 @@ function extractLines({
1449
1485
  if (startLine == null && endLine == null) return text;
1450
1486
  const lineEnding = text.includes("\r\n") ? "\r\n" : text.includes("\n") ? "\n" : text.includes("\r") ? "\r" : "\n";
1451
1487
  const lines = text.split(lineEnding);
1452
- const start = Math.max(1, startLine != null ? startLine : 1) - 1;
1453
- const end = Math.min(lines.length, endLine != null ? endLine : lines.length);
1488
+ const start = Math.max(1, startLine ?? 1) - 1;
1489
+ const end = Math.min(lines.length, endLine ?? lines.length);
1454
1490
  return lines.slice(start, end).join(lineEnding);
1455
1491
  }
1456
1492
 
@@ -1506,11 +1542,11 @@ var getFromApi = async ({
1506
1542
  trustedOrigin
1507
1543
  }) => {
1508
1544
  try {
1509
- const requestFetch = fetch != null ? fetch : getOriginalFetch2();
1545
+ const requestFetch = fetch ?? getOriginalFetch2();
1510
1546
  const outgoingHeaders = credentialedOrigin !== void 0 && !isSameOrigin(url, credentialedOrigin) ? {} : headers;
1511
1547
  const requestHeaders = withUserAgentSuffix(
1512
1548
  outgoingHeaders,
1513
- `ai-sdk/provider-utils/${VERSION}`,
1549
+ `ai-sdk-provider-utils/${VERSION}`,
1514
1550
  getRuntimeEnvironmentUserAgent()
1515
1551
  );
1516
1552
  const response = validateUrl ? await fetchWithValidatedRedirects({
@@ -1599,8 +1635,7 @@ function injectJsonInstructionIntoMessages({
1599
1635
  schemaPrefix,
1600
1636
  schemaSuffix
1601
1637
  }) {
1602
- var _a3, _b3;
1603
- const systemMessage = ((_a3 = messages[0]) == null ? void 0 : _a3.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
1638
+ const systemMessage = messages[0]?.role === "system" ? { ...messages[0] } : { role: "system", content: "" };
1604
1639
  systemMessage.content = injectJsonInstruction({
1605
1640
  prompt: systemMessage.content,
1606
1641
  schema,
@@ -1609,14 +1644,13 @@ function injectJsonInstructionIntoMessages({
1609
1644
  });
1610
1645
  return [
1611
1646
  systemMessage,
1612
- ...((_b3 = messages[0]) == null ? void 0 : _b3.role) === "system" ? messages.slice(1) : messages
1647
+ ...messages[0]?.role === "system" ? messages.slice(1) : messages
1613
1648
  ];
1614
1649
  }
1615
1650
 
1616
1651
  // src/is-buffer.ts
1617
1652
  function isBuffer(value) {
1618
- var _a3, _b3;
1619
- return (_b3 = (_a3 = globalThis.Buffer) == null ? void 0 : _a3.isBuffer(value)) != null ? _b3 : false;
1653
+ return globalThis.Buffer?.isBuffer(value) ?? false;
1620
1654
  }
1621
1655
 
1622
1656
  // src/is-non-nullable.ts
@@ -1653,7 +1687,7 @@ function isUrlSupported({
1653
1687
  if (isTopLevelOnly) {
1654
1688
  return `${mediaType}/` === mediaTypePrefix;
1655
1689
  }
1656
- return mediaType.startsWith(mediaTypePrefix);
1690
+ return mediaTypePrefix.endsWith("/") ? mediaType.startsWith(mediaTypePrefix) : mediaType === mediaTypePrefix;
1657
1691
  }).flatMap(({ regexes }) => regexes).some((pattern) => testRegExpFromStart(pattern, url));
1658
1692
  }
1659
1693
  function testRegExpFromStart(pattern, value) {
@@ -1816,15 +1850,14 @@ function mapReasoningToProviderBudget({
1816
1850
 
1817
1851
  // src/media-type-to-extension.ts
1818
1852
  function mediaTypeToExtension(mediaType) {
1819
- var _a3;
1820
1853
  const [_type, subtype = ""] = mediaType.toLowerCase().split("/");
1821
- return (_a3 = {
1854
+ return {
1822
1855
  mpeg: "mp3",
1823
1856
  "x-wav": "wav",
1824
1857
  opus: "ogg",
1825
1858
  mp4: "m4a",
1826
1859
  "x-m4a": "m4a"
1827
- }[subtype]) != null ? _a3 : subtype;
1860
+ }[subtype] ?? subtype;
1828
1861
  }
1829
1862
 
1830
1863
  // src/normalize-batch-request-counts.ts
@@ -1842,7 +1875,6 @@ function normalizeBatchRequestCounts({
1842
1875
  failed
1843
1876
  };
1844
1877
  }
1845
- return void 0;
1846
1878
  }
1847
1879
  function isNonNegativeSafeInteger(value) {
1848
1880
  return value != null && Number.isSafeInteger(value) && value >= 0;
@@ -1893,7 +1925,7 @@ function secureJsonParse(text) {
1893
1925
  const { stackTraceLimit } = Error;
1894
1926
  try {
1895
1927
  Error.stackTraceLimit = 0;
1896
- } catch (e) {
1928
+ } catch {
1897
1929
  return _parse(text);
1898
1930
  }
1899
1931
  try {
@@ -1990,11 +2022,10 @@ function parseAnyDef() {
1990
2022
 
1991
2023
  // src/to-json-schema/zod3-to-json-schema/parsers/array.ts
1992
2024
  function parseArrayDef(def, refs) {
1993
- var _a3, _b3, _c;
1994
2025
  const res = {
1995
2026
  type: "array"
1996
2027
  };
1997
- if (((_a3 = def.type) == null ? void 0 : _a3._def) && ((_c = (_b3 = def.type) == null ? void 0 : _b3._def) == null ? void 0 : _c.typeName) !== "ZodAny") {
2028
+ if (def.type?._def && def.type?._def?.typeName !== "ZodAny") {
1998
2029
  res.items = parseDef(def.type._def, {
1999
2030
  ...refs,
2000
2031
  currentPath: [...refs.currentPath, "items"]
@@ -2061,7 +2092,7 @@ var parseCatchDef = (def, refs) => {
2061
2092
 
2062
2093
  // src/to-json-schema/zod3-to-json-schema/parsers/date.ts
2063
2094
  function parseDateDef(def, refs, overrideDateStrategy) {
2064
- const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
2095
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
2065
2096
  if (Array.isArray(strategy)) {
2066
2097
  return {
2067
2098
  anyOf: strategy.map((item) => parseDateDef(def, refs, item))
@@ -2180,7 +2211,7 @@ var zodPatterns = {
2180
2211
  /**
2181
2212
  * `a-z` was added to replicate /i flag
2182
2213
  */
2183
- email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
2214
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
2184
2215
  /**
2185
2216
  * Constructed a valid Unicode RegExp
2186
2217
  *
@@ -2382,8 +2413,7 @@ function escapeNonAlphaNumeric(source) {
2382
2413
  return result;
2383
2414
  }
2384
2415
  function addFormat(schema, value, message, refs) {
2385
- var _a3;
2386
- if (schema.format || ((_a3 = schema.anyOf) == null ? void 0 : _a3.some((x) => x.format))) {
2416
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
2387
2417
  if (!schema.anyOf) {
2388
2418
  schema.anyOf = [];
2389
2419
  }
@@ -2402,8 +2432,7 @@ function addFormat(schema, value, message, refs) {
2402
2432
  }
2403
2433
  }
2404
2434
  function addPattern(schema, regex, message, refs) {
2405
- var _a3;
2406
- if (schema.pattern || ((_a3 = schema.allOf) == null ? void 0 : _a3.some((x) => x.pattern))) {
2435
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
2407
2436
  if (!schema.allOf) {
2408
2437
  schema.allOf = [];
2409
2438
  }
@@ -2422,7 +2451,6 @@ function addPattern(schema, regex, message, refs) {
2422
2451
  }
2423
2452
  }
2424
2453
  function stringifyRegExpWithFlags(regex, refs) {
2425
- var _a3;
2426
2454
  if (!refs.applyRegexFlags || !regex.flags) {
2427
2455
  return regex.source;
2428
2456
  }
@@ -2452,7 +2480,7 @@ function stringifyRegExpWithFlags(regex, refs) {
2452
2480
  pattern += source[i];
2453
2481
  pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
2454
2482
  inCharRange = false;
2455
- } else if (source[i + 1] === "-" && ((_a3 = source[i + 2]) == null ? void 0 : _a3.match(/[a-z]/))) {
2483
+ } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
2456
2484
  pattern += source[i];
2457
2485
  inCharRange = true;
2458
2486
  } else {
@@ -2493,7 +2521,7 @@ function stringifyRegExpWithFlags(regex, refs) {
2493
2521
  }
2494
2522
  try {
2495
2523
  new RegExp(pattern);
2496
- } catch (e) {
2524
+ } catch {
2497
2525
  console.warn(
2498
2526
  `Could not convert regex pattern at ${refs.currentPath.join(
2499
2527
  "/"
@@ -2506,28 +2534,27 @@ function stringifyRegExpWithFlags(regex, refs) {
2506
2534
 
2507
2535
  // src/to-json-schema/zod3-to-json-schema/parsers/record.ts
2508
2536
  function parseRecordDef(def, refs) {
2509
- var _a3, _b3, _c, _d, _e, _f;
2510
2537
  const schema = {
2511
2538
  type: "object",
2512
- additionalProperties: (_a3 = parseDef(def.valueType._def, {
2539
+ additionalProperties: parseDef(def.valueType._def, {
2513
2540
  ...refs,
2514
2541
  currentPath: [...refs.currentPath, "additionalProperties"]
2515
- })) != null ? _a3 : refs.allowedAdditionalProperties
2542
+ }) ?? refs.allowedAdditionalProperties
2516
2543
  };
2517
- if (((_b3 = def.keyType) == null ? void 0 : _b3._def.typeName) === "ZodString" && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
2544
+ if (def.keyType?._def.typeName === "ZodString" && def.keyType._def.checks?.length) {
2518
2545
  const { type: _type, ...keyType } = parseStringDef(def.keyType._def, refs);
2519
2546
  return {
2520
2547
  ...schema,
2521
2548
  propertyNames: keyType
2522
2549
  };
2523
- } else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === "ZodEnum") {
2550
+ } else if (def.keyType?._def.typeName === "ZodEnum") {
2524
2551
  return {
2525
2552
  ...schema,
2526
2553
  propertyNames: {
2527
2554
  enum: def.keyType._def.values
2528
2555
  }
2529
2556
  };
2530
- } else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === "ZodBranded" && def.keyType._def.type._def.typeName === "ZodString" && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
2557
+ } else if (def.keyType?._def.typeName === "ZodBranded" && def.keyType._def.type._def.typeName === "ZodString" && def.keyType._def.type._def.checks?.length) {
2531
2558
  const { type: _type, ...keyType } = parseBrandedDef(
2532
2559
  def.keyType._def,
2533
2560
  refs
@@ -2780,15 +2807,14 @@ function decideAdditionalProperties(def, refs) {
2780
2807
  function safeIsOptional(schema) {
2781
2808
  try {
2782
2809
  return schema.isOptional();
2783
- } catch (e) {
2810
+ } catch {
2784
2811
  return true;
2785
2812
  }
2786
2813
  }
2787
2814
 
2788
2815
  // src/to-json-schema/zod3-to-json-schema/parsers/optional.ts
2789
2816
  var parseOptionalDef = (def, refs) => {
2790
- var _a3;
2791
- if (refs.currentPath.toString() === ((_a3 = refs.propertyPath) == null ? void 0 : _a3.toString())) {
2817
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
2792
2818
  return parseDef(def.innerType._def, refs);
2793
2819
  }
2794
2820
  const innerSchema = parseDef(def.innerType._def, {
@@ -2987,11 +3013,9 @@ var getRelativePath = (pathA, pathB) => {
2987
3013
 
2988
3014
  // src/to-json-schema/zod3-to-json-schema/parse-def.ts
2989
3015
  function parseDef(def, refs, forceResolution = false) {
2990
- var _a3;
2991
3016
  const seenItem = refs.seen.get(def);
2992
3017
  if (refs.override) {
2993
- const overrideResult = (_a3 = refs.override) == null ? void 0 : _a3.call(
2994
- refs,
3018
+ const overrideResult = refs.override?.(
2995
3019
  def,
2996
3020
  refs,
2997
3021
  seenItem,
@@ -3073,34 +3097,30 @@ var getRefs = (options) => {
3073
3097
 
3074
3098
  // src/to-json-schema/zod3-to-json-schema/zod3-to-json-schema.ts
3075
3099
  var zod3ToJsonSchema = (schema, options) => {
3076
- var _a3;
3077
3100
  const refs = getRefs(options);
3078
3101
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
3079
- (acc, [name4, schema2]) => {
3080
- var _a4;
3081
- return {
3082
- ...acc,
3083
- [name4]: (_a4 = parseDef(
3084
- schema2._def,
3085
- {
3086
- ...refs,
3087
- currentPath: [...refs.basePath, refs.definitionPath, name4]
3088
- },
3089
- true
3090
- )) != null ? _a4 : parseAnyDef()
3091
- };
3092
- },
3102
+ (acc, [name4, schema2]) => ({
3103
+ ...acc,
3104
+ [name4]: parseDef(
3105
+ schema2._def,
3106
+ {
3107
+ ...refs,
3108
+ currentPath: [...refs.basePath, refs.definitionPath, name4]
3109
+ },
3110
+ true
3111
+ ) ?? parseAnyDef()
3112
+ }),
3093
3113
  {}
3094
3114
  ) : void 0;
3095
- const name3 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
3096
- const main = (_a3 = parseDef(
3115
+ const name3 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
3116
+ const main = parseDef(
3097
3117
  schema._def,
3098
3118
  name3 === void 0 ? refs : {
3099
3119
  ...refs,
3100
3120
  currentPath: [...refs.basePath, refs.definitionPath, name3]
3101
3121
  },
3102
3122
  false
3103
- )) != null ? _a3 : parseAnyDef();
3123
+ ) ?? parseAnyDef();
3104
3124
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
3105
3125
  if (title !== void 0) {
3106
3126
  main.title = title;
@@ -3192,8 +3212,7 @@ function hasStandardJsonSchema(schema) {
3192
3212
  return schema["~standard"].jsonSchema != null;
3193
3213
  }
3194
3214
  function zod3Schema(zodSchema2, options) {
3195
- var _a3;
3196
- const useReferences = (_a3 = options == null ? void 0 : options.useReferences) != null ? _a3 : false;
3215
+ const useReferences = options?.useReferences ?? false;
3197
3216
  return jsonSchema(
3198
3217
  // defer json schema creation to avoid unnecessary computation when only validation is needed
3199
3218
  () => zod3ToJsonSchema(zodSchema2, {
@@ -3208,8 +3227,7 @@ function zod3Schema(zodSchema2, options) {
3208
3227
  );
3209
3228
  }
3210
3229
  function zod4Schema(zodSchema2, options) {
3211
- var _a3;
3212
- const useReferences = (_a3 = options == null ? void 0 : options.useReferences) != null ? _a3 : false;
3230
+ const useReferences = options?.useReferences ?? false;
3213
3231
  return jsonSchema(
3214
3232
  // defer json schema creation to avoid unnecessary computation when only validation is needed
3215
3233
  () => addAdditionalPropertiesToJsonSchema(
@@ -3318,7 +3336,7 @@ function isParsableJson(input) {
3318
3336
  try {
3319
3337
  secureJsonParse(input);
3320
3338
  return true;
3321
- } catch (e) {
3339
+ } catch {
3322
3340
  return false;
3323
3341
  }
3324
3342
  }
@@ -3350,7 +3368,7 @@ async function parseProviderOptions({
3350
3368
  providerOptions,
3351
3369
  schema
3352
3370
  }) {
3353
- if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
3371
+ if (providerOptions?.[provider] == null) {
3354
3372
  return void 0;
3355
3373
  }
3356
3374
  const parsedProviderOptions = await safeValidateTypes({
@@ -3379,7 +3397,6 @@ function createMultipartBody(parts, boundary) {
3379
3397
  let activeReader;
3380
3398
  const enteredStreams = /* @__PURE__ */ new Set();
3381
3399
  async function* emitParts() {
3382
- var _a3, _b3;
3383
3400
  for (const part of parts) {
3384
3401
  if (disposed) return;
3385
3402
  const disposition = `--${boundary}\r
@@ -3392,9 +3409,9 @@ ${part.value}\r
3392
3409
  continue;
3393
3410
  }
3394
3411
  const filenameParameter = `; filename="${escapeMultipartHeaderValue(
3395
- (_a3 = part.filename) != null ? _a3 : "blob"
3412
+ part.filename ?? "blob"
3396
3413
  )}"`;
3397
- const mediaType = ((_b3 = part.mediaType) != null ? _b3 : "application/octet-stream").replace(
3414
+ const mediaType = (part.mediaType ?? "application/octet-stream").replace(
3398
3415
  /[\r\n]/g,
3399
3416
  ""
3400
3417
  );
@@ -3465,13 +3482,10 @@ var postMultipartStreamToApi = async ({
3465
3482
  }) => {
3466
3483
  const boundary = `ai-sdk-multipart-${generateId()}`;
3467
3484
  const requestBodyValues = Object.fromEntries(
3468
- parts.map((part) => {
3469
- var _a3;
3470
- return [
3471
- part.name,
3472
- part.type === "field" ? part.value : `<file:${(_a3 = part.filename) != null ? _a3 : part.name}>`
3473
- ];
3474
- })
3485
+ parts.map((part) => [
3486
+ part.name,
3487
+ part.type === "field" ? part.value : `<file:${part.filename ?? part.name}>`
3488
+ ])
3475
3489
  );
3476
3490
  const body = createMultipartBody(parts, boundary);
3477
3491
  try {
@@ -3482,7 +3496,7 @@ var postMultipartStreamToApi = async ({
3482
3496
  ...headers,
3483
3497
  "Content-Type": `multipart/form-data; boundary=${boundary}`
3484
3498
  },
3485
- `ai-sdk/provider-utils/${VERSION}`,
3499
+ `ai-sdk-provider-utils/${VERSION}`,
3486
3500
  getRuntimeEnvironmentUserAgent()
3487
3501
  ),
3488
3502
  body: body.stream,
@@ -3601,7 +3615,7 @@ var postToApi = async ({
3601
3615
  method: "POST",
3602
3616
  headers: withUserAgentSuffix(
3603
3617
  headers,
3604
- `ai-sdk/provider-utils/${VERSION}`,
3618
+ `ai-sdk-provider-utils/${VERSION}`,
3605
3619
  getRuntimeEnvironmentUserAgent()
3606
3620
  ),
3607
3621
  body: body.content,
@@ -3754,7 +3768,7 @@ async function resolve(value) {
3754
3768
  if (typeof value === "function") {
3755
3769
  value = value();
3756
3770
  }
3757
- return Promise.resolve(value);
3771
+ return value;
3758
3772
  }
3759
3773
 
3760
3774
  // src/resolve-full-media-type.ts
@@ -3968,7 +3982,7 @@ var createJsonErrorResponseHandler = ({
3968
3982
  statusCode: response.status,
3969
3983
  responseHeaders,
3970
3984
  responseBody,
3971
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
3985
+ isRetryable: isRetryable?.(response)
3972
3986
  })
3973
3987
  };
3974
3988
  }
@@ -3987,10 +4001,10 @@ var createJsonErrorResponseHandler = ({
3987
4001
  responseHeaders,
3988
4002
  responseBody,
3989
4003
  data: parsedError,
3990
- isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
4004
+ isRetryable: isRetryable?.(response, parsedError)
3991
4005
  })
3992
4006
  };
3993
- } catch (e) {
4007
+ } catch {
3994
4008
  return {
3995
4009
  responseHeaders,
3996
4010
  value: new APICallError6({
@@ -4000,7 +4014,7 @@ var createJsonErrorResponseHandler = ({
4000
4014
  statusCode: response.status,
4001
4015
  responseHeaders,
4002
4016
  responseBody,
4003
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
4017
+ isRetryable: isRetryable?.(response)
4004
4018
  })
4005
4019
  };
4006
4020
  }
@@ -4232,16 +4246,87 @@ function resolveSync(value) {
4232
4246
  import {
4233
4247
  InvalidResponseDataError
4234
4248
  } from "@ai-sdk/provider";
4235
- function absentIfBlank(value) {
4236
- return value != null && value.trim() !== "" ? value : void 0;
4249
+
4250
+ // src/streaming-tool-call-argument-state.ts
4251
+ function startsWithStructuredValue(value) {
4252
+ if (typeof value !== "string") {
4253
+ return false;
4254
+ }
4255
+ const firstCharacter = value.trimStart()[0];
4256
+ return firstCharacter === "{" || firstCharacter === "[";
4237
4257
  }
4258
+ var StreamingToolCallArgumentState = class {
4259
+ constructor(initialValue = "") {
4260
+ this.structure = { kind: "undetermined" };
4261
+ this.append(initialValue);
4262
+ }
4263
+ get hasCompleteStructuredValue() {
4264
+ return this.structure.kind === "structured" && this.structure.complete === true;
4265
+ }
4266
+ append(delta) {
4267
+ let nextStructure = this.structure;
4268
+ for (const character of delta) {
4269
+ if (nextStructure.kind === "undetermined") {
4270
+ if (/\s/.test(character)) {
4271
+ continue;
4272
+ }
4273
+ if (character !== "{" && character !== "[") {
4274
+ nextStructure = { kind: "other" };
4275
+ continue;
4276
+ }
4277
+ nextStructure = {
4278
+ kind: "structured",
4279
+ stack: [character],
4280
+ inString: false,
4281
+ escaped: false,
4282
+ complete: false
4283
+ };
4284
+ continue;
4285
+ }
4286
+ if (nextStructure.kind !== "structured" || nextStructure.complete) {
4287
+ continue;
4288
+ }
4289
+ if (nextStructure.inString) {
4290
+ if (nextStructure.escaped) {
4291
+ nextStructure.escaped = false;
4292
+ } else if (character === "\\") {
4293
+ nextStructure.escaped = true;
4294
+ } else if (character === '"') {
4295
+ nextStructure.inString = false;
4296
+ }
4297
+ continue;
4298
+ }
4299
+ if (character === '"') {
4300
+ nextStructure.inString = true;
4301
+ } else if (character === "{" || character === "[") {
4302
+ nextStructure.stack.push(character);
4303
+ } else if (character === "}" || character === "]") {
4304
+ const expectedOpening = character === "}" ? "{" : "[";
4305
+ if (nextStructure.stack.at(-1) !== expectedOpening) {
4306
+ nextStructure = { kind: "other" };
4307
+ continue;
4308
+ }
4309
+ nextStructure.stack.pop();
4310
+ if (nextStructure.stack.length === 0) {
4311
+ nextStructure.complete = true;
4312
+ }
4313
+ }
4314
+ }
4315
+ this.structure = nextStructure;
4316
+ }
4317
+ };
4318
+
4319
+ // src/streaming-tool-call-tracker.ts
4238
4320
  var StreamingToolCallTracker = class {
4239
4321
  constructor(controller, options = {}) {
4240
4322
  this.toolCalls = [];
4241
- var _a3, _b3;
4323
+ this.toolCallsById = /* @__PURE__ */ new Map();
4324
+ this.toolCallsByIndex = /* @__PURE__ */ new Map();
4325
+ this.usedToolCallIds = /* @__PURE__ */ new Set();
4326
+ this.nextGeneratedIdSuffixes = /* @__PURE__ */ new Map();
4242
4327
  this.controller = controller;
4243
- this._generateId = (_a3 = options.generateId) != null ? _a3 : generateId;
4244
- this.typeValidation = (_b3 = options.typeValidation) != null ? _b3 : "none";
4328
+ this._generateId = options.generateId ?? generateId;
4329
+ this.typeValidation = options.typeValidation ?? "none";
4245
4330
  this.extractMetadata = options.extractMetadata;
4246
4331
  this.buildToolCallProviderMetadata = options.buildToolCallProviderMetadata;
4247
4332
  }
@@ -4251,90 +4336,161 @@ var StreamingToolCallTracker = class {
4251
4336
  * events as appropriate.
4252
4337
  */
4253
4338
  processDelta(toolCallDelta) {
4254
- var _a3;
4255
- const wireId = absentIfBlank(toolCallDelta.id);
4256
- const wireIndex = toolCallDelta.index != null ? toolCallDelta.index : void 0;
4257
- const wireName = absentIfBlank((_a3 = toolCallDelta.function) == null ? void 0 : _a3.name);
4258
- let toolCall = this.findByAlias(wireId, wireIndex, wireName);
4259
- if (toolCall == null && this.toolCalls.length === 1) {
4260
- const only = this.toolCalls[0];
4261
- if ((wireName === void 0 || only.function.name === wireName) && (wireId === void 0 || only.wireId === void 0) && (wireIndex === void 0 || only.index === void 0)) {
4262
- toolCall = only;
4263
- }
4264
- }
4265
- if (toolCall == null) {
4266
- this.processNewToolCall(toolCallDelta, wireId, wireIndex, wireName);
4267
- return;
4339
+ const wireName = toolCallDelta.function?.name;
4340
+ const wireId = this.getNonBlankString(toolCallDelta.id);
4341
+ const name3 = this.getNonBlankString(wireName);
4342
+ const { index } = toolCallDelta;
4343
+ const resolution = this.resolveToolCall({
4344
+ wireId,
4345
+ index,
4346
+ name: name3,
4347
+ hasExplicitCallStart: name3 != null && startsWithStructuredValue(toolCallDelta.function?.arguments)
4348
+ });
4349
+ if (resolution.kind === "ambiguous") {
4350
+ throw new InvalidResponseDataError({
4351
+ data: toolCallDelta,
4352
+ message: "Ambiguous streamed tool call delta."
4353
+ });
4268
4354
  }
4269
- if (wireId !== void 0) {
4270
- toolCall.wireId = wireId;
4355
+ let toolCall;
4356
+ if (resolution.kind === "new") {
4357
+ toolCall = this.processNewToolCall(toolCallDelta, {
4358
+ wireId,
4359
+ index,
4360
+ name: name3
4361
+ });
4362
+ } else {
4363
+ toolCall = resolution.toolCall;
4364
+ if (wireId != null) {
4365
+ this.associateWireId(toolCall, wireId);
4366
+ }
4367
+ this.processExistingToolCall(toolCall, toolCallDelta);
4271
4368
  }
4272
- if (wireIndex !== void 0) {
4273
- toolCall.index = wireIndex;
4369
+ if (index != null) {
4370
+ this.associateIndex(toolCall, index);
4274
4371
  }
4275
- this.processExistingToolCall(toolCall, toolCallDelta);
4276
4372
  }
4277
4373
  /**
4278
- * The most recent tool call this delta's aliases claim. An alias the candidate has not
4279
- * seen yet cannot disagree, so it neither matches nor rejects; at least one alias must
4280
- * actually match, which is why a delta carrying only arguments never resolves here.
4281
- *
4282
- * Scanning stops at the first call an alias claims, and a `function.name` that disagrees
4283
- * with that call rejects the delta rather than letting the scan continue. Continuing past
4284
- * it reaches a call whose claim on the alias a later call has already superseded, which
4285
- * files a whole new call as a continuation of one two positions back.
4374
+ * Finalize any unfinished tool calls. Should be called during the stream's
4375
+ * flush handler to ensure all tool calls are properly completed.
4286
4376
  */
4377
+ flush() {
4378
+ const toolCalls = this.toolCalls.every((toolCall) => toolCall.index != null) ? [...this.toolCalls].sort(
4379
+ (a, b) => a.index - b.index || a.sequence - b.sequence
4380
+ ) : this.toolCalls;
4381
+ for (const toolCall of toolCalls) {
4382
+ if (!toolCall.hasFinished) {
4383
+ this.finishToolCall(toolCall);
4384
+ }
4385
+ }
4386
+ }
4287
4387
  /**
4288
- * Whether an alias the delta carries, but the matched call has not claimed, belongs to some
4289
- * other call. The delta then addresses two calls at once, which resolves to neither — the
4290
- * other claimant cannot be it either, because the alias it did match rejected that call
4291
- * already. Agreement has to be read across the record set: a candidate missing the alias is
4292
- * not contradicted by it on its own, and reading only the candidate let exactly this
4293
- * contradiction resolve, silently, onto a call the gateway never addressed.
4388
+ * Correlation precedence for streamed deltas:
4389
+ *
4390
+ * | ID evidence | index/name evidence | start evidence | resolution |
4391
+ * | --- | --- | --- | --- |
4392
+ * | known | matching | any | matching call, new call, or ambiguity |
4393
+ * | known | conflicting | named | new call |
4394
+ * | unseen | matching | structured start | new call |
4395
+ * | unseen | matching | continuation | matching call or ambiguity |
4396
+ * | absent | matching | any | matching call, new call, or ambiguity |
4397
+ * | absent | absent | named | new call |
4398
+ * | absent | absent | unnamed | sole unfinished call, new call, or ambiguity |
4294
4399
  */
4295
- claimedByAnother(candidate, alias, value) {
4296
- return value !== void 0 && candidate[alias] === void 0 && this.toolCalls.some((other) => other !== candidate && other[alias] === value);
4297
- }
4298
- findByAlias(wireId, wireIndex, wireName) {
4299
- for (let position = this.toolCalls.length - 1; position >= 0; position--) {
4300
- const candidate = this.toolCalls[position];
4301
- let matched = false;
4302
- if (wireIndex !== void 0 && candidate.index !== void 0) {
4303
- if (candidate.index !== wireIndex) {
4304
- continue;
4400
+ resolveToolCall({
4401
+ wireId,
4402
+ index,
4403
+ name: name3,
4404
+ hasExplicitCallStart
4405
+ }) {
4406
+ const indexedToolCalls = index != null ? this.toolCallsByIndex.get(index) : void 0;
4407
+ const matchingIndexedToolCalls = this.filterToolCallsByName(
4408
+ indexedToolCalls,
4409
+ name3
4410
+ );
4411
+ if (wireId != null) {
4412
+ const toolCallsWithId = this.toolCallsById.get(wireId);
4413
+ if (toolCallsWithId != null) {
4414
+ if (index != null) {
4415
+ const matchingToolCalls = matchingIndexedToolCalls.filter(
4416
+ (toolCall) => toolCallsWithId.has(toolCall)
4417
+ );
4418
+ const matchingToolCall = this.resolveMatchingToolCall(
4419
+ matchingToolCalls,
4420
+ hasExplicitCallStart
4421
+ );
4422
+ if (matchingToolCall.kind !== "new") {
4423
+ return matchingToolCall;
4424
+ }
4425
+ if (name3 != null) {
4426
+ return { kind: "new" };
4427
+ }
4428
+ if (indexedToolCalls != null) {
4429
+ return { kind: "ambiguous" };
4430
+ }
4431
+ return this.resolveMatchingToolCall([...toolCallsWithId], false);
4305
4432
  }
4306
- matched = true;
4307
- }
4308
- if (wireId !== void 0 && candidate.wireId !== void 0) {
4309
- if (candidate.wireId !== wireId) {
4310
- continue;
4433
+ if (name3 != null) {
4434
+ const matchingToolCalls = [...toolCallsWithId].filter(
4435
+ (toolCall) => toolCall.function.name === name3
4436
+ );
4437
+ return this.resolveMatchingToolCall(
4438
+ matchingToolCalls,
4439
+ hasExplicitCallStart
4440
+ );
4311
4441
  }
4312
- matched = true;
4442
+ return this.resolveMatchingToolCall([...toolCallsWithId], false);
4313
4443
  }
4314
- if (matched) {
4315
- if (this.claimedByAnother(candidate, "wireId", wireId) || this.claimedByAnother(candidate, "index", wireIndex)) {
4316
- return void 0;
4317
- }
4318
- return wireName !== void 0 && candidate.function.name !== wireName ? void 0 : candidate;
4444
+ if (matchingIndexedToolCalls.length > 0) {
4445
+ return hasExplicitCallStart ? { kind: "new" } : this.resolveMatchingToolCall(matchingIndexedToolCalls, false);
4319
4446
  }
4447
+ return { kind: "new" };
4320
4448
  }
4321
- return void 0;
4449
+ if (indexedToolCalls != null) {
4450
+ return this.resolveMatchingToolCall(
4451
+ matchingIndexedToolCalls,
4452
+ hasExplicitCallStart
4453
+ );
4454
+ }
4455
+ if (name3 != null) {
4456
+ return { kind: "new" };
4457
+ }
4458
+ const unfinishedToolCalls = this.toolCalls.filter(
4459
+ (toolCall) => !toolCall.hasFinished
4460
+ );
4461
+ if (unfinishedToolCalls.length === 1) {
4462
+ return { kind: "existing", toolCall: unfinishedToolCalls[0] };
4463
+ }
4464
+ return unfinishedToolCalls.length > 1 ? { kind: "ambiguous" } : { kind: "new" };
4322
4465
  }
4323
- /**
4324
- * Finalize any unfinished tool calls. Should be called during the stream's
4325
- * flush handler to ensure all tool calls are properly completed.
4326
- */
4327
- flush() {
4328
- const indices = this.toolCalls.map((toolCall) => toolCall.index);
4329
- const ordered = indices.every((index) => index !== void 0) && new Set(indices).size === indices.length ? [...this.toolCalls].sort((a, b) => a.index - b.index) : this.toolCalls;
4330
- for (const toolCall of ordered) {
4331
- if (!toolCall.hasFinished) {
4332
- this.finishToolCall(toolCall);
4333
- }
4466
+ filterToolCallsByName(toolCalls, name3) {
4467
+ if (toolCalls == null) {
4468
+ return [];
4334
4469
  }
4470
+ return [...toolCalls].filter(
4471
+ (toolCall) => name3 == null || toolCall.function.name === name3
4472
+ );
4335
4473
  }
4336
- processNewToolCall(toolCallDelta, wireId, wireIndex, wireName) {
4337
- var _a3, _b3;
4474
+ resolveMatchingToolCall(toolCalls, hasExplicitCallStart) {
4475
+ if (toolCalls.length === 0) {
4476
+ return { kind: "new" };
4477
+ }
4478
+ if (!hasExplicitCallStart) {
4479
+ return toolCalls.length === 1 ? { kind: "existing", toolCall: toolCalls[0] } : { kind: "ambiguous" };
4480
+ }
4481
+ const continuableToolCalls = toolCalls.filter(
4482
+ (toolCall) => !toolCall.argumentState.hasCompleteStructuredValue
4483
+ );
4484
+ if (continuableToolCalls.length === 1) {
4485
+ return { kind: "existing", toolCall: continuableToolCalls[0] };
4486
+ }
4487
+ return continuableToolCalls.length > 1 ? { kind: "ambiguous" } : { kind: "new" };
4488
+ }
4489
+ processNewToolCall(toolCallDelta, {
4490
+ wireId,
4491
+ index,
4492
+ name: name3
4493
+ }) {
4338
4494
  if (this.typeValidation === "required") {
4339
4495
  if (toolCallDelta.type !== "function") {
4340
4496
  throw new InvalidResponseDataError({
@@ -4350,32 +4506,37 @@ var StreamingToolCallTracker = class {
4350
4506
  });
4351
4507
  }
4352
4508
  }
4353
- if (wireName === void 0) {
4509
+ if (name3 == null) {
4354
4510
  throw new InvalidResponseDataError({
4355
4511
  data: toolCallDelta,
4356
4512
  message: `Expected 'function.name' to be a string.`
4357
4513
  });
4358
4514
  }
4359
- const mintedId = wireId === void 0 || this.toolCalls.some((candidate) => candidate.id === wireId) ? this._generateId() : wireId;
4515
+ const id = this.createToolCallId(wireId);
4360
4516
  this.controller.enqueue({
4361
4517
  type: "tool-input-start",
4362
- id: mintedId,
4363
- toolName: wireName
4518
+ id,
4519
+ toolName: name3
4364
4520
  });
4365
- const metadata = (_a3 = this.extractMetadata) == null ? void 0 : _a3.call(this, toolCallDelta);
4521
+ const metadata = this.extractMetadata?.(toolCallDelta);
4522
+ const initialArguments = toolCallDelta.function?.arguments ?? "";
4366
4523
  const toolCall = {
4367
- id: mintedId,
4524
+ id,
4525
+ index: index ?? void 0,
4526
+ sequence: this.toolCalls.length,
4368
4527
  type: "function",
4369
4528
  function: {
4370
- name: wireName,
4371
- arguments: (_b3 = toolCallDelta.function.arguments) != null ? _b3 : ""
4529
+ name: name3,
4530
+ arguments: initialArguments
4372
4531
  },
4532
+ argumentState: new StreamingToolCallArgumentState(initialArguments),
4373
4533
  hasFinished: false,
4374
- metadata,
4375
- wireId,
4376
- index: wireIndex
4534
+ metadata
4377
4535
  };
4378
4536
  this.toolCalls.push(toolCall);
4537
+ if (wireId != null) {
4538
+ this.associateWireId(toolCall, wireId);
4539
+ }
4379
4540
  if (toolCall.function.arguments.length > 0) {
4380
4541
  this.controller.enqueue({
4381
4542
  type: "tool-input-delta",
@@ -4385,12 +4546,53 @@ var StreamingToolCallTracker = class {
4385
4546
  }
4386
4547
  return toolCall;
4387
4548
  }
4549
+ associateWireId(toolCall, wireId) {
4550
+ let toolCallsWithId = this.toolCallsById.get(wireId);
4551
+ if (toolCallsWithId == null) {
4552
+ toolCallsWithId = /* @__PURE__ */ new Set();
4553
+ this.toolCallsById.set(wireId, toolCallsWithId);
4554
+ }
4555
+ toolCallsWithId.add(toolCall);
4556
+ }
4557
+ associateIndex(toolCall, index) {
4558
+ let toolCallsWithIndex = this.toolCallsByIndex.get(index);
4559
+ if (toolCallsWithIndex == null) {
4560
+ toolCallsWithIndex = /* @__PURE__ */ new Set();
4561
+ this.toolCallsByIndex.set(index, toolCallsWithIndex);
4562
+ }
4563
+ toolCallsWithIndex.add(toolCall);
4564
+ }
4565
+ createToolCallId(wireId) {
4566
+ if (wireId != null && !this.usedToolCallIds.has(wireId)) {
4567
+ this.usedToolCallIds.add(wireId);
4568
+ return wireId;
4569
+ }
4570
+ const generatedId = this.getNonBlankString(this._generateId()) ?? "tool-call";
4571
+ if (!this.usedToolCallIds.has(generatedId)) {
4572
+ this.usedToolCallIds.add(generatedId);
4573
+ return generatedId;
4574
+ }
4575
+ const initialSuffix = this.nextGeneratedIdSuffixes.get(generatedId) ?? 1;
4576
+ const maximumSuffix = initialSuffix + this.usedToolCallIds.size;
4577
+ for (let suffix = initialSuffix; suffix <= maximumSuffix; suffix++) {
4578
+ const suffixedId = `${generatedId}-${suffix}`;
4579
+ if (!this.usedToolCallIds.has(suffixedId)) {
4580
+ this.usedToolCallIds.add(suffixedId);
4581
+ this.nextGeneratedIdSuffixes.set(generatedId, suffix + 1);
4582
+ return suffixedId;
4583
+ }
4584
+ }
4585
+ throw new Error("Failed to create a unique tool call ID.");
4586
+ }
4587
+ getNonBlankString(value) {
4588
+ return value != null && value.trim().length > 0 ? value : void 0;
4589
+ }
4388
4590
  processExistingToolCall(toolCall, toolCallDelta) {
4389
- var _a3;
4390
4591
  if (toolCall.hasFinished) {
4391
4592
  return;
4392
4593
  }
4393
- if (((_a3 = toolCallDelta.function) == null ? void 0 : _a3.arguments) != null) {
4594
+ if (toolCallDelta.function?.arguments != null) {
4595
+ toolCall.argumentState.append(toolCallDelta.function.arguments);
4394
4596
  toolCall.function.arguments += toolCallDelta.function.arguments;
4395
4597
  this.controller.enqueue({
4396
4598
  type: "tool-input-delta",
@@ -4400,18 +4602,16 @@ var StreamingToolCallTracker = class {
4400
4602
  }
4401
4603
  }
4402
4604
  finishToolCall(toolCall) {
4403
- var _a3, _b3;
4404
4605
  this.controller.enqueue({
4405
4606
  type: "tool-input-end",
4406
4607
  id: toolCall.id
4407
4608
  });
4408
- const providerMetadata = (_a3 = this.buildToolCallProviderMetadata) == null ? void 0 : _a3.call(
4409
- this,
4609
+ const providerMetadata = this.buildToolCallProviderMetadata?.(
4410
4610
  toolCall.metadata
4411
4611
  );
4412
4612
  this.controller.enqueue({
4413
4613
  type: "tool-call",
4414
- toolCallId: (_b3 = toolCall.id) != null ? _b3 : this._generateId(),
4614
+ toolCallId: toolCall.id,
4415
4615
  toolName: toolCall.function.name,
4416
4616
  input: toolCall.function.arguments,
4417
4617
  ...providerMetadata ? { providerMetadata } : {}
@@ -4433,7 +4633,7 @@ function parseTranscriptionStreamClientFrame(text) {
4433
4633
  let value;
4434
4634
  try {
4435
4635
  value = secureJsonParse(text);
4436
- } catch (e) {
4636
+ } catch {
4437
4637
  return { type: "invalid", message: "malformed JSON" };
4438
4638
  }
4439
4639
  if (value == null || typeof value !== "object" || Array.isArray(value)) {
@@ -4490,7 +4690,7 @@ function serializeTranscriptionStreamPart(part) {
4490
4690
  });
4491
4691
  }
4492
4692
  return JSON.stringify(part);
4493
- } catch (e) {
4693
+ } catch {
4494
4694
  return void 0;
4495
4695
  }
4496
4696
  }
@@ -4501,7 +4701,7 @@ function parseTranscriptionStreamPart(text) {
4501
4701
  let value;
4502
4702
  try {
4503
4703
  value = secureJsonParse(text);
4504
- } catch (e) {
4704
+ } catch {
4505
4705
  return void 0;
4506
4706
  }
4507
4707
  if (value == null || typeof value !== "object" || Array.isArray(value)) {
@@ -4560,7 +4760,7 @@ function isSegment(value) {
4560
4760
  // src/validate-base-url.ts
4561
4761
  import { InvalidArgumentError as InvalidArgumentError3 } from "@ai-sdk/provider";
4562
4762
  function validateBaseURL(baseURL) {
4563
- if ((baseURL == null ? void 0 : baseURL.trim()) === "") {
4763
+ if (baseURL?.trim() === "") {
4564
4764
  throw new InvalidArgumentError3({
4565
4765
  argument: "baseURL",
4566
4766
  message: "baseURL must be a non-empty string."
@@ -4571,7 +4771,7 @@ function validateBaseURL(baseURL) {
4571
4771
 
4572
4772
  // src/without-trailing-slash.ts
4573
4773
  function withoutTrailingSlash(url) {
4574
- return url == null ? void 0 : url.replace(/\/$/, "");
4774
+ return url?.replace(/\/$/, "");
4575
4775
  }
4576
4776
 
4577
4777
  // src/types/executable-tool.ts
@@ -4610,7 +4810,7 @@ function toolCaller(tool2, definition) {
4610
4810
  });
4611
4811
  }
4612
4812
  function getToolCaller(tool2) {
4613
- return tool2 == null ? void 0 : tool2.experimental_toolCaller;
4813
+ return tool2?.experimental_toolCaller;
4614
4814
  }
4615
4815
 
4616
4816
  // src/index.ts
@@ -4623,6 +4823,7 @@ export {
4623
4823
  DelayedPromise,
4624
4824
  DownloadError,
4625
4825
  EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
4826
+ EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER as EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER,
4626
4827
  TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE,
4627
4828
  TRANSCRIPTION_STREAM_START_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE,
4628
4829
  EventSourceParserStream2 as EventSourceParserStream,
@@ -4671,6 +4872,7 @@ export {
4671
4872
  toolCaller as experimental_toolCaller,
4672
4873
  extractLines,
4673
4874
  extractResponseHeaders,
4875
+ fetchUntrustedUrl,
4674
4876
  fetchWithValidatedEndpoint,
4675
4877
  fetchWithValidatedRedirects,
4676
4878
  filterNullable,