ai 6.0.148 → 6.0.150

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.
@@ -153,7 +153,7 @@ var import_provider_utils2 = require("@ai-sdk/provider-utils");
153
153
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
154
154
 
155
155
  // src/version.ts
156
- var VERSION = true ? "6.0.148" : "0.0.0-test";
156
+ var VERSION = true ? "6.0.150" : "0.0.0-test";
157
157
 
158
158
  // src/util/download/download.ts
159
159
  var download = async ({
@@ -133,7 +133,7 @@ import {
133
133
  } from "@ai-sdk/provider-utils";
134
134
 
135
135
  // src/version.ts
136
- var VERSION = true ? "6.0.148" : "0.0.0-test";
136
+ var VERSION = true ? "6.0.150" : "0.0.0-test";
137
137
 
138
138
  // src/util/download/download.ts
139
139
  var download = async ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "6.0.148",
3
+ "version": "6.0.150",
4
4
  "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.",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@opentelemetry/api": "1.9.0",
48
- "@ai-sdk/gateway": "3.0.90",
48
+ "@ai-sdk/gateway": "3.0.92",
49
49
  "@ai-sdk/provider": "3.0.8",
50
50
  "@ai-sdk/provider-utils": "4.0.23"
51
51
  },
@@ -600,7 +600,7 @@ function createOutputTransformStream<
600
600
  let text = '';
601
601
  let textChunk = '';
602
602
  let textProviderMetadata: ProviderMetadata | undefined = undefined;
603
- let lastPublishedJson = '';
603
+ let lastPublishedValue = '';
604
604
 
605
605
  function publishTextChunk({
606
606
  controller,
@@ -673,11 +673,15 @@ function createOutputTransformStream<
673
673
 
674
674
  // null should be allowed (valid JSON value) but undefined should not:
675
675
  if (result !== undefined) {
676
- // only send new json if it has changed:
677
- const currentJson = JSON.stringify(result.partial);
678
- if (currentJson !== lastPublishedJson) {
676
+ // only send new value if it has changed:
677
+ // For string partials (text output), compare directly to avoid unnecessary JSON.stringify overhead
678
+ const currentValue =
679
+ typeof result.partial === 'string'
680
+ ? result.partial
681
+ : JSON.stringify(result.partial);
682
+ if (currentValue !== lastPublishedValue) {
679
683
  publishTextChunk({ controller, partialOutput: result.partial });
680
- lastPublishedJson = currentJson;
684
+ lastPublishedValue = currentValue;
681
685
  }
682
686
  }
683
687
  },