ai 4.2.10 → 4.2.11

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,11 @@
1
1
  # ai
2
2
 
3
+ ## 4.2.11
4
+
5
+ ### Patch Changes
6
+
7
+ - c45d100: fix (core): send buffered text in smooth stream when stream parts change
8
+
3
9
  ## 4.2.10
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1156,14 +1156,11 @@ var DownloadError = class extends import_provider6.AISDKError {
1156
1156
  _a5 = symbol5;
1157
1157
 
1158
1158
  // util/download.ts
1159
- async function download({
1160
- url,
1161
- fetchImplementation = fetch
1162
- }) {
1159
+ async function download({ url }) {
1163
1160
  var _a17;
1164
1161
  const urlText = url.toString();
1165
1162
  try {
1166
- const response = await fetchImplementation(urlText);
1163
+ const response = await fetch(urlText);
1167
1164
  if (!response.ok) {
1168
1165
  throw new DownloadError({
1169
1166
  url: urlText,
@@ -4687,7 +4684,7 @@ function smoothStream({
4687
4684
  let buffer = "";
4688
4685
  return new TransformStream({
4689
4686
  async transform(chunk, controller) {
4690
- if (chunk.type === "step-finish") {
4687
+ if (chunk.type !== "text-delta") {
4691
4688
  if (buffer.length > 0) {
4692
4689
  controller.enqueue({ type: "text-delta", textDelta: buffer });
4693
4690
  buffer = "";
@@ -4695,10 +4692,6 @@ function smoothStream({
4695
4692
  controller.enqueue(chunk);
4696
4693
  return;
4697
4694
  }
4698
- if (chunk.type !== "text-delta") {
4699
- controller.enqueue(chunk);
4700
- return;
4701
- }
4702
4695
  buffer += chunk.textDelta;
4703
4696
  let match;
4704
4697
  while ((match = chunkingRegexp.exec(buffer)) != null) {