ai 4.1.21 → 4.1.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/dist/index.mjs CHANGED
@@ -4652,6 +4652,7 @@ function streamText({
4652
4652
  experimental_repairToolCall: repairToolCall,
4653
4653
  experimental_transform: transform,
4654
4654
  onChunk,
4655
+ onError,
4655
4656
  onFinish,
4656
4657
  onStepFinish,
4657
4658
  _internal: {
@@ -4682,6 +4683,7 @@ function streamText({
4682
4683
  continueSteps,
4683
4684
  providerOptions,
4684
4685
  onChunk,
4686
+ onError,
4685
4687
  onFinish,
4686
4688
  onStepFinish,
4687
4689
  now: now2,
@@ -4763,6 +4765,7 @@ var DefaultStreamTextResult = class {
4763
4765
  continueSteps,
4764
4766
  providerOptions,
4765
4767
  onChunk,
4768
+ onError,
4766
4769
  onFinish,
4767
4770
  onStepFinish,
4768
4771
  now: now2,
@@ -4814,6 +4817,9 @@ var DefaultStreamTextResult = class {
4814
4817
  if (part.type === "text-delta" || part.type === "reasoning" || part.type === "tool-call" || part.type === "tool-result" || part.type === "tool-call-streaming-start" || part.type === "tool-call-delta") {
4815
4818
  await (onChunk == null ? void 0 : onChunk({ chunk: part }));
4816
4819
  }
4820
+ if (part.type === "error") {
4821
+ await (onError == null ? void 0 : onError({ error: part.error }));
4822
+ }
4817
4823
  if (part.type === "text-delta") {
4818
4824
  recordedStepText += part.textDelta;
4819
4825
  recordedContinuationText += part.textDelta;