ai 7.0.95 → 7.0.97

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,29 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.97
4
+
5
+ ### Patch Changes
6
+
7
+ - ef3bac4: Observe video webhook receiver rejections before generation starts to prevent unhandled rejections during or after a failed start. Preserve start error precedence and assimilate custom receivers only once.
8
+ - 9942196: feat: add batch cancel and list APIs
9
+ - Updated dependencies [9942196]
10
+ - @ai-sdk/provider@4.0.13
11
+ - @ai-sdk/gateway@4.0.78
12
+ - @ai-sdk/provider-utils@5.0.39
13
+
14
+ ## 7.0.96
15
+
16
+ ### Patch Changes
17
+
18
+ - 912fb01: feat: add batch cancel and list APIs
19
+ - c595e6e: fix(ai): call `atob` without a receiver for Cloudflare Workers compatibility
20
+ - Updated dependencies [912fb01]
21
+ - Updated dependencies [aa4cc14]
22
+ - Updated dependencies [f102e41]
23
+ - @ai-sdk/provider@4.0.12
24
+ - @ai-sdk/gateway@4.0.77
25
+ - @ai-sdk/provider-utils@5.0.38
26
+
3
27
  ## 7.0.95
4
28
 
5
29
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -6304,6 +6304,38 @@ type StartBatchOptions<TOOLS extends ToolSet = ToolSet, PROVIDER extends BatchPr
6304
6304
  type StartBatchResult = Batch & {
6305
6305
  readonly warnings: Experimental_BatchV4StartResult['warnings'];
6306
6306
  };
6307
+ /**
6308
+ * Options for requesting cancellation of a batch.
6309
+ */
6310
+ type CancelBatchOptions = {
6311
+ provider?: BatchProvider;
6312
+ batch: BatchReference;
6313
+ providerOptions?: ProviderOptions;
6314
+ } & BatchCallOptions;
6315
+ /**
6316
+ * Result of requesting cancellation of a batch.
6317
+ */
6318
+ type CancelBatchResult = {
6319
+ readonly providerMetadata?: ProviderMetadata;
6320
+ };
6321
+ /**
6322
+ * Options for listing batches.
6323
+ */
6324
+ type ListBatchesOptions = {
6325
+ provider?: BatchProvider;
6326
+ providerOptions?: ProviderOptions;
6327
+ limit?: number;
6328
+ cursor?: string;
6329
+ maxRetries?: number;
6330
+ } & BatchCallOptions;
6331
+ /**
6332
+ * One page of listed batches.
6333
+ */
6334
+ type ListBatchesResult = {
6335
+ readonly batches: Array<Batch>;
6336
+ readonly nextCursor?: string;
6337
+ readonly providerMetadata?: ProviderMetadata;
6338
+ };
6307
6339
  /**
6308
6340
  * Options for retrieving batch status.
6309
6341
  */
@@ -6368,6 +6400,14 @@ type TextBatchItemResult<TOOLS extends ToolSet = ToolSet> = (TextBatchGeneration
6368
6400
  */
6369
6401
  type BatchItemResult<TOOLS extends ToolSet = ToolSet> = TextBatchItemResult<TOOLS>;
6370
6402
 
6403
+ /**
6404
+ * Requests cancellation of a batch.
6405
+ */
6406
+ declare function cancelBatch({ provider, batch, providerOptions, abortSignal, headers, timeout, }: CancelBatchOptions): Promise<CancelBatchResult>;
6407
+ /**
6408
+ * Lists a page of batches.
6409
+ */
6410
+ declare function listBatches({ provider, providerOptions, limit, cursor, maxRetries, abortSignal, headers, timeout, }?: ListBatchesOptions): Promise<ListBatchesResult>;
6371
6411
  /**
6372
6412
  * Starts a batch.
6373
6413
  */
@@ -9742,4 +9782,4 @@ declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
9742
9782
  files: UploadSkillFile[];
9743
9783
  }): Promise<UploadSkillResult>;
9744
9784
 
9745
- export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, type ActiveTools, type Agent, type AgentCallParameters, type AgentStreamParameters, type AsyncIterableStream, type CallSettings, type CallWarning, type ChatAddToolApproveResponseFunction, type ChatAddToolOutputFunction, type ChatInit, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatOnToolCallCallback, type ChatRequestOptions, type ChatState, type ChatStatus, type ChatTransport, type ChunkDetector, type CompletionRequestOptions, type ContentPart, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, type DirectChatTransportOptions, type DynamicToolCall, type DynamicToolError, type DynamicToolResult, type DynamicToolUIPart, type EmbedEndEvent, type EmbedManyResult, type EmbedResult, type EmbedStartEvent, type Embedding, type EmbeddingModel, type EmbeddingModelCallEndEvent, type EmbeddingModelCallStartEvent, type EmbeddingModelMiddleware, type EmbeddingModelUsage, type ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, type ToolLoopAgentSettings as Experimental_AgentSettings, type Batch as Experimental_Batch, type BatchError as Experimental_BatchError, type BatchItemResult as Experimental_BatchItemResult, type BatchProvider as Experimental_BatchProvider, type BatchReference as Experimental_BatchReference, type BatchRequest as Experimental_BatchRequest, type BatchStatus as Experimental_BatchStatus, type DownloadFunction as Experimental_DownloadFunction, type Experimental_GeneratedImage, type GetBatchResultsOptions as Experimental_GetBatchResultsOptions, type GetBatchStatusOptions as Experimental_GetBatchStatusOptions, type InferAgentUIMessage as Experimental_InferAgentUIMessage, type LanguageModelStreamPart as Experimental_LanguageModelStreamPart, type LogWarningsFunction as Experimental_LogWarningsFunction, type RealtimeClientEvent as Experimental_RealtimeClientEvent, type RealtimeFactory as Experimental_RealtimeFactory, type RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, type RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, type RealtimeModel as Experimental_RealtimeModel, type RealtimeServerEvent as Experimental_RealtimeServerEvent, type RealtimeSessionConfig as Experimental_RealtimeSessionConfig, type RealtimeSessionOptions as Experimental_RealtimeSessionOptions, type RealtimeSetupResponse as Experimental_RealtimeSetupResponse, type RealtimeState as Experimental_RealtimeState, type RealtimeStatus as Experimental_RealtimeStatus, type RealtimeToolDefinition as Experimental_RealtimeToolDefinition, type Experimental_SpeechResult, type StartBatchOptions as Experimental_StartBatchOptions, type StartBatchResult as Experimental_StartBatchResult, type StreamTranslationResult as Experimental_StreamTranslationResult, type TextBatchGenerationResult as Experimental_TextBatchGenerationResult, type TextBatchItemResult as Experimental_TextBatchItemResult, type TextBatchRequest as Experimental_TextBatchRequest, type Experimental_ToolCallers, type Experimental_TranscriptionResult, type TranslationStreamPart as Experimental_TranslationStreamPart, type FileUIPart, type FinishReason, type GenerateImageCall, type GenerateImageResult, type GenerateObjectEndEvent, type GenerateObjectResult, type GenerateObjectStartEvent, type GenerateObjectStepEndEvent, type GenerateObjectStepStartEvent, type GenerateTextAbortEvent, type GenerateTextEndEvent, type GenerateTextInclude, type GenerateTextOnAbortCallback, type GenerateTextOnEndCallback, type GenerateTextOnFinishCallback, type GenerateTextOnStartCallback, type GenerateTextOnStepEndCallback, type GenerateTextOnStepFinishCallback, type GenerateTextOnStepStartCallback, type GenerateTextResult, type GenerateTextStartEvent, type GenerateTextStepEndEvent, type GenerateTextStepStartEvent, type GenerateVideoPrompt, type GenerateVideoResult, type GeneratedAudioFile, type GeneratedFile, type GenericToolApprovalFunction, type GetVideoStatusResult, HttpChatTransport, type HttpChatTransportInitOptions, type ImageModel, type ImageModelMiddleware, type ImageModelProviderMetadata, type ImageModelResponseMetadata, type ImageModelUsage, type InferAgentUIMessage, type InferCompleteOutput as InferGenerateOutput, type InferPartialOutput as InferStreamOutput, type InferTelemetryEvent, type InferUIDataParts, type InferUIMessageChunk, type InferUITool, type InferUITools, type Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, type JSONValue, JsonToSseTransformStream, type LanguageModel, type LanguageModelCallEndEvent, type LanguageModelCallOptions, type LanguageModelCallStartEvent, type LanguageModelMiddleware, type LanguageModelRequestMetadata, type LanguageModelResponseMetadata, type LanguageModelUsage, type LogWarningsFunction, MessageConversionError, MissingToolResultsError, type ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, type ObjectStreamPart, type OnFinishEvent, type OnLanguageModelCallEndCallback, type OnLanguageModelCallStartCallback, type OnStartEvent, type OnStepFinishEvent, type OnStepStartEvent, type OnToolCallFinishEvent, type OnToolCallStartEvent, type OnToolExecutionEndCallback, type OnToolExecutionStartCallback, output as Output, type OutputChunkTimingStats, type Output as OutputInterface, type PrepareReconnectToStreamRequest, type PrepareSendMessagesRequest, type PrepareStepFunction, type PrepareStepResult, type Prompt, type Provider, type ProviderMetadata, type ProviderReference, type ProviderRegistryProvider, type ReasoningFileOutput, type ReasoningFileUIPart, type ReasoningOutput, type ReasoningUIPart, type RepairTextFunction, type RequestOptions, type RerankEndEvent, type RerankResult, type RerankStartEvent, type RerankingModel, type RerankingModelCallEndEvent, type RerankingModelCallStartEvent, RetryError, type SafeValidateUIMessagesResult, SerialJobExecutor, type SingleToolApprovalFunction, type SourceDocumentUIPart, type SourceUrlUIPart, type SpeechModel, type SpeechModelResponseMetadata, type SpeechResult, type StartVideoResult, type StaticToolCall, type StaticToolError, type StaticToolOutputDenied, type StaticToolResult, type StepResult, type StepResultPerformance, type StepStartUIPart, type StopCondition, type StreamObjectOnFinishCallback, type StreamObjectResult, StreamProviderError, type StreamTextEndEvent, type StreamTextInclude, type StreamTextOnChunkCallback, type StreamTextOnEndCallback, type StreamTextOnErrorCallback, type StreamTextOnErrorResult, type StreamTextOnErrorRetryCallback, type StreamTextResult, type StreamTextTransform, type StreamTranscriptionResult, type Telemetry, type TelemetryOptions, type TelemetryTracingChannelMessage, type TelemetryTracingEventType, TextStreamChatTransport, type TextStreamPart, type TextUIPart, type TimeoutConfiguration, type ToUIMessageChunkOptions, type ToolApprovalConfiguration, type ToolApprovalRequestOutput, type ToolApprovalResponseOutput, type ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, type ToolCallRepairFunction, type ToolChoice, ToolChoiceViolationError, type ToolExecutionEndEvent, type ToolExecutionStartEvent, type ToolInputRefinement, ToolLoopAgent, type ToolLoopAgentSettings, type ToolOrder, type ToolUIPart, type TranscriptionModel, type TranscriptionModelResponseMetadata, type TranscriptionResult, type TranscriptionStreamPart, type TypedToolCall, type TypedToolError, type TypedToolOutputDenied, type TypedToolResult, type UIDataPartSchemas, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, UIMessageStreamError, type UIMessageStreamOnEndCallback, type UIMessageStreamOnFinishCallback, type UIMessageStreamOnStepEndCallback, type UIMessageStreamOnStepFinishCallback, type UIMessageStreamOptions, type UIMessageStreamOutcome, type UIMessageStreamWriter, type UIMessageStreamWriterWithOutcome, type UITool, type UIToolInvocation, type UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, type UploadFileResult, type UploadSkillResult, type UseCompletionOptions, type Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
9785
+ export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, type ActiveTools, type Agent, type AgentCallParameters, type AgentStreamParameters, type AsyncIterableStream, type CallSettings, type CallWarning, type ChatAddToolApproveResponseFunction, type ChatAddToolOutputFunction, type ChatInit, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatOnToolCallCallback, type ChatRequestOptions, type ChatState, type ChatStatus, type ChatTransport, type ChunkDetector, type CompletionRequestOptions, type ContentPart, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, type DirectChatTransportOptions, type DynamicToolCall, type DynamicToolError, type DynamicToolResult, type DynamicToolUIPart, type EmbedEndEvent, type EmbedManyResult, type EmbedResult, type EmbedStartEvent, type Embedding, type EmbeddingModel, type EmbeddingModelCallEndEvent, type EmbeddingModelCallStartEvent, type EmbeddingModelMiddleware, type EmbeddingModelUsage, type ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, type ToolLoopAgentSettings as Experimental_AgentSettings, type Batch as Experimental_Batch, type BatchError as Experimental_BatchError, type BatchItemResult as Experimental_BatchItemResult, type BatchProvider as Experimental_BatchProvider, type BatchReference as Experimental_BatchReference, type BatchRequest as Experimental_BatchRequest, type BatchStatus as Experimental_BatchStatus, type CancelBatchOptions as Experimental_CancelBatchOptions, type CancelBatchResult as Experimental_CancelBatchResult, type DownloadFunction as Experimental_DownloadFunction, type Experimental_GeneratedImage, type GetBatchResultsOptions as Experimental_GetBatchResultsOptions, type GetBatchStatusOptions as Experimental_GetBatchStatusOptions, type InferAgentUIMessage as Experimental_InferAgentUIMessage, type LanguageModelStreamPart as Experimental_LanguageModelStreamPart, type ListBatchesOptions as Experimental_ListBatchesOptions, type ListBatchesResult as Experimental_ListBatchesResult, type LogWarningsFunction as Experimental_LogWarningsFunction, type RealtimeClientEvent as Experimental_RealtimeClientEvent, type RealtimeFactory as Experimental_RealtimeFactory, type RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, type RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, type RealtimeModel as Experimental_RealtimeModel, type RealtimeServerEvent as Experimental_RealtimeServerEvent, type RealtimeSessionConfig as Experimental_RealtimeSessionConfig, type RealtimeSessionOptions as Experimental_RealtimeSessionOptions, type RealtimeSetupResponse as Experimental_RealtimeSetupResponse, type RealtimeState as Experimental_RealtimeState, type RealtimeStatus as Experimental_RealtimeStatus, type RealtimeToolDefinition as Experimental_RealtimeToolDefinition, type Experimental_SpeechResult, type StartBatchOptions as Experimental_StartBatchOptions, type StartBatchResult as Experimental_StartBatchResult, type StreamTranslationResult as Experimental_StreamTranslationResult, type TextBatchGenerationResult as Experimental_TextBatchGenerationResult, type TextBatchItemResult as Experimental_TextBatchItemResult, type TextBatchRequest as Experimental_TextBatchRequest, type Experimental_ToolCallers, type Experimental_TranscriptionResult, type TranslationStreamPart as Experimental_TranslationStreamPart, type FileUIPart, type FinishReason, type GenerateImageCall, type GenerateImageResult, type GenerateObjectEndEvent, type GenerateObjectResult, type GenerateObjectStartEvent, type GenerateObjectStepEndEvent, type GenerateObjectStepStartEvent, type GenerateTextAbortEvent, type GenerateTextEndEvent, type GenerateTextInclude, type GenerateTextOnAbortCallback, type GenerateTextOnEndCallback, type GenerateTextOnFinishCallback, type GenerateTextOnStartCallback, type GenerateTextOnStepEndCallback, type GenerateTextOnStepFinishCallback, type GenerateTextOnStepStartCallback, type GenerateTextResult, type GenerateTextStartEvent, type GenerateTextStepEndEvent, type GenerateTextStepStartEvent, type GenerateVideoPrompt, type GenerateVideoResult, type GeneratedAudioFile, type GeneratedFile, type GenericToolApprovalFunction, type GetVideoStatusResult, HttpChatTransport, type HttpChatTransportInitOptions, type ImageModel, type ImageModelMiddleware, type ImageModelProviderMetadata, type ImageModelResponseMetadata, type ImageModelUsage, type InferAgentUIMessage, type InferCompleteOutput as InferGenerateOutput, type InferPartialOutput as InferStreamOutput, type InferTelemetryEvent, type InferUIDataParts, type InferUIMessageChunk, type InferUITool, type InferUITools, type Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, type JSONValue, JsonToSseTransformStream, type LanguageModel, type LanguageModelCallEndEvent, type LanguageModelCallOptions, type LanguageModelCallStartEvent, type LanguageModelMiddleware, type LanguageModelRequestMetadata, type LanguageModelResponseMetadata, type LanguageModelUsage, type LogWarningsFunction, MessageConversionError, MissingToolResultsError, type ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, type ObjectStreamPart, type OnFinishEvent, type OnLanguageModelCallEndCallback, type OnLanguageModelCallStartCallback, type OnStartEvent, type OnStepFinishEvent, type OnStepStartEvent, type OnToolCallFinishEvent, type OnToolCallStartEvent, type OnToolExecutionEndCallback, type OnToolExecutionStartCallback, output as Output, type OutputChunkTimingStats, type Output as OutputInterface, type PrepareReconnectToStreamRequest, type PrepareSendMessagesRequest, type PrepareStepFunction, type PrepareStepResult, type Prompt, type Provider, type ProviderMetadata, type ProviderReference, type ProviderRegistryProvider, type ReasoningFileOutput, type ReasoningFileUIPart, type ReasoningOutput, type ReasoningUIPart, type RepairTextFunction, type RequestOptions, type RerankEndEvent, type RerankResult, type RerankStartEvent, type RerankingModel, type RerankingModelCallEndEvent, type RerankingModelCallStartEvent, RetryError, type SafeValidateUIMessagesResult, SerialJobExecutor, type SingleToolApprovalFunction, type SourceDocumentUIPart, type SourceUrlUIPart, type SpeechModel, type SpeechModelResponseMetadata, type SpeechResult, type StartVideoResult, type StaticToolCall, type StaticToolError, type StaticToolOutputDenied, type StaticToolResult, type StepResult, type StepResultPerformance, type StepStartUIPart, type StopCondition, type StreamObjectOnFinishCallback, type StreamObjectResult, StreamProviderError, type StreamTextEndEvent, type StreamTextInclude, type StreamTextOnChunkCallback, type StreamTextOnEndCallback, type StreamTextOnErrorCallback, type StreamTextOnErrorResult, type StreamTextOnErrorRetryCallback, type StreamTextResult, type StreamTextTransform, type StreamTranscriptionResult, type Telemetry, type TelemetryOptions, type TelemetryTracingChannelMessage, type TelemetryTracingEventType, TextStreamChatTransport, type TextStreamPart, type TextUIPart, type TimeoutConfiguration, type ToUIMessageChunkOptions, type ToolApprovalConfiguration, type ToolApprovalRequestOutput, type ToolApprovalResponseOutput, type ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, type ToolCallRepairFunction, type ToolChoice, ToolChoiceViolationError, type ToolExecutionEndEvent, type ToolExecutionStartEvent, type ToolInputRefinement, ToolLoopAgent, type ToolLoopAgentSettings, type ToolOrder, type ToolUIPart, type TranscriptionModel, type TranscriptionModelResponseMetadata, type TranscriptionResult, type TranscriptionStreamPart, type TypedToolCall, type TypedToolError, type TypedToolOutputDenied, type TypedToolResult, type UIDataPartSchemas, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, UIMessageStreamError, type UIMessageStreamOnEndCallback, type UIMessageStreamOnFinishCallback, type UIMessageStreamOnStepEndCallback, type UIMessageStreamOnStepFinishCallback, type UIMessageStreamOptions, type UIMessageStreamOutcome, type UIMessageStreamWriter, type UIMessageStreamWriterWithOutcome, type UITool, type UIToolInvocation, type UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, type UploadFileResult, type UploadSkillResult, type UseCompletionOptions, type Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, cancelBatch as experimental_cancelBatch, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, listBatches as experimental_listBatches, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
package/dist/index.js CHANGED
@@ -1178,7 +1178,7 @@ import {
1178
1178
  } from "@ai-sdk/provider-utils";
1179
1179
 
1180
1180
  // src/version.ts
1181
- var VERSION = true ? "7.0.95" : "0.0.0-test";
1181
+ var VERSION = true ? "7.0.97" : "0.0.0-test";
1182
1182
 
1183
1183
  // src/util/download/download.ts
1184
1184
  var download = async ({
@@ -12611,6 +12611,88 @@ function isDeepEqualData(obj1, obj2) {
12611
12611
  }
12612
12612
 
12613
12613
  // src/batch/batch.ts
12614
+ async function cancelBatch({
12615
+ provider,
12616
+ batch,
12617
+ providerOptions,
12618
+ abortSignal,
12619
+ headers,
12620
+ timeout
12621
+ }) {
12622
+ const batchApi = resolveBatchApi(provider);
12623
+ validateBatchReference({ batchApi, batch });
12624
+ if (batchApi.doCancelBatch == null) {
12625
+ throw new UnsupportedFunctionalityError3({
12626
+ functionality: "batch cancellation",
12627
+ message: "The provider does not support batch cancellation."
12628
+ });
12629
+ }
12630
+ const operationAbortSignal = mergeAbortSignals(
12631
+ abortSignal,
12632
+ getTotalTimeoutMs(timeout)
12633
+ );
12634
+ try {
12635
+ return await batchApi.doCancelBatch({
12636
+ batchId: batch.id,
12637
+ providerOptions,
12638
+ abortSignal: operationAbortSignal,
12639
+ headers: withUserAgentSuffix4(headers != null ? headers : {}, `ai/${VERSION}`)
12640
+ });
12641
+ } catch (error) {
12642
+ throw wrapGatewayError(error);
12643
+ }
12644
+ }
12645
+ async function listBatches({
12646
+ provider,
12647
+ providerOptions,
12648
+ limit,
12649
+ cursor,
12650
+ maxRetries,
12651
+ abortSignal,
12652
+ headers,
12653
+ timeout
12654
+ } = {}) {
12655
+ var _a25;
12656
+ const batchApi = resolveBatchApi(provider);
12657
+ const doListBatches = (_a25 = batchApi.doListBatches) == null ? void 0 : _a25.bind(batchApi);
12658
+ if (doListBatches == null) {
12659
+ throw new UnsupportedFunctionalityError3({
12660
+ functionality: "batch listing",
12661
+ message: "The provider does not support listing batches."
12662
+ });
12663
+ }
12664
+ const operationAbortSignal = mergeAbortSignals(
12665
+ abortSignal,
12666
+ getTotalTimeoutMs(timeout)
12667
+ );
12668
+ const { retry } = prepareRetries({
12669
+ maxRetries,
12670
+ abortSignal: operationAbortSignal
12671
+ });
12672
+ try {
12673
+ const { batches, nextCursor, providerMetadata } = await retry(
12674
+ () => doListBatches({
12675
+ providerOptions,
12676
+ abortSignal: operationAbortSignal,
12677
+ headers: withUserAgentSuffix4(headers != null ? headers : {}, `ai/${VERSION}`),
12678
+ ...limit != null && { limit },
12679
+ ...cursor != null && { cursor }
12680
+ })
12681
+ );
12682
+ return {
12683
+ batches: batches.map(({ batchId, ...status }) => ({
12684
+ version: 2,
12685
+ id: batchId,
12686
+ provider: batchApi.provider,
12687
+ ...status
12688
+ })),
12689
+ ...nextCursor != null && { nextCursor },
12690
+ ...providerMetadata != null && { providerMetadata }
12691
+ };
12692
+ } catch (error) {
12693
+ throw wrapGatewayError(error);
12694
+ }
12695
+ }
12614
12696
  async function startBatch({
12615
12697
  provider,
12616
12698
  requests,
@@ -14519,6 +14601,7 @@ function createDownload(options) {
14519
14601
  }
14520
14602
 
14521
14603
  // src/util/data-url.ts
14604
+ var { atob: atob2 } = globalThis;
14522
14605
  function getTextFromDataUrl(dataUrl) {
14523
14606
  const [header, base64Content] = dataUrl.split(",");
14524
14607
  const mediaType = header.split(";")[0].split(":")[1];
@@ -14526,7 +14609,7 @@ function getTextFromDataUrl(dataUrl) {
14526
14609
  throw new Error("Invalid data URL format");
14527
14610
  }
14528
14611
  try {
14529
- return globalThis.atob(base64Content);
14612
+ return atob2(base64Content);
14530
14613
  } catch (e) {
14531
14614
  throw new Error(`Error decoding data URL`);
14532
14615
  }
@@ -15695,8 +15778,10 @@ async function executeStartStatusFlow({
15695
15778
  const result = await model.handleWebhookOption({
15696
15779
  webhook: webhookFactory
15697
15780
  });
15781
+ webhookReceived = Promise.resolve(result.received);
15782
+ webhookReceived.catch(() => {
15783
+ });
15698
15784
  webhookUrl = result.webhookUrl;
15699
- webhookReceived = result.received;
15700
15785
  } else {
15701
15786
  earlyWarnings.push({
15702
15787
  type: "unsupported",
@@ -19771,6 +19856,7 @@ export {
19771
19856
  dynamicTool,
19772
19857
  embed,
19773
19858
  embedMany,
19859
+ cancelBatch as experimental_cancelBatch,
19774
19860
  experimental_createProviderRegistry,
19775
19861
  decodeRealtimeAudio as experimental_decodeRealtimeAudio,
19776
19862
  encodeRealtimeAudio as experimental_encodeRealtimeAudio,
@@ -19781,6 +19867,7 @@ export {
19781
19867
  getBatchStatus as experimental_getBatchStatus,
19782
19868
  getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions,
19783
19869
  experimental_getVideoStatus,
19870
+ listBatches as experimental_listBatches,
19784
19871
  resampleAudio as experimental_resampleAudio,
19785
19872
  startBatch as experimental_startBatch,
19786
19873
  experimental_startVideo,