ai 5.0.222 → 5.0.223

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,16 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.223
4
+
5
+ ### Patch Changes
6
+
7
+ - 7a6bdbc: Prevent validated downloads on Node.js from reaching private or internal services through DNS aliases or DNS rebinding by validating and pinning every resolved address at connection time.
8
+ - c5e11c6: Preserve provider metadata from empty text deltas in `streamText`.
9
+ - Updated dependencies [7a6bdbc]
10
+ - Updated dependencies [5bd6d2c]
11
+ - @ai-sdk/provider-utils@3.0.31
12
+ - @ai-sdk/gateway@2.0.122
13
+
3
14
  ## 5.0.222
4
15
 
5
16
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -675,7 +675,8 @@ type StepResult<TOOLS extends ToolSet> = {
675
675
  */
676
676
  readonly content: Array<ContentPart<TOOLS>>;
677
677
  /**
678
- The generated text.
678
+ The concatenation of all text parts generated in this step.
679
+ It is an empty string if the step contains no text parts.
679
680
  */
680
681
  readonly text: string;
681
682
  /**
@@ -767,7 +768,9 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
767
768
  */
768
769
  readonly content: Array<ContentPart<TOOLS>>;
769
770
  /**
770
- The text that was generated in the last step.
771
+ The concatenation of all text parts generated in the last step.
772
+ It is an empty string if the last step contains no text parts.
773
+ Inspect `content` to distinguish that case.
771
774
  */
772
775
  readonly text: string;
773
776
  /**
package/dist/index.d.ts CHANGED
@@ -675,7 +675,8 @@ type StepResult<TOOLS extends ToolSet> = {
675
675
  */
676
676
  readonly content: Array<ContentPart<TOOLS>>;
677
677
  /**
678
- The generated text.
678
+ The concatenation of all text parts generated in this step.
679
+ It is an empty string if the step contains no text parts.
679
680
  */
680
681
  readonly text: string;
681
682
  /**
@@ -767,7 +768,9 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
767
768
  */
768
769
  readonly content: Array<ContentPart<TOOLS>>;
769
770
  /**
770
- The text that was generated in the last step.
771
+ The concatenation of all text parts generated in the last step.
772
+ It is an empty string if the last step contains no text parts.
773
+ Inspect `content` to distinguish that case.
771
774
  */
772
775
  readonly text: string;
773
776
  /**
package/dist/index.js CHANGED
@@ -816,7 +816,7 @@ function detectMediaType({
816
816
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
817
817
 
818
818
  // src/version.ts
819
- var VERSION = true ? "5.0.222" : "0.0.0-test";
819
+ var VERSION = true ? "5.0.223" : "0.0.0-test";
820
820
 
821
821
  // src/util/download/download.ts
822
822
  var download = async ({
@@ -4805,6 +4805,10 @@ function createOutputTransformStream(output) {
4805
4805
  }
4806
4806
  text2 += chunk.text;
4807
4807
  textChunk += chunk.text;
4808
+ if (chunk.text.length === 0 && chunk.providerMetadata != null) {
4809
+ controller.enqueue({ part: chunk, partialOutput: void 0 });
4810
+ return;
4811
+ }
4808
4812
  const result = await output.parsePartial({ text: text2 });
4809
4813
  if (result != null) {
4810
4814
  const currentJson = JSON.stringify(result.partial);
@@ -5329,7 +5333,7 @@ var DefaultStreamTextResult = class {
5329
5333
  break;
5330
5334
  }
5331
5335
  case "text-delta": {
5332
- if (chunk.delta.length > 0) {
5336
+ if (chunk.delta.length > 0 || chunk.providerMetadata != null) {
5333
5337
  controller.enqueue({
5334
5338
  type: "text-delta",
5335
5339
  id: chunk.id,