ai 3.3.21 → 3.3.22

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
+ ## 3.3.22
4
+
5
+ ### Patch Changes
6
+
7
+ - a5a56fd: fix (ai/core): only send roundtrip-finish event after async tool calls are done
8
+
3
9
  ## 3.3.21
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3560,13 +3560,6 @@ var DefaultStreamTextResult = class {
3560
3560
  roundtripFinishReason = chunk.finishReason;
3561
3561
  roundtripProviderMetadata = chunk.experimental_providerMetadata;
3562
3562
  roundtripLogProbs = chunk.logprobs;
3563
- controller.enqueue({
3564
- type: "roundtrip-finish",
3565
- finishReason: chunk.finishReason,
3566
- usage: chunk.usage,
3567
- experimental_providerMetadata: chunk.experimental_providerMetadata,
3568
- logprobs: chunk.logprobs
3569
- });
3570
3563
  break;
3571
3564
  case "tool-call-streaming-start":
3572
3565
  case "tool-call-delta": {
@@ -3586,6 +3579,13 @@ var DefaultStreamTextResult = class {
3586
3579
  },
3587
3580
  // invoke onFinish callback and resolve toolResults promise when the stream is about to close:
3588
3581
  async flush(controller) {
3582
+ controller.enqueue({
3583
+ type: "roundtrip-finish",
3584
+ finishReason: roundtripFinishReason,
3585
+ usage: roundtripUsage,
3586
+ experimental_providerMetadata: roundtripProviderMetadata,
3587
+ logprobs: roundtripLogProbs
3588
+ });
3589
3589
  const telemetryToolCalls = roundtripToolCalls.length > 0 ? JSON.stringify(roundtripToolCalls) : void 0;
3590
3590
  try {
3591
3591
  doStreamSpan2.setAttributes(