@wix/ditto-codegen-public 1.0.255 → 1.0.257
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/out.js +893 -442
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -72,7 +72,7 @@ var require_package = __commonJS({
|
|
|
72
72
|
"../../node_modules/dotenv/package.json"(exports2, module2) {
|
|
73
73
|
module2.exports = {
|
|
74
74
|
name: "dotenv",
|
|
75
|
-
version: "17.
|
|
75
|
+
version: "17.3.1",
|
|
76
76
|
description: "Loads environment variables from .env file",
|
|
77
77
|
main: "lib/main.js",
|
|
78
78
|
types: "lib/main.d.ts",
|
|
@@ -148,12 +148,9 @@ var require_main = __commonJS({
|
|
|
148
148
|
"\u{1F510} encrypt with Dotenvx: https://dotenvx.com",
|
|
149
149
|
"\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit",
|
|
150
150
|
"\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild",
|
|
151
|
-
"\u{
|
|
152
|
-
"\
|
|
153
|
-
"\u{
|
|
154
|
-
"\u2705 audit secrets and track compliance: https://dotenvx.com/ops",
|
|
155
|
-
"\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops",
|
|
156
|
-
"\u{1F511} add access controls to secrets: https://dotenvx.com/ops",
|
|
151
|
+
"\u{1F916} agentic secret storage: https://dotenvx.com/as2",
|
|
152
|
+
"\u26A1\uFE0F secrets for agents: https://dotenvx.com/as2",
|
|
153
|
+
"\u{1F6E1}\uFE0F auth for agents: https://vestauth.com",
|
|
157
154
|
"\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`",
|
|
158
155
|
"\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }",
|
|
159
156
|
"\u2699\uFE0F enable debug logging with { debug: true }",
|
|
@@ -13576,7 +13573,7 @@ var require_versions = __commonJS({
|
|
|
13576
13573
|
exports2.version = {
|
|
13577
13574
|
major: 4,
|
|
13578
13575
|
minor: 3,
|
|
13579
|
-
patch:
|
|
13576
|
+
patch: 6
|
|
13580
13577
|
};
|
|
13581
13578
|
}
|
|
13582
13579
|
});
|
|
@@ -14916,7 +14913,7 @@ var require_schemas = __commonJS({
|
|
|
14916
14913
|
if (keyResult instanceof Promise) {
|
|
14917
14914
|
throw new Error("Async schemas not supported in object keys currently");
|
|
14918
14915
|
}
|
|
14919
|
-
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length
|
|
14916
|
+
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
|
|
14920
14917
|
if (checkNumericKey) {
|
|
14921
14918
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
14922
14919
|
if (retryResult instanceof Promise) {
|
|
@@ -24513,7 +24510,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24513
24510
|
}
|
|
24514
24511
|
}
|
|
24515
24512
|
}
|
|
24516
|
-
if (refSchema.$ref) {
|
|
24513
|
+
if (refSchema.$ref && refSeen.def) {
|
|
24517
24514
|
for (const key in schema2) {
|
|
24518
24515
|
if (key === "$ref" || key === "allOf")
|
|
24519
24516
|
continue;
|
|
@@ -31973,8 +31970,8 @@ var require_dist8 = __commonJS({
|
|
|
31973
31970
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
31974
31971
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
31975
31972
|
var __export2 = (target, all) => {
|
|
31976
|
-
for (var
|
|
31977
|
-
__defProp2(target,
|
|
31973
|
+
for (var name2 in all)
|
|
31974
|
+
__defProp2(target, name2, { get: all[name2], enumerable: true });
|
|
31978
31975
|
};
|
|
31979
31976
|
var __copyProps2 = (to, from, except, desc) => {
|
|
31980
31977
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -31996,7 +31993,9 @@ var require_dist8 = __commonJS({
|
|
|
31996
31993
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
31997
31994
|
var src_exports = {};
|
|
31998
31995
|
__export2(src_exports, {
|
|
31996
|
+
DEFAULT_MAX_DOWNLOAD_SIZE: () => DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
31999
31997
|
DelayedPromise: () => DelayedPromise,
|
|
31998
|
+
DownloadError: () => DownloadError,
|
|
32000
31999
|
EventSourceParserStream: () => import_stream2.EventSourceParserStream,
|
|
32001
32000
|
VERSION: () => VERSION2,
|
|
32002
32001
|
asSchema: () => asSchema2,
|
|
@@ -32042,6 +32041,7 @@ var require_dist8 = __commonJS({
|
|
|
32042
32041
|
postFormDataToApi: () => postFormDataToApi,
|
|
32043
32042
|
postJsonToApi: () => postJsonToApi,
|
|
32044
32043
|
postToApi: () => postToApi,
|
|
32044
|
+
readResponseWithSizeLimit: () => readResponseWithSizeLimit,
|
|
32045
32045
|
removeUndefinedEntries: () => removeUndefinedEntries,
|
|
32046
32046
|
resolve: () => resolve3,
|
|
32047
32047
|
safeParseJSON: () => safeParseJSON,
|
|
@@ -32150,17 +32150,17 @@ var require_dist8 = __commonJS({
|
|
|
32150
32150
|
return this._promise;
|
|
32151
32151
|
}
|
|
32152
32152
|
resolve(value) {
|
|
32153
|
-
var
|
|
32153
|
+
var _a22;
|
|
32154
32154
|
this.status = { type: "resolved", value };
|
|
32155
32155
|
if (this._promise) {
|
|
32156
|
-
(
|
|
32156
|
+
(_a22 = this._resolve) == null ? void 0 : _a22.call(this, value);
|
|
32157
32157
|
}
|
|
32158
32158
|
}
|
|
32159
32159
|
reject(error48) {
|
|
32160
|
-
var
|
|
32160
|
+
var _a22;
|
|
32161
32161
|
this.status = { type: "rejected", error: error48 };
|
|
32162
32162
|
if (this._promise) {
|
|
32163
|
-
(
|
|
32163
|
+
(_a22 = this._reject) == null ? void 0 : _a22.call(this, error48);
|
|
32164
32164
|
}
|
|
32165
32165
|
}
|
|
32166
32166
|
isResolved() {
|
|
@@ -32177,6 +32177,83 @@ var require_dist8 = __commonJS({
|
|
|
32177
32177
|
return Object.fromEntries([...response.headers]);
|
|
32178
32178
|
}
|
|
32179
32179
|
var import_provider = require_dist5();
|
|
32180
|
+
var name = "AI_DownloadError";
|
|
32181
|
+
var marker = `vercel.ai.error.${name}`;
|
|
32182
|
+
var symbol2 = Symbol.for(marker);
|
|
32183
|
+
var _a2;
|
|
32184
|
+
var _b;
|
|
32185
|
+
var DownloadError = class extends (_b = import_provider.AISDKError, _a2 = symbol2, _b) {
|
|
32186
|
+
constructor({
|
|
32187
|
+
url: url2,
|
|
32188
|
+
statusCode,
|
|
32189
|
+
statusText,
|
|
32190
|
+
cause,
|
|
32191
|
+
message = cause == null ? `Failed to download ${url2}: ${statusCode} ${statusText}` : `Failed to download ${url2}: ${cause}`
|
|
32192
|
+
}) {
|
|
32193
|
+
super({ name, message, cause });
|
|
32194
|
+
this[_a2] = true;
|
|
32195
|
+
this.url = url2;
|
|
32196
|
+
this.statusCode = statusCode;
|
|
32197
|
+
this.statusText = statusText;
|
|
32198
|
+
}
|
|
32199
|
+
static isInstance(error48) {
|
|
32200
|
+
return import_provider.AISDKError.hasMarker(error48, marker);
|
|
32201
|
+
}
|
|
32202
|
+
};
|
|
32203
|
+
var DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
|
|
32204
|
+
async function readResponseWithSizeLimit({
|
|
32205
|
+
response,
|
|
32206
|
+
url: url2,
|
|
32207
|
+
maxBytes = DEFAULT_MAX_DOWNLOAD_SIZE
|
|
32208
|
+
}) {
|
|
32209
|
+
const contentLength = response.headers.get("content-length");
|
|
32210
|
+
if (contentLength != null) {
|
|
32211
|
+
const length = parseInt(contentLength, 10);
|
|
32212
|
+
if (!isNaN(length) && length > maxBytes) {
|
|
32213
|
+
throw new DownloadError({
|
|
32214
|
+
url: url2,
|
|
32215
|
+
message: `Download of ${url2} exceeded maximum size of ${maxBytes} bytes (Content-Length: ${length}).`
|
|
32216
|
+
});
|
|
32217
|
+
}
|
|
32218
|
+
}
|
|
32219
|
+
const body = response.body;
|
|
32220
|
+
if (body == null) {
|
|
32221
|
+
return new Uint8Array(0);
|
|
32222
|
+
}
|
|
32223
|
+
const reader = body.getReader();
|
|
32224
|
+
const chunks = [];
|
|
32225
|
+
let totalBytes = 0;
|
|
32226
|
+
try {
|
|
32227
|
+
while (true) {
|
|
32228
|
+
const { done, value } = await reader.read();
|
|
32229
|
+
if (done) {
|
|
32230
|
+
break;
|
|
32231
|
+
}
|
|
32232
|
+
totalBytes += value.length;
|
|
32233
|
+
if (totalBytes > maxBytes) {
|
|
32234
|
+
throw new DownloadError({
|
|
32235
|
+
url: url2,
|
|
32236
|
+
message: `Download of ${url2} exceeded maximum size of ${maxBytes} bytes.`
|
|
32237
|
+
});
|
|
32238
|
+
}
|
|
32239
|
+
chunks.push(value);
|
|
32240
|
+
}
|
|
32241
|
+
} finally {
|
|
32242
|
+
try {
|
|
32243
|
+
await reader.cancel();
|
|
32244
|
+
} finally {
|
|
32245
|
+
reader.releaseLock();
|
|
32246
|
+
}
|
|
32247
|
+
}
|
|
32248
|
+
const result = new Uint8Array(totalBytes);
|
|
32249
|
+
let offset = 0;
|
|
32250
|
+
for (const chunk of chunks) {
|
|
32251
|
+
result.set(chunk, offset);
|
|
32252
|
+
offset += chunk.length;
|
|
32253
|
+
}
|
|
32254
|
+
return result;
|
|
32255
|
+
}
|
|
32256
|
+
var import_provider2 = require_dist5();
|
|
32180
32257
|
var createIdGenerator2 = ({
|
|
32181
32258
|
prefix,
|
|
32182
32259
|
size = 16,
|
|
@@ -32195,7 +32272,7 @@ var require_dist8 = __commonJS({
|
|
|
32195
32272
|
return generator;
|
|
32196
32273
|
}
|
|
32197
32274
|
if (alphabet.includes(separator)) {
|
|
32198
|
-
throw new
|
|
32275
|
+
throw new import_provider2.InvalidArgumentError({
|
|
32199
32276
|
argument: "separator",
|
|
32200
32277
|
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
32201
32278
|
});
|
|
@@ -32215,8 +32292,8 @@ var require_dist8 = __commonJS({
|
|
|
32215
32292
|
}
|
|
32216
32293
|
return JSON.stringify(error48);
|
|
32217
32294
|
}
|
|
32295
|
+
var import_provider4 = require_dist5();
|
|
32218
32296
|
var import_provider3 = require_dist5();
|
|
32219
|
-
var import_provider2 = require_dist5();
|
|
32220
32297
|
function isAbortError2(error48) {
|
|
32221
32298
|
return (error48 instanceof Error || error48 instanceof DOMException) && (error48.name === "AbortError" || error48.name === "ResponseAborted" || // Next.js
|
|
32222
32299
|
error48.name === "TimeoutError");
|
|
@@ -32233,7 +32310,7 @@ var require_dist8 = __commonJS({
|
|
|
32233
32310
|
if (error48 instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error48.message.toLowerCase())) {
|
|
32234
32311
|
const cause = error48.cause;
|
|
32235
32312
|
if (cause != null) {
|
|
32236
|
-
return new
|
|
32313
|
+
return new import_provider3.APICallError({
|
|
32237
32314
|
message: `Cannot connect to API: ${cause.message}`,
|
|
32238
32315
|
cause,
|
|
32239
32316
|
url: url2,
|
|
@@ -32246,14 +32323,14 @@ var require_dist8 = __commonJS({
|
|
|
32246
32323
|
return error48;
|
|
32247
32324
|
}
|
|
32248
32325
|
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
32249
|
-
var
|
|
32326
|
+
var _a22, _b2, _c;
|
|
32250
32327
|
if (globalThisAny.window) {
|
|
32251
32328
|
return `runtime/browser`;
|
|
32252
32329
|
}
|
|
32253
|
-
if ((
|
|
32330
|
+
if ((_a22 = globalThisAny.navigator) == null ? void 0 : _a22.userAgent) {
|
|
32254
32331
|
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
32255
32332
|
}
|
|
32256
|
-
if ((_c = (
|
|
32333
|
+
if ((_c = (_b2 = globalThisAny.process) == null ? void 0 : _b2.versions) == null ? void 0 : _c.node) {
|
|
32257
32334
|
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
32258
32335
|
}
|
|
32259
32336
|
if (globalThisAny.EdgeRuntime) {
|
|
@@ -32291,7 +32368,7 @@ var require_dist8 = __commonJS({
|
|
|
32291
32368
|
);
|
|
32292
32369
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
32293
32370
|
}
|
|
32294
|
-
var VERSION2 = true ? "3.0.
|
|
32371
|
+
var VERSION2 = true ? "3.0.21" : "0.0.0-test";
|
|
32295
32372
|
var getOriginalFetch = () => globalThis.fetch;
|
|
32296
32373
|
var getFromApi = async ({
|
|
32297
32374
|
url: url2,
|
|
@@ -32321,10 +32398,10 @@ var require_dist8 = __commonJS({
|
|
|
32321
32398
|
requestBodyValues: {}
|
|
32322
32399
|
});
|
|
32323
32400
|
} catch (error48) {
|
|
32324
|
-
if (isAbortError2(error48) ||
|
|
32401
|
+
if (isAbortError2(error48) || import_provider4.APICallError.isInstance(error48)) {
|
|
32325
32402
|
throw error48;
|
|
32326
32403
|
}
|
|
32327
|
-
throw new
|
|
32404
|
+
throw new import_provider4.APICallError({
|
|
32328
32405
|
message: "Failed to process error response",
|
|
32329
32406
|
cause: error48,
|
|
32330
32407
|
statusCode: response.status,
|
|
@@ -32343,11 +32420,11 @@ var require_dist8 = __commonJS({
|
|
|
32343
32420
|
});
|
|
32344
32421
|
} catch (error48) {
|
|
32345
32422
|
if (error48 instanceof Error) {
|
|
32346
|
-
if (isAbortError2(error48) ||
|
|
32423
|
+
if (isAbortError2(error48) || import_provider4.APICallError.isInstance(error48)) {
|
|
32347
32424
|
throw error48;
|
|
32348
32425
|
}
|
|
32349
32426
|
}
|
|
32350
|
-
throw new
|
|
32427
|
+
throw new import_provider4.APICallError({
|
|
32351
32428
|
message: "Failed to process successful response",
|
|
32352
32429
|
cause: error48,
|
|
32353
32430
|
statusCode: response.status,
|
|
@@ -32384,8 +32461,8 @@ var require_dist8 = __commonJS({
|
|
|
32384
32461
|
schemaPrefix,
|
|
32385
32462
|
schemaSuffix
|
|
32386
32463
|
}) {
|
|
32387
|
-
var
|
|
32388
|
-
const systemMessage = ((
|
|
32464
|
+
var _a22, _b2;
|
|
32465
|
+
const systemMessage = ((_a22 = messages[0]) == null ? void 0 : _a22.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
|
|
32389
32466
|
systemMessage.content = injectJsonInstruction({
|
|
32390
32467
|
prompt: systemMessage.content,
|
|
32391
32468
|
schema,
|
|
@@ -32394,7 +32471,7 @@ var require_dist8 = __commonJS({
|
|
|
32394
32471
|
});
|
|
32395
32472
|
return [
|
|
32396
32473
|
systemMessage,
|
|
32397
|
-
...((
|
|
32474
|
+
...((_b2 = messages[0]) == null ? void 0 : _b2.role) === "system" ? messages.slice(1) : messages
|
|
32398
32475
|
];
|
|
32399
32476
|
}
|
|
32400
32477
|
function isUrlSupported({
|
|
@@ -32409,7 +32486,7 @@ var require_dist8 = __commonJS({
|
|
|
32409
32486
|
return mediaType2 === "*" || mediaType2 === "*/*" ? { mediaTypePrefix: "", regexes: value } : { mediaTypePrefix: mediaType2.replace(/\*/, ""), regexes: value };
|
|
32410
32487
|
}).filter(({ mediaTypePrefix }) => mediaType.startsWith(mediaTypePrefix)).flatMap(({ regexes }) => regexes).some((pattern) => pattern.test(url2));
|
|
32411
32488
|
}
|
|
32412
|
-
var
|
|
32489
|
+
var import_provider5 = require_dist5();
|
|
32413
32490
|
function loadApiKey({
|
|
32414
32491
|
apiKey,
|
|
32415
32492
|
environmentVariableName,
|
|
@@ -32420,23 +32497,23 @@ var require_dist8 = __commonJS({
|
|
|
32420
32497
|
return apiKey;
|
|
32421
32498
|
}
|
|
32422
32499
|
if (apiKey != null) {
|
|
32423
|
-
throw new
|
|
32500
|
+
throw new import_provider5.LoadAPIKeyError({
|
|
32424
32501
|
message: `${description} API key must be a string.`
|
|
32425
32502
|
});
|
|
32426
32503
|
}
|
|
32427
32504
|
if (typeof process === "undefined") {
|
|
32428
|
-
throw new
|
|
32505
|
+
throw new import_provider5.LoadAPIKeyError({
|
|
32429
32506
|
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
|
|
32430
32507
|
});
|
|
32431
32508
|
}
|
|
32432
32509
|
apiKey = process.env[environmentVariableName];
|
|
32433
32510
|
if (apiKey == null) {
|
|
32434
|
-
throw new
|
|
32511
|
+
throw new import_provider5.LoadAPIKeyError({
|
|
32435
32512
|
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
|
|
32436
32513
|
});
|
|
32437
32514
|
}
|
|
32438
32515
|
if (typeof apiKey !== "string") {
|
|
32439
|
-
throw new
|
|
32516
|
+
throw new import_provider5.LoadAPIKeyError({
|
|
32440
32517
|
message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
32441
32518
|
});
|
|
32442
32519
|
}
|
|
@@ -32458,7 +32535,7 @@ var require_dist8 = __commonJS({
|
|
|
32458
32535
|
}
|
|
32459
32536
|
return settingValue;
|
|
32460
32537
|
}
|
|
32461
|
-
var
|
|
32538
|
+
var import_provider6 = require_dist5();
|
|
32462
32539
|
function loadSetting({
|
|
32463
32540
|
settingValue,
|
|
32464
32541
|
environmentVariableName,
|
|
@@ -32469,40 +32546,40 @@ var require_dist8 = __commonJS({
|
|
|
32469
32546
|
return settingValue;
|
|
32470
32547
|
}
|
|
32471
32548
|
if (settingValue != null) {
|
|
32472
|
-
throw new
|
|
32549
|
+
throw new import_provider6.LoadSettingError({
|
|
32473
32550
|
message: `${description} setting must be a string.`
|
|
32474
32551
|
});
|
|
32475
32552
|
}
|
|
32476
32553
|
if (typeof process === "undefined") {
|
|
32477
|
-
throw new
|
|
32554
|
+
throw new import_provider6.LoadSettingError({
|
|
32478
32555
|
message: `${description} setting is missing. Pass it using the '${settingName}' parameter. Environment variables is not supported in this environment.`
|
|
32479
32556
|
});
|
|
32480
32557
|
}
|
|
32481
32558
|
settingValue = process.env[environmentVariableName];
|
|
32482
32559
|
if (settingValue == null) {
|
|
32483
|
-
throw new
|
|
32560
|
+
throw new import_provider6.LoadSettingError({
|
|
32484
32561
|
message: `${description} setting is missing. Pass it using the '${settingName}' parameter or the ${environmentVariableName} environment variable.`
|
|
32485
32562
|
});
|
|
32486
32563
|
}
|
|
32487
32564
|
if (typeof settingValue !== "string") {
|
|
32488
|
-
throw new
|
|
32565
|
+
throw new import_provider6.LoadSettingError({
|
|
32489
32566
|
message: `${description} setting must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
32490
32567
|
});
|
|
32491
32568
|
}
|
|
32492
32569
|
return settingValue;
|
|
32493
32570
|
}
|
|
32494
32571
|
function mediaTypeToExtension(mediaType) {
|
|
32495
|
-
var
|
|
32572
|
+
var _a22;
|
|
32496
32573
|
const [_type, subtype = ""] = mediaType.toLowerCase().split("/");
|
|
32497
|
-
return (
|
|
32574
|
+
return (_a22 = {
|
|
32498
32575
|
mpeg: "mp3",
|
|
32499
32576
|
"x-wav": "wav",
|
|
32500
32577
|
opus: "ogg",
|
|
32501
32578
|
mp4: "m4a",
|
|
32502
32579
|
"x-m4a": "m4a"
|
|
32503
|
-
}[subtype]) != null ?
|
|
32580
|
+
}[subtype]) != null ? _a22 : subtype;
|
|
32504
32581
|
}
|
|
32505
|
-
var
|
|
32582
|
+
var import_provider9 = require_dist5();
|
|
32506
32583
|
var suspectProtoRx = /"__proto__"\s*:/;
|
|
32507
32584
|
var suspectConstructorRx = /"constructor"\s*:/;
|
|
32508
32585
|
function _parse2(text) {
|
|
@@ -32550,8 +32627,8 @@ var require_dist8 = __commonJS({
|
|
|
32550
32627
|
Error.stackTraceLimit = stackTraceLimit;
|
|
32551
32628
|
}
|
|
32552
32629
|
}
|
|
32630
|
+
var import_provider8 = require_dist5();
|
|
32553
32631
|
var import_provider7 = require_dist5();
|
|
32554
|
-
var import_provider6 = require_dist5();
|
|
32555
32632
|
var validatorSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.validator");
|
|
32556
32633
|
function validator(validate2) {
|
|
32557
32634
|
return { [validatorSymbol]: true, validate: validate2 };
|
|
@@ -32576,7 +32653,7 @@ var require_dist8 = __commonJS({
|
|
|
32576
32653
|
const result = await standardSchema["~standard"].validate(value);
|
|
32577
32654
|
return result.issues == null ? { success: true, value: result.value } : {
|
|
32578
32655
|
success: false,
|
|
32579
|
-
error: new
|
|
32656
|
+
error: new import_provider7.TypeValidationError({
|
|
32580
32657
|
value,
|
|
32581
32658
|
cause: result.issues
|
|
32582
32659
|
})
|
|
@@ -32589,7 +32666,7 @@ var require_dist8 = __commonJS({
|
|
|
32589
32666
|
}) {
|
|
32590
32667
|
const result = await safeValidateTypes({ value, schema });
|
|
32591
32668
|
if (!result.success) {
|
|
32592
|
-
throw
|
|
32669
|
+
throw import_provider8.TypeValidationError.wrap({ value, cause: result.error });
|
|
32593
32670
|
}
|
|
32594
32671
|
return result.value;
|
|
32595
32672
|
}
|
|
@@ -32608,13 +32685,13 @@ var require_dist8 = __commonJS({
|
|
|
32608
32685
|
}
|
|
32609
32686
|
return {
|
|
32610
32687
|
success: false,
|
|
32611
|
-
error:
|
|
32688
|
+
error: import_provider8.TypeValidationError.wrap({ value, cause: result.error }),
|
|
32612
32689
|
rawValue: value
|
|
32613
32690
|
};
|
|
32614
32691
|
} catch (error48) {
|
|
32615
32692
|
return {
|
|
32616
32693
|
success: false,
|
|
32617
|
-
error:
|
|
32694
|
+
error: import_provider8.TypeValidationError.wrap({ value, cause: error48 }),
|
|
32618
32695
|
rawValue: value
|
|
32619
32696
|
};
|
|
32620
32697
|
}
|
|
@@ -32630,10 +32707,10 @@ var require_dist8 = __commonJS({
|
|
|
32630
32707
|
}
|
|
32631
32708
|
return validateTypes({ value, schema });
|
|
32632
32709
|
} catch (error48) {
|
|
32633
|
-
if (
|
|
32710
|
+
if (import_provider9.JSONParseError.isInstance(error48) || import_provider9.TypeValidationError.isInstance(error48)) {
|
|
32634
32711
|
throw error48;
|
|
32635
32712
|
}
|
|
32636
|
-
throw new
|
|
32713
|
+
throw new import_provider9.JSONParseError({ text, cause: error48 });
|
|
32637
32714
|
}
|
|
32638
32715
|
}
|
|
32639
32716
|
async function safeParseJSON({
|
|
@@ -32649,7 +32726,7 @@ var require_dist8 = __commonJS({
|
|
|
32649
32726
|
} catch (error48) {
|
|
32650
32727
|
return {
|
|
32651
32728
|
success: false,
|
|
32652
|
-
error:
|
|
32729
|
+
error: import_provider9.JSONParseError.isInstance(error48) ? error48 : new import_provider9.JSONParseError({ text, cause: error48 }),
|
|
32653
32730
|
rawValue: void 0
|
|
32654
32731
|
};
|
|
32655
32732
|
}
|
|
@@ -32678,7 +32755,7 @@ var require_dist8 = __commonJS({
|
|
|
32678
32755
|
})
|
|
32679
32756
|
);
|
|
32680
32757
|
}
|
|
32681
|
-
var
|
|
32758
|
+
var import_provider10 = require_dist5();
|
|
32682
32759
|
async function parseProviderOptions({
|
|
32683
32760
|
provider,
|
|
32684
32761
|
providerOptions,
|
|
@@ -32692,7 +32769,7 @@ var require_dist8 = __commonJS({
|
|
|
32692
32769
|
schema
|
|
32693
32770
|
});
|
|
32694
32771
|
if (!parsedProviderOptions.success) {
|
|
32695
|
-
throw new
|
|
32772
|
+
throw new import_provider10.InvalidArgumentError({
|
|
32696
32773
|
argument: "providerOptions",
|
|
32697
32774
|
message: `invalid ${provider} provider options`,
|
|
32698
32775
|
cause: parsedProviderOptions.error
|
|
@@ -32700,7 +32777,7 @@ var require_dist8 = __commonJS({
|
|
|
32700
32777
|
}
|
|
32701
32778
|
return parsedProviderOptions.value;
|
|
32702
32779
|
}
|
|
32703
|
-
var
|
|
32780
|
+
var import_provider11 = require_dist5();
|
|
32704
32781
|
var getOriginalFetch2 = () => globalThis.fetch;
|
|
32705
32782
|
var postJsonToApi = async ({
|
|
32706
32783
|
url: url2,
|
|
@@ -32775,10 +32852,10 @@ var require_dist8 = __commonJS({
|
|
|
32775
32852
|
requestBodyValues: body.values
|
|
32776
32853
|
});
|
|
32777
32854
|
} catch (error48) {
|
|
32778
|
-
if (isAbortError2(error48) ||
|
|
32855
|
+
if (isAbortError2(error48) || import_provider11.APICallError.isInstance(error48)) {
|
|
32779
32856
|
throw error48;
|
|
32780
32857
|
}
|
|
32781
|
-
throw new
|
|
32858
|
+
throw new import_provider11.APICallError({
|
|
32782
32859
|
message: "Failed to process error response",
|
|
32783
32860
|
cause: error48,
|
|
32784
32861
|
statusCode: response.status,
|
|
@@ -32797,11 +32874,11 @@ var require_dist8 = __commonJS({
|
|
|
32797
32874
|
});
|
|
32798
32875
|
} catch (error48) {
|
|
32799
32876
|
if (error48 instanceof Error) {
|
|
32800
|
-
if (isAbortError2(error48) ||
|
|
32877
|
+
if (isAbortError2(error48) || import_provider11.APICallError.isInstance(error48)) {
|
|
32801
32878
|
throw error48;
|
|
32802
32879
|
}
|
|
32803
32880
|
}
|
|
32804
|
-
throw new
|
|
32881
|
+
throw new import_provider11.APICallError({
|
|
32805
32882
|
message: "Failed to process successful response",
|
|
32806
32883
|
cause: error48,
|
|
32807
32884
|
statusCode: response.status,
|
|
@@ -32822,7 +32899,7 @@ var require_dist8 = __commonJS({
|
|
|
32822
32899
|
}
|
|
32823
32900
|
function createProviderDefinedToolFactory({
|
|
32824
32901
|
id,
|
|
32825
|
-
name,
|
|
32902
|
+
name: name2,
|
|
32826
32903
|
inputSchema
|
|
32827
32904
|
}) {
|
|
32828
32905
|
return ({
|
|
@@ -32836,7 +32913,7 @@ var require_dist8 = __commonJS({
|
|
|
32836
32913
|
}) => tool2({
|
|
32837
32914
|
type: "provider-defined",
|
|
32838
32915
|
id,
|
|
32839
|
-
name,
|
|
32916
|
+
name: name2,
|
|
32840
32917
|
args,
|
|
32841
32918
|
inputSchema,
|
|
32842
32919
|
outputSchema,
|
|
@@ -32849,7 +32926,7 @@ var require_dist8 = __commonJS({
|
|
|
32849
32926
|
}
|
|
32850
32927
|
function createProviderDefinedToolFactoryWithOutputSchema({
|
|
32851
32928
|
id,
|
|
32852
|
-
name,
|
|
32929
|
+
name: name2,
|
|
32853
32930
|
inputSchema,
|
|
32854
32931
|
outputSchema
|
|
32855
32932
|
}) {
|
|
@@ -32863,7 +32940,7 @@ var require_dist8 = __commonJS({
|
|
|
32863
32940
|
}) => tool2({
|
|
32864
32941
|
type: "provider-defined",
|
|
32865
32942
|
id,
|
|
32866
|
-
name,
|
|
32943
|
+
name: name2,
|
|
32867
32944
|
args,
|
|
32868
32945
|
inputSchema,
|
|
32869
32946
|
outputSchema,
|
|
@@ -32885,7 +32962,7 @@ var require_dist8 = __commonJS({
|
|
|
32885
32962
|
}
|
|
32886
32963
|
return Promise.resolve(value);
|
|
32887
32964
|
}
|
|
32888
|
-
var
|
|
32965
|
+
var import_provider12 = require_dist5();
|
|
32889
32966
|
var createJsonErrorResponseHandler = ({
|
|
32890
32967
|
errorSchema,
|
|
32891
32968
|
errorToMessage,
|
|
@@ -32896,7 +32973,7 @@ var require_dist8 = __commonJS({
|
|
|
32896
32973
|
if (responseBody.trim() === "") {
|
|
32897
32974
|
return {
|
|
32898
32975
|
responseHeaders,
|
|
32899
|
-
value: new
|
|
32976
|
+
value: new import_provider12.APICallError({
|
|
32900
32977
|
message: response.statusText,
|
|
32901
32978
|
url: url2,
|
|
32902
32979
|
requestBodyValues,
|
|
@@ -32914,7 +32991,7 @@ var require_dist8 = __commonJS({
|
|
|
32914
32991
|
});
|
|
32915
32992
|
return {
|
|
32916
32993
|
responseHeaders,
|
|
32917
|
-
value: new
|
|
32994
|
+
value: new import_provider12.APICallError({
|
|
32918
32995
|
message: errorToMessage(parsedError),
|
|
32919
32996
|
url: url2,
|
|
32920
32997
|
requestBodyValues,
|
|
@@ -32928,7 +33005,7 @@ var require_dist8 = __commonJS({
|
|
|
32928
33005
|
} catch (parseError) {
|
|
32929
33006
|
return {
|
|
32930
33007
|
responseHeaders,
|
|
32931
|
-
value: new
|
|
33008
|
+
value: new import_provider12.APICallError({
|
|
32932
33009
|
message: response.statusText,
|
|
32933
33010
|
url: url2,
|
|
32934
33011
|
requestBodyValues,
|
|
@@ -32943,7 +33020,7 @@ var require_dist8 = __commonJS({
|
|
|
32943
33020
|
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
32944
33021
|
const responseHeaders = extractResponseHeaders(response);
|
|
32945
33022
|
if (response.body == null) {
|
|
32946
|
-
throw new
|
|
33023
|
+
throw new import_provider12.EmptyResponseBodyError({});
|
|
32947
33024
|
}
|
|
32948
33025
|
return {
|
|
32949
33026
|
responseHeaders,
|
|
@@ -32956,7 +33033,7 @@ var require_dist8 = __commonJS({
|
|
|
32956
33033
|
var createJsonStreamResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
32957
33034
|
const responseHeaders = extractResponseHeaders(response);
|
|
32958
33035
|
if (response.body == null) {
|
|
32959
|
-
throw new
|
|
33036
|
+
throw new import_provider12.EmptyResponseBodyError({});
|
|
32960
33037
|
}
|
|
32961
33038
|
let buffer = "";
|
|
32962
33039
|
return {
|
|
@@ -32988,7 +33065,7 @@ var require_dist8 = __commonJS({
|
|
|
32988
33065
|
});
|
|
32989
33066
|
const responseHeaders = extractResponseHeaders(response);
|
|
32990
33067
|
if (!parsedResult.success) {
|
|
32991
|
-
throw new
|
|
33068
|
+
throw new import_provider12.APICallError({
|
|
32992
33069
|
message: "Invalid JSON response",
|
|
32993
33070
|
cause: parsedResult.error,
|
|
32994
33071
|
statusCode: response.status,
|
|
@@ -33007,7 +33084,7 @@ var require_dist8 = __commonJS({
|
|
|
33007
33084
|
var createBinaryResponseHandler = () => async ({ response, url: url2, requestBodyValues }) => {
|
|
33008
33085
|
const responseHeaders = extractResponseHeaders(response);
|
|
33009
33086
|
if (!response.body) {
|
|
33010
|
-
throw new
|
|
33087
|
+
throw new import_provider12.APICallError({
|
|
33011
33088
|
message: "Response body is empty",
|
|
33012
33089
|
url: url2,
|
|
33013
33090
|
requestBodyValues,
|
|
@@ -33023,7 +33100,7 @@ var require_dist8 = __commonJS({
|
|
|
33023
33100
|
value: new Uint8Array(buffer)
|
|
33024
33101
|
};
|
|
33025
33102
|
} catch (error48) {
|
|
33026
|
-
throw new
|
|
33103
|
+
throw new import_provider12.APICallError({
|
|
33027
33104
|
message: "Failed to read response as array buffer",
|
|
33028
33105
|
url: url2,
|
|
33029
33106
|
requestBodyValues,
|
|
@@ -33039,7 +33116,7 @@ var require_dist8 = __commonJS({
|
|
|
33039
33116
|
const responseBody = await response.text();
|
|
33040
33117
|
return {
|
|
33041
33118
|
responseHeaders,
|
|
33042
|
-
value: new
|
|
33119
|
+
value: new import_provider12.APICallError({
|
|
33043
33120
|
message: response.statusText,
|
|
33044
33121
|
url: url2,
|
|
33045
33122
|
requestBodyValues,
|
|
@@ -33119,11 +33196,11 @@ var require_dist8 = __commonJS({
|
|
|
33119
33196
|
}
|
|
33120
33197
|
var import_v32 = require_v3();
|
|
33121
33198
|
function parseArrayDef(def, refs) {
|
|
33122
|
-
var
|
|
33199
|
+
var _a22, _b2, _c;
|
|
33123
33200
|
const res = {
|
|
33124
33201
|
type: "array"
|
|
33125
33202
|
};
|
|
33126
|
-
if (((
|
|
33203
|
+
if (((_a22 = def.type) == null ? void 0 : _a22._def) && ((_c = (_b2 = def.type) == null ? void 0 : _b2._def) == null ? void 0 : _c.typeName) !== import_v32.ZodFirstPartyTypeKind.ZodAny) {
|
|
33127
33204
|
res.items = parseDef(def.type._def, {
|
|
33128
33205
|
...refs,
|
|
33129
33206
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -33490,8 +33567,8 @@ var require_dist8 = __commonJS({
|
|
|
33490
33567
|
return result;
|
|
33491
33568
|
}
|
|
33492
33569
|
function addFormat(schema, value, message, refs) {
|
|
33493
|
-
var
|
|
33494
|
-
if (schema.format || ((
|
|
33570
|
+
var _a22;
|
|
33571
|
+
if (schema.format || ((_a22 = schema.anyOf) == null ? void 0 : _a22.some((x) => x.format))) {
|
|
33495
33572
|
if (!schema.anyOf) {
|
|
33496
33573
|
schema.anyOf = [];
|
|
33497
33574
|
}
|
|
@@ -33510,8 +33587,8 @@ var require_dist8 = __commonJS({
|
|
|
33510
33587
|
}
|
|
33511
33588
|
}
|
|
33512
33589
|
function addPattern(schema, regex, message, refs) {
|
|
33513
|
-
var
|
|
33514
|
-
if (schema.pattern || ((
|
|
33590
|
+
var _a22;
|
|
33591
|
+
if (schema.pattern || ((_a22 = schema.allOf) == null ? void 0 : _a22.some((x) => x.pattern))) {
|
|
33515
33592
|
if (!schema.allOf) {
|
|
33516
33593
|
schema.allOf = [];
|
|
33517
33594
|
}
|
|
@@ -33530,7 +33607,7 @@ var require_dist8 = __commonJS({
|
|
|
33530
33607
|
}
|
|
33531
33608
|
}
|
|
33532
33609
|
function stringifyRegExpWithFlags(regex, refs) {
|
|
33533
|
-
var
|
|
33610
|
+
var _a22;
|
|
33534
33611
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
33535
33612
|
return regex.source;
|
|
33536
33613
|
}
|
|
@@ -33560,7 +33637,7 @@ var require_dist8 = __commonJS({
|
|
|
33560
33637
|
pattern += source[i];
|
|
33561
33638
|
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
33562
33639
|
inCharRange = false;
|
|
33563
|
-
} else if (source[i + 1] === "-" && ((
|
|
33640
|
+
} else if (source[i + 1] === "-" && ((_a22 = source[i + 2]) == null ? void 0 : _a22.match(/[a-z]/))) {
|
|
33564
33641
|
pattern += source[i];
|
|
33565
33642
|
inCharRange = true;
|
|
33566
33643
|
} else {
|
|
@@ -33612,15 +33689,15 @@ var require_dist8 = __commonJS({
|
|
|
33612
33689
|
return pattern;
|
|
33613
33690
|
}
|
|
33614
33691
|
function parseRecordDef(def, refs) {
|
|
33615
|
-
var
|
|
33692
|
+
var _a22, _b2, _c, _d, _e, _f;
|
|
33616
33693
|
const schema = {
|
|
33617
33694
|
type: "object",
|
|
33618
|
-
additionalProperties: (
|
|
33695
|
+
additionalProperties: (_a22 = parseDef(def.valueType._def, {
|
|
33619
33696
|
...refs,
|
|
33620
33697
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
33621
|
-
})) != null ?
|
|
33698
|
+
})) != null ? _a22 : refs.allowedAdditionalProperties
|
|
33622
33699
|
};
|
|
33623
|
-
if (((
|
|
33700
|
+
if (((_b2 = def.keyType) == null ? void 0 : _b2._def.typeName) === import_v322.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
33624
33701
|
const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
33625
33702
|
return {
|
|
33626
33703
|
...schema,
|
|
@@ -33875,8 +33952,8 @@ var require_dist8 = __commonJS({
|
|
|
33875
33952
|
}
|
|
33876
33953
|
}
|
|
33877
33954
|
var parseOptionalDef = (def, refs) => {
|
|
33878
|
-
var
|
|
33879
|
-
if (refs.currentPath.toString() === ((
|
|
33955
|
+
var _a22;
|
|
33956
|
+
if (refs.currentPath.toString() === ((_a22 = refs.propertyPath) == null ? void 0 : _a22.toString())) {
|
|
33880
33957
|
return parseDef(def.innerType._def, refs);
|
|
33881
33958
|
}
|
|
33882
33959
|
const innerSchema = parseDef(def.innerType._def, {
|
|
@@ -34046,10 +34123,10 @@ var require_dist8 = __commonJS({
|
|
|
34046
34123
|
}
|
|
34047
34124
|
};
|
|
34048
34125
|
function parseDef(def, refs, forceResolution = false) {
|
|
34049
|
-
var
|
|
34126
|
+
var _a22;
|
|
34050
34127
|
const seenItem = refs.seen.get(def);
|
|
34051
34128
|
if (refs.override) {
|
|
34052
|
-
const overrideResult = (
|
|
34129
|
+
const overrideResult = (_a22 = refs.override) == null ? void 0 : _a22.call(
|
|
34053
34130
|
refs,
|
|
34054
34131
|
def,
|
|
34055
34132
|
refs,
|
|
@@ -34115,11 +34192,11 @@ var require_dist8 = __commonJS({
|
|
|
34115
34192
|
currentPath,
|
|
34116
34193
|
propertyPath: void 0,
|
|
34117
34194
|
seen: new Map(
|
|
34118
|
-
Object.entries(_options.definitions).map(([
|
|
34195
|
+
Object.entries(_options.definitions).map(([name2, def]) => [
|
|
34119
34196
|
def._def,
|
|
34120
34197
|
{
|
|
34121
34198
|
def: def._def,
|
|
34122
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
34199
|
+
path: [..._options.basePath, _options.definitionPath, name2],
|
|
34123
34200
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
34124
34201
|
jsonSchema: void 0
|
|
34125
34202
|
}
|
|
@@ -34128,50 +34205,50 @@ var require_dist8 = __commonJS({
|
|
|
34128
34205
|
};
|
|
34129
34206
|
};
|
|
34130
34207
|
var zodToJsonSchema = (schema, options) => {
|
|
34131
|
-
var
|
|
34208
|
+
var _a22;
|
|
34132
34209
|
const refs = getRefs(options);
|
|
34133
34210
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
34134
|
-
(acc, [
|
|
34135
|
-
var
|
|
34211
|
+
(acc, [name3, schema2]) => {
|
|
34212
|
+
var _a3;
|
|
34136
34213
|
return {
|
|
34137
34214
|
...acc,
|
|
34138
|
-
[
|
|
34215
|
+
[name3]: (_a3 = parseDef(
|
|
34139
34216
|
schema2._def,
|
|
34140
34217
|
{
|
|
34141
34218
|
...refs,
|
|
34142
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
34219
|
+
currentPath: [...refs.basePath, refs.definitionPath, name3]
|
|
34143
34220
|
},
|
|
34144
34221
|
true
|
|
34145
|
-
)) != null ?
|
|
34222
|
+
)) != null ? _a3 : parseAnyDef()
|
|
34146
34223
|
};
|
|
34147
34224
|
},
|
|
34148
34225
|
{}
|
|
34149
34226
|
) : void 0;
|
|
34150
|
-
const
|
|
34151
|
-
const main2 = (
|
|
34227
|
+
const name2 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
34228
|
+
const main2 = (_a22 = parseDef(
|
|
34152
34229
|
schema._def,
|
|
34153
|
-
|
|
34230
|
+
name2 === void 0 ? refs : {
|
|
34154
34231
|
...refs,
|
|
34155
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
34232
|
+
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
34156
34233
|
},
|
|
34157
34234
|
false
|
|
34158
|
-
)) != null ?
|
|
34235
|
+
)) != null ? _a22 : parseAnyDef();
|
|
34159
34236
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
34160
34237
|
if (title !== void 0) {
|
|
34161
34238
|
main2.title = title;
|
|
34162
34239
|
}
|
|
34163
|
-
const combined =
|
|
34240
|
+
const combined = name2 === void 0 ? definitions ? {
|
|
34164
34241
|
...main2,
|
|
34165
34242
|
[refs.definitionPath]: definitions
|
|
34166
34243
|
} : main2 : {
|
|
34167
34244
|
$ref: [
|
|
34168
34245
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
34169
34246
|
refs.definitionPath,
|
|
34170
|
-
|
|
34247
|
+
name2
|
|
34171
34248
|
].join("/"),
|
|
34172
34249
|
[refs.definitionPath]: {
|
|
34173
34250
|
...definitions,
|
|
34174
|
-
[
|
|
34251
|
+
[name2]: main2
|
|
34175
34252
|
}
|
|
34176
34253
|
};
|
|
34177
34254
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -34179,8 +34256,8 @@ var require_dist8 = __commonJS({
|
|
|
34179
34256
|
};
|
|
34180
34257
|
var zod_to_json_schema_default = zodToJsonSchema;
|
|
34181
34258
|
function zod3Schema(zodSchema22, options) {
|
|
34182
|
-
var
|
|
34183
|
-
const useReferences = (
|
|
34259
|
+
var _a22;
|
|
34260
|
+
const useReferences = (_a22 = options == null ? void 0 : options.useReferences) != null ? _a22 : false;
|
|
34184
34261
|
return jsonSchema2(
|
|
34185
34262
|
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
34186
34263
|
() => zod_to_json_schema_default(zodSchema22, {
|
|
@@ -34195,8 +34272,8 @@ var require_dist8 = __commonJS({
|
|
|
34195
34272
|
);
|
|
34196
34273
|
}
|
|
34197
34274
|
function zod4Schema(zodSchema22, options) {
|
|
34198
|
-
var
|
|
34199
|
-
const useReferences = (
|
|
34275
|
+
var _a22;
|
|
34276
|
+
const useReferences = (_a22 = options == null ? void 0 : options.useReferences) != null ? _a22 : false;
|
|
34200
34277
|
return jsonSchema2(
|
|
34201
34278
|
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
34202
34279
|
() => addAdditionalPropertiesToJsonSchema(
|
|
@@ -34480,7 +34557,7 @@ var require_token_io = __commonJS({
|
|
|
34480
34557
|
"Token refresh only supported in node server environments"
|
|
34481
34558
|
);
|
|
34482
34559
|
}
|
|
34483
|
-
|
|
34560
|
+
return null;
|
|
34484
34561
|
}
|
|
34485
34562
|
function getUserDataDir() {
|
|
34486
34563
|
if (process.env.XDG_DATA_HOME) {
|
|
@@ -34503,6 +34580,179 @@ var require_token_io = __commonJS({
|
|
|
34503
34580
|
}
|
|
34504
34581
|
});
|
|
34505
34582
|
|
|
34583
|
+
// ../../node_modules/@vercel/oidc/dist/auth-config.js
|
|
34584
|
+
var require_auth_config = __commonJS({
|
|
34585
|
+
"../../node_modules/@vercel/oidc/dist/auth-config.js"(exports2, module2) {
|
|
34586
|
+
"use strict";
|
|
34587
|
+
var __create2 = Object.create;
|
|
34588
|
+
var __defProp2 = Object.defineProperty;
|
|
34589
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
34590
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
34591
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
34592
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
34593
|
+
var __export2 = (target, all) => {
|
|
34594
|
+
for (var name in all)
|
|
34595
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
34596
|
+
};
|
|
34597
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
34598
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34599
|
+
for (let key of __getOwnPropNames2(from))
|
|
34600
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
34601
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
34602
|
+
}
|
|
34603
|
+
return to;
|
|
34604
|
+
};
|
|
34605
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
34606
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
34607
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
34608
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34609
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34610
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
34611
|
+
mod
|
|
34612
|
+
));
|
|
34613
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
34614
|
+
var auth_config_exports = {};
|
|
34615
|
+
__export2(auth_config_exports, {
|
|
34616
|
+
isValidAccessToken: () => isValidAccessToken,
|
|
34617
|
+
readAuthConfig: () => readAuthConfig,
|
|
34618
|
+
writeAuthConfig: () => writeAuthConfig
|
|
34619
|
+
});
|
|
34620
|
+
module2.exports = __toCommonJS2(auth_config_exports);
|
|
34621
|
+
var fs4 = __toESM2(require("fs"));
|
|
34622
|
+
var path4 = __toESM2(require("path"));
|
|
34623
|
+
var import_token_util = require_token_util();
|
|
34624
|
+
function getAuthConfigPath() {
|
|
34625
|
+
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
34626
|
+
if (!dataDir) {
|
|
34627
|
+
throw new Error(
|
|
34628
|
+
`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
|
|
34629
|
+
);
|
|
34630
|
+
}
|
|
34631
|
+
return path4.join(dataDir, "auth.json");
|
|
34632
|
+
}
|
|
34633
|
+
function readAuthConfig() {
|
|
34634
|
+
try {
|
|
34635
|
+
const authPath = getAuthConfigPath();
|
|
34636
|
+
if (!fs4.existsSync(authPath)) {
|
|
34637
|
+
return null;
|
|
34638
|
+
}
|
|
34639
|
+
const content = fs4.readFileSync(authPath, "utf8");
|
|
34640
|
+
if (!content) {
|
|
34641
|
+
return null;
|
|
34642
|
+
}
|
|
34643
|
+
return JSON.parse(content);
|
|
34644
|
+
} catch (error48) {
|
|
34645
|
+
return null;
|
|
34646
|
+
}
|
|
34647
|
+
}
|
|
34648
|
+
function writeAuthConfig(config2) {
|
|
34649
|
+
const authPath = getAuthConfigPath();
|
|
34650
|
+
const authDir = path4.dirname(authPath);
|
|
34651
|
+
if (!fs4.existsSync(authDir)) {
|
|
34652
|
+
fs4.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
34653
|
+
}
|
|
34654
|
+
fs4.writeFileSync(authPath, JSON.stringify(config2, null, 2), { mode: 384 });
|
|
34655
|
+
}
|
|
34656
|
+
function isValidAccessToken(authConfig) {
|
|
34657
|
+
if (!authConfig.token)
|
|
34658
|
+
return false;
|
|
34659
|
+
if (typeof authConfig.expiresAt !== "number")
|
|
34660
|
+
return true;
|
|
34661
|
+
const nowInSeconds = Math.floor(Date.now() / 1e3);
|
|
34662
|
+
return authConfig.expiresAt >= nowInSeconds;
|
|
34663
|
+
}
|
|
34664
|
+
}
|
|
34665
|
+
});
|
|
34666
|
+
|
|
34667
|
+
// ../../node_modules/@vercel/oidc/dist/oauth.js
|
|
34668
|
+
var require_oauth = __commonJS({
|
|
34669
|
+
"../../node_modules/@vercel/oidc/dist/oauth.js"(exports2, module2) {
|
|
34670
|
+
"use strict";
|
|
34671
|
+
var __defProp2 = Object.defineProperty;
|
|
34672
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
34673
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
34674
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
34675
|
+
var __export2 = (target, all) => {
|
|
34676
|
+
for (var name in all)
|
|
34677
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
34678
|
+
};
|
|
34679
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
34680
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34681
|
+
for (let key of __getOwnPropNames2(from))
|
|
34682
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
34683
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
34684
|
+
}
|
|
34685
|
+
return to;
|
|
34686
|
+
};
|
|
34687
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
34688
|
+
var oauth_exports = {};
|
|
34689
|
+
__export2(oauth_exports, {
|
|
34690
|
+
processTokenResponse: () => processTokenResponse,
|
|
34691
|
+
refreshTokenRequest: () => refreshTokenRequest
|
|
34692
|
+
});
|
|
34693
|
+
module2.exports = __toCommonJS2(oauth_exports);
|
|
34694
|
+
var import_os = require("os");
|
|
34695
|
+
var VERCEL_ISSUER = "https://vercel.com";
|
|
34696
|
+
var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
|
|
34697
|
+
var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;
|
|
34698
|
+
var _tokenEndpoint = null;
|
|
34699
|
+
async function getTokenEndpoint() {
|
|
34700
|
+
if (_tokenEndpoint) {
|
|
34701
|
+
return _tokenEndpoint;
|
|
34702
|
+
}
|
|
34703
|
+
const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;
|
|
34704
|
+
const response = await fetch(discoveryUrl, {
|
|
34705
|
+
headers: { "user-agent": userAgent }
|
|
34706
|
+
});
|
|
34707
|
+
if (!response.ok) {
|
|
34708
|
+
throw new Error("Failed to discover OAuth endpoints");
|
|
34709
|
+
}
|
|
34710
|
+
const metadata = await response.json();
|
|
34711
|
+
if (!metadata || typeof metadata.token_endpoint !== "string") {
|
|
34712
|
+
throw new Error("Invalid OAuth discovery response");
|
|
34713
|
+
}
|
|
34714
|
+
const endpoint = metadata.token_endpoint;
|
|
34715
|
+
_tokenEndpoint = endpoint;
|
|
34716
|
+
return endpoint;
|
|
34717
|
+
}
|
|
34718
|
+
async function refreshTokenRequest(options) {
|
|
34719
|
+
const tokenEndpoint = await getTokenEndpoint();
|
|
34720
|
+
return await fetch(tokenEndpoint, {
|
|
34721
|
+
method: "POST",
|
|
34722
|
+
headers: {
|
|
34723
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
34724
|
+
"user-agent": userAgent
|
|
34725
|
+
},
|
|
34726
|
+
body: new URLSearchParams({
|
|
34727
|
+
client_id: VERCEL_CLI_CLIENT_ID,
|
|
34728
|
+
grant_type: "refresh_token",
|
|
34729
|
+
...options
|
|
34730
|
+
})
|
|
34731
|
+
});
|
|
34732
|
+
}
|
|
34733
|
+
async function processTokenResponse(response) {
|
|
34734
|
+
const json2 = await response.json();
|
|
34735
|
+
if (!response.ok) {
|
|
34736
|
+
const errorMsg = typeof json2 === "object" && json2 && "error" in json2 ? String(json2.error) : "Token refresh failed";
|
|
34737
|
+
return [new Error(errorMsg)];
|
|
34738
|
+
}
|
|
34739
|
+
if (typeof json2 !== "object" || json2 === null) {
|
|
34740
|
+
return [new Error("Invalid token response")];
|
|
34741
|
+
}
|
|
34742
|
+
if (typeof json2.access_token !== "string") {
|
|
34743
|
+
return [new Error("Missing access_token in response")];
|
|
34744
|
+
}
|
|
34745
|
+
if (json2.token_type !== "Bearer") {
|
|
34746
|
+
return [new Error("Invalid token_type in response")];
|
|
34747
|
+
}
|
|
34748
|
+
if (typeof json2.expires_in !== "number") {
|
|
34749
|
+
return [new Error("Missing expires_in in response")];
|
|
34750
|
+
}
|
|
34751
|
+
return [null, json2];
|
|
34752
|
+
}
|
|
34753
|
+
}
|
|
34754
|
+
});
|
|
34755
|
+
|
|
34506
34756
|
// ../../node_modules/@vercel/oidc/dist/token-util.js
|
|
34507
34757
|
var require_token_util = __commonJS({
|
|
34508
34758
|
"../../node_modules/@vercel/oidc/dist/token-util.js"(exports2, module2) {
|
|
@@ -34551,6 +34801,8 @@ var require_token_util = __commonJS({
|
|
|
34551
34801
|
var fs4 = __toESM2(require("fs"));
|
|
34552
34802
|
var import_token_error = require_token_error();
|
|
34553
34803
|
var import_token_io = require_token_io();
|
|
34804
|
+
var import_auth_config = require_auth_config();
|
|
34805
|
+
var import_oauth = require_oauth();
|
|
34554
34806
|
function getVercelDataDir() {
|
|
34555
34807
|
const vercelFolder = "com.vercel.cli";
|
|
34556
34808
|
const dataDir = (0, import_token_io.getUserDataDir)();
|
|
@@ -34559,106 +34811,126 @@ var require_token_util = __commonJS({
|
|
|
34559
34811
|
}
|
|
34560
34812
|
return path4.join(dataDir, vercelFolder);
|
|
34561
34813
|
}
|
|
34562
|
-
function getVercelCliToken() {
|
|
34563
|
-
const
|
|
34564
|
-
if (!
|
|
34814
|
+
async function getVercelCliToken() {
|
|
34815
|
+
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
34816
|
+
if (!authConfig) {
|
|
34565
34817
|
return null;
|
|
34566
34818
|
}
|
|
34567
|
-
|
|
34568
|
-
|
|
34819
|
+
if ((0, import_auth_config.isValidAccessToken)(authConfig)) {
|
|
34820
|
+
return authConfig.token || null;
|
|
34821
|
+
}
|
|
34822
|
+
if (!authConfig.refreshToken) {
|
|
34823
|
+
(0, import_auth_config.writeAuthConfig)({});
|
|
34569
34824
|
return null;
|
|
34570
34825
|
}
|
|
34571
|
-
|
|
34572
|
-
|
|
34826
|
+
try {
|
|
34827
|
+
const tokenResponse = await (0, import_oauth.refreshTokenRequest)({
|
|
34828
|
+
refresh_token: authConfig.refreshToken
|
|
34829
|
+
});
|
|
34830
|
+
const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);
|
|
34831
|
+
if (tokensError || !tokens) {
|
|
34832
|
+
(0, import_auth_config.writeAuthConfig)({});
|
|
34833
|
+
return null;
|
|
34834
|
+
}
|
|
34835
|
+
const updatedConfig = {
|
|
34836
|
+
token: tokens.access_token,
|
|
34837
|
+
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
|
|
34838
|
+
};
|
|
34839
|
+
if (tokens.refresh_token) {
|
|
34840
|
+
updatedConfig.refreshToken = tokens.refresh_token;
|
|
34841
|
+
}
|
|
34842
|
+
(0, import_auth_config.writeAuthConfig)(updatedConfig);
|
|
34843
|
+
return updatedConfig.token ?? null;
|
|
34844
|
+
} catch (error48) {
|
|
34845
|
+
(0, import_auth_config.writeAuthConfig)({});
|
|
34573
34846
|
return null;
|
|
34574
34847
|
}
|
|
34575
|
-
return JSON.parse(token).token;
|
|
34576
34848
|
}
|
|
34577
34849
|
async function getVercelOidcToken2(authToken, projectId, teamId) {
|
|
34578
|
-
|
|
34579
|
-
|
|
34580
|
-
|
|
34581
|
-
|
|
34582
|
-
|
|
34583
|
-
Authorization: `Bearer ${authToken}`
|
|
34584
|
-
}
|
|
34585
|
-
});
|
|
34586
|
-
if (!res.ok) {
|
|
34587
|
-
throw new import_token_error.VercelOidcTokenError(
|
|
34588
|
-
`Failed to refresh OIDC token: ${res.statusText}`
|
|
34589
|
-
);
|
|
34850
|
+
const url2 = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : ""}`;
|
|
34851
|
+
const res = await fetch(url2, {
|
|
34852
|
+
method: "POST",
|
|
34853
|
+
headers: {
|
|
34854
|
+
Authorization: `Bearer ${authToken}`
|
|
34590
34855
|
}
|
|
34591
|
-
|
|
34592
|
-
|
|
34593
|
-
|
|
34594
|
-
|
|
34595
|
-
|
|
34856
|
+
});
|
|
34857
|
+
if (!res.ok) {
|
|
34858
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
34859
|
+
`Failed to refresh OIDC token: ${res.statusText}`
|
|
34860
|
+
);
|
|
34596
34861
|
}
|
|
34862
|
+
const tokenRes = await res.json();
|
|
34863
|
+
assertVercelOidcTokenResponse(tokenRes);
|
|
34864
|
+
return tokenRes;
|
|
34597
34865
|
}
|
|
34598
34866
|
function assertVercelOidcTokenResponse(res) {
|
|
34599
34867
|
if (!res || typeof res !== "object") {
|
|
34600
|
-
throw new TypeError(
|
|
34868
|
+
throw new TypeError(
|
|
34869
|
+
"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again"
|
|
34870
|
+
);
|
|
34601
34871
|
}
|
|
34602
34872
|
if (!("token" in res) || typeof res.token !== "string") {
|
|
34603
|
-
throw new TypeError(
|
|
34873
|
+
throw new TypeError(
|
|
34874
|
+
"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again"
|
|
34875
|
+
);
|
|
34604
34876
|
}
|
|
34605
34877
|
}
|
|
34606
34878
|
function findProjectInfo() {
|
|
34607
34879
|
const dir = (0, import_token_io.findRootDir)();
|
|
34608
34880
|
if (!dir) {
|
|
34609
|
-
throw new import_token_error.VercelOidcTokenError(
|
|
34881
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
34882
|
+
"Unable to find project root directory. Have you linked your project with `vc link?`"
|
|
34883
|
+
);
|
|
34610
34884
|
}
|
|
34611
|
-
|
|
34612
|
-
|
|
34613
|
-
|
|
34614
|
-
|
|
34615
|
-
|
|
34616
|
-
|
|
34617
|
-
|
|
34618
|
-
|
|
34619
|
-
|
|
34620
|
-
|
|
34621
|
-
|
|
34622
|
-
throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);
|
|
34885
|
+
const prjPath = path4.join(dir, ".vercel", "project.json");
|
|
34886
|
+
if (!fs4.existsSync(prjPath)) {
|
|
34887
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
34888
|
+
"project.json not found, have you linked your project with `vc link?`"
|
|
34889
|
+
);
|
|
34890
|
+
}
|
|
34891
|
+
const prj = JSON.parse(fs4.readFileSync(prjPath, "utf8"));
|
|
34892
|
+
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
34893
|
+
throw new TypeError(
|
|
34894
|
+
"Expected a string-valued projectId property. Try running `vc link` to re-link your project."
|
|
34895
|
+
);
|
|
34623
34896
|
}
|
|
34897
|
+
return { projectId: prj.projectId, teamId: prj.orgId };
|
|
34624
34898
|
}
|
|
34625
34899
|
function saveToken(token, projectId) {
|
|
34626
|
-
|
|
34627
|
-
|
|
34628
|
-
|
|
34629
|
-
|
|
34630
|
-
|
|
34631
|
-
const tokenPath = path4.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
34632
|
-
const tokenJson = JSON.stringify(token);
|
|
34633
|
-
fs4.mkdirSync(path4.dirname(tokenPath), { mode: 504, recursive: true });
|
|
34634
|
-
fs4.writeFileSync(tokenPath, tokenJson);
|
|
34635
|
-
fs4.chmodSync(tokenPath, 432);
|
|
34636
|
-
return;
|
|
34637
|
-
} catch (e) {
|
|
34638
|
-
throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);
|
|
34900
|
+
const dir = (0, import_token_io.getUserDataDir)();
|
|
34901
|
+
if (!dir) {
|
|
34902
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
34903
|
+
"Unable to find user data directory. Please reach out to Vercel support."
|
|
34904
|
+
);
|
|
34639
34905
|
}
|
|
34906
|
+
const tokenPath = path4.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
34907
|
+
const tokenJson = JSON.stringify(token);
|
|
34908
|
+
fs4.mkdirSync(path4.dirname(tokenPath), { mode: 504, recursive: true });
|
|
34909
|
+
fs4.writeFileSync(tokenPath, tokenJson);
|
|
34910
|
+
fs4.chmodSync(tokenPath, 432);
|
|
34911
|
+
return;
|
|
34640
34912
|
}
|
|
34641
34913
|
function loadToken(projectId) {
|
|
34642
|
-
|
|
34643
|
-
|
|
34644
|
-
|
|
34645
|
-
|
|
34646
|
-
|
|
34647
|
-
|
|
34648
|
-
|
|
34649
|
-
|
|
34650
|
-
|
|
34651
|
-
const token = JSON.parse(fs4.readFileSync(tokenPath, "utf8"));
|
|
34652
|
-
assertVercelOidcTokenResponse(token);
|
|
34653
|
-
return token;
|
|
34654
|
-
} catch (e) {
|
|
34655
|
-
throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);
|
|
34914
|
+
const dir = (0, import_token_io.getUserDataDir)();
|
|
34915
|
+
if (!dir) {
|
|
34916
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
34917
|
+
"Unable to find user data directory. Please reach out to Vercel support."
|
|
34918
|
+
);
|
|
34919
|
+
}
|
|
34920
|
+
const tokenPath = path4.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
34921
|
+
if (!fs4.existsSync(tokenPath)) {
|
|
34922
|
+
return null;
|
|
34656
34923
|
}
|
|
34924
|
+
const token = JSON.parse(fs4.readFileSync(tokenPath, "utf8"));
|
|
34925
|
+
assertVercelOidcTokenResponse(token);
|
|
34926
|
+
return token;
|
|
34657
34927
|
}
|
|
34658
34928
|
function getTokenPayload(token) {
|
|
34659
34929
|
const tokenParts = token.split(".");
|
|
34660
34930
|
if (tokenParts.length !== 3) {
|
|
34661
|
-
throw new import_token_error.VercelOidcTokenError(
|
|
34931
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
34932
|
+
"Invalid token. Please run `vc env pull` and try again"
|
|
34933
|
+
);
|
|
34662
34934
|
}
|
|
34663
34935
|
const base643 = tokenParts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
34664
34936
|
const padded = base643.padEnd(
|
|
@@ -34705,15 +34977,15 @@ var require_token = __commonJS({
|
|
|
34705
34977
|
const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
|
|
34706
34978
|
let maybeToken = (0, import_token_util.loadToken)(projectId);
|
|
34707
34979
|
if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
|
|
34708
|
-
const authToken = (0, import_token_util.getVercelCliToken)();
|
|
34980
|
+
const authToken = await (0, import_token_util.getVercelCliToken)();
|
|
34709
34981
|
if (!authToken) {
|
|
34710
34982
|
throw new import_token_error.VercelOidcTokenError(
|
|
34711
|
-
"Failed to refresh OIDC token:
|
|
34983
|
+
"Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`"
|
|
34712
34984
|
);
|
|
34713
34985
|
}
|
|
34714
34986
|
if (!projectId) {
|
|
34715
34987
|
throw new import_token_error.VercelOidcTokenError(
|
|
34716
|
-
"Failed to refresh OIDC token: project
|
|
34988
|
+
"Failed to refresh OIDC token: Try re-linking your project with `vc link`"
|
|
34717
34989
|
);
|
|
34718
34990
|
}
|
|
34719
34991
|
maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
|
|
@@ -34775,11 +35047,15 @@ var require_get_vercel_oidc_token = __commonJS({
|
|
|
34775
35047
|
token = getVercelOidcTokenSync2();
|
|
34776
35048
|
}
|
|
34777
35049
|
} catch (error48) {
|
|
34778
|
-
|
|
34779
|
-
|
|
35050
|
+
let message = err instanceof Error ? err.message : "";
|
|
35051
|
+
if (error48 instanceof Error) {
|
|
35052
|
+
message = `${message}
|
|
34780
35053
|
${error48.message}`;
|
|
34781
35054
|
}
|
|
34782
|
-
|
|
35055
|
+
if (message) {
|
|
35056
|
+
throw new import_token_error.VercelOidcTokenError(message);
|
|
35057
|
+
}
|
|
35058
|
+
throw error48;
|
|
34783
35059
|
}
|
|
34784
35060
|
return token;
|
|
34785
35061
|
}
|
|
@@ -34837,8 +35113,8 @@ var require_dist10 = __commonJS({
|
|
|
34837
35113
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
34838
35114
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
34839
35115
|
var __export2 = (target, all) => {
|
|
34840
|
-
for (var
|
|
34841
|
-
__defProp2(target,
|
|
35116
|
+
for (var name8 in all)
|
|
35117
|
+
__defProp2(target, name8, { get: all[name8], enumerable: true });
|
|
34842
35118
|
};
|
|
34843
35119
|
var __copyProps2 = (to, from, except, desc) => {
|
|
34844
35120
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -34863,7 +35139,7 @@ var require_dist10 = __commonJS({
|
|
|
34863
35139
|
gateway: () => gateway2
|
|
34864
35140
|
});
|
|
34865
35141
|
module2.exports = __toCommonJS2(src_exports);
|
|
34866
|
-
var
|
|
35142
|
+
var import_provider_utils10 = require_dist8();
|
|
34867
35143
|
var import_provider = require_dist5();
|
|
34868
35144
|
var import_v42 = require_v4();
|
|
34869
35145
|
var marker = "vercel.ai.gateway.error";
|
|
@@ -35133,21 +35409,85 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35133
35409
|
})
|
|
35134
35410
|
)
|
|
35135
35411
|
);
|
|
35136
|
-
|
|
35137
|
-
|
|
35412
|
+
var name7 = "GatewayTimeoutError";
|
|
35413
|
+
var marker8 = `vercel.ai.gateway.error.${name7}`;
|
|
35414
|
+
var symbol8 = Symbol.for(marker8);
|
|
35415
|
+
var _a8;
|
|
35416
|
+
var _b8;
|
|
35417
|
+
var GatewayTimeoutError = class _GatewayTimeoutError extends (_b8 = GatewayError, _a8 = symbol8, _b8) {
|
|
35418
|
+
constructor({
|
|
35419
|
+
message = "Request timed out",
|
|
35420
|
+
statusCode = 408,
|
|
35421
|
+
cause
|
|
35422
|
+
} = {}) {
|
|
35423
|
+
super({ message, statusCode, cause });
|
|
35424
|
+
this[_a8] = true;
|
|
35425
|
+
this.name = name7;
|
|
35426
|
+
this.type = "timeout_error";
|
|
35427
|
+
}
|
|
35428
|
+
static isInstance(error48) {
|
|
35429
|
+
return GatewayError.hasMarker(error48) && symbol8 in error48;
|
|
35430
|
+
}
|
|
35431
|
+
/**
|
|
35432
|
+
* Creates a helpful timeout error message with troubleshooting guidance
|
|
35433
|
+
*/
|
|
35434
|
+
static createTimeoutError({
|
|
35435
|
+
originalMessage,
|
|
35436
|
+
statusCode = 408,
|
|
35437
|
+
cause
|
|
35438
|
+
}) {
|
|
35439
|
+
const message = `Gateway request timed out: ${originalMessage}
|
|
35440
|
+
|
|
35441
|
+
This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;
|
|
35442
|
+
return new _GatewayTimeoutError({
|
|
35443
|
+
message,
|
|
35444
|
+
statusCode,
|
|
35445
|
+
cause
|
|
35446
|
+
});
|
|
35447
|
+
}
|
|
35448
|
+
};
|
|
35449
|
+
function isTimeoutError(error48) {
|
|
35450
|
+
if (!(error48 instanceof Error)) {
|
|
35451
|
+
return false;
|
|
35452
|
+
}
|
|
35453
|
+
const errorCode = error48.code;
|
|
35454
|
+
if (typeof errorCode === "string") {
|
|
35455
|
+
const undiciTimeoutCodes = [
|
|
35456
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
35457
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
35458
|
+
"UND_ERR_CONNECT_TIMEOUT"
|
|
35459
|
+
];
|
|
35460
|
+
return undiciTimeoutCodes.includes(errorCode);
|
|
35461
|
+
}
|
|
35462
|
+
return false;
|
|
35463
|
+
}
|
|
35464
|
+
async function asGatewayError(error48, authMethod) {
|
|
35465
|
+
var _a9;
|
|
35138
35466
|
if (GatewayError.isInstance(error48)) {
|
|
35139
35467
|
return error48;
|
|
35140
35468
|
}
|
|
35469
|
+
if (isTimeoutError(error48)) {
|
|
35470
|
+
return GatewayTimeoutError.createTimeoutError({
|
|
35471
|
+
originalMessage: error48 instanceof Error ? error48.message : "Unknown error",
|
|
35472
|
+
cause: error48
|
|
35473
|
+
});
|
|
35474
|
+
}
|
|
35141
35475
|
if (import_provider.APICallError.isInstance(error48)) {
|
|
35142
|
-
|
|
35476
|
+
if (error48.cause && isTimeoutError(error48.cause)) {
|
|
35477
|
+
return GatewayTimeoutError.createTimeoutError({
|
|
35478
|
+
originalMessage: error48.message,
|
|
35479
|
+
cause: error48
|
|
35480
|
+
});
|
|
35481
|
+
}
|
|
35482
|
+
return await createGatewayErrorFromResponse({
|
|
35143
35483
|
response: extractApiCallResponse(error48),
|
|
35144
|
-
statusCode: (
|
|
35484
|
+
statusCode: (_a9 = error48.statusCode) != null ? _a9 : 500,
|
|
35145
35485
|
defaultMessage: "Gateway request failed",
|
|
35146
35486
|
cause: error48,
|
|
35147
35487
|
authMethod
|
|
35148
35488
|
});
|
|
35149
35489
|
}
|
|
35150
|
-
return createGatewayErrorFromResponse({
|
|
35490
|
+
return await createGatewayErrorFromResponse({
|
|
35151
35491
|
response: {},
|
|
35152
35492
|
statusCode: 500,
|
|
35153
35493
|
defaultMessage: error48 instanceof Error ? `Gateway request failed: ${error48.message}` : "Unknown Gateway error",
|
|
@@ -35436,7 +35776,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35436
35776
|
abortSignal,
|
|
35437
35777
|
providerOptions
|
|
35438
35778
|
}) {
|
|
35439
|
-
var
|
|
35779
|
+
var _a9;
|
|
35440
35780
|
const resolvedHeaders = await (0, import_provider_utils6.resolve)(this.config.headers());
|
|
35441
35781
|
try {
|
|
35442
35782
|
const {
|
|
@@ -35467,7 +35807,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35467
35807
|
});
|
|
35468
35808
|
return {
|
|
35469
35809
|
embeddings: responseBody.embeddings,
|
|
35470
|
-
usage: (
|
|
35810
|
+
usage: (_a9 = responseBody.usage) != null ? _a9 : void 0,
|
|
35471
35811
|
providerMetadata: responseBody.providerMetadata,
|
|
35472
35812
|
response: { headers: responseHeaders, body: rawValue }
|
|
35473
35813
|
};
|
|
@@ -35516,7 +35856,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35516
35856
|
headers,
|
|
35517
35857
|
abortSignal
|
|
35518
35858
|
}) {
|
|
35519
|
-
var
|
|
35859
|
+
var _a9, _b9, _c, _d;
|
|
35520
35860
|
const resolvedHeaders = await (0, import_provider_utils7.resolve)(this.config.headers());
|
|
35521
35861
|
try {
|
|
35522
35862
|
const {
|
|
@@ -35552,16 +35892,23 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35552
35892
|
return {
|
|
35553
35893
|
images: responseBody.images,
|
|
35554
35894
|
// Always base64 strings from server
|
|
35555
|
-
warnings: (
|
|
35895
|
+
warnings: (_a9 = responseBody.warnings) != null ? _a9 : [],
|
|
35556
35896
|
providerMetadata: responseBody.providerMetadata,
|
|
35557
35897
|
response: {
|
|
35558
35898
|
timestamp: /* @__PURE__ */ new Date(),
|
|
35559
35899
|
modelId: this.modelId,
|
|
35560
35900
|
headers: responseHeaders
|
|
35901
|
+
},
|
|
35902
|
+
...responseBody.usage != null && {
|
|
35903
|
+
usage: {
|
|
35904
|
+
inputTokens: (_b9 = responseBody.usage.inputTokens) != null ? _b9 : void 0,
|
|
35905
|
+
outputTokens: (_c = responseBody.usage.outputTokens) != null ? _c : void 0,
|
|
35906
|
+
totalTokens: (_d = responseBody.usage.totalTokens) != null ? _d : void 0
|
|
35907
|
+
}
|
|
35561
35908
|
}
|
|
35562
35909
|
};
|
|
35563
35910
|
} catch (error48) {
|
|
35564
|
-
throw asGatewayError(error48, await parseAuthMethod(resolvedHeaders));
|
|
35911
|
+
throw await asGatewayError(error48, await parseAuthMethod(resolvedHeaders));
|
|
35565
35912
|
}
|
|
35566
35913
|
}
|
|
35567
35914
|
getUrl() {
|
|
@@ -35577,6 +35924,11 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35577
35924
|
var providerMetadataEntrySchema = import_v47.z.object({
|
|
35578
35925
|
images: import_v47.z.array(import_v47.z.unknown()).optional()
|
|
35579
35926
|
}).catchall(import_v47.z.unknown());
|
|
35927
|
+
var gatewayImageUsageSchema = import_v47.z.object({
|
|
35928
|
+
inputTokens: import_v47.z.number().nullish(),
|
|
35929
|
+
outputTokens: import_v47.z.number().nullish(),
|
|
35930
|
+
totalTokens: import_v47.z.number().nullish()
|
|
35931
|
+
});
|
|
35580
35932
|
var gatewayImageResponseSchema = import_v47.z.object({
|
|
35581
35933
|
images: import_v47.z.array(import_v47.z.string()),
|
|
35582
35934
|
// Always base64 strings over the wire
|
|
@@ -35586,75 +35938,162 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35586
35938
|
message: import_v47.z.string()
|
|
35587
35939
|
})
|
|
35588
35940
|
).optional(),
|
|
35589
|
-
providerMetadata: import_v47.z.record(import_v47.z.string(), providerMetadataEntrySchema).optional()
|
|
35941
|
+
providerMetadata: import_v47.z.record(import_v47.z.string(), providerMetadataEntrySchema).optional(),
|
|
35942
|
+
usage: gatewayImageUsageSchema.optional()
|
|
35590
35943
|
});
|
|
35591
35944
|
var import_provider_utils8 = require_dist8();
|
|
35592
35945
|
var import_zod3 = require_zod();
|
|
35593
|
-
var
|
|
35946
|
+
var parallelSearchInputSchema = (0, import_provider_utils8.lazySchema)(
|
|
35594
35947
|
() => (0, import_provider_utils8.zodSchema)(
|
|
35595
35948
|
import_zod3.z.object({
|
|
35596
|
-
|
|
35597
|
-
"
|
|
35949
|
+
objective: import_zod3.z.string().describe(
|
|
35950
|
+
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
35951
|
+
),
|
|
35952
|
+
search_queries: import_zod3.z.array(import_zod3.z.string()).optional().describe(
|
|
35953
|
+
"Optional search queries to supplement the objective. Maximum 200 characters per query."
|
|
35954
|
+
),
|
|
35955
|
+
mode: import_zod3.z.enum(["one-shot", "agentic"]).optional().describe(
|
|
35956
|
+
'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
|
|
35598
35957
|
),
|
|
35599
35958
|
max_results: import_zod3.z.number().optional().describe(
|
|
35959
|
+
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
35960
|
+
),
|
|
35961
|
+
source_policy: import_zod3.z.object({
|
|
35962
|
+
include_domains: import_zod3.z.array(import_zod3.z.string()).optional().describe("List of domains to include in search results."),
|
|
35963
|
+
exclude_domains: import_zod3.z.array(import_zod3.z.string()).optional().describe("List of domains to exclude from search results."),
|
|
35964
|
+
after_date: import_zod3.z.string().optional().describe(
|
|
35965
|
+
"Only include results published after this date (ISO 8601 format)."
|
|
35966
|
+
)
|
|
35967
|
+
}).optional().describe(
|
|
35968
|
+
"Source policy for controlling which domains to include/exclude and freshness."
|
|
35969
|
+
),
|
|
35970
|
+
excerpts: import_zod3.z.object({
|
|
35971
|
+
max_chars_per_result: import_zod3.z.number().optional().describe("Maximum characters per result."),
|
|
35972
|
+
max_chars_total: import_zod3.z.number().optional().describe("Maximum total characters across all results.")
|
|
35973
|
+
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
35974
|
+
fetch_policy: import_zod3.z.object({
|
|
35975
|
+
max_age_seconds: import_zod3.z.number().optional().describe(
|
|
35976
|
+
"Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
|
|
35977
|
+
)
|
|
35978
|
+
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
35979
|
+
})
|
|
35980
|
+
)
|
|
35981
|
+
);
|
|
35982
|
+
var parallelSearchOutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
35983
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
35984
|
+
import_zod3.z.union([
|
|
35985
|
+
// Success response
|
|
35986
|
+
import_zod3.z.object({
|
|
35987
|
+
searchId: import_zod3.z.string(),
|
|
35988
|
+
results: import_zod3.z.array(
|
|
35989
|
+
import_zod3.z.object({
|
|
35990
|
+
url: import_zod3.z.string(),
|
|
35991
|
+
title: import_zod3.z.string(),
|
|
35992
|
+
excerpt: import_zod3.z.string(),
|
|
35993
|
+
publishDate: import_zod3.z.string().nullable().optional(),
|
|
35994
|
+
relevanceScore: import_zod3.z.number().optional()
|
|
35995
|
+
})
|
|
35996
|
+
)
|
|
35997
|
+
}),
|
|
35998
|
+
// Error response
|
|
35999
|
+
import_zod3.z.object({
|
|
36000
|
+
error: import_zod3.z.enum([
|
|
36001
|
+
"api_error",
|
|
36002
|
+
"rate_limit",
|
|
36003
|
+
"timeout",
|
|
36004
|
+
"invalid_input",
|
|
36005
|
+
"configuration_error",
|
|
36006
|
+
"unknown"
|
|
36007
|
+
]),
|
|
36008
|
+
statusCode: import_zod3.z.number().optional(),
|
|
36009
|
+
message: import_zod3.z.string()
|
|
36010
|
+
})
|
|
36011
|
+
])
|
|
36012
|
+
)
|
|
36013
|
+
);
|
|
36014
|
+
var parallelSearchToolFactory = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
36015
|
+
id: "gateway.parallel_search",
|
|
36016
|
+
name: "parallel_search",
|
|
36017
|
+
inputSchema: parallelSearchInputSchema,
|
|
36018
|
+
outputSchema: parallelSearchOutputSchema
|
|
36019
|
+
});
|
|
36020
|
+
var parallelSearch = (config2 = {}) => parallelSearchToolFactory(config2);
|
|
36021
|
+
var import_provider_utils9 = require_dist8();
|
|
36022
|
+
var import_zod22 = require_zod();
|
|
36023
|
+
var perplexitySearchInputSchema = (0, import_provider_utils9.lazySchema)(
|
|
36024
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
36025
|
+
import_zod22.z.object({
|
|
36026
|
+
query: import_zod22.z.union([import_zod22.z.string(), import_zod22.z.array(import_zod22.z.string())]).describe(
|
|
36027
|
+
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
36028
|
+
),
|
|
36029
|
+
max_results: import_zod22.z.number().optional().describe(
|
|
35600
36030
|
"Maximum number of search results to return (1-20, default: 10)"
|
|
35601
36031
|
),
|
|
35602
|
-
max_tokens_per_page:
|
|
35603
|
-
"Maximum number of tokens to extract per search result page (256-2048, default:
|
|
36032
|
+
max_tokens_per_page: import_zod22.z.number().optional().describe(
|
|
36033
|
+
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
36034
|
+
),
|
|
36035
|
+
max_tokens: import_zod22.z.number().optional().describe(
|
|
36036
|
+
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
35604
36037
|
),
|
|
35605
|
-
country:
|
|
36038
|
+
country: import_zod22.z.string().optional().describe(
|
|
35606
36039
|
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
35607
36040
|
),
|
|
35608
|
-
search_domain_filter:
|
|
36041
|
+
search_domain_filter: import_zod22.z.array(import_zod22.z.string()).optional().describe(
|
|
35609
36042
|
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
35610
36043
|
),
|
|
35611
|
-
search_language_filter:
|
|
36044
|
+
search_language_filter: import_zod22.z.array(import_zod22.z.string()).optional().describe(
|
|
35612
36045
|
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
35613
36046
|
),
|
|
35614
|
-
search_after_date:
|
|
36047
|
+
search_after_date: import_zod22.z.string().optional().describe(
|
|
35615
36048
|
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
35616
36049
|
),
|
|
35617
|
-
search_before_date:
|
|
36050
|
+
search_before_date: import_zod22.z.string().optional().describe(
|
|
35618
36051
|
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
35619
36052
|
),
|
|
35620
|
-
|
|
36053
|
+
last_updated_after_filter: import_zod22.z.string().optional().describe(
|
|
36054
|
+
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
36055
|
+
),
|
|
36056
|
+
last_updated_before_filter: import_zod22.z.string().optional().describe(
|
|
36057
|
+
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
36058
|
+
),
|
|
36059
|
+
search_recency_filter: import_zod22.z.enum(["day", "week", "month", "year"]).optional().describe(
|
|
35621
36060
|
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
35622
36061
|
)
|
|
35623
36062
|
})
|
|
35624
36063
|
)
|
|
35625
36064
|
);
|
|
35626
|
-
var perplexitySearchOutputSchema = (0,
|
|
35627
|
-
() => (0,
|
|
35628
|
-
|
|
36065
|
+
var perplexitySearchOutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
36066
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
36067
|
+
import_zod22.z.union([
|
|
35629
36068
|
// Success response
|
|
35630
|
-
|
|
35631
|
-
results:
|
|
35632
|
-
|
|
35633
|
-
title:
|
|
35634
|
-
url:
|
|
35635
|
-
snippet:
|
|
35636
|
-
date:
|
|
35637
|
-
lastUpdated:
|
|
36069
|
+
import_zod22.z.object({
|
|
36070
|
+
results: import_zod22.z.array(
|
|
36071
|
+
import_zod22.z.object({
|
|
36072
|
+
title: import_zod22.z.string(),
|
|
36073
|
+
url: import_zod22.z.string(),
|
|
36074
|
+
snippet: import_zod22.z.string(),
|
|
36075
|
+
date: import_zod22.z.string().optional(),
|
|
36076
|
+
lastUpdated: import_zod22.z.string().optional()
|
|
35638
36077
|
})
|
|
35639
36078
|
),
|
|
35640
|
-
id:
|
|
36079
|
+
id: import_zod22.z.string()
|
|
35641
36080
|
}),
|
|
35642
36081
|
// Error response
|
|
35643
|
-
|
|
35644
|
-
error:
|
|
36082
|
+
import_zod22.z.object({
|
|
36083
|
+
error: import_zod22.z.enum([
|
|
35645
36084
|
"api_error",
|
|
35646
36085
|
"rate_limit",
|
|
35647
36086
|
"timeout",
|
|
35648
36087
|
"invalid_input",
|
|
35649
36088
|
"unknown"
|
|
35650
36089
|
]),
|
|
35651
|
-
statusCode:
|
|
35652
|
-
message:
|
|
36090
|
+
statusCode: import_zod22.z.number().optional(),
|
|
36091
|
+
message: import_zod22.z.string()
|
|
35653
36092
|
})
|
|
35654
36093
|
])
|
|
35655
36094
|
)
|
|
35656
36095
|
);
|
|
35657
|
-
var perplexitySearchToolFactory = (0,
|
|
36096
|
+
var perplexitySearchToolFactory = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
35658
36097
|
id: "gateway.perplexity_search",
|
|
35659
36098
|
name: "perplexity_search",
|
|
35660
36099
|
inputSchema: perplexitySearchInputSchema,
|
|
@@ -35662,6 +36101,15 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35662
36101
|
});
|
|
35663
36102
|
var perplexitySearch = (config2 = {}) => perplexitySearchToolFactory(config2);
|
|
35664
36103
|
var gatewayTools = {
|
|
36104
|
+
/**
|
|
36105
|
+
* Search the web using Parallel AI's Search API for LLM-optimized excerpts.
|
|
36106
|
+
*
|
|
36107
|
+
* Takes a natural language objective and returns relevant excerpts,
|
|
36108
|
+
* replacing multiple keyword searches with a single call for broad
|
|
36109
|
+
* or complex queries. Supports different search types for depth vs
|
|
36110
|
+
* breadth tradeoffs.
|
|
36111
|
+
*/
|
|
36112
|
+
parallelSearch,
|
|
35665
36113
|
/**
|
|
35666
36114
|
* Search the web using Perplexity's Search API for real-time information,
|
|
35667
36115
|
* news, research papers, and articles.
|
|
@@ -35674,23 +36122,23 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35674
36122
|
var import_oidc = require_dist9();
|
|
35675
36123
|
var import_oidc2 = require_dist9();
|
|
35676
36124
|
async function getVercelRequestId() {
|
|
35677
|
-
var
|
|
35678
|
-
return (
|
|
36125
|
+
var _a9;
|
|
36126
|
+
return (_a9 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a9["x-vercel-id"];
|
|
35679
36127
|
}
|
|
35680
|
-
var
|
|
35681
|
-
var VERSION2 = true ? "2.0.
|
|
36128
|
+
var import_provider_utils11 = require_dist8();
|
|
36129
|
+
var VERSION2 = true ? "2.0.47" : "0.0.0-test";
|
|
35682
36130
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
35683
36131
|
function createGatewayProvider(options = {}) {
|
|
35684
|
-
var
|
|
36132
|
+
var _a9, _b9;
|
|
35685
36133
|
let pendingMetadata = null;
|
|
35686
36134
|
let metadataCache = null;
|
|
35687
|
-
const cacheRefreshMillis = (
|
|
36135
|
+
const cacheRefreshMillis = (_a9 = options.metadataCacheRefreshMillis) != null ? _a9 : 1e3 * 60 * 5;
|
|
35688
36136
|
let lastFetchTime = 0;
|
|
35689
|
-
const baseURL = (
|
|
36137
|
+
const baseURL = (_b9 = (0, import_provider_utils10.withoutTrailingSlash)(options.baseURL)) != null ? _b9 : "https://ai-gateway.vercel.sh/v1/ai";
|
|
35690
36138
|
const getHeaders = async () => {
|
|
35691
36139
|
const auth = await getGatewayAuthToken(options);
|
|
35692
36140
|
if (auth) {
|
|
35693
|
-
return (0,
|
|
36141
|
+
return (0, import_provider_utils11.withUserAgentSuffix)(
|
|
35694
36142
|
{
|
|
35695
36143
|
Authorization: `Bearer ${auth.token}`,
|
|
35696
36144
|
"ai-gateway-protocol-version": AI_GATEWAY_PROTOCOL_VERSION,
|
|
@@ -35707,25 +36155,30 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35707
36155
|
});
|
|
35708
36156
|
};
|
|
35709
36157
|
const createO11yHeaders = () => {
|
|
35710
|
-
const deploymentId = (0,
|
|
36158
|
+
const deploymentId = (0, import_provider_utils10.loadOptionalSetting)({
|
|
35711
36159
|
settingValue: void 0,
|
|
35712
36160
|
environmentVariableName: "VERCEL_DEPLOYMENT_ID"
|
|
35713
36161
|
});
|
|
35714
|
-
const environment = (0,
|
|
36162
|
+
const environment = (0, import_provider_utils10.loadOptionalSetting)({
|
|
35715
36163
|
settingValue: void 0,
|
|
35716
36164
|
environmentVariableName: "VERCEL_ENV"
|
|
35717
36165
|
});
|
|
35718
|
-
const region = (0,
|
|
36166
|
+
const region = (0, import_provider_utils10.loadOptionalSetting)({
|
|
35719
36167
|
settingValue: void 0,
|
|
35720
36168
|
environmentVariableName: "VERCEL_REGION"
|
|
35721
36169
|
});
|
|
36170
|
+
const projectId = (0, import_provider_utils10.loadOptionalSetting)({
|
|
36171
|
+
settingValue: void 0,
|
|
36172
|
+
environmentVariableName: "VERCEL_PROJECT_ID"
|
|
36173
|
+
});
|
|
35722
36174
|
return async () => {
|
|
35723
36175
|
const requestId = await getVercelRequestId();
|
|
35724
36176
|
return {
|
|
35725
36177
|
...deploymentId && { "ai-o11y-deployment-id": deploymentId },
|
|
35726
36178
|
...environment && { "ai-o11y-environment": environment },
|
|
35727
36179
|
...region && { "ai-o11y-region": region },
|
|
35728
|
-
...requestId && { "ai-o11y-request-id": requestId }
|
|
36180
|
+
...requestId && { "ai-o11y-request-id": requestId },
|
|
36181
|
+
...projectId && { "ai-o11y-project-id": projectId }
|
|
35729
36182
|
};
|
|
35730
36183
|
};
|
|
35731
36184
|
};
|
|
@@ -35739,8 +36192,8 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35739
36192
|
});
|
|
35740
36193
|
};
|
|
35741
36194
|
const getAvailableModels = async () => {
|
|
35742
|
-
var
|
|
35743
|
-
const now = (_c = (
|
|
36195
|
+
var _a10, _b10, _c;
|
|
36196
|
+
const now = (_c = (_b10 = (_a10 = options._internal) == null ? void 0 : _a10.currentDate) == null ? void 0 : _b10.call(_a10).getTime()) != null ? _c : Date.now();
|
|
35744
36197
|
if (!pendingMetadata || now - lastFetchTime > cacheRefreshMillis) {
|
|
35745
36198
|
lastFetchTime = now;
|
|
35746
36199
|
pendingMetadata = new GatewayFetchMetadata({
|
|
@@ -35805,7 +36258,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
35805
36258
|
}
|
|
35806
36259
|
var gateway2 = createGatewayProvider();
|
|
35807
36260
|
async function getGatewayAuthToken(options) {
|
|
35808
|
-
const apiKey = (0,
|
|
36261
|
+
const apiKey = (0, import_provider_utils10.loadOptionalSetting)({
|
|
35809
36262
|
settingValue: options.apiKey,
|
|
35810
36263
|
environmentVariableName: "AI_GATEWAY_API_KEY"
|
|
35811
36264
|
});
|
|
@@ -37516,7 +37969,7 @@ var require_dist11 = __commonJS({
|
|
|
37516
37969
|
UI_MESSAGE_STREAM_HEADERS: () => UI_MESSAGE_STREAM_HEADERS,
|
|
37517
37970
|
UnsupportedFunctionalityError: () => import_provider17.UnsupportedFunctionalityError,
|
|
37518
37971
|
UnsupportedModelVersionError: () => UnsupportedModelVersionError,
|
|
37519
|
-
asSchema: () =>
|
|
37972
|
+
asSchema: () => import_provider_utils35.asSchema,
|
|
37520
37973
|
assistantModelMessageSchema: () => assistantModelMessageSchema,
|
|
37521
37974
|
callCompletionApi: () => callCompletionApi,
|
|
37522
37975
|
consumeStream: () => consumeStream,
|
|
@@ -37529,15 +37982,16 @@ var require_dist11 = __commonJS({
|
|
|
37529
37982
|
coreToolMessageSchema: () => coreToolMessageSchema,
|
|
37530
37983
|
coreUserMessageSchema: () => coreUserMessageSchema,
|
|
37531
37984
|
cosineSimilarity: () => cosineSimilarity,
|
|
37985
|
+
createDownload: () => createDownload,
|
|
37532
37986
|
createGateway: () => import_gateway3.createGateway,
|
|
37533
|
-
createIdGenerator: () =>
|
|
37987
|
+
createIdGenerator: () => import_provider_utils35.createIdGenerator,
|
|
37534
37988
|
createProviderRegistry: () => createProviderRegistry,
|
|
37535
37989
|
createTextStreamResponse: () => createTextStreamResponse,
|
|
37536
37990
|
createUIMessageStream: () => createUIMessageStream,
|
|
37537
37991
|
createUIMessageStreamResponse: () => createUIMessageStreamResponse,
|
|
37538
37992
|
customProvider: () => customProvider,
|
|
37539
37993
|
defaultSettingsMiddleware: () => defaultSettingsMiddleware,
|
|
37540
|
-
dynamicTool: () =>
|
|
37994
|
+
dynamicTool: () => import_provider_utils35.dynamicTool,
|
|
37541
37995
|
embed: () => embed,
|
|
37542
37996
|
embedMany: () => embedMany,
|
|
37543
37997
|
experimental_createProviderRegistry: () => experimental_createProviderRegistry,
|
|
@@ -37547,7 +38001,7 @@ var require_dist11 = __commonJS({
|
|
|
37547
38001
|
experimental_transcribe: () => transcribe,
|
|
37548
38002
|
extractReasoningMiddleware: () => extractReasoningMiddleware,
|
|
37549
38003
|
gateway: () => import_gateway3.gateway,
|
|
37550
|
-
generateId: () =>
|
|
38004
|
+
generateId: () => import_provider_utils35.generateId,
|
|
37551
38005
|
generateObject: () => generateObject,
|
|
37552
38006
|
generateText: () => generateText,
|
|
37553
38007
|
getTextFromDataUrl: () => getTextFromDataUrl,
|
|
@@ -37561,10 +38015,10 @@ var require_dist11 = __commonJS({
|
|
|
37561
38015
|
isTextUIPart: () => isTextUIPart,
|
|
37562
38016
|
isToolOrDynamicToolUIPart: () => isToolOrDynamicToolUIPart,
|
|
37563
38017
|
isToolUIPart: () => isToolUIPart,
|
|
37564
|
-
jsonSchema: () =>
|
|
38018
|
+
jsonSchema: () => import_provider_utils35.jsonSchema,
|
|
37565
38019
|
lastAssistantMessageIsCompleteWithToolCalls: () => lastAssistantMessageIsCompleteWithToolCalls,
|
|
37566
38020
|
modelMessageSchema: () => modelMessageSchema,
|
|
37567
|
-
parseJsonEventStream: () =>
|
|
38021
|
+
parseJsonEventStream: () => import_provider_utils35.parseJsonEventStream,
|
|
37568
38022
|
parsePartialJson: () => parsePartialJson,
|
|
37569
38023
|
pipeTextStreamToResponse: () => pipeTextStreamToResponse,
|
|
37570
38024
|
pipeUIMessageStreamToResponse: () => pipeUIMessageStreamToResponse,
|
|
@@ -37578,19 +38032,19 @@ var require_dist11 = __commonJS({
|
|
|
37578
38032
|
streamObject: () => streamObject,
|
|
37579
38033
|
streamText: () => streamText,
|
|
37580
38034
|
systemModelMessageSchema: () => systemModelMessageSchema,
|
|
37581
|
-
tool: () =>
|
|
38035
|
+
tool: () => import_provider_utils35.tool,
|
|
37582
38036
|
toolModelMessageSchema: () => toolModelMessageSchema,
|
|
37583
38037
|
uiMessageChunkSchema: () => uiMessageChunkSchema,
|
|
37584
38038
|
userModelMessageSchema: () => userModelMessageSchema,
|
|
37585
38039
|
validateUIMessages: () => validateUIMessages,
|
|
37586
38040
|
wrapLanguageModel: () => wrapLanguageModel,
|
|
37587
38041
|
wrapProvider: () => wrapProvider,
|
|
37588
|
-
zodSchema: () =>
|
|
38042
|
+
zodSchema: () => import_provider_utils35.zodSchema
|
|
37589
38043
|
});
|
|
37590
38044
|
module2.exports = __toCommonJS2(src_exports);
|
|
37591
38045
|
var import_gateway3 = require_dist10();
|
|
37592
|
-
var
|
|
37593
|
-
var
|
|
38046
|
+
var import_provider_utils35 = require_dist8();
|
|
38047
|
+
var import_provider_utils11 = require_dist8();
|
|
37594
38048
|
var import_provider = require_dist5();
|
|
37595
38049
|
var name = "AI_NoOutputSpecifiedError";
|
|
37596
38050
|
var marker = `vercel.ai.error.${name}`;
|
|
@@ -37999,7 +38453,7 @@ var require_dist11 = __commonJS({
|
|
|
37999
38453
|
var _a16;
|
|
38000
38454
|
return (_a16 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a16 : import_gateway.gateway;
|
|
38001
38455
|
}
|
|
38002
|
-
var
|
|
38456
|
+
var import_provider_utils5 = require_dist8();
|
|
38003
38457
|
var import_provider_utils = require_dist8();
|
|
38004
38458
|
var imageMediaTypeSignatures = [
|
|
38005
38459
|
{
|
|
@@ -38184,17 +38638,23 @@ var require_dist11 = __commonJS({
|
|
|
38184
38638
|
return void 0;
|
|
38185
38639
|
}
|
|
38186
38640
|
var import_provider_utils2 = require_dist8();
|
|
38187
|
-
var
|
|
38188
|
-
var
|
|
38641
|
+
var import_provider_utils3 = require_dist8();
|
|
38642
|
+
var VERSION2 = true ? "5.0.141" : "0.0.0-test";
|
|
38643
|
+
var download = async ({
|
|
38644
|
+
url: url2,
|
|
38645
|
+
maxBytes,
|
|
38646
|
+
abortSignal
|
|
38647
|
+
}) => {
|
|
38189
38648
|
var _a16;
|
|
38190
38649
|
const urlText = url2.toString();
|
|
38191
38650
|
try {
|
|
38192
38651
|
const response = await fetch(urlText, {
|
|
38193
|
-
headers: (0,
|
|
38652
|
+
headers: (0, import_provider_utils3.withUserAgentSuffix)(
|
|
38194
38653
|
{},
|
|
38195
38654
|
`ai-sdk/${VERSION2}`,
|
|
38196
|
-
(0,
|
|
38197
|
-
)
|
|
38655
|
+
(0, import_provider_utils3.getRuntimeEnvironmentUserAgent)()
|
|
38656
|
+
),
|
|
38657
|
+
signal: abortSignal
|
|
38198
38658
|
});
|
|
38199
38659
|
if (!response.ok) {
|
|
38200
38660
|
throw new DownloadError({
|
|
@@ -38203,8 +38663,13 @@ var require_dist11 = __commonJS({
|
|
|
38203
38663
|
statusText: response.statusText
|
|
38204
38664
|
});
|
|
38205
38665
|
}
|
|
38666
|
+
const data = await (0, import_provider_utils2.readResponseWithSizeLimit)({
|
|
38667
|
+
response,
|
|
38668
|
+
url: urlText,
|
|
38669
|
+
maxBytes: maxBytes != null ? maxBytes : import_provider_utils2.DEFAULT_MAX_DOWNLOAD_SIZE
|
|
38670
|
+
});
|
|
38206
38671
|
return {
|
|
38207
|
-
data
|
|
38672
|
+
data,
|
|
38208
38673
|
mediaType: (_a16 = response.headers.get("content-type")) != null ? _a16 : void 0
|
|
38209
38674
|
};
|
|
38210
38675
|
} catch (error48) {
|
|
@@ -38220,7 +38685,7 @@ var require_dist11 = __commonJS({
|
|
|
38220
38685
|
)
|
|
38221
38686
|
);
|
|
38222
38687
|
var import_provider18 = require_dist5();
|
|
38223
|
-
var
|
|
38688
|
+
var import_provider_utils4 = require_dist8();
|
|
38224
38689
|
var import_v42 = require_v4();
|
|
38225
38690
|
function splitDataUrl(dataUrl) {
|
|
38226
38691
|
try {
|
|
@@ -38281,9 +38746,9 @@ var require_dist11 = __commonJS({
|
|
|
38281
38746
|
return content;
|
|
38282
38747
|
}
|
|
38283
38748
|
if (content instanceof ArrayBuffer) {
|
|
38284
|
-
return (0,
|
|
38749
|
+
return (0, import_provider_utils4.convertUint8ArrayToBase64)(new Uint8Array(content));
|
|
38285
38750
|
}
|
|
38286
|
-
return (0,
|
|
38751
|
+
return (0, import_provider_utils4.convertUint8ArrayToBase64)(content);
|
|
38287
38752
|
}
|
|
38288
38753
|
function convertDataContentToUint8Array(content) {
|
|
38289
38754
|
if (content instanceof Uint8Array) {
|
|
@@ -38291,7 +38756,7 @@ var require_dist11 = __commonJS({
|
|
|
38291
38756
|
}
|
|
38292
38757
|
if (typeof content === "string") {
|
|
38293
38758
|
try {
|
|
38294
|
-
return (0,
|
|
38759
|
+
return (0, import_provider_utils4.convertBase64ToUint8Array)(content);
|
|
38295
38760
|
} catch (error48) {
|
|
38296
38761
|
throw new InvalidDataContentError({
|
|
38297
38762
|
message: "Invalid data content. Content string is not a base64-encoded media.",
|
|
@@ -38454,7 +38919,7 @@ var require_dist11 = __commonJS({
|
|
|
38454
38919
|
(part) => part.data instanceof URL
|
|
38455
38920
|
).map((part) => ({
|
|
38456
38921
|
url: part.data,
|
|
38457
|
-
isUrlSupportedByModel: part.mediaType != null && (0,
|
|
38922
|
+
isUrlSupportedByModel: part.mediaType != null && (0, import_provider_utils5.isUrlSupported)({
|
|
38458
38923
|
url: part.data.toString(),
|
|
38459
38924
|
mediaType: part.mediaType,
|
|
38460
38925
|
supportedUrls
|
|
@@ -38620,7 +39085,7 @@ var require_dist11 = __commonJS({
|
|
|
38620
39085
|
seed
|
|
38621
39086
|
};
|
|
38622
39087
|
}
|
|
38623
|
-
var
|
|
39088
|
+
var import_provider_utils6 = require_dist8();
|
|
38624
39089
|
function isNonEmptyObject(object22) {
|
|
38625
39090
|
return object22 != null && Object.keys(object22).length > 0;
|
|
38626
39091
|
}
|
|
@@ -38649,7 +39114,7 @@ var require_dist11 = __commonJS({
|
|
|
38649
39114
|
type: "function",
|
|
38650
39115
|
name: name16,
|
|
38651
39116
|
description: tool2.description,
|
|
38652
|
-
inputSchema: (0,
|
|
39117
|
+
inputSchema: (0, import_provider_utils6.asSchema)(tool2.inputSchema).jsonSchema,
|
|
38653
39118
|
providerOptions: tool2.providerOptions
|
|
38654
39119
|
};
|
|
38655
39120
|
case "provider-defined":
|
|
@@ -38669,7 +39134,7 @@ var require_dist11 = __commonJS({
|
|
|
38669
39134
|
};
|
|
38670
39135
|
}
|
|
38671
39136
|
var import_provider19 = require_dist5();
|
|
38672
|
-
var
|
|
39137
|
+
var import_provider_utils7 = require_dist8();
|
|
38673
39138
|
var import_v46 = require_v4();
|
|
38674
39139
|
var import_v45 = require_v4();
|
|
38675
39140
|
var import_v43 = require_v4();
|
|
@@ -38846,7 +39311,7 @@ var require_dist11 = __commonJS({
|
|
|
38846
39311
|
message: "messages must not be empty"
|
|
38847
39312
|
});
|
|
38848
39313
|
}
|
|
38849
|
-
const validationResult = await (0,
|
|
39314
|
+
const validationResult = await (0, import_provider_utils7.safeValidateTypes)({
|
|
38850
39315
|
value: messages,
|
|
38851
39316
|
schema: import_v46.z.array(modelMessageSchema)
|
|
38852
39317
|
});
|
|
@@ -39105,7 +39570,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39105
39570
|
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
39106
39571
|
}
|
|
39107
39572
|
var import_provider21 = require_dist5();
|
|
39108
|
-
var
|
|
39573
|
+
var import_provider_utils8 = require_dist8();
|
|
39109
39574
|
function getRetryDelayInMs({
|
|
39110
39575
|
error: error48,
|
|
39111
39576
|
exponentialBackoffDelay
|
|
@@ -39155,13 +39620,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39155
39620
|
try {
|
|
39156
39621
|
return await f();
|
|
39157
39622
|
} catch (error48) {
|
|
39158
|
-
if ((0,
|
|
39623
|
+
if ((0, import_provider_utils8.isAbortError)(error48)) {
|
|
39159
39624
|
throw error48;
|
|
39160
39625
|
}
|
|
39161
39626
|
if (maxRetries === 0) {
|
|
39162
39627
|
throw error48;
|
|
39163
39628
|
}
|
|
39164
|
-
const errorMessage = (0,
|
|
39629
|
+
const errorMessage = (0, import_provider_utils8.getErrorMessage)(error48);
|
|
39165
39630
|
const newErrors = [...errors, error48];
|
|
39166
39631
|
const tryNumber = newErrors.length;
|
|
39167
39632
|
if (tryNumber > maxRetries) {
|
|
@@ -39172,7 +39637,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39172
39637
|
});
|
|
39173
39638
|
}
|
|
39174
39639
|
if (error48 instanceof Error && import_provider21.APICallError.isInstance(error48) && error48.isRetryable === true && tryNumber <= maxRetries) {
|
|
39175
|
-
await (0,
|
|
39640
|
+
await (0, import_provider_utils8.delay)(
|
|
39176
39641
|
getRetryDelayInMs({
|
|
39177
39642
|
error: error48,
|
|
39178
39643
|
exponentialBackoffDelay: delayInMs
|
|
@@ -39238,7 +39703,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39238
39703
|
}
|
|
39239
39704
|
return parts.map((content2) => content2.text).join("");
|
|
39240
39705
|
}
|
|
39241
|
-
var
|
|
39706
|
+
var import_provider_utils9 = require_dist8();
|
|
39242
39707
|
var DefaultGeneratedFile = class {
|
|
39243
39708
|
constructor({
|
|
39244
39709
|
data,
|
|
@@ -39252,14 +39717,14 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39252
39717
|
// lazy conversion with caching to avoid unnecessary conversion overhead:
|
|
39253
39718
|
get base64() {
|
|
39254
39719
|
if (this.base64Data == null) {
|
|
39255
|
-
this.base64Data = (0,
|
|
39720
|
+
this.base64Data = (0, import_provider_utils9.convertUint8ArrayToBase64)(this.uint8ArrayData);
|
|
39256
39721
|
}
|
|
39257
39722
|
return this.base64Data;
|
|
39258
39723
|
}
|
|
39259
39724
|
// lazy conversion with caching to avoid unnecessary conversion overhead:
|
|
39260
39725
|
get uint8Array() {
|
|
39261
39726
|
if (this.uint8ArrayData == null) {
|
|
39262
|
-
this.uint8ArrayData = (0,
|
|
39727
|
+
this.uint8ArrayData = (0, import_provider_utils9.convertBase64ToUint8Array)(this.base64Data);
|
|
39263
39728
|
}
|
|
39264
39729
|
return this.uint8ArrayData;
|
|
39265
39730
|
}
|
|
@@ -39270,7 +39735,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39270
39735
|
this.type = "file";
|
|
39271
39736
|
}
|
|
39272
39737
|
};
|
|
39273
|
-
var
|
|
39738
|
+
var import_provider_utils10 = require_dist8();
|
|
39274
39739
|
async function parseToolCall({
|
|
39275
39740
|
toolCall,
|
|
39276
39741
|
tools,
|
|
@@ -39295,7 +39760,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39295
39760
|
tools,
|
|
39296
39761
|
inputSchema: ({ toolName }) => {
|
|
39297
39762
|
const { inputSchema } = tools[toolName];
|
|
39298
|
-
return (0,
|
|
39763
|
+
return (0, import_provider_utils10.asSchema)(inputSchema).jsonSchema;
|
|
39299
39764
|
},
|
|
39300
39765
|
system,
|
|
39301
39766
|
messages,
|
|
@@ -39313,7 +39778,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39313
39778
|
return await doParseToolCall({ toolCall: repairedToolCall, tools });
|
|
39314
39779
|
}
|
|
39315
39780
|
} catch (error48) {
|
|
39316
|
-
const parsedInput = await (0,
|
|
39781
|
+
const parsedInput = await (0, import_provider_utils10.safeParseJSON)({ text: toolCall.input });
|
|
39317
39782
|
const input = parsedInput.success ? parsedInput.value : toolCall.input;
|
|
39318
39783
|
return {
|
|
39319
39784
|
type: "tool-call",
|
|
@@ -39339,8 +39804,8 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39339
39804
|
availableTools: Object.keys(tools)
|
|
39340
39805
|
});
|
|
39341
39806
|
}
|
|
39342
|
-
const schema = (0,
|
|
39343
|
-
const parseResult = toolCall.input.trim() === "" ? await (0,
|
|
39807
|
+
const schema = (0, import_provider_utils10.asSchema)(tool2.inputSchema);
|
|
39808
|
+
const parseResult = toolCall.input.trim() === "" ? await (0, import_provider_utils10.safeValidateTypes)({ value: {}, schema }) : await (0, import_provider_utils10.safeParseJSON)({ text: toolCall.input, schema });
|
|
39344
39809
|
if (parseResult.success === false) {
|
|
39345
39810
|
throw new InvalidToolInputError({
|
|
39346
39811
|
toolName,
|
|
@@ -39550,7 +40015,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39550
40015
|
}
|
|
39551
40016
|
return responseMessages;
|
|
39552
40017
|
}
|
|
39553
|
-
var originalGenerateId = (0,
|
|
40018
|
+
var originalGenerateId = (0, import_provider_utils11.createIdGenerator)({
|
|
39554
40019
|
prefix: "aitxt",
|
|
39555
40020
|
size: 24
|
|
39556
40021
|
});
|
|
@@ -39589,7 +40054,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39589
40054
|
abortSignal
|
|
39590
40055
|
});
|
|
39591
40056
|
const callSettings = prepareCallSettings(settings);
|
|
39592
|
-
const headersWithUserAgent = (0,
|
|
40057
|
+
const headersWithUserAgent = (0, import_provider_utils11.withUserAgentSuffix)(
|
|
39593
40058
|
headers != null ? headers : {},
|
|
39594
40059
|
`ai/${VERSION2}`
|
|
39595
40060
|
);
|
|
@@ -39795,7 +40260,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39795
40260
|
toolCallId: toolCall.toolCallId,
|
|
39796
40261
|
toolName: toolCall.toolName,
|
|
39797
40262
|
input: toolCall.input,
|
|
39798
|
-
error: (0,
|
|
40263
|
+
error: (0, import_provider_utils11.getErrorMessage)(toolCall.error),
|
|
39799
40264
|
dynamic: true
|
|
39800
40265
|
});
|
|
39801
40266
|
}
|
|
@@ -39929,7 +40394,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
39929
40394
|
tracer,
|
|
39930
40395
|
fn: async (span) => {
|
|
39931
40396
|
try {
|
|
39932
|
-
const stream = (0,
|
|
40397
|
+
const stream = (0, import_provider_utils11.executeTool)({
|
|
39933
40398
|
execute: tool2.execute.bind(tool2),
|
|
39934
40399
|
input,
|
|
39935
40400
|
options: {
|
|
@@ -40138,7 +40603,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
40138
40603
|
];
|
|
40139
40604
|
}
|
|
40140
40605
|
var import_provider23 = require_dist5();
|
|
40141
|
-
var
|
|
40606
|
+
var import_provider_utils16 = require_dist8();
|
|
40142
40607
|
function prepareHeaders(headers, defaultHeaders) {
|
|
40143
40608
|
const responseHeaders = new Headers(headers != null ? headers : {});
|
|
40144
40609
|
for (const [key, value] of Object.entries(defaultHeaders)) {
|
|
@@ -40267,11 +40732,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
40267
40732
|
const lastMessage = originalMessages[originalMessages.length - 1];
|
|
40268
40733
|
return (lastMessage == null ? void 0 : lastMessage.role) === "assistant" ? lastMessage.id : typeof responseMessageId === "function" ? responseMessageId() : responseMessageId;
|
|
40269
40734
|
}
|
|
40270
|
-
var
|
|
40735
|
+
var import_provider_utils14 = require_dist8();
|
|
40271
40736
|
var import_v47 = require_v4();
|
|
40272
|
-
var
|
|
40273
|
-
var uiMessageChunkSchema = (0,
|
|
40274
|
-
() => (0,
|
|
40737
|
+
var import_provider_utils12 = require_dist8();
|
|
40738
|
+
var uiMessageChunkSchema = (0, import_provider_utils12.lazyValidator)(
|
|
40739
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
40275
40740
|
import_v47.z.union([
|
|
40276
40741
|
import_v47.z.strictObject({
|
|
40277
40742
|
type: import_v47.z.literal("text-start"),
|
|
@@ -40453,7 +40918,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
40453
40918
|
}
|
|
40454
40919
|
return result;
|
|
40455
40920
|
}
|
|
40456
|
-
var
|
|
40921
|
+
var import_provider_utils13 = require_dist8();
|
|
40457
40922
|
function fixJson(input) {
|
|
40458
40923
|
const stack = ["ROOT"];
|
|
40459
40924
|
let lastValidIndex = -1;
|
|
@@ -40774,11 +41239,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
40774
41239
|
if (jsonText === void 0) {
|
|
40775
41240
|
return { value: void 0, state: "undefined-input" };
|
|
40776
41241
|
}
|
|
40777
|
-
let result = await (0,
|
|
41242
|
+
let result = await (0, import_provider_utils13.safeParseJSON)({ text: jsonText });
|
|
40778
41243
|
if (result.success) {
|
|
40779
41244
|
return { value: result.value, state: "successful-parse" };
|
|
40780
41245
|
}
|
|
40781
|
-
result = await (0,
|
|
41246
|
+
result = await (0, import_provider_utils13.safeParseJSON)({ text: fixJson(jsonText) });
|
|
40782
41247
|
if (result.success) {
|
|
40783
41248
|
return { value: result.value, state: "repaired-parse" };
|
|
40784
41249
|
}
|
|
@@ -40938,7 +41403,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
40938
41403
|
if (metadata != null) {
|
|
40939
41404
|
const mergedMetadata = state.message.metadata != null ? mergeObjects(state.message.metadata, metadata) : metadata;
|
|
40940
41405
|
if (messageMetadataSchema != null) {
|
|
40941
|
-
await (0,
|
|
41406
|
+
await (0, import_provider_utils14.validateTypes)({
|
|
40942
41407
|
value: mergedMetadata,
|
|
40943
41408
|
schema: messageMetadataSchema
|
|
40944
41409
|
});
|
|
@@ -41238,7 +41703,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41238
41703
|
default: {
|
|
41239
41704
|
if (isDataUIMessageChunk(chunk)) {
|
|
41240
41705
|
if ((dataPartSchemas == null ? void 0 : dataPartSchemas[chunk.type]) != null) {
|
|
41241
|
-
await (0,
|
|
41706
|
+
await (0, import_provider_utils14.validateTypes)({
|
|
41242
41707
|
value: chunk.data,
|
|
41243
41708
|
schema: dataPartSchemas[chunk.type]
|
|
41244
41709
|
});
|
|
@@ -41541,7 +42006,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41541
42006
|
var _a16, _b;
|
|
41542
42007
|
return (_b = (_a16 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a16.now()) != null ? _b : Date.now();
|
|
41543
42008
|
}
|
|
41544
|
-
var
|
|
42009
|
+
var import_provider_utils15 = require_dist8();
|
|
41545
42010
|
function runToolsTransformation({
|
|
41546
42011
|
tools,
|
|
41547
42012
|
generatorStream,
|
|
@@ -41627,7 +42092,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41627
42092
|
toolCallId: toolCall.toolCallId,
|
|
41628
42093
|
toolName: toolCall.toolName,
|
|
41629
42094
|
input: toolCall.input,
|
|
41630
|
-
error: (0,
|
|
42095
|
+
error: (0, import_provider_utils15.getErrorMessage)(toolCall.error),
|
|
41631
42096
|
dynamic: true
|
|
41632
42097
|
});
|
|
41633
42098
|
break;
|
|
@@ -41644,7 +42109,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41644
42109
|
});
|
|
41645
42110
|
}
|
|
41646
42111
|
if (tool2.execute != null && toolCall.providerExecuted !== true) {
|
|
41647
|
-
const toolExecutionId = (0,
|
|
42112
|
+
const toolExecutionId = (0, import_provider_utils15.generateId)();
|
|
41648
42113
|
outstandingToolResults.add(toolExecutionId);
|
|
41649
42114
|
recordSpan({
|
|
41650
42115
|
name: "ai.toolCall",
|
|
@@ -41666,7 +42131,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41666
42131
|
fn: async (span) => {
|
|
41667
42132
|
let output;
|
|
41668
42133
|
try {
|
|
41669
|
-
const stream = (0,
|
|
42134
|
+
const stream = (0, import_provider_utils15.executeTool)({
|
|
41670
42135
|
execute: tool2.execute.bind(tool2),
|
|
41671
42136
|
input: toolCall.input,
|
|
41672
42137
|
options: {
|
|
@@ -41783,7 +42248,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41783
42248
|
}
|
|
41784
42249
|
});
|
|
41785
42250
|
}
|
|
41786
|
-
var originalGenerateId2 = (0,
|
|
42251
|
+
var originalGenerateId2 = (0, import_provider_utils16.createIdGenerator)({
|
|
41787
42252
|
prefix: "aitxt",
|
|
41788
42253
|
size: 24
|
|
41789
42254
|
});
|
|
@@ -41952,9 +42417,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
41952
42417
|
experimental_context,
|
|
41953
42418
|
download: download2
|
|
41954
42419
|
}) {
|
|
41955
|
-
this._totalUsage = new
|
|
41956
|
-
this._finishReason = new
|
|
41957
|
-
this._steps = new
|
|
42420
|
+
this._totalUsage = new import_provider_utils16.DelayedPromise();
|
|
42421
|
+
this._finishReason = new import_provider_utils16.DelayedPromise();
|
|
42422
|
+
this._steps = new import_provider_utils16.DelayedPromise();
|
|
41958
42423
|
this.output = output;
|
|
41959
42424
|
this.includeRawChunks = includeRawChunks;
|
|
41960
42425
|
this.tools = tools;
|
|
@@ -42205,7 +42670,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
42205
42670
|
}
|
|
42206
42671
|
controller.enqueue(value);
|
|
42207
42672
|
} catch (error48) {
|
|
42208
|
-
if ((0,
|
|
42673
|
+
if ((0, import_provider_utils16.isAbortError)(error48) && (abortSignal == null ? void 0 : abortSignal.aborted)) {
|
|
42209
42674
|
abort();
|
|
42210
42675
|
} else {
|
|
42211
42676
|
controller.error(error48);
|
|
@@ -42264,7 +42729,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
42264
42729
|
}) {
|
|
42265
42730
|
var _a16, _b, _c, _d, _e;
|
|
42266
42731
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
42267
|
-
stepFinish = new
|
|
42732
|
+
stepFinish = new import_provider_utils16.DelayedPromise();
|
|
42268
42733
|
const initialPrompt = await standardizePrompt({
|
|
42269
42734
|
system,
|
|
42270
42735
|
prompt,
|
|
@@ -43335,7 +43800,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43335
43800
|
}).toUIMessageStreamResponse();
|
|
43336
43801
|
}
|
|
43337
43802
|
};
|
|
43338
|
-
var
|
|
43803
|
+
var import_provider_utils17 = require_dist8();
|
|
43339
43804
|
async function embed({
|
|
43340
43805
|
model: modelArg,
|
|
43341
43806
|
value,
|
|
@@ -43350,7 +43815,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43350
43815
|
maxRetries: maxRetriesArg,
|
|
43351
43816
|
abortSignal
|
|
43352
43817
|
});
|
|
43353
|
-
const headersWithUserAgent = (0,
|
|
43818
|
+
const headersWithUserAgent = (0, import_provider_utils17.withUserAgentSuffix)(
|
|
43354
43819
|
headers != null ? headers : {},
|
|
43355
43820
|
`ai/${VERSION2}`
|
|
43356
43821
|
);
|
|
@@ -43452,7 +43917,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43452
43917
|
this.response = options.response;
|
|
43453
43918
|
}
|
|
43454
43919
|
};
|
|
43455
|
-
var
|
|
43920
|
+
var import_provider_utils18 = require_dist8();
|
|
43456
43921
|
function splitArray(array2, chunkSize) {
|
|
43457
43922
|
if (chunkSize <= 0) {
|
|
43458
43923
|
throw new Error("chunkSize must be greater than 0");
|
|
@@ -43478,7 +43943,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43478
43943
|
maxRetries: maxRetriesArg,
|
|
43479
43944
|
abortSignal
|
|
43480
43945
|
});
|
|
43481
|
-
const headersWithUserAgent = (0,
|
|
43946
|
+
const headersWithUserAgent = (0, import_provider_utils18.withUserAgentSuffix)(
|
|
43482
43947
|
headers != null ? headers : {},
|
|
43483
43948
|
`ai/${VERSION2}`
|
|
43484
43949
|
);
|
|
@@ -43695,7 +44160,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43695
44160
|
this.responses = options.responses;
|
|
43696
44161
|
}
|
|
43697
44162
|
};
|
|
43698
|
-
var
|
|
44163
|
+
var import_provider_utils19 = require_dist8();
|
|
43699
44164
|
async function generateImage({
|
|
43700
44165
|
model: modelArg,
|
|
43701
44166
|
prompt,
|
|
@@ -43711,7 +44176,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43711
44176
|
}) {
|
|
43712
44177
|
var _a16, _b;
|
|
43713
44178
|
const model = resolveImageModel(modelArg);
|
|
43714
|
-
const headersWithUserAgent = (0,
|
|
44179
|
+
const headersWithUserAgent = (0, import_provider_utils19.withUserAgentSuffix)(
|
|
43715
44180
|
headers != null ? headers : {},
|
|
43716
44181
|
`ai/${VERSION2}`
|
|
43717
44182
|
);
|
|
@@ -43821,7 +44286,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43821
44286
|
modelId: model.modelId
|
|
43822
44287
|
});
|
|
43823
44288
|
}
|
|
43824
|
-
var
|
|
44289
|
+
var import_provider_utils22 = require_dist8();
|
|
43825
44290
|
function extractReasoningContent(content) {
|
|
43826
44291
|
const parts = content.filter(
|
|
43827
44292
|
(content2) => content2.type === "reasoning"
|
|
@@ -43829,7 +44294,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43829
44294
|
return parts.length === 0 ? void 0 : parts.map((content2) => content2.text).join("\n");
|
|
43830
44295
|
}
|
|
43831
44296
|
var import_provider24 = require_dist5();
|
|
43832
|
-
var
|
|
44297
|
+
var import_provider_utils20 = require_dist8();
|
|
43833
44298
|
var noSchemaOutputStrategy = {
|
|
43834
44299
|
type: "no-schema",
|
|
43835
44300
|
jsonSchema: void 0,
|
|
@@ -43868,7 +44333,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43868
44333
|
};
|
|
43869
44334
|
},
|
|
43870
44335
|
async validateFinalResult(value) {
|
|
43871
|
-
return (0,
|
|
44336
|
+
return (0, import_provider_utils20.safeValidateTypes)({ value, schema });
|
|
43872
44337
|
},
|
|
43873
44338
|
createElementStream() {
|
|
43874
44339
|
throw new import_provider24.UnsupportedFunctionalityError({
|
|
@@ -43912,7 +44377,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43912
44377
|
const resultArray = [];
|
|
43913
44378
|
for (let i = 0; i < inputArray.length; i++) {
|
|
43914
44379
|
const element = inputArray[i];
|
|
43915
|
-
const result = await (0,
|
|
44380
|
+
const result = await (0, import_provider_utils20.safeValidateTypes)({ value: element, schema });
|
|
43916
44381
|
if (i === inputArray.length - 1 && !isFinalDelta) {
|
|
43917
44382
|
continue;
|
|
43918
44383
|
}
|
|
@@ -43953,7 +44418,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
43953
44418
|
}
|
|
43954
44419
|
const inputArray = value.elements;
|
|
43955
44420
|
for (const element of inputArray) {
|
|
43956
|
-
const result = await (0,
|
|
44421
|
+
const result = await (0, import_provider_utils20.safeValidateTypes)({ value: element, schema });
|
|
43957
44422
|
if (!result.success) {
|
|
43958
44423
|
return result;
|
|
43959
44424
|
}
|
|
@@ -44071,9 +44536,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44071
44536
|
}) {
|
|
44072
44537
|
switch (output) {
|
|
44073
44538
|
case "object":
|
|
44074
|
-
return objectOutputStrategy((0,
|
|
44539
|
+
return objectOutputStrategy((0, import_provider_utils20.asSchema)(schema));
|
|
44075
44540
|
case "array":
|
|
44076
|
-
return arrayOutputStrategy((0,
|
|
44541
|
+
return arrayOutputStrategy((0, import_provider_utils20.asSchema)(schema));
|
|
44077
44542
|
case "enum":
|
|
44078
44543
|
return enumOutputStrategy(enumValues);
|
|
44079
44544
|
case "no-schema":
|
|
@@ -44085,9 +44550,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44085
44550
|
}
|
|
44086
44551
|
}
|
|
44087
44552
|
var import_provider25 = require_dist5();
|
|
44088
|
-
var
|
|
44553
|
+
var import_provider_utils21 = require_dist8();
|
|
44089
44554
|
async function parseAndValidateObjectResult(result, outputStrategy, context2) {
|
|
44090
|
-
const parseResult = await (0,
|
|
44555
|
+
const parseResult = await (0, import_provider_utils21.safeParseJSON)({ text: result });
|
|
44091
44556
|
if (!parseResult.success) {
|
|
44092
44557
|
throw new NoObjectGeneratedError({
|
|
44093
44558
|
message: "No object generated: could not parse the response.",
|
|
@@ -44255,7 +44720,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44255
44720
|
}
|
|
44256
44721
|
}
|
|
44257
44722
|
}
|
|
44258
|
-
var originalGenerateId3 = (0,
|
|
44723
|
+
var originalGenerateId3 = (0, import_provider_utils22.createIdGenerator)({ prefix: "aiobj", size: 24 });
|
|
44259
44724
|
async function generateObject(options) {
|
|
44260
44725
|
const {
|
|
44261
44726
|
model: modelArg,
|
|
@@ -44300,7 +44765,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44300
44765
|
enumValues
|
|
44301
44766
|
});
|
|
44302
44767
|
const callSettings = prepareCallSettings(settings);
|
|
44303
|
-
const headersWithUserAgent = (0,
|
|
44768
|
+
const headersWithUserAgent = (0, import_provider_utils22.withUserAgentSuffix)(
|
|
44304
44769
|
headers != null ? headers : {},
|
|
44305
44770
|
`ai/${VERSION2}`
|
|
44306
44771
|
);
|
|
@@ -44517,7 +44982,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44517
44982
|
});
|
|
44518
44983
|
}
|
|
44519
44984
|
};
|
|
44520
|
-
var
|
|
44985
|
+
var import_provider_utils24 = require_dist8();
|
|
44521
44986
|
function cosineSimilarity(vector1, vector2) {
|
|
44522
44987
|
if (vector1.length !== vector2.length) {
|
|
44523
44988
|
throw new InvalidArgumentError({
|
|
@@ -44542,6 +45007,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44542
45007
|
}
|
|
44543
45008
|
return magnitudeSquared1 === 0 || magnitudeSquared2 === 0 ? 0 : dotProduct / (Math.sqrt(magnitudeSquared1) * Math.sqrt(magnitudeSquared2));
|
|
44544
45009
|
}
|
|
45010
|
+
function createDownload(options) {
|
|
45011
|
+
return ({ url: url2, abortSignal }) => download({ url: url2, maxBytes: options == null ? void 0 : options.maxBytes, abortSignal });
|
|
45012
|
+
}
|
|
44545
45013
|
function getTextFromDataUrl(dataUrl) {
|
|
44546
45014
|
const [header, base64Content] = dataUrl.split(",");
|
|
44547
45015
|
const mediaType = header.split(";")[0].split(":")[1];
|
|
@@ -44617,7 +45085,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44617
45085
|
});
|
|
44618
45086
|
}
|
|
44619
45087
|
};
|
|
44620
|
-
var
|
|
45088
|
+
var import_provider_utils23 = require_dist8();
|
|
44621
45089
|
function simulateReadableStream({
|
|
44622
45090
|
chunks,
|
|
44623
45091
|
initialDelayInMs = 0,
|
|
@@ -44625,7 +45093,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44625
45093
|
_internal
|
|
44626
45094
|
}) {
|
|
44627
45095
|
var _a16;
|
|
44628
|
-
const delay2 = (_a16 = _internal == null ? void 0 : _internal.delay) != null ? _a16 :
|
|
45096
|
+
const delay2 = (_a16 = _internal == null ? void 0 : _internal.delay) != null ? _a16 : import_provider_utils23.delay;
|
|
44629
45097
|
let index = 0;
|
|
44630
45098
|
return new ReadableStream({
|
|
44631
45099
|
async pull(controller) {
|
|
@@ -44638,7 +45106,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44638
45106
|
}
|
|
44639
45107
|
});
|
|
44640
45108
|
}
|
|
44641
|
-
var originalGenerateId4 = (0,
|
|
45109
|
+
var originalGenerateId4 = (0, import_provider_utils24.createIdGenerator)({ prefix: "aiobj", size: 24 });
|
|
44642
45110
|
function streamObject(options) {
|
|
44643
45111
|
const {
|
|
44644
45112
|
model,
|
|
@@ -44728,13 +45196,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
44728
45196
|
currentDate,
|
|
44729
45197
|
now: now2
|
|
44730
45198
|
}) {
|
|
44731
|
-
this._object = new
|
|
44732
|
-
this._usage = new
|
|
44733
|
-
this._providerMetadata = new
|
|
44734
|
-
this._warnings = new
|
|
44735
|
-
this._request = new
|
|
44736
|
-
this._response = new
|
|
44737
|
-
this._finishReason = new
|
|
45199
|
+
this._object = new import_provider_utils24.DelayedPromise();
|
|
45200
|
+
this._usage = new import_provider_utils24.DelayedPromise();
|
|
45201
|
+
this._providerMetadata = new import_provider_utils24.DelayedPromise();
|
|
45202
|
+
this._warnings = new import_provider_utils24.DelayedPromise();
|
|
45203
|
+
this._request = new import_provider_utils24.DelayedPromise();
|
|
45204
|
+
this._response = new import_provider_utils24.DelayedPromise();
|
|
45205
|
+
this._finishReason = new import_provider_utils24.DelayedPromise();
|
|
44738
45206
|
const model = resolveLanguageModel(modelArg);
|
|
44739
45207
|
const { maxRetries, retry } = prepareRetries({
|
|
44740
45208
|
maxRetries: maxRetriesArg,
|
|
@@ -45157,7 +45625,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45157
45625
|
});
|
|
45158
45626
|
}
|
|
45159
45627
|
};
|
|
45160
|
-
var
|
|
45628
|
+
var import_provider_utils25 = require_dist8();
|
|
45161
45629
|
var DefaultGeneratedAudioFile = class extends DefaultGeneratedFile {
|
|
45162
45630
|
constructor({
|
|
45163
45631
|
data,
|
|
@@ -45202,7 +45670,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45202
45670
|
modelId: model.modelId
|
|
45203
45671
|
});
|
|
45204
45672
|
}
|
|
45205
|
-
const headersWithUserAgent = (0,
|
|
45673
|
+
const headersWithUserAgent = (0, import_provider_utils25.withUserAgentSuffix)(
|
|
45206
45674
|
headers != null ? headers : {},
|
|
45207
45675
|
`ai/${VERSION2}`
|
|
45208
45676
|
);
|
|
@@ -45254,7 +45722,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45254
45722
|
object: () => object2,
|
|
45255
45723
|
text: () => text
|
|
45256
45724
|
});
|
|
45257
|
-
var
|
|
45725
|
+
var import_provider_utils26 = require_dist8();
|
|
45258
45726
|
var text = () => ({
|
|
45259
45727
|
type: "text",
|
|
45260
45728
|
responseFormat: { type: "text" },
|
|
@@ -45268,7 +45736,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45268
45736
|
var object2 = ({
|
|
45269
45737
|
schema: inputSchema
|
|
45270
45738
|
}) => {
|
|
45271
|
-
const schema = (0,
|
|
45739
|
+
const schema = (0, import_provider_utils26.asSchema)(inputSchema);
|
|
45272
45740
|
return {
|
|
45273
45741
|
type: "object",
|
|
45274
45742
|
responseFormat: {
|
|
@@ -45294,7 +45762,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45294
45762
|
}
|
|
45295
45763
|
},
|
|
45296
45764
|
async parseOutput({ text: text2 }, context2) {
|
|
45297
|
-
const parseResult = await (0,
|
|
45765
|
+
const parseResult = await (0, import_provider_utils26.safeParseJSON)({ text: text2 });
|
|
45298
45766
|
if (!parseResult.success) {
|
|
45299
45767
|
throw new NoObjectGeneratedError({
|
|
45300
45768
|
message: "No object generated: could not parse the response.",
|
|
@@ -45305,7 +45773,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45305
45773
|
finishReason: context2.finishReason
|
|
45306
45774
|
});
|
|
45307
45775
|
}
|
|
45308
|
-
const validationResult = await (0,
|
|
45776
|
+
const validationResult = await (0, import_provider_utils26.safeValidateTypes)({
|
|
45309
45777
|
value: parseResult.value,
|
|
45310
45778
|
schema
|
|
45311
45779
|
});
|
|
@@ -45393,7 +45861,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45393
45861
|
}
|
|
45394
45862
|
return messages;
|
|
45395
45863
|
}
|
|
45396
|
-
var
|
|
45864
|
+
var import_provider_utils27 = require_dist8();
|
|
45397
45865
|
var import_provider26 = require_dist5();
|
|
45398
45866
|
var CHUNKING_REGEXPS = {
|
|
45399
45867
|
word: /\S+\s+/m,
|
|
@@ -45402,7 +45870,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45402
45870
|
function smoothStream({
|
|
45403
45871
|
delayInMs = 10,
|
|
45404
45872
|
chunking = "word",
|
|
45405
|
-
_internal: { delay: delay2 =
|
|
45873
|
+
_internal: { delay: delay2 = import_provider_utils27.delay } = {}
|
|
45406
45874
|
} = {}) {
|
|
45407
45875
|
let detectChunk;
|
|
45408
45876
|
if (typeof chunking === "function") {
|
|
@@ -45981,7 +46449,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45981
46449
|
return model;
|
|
45982
46450
|
}
|
|
45983
46451
|
};
|
|
45984
|
-
var
|
|
46452
|
+
var import_provider_utils28 = require_dist8();
|
|
45985
46453
|
var import_provider30 = require_dist5();
|
|
45986
46454
|
var NoTranscriptGeneratedError = class extends import_provider30.AISDKError {
|
|
45987
46455
|
constructor(options) {
|
|
@@ -45992,13 +46460,15 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
45992
46460
|
this.responses = options.responses;
|
|
45993
46461
|
}
|
|
45994
46462
|
};
|
|
46463
|
+
var defaultDownload = createDownload();
|
|
45995
46464
|
async function transcribe({
|
|
45996
46465
|
model,
|
|
45997
46466
|
audio,
|
|
45998
46467
|
providerOptions = {},
|
|
45999
46468
|
maxRetries: maxRetriesArg,
|
|
46000
46469
|
abortSignal,
|
|
46001
|
-
headers
|
|
46470
|
+
headers,
|
|
46471
|
+
download: downloadFn = defaultDownload
|
|
46002
46472
|
}) {
|
|
46003
46473
|
if (model.specificationVersion !== "v2") {
|
|
46004
46474
|
throw new UnsupportedModelVersionError({
|
|
@@ -46011,11 +46481,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46011
46481
|
maxRetries: maxRetriesArg,
|
|
46012
46482
|
abortSignal
|
|
46013
46483
|
});
|
|
46014
|
-
const headersWithUserAgent = (0,
|
|
46484
|
+
const headersWithUserAgent = (0, import_provider_utils28.withUserAgentSuffix)(
|
|
46015
46485
|
headers != null ? headers : {},
|
|
46016
46486
|
`ai/${VERSION2}`
|
|
46017
46487
|
);
|
|
46018
|
-
const audioData = audio instanceof URL ? (await
|
|
46488
|
+
const audioData = audio instanceof URL ? (await downloadFn({ url: audio, abortSignal })).data : convertDataContentToUint8Array(audio);
|
|
46019
46489
|
const result = await retry(
|
|
46020
46490
|
() => {
|
|
46021
46491
|
var _a16;
|
|
@@ -46057,7 +46527,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46057
46527
|
this.providerMetadata = (_a16 = options.providerMetadata) != null ? _a16 : {};
|
|
46058
46528
|
}
|
|
46059
46529
|
};
|
|
46060
|
-
var
|
|
46530
|
+
var import_provider_utils29 = require_dist8();
|
|
46061
46531
|
async function processTextStream({
|
|
46062
46532
|
stream,
|
|
46063
46533
|
onTextPart
|
|
@@ -46101,13 +46571,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46101
46571
|
...body
|
|
46102
46572
|
}),
|
|
46103
46573
|
credentials,
|
|
46104
|
-
headers: (0,
|
|
46574
|
+
headers: (0, import_provider_utils29.withUserAgentSuffix)(
|
|
46105
46575
|
{
|
|
46106
46576
|
"Content-Type": "application/json",
|
|
46107
46577
|
...headers
|
|
46108
46578
|
},
|
|
46109
46579
|
`ai-sdk/${VERSION2}`,
|
|
46110
|
-
(0,
|
|
46580
|
+
(0, import_provider_utils29.getRuntimeEnvironmentUserAgent)()
|
|
46111
46581
|
),
|
|
46112
46582
|
signal: abortController.signal
|
|
46113
46583
|
}).catch((err) => {
|
|
@@ -46135,7 +46605,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46135
46605
|
}
|
|
46136
46606
|
case "data": {
|
|
46137
46607
|
await consumeStream({
|
|
46138
|
-
stream: (0,
|
|
46608
|
+
stream: (0, import_provider_utils29.parseJsonEventStream)({
|
|
46139
46609
|
stream: response.body,
|
|
46140
46610
|
schema: uiMessageChunkSchema
|
|
46141
46611
|
}).pipeThrough(
|
|
@@ -46185,7 +46655,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46185
46655
|
setLoading(false);
|
|
46186
46656
|
}
|
|
46187
46657
|
}
|
|
46188
|
-
var
|
|
46658
|
+
var import_provider_utils32 = require_dist8();
|
|
46189
46659
|
async function convertFileListToFileUIParts(files) {
|
|
46190
46660
|
if (files == null) {
|
|
46191
46661
|
return [];
|
|
@@ -46214,8 +46684,8 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46214
46684
|
})
|
|
46215
46685
|
);
|
|
46216
46686
|
}
|
|
46687
|
+
var import_provider_utils31 = require_dist8();
|
|
46217
46688
|
var import_provider_utils30 = require_dist8();
|
|
46218
|
-
var import_provider_utils29 = require_dist8();
|
|
46219
46689
|
var HttpChatTransport = class {
|
|
46220
46690
|
constructor({
|
|
46221
46691
|
api = "/api/chat",
|
|
@@ -46239,12 +46709,12 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46239
46709
|
...options
|
|
46240
46710
|
}) {
|
|
46241
46711
|
var _a16, _b, _c, _d, _e;
|
|
46242
|
-
const resolvedBody = await (0,
|
|
46243
|
-
const resolvedHeaders = await (0,
|
|
46244
|
-
const resolvedCredentials = await (0,
|
|
46712
|
+
const resolvedBody = await (0, import_provider_utils30.resolve)(this.body);
|
|
46713
|
+
const resolvedHeaders = await (0, import_provider_utils30.resolve)(this.headers);
|
|
46714
|
+
const resolvedCredentials = await (0, import_provider_utils30.resolve)(this.credentials);
|
|
46245
46715
|
const baseHeaders = {
|
|
46246
|
-
...(0,
|
|
46247
|
-
...(0,
|
|
46716
|
+
...(0, import_provider_utils30.normalizeHeaders)(resolvedHeaders),
|
|
46717
|
+
...(0, import_provider_utils30.normalizeHeaders)(options.headers)
|
|
46248
46718
|
};
|
|
46249
46719
|
const preparedRequest = await ((_a16 = this.prepareSendMessagesRequest) == null ? void 0 : _a16.call(this, {
|
|
46250
46720
|
api: this.api,
|
|
@@ -46258,7 +46728,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46258
46728
|
messageId: options.messageId
|
|
46259
46729
|
}));
|
|
46260
46730
|
const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : this.api;
|
|
46261
|
-
const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0,
|
|
46731
|
+
const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils30.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
|
|
46262
46732
|
const body = (preparedRequest == null ? void 0 : preparedRequest.body) !== void 0 ? preparedRequest.body : {
|
|
46263
46733
|
...resolvedBody,
|
|
46264
46734
|
...options.body,
|
|
@@ -46271,13 +46741,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46271
46741
|
const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
|
|
46272
46742
|
const response = await fetch2(api, {
|
|
46273
46743
|
method: "POST",
|
|
46274
|
-
headers: (0,
|
|
46744
|
+
headers: (0, import_provider_utils30.withUserAgentSuffix)(
|
|
46275
46745
|
{
|
|
46276
46746
|
"Content-Type": "application/json",
|
|
46277
46747
|
...headers
|
|
46278
46748
|
},
|
|
46279
46749
|
`ai-sdk/${VERSION2}`,
|
|
46280
|
-
(0,
|
|
46750
|
+
(0, import_provider_utils30.getRuntimeEnvironmentUserAgent)()
|
|
46281
46751
|
),
|
|
46282
46752
|
body: JSON.stringify(body),
|
|
46283
46753
|
credentials,
|
|
@@ -46295,12 +46765,12 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46295
46765
|
}
|
|
46296
46766
|
async reconnectToStream(options) {
|
|
46297
46767
|
var _a16, _b, _c, _d, _e;
|
|
46298
|
-
const resolvedBody = await (0,
|
|
46299
|
-
const resolvedHeaders = await (0,
|
|
46300
|
-
const resolvedCredentials = await (0,
|
|
46768
|
+
const resolvedBody = await (0, import_provider_utils30.resolve)(this.body);
|
|
46769
|
+
const resolvedHeaders = await (0, import_provider_utils30.resolve)(this.headers);
|
|
46770
|
+
const resolvedCredentials = await (0, import_provider_utils30.resolve)(this.credentials);
|
|
46301
46771
|
const baseHeaders = {
|
|
46302
|
-
...(0,
|
|
46303
|
-
...(0,
|
|
46772
|
+
...(0, import_provider_utils30.normalizeHeaders)(resolvedHeaders),
|
|
46773
|
+
...(0, import_provider_utils30.normalizeHeaders)(options.headers)
|
|
46304
46774
|
};
|
|
46305
46775
|
const preparedRequest = await ((_a16 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a16.call(this, {
|
|
46306
46776
|
api: this.api,
|
|
@@ -46311,15 +46781,15 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46311
46781
|
requestMetadata: options.metadata
|
|
46312
46782
|
}));
|
|
46313
46783
|
const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : `${this.api}/${options.chatId}/stream`;
|
|
46314
|
-
const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0,
|
|
46784
|
+
const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils30.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
|
|
46315
46785
|
const credentials = (_c = preparedRequest == null ? void 0 : preparedRequest.credentials) != null ? _c : resolvedCredentials;
|
|
46316
46786
|
const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
|
|
46317
46787
|
const response = await fetch2(api, {
|
|
46318
46788
|
method: "GET",
|
|
46319
|
-
headers: (0,
|
|
46789
|
+
headers: (0, import_provider_utils30.withUserAgentSuffix)(
|
|
46320
46790
|
headers,
|
|
46321
46791
|
`ai-sdk/${VERSION2}`,
|
|
46322
|
-
(0,
|
|
46792
|
+
(0, import_provider_utils30.getRuntimeEnvironmentUserAgent)()
|
|
46323
46793
|
),
|
|
46324
46794
|
credentials
|
|
46325
46795
|
});
|
|
@@ -46342,7 +46812,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46342
46812
|
super(options);
|
|
46343
46813
|
}
|
|
46344
46814
|
processResponseStream(stream) {
|
|
46345
|
-
return (0,
|
|
46815
|
+
return (0, import_provider_utils31.parseJsonEventStream)({
|
|
46346
46816
|
stream,
|
|
46347
46817
|
schema: uiMessageChunkSchema
|
|
46348
46818
|
}).pipeThrough(
|
|
@@ -46359,7 +46829,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46359
46829
|
};
|
|
46360
46830
|
var AbstractChat = class {
|
|
46361
46831
|
constructor({
|
|
46362
|
-
generateId: generateId3 =
|
|
46832
|
+
generateId: generateId3 = import_provider_utils32.generateId,
|
|
46363
46833
|
id = generateId3(),
|
|
46364
46834
|
transport = new DefaultChatTransport(),
|
|
46365
46835
|
messageMetadataSchema,
|
|
@@ -46720,10 +47190,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46720
47190
|
}
|
|
46721
47191
|
};
|
|
46722
47192
|
var import_provider31 = require_dist5();
|
|
46723
|
-
var
|
|
47193
|
+
var import_provider_utils33 = require_dist8();
|
|
46724
47194
|
var import_v48 = require_v4();
|
|
46725
|
-
var uiMessagesSchema = (0,
|
|
46726
|
-
() => (0,
|
|
47195
|
+
var uiMessagesSchema = (0, import_provider_utils33.lazyValidator)(
|
|
47196
|
+
() => (0, import_provider_utils33.zodSchema)(
|
|
46727
47197
|
import_v48.z.array(
|
|
46728
47198
|
import_v48.z.object({
|
|
46729
47199
|
id: import_v48.z.string(),
|
|
@@ -46937,13 +47407,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46937
47407
|
})
|
|
46938
47408
|
};
|
|
46939
47409
|
}
|
|
46940
|
-
const validatedMessages = await (0,
|
|
47410
|
+
const validatedMessages = await (0, import_provider_utils33.validateTypes)({
|
|
46941
47411
|
value: messages,
|
|
46942
47412
|
schema: uiMessagesSchema
|
|
46943
47413
|
});
|
|
46944
47414
|
if (metadataSchema) {
|
|
46945
47415
|
for (const message of validatedMessages) {
|
|
46946
|
-
await (0,
|
|
47416
|
+
await (0, import_provider_utils33.validateTypes)({
|
|
46947
47417
|
value: message.metadata,
|
|
46948
47418
|
schema: metadataSchema
|
|
46949
47419
|
});
|
|
@@ -46966,7 +47436,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46966
47436
|
})
|
|
46967
47437
|
};
|
|
46968
47438
|
}
|
|
46969
|
-
await (0,
|
|
47439
|
+
await (0, import_provider_utils33.validateTypes)({
|
|
46970
47440
|
value: dataPart.data,
|
|
46971
47441
|
schema: dataSchema
|
|
46972
47442
|
});
|
|
@@ -46991,13 +47461,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
46991
47461
|
};
|
|
46992
47462
|
}
|
|
46993
47463
|
if (toolPart.state === "input-available" || toolPart.state === "output-available" || toolPart.state === "output-error") {
|
|
46994
|
-
await (0,
|
|
47464
|
+
await (0, import_provider_utils33.validateTypes)({
|
|
46995
47465
|
value: toolPart.input,
|
|
46996
47466
|
schema: tool2.inputSchema
|
|
46997
47467
|
});
|
|
46998
47468
|
}
|
|
46999
47469
|
if (toolPart.state === "output-available" && tool2.outputSchema) {
|
|
47000
|
-
await (0,
|
|
47470
|
+
await (0, import_provider_utils33.validateTypes)({
|
|
47001
47471
|
value: toolPart.output,
|
|
47002
47472
|
schema: tool2.outputSchema
|
|
47003
47473
|
});
|
|
@@ -47033,13 +47503,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
47033
47503
|
throw response.error;
|
|
47034
47504
|
return response.data;
|
|
47035
47505
|
}
|
|
47036
|
-
var
|
|
47506
|
+
var import_provider_utils34 = require_dist8();
|
|
47037
47507
|
function createUIMessageStream({
|
|
47038
47508
|
execute,
|
|
47039
|
-
onError =
|
|
47509
|
+
onError = import_provider_utils34.getErrorMessage,
|
|
47040
47510
|
originalMessages,
|
|
47041
47511
|
onFinish,
|
|
47042
|
-
generateId: generateId3 =
|
|
47512
|
+
generateId: generateId3 = import_provider_utils34.generateId
|
|
47043
47513
|
}) {
|
|
47044
47514
|
let controller;
|
|
47045
47515
|
const ongoingStreamPromises = [];
|
|
@@ -60191,7 +60661,7 @@ var init_versions = __esm({
|
|
|
60191
60661
|
version2 = {
|
|
60192
60662
|
major: 4,
|
|
60193
60663
|
minor: 3,
|
|
60194
|
-
patch:
|
|
60664
|
+
patch: 6
|
|
60195
60665
|
};
|
|
60196
60666
|
}
|
|
60197
60667
|
});
|
|
@@ -61609,7 +62079,7 @@ var init_schemas = __esm({
|
|
|
61609
62079
|
if (keyResult instanceof Promise) {
|
|
61610
62080
|
throw new Error("Async schemas not supported in object keys currently");
|
|
61611
62081
|
}
|
|
61612
|
-
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length
|
|
62082
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
61613
62083
|
if (checkNumericKey) {
|
|
61614
62084
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
61615
62085
|
if (retryResult instanceof Promise) {
|
|
@@ -69403,7 +69873,7 @@ function finalize(ctx, schema) {
|
|
|
69403
69873
|
}
|
|
69404
69874
|
}
|
|
69405
69875
|
}
|
|
69406
|
-
if (refSchema.$ref) {
|
|
69876
|
+
if (refSchema.$ref && refSeen.def) {
|
|
69407
69877
|
for (const key in schema2) {
|
|
69408
69878
|
if (key === "$ref" || key === "allOf")
|
|
69409
69879
|
continue;
|
|
@@ -73672,6 +74142,37 @@ var require_DashboardPlugins = __commonJS({
|
|
|
73672
74142
|
}
|
|
73673
74143
|
});
|
|
73674
74144
|
|
|
74145
|
+
// ../codegen-common-logic/dist/extensions/DashboardMenuPlugins.js
|
|
74146
|
+
var require_DashboardMenuPlugins = __commonJS({
|
|
74147
|
+
"../codegen-common-logic/dist/extensions/DashboardMenuPlugins.js"(exports2) {
|
|
74148
|
+
"use strict";
|
|
74149
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
74150
|
+
exports2.getDashboardMenuPluginsDecisionGuide = exports2.getDashboardMenuPluginsAgentDocumentation = void 0;
|
|
74151
|
+
var getDashboardMenuPluginsAgentDocumentation = () => {
|
|
74152
|
+
return `<dashboard_menu_plugins>
|
|
74153
|
+
#### Dashboard Menu Plugins
|
|
74154
|
+
|
|
74155
|
+
- **Description**: Menu items added to dashboard page menus that can navigate to pages or open modals
|
|
74156
|
+
- **Use Cases**:
|
|
74157
|
+
- Quick access to app features
|
|
74158
|
+
- Navigation shortcuts
|
|
74159
|
+
- Context-specific actions
|
|
74160
|
+
- **When to Choose**: When you need to add navigation items or quick actions to existing dashboard menus
|
|
74161
|
+
</dashboard_menu_plugins>`;
|
|
74162
|
+
};
|
|
74163
|
+
exports2.getDashboardMenuPluginsAgentDocumentation = getDashboardMenuPluginsAgentDocumentation;
|
|
74164
|
+
var getDashboardMenuPluginsDecisionGuide = () => {
|
|
74165
|
+
return `### Choose Dashboard Menu Plugins when:
|
|
74166
|
+
|
|
74167
|
+
- \u2705 Need to add custom navigation items to the dashboard sidebar
|
|
74168
|
+
- \u2705 Want quick-access shortcuts to app features from the dashboard menu
|
|
74169
|
+
- \u2705 Need context-specific actions accessible from dashboard navigation
|
|
74170
|
+
- \u2705 Want to link dashboard menu items to Dashboard Pages`;
|
|
74171
|
+
};
|
|
74172
|
+
exports2.getDashboardMenuPluginsDecisionGuide = getDashboardMenuPluginsDecisionGuide;
|
|
74173
|
+
}
|
|
74174
|
+
});
|
|
74175
|
+
|
|
73675
74176
|
// ../codegen-common-logic/dist/extensions/DashboardExtensions.js
|
|
73676
74177
|
var require_DashboardExtensions = __commonJS({
|
|
73677
74178
|
"../codegen-common-logic/dist/extensions/DashboardExtensions.js"(exports2) {
|
|
@@ -73680,12 +74181,15 @@ var require_DashboardExtensions = __commonJS({
|
|
|
73680
74181
|
exports2.getDashboardExtensionsDocumentation = void 0;
|
|
73681
74182
|
var DashboardPageAgent_1 = require_DashboardPageAgent();
|
|
73682
74183
|
var DashboardPlugins_1 = require_DashboardPlugins();
|
|
74184
|
+
var DashboardMenuPlugins_1 = require_DashboardMenuPlugins();
|
|
73683
74185
|
var getDashboardExtensionsDocumentation = (options) => {
|
|
73684
74186
|
return `### Dashboard Extensions
|
|
73685
74187
|
Dashboard extensions add functionality to the Wix Dashboard for site administrators. They are not visible on live sites.
|
|
73686
74188
|
${(0, DashboardPageAgent_1.getDashboardPageAgentDocumentation)()}${options?.enableNewExtensions ? `
|
|
73687
74189
|
|
|
73688
|
-
${(0, DashboardPlugins_1.getDashboardPluginsAgentDocumentation)()}
|
|
74190
|
+
${(0, DashboardPlugins_1.getDashboardPluginsAgentDocumentation)()}
|
|
74191
|
+
|
|
74192
|
+
${(0, DashboardMenuPlugins_1.getDashboardMenuPluginsAgentDocumentation)()}` : ""}`;
|
|
73689
74193
|
};
|
|
73690
74194
|
exports2.getDashboardExtensionsDocumentation = getDashboardExtensionsDocumentation;
|
|
73691
74195
|
}
|
|
@@ -73860,37 +74364,6 @@ ${(0, SitePluginAgent_1.getSitePluginAgentDocumentation)()}` : ""}`;
|
|
|
73860
74364
|
}
|
|
73861
74365
|
});
|
|
73862
74366
|
|
|
73863
|
-
// ../codegen-common-logic/dist/extensions/DashboardMenuPlugins.js
|
|
73864
|
-
var require_DashboardMenuPlugins = __commonJS({
|
|
73865
|
-
"../codegen-common-logic/dist/extensions/DashboardMenuPlugins.js"(exports2) {
|
|
73866
|
-
"use strict";
|
|
73867
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
73868
|
-
exports2.getDashboardMenuPluginsDecisionGuide = exports2.getDashboardMenuPluginsAgentDocumentation = void 0;
|
|
73869
|
-
var getDashboardMenuPluginsAgentDocumentation = () => {
|
|
73870
|
-
return `<dashboard_menu_plugins>
|
|
73871
|
-
#### Dashboard Menu Plugins
|
|
73872
|
-
|
|
73873
|
-
- **Description**: Menu items added to dashboard page menus that can navigate to pages or open modals
|
|
73874
|
-
- **Use Cases**:
|
|
73875
|
-
- Quick access to app features
|
|
73876
|
-
- Navigation shortcuts
|
|
73877
|
-
- Context-specific actions
|
|
73878
|
-
- **When to Choose**: When you need to add navigation items or quick actions to existing dashboard menus
|
|
73879
|
-
</dashboard_menu_plugins>`;
|
|
73880
|
-
};
|
|
73881
|
-
exports2.getDashboardMenuPluginsAgentDocumentation = getDashboardMenuPluginsAgentDocumentation;
|
|
73882
|
-
var getDashboardMenuPluginsDecisionGuide = () => {
|
|
73883
|
-
return `### Choose Dashboard Menu Plugins when:
|
|
73884
|
-
|
|
73885
|
-
- \u2705 Need to add custom navigation items to the dashboard sidebar
|
|
73886
|
-
- \u2705 Want quick-access shortcuts to app features from the dashboard menu
|
|
73887
|
-
- \u2705 Need context-specific actions accessible from dashboard navigation
|
|
73888
|
-
- \u2705 Want to link dashboard menu items to Dashboard Pages`;
|
|
73889
|
-
};
|
|
73890
|
-
exports2.getDashboardMenuPluginsDecisionGuide = getDashboardMenuPluginsDecisionGuide;
|
|
73891
|
-
}
|
|
73892
|
-
});
|
|
73893
|
-
|
|
73894
74367
|
// ../codegen-common-logic/dist/extensions/DashboardModals.js
|
|
73895
74368
|
var require_DashboardModals = __commonJS({
|
|
73896
74369
|
"../codegen-common-logic/dist/extensions/DashboardModals.js"(exports2) {
|
|
@@ -73931,6 +74404,7 @@ var require_extensionsDecisionGuide = __commonJS({
|
|
|
73931
74404
|
exports2.getExtensionDecisionMatrix = void 0;
|
|
73932
74405
|
var DashboardPageAgent_1 = require_DashboardPageAgent();
|
|
73933
74406
|
var DashboardPlugins_1 = require_DashboardPlugins();
|
|
74407
|
+
var DashboardMenuPlugins_1 = require_DashboardMenuPlugins();
|
|
73934
74408
|
var EmbeddedScriptAgent_1 = require_EmbeddedScriptAgent();
|
|
73935
74409
|
var CustomElementAgent_1 = require_CustomElementAgent();
|
|
73936
74410
|
var SiteComponentAgent_1 = require_SiteComponentAgent();
|
|
@@ -73943,7 +74417,9 @@ var require_extensionsDecisionGuide = __commonJS({
|
|
|
73943
74417
|
return `## Decision Matrix
|
|
73944
74418
|
${(0, DashboardPageAgent_1.getDashboardPageDecisionGuide)()}${options?.enableNewExtensions ? `
|
|
73945
74419
|
|
|
73946
|
-
${(0, DashboardPlugins_1.getDashboardPluginsDecisionGuide)()}
|
|
74420
|
+
${(0, DashboardPlugins_1.getDashboardPluginsDecisionGuide)()}
|
|
74421
|
+
|
|
74422
|
+
${(0, DashboardMenuPlugins_1.getDashboardMenuPluginsDecisionGuide)()}` : ""}
|
|
73947
74423
|
|
|
73948
74424
|
${(0, EmbeddedScriptAgent_1.getEmbeddedScriptDecisionGuide)()}
|
|
73949
74425
|
|
|
@@ -78220,9 +78696,9 @@ var require_external3 = __commonJS({
|
|
|
78220
78696
|
}
|
|
78221
78697
|
});
|
|
78222
78698
|
|
|
78223
|
-
// ../../node_modules/zod/v4
|
|
78224
|
-
var
|
|
78225
|
-
"../../node_modules/zod/v4
|
|
78699
|
+
// ../../node_modules/zod/v4-mini/index.cjs
|
|
78700
|
+
var require_v4_mini = __commonJS({
|
|
78701
|
+
"../../node_modules/zod/v4-mini/index.cjs"(exports2) {
|
|
78226
78702
|
"use strict";
|
|
78227
78703
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
78228
78704
|
if (k2 === void 0) k2 = k;
|
|
@@ -78262,31 +78738,6 @@ var require_mini = __commonJS({
|
|
|
78262
78738
|
}
|
|
78263
78739
|
});
|
|
78264
78740
|
|
|
78265
|
-
// ../../node_modules/zod/v4-mini/index.cjs
|
|
78266
|
-
var require_v4_mini = __commonJS({
|
|
78267
|
-
"../../node_modules/zod/v4-mini/index.cjs"(exports2) {
|
|
78268
|
-
"use strict";
|
|
78269
|
-
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
78270
|
-
if (k2 === void 0) k2 = k;
|
|
78271
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
78272
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
78273
|
-
desc = { enumerable: true, get: function() {
|
|
78274
|
-
return m[k];
|
|
78275
|
-
} };
|
|
78276
|
-
}
|
|
78277
|
-
Object.defineProperty(o, k2, desc);
|
|
78278
|
-
}) : (function(o, m, k, k2) {
|
|
78279
|
-
if (k2 === void 0) k2 = k;
|
|
78280
|
-
o[k2] = m[k];
|
|
78281
|
-
}));
|
|
78282
|
-
var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
78283
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
|
|
78284
|
-
};
|
|
78285
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78286
|
-
__exportStar2(require_mini(), exports2);
|
|
78287
|
-
}
|
|
78288
|
-
});
|
|
78289
|
-
|
|
78290
78741
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js
|
|
78291
78742
|
var require_zod_compat = __commonJS({
|
|
78292
78743
|
"../../node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js"(exports2) {
|