ai 4.1.34 → 4.1.35

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/dist/index.mjs CHANGED
@@ -5537,7 +5537,8 @@ var DefaultStreamTextResult = class {
5537
5537
  getErrorMessage: getErrorMessage5 = () => "An error occurred.",
5538
5538
  // mask error messages for safety by default
5539
5539
  sendUsage = true,
5540
- sendReasoning = false
5540
+ sendReasoning = false,
5541
+ sendSources = false
5541
5542
  }) {
5542
5543
  return this.fullStream.pipeThrough(
5543
5544
  new TransformStream({
@@ -5557,6 +5558,11 @@ var DefaultStreamTextResult = class {
5557
5558
  break;
5558
5559
  }
5559
5560
  case "source": {
5561
+ if (sendSources) {
5562
+ controller.enqueue(
5563
+ formatDataStreamPart2("source", chunk.source)
5564
+ );
5565
+ }
5560
5566
  break;
5561
5567
  }
5562
5568
  case "tool-call-streaming-start": {
@@ -5651,7 +5657,8 @@ var DefaultStreamTextResult = class {
5651
5657
  data,
5652
5658
  getErrorMessage: getErrorMessage5,
5653
5659
  sendUsage,
5654
- sendReasoning
5660
+ sendReasoning,
5661
+ sendSources
5655
5662
  } = {}) {
5656
5663
  writeToServerResponse({
5657
5664
  response,
@@ -5665,7 +5672,8 @@ var DefaultStreamTextResult = class {
5665
5672
  data,
5666
5673
  getErrorMessage: getErrorMessage5,
5667
5674
  sendUsage,
5668
- sendReasoning
5675
+ sendReasoning,
5676
+ sendSources
5669
5677
  })
5670
5678
  });
5671
5679
  }
@@ -5685,7 +5693,8 @@ var DefaultStreamTextResult = class {
5685
5693
  const stream = this.toDataStreamInternal({
5686
5694
  getErrorMessage: options == null ? void 0 : options.getErrorMessage,
5687
5695
  sendUsage: options == null ? void 0 : options.sendUsage,
5688
- sendReasoning: options == null ? void 0 : options.sendReasoning
5696
+ sendReasoning: options == null ? void 0 : options.sendReasoning,
5697
+ sendSources: options == null ? void 0 : options.sendSources
5689
5698
  }).pipeThrough(new TextEncoderStream());
5690
5699
  return (options == null ? void 0 : options.data) ? mergeStreams(options == null ? void 0 : options.data.stream, stream) : stream;
5691
5700
  }
@@ -5694,7 +5703,8 @@ var DefaultStreamTextResult = class {
5694
5703
  this.toDataStreamInternal({
5695
5704
  getErrorMessage: writer.onError,
5696
5705
  sendUsage: options == null ? void 0 : options.sendUsage,
5697
- sendReasoning: options == null ? void 0 : options.sendReasoning
5706
+ sendReasoning: options == null ? void 0 : options.sendReasoning,
5707
+ sendSources: options == null ? void 0 : options.sendSources
5698
5708
  })
5699
5709
  );
5700
5710
  }
@@ -5705,10 +5715,17 @@ var DefaultStreamTextResult = class {
5705
5715
  data,
5706
5716
  getErrorMessage: getErrorMessage5,
5707
5717
  sendUsage,
5708
- sendReasoning
5718
+ sendReasoning,
5719
+ sendSources
5709
5720
  } = {}) {
5710
5721
  return new Response(
5711
- this.toDataStream({ data, getErrorMessage: getErrorMessage5, sendUsage, sendReasoning }),
5722
+ this.toDataStream({
5723
+ data,
5724
+ getErrorMessage: getErrorMessage5,
5725
+ sendUsage,
5726
+ sendReasoning,
5727
+ sendSources
5728
+ }),
5712
5729
  {
5713
5730
  status,
5714
5731
  statusText,