ai 7.0.64 → 7.0.66
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 +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -13
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +0 -1
- package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +2 -0
- package/package.json +2 -2
- package/src/generate-object/output-strategy.ts +11 -2
- package/src/generate-text/index.ts +1 -0
- package/src/generate-text/output.ts +12 -2
- package/src/ui/chat.ts +11 -11
- package/src/ui/process-ui-message-stream.ts +6 -2
- package/src/ui-message-stream/handle-ui-message-stream-finish.ts +2 -1
- package/src/ui-message-stream/read-ui-message-stream.ts +32 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 7.0.66
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0782259: Keep chat status submitted until response content begins streaming.
|
|
8
|
+
- 2fd1214: Fix declaration emit for exported values that infer an `Output` type.
|
|
9
|
+
|
|
10
|
+
## 7.0.65
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- dc8caae: Avoid repeatedly cloning accumulated text in `readUIMessageStream` while
|
|
15
|
+
preserving independent snapshots for mutable nested values.
|
|
16
|
+
- 72ec74f: Preserve root-level JSON Schema definitions when wrapping array output schemas.
|
|
17
|
+
- c5b0515: Propagate errors thrown by the Chat `onFinish` callback to the initiating request.
|
|
18
|
+
- Updated dependencies [16650e9]
|
|
19
|
+
- @ai-sdk/gateway@4.0.52
|
|
20
|
+
|
|
3
21
|
## 7.0.64
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -9322,4 +9322,4 @@ declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
|
|
|
9322
9322
|
files: UploadSkillFile[];
|
|
9323
9323
|
}): Promise<UploadSkillResult>;
|
|
9324
9324
|
|
|
9325
|
-
export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, ActiveTools, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, BatchError as Experimental_BatchError, BatchLanguageModel as Experimental_BatchLanguageModel, BatchOperationOptions as Experimental_BatchOperationOptions, BatchReference as Experimental_BatchReference, BatchStatus as Experimental_BatchStatus, DownloadFunction as Experimental_DownloadFunction, Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, Experimental_SpeechResult, StartTextBatchOptions as Experimental_StartTextBatchOptions, StartTextBatchResult as Experimental_StartTextBatchResult, StreamTranslationResult as Experimental_StreamTranslationResult, TextBatch as Experimental_TextBatch, TextBatchGenerationResult as Experimental_TextBatchGenerationResult, TextBatchItemResult as Experimental_TextBatchItemResult, TextBatchReference as Experimental_TextBatchReference, TextBatchRequest as Experimental_TextBatchRequest, Experimental_ToolCallers, Experimental_TranscriptionResult, TranslationStreamPart as Experimental_TranslationStreamPart, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, StreamTranscriptionResult, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, ToolApprovalConfiguration, ToolApprovalRequestOutput, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolOrder, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TranscriptionStreamPart, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, 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, resampleAudio as experimental_resampleAudio, startTextBatch as experimental_startTextBatch, 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 };
|
|
9325
|
+
export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, ActiveTools, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, BatchError as Experimental_BatchError, BatchLanguageModel as Experimental_BatchLanguageModel, BatchOperationOptions as Experimental_BatchOperationOptions, BatchReference as Experimental_BatchReference, BatchStatus as Experimental_BatchStatus, DownloadFunction as Experimental_DownloadFunction, Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, Experimental_SpeechResult, StartTextBatchOptions as Experimental_StartTextBatchOptions, StartTextBatchResult as Experimental_StartTextBatchResult, StreamTranslationResult as Experimental_StreamTranslationResult, TextBatch as Experimental_TextBatch, TextBatchGenerationResult as Experimental_TextBatchGenerationResult, TextBatchItemResult as Experimental_TextBatchItemResult, TextBatchReference as Experimental_TextBatchReference, TextBatchRequest as Experimental_TextBatchRequest, Experimental_ToolCallers, Experimental_TranscriptionResult, TranslationStreamPart as Experimental_TranslationStreamPart, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, StreamTranscriptionResult, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, ToolApprovalConfiguration, ToolApprovalRequestOutput, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolOrder, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TranscriptionStreamPart, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, 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, resampleAudio as experimental_resampleAudio, startTextBatch as experimental_startTextBatch, 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
|
@@ -1143,7 +1143,7 @@ import {
|
|
|
1143
1143
|
} from "@ai-sdk/provider-utils";
|
|
1144
1144
|
|
|
1145
1145
|
// src/version.ts
|
|
1146
|
-
var VERSION = true ? "7.0.
|
|
1146
|
+
var VERSION = true ? "7.0.66" : "0.0.0-test";
|
|
1147
1147
|
|
|
1148
1148
|
// src/util/download/download.ts
|
|
1149
1149
|
var download = async ({
|
|
@@ -3601,11 +3601,18 @@ var array2 = ({
|
|
|
3601
3601
|
name: "array",
|
|
3602
3602
|
// JSON schema that describes an array of elements:
|
|
3603
3603
|
responseFormat: resolve(elementSchema.jsonSchema).then((jsonSchema2) => {
|
|
3604
|
-
const {
|
|
3604
|
+
const {
|
|
3605
|
+
$schema: _$schema,
|
|
3606
|
+
definitions,
|
|
3607
|
+
$defs,
|
|
3608
|
+
...itemSchema
|
|
3609
|
+
} = jsonSchema2;
|
|
3605
3610
|
return {
|
|
3606
3611
|
type: "json",
|
|
3607
3612
|
schema: {
|
|
3608
3613
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
3614
|
+
...definitions != null && { definitions },
|
|
3615
|
+
...$defs != null && { $defs },
|
|
3609
3616
|
type: "object",
|
|
3610
3617
|
properties: {
|
|
3611
3618
|
elements: { type: "array", items: itemSchema }
|
|
@@ -7363,7 +7370,7 @@ function processUIMessageStream({
|
|
|
7363
7370
|
}
|
|
7364
7371
|
await updateMessageMetadata(chunk.messageMetadata);
|
|
7365
7372
|
if (chunk.messageId != null || chunk.messageMetadata != null) {
|
|
7366
|
-
write();
|
|
7373
|
+
write({ updateStatus: false });
|
|
7367
7374
|
}
|
|
7368
7375
|
break;
|
|
7369
7376
|
}
|
|
@@ -10704,6 +10711,27 @@ function createUIMessageStream({
|
|
|
10704
10711
|
}
|
|
10705
10712
|
|
|
10706
10713
|
// src/ui-message-stream/read-ui-message-stream.ts
|
|
10714
|
+
function createUIMessageSnapshot(message) {
|
|
10715
|
+
const textByPartIndex = /* @__PURE__ */ new Map();
|
|
10716
|
+
const messageWithoutText = {
|
|
10717
|
+
...message,
|
|
10718
|
+
parts: message.parts.map((part, index) => {
|
|
10719
|
+
if (part.type === "text" || part.type === "reasoning") {
|
|
10720
|
+
textByPartIndex.set(index, part.text);
|
|
10721
|
+
return { ...part, text: "" };
|
|
10722
|
+
}
|
|
10723
|
+
return part;
|
|
10724
|
+
})
|
|
10725
|
+
};
|
|
10726
|
+
const snapshot = structuredClone(messageWithoutText);
|
|
10727
|
+
for (const [index, text2] of textByPartIndex) {
|
|
10728
|
+
const part = snapshot.parts[index];
|
|
10729
|
+
if (part.type === "text" || part.type === "reasoning") {
|
|
10730
|
+
part.text = text2;
|
|
10731
|
+
}
|
|
10732
|
+
}
|
|
10733
|
+
return snapshot;
|
|
10734
|
+
}
|
|
10707
10735
|
function readUIMessageStream({
|
|
10708
10736
|
message,
|
|
10709
10737
|
stream,
|
|
@@ -10736,7 +10764,7 @@ function readUIMessageStream({
|
|
|
10736
10764
|
return job({
|
|
10737
10765
|
state,
|
|
10738
10766
|
write: () => {
|
|
10739
|
-
controller == null ? void 0 : controller.enqueue(
|
|
10767
|
+
controller == null ? void 0 : controller.enqueue(createUIMessageSnapshot(state.message));
|
|
10740
10768
|
}
|
|
10741
10769
|
});
|
|
10742
10770
|
},
|
|
@@ -12561,9 +12589,16 @@ var arrayOutputStrategy = (schema) => {
|
|
|
12561
12589
|
// be able to generate an array directly:
|
|
12562
12590
|
// possible future optimization: use arrays directly when model supports grammar-guided generation
|
|
12563
12591
|
jsonSchema: async () => {
|
|
12564
|
-
const {
|
|
12592
|
+
const {
|
|
12593
|
+
$schema: _$schema,
|
|
12594
|
+
definitions,
|
|
12595
|
+
$defs,
|
|
12596
|
+
...itemSchema
|
|
12597
|
+
} = await schema.jsonSchema;
|
|
12565
12598
|
return {
|
|
12566
12599
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
12600
|
+
...definitions != null && { definitions },
|
|
12601
|
+
...$defs != null && { $defs },
|
|
12567
12602
|
type: "object",
|
|
12568
12603
|
properties: {
|
|
12569
12604
|
elements: { type: "array", items: itemSchema }
|
|
@@ -17931,12 +17966,14 @@ var AbstractChat = class {
|
|
|
17931
17966
|
}
|
|
17932
17967
|
return job({
|
|
17933
17968
|
state: response.state,
|
|
17934
|
-
write: () => {
|
|
17969
|
+
write: ({ updateStatus = true } = {}) => {
|
|
17935
17970
|
var _a24;
|
|
17936
17971
|
if (response.abortController.signal.aborted) {
|
|
17937
17972
|
return;
|
|
17938
17973
|
}
|
|
17939
|
-
|
|
17974
|
+
if (updateStatus) {
|
|
17975
|
+
this.setStatus({ status: "streaming" });
|
|
17976
|
+
}
|
|
17940
17977
|
const replaceLastMessage = response.state.message.id === ((_a24 = this.lastMessage) == null ? void 0 : _a24.id);
|
|
17941
17978
|
if (replaceLastMessage) {
|
|
17942
17979
|
this.state.replaceMessage(
|
|
@@ -18007,13 +18044,12 @@ var AbstractChat = class {
|
|
|
18007
18044
|
finishReason: activeResponse.state.finishReason
|
|
18008
18045
|
});
|
|
18009
18046
|
}
|
|
18010
|
-
}
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18047
|
+
} finally {
|
|
18048
|
+
if (this.activeResponse === activeResponse) {
|
|
18049
|
+
this.activeResponse = void 0;
|
|
18050
|
+
}
|
|
18051
|
+
clearActiveResumeRequest();
|
|
18015
18052
|
}
|
|
18016
|
-
clearActiveResumeRequest();
|
|
18017
18053
|
}
|
|
18018
18054
|
if (!isError && await this.shouldSendAutomatically()) {
|
|
18019
18055
|
await this.makeRequest({
|