ai 5.0.51 → 5.0.53

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/dist/index.mjs CHANGED
@@ -679,7 +679,7 @@ import {
679
679
  } from "@ai-sdk/provider-utils";
680
680
 
681
681
  // src/version.ts
682
- var VERSION = true ? "5.0.51" : "0.0.0-test";
682
+ var VERSION = true ? "5.0.53" : "0.0.0-test";
683
683
 
684
684
  // src/util/download/download.ts
685
685
  var download = async ({ url }) => {
@@ -972,12 +972,12 @@ async function downloadAssets(messages, download2, supportedUrls) {
972
972
  }));
973
973
  const downloadedFiles = await download2(plannedDownloads);
974
974
  return Object.fromEntries(
975
- downloadedFiles.filter(
976
- (downloadedFile) => (downloadedFile == null ? void 0 : downloadedFile.data) != null
977
- ).map(({ data, mediaType }, index) => [
978
- plannedDownloads[index].url.toString(),
979
- { data, mediaType }
980
- ])
975
+ downloadedFiles.map(
976
+ (file, index) => file == null ? null : [
977
+ plannedDownloads[index].url.toString(),
978
+ { data: file.data, mediaType: file.mediaType }
979
+ ]
980
+ ).filter((file) => file != null)
981
981
  );
982
982
  }
983
983
  function convertPartToLanguageModelPart(part, downloadedAssets) {
@@ -2923,11 +2923,6 @@ var uiMessageChunkSchema = z7.union([
2923
2923
  providerExecuted: z7.boolean().optional(),
2924
2924
  dynamic: z7.boolean().optional()
2925
2925
  }),
2926
- z7.strictObject({
2927
- type: z7.literal("reasoning"),
2928
- text: z7.string(),
2929
- providerMetadata: providerMetadataSchema.optional()
2930
- }),
2931
2926
  z7.strictObject({
2932
2927
  type: z7.literal("reasoning-start"),
2933
2928
  id: z7.string(),
@@ -2944,9 +2939,6 @@ var uiMessageChunkSchema = z7.union([
2944
2939
  id: z7.string(),
2945
2940
  providerMetadata: providerMetadataSchema.optional()
2946
2941
  }),
2947
- z7.strictObject({
2948
- type: z7.literal("reasoning-part-finish")
2949
- }),
2950
2942
  z7.strictObject({
2951
2943
  type: z7.literal("source-url"),
2952
2944
  sourceId: z7.string(),
@@ -2969,7 +2961,10 @@ var uiMessageChunkSchema = z7.union([
2969
2961
  providerMetadata: providerMetadataSchema.optional()
2970
2962
  }),
2971
2963
  z7.strictObject({
2972
- type: z7.string().startsWith("data-"),
2964
+ type: z7.custom(
2965
+ (value) => typeof value === "string" && value.startsWith("data-"),
2966
+ { message: 'Type must start with "data-"' }
2967
+ ),
2973
2968
  id: z7.string().optional(),
2974
2969
  data: z7.unknown(),
2975
2970
  transient: z7.boolean().optional()
@@ -9702,9 +9697,11 @@ var AbstractChat = class {
9702
9697
  }
9703
9698
  };
9704
9699
  this.addToolResult = async ({
9700
+ state = "output-available",
9705
9701
  tool: tool3,
9706
9702
  toolCallId,
9707
- output
9703
+ output,
9704
+ errorText
9708
9705
  }) => this.jobExecutor.run(async () => {
9709
9706
  var _a17, _b;
9710
9707
  const messages = this.state.messages;
@@ -9712,16 +9709,16 @@ var AbstractChat = class {
9712
9709
  this.state.replaceMessage(messages.length - 1, {
9713
9710
  ...lastMessage,
9714
9711
  parts: lastMessage.parts.map(
9715
- (part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state: "output-available", output } : part
9712
+ (part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state, output, errorText } : part
9716
9713
  )
9717
9714
  });
9718
9715
  if (this.activeResponse) {
9719
9716
  this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(
9720
9717
  (part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? {
9721
9718
  ...part,
9722
- state: "output-available",
9719
+ state,
9723
9720
  output,
9724
- errorText: void 0
9721
+ errorText
9725
9722
  } : part
9726
9723
  );
9727
9724
  }
@@ -9930,7 +9927,9 @@ function lastAssistantMessageIsCompleteWithToolCalls({
9930
9927
  return part.type === "step-start" ? index : lastIndex;
9931
9928
  }, -1);
9932
9929
  const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolOrDynamicToolUIPart);
9933
- return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every((part) => part.state === "output-available");
9930
+ return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every(
9931
+ (part) => part.state === "output-available" || part.state === "output-error"
9932
+ );
9934
9933
  }
9935
9934
 
9936
9935
  // src/ui/transform-text-to-ui-message-stream.ts