@ai-sdk/provider-utils 5.0.5 → 5.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -4,7 +4,6 @@ import {
4
4
  type SharedV4ProviderMetadata,
5
5
  } from '@ai-sdk/provider';
6
6
  import { generateId as defaultGenerateId } from './generate-id';
7
- import { isParsableJson } from './parse-json';
8
7
 
9
8
  /**
10
9
  * Minimal interface for a streaming tool call delta from an OpenAI-compatible API.
@@ -188,11 +187,10 @@ export class StreamingToolCallTracker<
188
187
  });
189
188
  }
190
189
 
191
- // Check if tool call is complete
192
- // (some providers send the full tool call in one chunk)
193
- if (isParsableJson(toolCall.function.arguments)) {
194
- this.finishToolCall(toolCall);
195
- }
190
+ // Tool calls must not finalize before the stream ends: a parsable
191
+ // argument buffer can still be the prefix of a longer argument string,
192
+ // so acting on it early would use truncated inputs (see #13137).
193
+ // Finalization happens in flush().
196
194
  }
197
195
 
198
196
  private processExistingToolCall(index: number, toolCallDelta: DELTA): void {
@@ -211,11 +209,6 @@ export class StreamingToolCallTracker<
211
209
  delta: toolCallDelta.function.arguments,
212
210
  });
213
211
  }
214
-
215
- // Check if tool call is complete
216
- if (isParsableJson(toolCall.function.arguments)) {
217
- this.finishToolCall(toolCall);
218
- }
219
212
  }
220
213
 
221
214
  private finishToolCall(toolCall: TrackedToolCall): void {