ai 5.0.235 → 5.0.236

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,14 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.236
4
+
5
+ ### Patch Changes
6
+
7
+ - c425210: Propagate errors thrown by chat `onFinish` callbacks.
8
+ - eb7f2ac: Keep chat status submitted until response content begins streaming.
9
+ - Updated dependencies [df0cbe9]
10
+ - @ai-sdk/gateway@2.0.134
11
+
3
12
  ## 5.0.235
4
13
 
5
14
  ### Patch Changes
package/dist/index.js CHANGED
@@ -816,7 +816,7 @@ function detectMediaType({
816
816
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
817
817
 
818
818
  // src/version.ts
819
- var VERSION = true ? "5.0.235" : "0.0.0-test";
819
+ var VERSION = true ? "5.0.236" : "0.0.0-test";
820
820
 
821
821
  // src/util/download/download.ts
822
822
  var download = async ({
@@ -4066,7 +4066,7 @@ function processUIMessageStream({
4066
4066
  }
4067
4067
  await updateMessageMetadata(chunk.messageMetadata);
4068
4068
  if (chunk.messageId != null || chunk.messageMetadata != null) {
4069
- write();
4069
+ write({ updateStatus: false });
4070
4070
  }
4071
4071
  break;
4072
4072
  }
@@ -9678,12 +9678,14 @@ var AbstractChat = class {
9678
9678
  }
9679
9679
  return job({
9680
9680
  state: response.state,
9681
- write: () => {
9681
+ write: ({ updateStatus = true } = {}) => {
9682
9682
  var _a17;
9683
9683
  if (response.abortController.signal.aborted) {
9684
9684
  return;
9685
9685
  }
9686
- this.setStatus({ status: "streaming" });
9686
+ if (updateStatus) {
9687
+ this.setStatus({ status: "streaming" });
9688
+ }
9687
9689
  const replaceLastMessage = response.state.message.id === ((_a17 = this.lastMessage) == null ? void 0 : _a17.id);
9688
9690
  if (replaceLastMessage) {
9689
9691
  this.state.replaceMessage(
@@ -9754,13 +9756,12 @@ var AbstractChat = class {
9754
9756
  finishReason: activeResponse.state.finishReason
9755
9757
  });
9756
9758
  }
9757
- } catch (err) {
9758
- console.error(err);
9759
- }
9760
- if (this.activeResponse === activeResponse) {
9761
- this.activeResponse = void 0;
9759
+ } finally {
9760
+ if (this.activeResponse === activeResponse) {
9761
+ this.activeResponse = void 0;
9762
+ }
9763
+ clearActiveResumeRequest();
9762
9764
  }
9763
- clearActiveResumeRequest();
9764
9765
  }
9765
9766
  if (((_c = this.sendAutomaticallyWhen) == null ? void 0 : _c.call(this, { messages: this.state.messages })) && !isError) {
9766
9767
  await this.makeRequest({