@mastra/ai-sdk 1.11.2-alpha.0 → 1.11.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 {
@@ -181,8 +189,10 @@ declare namespace _ai_sdk_provider_utils {
181
189
  createStatusCodeErrorResponseHandler,
182
190
  delay,
183
191
  dynamicTool,
192
+ encodePathSegment,
184
193
  executeTool,
185
194
  extractResponseHeaders,
195
+ fetchWithValidatedEndpoint,
186
196
  fetchWithValidatedRedirects,
187
197
  generateId,
188
198
  getErrorMessage,
@@ -261,36 +271,34 @@ export declare class AISDKError extends Error {
261
271
  }
262
272
 
263
273
  /**
264
- * Custom error class for AI SDK related errors.
265
- * @extends Error
274
+ * AnyValue can be:
275
+ * - a string, number, boolean value
276
+ * - a byte array (Uint8Array)
277
+ * - array of any value
278
+ * - map from string to any value (a plain Object)
279
+ * - null (an empty value)
280
+ *
281
+ * https://opentelemetry.io/docs/specs/otel/common/#anyvalue
282
+ *
283
+ * Notable JavaScript types that are excluded:
284
+ * - `undefined` - Excluding this means the common practice in instrumentations,
285
+ * using `undefined` to mean "no value for this optional attribute", can
286
+ * remain supported.
287
+ * - `BigInt`
288
+ * - TypedArrays other than `Uint8Array`
289
+ * - subclasses of Object, e.g. Date, Error
290
+ *
291
+ * The TypeScript type `unknown` is used for `AnyValue`. This has some
292
+ * implications:
293
+ * - Callers of `@opentelemetry/api` APIs using `AnyValue` can pass in
294
+ * whatever type. This was always the case for (untyped) JavaScript usage.
295
+ * - SDK implementations of `@opentelemetry/api` need to document if/when they
296
+ * support a subset of AnyValue types.
297
+ * - Using `unknown` allows future changes to support more types (e.g. BigInt).
298
+ *
299
+ * @since 1.10.0
266
300
  */
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
- }
301
+ declare type AnyValue = unknown;
294
302
 
295
303
  export declare class APICallError extends AISDKError {
296
304
  private readonly [symbol$c];
@@ -316,30 +324,6 @@ export declare class APICallError extends AISDKError {
316
324
  static isInstance(error: unknown): error is APICallError;
317
325
  }
318
326
 
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
327
  export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
344
328
 
345
329
  /**
@@ -375,24 +359,20 @@ declare function asValidator<OBJECT>(value: FlexibleValidator<OBJECT>): Validato
375
359
  export declare type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T>;
376
360
 
377
361
  /**
378
- * Attributes is a map from string to attribute values.
379
- *
380
- * Note: only the own enumerable keys are counted as valid attribute keys.
362
+ * Attributes is a mapping from string to attribute values.
363
+ * https://opentelemetry.io/docs/specs/otel/common/#attribute-collections
381
364
  *
382
- * @since 1.3.0
365
+ * @since 1.1.0
383
366
  */
384
367
  declare interface Attributes {
385
- [attributeKey: string]: AttributeValue | undefined;
368
+ [attributeKey: string]: AnyValue;
386
369
  }
387
370
 
388
371
  /**
389
- * Attribute values may be any non-nullish primitive value except an object.
390
- *
391
- * null or undefined attribute values are invalid and will result in undefined behavior.
392
- *
393
- * @since 1.3.0
372
+ * @since 1.1.0
373
+ * @deprecated use AnyValue
394
374
  */
395
- declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
375
+ declare type AttributeValue = AnyValue;
396
376
 
397
377
  export declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onFinish, onError, fetch, }: {
398
378
  api: string;
@@ -658,6 +638,7 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
658
638
  *
659
639
  * @param options - Configuration object containing:
660
640
  * @param options.chatId - Unique identifier for the chat session to reconnect to
641
+ * @param options.abortSignal - Signal to abort the reconnection request if needed
661
642
  * @param options.headers - Additional HTTP headers to include in the reconnection request
662
643
  * @param options.body - Additional JSON properties to include in the request body
663
644
  * @param options.metadata - Custom metadata to attach to the request
@@ -671,6 +652,8 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
671
652
  reconnectToStream: (options: {
672
653
  /** Unique identifier for the chat session to reconnect to */
673
654
  chatId: string;
655
+ /** Signal to abort the reconnection request if needed */
656
+ abortSignal?: AbortSignal;
674
657
  } & ChatRequestOptions) => Promise<ReadableStream<UIMessageChunk> | null>;
675
658
  }
676
659
 
@@ -706,9 +689,10 @@ export declare type CompletionRequestOptions = {
706
689
  * @param {ReadableStream} stream - The ReadableStream to be consumed.
707
690
  * @returns {Promise<void>} A promise that resolves when the stream is fully consumed.
708
691
  */
709
- export declare function consumeStream({ stream, onError, }: {
692
+ export declare function consumeStream({ stream, onError, abortSignal, }: {
710
693
  stream: ReadableStream;
711
694
  onError?: (error: unknown) => void;
695
+ abortSignal?: AbortSignal;
712
696
  }): Promise<void>;
713
697
 
714
698
  declare type ConsumeStreamOptions = {
@@ -916,7 +900,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
916
900
  errorSchema: FlexibleValidator<T>;
917
901
  errorToMessage: (error: T) => string;
918
902
  isRetryable?: (response: Response, error?: T) => boolean;
919
- }) => ResponseHandler<APICallError_2>;
903
+ }) => ResponseHandler<APICallError>;
920
904
 
921
905
  declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
922
906
 
@@ -952,7 +936,7 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
952
936
  languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
953
937
  }): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
954
938
 
955
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
939
+ declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
956
940
 
957
941
  export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
958
942
  textStream: ReadableStream<string>;
@@ -979,7 +963,7 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
979
963
  export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
980
964
  originalMessages, onFinish, generateId, }: {
981
965
  execute: (options: {
982
- writer: UIMessageStreamWriter<UI_MESSAGE>;
966
+ writer: UIMessageStreamWriterWithOutcome<UI_MESSAGE>;
983
967
  }) => Promise<void> | void;
984
968
  onError?: (error: unknown) => string;
985
969
  /**
@@ -991,7 +975,7 @@ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ ex
991
975
  generateId?: IdGenerator;
992
976
  }): ReadableStream<InferUIMessageChunk<UI_MESSAGE>>;
993
977
 
994
- export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
978
+ export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
995
979
  stream: ReadableStream<UIMessageChunk>;
996
980
  }): Response;
997
981
 
@@ -1140,7 +1124,7 @@ export declare class DownloadError extends AISDKError {
1140
1124
  static isInstance(error: unknown): error is DownloadError;
1141
1125
  }
1142
1126
 
1143
- declare class DownloadError_2 extends AISDKError_2 {
1127
+ declare class DownloadError_2 extends AISDKError {
1144
1128
  private readonly [symbol_2];
1145
1129
  readonly url: string;
1146
1130
  readonly statusCode?: number;
@@ -1163,7 +1147,7 @@ export declare function dynamicTool(tool: {
1163
1147
  providerOptions?: ProviderOptions;
1164
1148
  inputSchema: FlexibleSchema<unknown>;
1165
1149
  execute: ToolExecuteFunction<unknown, unknown>;
1166
- toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart_2['output'];
1150
+ toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart['output'];
1167
1151
  }): Tool<unknown, unknown> & {
1168
1152
  type: 'dynamic';
1169
1153
  };
@@ -1212,6 +1196,13 @@ export declare type DynamicToolResult = {
1212
1196
 
1213
1197
  export declare type DynamicToolUIPart = {
1214
1198
  type: 'dynamic-tool';
1199
+ /**
1200
+ * `false` when a static tool part was normalized to a dynamic tool part
1201
+ * because its current tool schema was unavailable or incompatible.
1202
+ *
1203
+ * This preserves its static origin across persistence boundaries.
1204
+ */
1205
+ dynamic?: false;
1215
1206
  /**
1216
1207
  * Name of the tool that is being called.
1217
1208
  */
@@ -1228,6 +1219,13 @@ export declare type DynamicToolUIPart = {
1228
1219
  } & ({
1229
1220
  state: 'input-streaming';
1230
1221
  input: unknown | undefined;
1222
+ /**
1223
+ * The raw tool input text received so far.
1224
+ *
1225
+ * This is used to continue input streaming when a message is persisted
1226
+ * and later resumed.
1227
+ */
1228
+ rawInput?: string;
1231
1229
  output?: never;
1232
1230
  errorText?: never;
1233
1231
  } | {
@@ -1431,8 +1429,9 @@ declare type EmbeddingModelV2Embedding = Array<number>;
1431
1429
  Embed several values using an embedding model. The type of the value is defined
1432
1430
  by the embedding model.
1433
1431
 
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.
1432
+ `embedMany` automatically splits large requests into smaller chunks when the
1433
+ model has a limit on either the number of embeddings or the UTF-8 input bytes
1434
+ that can be processed in a single call.
1436
1435
 
1437
1436
  @param model - The embedding model to use.
1438
1437
  @param values - The values that should be embedded.
@@ -1565,6 +1564,17 @@ export declare class EmptyResponseBodyError extends AISDKError {
1565
1564
  static isInstance(error: unknown): error is EmptyResponseBodyError;
1566
1565
  }
1567
1566
 
1567
+ /**
1568
+ * Encodes a raw identifier as one URL path segment, including standalone dot
1569
+ * segments that URL parsers would otherwise normalize. Pass unencoded values;
1570
+ * for resource paths with intentional slashes, encode each segment separately.
1571
+ */
1572
+ declare function encodePathSegment(value: string): string;
1573
+
1574
+ declare type EnforcedToolChoice = Extract<LanguageModelV2ToolChoice, {
1575
+ type: 'none';
1576
+ }>;
1577
+
1568
1578
  export declare type ErrorHandler = (error: unknown) => void;
1569
1579
 
1570
1580
  /**
@@ -1606,7 +1616,7 @@ declare interface EventSourceMessage {
1606
1616
  * const eventStream =
1607
1617
  * response.body
1608
1618
  * .pipeThrough(new TextDecoderStream())
1609
- * .pipeThrough(new EventSourceParserStream({terminateOnError: true}))
1619
+ * .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))
1610
1620
  * ```
1611
1621
  *
1612
1622
  * @public
@@ -1615,7 +1625,7 @@ declare class EventSourceParserStream extends TransformStream<
1615
1625
  string,
1616
1626
  EventSourceMessage
1617
1627
  > {
1618
- constructor({ onError, onRetry, onComment }?: StreamOptions);
1628
+ constructor({ onError, onRetry, onComment, maxBufferSize }?: StreamOptions);
1619
1629
  }
1620
1630
 
1621
1631
  /**
@@ -1736,7 +1746,7 @@ export declare type Experimental_AgentSettings<TOOLS extends ToolSet, OUTPUT = n
1736
1746
  /**
1737
1747
  Optional specification for parsing structured outputs from the LLM response.
1738
1748
  */
1739
- experimental_output?: Output_2<OUTPUT, OUTPUT_PARTIAL>;
1749
+ experimental_output?: OutputInterface<OUTPUT, OUTPUT_PARTIAL>;
1740
1750
  /**
1741
1751
  * @deprecated Use `prepareStep` instead.
1742
1752
  */
@@ -1816,7 +1826,7 @@ export declare type Experimental_DownloadFunction = (options: Array<{
1816
1826
  @param seed - Seed for the image generation.
1817
1827
  @param providerOptions - Additional provider-specific options that are passed through to the provider
1818
1828
  as body parameters.
1819
- @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
1829
+ @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
1830
  @param abortSignal - An optional abort signal that can be used to cancel the call.
1821
1831
  @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
1822
1832
 
@@ -1867,7 +1877,9 @@ export declare function experimental_generateImage({ model: modelArg, prompt, n,
1867
1877
  */
1868
1878
  providerOptions?: ProviderOptions;
1869
1879
  /**
1870
- Maximum number of retries per embedding model call. Set to 0 to disable retries.
1880
+ Maximum number of retries per image model call, including retries after
1881
+ unclassified empty responses. Empty responses marked as not retryable by the
1882
+ provider are not retried. Set to 0 to disable retries.
1871
1883
 
1872
1884
  @default 2
1873
1885
  */
@@ -2158,6 +2170,26 @@ declare function extractResponseHeaders(response: Response): {
2158
2170
  */
2159
2171
  declare type FetchFunction = typeof globalThis.fetch;
2160
2172
 
2173
+ /**
2174
+ * Fetches one validated URL without following redirects.
2175
+ *
2176
+ * On Node.js, the default fetch validates and pins DNS results at connect time.
2177
+ * An injected fetch is responsible for equivalent connect-time validation.
2178
+ * Redirects are rejected by default. Callers using `redirect: 'manual'` must
2179
+ * validate the Location target before issuing another request.
2180
+ */
2181
+ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
2182
+ url: string | URL;
2183
+ init?: RequestInit;
2184
+ fetch?: FetchFunction;
2185
+ /**
2186
+ * A developer-configured origin that may legitimately resolve to a private
2187
+ * address. This must never be derived from untrusted response data.
2188
+ */
2189
+ trustedOrigin?: string;
2190
+ redirect?: 'error' | 'manual';
2191
+ }): Promise<Response>;
2192
+
2161
2193
  /**
2162
2194
  * Fetches a URL while enforcing the SSRF download guard on every hop.
2163
2195
  *
@@ -2175,6 +2207,13 @@ declare type FetchFunction = typeof globalThis.fetch;
2175
2207
  * runtime we cannot validate the hop, so we fail closed rather than follow it
2176
2208
  * blindly and bypass the SSRF guard.
2177
2209
  *
2210
+ * A hop that is same-origin with `trustedOrigin` (the developer-configured
2211
+ * endpoint) skips target validation: that origin is exactly what an
2212
+ * unvalidated, config-derived request would fetch anyway, and validating it
2213
+ * would break legitimate self-hosted / localhost deployments whose response
2214
+ * URLs point back at the configured host. Hops on any other origin are always
2215
+ * validated.
2216
+ *
2178
2217
  * The returned response is the final (non-redirect) response. The caller is
2179
2218
  * responsible for checking `response.ok` and reading the body.
2180
2219
  *
@@ -2186,11 +2225,17 @@ declare type FetchFunction = typeof globalThis.fetch;
2186
2225
  * @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
2187
2226
  * a redirect cannot be validated on a non-browser runtime.
2188
2227
  */
2189
- declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
2228
+ declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin, }: {
2190
2229
  url: string;
2191
2230
  headers?: HeadersInit;
2192
2231
  abortSignal?: AbortSignal;
2193
2232
  maxRedirects?: number;
2233
+ fetch?: FetchFunction;
2234
+ /**
2235
+ * A developer-configured origin whose hops skip target validation. Must
2236
+ * never be derived from response data.
2237
+ */
2238
+ trustedOrigin?: string;
2194
2239
  }): Promise<Response>;
2195
2240
 
2196
2241
  /**
@@ -2275,7 +2320,7 @@ declare interface GatewayCreditsResponse {
2275
2320
  totalUsed: string;
2276
2321
  }
2277
2322
 
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 & {});
2323
+ 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
2324
 
2280
2325
  declare interface GatewayFetchMetadataResponse {
2281
2326
  models: GatewayLanguageModelEntry[];
@@ -2325,7 +2370,7 @@ declare interface GatewayGenerationInfoParams {
2325
2370
  id: string;
2326
2371
  }
2327
2372
 
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 & {});
2373
+ 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-3-image-klein' | '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' | '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
2374
 
2330
2375
  declare interface GatewayLanguageModelEntry {
2331
2376
  /**
@@ -2376,7 +2421,7 @@ declare interface GatewayLanguageModelEntry {
2376
2421
 
2377
2422
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2378
2423
 
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 & {});
2424
+ 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.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-1017' | 'deepseek/deepseek-v4.1-flash-1017-fast' | 'deepseek/deepseek-v4.1-flash-fast' | 'elorian/glimpse' | '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-3' | '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-spark-open' | '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' | 'minimax/minimax-m3.1-flash' | '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' | 'moonshotai/kimi-k3.1-pro' | 'moonshotai/kimi-k3.1-pro-highspeed' | '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-3.5-super-vl' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | '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-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' | 'perplexity/sonar' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'quiverai/arrow-2' | 'quiverai/arrow-2-telos' | 'reflection/beam' | 'reflection/beam-free' | 'sakana/fugu-max' | 'sakana/fugu-ultra' | 'sakana/fugu-ultra-v2' | 'sakana/namazu' | 'scaledown/scaledown-extract-1' | 'scaledown/scaledown-summarize-1' | '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
2425
 
2381
2426
  declare interface GatewayProvider extends ProviderV2 {
2382
2427
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2821,7 +2866,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTP
2821
2866
  /**
2822
2867
  Optional specification for parsing structured outputs from the LLM response.
2823
2868
  */
2824
- experimental_output?: Output_2<OUTPUT, OUTPUT_PARTIAL>;
2869
+ experimental_output?: OutputInterface<OUTPUT, OUTPUT_PARTIAL>;
2825
2870
  /**
2826
2871
  Custom download function to use for URLs.
2827
2872
 
@@ -3190,6 +3235,11 @@ declare type ImageModelV2 = {
3190
3235
  be returned as binary data.
3191
3236
  */
3192
3237
  images: Array<string> | Array<Uint8Array>;
3238
+ /**
3239
+ Whether an unsuccessful result, such as an empty image result, can be
3240
+ retried. When omitted, the result is unclassified.
3241
+ */
3242
+ isRetryable?: boolean;
3193
3243
  /**
3194
3244
  Warnings for the call, e.g. unsupported settings.
3195
3245
  */
@@ -3381,14 +3431,14 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
3381
3431
  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
3432
 
3383
3433
  declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
3384
- messages: LanguageModelV2Prompt_2;
3434
+ messages: LanguageModelV2Prompt;
3385
3435
  schema?: JSONSchema7;
3386
3436
  schemaPrefix?: string;
3387
3437
  schemaSuffix?: string;
3388
- }): LanguageModelV2Prompt_2;
3438
+ }): LanguageModelV2Prompt;
3389
3439
 
3390
3440
  export declare class InvalidArgumentError extends AISDKError {
3391
- private readonly [symbol$c_3];
3441
+ private readonly [symbol$d_2];
3392
3442
  readonly parameter: string;
3393
3443
  readonly value: unknown;
3394
3444
  constructor({ parameter, value, message, }: {
@@ -3450,7 +3500,7 @@ export declare class InvalidResponseDataError extends AISDKError {
3450
3500
  }
3451
3501
 
3452
3502
  export declare class InvalidStreamPartError extends AISDKError {
3453
- private readonly [symbol$b_2];
3503
+ private readonly [symbol$c_2];
3454
3504
  readonly chunk: SingleRequestTextStreamPart<any>;
3455
3505
  constructor({ chunk, message, }: {
3456
3506
  chunk: SingleRequestTextStreamPart<any>;
@@ -3460,7 +3510,7 @@ export declare class InvalidStreamPartError extends AISDKError {
3460
3510
  }
3461
3511
 
3462
3512
  export declare class InvalidToolInputError extends AISDKError {
3463
- private readonly [symbol$e];
3513
+ private readonly [symbol$f];
3464
3514
  readonly toolName: string;
3465
3515
  readonly toolInput: string;
3466
3516
  constructor({ toolInput, toolName, cause, message, }: {
@@ -3498,6 +3548,8 @@ export declare function isDataUIPart<DATA_TYPES extends UIDataTypes>(part: UIMes
3498
3548
  */
3499
3549
  export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3500
3550
 
3551
+ export declare function isDynamicToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart;
3552
+
3501
3553
  /**
3502
3554
  * Type guard to check if a message part is a file part.
3503
3555
  */
@@ -3556,16 +3608,10 @@ declare type Job = () => Promise<void>;
3556
3608
 
3557
3609
  declare type JSONArray = JSONValue_2[];
3558
3610
 
3559
- declare type JSONArray_2 = JSONValue_3[];
3560
-
3561
3611
  declare type JSONObject = {
3562
3612
  [key: string]: JSONValue_2;
3563
3613
  };
3564
3614
 
3565
- declare type JSONObject_2 = {
3566
- [key: string]: JSONValue_3;
3567
- };
3568
-
3569
3615
  export declare class JSONParseError extends AISDKError {
3570
3616
  private readonly [symbol$7];
3571
3617
  readonly text: string;
@@ -3576,16 +3622,6 @@ export declare class JSONParseError extends AISDKError {
3576
3622
  static isInstance(error: unknown): error is JSONParseError;
3577
3623
  }
3578
3624
 
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
3625
  /**
3590
3626
  * Create a schema using a JSON Schema.
3591
3627
  *
@@ -3610,12 +3646,6 @@ export declare type JSONValue = JSONValue_2;
3610
3646
  */
3611
3647
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3612
3648
 
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
3649
  declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
3620
3650
 
3621
3651
  declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
@@ -3871,107 +3901,6 @@ declare type LanguageModelV2CallOptions = {
3871
3901
  providerOptions?: SharedV2ProviderOptions;
3872
3902
  };
3873
3903
 
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
3904
  /**
3976
3905
  Warning from the model provider for this call. The call will proceed, but e.g.
3977
3906
  some settings might not be supported, which can lead to suboptimal results.
@@ -3989,23 +3918,6 @@ declare type LanguageModelV2CallWarning = {
3989
3918
  message: string;
3990
3919
  };
3991
3920
 
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
3921
  declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
4010
3922
 
4011
3923
  /**
@@ -4013,11 +3925,6 @@ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reaso
4013
3925
  */
4014
3926
  declare type LanguageModelV2DataContent = Uint8Array | string | URL;
4015
3927
 
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
3928
  /**
4022
3929
  A file that has been generated by the model.
4023
3930
  Generated files as base64 encoded strings or binary data.
@@ -4042,30 +3949,6 @@ declare type LanguageModelV2File = {
4042
3949
  data: string | Uint8Array;
4043
3950
  };
4044
3951
 
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
3952
  /**
4070
3953
  File content part of a prompt. It contains a file.
4071
3954
  */
@@ -4079,6 +3962,13 @@ declare interface LanguageModelV2FilePart {
4079
3962
  File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4080
3963
  */
4081
3964
  data: LanguageModelV2DataContent;
3965
+ /**
3966
+ * The original URL string before it was parsed into a `URL`.
3967
+ *
3968
+ * This is available when parsing would change the string and a provider
3969
+ * needs to preserve an opaque non-HTTP URI exactly.
3970
+ */
3971
+ originalUrl?: string;
4082
3972
  /**
4083
3973
  IANA media type of the file.
4084
3974
 
@@ -4095,42 +3985,6 @@ declare interface LanguageModelV2FilePart {
4095
3985
  providerOptions?: SharedV2ProviderOptions;
4096
3986
  }
4097
3987
 
4098
- /**
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
3988
  /**
4135
3989
  Reason why a language model finished generating a response.
4136
3990
 
@@ -4145,20 +3999,6 @@ declare interface LanguageModelV2FilePart_2 {
4145
3999
  */
4146
4000
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4147
4001
 
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
4002
  /**
4163
4003
  A tool has a name, a description, and a set of parameters.
4164
4004
 
@@ -4190,37 +4030,6 @@ declare type LanguageModelV2FunctionTool = {
4190
4030
  providerOptions?: SharedV2ProviderOptions;
4191
4031
  };
4192
4032
 
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
4033
  declare type LanguageModelV2Message = ({
4225
4034
  role: 'system';
4226
4035
  content: string;
@@ -4242,27 +4051,6 @@ declare type LanguageModelV2Message = ({
4242
4051
  providerOptions?: SharedV2ProviderOptions;
4243
4052
  };
4244
4053
 
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
4054
  /**
4267
4055
  * Experimental middleware for LanguageModelV2.
4268
4056
  * This type defines the structure for middleware that can be used to modify
@@ -4352,17 +4140,6 @@ declare type LanguageModelV2Middleware = {
4352
4140
  */
4353
4141
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
4354
4142
 
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
4143
  /**
4367
4144
  The configuration of a tool that is defined by the provider.
4368
4145
  */
@@ -4385,28 +4162,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
4385
4162
  args: Record<string, unknown>;
4386
4163
  };
4387
4164
 
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
4165
  /**
4411
4166
  Reasoning that the model has generated.
4412
4167
  */
@@ -4436,23 +4191,6 @@ declare interface LanguageModelV2ReasoningPart {
4436
4191
  providerOptions?: SharedV2ProviderOptions;
4437
4192
  }
4438
4193
 
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
4194
  declare interface LanguageModelV2ResponseMetadata {
4457
4195
  /**
4458
4196
  ID for the generated response, if the provider sends one.
@@ -4468,21 +4206,6 @@ declare interface LanguageModelV2ResponseMetadata {
4468
4206
  modelId?: string;
4469
4207
  }
4470
4208
 
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
4209
  /**
4487
4210
  A source that has been used as input to generate the response.
4488
4211
  */
@@ -4536,59 +4259,6 @@ declare type LanguageModelV2Source = {
4536
4259
  providerMetadata?: SharedV2ProviderMetadata;
4537
4260
  };
4538
4261
 
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
4262
  declare type LanguageModelV2StreamPart = {
4593
4263
  type: 'text-start';
4594
4264
  providerMetadata?: SharedV2ProviderMetadata;
@@ -4648,65 +4318,6 @@ declare type LanguageModelV2StreamPart = {
4648
4318
  error: unknown;
4649
4319
  };
4650
4320
 
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
4321
  /**
4711
4322
  Text that the model has generated.
4712
4323
  */
@@ -4736,23 +4347,6 @@ declare interface LanguageModelV2TextPart {
4736
4347
  providerOptions?: SharedV2ProviderOptions;
4737
4348
  }
4738
4349
 
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
4350
  /**
4757
4351
  * Tool calls that the model has generated.
4758
4352
  */
@@ -4782,35 +4376,6 @@ declare type LanguageModelV2ToolCall = {
4782
4376
  providerMetadata?: SharedV2ProviderMetadata;
4783
4377
  };
4784
4378
 
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
- };
4813
-
4814
4379
  /**
4815
4380
  Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
4816
4381
  */
@@ -4841,36 +4406,6 @@ declare interface LanguageModelV2ToolCallPart {
4841
4406
  providerOptions?: SharedV2ProviderOptions;
4842
4407
  }
4843
4408
 
4844
- /**
4845
- Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
4846
- */
4847
- declare interface LanguageModelV2ToolCallPart_2 {
4848
- type: 'tool-call';
4849
- /**
4850
- ID of the tool call. This ID is used to match the tool call with the tool result.
4851
- */
4852
- toolCallId: string;
4853
- /**
4854
- Name of the tool that is being called.
4855
- */
4856
- toolName: string;
4857
- /**
4858
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
4859
- */
4860
- input: unknown;
4861
- /**
4862
- * Whether the tool call will be executed by the provider.
4863
- * If this flag is not set or is false, the tool call will be executed by the client.
4864
- */
4865
- providerExecuted?: boolean;
4866
- /**
4867
- * Additional provider-specific options. They are passed through
4868
- * to the provider from the AI SDK and enable provider-specific
4869
- * functionality that can be fully encapsulated in the provider.
4870
- */
4871
- providerOptions?: SharedV2ProviderOptions_2;
4872
- }
4873
-
4874
4409
  declare type LanguageModelV2ToolChoice = {
4875
4410
  type: 'auto';
4876
4411
  } | {
@@ -4882,17 +4417,6 @@ declare type LanguageModelV2ToolChoice = {
4882
4417
  toolName: string;
4883
4418
  };
4884
4419
 
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
4420
  /**
4897
4421
  Result of a tool call that has been executed by the provider.
4898
4422
  */
@@ -4900,111 +4424,44 @@ declare type LanguageModelV2ToolResult = {
4900
4424
  type: 'tool-result';
4901
4425
  /**
4902
4426
  * The ID of the tool call that this result is associated with.
4903
- */
4904
- toolCallId: string;
4905
- /**
4906
- * Name of the tool that generated this result.
4907
- */
4908
- toolName: string;
4909
- /**
4910
- * Result of the tool call. This is a JSON-serializable object.
4911
- */
4912
- result: unknown;
4913
- /**
4914
- * Optional flag if the result is an error or an error message.
4915
- */
4916
- isError?: boolean;
4917
- /**
4918
- * Whether the tool result was generated by the provider.
4919
- * If this flag is set to true, the tool result was generated by the provider.
4920
- * If this flag is not set or is false, the tool result was generated by the client.
4921
- */
4922
- providerExecuted?: boolean;
4923
- /**
4924
- * Additional provider-specific metadata for the tool result.
4925
- */
4926
- providerMetadata?: SharedV2ProviderMetadata;
4927
- };
4928
-
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
- declare type LanguageModelV2ToolResultOutput = {
4963
- type: 'text';
4964
- value: string;
4965
- } | {
4966
- type: 'json';
4967
- value: JSONValue_2;
4968
- } | {
4969
- type: 'error-text';
4970
- value: string;
4971
- } | {
4972
- type: 'error-json';
4973
- value: JSONValue_2;
4974
- } | {
4975
- type: 'content';
4976
- value: Array<{
4977
- type: 'text';
4978
- /**
4979
- Text content.
4980
- */
4981
- text: string;
4982
- } | {
4983
- type: 'media';
4984
- /**
4985
- Base-64 encoded media data.
4986
- */
4987
- data: string;
4988
- /**
4989
- IANA media type.
4990
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4991
- */
4992
- mediaType: string;
4993
- }>;
4427
+ */
4428
+ toolCallId: string;
4429
+ /**
4430
+ * Name of the tool that generated this result.
4431
+ */
4432
+ toolName: string;
4433
+ /**
4434
+ * Result of the tool call. This is a JSON-serializable object.
4435
+ */
4436
+ result: unknown;
4437
+ /**
4438
+ * Optional flag if the result is an error or an error message.
4439
+ */
4440
+ isError?: boolean;
4441
+ /**
4442
+ * Whether the tool result was generated by the provider.
4443
+ * If this flag is set to true, the tool result was generated by the provider.
4444
+ * If this flag is not set or is false, the tool result was generated by the client.
4445
+ */
4446
+ providerExecuted?: boolean;
4447
+ /**
4448
+ * Additional provider-specific metadata for the tool result.
4449
+ */
4450
+ providerMetadata?: SharedV2ProviderMetadata;
4994
4451
  };
4995
4452
 
4996
- declare type LanguageModelV2ToolResultOutput_2 = {
4453
+ declare type LanguageModelV2ToolResultOutput = {
4997
4454
  type: 'text';
4998
4455
  value: string;
4999
4456
  } | {
5000
4457
  type: 'json';
5001
- value: JSONValue_3;
4458
+ value: JSONValue_2;
5002
4459
  } | {
5003
4460
  type: 'error-text';
5004
4461
  value: string;
5005
4462
  } | {
5006
4463
  type: 'error-json';
5007
- value: JSONValue_3;
4464
+ value: JSONValue_2;
5008
4465
  } | {
5009
4466
  type: 'content';
5010
4467
  value: Array<{
@@ -5052,31 +4509,6 @@ declare interface LanguageModelV2ToolResultPart {
5052
4509
  providerOptions?: SharedV2ProviderOptions;
5053
4510
  }
5054
4511
 
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
4512
  /**
5081
4513
  Usage information for a language model call.
5082
4514
 
@@ -5109,40 +4541,11 @@ declare type LanguageModelV2Usage = {
5109
4541
  };
5110
4542
 
5111
4543
  /**
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.
4544
+ * Check if the last message is an assistant message with completed tool calls.
4545
+ * The last step of the message must have at least one tool invocation and
4546
+ * all tool invocations must have a result. Completed model text may follow
4547
+ * the tool invocation because client-side tool results update parts in place,
4548
+ * but trailing text without a completed stream state prevents resubmission.
5146
4549
  */
5147
4550
  export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
5148
4551
  messages: UIMessage[];
@@ -5194,7 +4597,11 @@ declare interface Link {
5194
4597
  context: SpanContext;
5195
4598
  /** A set of {@link SpanAttributes} on the link. */
5196
4599
  attributes?: SpanAttributes;
5197
- /** Count of attributes of the link that were dropped due to collection limits */
4600
+ /**
4601
+ * Count of attributes of the link that were dropped due to collection limits
4602
+ *
4603
+ * @since 1.4.1
4604
+ */
5198
4605
  droppedAttributesCount?: number;
5199
4606
  }
5200
4607
 
@@ -5298,7 +4705,7 @@ export declare class NoContentGeneratedError extends AISDKError {
5298
4705
  - The model generated a response that could not be parsed.
5299
4706
  */
5300
4707
  export declare class NoImageGeneratedError extends AISDKError {
5301
- private readonly [symbol$a];
4708
+ private readonly [symbol$b_2];
5302
4709
  /**
5303
4710
  The response metadata for each call.
5304
4711
  */
@@ -5323,7 +4730,7 @@ export declare class NoImageGeneratedError extends AISDKError {
5323
4730
  - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
5324
4731
  */
5325
4732
  export declare class NoObjectGeneratedError extends AISDKError {
5326
- private readonly [symbol$9_2];
4733
+ private readonly [symbol$a];
5327
4734
  /**
5328
4735
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
5329
4736
  */
@@ -5355,7 +4762,7 @@ export declare class NoObjectGeneratedError extends AISDKError {
5355
4762
  Thrown when no LLM output was generated, e.g. because of errors.
5356
4763
  */
5357
4764
  export declare class NoOutputGeneratedError extends AISDKError {
5358
- private readonly [symbol$8_2];
4765
+ private readonly [symbol$9_2];
5359
4766
  constructor({ message, cause, }?: {
5360
4767
  message?: string;
5361
4768
  cause?: Error;
@@ -5367,7 +4774,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
5367
4774
  Thrown when no output type is specified and output-related methods are called.
5368
4775
  */
5369
4776
  export declare class NoOutputSpecifiedError extends AISDKError {
5370
- private readonly [symbol$7_3];
4777
+ private readonly [symbol$8_2];
5371
4778
  constructor({ message }?: {
5372
4779
  message?: string;
5373
4780
  });
@@ -5421,7 +4828,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
5421
4828
  }
5422
4829
 
5423
4830
  export declare class NoSuchToolError extends AISDKError {
5424
- private readonly [symbol$d_3];
4831
+ private readonly [symbol$e];
5425
4832
  readonly toolName: string;
5426
4833
  readonly availableTools: string[] | undefined;
5427
4834
  constructor({ toolName, availableTools, message, }: {
@@ -5457,7 +4864,7 @@ export declare namespace Output {
5457
4864
  };
5458
4865
  }
5459
4866
 
5460
- declare interface Output_2<OUTPUT, PARTIAL> {
4867
+ export declare interface OutputInterface<OUTPUT, PARTIAL> {
5461
4868
  readonly type: 'object' | 'text';
5462
4869
  responseFormat: LanguageModelV2CallOptions['responseFormat'];
5463
4870
  parsePartial(options: {
@@ -5476,11 +4883,9 @@ declare interface Output_2<OUTPUT, PARTIAL> {
5476
4883
 
5477
4884
  declare interface ParallelSearchConfig {
5478
4885
  /**
5479
- * Mode preset for different use cases:
5480
- * - "one-shot": Comprehensive results with longer excerpts for single-response answers (default)
5481
- * - "agentic": Concise, token-efficient results for multi-step agentic workflows
4886
+ * Search mode. Defaults to `basic`.
5482
4887
  */
5483
- mode?: 'one-shot' | 'agentic';
4888
+ mode?: ParallelSearchMode;
5484
4889
  /**
5485
4890
  * Default maximum number of results to return (1-20).
5486
4891
  * Defaults to 10 if not specified.
@@ -5494,15 +4899,24 @@ declare interface ParallelSearchConfig {
5494
4899
  * Default excerpt configuration for controlling result length.
5495
4900
  */
5496
4901
  excerpts?: ParallelSearchExcerpts;
4902
+ /**
4903
+ * Maximum total characters across all result excerpts.
4904
+ */
4905
+ maxCharsTotal?: number;
5497
4906
  /**
5498
4907
  * Default fetch policy for controlling content freshness.
5499
4908
  */
5500
4909
  fetchPolicy?: ParallelSearchFetchPolicy;
4910
+ /**
4911
+ * ISO 3166-1 alpha-2 country code to localize results, e.g. 'us'.
4912
+ * Invalid codes are ignored with a warning.
4913
+ */
4914
+ location?: string;
5501
4915
  }
5502
4916
 
5503
4917
  declare interface ParallelSearchError {
5504
4918
  /** Error type */
5505
- error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'configuration_error' | 'unknown';
4919
+ error: 'api_error' | 'configuration_error' | 'execution_error' | 'gateway_rate_limit' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown' | 'unknown_tool';
5506
4920
  /** HTTP status code if applicable */
5507
4921
  statusCode?: number;
5508
4922
  /** Human-readable error message */
@@ -5516,16 +4930,27 @@ declare interface ParallelSearchExcerpts {
5516
4930
  maxCharsPerResult?: number;
5517
4931
  /**
5518
4932
  * Maximum total characters across all results.
4933
+ * @deprecated Use the top-level `maxCharsTotal` option instead.
5519
4934
  */
5520
4935
  maxCharsTotal?: number;
5521
4936
  }
5522
4937
 
5523
4938
  declare interface ParallelSearchFetchPolicy {
5524
4939
  /**
5525
- * Maximum age in seconds for cached content.
5526
- * Set to 0 to always fetch fresh content.
4940
+ * Maximum age in seconds of cached content before a live fetch is attempted.
4941
+ * Minimum 600; lower values are raised to 600.
5527
4942
  */
5528
4943
  maxAgeSeconds?: number;
4944
+ /**
4945
+ * Timeout in seconds for a live fetch when content is not cached.
4946
+ * The gateway caps it to stay within its own tool timeout.
4947
+ */
4948
+ timeoutSeconds?: number;
4949
+ /**
4950
+ * Return an error instead of falling back to older cached content when a
4951
+ * live fetch fails or times out. Defaults to false.
4952
+ */
4953
+ disableCacheFallback?: boolean;
5529
4954
  }
5530
4955
 
5531
4956
  declare interface ParallelSearchInput {
@@ -5536,16 +4961,13 @@ declare interface ParallelSearchInput {
5536
4961
  */
5537
4962
  objective: string;
5538
4963
  /**
5539
- * Optional search queries to supplement the objective.
5540
- * Maximum 200 characters per query.
4964
+ * 2-3 concise keyword queries, 3-6 words each (max 5, 200 characters each).
5541
4965
  */
5542
4966
  search_queries?: string[];
5543
4967
  /**
5544
- * Mode preset for different use cases:
5545
- * - "one-shot": Comprehensive results with longer excerpts
5546
- * - "agentic": Concise, token-efficient results for multi-step workflows
4968
+ * Search mode. Defaults to `basic`.
5547
4969
  */
5548
- mode?: 'one-shot' | 'agentic';
4970
+ mode?: ParallelSearchMode;
5549
4971
  /**
5550
4972
  * Maximum number of results to return (1-20).
5551
4973
  * Defaults to 10 if not specified.
@@ -5564,51 +4986,75 @@ declare interface ParallelSearchInput {
5564
4986
  */
5565
4987
  excerpts?: {
5566
4988
  max_chars_per_result?: number;
4989
+ /** @deprecated Use the top-level `max_chars_total` instead. */
5567
4990
  max_chars_total?: number;
5568
4991
  };
4992
+ /**
4993
+ * Maximum total characters across all result excerpts.
4994
+ */
4995
+ max_chars_total?: number;
5569
4996
  /**
5570
4997
  * Fetch policy for controlling content freshness.
5571
4998
  */
5572
4999
  fetch_policy?: {
5573
5000
  max_age_seconds?: number;
5001
+ timeout_seconds?: number;
5002
+ disable_cache_fallback?: boolean;
5574
5003
  };
5004
+ /**
5005
+ * ISO 3166-1 alpha-2 country code to localize results.
5006
+ */
5007
+ location?: string;
5575
5008
  }
5576
5009
 
5010
+ /**
5011
+ * Search mode. `turbo` and `fast` trade excerpt depth for latency (`turbo` is
5012
+ * English and Japanese only), `basic` is balanced, `advanced` is the most thorough.
5013
+ * Deprecated: `one-shot` (runs as `basic`) and `agentic` (runs as `advanced`).
5014
+ */
5015
+ declare type ParallelSearchMode = (typeof parallelSearchModes)[number];
5016
+
5017
+ declare const parallelSearchModes: readonly ["turbo", "fast", "basic", "advanced", "one-shot", "agentic"];
5018
+
5577
5019
  declare type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
5578
5020
 
5579
5021
  declare interface ParallelSearchResponse {
5580
5022
  /** Unique identifier for this search request */
5581
- searchId: string;
5582
- /** Array of search results */
5023
+ search_id: string;
5024
+ /** Search results, ordered by decreasing relevance */
5583
5025
  results: ParallelSearchResult[];
5026
+ /** Non-fatal issues with the request, such as an ignored `location` */
5027
+ warnings?: ParallelSearchWarning[] | null;
5028
+ /** Usage reported by Parallel for this search */
5029
+ usage?: ParallelSearchUsage[] | null;
5030
+ /** Session identifier shared by the searches made during one request */
5031
+ session_id?: string;
5584
5032
  }
5585
5033
 
5586
5034
  declare interface ParallelSearchResult {
5587
5035
  /** URL of the search result */
5588
5036
  url: string;
5589
- /** Title of the search result */
5590
- title: string;
5591
- /** Extracted text excerpt/content from the page */
5592
- excerpt: string;
5593
- /** Publication date of the content (may be null) */
5594
- publishDate?: string | null;
5595
- /** Relevance score for the result */
5596
- relevanceScore?: number;
5037
+ /** Title of the page, if available */
5038
+ title?: string | null;
5039
+ /** Publication date of the page (YYYY-MM-DD), if available */
5040
+ publish_date?: string | null;
5041
+ /** Relevant excerpts from the page, formatted as markdown */
5042
+ excerpts: string[];
5597
5043
  }
5598
5044
 
5599
5045
  declare interface ParallelSearchSourcePolicy {
5600
5046
  /**
5601
- * List of domains to include in search results.
5602
- * Example: ['wikipedia.org', 'nature.com']
5047
+ * Domains or domain/path prefixes to restrict results to. When set,
5048
+ * `excludeDomains` is ignored. Example: ['wikipedia.org', 'docs.python.org/3']
5603
5049
  */
5604
5050
  includeDomains?: string[];
5605
5051
  /**
5606
- * List of domains to exclude from search results.
5607
- * Example: ['reddit.com', 'twitter.com']
5052
+ * Domains or domain/path prefixes to exclude from results.
5053
+ * Example: ['reddit.com']
5608
5054
  */
5609
5055
  excludeDomains?: string[];
5610
5056
  /**
5611
- * Only include results published after this date (ISO 8601 format).
5057
+ * Only include results published on or after this date (YYYY-MM-DD).
5612
5058
  * Example: '2024-01-01'
5613
5059
  */
5614
5060
  afterDate?: string;
@@ -5616,6 +5062,22 @@ declare interface ParallelSearchSourcePolicy {
5616
5062
 
5617
5063
  declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
5618
5064
 
5065
+ declare interface ParallelSearchUsage {
5066
+ /** Usage item name, e.g. 'sku_search' */
5067
+ name: string;
5068
+ /** Count for the usage item */
5069
+ count?: number;
5070
+ }
5071
+
5072
+ declare interface ParallelSearchWarning {
5073
+ /** Warning type, e.g. 'input_validation_warning'. New types may be added. */
5074
+ type: string;
5075
+ /** Human-readable message */
5076
+ message: string;
5077
+ /** Optional detail supporting the warning */
5078
+ detail?: Record<string, unknown> | null;
5079
+ }
5080
+
5619
5081
  /**
5620
5082
  * Parses a JSON string into an unknown object.
5621
5083
  *
@@ -5625,7 +5087,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedT
5625
5087
  declare function parseJSON(options: {
5626
5088
  text: string;
5627
5089
  schema?: undefined;
5628
- }): Promise<JSONValue_3>;
5090
+ }): Promise<JSONValue_2>;
5629
5091
 
5630
5092
  /**
5631
5093
  * Parses a JSON string into a strongly-typed object using the provided schema.
@@ -5665,7 +5127,7 @@ declare type ParseResult<T> = {
5665
5127
  rawValue: unknown;
5666
5128
  } | {
5667
5129
  success: false;
5668
- error: JSONParseError_2 | TypeValidationError_2;
5130
+ error: JSONParseError | TypeValidationError;
5669
5131
  rawValue: unknown;
5670
5132
  };
5671
5133
 
@@ -5820,7 +5282,7 @@ export declare function pipeTextStreamToResponse({ response, status, statusText,
5820
5282
  textStream: ReadableStream<string>;
5821
5283
  } & ResponseInit): Promise<void>;
5822
5284
 
5823
- export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
5285
+ export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
5824
5286
  response: ServerResponse;
5825
5287
  stream: ReadableStream<UIMessageChunk>;
5826
5288
  } & UIMessageStreamResponseInit): Promise<void>;
@@ -5829,7 +5291,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
5829
5291
  url: string;
5830
5292
  headers?: Record<string, string | undefined>;
5831
5293
  formData: FormData;
5832
- failedResponseHandler: ResponseHandler<APICallError_2>;
5294
+ failedResponseHandler: ResponseHandler<APICallError>;
5833
5295
  successfulResponseHandler: ResponseHandler<T>;
5834
5296
  abortSignal?: AbortSignal;
5835
5297
  fetch?: FetchFunction;
@@ -5843,7 +5305,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
5843
5305
  url: string;
5844
5306
  headers?: Record<string, string | undefined>;
5845
5307
  body: unknown;
5846
- failedResponseHandler: ResponseHandler<APICallError_2>;
5308
+ failedResponseHandler: ResponseHandler<APICallError>;
5847
5309
  successfulResponseHandler: ResponseHandler<T>;
5848
5310
  abortSignal?: AbortSignal;
5849
5311
  fetch?: FetchFunction;
@@ -6049,7 +5511,7 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata;
6049
5511
  They are passed through to the provider from the AI SDK and enable
6050
5512
  provider-specific functionality that can be fully encapsulated in the provider.
6051
5513
  */
6052
- declare type ProviderOptions = SharedV2ProviderOptions_2;
5514
+ declare type ProviderOptions = SharedV2ProviderOptions;
6053
5515
 
6054
5516
  export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
6055
5517
  languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
@@ -6215,6 +5677,10 @@ declare interface ReasoningPart {
6215
5677
  */
6216
5678
  export declare type ReasoningUIPart = {
6217
5679
  type: 'reasoning';
5680
+ /**
5681
+ * The identifier of the reasoning part.
5682
+ */
5683
+ id?: string;
6218
5684
  /**
6219
5685
  * The reasoning text.
6220
5686
  */
@@ -6272,7 +5738,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
6272
5738
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
6273
5739
 
6274
5740
  export declare class RetryError extends AISDKError {
6275
- private readonly [symbol$1_3];
5741
+ private readonly [symbol$1_2];
6276
5742
  readonly reason: RetryErrorReason;
6277
5743
  readonly lastError: unknown;
6278
5744
  readonly errors: Array<unknown>;
@@ -6295,7 +5761,7 @@ declare type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable' | 'ab
6295
5761
  declare function safeParseJSON(options: {
6296
5762
  text: string;
6297
5763
  schema?: undefined;
6298
- }): Promise<ParseResult<JSONValue_3>>;
5764
+ }): Promise<ParseResult<JSONValue_2>>;
6299
5765
 
6300
5766
  /**
6301
5767
  * Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
@@ -6328,7 +5794,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6328
5794
  rawValue: unknown;
6329
5795
  } | {
6330
5796
  success: false;
6331
- error: TypeValidationError_2;
5797
+ error: TypeValidationError;
6332
5798
  rawValue: unknown;
6333
5799
  }>;
6334
5800
 
@@ -6337,16 +5803,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6337
5803
  * but instead of throwing it returns `{ success: true, data }`
6338
5804
  * or `{ success: false, error }`.
6339
5805
  */
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>>;
5806
+ export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
6350
5807
 
6351
5808
  export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
6352
5809
  success: true;
@@ -6379,8 +5836,10 @@ declare const schemaSymbol: unique symbol;
6379
5836
  export declare class SerialJobExecutor {
6380
5837
  private queue;
6381
5838
  private isProcessing;
5839
+ private idleWaiters;
6382
5840
  private processQueue;
6383
5841
  run(job: Job): Promise<void>;
5842
+ waitForIdle(): Promise<void>;
6384
5843
  }
6385
5844
 
6386
5845
  declare type SharedV2Headers = Record<string, string>;
@@ -6408,29 +5867,6 @@ declare type SharedV2Headers = Record<string, string>;
6408
5867
  */
6409
5868
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
6410
5869
 
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
5870
  /**
6435
5871
  * Additional provider-specific options.
6436
5872
  * Options are additional input to the provider.
@@ -6454,29 +5890,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
6454
5890
  */
6455
5891
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
6456
5892
 
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
5893
  /**
6481
5894
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
6482
5895
  *
@@ -6578,7 +5991,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
6578
5991
  /**
6579
5992
  * Smooths text streaming output.
6580
5993
  *
6581
- * @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay.
5994
+ * @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
5995
  * @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
5996
  *
6584
5997
  * @returns A transform stream that smooths text streaming output.
@@ -6681,6 +6094,8 @@ declare interface Span {
6681
6094
  * It is preferred span links be added at span creation.
6682
6095
  *
6683
6096
  * @param link the link to add.
6097
+ *
6098
+ * @since 1.9.0
6684
6099
  */
6685
6100
  addLink(link: Link): this;
6686
6101
  /**
@@ -6690,6 +6105,8 @@ declare interface Span {
6690
6105
  * It is preferred span links be added at span creation.
6691
6106
  *
6692
6107
  * @param links the links to add.
6108
+ *
6109
+ * @since 1.9.0
6693
6110
  */
6694
6111
  addLinks(links: Link[]): this;
6695
6112
  /**
@@ -7383,7 +6800,7 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
7383
6800
  private finishToolCall;
7384
6801
  }
7385
6802
 
7386
- declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart_2>, 'enqueue'>;
6803
+ declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart>, 'enqueue'>;
7387
6804
 
7388
6805
  declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
7389
6806
  /**
@@ -7403,11 +6820,11 @@ declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCal
7403
6820
  * Extract provider-specific metadata from a tool call delta.
7404
6821
  * Called once when a new tool call is detected.
7405
6822
  */
7406
- extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata_2 | undefined;
6823
+ extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata | undefined;
7407
6824
  /**
7408
6825
  * Build the `providerMetadata` object for a `tool-call` event.
7409
6826
  */
7410
- buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata_2 | undefined) => SharedV2ProviderMetadata_2 | undefined;
6827
+ buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata | undefined) => SharedV2ProviderMetadata | undefined;
7411
6828
  }
7412
6829
 
7413
6830
  /**
@@ -7689,6 +7106,16 @@ declare interface StreamOptions {
7689
7106
  * @param comment - The comment encountered in the stream.
7690
7107
  */
7691
7108
  onComment?: ((comment: string) => void) | undefined;
7109
+ /**
7110
+ * Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
7111
+ * See {@link ParserConfig.maxBufferSize} for details.
7112
+ *
7113
+ * When the limit is exceeded, the stream is always errored (regardless of the `onError`
7114
+ * setting) since the underlying parser is unrecoverable without a `reset()`.
7115
+ *
7116
+ * @defaultValue `undefined` (unbounded)
7117
+ */
7118
+ maxBufferSize?: number | undefined;
7692
7119
  }
7693
7120
 
7694
7121
  /**
@@ -7781,7 +7208,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIA
7781
7208
  /**
7782
7209
  Optional specification for parsing structured outputs from the LLM response.
7783
7210
  */
7784
- experimental_output?: Output_2<OUTPUT, PARTIAL_OUTPUT>;
7211
+ experimental_output?: OutputInterface<OUTPUT, PARTIAL_OUTPUT>;
7785
7212
  /**
7786
7213
  Optional function that you can use to provide different settings for a step.
7787
7214
 
@@ -8125,8 +7552,6 @@ declare const symbol$1: unique symbol;
8125
7552
 
8126
7553
  declare const symbol$1_2: unique symbol;
8127
7554
 
8128
- declare const symbol$1_3: unique symbol;
8129
-
8130
7555
  declare const symbol$2: unique symbol;
8131
7556
 
8132
7557
  declare const symbol$2_2: unique symbol;
@@ -8151,8 +7576,6 @@ declare const symbol$7: unique symbol;
8151
7576
 
8152
7577
  declare const symbol$7_2: unique symbol;
8153
7578
 
8154
- declare const symbol$7_3: unique symbol;
8155
-
8156
7579
  declare const symbol$8: unique symbol;
8157
7580
 
8158
7581
  declare const symbol$8_2: unique symbol;
@@ -8171,16 +7594,14 @@ declare const symbol$c: unique symbol;
8171
7594
 
8172
7595
  declare const symbol$c_2: unique symbol;
8173
7596
 
8174
- declare const symbol$c_3: unique symbol;
8175
-
8176
7597
  declare const symbol$d: unique symbol;
8177
7598
 
8178
7599
  declare const symbol$d_2: unique symbol;
8179
7600
 
8180
- declare const symbol$d_3: unique symbol;
8181
-
8182
7601
  declare const symbol$e: unique symbol;
8183
7602
 
7603
+ declare const symbol$f: unique symbol;
7604
+
8184
7605
  declare const symbol: unique symbol;
8185
7606
 
8186
7607
  declare const symbol_2: unique symbol;
@@ -8378,7 +7799,7 @@ declare type TimeInput = HrTime | number | Date;
8378
7799
 
8379
7800
  The tool can also contain an optional execute function for the actual execution function of the tool.
8380
7801
  */
8381
- export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any> = {
7802
+ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
8382
7803
  /**
8383
7804
  An optional description of what the tool does.
8384
7805
  Will be used by the language model to decide whether to use the tool.
@@ -8422,7 +7843,7 @@ export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTP
8422
7843
 
8423
7844
  If not provided, the tool result will be sent as a JSON object.
8424
7845
  */
8425
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart_2['output'];
7846
+ toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart['output'];
8426
7847
  } & ({
8427
7848
  /**
8428
7849
  Tool with user-defined input and output schemas.
@@ -8547,7 +7968,7 @@ export declare interface ToolCallPart {
8547
7968
  }
8548
7969
 
8549
7970
  export declare class ToolCallRepairError extends AISDKError {
8550
- private readonly [symbol$6_2];
7971
+ private readonly [symbol$7_2];
8551
7972
  readonly originalError: NoSuchToolError | InvalidToolInputError;
8552
7973
  constructor({ cause, originalError, message, }: {
8553
7974
  message?: string;
@@ -8594,6 +8015,42 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
8594
8015
  toolName: Extract<keyof TOOLS, string>;
8595
8016
  };
8596
8017
 
8018
+ /**
8019
+ * Thrown when a model response does not satisfy an enforced tool choice.
8020
+ */
8021
+ export declare class ToolChoiceViolationError extends AISDKError {
8022
+ private readonly [symbol$6_2];
8023
+ /**
8024
+ * The tool choice that the model response did not satisfy.
8025
+ */
8026
+ readonly toolChoice: EnforcedToolChoice;
8027
+ /**
8028
+ * Reason why the model finished generating the response.
8029
+ */
8030
+ readonly finishReason: FinishReason;
8031
+ /**
8032
+ * The provider that returned the response.
8033
+ */
8034
+ readonly provider: string;
8035
+ /**
8036
+ * The model that returned the response.
8037
+ */
8038
+ readonly modelId: string;
8039
+ /**
8040
+ * The normalized content returned by the model.
8041
+ */
8042
+ readonly content: Array<LanguageModelV2Content>;
8043
+ constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
8044
+ toolChoice: EnforcedToolChoice;
8045
+ finishReason: FinishReason;
8046
+ provider: string;
8047
+ modelId: string;
8048
+ content: Array<LanguageModelV2Content>;
8049
+ message?: string;
8050
+ });
8051
+ static isInstance(error: unknown): error is ToolChoiceViolationError;
8052
+ }
8053
+
8597
8054
  /**
8598
8055
  Content of a tool message. It is an array of tool result parts.
8599
8056
  */
@@ -8679,7 +8136,7 @@ export declare interface ToolResultPart {
8679
8136
  /**
8680
8137
  Result of the tool call. This is a JSON-serializable object.
8681
8138
  */
8682
- output: LanguageModelV2ToolResultOutput_2;
8139
+ output: LanguageModelV2ToolResultOutput;
8683
8140
  /**
8684
8141
  Additional provider-specific metadata. They are passed through
8685
8142
  to the provider from the AI SDK and enable provider-specific
@@ -8738,6 +8195,11 @@ declare interface Tracer {
8738
8195
  * Additionally the new span gets set in context and this context is activated
8739
8196
  * for the duration of the function call.
8740
8197
  *
8198
+ * **Important**: The callback function is responsible for calling `span.end()`
8199
+ * to finish the span. Unlike some other OpenTelemetry implementations, the span
8200
+ * is NOT automatically ended when the callback returns. If `span.end()` is not
8201
+ * called, the span will never be exported and will be silently lost.
8202
+ *
8741
8203
  * @param name The name of the span
8742
8204
  * @param [options] SpanOptions used for span creation
8743
8205
  * @param [context] Context to use to extract parent
@@ -9031,30 +8493,6 @@ export declare class TypeValidationError extends AISDKError {
9031
8493
  }): TypeValidationError;
9032
8494
  }
9033
8495
 
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
8496
  export declare const UI_MESSAGE_STREAM_HEADERS: {
9059
8497
  'content-type': string;
9060
8498
  'cache-control': string;
@@ -9227,6 +8665,10 @@ export declare type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage
9227
8665
  * Indicates whether the stream was aborted.
9228
8666
  */
9229
8667
  isAborted: boolean;
8668
+ /**
8669
+ * The operation-level outcome of the stream.
8670
+ */
8671
+ outcome: UIMessageStreamOutcome;
9230
8672
  /**
9231
8673
  * The message that was sent to the client as a response
9232
8674
  * (including the original message if it was extended).
@@ -9292,7 +8734,31 @@ export declare type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
9292
8734
  onError?: (error: unknown) => string;
9293
8735
  };
9294
8736
 
8737
+ /**
8738
+ * The operation-level outcome of a UI message stream.
8739
+ *
8740
+ * This is separate from model finish reasons and individual stream chunks.
8741
+ * Fatal stream-processing failures override outcomes declared by the stream
8742
+ * owner.
8743
+ */
8744
+ export declare type UIMessageStreamOutcome = {
8745
+ status: 'completed';
8746
+ } | {
8747
+ status: 'failed';
8748
+ error?: unknown;
8749
+ } | {
8750
+ status: 'aborted';
8751
+ } | {
8752
+ status: 'unknown';
8753
+ };
8754
+
9295
8755
  declare type UIMessageStreamResponseInit = ResponseInit & {
8756
+ /**
8757
+ * Optional interval in milliseconds for sending SSE keep-alive comments.
8758
+ * When set, an opening comment is sent immediately and additional comments
8759
+ * are sent after the stream has been idle for the configured interval.
8760
+ */
8761
+ keepAliveMs?: number;
9296
8762
  consumeSseStream?: (options: {
9297
8763
  stream: ReadableStream<string>;
9298
8764
  }) => PromiseLike<void> | void;
@@ -9315,6 +8781,18 @@ export declare interface UIMessageStreamWriter<UI_MESSAGE extends UIMessage = UI
9315
8781
  onError: ErrorHandler | undefined;
9316
8782
  }
9317
8783
 
8784
+ export declare interface UIMessageStreamWriterWithOutcome<UI_MESSAGE extends UIMessage = UIMessage> extends UIMessageStreamWriter<UI_MESSAGE> {
8785
+ /**
8786
+ * Declares the operation-level outcome of the composed stream.
8787
+ *
8788
+ * The first outcome declared through this method is retained. Fatal
8789
+ * execution, merge, error-handling, or downstream processing failures
8790
+ * override declared outcomes. Declaring an outcome does not write a chunk or
8791
+ * close the stream.
8792
+ */
8793
+ setOutcome(outcome: UIMessageStreamOutcome): void;
8794
+ }
8795
+
9318
8796
  export declare type UITool = {
9319
8797
  input: unknown;
9320
8798
  output: unknown | undefined;
@@ -9338,6 +8816,13 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
9338
8816
  state: 'input-streaming';
9339
8817
  input: DeepPartial<asUITool<TOOL>['input']> | undefined;
9340
8818
  providerExecuted?: boolean;
8819
+ /**
8820
+ * The raw tool input text received so far.
8821
+ *
8822
+ * This is used to continue input streaming when a message is persisted
8823
+ * and later resumed.
8824
+ */
8825
+ rawInput?: string;
9341
8826
  output?: never;
9342
8827
  errorText?: never;
9343
8828
  } | {
@@ -9507,7 +8992,9 @@ declare function validateTypes<OBJECT>({ value, schema, }: {
9507
8992
  * the corresponding schemas are provided. Otherwise, they are assumed to be
9508
8993
  * valid.
9509
8994
  */
9510
- export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
8995
+ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
8996
+
8997
+ declare type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
9511
8998
  messages: unknown;
9512
8999
  metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
9513
9000
  dataSchemas?: {
@@ -9516,7 +9003,7 @@ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messa
9516
9003
  tools?: {
9517
9004
  [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
9518
9005
  };
9519
- }): Promise<Array<UI_MESSAGE>>;
9006
+ };
9520
9007
 
9521
9008
  declare type ValidationResult<OBJECT> = {
9522
9009
  success: true;
@@ -9654,5 +9141,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
9654
9141
  }): Schema<OBJECT>;
9655
9142
 
9656
9143
  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 };
9144
+ 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, EnforcedToolChoice as EnforcedToolChoice, LanguageModelV2Content as LanguageModelV2Content, 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 };
9145
+ 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$f, symbol, symbol_2, symbol_3, validatorSymbol };