ai 7.0.133 → 7.0.134

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.
@@ -111,7 +111,7 @@ function asAsyncIterableStream(stream) {
111
111
  }
112
112
  //#endregion
113
113
  //#region src/version.ts
114
- const VERSION = "7.0.133";
114
+ const VERSION = "7.0.134";
115
115
  //#endregion
116
116
  //#region src/util/download/download.ts
117
117
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.133",
3
+ "version": "7.0.134",
4
4
  "type": "module",
5
5
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
6
6
  "license": "Apache-2.0",
@@ -47,13 +47,13 @@
47
47
  "@ai-sdk/provider-utils": "5.0.57"
48
48
  },
49
49
  "devDependencies": {
50
- "@ai-sdk/amazon-bedrock": "5.0.111",
50
+ "@ai-sdk/amazon-bedrock": "5.0.112",
51
51
  "@ai-sdk/deepseek": "3.0.62",
52
52
  "@ai-sdk/google": "4.0.92",
53
53
  "@ai-sdk/groq": "4.0.58",
54
54
  "@ai-sdk/huggingface": "2.0.66",
55
55
  "@ai-sdk/moonshotai": "3.0.66",
56
- "@ai-sdk/openai": "4.0.89",
56
+ "@ai-sdk/openai": "4.0.90",
57
57
  "@ai-sdk/test-server": "2.0.4",
58
58
  "@ai-sdk/xai": "5.0.19",
59
59
  "@edge-runtime/vm": "^5.0.0",
package/src/ui/chat.ts CHANGED
@@ -595,21 +595,21 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
595
595
  this.status !== 'submitted' &&
596
596
  this.sendAutomaticallyWhen
597
597
  ) {
598
- this.shouldSendAutomatically().then(shouldSend => {
599
- if (shouldSend) {
600
- // no await to avoid deadlocking
601
- const messageId =
602
- messageIndex === -1
603
- ? this.lastMessage?.id
604
- : messages[messageIndex].id;
605
-
606
- this.makeRequestForToolApproval({
607
- messageId,
608
- messageIndex,
609
- ...options,
610
- });
611
- }
612
- });
598
+ const shouldSend = await this.shouldSendAutomatically();
599
+
600
+ if (shouldSend) {
601
+ // no await to avoid deadlocking
602
+ const messageId =
603
+ messageIndex === -1
604
+ ? this.lastMessage?.id
605
+ : messages[messageIndex].id;
606
+
607
+ this.makeRequestForToolApproval({
608
+ messageId,
609
+ messageIndex,
610
+ ...options,
611
+ });
612
+ }
613
613
  }
614
614
  });
615
615
 
@@ -680,16 +680,16 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
680
680
  this.status !== 'submitted' &&
681
681
  this.sendAutomaticallyWhen
682
682
  ) {
683
- this.shouldSendAutomatically().then(shouldSend => {
684
- if (shouldSend) {
685
- // no await to avoid deadlocking
686
- this.makeRequest({
687
- trigger: 'submit-message',
688
- messageId: this.lastMessage?.id,
689
- ...options,
690
- });
691
- }
692
- });
683
+ const shouldSend = await this.shouldSendAutomatically();
684
+
685
+ if (shouldSend) {
686
+ // no await to avoid deadlocking
687
+ this.makeRequest({
688
+ trigger: 'submit-message',
689
+ messageId: this.lastMessage?.id,
690
+ ...options,
691
+ });
692
+ }
693
693
  }
694
694
  });
695
695
 
@@ -854,10 +854,8 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
854
854
  responseMessageIndex === -1
855
855
  ? lastMessage
856
856
  : this.state.messages[responseMessageIndex];
857
- // the continued stream can start with either
858
- // 1) input deltas
859
- // 2) or the result of an answered tool approval request
860
- // Keep the tool part so in case 2, those chunks can find their tool call
857
+ // The continued stream can start with input deltas or a tool result.
858
+ // Keep unfinished tool parts so result chunks can find their tool call.
861
859
  const resumableResponseMessage =
862
860
  trigger === 'resume-stream' &&
863
861
  responseMessage?.role === 'assistant' &&
@@ -865,6 +863,7 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
865
863
  part =>
866
864
  isToolUIPart(part) &&
867
865
  (part.state === 'input-streaming' ||
866
+ (part.state === 'input-available' && part.providerExecuted) ||
868
867
  part.state === 'approval-responded'),
869
868
  )
870
869
  ? this.state.snapshot(responseMessage)