eve 0.71.3 → 0.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +22 -6
  3. package/dist/src/acp/adapter.js +1 -1
  4. package/dist/src/ai/decide.d.ts +7 -0
  5. package/dist/src/ai/decide.js +1 -0
  6. package/dist/src/chunks/{use-eve-agent-CFCaYnrI.js → use-eve-agent-C1GYGCtb.js} +698 -388
  7. package/dist/src/chunks/{use-eve-agent-DcDhXNv1.js → use-eve-agent-hZJ7CB8t.js} +698 -388
  8. package/dist/src/cli/commands/integration-setup.js +1 -1
  9. package/dist/src/cli/commands/registry.js +1 -1
  10. package/dist/src/cli/commands/trace-detail.d.ts +1 -1
  11. package/dist/src/cli/commands/trace-detail.js +1 -1
  12. package/dist/src/cli/dev/tui/runner.js +1 -1
  13. package/dist/src/cli/dev/tui/setup-flow.d.ts +1 -0
  14. package/dist/src/cli/dev/tui/setup-panel.d.ts +1 -0
  15. package/dist/src/cli/dev/tui/setup-panel.js +2 -1
  16. package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +2 -2
  17. package/dist/src/cli/dev/tui/traces/trace-conversation.js +2 -2
  18. package/dist/src/cli/dev/tui/transcript-parts.d.ts +2 -1
  19. package/dist/src/cli/dev/tui/transcript-parts.js +1 -1
  20. package/dist/src/cli/dev/tui/transcript.js +1 -1
  21. package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
  22. package/dist/src/client/conversation-projection.d.ts +4 -0
  23. package/dist/src/client/conversation-projection.js +1 -0
  24. package/dist/src/client/conversation-reducer.js +1 -1
  25. package/dist/src/client/conversation-state.d.ts +5 -26
  26. package/dist/src/client/conversation-state.js +1 -1
  27. package/dist/src/client/index.d.ts +1 -0
  28. package/dist/src/client/index.js +1 -1
  29. package/dist/src/client/message-action-parts.d.ts +1 -11
  30. package/dist/src/client/message-action-parts.js +1 -1
  31. package/dist/src/client/message-reducer.d.ts +3 -1
  32. package/dist/src/client/message-reducer.js +1 -1
  33. package/dist/src/client/session-utils.js +1 -1
  34. package/dist/src/client/session.js +1 -1
  35. package/dist/src/client/tool-call-state.d.ts +23 -0
  36. package/dist/src/client/tool-call-state.js +1 -0
  37. package/dist/src/client/tool-part-state.d.ts +7 -0
  38. package/dist/src/client/tool-part-state.js +1 -0
  39. package/dist/src/compiled/.vendor-stamp.json +10 -10
  40. package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +1453 -1358
  41. package/dist/src/compiled/@ai-sdk/anthropic/index.js +1 -2
  42. package/dist/src/compiled/@ai-sdk/code-mode/index.d.ts +172 -163
  43. package/dist/src/compiled/@ai-sdk/code-mode/index.js +15 -20
  44. package/dist/src/compiled/@ai-sdk/google/index.d.ts +772 -733
  45. package/dist/src/compiled/@ai-sdk/google/index.js +6 -8
  46. package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +887 -790
  47. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  48. package/dist/src/compiled/@ai-sdk/openai/index.d.ts +1722 -1691
  49. package/dist/src/compiled/@ai-sdk/openai/index.js +3 -14
  50. package/dist/src/compiled/@ai-sdk/otel/index.d.ts +216 -159
  51. package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
  52. package/dist/src/compiled/@ai-sdk/provider/index.d.ts +7542 -7271
  53. package/dist/src/compiled/@ai-sdk/provider/index.js +1 -3
  54. package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +1799 -1600
  55. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  56. package/dist/src/compiled/_chunks/workflow/dist-DXLdlucM.js +15 -0
  57. package/dist/src/compiled/_chunks/workflow/experimental-decision-BrfWf6-n.js +3 -0
  58. package/dist/src/compiler/extension-compatibility.d.ts +36 -20
  59. package/dist/src/compiler/extension-compatibility.js +1 -1
  60. package/dist/src/compiler/manifest.js +1 -1
  61. package/dist/src/context/build-dynamic-tools.js +1 -1
  62. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  63. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -0
  64. package/dist/src/context/providers/session.js +1 -1
  65. package/dist/src/evals/define-eval.d.ts +1 -1
  66. package/dist/src/evals/judge.d.ts +1 -1
  67. package/dist/src/evals/judge.js +2 -2
  68. package/dist/src/evals/types.d.ts +8 -8
  69. package/dist/src/execution/cancel-descendant-turns-step.d.ts +1 -0
  70. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  71. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  72. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  73. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  74. package/dist/src/execution/durable-session-read.d.ts +5 -0
  75. package/dist/src/execution/durable-session-read.js +1 -0
  76. package/dist/src/execution/durable-session-store.d.ts +4 -10
  77. package/dist/src/execution/durable-session-store.js +1 -1
  78. package/dist/src/execution/dynamic-connections.d.ts +3 -3
  79. package/dist/src/execution/dynamic-connections.js +1 -1
  80. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  81. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  82. package/dist/src/execution/legacy-session/snapshot.d.ts +3 -0
  83. package/dist/src/execution/legacy-session/snapshot.js +1 -1
  84. package/dist/src/execution/model-call-batching.js +1 -1
  85. package/dist/src/execution/node-step.d.ts +2 -0
  86. package/dist/src/execution/node-step.js +1 -1
  87. package/dist/src/execution/proxied-deliver-step.js +1 -1
  88. package/dist/src/execution/publish-session-events.d.ts +7 -2
  89. package/dist/src/execution/publish-session-events.js +1 -1
  90. package/dist/src/execution/session/active-turn.js +1 -1
  91. package/dist/src/execution/session/answer-caller.js +1 -1
  92. package/dist/src/execution/session/checkpoint-migrations.js +1 -1
  93. package/dist/src/execution/session/finalization.js +1 -1
  94. package/dist/src/execution/session/handoff-steps.d.ts +3 -1
  95. package/dist/src/execution/session/handoff-steps.js +1 -1
  96. package/dist/src/execution/session/handoff.d.ts +1 -1
  97. package/dist/src/execution/session/handoff.js +1 -1
  98. package/dist/src/execution/session/pending-turn-state.d.ts +8 -3
  99. package/dist/src/execution/session/pending-turn-state.js +1 -1
  100. package/dist/src/execution/session/task-tool-tracing-step.d.ts +5 -0
  101. package/dist/src/execution/session/task-tool-tracing-step.js +1 -0
  102. package/dist/src/execution/session/turn-step-result.js +1 -1
  103. package/dist/src/execution/session/turn-step.js +1 -1
  104. package/dist/src/execution/session/turn-waiting-step.js +1 -1
  105. package/dist/src/execution/session/turn.d.ts +1 -0
  106. package/dist/src/execution/session/turn.js +1 -1
  107. package/dist/src/execution/settle-cancelled-turn-step.d.ts +4 -6
  108. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  109. package/dist/src/execution/tasks/start.d.ts +3 -3
  110. package/dist/src/execution/tasks/start.js +1 -1
  111. package/dist/src/execution/tasks/steps.d.ts +1 -1
  112. package/dist/src/execution/tasks/steps.js +1 -1
  113. package/dist/src/execution/terminal-session-completion-step.d.ts +5 -1
  114. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  115. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  116. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  117. package/dist/src/execution/tools/connection-tools.js +1 -1
  118. package/dist/src/execution/tools/workflow/harness-definition.js +1 -1
  119. package/dist/src/execution/tools/workflow/step.js +1 -1
  120. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +7 -9
  121. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -1
  122. package/dist/src/execution/workflow-trace-context.d.ts +2 -2
  123. package/dist/src/harness/authorization.d.ts +4 -2
  124. package/dist/src/harness/authorization.js +1 -1
  125. package/dist/src/harness/{compaction.js → compaction/engine.js} +1 -1
  126. package/dist/src/harness/compaction/step.d.ts +46 -0
  127. package/dist/src/harness/compaction/step.js +1 -0
  128. package/dist/src/harness/coordination.d.ts +32 -68
  129. package/dist/src/harness/coordination.js +1 -1
  130. package/dist/src/harness/current-messages.d.ts +1 -3
  131. package/dist/src/harness/current-messages.js +1 -1
  132. package/dist/src/harness/emission.d.ts +4 -52
  133. package/dist/src/harness/emission.js +1 -1
  134. package/dist/src/harness/execute-tool.d.ts +1 -0
  135. package/dist/src/harness/final-output.d.ts +5 -0
  136. package/dist/src/harness/final-output.js +1 -1
  137. package/dist/src/harness/hitl/approvals.d.ts +115 -0
  138. package/dist/src/harness/hitl/approvals.js +1 -0
  139. package/dist/src/harness/hitl/approved-call-callers.d.ts +14 -0
  140. package/dist/src/harness/hitl/approved-call-callers.js +1 -0
  141. package/dist/src/harness/hitl/approved-calls.d.ts +37 -0
  142. package/dist/src/harness/hitl/approved-calls.js +1 -0
  143. package/dist/src/harness/hitl/budget.d.ts +21 -0
  144. package/dist/src/harness/hitl/budget.js +1 -0
  145. package/dist/src/harness/{approval-candidates.d.ts → hitl/candidates.d.ts} +9 -18
  146. package/dist/src/harness/hitl/candidates.js +1 -0
  147. package/dist/src/harness/hitl/coordinator.js +1 -0
  148. package/dist/src/harness/hitl/delivery.d.ts +37 -0
  149. package/dist/src/harness/hitl/delivery.js +1 -0
  150. package/dist/src/harness/hitl/index.d.ts +49 -0
  151. package/dist/src/harness/hitl/index.js +1 -0
  152. package/dist/src/harness/hitl/intake.d.ts +67 -0
  153. package/dist/src/harness/hitl/intake.js +1 -0
  154. package/dist/src/harness/{stale-input-responses.d.ts → hitl/stale-responses.d.ts} +5 -3
  155. package/dist/src/harness/hitl/stale-responses.js +3 -0
  156. package/dist/src/harness/inline-tool-authorization.d.ts +4 -0
  157. package/dist/src/harness/inline-tool-authorization.js +1 -1
  158. package/dist/src/harness/input-extraction.d.ts +1 -10
  159. package/dist/src/harness/input-extraction.js +1 -1
  160. package/dist/src/harness/input-request-resolution.d.ts +1 -5
  161. package/dist/src/harness/input-request-resolution.js +1 -1
  162. package/dist/src/harness/model-call/call.d.ts +78 -0
  163. package/dist/src/harness/model-call/call.js +1 -0
  164. package/dist/src/harness/{model-call-error.d.ts → model-call/errors.d.ts} +1 -1
  165. package/dist/src/harness/model-call/failure.d.ts +52 -0
  166. package/dist/src/harness/model-call/failure.js +1 -0
  167. package/dist/src/harness/model-call/model.d.ts +18 -0
  168. package/dist/src/harness/model-call/model.js +1 -0
  169. package/dist/src/harness/model-call/recovery.d.ts +52 -0
  170. package/dist/src/harness/model-call/recovery.js +1 -0
  171. package/dist/src/harness/model-call/request.d.ts +30 -0
  172. package/dist/src/harness/model-call/request.js +3 -0
  173. package/dist/src/harness/model-call/response.d.ts +39 -0
  174. package/dist/src/harness/model-call/response.js +1 -0
  175. package/dist/src/harness/model-call/retry.d.ts +11 -0
  176. package/dist/src/harness/model-call/retry.js +1 -0
  177. package/dist/src/harness/model-call/run.d.ts +38 -0
  178. package/dist/src/harness/model-call/run.js +1 -0
  179. package/dist/src/harness/model-call/tools.d.ts +48 -0
  180. package/dist/src/harness/model-call/tools.js +1 -0
  181. package/dist/src/harness/model-call/usage.d.ts +23 -0
  182. package/dist/src/harness/model-call/usage.js +1 -0
  183. package/dist/src/harness/nested-actions.d.ts +2 -2
  184. package/dist/src/harness/provider-tools.d.ts +2 -2
  185. package/dist/src/harness/provider-tools.js +1 -1
  186. package/dist/src/harness/proxy-input-requests.d.ts +4 -12
  187. package/dist/src/harness/proxy-input-requests.js +1 -1
  188. package/dist/src/harness/session-machine/commit.d.ts +28 -0
  189. package/dist/src/harness/session-machine/commit.js +1 -0
  190. package/dist/src/harness/session-machine/current.d.ts +29 -0
  191. package/dist/src/harness/session-machine/current.js +1 -0
  192. package/dist/src/harness/session-machine/events.d.ts +6 -0
  193. package/dist/src/harness/session-machine/events.js +1 -0
  194. package/dist/src/harness/session-machine/resolver-events.d.ts +12 -0
  195. package/dist/src/harness/session-machine/resolver-events.js +1 -0
  196. package/dist/src/harness/session-machine/state.d.ts +47 -0
  197. package/dist/src/harness/session-machine/state.js +1 -0
  198. package/dist/src/harness/session-machine/transitions.d.ts +188 -0
  199. package/dist/src/harness/session-machine/transitions.js +1 -0
  200. package/dist/src/harness/session-machine/view.d.ts +58 -0
  201. package/dist/src/harness/session-machine/view.js +1 -0
  202. package/dist/src/harness/step/after-model.d.ts +7 -0
  203. package/dist/src/harness/step/after-model.js +1 -0
  204. package/dist/src/harness/step/context.d.ts +59 -0
  205. package/dist/src/harness/step/context.js +1 -0
  206. package/dist/src/harness/step/intake.d.ts +34 -0
  207. package/dist/src/harness/step/intake.js +1 -0
  208. package/dist/src/harness/step/prompt.d.ts +37 -0
  209. package/dist/src/harness/step/prompt.js +1 -0
  210. package/dist/src/harness/step-hooks.d.ts +8 -13
  211. package/dist/src/harness/step-hooks.js +1 -1
  212. package/dist/src/harness/tool-loop.d.ts +7 -22
  213. package/dist/src/harness/tool-loop.js +1 -3
  214. package/dist/src/harness/tools.d.ts +13 -0
  215. package/dist/src/harness/tools.js +1 -1
  216. package/dist/src/harness/turn-tag-state.d.ts +1 -1
  217. package/dist/src/harness/types.d.ts +6 -0
  218. package/dist/src/instrumentation/ai-sdk-hook-bridge.d.ts +1 -1
  219. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  220. package/dist/src/instrumentation/content.js +1 -1
  221. package/dist/src/instrumentation/dispatch.js +1 -1
  222. package/dist/src/instrumentation/lifecycle.d.ts +28 -56
  223. package/dist/src/instrumentation/native-events.d.ts +2 -1
  224. package/dist/src/instrumentation/native-events.js +1 -1
  225. package/dist/src/instrumentation/provider.d.ts +1 -1
  226. package/dist/src/instrumentation/runtime-context.d.ts +2 -3
  227. package/dist/src/instrumentation/runtime-context.js +1 -1
  228. package/dist/src/instrumentation/runtime.d.ts +11 -1
  229. package/dist/src/instrumentation/runtime.js +1 -1
  230. package/dist/src/instrumentation/state.d.ts +6 -1
  231. package/dist/src/instrumentation/state.js +1 -1
  232. package/dist/src/internal/application/package.js +1 -1
  233. package/dist/src/internal/attachments/limited-read.d.ts +16 -0
  234. package/dist/src/internal/attachments/limited-read.js +1 -0
  235. package/dist/src/internal/authored-definition/schema-backed.d.ts +2 -1
  236. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  237. package/dist/src/internal/mcp/published-tools.d.ts +13 -0
  238. package/dist/src/internal/mcp/published-tools.js +1 -0
  239. package/dist/src/internal/mcp/request-trace-context.d.ts +12 -0
  240. package/dist/src/internal/mcp/request-trace-context.js +1 -0
  241. package/dist/src/internal/mcp/streamable-http-server.d.ts +7 -3
  242. package/dist/src/internal/mcp/streamable-http-server.js +1 -1
  243. package/dist/src/internal/model-auth/transport.d.ts +3 -3
  244. package/dist/src/internal/model-auth/transport.js +1 -1
  245. package/dist/src/models/auto.d.ts +5 -5
  246. package/dist/src/models/auto.js +2 -2
  247. package/dist/src/protocol/message.d.ts +7 -0
  248. package/dist/src/protocol/message.js +1 -1
  249. package/dist/src/protocol/session-projection.d.ts +159 -0
  250. package/dist/src/protocol/session-projection.js +1 -0
  251. package/dist/src/public/ai/index.d.ts +1 -1
  252. package/dist/src/public/ai/index.js +1 -1
  253. package/dist/src/public/channels/chat-sdk/attachment-refs.d.ts +15 -0
  254. package/dist/src/public/channels/chat-sdk/attachment-refs.js +1 -0
  255. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  256. package/dist/src/public/channels/chat-sdk/messageToUserContent.d.ts +11 -5
  257. package/dist/src/public/channels/chat-sdk/messageToUserContent.js +1 -1
  258. package/dist/src/public/channels/discord/attachments.d.ts +15 -0
  259. package/dist/src/public/channels/discord/attachments.js +1 -0
  260. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  261. package/dist/src/public/channels/discord/inbound.d.ts +13 -0
  262. package/dist/src/public/channels/discord/inbound.js +1 -1
  263. package/dist/src/public/channels/linear/inbound-uploads.d.ts +21 -0
  264. package/dist/src/public/channels/linear/inbound-uploads.js +1 -0
  265. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  266. package/dist/src/public/channels/linq/inboundContent.d.ts +7 -1
  267. package/dist/src/public/channels/linq/inboundContent.js +1 -1
  268. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  269. package/dist/src/public/channels/mcp.d.ts +17 -2
  270. package/dist/src/public/channels/mcp.js +1 -1
  271. package/dist/src/public/channels/photon/attachments.d.ts +21 -0
  272. package/dist/src/public/channels/photon/attachments.js +1 -0
  273. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  274. package/dist/src/public/channels/slack/attachments.d.ts +3 -1
  275. package/dist/src/public/channels/slack/attachments.js +1 -1
  276. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  277. package/dist/src/public/channels/teams/attachments.d.ts +4 -4
  278. package/dist/src/public/channels/teams/attachments.js +1 -1
  279. package/dist/src/public/channels/telegram/attachments.js +1 -1
  280. package/dist/src/public/channels/twilio/api.d.ts +7 -0
  281. package/dist/src/public/channels/twilio/api.js +1 -1
  282. package/dist/src/public/channels/twilio/inbound.d.ts +7 -0
  283. package/dist/src/public/channels/twilio/inbound.js +2 -2
  284. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  285. package/dist/src/public/definitions/connections/mcp.d.ts +1 -1
  286. package/dist/src/public/definitions/connections/openapi.d.ts +1 -1
  287. package/dist/src/react/index.d.ts +1 -0
  288. package/dist/src/react/index.js +1 -1
  289. package/dist/src/runtime/agent/mock-model-adapter.js +2 -2
  290. package/dist/src/runtime/resolve-tool.js +1 -1
  291. package/dist/src/setup/boxes/resolve-provisioning.d.ts +2 -0
  292. package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
  293. package/dist/src/setup/cli/prompt-ui.d.ts +3 -0
  294. package/dist/src/setup/cli/prompt-ui.js +3 -1
  295. package/dist/src/setup/cli/select-component.d.ts +1 -0
  296. package/dist/src/setup/cli/select-component.js +1 -1
  297. package/dist/src/setup/flows/ensure-vercel-project.d.ts +2 -0
  298. package/dist/src/setup/flows/ensure-vercel-project.js +1 -1
  299. package/dist/src/setup/integrations/discord/api.js +1 -1
  300. package/dist/src/setup/integrations/web/auth-options.d.ts +4 -0
  301. package/dist/src/setup/integrations/web/auth-options.js +1 -0
  302. package/dist/src/setup/integrations/web/auth-scaffold.d.ts +7 -0
  303. package/dist/src/setup/integrations/web/auth-scaffold.js +1 -0
  304. package/dist/src/setup/integrations/web/provision-auth.d.ts +3 -0
  305. package/dist/src/setup/integrations/web/provision-auth.js +1 -0
  306. package/dist/src/setup/integrations/web/setup.d.ts +11 -6
  307. package/dist/src/setup/integrations/web/setup.js +3 -3
  308. package/dist/src/setup/prompter.d.ts +2 -0
  309. package/dist/src/setup/prompter.js +1 -1
  310. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  311. package/dist/src/setup/scaffold/create/project.js +2 -2
  312. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  313. package/dist/src/setup/scaffold/create/web-template.js +1 -0
  314. package/dist/src/setup/scaffold/update/web-options.js +1 -1
  315. package/dist/src/setup/vercel-project-api.d.ts +9 -0
  316. package/dist/src/setup/vercel-project-api.js +1 -1
  317. package/dist/src/setup/vercel-project.d.ts +4 -2
  318. package/dist/src/setup/vercel-project.js +0 -0
  319. package/dist/src/shared/web-search.d.ts +1 -1
  320. package/dist/src/subagents/adapter.js +1 -1
  321. package/dist/src/subagents/event-proxy-step.js +1 -1
  322. package/dist/src/subagents/hitl-proxy.d.ts +4 -28
  323. package/dist/src/subagents/hitl-proxy.js +1 -1
  324. package/dist/src/svelte/index.d.ts +2 -0
  325. package/dist/src/svelte/index.js +39 -2
  326. package/dist/src/svelte/use-eve-agent.js +1 -1
  327. package/dist/src/tools/approval/policies.d.ts +5 -5
  328. package/dist/src/tools/approval/policies.js +1 -1
  329. package/dist/src/tools/framework/agent.js +1 -1
  330. package/dist/src/tools/provided/agent-router.js +1 -1
  331. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  332. package/dist/src/tools/provided/ask-question.js +2 -2
  333. package/dist/src/tools/provided/bash.js +1 -1
  334. package/dist/src/tools/provided/framework-tool.d.ts +3 -0
  335. package/dist/src/tools/provided/framework-tool.js +1 -0
  336. package/dist/src/tools/provided/glob.js +2 -2
  337. package/dist/src/tools/provided/grep.js +2 -2
  338. package/dist/src/tools/provided/load-skill.js +1 -1
  339. package/dist/src/tools/provided/no-reply.js +1 -1
  340. package/dist/src/tools/provided/read-file.js +2 -2
  341. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  342. package/dist/src/tools/provided/sleep.js +1 -1
  343. package/dist/src/tools/provided/task-cancel.js +1 -1
  344. package/dist/src/tools/provided/task-wait.js +1 -1
  345. package/dist/src/tools/provided/web-fetch.js +2 -2
  346. package/dist/src/tools/provided/web-search.js +1 -1
  347. package/dist/src/tools/provided/workflow.js +1 -1
  348. package/dist/src/tools/provided/write-file.js +2 -2
  349. package/dist/src/tracing/agent-approval-instrumentation.d.ts +2 -2
  350. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  351. package/dist/src/tracing/agent-otel-provider.js +2 -2
  352. package/dist/src/tracing/agent-otel-usage.d.ts +1 -1
  353. package/dist/src/tracing/agent-otel-usage.js +1 -1
  354. package/dist/src/tracing/agent-span-contract.d.ts +0 -1
  355. package/dist/src/tracing/agent-span-contract.js +1 -1
  356. package/dist/src/tracing/agent-tool-instrumentation.d.ts +16 -6
  357. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  358. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  359. package/dist/src/tracing/agent-trace-state.d.ts +7 -3
  360. package/dist/src/tracing/invoke-tool-span.js +1 -1
  361. package/dist/src/tracing/local-trace-analysis.js +1 -1
  362. package/dist/src/vue/index.d.ts +2 -0
  363. package/dist/src/vue/index.js +39 -2
  364. package/dist/src/vue/use-eve-agent.js +1 -1
  365. package/docs/agent-config.md +2 -2
  366. package/docs/channels/chat-sdk.mdx +3 -1
  367. package/docs/channels/custom.mdx +2 -0
  368. package/docs/channels/discord.mdx +5 -4
  369. package/docs/channels/eve.mdx +65 -0
  370. package/docs/channels/linear.mdx +1 -1
  371. package/docs/channels/linq.mdx +2 -0
  372. package/docs/channels/mcp.mdx +39 -1
  373. package/docs/channels/photon.mdx +5 -0
  374. package/docs/channels/teams.mdx +4 -7
  375. package/docs/channels/twilio.mdx +1 -1
  376. package/docs/concepts/built-in-tools.md +12 -0
  377. package/docs/concepts/sessions-runs-and-streaming.md +3 -3
  378. package/docs/connections/overview.mdx +1 -1
  379. package/docs/dynamic-configuration/meta.json +1 -1
  380. package/docs/evals/judge.mdx +16 -16
  381. package/docs/evals/overview.mdx +1 -1
  382. package/docs/guides/{evaluate.md → decide.md} +35 -35
  383. package/docs/guides/dynamic-capabilities.md +1 -1
  384. package/docs/guides/frontend/overview.mdx +3 -1
  385. package/docs/guides/hooks.md +1 -1
  386. package/docs/guides/instrumentation/instrumentation.mdx +23 -22
  387. package/docs/guides/instrumentation/otel.mdx +13 -2
  388. package/docs/reference/cli.md +3 -3
  389. package/docs/reference/typescript-api.md +4 -2
  390. package/docs/tools/human-in-the-loop.md +6 -4
  391. package/docs/tools/workflows.mdx +4 -4
  392. package/package.json +11 -11
  393. package/dist/src/ai/evaluate.d.ts +0 -7
  394. package/dist/src/ai/evaluate.js +0 -1
  395. package/dist/src/client/message-task-parts.d.ts +0 -8
  396. package/dist/src/client/message-task-parts.js +0 -1
  397. package/dist/src/compiled/_chunks/workflow/dist-C3ZE62yI.js +0 -25
  398. package/dist/src/compiled/_chunks/workflow/experimental-evaluation-Dm32egEG.js +0 -5
  399. package/dist/src/harness/active-turn-id.d.ts +0 -11
  400. package/dist/src/harness/active-turn-id.js +0 -1
  401. package/dist/src/harness/approval-candidates.js +0 -1
  402. package/dist/src/harness/approval-delivery-coordinator.js +0 -1
  403. package/dist/src/harness/approved-call-callers.d.ts +0 -11
  404. package/dist/src/harness/approved-call-callers.js +0 -1
  405. package/dist/src/harness/cancelled-turn-emission.d.ts +0 -12
  406. package/dist/src/harness/cancelled-turn-emission.js +0 -1
  407. package/dist/src/harness/emission-state.d.ts +0 -36
  408. package/dist/src/harness/emission-state.js +0 -1
  409. package/dist/src/harness/held-requests.d.ts +0 -18
  410. package/dist/src/harness/held-requests.js +0 -1
  411. package/dist/src/harness/hitl/approval-input-requests.d.ts +0 -27
  412. package/dist/src/harness/hitl/approval-input-requests.js +0 -1
  413. package/dist/src/harness/hitl/pending-input-resolution.d.ts +0 -54
  414. package/dist/src/harness/hitl/pending-input-resolution.js +0 -1
  415. package/dist/src/harness/hitl/session-limit-input-requests.d.ts +0 -12
  416. package/dist/src/harness/hitl/session-limit-input-requests.js +0 -1
  417. package/dist/src/harness/input-requests.d.ts +0 -37
  418. package/dist/src/harness/input-requests.js +0 -1
  419. package/dist/src/harness/pending-input-batches.d.ts +0 -81
  420. package/dist/src/harness/pending-input-batches.js +0 -1
  421. package/dist/src/harness/session-limit-enforcement.d.ts +0 -45
  422. package/dist/src/harness/session-limit-enforcement.js +0 -1
  423. package/dist/src/harness/stale-input-responses.js +0 -3
  424. package/dist/src/harness/workflow-dispatch.d.ts +0 -30
  425. package/dist/src/harness/workflow-dispatch.js +0 -1
  426. package/dist/src/public/channels/linear/inbound-images.d.ts +0 -19
  427. package/dist/src/public/channels/linear/inbound-images.js +0 -1
  428. package/dist/src/tracing/agent-action-instrumentation.d.ts +0 -26
  429. package/dist/src/tracing/agent-action-instrumentation.js +0 -1
  430. /package/dist/src/harness/{compaction.d.ts → compaction/engine.d.ts} +0 -0
  431. /package/dist/src/harness/{compaction-prompt.d.ts → compaction/prompt.d.ts} +0 -0
  432. /package/dist/src/harness/{compaction-prompt.js → compaction/prompt.js} +0 -0
  433. /package/dist/src/harness/{session-limit-continuation.d.ts → hitl/budget-request.d.ts} +0 -0
  434. /package/dist/src/harness/{session-limit-continuation.js → hitl/budget-request.js} +0 -0
  435. /package/dist/src/harness/{approval-delivery-coordinator.d.ts → hitl/coordinator.d.ts} +0 -0
  436. /package/dist/src/harness/{model-call-error.js → model-call/errors.js} +0 -0
@@ -1,12 +1,11 @@
1
- import { SharedV4FileDataUrl, SharedV4FileDataReference, SharedV4FileDataText, SharedV4ProviderOptions, SharedV4ProviderReference, JSONValue, ImageModelV4File, LanguageModelV4ResponseMetadata, LanguageModelV4Usage, LanguageModelV4FunctionTool, LanguageModelV4ProviderTool, JSONSchema7, JSONParseError, TypeValidationError, APICallError, AISDKError, LanguageModelV4Prompt, LanguageModelV4CallOptions, SharedV4Warning, Experimental_BatchV4Status, JSONObject, LanguageModelV4FilePart, LanguageModelV4StreamPart, SharedV4ProviderMetadata, Experimental_TranscriptionModelV4StreamPart, TypeValidationContext } from '#compiled/@ai-sdk/provider/index.js';
2
- export { getErrorMessage } from '#compiled/@ai-sdk/provider/index.js';
3
- import { StandardSchemaV1, StandardJSONSchemaV1 } from '#compiled/@standard-schema/spec/index.js';
4
- export * from '#compiled/@standard-schema/spec/index.js';
5
- import * as z3 from '#compiled/zod/index.js';
6
- import { $ZodType } from 'zod/v4/core';
7
- export { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE } from '#compiled/@workflow/serde/index.js';
8
- export { EventSourceMessage, EventSourceParserStream } from '#compiled/eventsource-parser/stream/index.js';
9
-
1
+ import { AISDKError, APICallError, Experimental_BatchV4Status, Experimental_TranscriptionModelV4StreamPart, ImageModelV4File, JSONObject, JSONParseError, JSONSchema7, JSONValue, LanguageModelV4CallOptions, LanguageModelV4FilePart, LanguageModelV4FunctionTool, LanguageModelV4Prompt, LanguageModelV4ProviderTool, LanguageModelV4ResponseMetadata, LanguageModelV4StreamPart, LanguageModelV4Usage, SharedV4FileDataReference, SharedV4FileDataText, SharedV4FileDataUrl, SharedV4ProviderMetadata, SharedV4ProviderOptions, SharedV4ProviderReference, SharedV4Warning, TypeValidationContext, TypeValidationError, getErrorMessage } from "#compiled/@ai-sdk/provider/index.js";
2
+ import { $ZodType } from "zod/v4/core";
3
+ import { EventSourceMessage, EventSourceParserStream } from "#compiled/eventsource-parser/stream/index.js";
4
+ import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE } from "#compiled/@workflow/serde/index.js";
5
+ import { StandardJSONSchemaV1, StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
6
+ import * as z3 from "#compiled/zod/index.js";
7
+ export type * from "#compiled/@standard-schema/spec/index.js";
8
+ //#region src/as-array.d.ts
10
9
  /**
11
10
  * A value that can be provided either as a single item, an array of items,
12
11
  * or be left undefined.
@@ -15,36 +14,38 @@ type Arrayable<T> = T | T[] | undefined;
15
14
  /**
16
15
  * Normalizes a possibly undefined or non-array value into an array.
17
16
  */
18
- declare function asArray<T>(value: Arrayable<T>): T[];
19
-
20
- declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
21
-
17
+ export declare function asArray<T>(value: Arrayable<T>): T[];
18
+ //#endregion
19
+ //#region src/combine-headers.d.ts
20
+ export declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
21
+ //#endregion
22
+ //#region src/websocket.d.ts
22
23
  type WebSocketLike = {
23
- readyState: number;
24
- /** Bytes queued by `send` but not yet transmitted (native + `ws`). */
25
- readonly bufferedAmount?: number;
26
- send(data: string | Uint8Array | ArrayBuffer): void;
27
- close(code?: number, reason?: string): void;
28
- onopen: ((event: unknown) => void) | null;
29
- onmessage: ((event: {
30
- data: unknown;
31
- }) => void) | null;
32
- onerror: ((event: unknown) => void) | null;
33
- onclose: ((event: unknown) => void) | null;
24
+ readyState: number;
25
+ /** Bytes queued by `send` but not yet transmitted (native + `ws`). */
26
+ readonly bufferedAmount?: number;
27
+ send(data: string | Uint8Array | ArrayBuffer): void;
28
+ close(code?: number, reason?: string): void;
29
+ onopen: ((event: unknown) => void) | null;
30
+ onmessage: ((event: {
31
+ data: unknown;
32
+ }) => void) | null;
33
+ onerror: ((event: unknown) => void) | null;
34
+ onclose: ((event: unknown) => void) | null;
34
35
  };
35
36
  type WebSocketConstructor = new (url: string | URL, protocols?: string | string[], options?: {
36
- headers?: Record<string, string | undefined>;
37
+ headers?: Record<string, string | undefined>;
37
38
  }) => WebSocketLike;
38
- declare function getWebSocketConstructor(webSocket: WebSocketConstructor | undefined): WebSocketConstructor;
39
+ export declare function getWebSocketConstructor(webSocket: WebSocketConstructor | undefined): WebSocketConstructor;
39
40
  /**
40
41
  * Converts an http(s) URL to the corresponding ws(s) URL.
41
42
  */
42
- declare function toWebSocketUrl(url: string | URL): URL;
43
+ export declare function toWebSocketUrl(url: string | URL): URL;
43
44
  /**
44
45
  * Reads WebSocket message data as text, handling string, binary,
45
46
  * and Blob payloads.
46
47
  */
47
- declare function readWebSocketMessageText(data: unknown): Promise<string>;
48
+ export declare function readWebSocketMessageText(data: unknown): Promise<string>;
48
49
  /**
49
50
  * Waits until the socket's send buffer drains below `highWaterMark` bytes.
50
51
  * No-op for implementations that do not expose `bufferedAmount`. There is no
@@ -52,20 +53,21 @@ declare function readWebSocketMessageText(data: unknown): Promise<string>;
52
53
  * longer open or the signal aborts — `bufferedAmount` never drains on a
53
54
  * closed socket, so waiting on would poll forever.
54
55
  */
55
- declare function waitForWebSocketBufferDrain(socket: WebSocketLike, { highWaterMark, pollIntervalMs, abortSignal, }?: {
56
- highWaterMark?: number;
57
- pollIntervalMs?: number;
58
- abortSignal?: AbortSignal;
56
+ export declare function waitForWebSocketBufferDrain(socket: WebSocketLike, { highWaterMark, pollIntervalMs, abortSignal }?: {
57
+ highWaterMark?: number;
58
+ pollIntervalMs?: number;
59
+ abortSignal?: AbortSignal;
59
60
  }): Promise<void>;
60
-
61
+ //#endregion
62
+ //#region src/connect-to-websocket.d.ts
61
63
  interface WebSocketConnection {
62
- /** Undefined when the constructor threw or the signal was already aborted. */
63
- socket: WebSocketLike | undefined;
64
- /**
65
- * Unregisters the abort listener and closes the socket. Never throws.
66
- * Handlers stay attached; callers guard their own terminal state.
67
- */
68
- close: (code?: number) => void;
64
+ /** Undefined when the constructor threw or the signal was already aborted. */
65
+ socket: WebSocketLike | undefined;
66
+ /**
67
+ * Unregisters the abort listener and closes the socket. Never throws.
68
+ * Handlers stay attached; callers guard their own terminal state.
69
+ */
70
+ close: (code?: number) => void;
69
71
  }
70
72
  /**
71
73
  * Opens a WebSocket for a provider model, owning the transport-generic layer
@@ -73,30 +75,31 @@ interface WebSocketConnection {
73
75
  * abort wiring, and message decoding. Callers own the URL, the auth channel
74
76
  * (subprotocols vs headers), and the wire protocol.
75
77
  */
76
- declare function connectToWebSocket({ url, protocols, headers, webSocket, abortSignal, onOpen, onMessageText, onProcessingError, onSocketError, onClose, onAbort, }: {
77
- url: string | URL;
78
- protocols?: string | string[];
79
- headers?: Record<string, string | undefined>;
80
- webSocket?: WebSocketConstructor;
81
- abortSignal?: AbortSignal;
82
- onOpen?: (socket: WebSocketLike) => void;
83
- /** One decoded message. Throws and rejections go to `onProcessingError`. */
84
- onMessageText: (text: string) => void | PromiseLike<void>;
85
- /** Constructor throws and message decoding/processing failures. */
86
- onProcessingError: (error: unknown) => void;
87
- onSocketError?: () => void;
88
- /**
89
- * Receives the close code and reason when the transport provides them
90
- * (native `CloseEvent` / `ws` close event).
91
- */
92
- onClose?: (info: {
93
- code?: number;
94
- reason?: string;
95
- }) => void;
96
- /** Also called (without opening a socket) when the signal is already aborted. */
97
- onAbort?: (reason: unknown) => void;
78
+ export declare function connectToWebSocket({ url, protocols, headers, webSocket, abortSignal, onOpen, onMessageText, onProcessingError, onSocketError, onClose, onAbort }: {
79
+ url: string | URL;
80
+ protocols?: string | string[];
81
+ headers?: Record<string, string | undefined>;
82
+ webSocket?: WebSocketConstructor;
83
+ abortSignal?: AbortSignal;
84
+ onOpen?: (socket: WebSocketLike) => void;
85
+ /** One decoded message. Throws and rejections go to `onProcessingError`. */
86
+ onMessageText: (text: string) => void | PromiseLike<void>;
87
+ /** Constructor throws and message decoding/processing failures. */
88
+ onProcessingError: (error: unknown) => void;
89
+ onSocketError?: () => void;
90
+ /**
91
+ * Receives the close code and reason when the transport provides them
92
+ * (native `CloseEvent` / `ws` close event).
93
+ */
94
+ onClose?: (info: {
95
+ code?: number;
96
+ reason?: string;
97
+ }) => void;
98
+ /** Also called (without opening a socket) when the signal is already aborted. */
99
+ onAbort?: (reason: unknown) => void;
98
100
  }): WebSocketConnection;
99
-
101
+ //#endregion
102
+ //#region src/convert-async-iterator-to-readable-stream.d.ts
100
103
  /**
101
104
  * Converts an AsyncIterator to a ReadableStream.
102
105
  *
@@ -104,13 +107,15 @@ declare function connectToWebSocket({ url, protocols, headers, webSocket, abortS
104
107
  * @param { <T>} iterator - The AsyncIterator to convert.
105
108
  * @returns {ReadableStream<T>} - A ReadableStream that provides the same data as the AsyncIterator.
106
109
  */
107
- declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
108
-
110
+ export declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
111
+ //#endregion
112
+ //#region src/types/data-content.d.ts
109
113
  /**
110
114
  * Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
111
115
  */
112
116
  type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
113
-
117
+ //#endregion
118
+ //#region src/types/file-data.d.ts
114
119
  /**
115
120
  * File data variant containing raw bytes (`Uint8Array`, `ArrayBuffer`, or
116
121
  * `Buffer`) or a base64-encoded string.
@@ -118,8 +123,8 @@ type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
118
123
  * This is slightly more permissive than `SharedV4FileDataData`.
119
124
  */
120
125
  interface FileDataData {
121
- type: 'data';
122
- data: DataContent;
126
+ type: 'data';
127
+ data: DataContent;
123
128
  }
124
129
  /**
125
130
  * File data variant containing a URL that points to the file.
@@ -144,7 +149,8 @@ type FileDataText = SharedV4FileDataText;
144
149
  * - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
145
150
  */
146
151
  type FileData = FileDataData | FileDataUrl | FileDataReference | FileDataText;
147
-
152
+ //#endregion
153
+ //#region src/types/provider-options.d.ts
148
154
  /**
149
155
  * Additional provider-specific options.
150
156
  *
@@ -152,7 +158,8 @@ type FileData = FileDataData | FileDataUrl | FileDataReference | FileDataText;
152
158
  * provider-specific functionality that can be fully encapsulated in the provider.
153
159
  */
154
160
  type ProviderOptions = SharedV4ProviderOptions;
155
-
161
+ //#endregion
162
+ //#region src/types/provider-reference.d.ts
156
163
  /**
157
164
  * A mapping of provider names to provider-specific file identifiers.
158
165
  *
@@ -161,22 +168,23 @@ type ProviderOptions = SharedV4ProviderOptions;
161
168
  * identifier for the same logical file.
162
169
  */
163
170
  type ProviderReference = SharedV4ProviderReference;
164
-
171
+ //#endregion
172
+ //#region src/types/content-part.d.ts
165
173
  /**
166
174
  * Text content part of a prompt. It contains a string of text.
167
175
  */
168
176
  interface TextPart {
169
- type: 'text';
170
- /**
171
- * The text content.
172
- */
173
- text: string;
174
- /**
175
- * Additional provider-specific metadata. They are passed through
176
- * to the provider from the AI SDK and enable provider-specific
177
- * functionality that can be fully encapsulated in the provider.
178
- */
179
- providerOptions?: ProviderOptions;
177
+ type: 'text';
178
+ /**
179
+ * The text content.
180
+ */
181
+ text: string;
182
+ /**
183
+ * Additional provider-specific metadata. They are passed through
184
+ * to the provider from the AI SDK and enable provider-specific
185
+ * functionality that can be fully encapsulated in the provider.
186
+ */
187
+ providerOptions?: ProviderOptions;
180
188
  }
181
189
  /**
182
190
  * Image content part of a prompt. It contains an image.
@@ -185,48 +193,260 @@ interface TextPart {
185
193
  * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
186
194
  */
187
195
  interface ImagePart {
188
- type: 'image';
189
- /**
190
- * Image data. Can either be:
191
- *
192
- * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
193
- * - URL: a URL that points to the image
194
- * - ProviderReference: a provider reference from `uploadFile`
195
- */
196
- image: DataContent | URL | ProviderReference;
197
- /**
198
- * Optional IANA media type of the image.
199
- *
200
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
201
- */
202
- mediaType?: string;
203
- /**
204
- * Additional provider-specific metadata. They are passed through
205
- * to the provider from the AI SDK and enable provider-specific
206
- * functionality that can be fully encapsulated in the provider.
207
- */
208
- providerOptions?: ProviderOptions;
196
+ type: 'image';
197
+ /**
198
+ * Image data. Can either be:
199
+ *
200
+ * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
201
+ * - URL: a URL that points to the image
202
+ * - ProviderReference: a provider reference from `uploadFile`
203
+ */
204
+ image: DataContent | URL | ProviderReference;
205
+ /**
206
+ * Optional IANA media type of the image.
207
+ *
208
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
209
+ */
210
+ mediaType?: string;
211
+ /**
212
+ * Additional provider-specific metadata. They are passed through
213
+ * to the provider from the AI SDK and enable provider-specific
214
+ * functionality that can be fully encapsulated in the provider.
215
+ */
216
+ providerOptions?: ProviderOptions;
209
217
  }
210
218
  /**
211
219
  * File content part of a prompt. It contains a file.
212
220
  */
213
221
  interface FilePart {
222
+ type: 'file';
223
+ /**
224
+ * File data. Either a tagged shape or a bare shorthand:
225
+ *
226
+ * - `{ type: 'data', data }` or bare `DataContent`: raw bytes
227
+ * (base64 string, Uint8Array, ArrayBuffer, Buffer)
228
+ * - `{ type: 'url', url }` or bare `URL`: a URL that points to the file
229
+ * - `{ type: 'reference', reference }` or bare `ProviderReference`:
230
+ * a provider reference from `uploadFile`
231
+ * - `{ type: 'text', text }`: inline text content (tagged only)
232
+ */
233
+ data: FileData | DataContent | URL | ProviderReference;
234
+ /**
235
+ * Optional filename of the file.
236
+ */
237
+ filename?: string;
238
+ /**
239
+ * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
240
+ * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
241
+ *
242
+ * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
243
+ * top-level segment alone (e.g. `image`). Providers can use the helpers in
244
+ * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
245
+ * `detectMediaType`) to resolve the field according to their API
246
+ * requirements.
247
+ *
248
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
249
+ */
250
+ mediaType: string;
251
+ /**
252
+ * Additional provider-specific metadata. They are passed through
253
+ * to the provider from the AI SDK and enable provider-specific
254
+ * functionality that can be fully encapsulated in the provider.
255
+ */
256
+ providerOptions?: ProviderOptions;
257
+ }
258
+ /**
259
+ * Reasoning content part of a prompt. It contains a reasoning.
260
+ */
261
+ interface ReasoningPart {
262
+ type: 'reasoning';
263
+ /**
264
+ * The reasoning text.
265
+ */
266
+ text: string;
267
+ /**
268
+ * Additional provider-specific metadata. They are passed through
269
+ * to the provider from the AI SDK and enable provider-specific
270
+ * functionality that can be fully encapsulated in the provider.
271
+ */
272
+ providerOptions?: ProviderOptions;
273
+ }
274
+ /**
275
+ * Custom content part of a prompt. It contains no standardized payload beyond
276
+ * provider-specific options.
277
+ */
278
+ interface CustomPart {
279
+ type: 'custom';
280
+ /**
281
+ * The kind of custom content, in the format `{provider}.{provider-type}`.
282
+ */
283
+ kind: `${string}.${string}`;
284
+ /**
285
+ * Additional provider-specific metadata. They are passed through
286
+ * to the provider from the AI SDK and enable provider-specific
287
+ * functionality that can be fully encapsulated in the provider.
288
+ */
289
+ providerOptions?: ProviderOptions;
290
+ }
291
+ /**
292
+ * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
293
+ */
294
+ interface ReasoningFilePart {
295
+ type: 'reasoning-file';
296
+ /**
297
+ * Reasoning file data.
298
+ *
299
+ * Reasoning files originate from a model's reasoning output and are always
300
+ * raw bytes or a fetchable URL. Unlike `FilePart.data`, the `reference` and
301
+ * `text` shapes are not supported here: provider references describe files
302
+ * uploaded by the user (not produced as model output), and reasoning text is
303
+ * carried by `ReasoningPart` rather than as a file.
304
+ *
305
+ * Either a tagged shape or a bare shorthand:
306
+ *
307
+ * - `{ type: 'data', data }` or bare `DataContent`: raw bytes
308
+ * (base64 string, Uint8Array, ArrayBuffer, Buffer)
309
+ * - `{ type: 'url', url }` or bare `URL`: a URL that points to the file
310
+ */
311
+ data: FileDataData | FileDataUrl | DataContent | URL;
312
+ /**
313
+ * IANA media type of the file.
314
+ *
315
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
316
+ */
317
+ mediaType: string;
318
+ /**
319
+ * Additional provider-specific metadata. They are passed through
320
+ * to the provider from the AI SDK and enable provider-specific
321
+ * functionality that can be fully encapsulated in the provider.
322
+ */
323
+ providerOptions?: ProviderOptions;
324
+ }
325
+ /**
326
+ * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
327
+ */
328
+ interface ToolCallPart {
329
+ type: 'tool-call';
330
+ /**
331
+ * ID of the tool call. This ID is used to match the tool call with the tool result.
332
+ */
333
+ toolCallId: string;
334
+ /**
335
+ * Name of the tool that is being called.
336
+ */
337
+ toolName: string;
338
+ /**
339
+ * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
340
+ */
341
+ input: unknown;
342
+ /**
343
+ * Additional provider-specific metadata. They are passed through
344
+ * to the provider from the AI SDK and enable provider-specific
345
+ * functionality that can be fully encapsulated in the provider.
346
+ */
347
+ providerOptions?: ProviderOptions;
348
+ /**
349
+ * Whether the tool call was executed by the provider.
350
+ */
351
+ providerExecuted?: boolean;
352
+ }
353
+ /**
354
+ * Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
355
+ */
356
+ interface ToolResultPart {
357
+ type: 'tool-result';
358
+ /**
359
+ * ID of the tool call that this result is associated with.
360
+ */
361
+ toolCallId: string;
362
+ /**
363
+ * Name of the tool that generated this result.
364
+ */
365
+ toolName: string;
366
+ /**
367
+ * Result of the tool call. This is a JSON-serializable object.
368
+ */
369
+ output: ToolResultOutput;
370
+ /**
371
+ * Additional provider-specific metadata. They are passed through
372
+ * to the provider from the AI SDK and enable provider-specific
373
+ * functionality that can be fully encapsulated in the provider.
374
+ */
375
+ providerOptions?: ProviderOptions;
376
+ }
377
+ /**
378
+ * Output of a tool result.
379
+ */
380
+ type ToolResultOutput = {
381
+ /**
382
+ * Text tool output that should be directly sent to the API.
383
+ */
384
+ type: 'text';
385
+ value: string;
386
+ /**
387
+ * Provider-specific options.
388
+ */
389
+ providerOptions?: ProviderOptions;
390
+ } | {
391
+ type: 'json';
392
+ value: JSONValue;
393
+ /**
394
+ * Provider-specific options.
395
+ */
396
+ providerOptions?: ProviderOptions;
397
+ } | {
398
+ /**
399
+ * Type when the user has denied the execution of the tool call.
400
+ */
401
+ type: 'execution-denied';
402
+ /**
403
+ * Optional reason for the execution denial.
404
+ */
405
+ reason?: string;
406
+ /**
407
+ * Provider-specific options.
408
+ */
409
+ providerOptions?: ProviderOptions;
410
+ } | {
411
+ type: 'error-text';
412
+ value: string;
413
+ /**
414
+ * Provider-specific options.
415
+ */
416
+ providerOptions?: ProviderOptions;
417
+ } | {
418
+ type: 'error-json';
419
+ value: JSONValue;
420
+ /**
421
+ * Provider-specific options.
422
+ */
423
+ providerOptions?: ProviderOptions;
424
+ } | {
425
+ type: 'content';
426
+ value: Array<{
427
+ type: 'text';
428
+ /**
429
+ * Text content.
430
+ */
431
+ text: string;
432
+ /**
433
+ * Provider-specific options.
434
+ */
435
+ providerOptions?: ProviderOptions;
436
+ } | {
214
437
  type: 'file';
215
438
  /**
216
- * File data. Either a tagged shape or a bare shorthand:
439
+ * File data as a tagged discriminated union:
217
440
  *
218
- * - `{ type: 'data', data }` or bare `DataContent`: raw bytes
441
+ * - `{ type: 'data', data }`: raw bytes
219
442
  * (base64 string, Uint8Array, ArrayBuffer, Buffer)
220
- * - `{ type: 'url', url }` or bare `URL`: a URL that points to the file
221
- * - `{ type: 'reference', reference }` or bare `ProviderReference`:
222
- * a provider reference from `uploadFile`
223
- * - `{ type: 'text', text }`: inline text content (tagged only)
224
- */
225
- data: FileData | DataContent | URL | ProviderReference;
226
- /**
227
- * Optional filename of the file.
443
+ * - `{ type: 'url', url }`: a URL that points to the file
444
+ * - `{ type: 'reference', reference }`: a provider reference
445
+ * from `uploadFile`
446
+ * - `{ type: 'text', text }`: inline text content (e.g. an inline
447
+ * text document)
228
448
  */
229
- filename?: string;
449
+ data: FileData;
230
450
  /**
231
451
  * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
232
452
  * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
@@ -241,389 +461,178 @@ interface FilePart {
241
461
  */
242
462
  mediaType: string;
243
463
  /**
244
- * Additional provider-specific metadata. They are passed through
245
- * to the provider from the AI SDK and enable provider-specific
246
- * functionality that can be fully encapsulated in the provider.
464
+ * Optional filename of the file.
465
+ */
466
+ filename?: string;
467
+ /**
468
+ * Provider-specific options.
247
469
  */
248
470
  providerOptions?: ProviderOptions;
249
- }
250
- /**
251
- * Reasoning content part of a prompt. It contains a reasoning.
252
- */
253
- interface ReasoningPart {
254
- type: 'reasoning';
471
+ } | {
255
472
  /**
256
- * The reasoning text.
473
+ * @deprecated Use 'file' with mediaType + tagged data instead:
474
+ * `{ type: 'file', mediaType, data: { type: 'data', data } }`.
257
475
  */
258
- text: string;
476
+ type: 'file-data';
259
477
  /**
260
- * Additional provider-specific metadata. They are passed through
261
- * to the provider from the AI SDK and enable provider-specific
262
- * functionality that can be fully encapsulated in the provider.
478
+ * Base-64 encoded media data.
263
479
  */
264
- providerOptions?: ProviderOptions;
265
- }
266
- /**
267
- * Custom content part of a prompt. It contains no standardized payload beyond
268
- * provider-specific options.
269
- */
270
- interface CustomPart {
271
- type: 'custom';
480
+ data: string;
272
481
  /**
273
- * The kind of custom content, in the format `{provider}.{provider-type}`.
482
+ * IANA media type.
483
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
274
484
  */
275
- kind: `${string}.${string}`;
485
+ mediaType: string;
276
486
  /**
277
- * Additional provider-specific metadata. They are passed through
278
- * to the provider from the AI SDK and enable provider-specific
279
- * functionality that can be fully encapsulated in the provider.
487
+ * Optional filename of the file.
488
+ */
489
+ filename?: string;
490
+ /**
491
+ * Provider-specific options.
280
492
  */
281
493
  providerOptions?: ProviderOptions;
282
- }
283
- /**
284
- * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
285
- */
286
- interface ReasoningFilePart {
287
- type: 'reasoning-file';
494
+ } | {
288
495
  /**
289
- * Reasoning file data.
290
- *
291
- * Reasoning files originate from a model's reasoning output and are always
292
- * raw bytes or a fetchable URL. Unlike `FilePart.data`, the `reference` and
293
- * `text` shapes are not supported here: provider references describe files
294
- * uploaded by the user (not produced as model output), and reasoning text is
295
- * carried by `ReasoningPart` rather than as a file.
296
- *
297
- * Either a tagged shape or a bare shorthand:
298
- *
299
- * - `{ type: 'data', data }` or bare `DataContent`: raw bytes
300
- * (base64 string, Uint8Array, ArrayBuffer, Buffer)
301
- * - `{ type: 'url', url }` or bare `URL`: a URL that points to the file
496
+ * @deprecated Use 'file' with mediaType and tagged data instead:
497
+ * `{ type: 'file', mediaType, data: { type: 'url', url: new URL(url) } }`.
302
498
  */
303
- data: FileDataData | FileDataUrl | DataContent | URL;
499
+ type: 'file-url';
304
500
  /**
305
- * IANA media type of the file.
306
- *
307
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
501
+ * URL of the file.
308
502
  */
309
- mediaType: string;
503
+ url: string;
310
504
  /**
311
- * Additional provider-specific metadata. They are passed through
312
- * to the provider from the AI SDK and enable provider-specific
313
- * functionality that can be fully encapsulated in the provider.
505
+ * IANA media type.
506
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
314
507
  */
315
- providerOptions?: ProviderOptions;
316
- }
317
- /**
318
- * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
319
- */
320
- interface ToolCallPart {
321
- type: 'tool-call';
508
+ mediaType?: string;
322
509
  /**
323
- * ID of the tool call. This ID is used to match the tool call with the tool result.
510
+ * Provider-specific options.
324
511
  */
325
- toolCallId: string;
512
+ providerOptions?: ProviderOptions;
513
+ } | {
326
514
  /**
327
- * Name of the tool that is being called.
515
+ * @deprecated Use 'file' with tagged data instead:
516
+ * `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
328
517
  */
329
- toolName: string;
518
+ type: 'file-id';
330
519
  /**
331
- * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
520
+ * ID of the file.
521
+ *
522
+ * If you use multiple providers, you need to
523
+ * specify the provider specific ids using
524
+ * the Record option. The key is the provider
525
+ * name, e.g. 'openai' or 'anthropic'.
332
526
  */
333
- input: unknown;
527
+ fileId: string | Record<string, string>;
334
528
  /**
335
- * Additional provider-specific metadata. They are passed through
336
- * to the provider from the AI SDK and enable provider-specific
337
- * functionality that can be fully encapsulated in the provider.
529
+ * Provider-specific options.
338
530
  */
339
531
  providerOptions?: ProviderOptions;
532
+ } | {
340
533
  /**
341
- * Whether the tool call was executed by the provider.
534
+ * @deprecated Use 'file' with tagged data instead:
535
+ * `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
342
536
  */
343
- providerExecuted?: boolean;
344
- }
345
- /**
346
- * Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
347
- */
348
- interface ToolResultPart {
349
- type: 'tool-result';
537
+ type: 'file-reference';
350
538
  /**
351
- * ID of the tool call that this result is associated with.
539
+ * Provider-specific references for the file.
540
+ * The key is the provider name, e.g. 'openai' or 'anthropic'.
352
541
  */
353
- toolCallId: string;
542
+ providerReference: ProviderReference;
354
543
  /**
355
- * Name of the tool that generated this result.
544
+ * Provider-specific options.
356
545
  */
357
- toolName: string;
546
+ providerOptions?: ProviderOptions;
547
+ } | {
358
548
  /**
359
- * Result of the tool call. This is a JSON-serializable object.
549
+ * @deprecated Use 'file' with mediaType (e.g. 'image' or a specific
550
+ * `image/*` subtype) and tagged data instead:
551
+ * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
360
552
  */
361
- output: ToolResultOutput;
553
+ type: 'image-data';
362
554
  /**
363
- * Additional provider-specific metadata. They are passed through
364
- * to the provider from the AI SDK and enable provider-specific
365
- * functionality that can be fully encapsulated in the provider.
555
+ * Base-64 encoded image data.
366
556
  */
367
- providerOptions?: ProviderOptions;
368
- }
369
- /**
370
- * Output of a tool result.
371
- */
372
- type ToolResultOutput = {
557
+ data: string;
373
558
  /**
374
- * Text tool output that should be directly sent to the API.
559
+ * IANA media type.
560
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
375
561
  */
376
- type: 'text';
377
- value: string;
562
+ mediaType: string;
378
563
  /**
379
564
  * Provider-specific options.
380
565
  */
381
566
  providerOptions?: ProviderOptions;
382
- } | {
383
- type: 'json';
384
- value: JSONValue;
567
+ } | {
568
+ /**
569
+ * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
570
+ * `image/*` subtype) and tagged data instead:
571
+ * `{ type: 'file', mediaType: 'image', data: { type: 'url', url: new URL(url) } }`.
572
+ */
573
+ type: 'image-url';
574
+ /**
575
+ * URL of the image.
576
+ */
577
+ url: string;
385
578
  /**
386
579
  * Provider-specific options.
387
580
  */
388
581
  providerOptions?: ProviderOptions;
389
- } | {
582
+ } | {
390
583
  /**
391
- * Type when the user has denied the execution of the tool call.
584
+ * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
585
+ * `image/*` subtype) and tagged data instead:
586
+ * `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
392
587
  */
393
- type: 'execution-denied';
588
+ type: 'image-file-id';
394
589
  /**
395
- * Optional reason for the execution denial.
590
+ * Image that is referenced using a provider file id.
591
+ *
592
+ * If you use multiple providers, you need to
593
+ * specify the provider specific ids using
594
+ * the Record option. The key is the provider
595
+ * name, e.g. 'openai' or 'anthropic'.
396
596
  */
397
- reason?: string;
597
+ fileId: string | Record<string, string>;
398
598
  /**
399
599
  * Provider-specific options.
400
600
  */
401
601
  providerOptions?: ProviderOptions;
402
- } | {
403
- type: 'error-text';
404
- value: string;
602
+ } | {
603
+ /**
604
+ * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
605
+ * `image/*` subtype) and tagged data instead:
606
+ * `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
607
+ */
608
+ type: 'image-file-reference';
609
+ /**
610
+ * Provider-specific references for the image file.
611
+ * The key is the provider name, e.g. 'openai' or 'anthropic'.
612
+ */
613
+ providerReference: ProviderReference;
405
614
  /**
406
615
  * Provider-specific options.
407
616
  */
408
617
  providerOptions?: ProviderOptions;
409
- } | {
410
- type: 'error-json';
411
- value: JSONValue;
618
+ } | {
619
+ /**
620
+ * Custom content part. This can be used to implement
621
+ * provider-specific content parts.
622
+ */
623
+ type: 'custom';
412
624
  /**
413
625
  * Provider-specific options.
414
626
  */
415
627
  providerOptions?: ProviderOptions;
416
- } | {
417
- type: 'content';
418
- value: Array<{
419
- type: 'text';
420
- /**
421
- * Text content.
422
- */
423
- text: string;
424
- /**
425
- * Provider-specific options.
426
- */
427
- providerOptions?: ProviderOptions;
428
- } | {
429
- type: 'file';
430
- /**
431
- * File data as a tagged discriminated union:
432
- *
433
- * - `{ type: 'data', data }`: raw bytes
434
- * (base64 string, Uint8Array, ArrayBuffer, Buffer)
435
- * - `{ type: 'url', url }`: a URL that points to the file
436
- * - `{ type: 'reference', reference }`: a provider reference
437
- * from `uploadFile`
438
- * - `{ type: 'text', text }`: inline text content (e.g. an inline
439
- * text document)
440
- */
441
- data: FileData;
442
- /**
443
- * Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
444
- * the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
445
- *
446
- * `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
447
- * top-level segment alone (e.g. `image`). Providers can use the helpers in
448
- * `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
449
- * `detectMediaType`) to resolve the field according to their API
450
- * requirements.
451
- *
452
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
453
- */
454
- mediaType: string;
455
- /**
456
- * Optional filename of the file.
457
- */
458
- filename?: string;
459
- /**
460
- * Provider-specific options.
461
- */
462
- providerOptions?: ProviderOptions;
463
- } | {
464
- /**
465
- * @deprecated Use 'file' with mediaType + tagged data instead:
466
- * `{ type: 'file', mediaType, data: { type: 'data', data } }`.
467
- */
468
- type: 'file-data';
469
- /**
470
- * Base-64 encoded media data.
471
- */
472
- data: string;
473
- /**
474
- * IANA media type.
475
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
476
- */
477
- mediaType: string;
478
- /**
479
- * Optional filename of the file.
480
- */
481
- filename?: string;
482
- /**
483
- * Provider-specific options.
484
- */
485
- providerOptions?: ProviderOptions;
486
- } | {
487
- /**
488
- * @deprecated Use 'file' with mediaType and tagged data instead:
489
- * `{ type: 'file', mediaType, data: { type: 'url', url: new URL(url) } }`.
490
- */
491
- type: 'file-url';
492
- /**
493
- * URL of the file.
494
- */
495
- url: string;
496
- /**
497
- * IANA media type.
498
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
499
- */
500
- mediaType?: string;
501
- /**
502
- * Provider-specific options.
503
- */
504
- providerOptions?: ProviderOptions;
505
- } | {
506
- /**
507
- * @deprecated Use 'file' with tagged data instead:
508
- * `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
509
- */
510
- type: 'file-id';
511
- /**
512
- * ID of the file.
513
- *
514
- * If you use multiple providers, you need to
515
- * specify the provider specific ids using
516
- * the Record option. The key is the provider
517
- * name, e.g. 'openai' or 'anthropic'.
518
- */
519
- fileId: string | Record<string, string>;
520
- /**
521
- * Provider-specific options.
522
- */
523
- providerOptions?: ProviderOptions;
524
- } | {
525
- /**
526
- * @deprecated Use 'file' with tagged data instead:
527
- * `{ type: 'file', mediaType, data: { type: 'reference', reference } }`.
528
- */
529
- type: 'file-reference';
530
- /**
531
- * Provider-specific references for the file.
532
- * The key is the provider name, e.g. 'openai' or 'anthropic'.
533
- */
534
- providerReference: ProviderReference;
535
- /**
536
- * Provider-specific options.
537
- */
538
- providerOptions?: ProviderOptions;
539
- } | {
540
- /**
541
- * @deprecated Use 'file' with mediaType (e.g. 'image' or a specific
542
- * `image/*` subtype) and tagged data instead:
543
- * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
544
- */
545
- type: 'image-data';
546
- /**
547
- * Base-64 encoded image data.
548
- */
549
- data: string;
550
- /**
551
- * IANA media type.
552
- * @see https://www.iana.org/assignments/media-types/media-types.xhtml
553
- */
554
- mediaType: string;
555
- /**
556
- * Provider-specific options.
557
- */
558
- providerOptions?: ProviderOptions;
559
- } | {
560
- /**
561
- * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
562
- * `image/*` subtype) and tagged data instead:
563
- * `{ type: 'file', mediaType: 'image', data: { type: 'url', url: new URL(url) } }`.
564
- */
565
- type: 'image-url';
566
- /**
567
- * URL of the image.
568
- */
569
- url: string;
570
- /**
571
- * Provider-specific options.
572
- */
573
- providerOptions?: ProviderOptions;
574
- } | {
575
- /**
576
- * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
577
- * `image/*` subtype) and tagged data instead:
578
- * `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
579
- */
580
- type: 'image-file-id';
581
- /**
582
- * Image that is referenced using a provider file id.
583
- *
584
- * If you use multiple providers, you need to
585
- * specify the provider specific ids using
586
- * the Record option. The key is the provider
587
- * name, e.g. 'openai' or 'anthropic'.
588
- */
589
- fileId: string | Record<string, string>;
590
- /**
591
- * Provider-specific options.
592
- */
593
- providerOptions?: ProviderOptions;
594
- } | {
595
- /**
596
- * @deprecated Use 'file' with `mediaType: 'image'` (or a specific
597
- * `image/*` subtype) and tagged data instead:
598
- * `{ type: 'file', mediaType: 'image', data: { type: 'reference', reference } }`.
599
- */
600
- type: 'image-file-reference';
601
- /**
602
- * Provider-specific references for the image file.
603
- * The key is the provider name, e.g. 'openai' or 'anthropic'.
604
- */
605
- providerReference: ProviderReference;
606
- /**
607
- * Provider-specific options.
608
- */
609
- providerOptions?: ProviderOptions;
610
- } | {
611
- /**
612
- * Custom content part. This can be used to implement
613
- * provider-specific content parts.
614
- */
615
- type: 'custom';
616
- /**
617
- * Provider-specific options.
618
- */
619
- providerOptions?: ProviderOptions;
620
- }>;
628
+ }>;
621
629
  };
622
-
630
+ //#endregion
631
+ //#region src/convert-inline-file-data-to-uint8-array.d.ts
623
632
  type InlineFileData = Extract<FilePart['data'], {
624
- type: 'data';
633
+ type: 'data';
625
634
  } | {
626
- type: 'text';
635
+ type: 'text';
627
636
  }>;
628
637
  /**
629
638
  * Converts inline file data (a tagged `data` or `text` shape) into raw bytes.
@@ -636,11 +645,12 @@ type InlineFileData = Extract<FilePart['data'], {
636
645
  * `{ type: 'stream' }` data is rejected: providers without streaming upload
637
646
  * support funnel here and surface a clear `UnsupportedFunctionalityError`.
638
647
  */
639
- declare function convertInlineFileDataToUint8Array(data: InlineFileData | {
640
- type: 'stream';
641
- stream: ReadableStream<Uint8Array>;
648
+ export declare function convertInlineFileDataToUint8Array(data: InlineFileData | {
649
+ type: 'stream';
650
+ stream: ReadableStream<Uint8Array>;
642
651
  }): Uint8Array;
643
-
652
+ //#endregion
653
+ //#region src/convert-image-model-file-to-data-uri.d.ts
644
654
  /**
645
655
  * Convert an ImageModelV4File to a URL or data URI string.
646
656
  *
@@ -648,8 +658,21 @@ declare function convertInlineFileDataToUint8Array(data: InlineFileData | {
648
658
  * If the file is base64 data, it returns a data URI with the base64 data.
649
659
  * If the file is a Uint8Array, it converts it to base64 and returns a data URI.
650
660
  */
651
- declare function convertImageModelFileToDataUri(file: ImageModelV4File): string;
652
-
661
+ export declare function convertImageModelFileToDataUri(file: ImageModelV4File): string;
662
+ //#endregion
663
+ //#region src/convert-json-response-tool-stream.d.ts
664
+ /**
665
+ * Providers that cannot use native structured output for a request can use a
666
+ * JSON response tool instead. This utility converts that tool's streamed input
667
+ * into text events so the SDK can parse it as structured output.
668
+ *
669
+ * Conversational text is suppressed. Application tool calls pass through so the
670
+ * caller can execute them. A response containing only the JSON tool finishes
671
+ * with `stop`; a response containing application calls keeps its finish reason.
672
+ */
673
+ export declare function convertJsonResponseToolStream(toolName: string): TransformStream<LanguageModelV4StreamPart, LanguageModelV4StreamPart>;
674
+ //#endregion
675
+ //#region src/convert-to-form-data.d.ts
653
676
  /**
654
677
  * Converts an input object to FormData for multipart/form-data requests.
655
678
  *
@@ -681,83 +704,88 @@ declare function convertImageModelFileToDataUri(file: ImageModelV4File): string;
681
704
  * });
682
705
  * ```
683
706
  */
684
- declare function convertToFormData<T extends Record<string, unknown>>(input: T, options?: {
685
- useArrayBrackets?: boolean;
707
+ export declare function convertToFormData<T extends Record<string, unknown>>(input: T, options?: {
708
+ useArrayBrackets?: boolean;
686
709
  }): FormData;
687
-
710
+ //#endregion
711
+ //#region src/create-language-model-response-metadata.d.ts
688
712
  /**
689
713
  * Converts common provider response fields into language model response
690
714
  * metadata.
691
715
  */
692
- declare function createLanguageModelResponseMetadata({ id, model, created, }: {
693
- id?: string | null;
694
- model?: string | null;
695
- created?: number | null;
716
+ export declare function createLanguageModelResponseMetadata({ id, model, created }: {
717
+ id?: string | null;
718
+ model?: string | null;
719
+ created?: number | null;
696
720
  }): LanguageModelV4ResponseMetadata;
697
-
721
+ //#endregion
722
+ //#region src/create-null-language-model-usage.d.ts
698
723
  /**
699
724
  * Creates an empty language model usage result for unavailable usage data.
700
725
  */
701
- declare function createNullLanguageModelUsage(): LanguageModelV4Usage;
702
-
726
+ export declare function createNullLanguageModelUsage(): LanguageModelV4Usage;
727
+ //#endregion
728
+ //#region src/create-tool-name-mapping.d.ts
703
729
  /**
704
730
  * Interface for mapping between custom tool names and provider tool names.
705
731
  */
706
732
  interface ToolNameMapping {
707
- /**
708
- * Maps a custom tool name (used by the client) to the provider's tool name.
709
- * If the custom tool name does not have a mapping, returns the input name.
710
- *
711
- * @param customToolName - The custom name of the tool defined by the client.
712
- * @returns The corresponding provider tool name, or the input name if not mapped.
713
- */
714
- toProviderToolName: (customToolName: string) => string;
715
- /**
716
- * Maps a provider tool name to the custom tool name used by the client.
717
- * If the provider tool name does not have a mapping, returns the input name.
718
- *
719
- * @param providerToolName - The name of the tool as understood by the provider.
720
- * @returns The corresponding custom tool name, or the input name if not mapped.
721
- */
722
- toCustomToolName: (providerToolName: string) => string;
733
+ /**
734
+ * Maps a custom tool name (used by the client) to the provider's tool name.
735
+ * If the custom tool name does not have a mapping, returns the input name.
736
+ *
737
+ * @param customToolName - The custom name of the tool defined by the client.
738
+ * @returns The corresponding provider tool name, or the input name if not mapped.
739
+ */
740
+ toProviderToolName: (customToolName: string) => string;
741
+ /**
742
+ * Maps a provider tool name to the custom tool name used by the client.
743
+ * If the provider tool name does not have a mapping, returns the input name.
744
+ *
745
+ * @param providerToolName - The name of the tool as understood by the provider.
746
+ * @returns The corresponding custom tool name, or the input name if not mapped.
747
+ */
748
+ toCustomToolName: (providerToolName: string) => string;
723
749
  }
724
750
  /**
725
751
  * @param tools - Tools that were passed to the language model.
726
752
  * @param providerToolNames - Maps the provider tool ids to the provider tool names.
727
753
  */
728
- declare function createToolNameMapping({ tools, providerToolNames, }: {
729
- /**
730
- * Tools that were passed to the language model.
731
- */
732
- tools: Array<LanguageModelV4FunctionTool | LanguageModelV4ProviderTool> | undefined;
733
- /**
734
- * Maps the provider tool ids to the provider tool names.
735
- */
736
- providerToolNames: Record<`${string}.${string}`, string>;
754
+ export declare function createToolNameMapping({ tools, providerToolNames }: {
755
+ /**
756
+ * Tools that were passed to the language model.
757
+ */
758
+ tools: Array<LanguageModelV4FunctionTool | LanguageModelV4ProviderTool> | undefined;
759
+ /**
760
+ * Maps the provider tool ids to the provider tool names.
761
+ */
762
+ providerToolNames: Record<`${string}.${string}`, string>;
737
763
  }): ToolNameMapping;
738
-
764
+ //#endregion
765
+ //#region src/create-provider-stream-error.d.ts
739
766
  type ProviderStreamError = {
740
- readonly message: string;
741
- readonly type?: string;
742
- readonly code?: string | number;
743
- readonly statusCode?: number;
744
- readonly isRetryable?: boolean;
745
- readonly data: unknown;
767
+ readonly message: string;
768
+ readonly type?: string;
769
+ readonly code?: string | number;
770
+ readonly statusCode?: number;
771
+ readonly isRetryable?: boolean;
772
+ readonly data: unknown;
746
773
  };
747
774
  /**
748
775
  * Adds provider-owned status and retry metadata to a stream error payload
749
776
  * without requiring provider packages to depend on AI SDK Core.
750
777
  */
751
- declare function createProviderStreamError({ message, type, code, statusCode, isRetryable, data, }: {
752
- message: string;
753
- type?: string;
754
- code?: string | number;
755
- statusCode?: number;
756
- isRetryable?: boolean;
757
- data: unknown;
778
+ export declare function createProviderStreamError({ message, type, code, statusCode, isRetryable, data }: {
779
+ message: string;
780
+ type?: string;
781
+ code?: string | number;
782
+ statusCode?: number;
783
+ isRetryable?: boolean;
784
+ data: unknown;
758
785
  }): ProviderStreamError;
759
- declare function isProviderStreamError(error: unknown): error is ProviderStreamError;
760
-
786
+ export declare function isProviderStreamError(error: unknown): error is ProviderStreamError;
787
+ //#endregion
788
+ //#region src/delay.d.ts
761
789
  /**
762
790
  * Creates a Promise that resolves after a specified delay
763
791
  * @param delayInMs - The delay duration in milliseconds. If null or undefined, resolves immediately.
@@ -765,62 +793,65 @@ declare function isProviderStreamError(error: unknown): error is ProviderStreamE
765
793
  * @returns A Promise that resolves after the specified delay
766
794
  * @throws {DOMException} When the signal is aborted
767
795
  */
768
- declare function delay(delayInMs?: number | null, options?: {
769
- abortSignal?: AbortSignal;
796
+ export declare function delay(delayInMs?: number | null, options?: {
797
+ abortSignal?: AbortSignal;
770
798
  }): Promise<void>;
771
-
799
+ //#endregion
800
+ //#region src/delayed-promise.d.ts
772
801
  /**
773
802
  * Delayed promise. It is only constructed once the value is accessed.
774
803
  * This is useful to avoid unhandled promise rejections when the promise is created
775
804
  * but not accessed.
776
805
  */
777
- declare class DelayedPromise<T> {
778
- private status;
779
- private _promise;
780
- private _resolve;
781
- private _reject;
782
- get promise(): Promise<T>;
783
- resolve(value: T): void;
784
- reject(error: unknown): void;
785
- isResolved(): boolean;
786
- isRejected(): boolean;
787
- isPending(): boolean;
806
+ export declare class DelayedPromise<T> {
807
+ private status;
808
+ private _promise;
809
+ private _resolve;
810
+ private _reject;
811
+ get promise(): Promise<T>;
812
+ resolve(value: T): void;
813
+ reject(error: unknown): void;
814
+ isResolved(): boolean;
815
+ isRejected(): boolean;
816
+ isPending(): boolean;
788
817
  }
789
-
818
+ //#endregion
819
+ //#region src/fetch-function.d.ts
790
820
  /**
791
821
  * Fetch function type (standardizes the version of fetch used).
792
822
  */
793
- type FetchFunction = typeof globalThis.fetch;
794
-
823
+ export type FetchFunction = typeof globalThis.fetch;
824
+ //#endregion
825
+ //#region src/schema.d.ts
795
826
  /**
796
827
  * Used to mark schemas so we can support both Zod and custom schemas.
797
828
  */
798
829
  declare const schemaSymbol: unique symbol;
799
830
  type ValidationResult<OBJECT> = {
800
- success: true;
801
- value: OBJECT;
831
+ success: true;
832
+ value: OBJECT;
802
833
  } | {
803
- success: false;
804
- error: Error;
834
+ success: false;
835
+ error: Error;
805
836
  };
806
837
  type Schema<OBJECT = unknown> = {
807
- /**
808
- * Used to mark schemas so we can support both Zod and custom schemas.
809
- */
810
- [schemaSymbol]: true;
811
- /**
812
- * Schema type for inference.
813
- */
814
- _type: OBJECT;
815
- /**
816
- * Optional. Validates that the structure of a value matches this schema,
817
- * and returns a typed version of the value if it does.
818
- */
819
- readonly validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
820
- /**
821
- * The JSON Schema for the schema. It is passed to the providers.
822
- */
823
- readonly jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7>;
838
+ /**
839
+ * Used to mark schemas so we can support both Zod and custom schemas.
840
+ */
841
+ [schemaSymbol]: true;
842
+ /**
843
+ * Schema type for inference.
844
+ */
845
+ _type: OBJECT;
846
+ /**
847
+ * Optional. Validates that the structure of a value matches this schema,
848
+ * and returns a typed version of the value if it does.
849
+ */
850
+ readonly validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
851
+ /**
852
+ * The JSON Schema for the schema. It is passed to the providers.
853
+ */
854
+ readonly jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7>;
824
855
  };
825
856
  /**
826
857
  * Creates a schema with deferred creation.
@@ -830,13 +861,13 @@ type Schema<OBJECT = unknown> = {
830
861
  * @param createValidator A function that creates a schema.
831
862
  * @returns A function that returns a schema.
832
863
  */
833
- declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
864
+ export declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
834
865
  type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
835
866
  type ZodSchema<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | $ZodType<SCHEMA, any>;
836
867
  type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
837
- readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
838
- readonly jsonSchema?: StandardJSONSchemaV1.Converter;
839
- };
868
+ readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
869
+ readonly jsonSchema?: StandardJSONSchemaV1.Converter;
870
+ };
840
871
  };
841
872
  type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
842
873
  type InferSchema<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema<infer T> ? T : never;
@@ -846,29 +877,30 @@ type InferSchema<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extend
846
877
  * @param jsonSchema The JSON Schema for the schema.
847
878
  * @param options.validate Optional. A validation function for the schema.
848
879
  */
849
- declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
850
- validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
880
+ export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate }?: {
881
+ validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
851
882
  }): Schema<OBJECT>;
852
- declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
853
- declare function zodSchema<OBJECT>(zodSchema: $ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
854
- /**
855
- * Enables support for references in the schema.
856
- * This is required for recursive schemas, e.g. with `z.lazy`.
857
- * However, not all language models and providers support such references.
858
- * Defaults to `false`.
859
- */
860
- useReferences?: boolean;
883
+ export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
884
+ export declare function zodSchema<OBJECT>(zodSchema: $ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
885
+ /**
886
+ * Enables support for references in the schema.
887
+ * This is required for recursive schemas, e.g. with `z.lazy`.
888
+ * However, not all language models and providers support such references.
889
+ * Defaults to `false`.
890
+ */
891
+ useReferences?: boolean;
861
892
  }): Schema<OBJECT>;
862
-
893
+ //#endregion
894
+ //#region src/parse-json.d.ts
863
895
  /**
864
896
  * Parses a JSON string into an unknown object.
865
897
  *
866
898
  * @param text - The JSON string to parse.
867
899
  * @returns {JSONValue} - The parsed JSON object.
868
900
  */
869
- declare function parseJSON(options: {
870
- text: string;
871
- schema?: undefined;
901
+ export declare function parseJSON(options: {
902
+ text: string;
903
+ schema?: undefined;
872
904
  }): Promise<JSONValue>;
873
905
  /**
874
906
  * Parses a JSON string into a strongly-typed object using the provided schema.
@@ -878,18 +910,18 @@ declare function parseJSON(options: {
878
910
  * @param {Validator<T>} schema - The schema to use for parsing the JSON.
879
911
  * @returns {Promise<T>} - The parsed object.
880
912
  */
881
- declare function parseJSON<T>(options: {
882
- text: string;
883
- schema: FlexibleSchema<T>;
913
+ export declare function parseJSON<T>(options: {
914
+ text: string;
915
+ schema: FlexibleSchema<T>;
884
916
  }): Promise<T>;
885
- type ParseResult<T> = {
886
- success: true;
887
- value: T;
888
- rawValue: unknown;
917
+ export type ParseResult<T> = {
918
+ success: true;
919
+ value: T;
920
+ rawValue: unknown;
889
921
  } | {
890
- success: false;
891
- error: JSONParseError | TypeValidationError;
892
- rawValue: unknown;
922
+ success: false;
923
+ error: JSONParseError | TypeValidationError;
924
+ rawValue: unknown;
893
925
  };
894
926
  /**
895
927
  * Safely parses a JSON string and returns the result as an object of type `unknown`.
@@ -897,9 +929,9 @@ type ParseResult<T> = {
897
929
  * @param text - The JSON string to parse.
898
930
  * @returns {Promise<object>} Either an object with `success: true` and the parsed data, or an object with `success: false` and the error that occurred.
899
931
  */
900
- declare function safeParseJSON(options: {
901
- text: string;
902
- schema?: undefined;
932
+ export declare function safeParseJSON(options: {
933
+ text: string;
934
+ schema?: undefined;
903
935
  }): Promise<ParseResult<JSONValue>>;
904
936
  /**
905
937
  * Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
@@ -909,56 +941,59 @@ declare function safeParseJSON(options: {
909
941
  * @param {Validator<T>} schema - The schema to use for parsing the JSON.
910
942
  * @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
911
943
  */
912
- declare function safeParseJSON<T>(options: {
913
- text: string;
914
- schema: FlexibleSchema<T>;
944
+ export declare function safeParseJSON<T>(options: {
945
+ text: string;
946
+ schema: FlexibleSchema<T>;
915
947
  }): Promise<ParseResult<T>>;
916
- declare function isParsableJson(input: string): boolean;
917
-
918
- type ResponseHandler<RETURN_TYPE> = (options: {
919
- url: string;
920
- requestBodyValues: unknown;
921
- response: Response;
948
+ export declare function isParsableJson(input: string): boolean;
949
+ //#endregion
950
+ //#region src/response-handler.d.ts
951
+ export type ResponseHandler<RETURN_TYPE> = (options: {
952
+ url: string;
953
+ requestBodyValues: unknown;
954
+ response: Response;
922
955
  }) => PromiseLike<{
923
- value: RETURN_TYPE;
924
- rawValue?: unknown;
925
- responseHeaders?: Record<string, string>;
956
+ value: RETURN_TYPE;
957
+ rawValue?: unknown;
958
+ responseHeaders?: Record<string, string>;
926
959
  }>;
927
- declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable, }: {
928
- errorSchema: FlexibleSchema<T>;
929
- errorToMessage: (error: T) => string;
930
- isRetryable?: (response: Response, error?: T) => boolean;
960
+ export declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable }: {
961
+ errorSchema: FlexibleSchema<T>;
962
+ errorToMessage: (error: T) => string;
963
+ isRetryable?: (response: Response, error?: T) => boolean;
931
964
  }) => ResponseHandler<APICallError>;
932
- declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
933
- declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
934
- declare const createJsonLinesResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<AsyncGenerator<T>>;
935
- declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
965
+ export declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
966
+ export declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
967
+ export declare const createJsonLinesResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<AsyncGenerator<T>>;
968
+ export declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
936
969
  /**
937
970
  * Passes the response body through as a `ReadableStream<Uint8Array>` without
938
971
  * buffering it (unlike `createBinaryResponseHandler`). The consumer is
939
972
  * responsible for draining or cancelling the stream.
940
973
  */
941
- declare const createBinaryStreamResponseHandler: () => ResponseHandler<ReadableStream<Uint8Array>>;
942
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
943
-
974
+ export declare const createBinaryStreamResponseHandler: () => ResponseHandler<ReadableStream<Uint8Array>>;
975
+ export declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
976
+ //#endregion
977
+ //#region src/delete-from-api.d.ts
944
978
  /**
945
979
  * Sends a DELETE request. For URLs built from developer-configured endpoints
946
980
  * only — there is no untrusted-URL validation path (use `getFromApi` with
947
981
  * `validateUrl` for response-supplied URLs).
948
982
  */
949
- declare const deleteFromApi: <T>({ url, headers, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
950
- url: string;
951
- headers?: Record<string, string | undefined>;
952
- failedResponseHandler: ResponseHandler<Error>;
953
- successfulResponseHandler: ResponseHandler<T>;
954
- abortSignal?: AbortSignal;
955
- fetch?: FetchFunction;
983
+ export declare const deleteFromApi: <T>({ url, headers, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
984
+ url: string;
985
+ headers?: Record<string, string | undefined>;
986
+ failedResponseHandler: ResponseHandler<Error>;
987
+ successfulResponseHandler: ResponseHandler<T>;
988
+ abortSignal?: AbortSignal;
989
+ fetch?: FetchFunction;
956
990
  }) => Promise<{
957
- value: T;
958
- rawValue?: unknown;
959
- responseHeaders?: Record<string, string>;
991
+ value: T;
992
+ rawValue?: unknown;
993
+ responseHeaders?: Record<string, string>;
960
994
  }>;
961
-
995
+ //#endregion
996
+ //#region src/detect-media-type.d.ts
962
997
  /**
963
998
  * Detect the IANA media type of a file from its raw bytes or base64 string.
964
999
  *
@@ -969,9 +1004,9 @@ declare const deleteFromApi: <T>({ url, headers, failedResponseHandler, successf
969
1004
  * segment are considered. Returns `undefined` for unsupported segments
970
1005
  * (e.g. `"text"`) or when no signature matches.
971
1006
  */
972
- declare function detectMediaType({ data, topLevelType, }: {
973
- data: Uint8Array | string;
974
- topLevelType?: string;
1007
+ export declare function detectMediaType({ data, topLevelType }: {
1008
+ data: Uint8Array | string;
1009
+ topLevelType?: string;
975
1010
  }): string | undefined;
976
1011
  /**
977
1012
  * Returns the top-level segment of a media type (the portion before `/`).
@@ -984,7 +1019,7 @@ declare function detectMediaType({ data, topLevelType, }: {
984
1019
  * - `""` -> `""`
985
1020
  * - `"/"` -> `""`
986
1021
  */
987
- declare function getTopLevelMediaType(mediaType: string): string;
1022
+ export declare function getTopLevelMediaType(mediaType: string): string;
988
1023
  /**
989
1024
  * Returns `true` only when the given media type has a non-empty, non-wildcard
990
1025
  * subtype (i.e. matches the form `type/subtype`, and `subtype` is not `*`).
@@ -997,8 +1032,9 @@ declare function getTopLevelMediaType(mediaType: string): string;
997
1032
  * - `""` -> `false`
998
1033
  * - `"/"` -> `false`
999
1034
  */
1000
- declare function isFullMediaType(mediaType: string): boolean;
1001
-
1035
+ export declare function isFullMediaType(mediaType: string): boolean;
1036
+ //#endregion
1037
+ //#region src/download-blob.d.ts
1002
1038
  /**
1003
1039
  * Download a file from a URL and return it as a Blob.
1004
1040
  *
@@ -1010,27 +1046,29 @@ declare function isFullMediaType(mediaType: string): boolean;
1010
1046
  *
1011
1047
  * @throws DownloadError if the download fails or exceeds maxBytes.
1012
1048
  */
1013
- declare function downloadBlob(url: string, options?: {
1014
- maxBytes?: number;
1015
- abortSignal?: AbortSignal;
1049
+ export declare function downloadBlob(url: string, options?: {
1050
+ maxBytes?: number;
1051
+ abortSignal?: AbortSignal;
1016
1052
  }): Promise<Blob>;
1017
-
1053
+ //#endregion
1054
+ //#region src/download-error.d.ts
1018
1055
  declare const symbol$1: unique symbol;
1019
- declare class DownloadError extends AISDKError {
1020
- private readonly [symbol$1];
1021
- readonly url: string;
1022
- readonly statusCode?: number;
1023
- readonly statusText?: string;
1024
- constructor({ url, statusCode, statusText, cause, message, }: {
1025
- url: string;
1026
- statusCode?: number;
1027
- statusText?: string;
1028
- message?: string;
1029
- cause?: unknown;
1030
- });
1031
- static isInstance(error: unknown): error is DownloadError;
1056
+ export declare class DownloadError extends AISDKError {
1057
+ private readonly [symbol$1];
1058
+ readonly url: string;
1059
+ readonly statusCode?: number;
1060
+ readonly statusText?: string;
1061
+ constructor({ url, statusCode, statusText, cause, message }: {
1062
+ url: string;
1063
+ statusCode?: number;
1064
+ statusText?: string;
1065
+ message?: string;
1066
+ cause?: unknown;
1067
+ });
1068
+ static isInstance(error: unknown): error is DownloadError;
1032
1069
  }
1033
-
1070
+ //#endregion
1071
+ //#region src/embedding-model-capabilities.d.ts
1034
1072
  /**
1035
1073
  * Symbol for exposing the UTF-8 input byte budget of an embedding model.
1036
1074
  *
@@ -1038,7 +1076,22 @@ declare class DownloadError extends AISDKError {
1038
1076
  * embedding model specification.
1039
1077
  */
1040
1078
  declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
1041
-
1079
+ /**
1080
+ * Symbol for transforming provider options for an automatically batched
1081
+ * embedding model call.
1082
+ *
1083
+ * This capability is experimental and intentionally lives outside the versioned
1084
+ * embedding model specification.
1085
+ */
1086
+ declare const EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER: unique symbol;
1087
+ type EmbeddingModelProviderOptionsTransformer = (options: {
1088
+ providerOptions: SharedV4ProviderOptions | undefined;
1089
+ values: Array<string>;
1090
+ startIndex: number;
1091
+ endIndex: number;
1092
+ }) => SharedV4ProviderOptions | undefined | PromiseLike<SharedV4ProviderOptions | undefined>;
1093
+ //#endregion
1094
+ //#region src/fetch-with-validated-redirects.d.ts
1042
1095
  /**
1043
1096
  * Fetches one validated URL without following redirects.
1044
1097
  *
@@ -1047,16 +1100,16 @@ declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
1047
1100
  * Redirects are rejected by default. Callers using `redirect: 'manual'` must
1048
1101
  * validate the Location target before issuing another request.
1049
1102
  */
1050
- declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
1051
- url: string | URL;
1052
- init?: RequestInit;
1053
- fetch?: FetchFunction;
1054
- /**
1055
- * A developer-configured origin that may legitimately resolve to a private
1056
- * address. This must never be derived from untrusted response data.
1057
- */
1058
- trustedOrigin?: string;
1059
- redirect?: 'error' | 'manual';
1103
+ export declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect }: {
1104
+ url: string | URL;
1105
+ init?: RequestInit;
1106
+ fetch?: FetchFunction;
1107
+ /**
1108
+ * A developer-configured origin that may legitimately resolve to a private
1109
+ * address. This must never be derived from untrusted response data.
1110
+ */
1111
+ trustedOrigin?: string;
1112
+ redirect?: 'error' | 'manual';
1060
1113
  }): Promise<Response>;
1061
1114
  /**
1062
1115
  * Fetches a URL while enforcing the download guard on every hop.
@@ -1070,6 +1123,9 @@ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, tru
1070
1123
  * Request headers are also protected: {@link sanitizeRequestHeaders} strips
1071
1124
  * proxy/metadata/cookie/hop-by-hop headers before the first request, and all
1072
1125
  * caller headers except `User-Agent` are dropped on a cross-origin redirect.
1126
+ * Credentials and custom headers are preserved on the first hop for backwards
1127
+ * compatibility. The caller must ensure that the initial URL may receive them.
1128
+ * Use `fetchUntrustedUrl` for URLs that require first-hop credential isolation.
1073
1129
  * The fetch spec only strips `Authorization` on cross-origin redirects because
1074
1130
  * in a browser, CORS preflighting protects custom headers; there is no CORS on
1075
1131
  * the server, so provider API keys carried in custom headers (e.g. `x-key`)
@@ -1102,19 +1158,20 @@ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, tru
1102
1158
  * @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
1103
1159
  * a redirect cannot be validated on a non-browser runtime.
1104
1160
  */
1105
- declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin, }: {
1106
- url: string;
1107
- headers?: HeadersInit;
1108
- abortSignal?: AbortSignal;
1109
- maxRedirects?: number;
1110
- fetch?: FetchFunction;
1111
- /**
1112
- * A developer-configured origin (e.g. the provider's `baseURL`) whose hops
1113
- * skip target validation. Must never be derived from response data.
1114
- */
1115
- trustedOrigin?: string;
1161
+ export declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin }: {
1162
+ url: string;
1163
+ headers?: HeadersInit;
1164
+ abortSignal?: AbortSignal;
1165
+ maxRedirects?: number;
1166
+ fetch?: FetchFunction;
1167
+ /**
1168
+ * A developer-configured origin (e.g. the provider's `baseURL`) whose hops
1169
+ * skip target validation. Must never be derived from response data.
1170
+ */
1171
+ trustedOrigin?: string;
1116
1172
  }): Promise<Response>;
1117
-
1173
+ //#endregion
1174
+ //#region src/extract-lines.d.ts
1118
1175
  /**
1119
1176
  * Extracts a 1-based inclusive line range from `text`, auto-detecting the
1120
1177
  * file's line ending (`\r\n`, `\n`, or `\r`, in that priority).
@@ -1124,30 +1181,69 @@ declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRed
1124
1181
  * cleanly. When neither `startLine` nor `endLine` is provided, the input is
1125
1182
  * returned unchanged. `endLine` past EOF clamps to the last line.
1126
1183
  */
1127
- declare function extractLines({ text, startLine, endLine, }: {
1128
- text: string;
1129
- startLine?: number;
1130
- endLine?: number;
1184
+ export declare function extractLines({ text, startLine, endLine }: {
1185
+ text: string;
1186
+ startLine?: number;
1187
+ endLine?: number;
1131
1188
  }): string;
1132
-
1189
+ //#endregion
1190
+ //#region src/extract-response-headers.d.ts
1133
1191
  /**
1134
1192
  * Extracts the headers from a response object and returns them as a key-value object.
1135
1193
  *
1136
1194
  * @param response - The response object to extract headers from.
1137
1195
  * @returns The headers as a key-value object.
1138
1196
  */
1139
- declare function extractResponseHeaders(response: Response): {
1140
- [k: string]: string;
1197
+ export declare function extractResponseHeaders(response: Response): {
1198
+ [k: string]: string;
1141
1199
  };
1142
-
1200
+ //#endregion
1201
+ //#region src/fetch-untrusted-url.d.ts
1202
+ /**
1203
+ * Fetches an untrusted URL with first-hop credential isolation and validated
1204
+ * redirects. Uses the URL validation, DNS-pinned Node.js transport, redirect
1205
+ * limits, and cross-origin header stripping of {@link fetchWithValidatedRedirects}.
1206
+ * An injected fetch must provide equivalent connect-time DNS validation.
1207
+ *
1208
+ * Without a matching `credentialedOrigin` (or `trustedOrigin` when it is
1209
+ * omitted), only allowlisted request metadata is sent on the first hop.
1210
+ * Arbitrary caller headers require an explicit matching origin because vendor
1211
+ * credential names cannot be inferred safely. Proxy, metadata, cookie, and
1212
+ * hop-by-hop headers are sanitized even for a matching origin.
1213
+ *
1214
+ * `trustedOrigin` also exempts same-origin hops from URL validation, allowing
1215
+ * developer-configured private endpoints. Both origin options must come from
1216
+ * developer configuration, never from untrusted response data.
1217
+ *
1218
+ * This is an opt-in alternative to `fetchWithValidatedRedirects`, whose
1219
+ * existing first-hop header behavior is preserved for compatibility.
1220
+ */
1221
+ export declare function fetchUntrustedUrl({ headers, credentialedOrigin, untrustedFirstHopHeaders, ...options }: Parameters<typeof fetchWithValidatedRedirects>[0] & {
1222
+ /**
1223
+ * The developer-configured origin allowed to receive arbitrary caller
1224
+ * headers on the first hop. Defaults to `trustedOrigin` when omitted.
1225
+ * An explicit value takes precedence over `trustedOrigin` and does not
1226
+ * exempt the URL from validation.
1227
+ */
1228
+ credentialedOrigin?: string;
1229
+ /**
1230
+ * Additional sanitized header names safe to disclose to an untrusted first
1231
+ * hop. Use only for non-credential protocol metadata. Credentials require
1232
+ * a matching `credentialedOrigin` instead. Names are case-insensitive.
1233
+ */
1234
+ untrustedFirstHopHeaders?: readonly string[];
1235
+ }): Promise<Response>;
1236
+ //#endregion
1237
+ //#region src/filter-nullable.d.ts
1143
1238
  /**
1144
1239
  * Filters `null` and `undefined` values out of a list of values.
1145
1240
  *
1146
1241
  * @param values - The values to filter.
1147
1242
  * @returns A new array containing only non-nullish values.
1148
1243
  */
1149
- declare function filterNullable<T>(...values: Array<T | undefined | null>): Array<T>;
1150
-
1244
+ export declare function filterNullable<T>(...values: Array<T | undefined | null>): Array<T>;
1245
+ //#endregion
1246
+ //#region src/generate-id.d.ts
1151
1247
  /**
1152
1248
  * Creates an ID generator.
1153
1249
  * The total length of the ID is the sum of the prefix, separator, and random part length.
@@ -1158,11 +1254,11 @@ declare function filterNullable<T>(...values: Array<T | undefined | null>): Arra
1158
1254
  * @param separator - The separator between the prefix and the random part of the ID. Default: '-'.
1159
1255
  * @param size - The size of the random part of the ID to generate. Default: 16.
1160
1256
  */
1161
- declare const createIdGenerator: ({ prefix, size, alphabet, separator, }?: {
1162
- prefix?: string;
1163
- separator?: string;
1164
- size?: number;
1165
- alphabet?: string;
1257
+ export declare const createIdGenerator: ({ prefix, size, alphabet, separator }?: {
1258
+ prefix?: string;
1259
+ separator?: string;
1260
+ size?: number;
1261
+ alphabet?: string;
1166
1262
  }) => IdGenerator;
1167
1263
  /**
1168
1264
  * A function that generates an ID.
@@ -1172,72 +1268,78 @@ type IdGenerator = () => string;
1172
1268
  * Generates a 16-character random string to use for IDs.
1173
1269
  * Not cryptographically secure.
1174
1270
  */
1175
- declare const generateId: IdGenerator;
1176
-
1177
- declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin, }: {
1178
- url: string;
1179
- headers?: Record<string, string | undefined>;
1180
- failedResponseHandler: ResponseHandler<Error>;
1181
- successfulResponseHandler: ResponseHandler<T>;
1182
- abortSignal?: AbortSignal;
1183
- fetch?: FetchFunction;
1184
- /**
1185
- * Set `true` when `url` is untrusted (e.g. taken from a provider response
1186
- * body): it is routed through {@link fetchWithValidatedRedirects}, which
1187
- * rejects private/loopback/link-local targets and re-validates redirect
1188
- * hops; blocked URLs throw `DownloadError`. Set `false` only for URLs built
1189
- * from a developer-configured endpoint.
1190
- *
1191
- * Optional for backwards compatibility with existing callers; omitting it
1192
- * behaves like `false` (no validation). Provider code in this repository
1193
- * must always pass it explicitly so every call site makes a visible trust
1194
- * decision — see `contributing/secure-url-handling.md`.
1195
- */
1196
- validateUrl?: boolean;
1197
- /**
1198
- * When set, `headers` are sent only if `url` is same-origin with this origin
1199
- * (the user-agent suffix is always kept). Pass the provider's configured
1200
- * base URL alongside `validateUrl: true` so credentials never ride a request
1201
- * to a response-supplied host on a different origin (e.g. a CDN). Redirects
1202
- * that later cross origin drop all caller headers regardless (see
1203
- * {@link fetchWithValidatedRedirects}).
1204
- */
1205
- credentialedOrigin?: string;
1206
- /**
1207
- * A developer-configured origin (e.g. the provider's `baseURL`) that is
1208
- * exempt from URL validation when `validateUrl` is `true`. A response URL
1209
- * (or redirect hop) that is same-origin with it is fetched without target
1210
- * validation — it points at exactly the host a config-derived
1211
- * `validateUrl: false` request would fetch anyway, so blocking it would
1212
- * only break legitimate self-hosted / localhost deployments whose response
1213
- * URLs point back at the configured host. Hops on any other origin are
1214
- * still validated. Must never be derived from response data.
1215
- */
1216
- trustedOrigin?: string;
1271
+ export declare const generateId: IdGenerator;
1272
+ //#endregion
1273
+ //#region src/get-from-api.d.ts
1274
+ export declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin }: {
1275
+ url: string;
1276
+ headers?: Record<string, string | undefined>;
1277
+ failedResponseHandler: ResponseHandler<Error>;
1278
+ successfulResponseHandler: ResponseHandler<T>;
1279
+ abortSignal?: AbortSignal;
1280
+ fetch?: FetchFunction;
1281
+ /**
1282
+ * Set `true` when `url` is untrusted (e.g. taken from a provider response
1283
+ * body): it is routed through {@link fetchWithValidatedRedirects}, which
1284
+ * rejects private/loopback/link-local targets and re-validates redirect
1285
+ * hops; blocked URLs throw `DownloadError`. Set `false` only for URLs built
1286
+ * from a developer-configured endpoint.
1287
+ *
1288
+ * Optional for backwards compatibility with existing callers; omitting it
1289
+ * behaves like `false` (no validation). Provider code in this repository
1290
+ * must always pass it explicitly so every call site makes a visible trust
1291
+ * decision — see `contributing/secure-url-handling.md`.
1292
+ */
1293
+ validateUrl?: boolean;
1294
+ /**
1295
+ * When set, `headers` are sent only if `url` is same-origin with this origin
1296
+ * (the user-agent suffix is always kept). Pass the provider's configured
1297
+ * base URL alongside `validateUrl: true` so credentials never ride a request
1298
+ * to a response-supplied host on a different origin (e.g. a CDN). Redirects
1299
+ * that later cross origin drop all caller headers regardless (see
1300
+ * {@link fetchWithValidatedRedirects}).
1301
+ */
1302
+ credentialedOrigin?: string;
1303
+ /**
1304
+ * A developer-configured origin (e.g. the provider's `baseURL`) that is
1305
+ * exempt from URL validation when `validateUrl` is `true`. A response URL
1306
+ * (or redirect hop) that is same-origin with it is fetched without target
1307
+ * validation — it points at exactly the host a config-derived
1308
+ * `validateUrl: false` request would fetch anyway, so blocking it would
1309
+ * only break legitimate self-hosted / localhost deployments whose response
1310
+ * URLs point back at the configured host. Hops on any other origin are
1311
+ * still validated. Must never be derived from response data.
1312
+ */
1313
+ trustedOrigin?: string;
1217
1314
  }) => Promise<{
1218
- value: T;
1219
- rawValue?: unknown;
1220
- responseHeaders?: Record<string, string>;
1315
+ value: T;
1316
+ rawValue?: unknown;
1317
+ responseHeaders?: Record<string, string>;
1221
1318
  }>;
1222
-
1223
- declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
1224
-
1319
+ //#endregion
1320
+ //#region src/get-runtime-environment-user-agent.d.ts
1321
+ export declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
1322
+ //#endregion
1323
+ //#region src/has-required-key.d.ts
1225
1324
  /**
1226
1325
  * Checks if an object has required keys.
1227
1326
  * @param OBJECT - The object to check.
1228
1327
  * @returns True if the object has required keys, false otherwise.
1229
1328
  */
1230
1329
  type HasRequiredKey<OBJECT> = {} extends OBJECT ? false : true;
1231
-
1232
- declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
1233
- messages: LanguageModelV4Prompt;
1234
- schema?: JSONSchema7;
1235
- schemaPrefix?: string;
1236
- schemaSuffix?: string;
1330
+ //#endregion
1331
+ //#region src/inject-json-instruction.d.ts
1332
+ export declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix }: {
1333
+ messages: LanguageModelV4Prompt;
1334
+ schema?: JSONSchema7;
1335
+ schemaPrefix?: string;
1336
+ schemaSuffix?: string;
1237
1337
  }): LanguageModelV4Prompt;
1238
-
1239
- declare function isAbortError(error: unknown): error is Error;
1240
-
1338
+ //#endregion
1339
+ //#region src/is-abort-error.d.ts
1340
+ export declare function isAbortError(error: unknown): error is Error;
1341
+ //#endregion
1342
+ //#region src/is-browser-runtime.d.ts
1241
1343
  /**
1242
1344
  * Returns `true` when running in a browser.
1243
1345
  *
@@ -1246,16 +1348,18 @@ declare function isAbortError(error: unknown): error is Error;
1246
1348
  * so the SDK has a single, consistent definition of "browser". Server runtimes
1247
1349
  * (Node.js, Deno, Bun, edge/workers) do not define `window`.
1248
1350
  */
1249
- declare function isBrowserRuntime(globalThisAny?: any): boolean;
1250
-
1351
+ export declare function isBrowserRuntime(globalThisAny?: any): boolean;
1352
+ //#endregion
1353
+ //#region src/is-buffer.d.ts
1251
1354
  /**
1252
1355
  * Type-guard for Node.js `Buffer` instances.
1253
1356
  *
1254
1357
  * Uses optional chaining on `globalThis.Buffer` so it returns `false` in
1255
1358
  * runtimes where `Buffer` is not available (e.g. CloudFlare Workers).
1256
1359
  */
1257
- declare function isBuffer(value: unknown): value is Buffer;
1258
-
1360
+ export declare function isBuffer(value: unknown): value is Buffer;
1361
+ //#endregion
1362
+ //#region src/is-same-origin.d.ts
1259
1363
  /**
1260
1364
  * Returns true when `url` has the same origin (scheme + host + port) as
1261
1365
  * `baseUrl`.
@@ -1268,8 +1372,9 @@ declare function isBuffer(value: unknown): value is Buffer;
1268
1372
  *
1269
1373
  * Returns false if either value is not a valid absolute URL (fail-closed).
1270
1374
  */
1271
- declare function isSameOrigin(url: string, baseUrl: string): boolean;
1272
-
1375
+ export declare function isSameOrigin(url: string, baseUrl: string): boolean;
1376
+ //#endregion
1377
+ //#region src/is-non-nullable.d.ts
1273
1378
  /**
1274
1379
  * Type guard that checks whether a value is not `null` or `undefined`.
1275
1380
  *
@@ -1277,46 +1382,62 @@ declare function isSameOrigin(url: string, baseUrl: string): boolean;
1277
1382
  * @param value - The value to check.
1278
1383
  * @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
1279
1384
  */
1280
- declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
1281
-
1385
+ export declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
1386
+ //#endregion
1387
+ //#region src/is-provider-reference.d.ts
1282
1388
  /**
1283
1389
  * Checks whether a value is a provider reference (a mapping of provider names
1284
1390
  * to provider-specific identifiers) as opposed to raw bytes, a URL, or a
1285
1391
  * tagged `{ type: ... }` object.
1286
1392
  */
1287
- declare function isProviderReference(data: unknown): data is SharedV4ProviderReference;
1288
-
1393
+ export declare function isProviderReference(data: unknown): data is SharedV4ProviderReference;
1394
+ //#endregion
1395
+ //#region src/is-record.d.ts
1289
1396
  /**
1290
1397
  * Checks whether a value is a non-null, non-array object.
1291
1398
  */
1292
- declare function isRecord(value: unknown): value is Record<string, unknown>;
1293
-
1399
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
1400
+ //#endregion
1401
+ //#region src/is-url-supported.d.ts
1294
1402
  /**
1295
1403
  * Checks if the given URL is supported natively by the model.
1296
1404
  *
1297
- * @param mediaType - The media type of the URL. Case-sensitive. May be a full
1405
+ * @param mediaType - The media type of the URL. Case-insensitive. May be a full
1298
1406
  * `type/subtype`, a wildcard `type/*`, or just the
1299
1407
  * top-level segment (e.g. `image`).
1300
1408
  * @param url - The URL to check.
1301
- * @param supportedUrls - A record where keys are case-sensitive media types (or '*')
1409
+ * @param supportedUrls - A record where keys are case-insensitive media types (or '*')
1302
1410
  * and values are arrays of RegExp patterns for URLs.
1303
1411
  *
1304
1412
  * @returns `true` if the URL matches a pattern under the specific media type
1305
1413
  * or the wildcard '*', `false` otherwise.
1306
1414
  */
1307
- declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
1308
- mediaType: string;
1309
- url: string;
1310
- supportedUrls: Record<string, RegExp[]>;
1415
+ export declare function isUrlSupported({ mediaType, url, supportedUrls }: {
1416
+ mediaType: string;
1417
+ url: string;
1418
+ supportedUrls: Record<string, RegExp[]>;
1311
1419
  }): boolean;
1312
-
1313
- declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description, }: {
1314
- apiKey: string | undefined;
1315
- environmentVariableName: string;
1316
- apiKeyParameterName?: string;
1317
- description: string;
1420
+ //#endregion
1421
+ //#region src/is-valid-hostname-part.d.ts
1422
+ /**
1423
+ * Checks whether a value is a valid ASCII hostname part: 1–63 letters, digits,
1424
+ * or hyphens, without a leading or trailing hyphen.
1425
+ *
1426
+ * Use this before inserting a resource name, region, or location into a
1427
+ * generated hostname. Rejects values such as `evil.example.com/#` and
1428
+ * `user@localhost:8080/#` that could change the request destination.
1429
+ */
1430
+ export declare function isValidHostnamePart(value: string): boolean;
1431
+ //#endregion
1432
+ //#region src/load-api-key.d.ts
1433
+ export declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description }: {
1434
+ apiKey: string | undefined;
1435
+ environmentVariableName: string;
1436
+ apiKeyParameterName?: string;
1437
+ description: string;
1318
1438
  }): string;
1319
-
1439
+ //#endregion
1440
+ //#region src/load-optional-setting.d.ts
1320
1441
  /**
1321
1442
  * Loads an optional `string` setting from the environment or a parameter.
1322
1443
  *
@@ -1324,11 +1445,12 @@ declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterNa
1324
1445
  * @param environmentVariableName - The environment variable name.
1325
1446
  * @returns The setting value.
1326
1447
  */
1327
- declare function loadOptionalSetting({ settingValue, environmentVariableName, }: {
1328
- settingValue: string | undefined;
1329
- environmentVariableName: string;
1448
+ export declare function loadOptionalSetting({ settingValue, environmentVariableName }: {
1449
+ settingValue: string | undefined;
1450
+ environmentVariableName: string;
1330
1451
  }): string | undefined;
1331
-
1452
+ //#endregion
1453
+ //#region src/load-setting.d.ts
1332
1454
  /**
1333
1455
  * Loads a `string` setting from the environment or a parameter.
1334
1456
  *
@@ -1338,15 +1460,16 @@ declare function loadOptionalSetting({ settingValue, environmentVariableName, }:
1338
1460
  * @param description - The description of the setting.
1339
1461
  * @returns The setting value.
1340
1462
  */
1341
- declare function loadSetting({ settingValue, environmentVariableName, settingName, description, }: {
1342
- settingValue: string | undefined;
1343
- environmentVariableName: string;
1344
- settingName: string;
1345
- description: string;
1463
+ export declare function loadSetting({ settingValue, environmentVariableName, settingName, description }: {
1464
+ settingValue: string | undefined;
1465
+ environmentVariableName: string;
1466
+ settingName: string;
1467
+ description: string;
1346
1468
  }): string;
1347
-
1469
+ //#endregion
1470
+ //#region src/map-reasoning-to-provider.d.ts
1348
1471
  type ReasoningLevel = Exclude<LanguageModelV4CallOptions['reasoning'], 'none' | 'provider-default' | undefined>;
1349
- declare function isCustomReasoning(reasoning: LanguageModelV4CallOptions['reasoning']): reasoning is Exclude<LanguageModelV4CallOptions['reasoning'], 'provider-default' | undefined>;
1472
+ export declare function isCustomReasoning(reasoning: LanguageModelV4CallOptions['reasoning']): reasoning is Exclude<LanguageModelV4CallOptions['reasoning'], 'provider-default' | undefined>;
1350
1473
  /**
1351
1474
  * Maps a top-level reasoning level to a provider-specific effort string using
1352
1475
  * the given effort map. Pushes a compatibility warning if the reasoning level
@@ -1356,10 +1479,10 @@ declare function isCustomReasoning(reasoning: LanguageModelV4CallOptions['reason
1356
1479
  * @returns The mapped effort string, or `undefined` if the level is not
1357
1480
  * supported.
1358
1481
  */
1359
- declare function mapReasoningToProviderEffort<T extends string>({ reasoning, effortMap, warnings, }: {
1360
- reasoning: ReasoningLevel;
1361
- effortMap: Partial<Record<ReasoningLevel, T>>;
1362
- warnings: SharedV4Warning[];
1482
+ export declare function mapReasoningToProviderEffort<T extends string>({ reasoning, effortMap, warnings }: {
1483
+ reasoning: ReasoningLevel;
1484
+ effortMap: Partial<Record<ReasoningLevel, T>>;
1485
+ warnings: SharedV4Warning[];
1363
1486
  }): T | undefined;
1364
1487
  /**
1365
1488
  * Maps a top-level reasoning level to an absolute token budget by multiplying
@@ -1371,20 +1494,22 @@ declare function mapReasoningToProviderEffort<T extends string>({ reasoning, eff
1371
1494
  * @returns The computed token budget, or `undefined` if the level is not
1372
1495
  * supported.
1373
1496
  */
1374
- declare function mapReasoningToProviderBudget({ reasoning, maxOutputTokens, maxReasoningBudget, minReasoningBudget, budgetPercentages, warnings, }: {
1375
- reasoning: ReasoningLevel;
1376
- maxOutputTokens: number;
1377
- maxReasoningBudget: number;
1378
- minReasoningBudget?: number;
1379
- budgetPercentages?: Partial<Record<ReasoningLevel, number>>;
1380
- warnings: SharedV4Warning[];
1497
+ export declare function mapReasoningToProviderBudget({ reasoning, maxOutputTokens, maxReasoningBudget, minReasoningBudget, budgetPercentages, warnings }: {
1498
+ reasoning: ReasoningLevel;
1499
+ maxOutputTokens: number;
1500
+ maxReasoningBudget: number;
1501
+ minReasoningBudget?: number;
1502
+ budgetPercentages?: Partial<Record<ReasoningLevel, number>>;
1503
+ warnings: SharedV4Warning[];
1381
1504
  }): number | undefined;
1382
-
1505
+ //#endregion
1506
+ //#region src/maybe-promise-like.d.ts
1383
1507
  /**
1384
1508
  * A value that can be provided either synchronously or as a promise-like.
1385
1509
  */
1386
1510
  type MaybePromiseLike<T> = T | PromiseLike<T>;
1387
-
1511
+ //#endregion
1512
+ //#region src/media-type-to-extension.d.ts
1388
1513
  /**
1389
1514
  * Maps a media type to its corresponding file extension.
1390
1515
  * It was originally introduced to set a filename for audio file uploads
@@ -1394,8 +1519,9 @@ type MaybePromiseLike<T> = T | PromiseLike<T>;
1394
1519
  * @returns The corresponding file extension
1395
1520
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types
1396
1521
  */
1397
- declare function mediaTypeToExtension(mediaType: string): string;
1398
-
1522
+ export declare function mediaTypeToExtension(mediaType: string): string;
1523
+ //#endregion
1524
+ //#region src/normalize-headers.d.ts
1399
1525
  /**
1400
1526
  * Normalizes different header inputs into a plain record with lower-case keys.
1401
1527
  * Entries with `undefined` or `null` values are removed.
@@ -1403,51 +1529,55 @@ declare function mediaTypeToExtension(mediaType: string): string;
1403
1529
  * @param headers - Input headers (`Headers`, tuples array, plain record) to normalize.
1404
1530
  * @returns A record containing the normalized header entries.
1405
1531
  */
1406
- declare function normalizeHeaders(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
1407
-
1532
+ export declare function normalizeHeaders(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
1533
+ //#endregion
1534
+ //#region src/normalize-batch-request-counts.d.ts
1408
1535
  /**
1409
1536
  * Normalizes complete batch request counts.
1410
1537
  *
1411
1538
  * Returns `undefined` when any count is missing, is not a non-negative safe
1412
1539
  * integer, or when the item counts do not add up to the total.
1413
1540
  */
1414
- declare function normalizeBatchRequestCounts({ total, pending, completed, failed, }: {
1415
- total: number | null | undefined;
1416
- pending: number | null | undefined;
1417
- completed: number | null | undefined;
1418
- failed: number | null | undefined;
1541
+ export declare function normalizeBatchRequestCounts({ total, pending, completed, failed }: {
1542
+ total: number | null | undefined;
1543
+ pending: number | null | undefined;
1544
+ completed: number | null | undefined;
1545
+ failed: number | null | undefined;
1419
1546
  }): Experimental_BatchV4Status['requestCounts'] | undefined;
1420
-
1547
+ //#endregion
1548
+ //#region src/parse-json-event-stream.d.ts
1421
1549
  /**
1422
1550
  * Parses a JSON event stream into a stream of parsed JSON objects.
1423
1551
  */
1424
- declare function parseJsonEventStream<T>({ stream, schema, }: {
1425
- stream: ReadableStream<Uint8Array>;
1426
- schema: FlexibleSchema<T>;
1552
+ export declare function parseJsonEventStream<T>({ stream, schema }: {
1553
+ stream: ReadableStream<Uint8Array>;
1554
+ schema: FlexibleSchema<T>;
1427
1555
  }): ReadableStream<ParseResult<T>>;
1428
-
1429
- declare function parseProviderOptions<OPTIONS>({ provider, providerOptions, schema, }: {
1430
- provider: string;
1431
- providerOptions: Record<string, unknown> | undefined;
1432
- schema: FlexibleSchema<OPTIONS>;
1556
+ //#endregion
1557
+ //#region src/parse-provider-options.d.ts
1558
+ export declare function parseProviderOptions<OPTIONS>({ provider, providerOptions, schema }: {
1559
+ provider: string;
1560
+ providerOptions: Record<string, unknown> | undefined;
1561
+ schema: FlexibleSchema<OPTIONS>;
1433
1562
  }): Promise<OPTIONS | undefined>;
1434
-
1563
+ //#endregion
1564
+ //#region src/post-multipart-stream-to-api.d.ts
1435
1565
  /**
1436
1566
  * A part of a streaming multipart/form-data request body.
1437
1567
  *
1438
1568
  * Parts are emitted in array order, which providers may depend on
1439
1569
  * (e.g. xAI requires expiry fields to precede the file part).
1440
1570
  */
1441
- type MultipartStreamPart = {
1442
- type: 'field';
1443
- name: string;
1444
- value: string;
1571
+ export type MultipartStreamPart = {
1572
+ type: 'field';
1573
+ name: string;
1574
+ value: string;
1445
1575
  } | {
1446
- type: 'file';
1447
- name: string;
1448
- filename?: string;
1449
- mediaType?: string;
1450
- content: ReadableStream<Uint8Array> | Uint8Array;
1576
+ type: 'file';
1577
+ name: string;
1578
+ filename?: string;
1579
+ mediaType?: string;
1580
+ content: ReadableStream<Uint8Array> | Uint8Array;
1451
1581
  };
1452
1582
  /**
1453
1583
  * POSTs a multipart/form-data body as a request stream, so file parts backed
@@ -1457,130 +1587,144 @@ type MultipartStreamPart = {
1457
1587
  * (`duplex: 'half'`). Callers with fully buffered payloads can keep using
1458
1588
  * `postFormDataToApi`.
1459
1589
  */
1460
- declare const postMultipartStreamToApi: <T>({ url, headers, parts, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
1461
- url: string;
1462
- headers?: Record<string, string | undefined>;
1463
- parts: Array<MultipartStreamPart>;
1464
- failedResponseHandler: ResponseHandler<Error>;
1465
- successfulResponseHandler: ResponseHandler<T>;
1466
- abortSignal?: AbortSignal;
1467
- fetch?: FetchFunction;
1590
+ export declare const postMultipartStreamToApi: <T>({ url, headers, parts, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
1591
+ url: string;
1592
+ headers?: Record<string, string | undefined>;
1593
+ parts: Array<MultipartStreamPart>;
1594
+ failedResponseHandler: ResponseHandler<Error>;
1595
+ successfulResponseHandler: ResponseHandler<T>;
1596
+ abortSignal?: AbortSignal;
1597
+ fetch?: FetchFunction;
1468
1598
  }) => Promise<{
1469
- value: T;
1470
- rawValue?: unknown;
1471
- responseHeaders?: Record<string, string>;
1599
+ value: T;
1600
+ rawValue?: unknown;
1601
+ responseHeaders?: Record<string, string>;
1472
1602
  }>;
1473
-
1474
- declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
1475
- url: string;
1476
- headers?: Record<string, string | undefined>;
1477
- body: unknown;
1478
- failedResponseHandler: ResponseHandler<APICallError>;
1479
- successfulResponseHandler: ResponseHandler<T>;
1480
- abortSignal?: AbortSignal;
1481
- fetch?: FetchFunction;
1603
+ //#endregion
1604
+ //#region src/post-to-api.d.ts
1605
+ export declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
1606
+ url: string;
1607
+ headers?: Record<string, string | undefined>;
1608
+ body: unknown;
1609
+ failedResponseHandler: ResponseHandler<APICallError>;
1610
+ successfulResponseHandler: ResponseHandler<T>;
1611
+ abortSignal?: AbortSignal;
1612
+ fetch?: FetchFunction;
1482
1613
  }) => Promise<{
1483
- value: T;
1484
- rawValue?: unknown;
1485
- responseHeaders?: Record<string, string>;
1614
+ value: T;
1615
+ rawValue?: unknown;
1616
+ responseHeaders?: Record<string, string>;
1486
1617
  }>;
1487
- declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
1488
- url: string;
1489
- headers?: Record<string, string | undefined>;
1490
- formData: FormData;
1491
- failedResponseHandler: ResponseHandler<APICallError>;
1492
- successfulResponseHandler: ResponseHandler<T>;
1493
- abortSignal?: AbortSignal;
1494
- fetch?: FetchFunction;
1618
+ export declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
1619
+ url: string;
1620
+ headers?: Record<string, string | undefined>;
1621
+ formData: FormData;
1622
+ failedResponseHandler: ResponseHandler<APICallError>;
1623
+ successfulResponseHandler: ResponseHandler<T>;
1624
+ abortSignal?: AbortSignal;
1625
+ fetch?: FetchFunction;
1495
1626
  }) => Promise<{
1496
- value: T;
1497
- rawValue?: unknown;
1498
- responseHeaders?: Record<string, string>;
1627
+ value: T;
1628
+ rawValue?: unknown;
1629
+ responseHeaders?: Record<string, string>;
1499
1630
  }>;
1500
- declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
1501
- url: string;
1502
- headers?: Record<string, string | undefined>;
1503
- body: {
1504
- content: string | FormData | Uint8Array | Blob;
1505
- values: unknown;
1506
- };
1507
- failedResponseHandler: ResponseHandler<Error>;
1508
- successfulResponseHandler: ResponseHandler<T>;
1509
- abortSignal?: AbortSignal;
1510
- fetch?: FetchFunction;
1631
+ export declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch }: {
1632
+ url: string;
1633
+ headers?: Record<string, string | undefined>;
1634
+ body: {
1635
+ content: string | FormData | Uint8Array | Blob;
1636
+ values: unknown;
1637
+ };
1638
+ failedResponseHandler: ResponseHandler<Error>;
1639
+ successfulResponseHandler: ResponseHandler<T>;
1640
+ abortSignal?: AbortSignal;
1641
+ fetch?: FetchFunction;
1511
1642
  }) => Promise<{
1512
- value: T;
1513
- rawValue?: unknown;
1514
- responseHeaders?: Record<string, string>;
1643
+ value: T;
1644
+ rawValue?: unknown;
1645
+ responseHeaders?: Record<string, string>;
1515
1646
  }>;
1516
-
1647
+ //#endregion
1648
+ //#region src/types/context.d.ts
1517
1649
  /**
1518
1650
  * A context object that is passed into tool execution.
1519
1651
  */
1520
1652
  type Context = Record<string, unknown>;
1521
-
1653
+ //#endregion
1654
+ //#region src/types/executable-tool.d.ts
1522
1655
  /**
1523
1656
  * A tool that is guaranteed to expose an execute function.
1524
1657
  */
1525
1658
  type ExecutableTool<TOOL extends Tool = Tool> = TOOL & {
1526
- execute: NonNullable<TOOL['execute']>;
1659
+ execute: NonNullable<TOOL['execute']>;
1527
1660
  };
1528
1661
  /**
1529
1662
  * Checks whether a tool exposes an execute function.
1530
1663
  */
1531
- declare function isExecutableTool<TOOL extends Tool>(tool: TOOL | undefined): tool is ExecutableTool<TOOL>;
1532
-
1664
+ export declare function isExecutableTool<TOOL extends Tool>(tool: TOOL | undefined): tool is ExecutableTool<TOOL>;
1665
+ //#endregion
1666
+ //#region src/types/never-optional.d.ts
1533
1667
  type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
1534
-
1668
+ //#endregion
1669
+ //#region src/types/tool-approval-request.d.ts
1535
1670
  /**
1536
1671
  * Tool approval request prompt part.
1537
1672
  */
1538
1673
  type ToolApprovalRequest = {
1539
- type: 'tool-approval-request';
1540
- /**
1541
- * ID of the tool approval.
1542
- */
1543
- approvalId: string;
1544
- /**
1545
- * ID of the tool call that the approval request is for.
1546
- */
1547
- toolCallId: string;
1548
- /**
1549
- * Reason why the tool call requires approval.
1550
- */
1551
- reason?: string;
1552
- /**
1553
- * Flag indicating whether the tool was automatically approved or denied.
1554
- *
1555
- * @default false
1556
- */
1557
- isAutomatic?: boolean;
1558
- /**
1559
- * HMAC-SHA256 signature binding this approval to its tool call.
1560
- * Present only when `experimental_toolApprovalSecret` is configured.
1561
- */
1562
- signature?: string;
1674
+ type: 'tool-approval-request';
1675
+ /**
1676
+ * ID of the tool approval.
1677
+ */
1678
+ approvalId: string;
1679
+ /**
1680
+ * ID of the tool call that the approval request is for.
1681
+ */
1682
+ toolCallId: string;
1683
+ /**
1684
+ * Reason why the tool call requires approval.
1685
+ */
1686
+ reason?: string;
1687
+ /**
1688
+ * Flag indicating whether the tool was automatically approved or denied.
1689
+ *
1690
+ * @default false
1691
+ */
1692
+ isAutomatic?: boolean;
1693
+ /**
1694
+ * HMAC-SHA256 signature binding this approval to its tool call.
1695
+ * Present only when `experimental_toolApprovalSecret` is configured.
1696
+ */
1697
+ signature?: string;
1698
+ /**
1699
+ * Tool input before input schema validation and transformation.
1700
+ *
1701
+ * This is included when it differs from the validated tool input so that
1702
+ * approved tool calls can be safely revalidated before execution.
1703
+ */
1704
+ inputSchemaInput?: unknown;
1563
1705
  };
1564
-
1706
+ //#endregion
1707
+ //#region src/types/assistant-model-message.d.ts
1565
1708
  /**
1566
1709
  * An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
1567
1710
  */
1568
1711
  type AssistantModelMessage = {
1569
- role: 'assistant';
1570
- content: AssistantContent;
1571
- /**
1572
- * Additional provider-specific metadata. They are passed through
1573
- * to the provider from the AI SDK and enable provider-specific
1574
- * functionality that can be fully encapsulated in the provider.
1575
- */
1576
- providerOptions?: ProviderOptions;
1712
+ role: 'assistant';
1713
+ content: AssistantContent;
1714
+ /**
1715
+ * Additional provider-specific metadata. They are passed through
1716
+ * to the provider from the AI SDK and enable provider-specific
1717
+ * functionality that can be fully encapsulated in the provider.
1718
+ */
1719
+ providerOptions?: ProviderOptions;
1577
1720
  };
1578
1721
  /**
1579
1722
  * Content of an assistant message.
1580
1723
  * It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
1581
1724
  */
1582
1725
  type AssistantContent = string | Array<TextPart | CustomPart | FilePart | ReasoningPart | ReasoningFilePart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
1583
-
1726
+ //#endregion
1727
+ //#region src/types/system-model-message.d.ts
1584
1728
  /**
1585
1729
  * A system message. It can contain system information.
1586
1730
  *
@@ -1589,496 +1733,502 @@ type AssistantContent = string | Array<TextPart | CustomPart | FilePart | Reason
1589
1733
  * and because not all providers support several system messages.
1590
1734
  */
1591
1735
  type SystemModelMessage = {
1592
- role: 'system';
1593
- content: string;
1594
- /**
1595
- * Additional provider-specific metadata. They are passed through
1596
- * to the provider from the AI SDK and enable provider-specific
1597
- * functionality that can be fully encapsulated in the provider.
1598
- */
1599
- providerOptions?: ProviderOptions;
1736
+ role: 'system';
1737
+ content: string;
1738
+ /**
1739
+ * Additional provider-specific metadata. They are passed through
1740
+ * to the provider from the AI SDK and enable provider-specific
1741
+ * functionality that can be fully encapsulated in the provider.
1742
+ */
1743
+ providerOptions?: ProviderOptions;
1600
1744
  };
1601
-
1745
+ //#endregion
1746
+ //#region src/types/tool-approval-response.d.ts
1602
1747
  /**
1603
1748
  * Tool approval response prompt part.
1604
1749
  */
1605
1750
  type ToolApprovalResponse = {
1606
- type: 'tool-approval-response';
1607
- /**
1608
- * ID of the tool approval.
1609
- */
1610
- approvalId: string;
1611
- /**
1612
- * Flag indicating whether the approval was granted or denied.
1613
- */
1614
- approved: boolean;
1615
- /**
1616
- * Optional reason for the approval or denial.
1617
- */
1618
- reason?: string;
1619
- /**
1620
- * Flag indicating whether the tool call is provider-executed.
1621
- * Only provider-executed tool approval responses should be sent to the model.
1622
- */
1623
- providerExecuted?: boolean;
1751
+ type: 'tool-approval-response';
1752
+ /**
1753
+ * ID of the tool approval.
1754
+ */
1755
+ approvalId: string;
1756
+ /**
1757
+ * Flag indicating whether the approval was granted or denied.
1758
+ */
1759
+ approved: boolean;
1760
+ /**
1761
+ * Optional reason for the approval or denial.
1762
+ */
1763
+ reason?: string;
1764
+ /**
1765
+ * Flag indicating whether the tool call is provider-executed.
1766
+ * Only provider-executed tool approval responses should be sent to the model.
1767
+ */
1768
+ providerExecuted?: boolean;
1624
1769
  };
1625
-
1770
+ //#endregion
1771
+ //#region src/types/tool-model-message.d.ts
1626
1772
  /**
1627
1773
  * A tool message. It contains the result of one or more tool calls.
1628
1774
  */
1629
1775
  type ToolModelMessage = {
1630
- role: 'tool';
1631
- content: ToolContent;
1632
- /**
1633
- * Additional provider-specific metadata. They are passed through
1634
- * to the provider from the AI SDK and enable provider-specific
1635
- * functionality that can be fully encapsulated in the provider.
1636
- */
1637
- providerOptions?: ProviderOptions;
1776
+ role: 'tool';
1777
+ content: ToolContent;
1778
+ /**
1779
+ * Additional provider-specific metadata. They are passed through
1780
+ * to the provider from the AI SDK and enable provider-specific
1781
+ * functionality that can be fully encapsulated in the provider.
1782
+ */
1783
+ providerOptions?: ProviderOptions;
1638
1784
  };
1639
1785
  /**
1640
1786
  * Content of a tool message. It is an array of tool result parts.
1641
1787
  */
1642
1788
  type ToolContent = Array<ToolResultPart | ToolApprovalResponse>;
1643
-
1789
+ //#endregion
1790
+ //#region src/types/user-model-message.d.ts
1644
1791
  /**
1645
1792
  * A user message. It can contain text or a combination of text and images.
1646
1793
  */
1647
1794
  type UserModelMessage = {
1648
- role: 'user';
1649
- content: UserContent;
1650
- /**
1651
- * Additional provider-specific metadata. They are passed through
1652
- * to the provider from the AI SDK and enable provider-specific
1653
- * functionality that can be fully encapsulated in the provider.
1654
- */
1655
- providerOptions?: ProviderOptions;
1795
+ role: 'user';
1796
+ content: UserContent;
1797
+ /**
1798
+ * Additional provider-specific metadata. They are passed through
1799
+ * to the provider from the AI SDK and enable provider-specific
1800
+ * functionality that can be fully encapsulated in the provider.
1801
+ */
1802
+ providerOptions?: ProviderOptions;
1656
1803
  };
1657
1804
  /**
1658
1805
  * Content of a user message. It can be a string or an array of text and image parts.
1659
1806
  */
1660
1807
  type UserContent = string | Array<TextPart | ImagePart | FilePart>;
1661
-
1808
+ //#endregion
1809
+ //#region src/types/model-message.d.ts
1662
1810
  /**
1663
1811
  * A message that can be used in the `messages` field of a prompt.
1664
1812
  * It can be a user message, an assistant message, or a tool message.
1665
1813
  */
1666
1814
  type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
1667
-
1815
+ //#endregion
1816
+ //#region src/types/sandbox.d.ts
1668
1817
  /**
1669
1818
  * Options for executing a command in the sandbox via `run` or `spawn`.
1670
1819
  */
1671
1820
  type SandboxProcessOptions = {
1672
- /**
1673
- * Command to execute in the sandbox.
1674
- */
1675
- command: string;
1676
- /**
1677
- * Working directory to execute the command in.
1678
- */
1679
- workingDirectory?: string;
1680
- /**
1681
- * Environment variables to set for this command. Merged with the
1682
- * sandbox's default environment; values here take precedence.
1683
- * Supporting environment variables as an option is preferable from a
1684
- * security perspective, e.g. to avoid them leaking in logs.
1685
- */
1686
- env?: Record<string, string>;
1687
- /**
1688
- * Signal that can be used to abort the command. When aborted, the running
1689
- * process is killed; for `spawn`, `wait()` rejects with the abort reason.
1690
- */
1691
- abortSignal?: AbortSignal;
1821
+ /**
1822
+ * Command to execute in the sandbox.
1823
+ */
1824
+ command: string;
1825
+ /**
1826
+ * Working directory to execute the command in.
1827
+ */
1828
+ workingDirectory?: string;
1829
+ /**
1830
+ * Environment variables to set for this command. Merged with the
1831
+ * sandbox's default environment; values here take precedence.
1832
+ * Supporting environment variables as an option is preferable from a
1833
+ * security perspective, e.g. to avoid them leaking in logs.
1834
+ */
1835
+ env?: Record<string, string>;
1836
+ /**
1837
+ * Signal that can be used to abort the command. When aborted, the running
1838
+ * process is killed; for `spawn`, `wait()` rejects with the abort reason.
1839
+ */
1840
+ abortSignal?: AbortSignal;
1692
1841
  };
1693
1842
  /**
1694
1843
  * Options for reading a file from the sandbox.
1695
1844
  */
1696
1845
  type ReadFileOptions = {
1697
- /**
1698
- * Path of the file to read.
1699
- */
1700
- path: string;
1701
- /**
1702
- * Signal that can be used to abort the read.
1703
- */
1704
- abortSignal?: AbortSignal;
1846
+ /**
1847
+ * Path of the file to read.
1848
+ */
1849
+ path: string;
1850
+ /**
1851
+ * Signal that can be used to abort the read.
1852
+ */
1853
+ abortSignal?: AbortSignal;
1705
1854
  };
1706
1855
  /**
1707
1856
  * Options for writing a file to the sandbox. `CONTENT` is the payload written
1708
1857
  * to the file: a byte stream, raw bytes, or a string.
1709
1858
  */
1710
1859
  type WriteFileOptions<CONTENT> = {
1711
- /**
1712
- * Path of the file to write.
1713
- */
1714
- path: string;
1715
- /**
1716
- * Content to write to the file.
1717
- */
1718
- content: CONTENT;
1719
- /**
1720
- * Signal that can be used to abort the write.
1721
- */
1722
- abortSignal?: AbortSignal;
1860
+ /**
1861
+ * Path of the file to write.
1862
+ */
1863
+ path: string;
1864
+ /**
1865
+ * Content to write to the file.
1866
+ */
1867
+ content: CONTENT;
1868
+ /**
1869
+ * Signal that can be used to abort the write.
1870
+ */
1871
+ abortSignal?: AbortSignal;
1723
1872
  };
1724
1873
  /**
1725
1874
  * Sandbox session that can execute commands and read/write files.
1726
1875
  */
1727
1876
  type SandboxSession = {
1728
- /**
1729
- * Description of the sandbox environment that can be added to the agent's instructions
1730
- * so that the agent knows about relevant details such as the root directory, exposed
1731
- * ports, the public hostname, etc.
1732
- */
1733
- readonly description: string;
1734
- /**
1735
- * Read one file from the sandbox as a stream of bytes. Resolves to `null`
1736
- * when the file does not exist.
1737
- *
1738
- * Relative path handling is implementation-defined. This is the lowest-level
1739
- * read primitive; prefer `readBinaryFile` or `readTextFile` unless you need
1740
- * to stream bytes.
1877
+ /**
1878
+ * Description of the sandbox environment that can be added to the agent's instructions
1879
+ * so that the agent knows about relevant details such as the root directory, exposed
1880
+ * ports, the public hostname, etc.
1881
+ */
1882
+ readonly description: string;
1883
+ /**
1884
+ * Read one file from the sandbox as a stream of bytes. Resolves to `null`
1885
+ * when the file does not exist.
1886
+ *
1887
+ * Relative path handling is implementation-defined. This is the lowest-level
1888
+ * read primitive; prefer `readBinaryFile` or `readTextFile` unless you need
1889
+ * to stream bytes.
1890
+ */
1891
+ readonly readFile: (options: ReadFileOptions) => PromiseLike<ReadableStream<Uint8Array> | null>;
1892
+ /**
1893
+ * Read one file from the sandbox as raw bytes. Resolves to `null` when the
1894
+ * file does not exist.
1895
+ */
1896
+ readonly readBinaryFile: (options: ReadFileOptions) => PromiseLike<Uint8Array | null>;
1897
+ /**
1898
+ * Read one text file from the sandbox, decoded using the requested encoding.
1899
+ * Resolves to `null` when the file does not exist.
1900
+ *
1901
+ * Line ranges are 1-based and inclusive. When `endLine` is past EOF the read
1902
+ * returns through EOF without error.
1903
+ */
1904
+ readonly readTextFile: (options: ReadFileOptions & {
1905
+ /**
1906
+ * Text encoding used to decode the file bytes. Defaults to `"utf-8"`.
1907
+ */
1908
+ encoding?: string;
1909
+ /**
1910
+ * 1-based inclusive start line. Defaults to 1.
1741
1911
  */
1742
- readonly readFile: (options: ReadFileOptions) => PromiseLike<ReadableStream<Uint8Array> | null>;
1743
- /**
1744
- * Read one file from the sandbox as raw bytes. Resolves to `null` when the
1745
- * file does not exist.
1746
- */
1747
- readonly readBinaryFile: (options: ReadFileOptions) => PromiseLike<Uint8Array | null>;
1912
+ startLine?: number;
1748
1913
  /**
1749
- * Read one text file from the sandbox, decoded using the requested encoding.
1750
- * Resolves to `null` when the file does not exist.
1751
- *
1752
- * Line ranges are 1-based and inclusive. When `endLine` is past EOF the read
1914
+ * 1-based inclusive end line. When past the file's line count, the read
1753
1915
  * returns through EOF without error.
1754
1916
  */
1755
- readonly readTextFile: (options: ReadFileOptions & {
1756
- /**
1757
- * Text encoding used to decode the file bytes. Defaults to `"utf-8"`.
1758
- */
1759
- encoding?: string;
1760
- /**
1761
- * 1-based inclusive start line. Defaults to 1.
1762
- */
1763
- startLine?: number;
1764
- /**
1765
- * 1-based inclusive end line. When past the file's line count, the read
1766
- * returns through EOF without error.
1767
- */
1768
- endLine?: number;
1769
- }) => PromiseLike<string | null>;
1770
- /**
1771
- * Write one file to the sandbox from a stream of bytes. Creates parent
1772
- * directories recursively and overwrites any existing file.
1773
- *
1774
- * This is the lowest-level write primitive; prefer `writeBinaryFile` or
1775
- * `writeTextFile` when the full content is already materialized in memory.
1776
- */
1777
- readonly writeFile: (options: WriteFileOptions<ReadableStream<Uint8Array>>) => PromiseLike<void>;
1778
- /**
1779
- * Write one file to the sandbox from raw bytes. Creates parent directories
1780
- * recursively and overwrites any existing file.
1781
- */
1782
- readonly writeBinaryFile: (options: WriteFileOptions<Uint8Array>) => PromiseLike<void>;
1783
- /**
1784
- * Write one file to the sandbox from a string, encoded using the requested
1785
- * encoding. Creates parent directories recursively and overwrites any
1786
- * existing file.
1787
- */
1788
- readonly writeTextFile: (options: WriteFileOptions<string> & {
1789
- /**
1790
- * Text encoding used to encode the string to bytes. Defaults to `"utf-8"`.
1791
- */
1792
- encoding?: string;
1793
- }) => PromiseLike<void>;
1794
- /**
1795
- * Spawn a long-running process in the sandbox. Returns immediately with a
1796
- * handle that streams stdout/stderr, can be waited on, and can be killed.
1797
- *
1798
- * `run` is conceptually a thin wrapper over this primitive: spawn,
1799
- * collect both streams to strings, await `wait()`, return the result.
1800
- */
1801
- readonly spawn: (options: SandboxProcessOptions) => PromiseLike<SandboxProcess>;
1802
- /**
1803
- * Run a command in the sandbox.
1804
- */
1805
- readonly run: (options: SandboxProcessOptions) => PromiseLike<{
1806
- /**
1807
- * Exit code returned by the command.
1808
- */
1809
- exitCode: number;
1810
- /**
1811
- * Standard output produced by the command.
1812
- */
1813
- stdout: string;
1814
- /**
1815
- * Standard error produced by the command.
1816
- */
1817
- stderr: string;
1818
- }>;
1917
+ endLine?: number;
1918
+ }) => PromiseLike<string | null>;
1919
+ /**
1920
+ * Write one file to the sandbox from a stream of bytes. Creates parent
1921
+ * directories recursively and overwrites any existing file.
1922
+ *
1923
+ * This is the lowest-level write primitive; prefer `writeBinaryFile` or
1924
+ * `writeTextFile` when the full content is already materialized in memory.
1925
+ */
1926
+ readonly writeFile: (options: WriteFileOptions<ReadableStream<Uint8Array>>) => PromiseLike<void>;
1927
+ /**
1928
+ * Write one file to the sandbox from raw bytes. Creates parent directories
1929
+ * recursively and overwrites any existing file.
1930
+ */
1931
+ readonly writeBinaryFile: (options: WriteFileOptions<Uint8Array>) => PromiseLike<void>;
1932
+ /**
1933
+ * Write one file to the sandbox from a string, encoded using the requested
1934
+ * encoding. Creates parent directories recursively and overwrites any
1935
+ * existing file.
1936
+ */
1937
+ readonly writeTextFile: (options: WriteFileOptions<string> & {
1938
+ /**
1939
+ * Text encoding used to encode the string to bytes. Defaults to `"utf-8"`.
1940
+ */
1941
+ encoding?: string;
1942
+ }) => PromiseLike<void>;
1943
+ /**
1944
+ * Spawn a long-running process in the sandbox. Returns immediately with a
1945
+ * handle that streams stdout/stderr, can be waited on, and can be killed.
1946
+ *
1947
+ * `run` is conceptually a thin wrapper over this primitive: spawn,
1948
+ * collect both streams to strings, await `wait()`, return the result.
1949
+ */
1950
+ readonly spawn: (options: SandboxProcessOptions) => PromiseLike<SandboxProcess>;
1951
+ /**
1952
+ * Run a command in the sandbox.
1953
+ */
1954
+ readonly run: (options: SandboxProcessOptions) => PromiseLike<{
1955
+ /**
1956
+ * Exit code returned by the command.
1957
+ */
1958
+ exitCode: number;
1959
+ /**
1960
+ * Standard output produced by the command.
1961
+ */
1962
+ stdout: string;
1963
+ /**
1964
+ * Standard error produced by the command.
1965
+ */
1966
+ stderr: string;
1967
+ }>;
1819
1968
  };
1820
1969
  /**
1821
1970
  * Handle to a long-running process started via `SandboxSession.spawn`.
1822
1971
  */
1823
1972
  type SandboxProcess = {
1824
- /**
1825
- * Process identifier, if the sandbox implementation exposes one.
1826
- */
1827
- readonly pid?: number;
1828
- /**
1829
- * Stream of bytes written by the process to standard output.
1830
- */
1831
- readonly stdout: ReadableStream<Uint8Array>;
1832
- /**
1833
- * Stream of bytes written by the process to standard error.
1834
- */
1835
- readonly stderr: ReadableStream<Uint8Array>;
1836
- /**
1837
- * Resolve when the process exits, yielding its exit code.
1838
- */
1839
- wait(): PromiseLike<{
1840
- exitCode: number;
1841
- }>;
1842
- /**
1843
- * Terminate the process. Idempotent.
1844
- */
1845
- kill(): PromiseLike<void>;
1973
+ /**
1974
+ * Process identifier, if the sandbox implementation exposes one.
1975
+ */
1976
+ readonly pid?: number;
1977
+ /**
1978
+ * Stream of bytes written by the process to standard output.
1979
+ */
1980
+ readonly stdout: ReadableStream<Uint8Array>;
1981
+ /**
1982
+ * Stream of bytes written by the process to standard error.
1983
+ */
1984
+ readonly stderr: ReadableStream<Uint8Array>;
1985
+ /**
1986
+ * Resolve when the process exits, yielding its exit code.
1987
+ */
1988
+ wait(): PromiseLike<{
1989
+ exitCode: number;
1990
+ }>;
1991
+ /**
1992
+ * Terminate the process. Idempotent.
1993
+ */
1994
+ kill(): PromiseLike<void>;
1846
1995
  };
1847
-
1996
+ //#endregion
1997
+ //#region src/types/tool-execute-function.d.ts
1848
1998
  /**
1849
1999
  * Additional options that are sent into each tool execution.
1850
2000
  */
1851
2001
  interface ToolExecutionOptions<CONTEXT extends Context | unknown | never> {
1852
- /**
1853
- * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
1854
- */
1855
- toolCallId: string;
1856
- /**
1857
- * Messages that were sent to the language model to initiate the response that contained the tool call.
1858
- * The messages **do not** include the system prompt nor the assistant response that contained the tool call.
1859
- */
1860
- messages: ModelMessage[];
1861
- /**
1862
- * An optional abort signal that indicates that the overall operation should be aborted.
1863
- */
1864
- abortSignal?: AbortSignal;
1865
- /**
1866
- * Tool context as defined by the tool's context schema.
1867
- * The tool context is specific to the tool and is passed to the tool execution.
1868
- *
1869
- * Treat the context object as immutable inside tools.
1870
- * Mutating the context object can lead to race conditions and unexpected results
1871
- * when tools are called in parallel.
1872
- *
1873
- * If you need to mutate the context, analyze the tool calls and results
1874
- * in `prepareStep` and update it there.
1875
- */
1876
- context: CONTEXT;
1877
- /**
1878
- * The sandbox environment that the tool is operating in.
1879
- */
1880
- experimental_sandbox?: SandboxSession;
2002
+ /**
2003
+ * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
2004
+ */
2005
+ toolCallId: string;
2006
+ /**
2007
+ * Messages that were sent to the language model to initiate the response that contained the tool call.
2008
+ * The messages **do not** include the system prompt nor the assistant response that contained the tool call.
2009
+ */
2010
+ messages: ModelMessage[];
2011
+ /**
2012
+ * An optional abort signal that indicates that the overall operation should be aborted.
2013
+ */
2014
+ abortSignal?: AbortSignal;
2015
+ /**
2016
+ * Tool context as defined by the tool's context schema.
2017
+ * The tool context is specific to the tool and is passed to the tool execution.
2018
+ *
2019
+ * Treat the context object as immutable inside tools.
2020
+ * Mutating the context object can lead to race conditions and unexpected results
2021
+ * when tools are called in parallel.
2022
+ *
2023
+ * If you need to mutate the context, analyze the tool calls and results
2024
+ * in `prepareStep` and update it there.
2025
+ */
2026
+ context: CONTEXT;
2027
+ /**
2028
+ * The sandbox environment that the tool is operating in.
2029
+ */
2030
+ experimental_sandbox?: SandboxSession;
1881
2031
  }
1882
2032
  /**
1883
2033
  * Function that executes the tool and returns either a single result or a stream of results.
1884
2034
  */
1885
2035
  type ToolExecuteFunction<INPUT, OUTPUT, CONTEXT extends Context | unknown | never> = (input: INPUT, options: ToolExecutionOptions<CONTEXT>) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
1886
-
2036
+ //#endregion
2037
+ //#region src/types/tool-needs-approval-function.d.ts
1887
2038
  /**
1888
2039
  * Function that is called to determine if the tool needs approval before it can be executed.
1889
2040
  *
1890
2041
  * @deprecated Tool approval is handled on a `generateText` / `streamText` level now.
1891
2042
  */
1892
2043
  type ToolNeedsApprovalFunction<INPUT, CONTEXT extends Context | unknown | never> = (input: INPUT, options: {
1893
- /**
1894
- * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
1895
- */
1896
- toolCallId: string;
1897
- /**
1898
- * Messages that were sent to the language model to initiate the response that contained the tool call.
1899
- * The messages **do not** include the system prompt nor the assistant response that contained the tool call.
1900
- */
1901
- messages: ModelMessage[];
1902
- /**
1903
- * Tool context as defined by the tool's context schema.
1904
- * The tool context is specific to the tool and is passed to the tool execution.
1905
- *
1906
- * Treat the context object as immutable inside tools.
1907
- * Mutating the context object can lead to race conditions and unexpected results
1908
- * when tools are called in parallel.
1909
- *
1910
- * If you need to mutate the context, analyze the tool calls and results
1911
- * in `prepareStep` and update it there.
1912
- */
1913
- context: CONTEXT;
2044
+ /**
2045
+ * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
2046
+ */
2047
+ toolCallId: string;
2048
+ /**
2049
+ * Messages that were sent to the language model to initiate the response that contained the tool call.
2050
+ * The messages **do not** include the system prompt nor the assistant response that contained the tool call.
2051
+ */
2052
+ messages: ModelMessage[];
2053
+ /**
2054
+ * Tool context as defined by the tool's context schema.
2055
+ * The tool context is specific to the tool and is passed to the tool execution.
2056
+ *
2057
+ * Treat the context object as immutable inside tools.
2058
+ * Mutating the context object can lead to race conditions and unexpected results
2059
+ * when tools are called in parallel.
2060
+ *
2061
+ * If you need to mutate the context, analyze the tool calls and results
2062
+ * in `prepareStep` and update it there.
2063
+ */
2064
+ context: CONTEXT;
1914
2065
  }) => boolean | PromiseLike<boolean>;
1915
-
2066
+ //#endregion
2067
+ //#region src/types/tool.d.ts
1916
2068
  /**
1917
2069
  * Helper type to determine the outputSchema and execute function properties of a tool.
1918
2070
  */
1919
2071
  type ToolOutputProperties<INPUT, OUTPUT, CONTEXT extends Context | unknown | never> = NeverOptional<OUTPUT, {
1920
- /**
1921
- * The optional schema of the output that the tool produces.
1922
- *
1923
- * If not provided, the output shape will be inferred from the execute function.
1924
- */
1925
- outputSchema?: FlexibleSchema<OUTPUT>;
1926
- /**
1927
- * An async function that is called with the arguments from the tool call and produces a result.
1928
- * If not provided, the tool will not be executed automatically.
1929
- *
1930
- * @args is the input of the tool call.
1931
- * @options.abortSignal is a signal that can be used to abort the tool call.
1932
- */
1933
- execute: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2072
+ /**
2073
+ * The optional schema of the output that the tool produces.
2074
+ *
2075
+ * If not provided, the output shape will be inferred from the execute function.
2076
+ */
2077
+ outputSchema?: FlexibleSchema<OUTPUT>;
2078
+ /**
2079
+ * An async function that is called with the arguments from the tool call and produces a result.
2080
+ * If not provided, the tool will not be executed automatically.
2081
+ *
2082
+ * @args is the input of the tool call.
2083
+ * @options.abortSignal is a signal that can be used to abort the tool call.
2084
+ */
2085
+ execute: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
1934
2086
  } | {
1935
- /**
1936
- * The schema of the output that the tool produces.
1937
- *
1938
- * Required when no execute function is provided.
1939
- */
1940
- outputSchema: FlexibleSchema<OUTPUT>;
1941
- execute?: never;
2087
+ /**
2088
+ * The schema of the output that the tool produces.
2089
+ *
2090
+ * Required when no execute function is provided.
2091
+ */
2092
+ outputSchema: FlexibleSchema<OUTPUT>;
2093
+ execute?: never;
1942
2094
  }>;
1943
2095
  /**
1944
2096
  * Common properties shared by all tool kinds.
1945
2097
  */
1946
2098
  type BaseTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = {
2099
+ /**
2100
+ * Defer exposing this tool until it is discovered by `toolSearch`.
2101
+ * Supports direct calls and local callers that announce tools in conversation
2102
+ * messages (code mode with `toolDiscovery: 'conversation'`). Discovered tools
2103
+ * become available on the next model step.
2104
+ */
2105
+ deferLoading?: boolean;
2106
+ /**
2107
+ * An optional title of the tool.
2108
+ *
2109
+ * @deprecated Use `providerMetadata` for source-specific tool display metadata.
2110
+ */
2111
+ title?: string;
2112
+ /**
2113
+ * Additional provider-specific metadata. They are passed through
2114
+ * to the provider from the AI SDK and enable provider-specific
2115
+ * functionality that can be fully encapsulated in the provider.
2116
+ */
2117
+ providerOptions?: ProviderOptions;
2118
+ /**
2119
+ * Optional metadata about the tool itself (e.g. its source).
2120
+ *
2121
+ * Unlike `providerOptions`, this metadata is not sent to the language
2122
+ * model. Instead, it is propagated onto the resulting tool call's
2123
+ * `toolMetadata` so consumers can read it from tool call / result parts
2124
+ * and UI message parts. This is useful for sources of dynamic tools (e.g.
2125
+ * an MCP server) to identify themselves.
2126
+ */
2127
+ metadata?: JSONObject;
2128
+ /**
2129
+ * The schema of the input that the tool expects.
2130
+ * The language model will use this to generate the input.
2131
+ * It is also used to validate the output of the language model.
2132
+ *
2133
+ * You can use descriptions on the schema properties to make the input understandable for the language model.
2134
+ */
2135
+ inputSchema: FlexibleSchema<INPUT>;
2136
+ /**
2137
+ * An optional schema describing the context that the tool expects.
2138
+ *
2139
+ * The context is passed to execute function as part of the execution options.
2140
+ */
2141
+ contextSchema?: FlexibleSchema<CONTEXT>;
2142
+ /**
2143
+ * Whether the tool needs approval before it can be executed.
2144
+ *
2145
+ * @deprecated Tool approval is handled on a `generateText` / `streamText` level now.
2146
+ */
2147
+ needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT, NoInfer<CONTEXT>>;
2148
+ /**
2149
+ * Optional function that is called when the model starts generating the tool input.
2150
+ * In non-streaming contexts, it is called immediately before `onInputAvailable`.
2151
+ */
2152
+ onInputStart?: (options: ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
2153
+ /**
2154
+ * Optional function that is called when an argument streaming delta is available.
2155
+ * Only called when the tool is used in a streaming context.
2156
+ */
2157
+ onInputDelta?: (options: {
2158
+ inputTextDelta: string;
2159
+ } & ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
2160
+ /**
2161
+ * Optional function that is called when a tool call can be started,
2162
+ * even if the execute function is not provided.
2163
+ */
2164
+ onInputAvailable?: (options: {
2165
+ input: [INPUT] extends [never] ? unknown : INPUT;
2166
+ } & ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
2167
+ /**
2168
+ * Optional conversion function that maps the tool result to an output that can be used by the language model.
2169
+ *
2170
+ * If not provided, the tool result will be sent as a JSON object.
2171
+ *
2172
+ * This function is invoked on the server by `convertToModelMessages`, so ensure that you pass the same "tools" (ToolSet) to both "convertToModelMessages" and "streamText" (or other generation APIs).
2173
+ */
2174
+ toModelOutput?: (options: {
1947
2175
  /**
1948
- * Defer exposing this tool until it is discovered by `toolSearch`.
1949
- * Supports direct calls and local callers that announce tools in conversation
1950
- * messages (code mode with `toolDiscovery: 'conversation'`). Discovered tools
1951
- * become available on the next model step.
1952
- */
1953
- deferLoading?: boolean;
1954
- /**
1955
- * An optional title of the tool.
1956
- *
1957
- * @deprecated Use `providerMetadata` for source-specific tool display metadata.
1958
- */
1959
- title?: string;
1960
- /**
1961
- * Additional provider-specific metadata. They are passed through
1962
- * to the provider from the AI SDK and enable provider-specific
1963
- * functionality that can be fully encapsulated in the provider.
1964
- */
1965
- providerOptions?: ProviderOptions;
1966
- /**
1967
- * Optional metadata about the tool itself (e.g. its source).
1968
- *
1969
- * Unlike `providerOptions`, this metadata is not sent to the language
1970
- * model. Instead, it is propagated onto the resulting tool call's
1971
- * `toolMetadata` so consumers can read it from tool call / result parts
1972
- * and UI message parts. This is useful for sources of dynamic tools (e.g.
1973
- * an MCP server) to identify themselves.
1974
- */
1975
- metadata?: JSONObject;
1976
- /**
1977
- * The schema of the input that the tool expects.
1978
- * The language model will use this to generate the input.
1979
- * It is also used to validate the output of the language model.
1980
- *
1981
- * You can use descriptions on the schema properties to make the input understandable for the language model.
1982
- */
1983
- inputSchema: FlexibleSchema<INPUT>;
1984
- /**
1985
- * An optional schema describing the context that the tool expects.
1986
- *
1987
- * The context is passed to execute function as part of the execution options.
1988
- */
1989
- contextSchema?: FlexibleSchema<CONTEXT>;
1990
- /**
1991
- * Whether the tool needs approval before it can be executed.
1992
- *
1993
- * @deprecated Tool approval is handled on a `generateText` / `streamText` level now.
1994
- */
1995
- needsApproval?: boolean | ToolNeedsApprovalFunction<[
1996
- INPUT
1997
- ] extends [never] ? unknown : INPUT, NoInfer<CONTEXT>>;
1998
- /**
1999
- * Optional function that is called when the model starts generating the tool input.
2000
- * In non-streaming contexts, it is called immediately before `onInputAvailable`.
2001
- */
2002
- onInputStart?: (options: ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
2003
- /**
2004
- * Optional function that is called when an argument streaming delta is available.
2005
- * Only called when the tool is used in a streaming context.
2176
+ * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
2006
2177
  */
2007
- onInputDelta?: (options: {
2008
- inputTextDelta: string;
2009
- } & ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
2178
+ toolCallId: string;
2010
2179
  /**
2011
- * Optional function that is called when a tool call can be started,
2012
- * even if the execute function is not provided.
2180
+ * The input of the tool call.
2013
2181
  */
2014
- onInputAvailable?: (options: {
2015
- input: [INPUT] extends [never] ? unknown : INPUT;
2016
- } & ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
2182
+ input: [INPUT] extends [never] ? unknown : INPUT;
2017
2183
  /**
2018
- * Optional conversion function that maps the tool result to an output that can be used by the language model.
2019
- *
2020
- * If not provided, the tool result will be sent as a JSON object.
2021
- *
2022
- * This function is invoked on the server by `convertToModelMessages`, so ensure that you pass the same "tools" (ToolSet) to both "convertToModelMessages" and "streamText" (or other generation APIs).
2184
+ * The output of the tool call.
2023
2185
  */
2024
- toModelOutput?: (options: {
2025
- /**
2026
- * The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
2027
- */
2028
- toolCallId: string;
2029
- /**
2030
- * The input of the tool call.
2031
- */
2032
- input: [INPUT] extends [never] ? unknown : INPUT;
2033
- /**
2034
- * The output of the tool call.
2035
- */
2036
- output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
2037
- }) => ToolResultOutput | PromiseLike<ToolResultOutput>;
2186
+ output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
2187
+ }) => ToolResultOutput | PromiseLike<ToolResultOutput>;
2038
2188
  } & ToolOutputProperties<INPUT, OUTPUT, NoInfer<CONTEXT>>;
2039
2189
  /**
2040
2190
  * Common properties shared by function-style tools.
2041
2191
  */
2042
2192
  type BaseFunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseTool<INPUT, OUTPUT, CONTEXT> & {
2043
- /**
2044
- * Optional description of what the tool does.
2045
- *
2046
- * Included in the tool definition sent to the language model so it can
2047
- * decide when and how to call the tool.
2048
- *
2049
- * Provide a string for a fixed description, or a function that returns a
2050
- * string from the current `context` (and optional `experimental_sandbox`) when the
2051
- * description should vary per call.
2052
- */
2053
- description?: string | ((options: {
2054
- context: NoInfer<CONTEXT>;
2055
- experimental_sandbox?: SandboxSession;
2056
- }) => string);
2057
- /**
2058
- * Strict mode setting for the tool.
2059
- *
2060
- * Providers that support strict mode will use this setting to determine
2061
- * how the input should be generated. Strict mode will always produce
2062
- * valid inputs, but it might limit what input schemas are supported.
2063
- */
2064
- strict?: boolean;
2065
- /**
2066
- * An optional list of input examples that show the language
2067
- * model what the input should look like.
2068
- */
2069
- inputExamples?: Array<{
2070
- input: NoInfer<INPUT>;
2071
- }>;
2072
- id?: never;
2073
- isProviderExecuted?: never;
2074
- args?: never;
2075
- supportsDeferredResults?: never;
2193
+ /**
2194
+ * Optional description of what the tool does.
2195
+ *
2196
+ * Included in the tool definition sent to the language model so it can
2197
+ * decide when and how to call the tool.
2198
+ *
2199
+ * Provide a string for a fixed description, or a function that returns a
2200
+ * string from the current `context` (and optional `experimental_sandbox`) when the
2201
+ * description should vary per call.
2202
+ */
2203
+ description?: string | ((options: {
2204
+ context: NoInfer<CONTEXT>;
2205
+ experimental_sandbox?: SandboxSession;
2206
+ }) => string);
2207
+ /**
2208
+ * Strict mode setting for the tool.
2209
+ *
2210
+ * Providers that support strict mode will use this setting to determine
2211
+ * how the input should be generated. Strict mode will always produce
2212
+ * valid inputs, but it might limit what input schemas are supported.
2213
+ */
2214
+ strict?: boolean;
2215
+ /**
2216
+ * An optional list of input examples that show the language
2217
+ * model what the input should look like.
2218
+ */
2219
+ inputExamples?: Array<{
2220
+ input: NoInfer<INPUT>;
2221
+ }>;
2222
+ id?: never;
2223
+ isProviderExecuted?: never;
2224
+ args?: never;
2225
+ supportsDeferredResults?: never;
2076
2226
  };
2077
2227
  /**
2078
2228
  * Tool with user-defined input and output schemas that is executed by the AI SDK.
2079
2229
  */
2080
2230
  type FunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseFunctionTool<INPUT, OUTPUT, CONTEXT> & {
2081
- type?: undefined | 'function';
2231
+ type?: undefined | 'function';
2082
2232
  };
2083
2233
  /**
2084
2234
  * Tool that is defined at runtime.
@@ -2087,24 +2237,24 @@ type FunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extend
2087
2237
  * For example, MCP tools that are not known at development time.
2088
2238
  */
2089
2239
  type DynamicTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseFunctionTool<INPUT, OUTPUT, CONTEXT> & {
2090
- type: 'dynamic';
2240
+ type: 'dynamic';
2091
2241
  };
2092
2242
  /**
2093
2243
  * Common properties shared by provider tools.
2094
2244
  */
2095
2245
  type BaseProviderTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseTool<INPUT, OUTPUT, CONTEXT> & {
2096
- type: 'provider';
2097
- /**
2098
- * The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
2099
- */
2100
- id: `${string}.${string}`;
2101
- /**
2102
- * The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
2103
- */
2104
- args: Record<string, unknown>;
2105
- description?: never;
2106
- strict?: never;
2107
- inputExamples?: never;
2246
+ type: 'provider';
2247
+ /**
2248
+ * The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
2249
+ */
2250
+ id: `${string}.${string}`;
2251
+ /**
2252
+ * The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
2253
+ */
2254
+ args: Record<string, unknown>;
2255
+ description?: never;
2256
+ strict?: never;
2257
+ inputExamples?: never;
2108
2258
  };
2109
2259
  /**
2110
2260
  * Tool with provider-defined input and output schemas that is executed by the
@@ -2113,11 +2263,11 @@ type BaseProviderTool<INPUT extends JSONValue | unknown | never = any, OUTPUT ex
2113
2263
  * For example, shell tools that are executed in a local shell, but have provider-defined input and output schemas.
2114
2264
  */
2115
2265
  type ProviderDefinedTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseProviderTool<INPUT, OUTPUT, CONTEXT> & {
2116
- /**
2117
- * Flag that indicates whether the tool is executed by the provider.
2118
- */
2119
- isProviderExecuted: false;
2120
- supportsDeferredResults?: never;
2266
+ /**
2267
+ * Flag that indicates whether the tool is executed by the provider.
2268
+ */
2269
+ isProviderExecuted: false;
2270
+ supportsDeferredResults?: never;
2121
2271
  };
2122
2272
  /**
2123
2273
  * Tool with provider-defined input and output schemas that is executed by the
@@ -2126,24 +2276,24 @@ type ProviderDefinedTool<INPUT extends JSONValue | unknown | never = any, OUTPUT
2126
2276
  * For example, web search tools and code execution tools that are executed by the provider itself.
2127
2277
  */
2128
2278
  type ProviderExecutedTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseProviderTool<INPUT, OUTPUT, CONTEXT> & {
2129
- /**
2130
- * Flag that indicates whether the tool is executed by the provider.
2131
- */
2132
- isProviderExecuted: true;
2133
- /**
2134
- * Whether this provider-executed tool supports deferred results.
2135
- *
2136
- * When true, the tool result may not be returned in the same turn as the
2137
- * tool call (e.g., when using programmatic tool calling where a server tool
2138
- * triggers a client-executed tool, and the server tool's result is deferred
2139
- * until the client tool is resolved).
2140
- *
2141
- * This flag allows the AI SDK to handle tool results that arrive without
2142
- * a matching tool call in the current response.
2143
- *
2144
- * @default false
2145
- */
2146
- supportsDeferredResults?: boolean;
2279
+ /**
2280
+ * Flag that indicates whether the tool is executed by the provider.
2281
+ */
2282
+ isProviderExecuted: true;
2283
+ /**
2284
+ * Whether this provider-executed tool supports deferred results.
2285
+ *
2286
+ * When true, the tool result may not be returned in the same turn as the
2287
+ * tool call (e.g., when using programmatic tool calling where a server tool
2288
+ * triggers a client-executed tool, and the server tool's result is deferred
2289
+ * until the client tool is resolved).
2290
+ *
2291
+ * This flag allows the AI SDK to handle tool results that arrive without
2292
+ * a matching tool call in the current response.
2293
+ *
2294
+ * @default false
2295
+ */
2296
+ supportsDeferredResults?: boolean;
2147
2297
  };
2148
2298
  /**
2149
2299
  * A tool can either be user-defined or provider-defined.
@@ -2162,73 +2312,76 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
2162
2312
  * `ExecutableTool<Tool<...>>` so that `.execute` is non-nullable without
2163
2313
  * needing `isExecutableTool` or a `!` assertion at the call site.
2164
2314
  */
2165
- declare function tool<INPUT, OUTPUT, CONTEXT extends Context>(tool: Tool<INPUT, OUTPUT, CONTEXT> & {
2166
- execute: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2315
+ declare function tool$1<INPUT, OUTPUT, CONTEXT extends Context>(tool: Tool<INPUT, OUTPUT, CONTEXT> & {
2316
+ execute: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2167
2317
  }): ExecutableTool<Tool<INPUT, OUTPUT, CONTEXT>>;
2168
- declare function tool<INPUT, OUTPUT, CONTEXT extends Context>(tool: Tool<INPUT, OUTPUT, CONTEXT>): Tool<INPUT, OUTPUT, CONTEXT>;
2169
- declare function tool<INPUT, CONTEXT extends Context>(tool: Tool<INPUT, never, CONTEXT>): Tool<INPUT, never, CONTEXT>;
2170
- declare function tool<OUTPUT, CONTEXT extends Context>(tool: Tool<never, OUTPUT, CONTEXT>): Tool<never, OUTPUT, CONTEXT>;
2171
- declare function tool<CONTEXT extends Context>(tool: Tool<never, never, CONTEXT>): Tool<never, never, CONTEXT>;
2318
+ declare function tool$1<INPUT, OUTPUT, CONTEXT extends Context>(tool: Tool<INPUT, OUTPUT, CONTEXT>): Tool<INPUT, OUTPUT, CONTEXT>;
2319
+ declare function tool$1<INPUT, CONTEXT extends Context>(tool: Tool<INPUT, never, CONTEXT>): Tool<INPUT, never, CONTEXT>;
2320
+ declare function tool$1<OUTPUT, CONTEXT extends Context>(tool: Tool<never, OUTPUT, CONTEXT>): Tool<never, OUTPUT, CONTEXT>;
2321
+ declare function tool$1<CONTEXT extends Context>(tool: Tool<never, never, CONTEXT>): Tool<never, never, CONTEXT>;
2172
2322
  /**
2173
2323
  * Define a dynamic tool.
2174
2324
  */
2175
- declare function dynamicTool(tool: Omit<DynamicTool<unknown, unknown, Context>, 'type'>): DynamicTool<unknown, unknown, Context>;
2176
-
2325
+ export declare function dynamicTool(tool: Omit<DynamicTool<unknown, unknown, Context>, 'type'>): DynamicTool<unknown, unknown, Context>;
2326
+ //#endregion
2327
+ //#region src/provider-defined-tool-factory.d.ts
2177
2328
  /**
2178
2329
  * A provider-defined tool is a tool for which the provider defines the input
2179
2330
  * and output schemas, but does not execute the tool.
2180
2331
  */
2181
2332
  type ProviderDefinedToolFactory<INPUT, ARGS extends object, CONTEXT extends Context = {}> = <OUTPUT>(options: ARGS & {
2182
- execute?: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2183
- needsApproval?: Tool<INPUT, OUTPUT, CONTEXT>['needsApproval'];
2184
- toModelOutput?: Tool<INPUT, OUTPUT, CONTEXT>['toModelOutput'];
2185
- onInputStart?: Tool<INPUT, OUTPUT, CONTEXT>['onInputStart'];
2186
- onInputDelta?: Tool<INPUT, OUTPUT, CONTEXT>['onInputDelta'];
2187
- onInputAvailable?: Tool<INPUT, OUTPUT, CONTEXT>['onInputAvailable'];
2333
+ execute?: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2334
+ needsApproval?: Tool<INPUT, OUTPUT, CONTEXT>['needsApproval'];
2335
+ toModelOutput?: Tool<INPUT, OUTPUT, CONTEXT>['toModelOutput'];
2336
+ onInputStart?: Tool<INPUT, OUTPUT, CONTEXT>['onInputStart'];
2337
+ onInputDelta?: Tool<INPUT, OUTPUT, CONTEXT>['onInputDelta'];
2338
+ onInputAvailable?: Tool<INPUT, OUTPUT, CONTEXT>['onInputAvailable'];
2188
2339
  }) => ProviderDefinedTool<INPUT, OUTPUT, CONTEXT>;
2189
- declare function createProviderDefinedToolFactory<INPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, }: {
2190
- id: `${string}.${string}`;
2191
- inputSchema: FlexibleSchema<INPUT>;
2340
+ export declare function createProviderDefinedToolFactory<INPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema }: {
2341
+ id: `${string}.${string}`;
2342
+ inputSchema: FlexibleSchema<INPUT>;
2192
2343
  }): ProviderDefinedToolFactory<INPUT, ARGS, CONTEXT>;
2193
2344
  type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}> = (options: ARGS & {
2194
- execute?: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2195
- needsApproval?: Tool<INPUT, OUTPUT, CONTEXT>['needsApproval'];
2196
- toModelOutput?: Tool<INPUT, OUTPUT, CONTEXT>['toModelOutput'];
2197
- onInputStart?: Tool<INPUT, OUTPUT, CONTEXT>['onInputStart'];
2198
- onInputDelta?: Tool<INPUT, OUTPUT, CONTEXT>['onInputDelta'];
2199
- onInputAvailable?: Tool<INPUT, OUTPUT, CONTEXT>['onInputAvailable'];
2345
+ execute?: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
2346
+ needsApproval?: Tool<INPUT, OUTPUT, CONTEXT>['needsApproval'];
2347
+ toModelOutput?: Tool<INPUT, OUTPUT, CONTEXT>['toModelOutput'];
2348
+ onInputStart?: Tool<INPUT, OUTPUT, CONTEXT>['onInputStart'];
2349
+ onInputDelta?: Tool<INPUT, OUTPUT, CONTEXT>['onInputDelta'];
2350
+ onInputAvailable?: Tool<INPUT, OUTPUT, CONTEXT>['onInputAvailable'];
2200
2351
  }) => ProviderDefinedTool<INPUT, OUTPUT, CONTEXT>;
2201
- declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema, }: {
2202
- id: `${string}.${string}`;
2203
- inputSchema: FlexibleSchema<INPUT>;
2204
- outputSchema: FlexibleSchema<OUTPUT>;
2352
+ export declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema }: {
2353
+ id: `${string}.${string}`;
2354
+ inputSchema: FlexibleSchema<INPUT>;
2355
+ outputSchema: FlexibleSchema<OUTPUT>;
2205
2356
  }): ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS, CONTEXT>;
2206
-
2357
+ //#endregion
2358
+ //#region src/provider-executed-tool-factory.d.ts
2207
2359
  /**
2208
2360
  * A provider-executed tool is a tool for which the provider executes the tool.
2209
2361
  */
2210
2362
  type ProviderExecutedToolFactory<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}> = (options: ARGS & {
2211
- onInputStart?: Tool<INPUT, OUTPUT, CONTEXT>['onInputStart'];
2212
- onInputDelta?: Tool<INPUT, OUTPUT, CONTEXT>['onInputDelta'];
2213
- onInputAvailable?: Tool<INPUT, OUTPUT, CONTEXT>['onInputAvailable'];
2363
+ onInputStart?: Tool<INPUT, OUTPUT, CONTEXT>['onInputStart'];
2364
+ onInputDelta?: Tool<INPUT, OUTPUT, CONTEXT>['onInputDelta'];
2365
+ onInputAvailable?: Tool<INPUT, OUTPUT, CONTEXT>['onInputAvailable'];
2214
2366
  }) => ProviderExecutedTool<INPUT, OUTPUT, CONTEXT>;
2215
- declare function createProviderExecutedToolFactory<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema, supportsDeferredResults, }: {
2216
- id: `${string}.${string}`;
2217
- inputSchema: FlexibleSchema<INPUT>;
2218
- outputSchema: FlexibleSchema<OUTPUT>;
2219
- /**
2220
- * Whether this provider-executed tool supports deferred results.
2221
- *
2222
- * When true, the tool result may not be returned in the same turn as the
2223
- * tool call (e.g., when using programmatic tool calling where a server tool
2224
- * triggers a client-executed tool, and the server tool's result is deferred
2225
- * until the client tool is resolved).
2226
- *
2227
- * @default false
2228
- */
2229
- supportsDeferredResults?: boolean;
2367
+ export declare function createProviderExecutedToolFactory<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema, supportsDeferredResults }: {
2368
+ id: `${string}.${string}`;
2369
+ inputSchema: FlexibleSchema<INPUT>;
2370
+ outputSchema: FlexibleSchema<OUTPUT>;
2371
+ /**
2372
+ * Whether this provider-executed tool supports deferred results.
2373
+ *
2374
+ * When true, the tool result may not be returned in the same turn as the
2375
+ * tool call (e.g., when using programmatic tool calling where a server tool
2376
+ * triggers a client-executed tool, and the server tool's result is deferred
2377
+ * until the client tool is resolved).
2378
+ *
2379
+ * @default false
2380
+ */
2381
+ supportsDeferredResults?: boolean;
2230
2382
  }): ProviderExecutedToolFactory<INPUT, OUTPUT, ARGS, CONTEXT>;
2231
-
2383
+ //#endregion
2384
+ //#region src/cancel-response-body.d.ts
2232
2385
  /**
2233
2386
  * Cancels a response body to release the underlying connection.
2234
2387
  *
@@ -2241,8 +2394,9 @@ declare function createProviderExecutedToolFactory<INPUT, OUTPUT, ARGS extends o
2241
2394
  * Errors thrown while cancelling are ignored: the body may already be locked,
2242
2395
  * disturbed, or absent, none of which should mask the original rejection.
2243
2396
  */
2244
- declare function cancelResponseBody(response: Response): Promise<void>;
2245
-
2397
+ export declare function cancelResponseBody(response: Response): Promise<void>;
2398
+ //#endregion
2399
+ //#region src/read-response-with-size-limit.d.ts
2246
2400
  /**
2247
2401
  * Default maximum download size: 2 GiB.
2248
2402
  *
@@ -2254,7 +2408,7 @@ declare function cancelResponseBody(response: Response): Promise<void>;
2254
2408
  * Setting this limit converts an unrecoverable OOM crash into a catchable
2255
2409
  * `DownloadError`.
2256
2410
  */
2257
- declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
2411
+ export declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
2258
2412
  /**
2259
2413
  * Reads a fetch Response body with a size limit to prevent memory exhaustion.
2260
2414
  *
@@ -2268,19 +2422,21 @@ declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
2268
2422
  * @returns A Uint8Array containing the response body.
2269
2423
  * @throws DownloadError if the response exceeds maxBytes.
2270
2424
  */
2271
- declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
2272
- response: Response;
2273
- url: string;
2274
- maxBytes?: number;
2425
+ export declare function readResponseWithSizeLimit({ response, url, maxBytes }: {
2426
+ response: Response;
2427
+ url: string;
2428
+ maxBytes?: number;
2275
2429
  }): Promise<Uint8Array>;
2276
-
2430
+ //#endregion
2431
+ //#region src/remove-undefined-entries.d.ts
2277
2432
  /**
2278
2433
  * Removes entries from a record where the value is null or undefined.
2279
2434
  * @param record - The input object whose entries may be null or undefined.
2280
2435
  * @returns A new object containing only entries with non-null and non-undefined values.
2281
2436
  */
2282
- declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
2283
-
2437
+ export declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
2438
+ //#endregion
2439
+ //#region src/resolve.d.ts
2284
2440
  /**
2285
2441
  * A value or a lazy provider of a value, each of which may be synchronous or asynchronous.
2286
2442
  *
@@ -2296,13 +2452,14 @@ declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>
2296
2452
  * a {@link T} that happens to be a function—callers should wrap function values if disambiguation
2297
2453
  * is required.
2298
2454
  */
2299
- type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
2455
+ export type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
2300
2456
  /**
2301
2457
  * Resolves a value that could be a raw value, a Promise, a function returning a value,
2302
2458
  * or a function returning a Promise.
2303
2459
  */
2304
- declare function resolve<T>(value: Resolvable<T>): Promise<T>;
2305
-
2460
+ export declare function resolve<T>(value: Resolvable<T>): Promise<T>;
2461
+ //#endregion
2462
+ //#region src/resolve-full-media-type.d.ts
2306
2463
  /**
2307
2464
  * Resolves a file part's media type to a full `type/subtype` form required by
2308
2465
  * providers whose API demands the full IANA media type.
@@ -2315,45 +2472,48 @@ declare function resolve<T>(value: Resolvable<T>): Promise<T>;
2315
2472
  * - When neither applies (e.g. top-level-only with a URL source, or bytes that
2316
2473
  * cannot be detected), an `UnsupportedFunctionalityError` is thrown.
2317
2474
  */
2318
- declare function resolveFullMediaType({ part, }: {
2319
- part: LanguageModelV4FilePart;
2475
+ export declare function resolveFullMediaType({ part }: {
2476
+ part: LanguageModelV4FilePart;
2320
2477
  }): string;
2321
-
2478
+ //#endregion
2479
+ //#region src/resolve-provider-reference.d.ts
2322
2480
  /**
2323
2481
  * Resolves a provider reference to the provider-specific identifier for the
2324
2482
  * given provider. Throws `NoSuchProviderReferenceError` if the provider is not
2325
2483
  * found in the reference mapping.
2326
2484
  */
2327
- declare function resolveProviderReference({ reference, provider, }: {
2328
- reference: SharedV4ProviderReference;
2329
- provider: string;
2485
+ export declare function resolveProviderReference({ reference, provider }: {
2486
+ reference: SharedV4ProviderReference;
2487
+ provider: string;
2330
2488
  }): string;
2331
-
2332
- type RetryFunction = <OUTPUT>(fn: () => PromiseLike<OUTPUT>) => PromiseLike<OUTPUT>;
2333
- type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable';
2334
- type RetryErrorFactory = ({ message, reason, errors, }: {
2335
- message: string;
2336
- reason: RetryErrorReason;
2337
- errors: Array<unknown>;
2489
+ //#endregion
2490
+ //#region src/retry-with-exponential-backoff.d.ts
2491
+ export type RetryFunction = <OUTPUT>(fn: () => PromiseLike<OUTPUT>) => PromiseLike<OUTPUT>;
2492
+ export type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable';
2493
+ export type RetryErrorFactory = ({ message, reason, errors }: {
2494
+ message: string;
2495
+ reason: RetryErrorReason;
2496
+ errors: Array<unknown>;
2338
2497
  }) => unknown;
2339
- type RetryDelayProvider = ({ error, exponentialBackoffDelay, }: {
2340
- error: unknown;
2341
- exponentialBackoffDelay: number;
2498
+ export type RetryDelayProvider = ({ error, exponentialBackoffDelay }: {
2499
+ error: unknown;
2500
+ exponentialBackoffDelay: number;
2342
2501
  }) => number;
2343
- type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
2502
+ export type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
2344
2503
  /**
2345
2504
  * Retries a failed operation with exponential backoff.
2346
2505
  */
2347
- declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, backoffFactor, abortSignal, shouldRetry, getDelayInMs, createRetryError, }: {
2348
- maxRetries?: number;
2349
- initialDelayInMs?: number;
2350
- backoffFactor?: number;
2351
- abortSignal?: AbortSignal;
2352
- shouldRetry: ShouldRetryFunction;
2353
- getDelayInMs?: RetryDelayProvider;
2354
- createRetryError?: RetryErrorFactory;
2506
+ export declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, backoffFactor, abortSignal, shouldRetry, getDelayInMs, createRetryError }: {
2507
+ maxRetries?: number;
2508
+ initialDelayInMs?: number;
2509
+ backoffFactor?: number;
2510
+ abortSignal?: AbortSignal;
2511
+ shouldRetry: ShouldRetryFunction;
2512
+ getDelayInMs?: RetryDelayProvider;
2513
+ createRetryError?: RetryErrorFactory;
2355
2514
  }) => RetryFunction;
2356
-
2515
+ //#endregion
2516
+ //#region src/serialize-model-options.d.ts
2357
2517
  /**
2358
2518
  * Serializes a model instance for workflow step boundaries.
2359
2519
  * Returns the `modelId` plus the JSON-serializable config properties.
@@ -2374,66 +2534,70 @@ declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, back
2374
2534
  * }
2375
2535
  * ```
2376
2536
  */
2377
- declare function serializeModelOptions<CONFIG extends {
2378
- headers?: Resolvable<Record<string, string | undefined>>;
2537
+ export declare function serializeModelOptions<CONFIG extends {
2538
+ headers?: Resolvable<Record<string, string | undefined>>;
2379
2539
  }>(options: {
2380
- modelId: string;
2381
- config: CONFIG;
2540
+ modelId: string;
2541
+ config: CONFIG;
2382
2542
  }): {
2383
- modelId: string;
2384
- config: JSONObject;
2543
+ modelId: string;
2544
+ config: JSONObject;
2385
2545
  };
2386
-
2546
+ //#endregion
2547
+ //#region src/serialization-error.d.ts
2387
2548
  declare const symbol: unique symbol;
2388
- declare class SerializationError extends AISDKError {
2389
- private readonly [symbol];
2390
- constructor({ message, cause, }?: {
2391
- message?: string;
2392
- cause?: unknown;
2393
- });
2394
- static isInstance(error: unknown): error is SerializationError;
2549
+ export declare class SerializationError extends AISDKError {
2550
+ private readonly [symbol];
2551
+ constructor({ message, cause }?: {
2552
+ message?: string;
2553
+ cause?: unknown;
2554
+ });
2555
+ static isInstance(error: unknown): error is SerializationError;
2395
2556
  }
2396
-
2397
- declare function secureJsonParse(text: string): any;
2398
-
2557
+ //#endregion
2558
+ //#region src/secure-json-parse.d.ts
2559
+ export declare function secureJsonParse(text: string): any;
2560
+ //#endregion
2561
+ //#region src/streaming-tool-call-tracker.d.ts
2399
2562
  /**
2400
2563
  * Minimal interface for a streaming tool call delta from an OpenAI-compatible API.
2401
2564
  */
2402
2565
  interface StreamingToolCallDelta {
2403
- index?: number | null;
2404
- id?: string | null;
2405
- type?: string | null;
2406
- function?: {
2407
- name?: string | null;
2408
- arguments?: string | null;
2409
- } | null;
2566
+ index?: number | null;
2567
+ id?: string | null;
2568
+ type?: string | null;
2569
+ function?: {
2570
+ name?: string | null;
2571
+ arguments?: string | null;
2572
+ } | null;
2410
2573
  }
2411
2574
  interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
2412
- /**
2413
- * ID generator function for tool call IDs.
2414
- * Defaults to the standard generateId.
2415
- */
2416
- generateId?: () => string;
2417
- /**
2418
- * How to validate the `type` field on new tool call deltas.
2419
- * - `'none'`: no validation (default)
2420
- * - `'if-present'`: throw if type is present and not `'function'`
2421
- * - `'required'`: throw if type is not exactly `'function'`
2422
- */
2423
- typeValidation?: 'none' | 'if-present' | 'required';
2424
- /**
2425
- * Extract provider-specific metadata from a tool call delta.
2426
- * Called once when a new tool call is detected.
2427
- * The returned metadata is stored on the tool call and passed to
2428
- * `buildToolCallProviderMetadata` when the tool call is finalized.
2429
- */
2430
- extractMetadata?: (delta: DELTA) => SharedV4ProviderMetadata | undefined;
2431
- /**
2432
- * Build the `providerMetadata` object for a `tool-call` event.
2433
- * Receives the metadata previously extracted via `extractMetadata`.
2434
- * If `undefined` is returned, no `providerMetadata` is included in the event.
2435
- */
2436
- buildToolCallProviderMetadata?: (metadata: SharedV4ProviderMetadata | undefined) => SharedV4ProviderMetadata | undefined;
2575
+ /**
2576
+ * ID generator function for tool call IDs.
2577
+ * Blank or repeated outputs are converted to usable unique IDs.
2578
+ * Defaults to the standard generateId.
2579
+ */
2580
+ generateId?: () => string;
2581
+ /**
2582
+ * How to validate the `type` field on new tool call deltas.
2583
+ * - `'none'`: no validation (default)
2584
+ * - `'if-present'`: throw if type is present and not `'function'`
2585
+ * - `'required'`: throw if type is not exactly `'function'`
2586
+ */
2587
+ typeValidation?: 'none' | 'if-present' | 'required';
2588
+ /**
2589
+ * Extract provider-specific metadata from a tool call delta.
2590
+ * Called once when a new tool call is detected.
2591
+ * The returned metadata is stored on the tool call and passed to
2592
+ * `buildToolCallProviderMetadata` when the tool call is finalized.
2593
+ */
2594
+ extractMetadata?: (delta: DELTA) => SharedV4ProviderMetadata | undefined;
2595
+ /**
2596
+ * Build the `providerMetadata` object for a `tool-call` event.
2597
+ * Receives the metadata previously extracted via `extractMetadata`.
2598
+ * If `undefined` is returned, no `providerMetadata` is included in the event.
2599
+ */
2600
+ buildToolCallProviderMetadata?: (metadata: SharedV4ProviderMetadata | undefined) => SharedV4ProviderMetadata | undefined;
2437
2601
  }
2438
2602
  type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV4StreamPart>, 'enqueue'>;
2439
2603
  /**
@@ -2442,35 +2606,58 @@ type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<
2442
2606
  * emits tool-input-start/delta/end and tool-call events, and finalizes
2443
2607
  * unfinished tool calls on flush.
2444
2608
  *
2445
- * Used by openai, openai-compatible, groq, deepseek, and alibaba providers.
2446
- */
2447
- declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
2448
- private toolCalls;
2449
- private toolCallsById;
2450
- private toolCallsByIndex;
2451
- private latestToolCall;
2452
- private readonly controller;
2453
- private readonly _generateId;
2454
- private readonly typeValidation;
2455
- private readonly extractMetadata?;
2456
- private readonly buildToolCallProviderMetadata?;
2457
- constructor(controller: StreamingToolCallTrackerController, options?: StreamingToolCallTrackerOptions<DELTA>);
2458
- /**
2459
- * Process a tool call delta from a streaming response chunk.
2460
- * Emits tool-input-start, tool-input-delta, tool-input-end, and tool-call
2461
- * events as appropriate.
2462
- */
2463
- processDelta(toolCallDelta: DELTA): void;
2464
- /**
2465
- * Finalize any unfinished tool calls. Should be called during the stream's
2466
- * flush handler to ensure all tool calls are properly completed.
2467
- */
2468
- flush(): void;
2469
- private processNewToolCall;
2470
- private processExistingToolCall;
2471
- private finishToolCall;
2609
+ * Used by openai, openai-compatible, groq, deepseek, alibaba, mistral, and
2610
+ * moonshotai providers.
2611
+ */
2612
+ export declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
2613
+ private toolCalls;
2614
+ private toolCallsById;
2615
+ private toolCallsByIndex;
2616
+ private usedToolCallIds;
2617
+ private nextGeneratedIdSuffixes;
2618
+ private readonly controller;
2619
+ private readonly _generateId;
2620
+ private readonly typeValidation;
2621
+ private readonly extractMetadata?;
2622
+ private readonly buildToolCallProviderMetadata?;
2623
+ constructor(controller: StreamingToolCallTrackerController, options?: StreamingToolCallTrackerOptions<DELTA>);
2624
+ /**
2625
+ * Process a tool call delta from a streaming response chunk.
2626
+ * Emits tool-input-start, tool-input-delta, tool-input-end, and tool-call
2627
+ * events as appropriate.
2628
+ */
2629
+ processDelta(toolCallDelta: DELTA): void;
2630
+ /**
2631
+ * Finalize any unfinished tool calls. Should be called during the stream's
2632
+ * flush handler to ensure all tool calls are properly completed.
2633
+ */
2634
+ flush(): void;
2635
+ /**
2636
+ * Correlation precedence for streamed deltas:
2637
+ *
2638
+ * | ID evidence | index/name evidence | start evidence | resolution |
2639
+ * | --- | --- | --- | --- |
2640
+ * | known | matching | any | matching call, new call, or ambiguity |
2641
+ * | known | conflicting | named | new call |
2642
+ * | unseen | matching | structured start | new call |
2643
+ * | unseen | matching | continuation | matching call or ambiguity |
2644
+ * | absent | matching | any | matching call, new call, or ambiguity |
2645
+ * | absent | absent | named | new call |
2646
+ * | absent | absent | unnamed | sole unfinished call, new call, or ambiguity |
2647
+ */
2648
+ private resolveToolCall;
2649
+ private filterToolCallsByName;
2650
+ private resolveMatchingToolCall;
2651
+ private processNewToolCall;
2652
+ private associateWireId;
2653
+ private associateIndex;
2654
+ private createToolCallId;
2655
+ private getNonBlankString;
2656
+ private processExistingToolCall;
2657
+ private finishToolCall;
2472
2658
  }
2473
-
2659
+ //#endregion
2660
+ //#region src/strip-file-extension.d.ts
2474
2661
  /**
2475
2662
  * Strips file extension segments from a filename.
2476
2663
  *
@@ -2479,8 +2666,9 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
2479
2666
  * - "archive.tar.gz" -> "archive"
2480
2667
  * - "filename" -> "filename"
2481
2668
  */
2482
- declare function stripFileExtension(filename: string): string;
2483
-
2669
+ export declare function stripFileExtension(filename: string): string;
2670
+ //#endregion
2671
+ //#region src/transcription-stream-envelope.d.ts
2484
2672
  /**
2485
2673
  * Experimental transcription-stream WebSocket envelope (v1): the standard
2486
2674
  * serialization of `TranscriptionModelV4.doStream` over a WebSocket. Clients
@@ -2526,30 +2714,30 @@ declare const TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE = "transcription-stream
2526
2714
  * The client's session start frame. Optional keys are omitted when undefined.
2527
2715
  */
2528
2716
  type TranscriptionStreamStartFrame = {
2529
- type: typeof TRANSCRIPTION_STREAM_START_FRAME_TYPE;
2530
- /** Audio format of the binary audio frames, e.g. `{ type: 'audio/pcm', rate: 16000 }`. */
2531
- inputAudioFormat: {
2532
- type: string;
2533
- rate?: number;
2534
- };
2535
- /** Provider-specific options, passed through verbatim. */
2536
- providerOptions?: Record<string, JSONObject>;
2537
- /** When true, the server should include `raw` parts in the stream. */
2538
- includeRawChunks?: boolean;
2717
+ type: typeof TRANSCRIPTION_STREAM_START_FRAME_TYPE;
2718
+ /** Audio format of the binary audio frames, e.g. `{ type: 'audio/pcm', rate: 16000 }`. */
2719
+ inputAudioFormat: {
2720
+ type: string;
2721
+ rate?: number;
2722
+ };
2723
+ /** Provider-specific options, passed through verbatim. */
2724
+ providerOptions?: Record<string, JSONObject>;
2725
+ /** When true, the server should include `raw` parts in the stream. */
2726
+ includeRawChunks?: boolean;
2539
2727
  };
2540
2728
  /** Server-side classification of a client TEXT frame. */
2541
2729
  type TranscriptionStreamClientFrame = {
2542
- type: 'start';
2543
- frame: TranscriptionStreamStartFrame;
2730
+ type: 'start';
2731
+ frame: TranscriptionStreamStartFrame;
2544
2732
  } | {
2545
- type: 'audio-done';
2733
+ type: 'audio-done';
2546
2734
  } | {
2547
- /** Malformed JSON or a recognized frame with an invalid shape. */
2548
- type: 'invalid';
2549
- message: string;
2735
+ /** Malformed JSON or a recognized frame with an invalid shape. */
2736
+ type: 'invalid';
2737
+ message: string;
2550
2738
  } | {
2551
- /** Unrecognized frame type; ignore for forward compatibility. */
2552
- type: 'unknown';
2739
+ /** Unrecognized frame type; ignore for forward compatibility. */
2740
+ type: 'unknown';
2553
2741
  };
2554
2742
  /**
2555
2743
  * Server-side: parse a client TEXT frame. Validates envelope shape only and
@@ -2576,13 +2764,16 @@ declare function serializeTranscriptionStreamPart(part: Experimental_Transcripti
2576
2764
  * Revives `response-metadata.timestamp` to a `Date`.
2577
2765
  */
2578
2766
  declare function parseTranscriptionStreamPart(text: string): Experimental_TranscriptionModelV4StreamPart | undefined;
2579
-
2580
- declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
2581
- declare function convertUint8ArrayToBase64(array: Uint8Array): string;
2582
- declare function convertToBase64(value: string | Uint8Array): string;
2583
-
2584
- declare function validateBaseURL(baseURL: string | undefined): string | undefined;
2585
-
2767
+ //#endregion
2768
+ //#region src/uint8-utils.d.ts
2769
+ export declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
2770
+ export declare function convertUint8ArrayToBase64(array: Uint8Array): string;
2771
+ export declare function convertToBase64(value: string | Uint8Array): string;
2772
+ //#endregion
2773
+ //#region src/validate-base-url.d.ts
2774
+ export declare function validateBaseURL(baseURL: string | undefined): string | undefined;
2775
+ //#endregion
2776
+ //#region src/validate-download-url.d.ts
2586
2777
  /**
2587
2778
  * Validates that a URL is safe to download from, blocking private/internal addresses
2588
2779
  * to prevent SSRF attacks.
@@ -2593,8 +2784,9 @@ declare function validateBaseURL(baseURL: string | undefined): string | undefine
2593
2784
  * @param url - The URL string to validate.
2594
2785
  * @throws DownloadError if the URL is unsafe.
2595
2786
  */
2596
- declare function validateDownloadUrl(url: string): void;
2597
-
2787
+ export declare function validateDownloadUrl(url: string): void;
2788
+ //#endregion
2789
+ //#region src/validate-types.d.ts
2598
2790
  /**
2599
2791
  * Validates the types of an unknown object using a schema and
2600
2792
  * return a strongly-typed object.
@@ -2605,10 +2797,10 @@ declare function validateDownloadUrl(url: string): void;
2605
2797
  * @param {TypeValidationContext} options.context - Optional context about what is being validated.
2606
2798
  * @returns {Promise<T>} - The typed object.
2607
2799
  */
2608
- declare function validateTypes<OBJECT>({ value, schema, context, }: {
2609
- value: unknown;
2610
- schema: FlexibleSchema<OBJECT>;
2611
- context?: TypeValidationContext;
2800
+ export declare function validateTypes<OBJECT>({ value, schema, context }: {
2801
+ value: unknown;
2802
+ schema: FlexibleSchema<OBJECT>;
2803
+ context?: TypeValidationContext;
2612
2804
  }): Promise<OBJECT>;
2613
2805
  /**
2614
2806
  * Safely validates the types of an unknown object using a schema and
@@ -2620,22 +2812,24 @@ declare function validateTypes<OBJECT>({ value, schema, context, }: {
2620
2812
  * @param {TypeValidationContext} options.context - Optional context about what is being validated.
2621
2813
  * @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
2622
2814
  */
2623
- declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
2624
- value: unknown;
2625
- schema: FlexibleSchema<OBJECT>;
2626
- context?: TypeValidationContext;
2815
+ export declare function safeValidateTypes<OBJECT>({ value, schema, context }: {
2816
+ value: unknown;
2817
+ schema: FlexibleSchema<OBJECT>;
2818
+ context?: TypeValidationContext;
2627
2819
  }): Promise<{
2628
- success: true;
2629
- value: OBJECT;
2630
- rawValue: unknown;
2820
+ success: true;
2821
+ value: OBJECT;
2822
+ rawValue: unknown;
2631
2823
  } | {
2632
- success: false;
2633
- error: TypeValidationError;
2634
- rawValue: unknown;
2824
+ success: false;
2825
+ error: TypeValidationError;
2826
+ rawValue: unknown;
2635
2827
  }>;
2636
-
2637
- declare const VERSION: string;
2638
-
2828
+ //#endregion
2829
+ //#region src/version.d.ts
2830
+ export declare const VERSION: string;
2831
+ //#endregion
2832
+ //#region src/with-user-agent-suffix.d.ts
2639
2833
  /**
2640
2834
  * Appends suffix parts to the `user-agent` header.
2641
2835
  * If a `user-agent` header already exists, the suffix parts are appended to it.
@@ -2646,10 +2840,12 @@ declare const VERSION: string;
2646
2840
  * @param userAgentSuffixParts - The parts to append to the `user-agent` header.
2647
2841
  * @returns The new headers with the `user-agent` header set or updated.
2648
2842
  */
2649
- declare function withUserAgentSuffix(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
2650
-
2651
- declare function withoutTrailingSlash(url: string | undefined): string | undefined;
2652
-
2843
+ export declare function withUserAgentSuffix(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
2844
+ //#endregion
2845
+ //#region src/without-trailing-slash.d.ts
2846
+ export declare function withoutTrailingSlash(url: string | undefined): string | undefined;
2847
+ //#endregion
2848
+ //#region src/types/infer-tool-context.d.ts
2653
2849
  /**
2654
2850
  * Detects the `any` type so untyped tools can be treated as having no explicit
2655
2851
  * context type.
@@ -2669,17 +2865,20 @@ type IsUntypedContext<CONTEXT> = IsAny<CONTEXT> extends true ? true : unknown ex
2669
2865
  * Infer the context type of a tool.
2670
2866
  */
2671
2867
  type InferToolContext<TOOL extends Tool> = TOOL extends Tool<any, any, infer CONTEXT> ? IsUntypedContext<CONTEXT> extends true ? never : CONTEXT : never;
2672
-
2868
+ //#endregion
2869
+ //#region src/types/infer-tool-input.d.ts
2673
2870
  /**
2674
2871
  * Infer the input type of a tool.
2675
2872
  */
2676
2873
  type InferToolInput<TOOL extends Tool<any, any, any>> = TOOL extends Tool<infer INPUT, any, any> ? INPUT : never;
2677
-
2874
+ //#endregion
2875
+ //#region src/types/infer-tool-output.d.ts
2678
2876
  /**
2679
2877
  * Infer the output type of a tool.
2680
2878
  */
2681
2879
  type InferToolOutput<TOOL extends Tool<any, any, any>> = TOOL extends Tool<any, infer OUTPUT, any> ? OUTPUT : never;
2682
-
2880
+ //#endregion
2881
+ //#region src/types/execute-tool.d.ts
2683
2882
  /**
2684
2883
  * Executes a tool function and normalizes its results into a stream of outputs.
2685
2884
  *
@@ -2694,44 +2893,40 @@ type InferToolOutput<TOOL extends Tool<any, any, any>> = TOOL extends Tool<any,
2694
2893
  * @yields A preliminary output for each streamed value, followed by a final output, or a single final
2695
2894
  * output for non-streaming tools.
2696
2895
  */
2697
- declare function executeTool<TOOL extends Tool>({ tool, input, options, }: {
2698
- tool: ExecutableTool<TOOL>;
2699
- input: InferToolInput<TOOL>;
2700
- options: ToolExecutionOptions<InferToolContext<TOOL>>;
2896
+ export declare function executeTool<TOOL extends Tool>({ tool, input, options }: {
2897
+ tool: ExecutableTool<TOOL>;
2898
+ input: InferToolInput<TOOL>;
2899
+ options: ToolExecutionOptions<InferToolContext<TOOL>>;
2701
2900
  }): AsyncGenerator<{
2702
- type: 'preliminary';
2703
- output: InferToolOutput<TOOL>;
2901
+ type: 'preliminary';
2902
+ output: InferToolOutput<TOOL>;
2704
2903
  } | {
2705
- type: 'final';
2706
- output: InferToolOutput<TOOL>;
2904
+ type: 'final';
2905
+ output: InferToolOutput<TOOL>;
2707
2906
  }>;
2708
-
2907
+ //#endregion
2908
+ //#region src/types/tool-set.d.ts
2709
2909
  /**
2710
2910
  * A mapping of tool names to tool definitions.
2711
2911
  */
2712
2912
  type ToolSet = Record<string, (Tool<never, never, any> | Tool<any, any, any> | Tool<any, never, any> | Tool<never, any, any>) & Pick<Tool<any, any, any>, 'execute' | 'onInputAvailable' | 'onInputStart' | 'onInputDelta' | 'needsApproval'>>;
2713
-
2913
+ //#endregion
2914
+ //#region src/types/infer-tool-set-context.d.ts
2714
2915
  /**
2715
2916
  * Builds the required portion of the tool context map for tools whose context
2716
2917
  * type does not include `undefined`.
2717
2918
  */
2718
- type RequiredToolSetContext<TOOLS extends ToolSet> = {
2719
- [K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? never : K]: InferToolContext<NoInfer<TOOLS[K]>>;
2720
- };
2919
+ type RequiredToolSetContext<TOOLS extends ToolSet> = { [K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? never : K]: InferToolContext<NoInfer<TOOLS[K]>>; };
2721
2920
  /**
2722
2921
  * Builds the optional portion of the tool context map for tools whose context
2723
2922
  * object itself may be `undefined`.
2724
2923
  */
2725
- type OptionalToolSetContext<TOOLS extends ToolSet> = {
2726
- [K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? K : never]?: InferToolContext<NoInfer<TOOLS[K]>>;
2727
- };
2924
+ type OptionalToolSetContext<TOOLS extends ToolSet> = { [K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? K : never]?: InferToolContext<NoInfer<TOOLS[K]>>; };
2728
2925
  /**
2729
2926
  * Flattens intersected mapped types so type equality assertions and editor
2730
2927
  * hovers show the resulting object shape.
2731
2928
  */
2732
- type Normalize<OBJECT> = {
2733
- [KEY in keyof OBJECT]: OBJECT[KEY];
2734
- };
2929
+ type Normalize<OBJECT> = { [KEY in keyof OBJECT]: OBJECT[KEY]; };
2735
2930
  /**
2736
2931
  * Infer the context type for a tool set.
2737
2932
  *
@@ -2741,85 +2936,89 @@ type Normalize<OBJECT> = {
2741
2936
  * `undefined` are represented as optional properties.
2742
2937
  */
2743
2938
  type InferToolSetContext<TOOLS extends ToolSet> = Normalize<RequiredToolSetContext<TOOLS> & OptionalToolSetContext<TOOLS>>;
2744
-
2939
+ //#endregion
2940
+ //#region src/types/tool-call.d.ts
2745
2941
  /**
2746
2942
  * Typed tool call that is returned by generateText and streamText.
2747
2943
  * It contains the tool call ID, the tool name, and the tool arguments.
2748
2944
  */
2749
2945
  interface ToolCall<NAME extends string, INPUT> {
2750
- /**
2751
- * ID of the tool call. This ID is used to match the tool call with the tool result.
2752
- */
2753
- toolCallId: string;
2754
- /**
2755
- * Name of the tool that is being called.
2756
- */
2757
- toolName: NAME;
2758
- /**
2759
- * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
2760
- */
2761
- input: INPUT;
2762
- /**
2763
- * Whether the tool call will be executed by the provider.
2764
- * If this flag is not set or is false, the tool call will be executed by the client.
2765
- */
2766
- providerExecuted?: boolean;
2767
- /**
2768
- * Whether the tool is dynamic.
2769
- */
2770
- dynamic?: boolean;
2946
+ /**
2947
+ * ID of the tool call. This ID is used to match the tool call with the tool result.
2948
+ */
2949
+ toolCallId: string;
2950
+ /**
2951
+ * Name of the tool that is being called.
2952
+ */
2953
+ toolName: NAME;
2954
+ /**
2955
+ * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
2956
+ */
2957
+ input: INPUT;
2958
+ /**
2959
+ * Whether the tool call will be executed by the provider.
2960
+ * If this flag is not set or is false, the tool call will be executed by the client.
2961
+ */
2962
+ providerExecuted?: boolean;
2963
+ /**
2964
+ * Whether the tool is dynamic.
2965
+ */
2966
+ dynamic?: boolean;
2771
2967
  }
2772
-
2968
+ //#endregion
2969
+ //#region src/types/tool-caller.d.ts
2773
2970
  type ToolCallerDefinition = {
2774
- type: 'local';
2775
- bind: (tools: ToolSet) => Tool;
2776
- /**
2777
- * Creates a provider-agnostic user message that describes the tools
2778
- * available through this caller. When present, the unbound caller tool
2779
- * remains model-visible so its definition stays stable, while the
2780
- * returned message is added to the conversation when its content has
2781
- * not already been announced.
2782
- */
2783
- prepareModelMessage?: (tools: ToolSet) => string | undefined;
2971
+ type: 'local';
2972
+ bind: (tools: ToolSet) => Tool;
2973
+ /**
2974
+ * Creates a provider-agnostic user message that describes the tools
2975
+ * available through this caller. When present, the unbound caller tool
2976
+ * remains model-visible so its definition stays stable, while the
2977
+ * returned message is added to the conversation when its content has
2978
+ * not already been announced.
2979
+ */
2980
+ prepareModelMessage?: (tools: ToolSet) => string | undefined;
2784
2981
  } | {
2785
- type: 'provider';
2786
- prepareProviderOptions: (providerOptions: ProviderOptions | undefined) => ProviderOptions;
2982
+ type: 'provider';
2983
+ prepareProviderOptions: (providerOptions: ProviderOptions | undefined) => ProviderOptions;
2787
2984
  };
2788
2985
  type ToolCallerTool<TOOL extends Tool = Tool> = TOOL & {
2789
- readonly experimental_toolCaller: ToolCallerDefinition;
2986
+ readonly experimental_toolCaller: ToolCallerDefinition;
2790
2987
  };
2791
2988
  declare function toolCaller<TOOL extends Tool>(tool: TOOL, definition: ToolCallerDefinition): ToolCallerTool<TOOL>;
2792
2989
  declare function getToolCaller(tool: Tool | undefined): ToolCallerDefinition | undefined;
2793
-
2990
+ //#endregion
2991
+ //#region src/types/tool-result.d.ts
2794
2992
  /**
2795
2993
  * Typed tool result that is returned by `generateText` and `streamText`.
2796
2994
  * It contains the tool call ID, the tool name, the tool arguments, and the tool result.
2797
2995
  */
2798
2996
  interface ToolResult<NAME extends string, INPUT, OUTPUT> {
2799
- /**
2800
- * ID of the tool call. This ID is used to match the tool call with the tool result.
2801
- */
2802
- toolCallId: string;
2803
- /**
2804
- * Name of the tool that was called.
2805
- */
2806
- toolName: NAME;
2807
- /**
2808
- * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
2809
- */
2810
- input: INPUT;
2811
- /**
2812
- * Result of the tool call. This is the result of the tool's execution.
2813
- */
2814
- output: OUTPUT;
2815
- /**
2816
- * Whether the tool result has been executed by the provider.
2817
- */
2818
- providerExecuted?: boolean;
2819
- /**
2820
- * Whether the tool is dynamic.
2821
- */
2822
- dynamic?: boolean;
2997
+ /**
2998
+ * ID of the tool call. This ID is used to match the tool call with the tool result.
2999
+ */
3000
+ toolCallId: string;
3001
+ /**
3002
+ * Name of the tool that was called.
3003
+ */
3004
+ toolName: NAME;
3005
+ /**
3006
+ * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
3007
+ */
3008
+ input: INPUT;
3009
+ /**
3010
+ * Result of the tool call. This is the result of the tool's execution.
3011
+ */
3012
+ output: OUTPUT;
3013
+ /**
3014
+ * Whether the tool result has been executed by the provider.
3015
+ */
3016
+ providerExecuted?: boolean;
3017
+ /**
3018
+ * Whether the tool is dynamic.
3019
+ */
3020
+ dynamic?: boolean;
2823
3021
  }
2824
-
2825
- export { type Arrayable, type AssistantContent, type AssistantModelMessage, type Context, type CustomPart, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type DynamicTool, EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE, TRANSCRIPTION_STREAM_START_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE, type ExecutableTool, type SandboxProcess as Experimental_SandboxProcess, type SandboxSession as Experimental_SandboxSession, type ToolCallerDefinition as Experimental_ToolCallerDefinition, type ToolCallerTool as Experimental_ToolCallerTool, type TranscriptionStreamClientFrame as Experimental_TranscriptionStreamClientFrame, type TranscriptionStreamStartFrame as Experimental_TranscriptionStreamStartFrame, type FetchFunction, type FileData, type FileDataData, type FileDataReference, type FileDataText, type FileDataUrl, type FilePart, type FlexibleSchema, type FunctionTool, type HasRequiredKey, type IdGenerator, type ImagePart, type InferSchema, type InferToolContext, type InferToolInput, type InferToolOutput, type InferToolSetContext, type LazySchema, type MaybePromiseLike, type ModelMessage, type MultipartStreamPart, type ParseResult, type ProviderDefinedTool, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderExecutedTool, type ProviderExecutedToolFactory, type ProviderOptions, type ProviderReference, type ProviderStreamError, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type RetryDelayProvider, type RetryErrorFactory, type RetryErrorReason, type RetryFunction, type Schema, SerializationError, type ShouldRetryFunction, type StreamingToolCallDelta, StreamingToolCallTracker, type StreamingToolCallTrackerOptions, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type ToolSet, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type WebSocketConnection, type WebSocketConstructor, type WebSocketLike, asArray, asSchema, cancelResponseBody, combineHeaders, connectToWebSocket, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertInlineFileDataToUint8Array, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createBinaryStreamResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonLinesResponseHandler, createJsonResponseHandler, createLanguageModelResponseMetadata, createNullLanguageModelUsage, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createProviderExecutedToolFactory, createProviderStreamError, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, deleteFromApi, detectMediaType, downloadBlob, dynamicTool, executeTool, getToolCaller as experimental_getToolCaller, parseTranscriptionStreamClientFrame as experimental_parseTranscriptionStreamClientFrame, parseTranscriptionStreamPart as experimental_parseTranscriptionStreamPart, serializeTranscriptionStreamPart as experimental_serializeTranscriptionStreamPart, toolCaller as experimental_toolCaller, extractLines, extractResponseHeaders, fetchWithValidatedEndpoint, fetchWithValidatedRedirects, filterNullable, generateId, getFromApi, getRuntimeEnvironmentUserAgent, getTopLevelMediaType, getWebSocketConstructor, injectJsonInstructionIntoMessages, isAbortError, isBrowserRuntime, isBuffer, isCustomReasoning, isExecutableTool, isFullMediaType, isNonNullable, isParsableJson, isProviderReference, isProviderStreamError, isRecord, isSameOrigin, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mapReasoningToProviderBudget, mapReasoningToProviderEffort, mediaTypeToExtension, normalizeBatchRequestCounts, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postMultipartStreamToApi, postToApi, readResponseWithSizeLimit, readWebSocketMessageText, removeUndefinedEntries, resolve, resolveFullMediaType, resolveProviderReference, retryWithExponentialBackoff, safeParseJSON, safeValidateTypes, secureJsonParse, serializeModelOptions, stripFileExtension, toWebSocketUrl, tool, validateBaseURL, validateDownloadUrl, validateTypes, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
3022
+ //#endregion
3023
+ export { type Arrayable, type AssistantContent, type AssistantModelMessage, type Context, type CustomPart, type DataContent, type DynamicTool, EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER as EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE, TRANSCRIPTION_STREAM_START_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE, type EmbeddingModelProviderOptionsTransformer, type EventSourceMessage, EventSourceParserStream, type ExecutableTool, type SandboxProcess as Experimental_SandboxProcess, type SandboxSession as Experimental_SandboxSession, type ToolCallerDefinition as Experimental_ToolCallerDefinition, type ToolCallerTool as Experimental_ToolCallerTool, type TranscriptionStreamClientFrame as Experimental_TranscriptionStreamClientFrame, type TranscriptionStreamStartFrame as Experimental_TranscriptionStreamStartFrame, type FileData, type FileDataData, type FileDataReference, type FileDataText, type FileDataUrl, type FilePart, type FlexibleSchema, type FunctionTool, type HasRequiredKey, type IdGenerator, type ImagePart, type InferSchema, type InferToolContext, type InferToolInput, type InferToolOutput, type InferToolSetContext, type LazySchema, type MaybePromiseLike, type ModelMessage, type ProviderDefinedTool, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderExecutedTool, type ProviderExecutedToolFactory, type ProviderOptions, type ProviderReference, type ProviderStreamError, type ReasoningFilePart, type ReasoningPart, type Schema, type StreamingToolCallDelta, type StreamingToolCallTrackerOptions, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type ToolSet, type UserContent, type UserModelMessage, type ValidationResult, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, type WebSocketConnection, type WebSocketConstructor, type WebSocketLike, getToolCaller as experimental_getToolCaller, parseTranscriptionStreamClientFrame as experimental_parseTranscriptionStreamClientFrame, parseTranscriptionStreamPart as experimental_parseTranscriptionStreamPart, serializeTranscriptionStreamPart as experimental_serializeTranscriptionStreamPart, toolCaller as experimental_toolCaller, getErrorMessage, tool$1 as tool };
3024
+ //# sourceMappingURL=index.d.ts.map