@ai-sdk/provider-utils 4.0.14 → 4.0.16

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,21 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 58bc42d: feat(provider/openai): support custom tools with alias mapping
8
+
9
+ ## 4.0.15
10
+
11
+ ### Patch Changes
12
+
13
+ - 4024a3a: security: prevent unbounded memory growth in download functions
14
+
15
+ The `download()` and `downloadBlob()` functions now enforce a default 2 GiB size limit when downloading from user-provided URLs. Downloads that exceed this limit are aborted with a `DownloadError` instead of consuming unbounded memory and crashing the process. The `abortSignal` parameter is now passed through to `fetch()` in all download call sites.
16
+
17
+ Added `download` option to `transcribe()` and `experimental_generateVideo()` for providing a custom download function. Use the new `createDownload({ maxBytes })` factory to configure download size limits.
18
+
3
19
  ## 4.0.14
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -41,7 +41,7 @@ interface ToolNameMapping {
41
41
  * @param tools - Tools that were passed to the language model.
42
42
  * @param providerToolNames - Maps the provider tool ids to the provider tool names.
43
43
  */
44
- declare function createToolNameMapping({ tools, providerToolNames, }: {
44
+ declare function createToolNameMapping({ tools, providerToolNames, resolveProviderToolName, }: {
45
45
  /**
46
46
  * Tools that were passed to the language model.
47
47
  */
@@ -50,6 +50,11 @@ declare function createToolNameMapping({ tools, providerToolNames, }: {
50
50
  * Maps the provider tool ids to the provider tool names.
51
51
  */
52
52
  providerToolNames: Record<`${string}.${string}`, string>;
53
+ /**
54
+ * Optional resolver for provider tool names that cannot be represented as
55
+ * static id -> name mappings (e.g. dynamic provider names).
56
+ */
57
+ resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
53
58
  }): ToolNameMapping;
54
59
 
55
60
  /**
@@ -139,11 +144,17 @@ declare function convertToFormData<T extends Record<string, unknown>>(input: T,
139
144
  * Download a file from a URL and return it as a Blob.
140
145
  *
141
146
  * @param url - The URL to download from.
147
+ * @param options - Optional settings for the download.
148
+ * @param options.maxBytes - Maximum allowed download size in bytes. Defaults to 100 MiB.
149
+ * @param options.abortSignal - An optional abort signal to cancel the download.
142
150
  * @returns A Promise that resolves to the downloaded Blob.
143
151
  *
144
- * @throws DownloadError if the download fails.
152
+ * @throws DownloadError if the download fails or exceeds maxBytes.
145
153
  */
146
- declare function downloadBlob(url: string): Promise<Blob>;
154
+ declare function downloadBlob(url: string, options?: {
155
+ maxBytes?: number;
156
+ abortSignal?: AbortSignal;
157
+ }): Promise<Blob>;
147
158
 
148
159
  declare const symbol: unique symbol;
149
160
  declare class DownloadError extends AISDKError {
@@ -161,6 +172,37 @@ declare class DownloadError extends AISDKError {
161
172
  static isInstance(error: unknown): error is DownloadError;
162
173
  }
163
174
 
175
+ /**
176
+ * Default maximum download size: 2 GiB.
177
+ *
178
+ * `fetch().arrayBuffer()` has ~2x peak memory overhead (undici buffers the
179
+ * body internally, then creates the JS ArrayBuffer), so very large downloads
180
+ * risk exceeding the default V8 heap limit on 64-bit systems and terminating
181
+ * the process with an out-of-memory error.
182
+ *
183
+ * Setting this limit converts an unrecoverable OOM crash into a catchable
184
+ * `DownloadError`.
185
+ */
186
+ declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
187
+ /**
188
+ * Reads a fetch Response body with a size limit to prevent memory exhaustion.
189
+ *
190
+ * Checks the Content-Length header for early rejection, then reads the body
191
+ * incrementally via ReadableStream and aborts with a DownloadError when the
192
+ * limit is exceeded.
193
+ *
194
+ * @param response - The fetch Response to read.
195
+ * @param url - The URL being downloaded (used in error messages).
196
+ * @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
197
+ * @returns A Uint8Array containing the response body.
198
+ * @throws DownloadError if the response exceeds maxBytes.
199
+ */
200
+ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
201
+ response: Response;
202
+ url: string;
203
+ maxBytes?: number;
204
+ }): Promise<Uint8Array>;
205
+
164
206
  /**
165
207
  * Fetch function type (standardizes the version of fetch used).
166
208
  */
@@ -1369,4 +1411,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
1369
1411
  */
1370
1412
  type ToolCallOptions = ToolExecutionOptions;
1371
1413
 
1372
- export { type AssistantContent, type AssistantModelMessage, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1414
+ export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.d.ts CHANGED
@@ -41,7 +41,7 @@ interface ToolNameMapping {
41
41
  * @param tools - Tools that were passed to the language model.
42
42
  * @param providerToolNames - Maps the provider tool ids to the provider tool names.
43
43
  */
44
- declare function createToolNameMapping({ tools, providerToolNames, }: {
44
+ declare function createToolNameMapping({ tools, providerToolNames, resolveProviderToolName, }: {
45
45
  /**
46
46
  * Tools that were passed to the language model.
47
47
  */
@@ -50,6 +50,11 @@ declare function createToolNameMapping({ tools, providerToolNames, }: {
50
50
  * Maps the provider tool ids to the provider tool names.
51
51
  */
52
52
  providerToolNames: Record<`${string}.${string}`, string>;
53
+ /**
54
+ * Optional resolver for provider tool names that cannot be represented as
55
+ * static id -> name mappings (e.g. dynamic provider names).
56
+ */
57
+ resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
53
58
  }): ToolNameMapping;
54
59
 
55
60
  /**
@@ -139,11 +144,17 @@ declare function convertToFormData<T extends Record<string, unknown>>(input: T,
139
144
  * Download a file from a URL and return it as a Blob.
140
145
  *
141
146
  * @param url - The URL to download from.
147
+ * @param options - Optional settings for the download.
148
+ * @param options.maxBytes - Maximum allowed download size in bytes. Defaults to 100 MiB.
149
+ * @param options.abortSignal - An optional abort signal to cancel the download.
142
150
  * @returns A Promise that resolves to the downloaded Blob.
143
151
  *
144
- * @throws DownloadError if the download fails.
152
+ * @throws DownloadError if the download fails or exceeds maxBytes.
145
153
  */
146
- declare function downloadBlob(url: string): Promise<Blob>;
154
+ declare function downloadBlob(url: string, options?: {
155
+ maxBytes?: number;
156
+ abortSignal?: AbortSignal;
157
+ }): Promise<Blob>;
147
158
 
148
159
  declare const symbol: unique symbol;
149
160
  declare class DownloadError extends AISDKError {
@@ -161,6 +172,37 @@ declare class DownloadError extends AISDKError {
161
172
  static isInstance(error: unknown): error is DownloadError;
162
173
  }
163
174
 
175
+ /**
176
+ * Default maximum download size: 2 GiB.
177
+ *
178
+ * `fetch().arrayBuffer()` has ~2x peak memory overhead (undici buffers the
179
+ * body internally, then creates the JS ArrayBuffer), so very large downloads
180
+ * risk exceeding the default V8 heap limit on 64-bit systems and terminating
181
+ * the process with an out-of-memory error.
182
+ *
183
+ * Setting this limit converts an unrecoverable OOM crash into a catchable
184
+ * `DownloadError`.
185
+ */
186
+ declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
187
+ /**
188
+ * Reads a fetch Response body with a size limit to prevent memory exhaustion.
189
+ *
190
+ * Checks the Content-Length header for early rejection, then reads the body
191
+ * incrementally via ReadableStream and aborts with a DownloadError when the
192
+ * limit is exceeded.
193
+ *
194
+ * @param response - The fetch Response to read.
195
+ * @param url - The URL being downloaded (used in error messages).
196
+ * @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
197
+ * @returns A Uint8Array containing the response body.
198
+ * @throws DownloadError if the response exceeds maxBytes.
199
+ */
200
+ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
201
+ response: Response;
202
+ url: string;
203
+ maxBytes?: number;
204
+ }): Promise<Uint8Array>;
205
+
164
206
  /**
165
207
  * Fetch function type (standardizes the version of fetch used).
166
208
  */
@@ -1369,4 +1411,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
1369
1411
  */
1370
1412
  type ToolCallOptions = ToolExecutionOptions;
1371
1413
 
1372
- export { type AssistantContent, type AssistantModelMessage, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1414
+ export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ DEFAULT_MAX_DOWNLOAD_SIZE: () => DEFAULT_MAX_DOWNLOAD_SIZE,
33
34
  DelayedPromise: () => DelayedPromise,
34
35
  DownloadError: () => DownloadError,
35
36
  EventSourceParserStream: () => import_stream2.EventSourceParserStream,
@@ -78,6 +79,7 @@ __export(src_exports, {
78
79
  postFormDataToApi: () => postFormDataToApi,
79
80
  postJsonToApi: () => postJsonToApi,
80
81
  postToApi: () => postToApi,
82
+ readResponseWithSizeLimit: () => readResponseWithSizeLimit,
81
83
  removeUndefinedEntries: () => removeUndefinedEntries,
82
84
  resolve: () => resolve,
83
85
  safeParseJSON: () => safeParseJSON,
@@ -142,25 +144,30 @@ function convertAsyncIteratorToReadableStream(iterator) {
142
144
  // src/create-tool-name-mapping.ts
143
145
  function createToolNameMapping({
144
146
  tools = [],
145
- providerToolNames
147
+ providerToolNames,
148
+ resolveProviderToolName
146
149
  }) {
150
+ var _a2;
147
151
  const customToolNameToProviderToolName = {};
148
152
  const providerToolNameToCustomToolName = {};
149
153
  for (const tool2 of tools) {
150
- if (tool2.type === "provider" && tool2.id in providerToolNames) {
151
- const providerToolName = providerToolNames[tool2.id];
154
+ if (tool2.type === "provider") {
155
+ const providerToolName = (_a2 = resolveProviderToolName == null ? void 0 : resolveProviderToolName(tool2)) != null ? _a2 : tool2.id in providerToolNames ? providerToolNames[tool2.id] : void 0;
156
+ if (providerToolName == null) {
157
+ continue;
158
+ }
152
159
  customToolNameToProviderToolName[tool2.name] = providerToolName;
153
160
  providerToolNameToCustomToolName[providerToolName] = tool2.name;
154
161
  }
155
162
  }
156
163
  return {
157
164
  toProviderToolName: (customToolName) => {
158
- var _a2;
159
- return (_a2 = customToolNameToProviderToolName[customToolName]) != null ? _a2 : customToolName;
165
+ var _a3;
166
+ return (_a3 = customToolNameToProviderToolName[customToolName]) != null ? _a3 : customToolName;
160
167
  },
161
168
  toCustomToolName: (providerToolName) => {
162
- var _a2;
163
- return (_a2 = providerToolNameToCustomToolName[providerToolName]) != null ? _a2 : providerToolName;
169
+ var _a3;
170
+ return (_a3 = providerToolNameToCustomToolName[providerToolName]) != null ? _a3 : providerToolName;
164
171
  }
165
172
  };
166
173
  }
@@ -320,10 +327,68 @@ var DownloadError = class extends (_b = import_provider.AISDKError, _a = symbol,
320
327
  }
321
328
  };
322
329
 
330
+ // src/read-response-with-size-limit.ts
331
+ var DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
332
+ async function readResponseWithSizeLimit({
333
+ response,
334
+ url,
335
+ maxBytes = DEFAULT_MAX_DOWNLOAD_SIZE
336
+ }) {
337
+ const contentLength = response.headers.get("content-length");
338
+ if (contentLength != null) {
339
+ const length = parseInt(contentLength, 10);
340
+ if (!isNaN(length) && length > maxBytes) {
341
+ throw new DownloadError({
342
+ url,
343
+ message: `Download of ${url} exceeded maximum size of ${maxBytes} bytes (Content-Length: ${length}).`
344
+ });
345
+ }
346
+ }
347
+ const body = response.body;
348
+ if (body == null) {
349
+ return new Uint8Array(0);
350
+ }
351
+ const reader = body.getReader();
352
+ const chunks = [];
353
+ let totalBytes = 0;
354
+ try {
355
+ while (true) {
356
+ const { done, value } = await reader.read();
357
+ if (done) {
358
+ break;
359
+ }
360
+ totalBytes += value.length;
361
+ if (totalBytes > maxBytes) {
362
+ throw new DownloadError({
363
+ url,
364
+ message: `Download of ${url} exceeded maximum size of ${maxBytes} bytes.`
365
+ });
366
+ }
367
+ chunks.push(value);
368
+ }
369
+ } finally {
370
+ try {
371
+ await reader.cancel();
372
+ } finally {
373
+ reader.releaseLock();
374
+ }
375
+ }
376
+ const result = new Uint8Array(totalBytes);
377
+ let offset = 0;
378
+ for (const chunk of chunks) {
379
+ result.set(chunk, offset);
380
+ offset += chunk.length;
381
+ }
382
+ return result;
383
+ }
384
+
323
385
  // src/download-blob.ts
324
- async function downloadBlob(url) {
386
+ async function downloadBlob(url, options) {
387
+ var _a2, _b2;
325
388
  try {
326
- const response = await fetch(url);
389
+ const response = await fetch(url, {
390
+ signal: options == null ? void 0 : options.abortSignal
391
+ });
327
392
  if (!response.ok) {
328
393
  throw new DownloadError({
329
394
  url,
@@ -331,7 +396,13 @@ async function downloadBlob(url) {
331
396
  statusText: response.statusText
332
397
  });
333
398
  }
334
- return await response.blob();
399
+ const data = await readResponseWithSizeLimit({
400
+ response,
401
+ url,
402
+ maxBytes: (_a2 = options == null ? void 0 : options.maxBytes) != null ? _a2 : DEFAULT_MAX_DOWNLOAD_SIZE
403
+ });
404
+ const contentType = (_b2 = response.headers.get("content-type")) != null ? _b2 : void 0;
405
+ return new Blob([data], contentType ? { type: contentType } : void 0);
335
406
  } catch (error) {
336
407
  if (DownloadError.isInstance(error)) {
337
408
  throw error;
@@ -502,7 +573,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
502
573
  }
503
574
 
504
575
  // src/version.ts
505
- var VERSION = true ? "4.0.14" : "0.0.0-test";
576
+ var VERSION = true ? "4.0.16" : "0.0.0-test";
506
577
 
507
578
  // src/get-from-api.ts
508
579
  var getOriginalFetch = () => globalThis.fetch;
@@ -2603,6 +2674,7 @@ async function* executeTool({
2603
2674
  var import_stream2 = require("eventsource-parser/stream");
2604
2675
  // Annotate the CommonJS export names for ESM import in node:
2605
2676
  0 && (module.exports = {
2677
+ DEFAULT_MAX_DOWNLOAD_SIZE,
2606
2678
  DelayedPromise,
2607
2679
  DownloadError,
2608
2680
  EventSourceParserStream,
@@ -2651,6 +2723,7 @@ var import_stream2 = require("eventsource-parser/stream");
2651
2723
  postFormDataToApi,
2652
2724
  postJsonToApi,
2653
2725
  postToApi,
2726
+ readResponseWithSizeLimit,
2654
2727
  removeUndefinedEntries,
2655
2728
  resolve,
2656
2729
  safeParseJSON,