@ai-sdk/provider-utils 3.0.21 → 3.0.23
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 +14 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +112 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -7
- package/dist/index.mjs.map +1 -1
- package/dist/test/index.js +3 -3
- package/package.json +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 3.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a27a978: fix: allow inline data URLs in download validation
|
|
8
|
+
|
|
9
|
+
## 3.0.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 6a2f01b: Add URL validation to `download` to prevent blind SSRF attacks. Private/internal IP addresses, localhost, and non-HTTP protocols are now rejected before fetching.
|
|
14
|
+
- 17d64e3: fix(provider-utils): prevent unicode escape bypass in secureJsonParse
|
|
15
|
+
|
|
3
16
|
## 3.0.21
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
6
19
|
|
|
7
20
|
- 20565b8: security: prevent unbounded memory growth in download functions
|
|
8
21
|
|
|
9
|
-
The `download()`
|
|
22
|
+
The `download()` function now enforces 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.
|
|
10
23
|
|
|
11
24
|
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.
|
|
12
25
|
|
package/dist/index.d.mts
CHANGED
|
@@ -872,6 +872,15 @@ declare function convertBase64ToUint8Array(base64String: string): Uint8Array<Arr
|
|
|
872
872
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
|
873
873
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
874
874
|
|
|
875
|
+
/**
|
|
876
|
+
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
877
|
+
* to prevent SSRF attacks.
|
|
878
|
+
*
|
|
879
|
+
* @param url - The URL string to validate.
|
|
880
|
+
* @throws DownloadError if the URL is unsafe.
|
|
881
|
+
*/
|
|
882
|
+
declare function validateDownloadUrl(url: string): void;
|
|
883
|
+
|
|
875
884
|
/**
|
|
876
885
|
* Validates the types of an unknown object using a schema and
|
|
877
886
|
* return a strongly-typed object.
|
|
@@ -1004,4 +1013,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1004
1013
|
dynamic?: boolean;
|
|
1005
1014
|
}
|
|
1006
1015
|
|
|
1007
|
-
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isParsableJson, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
|
1016
|
+
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isParsableJson, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateDownloadUrl, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -872,6 +872,15 @@ declare function convertBase64ToUint8Array(base64String: string): Uint8Array<Arr
|
|
|
872
872
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
|
873
873
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
874
874
|
|
|
875
|
+
/**
|
|
876
|
+
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
877
|
+
* to prevent SSRF attacks.
|
|
878
|
+
*
|
|
879
|
+
* @param url - The URL string to validate.
|
|
880
|
+
* @throws DownloadError if the URL is unsafe.
|
|
881
|
+
*/
|
|
882
|
+
declare function validateDownloadUrl(url: string): void;
|
|
883
|
+
|
|
875
884
|
/**
|
|
876
885
|
* Validates the types of an unknown object using a schema and
|
|
877
886
|
* return a strongly-typed object.
|
|
@@ -1004,4 +1013,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1004
1013
|
dynamic?: boolean;
|
|
1005
1014
|
}
|
|
1006
1015
|
|
|
1007
|
-
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isParsableJson, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
|
1016
|
+
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isParsableJson, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateDownloadUrl, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.js
CHANGED
|
@@ -29,8 +29,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
|
|
31
31
|
// src/index.ts
|
|
32
|
-
var
|
|
33
|
-
__export(
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
34
|
DEFAULT_MAX_DOWNLOAD_SIZE: () => DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
35
35
|
DelayedPromise: () => DelayedPromise,
|
|
36
36
|
DownloadError: () => DownloadError,
|
|
@@ -86,13 +86,14 @@ __export(src_exports, {
|
|
|
86
86
|
safeValidateTypes: () => safeValidateTypes,
|
|
87
87
|
standardSchemaValidator: () => standardSchemaValidator,
|
|
88
88
|
tool: () => tool,
|
|
89
|
+
validateDownloadUrl: () => validateDownloadUrl,
|
|
89
90
|
validateTypes: () => validateTypes,
|
|
90
91
|
validator: () => validator,
|
|
91
92
|
withUserAgentSuffix: () => withUserAgentSuffix,
|
|
92
93
|
withoutTrailingSlash: () => withoutTrailingSlash,
|
|
93
94
|
zodSchema: () => zodSchema
|
|
94
95
|
});
|
|
95
|
-
module.exports = __toCommonJS(
|
|
96
|
+
module.exports = __toCommonJS(index_exports);
|
|
96
97
|
|
|
97
98
|
// src/combine-headers.ts
|
|
98
99
|
function combineHeaders(...headers) {
|
|
@@ -439,7 +440,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
// src/version.ts
|
|
442
|
-
var VERSION = true ? "3.0.
|
|
443
|
+
var VERSION = true ? "3.0.23" : "0.0.0-test";
|
|
443
444
|
|
|
444
445
|
// src/get-from-api.ts
|
|
445
446
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -669,8 +670,8 @@ function mediaTypeToExtension(mediaType) {
|
|
|
669
670
|
var import_provider9 = require("@ai-sdk/provider");
|
|
670
671
|
|
|
671
672
|
// src/secure-json-parse.ts
|
|
672
|
-
var suspectProtoRx = /"
|
|
673
|
-
var suspectConstructorRx = /"
|
|
673
|
+
var suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
674
|
+
var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
674
675
|
function _parse(text) {
|
|
675
676
|
const obj = JSON.parse(text);
|
|
676
677
|
if (obj === null || typeof obj !== "object") {
|
|
@@ -690,7 +691,7 @@ function filter(obj) {
|
|
|
690
691
|
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
691
692
|
throw new SyntaxError("Object contains forbidden prototype property");
|
|
692
693
|
}
|
|
693
|
-
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
694
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
694
695
|
throw new SyntaxError("Object contains forbidden prototype property");
|
|
695
696
|
}
|
|
696
697
|
for (const key in node) {
|
|
@@ -722,7 +723,7 @@ var import_provider8 = require("@ai-sdk/provider");
|
|
|
722
723
|
|
|
723
724
|
// src/validator.ts
|
|
724
725
|
var import_provider7 = require("@ai-sdk/provider");
|
|
725
|
-
var validatorSymbol = Symbol.for("vercel.ai.validator");
|
|
726
|
+
var validatorSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.validator");
|
|
726
727
|
function validator(validate) {
|
|
727
728
|
return { [validatorSymbol]: true, validate };
|
|
728
729
|
}
|
|
@@ -1280,7 +1281,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
1280
1281
|
};
|
|
1281
1282
|
|
|
1282
1283
|
// src/zod-to-json-schema/options.ts
|
|
1283
|
-
var ignoreOverride = Symbol(
|
|
1284
|
+
var ignoreOverride = /* @__PURE__ */ Symbol(
|
|
1284
1285
|
"Let zodToJsonSchema decide on which parser to use"
|
|
1285
1286
|
);
|
|
1286
1287
|
var defaultOptions = {
|
|
@@ -2500,7 +2501,7 @@ function zodSchema(zodSchema2, options) {
|
|
|
2500
2501
|
}
|
|
2501
2502
|
|
|
2502
2503
|
// src/schema.ts
|
|
2503
|
-
var schemaSymbol = Symbol.for("vercel.ai.schema");
|
|
2504
|
+
var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
|
|
2504
2505
|
function lazySchema(createSchema) {
|
|
2505
2506
|
let schema;
|
|
2506
2507
|
return () => {
|
|
@@ -2555,6 +2556,105 @@ function convertToBase64(value) {
|
|
|
2555
2556
|
return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
|
|
2556
2557
|
}
|
|
2557
2558
|
|
|
2559
|
+
// src/validate-download-url.ts
|
|
2560
|
+
function validateDownloadUrl(url) {
|
|
2561
|
+
let parsed;
|
|
2562
|
+
try {
|
|
2563
|
+
parsed = new URL(url);
|
|
2564
|
+
} catch (e) {
|
|
2565
|
+
throw new DownloadError({
|
|
2566
|
+
url,
|
|
2567
|
+
message: `Invalid URL: ${url}`
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
if (parsed.protocol === "data:") {
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2573
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
2574
|
+
throw new DownloadError({
|
|
2575
|
+
url,
|
|
2576
|
+
message: `URL scheme must be http, https, or data, got ${parsed.protocol}`
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
const hostname = parsed.hostname;
|
|
2580
|
+
if (!hostname) {
|
|
2581
|
+
throw new DownloadError({
|
|
2582
|
+
url,
|
|
2583
|
+
message: `URL must have a hostname`
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost")) {
|
|
2587
|
+
throw new DownloadError({
|
|
2588
|
+
url,
|
|
2589
|
+
message: `URL with hostname ${hostname} is not allowed`
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
if (hostname.startsWith("[") && hostname.endsWith("]")) {
|
|
2593
|
+
const ipv6 = hostname.slice(1, -1);
|
|
2594
|
+
if (isPrivateIPv6(ipv6)) {
|
|
2595
|
+
throw new DownloadError({
|
|
2596
|
+
url,
|
|
2597
|
+
message: `URL with IPv6 address ${hostname} is not allowed`
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
return;
|
|
2601
|
+
}
|
|
2602
|
+
if (isIPv4(hostname)) {
|
|
2603
|
+
if (isPrivateIPv4(hostname)) {
|
|
2604
|
+
throw new DownloadError({
|
|
2605
|
+
url,
|
|
2606
|
+
message: `URL with IP address ${hostname} is not allowed`
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
return;
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
function isIPv4(hostname) {
|
|
2613
|
+
const parts = hostname.split(".");
|
|
2614
|
+
if (parts.length !== 4) return false;
|
|
2615
|
+
return parts.every((part) => {
|
|
2616
|
+
const num = Number(part);
|
|
2617
|
+
return Number.isInteger(num) && num >= 0 && num <= 255 && String(num) === part;
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2620
|
+
function isPrivateIPv4(ip) {
|
|
2621
|
+
const parts = ip.split(".").map(Number);
|
|
2622
|
+
const [a, b] = parts;
|
|
2623
|
+
if (a === 0) return true;
|
|
2624
|
+
if (a === 10) return true;
|
|
2625
|
+
if (a === 127) return true;
|
|
2626
|
+
if (a === 169 && b === 254) return true;
|
|
2627
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
2628
|
+
if (a === 192 && b === 168) return true;
|
|
2629
|
+
return false;
|
|
2630
|
+
}
|
|
2631
|
+
function isPrivateIPv6(ip) {
|
|
2632
|
+
const normalized = ip.toLowerCase();
|
|
2633
|
+
if (normalized === "::1") return true;
|
|
2634
|
+
if (normalized === "::") return true;
|
|
2635
|
+
if (normalized.startsWith("::ffff:")) {
|
|
2636
|
+
const mappedPart = normalized.slice(7);
|
|
2637
|
+
if (isIPv4(mappedPart)) {
|
|
2638
|
+
return isPrivateIPv4(mappedPart);
|
|
2639
|
+
}
|
|
2640
|
+
const hexParts = mappedPart.split(":");
|
|
2641
|
+
if (hexParts.length === 2) {
|
|
2642
|
+
const high = parseInt(hexParts[0], 16);
|
|
2643
|
+
const low = parseInt(hexParts[1], 16);
|
|
2644
|
+
if (!isNaN(high) && !isNaN(low)) {
|
|
2645
|
+
const a = high >> 8 & 255;
|
|
2646
|
+
const b = high & 255;
|
|
2647
|
+
const c = low >> 8 & 255;
|
|
2648
|
+
const d = low & 255;
|
|
2649
|
+
return isPrivateIPv4(`${a}.${b}.${c}.${d}`);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
if (normalized.startsWith("fc") || normalized.startsWith("fd")) return true;
|
|
2654
|
+
if (normalized.startsWith("fe80")) return true;
|
|
2655
|
+
return false;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2558
2658
|
// src/without-trailing-slash.ts
|
|
2559
2659
|
function withoutTrailingSlash(url) {
|
|
2560
2660
|
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
@@ -2585,7 +2685,7 @@ async function* executeTool({
|
|
|
2585
2685
|
}
|
|
2586
2686
|
|
|
2587
2687
|
// src/index.ts
|
|
2588
|
-
__reExport(
|
|
2688
|
+
__reExport(index_exports, require("@standard-schema/spec"), module.exports);
|
|
2589
2689
|
var import_stream2 = require("eventsource-parser/stream");
|
|
2590
2690
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2591
2691
|
0 && (module.exports = {
|
|
@@ -2644,6 +2744,7 @@ var import_stream2 = require("eventsource-parser/stream");
|
|
|
2644
2744
|
safeValidateTypes,
|
|
2645
2745
|
standardSchemaValidator,
|
|
2646
2746
|
tool,
|
|
2747
|
+
validateDownloadUrl,
|
|
2647
2748
|
validateTypes,
|
|
2648
2749
|
validator,
|
|
2649
2750
|
withUserAgentSuffix,
|