ai 6.0.34 → 6.0.35

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.35
4
+
5
+ ### Patch Changes
6
+
7
+ - d7e7f1f: Add descriptive error messages for malformed UIMessageStream chunks.
8
+
3
9
  ## 6.0.34
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -942,9 +942,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
942
942
  declare function stepCountIs(stepCount: number): StopCondition<any>;
943
943
  declare function hasToolCall(toolName: string): StopCondition<any>;
944
944
 
945
- declare const symbol$e: unique symbol;
945
+ declare const symbol$f: unique symbol;
946
946
  declare class InvalidToolInputError extends AISDKError {
947
- private readonly [symbol$e];
947
+ private readonly [symbol$f];
948
948
  readonly toolName: string;
949
949
  readonly toolInput: string;
950
950
  constructor({ toolInput, toolName, cause, message, }: {
@@ -956,9 +956,9 @@ declare class InvalidToolInputError extends AISDKError {
956
956
  static isInstance(error: unknown): error is InvalidToolInputError;
957
957
  }
958
958
 
959
- declare const symbol$d: unique symbol;
959
+ declare const symbol$e: unique symbol;
960
960
  declare class NoSuchToolError extends AISDKError {
961
- private readonly [symbol$d];
961
+ private readonly [symbol$e];
962
962
  readonly toolName: string;
963
963
  readonly availableTools: string[] | undefined;
964
964
  constructor({ toolName, availableTools, message, }: {
@@ -3983,9 +3983,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
3983
3983
  maxParallelCalls?: number;
3984
3984
  }): Promise<EmbedManyResult>;
3985
3985
 
3986
- declare const symbol$c: unique symbol;
3986
+ declare const symbol$d: unique symbol;
3987
3987
  declare class InvalidArgumentError extends AISDKError {
3988
- private readonly [symbol$c];
3988
+ private readonly [symbol$d];
3989
3989
  readonly parameter: string;
3990
3990
  readonly value: unknown;
3991
3991
  constructor({ parameter, value, message, }: {
@@ -4074,9 +4074,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
4074
4074
  rawValue: unknown;
4075
4075
  };
4076
4076
 
4077
- declare const symbol$b: unique symbol;
4077
+ declare const symbol$c: unique symbol;
4078
4078
  declare class InvalidStreamPartError extends AISDKError {
4079
- private readonly [symbol$b];
4079
+ private readonly [symbol$c];
4080
4080
  readonly chunk: SingleRequestTextStreamPart<any>;
4081
4081
  constructor({ chunk, message, }: {
4082
4082
  chunk: SingleRequestTextStreamPart<any>;
@@ -4085,9 +4085,9 @@ declare class InvalidStreamPartError extends AISDKError {
4085
4085
  static isInstance(error: unknown): error is InvalidStreamPartError;
4086
4086
  }
4087
4087
 
4088
- declare const symbol$a: unique symbol;
4088
+ declare const symbol$b: unique symbol;
4089
4089
  declare class InvalidToolApprovalError extends AISDKError {
4090
- private readonly [symbol$a];
4090
+ private readonly [symbol$b];
4091
4091
  readonly approvalId: string;
4092
4092
  constructor({ approvalId }: {
4093
4093
  approvalId: string;
@@ -4095,9 +4095,9 @@ declare class InvalidToolApprovalError extends AISDKError {
4095
4095
  static isInstance(error: unknown): error is InvalidToolApprovalError;
4096
4096
  }
4097
4097
 
4098
- declare const symbol$9: unique symbol;
4098
+ declare const symbol$a: unique symbol;
4099
4099
  declare class ToolCallNotFoundForApprovalError extends AISDKError {
4100
- private readonly [symbol$9];
4100
+ private readonly [symbol$a];
4101
4101
  readonly toolCallId: string;
4102
4102
  readonly approvalId: string;
4103
4103
  constructor({ toolCallId, approvalId, }: {
@@ -4107,7 +4107,7 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
4107
4107
  static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
4108
4108
  }
4109
4109
 
4110
- declare const symbol$8: unique symbol;
4110
+ declare const symbol$9: unique symbol;
4111
4111
  /**
4112
4112
  Thrown when no image could be generated. This can have multiple causes:
4113
4113
 
@@ -4115,7 +4115,7 @@ Thrown when no image could be generated. This can have multiple causes:
4115
4115
  - The model generated a response that could not be parsed.
4116
4116
  */
4117
4117
  declare class NoImageGeneratedError extends AISDKError {
4118
- private readonly [symbol$8];
4118
+ private readonly [symbol$9];
4119
4119
  /**
4120
4120
  The response metadata for each call.
4121
4121
  */
@@ -4128,7 +4128,7 @@ declare class NoImageGeneratedError extends AISDKError {
4128
4128
  static isInstance(error: unknown): error is NoImageGeneratedError;
4129
4129
  }
4130
4130
 
4131
- declare const symbol$7: unique symbol;
4131
+ declare const symbol$8: unique symbol;
4132
4132
  /**
4133
4133
  Thrown when no object could be generated. This can have several causes:
4134
4134
 
@@ -4141,7 +4141,7 @@ The error contains the following properties:
4141
4141
  - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
4142
4142
  */
4143
4143
  declare class NoObjectGeneratedError extends AISDKError {
4144
- private readonly [symbol$7];
4144
+ private readonly [symbol$8];
4145
4145
  /**
4146
4146
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
4147
4147
  */
@@ -4169,12 +4169,12 @@ declare class NoObjectGeneratedError extends AISDKError {
4169
4169
  static isInstance(error: unknown): error is NoObjectGeneratedError;
4170
4170
  }
4171
4171
 
4172
- declare const symbol$6: unique symbol;
4172
+ declare const symbol$7: unique symbol;
4173
4173
  /**
4174
4174
  Thrown when no LLM output was generated, e.g. because of errors.
4175
4175
  */
4176
4176
  declare class NoOutputGeneratedError extends AISDKError {
4177
- private readonly [symbol$6];
4177
+ private readonly [symbol$7];
4178
4178
  constructor({ message, cause, }?: {
4179
4179
  message?: string;
4180
4180
  cause?: Error;
@@ -4192,9 +4192,9 @@ declare class NoSpeechGeneratedError extends AISDKError {
4192
4192
  });
4193
4193
  }
4194
4194
 
4195
- declare const symbol$5: unique symbol;
4195
+ declare const symbol$6: unique symbol;
4196
4196
  declare class ToolCallRepairError extends AISDKError {
4197
- private readonly [symbol$5];
4197
+ private readonly [symbol$6];
4198
4198
  readonly originalError: NoSuchToolError | InvalidToolInputError;
4199
4199
  constructor({ cause, originalError, message, }: {
4200
4200
  message?: string;
@@ -4218,6 +4218,35 @@ declare class UnsupportedModelVersionError extends AISDKError {
4218
4218
  });
4219
4219
  }
4220
4220
 
4221
+ declare const symbol$5: unique symbol;
4222
+ /**
4223
+ * Error thrown when a UI message stream contains invalid or out-of-sequence chunks.
4224
+ *
4225
+ * This typically occurs when:
4226
+ * - A delta chunk is received without a corresponding start chunk
4227
+ * - An end chunk is received without a corresponding start chunk
4228
+ * - A tool invocation is not found for the given toolCallId
4229
+ *
4230
+ * @see https://ai-sdk.dev/docs/reference/ai-sdk-errors/ai-ui-message-stream-error
4231
+ */
4232
+ declare class UIMessageStreamError extends AISDKError {
4233
+ private readonly [symbol$5];
4234
+ /**
4235
+ * The type of chunk that caused the error (e.g., 'text-delta', 'reasoning-end').
4236
+ */
4237
+ readonly chunkType: string;
4238
+ /**
4239
+ * The ID associated with the failing chunk (part ID or toolCallId).
4240
+ */
4241
+ readonly chunkId: string;
4242
+ constructor({ chunkType, chunkId, message, }: {
4243
+ chunkType: string;
4244
+ chunkId: string;
4245
+ message: string;
4246
+ });
4247
+ static isInstance(error: unknown): error is UIMessageStreamError;
4248
+ }
4249
+
4221
4250
  declare const symbol$4: unique symbol;
4222
4251
  declare class InvalidDataContentError extends AISDKError {
4223
4252
  private readonly [symbol$4];
@@ -5589,4 +5618,4 @@ declare global {
5589
5618
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5590
5619
  }
5591
5620
 
5592
- export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
5621
+ export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
package/dist/index.d.ts CHANGED
@@ -942,9 +942,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
942
942
  declare function stepCountIs(stepCount: number): StopCondition<any>;
943
943
  declare function hasToolCall(toolName: string): StopCondition<any>;
944
944
 
945
- declare const symbol$e: unique symbol;
945
+ declare const symbol$f: unique symbol;
946
946
  declare class InvalidToolInputError extends AISDKError {
947
- private readonly [symbol$e];
947
+ private readonly [symbol$f];
948
948
  readonly toolName: string;
949
949
  readonly toolInput: string;
950
950
  constructor({ toolInput, toolName, cause, message, }: {
@@ -956,9 +956,9 @@ declare class InvalidToolInputError extends AISDKError {
956
956
  static isInstance(error: unknown): error is InvalidToolInputError;
957
957
  }
958
958
 
959
- declare const symbol$d: unique symbol;
959
+ declare const symbol$e: unique symbol;
960
960
  declare class NoSuchToolError extends AISDKError {
961
- private readonly [symbol$d];
961
+ private readonly [symbol$e];
962
962
  readonly toolName: string;
963
963
  readonly availableTools: string[] | undefined;
964
964
  constructor({ toolName, availableTools, message, }: {
@@ -3983,9 +3983,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
3983
3983
  maxParallelCalls?: number;
3984
3984
  }): Promise<EmbedManyResult>;
3985
3985
 
3986
- declare const symbol$c: unique symbol;
3986
+ declare const symbol$d: unique symbol;
3987
3987
  declare class InvalidArgumentError extends AISDKError {
3988
- private readonly [symbol$c];
3988
+ private readonly [symbol$d];
3989
3989
  readonly parameter: string;
3990
3990
  readonly value: unknown;
3991
3991
  constructor({ parameter, value, message, }: {
@@ -4074,9 +4074,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
4074
4074
  rawValue: unknown;
4075
4075
  };
4076
4076
 
4077
- declare const symbol$b: unique symbol;
4077
+ declare const symbol$c: unique symbol;
4078
4078
  declare class InvalidStreamPartError extends AISDKError {
4079
- private readonly [symbol$b];
4079
+ private readonly [symbol$c];
4080
4080
  readonly chunk: SingleRequestTextStreamPart<any>;
4081
4081
  constructor({ chunk, message, }: {
4082
4082
  chunk: SingleRequestTextStreamPart<any>;
@@ -4085,9 +4085,9 @@ declare class InvalidStreamPartError extends AISDKError {
4085
4085
  static isInstance(error: unknown): error is InvalidStreamPartError;
4086
4086
  }
4087
4087
 
4088
- declare const symbol$a: unique symbol;
4088
+ declare const symbol$b: unique symbol;
4089
4089
  declare class InvalidToolApprovalError extends AISDKError {
4090
- private readonly [symbol$a];
4090
+ private readonly [symbol$b];
4091
4091
  readonly approvalId: string;
4092
4092
  constructor({ approvalId }: {
4093
4093
  approvalId: string;
@@ -4095,9 +4095,9 @@ declare class InvalidToolApprovalError extends AISDKError {
4095
4095
  static isInstance(error: unknown): error is InvalidToolApprovalError;
4096
4096
  }
4097
4097
 
4098
- declare const symbol$9: unique symbol;
4098
+ declare const symbol$a: unique symbol;
4099
4099
  declare class ToolCallNotFoundForApprovalError extends AISDKError {
4100
- private readonly [symbol$9];
4100
+ private readonly [symbol$a];
4101
4101
  readonly toolCallId: string;
4102
4102
  readonly approvalId: string;
4103
4103
  constructor({ toolCallId, approvalId, }: {
@@ -4107,7 +4107,7 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
4107
4107
  static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
4108
4108
  }
4109
4109
 
4110
- declare const symbol$8: unique symbol;
4110
+ declare const symbol$9: unique symbol;
4111
4111
  /**
4112
4112
  Thrown when no image could be generated. This can have multiple causes:
4113
4113
 
@@ -4115,7 +4115,7 @@ Thrown when no image could be generated. This can have multiple causes:
4115
4115
  - The model generated a response that could not be parsed.
4116
4116
  */
4117
4117
  declare class NoImageGeneratedError extends AISDKError {
4118
- private readonly [symbol$8];
4118
+ private readonly [symbol$9];
4119
4119
  /**
4120
4120
  The response metadata for each call.
4121
4121
  */
@@ -4128,7 +4128,7 @@ declare class NoImageGeneratedError extends AISDKError {
4128
4128
  static isInstance(error: unknown): error is NoImageGeneratedError;
4129
4129
  }
4130
4130
 
4131
- declare const symbol$7: unique symbol;
4131
+ declare const symbol$8: unique symbol;
4132
4132
  /**
4133
4133
  Thrown when no object could be generated. This can have several causes:
4134
4134
 
@@ -4141,7 +4141,7 @@ The error contains the following properties:
4141
4141
  - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
4142
4142
  */
4143
4143
  declare class NoObjectGeneratedError extends AISDKError {
4144
- private readonly [symbol$7];
4144
+ private readonly [symbol$8];
4145
4145
  /**
4146
4146
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
4147
4147
  */
@@ -4169,12 +4169,12 @@ declare class NoObjectGeneratedError extends AISDKError {
4169
4169
  static isInstance(error: unknown): error is NoObjectGeneratedError;
4170
4170
  }
4171
4171
 
4172
- declare const symbol$6: unique symbol;
4172
+ declare const symbol$7: unique symbol;
4173
4173
  /**
4174
4174
  Thrown when no LLM output was generated, e.g. because of errors.
4175
4175
  */
4176
4176
  declare class NoOutputGeneratedError extends AISDKError {
4177
- private readonly [symbol$6];
4177
+ private readonly [symbol$7];
4178
4178
  constructor({ message, cause, }?: {
4179
4179
  message?: string;
4180
4180
  cause?: Error;
@@ -4192,9 +4192,9 @@ declare class NoSpeechGeneratedError extends AISDKError {
4192
4192
  });
4193
4193
  }
4194
4194
 
4195
- declare const symbol$5: unique symbol;
4195
+ declare const symbol$6: unique symbol;
4196
4196
  declare class ToolCallRepairError extends AISDKError {
4197
- private readonly [symbol$5];
4197
+ private readonly [symbol$6];
4198
4198
  readonly originalError: NoSuchToolError | InvalidToolInputError;
4199
4199
  constructor({ cause, originalError, message, }: {
4200
4200
  message?: string;
@@ -4218,6 +4218,35 @@ declare class UnsupportedModelVersionError extends AISDKError {
4218
4218
  });
4219
4219
  }
4220
4220
 
4221
+ declare const symbol$5: unique symbol;
4222
+ /**
4223
+ * Error thrown when a UI message stream contains invalid or out-of-sequence chunks.
4224
+ *
4225
+ * This typically occurs when:
4226
+ * - A delta chunk is received without a corresponding start chunk
4227
+ * - An end chunk is received without a corresponding start chunk
4228
+ * - A tool invocation is not found for the given toolCallId
4229
+ *
4230
+ * @see https://ai-sdk.dev/docs/reference/ai-sdk-errors/ai-ui-message-stream-error
4231
+ */
4232
+ declare class UIMessageStreamError extends AISDKError {
4233
+ private readonly [symbol$5];
4234
+ /**
4235
+ * The type of chunk that caused the error (e.g., 'text-delta', 'reasoning-end').
4236
+ */
4237
+ readonly chunkType: string;
4238
+ /**
4239
+ * The ID associated with the failing chunk (part ID or toolCallId).
4240
+ */
4241
+ readonly chunkId: string;
4242
+ constructor({ chunkType, chunkId, message, }: {
4243
+ chunkType: string;
4244
+ chunkId: string;
4245
+ message: string;
4246
+ });
4247
+ static isInstance(error: unknown): error is UIMessageStreamError;
4248
+ }
4249
+
4221
4250
  declare const symbol$4: unique symbol;
4222
4251
  declare class InvalidDataContentError extends AISDKError {
4223
4252
  private readonly [symbol$4];
@@ -5589,4 +5618,4 @@ declare global {
5589
5618
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5590
5619
  }
5591
5620
 
5592
- export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
5621
+ export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };