@mastra/voice-google-gemini-live 0.14.17-alpha.1 → 0.14.17

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.
@@ -19,7 +19,11 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
19
19
  private onData?;
20
20
  private sendAutomaticallyWhen?;
21
21
  private activeResponse;
22
+ private activeResumeRequest;
23
+ private resumableStreamState;
22
24
  private jobExecutor;
25
+ private activeStopCount;
26
+ private stopGeneration;
23
27
  constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
24
28
  state: ChatState<UI_MESSAGE>;
25
29
  });
@@ -105,10 +109,14 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
105
109
  errorText: string;
106
110
  }) => Promise<void>;
107
111
  /**
108
- * Abort the current request immediately, keep the generated tokens if any.
112
+ * Abort the current request, keep the generated tokens if any, and wait for
113
+ * the request pipeline to finish.
109
114
  */
110
115
  stop: () => Promise<void>;
116
+ private shouldSendAutomatically;
117
+ private runAutomaticRequest;
111
118
  private makeRequest;
119
+ private makeRequestImpl;
112
120
  }
113
121
 
114
122
  declare namespace _ai_sdk_provider_utils {
@@ -183,6 +191,7 @@ declare namespace _ai_sdk_provider_utils {
183
191
  dynamicTool,
184
192
  executeTool,
185
193
  extractResponseHeaders,
194
+ fetchWithValidatedEndpoint,
186
195
  fetchWithValidatedRedirects,
187
196
  generateId,
188
197
  getErrorMessage,
@@ -260,38 +269,6 @@ export declare class AISDKError extends Error {
260
269
  protected static hasMarker(error: unknown, marker: string): boolean;
261
270
  }
262
271
 
263
- /**
264
- * Custom error class for AI SDK related errors.
265
- * @extends Error
266
- */
267
- declare class AISDKError_2 extends Error {
268
- private readonly [symbol$d_2];
269
- /**
270
- * The underlying cause of the error, if any.
271
- */
272
- readonly cause?: unknown;
273
- /**
274
- * Creates an AI SDK Error.
275
- *
276
- * @param {Object} params - The parameters for creating the error.
277
- * @param {string} params.name - The name of the error.
278
- * @param {string} params.message - The error message.
279
- * @param {unknown} [params.cause] - The underlying cause of the error.
280
- */
281
- constructor({ name, message, cause, }: {
282
- name: string;
283
- message: string;
284
- cause?: unknown;
285
- });
286
- /**
287
- * Checks if the given error is an AI SDK Error.
288
- * @param {unknown} error - The error to check.
289
- * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
290
- */
291
- static isInstance(error: unknown): error is AISDKError_2;
292
- protected static hasMarker(error: unknown, marker: string): boolean;
293
- }
294
-
295
272
  export declare class APICallError extends AISDKError {
296
273
  private readonly [symbol$c];
297
274
  readonly url: string;
@@ -316,30 +293,6 @@ export declare class APICallError extends AISDKError {
316
293
  static isInstance(error: unknown): error is APICallError;
317
294
  }
318
295
 
319
- declare class APICallError_2 extends AISDKError_2 {
320
- private readonly [symbol$c_2];
321
- readonly url: string;
322
- readonly requestBodyValues: unknown;
323
- readonly statusCode?: number;
324
- readonly responseHeaders?: Record<string, string>;
325
- readonly responseBody?: string;
326
- readonly isRetryable: boolean;
327
- readonly data?: unknown;
328
- constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
329
- data, }: {
330
- message: string;
331
- url: string;
332
- requestBodyValues: unknown;
333
- statusCode?: number;
334
- responseHeaders?: Record<string, string>;
335
- responseBody?: string;
336
- cause?: unknown;
337
- isRetryable?: boolean;
338
- data?: unknown;
339
- });
340
- static isInstance(error: unknown): error is APICallError_2;
341
- }
342
-
343
296
  export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
344
297
 
345
298
  /**
@@ -658,6 +611,7 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
658
611
  *
659
612
  * @param options - Configuration object containing:
660
613
  * @param options.chatId - Unique identifier for the chat session to reconnect to
614
+ * @param options.abortSignal - Signal to abort the reconnection request if needed
661
615
  * @param options.headers - Additional HTTP headers to include in the reconnection request
662
616
  * @param options.body - Additional JSON properties to include in the request body
663
617
  * @param options.metadata - Custom metadata to attach to the request
@@ -671,6 +625,8 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
671
625
  reconnectToStream: (options: {
672
626
  /** Unique identifier for the chat session to reconnect to */
673
627
  chatId: string;
628
+ /** Signal to abort the reconnection request if needed */
629
+ abortSignal?: AbortSignal;
674
630
  } & ChatRequestOptions) => Promise<ReadableStream<UIMessageChunk> | null>;
675
631
  }
676
632
 
@@ -706,9 +662,10 @@ export declare type CompletionRequestOptions = {
706
662
  * @param {ReadableStream} stream - The ReadableStream to be consumed.
707
663
  * @returns {Promise<void>} A promise that resolves when the stream is fully consumed.
708
664
  */
709
- export declare function consumeStream({ stream, onError, }: {
665
+ export declare function consumeStream({ stream, onError, abortSignal, }: {
710
666
  stream: ReadableStream;
711
667
  onError?: (error: unknown) => void;
668
+ abortSignal?: AbortSignal;
712
669
  }): Promise<void>;
713
670
 
714
671
  declare type ConsumeStreamOptions = {
@@ -916,7 +873,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
916
873
  errorSchema: FlexibleValidator<T>;
917
874
  errorToMessage: (error: T) => string;
918
875
  isRetryable?: (response: Response, error?: T) => boolean;
919
- }) => ResponseHandler<APICallError_2>;
876
+ }) => ResponseHandler<APICallError>;
920
877
 
921
878
  declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
922
879
 
@@ -952,7 +909,7 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
952
909
  languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
953
910
  }): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
954
911
 
955
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
912
+ declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
956
913
 
957
914
  export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
958
915
  textStream: ReadableStream<string>;
@@ -979,7 +936,7 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
979
936
  export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
980
937
  originalMessages, onFinish, generateId, }: {
981
938
  execute: (options: {
982
- writer: UIMessageStreamWriter<UI_MESSAGE>;
939
+ writer: UIMessageStreamWriterWithOutcome<UI_MESSAGE>;
983
940
  }) => Promise<void> | void;
984
941
  onError?: (error: unknown) => string;
985
942
  /**
@@ -991,7 +948,7 @@ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ ex
991
948
  generateId?: IdGenerator;
992
949
  }): ReadableStream<InferUIMessageChunk<UI_MESSAGE>>;
993
950
 
994
- export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
951
+ export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
995
952
  stream: ReadableStream<UIMessageChunk>;
996
953
  }): Response;
997
954
 
@@ -1140,7 +1097,7 @@ export declare class DownloadError extends AISDKError {
1140
1097
  static isInstance(error: unknown): error is DownloadError;
1141
1098
  }
1142
1099
 
1143
- declare class DownloadError_2 extends AISDKError_2 {
1100
+ declare class DownloadError_2 extends AISDKError {
1144
1101
  private readonly [symbol_2];
1145
1102
  readonly url: string;
1146
1103
  readonly statusCode?: number;
@@ -1163,7 +1120,7 @@ export declare function dynamicTool(tool: {
1163
1120
  providerOptions?: ProviderOptions;
1164
1121
  inputSchema: FlexibleSchema<unknown>;
1165
1122
  execute: ToolExecuteFunction<unknown, unknown>;
1166
- toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart_2['output'];
1123
+ toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart['output'];
1167
1124
  }): Tool<unknown, unknown> & {
1168
1125
  type: 'dynamic';
1169
1126
  };
@@ -1212,6 +1169,13 @@ export declare type DynamicToolResult = {
1212
1169
 
1213
1170
  export declare type DynamicToolUIPart = {
1214
1171
  type: 'dynamic-tool';
1172
+ /**
1173
+ * `false` when a static tool part was normalized to a dynamic tool part
1174
+ * because its current tool schema was unavailable or incompatible.
1175
+ *
1176
+ * This preserves its static origin across persistence boundaries.
1177
+ */
1178
+ dynamic?: false;
1215
1179
  /**
1216
1180
  * Name of the tool that is being called.
1217
1181
  */
@@ -1228,6 +1192,13 @@ export declare type DynamicToolUIPart = {
1228
1192
  } & ({
1229
1193
  state: 'input-streaming';
1230
1194
  input: unknown | undefined;
1195
+ /**
1196
+ * The raw tool input text received so far.
1197
+ *
1198
+ * This is used to continue input streaming when a message is persisted
1199
+ * and later resumed.
1200
+ */
1201
+ rawInput?: string;
1231
1202
  output?: never;
1232
1203
  errorText?: never;
1233
1204
  } | {
@@ -1431,8 +1402,9 @@ declare type EmbeddingModelV2Embedding = Array<number>;
1431
1402
  Embed several values using an embedding model. The type of the value is defined
1432
1403
  by the embedding model.
1433
1404
 
1434
- `embedMany` automatically splits large requests into smaller chunks if the model
1435
- has a limit on how many embeddings can be generated in a single call.
1405
+ `embedMany` automatically splits large requests into smaller chunks when the
1406
+ model has a limit on either the number of embeddings or the UTF-8 input bytes
1407
+ that can be processed in a single call.
1436
1408
 
1437
1409
  @param model - The embedding model to use.
1438
1410
  @param values - The values that should be embedded.
@@ -1736,7 +1708,7 @@ export declare type Experimental_AgentSettings<TOOLS extends ToolSet, OUTPUT = n
1736
1708
  /**
1737
1709
  Optional specification for parsing structured outputs from the LLM response.
1738
1710
  */
1739
- experimental_output?: Output_2<OUTPUT, OUTPUT_PARTIAL>;
1711
+ experimental_output?: OutputInterface<OUTPUT, OUTPUT_PARTIAL>;
1740
1712
  /**
1741
1713
  * @deprecated Use `prepareStep` instead.
1742
1714
  */
@@ -1816,7 +1788,7 @@ export declare type Experimental_DownloadFunction = (options: Array<{
1816
1788
  @param seed - Seed for the image generation.
1817
1789
  @param providerOptions - Additional provider-specific options that are passed through to the provider
1818
1790
  as body parameters.
1819
- @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
1791
+ @param maxRetries - Maximum number of retries per image model call, including retries after unclassified empty responses. Empty responses marked as not retryable by the provider are not retried. Set to 0 to disable retries. Default: 2.
1820
1792
  @param abortSignal - An optional abort signal that can be used to cancel the call.
1821
1793
  @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
1822
1794
 
@@ -1867,7 +1839,9 @@ export declare function experimental_generateImage({ model: modelArg, prompt, n,
1867
1839
  */
1868
1840
  providerOptions?: ProviderOptions;
1869
1841
  /**
1870
- Maximum number of retries per embedding model call. Set to 0 to disable retries.
1842
+ Maximum number of retries per image model call, including retries after
1843
+ unclassified empty responses. Empty responses marked as not retryable by the
1844
+ provider are not retried. Set to 0 to disable retries.
1871
1845
 
1872
1846
  @default 2
1873
1847
  */
@@ -2158,6 +2132,26 @@ declare function extractResponseHeaders(response: Response): {
2158
2132
  */
2159
2133
  declare type FetchFunction = typeof globalThis.fetch;
2160
2134
 
2135
+ /**
2136
+ * Fetches one validated URL without following redirects.
2137
+ *
2138
+ * On Node.js, the default fetch validates and pins DNS results at connect time.
2139
+ * An injected fetch is responsible for equivalent connect-time validation.
2140
+ * Redirects are rejected by default. Callers using `redirect: 'manual'` must
2141
+ * validate the Location target before issuing another request.
2142
+ */
2143
+ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
2144
+ url: string | URL;
2145
+ init?: RequestInit;
2146
+ fetch?: FetchFunction;
2147
+ /**
2148
+ * A developer-configured origin that may legitimately resolve to a private
2149
+ * address. This must never be derived from untrusted response data.
2150
+ */
2151
+ trustedOrigin?: string;
2152
+ redirect?: 'error' | 'manual';
2153
+ }): Promise<Response>;
2154
+
2161
2155
  /**
2162
2156
  * Fetches a URL while enforcing the SSRF download guard on every hop.
2163
2157
  *
@@ -2175,6 +2169,13 @@ declare type FetchFunction = typeof globalThis.fetch;
2175
2169
  * runtime we cannot validate the hop, so we fail closed rather than follow it
2176
2170
  * blindly and bypass the SSRF guard.
2177
2171
  *
2172
+ * A hop that is same-origin with `trustedOrigin` (the developer-configured
2173
+ * endpoint) skips target validation: that origin is exactly what an
2174
+ * unvalidated, config-derived request would fetch anyway, and validating it
2175
+ * would break legitimate self-hosted / localhost deployments whose response
2176
+ * URLs point back at the configured host. Hops on any other origin are always
2177
+ * validated.
2178
+ *
2178
2179
  * The returned response is the final (non-redirect) response. The caller is
2179
2180
  * responsible for checking `response.ok` and reading the body.
2180
2181
  *
@@ -2186,11 +2187,17 @@ declare type FetchFunction = typeof globalThis.fetch;
2186
2187
  * @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
2187
2188
  * a redirect cannot be validated on a non-browser runtime.
2188
2189
  */
2189
- declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
2190
+ declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin, }: {
2190
2191
  url: string;
2191
2192
  headers?: HeadersInit;
2192
2193
  abortSignal?: AbortSignal;
2193
2194
  maxRedirects?: number;
2195
+ fetch?: FetchFunction;
2196
+ /**
2197
+ * A developer-configured origin whose hops skip target validation. Must
2198
+ * never be derived from response data.
2199
+ */
2200
+ trustedOrigin?: string;
2194
2201
  }): Promise<Response>;
2195
2202
 
2196
2203
  /**
@@ -2275,7 +2282,7 @@ declare interface GatewayCreditsResponse {
2275
2282
  totalUsed: string;
2276
2283
  }
2277
2284
 
2278
- declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
2285
+ declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'cohere/embed-v5.0-fast' | 'cohere/embed-v5.0-pro' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'perplexity/pplx-embed-v1-0.6b' | 'perplexity/pplx-embed-v1-4b' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
2279
2286
 
2280
2287
  declare interface GatewayFetchMetadataResponse {
2281
2288
  models: GatewayLanguageModelEntry[];
@@ -2325,7 +2332,7 @@ declare interface GatewayGenerationInfoParams {
2325
2332
  id: string;
2326
2333
  }
2327
2334
 
2328
- declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
2335
+ declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-3-image' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'meta/muse-image-1.0' | 'microsoft/mai-image-2.6' | 'microsoft/mai-image-2.6-flash' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'openai/gpt-image-2.5-flare' | 'openai/gpt-image-2.5-sunburst' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-flash' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'spacexai/grok-imagine-image' | 'spacexai/grok-imagine-image-2.0' | 'topaz/wonder-3.5' | (string & {});
2329
2336
 
2330
2337
  declare interface GatewayLanguageModelEntry {
2331
2338
  /**
@@ -2376,7 +2383,7 @@ declare interface GatewayLanguageModelEntry {
2376
2383
 
2377
2384
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2378
2385
 
2379
- export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.6-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash-free' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'tencent/hy3' | 'thinkingmachines/inkling' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
2386
+ export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-flash' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'alibaba/qwen3.8-2.4t-a95b' | 'alibaba/qwen3.8-27b' | 'alibaba/qwen3.8-flash' | 'alibaba/qwen3.8-max' | 'alibaba/qwen3.8-max-0902' | 'alibaba/qwen3.8-max-prime' | 'alibaba/qwen3.8-omni-flash' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-fable-5' | 'anthropic/claude-fable-5-batch' | 'anthropic/claude-fable-5.1' | 'anthropic/claude-fable-5.1-batch' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-haiku-4.5-batch' | 'anthropic/claude-haiku-5.5' | 'anthropic/claude-haiku-5.5-batch' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.5-batch' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.6-batch' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.7-batch' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-batch' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-batch' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-opus-5.5' | 'anthropic/claude-opus-5.5-batch' | 'anthropic/claude-opus-5.5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.5-batch' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-4.6-batch' | 'anthropic/claude-sonnet-5' | 'anthropic/claude-sonnet-5-batch' | 'anthropic/claude-sonnet-5.5' | 'anthropic/claude-sonnet-5.5-batch' | 'arcee-ai/trinity-large-thinking' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'bytedance/seed-2.1-turbo' | 'callstack/apex' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-flash-0731' | 'deepseek/deepseek-v4-flash-vision-exp' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-pro-0813' | 'deepseek/deepseek-v4.1-flash' | 'deepseek/deepseek-v4.1-flash-fast' | 'fireworks/ember-1' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-batch' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-batch' | 'google/gemini-2.5-pro' | 'google/gemini-2.5-pro-batch' | 'google/gemini-3-flash' | 'google/gemini-3-flash-batch' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-batch' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.1-pro-preview-batch' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-batch' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.5-flash-lite-batch' | 'google/gemini-3.6-flash' | 'google/gemini-3.6-flash-batch' | 'google/gemini-3.7-flash' | 'google/gemini-3.7-flash-batch' | 'google/gemini-3.8-flash' | 'google/gemini-4-argon' | 'google/gemini-nano-banana-2.1' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-2.5' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash' | 'inclusionai/ling-3.0-flash-fin' | 'inclusionai/ling-3.0-flash-sante' | 'inclusionai/ling-3.0-flash-vl' | 'inclusionai/ling-3.1-flash' | 'inference-net/schematron-v2-small' | 'inference-net/schematron-v2-turbo' | 'interfaze/interfaze-beta' | 'liquid/lfm2.5-24b-a2b' | 'meituan/longcat-2.5-preview' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-glimmer-30b' | 'meta/muse-spark-1.1' | 'meta/muse-spark-1.2' | 'meta/muse-spark-1.2-contributor' | 'meta/muse-spark-1.3' | 'meta/muse-spark-1.3-contributor' | 'meta/muse-wonder-1.0' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-large-4' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mixedbread/toast-1' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-3.5-lightning' | 'nvidia/nemotron-3.5-lightning-free' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-batch' | 'openai/gpt-4.1-fast' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-mini-batch' | 'openai/gpt-4.1-mini-fast' | 'openai/gpt-4.1-nano' | 'openai/gpt-4.1-nano-batch' | 'openai/gpt-4.1-nano-fast' | 'openai/gpt-4o' | 'openai/gpt-4o-batch' | 'openai/gpt-4o-fast' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-batch' | 'openai/gpt-4o-mini-fast' | 'openai/gpt-5' | 'openai/gpt-5-batch' | 'openai/gpt-5-codex' | 'openai/gpt-5-fast' | 'openai/gpt-5-mini' | 'openai/gpt-5-mini-batch' | 'openai/gpt-5-mini-fast' | 'openai/gpt-5-nano' | 'openai/gpt-5-nano-batch' | 'openai/gpt-5-pro' | 'openai/gpt-5-pro-batch' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.1-thinking-fast' | 'openai/gpt-5.2' | 'openai/gpt-5.2-batch' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-fast' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.3-codex-fast' | 'openai/gpt-5.4' | 'openai/gpt-5.4-batch' | 'openai/gpt-5.4-fast' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-mini-batch' | 'openai/gpt-5.4-mini-fast' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-nano-batch' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-batch' | 'openai/gpt-5.5-fast' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.5-pro-batch' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-luna-batch' | 'openai/gpt-5.6-luna-fast' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-sol-batch' | 'openai/gpt-5.6-sol-fast' | 'openai/gpt-5.6-terra' | 'openai/gpt-5.6-terra-batch' | 'openai/gpt-5.6-terra-fast' | 'openai/gpt-6-astra' | 'openai/gpt-6-astra-batch' | 'openai/gpt-6-astra-fast' | 'openai/gpt-6-luna' | 'openai/gpt-6-luna-batch' | 'openai/gpt-6-luna-fast' | 'openai/gpt-6-sol' | 'openai/gpt-6-sol-batch' | 'openai/gpt-6-sol-fast' | 'openai/gpt-6.1-sol' | 'openai/gpt-6.1-sol-batch' | 'openai/gpt-6.1-sol-fast' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-120b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-fast' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'openai/o4-mini-fast' | 'perplexity/sonar' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'quiverai/arrow-2' | 'quiverai/arrow-2-telos' | 'sakana/fugu-max' | 'sakana/fugu-ultra' | 'sakana/fugu-ultra-v2' | 'sakana/namazu' | 'spacexai/grok-4.1-fast-non-reasoning' | 'spacexai/grok-4.1-fast-reasoning' | 'spacexai/grok-4.20-multi-agent' | 'spacexai/grok-4.20-multi-agent-batch' | 'spacexai/grok-4.20-multi-agent-beta' | 'spacexai/grok-4.20-non-reasoning' | 'spacexai/grok-4.20-non-reasoning-batch' | 'spacexai/grok-4.20-non-reasoning-beta' | 'spacexai/grok-4.20-reasoning' | 'spacexai/grok-4.20-reasoning-batch' | 'spacexai/grok-4.20-reasoning-beta' | 'spacexai/grok-4.3' | 'spacexai/grok-4.3-batch' | 'spacexai/grok-4.5' | 'spacexai/grok-4.6' | 'spacexai/grok-4.7' | 'spacexai/grok-build-0.1' | 'stealth/glyph-cluster' | 'stepfun/step-3.7-flash' | 'stepfun/step-5-preview' | 'tencent/hy-mt2-lite' | 'tencent/hy-mt2-plus' | 'tencent/hy-mt2-pro' | 'tencent/hy3' | 'tencent/hy4-preview' | 'thinkingmachines/inkling' | 'thinkingmachines/inkling-small' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'xiaomi/mimo-v2.6-flash' | 'xiaomi/mimo-v2.6-pro' | 'xiaomi/mimo-v2.6-pro-ultraspeed' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5.3' | 'zai/glm-5.3-fast' | 'zai/glm-5.3-flash' | 'zai/glm-5.3-flashx' | 'zai/glm-5v-turbo' | (string & {});
2380
2387
 
2381
2388
  declare interface GatewayProvider extends ProviderV2 {
2382
2389
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2821,7 +2828,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTP
2821
2828
  /**
2822
2829
  Optional specification for parsing structured outputs from the LLM response.
2823
2830
  */
2824
- experimental_output?: Output_2<OUTPUT, OUTPUT_PARTIAL>;
2831
+ experimental_output?: OutputInterface<OUTPUT, OUTPUT_PARTIAL>;
2825
2832
  /**
2826
2833
  Custom download function to use for URLs.
2827
2834
 
@@ -3190,6 +3197,11 @@ declare type ImageModelV2 = {
3190
3197
  be returned as binary data.
3191
3198
  */
3192
3199
  images: Array<string> | Array<Uint8Array>;
3200
+ /**
3201
+ Whether an unsuccessful result, such as an empty image result, can be
3202
+ retried. When omitted, the result is unclassified.
3203
+ */
3204
+ isRetryable?: boolean;
3193
3205
  /**
3194
3206
  Warnings for the call, e.g. unsupported settings.
3195
3207
  */
@@ -3381,14 +3393,14 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
3381
3393
  declare type InferValidator<SCHEMA> = SCHEMA extends StandardSchemaV1<unknown, infer T> ? T : SCHEMA extends LazyValidator<infer T> ? T : SCHEMA extends Validator<infer T> ? T : never;
3382
3394
 
3383
3395
  declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
3384
- messages: LanguageModelV2Prompt_2;
3396
+ messages: LanguageModelV2Prompt;
3385
3397
  schema?: JSONSchema7;
3386
3398
  schemaPrefix?: string;
3387
3399
  schemaSuffix?: string;
3388
- }): LanguageModelV2Prompt_2;
3400
+ }): LanguageModelV2Prompt;
3389
3401
 
3390
3402
  export declare class InvalidArgumentError extends AISDKError {
3391
- private readonly [symbol$c_3];
3403
+ private readonly [symbol$c_2];
3392
3404
  readonly parameter: string;
3393
3405
  readonly value: unknown;
3394
3406
  constructor({ parameter, value, message, }: {
@@ -3498,6 +3510,8 @@ export declare function isDataUIPart<DATA_TYPES extends UIDataTypes>(part: UIMes
3498
3510
  */
3499
3511
  export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3500
3512
 
3513
+ export declare function isDynamicToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart;
3514
+
3501
3515
  /**
3502
3516
  * Type guard to check if a message part is a file part.
3503
3517
  */
@@ -3556,16 +3570,10 @@ declare type Job = () => Promise<void>;
3556
3570
 
3557
3571
  declare type JSONArray = JSONValue_2[];
3558
3572
 
3559
- declare type JSONArray_2 = JSONValue_3[];
3560
-
3561
3573
  declare type JSONObject = {
3562
3574
  [key: string]: JSONValue_2;
3563
3575
  };
3564
3576
 
3565
- declare type JSONObject_2 = {
3566
- [key: string]: JSONValue_3;
3567
- };
3568
-
3569
3577
  export declare class JSONParseError extends AISDKError {
3570
3578
  private readonly [symbol$7];
3571
3579
  readonly text: string;
@@ -3576,16 +3584,6 @@ export declare class JSONParseError extends AISDKError {
3576
3584
  static isInstance(error: unknown): error is JSONParseError;
3577
3585
  }
3578
3586
 
3579
- declare class JSONParseError_2 extends AISDKError_2 {
3580
- private readonly [symbol$7_2];
3581
- readonly text: string;
3582
- constructor({ text, cause }: {
3583
- text: string;
3584
- cause: unknown;
3585
- });
3586
- static isInstance(error: unknown): error is JSONParseError_2;
3587
- }
3588
-
3589
3587
  /**
3590
3588
  * Create a schema using a JSON Schema.
3591
3589
  *
@@ -3610,12 +3608,6 @@ export declare type JSONValue = JSONValue_2;
3610
3608
  */
3611
3609
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3612
3610
 
3613
- /**
3614
- A JSON value can be a string, number, boolean, object, array, or null.
3615
- JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
3616
- */
3617
- declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
3618
-
3619
3611
  declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
3620
3612
 
3621
3613
  declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
@@ -3871,107 +3863,6 @@ declare type LanguageModelV2CallOptions = {
3871
3863
  providerOptions?: SharedV2ProviderOptions;
3872
3864
  };
3873
3865
 
3874
- declare type LanguageModelV2CallOptions_2 = {
3875
- /**
3876
- A language mode prompt is a standardized prompt type.
3877
-
3878
- Note: This is **not** the user-facing prompt. The AI SDK methods will map the
3879
- user-facing prompt types such as chat or instruction prompts to this format.
3880
- That approach allows us to evolve the user facing prompts without breaking
3881
- the language model interface.
3882
- */
3883
- prompt: LanguageModelV2Prompt_2;
3884
- /**
3885
- Maximum number of tokens to generate.
3886
- */
3887
- maxOutputTokens?: number;
3888
- /**
3889
- Temperature setting. The range depends on the provider and model.
3890
- */
3891
- temperature?: number;
3892
- /**
3893
- Stop sequences.
3894
- If set, the model will stop generating text when one of the stop sequences is generated.
3895
- Providers may have limits on the number of stop sequences.
3896
- */
3897
- stopSequences?: string[];
3898
- /**
3899
- Nucleus sampling.
3900
- */
3901
- topP?: number;
3902
- /**
3903
- Only sample from the top K options for each subsequent token.
3904
-
3905
- Used to remove "long tail" low probability responses.
3906
- Recommended for advanced use cases only. You usually only need to use temperature.
3907
- */
3908
- topK?: number;
3909
- /**
3910
- Presence penalty setting. It affects the likelihood of the model to
3911
- repeat information that is already in the prompt.
3912
- */
3913
- presencePenalty?: number;
3914
- /**
3915
- Frequency penalty setting. It affects the likelihood of the model
3916
- to repeatedly use the same words or phrases.
3917
- */
3918
- frequencyPenalty?: number;
3919
- /**
3920
- Response format. The output can either be text or JSON. Default is text.
3921
-
3922
- If JSON is selected, a schema can optionally be provided to guide the LLM.
3923
- */
3924
- responseFormat?: {
3925
- type: 'text';
3926
- } | {
3927
- type: 'json';
3928
- /**
3929
- * JSON schema that the generated output should conform to.
3930
- */
3931
- schema?: JSONSchema7;
3932
- /**
3933
- * Name of output that should be generated. Used by some providers for additional LLM guidance.
3934
- */
3935
- name?: string;
3936
- /**
3937
- * Description of the output that should be generated. Used by some providers for additional LLM guidance.
3938
- */
3939
- description?: string;
3940
- };
3941
- /**
3942
- The seed (integer) to use for random sampling. If set and supported
3943
- by the model, calls will generate deterministic results.
3944
- */
3945
- seed?: number;
3946
- /**
3947
- The tools that are available for the model.
3948
- */
3949
- tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
3950
- /**
3951
- Specifies how the tool should be selected. Defaults to 'auto'.
3952
- */
3953
- toolChoice?: LanguageModelV2ToolChoice_2;
3954
- /**
3955
- Include raw chunks in the stream. Only applicable for streaming calls.
3956
- */
3957
- includeRawChunks?: boolean;
3958
- /**
3959
- Abort signal for cancelling the operation.
3960
- */
3961
- abortSignal?: AbortSignal;
3962
- /**
3963
- Additional HTTP headers to be sent with the request.
3964
- Only applicable for HTTP-based providers.
3965
- */
3966
- headers?: Record<string, string | undefined>;
3967
- /**
3968
- * Additional provider-specific options. They are passed through
3969
- * to the provider from the AI SDK and enable provider-specific
3970
- * functionality that can be fully encapsulated in the provider.
3971
- */
3972
- providerOptions?: SharedV2ProviderOptions_2;
3973
- };
3974
-
3975
3866
  /**
3976
3867
  Warning from the model provider for this call. The call will proceed, but e.g.
3977
3868
  some settings might not be supported, which can lead to suboptimal results.
@@ -3989,23 +3880,6 @@ declare type LanguageModelV2CallWarning = {
3989
3880
  message: string;
3990
3881
  };
3991
3882
 
3992
- /**
3993
- Warning from the model provider for this call. The call will proceed, but e.g.
3994
- some settings might not be supported, which can lead to suboptimal results.
3995
- */
3996
- declare type LanguageModelV2CallWarning_2 = {
3997
- type: 'unsupported-setting';
3998
- setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
3999
- details?: string;
4000
- } | {
4001
- type: 'unsupported-tool';
4002
- tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
4003
- details?: string;
4004
- } | {
4005
- type: 'other';
4006
- message: string;
4007
- };
4008
-
4009
3883
  declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
4010
3884
 
4011
3885
  /**
@@ -4013,11 +3887,6 @@ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reaso
4013
3887
  */
4014
3888
  declare type LanguageModelV2DataContent = Uint8Array | string | URL;
4015
3889
 
4016
- /**
4017
- Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4018
- */
4019
- declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
4020
-
4021
3890
  /**
4022
3891
  A file that has been generated by the model.
4023
3892
  Generated files as base64 encoded strings or binary data.
@@ -4042,30 +3911,6 @@ declare type LanguageModelV2File = {
4042
3911
  data: string | Uint8Array;
4043
3912
  };
4044
3913
 
4045
- /**
4046
- A file that has been generated by the model.
4047
- Generated files as base64 encoded strings or binary data.
4048
- The files should be returned without any unnecessary conversion.
4049
- */
4050
- declare type LanguageModelV2File_2 = {
4051
- type: 'file';
4052
- /**
4053
- The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4054
-
4055
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4056
- */
4057
- mediaType: string;
4058
- /**
4059
- Generated file data as base64 encoded strings or binary data.
4060
-
4061
- The file data should be returned without any unnecessary conversion.
4062
- If the API returns base64 encoded strings, the file data should be returned
4063
- as base64 encoded strings. If the API returns binary data, the file data should
4064
- be returned as binary data.
4065
- */
4066
- data: string | Uint8Array;
4067
- };
4068
-
4069
3914
  /**
4070
3915
  File content part of a prompt. It contains a file.
4071
3916
  */
@@ -4079,6 +3924,13 @@ declare interface LanguageModelV2FilePart {
4079
3924
  File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4080
3925
  */
4081
3926
  data: LanguageModelV2DataContent;
3927
+ /**
3928
+ * The original URL string before it was parsed into a `URL`.
3929
+ *
3930
+ * This is available when parsing would change the string and a provider
3931
+ * needs to preserve an opaque non-HTTP URI exactly.
3932
+ */
3933
+ originalUrl?: string;
4082
3934
  /**
4083
3935
  IANA media type of the file.
4084
3936
 
@@ -4096,69 +3948,19 @@ declare interface LanguageModelV2FilePart {
4096
3948
  }
4097
3949
 
4098
3950
  /**
4099
- File content part of a prompt. It contains a file.
4100
- */
4101
- declare interface LanguageModelV2FilePart_2 {
4102
- type: 'file';
4103
- /**
4104
- * Optional filename of the file.
4105
- */
4106
- filename?: string;
4107
- /**
4108
- File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4109
- */
4110
- data: LanguageModelV2DataContent_2;
4111
- /**
4112
- * The original URL string before it was parsed into a `URL`.
4113
- *
4114
- * This is available when parsing would change the string and a provider
4115
- * needs to preserve an opaque non-HTTP URI exactly.
4116
- */
4117
- originalUrl?: string;
4118
- /**
4119
- IANA media type of the file.
4120
-
4121
- Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
4122
-
4123
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4124
- */
4125
- mediaType: string;
4126
- /**
4127
- * Additional provider-specific options. They are passed through
4128
- * to the provider from the AI SDK and enable provider-specific
4129
- * functionality that can be fully encapsulated in the provider.
4130
- */
4131
- providerOptions?: SharedV2ProviderOptions_2;
4132
- }
4133
-
4134
- /**
4135
- Reason why a language model finished generating a response.
4136
-
4137
- Can be one of the following:
4138
- - `stop`: model generated stop sequence
4139
- - `length`: model generated maximum number of tokens
4140
- - `content-filter`: content filter violation stopped the model
4141
- - `tool-calls`: model triggered tool calls
4142
- - `error`: model stopped because of an error
4143
- - `other`: model stopped for other reasons
4144
- - `unknown`: the model has not transmitted a finish reason
3951
+ Reason why a language model finished generating a response.
3952
+
3953
+ Can be one of the following:
3954
+ - `stop`: model generated stop sequence
3955
+ - `length`: model generated maximum number of tokens
3956
+ - `content-filter`: content filter violation stopped the model
3957
+ - `tool-calls`: model triggered tool calls
3958
+ - `error`: model stopped because of an error
3959
+ - `other`: model stopped for other reasons
3960
+ - `unknown`: the model has not transmitted a finish reason
4145
3961
  */
4146
3962
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4147
3963
 
4148
- /**
4149
- Reason why a language model finished generating a response.
4150
-
4151
- Can be one of the following:
4152
- - `stop`: model generated stop sequence
4153
- - `length`: model generated maximum number of tokens
4154
- - `content-filter`: content filter violation stopped the model
4155
- - `tool-calls`: model triggered tool calls
4156
- - `error`: model stopped because of an error
4157
- - `other`: model stopped for other reasons
4158
- - `unknown`: the model has not transmitted a finish reason
4159
- */
4160
- declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4161
-
4162
3964
  /**
4163
3965
  A tool has a name, a description, and a set of parameters.
4164
3966
 
@@ -4190,37 +3992,6 @@ declare type LanguageModelV2FunctionTool = {
4190
3992
  providerOptions?: SharedV2ProviderOptions;
4191
3993
  };
4192
3994
 
4193
- /**
4194
- A tool has a name, a description, and a set of parameters.
4195
-
4196
- Note: this is **not** the user-facing tool definition. The AI SDK methods will
4197
- map the user-facing tool definitions to this format.
4198
- */
4199
- declare type LanguageModelV2FunctionTool_2 = {
4200
- /**
4201
- The type of the tool (always 'function').
4202
- */
4203
- type: 'function';
4204
- /**
4205
- The name of the tool. Unique within this model call.
4206
- */
4207
- name: string;
4208
- /**
4209
- A description of the tool. The language model uses this to understand the
4210
- tool's purpose and to provide better completion suggestions.
4211
- */
4212
- description?: string;
4213
- /**
4214
- The parameters that the tool expects. The language model uses this to
4215
- understand the tool's input requirements and to provide matching suggestions.
4216
- */
4217
- inputSchema: JSONSchema7;
4218
- /**
4219
- The provider-specific options for the tool.
4220
- */
4221
- providerOptions?: SharedV2ProviderOptions_2;
4222
- };
4223
-
4224
3995
  declare type LanguageModelV2Message = ({
4225
3996
  role: 'system';
4226
3997
  content: string;
@@ -4242,27 +4013,6 @@ declare type LanguageModelV2Message = ({
4242
4013
  providerOptions?: SharedV2ProviderOptions;
4243
4014
  };
4244
4015
 
4245
- declare type LanguageModelV2Message_2 = ({
4246
- role: 'system';
4247
- content: string;
4248
- } | {
4249
- role: 'user';
4250
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
4251
- } | {
4252
- role: 'assistant';
4253
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
4254
- } | {
4255
- role: 'tool';
4256
- content: Array<LanguageModelV2ToolResultPart_2>;
4257
- }) & {
4258
- /**
4259
- * Additional provider-specific options. They are passed through
4260
- * to the provider from the AI SDK and enable provider-specific
4261
- * functionality that can be fully encapsulated in the provider.
4262
- */
4263
- providerOptions?: SharedV2ProviderOptions_2;
4264
- };
4265
-
4266
4016
  /**
4267
4017
  * Experimental middleware for LanguageModelV2.
4268
4018
  * This type defines the structure for middleware that can be used to modify
@@ -4352,17 +4102,6 @@ declare type LanguageModelV2Middleware = {
4352
4102
  */
4353
4103
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
4354
4104
 
4355
- /**
4356
- A prompt is a list of messages.
4357
-
4358
- Note: Not all models and prompt formats support multi-modal inputs and
4359
- tool calls. The validation happens at runtime.
4360
-
4361
- Note: This is not a user-facing prompt. The AI SDK methods will map the
4362
- user-facing prompt types such as chat or instruction prompts to this format.
4363
- */
4364
- declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
4365
-
4366
4105
  /**
4367
4106
  The configuration of a tool that is defined by the provider.
4368
4107
  */
@@ -4385,28 +4124,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
4385
4124
  args: Record<string, unknown>;
4386
4125
  };
4387
4126
 
4388
- /**
4389
- The configuration of a tool that is defined by the provider.
4390
- */
4391
- declare type LanguageModelV2ProviderDefinedTool_2 = {
4392
- /**
4393
- The type of the tool (always 'provider-defined').
4394
- */
4395
- type: 'provider-defined';
4396
- /**
4397
- The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
4398
- */
4399
- id: `${string}.${string}`;
4400
- /**
4401
- The name of the tool that the user must use in the tool set.
4402
- */
4403
- name: string;
4404
- /**
4405
- The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
4406
- */
4407
- args: Record<string, unknown>;
4408
- };
4409
-
4410
4127
  /**
4411
4128
  Reasoning that the model has generated.
4412
4129
  */
@@ -4436,23 +4153,6 @@ declare interface LanguageModelV2ReasoningPart {
4436
4153
  providerOptions?: SharedV2ProviderOptions;
4437
4154
  }
4438
4155
 
4439
- /**
4440
- Reasoning content part of a prompt. It contains a string of reasoning text.
4441
- */
4442
- declare interface LanguageModelV2ReasoningPart_2 {
4443
- type: 'reasoning';
4444
- /**
4445
- The reasoning text.
4446
- */
4447
- text: string;
4448
- /**
4449
- * Additional provider-specific options. They are passed through
4450
- * to the provider from the AI SDK and enable provider-specific
4451
- * functionality that can be fully encapsulated in the provider.
4452
- */
4453
- providerOptions?: SharedV2ProviderOptions_2;
4454
- }
4455
-
4456
4156
  declare interface LanguageModelV2ResponseMetadata {
4457
4157
  /**
4458
4158
  ID for the generated response, if the provider sends one.
@@ -4468,21 +4168,6 @@ declare interface LanguageModelV2ResponseMetadata {
4468
4168
  modelId?: string;
4469
4169
  }
4470
4170
 
4471
- declare interface LanguageModelV2ResponseMetadata_2 {
4472
- /**
4473
- ID for the generated response, if the provider sends one.
4474
- */
4475
- id?: string;
4476
- /**
4477
- Timestamp for the start of the generated response, if the provider sends one.
4478
- */
4479
- timestamp?: Date;
4480
- /**
4481
- The ID of the response model that was used to generate the response, if the provider sends one.
4482
- */
4483
- modelId?: string;
4484
- }
4485
-
4486
4171
  /**
4487
4172
  A source that has been used as input to generate the response.
4488
4173
  */
@@ -4536,59 +4221,6 @@ declare type LanguageModelV2Source = {
4536
4221
  providerMetadata?: SharedV2ProviderMetadata;
4537
4222
  };
4538
4223
 
4539
- /**
4540
- A source that has been used as input to generate the response.
4541
- */
4542
- declare type LanguageModelV2Source_2 = {
4543
- type: 'source';
4544
- /**
4545
- * The type of source - URL sources reference web content.
4546
- */
4547
- sourceType: 'url';
4548
- /**
4549
- * The ID of the source.
4550
- */
4551
- id: string;
4552
- /**
4553
- * The URL of the source.
4554
- */
4555
- url: string;
4556
- /**
4557
- * The title of the source.
4558
- */
4559
- title?: string;
4560
- /**
4561
- * Additional provider metadata for the source.
4562
- */
4563
- providerMetadata?: SharedV2ProviderMetadata_2;
4564
- } | {
4565
- type: 'source';
4566
- /**
4567
- * The type of source - document sources reference files/documents.
4568
- */
4569
- sourceType: 'document';
4570
- /**
4571
- * The ID of the source.
4572
- */
4573
- id: string;
4574
- /**
4575
- * IANA media type of the document (e.g., 'application/pdf').
4576
- */
4577
- mediaType: string;
4578
- /**
4579
- * The title of the document.
4580
- */
4581
- title: string;
4582
- /**
4583
- * Optional filename of the document.
4584
- */
4585
- filename?: string;
4586
- /**
4587
- * Additional provider metadata for the source.
4588
- */
4589
- providerMetadata?: SharedV2ProviderMetadata_2;
4590
- };
4591
-
4592
4224
  declare type LanguageModelV2StreamPart = {
4593
4225
  type: 'text-start';
4594
4226
  providerMetadata?: SharedV2ProviderMetadata;
@@ -4648,65 +4280,6 @@ declare type LanguageModelV2StreamPart = {
4648
4280
  error: unknown;
4649
4281
  };
4650
4282
 
4651
- declare type LanguageModelV2StreamPart_2 = {
4652
- type: 'text-start';
4653
- providerMetadata?: SharedV2ProviderMetadata_2;
4654
- id: string;
4655
- } | {
4656
- type: 'text-delta';
4657
- id: string;
4658
- providerMetadata?: SharedV2ProviderMetadata_2;
4659
- delta: string;
4660
- } | {
4661
- type: 'text-end';
4662
- providerMetadata?: SharedV2ProviderMetadata_2;
4663
- id: string;
4664
- } | {
4665
- type: 'reasoning-start';
4666
- providerMetadata?: SharedV2ProviderMetadata_2;
4667
- id: string;
4668
- } | {
4669
- type: 'reasoning-delta';
4670
- id: string;
4671
- providerMetadata?: SharedV2ProviderMetadata_2;
4672
- delta: string;
4673
- } | {
4674
- type: 'reasoning-end';
4675
- id: string;
4676
- providerMetadata?: SharedV2ProviderMetadata_2;
4677
- } | {
4678
- type: 'tool-input-start';
4679
- id: string;
4680
- toolName: string;
4681
- providerMetadata?: SharedV2ProviderMetadata_2;
4682
- providerExecuted?: boolean;
4683
- } | {
4684
- type: 'tool-input-delta';
4685
- id: string;
4686
- delta: string;
4687
- providerMetadata?: SharedV2ProviderMetadata_2;
4688
- } | {
4689
- type: 'tool-input-end';
4690
- id: string;
4691
- providerMetadata?: SharedV2ProviderMetadata_2;
4692
- } | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
4693
- type: 'stream-start';
4694
- warnings: Array<LanguageModelV2CallWarning_2>;
4695
- } | ({
4696
- type: 'response-metadata';
4697
- } & LanguageModelV2ResponseMetadata_2) | {
4698
- type: 'finish';
4699
- usage: LanguageModelV2Usage_2;
4700
- finishReason: LanguageModelV2FinishReason_2;
4701
- providerMetadata?: SharedV2ProviderMetadata_2;
4702
- } | {
4703
- type: 'raw';
4704
- rawValue: unknown;
4705
- } | {
4706
- type: 'error';
4707
- error: unknown;
4708
- };
4709
-
4710
4283
  /**
4711
4284
  Text that the model has generated.
4712
4285
  */
@@ -4734,117 +4307,41 @@ declare interface LanguageModelV2TextPart {
4734
4307
  * functionality that can be fully encapsulated in the provider.
4735
4308
  */
4736
4309
  providerOptions?: SharedV2ProviderOptions;
4737
- }
4738
-
4739
- /**
4740
- Text content part of a prompt. It contains a string of text.
4741
- */
4742
- declare interface LanguageModelV2TextPart_2 {
4743
- type: 'text';
4744
- /**
4745
- The text content.
4746
- */
4747
- text: string;
4748
- /**
4749
- * Additional provider-specific options. They are passed through
4750
- * to the provider from the AI SDK and enable provider-specific
4751
- * functionality that can be fully encapsulated in the provider.
4752
- */
4753
- providerOptions?: SharedV2ProviderOptions_2;
4754
- }
4755
-
4756
- /**
4757
- * Tool calls that the model has generated.
4758
- */
4759
- declare type LanguageModelV2ToolCall = {
4760
- type: 'tool-call';
4761
- /**
4762
- * The identifier of the tool call. It must be unique across all tool calls.
4763
- */
4764
- toolCallId: string;
4765
- /**
4766
- * The name of the tool that should be called.
4767
- */
4768
- toolName: string;
4769
- /**
4770
- * Stringified JSON object with the tool call arguments. Must match the
4771
- * parameters schema of the tool.
4772
- */
4773
- input: string;
4774
- /**
4775
- * Whether the tool call will be executed by the provider.
4776
- * If this flag is not set or is false, the tool call will be executed by the client.
4777
- */
4778
- providerExecuted?: boolean;
4779
- /**
4780
- * Additional provider-specific metadata for the tool call.
4781
- */
4782
- providerMetadata?: SharedV2ProviderMetadata;
4783
- };
4784
-
4785
- /**
4786
- * Tool calls that the model has generated.
4787
- */
4788
- declare type LanguageModelV2ToolCall_2 = {
4789
- type: 'tool-call';
4790
- /**
4791
- * The identifier of the tool call. It must be unique across all tool calls.
4792
- */
4793
- toolCallId: string;
4794
- /**
4795
- * The name of the tool that should be called.
4796
- */
4797
- toolName: string;
4798
- /**
4799
- * Stringified JSON object with the tool call arguments. Must match the
4800
- * parameters schema of the tool.
4801
- */
4802
- input: string;
4803
- /**
4804
- * Whether the tool call will be executed by the provider.
4805
- * If this flag is not set or is false, the tool call will be executed by the client.
4806
- */
4807
- providerExecuted?: boolean;
4808
- /**
4809
- * Additional provider-specific metadata for the tool call.
4810
- */
4811
- providerMetadata?: SharedV2ProviderMetadata_2;
4812
- };
4310
+ }
4813
4311
 
4814
4312
  /**
4815
- Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
4313
+ * Tool calls that the model has generated.
4816
4314
  */
4817
- declare interface LanguageModelV2ToolCallPart {
4315
+ declare type LanguageModelV2ToolCall = {
4818
4316
  type: 'tool-call';
4819
4317
  /**
4820
- ID of the tool call. This ID is used to match the tool call with the tool result.
4318
+ * The identifier of the tool call. It must be unique across all tool calls.
4821
4319
  */
4822
4320
  toolCallId: string;
4823
4321
  /**
4824
- Name of the tool that is being called.
4322
+ * The name of the tool that should be called.
4825
4323
  */
4826
4324
  toolName: string;
4827
4325
  /**
4828
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
4326
+ * Stringified JSON object with the tool call arguments. Must match the
4327
+ * parameters schema of the tool.
4829
4328
  */
4830
- input: unknown;
4329
+ input: string;
4831
4330
  /**
4832
4331
  * Whether the tool call will be executed by the provider.
4833
4332
  * If this flag is not set or is false, the tool call will be executed by the client.
4834
4333
  */
4835
4334
  providerExecuted?: boolean;
4836
4335
  /**
4837
- * Additional provider-specific options. They are passed through
4838
- * to the provider from the AI SDK and enable provider-specific
4839
- * functionality that can be fully encapsulated in the provider.
4336
+ * Additional provider-specific metadata for the tool call.
4840
4337
  */
4841
- providerOptions?: SharedV2ProviderOptions;
4842
- }
4338
+ providerMetadata?: SharedV2ProviderMetadata;
4339
+ };
4843
4340
 
4844
4341
  /**
4845
4342
  Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
4846
4343
  */
4847
- declare interface LanguageModelV2ToolCallPart_2 {
4344
+ declare interface LanguageModelV2ToolCallPart {
4848
4345
  type: 'tool-call';
4849
4346
  /**
4850
4347
  ID of the tool call. This ID is used to match the tool call with the tool result.
@@ -4868,7 +4365,7 @@ declare interface LanguageModelV2ToolCallPart_2 {
4868
4365
  * to the provider from the AI SDK and enable provider-specific
4869
4366
  * functionality that can be fully encapsulated in the provider.
4870
4367
  */
4871
- providerOptions?: SharedV2ProviderOptions_2;
4368
+ providerOptions?: SharedV2ProviderOptions;
4872
4369
  }
4873
4370
 
4874
4371
  declare type LanguageModelV2ToolChoice = {
@@ -4882,17 +4379,6 @@ declare type LanguageModelV2ToolChoice = {
4882
4379
  toolName: string;
4883
4380
  };
4884
4381
 
4885
- declare type LanguageModelV2ToolChoice_2 = {
4886
- type: 'auto';
4887
- } | {
4888
- type: 'none';
4889
- } | {
4890
- type: 'required';
4891
- } | {
4892
- type: 'tool';
4893
- toolName: string;
4894
- };
4895
-
4896
4382
  /**
4897
4383
  Result of a tool call that has been executed by the provider.
4898
4384
  */
@@ -4926,39 +4412,6 @@ declare type LanguageModelV2ToolResult = {
4926
4412
  providerMetadata?: SharedV2ProviderMetadata;
4927
4413
  };
4928
4414
 
4929
- /**
4930
- Result of a tool call that has been executed by the provider.
4931
- */
4932
- declare type LanguageModelV2ToolResult_2 = {
4933
- type: 'tool-result';
4934
- /**
4935
- * The ID of the tool call that this result is associated with.
4936
- */
4937
- toolCallId: string;
4938
- /**
4939
- * Name of the tool that generated this result.
4940
- */
4941
- toolName: string;
4942
- /**
4943
- * Result of the tool call. This is a JSON-serializable object.
4944
- */
4945
- result: unknown;
4946
- /**
4947
- * Optional flag if the result is an error or an error message.
4948
- */
4949
- isError?: boolean;
4950
- /**
4951
- * Whether the tool result was generated by the provider.
4952
- * If this flag is set to true, the tool result was generated by the provider.
4953
- * If this flag is not set or is false, the tool result was generated by the client.
4954
- */
4955
- providerExecuted?: boolean;
4956
- /**
4957
- * Additional provider-specific metadata for the tool result.
4958
- */
4959
- providerMetadata?: SharedV2ProviderMetadata_2;
4960
- };
4961
-
4962
4415
  declare type LanguageModelV2ToolResultOutput = {
4963
4416
  type: 'text';
4964
4417
  value: string;
@@ -4993,40 +4446,6 @@ declare type LanguageModelV2ToolResultOutput = {
4993
4446
  }>;
4994
4447
  };
4995
4448
 
4996
- declare type LanguageModelV2ToolResultOutput_2 = {
4997
- type: 'text';
4998
- value: string;
4999
- } | {
5000
- type: 'json';
5001
- value: JSONValue_3;
5002
- } | {
5003
- type: 'error-text';
5004
- value: string;
5005
- } | {
5006
- type: 'error-json';
5007
- value: JSONValue_3;
5008
- } | {
5009
- type: 'content';
5010
- value: Array<{
5011
- type: 'text';
5012
- /**
5013
- Text content.
5014
- */
5015
- text: string;
5016
- } | {
5017
- type: 'media';
5018
- /**
5019
- Base-64 encoded media data.
5020
- */
5021
- data: string;
5022
- /**
5023
- IANA media type.
5024
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
5025
- */
5026
- mediaType: string;
5027
- }>;
5028
- };
5029
-
5030
4449
  /**
5031
4450
  Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5032
4451
  */
@@ -5052,31 +4471,6 @@ declare interface LanguageModelV2ToolResultPart {
5052
4471
  providerOptions?: SharedV2ProviderOptions;
5053
4472
  }
5054
4473
 
5055
- /**
5056
- Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5057
- */
5058
- declare interface LanguageModelV2ToolResultPart_2 {
5059
- type: 'tool-result';
5060
- /**
5061
- ID of the tool call that this result is associated with.
5062
- */
5063
- toolCallId: string;
5064
- /**
5065
- Name of the tool that generated this result.
5066
- */
5067
- toolName: string;
5068
- /**
5069
- Result of the tool call.
5070
- */
5071
- output: LanguageModelV2ToolResultOutput_2;
5072
- /**
5073
- * Additional provider-specific options. They are passed through
5074
- * to the provider from the AI SDK and enable provider-specific
5075
- * functionality that can be fully encapsulated in the provider.
5076
- */
5077
- providerOptions?: SharedV2ProviderOptions_2;
5078
- }
5079
-
5080
4474
  /**
5081
4475
  Usage information for a language model call.
5082
4476
 
@@ -5109,40 +4503,11 @@ declare type LanguageModelV2Usage = {
5109
4503
  };
5110
4504
 
5111
4505
  /**
5112
- Usage information for a language model call.
5113
-
5114
- If your API return additional usage information, you can add it to the
5115
- provider metadata under your provider's key.
5116
- */
5117
- declare type LanguageModelV2Usage_2 = {
5118
- /**
5119
- The number of input (prompt) tokens used.
5120
- */
5121
- inputTokens: number | undefined;
5122
- /**
5123
- The number of output (completion) tokens used.
5124
- */
5125
- outputTokens: number | undefined;
5126
- /**
5127
- The total number of tokens as reported by the provider.
5128
- This number might be different from the sum of `inputTokens` and `outputTokens`
5129
- and e.g. include reasoning tokens or other overhead.
5130
- */
5131
- totalTokens: number | undefined;
5132
- /**
5133
- The number of reasoning tokens used.
5134
- */
5135
- reasoningTokens?: number | undefined;
5136
- /**
5137
- The number of cached input tokens.
5138
- */
5139
- cachedInputTokens?: number | undefined;
5140
- };
5141
-
5142
- /**
5143
- Check if the message is an assistant message with completed tool calls.
5144
- The last step of the message must have at least one tool invocation and
5145
- all tool invocations must have a result.
4506
+ * Check if the last message is an assistant message with completed tool calls.
4507
+ * The last step of the message must have at least one tool invocation and
4508
+ * all tool invocations must have a result. Completed model text may follow
4509
+ * the tool invocation because client-side tool results update parts in place,
4510
+ * but trailing text without a completed stream state prevents resubmission.
5146
4511
  */
5147
4512
  export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
5148
4513
  messages: UIMessage[];
@@ -5367,7 +4732,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
5367
4732
  Thrown when no output type is specified and output-related methods are called.
5368
4733
  */
5369
4734
  export declare class NoOutputSpecifiedError extends AISDKError {
5370
- private readonly [symbol$7_3];
4735
+ private readonly [symbol$7_2];
5371
4736
  constructor({ message }?: {
5372
4737
  message?: string;
5373
4738
  });
@@ -5421,7 +4786,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
5421
4786
  }
5422
4787
 
5423
4788
  export declare class NoSuchToolError extends AISDKError {
5424
- private readonly [symbol$d_3];
4789
+ private readonly [symbol$d_2];
5425
4790
  readonly toolName: string;
5426
4791
  readonly availableTools: string[] | undefined;
5427
4792
  constructor({ toolName, availableTools, message, }: {
@@ -5457,7 +4822,7 @@ export declare namespace Output {
5457
4822
  };
5458
4823
  }
5459
4824
 
5460
- declare interface Output_2<OUTPUT, PARTIAL> {
4825
+ export declare interface OutputInterface<OUTPUT, PARTIAL> {
5461
4826
  readonly type: 'object' | 'text';
5462
4827
  responseFormat: LanguageModelV2CallOptions['responseFormat'];
5463
4828
  parsePartial(options: {
@@ -5625,7 +4990,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedT
5625
4990
  declare function parseJSON(options: {
5626
4991
  text: string;
5627
4992
  schema?: undefined;
5628
- }): Promise<JSONValue_3>;
4993
+ }): Promise<JSONValue_2>;
5629
4994
 
5630
4995
  /**
5631
4996
  * Parses a JSON string into a strongly-typed object using the provided schema.
@@ -5665,7 +5030,7 @@ declare type ParseResult<T> = {
5665
5030
  rawValue: unknown;
5666
5031
  } | {
5667
5032
  success: false;
5668
- error: JSONParseError_2 | TypeValidationError_2;
5033
+ error: JSONParseError | TypeValidationError;
5669
5034
  rawValue: unknown;
5670
5035
  };
5671
5036
 
@@ -5820,7 +5185,7 @@ export declare function pipeTextStreamToResponse({ response, status, statusText,
5820
5185
  textStream: ReadableStream<string>;
5821
5186
  } & ResponseInit): Promise<void>;
5822
5187
 
5823
- export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
5188
+ export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
5824
5189
  response: ServerResponse;
5825
5190
  stream: ReadableStream<UIMessageChunk>;
5826
5191
  } & UIMessageStreamResponseInit): Promise<void>;
@@ -5829,7 +5194,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
5829
5194
  url: string;
5830
5195
  headers?: Record<string, string | undefined>;
5831
5196
  formData: FormData;
5832
- failedResponseHandler: ResponseHandler<APICallError_2>;
5197
+ failedResponseHandler: ResponseHandler<APICallError>;
5833
5198
  successfulResponseHandler: ResponseHandler<T>;
5834
5199
  abortSignal?: AbortSignal;
5835
5200
  fetch?: FetchFunction;
@@ -5843,7 +5208,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
5843
5208
  url: string;
5844
5209
  headers?: Record<string, string | undefined>;
5845
5210
  body: unknown;
5846
- failedResponseHandler: ResponseHandler<APICallError_2>;
5211
+ failedResponseHandler: ResponseHandler<APICallError>;
5847
5212
  successfulResponseHandler: ResponseHandler<T>;
5848
5213
  abortSignal?: AbortSignal;
5849
5214
  fetch?: FetchFunction;
@@ -6049,7 +5414,7 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata;
6049
5414
  They are passed through to the provider from the AI SDK and enable
6050
5415
  provider-specific functionality that can be fully encapsulated in the provider.
6051
5416
  */
6052
- declare type ProviderOptions = SharedV2ProviderOptions_2;
5417
+ declare type ProviderOptions = SharedV2ProviderOptions;
6053
5418
 
6054
5419
  export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
6055
5420
  languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
@@ -6215,6 +5580,10 @@ declare interface ReasoningPart {
6215
5580
  */
6216
5581
  export declare type ReasoningUIPart = {
6217
5582
  type: 'reasoning';
5583
+ /**
5584
+ * The identifier of the reasoning part.
5585
+ */
5586
+ id?: string;
6218
5587
  /**
6219
5588
  * The reasoning text.
6220
5589
  */
@@ -6272,7 +5641,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
6272
5641
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
6273
5642
 
6274
5643
  export declare class RetryError extends AISDKError {
6275
- private readonly [symbol$1_3];
5644
+ private readonly [symbol$1_2];
6276
5645
  readonly reason: RetryErrorReason;
6277
5646
  readonly lastError: unknown;
6278
5647
  readonly errors: Array<unknown>;
@@ -6295,7 +5664,7 @@ declare type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable' | 'ab
6295
5664
  declare function safeParseJSON(options: {
6296
5665
  text: string;
6297
5666
  schema?: undefined;
6298
- }): Promise<ParseResult<JSONValue_3>>;
5667
+ }): Promise<ParseResult<JSONValue_2>>;
6299
5668
 
6300
5669
  /**
6301
5670
  * Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
@@ -6328,7 +5697,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6328
5697
  rawValue: unknown;
6329
5698
  } | {
6330
5699
  success: false;
6331
- error: TypeValidationError_2;
5700
+ error: TypeValidationError;
6332
5701
  rawValue: unknown;
6333
5702
  }>;
6334
5703
 
@@ -6337,16 +5706,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6337
5706
  * but instead of throwing it returns `{ success: true, data }`
6338
5707
  * or `{ success: false, error }`.
6339
5708
  */
6340
- export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
6341
- messages: unknown;
6342
- metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
6343
- dataSchemas?: {
6344
- [NAME in keyof InferUIMessageData<UI_MESSAGE> & string]?: Validator<InferUIMessageData<UI_MESSAGE>[NAME]> | StandardSchemaV1<unknown, InferUIMessageData<UI_MESSAGE>[NAME]>;
6345
- };
6346
- tools?: {
6347
- [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
6348
- };
6349
- }): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
5709
+ export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
6350
5710
 
6351
5711
  export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
6352
5712
  success: true;
@@ -6379,8 +5739,10 @@ declare const schemaSymbol: unique symbol;
6379
5739
  export declare class SerialJobExecutor {
6380
5740
  private queue;
6381
5741
  private isProcessing;
5742
+ private idleWaiters;
6382
5743
  private processQueue;
6383
5744
  run(job: Job): Promise<void>;
5745
+ waitForIdle(): Promise<void>;
6384
5746
  }
6385
5747
 
6386
5748
  declare type SharedV2Headers = Record<string, string>;
@@ -6408,29 +5770,6 @@ declare type SharedV2Headers = Record<string, string>;
6408
5770
  */
6409
5771
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
6410
5772
 
6411
- /**
6412
- * Additional provider-specific metadata.
6413
- * Metadata are additional outputs from the provider.
6414
- * They are passed through to the provider from the AI SDK
6415
- * and enable provider-specific functionality
6416
- * that can be fully encapsulated in the provider.
6417
- *
6418
- * This enables us to quickly ship provider-specific functionality
6419
- * without affecting the core AI SDK.
6420
- *
6421
- * The outer record is keyed by the provider name, and the inner
6422
- * record is keyed by the provider-specific metadata key.
6423
- *
6424
- * ```ts
6425
- * {
6426
- * "anthropic": {
6427
- * "cacheControl": { "type": "ephemeral" }
6428
- * }
6429
- * }
6430
- * ```
6431
- */
6432
- declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
6433
-
6434
5773
  /**
6435
5774
  * Additional provider-specific options.
6436
5775
  * Options are additional input to the provider.
@@ -6454,29 +5793,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
6454
5793
  */
6455
5794
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
6456
5795
 
6457
- /**
6458
- * Additional provider-specific options.
6459
- * Options are additional input to the provider.
6460
- * They are passed through to the provider from the AI SDK
6461
- * and enable provider-specific functionality
6462
- * that can be fully encapsulated in the provider.
6463
- *
6464
- * This enables us to quickly ship provider-specific functionality
6465
- * without affecting the core AI SDK.
6466
- *
6467
- * The outer record is keyed by the provider name, and the inner
6468
- * record is keyed by the provider-specific metadata key.
6469
- *
6470
- * ```ts
6471
- * {
6472
- * "anthropic": {
6473
- * "cacheControl": { "type": "ephemeral" }
6474
- * }
6475
- * }
6476
- * ```
6477
- */
6478
- declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
6479
-
6480
5796
  /**
6481
5797
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
6482
5798
  *
@@ -6578,7 +5894,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
6578
5894
  /**
6579
5895
  * Smooths text streaming output.
6580
5896
  *
6581
- * @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay.
5897
+ * @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay. The delay is skipped while the document is hidden (e.g. browser background tabs), where timer throttling would otherwise stall the stream.
6582
5898
  * @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, or provide a custom RegExp pattern for custom chunking.
6583
5899
  *
6584
5900
  * @returns A transform stream that smooths text streaming output.
@@ -7383,7 +6699,7 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
7383
6699
  private finishToolCall;
7384
6700
  }
7385
6701
 
7386
- declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart_2>, 'enqueue'>;
6702
+ declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart>, 'enqueue'>;
7387
6703
 
7388
6704
  declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
7389
6705
  /**
@@ -7403,11 +6719,11 @@ declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCal
7403
6719
  * Extract provider-specific metadata from a tool call delta.
7404
6720
  * Called once when a new tool call is detected.
7405
6721
  */
7406
- extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata_2 | undefined;
6722
+ extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata | undefined;
7407
6723
  /**
7408
6724
  * Build the `providerMetadata` object for a `tool-call` event.
7409
6725
  */
7410
- buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata_2 | undefined) => SharedV2ProviderMetadata_2 | undefined;
6726
+ buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata | undefined) => SharedV2ProviderMetadata | undefined;
7411
6727
  }
7412
6728
 
7413
6729
  /**
@@ -7781,7 +7097,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIA
7781
7097
  /**
7782
7098
  Optional specification for parsing structured outputs from the LLM response.
7783
7099
  */
7784
- experimental_output?: Output_2<OUTPUT, PARTIAL_OUTPUT>;
7100
+ experimental_output?: OutputInterface<OUTPUT, PARTIAL_OUTPUT>;
7785
7101
  /**
7786
7102
  Optional function that you can use to provide different settings for a step.
7787
7103
 
@@ -8125,8 +7441,6 @@ declare const symbol$1: unique symbol;
8125
7441
 
8126
7442
  declare const symbol$1_2: unique symbol;
8127
7443
 
8128
- declare const symbol$1_3: unique symbol;
8129
-
8130
7444
  declare const symbol$2: unique symbol;
8131
7445
 
8132
7446
  declare const symbol$2_2: unique symbol;
@@ -8151,8 +7465,6 @@ declare const symbol$7: unique symbol;
8151
7465
 
8152
7466
  declare const symbol$7_2: unique symbol;
8153
7467
 
8154
- declare const symbol$7_3: unique symbol;
8155
-
8156
7468
  declare const symbol$8: unique symbol;
8157
7469
 
8158
7470
  declare const symbol$8_2: unique symbol;
@@ -8171,14 +7483,10 @@ declare const symbol$c: unique symbol;
8171
7483
 
8172
7484
  declare const symbol$c_2: unique symbol;
8173
7485
 
8174
- declare const symbol$c_3: unique symbol;
8175
-
8176
7486
  declare const symbol$d: unique symbol;
8177
7487
 
8178
7488
  declare const symbol$d_2: unique symbol;
8179
7489
 
8180
- declare const symbol$d_3: unique symbol;
8181
-
8182
7490
  declare const symbol$e: unique symbol;
8183
7491
 
8184
7492
  declare const symbol: unique symbol;
@@ -8378,7 +7686,7 @@ declare type TimeInput = HrTime | number | Date;
8378
7686
 
8379
7687
  The tool can also contain an optional execute function for the actual execution function of the tool.
8380
7688
  */
8381
- export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any> = {
7689
+ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
8382
7690
  /**
8383
7691
  An optional description of what the tool does.
8384
7692
  Will be used by the language model to decide whether to use the tool.
@@ -8422,7 +7730,7 @@ export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTP
8422
7730
 
8423
7731
  If not provided, the tool result will be sent as a JSON object.
8424
7732
  */
8425
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart_2['output'];
7733
+ toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart['output'];
8426
7734
  } & ({
8427
7735
  /**
8428
7736
  Tool with user-defined input and output schemas.
@@ -8679,7 +7987,7 @@ export declare interface ToolResultPart {
8679
7987
  /**
8680
7988
  Result of the tool call. This is a JSON-serializable object.
8681
7989
  */
8682
- output: LanguageModelV2ToolResultOutput_2;
7990
+ output: LanguageModelV2ToolResultOutput;
8683
7991
  /**
8684
7992
  Additional provider-specific metadata. They are passed through
8685
7993
  to the provider from the AI SDK and enable provider-specific
@@ -9031,30 +8339,6 @@ export declare class TypeValidationError extends AISDKError {
9031
8339
  }): TypeValidationError;
9032
8340
  }
9033
8341
 
9034
- declare class TypeValidationError_2 extends AISDKError_2 {
9035
- private readonly [symbol$1_2];
9036
- readonly value: unknown;
9037
- constructor({ value, cause }: {
9038
- value: unknown;
9039
- cause: unknown;
9040
- });
9041
- static isInstance(error: unknown): error is TypeValidationError_2;
9042
- /**
9043
- * Wraps an error into a TypeValidationError.
9044
- * If the cause is already a TypeValidationError with the same value, it returns the cause.
9045
- * Otherwise, it creates a new TypeValidationError.
9046
- *
9047
- * @param {Object} params - The parameters for wrapping the error.
9048
- * @param {unknown} params.value - The value that failed validation.
9049
- * @param {unknown} params.cause - The original error or cause of the validation failure.
9050
- * @returns {TypeValidationError} A TypeValidationError instance.
9051
- */
9052
- static wrap({ value, cause, }: {
9053
- value: unknown;
9054
- cause: unknown;
9055
- }): TypeValidationError_2;
9056
- }
9057
-
9058
8342
  export declare const UI_MESSAGE_STREAM_HEADERS: {
9059
8343
  'content-type': string;
9060
8344
  'cache-control': string;
@@ -9227,6 +8511,10 @@ export declare type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage
9227
8511
  * Indicates whether the stream was aborted.
9228
8512
  */
9229
8513
  isAborted: boolean;
8514
+ /**
8515
+ * The operation-level outcome of the stream.
8516
+ */
8517
+ outcome: UIMessageStreamOutcome;
9230
8518
  /**
9231
8519
  * The message that was sent to the client as a response
9232
8520
  * (including the original message if it was extended).
@@ -9292,7 +8580,31 @@ export declare type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
9292
8580
  onError?: (error: unknown) => string;
9293
8581
  };
9294
8582
 
8583
+ /**
8584
+ * The operation-level outcome of a UI message stream.
8585
+ *
8586
+ * This is separate from model finish reasons and individual stream chunks.
8587
+ * Fatal stream-processing failures override outcomes declared by the stream
8588
+ * owner.
8589
+ */
8590
+ export declare type UIMessageStreamOutcome = {
8591
+ status: 'completed';
8592
+ } | {
8593
+ status: 'failed';
8594
+ error?: unknown;
8595
+ } | {
8596
+ status: 'aborted';
8597
+ } | {
8598
+ status: 'unknown';
8599
+ };
8600
+
9295
8601
  declare type UIMessageStreamResponseInit = ResponseInit & {
8602
+ /**
8603
+ * Optional interval in milliseconds for sending SSE keep-alive comments.
8604
+ * When set, an opening comment is sent immediately and additional comments
8605
+ * are sent after the stream has been idle for the configured interval.
8606
+ */
8607
+ keepAliveMs?: number;
9296
8608
  consumeSseStream?: (options: {
9297
8609
  stream: ReadableStream<string>;
9298
8610
  }) => PromiseLike<void> | void;
@@ -9315,6 +8627,18 @@ export declare interface UIMessageStreamWriter<UI_MESSAGE extends UIMessage = UI
9315
8627
  onError: ErrorHandler | undefined;
9316
8628
  }
9317
8629
 
8630
+ export declare interface UIMessageStreamWriterWithOutcome<UI_MESSAGE extends UIMessage = UIMessage> extends UIMessageStreamWriter<UI_MESSAGE> {
8631
+ /**
8632
+ * Declares the operation-level outcome of the composed stream.
8633
+ *
8634
+ * The first outcome declared through this method is retained. Fatal
8635
+ * execution, merge, error-handling, or downstream processing failures
8636
+ * override declared outcomes. Declaring an outcome does not write a chunk or
8637
+ * close the stream.
8638
+ */
8639
+ setOutcome(outcome: UIMessageStreamOutcome): void;
8640
+ }
8641
+
9318
8642
  export declare type UITool = {
9319
8643
  input: unknown;
9320
8644
  output: unknown | undefined;
@@ -9338,6 +8662,13 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
9338
8662
  state: 'input-streaming';
9339
8663
  input: DeepPartial<asUITool<TOOL>['input']> | undefined;
9340
8664
  providerExecuted?: boolean;
8665
+ /**
8666
+ * The raw tool input text received so far.
8667
+ *
8668
+ * This is used to continue input streaming when a message is persisted
8669
+ * and later resumed.
8670
+ */
8671
+ rawInput?: string;
9341
8672
  output?: never;
9342
8673
  errorText?: never;
9343
8674
  } | {
@@ -9507,7 +8838,9 @@ declare function validateTypes<OBJECT>({ value, schema, }: {
9507
8838
  * the corresponding schemas are provided. Otherwise, they are assumed to be
9508
8839
  * valid.
9509
8840
  */
9510
- export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
8841
+ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
8842
+
8843
+ declare type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
9511
8844
  messages: unknown;
9512
8845
  metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
9513
8846
  dataSchemas?: {
@@ -9516,7 +8849,7 @@ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messa
9516
8849
  tools?: {
9517
8850
  [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
9518
8851
  };
9519
- }): Promise<Array<UI_MESSAGE>>;
8852
+ };
9520
8853
 
9521
8854
  declare type ValidationResult<OBJECT> = {
9522
8855
  success: true;
@@ -9654,5 +8987,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
9654
8987
  }): Schema<OBJECT>;
9655
8988
 
9656
8989
  export { }
9657
- export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput_2 as LanguageModelV2ToolResultOutput_2, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_3 as JSONValue_3, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart_2 as LanguageModelV2ToolResultPart_2, FlexibleSchema as FlexibleSchema, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
9658
- export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$7_3, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$c_3, symbol$d, symbol$d_2, symbol$d_3, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };
8990
+ export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, FlexibleSchema as FlexibleSchema, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction, ValidateUIMessagesOptions as ValidateUIMessagesOptions };
8991
+ export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };