@polka-codes/cli 0.9.53 → 0.9.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +695 -583
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -471,7 +471,7 @@ var require_config = __commonJS(() => {
|
|
|
471
471
|
})();
|
|
472
472
|
});
|
|
473
473
|
|
|
474
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
474
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/error.js
|
|
475
475
|
var require_error = __commonJS((exports) => {
|
|
476
476
|
class CommanderError extends Error {
|
|
477
477
|
constructor(exitCode, code, message) {
|
|
@@ -495,7 +495,7 @@ var require_error = __commonJS((exports) => {
|
|
|
495
495
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
496
496
|
});
|
|
497
497
|
|
|
498
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
498
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/argument.js
|
|
499
499
|
var require_argument = __commonJS((exports) => {
|
|
500
500
|
var { InvalidArgumentError } = require_error();
|
|
501
501
|
|
|
@@ -575,7 +575,7 @@ var require_argument = __commonJS((exports) => {
|
|
|
575
575
|
exports.humanReadableArgName = humanReadableArgName;
|
|
576
576
|
});
|
|
577
577
|
|
|
578
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
578
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/help.js
|
|
579
579
|
var require_help = __commonJS((exports) => {
|
|
580
580
|
var { humanReadableArgName } = require_argument();
|
|
581
581
|
|
|
@@ -932,7 +932,7 @@ ${itemIndentStr}`);
|
|
|
932
932
|
exports.stripColor = stripColor;
|
|
933
933
|
});
|
|
934
934
|
|
|
935
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
935
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/option.js
|
|
936
936
|
var require_option = __commonJS((exports) => {
|
|
937
937
|
var { InvalidArgumentError } = require_error();
|
|
938
938
|
|
|
@@ -1116,7 +1116,7 @@ var require_option = __commonJS((exports) => {
|
|
|
1116
1116
|
exports.DualOptions = DualOptions;
|
|
1117
1117
|
});
|
|
1118
1118
|
|
|
1119
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
1119
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/suggestSimilar.js
|
|
1120
1120
|
var require_suggestSimilar = __commonJS((exports) => {
|
|
1121
1121
|
var maxDistance = 3;
|
|
1122
1122
|
function editDistance(a, b) {
|
|
@@ -1189,7 +1189,7 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
1189
1189
|
exports.suggestSimilar = suggestSimilar;
|
|
1190
1190
|
});
|
|
1191
1191
|
|
|
1192
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
1192
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/command.js
|
|
1193
1193
|
var require_command = __commonJS((exports) => {
|
|
1194
1194
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
1195
1195
|
var childProcess = __require("node:child_process");
|
|
@@ -2048,7 +2048,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2048
2048
|
return arg.length > 1 && arg[0] === "-";
|
|
2049
2049
|
}
|
|
2050
2050
|
const negativeNumberArg = (arg) => {
|
|
2051
|
-
if (
|
|
2051
|
+
if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg))
|
|
2052
2052
|
return false;
|
|
2053
2053
|
return !this._getCommandAndAncestors().some((cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short)));
|
|
2054
2054
|
};
|
|
@@ -2544,7 +2544,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2544
2544
|
exports.useColor = useColor;
|
|
2545
2545
|
});
|
|
2546
2546
|
|
|
2547
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
2547
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/index.js
|
|
2548
2548
|
var require_commander = __commonJS((exports) => {
|
|
2549
2549
|
var { Argument } = require_argument();
|
|
2550
2550
|
var { Command } = require_command();
|
|
@@ -11955,7 +11955,7 @@ var require_mimeScore = __commonJS((exports, module) => {
|
|
|
11955
11955
|
};
|
|
11956
11956
|
});
|
|
11957
11957
|
|
|
11958
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
11958
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/get-context.js
|
|
11959
11959
|
var require_get_context = __commonJS((exports, module) => {
|
|
11960
11960
|
var __defProp2 = Object.defineProperty;
|
|
11961
11961
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -11987,7 +11987,7 @@ var require_get_context = __commonJS((exports, module) => {
|
|
|
11987
11987
|
}
|
|
11988
11988
|
});
|
|
11989
11989
|
|
|
11990
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
11990
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-error.js
|
|
11991
11991
|
var require_token_error = __commonJS((exports, module) => {
|
|
11992
11992
|
var __defProp2 = Object.defineProperty;
|
|
11993
11993
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -12027,7 +12027,7 @@ var require_token_error = __commonJS((exports, module) => {
|
|
|
12027
12027
|
}
|
|
12028
12028
|
});
|
|
12029
12029
|
|
|
12030
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
12030
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-io.js
|
|
12031
12031
|
var require_token_io = __commonJS((exports, module) => {
|
|
12032
12032
|
var __create2 = Object.create;
|
|
12033
12033
|
var __defProp2 = Object.defineProperty;
|
|
@@ -12094,7 +12094,7 @@ var require_token_io = __commonJS((exports, module) => {
|
|
|
12094
12094
|
}
|
|
12095
12095
|
});
|
|
12096
12096
|
|
|
12097
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
12097
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-util.js
|
|
12098
12098
|
var require_token_util = __commonJS((exports, module) => {
|
|
12099
12099
|
var __create2 = Object.create;
|
|
12100
12100
|
var __defProp2 = Object.defineProperty;
|
|
@@ -12250,7 +12250,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
12250
12250
|
}
|
|
12251
12251
|
});
|
|
12252
12252
|
|
|
12253
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
12253
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token.js
|
|
12254
12254
|
var require_token = __commonJS((exports, module) => {
|
|
12255
12255
|
var __defProp2 = Object.defineProperty;
|
|
12256
12256
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -12298,7 +12298,7 @@ var require_token = __commonJS((exports, module) => {
|
|
|
12298
12298
|
}
|
|
12299
12299
|
});
|
|
12300
12300
|
|
|
12301
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
12301
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js
|
|
12302
12302
|
var require_get_vercel_oidc_token = __commonJS((exports, module) => {
|
|
12303
12303
|
var __defProp2 = Object.defineProperty;
|
|
12304
12304
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -12360,7 +12360,7 @@ ${error46.message}`;
|
|
|
12360
12360
|
}
|
|
12361
12361
|
});
|
|
12362
12362
|
|
|
12363
|
-
// ../../node_modules/.bun/@vercel+oidc@3.0.
|
|
12363
|
+
// ../../node_modules/.bun/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/index.js
|
|
12364
12364
|
var require_dist = __commonJS((exports, module) => {
|
|
12365
12365
|
var __defProp2 = Object.defineProperty;
|
|
12366
12366
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -25635,7 +25635,7 @@ var require_common = __commonJS((exports) => {
|
|
|
25635
25635
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
25636
25636
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
25637
25637
|
};
|
|
25638
|
-
var
|
|
25638
|
+
var _a16;
|
|
25639
25639
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25640
25640
|
exports.GaxiosError = exports.GAXIOS_ERROR_SYMBOL = undefined;
|
|
25641
25641
|
exports.defaultErrorRedactor = defaultErrorRedactor;
|
|
@@ -25645,7 +25645,7 @@ var require_common = __commonJS((exports) => {
|
|
|
25645
25645
|
exports.GAXIOS_ERROR_SYMBOL = Symbol.for(`${util_1.pkg.name}-gaxios-error`);
|
|
25646
25646
|
|
|
25647
25647
|
class GaxiosError extends Error {
|
|
25648
|
-
static [(
|
|
25648
|
+
static [(_a16 = exports.GAXIOS_ERROR_SYMBOL, Symbol.hasInstance)](instance) {
|
|
25649
25649
|
if (instance && typeof instance === "object" && exports.GAXIOS_ERROR_SYMBOL in instance && instance[exports.GAXIOS_ERROR_SYMBOL] === util_1.pkg.version) {
|
|
25650
25650
|
return true;
|
|
25651
25651
|
}
|
|
@@ -25657,7 +25657,7 @@ var require_common = __commonJS((exports) => {
|
|
|
25657
25657
|
this.config = config4;
|
|
25658
25658
|
this.response = response;
|
|
25659
25659
|
this.error = error46;
|
|
25660
|
-
this[
|
|
25660
|
+
this[_a16] = util_1.pkg.version;
|
|
25661
25661
|
this.config = (0, extend_1.default)(true, {}, config4);
|
|
25662
25662
|
if (this.response) {
|
|
25663
25663
|
this.response.config = (0, extend_1.default)(true, {}, this.response.config);
|
|
@@ -25807,9 +25807,9 @@ var require_retry = __commonJS((exports) => {
|
|
|
25807
25807
|
return { shouldRetry: true, config: err.config };
|
|
25808
25808
|
}
|
|
25809
25809
|
function shouldRetryRequest(err) {
|
|
25810
|
-
var
|
|
25810
|
+
var _a16;
|
|
25811
25811
|
const config4 = getConfig(err);
|
|
25812
|
-
if (err.name === "AbortError" || ((
|
|
25812
|
+
if (err.name === "AbortError" || ((_a16 = err.error) === null || _a16 === undefined ? undefined : _a16.name) === "AbortError") {
|
|
25813
25813
|
return false;
|
|
25814
25814
|
}
|
|
25815
25815
|
if (!config4 || config4.retry === 0) {
|
|
@@ -25847,8 +25847,8 @@ var require_retry = __commonJS((exports) => {
|
|
|
25847
25847
|
return;
|
|
25848
25848
|
}
|
|
25849
25849
|
function getNextRetryDelay(config4) {
|
|
25850
|
-
var
|
|
25851
|
-
const retryDelay = config4.currentRetryAttempt ? 0 : (
|
|
25850
|
+
var _a16;
|
|
25851
|
+
const retryDelay = config4.currentRetryAttempt ? 0 : (_a16 = config4.retryDelay) !== null && _a16 !== undefined ? _a16 : 100;
|
|
25852
25852
|
const calculatedDelay = retryDelay + (Math.pow(config4.retryDelayMultiplier, config4.currentRetryAttempt) - 1) / 2 * 1000;
|
|
25853
25853
|
const maxAllowableDelay = config4.totalTimeout - (Date.now() - config4.timeOfFirstRequest);
|
|
25854
25854
|
return Math.min(calculatedDelay, maxAllowableDelay, config4.maxRetryDelay);
|
|
@@ -27602,7 +27602,7 @@ var require_gaxios = __commonJS((exports) => {
|
|
|
27602
27602
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
27603
27603
|
};
|
|
27604
27604
|
var _Gaxios_instances;
|
|
27605
|
-
var
|
|
27605
|
+
var _a16;
|
|
27606
27606
|
var _Gaxios_urlMayUseProxy;
|
|
27607
27607
|
var _Gaxios_applyRequestInterceptors;
|
|
27608
27608
|
var _Gaxios_applyResponseInterceptors;
|
|
@@ -27782,7 +27782,7 @@ Content-Type: ${partContentType}\r
|
|
|
27782
27782
|
}
|
|
27783
27783
|
}
|
|
27784
27784
|
exports.Gaxios = Gaxios;
|
|
27785
|
-
|
|
27785
|
+
_a16 = Gaxios, _Gaxios_instances = new WeakSet, _Gaxios_urlMayUseProxy = function _Gaxios_urlMayUseProxy(url2, noProxy = []) {
|
|
27786
27786
|
var _b8, _c;
|
|
27787
27787
|
const candidate = new url_1.URL(url2);
|
|
27788
27788
|
const noProxyList = [...noProxy];
|
|
@@ -27890,7 +27890,7 @@ Content-Type: ${partContentType}\r
|
|
|
27890
27890
|
const proxy = opts.proxy || ((_b8 = process === null || process === undefined ? undefined : process.env) === null || _b8 === undefined ? undefined : _b8.HTTPS_PROXY) || ((_c = process === null || process === undefined ? undefined : process.env) === null || _c === undefined ? undefined : _c.https_proxy) || ((_d = process === null || process === undefined ? undefined : process.env) === null || _d === undefined ? undefined : _d.HTTP_PROXY) || ((_e = process === null || process === undefined ? undefined : process.env) === null || _e === undefined ? undefined : _e.http_proxy);
|
|
27891
27891
|
const urlMayUseProxy = __classPrivateFieldGet(this, _Gaxios_instances, "m", _Gaxios_urlMayUseProxy).call(this, opts.url, opts.noProxy);
|
|
27892
27892
|
if (opts.agent) {} else if (proxy && urlMayUseProxy) {
|
|
27893
|
-
const HttpsProxyAgent = await __classPrivateFieldGet(
|
|
27893
|
+
const HttpsProxyAgent = await __classPrivateFieldGet(_a16, _a16, "m", _Gaxios_getProxyAgent).call(_a16);
|
|
27894
27894
|
if (this.agentCache.has(proxy)) {
|
|
27895
27895
|
opts.agent = this.agentCache.get(proxy);
|
|
27896
27896
|
} else {
|
|
@@ -27916,8 +27916,8 @@ Content-Type: ${partContentType}\r
|
|
|
27916
27916
|
}
|
|
27917
27917
|
return opts;
|
|
27918
27918
|
}, _Gaxios_getProxyAgent = async function _Gaxios_getProxyAgent() {
|
|
27919
|
-
__classPrivateFieldSet(this,
|
|
27920
|
-
return __classPrivateFieldGet(this,
|
|
27919
|
+
__classPrivateFieldSet(this, _a16, __classPrivateFieldGet(this, _a16, "f", _Gaxios_proxyAgent) || (await Promise.resolve().then(() => __importStar(require_dist4()))).HttpsProxyAgent, "f", _Gaxios_proxyAgent);
|
|
27920
|
+
return __classPrivateFieldGet(this, _a16, "f", _Gaxios_proxyAgent);
|
|
27921
27921
|
};
|
|
27922
27922
|
_Gaxios_proxyAgent = { value: undefined };
|
|
27923
27923
|
});
|
|
@@ -29843,7 +29843,7 @@ var require_gcp_residency = __commonJS((exports) => {
|
|
|
29843
29843
|
(0, fs_1.statSync)(exports.GCE_LINUX_BIOS_PATHS.BIOS_DATE);
|
|
29844
29844
|
const biosVendor = (0, fs_1.readFileSync)(exports.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR, "utf8");
|
|
29845
29845
|
return /Google/.test(biosVendor);
|
|
29846
|
-
} catch (
|
|
29846
|
+
} catch (_a16) {
|
|
29847
29847
|
return false;
|
|
29848
29848
|
}
|
|
29849
29849
|
}
|
|
@@ -30006,11 +30006,11 @@ var require_logging_utils = __commonJS((exports) => {
|
|
|
30006
30006
|
|
|
30007
30007
|
class DebugLogBackendBase {
|
|
30008
30008
|
constructor() {
|
|
30009
|
-
var
|
|
30009
|
+
var _a16;
|
|
30010
30010
|
this.cached = new Map;
|
|
30011
30011
|
this.filters = [];
|
|
30012
30012
|
this.filtersSet = false;
|
|
30013
|
-
let nodeFlag = (
|
|
30013
|
+
let nodeFlag = (_a16 = process5.env[exports.env.nodeEnables]) !== null && _a16 !== undefined ? _a16 : "*";
|
|
30014
30014
|
if (nodeFlag === "all") {
|
|
30015
30015
|
nodeFlag = "*";
|
|
30016
30016
|
}
|
|
@@ -30048,7 +30048,7 @@ var require_logging_utils = __commonJS((exports) => {
|
|
|
30048
30048
|
return () => {};
|
|
30049
30049
|
}
|
|
30050
30050
|
return (fields, ...args) => {
|
|
30051
|
-
var
|
|
30051
|
+
var _a16;
|
|
30052
30052
|
const nscolour = `${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`;
|
|
30053
30053
|
const pid = `${colours_1.Colours.yellow}${process5.pid}${colours_1.Colours.reset}`;
|
|
30054
30054
|
let level;
|
|
@@ -30063,7 +30063,7 @@ var require_logging_utils = __commonJS((exports) => {
|
|
|
30063
30063
|
level = `${colours_1.Colours.yellow}${fields.severity}${colours_1.Colours.reset}`;
|
|
30064
30064
|
break;
|
|
30065
30065
|
default:
|
|
30066
|
-
level = (
|
|
30066
|
+
level = (_a16 = fields.severity) !== null && _a16 !== undefined ? _a16 : LogSeverity.DEFAULT;
|
|
30067
30067
|
break;
|
|
30068
30068
|
}
|
|
30069
30069
|
const msg = util2.formatWithOptions({ colors: colours_1.Colours.enabled }, ...args);
|
|
@@ -30096,8 +30096,8 @@ var require_logging_utils = __commonJS((exports) => {
|
|
|
30096
30096
|
};
|
|
30097
30097
|
}
|
|
30098
30098
|
setFilters() {
|
|
30099
|
-
var
|
|
30100
|
-
const existingFilters = (
|
|
30099
|
+
var _a16;
|
|
30100
|
+
const existingFilters = (_a16 = process5.env["NODE_DEBUG"]) !== null && _a16 !== undefined ? _a16 : "";
|
|
30101
30101
|
process5.env["NODE_DEBUG"] = `${existingFilters}${existingFilters ? "," : ""}${this.filters.join(",")}`;
|
|
30102
30102
|
}
|
|
30103
30103
|
}
|
|
@@ -30107,15 +30107,15 @@ var require_logging_utils = __commonJS((exports) => {
|
|
|
30107
30107
|
|
|
30108
30108
|
class StructuredBackend extends DebugLogBackendBase {
|
|
30109
30109
|
constructor(upstream) {
|
|
30110
|
-
var
|
|
30110
|
+
var _a16;
|
|
30111
30111
|
super();
|
|
30112
|
-
this.upstream = (
|
|
30112
|
+
this.upstream = (_a16 = upstream) !== null && _a16 !== undefined ? _a16 : new NodeBackend;
|
|
30113
30113
|
}
|
|
30114
30114
|
makeLogger(namespace) {
|
|
30115
30115
|
const debugLogger = this.upstream.makeLogger(namespace);
|
|
30116
30116
|
return (fields, ...args) => {
|
|
30117
|
-
var
|
|
30118
|
-
const severity = (
|
|
30117
|
+
var _a16;
|
|
30118
|
+
const severity = (_a16 = fields.severity) !== null && _a16 !== undefined ? _a16 : LogSeverity.INFO;
|
|
30119
30119
|
const json2 = Object.assign({
|
|
30120
30120
|
severity,
|
|
30121
30121
|
message: util2.format(...args)
|
|
@@ -30321,15 +30321,15 @@ var require_src5 = __commonJS((exports) => {
|
|
|
30321
30321
|
if (typeof res.data === "string") {
|
|
30322
30322
|
try {
|
|
30323
30323
|
return jsonBigint.parse(res.data);
|
|
30324
|
-
} catch (
|
|
30324
|
+
} catch (_a16) {}
|
|
30325
30325
|
}
|
|
30326
30326
|
return res.data;
|
|
30327
30327
|
}
|
|
30328
30328
|
async function fastFailMetadataRequest(options) {
|
|
30329
|
-
var
|
|
30329
|
+
var _a16;
|
|
30330
30330
|
const secondaryOptions = {
|
|
30331
30331
|
...options,
|
|
30332
|
-
url: (
|
|
30332
|
+
url: (_a16 = options.url) === null || _a16 === undefined ? undefined : _a16.toString().replace(getBaseUrl(), getBaseUrl(exports.SECONDARY_HOST_ADDRESS))
|
|
30333
30333
|
};
|
|
30334
30334
|
let responded = false;
|
|
30335
30335
|
const r1 = (0, gaxios_1.request)(options).then((res) => {
|
|
@@ -31121,9 +31121,9 @@ var require_util2 = __commonJS((exports) => {
|
|
|
31121
31121
|
}
|
|
31122
31122
|
function originalOrCamelOptions(obj) {
|
|
31123
31123
|
function get(key) {
|
|
31124
|
-
var
|
|
31124
|
+
var _a16;
|
|
31125
31125
|
const o = obj || {};
|
|
31126
|
-
return (
|
|
31126
|
+
return (_a16 = o[key]) !== null && _a16 !== undefined ? _a16 : o[snakeToCamel(key)];
|
|
31127
31127
|
}
|
|
31128
31128
|
return { get };
|
|
31129
31129
|
}
|
|
@@ -31178,7 +31178,7 @@ var require_authclient = __commonJS((exports) => {
|
|
|
31178
31178
|
|
|
31179
31179
|
class AuthClient extends events_1.EventEmitter {
|
|
31180
31180
|
constructor(opts = {}) {
|
|
31181
|
-
var
|
|
31181
|
+
var _a16, _b8, _c, _d, _e;
|
|
31182
31182
|
super();
|
|
31183
31183
|
this.credentials = {};
|
|
31184
31184
|
this.eagerRefreshThresholdMillis = exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;
|
|
@@ -31186,7 +31186,7 @@ var require_authclient = __commonJS((exports) => {
|
|
|
31186
31186
|
this.universeDomain = exports.DEFAULT_UNIVERSE;
|
|
31187
31187
|
const options = (0, util_1.originalOrCamelOptions)(opts);
|
|
31188
31188
|
this.apiKey = opts.apiKey;
|
|
31189
|
-
this.projectId = (
|
|
31189
|
+
this.projectId = (_a16 = options.get("project_id")) !== null && _a16 !== undefined ? _a16 : null;
|
|
31190
31190
|
this.quotaProjectId = options.get("quota_project_id");
|
|
31191
31191
|
this.credentials = (_b8 = options.get("credentials")) !== null && _b8 !== undefined ? _b8 : {};
|
|
31192
31192
|
this.universeDomain = (_c = options.get("universe_domain")) !== null && _c !== undefined ? _c : exports.DEFAULT_UNIVERSE;
|
|
@@ -31400,7 +31400,7 @@ var require_oauth2client = __commonJS((exports) => {
|
|
|
31400
31400
|
return p;
|
|
31401
31401
|
}
|
|
31402
31402
|
async refreshTokenNoCache(refreshToken) {
|
|
31403
|
-
var
|
|
31403
|
+
var _a16;
|
|
31404
31404
|
if (!refreshToken) {
|
|
31405
31405
|
throw new Error("No refresh token is set.");
|
|
31406
31406
|
}
|
|
@@ -31421,7 +31421,7 @@ var require_oauth2client = __commonJS((exports) => {
|
|
|
31421
31421
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
31422
31422
|
});
|
|
31423
31423
|
} catch (e) {
|
|
31424
|
-
if (e instanceof gaxios_1.GaxiosError && e.message === "invalid_grant" && ((
|
|
31424
|
+
if (e instanceof gaxios_1.GaxiosError && e.message === "invalid_grant" && ((_a16 = e.response) === null || _a16 === undefined ? undefined : _a16.data) && /ReAuth/i.test(e.response.data.error_description)) {
|
|
31425
31425
|
e.message = JSON.stringify(e.response.data);
|
|
31426
31426
|
}
|
|
31427
31427
|
throw e;
|
|
@@ -32619,9 +32619,9 @@ var require_src6 = __commonJS((exports) => {
|
|
|
32619
32619
|
}
|
|
32620
32620
|
}
|
|
32621
32621
|
isTokenExpiring() {
|
|
32622
|
-
var
|
|
32622
|
+
var _a16;
|
|
32623
32623
|
const now2 = new Date().getTime();
|
|
32624
|
-
const eagerRefreshThresholdMillis = (
|
|
32624
|
+
const eagerRefreshThresholdMillis = (_a16 = this.eagerRefreshThresholdMillis) !== null && _a16 !== undefined ? _a16 : 0;
|
|
32625
32625
|
if (this.rawToken && this.expiresAt) {
|
|
32626
32626
|
return this.expiresAt <= now2 + eagerRefreshThresholdMillis;
|
|
32627
32627
|
} else {
|
|
@@ -32742,7 +32742,7 @@ var require_src6 = __commonJS((exports) => {
|
|
|
32742
32742
|
this.transporter = options.transporter;
|
|
32743
32743
|
}
|
|
32744
32744
|
}, _GoogleToken_requestToken = async function _GoogleToken_requestToken() {
|
|
32745
|
-
var
|
|
32745
|
+
var _a16, _b8;
|
|
32746
32746
|
const iat = Math.floor(new Date().getTime() / 1000);
|
|
32747
32747
|
const additionalClaims = this.additionalClaims || {};
|
|
32748
32748
|
const payload = Object.assign({
|
|
@@ -32778,7 +32778,7 @@ var require_src6 = __commonJS((exports) => {
|
|
|
32778
32778
|
} catch (e) {
|
|
32779
32779
|
this.rawToken = undefined;
|
|
32780
32780
|
this.tokenExpires = undefined;
|
|
32781
|
-
const body = e.response && ((
|
|
32781
|
+
const body = e.response && ((_a16 = e.response) === null || _a16 === undefined ? undefined : _a16.data) ? (_b8 = e.response) === null || _b8 === undefined ? undefined : _b8.data : {};
|
|
32782
32782
|
if (body.error) {
|
|
32783
32783
|
const desc = body.error_description ? `: ${body.error_description}` : "";
|
|
32784
32784
|
e.message = `${body.error}${desc}`;
|
|
@@ -33224,13 +33224,13 @@ var require_impersonated = __commonJS((exports) => {
|
|
|
33224
33224
|
|
|
33225
33225
|
class Impersonated extends oauth2client_1.OAuth2Client {
|
|
33226
33226
|
constructor(options = {}) {
|
|
33227
|
-
var
|
|
33227
|
+
var _a16, _b8, _c, _d, _e, _f;
|
|
33228
33228
|
super(options);
|
|
33229
33229
|
this.credentials = {
|
|
33230
33230
|
expiry_date: 1,
|
|
33231
33231
|
refresh_token: "impersonated-placeholder"
|
|
33232
33232
|
};
|
|
33233
|
-
this.sourceClient = (
|
|
33233
|
+
this.sourceClient = (_a16 = options.sourceClient) !== null && _a16 !== undefined ? _a16 : new oauth2client_1.OAuth2Client;
|
|
33234
33234
|
this.targetPrincipal = (_b8 = options.targetPrincipal) !== null && _b8 !== undefined ? _b8 : "";
|
|
33235
33235
|
this.delegates = (_c = options.delegates) !== null && _c !== undefined ? _c : [];
|
|
33236
33236
|
this.targetScopes = (_d = options.targetScopes) !== null && _d !== undefined ? _d : [];
|
|
@@ -33263,7 +33263,7 @@ var require_impersonated = __commonJS((exports) => {
|
|
|
33263
33263
|
return this.targetPrincipal;
|
|
33264
33264
|
}
|
|
33265
33265
|
async refreshToken() {
|
|
33266
|
-
var
|
|
33266
|
+
var _a16, _b8, _c, _d, _e, _f;
|
|
33267
33267
|
try {
|
|
33268
33268
|
await this.sourceClient.getAccessToken();
|
|
33269
33269
|
const name17 = "projects/-/serviceAccounts/" + this.targetPrincipal;
|
|
@@ -33292,7 +33292,7 @@ var require_impersonated = __commonJS((exports) => {
|
|
|
33292
33292
|
let status = 0;
|
|
33293
33293
|
let message = "";
|
|
33294
33294
|
if (error46 instanceof gaxios_1.GaxiosError) {
|
|
33295
|
-
status = (_c = (_b8 = (
|
|
33295
|
+
status = (_c = (_b8 = (_a16 = error46 === null || error46 === undefined ? undefined : error46.response) === null || _a16 === undefined ? undefined : _a16.data) === null || _b8 === undefined ? undefined : _b8.error) === null || _c === undefined ? undefined : _c.status;
|
|
33296
33296
|
message = (_f = (_e = (_d = error46 === null || error46 === undefined ? undefined : error46.response) === null || _d === undefined ? undefined : _d.data) === null || _e === undefined ? undefined : _e.error) === null || _f === undefined ? undefined : _f.message;
|
|
33297
33297
|
}
|
|
33298
33298
|
if (status && message) {
|
|
@@ -33305,14 +33305,14 @@ var require_impersonated = __commonJS((exports) => {
|
|
|
33305
33305
|
}
|
|
33306
33306
|
}
|
|
33307
33307
|
async fetchIdToken(targetAudience, options) {
|
|
33308
|
-
var
|
|
33308
|
+
var _a16, _b8;
|
|
33309
33309
|
await this.sourceClient.getAccessToken();
|
|
33310
33310
|
const name17 = `projects/-/serviceAccounts/${this.targetPrincipal}`;
|
|
33311
33311
|
const u = `${this.endpoint}/v1/${name17}:generateIdToken`;
|
|
33312
33312
|
const body = {
|
|
33313
33313
|
delegates: this.delegates,
|
|
33314
33314
|
audience: targetAudience,
|
|
33315
|
-
includeEmail: (
|
|
33315
|
+
includeEmail: (_a16 = options === null || options === undefined ? undefined : options.includeEmail) !== null && _a16 !== undefined ? _a16 : true,
|
|
33316
33316
|
useEmailAzp: (_b8 = options === null || options === undefined ? undefined : options.includeEmail) !== null && _b8 !== undefined ? _b8 : true
|
|
33317
33317
|
};
|
|
33318
33318
|
const res = await this.sourceClient.request({
|
|
@@ -33348,13 +33348,13 @@ var require_oauth2common = __commonJS((exports) => {
|
|
|
33348
33348
|
}
|
|
33349
33349
|
}
|
|
33350
33350
|
injectAuthenticatedHeaders(opts, bearerToken) {
|
|
33351
|
-
var
|
|
33351
|
+
var _a16;
|
|
33352
33352
|
if (bearerToken) {
|
|
33353
33353
|
opts.headers = opts.headers || {};
|
|
33354
33354
|
Object.assign(opts.headers, {
|
|
33355
33355
|
Authorization: `Bearer ${bearerToken}}`
|
|
33356
33356
|
});
|
|
33357
|
-
} else if (((
|
|
33357
|
+
} else if (((_a16 = this.clientAuthentication) === null || _a16 === undefined ? undefined : _a16.confidentialClientType) === "basic") {
|
|
33358
33358
|
opts.headers = opts.headers || {};
|
|
33359
33359
|
const clientId = this.clientAuthentication.clientId;
|
|
33360
33360
|
const clientSecret = this.clientAuthentication.clientSecret || "";
|
|
@@ -33365,8 +33365,8 @@ var require_oauth2common = __commonJS((exports) => {
|
|
|
33365
33365
|
}
|
|
33366
33366
|
}
|
|
33367
33367
|
injectAuthenticatedRequestBody(opts) {
|
|
33368
|
-
var
|
|
33369
|
-
if (((
|
|
33368
|
+
var _a16;
|
|
33369
|
+
if (((_a16 = this.clientAuthentication) === null || _a16 === undefined ? undefined : _a16.confidentialClientType) === "request-body") {
|
|
33370
33370
|
const method = (opts.method || "GET").toUpperCase();
|
|
33371
33371
|
if (METHODS_SUPPORTING_REQUEST_BODY.indexOf(method) !== -1) {
|
|
33372
33372
|
let contentType;
|
|
@@ -33456,12 +33456,12 @@ var require_stscredentials = __commonJS((exports) => {
|
|
|
33456
33456
|
this.transporter = new transporters_1.DefaultTransporter;
|
|
33457
33457
|
}
|
|
33458
33458
|
async exchangeToken(stsCredentialsOptions, additionalHeaders, options) {
|
|
33459
|
-
var
|
|
33459
|
+
var _a16, _b8, _c;
|
|
33460
33460
|
const values = {
|
|
33461
33461
|
grant_type: stsCredentialsOptions.grantType,
|
|
33462
33462
|
resource: stsCredentialsOptions.resource,
|
|
33463
33463
|
audience: stsCredentialsOptions.audience,
|
|
33464
|
-
scope: (
|
|
33464
|
+
scope: (_a16 = stsCredentialsOptions.scope) === null || _a16 === undefined ? undefined : _a16.join(" "),
|
|
33465
33465
|
requested_token_type: stsCredentialsOptions.requestedTokenType,
|
|
33466
33466
|
subject_token: stsCredentialsOptions.subjectToken,
|
|
33467
33467
|
subject_token_type: stsCredentialsOptions.subjectTokenType,
|
|
@@ -33547,7 +33547,7 @@ var require_baseexternalclient = __commonJS((exports) => {
|
|
|
33547
33547
|
|
|
33548
33548
|
class BaseExternalAccountClient extends authclient_1.AuthClient {
|
|
33549
33549
|
constructor(options, additionalOptions) {
|
|
33550
|
-
var
|
|
33550
|
+
var _a16;
|
|
33551
33551
|
super({ ...options, ...additionalOptions });
|
|
33552
33552
|
_BaseExternalAccountClient_instances.add(this);
|
|
33553
33553
|
_BaseExternalAccountClient_pendingAccessToken.set(this, null);
|
|
@@ -33558,7 +33558,7 @@ var require_baseexternalclient = __commonJS((exports) => {
|
|
|
33558
33558
|
}
|
|
33559
33559
|
const clientId = opts.get("client_id");
|
|
33560
33560
|
const clientSecret = opts.get("client_secret");
|
|
33561
|
-
const tokenUrl = (
|
|
33561
|
+
const tokenUrl = (_a16 = opts.get("token_url")) !== null && _a16 !== undefined ? _a16 : DEFAULT_TOKEN_URL.replace("{universeDomain}", this.universeDomain);
|
|
33562
33562
|
const subjectTokenType = opts.get("subject_token_type");
|
|
33563
33563
|
const workforcePoolUserProject = opts.get("workforce_pool_user_project");
|
|
33564
33564
|
const serviceAccountImpersonationUrl = opts.get("service_account_impersonation_url");
|
|
@@ -33598,14 +33598,14 @@ var require_baseexternalclient = __commonJS((exports) => {
|
|
|
33598
33598
|
};
|
|
33599
33599
|
}
|
|
33600
33600
|
getServiceAccountEmail() {
|
|
33601
|
-
var
|
|
33601
|
+
var _a16;
|
|
33602
33602
|
if (this.serviceAccountImpersonationUrl) {
|
|
33603
33603
|
if (this.serviceAccountImpersonationUrl.length > 256) {
|
|
33604
33604
|
throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);
|
|
33605
33605
|
}
|
|
33606
33606
|
const re = /serviceAccounts\/(?<email>[^:]+):generateAccessToken$/;
|
|
33607
33607
|
const result = re.exec(this.serviceAccountImpersonationUrl);
|
|
33608
|
-
return ((
|
|
33608
|
+
return ((_a16 = result === null || result === undefined ? undefined : result.groups) === null || _a16 === undefined ? undefined : _a16.email) || null;
|
|
33609
33609
|
}
|
|
33610
33610
|
return null;
|
|
33611
33611
|
}
|
|
@@ -33783,14 +33783,14 @@ var require_baseexternalclient = __commonJS((exports) => {
|
|
|
33783
33783
|
|
|
33784
33784
|
// ../../node_modules/.bun/google-auth-library@9.15.1/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js
|
|
33785
33785
|
var require_filesubjecttokensupplier = __commonJS((exports) => {
|
|
33786
|
-
var
|
|
33786
|
+
var _a16;
|
|
33787
33787
|
var _b8;
|
|
33788
33788
|
var _c;
|
|
33789
33789
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33790
33790
|
exports.FileSubjectTokenSupplier = undefined;
|
|
33791
33791
|
var util_1 = __require("util");
|
|
33792
33792
|
var fs2 = __require("fs");
|
|
33793
|
-
var readFile2 = (0, util_1.promisify)((
|
|
33793
|
+
var readFile2 = (0, util_1.promisify)((_a16 = fs2.readFile) !== null && _a16 !== undefined ? _a16 : () => {});
|
|
33794
33794
|
var realpath = (0, util_1.promisify)((_b8 = fs2.realpath) !== null && _b8 !== undefined ? _b8 : () => {});
|
|
33795
33795
|
var lstat = (0, util_1.promisify)((_c = fs2.lstat) !== null && _c !== undefined ? _c : () => {});
|
|
33796
33796
|
|
|
@@ -34169,7 +34169,7 @@ var require_awsclient = __commonJS((exports) => {
|
|
|
34169
34169
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
34170
34170
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
34171
34171
|
};
|
|
34172
|
-
var
|
|
34172
|
+
var _a16;
|
|
34173
34173
|
var _AwsClient_DEFAULT_AWS_REGIONAL_CREDENTIAL_VERIFICATION_URL;
|
|
34174
34174
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34175
34175
|
exports.AwsClient = undefined;
|
|
@@ -34192,7 +34192,7 @@ var require_awsclient = __commonJS((exports) => {
|
|
|
34192
34192
|
}
|
|
34193
34193
|
if (awsSecurityCredentialsSupplier) {
|
|
34194
34194
|
this.awsSecurityCredentialsSupplier = awsSecurityCredentialsSupplier;
|
|
34195
|
-
this.regionalCredVerificationUrl = __classPrivateFieldGet(
|
|
34195
|
+
this.regionalCredVerificationUrl = __classPrivateFieldGet(_a16, _a16, "f", _AwsClient_DEFAULT_AWS_REGIONAL_CREDENTIAL_VERIFICATION_URL);
|
|
34196
34196
|
this.credentialSourceType = "programmatic";
|
|
34197
34197
|
} else {
|
|
34198
34198
|
const credentialSourceOpts = (0, util_1.originalOrCamelOptions)(credentialSource);
|
|
@@ -34229,7 +34229,7 @@ var require_awsclient = __commonJS((exports) => {
|
|
|
34229
34229
|
}, this.region);
|
|
34230
34230
|
}
|
|
34231
34231
|
const options = await this.awsRequestSigner.getRequestOptions({
|
|
34232
|
-
...
|
|
34232
|
+
..._a16.RETRY_CONFIG,
|
|
34233
34233
|
url: this.regionalCredVerificationUrl.replace("{region}", this.region),
|
|
34234
34234
|
method: "POST"
|
|
34235
34235
|
});
|
|
@@ -34251,7 +34251,7 @@ var require_awsclient = __commonJS((exports) => {
|
|
|
34251
34251
|
}
|
|
34252
34252
|
}
|
|
34253
34253
|
exports.AwsClient = AwsClient;
|
|
34254
|
-
|
|
34254
|
+
_a16 = AwsClient;
|
|
34255
34255
|
_AwsClient_DEFAULT_AWS_REGIONAL_CREDENTIAL_VERIFICATION_URL = { value: "https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15" };
|
|
34256
34256
|
AwsClient.AWS_EC2_METADATA_IPV4_ADDRESS = "169.254.169.254";
|
|
34257
34257
|
AwsClient.AWS_EC2_METADATA_IPV6_ADDRESS = "fd00:ec2::254";
|
|
@@ -34413,7 +34413,7 @@ var require_pluggable_auth_handler = __commonJS((exports) => {
|
|
|
34413
34413
|
let filePath;
|
|
34414
34414
|
try {
|
|
34415
34415
|
filePath = await fs2.promises.realpath(this.outputFile);
|
|
34416
|
-
} catch (
|
|
34416
|
+
} catch (_a16) {
|
|
34417
34417
|
return;
|
|
34418
34418
|
}
|
|
34419
34419
|
if (!(await fs2.promises.lstat(filePath)).isFile()) {
|
|
@@ -34559,9 +34559,9 @@ var require_externalclient = __commonJS((exports) => {
|
|
|
34559
34559
|
throw new Error("ExternalAccountClients should be initialized via: " + "ExternalAccountClient.fromJSON(), " + "directly via explicit constructors, eg. " + "new AwsClient(options), new IdentityPoolClient(options), new" + "PluggableAuthClientOptions, or via " + "new GoogleAuth(options).getClient()");
|
|
34560
34560
|
}
|
|
34561
34561
|
static fromJSON(options, additionalOptions) {
|
|
34562
|
-
var
|
|
34562
|
+
var _a16, _b8;
|
|
34563
34563
|
if (options && options.type === baseexternalclient_1.EXTERNAL_ACCOUNT_TYPE) {
|
|
34564
|
-
if ((
|
|
34564
|
+
if ((_a16 = options.credential_source) === null || _a16 === undefined ? undefined : _a16.environment_id) {
|
|
34565
34565
|
return new awsclient_1.AwsClient(options, additionalOptions);
|
|
34566
34566
|
} else if ((_b8 = options.credential_source) === null || _b8 === undefined ? undefined : _b8.executable) {
|
|
34567
34567
|
return new pluggable_auth_client_1.PluggableAuthClient(options, additionalOptions);
|
|
@@ -34628,7 +34628,7 @@ var require_externalAccountAuthorizedUserClient = __commonJS((exports) => {
|
|
|
34628
34628
|
|
|
34629
34629
|
class ExternalAccountAuthorizedUserClient extends authclient_1.AuthClient {
|
|
34630
34630
|
constructor(options, additionalOptions) {
|
|
34631
|
-
var
|
|
34631
|
+
var _a16;
|
|
34632
34632
|
super({ ...options, ...additionalOptions });
|
|
34633
34633
|
if (options.universe_domain) {
|
|
34634
34634
|
this.universeDomain = options.universe_domain;
|
|
@@ -34639,7 +34639,7 @@ var require_externalAccountAuthorizedUserClient = __commonJS((exports) => {
|
|
|
34639
34639
|
clientId: options.client_id,
|
|
34640
34640
|
clientSecret: options.client_secret
|
|
34641
34641
|
};
|
|
34642
|
-
this.externalAccountAuthorizedUserHandler = new ExternalAccountAuthorizedUserHandler((
|
|
34642
|
+
this.externalAccountAuthorizedUserHandler = new ExternalAccountAuthorizedUserHandler((_a16 = options.token_url) !== null && _a16 !== undefined ? _a16 : DEFAULT_TOKEN_URL.replace("{universeDomain}", this.universeDomain), this.transporter, clientAuth);
|
|
34643
34643
|
this.cachedAccessToken = null;
|
|
34644
34644
|
this.quotaProjectId = options.quota_project_id;
|
|
34645
34645
|
if (typeof (additionalOptions === null || additionalOptions === undefined ? undefined : additionalOptions.eagerRefreshThresholdMillis) !== "number") {
|
|
@@ -34850,13 +34850,13 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
34850
34850
|
return this._findProjectIdPromise;
|
|
34851
34851
|
}
|
|
34852
34852
|
async getUniverseDomainFromMetadataServer() {
|
|
34853
|
-
var
|
|
34853
|
+
var _a16;
|
|
34854
34854
|
let universeDomain;
|
|
34855
34855
|
try {
|
|
34856
34856
|
universeDomain = await gcpMetadata.universe("universe-domain");
|
|
34857
34857
|
universeDomain || (universeDomain = authclient_1.DEFAULT_UNIVERSE);
|
|
34858
34858
|
} catch (e) {
|
|
34859
|
-
if (e && ((
|
|
34859
|
+
if (e && ((_a16 = e === null || e === undefined ? undefined : e.response) === null || _a16 === undefined ? undefined : _a16.status) === 404) {
|
|
34860
34860
|
universeDomain = authclient_1.DEFAULT_UNIVERSE;
|
|
34861
34861
|
} else {
|
|
34862
34862
|
throw e;
|
|
@@ -34868,7 +34868,7 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
34868
34868
|
let universeDomain = (0, util_1.originalOrCamelOptions)(this.clientOptions).get("universe_domain");
|
|
34869
34869
|
try {
|
|
34870
34870
|
universeDomain !== null && universeDomain !== undefined || (universeDomain = (await this.getClient()).universeDomain);
|
|
34871
|
-
} catch (
|
|
34871
|
+
} catch (_a16) {
|
|
34872
34872
|
universeDomain !== null && universeDomain !== undefined || (universeDomain = authclient_1.DEFAULT_UNIVERSE);
|
|
34873
34873
|
}
|
|
34874
34874
|
return universeDomain;
|
|
@@ -34979,7 +34979,7 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
34979
34979
|
return this.fromStream(readStream, options);
|
|
34980
34980
|
}
|
|
34981
34981
|
fromImpersonatedJSON(json2) {
|
|
34982
|
-
var
|
|
34982
|
+
var _a16, _b8, _c, _d;
|
|
34983
34983
|
if (!json2) {
|
|
34984
34984
|
throw new Error("Must pass in a JSON object containing an impersonated refresh token");
|
|
34985
34985
|
}
|
|
@@ -34993,7 +34993,7 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
34993
34993
|
throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");
|
|
34994
34994
|
}
|
|
34995
34995
|
const sourceClient = this.fromJSON(json2.source_credentials);
|
|
34996
|
-
if (((
|
|
34996
|
+
if (((_a16 = json2.service_account_impersonation_url) === null || _a16 === undefined ? undefined : _a16.length) > 256) {
|
|
34997
34997
|
throw new RangeError(`Target principal is too long: ${json2.service_account_impersonation_url}`);
|
|
34998
34998
|
}
|
|
34999
34999
|
const targetPrincipal = (_c = (_b8 = /(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(json2.service_account_impersonation_url)) === null || _b8 === undefined ? undefined : _b8.groups) === null || _c === undefined ? undefined : _c.target;
|
|
@@ -35396,7 +35396,7 @@ var require_downscopedclient = __commonJS((exports) => {
|
|
|
35396
35396
|
return response;
|
|
35397
35397
|
}
|
|
35398
35398
|
async refreshAccessTokenAsync() {
|
|
35399
|
-
var
|
|
35399
|
+
var _a16;
|
|
35400
35400
|
const subjectToken = (await this.authClient.getAccessToken()).token;
|
|
35401
35401
|
const stsCredentialsOptions = {
|
|
35402
35402
|
grantType: STS_GRANT_TYPE,
|
|
@@ -35405,7 +35405,7 @@ var require_downscopedclient = __commonJS((exports) => {
|
|
|
35405
35405
|
subjectTokenType: STS_SUBJECT_TOKEN_TYPE
|
|
35406
35406
|
};
|
|
35407
35407
|
const stsResponse = await this.stsCredential.exchangeToken(stsCredentialsOptions, undefined, this.credentialAccessBoundary);
|
|
35408
|
-
const sourceCredExpireDate = ((
|
|
35408
|
+
const sourceCredExpireDate = ((_a16 = this.authClient.credentials) === null || _a16 === undefined ? undefined : _a16.expiry_date) || null;
|
|
35409
35409
|
const expiryDate = stsResponse.expires_in ? new Date().getTime() + stsResponse.expires_in * 1000 : sourceCredExpireDate;
|
|
35410
35410
|
this.cachedDownscopedAccessToken = {
|
|
35411
35411
|
access_token: stsResponse.access_token,
|
|
@@ -35563,7 +35563,7 @@ var require_src7 = __commonJS((exports) => {
|
|
|
35563
35563
|
// src/index.ts
|
|
35564
35564
|
var import_config = __toESM(require_config(), 1);
|
|
35565
35565
|
|
|
35566
|
-
// ../../node_modules/.bun/commander@14.0.
|
|
35566
|
+
// ../../node_modules/.bun/commander@14.0.2/node_modules/commander/esm.mjs
|
|
35567
35567
|
var import__ = __toESM(require_commander(), 1);
|
|
35568
35568
|
var {
|
|
35569
35569
|
program,
|
|
@@ -35579,7 +35579,7 @@ var {
|
|
|
35579
35579
|
Help
|
|
35580
35580
|
} = import__.default;
|
|
35581
35581
|
// package.json
|
|
35582
|
-
var version = "0.9.
|
|
35582
|
+
var version = "0.9.54";
|
|
35583
35583
|
|
|
35584
35584
|
// src/commands/code.ts
|
|
35585
35585
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -53778,7 +53778,7 @@ var optionalType = ZodOptional2.create;
|
|
|
53778
53778
|
var nullableType = ZodNullable2.create;
|
|
53779
53779
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
53780
53780
|
var pipelineType = ZodPipeline.create;
|
|
53781
|
-
// ../../node_modules/.bun/@ai-sdk+provider-utils@3.0.
|
|
53781
|
+
// ../../node_modules/.bun/@ai-sdk+provider-utils@3.0.15+5954958163efbb2a/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
53782
53782
|
function combineHeaders(...headers) {
|
|
53783
53783
|
return headers.reduce((combinedHeaders, currentHeaders) => ({
|
|
53784
53784
|
...combinedHeaders,
|
|
@@ -53896,17 +53896,34 @@ function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
|
53896
53896
|
}
|
|
53897
53897
|
return "runtime/unknown";
|
|
53898
53898
|
}
|
|
53899
|
-
function
|
|
53900
|
-
|
|
53899
|
+
function normalizeHeaders(headers) {
|
|
53900
|
+
if (headers == null) {
|
|
53901
|
+
return {};
|
|
53902
|
+
}
|
|
53903
|
+
const normalized = {};
|
|
53904
|
+
if (headers instanceof Headers) {
|
|
53905
|
+
headers.forEach((value, key) => {
|
|
53906
|
+
normalized[key.toLowerCase()] = value;
|
|
53907
|
+
});
|
|
53908
|
+
} else {
|
|
53909
|
+
if (!Array.isArray(headers)) {
|
|
53910
|
+
headers = Object.entries(headers);
|
|
53911
|
+
}
|
|
53912
|
+
for (const [key, value] of headers) {
|
|
53913
|
+
if (value != null) {
|
|
53914
|
+
normalized[key.toLowerCase()] = value;
|
|
53915
|
+
}
|
|
53916
|
+
}
|
|
53917
|
+
}
|
|
53918
|
+
return normalized;
|
|
53901
53919
|
}
|
|
53902
53920
|
function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
53903
|
-
const
|
|
53904
|
-
const normalizedHeaders = new Headers(cleanedHeaders);
|
|
53921
|
+
const normalizedHeaders = new Headers(normalizeHeaders(headers));
|
|
53905
53922
|
const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
|
|
53906
53923
|
normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
|
|
53907
|
-
return Object.fromEntries(normalizedHeaders);
|
|
53924
|
+
return Object.fromEntries(normalizedHeaders.entries());
|
|
53908
53925
|
}
|
|
53909
|
-
var VERSION = "3.0.
|
|
53926
|
+
var VERSION = "3.0.15";
|
|
53910
53927
|
var getOriginalFetch = () => globalThis.fetch;
|
|
53911
53928
|
var getFromApi = async ({
|
|
53912
53929
|
url: url2,
|
|
@@ -55683,7 +55700,7 @@ async function* executeTool({
|
|
|
55683
55700
|
}
|
|
55684
55701
|
}
|
|
55685
55702
|
|
|
55686
|
-
// ../../node_modules/.bun/@ai-sdk+gateway@
|
|
55703
|
+
// ../../node_modules/.bun/@ai-sdk+gateway@2.0.5+5954958163efbb2a/node_modules/@ai-sdk/gateway/dist/index.mjs
|
|
55687
55704
|
var import_oidc = __toESM(require_dist(), 1);
|
|
55688
55705
|
var import_oidc2 = __toESM(require_dist(), 1);
|
|
55689
55706
|
var marker15 = "vercel.ai.gateway.error";
|
|
@@ -55736,35 +55753,26 @@ var GatewayAuthenticationError = class _GatewayAuthenticationError extends (_b2
|
|
|
55736
55753
|
}) {
|
|
55737
55754
|
let contextualMessage;
|
|
55738
55755
|
if (apiKeyProvided) {
|
|
55739
|
-
contextualMessage = `AI Gateway authentication failed: Invalid API key
|
|
55756
|
+
contextualMessage = `AI Gateway authentication failed: Invalid API key.
|
|
55740
55757
|
|
|
55741
|
-
|
|
55758
|
+
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
55759
|
+
|
|
55760
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`;
|
|
55742
55761
|
} else if (oidcTokenProvided) {
|
|
55743
|
-
contextualMessage = `AI Gateway authentication failed: Invalid OIDC token
|
|
55762
|
+
contextualMessage = `AI Gateway authentication failed: Invalid OIDC token.
|
|
55744
55763
|
|
|
55745
|
-
|
|
55746
|
-
- make sure your Vercel project settings have OIDC enabled
|
|
55747
|
-
- if running locally with 'vercel dev', the token is automatically obtained and refreshed
|
|
55748
|
-
- if running locally with your own dev server, run 'vercel env pull' to fetch the token
|
|
55749
|
-
- in production/preview, the token is automatically obtained and refreshed
|
|
55764
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
|
|
55750
55765
|
|
|
55751
|
-
|
|
55766
|
+
Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`;
|
|
55752
55767
|
} else {
|
|
55753
55768
|
contextualMessage = `AI Gateway authentication failed: No authentication provided.
|
|
55754
55769
|
|
|
55755
|
-
|
|
55756
|
-
|
|
55757
|
-
|
|
55758
|
-
|
|
55759
|
-
The token is expected to be provided via the 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
55760
|
-
|
|
55761
|
-
OIDC token instructions:
|
|
55770
|
+
Option 1 - API key:
|
|
55771
|
+
Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
55772
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
55762
55773
|
|
|
55763
|
-
|
|
55764
|
-
|
|
55765
|
-
- if running locally with 'vercel dev', the token is automatically obtained and refreshed
|
|
55766
|
-
- if running locally with your own dev server, run 'vercel env pull' to fetch the token
|
|
55767
|
-
- in production/preview, the token is automatically obtained and refreshed`;
|
|
55774
|
+
Option 2 - OIDC token:
|
|
55775
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`;
|
|
55768
55776
|
}
|
|
55769
55777
|
return new _GatewayAuthenticationError({
|
|
55770
55778
|
message: contextualMessage,
|
|
@@ -56249,7 +56257,7 @@ async function getVercelRequestId() {
|
|
|
56249
56257
|
var _a82;
|
|
56250
56258
|
return (_a82 = import_oidc.getContext().headers) == null ? undefined : _a82["x-vercel-id"];
|
|
56251
56259
|
}
|
|
56252
|
-
var VERSION2 = "
|
|
56260
|
+
var VERSION2 = "2.0.5";
|
|
56253
56261
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
56254
56262
|
function createGatewayProvider(options = {}) {
|
|
56255
56263
|
var _a82, _b8;
|
|
@@ -56379,13 +56387,13 @@ async function getGatewayAuthToken(options) {
|
|
|
56379
56387
|
}
|
|
56380
56388
|
}
|
|
56381
56389
|
|
|
56382
|
-
// ../../node_modules/.bun/ai@5.0.
|
|
56390
|
+
// ../../node_modules/.bun/ai@5.0.86+5954958163efbb2a/node_modules/ai/dist/index.mjs
|
|
56383
56391
|
var import_api = __toESM(require_src(), 1);
|
|
56384
56392
|
var import_api2 = __toESM(require_src(), 1);
|
|
56385
56393
|
var __defProp2 = Object.defineProperty;
|
|
56386
56394
|
var __export2 = (target, all) => {
|
|
56387
|
-
for (var
|
|
56388
|
-
__defProp2(target,
|
|
56395
|
+
for (var name16 in all)
|
|
56396
|
+
__defProp2(target, name16, { get: all[name16], enumerable: true });
|
|
56389
56397
|
};
|
|
56390
56398
|
var name16 = "AI_NoOutputSpecifiedError";
|
|
56391
56399
|
var marker17 = `vercel.ai.error.${name16}`;
|
|
@@ -56498,20 +56506,15 @@ var InvalidToolInputError = class extends AISDKError {
|
|
|
56498
56506
|
}
|
|
56499
56507
|
};
|
|
56500
56508
|
_a43 = symbol43;
|
|
56501
|
-
var name53 = "
|
|
56509
|
+
var name53 = "AI_NoImageGeneratedError";
|
|
56502
56510
|
var marker53 = `vercel.ai.error.${name53}`;
|
|
56503
56511
|
var symbol53 = Symbol.for(marker53);
|
|
56504
56512
|
var _a53;
|
|
56505
56513
|
_a53 = symbol53;
|
|
56506
|
-
var name63 = "
|
|
56514
|
+
var name63 = "AI_NoObjectGeneratedError";
|
|
56507
56515
|
var marker63 = `vercel.ai.error.${name63}`;
|
|
56508
56516
|
var symbol63 = Symbol.for(marker63);
|
|
56509
56517
|
var _a63;
|
|
56510
|
-
_a63 = symbol63;
|
|
56511
|
-
var name72 = "AI_NoObjectGeneratedError";
|
|
56512
|
-
var marker73 = `vercel.ai.error.${name72}`;
|
|
56513
|
-
var symbol73 = Symbol.for(marker73);
|
|
56514
|
-
var _a73;
|
|
56515
56518
|
var NoObjectGeneratedError = class extends AISDKError {
|
|
56516
56519
|
constructor({
|
|
56517
56520
|
message = "No object generated.",
|
|
@@ -56521,74 +56524,74 @@ var NoObjectGeneratedError = class extends AISDKError {
|
|
|
56521
56524
|
usage,
|
|
56522
56525
|
finishReason
|
|
56523
56526
|
}) {
|
|
56524
|
-
super({ name:
|
|
56525
|
-
this[
|
|
56527
|
+
super({ name: name63, message, cause });
|
|
56528
|
+
this[_a63] = true;
|
|
56526
56529
|
this.text = text2;
|
|
56527
56530
|
this.response = response;
|
|
56528
56531
|
this.usage = usage;
|
|
56529
56532
|
this.finishReason = finishReason;
|
|
56530
56533
|
}
|
|
56531
56534
|
static isInstance(error46) {
|
|
56532
|
-
return AISDKError.hasMarker(error46,
|
|
56535
|
+
return AISDKError.hasMarker(error46, marker63);
|
|
56533
56536
|
}
|
|
56534
56537
|
};
|
|
56535
|
-
|
|
56536
|
-
var
|
|
56537
|
-
var
|
|
56538
|
-
var
|
|
56539
|
-
var
|
|
56538
|
+
_a63 = symbol63;
|
|
56539
|
+
var name72 = "AI_NoOutputGeneratedError";
|
|
56540
|
+
var marker73 = `vercel.ai.error.${name72}`;
|
|
56541
|
+
var symbol73 = Symbol.for(marker73);
|
|
56542
|
+
var _a73;
|
|
56540
56543
|
var NoOutputGeneratedError = class extends AISDKError {
|
|
56541
56544
|
constructor({
|
|
56542
56545
|
message = "No output generated.",
|
|
56543
56546
|
cause
|
|
56544
56547
|
} = {}) {
|
|
56545
|
-
super({ name:
|
|
56546
|
-
this[
|
|
56548
|
+
super({ name: name72, message, cause });
|
|
56549
|
+
this[_a73] = true;
|
|
56547
56550
|
}
|
|
56548
56551
|
static isInstance(error46) {
|
|
56549
|
-
return AISDKError.hasMarker(error46,
|
|
56552
|
+
return AISDKError.hasMarker(error46, marker73);
|
|
56550
56553
|
}
|
|
56551
56554
|
};
|
|
56552
|
-
|
|
56553
|
-
var
|
|
56554
|
-
var
|
|
56555
|
-
var
|
|
56556
|
-
var
|
|
56555
|
+
_a73 = symbol73;
|
|
56556
|
+
var name82 = "AI_NoSuchToolError";
|
|
56557
|
+
var marker82 = `vercel.ai.error.${name82}`;
|
|
56558
|
+
var symbol82 = Symbol.for(marker82);
|
|
56559
|
+
var _a82;
|
|
56557
56560
|
var NoSuchToolError = class extends AISDKError {
|
|
56558
56561
|
constructor({
|
|
56559
56562
|
toolName,
|
|
56560
56563
|
availableTools = undefined,
|
|
56561
56564
|
message = `Model tried to call unavailable tool '${toolName}'. ${availableTools === undefined ? "No tools are available." : `Available tools: ${availableTools.join(", ")}.`}`
|
|
56562
56565
|
}) {
|
|
56563
|
-
super({ name:
|
|
56564
|
-
this[
|
|
56566
|
+
super({ name: name82, message });
|
|
56567
|
+
this[_a82] = true;
|
|
56565
56568
|
this.toolName = toolName;
|
|
56566
56569
|
this.availableTools = availableTools;
|
|
56567
56570
|
}
|
|
56568
56571
|
static isInstance(error46) {
|
|
56569
|
-
return AISDKError.hasMarker(error46,
|
|
56572
|
+
return AISDKError.hasMarker(error46, marker82);
|
|
56570
56573
|
}
|
|
56571
56574
|
};
|
|
56572
|
-
|
|
56573
|
-
var
|
|
56574
|
-
var
|
|
56575
|
-
var
|
|
56576
|
-
var
|
|
56575
|
+
_a82 = symbol82;
|
|
56576
|
+
var name92 = "AI_ToolCallRepairError";
|
|
56577
|
+
var marker92 = `vercel.ai.error.${name92}`;
|
|
56578
|
+
var symbol92 = Symbol.for(marker92);
|
|
56579
|
+
var _a92;
|
|
56577
56580
|
var ToolCallRepairError = class extends AISDKError {
|
|
56578
56581
|
constructor({
|
|
56579
56582
|
cause,
|
|
56580
56583
|
originalError,
|
|
56581
56584
|
message = `Error repairing tool call: ${getErrorMessage(cause)}`
|
|
56582
56585
|
}) {
|
|
56583
|
-
super({ name:
|
|
56584
|
-
this[
|
|
56586
|
+
super({ name: name92, message, cause });
|
|
56587
|
+
this[_a92] = true;
|
|
56585
56588
|
this.originalError = originalError;
|
|
56586
56589
|
}
|
|
56587
56590
|
static isInstance(error46) {
|
|
56588
|
-
return AISDKError.hasMarker(error46,
|
|
56591
|
+
return AISDKError.hasMarker(error46, marker92);
|
|
56589
56592
|
}
|
|
56590
56593
|
};
|
|
56591
|
-
|
|
56594
|
+
_a92 = symbol92;
|
|
56592
56595
|
var UnsupportedModelVersionError = class extends AISDKError {
|
|
56593
56596
|
constructor(options) {
|
|
56594
56597
|
super({
|
|
@@ -56600,38 +56603,38 @@ var UnsupportedModelVersionError = class extends AISDKError {
|
|
|
56600
56603
|
this.modelId = options.modelId;
|
|
56601
56604
|
}
|
|
56602
56605
|
};
|
|
56603
|
-
var
|
|
56606
|
+
var name102 = "AI_InvalidDataContentError";
|
|
56607
|
+
var marker102 = `vercel.ai.error.${name102}`;
|
|
56608
|
+
var symbol102 = Symbol.for(marker102);
|
|
56609
|
+
var _a102;
|
|
56610
|
+
_a102 = symbol102;
|
|
56611
|
+
var name112 = "AI_InvalidMessageRoleError";
|
|
56604
56612
|
var marker112 = `vercel.ai.error.${name112}`;
|
|
56605
56613
|
var symbol112 = Symbol.for(marker112);
|
|
56606
56614
|
var _a112;
|
|
56607
|
-
_a112 = symbol112;
|
|
56608
|
-
var name122 = "AI_InvalidMessageRoleError";
|
|
56609
|
-
var marker122 = `vercel.ai.error.${name122}`;
|
|
56610
|
-
var symbol122 = Symbol.for(marker122);
|
|
56611
|
-
var _a122;
|
|
56612
56615
|
var InvalidMessageRoleError = class extends AISDKError {
|
|
56613
56616
|
constructor({
|
|
56614
56617
|
role,
|
|
56615
56618
|
message = `Invalid message role: '${role}'. Must be one of: "system", "user", "assistant", "tool".`
|
|
56616
56619
|
}) {
|
|
56617
|
-
super({ name:
|
|
56618
|
-
this[
|
|
56620
|
+
super({ name: name112, message });
|
|
56621
|
+
this[_a112] = true;
|
|
56619
56622
|
this.role = role;
|
|
56620
56623
|
}
|
|
56621
56624
|
static isInstance(error46) {
|
|
56622
|
-
return AISDKError.hasMarker(error46,
|
|
56625
|
+
return AISDKError.hasMarker(error46, marker112);
|
|
56623
56626
|
}
|
|
56624
56627
|
};
|
|
56628
|
+
_a112 = symbol112;
|
|
56629
|
+
var name122 = "AI_MessageConversionError";
|
|
56630
|
+
var marker122 = `vercel.ai.error.${name122}`;
|
|
56631
|
+
var symbol122 = Symbol.for(marker122);
|
|
56632
|
+
var _a122;
|
|
56625
56633
|
_a122 = symbol122;
|
|
56626
|
-
var name132 = "
|
|
56634
|
+
var name132 = "AI_DownloadError";
|
|
56627
56635
|
var marker132 = `vercel.ai.error.${name132}`;
|
|
56628
56636
|
var symbol132 = Symbol.for(marker132);
|
|
56629
56637
|
var _a132;
|
|
56630
|
-
_a132 = symbol132;
|
|
56631
|
-
var name142 = "AI_DownloadError";
|
|
56632
|
-
var marker142 = `vercel.ai.error.${name142}`;
|
|
56633
|
-
var symbol142 = Symbol.for(marker142);
|
|
56634
|
-
var _a142;
|
|
56635
56638
|
var DownloadError = class extends AISDKError {
|
|
56636
56639
|
constructor({
|
|
56637
56640
|
url: url2,
|
|
@@ -56640,38 +56643,38 @@ var DownloadError = class extends AISDKError {
|
|
|
56640
56643
|
cause,
|
|
56641
56644
|
message = cause == null ? `Failed to download ${url2}: ${statusCode} ${statusText}` : `Failed to download ${url2}: ${cause}`
|
|
56642
56645
|
}) {
|
|
56643
|
-
super({ name:
|
|
56644
|
-
this[
|
|
56646
|
+
super({ name: name132, message, cause });
|
|
56647
|
+
this[_a132] = true;
|
|
56645
56648
|
this.url = url2;
|
|
56646
56649
|
this.statusCode = statusCode;
|
|
56647
56650
|
this.statusText = statusText;
|
|
56648
56651
|
}
|
|
56649
56652
|
static isInstance(error46) {
|
|
56650
|
-
return AISDKError.hasMarker(error46,
|
|
56653
|
+
return AISDKError.hasMarker(error46, marker132);
|
|
56651
56654
|
}
|
|
56652
56655
|
};
|
|
56653
|
-
|
|
56654
|
-
var
|
|
56655
|
-
var
|
|
56656
|
-
var
|
|
56657
|
-
var
|
|
56656
|
+
_a132 = symbol132;
|
|
56657
|
+
var name142 = "AI_RetryError";
|
|
56658
|
+
var marker142 = `vercel.ai.error.${name142}`;
|
|
56659
|
+
var symbol142 = Symbol.for(marker142);
|
|
56660
|
+
var _a142;
|
|
56658
56661
|
var RetryError = class extends AISDKError {
|
|
56659
56662
|
constructor({
|
|
56660
56663
|
message,
|
|
56661
56664
|
reason,
|
|
56662
56665
|
errors: errors3
|
|
56663
56666
|
}) {
|
|
56664
|
-
super({ name:
|
|
56665
|
-
this[
|
|
56667
|
+
super({ name: name142, message });
|
|
56668
|
+
this[_a142] = true;
|
|
56666
56669
|
this.reason = reason;
|
|
56667
56670
|
this.errors = errors3;
|
|
56668
56671
|
this.lastError = errors3[errors3.length - 1];
|
|
56669
56672
|
}
|
|
56670
56673
|
static isInstance(error46) {
|
|
56671
|
-
return AISDKError.hasMarker(error46,
|
|
56674
|
+
return AISDKError.hasMarker(error46, marker142);
|
|
56672
56675
|
}
|
|
56673
56676
|
};
|
|
56674
|
-
|
|
56677
|
+
_a142 = symbol142;
|
|
56675
56678
|
function resolveLanguageModel(model) {
|
|
56676
56679
|
if (typeof model !== "string") {
|
|
56677
56680
|
if (model.specificationVersion !== "v2") {
|
|
@@ -56686,8 +56689,8 @@ function resolveLanguageModel(model) {
|
|
|
56686
56689
|
return getGlobalProvider().languageModel(model);
|
|
56687
56690
|
}
|
|
56688
56691
|
function getGlobalProvider() {
|
|
56689
|
-
var
|
|
56690
|
-
return (
|
|
56692
|
+
var _a16;
|
|
56693
|
+
return (_a16 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a16 : gateway;
|
|
56691
56694
|
}
|
|
56692
56695
|
var imageMediaTypeSignatures = [
|
|
56693
56696
|
{
|
|
@@ -56788,9 +56791,9 @@ function detectMediaType({
|
|
|
56788
56791
|
}
|
|
56789
56792
|
return;
|
|
56790
56793
|
}
|
|
56791
|
-
var VERSION3 = "5.0.
|
|
56794
|
+
var VERSION3 = "5.0.86";
|
|
56792
56795
|
var download = async ({ url: url2 }) => {
|
|
56793
|
-
var
|
|
56796
|
+
var _a16;
|
|
56794
56797
|
const urlText = url2.toString();
|
|
56795
56798
|
try {
|
|
56796
56799
|
const response = await fetch(urlText, {
|
|
@@ -56805,7 +56808,7 @@ var download = async ({ url: url2 }) => {
|
|
|
56805
56808
|
}
|
|
56806
56809
|
return {
|
|
56807
56810
|
data: new Uint8Array(await response.arrayBuffer()),
|
|
56808
|
-
mediaType: (
|
|
56811
|
+
mediaType: (_a16 = response.headers.get("content-type")) != null ? _a16 : undefined
|
|
56809
56812
|
};
|
|
56810
56813
|
} catch (error46) {
|
|
56811
56814
|
if (DownloadError.isInstance(error46)) {
|
|
@@ -56834,8 +56837,8 @@ var dataContentSchema = exports_external.union([
|
|
|
56834
56837
|
exports_external.instanceof(Uint8Array),
|
|
56835
56838
|
exports_external.instanceof(ArrayBuffer),
|
|
56836
56839
|
exports_external.custom((value) => {
|
|
56837
|
-
var
|
|
56838
|
-
return (_b8 = (
|
|
56840
|
+
var _a16, _b8;
|
|
56841
|
+
return (_b8 = (_a16 = globalThis.Buffer) == null ? undefined : _a16.isBuffer(value)) != null ? _b8 : false;
|
|
56839
56842
|
}, { message: "Must be a Buffer" })
|
|
56840
56843
|
]);
|
|
56841
56844
|
function convertToLanguageModelV2DataContent(content) {
|
|
@@ -56991,8 +56994,8 @@ function convertToLanguageModelMessage({
|
|
|
56991
56994
|
}
|
|
56992
56995
|
async function downloadAssets(messages, download2, supportedUrls) {
|
|
56993
56996
|
const plannedDownloads = messages.filter((message) => message.role === "user").map((message) => message.content).filter((content) => Array.isArray(content)).flat().filter((part) => part.type === "image" || part.type === "file").map((part) => {
|
|
56994
|
-
var
|
|
56995
|
-
const mediaType = (
|
|
56997
|
+
var _a16;
|
|
56998
|
+
const mediaType = (_a16 = part.mediaType) != null ? _a16 : part.type === "image" ? "image/*" : undefined;
|
|
56996
56999
|
let data = part.type === "image" ? part.image : part.data;
|
|
56997
57000
|
if (typeof data === "string") {
|
|
56998
57001
|
try {
|
|
@@ -57015,7 +57018,7 @@ async function downloadAssets(messages, download2, supportedUrls) {
|
|
|
57015
57018
|
]).filter((file2) => file2 != null));
|
|
57016
57019
|
}
|
|
57017
57020
|
function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
57018
|
-
var
|
|
57021
|
+
var _a16;
|
|
57019
57022
|
if (part.type === "text") {
|
|
57020
57023
|
return {
|
|
57021
57024
|
type: "text",
|
|
@@ -57048,7 +57051,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
57048
57051
|
switch (type) {
|
|
57049
57052
|
case "image": {
|
|
57050
57053
|
if (data instanceof Uint8Array || typeof data === "string") {
|
|
57051
|
-
mediaType = (
|
|
57054
|
+
mediaType = (_a16 = detectMediaType({ data, signatures: imageMediaTypeSignatures })) != null ? _a16 : mediaType;
|
|
57052
57055
|
}
|
|
57053
57056
|
return {
|
|
57054
57057
|
type: "file",
|
|
@@ -57177,27 +57180,27 @@ function prepareToolsAndToolChoice({
|
|
|
57177
57180
|
toolChoice: undefined
|
|
57178
57181
|
};
|
|
57179
57182
|
}
|
|
57180
|
-
const filteredTools = activeTools != null ? Object.entries(tools).filter(([
|
|
57183
|
+
const filteredTools = activeTools != null ? Object.entries(tools).filter(([name162]) => activeTools.includes(name162)) : Object.entries(tools);
|
|
57181
57184
|
return {
|
|
57182
|
-
tools: filteredTools.map(([
|
|
57183
|
-
const toolType =
|
|
57185
|
+
tools: filteredTools.map(([name162, tool2]) => {
|
|
57186
|
+
const toolType = tool2.type;
|
|
57184
57187
|
switch (toolType) {
|
|
57185
57188
|
case undefined:
|
|
57186
57189
|
case "dynamic":
|
|
57187
57190
|
case "function":
|
|
57188
57191
|
return {
|
|
57189
57192
|
type: "function",
|
|
57190
|
-
name:
|
|
57191
|
-
description:
|
|
57192
|
-
inputSchema: asSchema(
|
|
57193
|
-
providerOptions:
|
|
57193
|
+
name: name162,
|
|
57194
|
+
description: tool2.description,
|
|
57195
|
+
inputSchema: asSchema(tool2.inputSchema).jsonSchema,
|
|
57196
|
+
providerOptions: tool2.providerOptions
|
|
57194
57197
|
};
|
|
57195
57198
|
case "provider-defined":
|
|
57196
57199
|
return {
|
|
57197
57200
|
type: "provider-defined",
|
|
57198
|
-
name:
|
|
57199
|
-
id:
|
|
57200
|
-
args:
|
|
57201
|
+
name: name162,
|
|
57202
|
+
id: tool2.id,
|
|
57203
|
+
args: tool2.args
|
|
57201
57204
|
};
|
|
57202
57205
|
default: {
|
|
57203
57206
|
const exhaustiveCheck = toolType;
|
|
@@ -57406,7 +57409,7 @@ function getBaseTelemetryAttributes({
|
|
|
57406
57409
|
telemetry,
|
|
57407
57410
|
headers
|
|
57408
57411
|
}) {
|
|
57409
|
-
var
|
|
57412
|
+
var _a16;
|
|
57410
57413
|
return {
|
|
57411
57414
|
"ai.model.provider": model.provider,
|
|
57412
57415
|
"ai.model.id": model.modelId,
|
|
@@ -57414,7 +57417,7 @@ function getBaseTelemetryAttributes({
|
|
|
57414
57417
|
attributes[`ai.settings.${key}`] = value;
|
|
57415
57418
|
return attributes;
|
|
57416
57419
|
}, {}),
|
|
57417
|
-
...Object.entries((
|
|
57420
|
+
...Object.entries((_a16 = telemetry == null ? undefined : telemetry.metadata) != null ? _a16 : {}).reduce((attributes, [key, value]) => {
|
|
57418
57421
|
attributes[`ai.telemetry.metadata.${key}`] = value;
|
|
57419
57422
|
return attributes;
|
|
57420
57423
|
}, {}),
|
|
@@ -57430,7 +57433,7 @@ var noopTracer = {
|
|
|
57430
57433
|
startSpan() {
|
|
57431
57434
|
return noopSpan;
|
|
57432
57435
|
},
|
|
57433
|
-
startActiveSpan(
|
|
57436
|
+
startActiveSpan(name162, arg1, arg2, arg3) {
|
|
57434
57437
|
if (typeof arg1 === "function") {
|
|
57435
57438
|
return arg1(noopSpan);
|
|
57436
57439
|
}
|
|
@@ -57495,13 +57498,13 @@ function getTracer({
|
|
|
57495
57498
|
return import_api.trace.getTracer("ai");
|
|
57496
57499
|
}
|
|
57497
57500
|
function recordSpan({
|
|
57498
|
-
name:
|
|
57501
|
+
name: name162,
|
|
57499
57502
|
tracer,
|
|
57500
57503
|
attributes,
|
|
57501
57504
|
fn,
|
|
57502
57505
|
endWhenDone = true
|
|
57503
57506
|
}) {
|
|
57504
|
-
return tracer.startActiveSpan(
|
|
57507
|
+
return tracer.startActiveSpan(name162, { attributes }, async (span) => {
|
|
57505
57508
|
try {
|
|
57506
57509
|
const result = await fn(span);
|
|
57507
57510
|
if (endWhenDone) {
|
|
@@ -57790,14 +57793,14 @@ async function doParseToolCall({
|
|
|
57790
57793
|
tools
|
|
57791
57794
|
}) {
|
|
57792
57795
|
const toolName = toolCall.toolName;
|
|
57793
|
-
const
|
|
57794
|
-
if (
|
|
57796
|
+
const tool2 = tools[toolName];
|
|
57797
|
+
if (tool2 == null) {
|
|
57795
57798
|
throw new NoSuchToolError({
|
|
57796
57799
|
toolName: toolCall.toolName,
|
|
57797
57800
|
availableTools: Object.keys(tools)
|
|
57798
57801
|
});
|
|
57799
57802
|
}
|
|
57800
|
-
const schema = asSchema(
|
|
57803
|
+
const schema = asSchema(tool2.inputSchema);
|
|
57801
57804
|
const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
|
|
57802
57805
|
if (parseResult.success === false) {
|
|
57803
57806
|
throw new InvalidToolInputError({
|
|
@@ -57806,7 +57809,7 @@ async function doParseToolCall({
|
|
|
57806
57809
|
cause: parseResult.error
|
|
57807
57810
|
});
|
|
57808
57811
|
}
|
|
57809
|
-
return
|
|
57812
|
+
return tool2.type === "dynamic" ? {
|
|
57810
57813
|
type: "tool-call",
|
|
57811
57814
|
toolCallId: toolCall.toolCallId,
|
|
57812
57815
|
toolName: toolCall.toolName,
|
|
@@ -57886,7 +57889,7 @@ async function isStopConditionMet({
|
|
|
57886
57889
|
}
|
|
57887
57890
|
function createToolModelOutput({
|
|
57888
57891
|
output,
|
|
57889
|
-
tool:
|
|
57892
|
+
tool: tool2,
|
|
57890
57893
|
errorMode
|
|
57891
57894
|
}) {
|
|
57892
57895
|
if (errorMode === "text") {
|
|
@@ -57894,8 +57897,8 @@ function createToolModelOutput({
|
|
|
57894
57897
|
} else if (errorMode === "json") {
|
|
57895
57898
|
return { type: "error-json", value: toJSONValue(output) };
|
|
57896
57899
|
}
|
|
57897
|
-
if (
|
|
57898
|
-
return
|
|
57900
|
+
if (tool2 == null ? undefined : tool2.toModelOutput) {
|
|
57901
|
+
return tool2.toModelOutput(output);
|
|
57899
57902
|
}
|
|
57900
57903
|
return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
|
|
57901
57904
|
}
|
|
@@ -58642,7 +58645,7 @@ function processUIMessageStream({
|
|
|
58642
58645
|
return stream.pipeThrough(new TransformStream({
|
|
58643
58646
|
async transform(chunk, controller) {
|
|
58644
58647
|
await runUpdateMessageJob(async ({ state, write }) => {
|
|
58645
|
-
var
|
|
58648
|
+
var _a16, _b8, _c, _d;
|
|
58646
58649
|
function getToolInvocation(toolCallId) {
|
|
58647
58650
|
const toolInvocations = state.message.parts.filter(isToolUIPart);
|
|
58648
58651
|
const toolInvocation = toolInvocations.find((invocation) => invocation.toolCallId === toolCallId);
|
|
@@ -58660,7 +58663,7 @@ function processUIMessageStream({
|
|
|
58660
58663
|
return toolInvocation;
|
|
58661
58664
|
}
|
|
58662
58665
|
function updateToolPart(options) {
|
|
58663
|
-
var
|
|
58666
|
+
var _a172;
|
|
58664
58667
|
const part = state.message.parts.find((part2) => isToolUIPart(part2) && part2.toolCallId === options.toolCallId);
|
|
58665
58668
|
const anyOptions = options;
|
|
58666
58669
|
const anyPart = part;
|
|
@@ -58671,7 +58674,7 @@ function processUIMessageStream({
|
|
|
58671
58674
|
anyPart.errorText = anyOptions.errorText;
|
|
58672
58675
|
anyPart.rawInput = anyOptions.rawInput;
|
|
58673
58676
|
anyPart.preliminary = anyOptions.preliminary;
|
|
58674
|
-
anyPart.providerExecuted = (
|
|
58677
|
+
anyPart.providerExecuted = (_a172 = anyOptions.providerExecuted) != null ? _a172 : part.providerExecuted;
|
|
58675
58678
|
if (anyOptions.providerMetadata != null && part.state === "input-available") {
|
|
58676
58679
|
part.callProviderMetadata = anyOptions.providerMetadata;
|
|
58677
58680
|
}
|
|
@@ -58691,7 +58694,7 @@ function processUIMessageStream({
|
|
|
58691
58694
|
}
|
|
58692
58695
|
}
|
|
58693
58696
|
function updateDynamicToolPart(options) {
|
|
58694
|
-
var
|
|
58697
|
+
var _a172, _b22;
|
|
58695
58698
|
const part = state.message.parts.find((part2) => part2.type === "dynamic-tool" && part2.toolCallId === options.toolCallId);
|
|
58696
58699
|
const anyOptions = options;
|
|
58697
58700
|
const anyPart = part;
|
|
@@ -58701,8 +58704,9 @@ function processUIMessageStream({
|
|
|
58701
58704
|
anyPart.input = anyOptions.input;
|
|
58702
58705
|
anyPart.output = anyOptions.output;
|
|
58703
58706
|
anyPart.errorText = anyOptions.errorText;
|
|
58704
|
-
anyPart.rawInput = (
|
|
58707
|
+
anyPart.rawInput = (_a172 = anyOptions.rawInput) != null ? _a172 : anyPart.rawInput;
|
|
58705
58708
|
anyPart.preliminary = anyOptions.preliminary;
|
|
58709
|
+
anyPart.providerExecuted = (_b22 = anyOptions.providerExecuted) != null ? _b22 : part.providerExecuted;
|
|
58706
58710
|
if (anyOptions.providerMetadata != null && part.state === "input-available") {
|
|
58707
58711
|
part.callProviderMetadata = anyOptions.providerMetadata;
|
|
58708
58712
|
}
|
|
@@ -58716,6 +58720,7 @@ function processUIMessageStream({
|
|
|
58716
58720
|
output: anyOptions.output,
|
|
58717
58721
|
errorText: anyOptions.errorText,
|
|
58718
58722
|
preliminary: anyOptions.preliminary,
|
|
58723
|
+
providerExecuted: anyOptions.providerExecuted,
|
|
58719
58724
|
...anyOptions.providerMetadata != null ? { callProviderMetadata: anyOptions.providerMetadata } : {}
|
|
58720
58725
|
});
|
|
58721
58726
|
}
|
|
@@ -58748,7 +58753,7 @@ function processUIMessageStream({
|
|
|
58748
58753
|
case "text-delta": {
|
|
58749
58754
|
const textPart = state.activeTextParts[chunk.id];
|
|
58750
58755
|
textPart.text += chunk.delta;
|
|
58751
|
-
textPart.providerMetadata = (
|
|
58756
|
+
textPart.providerMetadata = (_a16 = chunk.providerMetadata) != null ? _a16 : textPart.providerMetadata;
|
|
58752
58757
|
write();
|
|
58753
58758
|
break;
|
|
58754
58759
|
}
|
|
@@ -58832,7 +58837,8 @@ function processUIMessageStream({
|
|
|
58832
58837
|
toolCallId: chunk.toolCallId,
|
|
58833
58838
|
toolName: chunk.toolName,
|
|
58834
58839
|
state: "input-streaming",
|
|
58835
|
-
input: undefined
|
|
58840
|
+
input: undefined,
|
|
58841
|
+
providerExecuted: chunk.providerExecuted
|
|
58836
58842
|
});
|
|
58837
58843
|
} else {
|
|
58838
58844
|
updateToolPart({
|
|
@@ -58875,6 +58881,7 @@ function processUIMessageStream({
|
|
|
58875
58881
|
toolName: chunk.toolName,
|
|
58876
58882
|
state: "input-available",
|
|
58877
58883
|
input: chunk.input,
|
|
58884
|
+
providerExecuted: chunk.providerExecuted,
|
|
58878
58885
|
providerMetadata: chunk.providerMetadata
|
|
58879
58886
|
});
|
|
58880
58887
|
} else {
|
|
@@ -58903,6 +58910,7 @@ function processUIMessageStream({
|
|
|
58903
58910
|
state: "output-error",
|
|
58904
58911
|
input: chunk.input,
|
|
58905
58912
|
errorText: chunk.errorText,
|
|
58913
|
+
providerExecuted: chunk.providerExecuted,
|
|
58906
58914
|
providerMetadata: chunk.providerMetadata
|
|
58907
58915
|
});
|
|
58908
58916
|
} else {
|
|
@@ -58954,7 +58962,8 @@ function processUIMessageStream({
|
|
|
58954
58962
|
toolName: toolInvocation.toolName,
|
|
58955
58963
|
state: "output-error",
|
|
58956
58964
|
input: toolInvocation.input,
|
|
58957
|
-
errorText: chunk.errorText
|
|
58965
|
+
errorText: chunk.errorText,
|
|
58966
|
+
providerExecuted: chunk.providerExecuted
|
|
58958
58967
|
});
|
|
58959
58968
|
} else {
|
|
58960
58969
|
const toolInvocation = getToolInvocation(chunk.toolCallId);
|
|
@@ -58964,7 +58973,8 @@ function processUIMessageStream({
|
|
|
58964
58973
|
state: "output-error",
|
|
58965
58974
|
input: toolInvocation.input,
|
|
58966
58975
|
rawInput: toolInvocation.rawInput,
|
|
58967
|
-
errorText: chunk.errorText
|
|
58976
|
+
errorText: chunk.errorText,
|
|
58977
|
+
providerExecuted: chunk.providerExecuted
|
|
58968
58978
|
});
|
|
58969
58979
|
}
|
|
58970
58980
|
write();
|
|
@@ -59135,11 +59145,11 @@ function createAsyncIterableStream(source) {
|
|
|
59135
59145
|
const reader = this.getReader();
|
|
59136
59146
|
let finished = false;
|
|
59137
59147
|
async function cleanup(cancelStream) {
|
|
59138
|
-
var
|
|
59148
|
+
var _a16;
|
|
59139
59149
|
finished = true;
|
|
59140
59150
|
try {
|
|
59141
59151
|
if (cancelStream) {
|
|
59142
|
-
await ((
|
|
59152
|
+
await ((_a16 = reader.cancel) == null ? undefined : _a16.call(reader));
|
|
59143
59153
|
}
|
|
59144
59154
|
} finally {
|
|
59145
59155
|
try {
|
|
@@ -59294,23 +59304,23 @@ var DelayedPromise = class {
|
|
|
59294
59304
|
return this._promise;
|
|
59295
59305
|
}
|
|
59296
59306
|
resolve(value) {
|
|
59297
|
-
var
|
|
59307
|
+
var _a16;
|
|
59298
59308
|
this.status = { type: "resolved", value };
|
|
59299
59309
|
if (this._promise) {
|
|
59300
|
-
(
|
|
59310
|
+
(_a16 = this._resolve) == null || _a16.call(this, value);
|
|
59301
59311
|
}
|
|
59302
59312
|
}
|
|
59303
59313
|
reject(error46) {
|
|
59304
|
-
var
|
|
59314
|
+
var _a16;
|
|
59305
59315
|
this.status = { type: "rejected", error: error46 };
|
|
59306
59316
|
if (this._promise) {
|
|
59307
|
-
(
|
|
59317
|
+
(_a16 = this._reject) == null || _a16.call(this, error46);
|
|
59308
59318
|
}
|
|
59309
59319
|
}
|
|
59310
59320
|
};
|
|
59311
59321
|
function now() {
|
|
59312
|
-
var
|
|
59313
|
-
return (_b8 = (
|
|
59322
|
+
var _a16, _b8;
|
|
59323
|
+
return (_b8 = (_a16 = globalThis == null ? undefined : globalThis.performance) == null ? undefined : _a16.now()) != null ? _b8 : Date.now();
|
|
59314
59324
|
}
|
|
59315
59325
|
function runToolsTransformation({
|
|
59316
59326
|
tools,
|
|
@@ -59402,10 +59412,10 @@ function runToolsTransformation({
|
|
|
59402
59412
|
});
|
|
59403
59413
|
break;
|
|
59404
59414
|
}
|
|
59405
|
-
const
|
|
59415
|
+
const tool2 = tools[toolCall.toolName];
|
|
59406
59416
|
toolInputs.set(toolCall.toolCallId, toolCall.input);
|
|
59407
|
-
if (
|
|
59408
|
-
await
|
|
59417
|
+
if (tool2.onInputAvailable != null) {
|
|
59418
|
+
await tool2.onInputAvailable({
|
|
59409
59419
|
input: toolCall.input,
|
|
59410
59420
|
toolCallId: toolCall.toolCallId,
|
|
59411
59421
|
messages,
|
|
@@ -59413,7 +59423,7 @@ function runToolsTransformation({
|
|
|
59413
59423
|
experimental_context
|
|
59414
59424
|
});
|
|
59415
59425
|
}
|
|
59416
|
-
if (
|
|
59426
|
+
if (tool2.execute != null && toolCall.providerExecuted !== true) {
|
|
59417
59427
|
const toolExecutionId = generateId();
|
|
59418
59428
|
outstandingToolResults.add(toolExecutionId);
|
|
59419
59429
|
recordSpan({
|
|
@@ -59437,7 +59447,7 @@ function runToolsTransformation({
|
|
|
59437
59447
|
let output;
|
|
59438
59448
|
try {
|
|
59439
59449
|
const stream = executeTool({
|
|
59440
|
-
execute:
|
|
59450
|
+
execute: tool2.execute.bind(tool2),
|
|
59441
59451
|
input: toolCall.input,
|
|
59442
59452
|
options: {
|
|
59443
59453
|
toolCallId: toolCall.toolCallId,
|
|
@@ -59733,7 +59743,7 @@ var DefaultStreamTextResult = class {
|
|
|
59733
59743
|
let activeReasoningContent = {};
|
|
59734
59744
|
const eventProcessor = new TransformStream({
|
|
59735
59745
|
async transform(chunk, controller) {
|
|
59736
|
-
var
|
|
59746
|
+
var _a16, _b8, _c, _d;
|
|
59737
59747
|
controller.enqueue(chunk);
|
|
59738
59748
|
const { part } = chunk;
|
|
59739
59749
|
if (part.type === "text-delta" || part.type === "reasoning-delta" || part.type === "source" || part.type === "tool-call" || part.type === "tool-result" || part.type === "tool-input-start" || part.type === "tool-input-delta" || part.type === "raw") {
|
|
@@ -59763,7 +59773,7 @@ var DefaultStreamTextResult = class {
|
|
|
59763
59773
|
return;
|
|
59764
59774
|
}
|
|
59765
59775
|
activeText.text += part.text;
|
|
59766
|
-
activeText.providerMetadata = (
|
|
59776
|
+
activeText.providerMetadata = (_a16 = part.providerMetadata) != null ? _a16 : activeText.providerMetadata;
|
|
59767
59777
|
}
|
|
59768
59778
|
if (part.type === "text-end") {
|
|
59769
59779
|
const activeText = activeTextContent[part.id];
|
|
@@ -59918,8 +59928,8 @@ var DefaultStreamTextResult = class {
|
|
|
59918
59928
|
"ai.response.text": { output: () => finalStep.text },
|
|
59919
59929
|
"ai.response.toolCalls": {
|
|
59920
59930
|
output: () => {
|
|
59921
|
-
var
|
|
59922
|
-
return ((
|
|
59931
|
+
var _a16;
|
|
59932
|
+
return ((_a16 = finalStep.toolCalls) == null ? undefined : _a16.length) ? JSON.stringify(finalStep.toolCalls) : undefined;
|
|
59923
59933
|
}
|
|
59924
59934
|
},
|
|
59925
59935
|
"ai.response.providerMetadata": JSON.stringify(finalStep.providerMetadata),
|
|
@@ -60017,7 +60027,7 @@ var DefaultStreamTextResult = class {
|
|
|
60017
60027
|
responseMessages,
|
|
60018
60028
|
usage
|
|
60019
60029
|
}) {
|
|
60020
|
-
var
|
|
60030
|
+
var _a16, _b8, _c, _d, _e;
|
|
60021
60031
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
60022
60032
|
stepFinish = new DelayedPromise;
|
|
60023
60033
|
const initialPrompt = await standardizePrompt({
|
|
@@ -60035,7 +60045,7 @@ var DefaultStreamTextResult = class {
|
|
|
60035
60045
|
stepNumber: recordedSteps.length,
|
|
60036
60046
|
messages: stepInputMessages
|
|
60037
60047
|
}));
|
|
60038
|
-
const stepModel = resolveLanguageModel((
|
|
60048
|
+
const stepModel = resolveLanguageModel((_a16 = prepareStepResult == null ? undefined : prepareStepResult.model) != null ? _a16 : model);
|
|
60039
60049
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
60040
60050
|
prompt: {
|
|
60041
60051
|
system: (_b8 = prepareStepResult == null ? undefined : prepareStepResult.system) != null ? _b8 : initialPrompt.system,
|
|
@@ -60069,7 +60079,7 @@ var DefaultStreamTextResult = class {
|
|
|
60069
60079
|
input: () => stringifyForTelemetry(promptMessages)
|
|
60070
60080
|
},
|
|
60071
60081
|
"ai.prompt.tools": {
|
|
60072
|
-
input: () => stepTools == null ? undefined : stepTools.map((
|
|
60082
|
+
input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
|
|
60073
60083
|
},
|
|
60074
60084
|
"ai.prompt.toolChoice": {
|
|
60075
60085
|
input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
|
|
@@ -60137,7 +60147,7 @@ var DefaultStreamTextResult = class {
|
|
|
60137
60147
|
let activeText = "";
|
|
60138
60148
|
self2.addStream(streamWithToolResults.pipeThrough(new TransformStream({
|
|
60139
60149
|
async transform(chunk, controller) {
|
|
60140
|
-
var
|
|
60150
|
+
var _a172, _b22, _c2, _d2;
|
|
60141
60151
|
if (chunk.type === "stream-start") {
|
|
60142
60152
|
warnings = chunk.warnings;
|
|
60143
60153
|
return;
|
|
@@ -60209,7 +60219,7 @@ var DefaultStreamTextResult = class {
|
|
|
60209
60219
|
}
|
|
60210
60220
|
case "response-metadata": {
|
|
60211
60221
|
stepResponse = {
|
|
60212
|
-
id: (
|
|
60222
|
+
id: (_a172 = chunk.id) != null ? _a172 : stepResponse.id,
|
|
60213
60223
|
timestamp: (_b22 = chunk.timestamp) != null ? _b22 : stepResponse.timestamp,
|
|
60214
60224
|
modelId: (_c2 = chunk.modelId) != null ? _c2 : stepResponse.modelId
|
|
60215
60225
|
};
|
|
@@ -60237,9 +60247,9 @@ var DefaultStreamTextResult = class {
|
|
|
60237
60247
|
}
|
|
60238
60248
|
case "tool-input-start": {
|
|
60239
60249
|
activeToolCallToolNames[chunk.id] = chunk.toolName;
|
|
60240
|
-
const
|
|
60241
|
-
if ((
|
|
60242
|
-
await
|
|
60250
|
+
const tool2 = tools == null ? undefined : tools[chunk.toolName];
|
|
60251
|
+
if ((tool2 == null ? undefined : tool2.onInputStart) != null) {
|
|
60252
|
+
await tool2.onInputStart({
|
|
60243
60253
|
toolCallId: chunk.id,
|
|
60244
60254
|
messages: stepInputMessages,
|
|
60245
60255
|
abortSignal,
|
|
@@ -60248,7 +60258,7 @@ var DefaultStreamTextResult = class {
|
|
|
60248
60258
|
}
|
|
60249
60259
|
controller.enqueue({
|
|
60250
60260
|
...chunk,
|
|
60251
|
-
dynamic: (
|
|
60261
|
+
dynamic: (tool2 == null ? undefined : tool2.type) === "dynamic"
|
|
60252
60262
|
});
|
|
60253
60263
|
break;
|
|
60254
60264
|
}
|
|
@@ -60259,9 +60269,9 @@ var DefaultStreamTextResult = class {
|
|
|
60259
60269
|
}
|
|
60260
60270
|
case "tool-input-delta": {
|
|
60261
60271
|
const toolName = activeToolCallToolNames[chunk.id];
|
|
60262
|
-
const
|
|
60263
|
-
if ((
|
|
60264
|
-
await
|
|
60272
|
+
const tool2 = tools == null ? undefined : tools[toolName];
|
|
60273
|
+
if ((tool2 == null ? undefined : tool2.onInputDelta) != null) {
|
|
60274
|
+
await tool2.onInputDelta({
|
|
60265
60275
|
inputTextDelta: chunk.delta,
|
|
60266
60276
|
toolCallId: chunk.id,
|
|
60267
60277
|
messages: stepInputMessages,
|
|
@@ -60475,14 +60485,14 @@ var DefaultStreamTextResult = class {
|
|
|
60475
60485
|
})));
|
|
60476
60486
|
}
|
|
60477
60487
|
async consumeStream(options) {
|
|
60478
|
-
var
|
|
60488
|
+
var _a16;
|
|
60479
60489
|
try {
|
|
60480
60490
|
await consumeStream({
|
|
60481
60491
|
stream: this.fullStream,
|
|
60482
60492
|
onError: options == null ? undefined : options.onError
|
|
60483
60493
|
});
|
|
60484
60494
|
} catch (error46) {
|
|
60485
|
-
(
|
|
60495
|
+
(_a16 = options == null ? undefined : options.onError) == null || _a16.call(options, error46);
|
|
60486
60496
|
}
|
|
60487
60497
|
}
|
|
60488
60498
|
get experimental_partialOutputStream() {
|
|
@@ -60514,9 +60524,9 @@ var DefaultStreamTextResult = class {
|
|
|
60514
60524
|
}) : undefined;
|
|
60515
60525
|
const toolNamesByCallId = {};
|
|
60516
60526
|
const isDynamic = (toolCallId) => {
|
|
60517
|
-
var
|
|
60527
|
+
var _a16, _b8;
|
|
60518
60528
|
const toolName = toolNamesByCallId[toolCallId];
|
|
60519
|
-
const dynamic = ((_b8 = (
|
|
60529
|
+
const dynamic = ((_b8 = (_a16 = this.tools) == null ? undefined : _a16[toolName]) == null ? undefined : _b8.type) === "dynamic";
|
|
60520
60530
|
return dynamic ? true : undefined;
|
|
60521
60531
|
};
|
|
60522
60532
|
const baseStream = this.fullStream.pipeThrough(new TransformStream({
|
|
@@ -60884,117 +60894,11 @@ var object2 = ({
|
|
|
60884
60894
|
}
|
|
60885
60895
|
};
|
|
60886
60896
|
};
|
|
60887
|
-
var
|
|
60888
|
-
var
|
|
60889
|
-
var
|
|
60890
|
-
var
|
|
60891
|
-
|
|
60892
|
-
var ClientOrServerImplementationSchema = exports_external.looseObject({
|
|
60893
|
-
name: exports_external.string(),
|
|
60894
|
-
version: exports_external.string()
|
|
60895
|
-
});
|
|
60896
|
-
var BaseParamsSchema = exports_external.looseObject({
|
|
60897
|
-
_meta: exports_external.optional(exports_external.object({}).loose())
|
|
60898
|
-
});
|
|
60899
|
-
var ResultSchema = BaseParamsSchema;
|
|
60900
|
-
var RequestSchema = exports_external.object({
|
|
60901
|
-
method: exports_external.string(),
|
|
60902
|
-
params: exports_external.optional(BaseParamsSchema)
|
|
60903
|
-
});
|
|
60904
|
-
var ServerCapabilitiesSchema = exports_external.looseObject({
|
|
60905
|
-
experimental: exports_external.optional(exports_external.object({}).loose()),
|
|
60906
|
-
logging: exports_external.optional(exports_external.object({}).loose()),
|
|
60907
|
-
prompts: exports_external.optional(exports_external.looseObject({
|
|
60908
|
-
listChanged: exports_external.optional(exports_external.boolean())
|
|
60909
|
-
})),
|
|
60910
|
-
resources: exports_external.optional(exports_external.looseObject({
|
|
60911
|
-
subscribe: exports_external.optional(exports_external.boolean()),
|
|
60912
|
-
listChanged: exports_external.optional(exports_external.boolean())
|
|
60913
|
-
})),
|
|
60914
|
-
tools: exports_external.optional(exports_external.looseObject({
|
|
60915
|
-
listChanged: exports_external.optional(exports_external.boolean())
|
|
60916
|
-
}))
|
|
60917
|
-
});
|
|
60918
|
-
var InitializeResultSchema = ResultSchema.extend({
|
|
60919
|
-
protocolVersion: exports_external.string(),
|
|
60920
|
-
capabilities: ServerCapabilitiesSchema,
|
|
60921
|
-
serverInfo: ClientOrServerImplementationSchema,
|
|
60922
|
-
instructions: exports_external.optional(exports_external.string())
|
|
60923
|
-
});
|
|
60924
|
-
var PaginatedResultSchema = ResultSchema.extend({
|
|
60925
|
-
nextCursor: exports_external.optional(exports_external.string())
|
|
60926
|
-
});
|
|
60927
|
-
var ToolSchema = exports_external.object({
|
|
60928
|
-
name: exports_external.string(),
|
|
60929
|
-
description: exports_external.optional(exports_external.string()),
|
|
60930
|
-
inputSchema: exports_external.object({
|
|
60931
|
-
type: exports_external.literal("object"),
|
|
60932
|
-
properties: exports_external.optional(exports_external.object({}).loose())
|
|
60933
|
-
}).loose()
|
|
60934
|
-
}).loose();
|
|
60935
|
-
var ListToolsResultSchema = PaginatedResultSchema.extend({
|
|
60936
|
-
tools: exports_external.array(ToolSchema)
|
|
60937
|
-
});
|
|
60938
|
-
var TextContentSchema = exports_external.object({
|
|
60939
|
-
type: exports_external.literal("text"),
|
|
60940
|
-
text: exports_external.string()
|
|
60941
|
-
}).loose();
|
|
60942
|
-
var ImageContentSchema = exports_external.object({
|
|
60943
|
-
type: exports_external.literal("image"),
|
|
60944
|
-
data: exports_external.base64(),
|
|
60945
|
-
mimeType: exports_external.string()
|
|
60946
|
-
}).loose();
|
|
60947
|
-
var ResourceContentsSchema = exports_external.object({
|
|
60948
|
-
uri: exports_external.string(),
|
|
60949
|
-
mimeType: exports_external.optional(exports_external.string())
|
|
60950
|
-
}).loose();
|
|
60951
|
-
var TextResourceContentsSchema = ResourceContentsSchema.extend({
|
|
60952
|
-
text: exports_external.string()
|
|
60953
|
-
});
|
|
60954
|
-
var BlobResourceContentsSchema = ResourceContentsSchema.extend({
|
|
60955
|
-
blob: exports_external.base64()
|
|
60956
|
-
});
|
|
60957
|
-
var EmbeddedResourceSchema = exports_external.object({
|
|
60958
|
-
type: exports_external.literal("resource"),
|
|
60959
|
-
resource: exports_external.union([TextResourceContentsSchema, BlobResourceContentsSchema])
|
|
60960
|
-
}).loose();
|
|
60961
|
-
var CallToolResultSchema = ResultSchema.extend({
|
|
60962
|
-
content: exports_external.array(exports_external.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])),
|
|
60963
|
-
isError: exports_external.boolean().default(false).optional()
|
|
60964
|
-
}).or(ResultSchema.extend({
|
|
60965
|
-
toolResult: exports_external.unknown()
|
|
60966
|
-
}));
|
|
60967
|
-
var JSONRPC_VERSION = "2.0";
|
|
60968
|
-
var JSONRPCRequestSchema = exports_external.object({
|
|
60969
|
-
jsonrpc: exports_external.literal(JSONRPC_VERSION),
|
|
60970
|
-
id: exports_external.union([exports_external.string(), exports_external.number().int()])
|
|
60971
|
-
}).merge(RequestSchema).strict();
|
|
60972
|
-
var JSONRPCResponseSchema = exports_external.object({
|
|
60973
|
-
jsonrpc: exports_external.literal(JSONRPC_VERSION),
|
|
60974
|
-
id: exports_external.union([exports_external.string(), exports_external.number().int()]),
|
|
60975
|
-
result: ResultSchema
|
|
60976
|
-
}).strict();
|
|
60977
|
-
var JSONRPCErrorSchema = exports_external.object({
|
|
60978
|
-
jsonrpc: exports_external.literal(JSONRPC_VERSION),
|
|
60979
|
-
id: exports_external.union([exports_external.string(), exports_external.number().int()]),
|
|
60980
|
-
error: exports_external.object({
|
|
60981
|
-
code: exports_external.number().int(),
|
|
60982
|
-
message: exports_external.string(),
|
|
60983
|
-
data: exports_external.optional(exports_external.unknown())
|
|
60984
|
-
})
|
|
60985
|
-
}).strict();
|
|
60986
|
-
var JSONRPCNotificationSchema = exports_external.object({
|
|
60987
|
-
jsonrpc: exports_external.literal(JSONRPC_VERSION)
|
|
60988
|
-
}).merge(exports_external.object({
|
|
60989
|
-
method: exports_external.string(),
|
|
60990
|
-
params: exports_external.optional(BaseParamsSchema)
|
|
60991
|
-
})).strict();
|
|
60992
|
-
var JSONRPCMessageSchema = exports_external.union([
|
|
60993
|
-
JSONRPCRequestSchema,
|
|
60994
|
-
JSONRPCNotificationSchema,
|
|
60995
|
-
JSONRPCResponseSchema,
|
|
60996
|
-
JSONRPCErrorSchema
|
|
60997
|
-
]);
|
|
60897
|
+
var name15 = "AI_NoSuchProviderError";
|
|
60898
|
+
var marker152 = `vercel.ai.error.${name15}`;
|
|
60899
|
+
var symbol152 = Symbol.for(marker152);
|
|
60900
|
+
var _a152;
|
|
60901
|
+
_a152 = symbol152;
|
|
60998
60902
|
var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(exports_external.object({
|
|
60999
60903
|
id: exports_external.string(),
|
|
61000
60904
|
role: exports_external.enum(["system", "user", "assistant"]),
|
|
@@ -61048,6 +60952,7 @@ var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(expo
|
|
|
61048
60952
|
toolCallId: exports_external.string(),
|
|
61049
60953
|
state: exports_external.literal("input-streaming"),
|
|
61050
60954
|
input: exports_external.unknown().optional(),
|
|
60955
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
61051
60956
|
output: exports_external.never().optional(),
|
|
61052
60957
|
errorText: exports_external.never().optional()
|
|
61053
60958
|
}),
|
|
@@ -61057,6 +60962,7 @@ var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(expo
|
|
|
61057
60962
|
toolCallId: exports_external.string(),
|
|
61058
60963
|
state: exports_external.literal("input-available"),
|
|
61059
60964
|
input: exports_external.unknown(),
|
|
60965
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
61060
60966
|
output: exports_external.never().optional(),
|
|
61061
60967
|
errorText: exports_external.never().optional(),
|
|
61062
60968
|
callProviderMetadata: providerMetadataSchema.optional()
|
|
@@ -61067,6 +60973,7 @@ var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(expo
|
|
|
61067
60973
|
toolCallId: exports_external.string(),
|
|
61068
60974
|
state: exports_external.literal("output-available"),
|
|
61069
60975
|
input: exports_external.unknown(),
|
|
60976
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
61070
60977
|
output: exports_external.unknown(),
|
|
61071
60978
|
errorText: exports_external.never().optional(),
|
|
61072
60979
|
callProviderMetadata: providerMetadataSchema.optional(),
|
|
@@ -61078,6 +60985,7 @@ var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(expo
|
|
|
61078
60985
|
toolCallId: exports_external.string(),
|
|
61079
60986
|
state: exports_external.literal("output-error"),
|
|
61080
60987
|
input: exports_external.unknown(),
|
|
60988
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
61081
60989
|
output: exports_external.never().optional(),
|
|
61082
60990
|
errorText: exports_external.string(),
|
|
61083
60991
|
callProviderMetadata: providerMetadataSchema.optional()
|
|
@@ -64234,13 +64142,13 @@ async function listFiles(dirPath, recursive, maxCount, cwd, excludeFiles, includ
|
|
|
64234
64142
|
const remainingEntries = entries.slice(entries.indexOf(entry) + 1);
|
|
64235
64143
|
const hasRemainingFiles = remainingEntries.some((e) => !e.isDirectory() && !folderIg.ignores(relative(cwd, join2(currentPath, e.name)).replace(/\\/g, "/")));
|
|
64236
64144
|
if (hasRemainingFiles) {
|
|
64237
|
-
const
|
|
64238
|
-
results.push(
|
|
64145
|
+
const marker16 = `${currentRelPath}/(files omitted)`;
|
|
64146
|
+
results.push(marker16);
|
|
64239
64147
|
}
|
|
64240
64148
|
for (const queueItem of queue) {
|
|
64241
64149
|
if (!processedDirs.has(queueItem.relPath)) {
|
|
64242
|
-
const
|
|
64243
|
-
results.push(
|
|
64150
|
+
const marker16 = `${queueItem.relPath}/(files omitted)`;
|
|
64151
|
+
results.push(marker16);
|
|
64244
64152
|
processedDirs.add(queueItem.relPath);
|
|
64245
64153
|
}
|
|
64246
64154
|
}
|
|
@@ -65375,8 +65283,8 @@ function readMultiline(prompt = "Enter text (Ctrl+D to finish):") {
|
|
|
65375
65283
|
// src/getModel.ts
|
|
65376
65284
|
import { appendFileSync } from "node:fs";
|
|
65377
65285
|
|
|
65378
|
-
// ../../node_modules/.bun/@ai-sdk+anthropic@2.0.
|
|
65379
|
-
var VERSION4 = "2.0.
|
|
65286
|
+
// ../../node_modules/.bun/@ai-sdk+anthropic@2.0.40+5954958163efbb2a/node_modules/@ai-sdk/anthropic/dist/index.mjs
|
|
65287
|
+
var VERSION4 = "2.0.40";
|
|
65380
65288
|
var anthropicErrorDataSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
65381
65289
|
type: exports_external.literal("error"),
|
|
65382
65290
|
error: exports_external.object({
|
|
@@ -65559,7 +65467,16 @@ var anthropicMessagesResponseSchema = lazySchema(() => zodSchema(exports_externa
|
|
|
65559
65467
|
output_tokens: exports_external.number(),
|
|
65560
65468
|
cache_creation_input_tokens: exports_external.number().nullish(),
|
|
65561
65469
|
cache_read_input_tokens: exports_external.number().nullish()
|
|
65562
|
-
})
|
|
65470
|
+
}),
|
|
65471
|
+
container: exports_external.object({
|
|
65472
|
+
expires_at: exports_external.string(),
|
|
65473
|
+
id: exports_external.string(),
|
|
65474
|
+
skills: exports_external.array(exports_external.object({
|
|
65475
|
+
type: exports_external.union([exports_external.literal("anthropic"), exports_external.literal("custom")]),
|
|
65476
|
+
skill_id: exports_external.string(),
|
|
65477
|
+
version: exports_external.string()
|
|
65478
|
+
})).nullish()
|
|
65479
|
+
}).nullish()
|
|
65563
65480
|
})));
|
|
65564
65481
|
var anthropicMessagesChunkSchema = lazySchema(() => zodSchema(exports_external.discriminatedUnion("type", [
|
|
65565
65482
|
exports_external.object({
|
|
@@ -65776,7 +65693,19 @@ var anthropicMessagesChunkSchema = lazySchema(() => zodSchema(exports_external.d
|
|
|
65776
65693
|
type: exports_external.literal("message_delta"),
|
|
65777
65694
|
delta: exports_external.object({
|
|
65778
65695
|
stop_reason: exports_external.string().nullish(),
|
|
65779
|
-
stop_sequence: exports_external.string().nullish()
|
|
65696
|
+
stop_sequence: exports_external.string().nullish(),
|
|
65697
|
+
container: exports_external.object({
|
|
65698
|
+
expires_at: exports_external.string(),
|
|
65699
|
+
id: exports_external.string(),
|
|
65700
|
+
skills: exports_external.array(exports_external.object({
|
|
65701
|
+
type: exports_external.union([
|
|
65702
|
+
exports_external.literal("anthropic"),
|
|
65703
|
+
exports_external.literal("custom")
|
|
65704
|
+
]),
|
|
65705
|
+
skill_id: exports_external.string(),
|
|
65706
|
+
version: exports_external.string()
|
|
65707
|
+
})).nullish()
|
|
65708
|
+
}).nullish()
|
|
65780
65709
|
}),
|
|
65781
65710
|
usage: exports_external.looseObject({
|
|
65782
65711
|
output_tokens: exports_external.number(),
|
|
@@ -65811,14 +65740,56 @@ var anthropicProviderOptions = exports_external.object({
|
|
|
65811
65740
|
cacheControl: exports_external.object({
|
|
65812
65741
|
type: exports_external.literal("ephemeral"),
|
|
65813
65742
|
ttl: exports_external.union([exports_external.literal("5m"), exports_external.literal("1h")]).optional()
|
|
65743
|
+
}).optional(),
|
|
65744
|
+
container: exports_external.object({
|
|
65745
|
+
id: exports_external.string().optional(),
|
|
65746
|
+
skills: exports_external.array(exports_external.object({
|
|
65747
|
+
type: exports_external.union([exports_external.literal("anthropic"), exports_external.literal("custom")]),
|
|
65748
|
+
skillId: exports_external.string(),
|
|
65749
|
+
version: exports_external.string().optional()
|
|
65750
|
+
})).optional()
|
|
65814
65751
|
}).optional()
|
|
65815
65752
|
});
|
|
65753
|
+
var MAX_CACHE_BREAKPOINTS = 4;
|
|
65816
65754
|
function getCacheControl(providerMetadata) {
|
|
65817
|
-
var
|
|
65755
|
+
var _a16;
|
|
65818
65756
|
const anthropic2 = providerMetadata == null ? undefined : providerMetadata.anthropic;
|
|
65819
|
-
const cacheControlValue = (
|
|
65757
|
+
const cacheControlValue = (_a16 = anthropic2 == null ? undefined : anthropic2.cacheControl) != null ? _a16 : anthropic2 == null ? undefined : anthropic2.cache_control;
|
|
65820
65758
|
return cacheControlValue;
|
|
65821
65759
|
}
|
|
65760
|
+
var CacheControlValidator = class {
|
|
65761
|
+
constructor() {
|
|
65762
|
+
this.breakpointCount = 0;
|
|
65763
|
+
this.warnings = [];
|
|
65764
|
+
}
|
|
65765
|
+
getCacheControl(providerMetadata, context) {
|
|
65766
|
+
const cacheControlValue = getCacheControl(providerMetadata);
|
|
65767
|
+
if (!cacheControlValue) {
|
|
65768
|
+
return;
|
|
65769
|
+
}
|
|
65770
|
+
if (!context.canCache) {
|
|
65771
|
+
this.warnings.push({
|
|
65772
|
+
type: "unsupported-setting",
|
|
65773
|
+
setting: "cacheControl",
|
|
65774
|
+
details: `cache_control cannot be set on ${context.type}. It will be ignored.`
|
|
65775
|
+
});
|
|
65776
|
+
return;
|
|
65777
|
+
}
|
|
65778
|
+
this.breakpointCount++;
|
|
65779
|
+
if (this.breakpointCount > MAX_CACHE_BREAKPOINTS) {
|
|
65780
|
+
this.warnings.push({
|
|
65781
|
+
type: "unsupported-setting",
|
|
65782
|
+
setting: "cacheControl",
|
|
65783
|
+
details: `Maximum ${MAX_CACHE_BREAKPOINTS} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`
|
|
65784
|
+
});
|
|
65785
|
+
return;
|
|
65786
|
+
}
|
|
65787
|
+
return cacheControlValue;
|
|
65788
|
+
}
|
|
65789
|
+
getWarnings() {
|
|
65790
|
+
return this.warnings;
|
|
65791
|
+
}
|
|
65792
|
+
};
|
|
65822
65793
|
var textEditor_20250728ArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
65823
65794
|
maxCharacters: exports_external.number().optional()
|
|
65824
65795
|
})));
|
|
@@ -65914,11 +65885,13 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
65914
65885
|
async function prepareTools({
|
|
65915
65886
|
tools: tools2,
|
|
65916
65887
|
toolChoice,
|
|
65917
|
-
disableParallelToolUse
|
|
65888
|
+
disableParallelToolUse,
|
|
65889
|
+
cacheControlValidator
|
|
65918
65890
|
}) {
|
|
65919
65891
|
tools2 = (tools2 == null ? undefined : tools2.length) ? tools2 : undefined;
|
|
65920
65892
|
const toolWarnings = [];
|
|
65921
65893
|
const betas = /* @__PURE__ */ new Set;
|
|
65894
|
+
const validator2 = cacheControlValidator || new CacheControlValidator;
|
|
65922
65895
|
if (tools2 == null) {
|
|
65923
65896
|
return { tools: undefined, toolChoice: undefined, toolWarnings, betas };
|
|
65924
65897
|
}
|
|
@@ -65926,7 +65899,10 @@ async function prepareTools({
|
|
|
65926
65899
|
for (const tool3 of tools2) {
|
|
65927
65900
|
switch (tool3.type) {
|
|
65928
65901
|
case "function": {
|
|
65929
|
-
const cacheControl = getCacheControl(tool3.providerOptions
|
|
65902
|
+
const cacheControl = validator2.getCacheControl(tool3.providerOptions, {
|
|
65903
|
+
type: "tool definition",
|
|
65904
|
+
canCache: true
|
|
65905
|
+
});
|
|
65930
65906
|
anthropicTools2.push({
|
|
65931
65907
|
name: tool3.name,
|
|
65932
65908
|
description: tool3.description,
|
|
@@ -65941,7 +65917,8 @@ async function prepareTools({
|
|
|
65941
65917
|
betas.add("code-execution-2025-05-22");
|
|
65942
65918
|
anthropicTools2.push({
|
|
65943
65919
|
type: "code_execution_20250522",
|
|
65944
|
-
name: "code_execution"
|
|
65920
|
+
name: "code_execution",
|
|
65921
|
+
cache_control: undefined
|
|
65945
65922
|
});
|
|
65946
65923
|
break;
|
|
65947
65924
|
}
|
|
@@ -65960,7 +65937,8 @@ async function prepareTools({
|
|
|
65960
65937
|
type: "computer_20250124",
|
|
65961
65938
|
display_width_px: tool3.args.displayWidthPx,
|
|
65962
65939
|
display_height_px: tool3.args.displayHeightPx,
|
|
65963
|
-
display_number: tool3.args.displayNumber
|
|
65940
|
+
display_number: tool3.args.displayNumber,
|
|
65941
|
+
cache_control: undefined
|
|
65964
65942
|
});
|
|
65965
65943
|
break;
|
|
65966
65944
|
}
|
|
@@ -65971,7 +65949,8 @@ async function prepareTools({
|
|
|
65971
65949
|
type: "computer_20241022",
|
|
65972
65950
|
display_width_px: tool3.args.displayWidthPx,
|
|
65973
65951
|
display_height_px: tool3.args.displayHeightPx,
|
|
65974
|
-
display_number: tool3.args.displayNumber
|
|
65952
|
+
display_number: tool3.args.displayNumber,
|
|
65953
|
+
cache_control: undefined
|
|
65975
65954
|
});
|
|
65976
65955
|
break;
|
|
65977
65956
|
}
|
|
@@ -65979,7 +65958,8 @@ async function prepareTools({
|
|
|
65979
65958
|
betas.add("computer-use-2025-01-24");
|
|
65980
65959
|
anthropicTools2.push({
|
|
65981
65960
|
name: "str_replace_editor",
|
|
65982
|
-
type: "text_editor_20250124"
|
|
65961
|
+
type: "text_editor_20250124",
|
|
65962
|
+
cache_control: undefined
|
|
65983
65963
|
});
|
|
65984
65964
|
break;
|
|
65985
65965
|
}
|
|
@@ -65987,7 +65967,8 @@ async function prepareTools({
|
|
|
65987
65967
|
betas.add("computer-use-2024-10-22");
|
|
65988
65968
|
anthropicTools2.push({
|
|
65989
65969
|
name: "str_replace_editor",
|
|
65990
|
-
type: "text_editor_20241022"
|
|
65970
|
+
type: "text_editor_20241022",
|
|
65971
|
+
cache_control: undefined
|
|
65991
65972
|
});
|
|
65992
65973
|
break;
|
|
65993
65974
|
}
|
|
@@ -65995,7 +65976,8 @@ async function prepareTools({
|
|
|
65995
65976
|
betas.add("computer-use-2025-01-24");
|
|
65996
65977
|
anthropicTools2.push({
|
|
65997
65978
|
name: "str_replace_based_edit_tool",
|
|
65998
|
-
type: "text_editor_20250429"
|
|
65979
|
+
type: "text_editor_20250429",
|
|
65980
|
+
cache_control: undefined
|
|
65999
65981
|
});
|
|
66000
65982
|
break;
|
|
66001
65983
|
}
|
|
@@ -66007,7 +65989,8 @@ async function prepareTools({
|
|
|
66007
65989
|
anthropicTools2.push({
|
|
66008
65990
|
name: "str_replace_based_edit_tool",
|
|
66009
65991
|
type: "text_editor_20250728",
|
|
66010
|
-
max_characters: args.maxCharacters
|
|
65992
|
+
max_characters: args.maxCharacters,
|
|
65993
|
+
cache_control: undefined
|
|
66011
65994
|
});
|
|
66012
65995
|
break;
|
|
66013
65996
|
}
|
|
@@ -66015,7 +65998,8 @@ async function prepareTools({
|
|
|
66015
65998
|
betas.add("computer-use-2025-01-24");
|
|
66016
65999
|
anthropicTools2.push({
|
|
66017
66000
|
name: "bash",
|
|
66018
|
-
type: "bash_20250124"
|
|
66001
|
+
type: "bash_20250124",
|
|
66002
|
+
cache_control: undefined
|
|
66019
66003
|
});
|
|
66020
66004
|
break;
|
|
66021
66005
|
}
|
|
@@ -66023,7 +66007,8 @@ async function prepareTools({
|
|
|
66023
66007
|
betas.add("computer-use-2024-10-22");
|
|
66024
66008
|
anthropicTools2.push({
|
|
66025
66009
|
name: "bash",
|
|
66026
|
-
type: "bash_20241022"
|
|
66010
|
+
type: "bash_20241022",
|
|
66011
|
+
cache_control: undefined
|
|
66027
66012
|
});
|
|
66028
66013
|
break;
|
|
66029
66014
|
}
|
|
@@ -66048,7 +66033,8 @@ async function prepareTools({
|
|
|
66048
66033
|
allowed_domains: args.allowedDomains,
|
|
66049
66034
|
blocked_domains: args.blockedDomains,
|
|
66050
66035
|
citations: args.citations,
|
|
66051
|
-
max_content_tokens: args.maxContentTokens
|
|
66036
|
+
max_content_tokens: args.maxContentTokens,
|
|
66037
|
+
cache_control: undefined
|
|
66052
66038
|
});
|
|
66053
66039
|
break;
|
|
66054
66040
|
}
|
|
@@ -66063,7 +66049,8 @@ async function prepareTools({
|
|
|
66063
66049
|
max_uses: args.maxUses,
|
|
66064
66050
|
allowed_domains: args.allowedDomains,
|
|
66065
66051
|
blocked_domains: args.blockedDomains,
|
|
66066
|
-
user_location: args.userLocation
|
|
66052
|
+
user_location: args.userLocation,
|
|
66053
|
+
cache_control: undefined
|
|
66067
66054
|
});
|
|
66068
66055
|
break;
|
|
66069
66056
|
}
|
|
@@ -66243,11 +66230,13 @@ function convertToString(data) {
|
|
|
66243
66230
|
async function convertToAnthropicMessagesPrompt({
|
|
66244
66231
|
prompt,
|
|
66245
66232
|
sendReasoning,
|
|
66246
|
-
warnings
|
|
66233
|
+
warnings,
|
|
66234
|
+
cacheControlValidator
|
|
66247
66235
|
}) {
|
|
66248
|
-
var
|
|
66236
|
+
var _a16, _b8, _c, _d, _e;
|
|
66249
66237
|
const betas = /* @__PURE__ */ new Set;
|
|
66250
66238
|
const blocks = groupIntoBlocks(prompt);
|
|
66239
|
+
const validator2 = cacheControlValidator || new CacheControlValidator;
|
|
66251
66240
|
let system = undefined;
|
|
66252
66241
|
const messages = [];
|
|
66253
66242
|
async function shouldEnableCitations(providerMetadata) {
|
|
@@ -66284,7 +66273,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66284
66273
|
system = block.messages.map(({ content, providerOptions }) => ({
|
|
66285
66274
|
type: "text",
|
|
66286
66275
|
text: content,
|
|
66287
|
-
cache_control: getCacheControl(providerOptions
|
|
66276
|
+
cache_control: validator2.getCacheControl(providerOptions, {
|
|
66277
|
+
type: "system message",
|
|
66278
|
+
canCache: true
|
|
66279
|
+
})
|
|
66288
66280
|
}));
|
|
66289
66281
|
break;
|
|
66290
66282
|
}
|
|
@@ -66297,7 +66289,13 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66297
66289
|
for (let j = 0;j < content.length; j++) {
|
|
66298
66290
|
const part = content[j];
|
|
66299
66291
|
const isLastPart = j === content.length - 1;
|
|
66300
|
-
const cacheControl = (
|
|
66292
|
+
const cacheControl = (_a16 = validator2.getCacheControl(part.providerOptions, {
|
|
66293
|
+
type: "user message part",
|
|
66294
|
+
canCache: true
|
|
66295
|
+
})) != null ? _a16 : isLastPart ? validator2.getCacheControl(message.providerOptions, {
|
|
66296
|
+
type: "user message",
|
|
66297
|
+
canCache: true
|
|
66298
|
+
}) : undefined;
|
|
66301
66299
|
switch (part.type) {
|
|
66302
66300
|
case "text": {
|
|
66303
66301
|
anthropicContent.push({
|
|
@@ -66377,7 +66375,13 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66377
66375
|
for (let i2 = 0;i2 < content.length; i2++) {
|
|
66378
66376
|
const part = content[i2];
|
|
66379
66377
|
const isLastPart = i2 === content.length - 1;
|
|
66380
|
-
const cacheControl = (_d = getCacheControl(part.providerOptions
|
|
66378
|
+
const cacheControl = (_d = validator2.getCacheControl(part.providerOptions, {
|
|
66379
|
+
type: "tool result part",
|
|
66380
|
+
canCache: true
|
|
66381
|
+
})) != null ? _d : isLastPart ? validator2.getCacheControl(message.providerOptions, {
|
|
66382
|
+
type: "tool result message",
|
|
66383
|
+
canCache: true
|
|
66384
|
+
}) : undefined;
|
|
66381
66385
|
const output = part.output;
|
|
66382
66386
|
let contentValue;
|
|
66383
66387
|
switch (output.type) {
|
|
@@ -66387,8 +66391,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66387
66391
|
case "text":
|
|
66388
66392
|
return {
|
|
66389
66393
|
type: "text",
|
|
66390
|
-
text: contentPart.text
|
|
66391
|
-
cache_control: undefined
|
|
66394
|
+
text: contentPart.text
|
|
66392
66395
|
};
|
|
66393
66396
|
case "media": {
|
|
66394
66397
|
if (contentPart.mediaType.startsWith("image/")) {
|
|
@@ -66398,8 +66401,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66398
66401
|
type: "base64",
|
|
66399
66402
|
media_type: contentPart.mediaType,
|
|
66400
66403
|
data: contentPart.data
|
|
66401
|
-
}
|
|
66402
|
-
cache_control: undefined
|
|
66404
|
+
}
|
|
66403
66405
|
};
|
|
66404
66406
|
}
|
|
66405
66407
|
if (contentPart.mediaType === "application/pdf") {
|
|
@@ -66410,8 +66412,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66410
66412
|
type: "base64",
|
|
66411
66413
|
media_type: contentPart.mediaType,
|
|
66412
66414
|
data: contentPart.data
|
|
66413
|
-
}
|
|
66414
|
-
cache_control: undefined
|
|
66415
|
+
}
|
|
66415
66416
|
};
|
|
66416
66417
|
}
|
|
66417
66418
|
throw new UnsupportedFunctionalityError({
|
|
@@ -66459,7 +66460,13 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66459
66460
|
for (let k = 0;k < content.length; k++) {
|
|
66460
66461
|
const part = content[k];
|
|
66461
66462
|
const isLastContentPart = k === content.length - 1;
|
|
66462
|
-
const cacheControl = (_e = getCacheControl(part.providerOptions
|
|
66463
|
+
const cacheControl = (_e = validator2.getCacheControl(part.providerOptions, {
|
|
66464
|
+
type: "assistant message part",
|
|
66465
|
+
canCache: true
|
|
66466
|
+
})) != null ? _e : isLastContentPart ? validator2.getCacheControl(message.providerOptions, {
|
|
66467
|
+
type: "assistant message",
|
|
66468
|
+
canCache: true
|
|
66469
|
+
}) : undefined;
|
|
66463
66470
|
switch (part.type) {
|
|
66464
66471
|
case "text": {
|
|
66465
66472
|
anthropicContent.push({
|
|
@@ -66478,17 +66485,23 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
66478
66485
|
});
|
|
66479
66486
|
if (reasoningMetadata != null) {
|
|
66480
66487
|
if (reasoningMetadata.signature != null) {
|
|
66488
|
+
validator2.getCacheControl(part.providerOptions, {
|
|
66489
|
+
type: "thinking block",
|
|
66490
|
+
canCache: false
|
|
66491
|
+
});
|
|
66481
66492
|
anthropicContent.push({
|
|
66482
66493
|
type: "thinking",
|
|
66483
66494
|
thinking: part.text,
|
|
66484
|
-
signature: reasoningMetadata.signature
|
|
66485
|
-
cache_control: cacheControl
|
|
66495
|
+
signature: reasoningMetadata.signature
|
|
66486
66496
|
});
|
|
66487
66497
|
} else if (reasoningMetadata.redactedData != null) {
|
|
66498
|
+
validator2.getCacheControl(part.providerOptions, {
|
|
66499
|
+
type: "redacted thinking block",
|
|
66500
|
+
canCache: false
|
|
66501
|
+
});
|
|
66488
66502
|
anthropicContent.push({
|
|
66489
66503
|
type: "redacted_thinking",
|
|
66490
|
-
data: reasoningMetadata.redactedData
|
|
66491
|
-
cache_control: cacheControl
|
|
66504
|
+
data: reasoningMetadata.redactedData
|
|
66492
66505
|
});
|
|
66493
66506
|
} else {
|
|
66494
66507
|
warnings.push({
|
|
@@ -66748,7 +66761,7 @@ function mapAnthropicStopReason({
|
|
|
66748
66761
|
}
|
|
66749
66762
|
}
|
|
66750
66763
|
function createCitationSource(citation, citationDocuments, generateId3) {
|
|
66751
|
-
var
|
|
66764
|
+
var _a16;
|
|
66752
66765
|
if (citation.type !== "page_location" && citation.type !== "char_location") {
|
|
66753
66766
|
return;
|
|
66754
66767
|
}
|
|
@@ -66761,7 +66774,7 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
66761
66774
|
sourceType: "document",
|
|
66762
66775
|
id: generateId3(),
|
|
66763
66776
|
mediaType: documentInfo.mediaType,
|
|
66764
|
-
title: (
|
|
66777
|
+
title: (_a16 = citation.document_title) != null ? _a16 : documentInfo.title,
|
|
66765
66778
|
filename: documentInfo.filename,
|
|
66766
66779
|
providerMetadata: {
|
|
66767
66780
|
anthropic: citation.type === "page_location" ? {
|
|
@@ -66779,10 +66792,10 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
66779
66792
|
var AnthropicMessagesLanguageModel = class {
|
|
66780
66793
|
constructor(modelId, config4) {
|
|
66781
66794
|
this.specificationVersion = "v2";
|
|
66782
|
-
var
|
|
66795
|
+
var _a16;
|
|
66783
66796
|
this.modelId = modelId;
|
|
66784
66797
|
this.config = config4;
|
|
66785
|
-
this.generateId = (
|
|
66798
|
+
this.generateId = (_a16 = config4.generateId) != null ? _a16 : generateId;
|
|
66786
66799
|
}
|
|
66787
66800
|
supportsUrl(url2) {
|
|
66788
66801
|
return url2.protocol === "https:";
|
|
@@ -66791,12 +66804,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66791
66804
|
return this.config.provider;
|
|
66792
66805
|
}
|
|
66793
66806
|
get supportedUrls() {
|
|
66794
|
-
var
|
|
66795
|
-
return (_c = (_b8 = (
|
|
66807
|
+
var _a16, _b8, _c;
|
|
66808
|
+
return (_c = (_b8 = (_a16 = this.config).supportedUrls) == null ? undefined : _b8.call(_a16)) != null ? _c : {};
|
|
66796
66809
|
}
|
|
66797
66810
|
async getArgs({
|
|
66798
66811
|
prompt,
|
|
66799
|
-
maxOutputTokens
|
|
66812
|
+
maxOutputTokens,
|
|
66800
66813
|
temperature,
|
|
66801
66814
|
topP,
|
|
66802
66815
|
topK,
|
|
@@ -66809,7 +66822,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66809
66822
|
toolChoice,
|
|
66810
66823
|
providerOptions
|
|
66811
66824
|
}) {
|
|
66812
|
-
var
|
|
66825
|
+
var _a16, _b8, _c, _d;
|
|
66813
66826
|
const warnings = [];
|
|
66814
66827
|
if (frequencyPenalty != null) {
|
|
66815
66828
|
warnings.push({
|
|
@@ -66855,16 +66868,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66855
66868
|
providerOptions,
|
|
66856
66869
|
schema: anthropicProviderOptions
|
|
66857
66870
|
});
|
|
66858
|
-
const
|
|
66871
|
+
const cacheControlValidator = new CacheControlValidator;
|
|
66872
|
+
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
66859
66873
|
prompt,
|
|
66860
|
-
sendReasoning: (
|
|
66861
|
-
warnings
|
|
66874
|
+
sendReasoning: (_a16 = anthropicOptions == null ? undefined : anthropicOptions.sendReasoning) != null ? _a16 : true,
|
|
66875
|
+
warnings,
|
|
66876
|
+
cacheControlValidator
|
|
66862
66877
|
});
|
|
66863
66878
|
const isThinking = ((_b8 = anthropicOptions == null ? undefined : anthropicOptions.thinking) == null ? undefined : _b8.type) === "enabled";
|
|
66864
66879
|
const thinkingBudget = (_c = anthropicOptions == null ? undefined : anthropicOptions.thinking) == null ? undefined : _c.budgetTokens;
|
|
66880
|
+
const { maxOutputTokens: maxOutputTokensForModel, knownModel } = getMaxOutputTokensForModel(this.modelId);
|
|
66881
|
+
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
66865
66882
|
const baseArgs = {
|
|
66866
66883
|
model: this.modelId,
|
|
66867
|
-
max_tokens:
|
|
66884
|
+
max_tokens: maxTokens,
|
|
66868
66885
|
temperature,
|
|
66869
66886
|
top_k: topK,
|
|
66870
66887
|
top_p: topP,
|
|
@@ -66872,6 +66889,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66872
66889
|
...isThinking && {
|
|
66873
66890
|
thinking: { type: "enabled", budget_tokens: thinkingBudget }
|
|
66874
66891
|
},
|
|
66892
|
+
...(anthropicOptions == null ? undefined : anthropicOptions.container) && {
|
|
66893
|
+
container: {
|
|
66894
|
+
id: anthropicOptions.container.id,
|
|
66895
|
+
skills: (_d = anthropicOptions.container.skills) == null ? undefined : _d.map((skill) => ({
|
|
66896
|
+
type: skill.type,
|
|
66897
|
+
skill_id: skill.skillId,
|
|
66898
|
+
version: skill.version
|
|
66899
|
+
}))
|
|
66900
|
+
}
|
|
66901
|
+
},
|
|
66875
66902
|
system: messagesPrompt.system,
|
|
66876
66903
|
messages: messagesPrompt.messages
|
|
66877
66904
|
};
|
|
@@ -66905,7 +66932,28 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66905
66932
|
details: "topP is not supported when thinking is enabled"
|
|
66906
66933
|
});
|
|
66907
66934
|
}
|
|
66908
|
-
baseArgs.max_tokens =
|
|
66935
|
+
baseArgs.max_tokens = maxTokens + thinkingBudget;
|
|
66936
|
+
}
|
|
66937
|
+
if (knownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
|
|
66938
|
+
if (maxOutputTokens != null) {
|
|
66939
|
+
warnings.push({
|
|
66940
|
+
type: "unsupported-setting",
|
|
66941
|
+
setting: "maxOutputTokens",
|
|
66942
|
+
details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
|
|
66943
|
+
});
|
|
66944
|
+
}
|
|
66945
|
+
baseArgs.max_tokens = maxOutputTokensForModel;
|
|
66946
|
+
}
|
|
66947
|
+
if ((anthropicOptions == null ? undefined : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
|
|
66948
|
+
betas.add("code-execution-2025-08-25");
|
|
66949
|
+
betas.add("skills-2025-10-02");
|
|
66950
|
+
betas.add("files-api-2025-04-14");
|
|
66951
|
+
if (!(tools2 == null ? undefined : tools2.some((tool3) => tool3.type === "provider-defined" && tool3.id === "anthropic.code_execution_20250825"))) {
|
|
66952
|
+
warnings.push({
|
|
66953
|
+
type: "other",
|
|
66954
|
+
message: "code execution tool is required when using skills"
|
|
66955
|
+
});
|
|
66956
|
+
}
|
|
66909
66957
|
}
|
|
66910
66958
|
const {
|
|
66911
66959
|
tools: anthropicTools2,
|
|
@@ -66915,20 +66963,23 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66915
66963
|
} = await prepareTools(jsonResponseTool != null ? {
|
|
66916
66964
|
tools: [jsonResponseTool],
|
|
66917
66965
|
toolChoice: { type: "tool", toolName: jsonResponseTool.name },
|
|
66918
|
-
disableParallelToolUse: true
|
|
66966
|
+
disableParallelToolUse: true,
|
|
66967
|
+
cacheControlValidator
|
|
66919
66968
|
} : {
|
|
66920
66969
|
tools: tools2 != null ? tools2 : [],
|
|
66921
66970
|
toolChoice,
|
|
66922
|
-
disableParallelToolUse: anthropicOptions == null ? undefined : anthropicOptions.disableParallelToolUse
|
|
66971
|
+
disableParallelToolUse: anthropicOptions == null ? undefined : anthropicOptions.disableParallelToolUse,
|
|
66972
|
+
cacheControlValidator
|
|
66923
66973
|
});
|
|
66974
|
+
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
66924
66975
|
return {
|
|
66925
66976
|
args: {
|
|
66926
66977
|
...baseArgs,
|
|
66927
66978
|
tools: anthropicTools2,
|
|
66928
66979
|
tool_choice: anthropicToolChoice
|
|
66929
66980
|
},
|
|
66930
|
-
warnings: [...warnings, ...toolWarnings],
|
|
66931
|
-
betas: /* @__PURE__ */ new Set([...
|
|
66981
|
+
warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
|
|
66982
|
+
betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
|
|
66932
66983
|
usesJsonResponseTool: jsonResponseTool != null
|
|
66933
66984
|
};
|
|
66934
66985
|
}
|
|
@@ -66939,38 +66990,38 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
66939
66990
|
return combineHeaders(await resolve(this.config.headers), betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}, headers);
|
|
66940
66991
|
}
|
|
66941
66992
|
buildRequestUrl(isStreaming) {
|
|
66942
|
-
var
|
|
66943
|
-
return (_c = (_b8 = (
|
|
66993
|
+
var _a16, _b8, _c;
|
|
66994
|
+
return (_c = (_b8 = (_a16 = this.config).buildRequestUrl) == null ? undefined : _b8.call(_a16, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
|
|
66944
66995
|
}
|
|
66945
66996
|
transformRequestBody(args) {
|
|
66946
|
-
var
|
|
66947
|
-
return (_c = (_b8 = (
|
|
66997
|
+
var _a16, _b8, _c;
|
|
66998
|
+
return (_c = (_b8 = (_a16 = this.config).transformRequestBody) == null ? undefined : _b8.call(_a16, args)) != null ? _c : args;
|
|
66948
66999
|
}
|
|
66949
67000
|
extractCitationDocuments(prompt) {
|
|
66950
67001
|
const isCitationPart = (part) => {
|
|
66951
|
-
var
|
|
67002
|
+
var _a16, _b8;
|
|
66952
67003
|
if (part.type !== "file") {
|
|
66953
67004
|
return false;
|
|
66954
67005
|
}
|
|
66955
67006
|
if (part.mediaType !== "application/pdf" && part.mediaType !== "text/plain") {
|
|
66956
67007
|
return false;
|
|
66957
67008
|
}
|
|
66958
|
-
const anthropic2 = (
|
|
67009
|
+
const anthropic2 = (_a16 = part.providerOptions) == null ? undefined : _a16.anthropic;
|
|
66959
67010
|
const citationsConfig = anthropic2 == null ? undefined : anthropic2.citations;
|
|
66960
67011
|
return (_b8 = citationsConfig == null ? undefined : citationsConfig.enabled) != null ? _b8 : false;
|
|
66961
67012
|
};
|
|
66962
67013
|
return prompt.filter((message) => message.role === "user").flatMap((message) => message.content).filter(isCitationPart).map((part) => {
|
|
66963
|
-
var
|
|
67014
|
+
var _a16;
|
|
66964
67015
|
const filePart = part;
|
|
66965
67016
|
return {
|
|
66966
|
-
title: (
|
|
67017
|
+
title: (_a16 = filePart.filename) != null ? _a16 : "Untitled Document",
|
|
66967
67018
|
filename: filePart.filename,
|
|
66968
67019
|
mediaType: filePart.mediaType
|
|
66969
67020
|
};
|
|
66970
67021
|
});
|
|
66971
67022
|
}
|
|
66972
67023
|
async doGenerate(options) {
|
|
66973
|
-
var
|
|
67024
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h;
|
|
66974
67025
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
66975
67026
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
66976
67027
|
const {
|
|
@@ -67124,7 +67175,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67124
67175
|
title: result.title,
|
|
67125
67176
|
providerMetadata: {
|
|
67126
67177
|
anthropic: {
|
|
67127
|
-
pageAge: (
|
|
67178
|
+
pageAge: (_a16 = result.page_age) != null ? _a16 : null
|
|
67128
67179
|
}
|
|
67129
67180
|
}
|
|
67130
67181
|
});
|
|
@@ -67210,7 +67261,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67210
67261
|
anthropic: {
|
|
67211
67262
|
usage: response.usage,
|
|
67212
67263
|
cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
|
|
67213
|
-
stopSequence: (_f = response.stop_sequence) != null ? _f : null
|
|
67264
|
+
stopSequence: (_f = response.stop_sequence) != null ? _f : null,
|
|
67265
|
+
container: response.container ? {
|
|
67266
|
+
expiresAt: response.container.expires_at,
|
|
67267
|
+
id: response.container.id,
|
|
67268
|
+
skills: (_h = (_g = response.container.skills) == null ? undefined : _g.map((skill) => ({
|
|
67269
|
+
type: skill.type,
|
|
67270
|
+
skillId: skill.skill_id,
|
|
67271
|
+
version: skill.version
|
|
67272
|
+
}))) != null ? _h : null
|
|
67273
|
+
} : null
|
|
67214
67274
|
}
|
|
67215
67275
|
}
|
|
67216
67276
|
};
|
|
@@ -67238,6 +67298,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67238
67298
|
let rawUsage = undefined;
|
|
67239
67299
|
let cacheCreationInputTokens = null;
|
|
67240
67300
|
let stopSequence = null;
|
|
67301
|
+
let container = null;
|
|
67241
67302
|
let blockType = undefined;
|
|
67242
67303
|
const generateId3 = this.generateId;
|
|
67243
67304
|
return {
|
|
@@ -67246,7 +67307,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67246
67307
|
controller.enqueue({ type: "stream-start", warnings });
|
|
67247
67308
|
},
|
|
67248
67309
|
transform(chunk, controller) {
|
|
67249
|
-
var
|
|
67310
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
67250
67311
|
if (options.includeRawChunks) {
|
|
67251
67312
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
67252
67313
|
}
|
|
@@ -67399,7 +67460,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67399
67460
|
title: result.title,
|
|
67400
67461
|
providerMetadata: {
|
|
67401
67462
|
anthropic: {
|
|
67402
|
-
pageAge: (
|
|
67463
|
+
pageAge: (_a16 = result.page_age) != null ? _a16 : null
|
|
67403
67464
|
}
|
|
67404
67465
|
}
|
|
67405
67466
|
});
|
|
@@ -67612,6 +67673,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67612
67673
|
isJsonResponseFromTool: usesJsonResponseTool
|
|
67613
67674
|
});
|
|
67614
67675
|
stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
|
|
67676
|
+
container = value.delta.container != null ? {
|
|
67677
|
+
expiresAt: value.delta.container.expires_at,
|
|
67678
|
+
id: value.delta.container.id,
|
|
67679
|
+
skills: (_j = (_i = value.delta.container.skills) == null ? undefined : _i.map((skill) => ({
|
|
67680
|
+
type: skill.type,
|
|
67681
|
+
skillId: skill.skill_id,
|
|
67682
|
+
version: skill.version
|
|
67683
|
+
}))) != null ? _j : null
|
|
67684
|
+
} : null;
|
|
67615
67685
|
rawUsage = {
|
|
67616
67686
|
...rawUsage,
|
|
67617
67687
|
...value.usage
|
|
@@ -67627,7 +67697,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67627
67697
|
anthropic: {
|
|
67628
67698
|
usage: rawUsage != null ? rawUsage : null,
|
|
67629
67699
|
cacheCreationInputTokens,
|
|
67630
|
-
stopSequence
|
|
67700
|
+
stopSequence,
|
|
67701
|
+
container
|
|
67631
67702
|
}
|
|
67632
67703
|
}
|
|
67633
67704
|
});
|
|
@@ -67649,6 +67720,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
67649
67720
|
};
|
|
67650
67721
|
}
|
|
67651
67722
|
};
|
|
67723
|
+
function getMaxOutputTokensForModel(modelId) {
|
|
67724
|
+
if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
|
|
67725
|
+
return { maxOutputTokens: 64000, knownModel: true };
|
|
67726
|
+
} else if (modelId.includes("claude-opus-4-")) {
|
|
67727
|
+
return { maxOutputTokens: 32000, knownModel: true };
|
|
67728
|
+
} else if (modelId.includes("claude-3-5-haiku")) {
|
|
67729
|
+
return { maxOutputTokens: 8192, knownModel: true };
|
|
67730
|
+
} else if (modelId.includes("claude-3-haiku")) {
|
|
67731
|
+
return { maxOutputTokens: 4096, knownModel: true };
|
|
67732
|
+
} else {
|
|
67733
|
+
return { maxOutputTokens: 4096, knownModel: false };
|
|
67734
|
+
}
|
|
67735
|
+
}
|
|
67652
67736
|
var bash_20241022InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
67653
67737
|
command: exports_external.string(),
|
|
67654
67738
|
restart: exports_external.boolean().optional()
|
|
@@ -67815,8 +67899,11 @@ var anthropicTools = {
|
|
|
67815
67899
|
webSearch_20250305
|
|
67816
67900
|
};
|
|
67817
67901
|
function createAnthropic(options = {}) {
|
|
67818
|
-
var
|
|
67819
|
-
const baseURL = (
|
|
67902
|
+
var _a16;
|
|
67903
|
+
const baseURL = (_a16 = withoutTrailingSlash(loadOptionalSetting({
|
|
67904
|
+
settingValue: options.baseURL,
|
|
67905
|
+
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
67906
|
+
}))) != null ? _a16 : "https://api.anthropic.com/v1";
|
|
67820
67907
|
const getHeaders = () => withUserAgentSuffix({
|
|
67821
67908
|
"anthropic-version": "2023-06-01",
|
|
67822
67909
|
"x-api-key": loadApiKey({
|
|
@@ -67859,10 +67946,10 @@ function createAnthropic(options = {}) {
|
|
|
67859
67946
|
}
|
|
67860
67947
|
var anthropic = createAnthropic();
|
|
67861
67948
|
|
|
67862
|
-
// ../../node_modules/.bun/@ai-sdk+openai-compatible@1.0.
|
|
67949
|
+
// ../../node_modules/.bun/@ai-sdk+openai-compatible@1.0.25+5954958163efbb2a/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
|
|
67863
67950
|
function getOpenAIMetadata(message) {
|
|
67864
|
-
var
|
|
67865
|
-
return (_b8 = (
|
|
67951
|
+
var _a16, _b8;
|
|
67952
|
+
return (_b8 = (_a16 = message == null ? undefined : message.providerOptions) == null ? undefined : _a16.openaiCompatible) != null ? _b8 : {};
|
|
67866
67953
|
}
|
|
67867
67954
|
function convertToOpenAICompatibleChatMessages(prompt) {
|
|
67868
67955
|
const messages = [];
|
|
@@ -68073,10 +68160,10 @@ function prepareTools2({
|
|
|
68073
68160
|
var OpenAICompatibleChatLanguageModel = class {
|
|
68074
68161
|
constructor(modelId, config4) {
|
|
68075
68162
|
this.specificationVersion = "v2";
|
|
68076
|
-
var
|
|
68163
|
+
var _a16, _b8;
|
|
68077
68164
|
this.modelId = modelId;
|
|
68078
68165
|
this.config = config4;
|
|
68079
|
-
const errorStructure = (
|
|
68166
|
+
const errorStructure = (_a16 = config4.errorStructure) != null ? _a16 : defaultOpenAICompatibleErrorStructure;
|
|
68080
68167
|
this.chunkSchema = createOpenAICompatibleChatChunkSchema(errorStructure.errorSchema);
|
|
68081
68168
|
this.failedResponseHandler = createJsonErrorResponseHandler(errorStructure);
|
|
68082
68169
|
this.supportsStructuredOutputs = (_b8 = config4.supportsStructuredOutputs) != null ? _b8 : false;
|
|
@@ -68088,8 +68175,8 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
68088
68175
|
return this.config.provider.split(".")[0].trim();
|
|
68089
68176
|
}
|
|
68090
68177
|
get supportedUrls() {
|
|
68091
|
-
var
|
|
68092
|
-
return (_c = (_b8 = (
|
|
68178
|
+
var _a16, _b8, _c;
|
|
68179
|
+
return (_c = (_b8 = (_a16 = this.config).supportedUrls) == null ? undefined : _b8.call(_a16)) != null ? _c : {};
|
|
68093
68180
|
}
|
|
68094
68181
|
async getArgs({
|
|
68095
68182
|
prompt,
|
|
@@ -68106,13 +68193,13 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
68106
68193
|
toolChoice,
|
|
68107
68194
|
tools: tools2
|
|
68108
68195
|
}) {
|
|
68109
|
-
var
|
|
68196
|
+
var _a16, _b8, _c, _d;
|
|
68110
68197
|
const warnings = [];
|
|
68111
|
-
const compatibleOptions = Object.assign((
|
|
68198
|
+
const compatibleOptions = Object.assign((_a16 = await parseProviderOptions({
|
|
68112
68199
|
provider: "openai-compatible",
|
|
68113
68200
|
providerOptions,
|
|
68114
68201
|
schema: openaiCompatibleProviderOptions
|
|
68115
|
-
})) != null ?
|
|
68202
|
+
})) != null ? _a16 : {}, (_b8 = await parseProviderOptions({
|
|
68116
68203
|
provider: this.providerOptionsName,
|
|
68117
68204
|
providerOptions,
|
|
68118
68205
|
schema: openaiCompatibleProviderOptions
|
|
@@ -68165,7 +68252,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
68165
68252
|
};
|
|
68166
68253
|
}
|
|
68167
68254
|
async doGenerate(options) {
|
|
68168
|
-
var
|
|
68255
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
68169
68256
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
68170
68257
|
const body = JSON.stringify(args);
|
|
68171
68258
|
const {
|
|
@@ -68190,7 +68277,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
68190
68277
|
if (text2 != null && text2.length > 0) {
|
|
68191
68278
|
content.push({ type: "text", text: text2 });
|
|
68192
68279
|
}
|
|
68193
|
-
const reasoning = (
|
|
68280
|
+
const reasoning = (_a16 = choice.message.reasoning_content) != null ? _a16 : choice.message.reasoning;
|
|
68194
68281
|
if (reasoning != null && reasoning.length > 0) {
|
|
68195
68282
|
content.push({
|
|
68196
68283
|
type: "reasoning",
|
|
@@ -68241,14 +68328,14 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
68241
68328
|
};
|
|
68242
68329
|
}
|
|
68243
68330
|
async doStream(options) {
|
|
68244
|
-
var
|
|
68331
|
+
var _a16;
|
|
68245
68332
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
68246
68333
|
const body = {
|
|
68247
68334
|
...args,
|
|
68248
68335
|
stream: true,
|
|
68249
68336
|
stream_options: this.config.includeUsage ? { include_usage: true } : undefined
|
|
68250
68337
|
};
|
|
68251
|
-
const metadataExtractor = (
|
|
68338
|
+
const metadataExtractor = (_a16 = this.config.metadataExtractor) == null ? undefined : _a16.createStreamExtractor();
|
|
68252
68339
|
const { responseHeaders, value: response } = await postJsonToApi({
|
|
68253
68340
|
url: this.config.url({
|
|
68254
68341
|
path: "/chat/completions",
|
|
@@ -68594,12 +68681,12 @@ var openaiCompatibleImageResponseSchema = exports_external.object({
|
|
|
68594
68681
|
data: exports_external.array(exports_external.object({ b64_json: exports_external.string() }))
|
|
68595
68682
|
});
|
|
68596
68683
|
|
|
68597
|
-
// ../../node_modules/.bun/@ai-sdk+deepseek@1.0.
|
|
68684
|
+
// ../../node_modules/.bun/@ai-sdk+deepseek@1.0.26+5954958163efbb2a/node_modules/@ai-sdk/deepseek/dist/index.mjs
|
|
68598
68685
|
var buildDeepseekMetadata = (usage) => {
|
|
68599
|
-
var
|
|
68686
|
+
var _a16, _b8;
|
|
68600
68687
|
return usage == null ? undefined : {
|
|
68601
68688
|
deepseek: {
|
|
68602
|
-
promptCacheHitTokens: (
|
|
68689
|
+
promptCacheHitTokens: (_a16 = usage.prompt_cache_hit_tokens) != null ? _a16 : NaN,
|
|
68603
68690
|
promptCacheMissTokens: (_b8 = usage.prompt_cache_miss_tokens) != null ? _b8 : NaN
|
|
68604
68691
|
}
|
|
68605
68692
|
};
|
|
@@ -68616,12 +68703,12 @@ var deepSeekMetadataExtractor = {
|
|
|
68616
68703
|
let usage;
|
|
68617
68704
|
return {
|
|
68618
68705
|
processChunk: async (chunk) => {
|
|
68619
|
-
var
|
|
68706
|
+
var _a16, _b8;
|
|
68620
68707
|
const parsed = await safeValidateTypes({
|
|
68621
68708
|
value: chunk,
|
|
68622
68709
|
schema: deepSeekStreamChunkSchema
|
|
68623
68710
|
});
|
|
68624
|
-
if (parsed.success && ((_b8 = (
|
|
68711
|
+
if (parsed.success && ((_b8 = (_a16 = parsed.value.choices) == null ? undefined : _a16[0]) == null ? undefined : _b8.finish_reason) === "stop" && parsed.value.usage) {
|
|
68625
68712
|
usage = parsed.value.usage;
|
|
68626
68713
|
}
|
|
68627
68714
|
},
|
|
@@ -68642,10 +68729,10 @@ var deepSeekStreamChunkSchema = exports_external.object({
|
|
|
68642
68729
|
})).nullish(),
|
|
68643
68730
|
usage: deepSeekUsageSchema.nullish()
|
|
68644
68731
|
});
|
|
68645
|
-
var VERSION5 = "1.0.
|
|
68732
|
+
var VERSION5 = "1.0.26";
|
|
68646
68733
|
function createDeepSeek(options = {}) {
|
|
68647
|
-
var
|
|
68648
|
-
const baseURL = withoutTrailingSlash((
|
|
68734
|
+
var _a16;
|
|
68735
|
+
const baseURL = withoutTrailingSlash((_a16 = options.baseURL) != null ? _a16 : "https://api.deepseek.com/v1");
|
|
68649
68736
|
const getHeaders = () => withUserAgentSuffix({
|
|
68650
68737
|
Authorization: `Bearer ${loadApiKey({
|
|
68651
68738
|
apiKey: options.apiKey,
|
|
@@ -68676,10 +68763,10 @@ function createDeepSeek(options = {}) {
|
|
|
68676
68763
|
}
|
|
68677
68764
|
var deepseek = createDeepSeek();
|
|
68678
68765
|
|
|
68679
|
-
// ../../node_modules/.bun/@ai-sdk+google-vertex@3.0.
|
|
68766
|
+
// ../../node_modules/.bun/@ai-sdk+google-vertex@3.0.56+5954958163efbb2a/node_modules/@ai-sdk/google-vertex/dist/index.mjs
|
|
68680
68767
|
var import_google_auth_library = __toESM(require_src7(), 1);
|
|
68681
68768
|
|
|
68682
|
-
// ../../node_modules/.bun/@ai-sdk+google@2.0.
|
|
68769
|
+
// ../../node_modules/.bun/@ai-sdk+google@2.0.26+5954958163efbb2a/node_modules/@ai-sdk/google/dist/internal/index.mjs
|
|
68683
68770
|
function convertJSONSchemaToOpenAPISchema(jsonSchema2) {
|
|
68684
68771
|
if (jsonSchema2 == null || isEmptyObjectSchema(jsonSchema2)) {
|
|
68685
68772
|
return;
|
|
@@ -68769,11 +68856,11 @@ function isEmptyObjectSchema(jsonSchema2) {
|
|
|
68769
68856
|
return jsonSchema2 != null && typeof jsonSchema2 === "object" && jsonSchema2.type === "object" && (jsonSchema2.properties == null || Object.keys(jsonSchema2.properties).length === 0) && !jsonSchema2.additionalProperties;
|
|
68770
68857
|
}
|
|
68771
68858
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
68772
|
-
var
|
|
68859
|
+
var _a16;
|
|
68773
68860
|
const systemInstructionParts = [];
|
|
68774
68861
|
const contents = [];
|
|
68775
68862
|
let systemMessagesAllowed = true;
|
|
68776
|
-
const isGemmaModel = (
|
|
68863
|
+
const isGemmaModel = (_a16 = options == null ? undefined : options.isGemmaModel) != null ? _a16 : false;
|
|
68777
68864
|
for (const { role, content } of prompt) {
|
|
68778
68865
|
switch (role) {
|
|
68779
68866
|
case "system": {
|
|
@@ -69009,7 +69096,7 @@ function prepareTools3({
|
|
|
69009
69096
|
toolChoice,
|
|
69010
69097
|
modelId
|
|
69011
69098
|
}) {
|
|
69012
|
-
var
|
|
69099
|
+
var _a16;
|
|
69013
69100
|
tools2 = (tools2 == null ? undefined : tools2.length) ? tools2 : undefined;
|
|
69014
69101
|
const toolWarnings = [];
|
|
69015
69102
|
const isGemini2 = modelId.includes("gemini-2");
|
|
@@ -69086,7 +69173,7 @@ function prepareTools3({
|
|
|
69086
69173
|
case "function":
|
|
69087
69174
|
functionDeclarations.push({
|
|
69088
69175
|
name: tool3.name,
|
|
69089
|
-
description: (
|
|
69176
|
+
description: (_a16 = tool3.description) != null ? _a16 : "",
|
|
69090
69177
|
parameters: convertJSONSchemaToOpenAPISchema(tool3.inputSchema)
|
|
69091
69178
|
});
|
|
69092
69179
|
break;
|
|
@@ -69169,17 +69256,17 @@ function mapGoogleGenerativeAIFinishReason({
|
|
|
69169
69256
|
var GoogleGenerativeAILanguageModel = class {
|
|
69170
69257
|
constructor(modelId, config4) {
|
|
69171
69258
|
this.specificationVersion = "v2";
|
|
69172
|
-
var
|
|
69259
|
+
var _a16;
|
|
69173
69260
|
this.modelId = modelId;
|
|
69174
69261
|
this.config = config4;
|
|
69175
|
-
this.generateId = (
|
|
69262
|
+
this.generateId = (_a16 = config4.generateId) != null ? _a16 : generateId;
|
|
69176
69263
|
}
|
|
69177
69264
|
get provider() {
|
|
69178
69265
|
return this.config.provider;
|
|
69179
69266
|
}
|
|
69180
69267
|
get supportedUrls() {
|
|
69181
|
-
var
|
|
69182
|
-
return (_c = (_b8 = (
|
|
69268
|
+
var _a16, _b8, _c;
|
|
69269
|
+
return (_c = (_b8 = (_a16 = this.config).supportedUrls) == null ? undefined : _b8.call(_a16)) != null ? _c : {};
|
|
69183
69270
|
}
|
|
69184
69271
|
async getArgs({
|
|
69185
69272
|
prompt,
|
|
@@ -69196,14 +69283,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
69196
69283
|
toolChoice,
|
|
69197
69284
|
providerOptions
|
|
69198
69285
|
}) {
|
|
69199
|
-
var
|
|
69286
|
+
var _a16, _b8;
|
|
69200
69287
|
const warnings = [];
|
|
69201
69288
|
const googleOptions = await parseProviderOptions({
|
|
69202
69289
|
provider: "google",
|
|
69203
69290
|
providerOptions,
|
|
69204
69291
|
schema: googleGenerativeAIProviderOptions
|
|
69205
69292
|
});
|
|
69206
|
-
if (((
|
|
69293
|
+
if (((_a16 = googleOptions == null ? undefined : googleOptions.thinkingConfig) == null ? undefined : _a16.includeThoughts) === true && !this.config.provider.startsWith("google.vertex.")) {
|
|
69207
69294
|
warnings.push({
|
|
69208
69295
|
type: "other",
|
|
69209
69296
|
message: `The 'includeThoughts' option is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`
|
|
@@ -69257,7 +69344,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
69257
69344
|
};
|
|
69258
69345
|
}
|
|
69259
69346
|
async doGenerate(options) {
|
|
69260
|
-
var
|
|
69347
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
69261
69348
|
const { args, warnings } = await this.getArgs(options);
|
|
69262
69349
|
const body = JSON.stringify(args);
|
|
69263
69350
|
const mergedHeaders = combineHeaders(await resolve(this.config.headers), options.headers);
|
|
@@ -69276,7 +69363,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
69276
69363
|
});
|
|
69277
69364
|
const candidate = response.candidates[0];
|
|
69278
69365
|
const content = [];
|
|
69279
|
-
const parts = (_b8 = (
|
|
69366
|
+
const parts = (_b8 = (_a16 = candidate.content) == null ? undefined : _a16.parts) != null ? _b8 : [];
|
|
69280
69367
|
const usageMetadata = response.usageMetadata;
|
|
69281
69368
|
let lastCodeExecutionToolCallId;
|
|
69282
69369
|
for (const part of parts) {
|
|
@@ -69394,7 +69481,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
69394
69481
|
controller.enqueue({ type: "stream-start", warnings });
|
|
69395
69482
|
},
|
|
69396
69483
|
transform(chunk, controller) {
|
|
69397
|
-
var
|
|
69484
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
69398
69485
|
if (options.includeRawChunks) {
|
|
69399
69486
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
69400
69487
|
}
|
|
@@ -69405,7 +69492,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
69405
69492
|
const value = chunk.value;
|
|
69406
69493
|
const usageMetadata = value.usageMetadata;
|
|
69407
69494
|
if (usageMetadata != null) {
|
|
69408
|
-
usage.inputTokens = (
|
|
69495
|
+
usage.inputTokens = (_a16 = usageMetadata.promptTokenCount) != null ? _a16 : undefined;
|
|
69409
69496
|
usage.outputTokens = (_b8 = usageMetadata.candidatesTokenCount) != null ? _b8 : undefined;
|
|
69410
69497
|
usage.totalTokens = (_c = usageMetadata.totalTokenCount) != null ? _c : undefined;
|
|
69411
69498
|
usage.reasoningTokens = (_d = usageMetadata.thoughtsTokenCount) != null ? _d : undefined;
|
|
@@ -69625,8 +69712,8 @@ function extractSources({
|
|
|
69625
69712
|
groundingMetadata,
|
|
69626
69713
|
generateId: generateId2
|
|
69627
69714
|
}) {
|
|
69628
|
-
var
|
|
69629
|
-
return (
|
|
69715
|
+
var _a16;
|
|
69716
|
+
return (_a16 = groundingMetadata == null ? undefined : groundingMetadata.groundingChunks) == null ? undefined : _a16.filter((chunk) => chunk.web != null).map((chunk) => ({
|
|
69630
69717
|
type: "source",
|
|
69631
69718
|
sourceType: "url",
|
|
69632
69719
|
id: generateId2(),
|
|
@@ -69771,7 +69858,7 @@ var googleTools = {
|
|
|
69771
69858
|
codeExecution
|
|
69772
69859
|
};
|
|
69773
69860
|
|
|
69774
|
-
// ../../node_modules/.bun/@ai-sdk+google-vertex@3.0.
|
|
69861
|
+
// ../../node_modules/.bun/@ai-sdk+google-vertex@3.0.56+5954958163efbb2a/node_modules/@ai-sdk/google-vertex/dist/index.mjs
|
|
69775
69862
|
var authInstance = null;
|
|
69776
69863
|
var authOptions = null;
|
|
69777
69864
|
function getAuth(options) {
|
|
@@ -69790,7 +69877,7 @@ async function generateAuthToken(options) {
|
|
|
69790
69877
|
const token = await client.getAccessToken();
|
|
69791
69878
|
return (token == null ? undefined : token.token) || null;
|
|
69792
69879
|
}
|
|
69793
|
-
var VERSION6 = "3.0.
|
|
69880
|
+
var VERSION6 = "3.0.56";
|
|
69794
69881
|
var googleVertexErrorDataSchema = exports_external.object({
|
|
69795
69882
|
error: exports_external.object({
|
|
69796
69883
|
code: exports_external.number().nullable(),
|
|
@@ -69834,12 +69921,12 @@ var GoogleVertexEmbeddingModel = class {
|
|
|
69834
69921
|
abortSignal,
|
|
69835
69922
|
providerOptions
|
|
69836
69923
|
}) {
|
|
69837
|
-
var
|
|
69838
|
-
const googleOptions = (
|
|
69924
|
+
var _a16;
|
|
69925
|
+
const googleOptions = (_a16 = await parseProviderOptions({
|
|
69839
69926
|
provider: "google",
|
|
69840
69927
|
providerOptions,
|
|
69841
69928
|
schema: googleVertexEmbeddingProviderOptions
|
|
69842
|
-
})) != null ?
|
|
69929
|
+
})) != null ? _a16 : {};
|
|
69843
69930
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
69844
69931
|
throw new TooManyEmbeddingValuesForCallError({
|
|
69845
69932
|
provider: this.provider,
|
|
@@ -69912,7 +69999,7 @@ var GoogleVertexImageModel = class {
|
|
|
69912
69999
|
headers,
|
|
69913
70000
|
abortSignal
|
|
69914
70001
|
}) {
|
|
69915
|
-
var
|
|
70002
|
+
var _a16, _b8, _c, _d, _e, _f, _g;
|
|
69916
70003
|
const warnings = [];
|
|
69917
70004
|
if (size != null) {
|
|
69918
70005
|
warnings.push({
|
|
@@ -69935,7 +70022,7 @@ var GoogleVertexImageModel = class {
|
|
|
69935
70022
|
...vertexImageOptions != null ? vertexImageOptions : {}
|
|
69936
70023
|
}
|
|
69937
70024
|
};
|
|
69938
|
-
const currentDate = (_c = (_b8 = (
|
|
70025
|
+
const currentDate = (_c = (_b8 = (_a16 = this.config._internal) == null ? undefined : _a16.currentDate) == null ? undefined : _b8.call(_a16)) != null ? _c : /* @__PURE__ */ new Date;
|
|
69939
70026
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
69940
70027
|
url: `${this.config.baseURL}/models/${this.modelId}:predict`,
|
|
69941
70028
|
headers: combineHeaders(await resolve(this.config.headers), headers),
|
|
@@ -70004,16 +70091,16 @@ function createVertex(options = {}) {
|
|
|
70004
70091
|
description: "Google Vertex location"
|
|
70005
70092
|
});
|
|
70006
70093
|
const loadBaseURL = () => {
|
|
70007
|
-
var
|
|
70094
|
+
var _a16;
|
|
70008
70095
|
const region = loadVertexLocation();
|
|
70009
70096
|
const project = loadVertexProject();
|
|
70010
70097
|
const baseHost = `${region === "global" ? "" : region + "-"}aiplatform.googleapis.com`;
|
|
70011
|
-
return (
|
|
70098
|
+
return (_a16 = withoutTrailingSlash(options.baseURL)) != null ? _a16 : `https://${baseHost}/v1beta1/projects/${project}/locations/${region}/publishers/google`;
|
|
70012
70099
|
};
|
|
70013
70100
|
const createConfig = (name17) => {
|
|
70014
70101
|
const getHeaders = async () => {
|
|
70015
|
-
var
|
|
70016
|
-
const originalHeaders = await resolve((
|
|
70102
|
+
var _a16;
|
|
70103
|
+
const originalHeaders = await resolve((_a16 = options.headers) != null ? _a16 : {});
|
|
70017
70104
|
return withUserAgentSuffix(originalHeaders, `ai-sdk/google-vertex/${VERSION6}`);
|
|
70018
70105
|
};
|
|
70019
70106
|
return {
|
|
@@ -70024,10 +70111,10 @@ function createVertex(options = {}) {
|
|
|
70024
70111
|
};
|
|
70025
70112
|
};
|
|
70026
70113
|
const createChatModel = (modelId) => {
|
|
70027
|
-
var
|
|
70114
|
+
var _a16;
|
|
70028
70115
|
return new GoogleGenerativeAILanguageModel(modelId, {
|
|
70029
70116
|
...createConfig("chat"),
|
|
70030
|
-
generateId: (
|
|
70117
|
+
generateId: (_a16 = options.generateId) != null ? _a16 : generateId,
|
|
70031
70118
|
supportedUrls: () => ({
|
|
70032
70119
|
"*": [
|
|
70033
70120
|
/^https?:\/\/.*$/,
|
|
@@ -70062,7 +70149,7 @@ function createVertex2(options = {}) {
|
|
|
70062
70149
|
}
|
|
70063
70150
|
var vertex = createVertex2();
|
|
70064
70151
|
|
|
70065
|
-
// ../../node_modules/.bun/@ai-sdk+openai@2.0.
|
|
70152
|
+
// ../../node_modules/.bun/@ai-sdk+openai@2.0.59+5954958163efbb2a/node_modules/@ai-sdk/openai/dist/index.mjs
|
|
70066
70153
|
var openaiErrorDataSchema = exports_external.object({
|
|
70067
70154
|
error: exports_external.object({
|
|
70068
70155
|
message: exports_external.string(),
|
|
@@ -70115,7 +70202,7 @@ function convertToOpenAIChatMessages({
|
|
|
70115
70202
|
messages.push({
|
|
70116
70203
|
role: "user",
|
|
70117
70204
|
content: content.map((part, index) => {
|
|
70118
|
-
var
|
|
70205
|
+
var _a16, _b8, _c;
|
|
70119
70206
|
switch (part.type) {
|
|
70120
70207
|
case "text": {
|
|
70121
70208
|
return { type: "text", text: part.text };
|
|
@@ -70127,7 +70214,7 @@ function convertToOpenAIChatMessages({
|
|
|
70127
70214
|
type: "image_url",
|
|
70128
70215
|
image_url: {
|
|
70129
70216
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
|
|
70130
|
-
detail: (_b8 = (
|
|
70217
|
+
detail: (_b8 = (_a16 = part.providerOptions) == null ? undefined : _a16.openai) == null ? undefined : _b8.imageDetail
|
|
70131
70218
|
}
|
|
70132
70219
|
};
|
|
70133
70220
|
} else if (part.mediaType.startsWith("audio/")) {
|
|
@@ -70480,13 +70567,13 @@ var OpenAIChatLanguageModel = class {
|
|
|
70480
70567
|
toolChoice,
|
|
70481
70568
|
providerOptions
|
|
70482
70569
|
}) {
|
|
70483
|
-
var
|
|
70570
|
+
var _a16, _b8, _c, _d;
|
|
70484
70571
|
const warnings = [];
|
|
70485
|
-
const openaiOptions = (
|
|
70572
|
+
const openaiOptions = (_a16 = await parseProviderOptions({
|
|
70486
70573
|
provider: "openai",
|
|
70487
70574
|
providerOptions,
|
|
70488
70575
|
schema: openaiChatLanguageModelOptions
|
|
70489
|
-
})) != null ?
|
|
70576
|
+
})) != null ? _a16 : {};
|
|
70490
70577
|
const structuredOutputs = (_b8 = openaiOptions.structuredOutputs) != null ? _b8 : true;
|
|
70491
70578
|
if (topK != null) {
|
|
70492
70579
|
warnings.push({
|
|
@@ -70647,7 +70734,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
70647
70734
|
};
|
|
70648
70735
|
}
|
|
70649
70736
|
async doGenerate(options) {
|
|
70650
|
-
var
|
|
70737
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
70651
70738
|
const { args: body, warnings } = await this.getArgs(options);
|
|
70652
70739
|
const {
|
|
70653
70740
|
responseHeaders,
|
|
@@ -70671,7 +70758,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
70671
70758
|
if (text2 != null && text2.length > 0) {
|
|
70672
70759
|
content.push({ type: "text", text: text2 });
|
|
70673
70760
|
}
|
|
70674
|
-
for (const toolCall of (
|
|
70761
|
+
for (const toolCall of (_a16 = choice.message.tool_calls) != null ? _a16 : []) {
|
|
70675
70762
|
content.push({
|
|
70676
70763
|
type: "tool-call",
|
|
70677
70764
|
toolCallId: (_b8 = toolCall.id) != null ? _b8 : generateId(),
|
|
@@ -70757,7 +70844,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
70757
70844
|
controller.enqueue({ type: "stream-start", warnings });
|
|
70758
70845
|
},
|
|
70759
70846
|
transform(chunk, controller) {
|
|
70760
|
-
var
|
|
70847
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
70761
70848
|
if (options.includeRawChunks) {
|
|
70762
70849
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
70763
70850
|
}
|
|
@@ -70780,7 +70867,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
70780
70867
|
});
|
|
70781
70868
|
}
|
|
70782
70869
|
if (value.usage != null) {
|
|
70783
|
-
usage.inputTokens = (
|
|
70870
|
+
usage.inputTokens = (_a16 = value.usage.prompt_tokens) != null ? _a16 : undefined;
|
|
70784
70871
|
usage.outputTokens = (_b8 = value.usage.completion_tokens) != null ? _b8 : undefined;
|
|
70785
70872
|
usage.totalTokens = (_c = value.usage.total_tokens) != null ? _c : undefined;
|
|
70786
70873
|
usage.reasoningTokens = (_e = (_d = value.usage.completion_tokens_details) == null ? undefined : _d.reasoning_tokens) != null ? _e : undefined;
|
|
@@ -70941,11 +71028,11 @@ function supportsPriorityProcessing(modelId) {
|
|
|
70941
71028
|
return modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
70942
71029
|
}
|
|
70943
71030
|
function getSystemMessageMode(modelId) {
|
|
70944
|
-
var
|
|
71031
|
+
var _a16, _b8;
|
|
70945
71032
|
if (!isReasoningModel(modelId)) {
|
|
70946
71033
|
return "system";
|
|
70947
71034
|
}
|
|
70948
|
-
return (_b8 = (
|
|
71035
|
+
return (_b8 = (_a16 = reasoningModels[modelId]) == null ? undefined : _a16.systemMessageMode) != null ? _b8 : "developer";
|
|
70949
71036
|
}
|
|
70950
71037
|
var reasoningModels = {
|
|
70951
71038
|
"o1-mini": {
|
|
@@ -71206,7 +71293,7 @@ var OpenAICompletionLanguageModel = class {
|
|
|
71206
71293
|
};
|
|
71207
71294
|
}
|
|
71208
71295
|
async doGenerate(options) {
|
|
71209
|
-
var
|
|
71296
|
+
var _a16, _b8, _c;
|
|
71210
71297
|
const { args, warnings } = await this.getArgs(options);
|
|
71211
71298
|
const {
|
|
71212
71299
|
responseHeaders,
|
|
@@ -71232,7 +71319,7 @@ var OpenAICompletionLanguageModel = class {
|
|
|
71232
71319
|
return {
|
|
71233
71320
|
content: [{ type: "text", text: choice.text }],
|
|
71234
71321
|
usage: {
|
|
71235
|
-
inputTokens: (
|
|
71322
|
+
inputTokens: (_a16 = response.usage) == null ? undefined : _a16.prompt_tokens,
|
|
71236
71323
|
outputTokens: (_b8 = response.usage) == null ? undefined : _b8.completion_tokens,
|
|
71237
71324
|
totalTokens: (_c = response.usage) == null ? undefined : _c.total_tokens
|
|
71238
71325
|
},
|
|
@@ -71366,7 +71453,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
71366
71453
|
abortSignal,
|
|
71367
71454
|
providerOptions
|
|
71368
71455
|
}) {
|
|
71369
|
-
var
|
|
71456
|
+
var _a16;
|
|
71370
71457
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
71371
71458
|
throw new TooManyEmbeddingValuesForCallError({
|
|
71372
71459
|
provider: this.provider,
|
|
@@ -71375,11 +71462,11 @@ var OpenAIEmbeddingModel = class {
|
|
|
71375
71462
|
values
|
|
71376
71463
|
});
|
|
71377
71464
|
}
|
|
71378
|
-
const openaiOptions = (
|
|
71465
|
+
const openaiOptions = (_a16 = await parseProviderOptions({
|
|
71379
71466
|
provider: "openai",
|
|
71380
71467
|
providerOptions,
|
|
71381
71468
|
schema: openaiEmbeddingProviderOptions
|
|
71382
|
-
})) != null ?
|
|
71469
|
+
})) != null ? _a16 : {};
|
|
71383
71470
|
const {
|
|
71384
71471
|
responseHeaders,
|
|
71385
71472
|
value: response,
|
|
@@ -71412,7 +71499,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
71412
71499
|
var openaiImageResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
71413
71500
|
data: exports_external.array(exports_external.object({
|
|
71414
71501
|
b64_json: exports_external.string(),
|
|
71415
|
-
revised_prompt: exports_external.string().
|
|
71502
|
+
revised_prompt: exports_external.string().nullish()
|
|
71416
71503
|
}))
|
|
71417
71504
|
})));
|
|
71418
71505
|
var modelMaxImagesPerCall = {
|
|
@@ -71432,8 +71519,8 @@ var OpenAIImageModel = class {
|
|
|
71432
71519
|
this.specificationVersion = "v2";
|
|
71433
71520
|
}
|
|
71434
71521
|
get maxImagesPerCall() {
|
|
71435
|
-
var
|
|
71436
|
-
return (
|
|
71522
|
+
var _a16;
|
|
71523
|
+
return (_a16 = modelMaxImagesPerCall[this.modelId]) != null ? _a16 : 1;
|
|
71437
71524
|
}
|
|
71438
71525
|
get provider() {
|
|
71439
71526
|
return this.config.provider;
|
|
@@ -71448,7 +71535,7 @@ var OpenAIImageModel = class {
|
|
|
71448
71535
|
headers,
|
|
71449
71536
|
abortSignal
|
|
71450
71537
|
}) {
|
|
71451
|
-
var
|
|
71538
|
+
var _a16, _b8, _c, _d;
|
|
71452
71539
|
const warnings = [];
|
|
71453
71540
|
if (aspectRatio != null) {
|
|
71454
71541
|
warnings.push({
|
|
@@ -71460,7 +71547,7 @@ var OpenAIImageModel = class {
|
|
|
71460
71547
|
if (seed != null) {
|
|
71461
71548
|
warnings.push({ type: "unsupported-setting", setting: "seed" });
|
|
71462
71549
|
}
|
|
71463
|
-
const currentDate = (_c = (_b8 = (
|
|
71550
|
+
const currentDate = (_c = (_b8 = (_a16 = this.config._internal) == null ? undefined : _a16.currentDate) == null ? undefined : _b8.call(_a16)) != null ? _c : /* @__PURE__ */ new Date;
|
|
71464
71551
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
71465
71552
|
url: this.config.url({
|
|
71466
71553
|
path: "/images/generations",
|
|
@@ -71629,7 +71716,8 @@ var webSearchOutputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
|
71629
71716
|
url: exports_external.string(),
|
|
71630
71717
|
pattern: exports_external.string()
|
|
71631
71718
|
})
|
|
71632
|
-
])
|
|
71719
|
+
]),
|
|
71720
|
+
sources: exports_external.array(exports_external.object({ type: exports_external.literal("url"), url: exports_external.string() })).optional()
|
|
71633
71721
|
})));
|
|
71634
71722
|
var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
|
|
71635
71723
|
id: "openai.web_search",
|
|
@@ -71692,7 +71780,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
71692
71780
|
store,
|
|
71693
71781
|
hasLocalShellTool = false
|
|
71694
71782
|
}) {
|
|
71695
|
-
var
|
|
71783
|
+
var _a16, _b8, _c, _d;
|
|
71696
71784
|
const input = [];
|
|
71697
71785
|
const warnings = [];
|
|
71698
71786
|
for (const { role, content } of prompt) {
|
|
@@ -71771,7 +71859,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
71771
71859
|
for (const part of content) {
|
|
71772
71860
|
switch (part.type) {
|
|
71773
71861
|
case "text": {
|
|
71774
|
-
const id = (_b8 = (
|
|
71862
|
+
const id = (_b8 = (_a16 = part.providerOptions) == null ? undefined : _a16.openai) == null ? undefined : _b8.itemId;
|
|
71775
71863
|
if (store && id != null) {
|
|
71776
71864
|
input.push({ type: "item_reference", id });
|
|
71777
71865
|
break;
|
|
@@ -72102,7 +72190,8 @@ var openaiResponsesChunkSchema = lazyValidator(() => zodSchema(exports_external.
|
|
|
72102
72190
|
action: exports_external.discriminatedUnion("type", [
|
|
72103
72191
|
exports_external.object({
|
|
72104
72192
|
type: exports_external.literal("search"),
|
|
72105
|
-
query: exports_external.string().nullish()
|
|
72193
|
+
query: exports_external.string().nullish(),
|
|
72194
|
+
sources: exports_external.array(exports_external.object({ type: exports_external.literal("url"), url: exports_external.string() })).nullish()
|
|
72106
72195
|
}),
|
|
72107
72196
|
exports_external.object({
|
|
72108
72197
|
type: exports_external.literal("open_page"),
|
|
@@ -72272,7 +72361,8 @@ var openaiResponsesResponseSchema = lazyValidator(() => zodSchema(exports_extern
|
|
|
72272
72361
|
action: exports_external.discriminatedUnion("type", [
|
|
72273
72362
|
exports_external.object({
|
|
72274
72363
|
type: exports_external.literal("search"),
|
|
72275
|
-
query: exports_external.string().nullish()
|
|
72364
|
+
query: exports_external.string().nullish(),
|
|
72365
|
+
sources: exports_external.array(exports_external.object({ type: exports_external.literal("url"), url: exports_external.string() })).nullish()
|
|
72276
72366
|
}),
|
|
72277
72367
|
exports_external.object({
|
|
72278
72368
|
type: exports_external.literal("open_page"),
|
|
@@ -72434,6 +72524,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator(() => zodSchema(exports
|
|
|
72434
72524
|
store: exports_external.boolean().nullish(),
|
|
72435
72525
|
strictJsonSchema: exports_external.boolean().nullish(),
|
|
72436
72526
|
textVerbosity: exports_external.enum(["low", "medium", "high"]).nullish(),
|
|
72527
|
+
truncation: exports_external.enum(["auto", "disabled"]).nullish(),
|
|
72437
72528
|
user: exports_external.string().nullish()
|
|
72438
72529
|
})));
|
|
72439
72530
|
async function prepareResponsesTools({
|
|
@@ -72600,7 +72691,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72600
72691
|
toolChoice,
|
|
72601
72692
|
responseFormat
|
|
72602
72693
|
}) {
|
|
72603
|
-
var
|
|
72694
|
+
var _a16, _b8, _c, _d;
|
|
72604
72695
|
const warnings = [];
|
|
72605
72696
|
const modelConfig = getResponsesModelConfig(this.modelId);
|
|
72606
72697
|
if (topK != null) {
|
|
@@ -72633,7 +72724,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72633
72724
|
prompt,
|
|
72634
72725
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
72635
72726
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
72636
|
-
store: (
|
|
72727
|
+
store: (_a16 = openaiOptions == null ? undefined : openaiOptions.store) != null ? _a16 : true,
|
|
72637
72728
|
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
72638
72729
|
});
|
|
72639
72730
|
warnings.push(...inputWarnings);
|
|
@@ -72698,6 +72789,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72698
72789
|
prompt_cache_key: openaiOptions == null ? undefined : openaiOptions.promptCacheKey,
|
|
72699
72790
|
safety_identifier: openaiOptions == null ? undefined : openaiOptions.safetyIdentifier,
|
|
72700
72791
|
top_logprobs: topLogprobs,
|
|
72792
|
+
truncation: openaiOptions == null ? undefined : openaiOptions.truncation,
|
|
72701
72793
|
...modelConfig.isReasoningModel && ((openaiOptions == null ? undefined : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? undefined : openaiOptions.reasoningSummary) != null) && {
|
|
72702
72794
|
reasoning: {
|
|
72703
72795
|
...(openaiOptions == null ? undefined : openaiOptions.reasoningEffort) != null && {
|
|
@@ -72707,9 +72799,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72707
72799
|
summary: openaiOptions.reasoningSummary
|
|
72708
72800
|
}
|
|
72709
72801
|
}
|
|
72710
|
-
},
|
|
72711
|
-
...modelConfig.requiredAutoTruncation && {
|
|
72712
|
-
truncation: "auto"
|
|
72713
72802
|
}
|
|
72714
72803
|
};
|
|
72715
72804
|
if (modelConfig.isReasoningModel) {
|
|
@@ -72782,7 +72871,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72782
72871
|
};
|
|
72783
72872
|
}
|
|
72784
72873
|
async doGenerate(options) {
|
|
72785
|
-
var
|
|
72874
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
72786
72875
|
const {
|
|
72787
72876
|
args: body,
|
|
72788
72877
|
warnings,
|
|
@@ -72832,7 +72921,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72832
72921
|
providerMetadata: {
|
|
72833
72922
|
openai: {
|
|
72834
72923
|
itemId: part.id,
|
|
72835
|
-
reasoningEncryptedContent: (
|
|
72924
|
+
reasoningEncryptedContent: (_a16 = part.encrypted_content) != null ? _a16 : null
|
|
72836
72925
|
}
|
|
72837
72926
|
}
|
|
72838
72927
|
});
|
|
@@ -72904,7 +72993,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
72904
72993
|
id: (_i = (_h = (_g = this.config).generateId) == null ? undefined : _h.call(_g)) != null ? _i : generateId(),
|
|
72905
72994
|
mediaType: "text/plain",
|
|
72906
72995
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
72907
|
-
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
72996
|
+
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
72997
|
+
...annotation.file_id ? {
|
|
72998
|
+
providerMetadata: {
|
|
72999
|
+
openai: {
|
|
73000
|
+
fileId: annotation.file_id
|
|
73001
|
+
}
|
|
73002
|
+
}
|
|
73003
|
+
} : {}
|
|
72908
73004
|
});
|
|
72909
73005
|
}
|
|
72910
73006
|
}
|
|
@@ -73088,7 +73184,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
73088
73184
|
controller.enqueue({ type: "stream-start", warnings });
|
|
73089
73185
|
},
|
|
73090
73186
|
transform(chunk, controller) {
|
|
73091
|
-
var
|
|
73187
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
73092
73188
|
if (options.includeRawChunks) {
|
|
73093
73189
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
73094
73190
|
}
|
|
@@ -73198,7 +73294,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
73198
73294
|
providerMetadata: {
|
|
73199
73295
|
openai: {
|
|
73200
73296
|
itemId: value.item.id,
|
|
73201
|
-
reasoningEncryptedContent: (
|
|
73297
|
+
reasoningEncryptedContent: (_a16 = value.item.encrypted_content) != null ? _a16 : null
|
|
73202
73298
|
}
|
|
73203
73299
|
}
|
|
73204
73300
|
});
|
|
@@ -73471,7 +73567,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
73471
73567
|
id: (_s = (_r = (_q = self2.config).generateId) == null ? undefined : _r.call(_q)) != null ? _s : generateId(),
|
|
73472
73568
|
mediaType: "text/plain",
|
|
73473
73569
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
73474
|
-
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id
|
|
73570
|
+
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
73571
|
+
...value.annotation.file_id ? {
|
|
73572
|
+
providerMetadata: {
|
|
73573
|
+
openai: {
|
|
73574
|
+
fileId: value.annotation.file_id
|
|
73575
|
+
}
|
|
73576
|
+
}
|
|
73577
|
+
} : {}
|
|
73475
73578
|
});
|
|
73476
73579
|
}
|
|
73477
73580
|
} else if (isErrorChunk(value)) {
|
|
@@ -73537,7 +73640,6 @@ function getResponsesModelConfig(modelId) {
|
|
|
73537
73640
|
const supportsFlexProcessing2 = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
73538
73641
|
const supportsPriorityProcessing2 = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
73539
73642
|
const defaults = {
|
|
73540
|
-
requiredAutoTruncation: false,
|
|
73541
73643
|
systemMessageMode: "system",
|
|
73542
73644
|
supportsFlexProcessing: supportsFlexProcessing2,
|
|
73543
73645
|
supportsPriorityProcessing: supportsPriorityProcessing2
|
|
@@ -73568,10 +73670,13 @@ function getResponsesModelConfig(modelId) {
|
|
|
73568
73670
|
};
|
|
73569
73671
|
}
|
|
73570
73672
|
function mapWebSearchOutput(action) {
|
|
73571
|
-
var
|
|
73673
|
+
var _a16;
|
|
73572
73674
|
switch (action.type) {
|
|
73573
73675
|
case "search":
|
|
73574
|
-
return {
|
|
73676
|
+
return {
|
|
73677
|
+
action: { type: "search", query: (_a16 = action.query) != null ? _a16 : undefined },
|
|
73678
|
+
...action.sources != null && { sources: action.sources }
|
|
73679
|
+
};
|
|
73575
73680
|
case "open_page":
|
|
73576
73681
|
return { action: { type: "openPage", url: action.url } };
|
|
73577
73682
|
case "find":
|
|
@@ -73649,8 +73754,8 @@ var OpenAISpeechModel = class {
|
|
|
73649
73754
|
};
|
|
73650
73755
|
}
|
|
73651
73756
|
async doGenerate(options) {
|
|
73652
|
-
var
|
|
73653
|
-
const currentDate = (_c = (_b8 = (
|
|
73757
|
+
var _a16, _b8, _c;
|
|
73758
|
+
const currentDate = (_c = (_b8 = (_a16 = this.config._internal) == null ? undefined : _a16.currentDate) == null ? undefined : _b8.call(_a16)) != null ? _c : /* @__PURE__ */ new Date;
|
|
73654
73759
|
const { requestBody, warnings } = await this.getArgs(options);
|
|
73655
73760
|
const {
|
|
73656
73761
|
value: audio,
|
|
@@ -73826,8 +73931,8 @@ var OpenAITranscriptionModel = class {
|
|
|
73826
73931
|
};
|
|
73827
73932
|
}
|
|
73828
73933
|
async doGenerate(options) {
|
|
73829
|
-
var
|
|
73830
|
-
const currentDate = (_c = (_b8 = (
|
|
73934
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h;
|
|
73935
|
+
const currentDate = (_c = (_b8 = (_a16 = this.config._internal) == null ? undefined : _a16.currentDate) == null ? undefined : _b8.call(_a16)) != null ? _c : /* @__PURE__ */ new Date;
|
|
73831
73936
|
const { formData, warnings } = await this.getArgs(options);
|
|
73832
73937
|
const {
|
|
73833
73938
|
value: response,
|
|
@@ -73869,13 +73974,13 @@ var OpenAITranscriptionModel = class {
|
|
|
73869
73974
|
};
|
|
73870
73975
|
}
|
|
73871
73976
|
};
|
|
73872
|
-
var VERSION7 = "2.0.
|
|
73977
|
+
var VERSION7 = "2.0.59";
|
|
73873
73978
|
function createOpenAI(options = {}) {
|
|
73874
|
-
var
|
|
73875
|
-
const baseURL = (
|
|
73979
|
+
var _a16, _b8;
|
|
73980
|
+
const baseURL = (_a16 = withoutTrailingSlash(loadOptionalSetting({
|
|
73876
73981
|
settingValue: options.baseURL,
|
|
73877
73982
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
73878
|
-
}))) != null ?
|
|
73983
|
+
}))) != null ? _a16 : "https://api.openai.com/v1";
|
|
73879
73984
|
const providerName = (_b8 = options.name) != null ? _b8 : "openai";
|
|
73880
73985
|
const getHeaders = () => withUserAgentSuffix({
|
|
73881
73986
|
Authorization: `Bearer ${loadApiKey({
|
|
@@ -73959,7 +74064,7 @@ function createOpenAI(options = {}) {
|
|
|
73959
74064
|
}
|
|
73960
74065
|
var openai = createOpenAI();
|
|
73961
74066
|
|
|
73962
|
-
// ../../node_modules/.bun/@openrouter+ai-sdk-provider@1.2.0+
|
|
74067
|
+
// ../../node_modules/.bun/@openrouter+ai-sdk-provider@1.2.0+075fdccf05cb66f3/node_modules/@openrouter/ai-sdk-provider/dist/index.mjs
|
|
73963
74068
|
var __defProp3 = Object.defineProperty;
|
|
73964
74069
|
var __defProps = Object.defineProperties;
|
|
73965
74070
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -74386,7 +74491,7 @@ function handleFetchError2({
|
|
|
74386
74491
|
}
|
|
74387
74492
|
return error46;
|
|
74388
74493
|
}
|
|
74389
|
-
function
|
|
74494
|
+
function removeUndefinedEntries(record2) {
|
|
74390
74495
|
return Object.fromEntries(Object.entries(record2).filter(([_key, value]) => value != null));
|
|
74391
74496
|
}
|
|
74392
74497
|
function loadApiKey2({
|
|
@@ -74613,7 +74718,7 @@ var postToApi2 = async ({
|
|
|
74613
74718
|
try {
|
|
74614
74719
|
const response = await fetch2(url2, {
|
|
74615
74720
|
method: "POST",
|
|
74616
|
-
headers:
|
|
74721
|
+
headers: removeUndefinedEntries(headers),
|
|
74617
74722
|
body: body.content,
|
|
74618
74723
|
signal: abortSignal
|
|
74619
74724
|
});
|
|
@@ -74894,8 +74999,8 @@ function convertToOpenRouterChatMessages(prompt) {
|
|
|
74894
74999
|
}
|
|
74895
75000
|
const messageCacheControl = getCacheControl2(providerOptions);
|
|
74896
75001
|
const contentParts = content.map((part) => {
|
|
74897
|
-
var
|
|
74898
|
-
const cacheControl = (
|
|
75002
|
+
var _a16, _b22, _c2, _d, _e, _f;
|
|
75003
|
+
const cacheControl = (_a16 = getCacheControl2(part.providerOptions)) != null ? _a16 : messageCacheControl;
|
|
74899
75004
|
switch (part.type) {
|
|
74900
75005
|
case "text":
|
|
74901
75006
|
return {
|
|
@@ -75450,7 +75555,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
75450
75555
|
return {
|
|
75451
75556
|
stream: response.pipeThrough(new TransformStream({
|
|
75452
75557
|
transform(chunk, controller) {
|
|
75453
|
-
var
|
|
75558
|
+
var _a16, _b8, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
75454
75559
|
if (!chunk.success) {
|
|
75455
75560
|
finishReason = "error";
|
|
75456
75561
|
controller.enqueue({ type: "error", error: chunk.error });
|
|
@@ -75484,7 +75589,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
75484
75589
|
usage.totalTokens = value.usage.prompt_tokens + value.usage.completion_tokens;
|
|
75485
75590
|
openrouterUsage.promptTokens = value.usage.prompt_tokens;
|
|
75486
75591
|
if (value.usage.prompt_tokens_details) {
|
|
75487
|
-
const cachedInputTokens = (
|
|
75592
|
+
const cachedInputTokens = (_a16 = value.usage.prompt_tokens_details.cached_tokens) != null ? _a16 : 0;
|
|
75488
75593
|
usage.cachedInputTokens = cachedInputTokens;
|
|
75489
75594
|
openrouterUsage.promptTokensDetails = {
|
|
75490
75595
|
cachedTokens: cachedInputTokens
|
|
@@ -75697,13 +75802,13 @@ var OpenRouterChatLanguageModel = class {
|
|
|
75697
75802
|
}
|
|
75698
75803
|
},
|
|
75699
75804
|
flush(controller) {
|
|
75700
|
-
var
|
|
75805
|
+
var _a16;
|
|
75701
75806
|
if (finishReason === "tool-calls") {
|
|
75702
75807
|
for (const toolCall of toolCalls) {
|
|
75703
75808
|
if (toolCall && !toolCall.sent) {
|
|
75704
75809
|
controller.enqueue({
|
|
75705
75810
|
type: "tool-call",
|
|
75706
|
-
toolCallId: (
|
|
75811
|
+
toolCallId: (_a16 = toolCall.id) != null ? _a16 : generateId2(),
|
|
75707
75812
|
toolName: toolCall.function.name,
|
|
75708
75813
|
input: isParsableJson2(toolCall.function.arguments) ? toolCall.function.arguments : "{}"
|
|
75709
75814
|
});
|
|
@@ -76129,7 +76234,7 @@ var openrouter = createOpenRouter({
|
|
|
76129
76234
|
compatibility: "strict"
|
|
76130
76235
|
});
|
|
76131
76236
|
|
|
76132
|
-
// ../../node_modules/.bun/ollama-ai-provider-v2@1.5.
|
|
76237
|
+
// ../../node_modules/.bun/ollama-ai-provider-v2@1.5.2+5954958163efbb2a/node_modules/ollama-ai-provider-v2/dist/index.mjs
|
|
76133
76238
|
var ollamaErrorDataSchema = exports_external.object({
|
|
76134
76239
|
error: exports_external.object({
|
|
76135
76240
|
message: exports_external.string(),
|
|
@@ -76271,13 +76376,13 @@ var OllamaCompletionLanguageModel = class {
|
|
|
76271
76376
|
seed,
|
|
76272
76377
|
providerOptions
|
|
76273
76378
|
}) {
|
|
76274
|
-
var
|
|
76379
|
+
var _a16;
|
|
76275
76380
|
const warnings = [];
|
|
76276
|
-
const ollamaOptions = (
|
|
76381
|
+
const ollamaOptions = (_a16 = await parseProviderOptions({
|
|
76277
76382
|
provider: "ollama",
|
|
76278
76383
|
providerOptions,
|
|
76279
76384
|
schema: ollamaCompletionProviderOptions
|
|
76280
|
-
})) != null ?
|
|
76385
|
+
})) != null ? _a16 : {};
|
|
76281
76386
|
if (topK != null) {
|
|
76282
76387
|
warnings.push({
|
|
76283
76388
|
type: "unsupported-setting",
|
|
@@ -76319,7 +76424,7 @@ var OllamaCompletionLanguageModel = class {
|
|
|
76319
76424
|
};
|
|
76320
76425
|
}
|
|
76321
76426
|
async doGenerate(options) {
|
|
76322
|
-
var
|
|
76427
|
+
var _a16, _b8, _c, _d;
|
|
76323
76428
|
const { args: body, warnings } = await this.getArgs(options);
|
|
76324
76429
|
const {
|
|
76325
76430
|
responseHeaders,
|
|
@@ -76347,7 +76452,7 @@ var OllamaCompletionLanguageModel = class {
|
|
|
76347
76452
|
}
|
|
76348
76453
|
],
|
|
76349
76454
|
usage: {
|
|
76350
|
-
inputTokens: (
|
|
76455
|
+
inputTokens: (_a16 = response.prompt_eval_count) != null ? _a16 : undefined,
|
|
76351
76456
|
outputTokens: (_b8 = response.eval_count) != null ? _b8 : undefined,
|
|
76352
76457
|
totalTokens: ((_c = response.prompt_eval_count) != null ? _c : 0) + ((_d = response.eval_count) != null ? _d : 0)
|
|
76353
76458
|
},
|
|
@@ -76462,23 +76567,23 @@ var OllamaEmbeddingModel = class {
|
|
|
76462
76567
|
return this.config.provider;
|
|
76463
76568
|
}
|
|
76464
76569
|
get maxEmbeddingsPerCall() {
|
|
76465
|
-
var
|
|
76466
|
-
return (
|
|
76570
|
+
var _a16;
|
|
76571
|
+
return (_a16 = this.settings.maxEmbeddingsPerCall) != null ? _a16 : 2048;
|
|
76467
76572
|
}
|
|
76468
76573
|
get supportsParallelCalls() {
|
|
76469
|
-
var
|
|
76470
|
-
return (
|
|
76574
|
+
var _a16;
|
|
76575
|
+
return (_a16 = this.settings.supportsParallelCalls) != null ? _a16 : true;
|
|
76471
76576
|
}
|
|
76472
76577
|
async getArgs({
|
|
76473
76578
|
values,
|
|
76474
76579
|
providerOptions
|
|
76475
76580
|
}) {
|
|
76476
|
-
var
|
|
76477
|
-
const ollamaOptions = (
|
|
76581
|
+
var _a16, _b8;
|
|
76582
|
+
const ollamaOptions = (_a16 = await parseProviderOptions({
|
|
76478
76583
|
provider: "ollama",
|
|
76479
76584
|
providerOptions,
|
|
76480
76585
|
schema: ollamaEmbeddingProviderOptions
|
|
76481
|
-
})) != null ?
|
|
76586
|
+
})) != null ? _a16 : {};
|
|
76482
76587
|
return {
|
|
76483
76588
|
args: {
|
|
76484
76589
|
model: this.modelId,
|
|
@@ -76570,7 +76675,7 @@ function convertToOllamaResponsesMessages({
|
|
|
76570
76675
|
messages.push({
|
|
76571
76676
|
role: "user",
|
|
76572
76677
|
content: content.map((part, index) => {
|
|
76573
|
-
var
|
|
76678
|
+
var _a16, _b8, _c;
|
|
76574
76679
|
switch (part.type) {
|
|
76575
76680
|
case "text": {
|
|
76576
76681
|
return { type: "input_text", text: part.text };
|
|
@@ -76581,7 +76686,7 @@ function convertToOllamaResponsesMessages({
|
|
|
76581
76686
|
return {
|
|
76582
76687
|
type: "input_image",
|
|
76583
76688
|
image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${part.data}`,
|
|
76584
|
-
detail: (_b8 = (
|
|
76689
|
+
detail: (_b8 = (_a16 = part.providerOptions) == null ? undefined : _a16.ollama) == null ? undefined : _b8.imageDetail
|
|
76585
76690
|
};
|
|
76586
76691
|
} else if (part.mediaType === "application/pdf") {
|
|
76587
76692
|
if (part.data instanceof URL) {
|
|
@@ -76950,7 +77055,7 @@ var OllamaRequestBuilder = class {
|
|
|
76950
77055
|
responseFormat,
|
|
76951
77056
|
ollamaOptions
|
|
76952
77057
|
}) {
|
|
76953
|
-
var
|
|
77058
|
+
var _a16, _b8;
|
|
76954
77059
|
return {
|
|
76955
77060
|
model: modelId,
|
|
76956
77061
|
messages: convertToOllamaChatMessages({
|
|
@@ -76963,7 +77068,7 @@ var OllamaRequestBuilder = class {
|
|
|
76963
77068
|
...(responseFormat == null ? undefined : responseFormat.type) === "json" && {
|
|
76964
77069
|
format: responseFormat.schema != null ? responseFormat.schema : "json"
|
|
76965
77070
|
},
|
|
76966
|
-
think: (
|
|
77071
|
+
think: (_a16 = ollamaOptions == null ? undefined : ollamaOptions.think) != null ? _a16 : false,
|
|
76967
77072
|
options: (_b8 = ollamaOptions == null ? undefined : ollamaOptions.options) != null ? _b8 : undefined
|
|
76968
77073
|
};
|
|
76969
77074
|
}
|
|
@@ -77009,7 +77114,7 @@ var OllamaResponseProcessor = class {
|
|
|
77009
77114
|
};
|
|
77010
77115
|
}
|
|
77011
77116
|
extractContent(response) {
|
|
77012
|
-
var
|
|
77117
|
+
var _a16, _b8, _c, _d, _e;
|
|
77013
77118
|
const content = [];
|
|
77014
77119
|
const text2 = response.message.content;
|
|
77015
77120
|
if (text2 != null && text2.length > 0) {
|
|
@@ -77018,7 +77123,7 @@ var OllamaResponseProcessor = class {
|
|
|
77018
77123
|
text: text2
|
|
77019
77124
|
});
|
|
77020
77125
|
}
|
|
77021
|
-
for (const toolCall of (
|
|
77126
|
+
for (const toolCall of (_a16 = response.message.tool_calls) != null ? _a16 : []) {
|
|
77022
77127
|
content.push({
|
|
77023
77128
|
type: "tool-call",
|
|
77024
77129
|
toolCallId: (_e = toolCall.id) != null ? _e : (_d = (_c = (_b8 = this.config).generateId) == null ? undefined : _c.call(_b8)) != null ? _d : generateId(),
|
|
@@ -77029,9 +77134,9 @@ var OllamaResponseProcessor = class {
|
|
|
77029
77134
|
return content;
|
|
77030
77135
|
}
|
|
77031
77136
|
extractUsage(response) {
|
|
77032
|
-
var
|
|
77137
|
+
var _a16, _b8, _c, _d;
|
|
77033
77138
|
return {
|
|
77034
|
-
inputTokens: (
|
|
77139
|
+
inputTokens: (_a16 = response.prompt_eval_count) != null ? _a16 : undefined,
|
|
77035
77140
|
outputTokens: (_b8 = response.eval_count) != null ? _b8 : undefined,
|
|
77036
77141
|
totalTokens: ((_c = response.prompt_eval_count) != null ? _c : 0) + ((_d = response.eval_count) != null ? _d : 0),
|
|
77037
77142
|
reasoningTokens: undefined,
|
|
@@ -77040,12 +77145,12 @@ var OllamaResponseProcessor = class {
|
|
|
77040
77145
|
}
|
|
77041
77146
|
};
|
|
77042
77147
|
function extractOllamaResponseObjectsFromChunk(chunk) {
|
|
77043
|
-
var
|
|
77148
|
+
var _a16;
|
|
77044
77149
|
if (chunk.success) {
|
|
77045
77150
|
return [chunk.value];
|
|
77046
77151
|
}
|
|
77047
77152
|
const results = [];
|
|
77048
|
-
const raw = (
|
|
77153
|
+
const raw = (_a16 = chunk.error) == null ? undefined : _a16.text;
|
|
77049
77154
|
if (typeof raw !== "string" || raw.length === 0) {
|
|
77050
77155
|
return results;
|
|
77051
77156
|
}
|
|
@@ -77139,11 +77244,11 @@ var OllamaStreamProcessor = class {
|
|
|
77139
77244
|
}
|
|
77140
77245
|
}
|
|
77141
77246
|
handleDoneChunk(value, controller) {
|
|
77142
|
-
var
|
|
77247
|
+
var _a16, _b8, _c;
|
|
77143
77248
|
this.state.finishReason = mapOllamaFinishReason(value.done_reason);
|
|
77144
77249
|
this.state.usage = {
|
|
77145
77250
|
inputTokens: value.prompt_eval_count || 0,
|
|
77146
|
-
outputTokens: (
|
|
77251
|
+
outputTokens: (_a16 = value.eval_count) != null ? _a16 : undefined,
|
|
77147
77252
|
totalTokens: ((_b8 = value.prompt_eval_count) != null ? _b8 : 0) + ((_c = value.eval_count) != null ? _c : 0)
|
|
77148
77253
|
};
|
|
77149
77254
|
if (this.state.hasTextStarted && !this.state.textEnded) {
|
|
@@ -77187,8 +77292,8 @@ var OllamaStreamProcessor = class {
|
|
|
77187
77292
|
}
|
|
77188
77293
|
}
|
|
77189
77294
|
processToolCalls(delta, controller) {
|
|
77190
|
-
var
|
|
77191
|
-
for (const toolCall of (
|
|
77295
|
+
var _a16, _b8, _c, _d;
|
|
77296
|
+
for (const toolCall of (_a16 = delta.tool_calls) != null ? _a16 : []) {
|
|
77192
77297
|
if (((_b8 = toolCall.function) == null ? undefined : _b8.name) == null) {
|
|
77193
77298
|
throw new InvalidResponseDataError({
|
|
77194
77299
|
data: toolCall,
|
|
@@ -77201,8 +77306,8 @@ var OllamaStreamProcessor = class {
|
|
|
77201
77306
|
}
|
|
77202
77307
|
}
|
|
77203
77308
|
emitToolCall(toolCall, controller) {
|
|
77204
|
-
var
|
|
77205
|
-
const id = (_d = toolCall.id) != null ? _d : (_c = (_b8 = (
|
|
77309
|
+
var _a16, _b8, _c, _d;
|
|
77310
|
+
const id = (_d = toolCall.id) != null ? _d : (_c = (_b8 = (_a16 = this.config).generateId) == null ? undefined : _b8.call(_a16)) != null ? _c : generateId();
|
|
77206
77311
|
controller.enqueue({
|
|
77207
77312
|
type: "tool-input-start",
|
|
77208
77313
|
id,
|
|
@@ -77320,8 +77425,8 @@ var OllamaResponsesLanguageModel = class {
|
|
|
77320
77425
|
}
|
|
77321
77426
|
};
|
|
77322
77427
|
function createOllama(options = {}) {
|
|
77323
|
-
var
|
|
77324
|
-
const baseURL = (
|
|
77428
|
+
var _a16, _b8;
|
|
77429
|
+
const baseURL = (_a16 = withoutTrailingSlash(options.baseURL)) != null ? _a16 : "http://127.0.0.1:11434/api";
|
|
77325
77430
|
const providerName = (_b8 = options.name) != null ? _b8 : "ollama";
|
|
77326
77431
|
const getHeaders = () => ({
|
|
77327
77432
|
"Ollama-Organization": options.organization,
|
|
@@ -81307,7 +81412,14 @@ var EpicContextSchema = exports_external.object({
|
|
|
81307
81412
|
memory: exports_external.record(exports_external.string(), exports_external.string()).nullish()
|
|
81308
81413
|
});
|
|
81309
81414
|
var saveEpicContext = async (context) => {
|
|
81310
|
-
const yamlString = $stringify(
|
|
81415
|
+
const yamlString = $stringify({
|
|
81416
|
+
task: context.task,
|
|
81417
|
+
plan: context.plan,
|
|
81418
|
+
branchName: context.branchName,
|
|
81419
|
+
baseBranch: context.baseBranch,
|
|
81420
|
+
todos: context.todos,
|
|
81421
|
+
memory: context.memory
|
|
81422
|
+
});
|
|
81311
81423
|
await fs3.writeFile(EPIC_CONTEXT_FILE, yamlString, "utf-8");
|
|
81312
81424
|
};
|
|
81313
81425
|
var loadEpicContext = async () => {
|