ai 5.0.103 → 5.0.105

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
@@ -684,7 +684,7 @@ import {
684
684
  } from "@ai-sdk/provider-utils";
685
685
 
686
686
  // src/version.ts
687
- var VERSION = true ? "5.0.103" : "0.0.0-test";
687
+ var VERSION = true ? "5.0.105" : "0.0.0-test";
688
688
 
689
689
  // src/util/download/download.ts
690
690
  var download = async ({ url }) => {
@@ -1889,7 +1889,8 @@ async function parseToolCall({
1889
1889
  input,
1890
1890
  dynamic: true,
1891
1891
  invalid: true,
1892
- error
1892
+ error,
1893
+ providerMetadata: toolCall.providerMetadata
1893
1894
  };
1894
1895
  }
1895
1896
  }
@@ -2722,6 +2723,7 @@ import {
2722
2723
  } from "@ai-sdk/provider";
2723
2724
  import {
2724
2725
  createIdGenerator as createIdGenerator2,
2726
+ DelayedPromise,
2725
2727
  isAbortError as isAbortError2
2726
2728
  } from "@ai-sdk/provider-utils";
2727
2729
 
@@ -4164,44 +4166,6 @@ function createStitchableStream() {
4164
4166
  };
4165
4167
  }
4166
4168
 
4167
- // src/util/delayed-promise.ts
4168
- var DelayedPromise = class {
4169
- constructor() {
4170
- this.status = { type: "pending" };
4171
- this._resolve = void 0;
4172
- this._reject = void 0;
4173
- }
4174
- get promise() {
4175
- if (this._promise) {
4176
- return this._promise;
4177
- }
4178
- this._promise = new Promise((resolve2, reject) => {
4179
- if (this.status.type === "resolved") {
4180
- resolve2(this.status.value);
4181
- } else if (this.status.type === "rejected") {
4182
- reject(this.status.error);
4183
- }
4184
- this._resolve = resolve2;
4185
- this._reject = reject;
4186
- });
4187
- return this._promise;
4188
- }
4189
- resolve(value) {
4190
- var _a16;
4191
- this.status = { type: "resolved", value };
4192
- if (this._promise) {
4193
- (_a16 = this._resolve) == null ? void 0 : _a16.call(this, value);
4194
- }
4195
- }
4196
- reject(error) {
4197
- var _a16;
4198
- this.status = { type: "rejected", error };
4199
- if (this._promise) {
4200
- (_a16 = this._reject) == null ? void 0 : _a16.call(this, error);
4201
- }
4202
- }
4203
- };
4204
-
4205
4169
  // src/util/now.ts
4206
4170
  function now() {
4207
4171
  var _a16, _b;
@@ -5906,7 +5870,8 @@ function convertToModelMessages(messages, options) {
5906
5870
  output: part.state === "output-error" ? part.errorText : part.output,
5907
5871
  tool: (_b = options == null ? void 0 : options.tools) == null ? void 0 : _b[toolName],
5908
5872
  errorMode: part.state === "output-error" ? "json" : "none"
5909
- })
5873
+ }),
5874
+ ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
5910
5875
  });
5911
5876
  }
5912
5877
  }
@@ -5947,7 +5912,8 @@ function convertToModelMessages(messages, options) {
5947
5912
  output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
5948
5913
  tool: (_a17 = options == null ? void 0 : options.tools) == null ? void 0 : _a17[toolName],
5949
5914
  errorMode: toolPart.state === "output-error" ? "text" : "none"
5950
- })
5915
+ }),
5916
+ ...toolPart.callProviderMetadata != null ? { providerOptions: toolPart.callProviderMetadata } : {}
5951
5917
  };
5952
5918
  }
5953
5919
  default: {
@@ -7229,7 +7195,8 @@ var DefaultGenerateObjectResult = class {
7229
7195
 
7230
7196
  // src/generate-object/stream-object.ts
7231
7197
  import {
7232
- createIdGenerator as createIdGenerator4
7198
+ createIdGenerator as createIdGenerator4,
7199
+ DelayedPromise as DelayedPromise2
7233
7200
  } from "@ai-sdk/provider-utils";
7234
7201
 
7235
7202
  // src/util/cosine-similarity.ts
@@ -7453,13 +7420,13 @@ var DefaultStreamObjectResult = class {
7453
7420
  currentDate,
7454
7421
  now: now2
7455
7422
  }) {
7456
- this._object = new DelayedPromise();
7457
- this._usage = new DelayedPromise();
7458
- this._providerMetadata = new DelayedPromise();
7459
- this._warnings = new DelayedPromise();
7460
- this._request = new DelayedPromise();
7461
- this._response = new DelayedPromise();
7462
- this._finishReason = new DelayedPromise();
7423
+ this._object = new DelayedPromise2();
7424
+ this._usage = new DelayedPromise2();
7425
+ this._providerMetadata = new DelayedPromise2();
7426
+ this._warnings = new DelayedPromise2();
7427
+ this._request = new DelayedPromise2();
7428
+ this._response = new DelayedPromise2();
7429
+ this._finishReason = new DelayedPromise2();
7463
7430
  const model = resolveLanguageModel(modelArg);
7464
7431
  const { maxRetries, retry } = prepareRetries({
7465
7432
  maxRetries: maxRetriesArg,