@skilder-ai/runtime 0.8.7 → 0.8.9
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 +702 -572
- package/dist/index.js.map +4 -4
- package/dist/script-sdk-bundle.cjs +24 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21941,7 +21941,7 @@ var require_transport = __commonJS({
|
|
|
21941
21941
|
stream.flushSync();
|
|
21942
21942
|
}
|
|
21943
21943
|
function transport(fullOptions) {
|
|
21944
|
-
const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions;
|
|
21944
|
+
const { pipeline: pipeline2, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions;
|
|
21945
21945
|
const options = {
|
|
21946
21946
|
...fullOptions.options
|
|
21947
21947
|
};
|
|
@@ -21969,9 +21969,9 @@ var require_transport = __commonJS({
|
|
|
21969
21969
|
};
|
|
21970
21970
|
});
|
|
21971
21971
|
});
|
|
21972
|
-
} else if (
|
|
21972
|
+
} else if (pipeline2) {
|
|
21973
21973
|
target = bundlerOverrides["pino-worker"] || join6(__dirname, "worker.js");
|
|
21974
|
-
options.pipelines = [
|
|
21974
|
+
options.pipelines = [pipeline2.map((dest) => {
|
|
21975
21975
|
return {
|
|
21976
21976
|
...dest,
|
|
21977
21977
|
target: fixTarget(dest.target)
|
|
@@ -24188,7 +24188,7 @@ var require_pump = __commonJS({
|
|
|
24188
24188
|
var require_split2 = __commonJS({
|
|
24189
24189
|
"../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports2, module2) {
|
|
24190
24190
|
"use strict";
|
|
24191
|
-
var { Transform } = require("stream");
|
|
24191
|
+
var { Transform: Transform2 } = require("stream");
|
|
24192
24192
|
var { StringDecoder } = require("string_decoder");
|
|
24193
24193
|
var kLast = /* @__PURE__ */ Symbol("last");
|
|
24194
24194
|
var kDecoder = /* @__PURE__ */ Symbol("decoder");
|
|
@@ -24267,7 +24267,7 @@ var require_split2 = __commonJS({
|
|
|
24267
24267
|
options.transform = transform2;
|
|
24268
24268
|
options.flush = flush;
|
|
24269
24269
|
options.readableObjectMode = true;
|
|
24270
|
-
const stream = new
|
|
24270
|
+
const stream = new Transform2(options);
|
|
24271
24271
|
stream[kLast] = "";
|
|
24272
24272
|
stream[kDecoder] = new StringDecoder("utf8");
|
|
24273
24273
|
stream.matcher = matcher;
|
|
@@ -26244,7 +26244,7 @@ var require_pino_pretty = __commonJS({
|
|
|
26244
26244
|
"use strict";
|
|
26245
26245
|
var { isColorSupported } = require_colorette();
|
|
26246
26246
|
var pump = require_pump();
|
|
26247
|
-
var { Transform } = require("node:stream");
|
|
26247
|
+
var { Transform: Transform2 } = require("node:stream");
|
|
26248
26248
|
var abstractTransport = require_pino_abstract_transport();
|
|
26249
26249
|
var colors = require_colors();
|
|
26250
26250
|
var {
|
|
@@ -26301,7 +26301,7 @@ var require_pino_pretty = __commonJS({
|
|
|
26301
26301
|
pretty3 = prettyFactory(opts);
|
|
26302
26302
|
source.off("message", pinoConfigListener);
|
|
26303
26303
|
});
|
|
26304
|
-
const stream = new
|
|
26304
|
+
const stream = new Transform2({
|
|
26305
26305
|
objectMode: true,
|
|
26306
26306
|
autoDestroy: true,
|
|
26307
26307
|
transform(chunk, enc, cb) {
|
|
@@ -41248,8 +41248,8 @@ var require_scope = __commonJS({
|
|
|
41248
41248
|
return `${prefix}${ng.index++}`;
|
|
41249
41249
|
}
|
|
41250
41250
|
_nameGroup(prefix) {
|
|
41251
|
-
var _a51,
|
|
41252
|
-
if (((
|
|
41251
|
+
var _a51, _b40;
|
|
41252
|
+
if (((_b40 = (_a51 = this._parent) === null || _a51 === void 0 ? void 0 : _a51._prefixes) === null || _b40 === void 0 ? void 0 : _b40.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
|
|
41253
41253
|
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
|
41254
41254
|
}
|
|
41255
41255
|
return this._names[prefix] = { prefix, index: 0 };
|
|
@@ -41710,17 +41710,17 @@ var require_codegen = __commonJS({
|
|
|
41710
41710
|
return code;
|
|
41711
41711
|
}
|
|
41712
41712
|
optimizeNodes() {
|
|
41713
|
-
var _a51,
|
|
41713
|
+
var _a51, _b40;
|
|
41714
41714
|
super.optimizeNodes();
|
|
41715
41715
|
(_a51 = this.catch) === null || _a51 === void 0 ? void 0 : _a51.optimizeNodes();
|
|
41716
|
-
(
|
|
41716
|
+
(_b40 = this.finally) === null || _b40 === void 0 ? void 0 : _b40.optimizeNodes();
|
|
41717
41717
|
return this;
|
|
41718
41718
|
}
|
|
41719
41719
|
optimizeNames(names, constants2) {
|
|
41720
|
-
var _a51,
|
|
41720
|
+
var _a51, _b40;
|
|
41721
41721
|
super.optimizeNames(names, constants2);
|
|
41722
41722
|
(_a51 = this.catch) === null || _a51 === void 0 ? void 0 : _a51.optimizeNames(names, constants2);
|
|
41723
|
-
(
|
|
41723
|
+
(_b40 = this.finally) === null || _b40 === void 0 ? void 0 : _b40.optimizeNames(names, constants2);
|
|
41724
41724
|
return this;
|
|
41725
41725
|
}
|
|
41726
41726
|
get names() {
|
|
@@ -44938,11 +44938,11 @@ var require_core2 = __commonJS({
|
|
|
44938
44938
|
};
|
|
44939
44939
|
var MAX_EXPRESSION = 200;
|
|
44940
44940
|
function requiredOptions(o) {
|
|
44941
|
-
var _a51,
|
|
44941
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _j2, _k3, _l, _m, _o2, _p2, _q2, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
44942
44942
|
const s = o.strict;
|
|
44943
44943
|
const _optz = (_a51 = o.code) === null || _a51 === void 0 ? void 0 : _a51.optimize;
|
|
44944
44944
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
44945
|
-
const regExp = (_c11 = (
|
|
44945
|
+
const regExp = (_c11 = (_b40 = o.code) === null || _b40 === void 0 ? void 0 : _b40.regExp) !== null && _c11 !== void 0 ? _c11 : defaultRegExp;
|
|
44946
44946
|
const uriResolver = (_d8 = o.uriResolver) !== null && _d8 !== void 0 ? _d8 : uri_1.default;
|
|
44947
44947
|
return {
|
|
44948
44948
|
strictSchema: (_f3 = (_e7 = o.strictSchema) !== null && _e7 !== void 0 ? _e7 : s) !== null && _f3 !== void 0 ? _f3 : true,
|
|
@@ -44952,7 +44952,7 @@ var require_core2 = __commonJS({
|
|
|
44952
44952
|
strictRequired: (_p2 = (_o2 = o.strictRequired) !== null && _o2 !== void 0 ? _o2 : s) !== null && _p2 !== void 0 ? _p2 : false,
|
|
44953
44953
|
code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
|
|
44954
44954
|
loopRequired: (_q2 = o.loopRequired) !== null && _q2 !== void 0 ? _q2 : MAX_EXPRESSION,
|
|
44955
|
-
loopEnum: (
|
|
44955
|
+
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
44956
44956
|
meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
|
|
44957
44957
|
messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
|
|
44958
44958
|
inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
|
|
@@ -47803,8 +47803,8 @@ var require_dist2 = __commonJS({
|
|
|
47803
47803
|
};
|
|
47804
47804
|
function addFormats(ajv, list, fs5, exportName) {
|
|
47805
47805
|
var _a51;
|
|
47806
|
-
var
|
|
47807
|
-
(_a51 = (
|
|
47806
|
+
var _b40;
|
|
47807
|
+
(_a51 = (_b40 = ajv.opts.code).formats) !== null && _a51 !== void 0 ? _a51 : _b40.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
47808
47808
|
for (const f2 of list)
|
|
47809
47809
|
ajv.addFormat(f2, fs5[f2]);
|
|
47810
47810
|
}
|
|
@@ -47933,7 +47933,7 @@ var require_Subscription = __commonJS({
|
|
|
47933
47933
|
this._finalizers = null;
|
|
47934
47934
|
}
|
|
47935
47935
|
Subscription2.prototype.unsubscribe = function() {
|
|
47936
|
-
var e_1, _a51, e_2,
|
|
47936
|
+
var e_1, _a51, e_2, _b40;
|
|
47937
47937
|
var errors;
|
|
47938
47938
|
if (!this.closed) {
|
|
47939
47939
|
this.closed = true;
|
|
@@ -47988,7 +47988,7 @@ var require_Subscription = __commonJS({
|
|
|
47988
47988
|
e_2 = { error: e_2_1 };
|
|
47989
47989
|
} finally {
|
|
47990
47990
|
try {
|
|
47991
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (
|
|
47991
|
+
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b40 = _finalizers_1.return)) _b40.call(_finalizers_1);
|
|
47992
47992
|
} finally {
|
|
47993
47993
|
if (e_2) throw e_2.error;
|
|
47994
47994
|
}
|
|
@@ -49037,7 +49037,7 @@ var require_Subject = __commonJS({
|
|
|
49037
49037
|
_this.currentObservers = Array.from(_this.observers);
|
|
49038
49038
|
}
|
|
49039
49039
|
try {
|
|
49040
|
-
for (var
|
|
49040
|
+
for (var _b40 = __values(_this.currentObservers), _c11 = _b40.next(); !_c11.done; _c11 = _b40.next()) {
|
|
49041
49041
|
var observer = _c11.value;
|
|
49042
49042
|
observer.next(value);
|
|
49043
49043
|
}
|
|
@@ -49045,7 +49045,7 @@ var require_Subject = __commonJS({
|
|
|
49045
49045
|
e_1 = { error: e_1_1 };
|
|
49046
49046
|
} finally {
|
|
49047
49047
|
try {
|
|
49048
|
-
if (_c11 && !_c11.done && (_a51 =
|
|
49048
|
+
if (_c11 && !_c11.done && (_a51 = _b40.return)) _a51.call(_b40);
|
|
49049
49049
|
} finally {
|
|
49050
49050
|
if (e_1) throw e_1.error;
|
|
49051
49051
|
}
|
|
@@ -49142,20 +49142,20 @@ var require_Subject = __commonJS({
|
|
|
49142
49142
|
return _this;
|
|
49143
49143
|
}
|
|
49144
49144
|
AnonymousSubject2.prototype.next = function(value) {
|
|
49145
|
-
var _a51,
|
|
49146
|
-
(
|
|
49145
|
+
var _a51, _b40;
|
|
49146
|
+
(_b40 = (_a51 = this.destination) === null || _a51 === void 0 ? void 0 : _a51.next) === null || _b40 === void 0 ? void 0 : _b40.call(_a51, value);
|
|
49147
49147
|
};
|
|
49148
49148
|
AnonymousSubject2.prototype.error = function(err) {
|
|
49149
|
-
var _a51,
|
|
49150
|
-
(
|
|
49149
|
+
var _a51, _b40;
|
|
49150
|
+
(_b40 = (_a51 = this.destination) === null || _a51 === void 0 ? void 0 : _a51.error) === null || _b40 === void 0 ? void 0 : _b40.call(_a51, err);
|
|
49151
49151
|
};
|
|
49152
49152
|
AnonymousSubject2.prototype.complete = function() {
|
|
49153
|
-
var _a51,
|
|
49154
|
-
(
|
|
49153
|
+
var _a51, _b40;
|
|
49154
|
+
(_b40 = (_a51 = this.destination) === null || _a51 === void 0 ? void 0 : _a51.complete) === null || _b40 === void 0 ? void 0 : _b40.call(_a51);
|
|
49155
49155
|
};
|
|
49156
49156
|
AnonymousSubject2.prototype._subscribe = function(subscriber) {
|
|
49157
|
-
var _a51,
|
|
49158
|
-
return (
|
|
49157
|
+
var _a51, _b40;
|
|
49158
|
+
return (_b40 = (_a51 = this.source) === null || _a51 === void 0 ? void 0 : _a51.subscribe(subscriber)) !== null && _b40 !== void 0 ? _b40 : Subscription_1.EMPTY_SUBSCRIPTION;
|
|
49159
49159
|
};
|
|
49160
49160
|
return AnonymousSubject2;
|
|
49161
49161
|
})(Subject);
|
|
@@ -50614,29 +50614,29 @@ var require_isReadableStreamLike = __commonJS({
|
|
|
50614
50614
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
50615
50615
|
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
50616
50616
|
var reader, _a51, value, done;
|
|
50617
|
-
return __generator(this, function(
|
|
50618
|
-
switch (
|
|
50617
|
+
return __generator(this, function(_b40) {
|
|
50618
|
+
switch (_b40.label) {
|
|
50619
50619
|
case 0:
|
|
50620
50620
|
reader = readableStream.getReader();
|
|
50621
|
-
|
|
50621
|
+
_b40.label = 1;
|
|
50622
50622
|
case 1:
|
|
50623
|
-
|
|
50624
|
-
|
|
50623
|
+
_b40.trys.push([1, , 9, 10]);
|
|
50624
|
+
_b40.label = 2;
|
|
50625
50625
|
case 2:
|
|
50626
50626
|
if (false) return [3, 8];
|
|
50627
50627
|
return [4, __await(reader.read())];
|
|
50628
50628
|
case 3:
|
|
50629
|
-
_a51 =
|
|
50629
|
+
_a51 = _b40.sent(), value = _a51.value, done = _a51.done;
|
|
50630
50630
|
if (!done) return [3, 5];
|
|
50631
50631
|
return [4, __await(void 0)];
|
|
50632
50632
|
case 4:
|
|
50633
|
-
return [2,
|
|
50633
|
+
return [2, _b40.sent()];
|
|
50634
50634
|
case 5:
|
|
50635
50635
|
return [4, __await(value)];
|
|
50636
50636
|
case 6:
|
|
50637
|
-
return [4,
|
|
50637
|
+
return [4, _b40.sent()];
|
|
50638
50638
|
case 7:
|
|
50639
|
-
|
|
50639
|
+
_b40.sent();
|
|
50640
50640
|
return [3, 2];
|
|
50641
50641
|
case 8:
|
|
50642
50642
|
return [3, 10];
|
|
@@ -50900,37 +50900,37 @@ var require_innerFrom = __commonJS({
|
|
|
50900
50900
|
var e_2, _a51;
|
|
50901
50901
|
return __awaiter(this, void 0, void 0, function() {
|
|
50902
50902
|
var value, e_2_1;
|
|
50903
|
-
return __generator(this, function(
|
|
50904
|
-
switch (
|
|
50903
|
+
return __generator(this, function(_b40) {
|
|
50904
|
+
switch (_b40.label) {
|
|
50905
50905
|
case 0:
|
|
50906
|
-
|
|
50906
|
+
_b40.trys.push([0, 5, 6, 11]);
|
|
50907
50907
|
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
50908
|
-
|
|
50908
|
+
_b40.label = 1;
|
|
50909
50909
|
case 1:
|
|
50910
50910
|
return [4, asyncIterable_1.next()];
|
|
50911
50911
|
case 2:
|
|
50912
|
-
if (!(asyncIterable_1_1 =
|
|
50912
|
+
if (!(asyncIterable_1_1 = _b40.sent(), !asyncIterable_1_1.done)) return [3, 4];
|
|
50913
50913
|
value = asyncIterable_1_1.value;
|
|
50914
50914
|
subscriber.next(value);
|
|
50915
50915
|
if (subscriber.closed) {
|
|
50916
50916
|
return [2];
|
|
50917
50917
|
}
|
|
50918
|
-
|
|
50918
|
+
_b40.label = 3;
|
|
50919
50919
|
case 3:
|
|
50920
50920
|
return [3, 1];
|
|
50921
50921
|
case 4:
|
|
50922
50922
|
return [3, 11];
|
|
50923
50923
|
case 5:
|
|
50924
|
-
e_2_1 =
|
|
50924
|
+
e_2_1 = _b40.sent();
|
|
50925
50925
|
e_2 = { error: e_2_1 };
|
|
50926
50926
|
return [3, 11];
|
|
50927
50927
|
case 6:
|
|
50928
|
-
|
|
50928
|
+
_b40.trys.push([6, , 9, 10]);
|
|
50929
50929
|
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a51 = asyncIterable_1.return))) return [3, 8];
|
|
50930
50930
|
return [4, _a51.call(asyncIterable_1)];
|
|
50931
50931
|
case 7:
|
|
50932
|
-
|
|
50933
|
-
|
|
50932
|
+
_b40.sent();
|
|
50933
|
+
_b40.label = 8;
|
|
50934
50934
|
case 8:
|
|
50935
50935
|
return [3, 10];
|
|
50936
50936
|
case 9:
|
|
@@ -51339,12 +51339,12 @@ var require_Notification = __commonJS({
|
|
|
51339
51339
|
})();
|
|
51340
51340
|
exports2.Notification = Notification;
|
|
51341
51341
|
function observeNotification(notification, observer) {
|
|
51342
|
-
var _a51,
|
|
51342
|
+
var _a51, _b40, _c11;
|
|
51343
51343
|
var _d8 = notification, kind = _d8.kind, value = _d8.value, error48 = _d8.error;
|
|
51344
51344
|
if (typeof kind !== "string") {
|
|
51345
51345
|
throw new TypeError('Invalid notification, missing "kind"');
|
|
51346
51346
|
}
|
|
51347
|
-
kind === "N" ? (_a51 = observer.next) === null || _a51 === void 0 ? void 0 : _a51.call(observer, value) : kind === "E" ? (
|
|
51347
|
+
kind === "N" ? (_a51 = observer.next) === null || _a51 === void 0 ? void 0 : _a51.call(observer, value) : kind === "E" ? (_b40 = observer.error) === null || _b40 === void 0 ? void 0 : _b40.call(observer, error48) : (_c11 = observer.complete) === null || _c11 === void 0 ? void 0 : _c11.call(observer);
|
|
51348
51348
|
}
|
|
51349
51349
|
exports2.observeNotification = observeNotification;
|
|
51350
51350
|
}
|
|
@@ -51537,7 +51537,7 @@ var require_timeout = __commonJS({
|
|
|
51537
51537
|
};
|
|
51538
51538
|
});
|
|
51539
51539
|
function timeout2(config2, schedulerArg) {
|
|
51540
|
-
var _a51 = isDate_1.isValidDate(config2) ? { first: config2 } : typeof config2 === "number" ? { each: config2 } : config2, first = _a51.first, each = _a51.each,
|
|
51540
|
+
var _a51 = isDate_1.isValidDate(config2) ? { first: config2 } : typeof config2 === "number" ? { each: config2 } : config2, first = _a51.first, each = _a51.each, _b40 = _a51.with, _with = _b40 === void 0 ? timeoutErrorFactory : _b40, _c11 = _a51.scheduler, scheduler2 = _c11 === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : async_1.asyncScheduler : _c11, _d8 = _a51.meta, meta3 = _d8 === void 0 ? null : _d8;
|
|
51541
51541
|
if (first == null && each == null) {
|
|
51542
51542
|
throw new TypeError("No timeout provided.");
|
|
51543
51543
|
}
|
|
@@ -52378,11 +52378,11 @@ var require_generate = __commonJS({
|
|
|
52378
52378
|
var defer_1 = require_defer();
|
|
52379
52379
|
var scheduleIterable_1 = require_scheduleIterable();
|
|
52380
52380
|
function generate(initialStateOrOptions, condition, iterate, resultSelectorOrScheduler, scheduler2) {
|
|
52381
|
-
var _a51,
|
|
52381
|
+
var _a51, _b40;
|
|
52382
52382
|
var resultSelector;
|
|
52383
52383
|
var initialState;
|
|
52384
52384
|
if (arguments.length === 1) {
|
|
52385
|
-
_a51 = initialStateOrOptions, initialState = _a51.initialState, condition = _a51.condition, iterate = _a51.iterate,
|
|
52385
|
+
_a51 = initialStateOrOptions, initialState = _a51.initialState, condition = _a51.condition, iterate = _a51.iterate, _b40 = _a51.resultSelector, resultSelector = _b40 === void 0 ? identity_1.identity : _b40, scheduler2 = _a51.scheduler;
|
|
52386
52386
|
} else {
|
|
52387
52387
|
initialState = initialStateOrOptions;
|
|
52388
52388
|
if (!resultSelectorOrScheduler || isScheduler_1.isScheduler(resultSelectorOrScheduler)) {
|
|
@@ -52998,7 +52998,7 @@ var require_bufferCount = __commonJS({
|
|
|
52998
52998
|
var buffers = [];
|
|
52999
52999
|
var count = 0;
|
|
53000
53000
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
|
|
53001
|
-
var e_1, _a51, e_2,
|
|
53001
|
+
var e_1, _a51, e_2, _b40;
|
|
53002
53002
|
var toEmit = null;
|
|
53003
53003
|
if (count++ % startBufferEvery === 0) {
|
|
53004
53004
|
buffers.push([]);
|
|
@@ -53032,7 +53032,7 @@ var require_bufferCount = __commonJS({
|
|
|
53032
53032
|
e_2 = { error: e_2_1 };
|
|
53033
53033
|
} finally {
|
|
53034
53034
|
try {
|
|
53035
|
-
if (toEmit_1_1 && !toEmit_1_1.done && (
|
|
53035
|
+
if (toEmit_1_1 && !toEmit_1_1.done && (_b40 = toEmit_1.return)) _b40.call(toEmit_1);
|
|
53036
53036
|
} finally {
|
|
53037
53037
|
if (e_2) throw e_2.error;
|
|
53038
53038
|
}
|
|
@@ -53089,13 +53089,13 @@ var require_bufferTime = __commonJS({
|
|
|
53089
53089
|
var args_1 = require_args();
|
|
53090
53090
|
var executeSchedule_1 = require_executeSchedule();
|
|
53091
53091
|
function bufferTime(bufferTimeSpan) {
|
|
53092
|
-
var _a51,
|
|
53092
|
+
var _a51, _b40;
|
|
53093
53093
|
var otherArgs = [];
|
|
53094
53094
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
53095
53095
|
otherArgs[_i - 1] = arguments[_i];
|
|
53096
53096
|
}
|
|
53097
53097
|
var scheduler2 = (_a51 = args_1.popScheduler(otherArgs)) !== null && _a51 !== void 0 ? _a51 : async_1.asyncScheduler;
|
|
53098
|
-
var bufferCreationInterval = (
|
|
53098
|
+
var bufferCreationInterval = (_b40 = otherArgs[0]) !== null && _b40 !== void 0 ? _b40 : null;
|
|
53099
53099
|
var maxBufferSize = otherArgs[1] || Infinity;
|
|
53100
53100
|
return lift_1.operate(function(source, subscriber) {
|
|
53101
53101
|
var bufferRecords = [];
|
|
@@ -55119,7 +55119,7 @@ var require_retry = __commonJS({
|
|
|
55119
55119
|
count: configOrCount
|
|
55120
55120
|
};
|
|
55121
55121
|
}
|
|
55122
|
-
var _a51 = config2.count, count = _a51 === void 0 ? Infinity : _a51, delay2 = config2.delay,
|
|
55122
|
+
var _a51 = config2.count, count = _a51 === void 0 ? Infinity : _a51, delay2 = config2.delay, _b40 = config2.resetOnSuccess, resetOnSuccess = _b40 === void 0 ? false : _b40;
|
|
55123
55123
|
return count <= 0 ? identity_1.identity : lift_1.operate(function(source, subscriber) {
|
|
55124
55124
|
var soFar = 0;
|
|
55125
55125
|
var innerSub;
|
|
@@ -55367,7 +55367,7 @@ var require_share = __commonJS({
|
|
|
55367
55367
|
}
|
|
55368
55368
|
var _a51 = options.connector, connector = _a51 === void 0 ? function() {
|
|
55369
55369
|
return new Subject_1.Subject();
|
|
55370
|
-
} : _a51,
|
|
55370
|
+
} : _a51, _b40 = options.resetOnError, resetOnError = _b40 === void 0 ? true : _b40, _c11 = options.resetOnComplete, resetOnComplete = _c11 === void 0 ? true : _c11, _d8 = options.resetOnRefCountZero, resetOnRefCountZero = _d8 === void 0 ? true : _d8;
|
|
55371
55371
|
return function(wrapperSource) {
|
|
55372
55372
|
var connection;
|
|
55373
55373
|
var resetConnection;
|
|
@@ -55458,11 +55458,11 @@ var require_shareReplay = __commonJS({
|
|
|
55458
55458
|
var ReplaySubject_1 = require_ReplaySubject();
|
|
55459
55459
|
var share_1 = require_share();
|
|
55460
55460
|
function shareReplay(configOrBufferSize, windowTime, scheduler2) {
|
|
55461
|
-
var _a51,
|
|
55461
|
+
var _a51, _b40, _c11;
|
|
55462
55462
|
var bufferSize;
|
|
55463
55463
|
var refCount = false;
|
|
55464
55464
|
if (configOrBufferSize && typeof configOrBufferSize === "object") {
|
|
55465
|
-
_a51 = configOrBufferSize.bufferSize, bufferSize = _a51 === void 0 ? Infinity : _a51,
|
|
55465
|
+
_a51 = configOrBufferSize.bufferSize, bufferSize = _a51 === void 0 ? Infinity : _a51, _b40 = configOrBufferSize.windowTime, windowTime = _b40 === void 0 ? Infinity : _b40, _c11 = configOrBufferSize.refCount, refCount = _c11 === void 0 ? false : _c11, scheduler2 = configOrBufferSize.scheduler;
|
|
55466
55466
|
} else {
|
|
55467
55467
|
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
|
|
55468
55468
|
}
|
|
@@ -55811,11 +55811,11 @@ var require_tap = __commonJS({
|
|
|
55811
55811
|
(_a54 = tapObserver.error) === null || _a54 === void 0 ? void 0 : _a54.call(tapObserver, err);
|
|
55812
55812
|
subscriber.error(err);
|
|
55813
55813
|
}, function() {
|
|
55814
|
-
var _a54,
|
|
55814
|
+
var _a54, _b40;
|
|
55815
55815
|
if (isUnsub) {
|
|
55816
55816
|
(_a54 = tapObserver.unsubscribe) === null || _a54 === void 0 ? void 0 : _a54.call(tapObserver);
|
|
55817
55817
|
}
|
|
55818
|
-
(
|
|
55818
|
+
(_b40 = tapObserver.finalize) === null || _b40 === void 0 ? void 0 : _b40.call(tapObserver);
|
|
55819
55819
|
}));
|
|
55820
55820
|
}) : identity_1.identity;
|
|
55821
55821
|
}
|
|
@@ -55834,7 +55834,7 @@ var require_throttle = __commonJS({
|
|
|
55834
55834
|
var innerFrom_1 = require_innerFrom();
|
|
55835
55835
|
function throttle(durationSelector, config2) {
|
|
55836
55836
|
return lift_1.operate(function(source, subscriber) {
|
|
55837
|
-
var _a51 = config2 !== null && config2 !== void 0 ? config2 : {},
|
|
55837
|
+
var _a51 = config2 !== null && config2 !== void 0 ? config2 : {}, _b40 = _a51.leading, leading = _b40 === void 0 ? true : _b40, _c11 = _a51.trailing, trailing = _c11 === void 0 ? false : _c11;
|
|
55838
55838
|
var hasValue = false;
|
|
55839
55839
|
var sendValue = null;
|
|
55840
55840
|
var throttled = null;
|
|
@@ -56123,13 +56123,13 @@ var require_windowTime = __commonJS({
|
|
|
56123
56123
|
var args_1 = require_args();
|
|
56124
56124
|
var executeSchedule_1 = require_executeSchedule();
|
|
56125
56125
|
function windowTime(windowTimeSpan) {
|
|
56126
|
-
var _a51,
|
|
56126
|
+
var _a51, _b40;
|
|
56127
56127
|
var otherArgs = [];
|
|
56128
56128
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
56129
56129
|
otherArgs[_i - 1] = arguments[_i];
|
|
56130
56130
|
}
|
|
56131
56131
|
var scheduler2 = (_a51 = args_1.popScheduler(otherArgs)) !== null && _a51 !== void 0 ? _a51 : async_1.asyncScheduler;
|
|
56132
|
-
var windowCreationInterval = (
|
|
56132
|
+
var windowCreationInterval = (_b40 = otherArgs[0]) !== null && _b40 !== void 0 ? _b40 : null;
|
|
56133
56133
|
var maxWindowSize = otherArgs[1] || Infinity;
|
|
56134
56134
|
return lift_1.operate(function(source, subscriber) {
|
|
56135
56135
|
var windowRecords = [];
|
|
@@ -61516,7 +61516,7 @@ var require_reply = __commonJS({
|
|
|
61516
61516
|
"../../node_modules/.pnpm/fastify@5.6.2/node_modules/fastify/lib/reply.js"(exports2, module2) {
|
|
61517
61517
|
"use strict";
|
|
61518
61518
|
var eos = require("node:stream").finished;
|
|
61519
|
-
var
|
|
61519
|
+
var Readable3 = require("node:stream").Readable;
|
|
61520
61520
|
var {
|
|
61521
61521
|
kFourOhFourContext,
|
|
61522
61522
|
kReplyErrorHandlerCalled,
|
|
@@ -62051,7 +62051,7 @@ var require_reply = __commonJS({
|
|
|
62051
62051
|
if (payload.locked) {
|
|
62052
62052
|
throw new FST_ERR_REP_READABLE_STREAM_LOCKED();
|
|
62053
62053
|
}
|
|
62054
|
-
const nodeStream =
|
|
62054
|
+
const nodeStream = Readable3.fromWeb(payload);
|
|
62055
62055
|
sendStream(nodeStream, res, reply);
|
|
62056
62056
|
}
|
|
62057
62057
|
function sendStream(payload, res, reply) {
|
|
@@ -72720,11 +72720,11 @@ var require_util4 = __commonJS({
|
|
|
72720
72720
|
});
|
|
72721
72721
|
};
|
|
72722
72722
|
exports2.tokenizeClass = (str, regexpStr) => {
|
|
72723
|
-
var _a51,
|
|
72723
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6;
|
|
72724
72724
|
let tokens = [], rs, c3;
|
|
72725
72725
|
const regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;
|
|
72726
72726
|
while ((rs = regexp.exec(str)) !== null) {
|
|
72727
|
-
const p2 = (_g6 = (_f3 = (_e7 = (_d8 = (_c11 = (
|
|
72727
|
+
const p2 = (_g6 = (_f3 = (_e7 = (_d8 = (_c11 = (_b40 = (_a51 = rs[1] && sets.words()) !== null && _a51 !== void 0 ? _a51 : rs[2] && sets.ints()) !== null && _b40 !== void 0 ? _b40 : rs[3] && sets.whitespace()) !== null && _c11 !== void 0 ? _c11 : rs[4] && sets.notWords()) !== null && _d8 !== void 0 ? _d8 : rs[5] && sets.notInts()) !== null && _e7 !== void 0 ? _e7 : rs[6] && sets.notWhitespace()) !== null && _f3 !== void 0 ? _f3 : rs[7] && {
|
|
72728
72728
|
type: types_1.types.RANGE,
|
|
72729
72729
|
from: (rs[8] || rs[9]).charCodeAt(0),
|
|
72730
72730
|
to: (c3 = rs[10]).charCodeAt(c3.length - 1)
|
|
@@ -77153,15 +77153,15 @@ var require_parse_url = __commonJS({
|
|
|
77153
77153
|
var require_form_data = __commonJS({
|
|
77154
77154
|
"../../node_modules/.pnpm/light-my-request@6.6.0/node_modules/light-my-request/lib/form-data.js"(exports2, module2) {
|
|
77155
77155
|
"use strict";
|
|
77156
|
-
var { randomUUID:
|
|
77157
|
-
var { Readable:
|
|
77156
|
+
var { randomUUID: randomUUID5 } = require("node:crypto");
|
|
77157
|
+
var { Readable: Readable3 } = require("node:stream");
|
|
77158
77158
|
var textEncoder;
|
|
77159
77159
|
function isFormDataLike(payload) {
|
|
77160
77160
|
return payload && typeof payload === "object" && typeof payload.append === "function" && typeof payload.delete === "function" && typeof payload.get === "function" && typeof payload.getAll === "function" && typeof payload.has === "function" && typeof payload.set === "function" && payload[Symbol.toStringTag] === "FormData";
|
|
77161
77161
|
}
|
|
77162
77162
|
function formDataToStream(formdata) {
|
|
77163
77163
|
textEncoder = textEncoder ?? new TextEncoder();
|
|
77164
|
-
const boundary = `----formdata-${
|
|
77164
|
+
const boundary = `----formdata-${randomUUID5()}`;
|
|
77165
77165
|
const prefix = `--${boundary}\r
|
|
77166
77166
|
Content-Disposition: form-data`;
|
|
77167
77167
|
const escape2 = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
|
|
@@ -77193,7 +77193,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
77193
77193
|
}
|
|
77194
77194
|
yield textEncoder.encode(`--${boundary}--`);
|
|
77195
77195
|
}
|
|
77196
|
-
const stream =
|
|
77196
|
+
const stream = Readable3.from(asyncIterator());
|
|
77197
77197
|
return {
|
|
77198
77198
|
stream,
|
|
77199
77199
|
contentType: `multipart/form-data; boundary=${boundary}`
|
|
@@ -77208,7 +77208,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
77208
77208
|
var require_request3 = __commonJS({
|
|
77209
77209
|
"../../node_modules/.pnpm/light-my-request@6.6.0/node_modules/light-my-request/lib/request.js"(exports2, module2) {
|
|
77210
77210
|
"use strict";
|
|
77211
|
-
var { Readable:
|
|
77211
|
+
var { Readable: Readable3, addAbortSignal } = require("node:stream");
|
|
77212
77212
|
var util2 = require("node:util");
|
|
77213
77213
|
var cookie = require_dist5();
|
|
77214
77214
|
var assert2 = require("node:assert");
|
|
@@ -77246,7 +77246,7 @@ var require_request3 = __commonJS({
|
|
|
77246
77246
|
}
|
|
77247
77247
|
}
|
|
77248
77248
|
function Request2(options) {
|
|
77249
|
-
|
|
77249
|
+
Readable3.call(this, {
|
|
77250
77250
|
autoDestroy: false
|
|
77251
77251
|
});
|
|
77252
77252
|
const parsedURL = parseURL(options.url || options.path, options.query);
|
|
@@ -77378,7 +77378,7 @@ var require_request3 = __commonJS({
|
|
|
77378
77378
|
}
|
|
77379
77379
|
});
|
|
77380
77380
|
}
|
|
77381
|
-
util2.inherits(Request2,
|
|
77381
|
+
util2.inherits(Request2, Readable3);
|
|
77382
77382
|
util2.inherits(CustomRequest, Request2);
|
|
77383
77383
|
Request2.prototype.destroy = function(error48) {
|
|
77384
77384
|
if (this.destroyed || this._lightMyRequest.isDone) return;
|
|
@@ -77583,14 +77583,14 @@ var require_response = __commonJS({
|
|
|
77583
77583
|
"../../node_modules/.pnpm/light-my-request@6.6.0/node_modules/light-my-request/lib/response.js"(exports2, module2) {
|
|
77584
77584
|
"use strict";
|
|
77585
77585
|
var http = require("node:http");
|
|
77586
|
-
var { Writable, Readable:
|
|
77586
|
+
var { Writable, Readable: Readable3, addAbortSignal } = require("node:stream");
|
|
77587
77587
|
var util2 = require("node:util");
|
|
77588
77588
|
var setCookie = require_set_cookie();
|
|
77589
77589
|
function Response3(req, onEnd, reject) {
|
|
77590
77590
|
http.ServerResponse.call(this, req);
|
|
77591
77591
|
if (req._lightMyRequest?.payloadAsStream) {
|
|
77592
77592
|
const read = this.emit.bind(this, "drain");
|
|
77593
|
-
this._lightMyRequest = { headers: null, trailers: {}, stream: new
|
|
77593
|
+
this._lightMyRequest = { headers: null, trailers: {}, stream: new Readable3({ read }) };
|
|
77594
77594
|
const signal = req._lightMyRequest.signal;
|
|
77595
77595
|
if (signal) {
|
|
77596
77596
|
addAbortSignal(signal, this._lightMyRequest.stream);
|
|
@@ -77736,7 +77736,7 @@ var require_response = __commonJS({
|
|
|
77736
77736
|
if (response._lightMyRequest.stream) {
|
|
77737
77737
|
return response._lightMyRequest.stream;
|
|
77738
77738
|
}
|
|
77739
|
-
return
|
|
77739
|
+
return Readable3.from(response._lightMyRequest.payloadChunks);
|
|
77740
77740
|
};
|
|
77741
77741
|
return res;
|
|
77742
77742
|
}
|
|
@@ -84311,14 +84311,14 @@ var require_streams = __commonJS({
|
|
|
84311
84311
|
"use strict";
|
|
84312
84312
|
var Buffer2 = require_safer().Buffer;
|
|
84313
84313
|
module2.exports = function(streamModule) {
|
|
84314
|
-
var
|
|
84314
|
+
var Transform2 = streamModule.Transform;
|
|
84315
84315
|
function IconvLiteEncoderStream(conv, options) {
|
|
84316
84316
|
this.conv = conv;
|
|
84317
84317
|
options = options || {};
|
|
84318
84318
|
options.decodeStrings = false;
|
|
84319
|
-
|
|
84319
|
+
Transform2.call(this, options);
|
|
84320
84320
|
}
|
|
84321
|
-
IconvLiteEncoderStream.prototype = Object.create(
|
|
84321
|
+
IconvLiteEncoderStream.prototype = Object.create(Transform2.prototype, {
|
|
84322
84322
|
constructor: { value: IconvLiteEncoderStream }
|
|
84323
84323
|
});
|
|
84324
84324
|
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
@@ -84357,9 +84357,9 @@ var require_streams = __commonJS({
|
|
|
84357
84357
|
this.conv = conv;
|
|
84358
84358
|
options = options || {};
|
|
84359
84359
|
options.encoding = this.encoding = "utf8";
|
|
84360
|
-
|
|
84360
|
+
Transform2.call(this, options);
|
|
84361
84361
|
}
|
|
84362
|
-
IconvLiteDecoderStream.prototype = Object.create(
|
|
84362
|
+
IconvLiteDecoderStream.prototype = Object.create(Transform2.prototype, {
|
|
84363
84363
|
constructor: { value: IconvLiteDecoderStream }
|
|
84364
84364
|
});
|
|
84365
84365
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
@@ -87646,6 +87646,10 @@ var ne2 = class {
|
|
|
87646
87646
|
};
|
|
87647
87647
|
|
|
87648
87648
|
// ../common/src/constants.ts
|
|
87649
|
+
var FILE_BODY_LIMIT_MB = 100;
|
|
87650
|
+
var FILE_BODY_LIMIT_BYTES = FILE_BODY_LIMIT_MB * 1024 * 1024;
|
|
87651
|
+
var GRAPHQL_BODY_LIMIT_MB = 10;
|
|
87652
|
+
var GRAPHQL_BODY_LIMIT_BYTES = GRAPHQL_BODY_LIMIT_MB * 1024 * 1024;
|
|
87649
87653
|
var DEFAULT_OLLAMA_BASE_URL = "http://localhost:11434/api";
|
|
87650
87654
|
var DEFAULT_TEMPERATURE = 1;
|
|
87651
87655
|
var AI_PROVIDER_API_URLS = {
|
|
@@ -89601,7 +89605,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
89601
89605
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
89602
89606
|
const result = { errors: [] };
|
|
89603
89607
|
const processError = (error49, path4 = []) => {
|
|
89604
|
-
var _a51,
|
|
89608
|
+
var _a51, _b40;
|
|
89605
89609
|
for (const issue2 of error49.issues) {
|
|
89606
89610
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
89607
89611
|
issue2.errors.map((issues) => processError({ issues }, issue2.path));
|
|
@@ -89626,7 +89630,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
89626
89630
|
curr = curr.properties[el];
|
|
89627
89631
|
} else {
|
|
89628
89632
|
curr.items ?? (curr.items = []);
|
|
89629
|
-
(
|
|
89633
|
+
(_b40 = curr.items)[el] ?? (_b40[el] = { errors: [] });
|
|
89630
89634
|
curr = curr.items[el];
|
|
89631
89635
|
}
|
|
89632
89636
|
if (terminal) {
|
|
@@ -90294,7 +90298,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
90294
90298
|
};
|
|
90295
90299
|
});
|
|
90296
90300
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
90297
|
-
var _a51,
|
|
90301
|
+
var _a51, _b40;
|
|
90298
90302
|
$ZodCheck.init(inst, def);
|
|
90299
90303
|
inst._zod.onattach.push((inst2) => {
|
|
90300
90304
|
const bag = inst2._zod.bag;
|
|
@@ -90320,7 +90324,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
90320
90324
|
});
|
|
90321
90325
|
});
|
|
90322
90326
|
else
|
|
90323
|
-
(
|
|
90327
|
+
(_b40 = inst._zod).check ?? (_b40.check = () => {
|
|
90324
90328
|
});
|
|
90325
90329
|
});
|
|
90326
90330
|
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
@@ -108842,7 +108846,7 @@ function shouldAttemptFallback(response, pathname) {
|
|
|
108842
108846
|
return !response || response.status >= 400 && response.status < 500 && pathname !== "/";
|
|
108843
108847
|
}
|
|
108844
108848
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
108845
|
-
var _a310,
|
|
108849
|
+
var _a310, _b310;
|
|
108846
108850
|
const issuer = new URL(serverUrl);
|
|
108847
108851
|
const protocolVersion = (_a310 = opts == null ? void 0 : opts.protocolVersion) != null ? _a310 : LATEST_PROTOCOL_VERSION;
|
|
108848
108852
|
let url2;
|
|
@@ -108850,7 +108854,7 @@ async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, o
|
|
|
108850
108854
|
url2 = new URL(opts.metadataUrl);
|
|
108851
108855
|
} else {
|
|
108852
108856
|
const wellKnownPath = buildWellKnownPath(wellKnownType, issuer.pathname);
|
|
108853
|
-
url2 = new URL(wellKnownPath, (
|
|
108857
|
+
url2 = new URL(wellKnownPath, (_b310 = opts == null ? void 0 : opts.metadataServerUrl) != null ? _b310 : issuer);
|
|
108854
108858
|
url2.search = issuer.search;
|
|
108855
108859
|
}
|
|
108856
108860
|
let response = await tryMetadataDiscovery(url2, protocolVersion, fetchFn);
|
|
@@ -109210,7 +109214,7 @@ async function registerClient(authorizationServerUrl, {
|
|
|
109210
109214
|
return OAuthClientInformationFullSchema.parse(await response.json());
|
|
109211
109215
|
}
|
|
109212
109216
|
async function auth(provider, options) {
|
|
109213
|
-
var _a310,
|
|
109217
|
+
var _a310, _b310;
|
|
109214
109218
|
try {
|
|
109215
109219
|
return await authInternal(provider, options);
|
|
109216
109220
|
} catch (error48) {
|
|
@@ -109218,7 +109222,7 @@ async function auth(provider, options) {
|
|
|
109218
109222
|
await ((_a310 = provider.invalidateCredentials) == null ? void 0 : _a310.call(provider, "all"));
|
|
109219
109223
|
return await authInternal(provider, options);
|
|
109220
109224
|
} else if (error48 instanceof InvalidGrantError) {
|
|
109221
|
-
await ((
|
|
109225
|
+
await ((_b310 = provider.invalidateCredentials) == null ? void 0 : _b310.call(provider, "tokens"));
|
|
109222
109226
|
return await authInternal(provider, options);
|
|
109223
109227
|
}
|
|
109224
109228
|
throw error48;
|
|
@@ -109389,7 +109393,7 @@ var SseMCPTransport = class {
|
|
|
109389
109393
|
}
|
|
109390
109394
|
this.abortController = new AbortController();
|
|
109391
109395
|
const establishConnection = async (triedAuth = false) => {
|
|
109392
|
-
var _a310,
|
|
109396
|
+
var _a310, _b310, _c11, _d8, _e7;
|
|
109393
109397
|
try {
|
|
109394
109398
|
const headers = await this.commonHeaders({
|
|
109395
109399
|
Accept: "text/event-stream"
|
|
@@ -109407,7 +109411,7 @@ var SseMCPTransport = class {
|
|
|
109407
109411
|
});
|
|
109408
109412
|
if (result !== "AUTHORIZED") {
|
|
109409
109413
|
const error48 = new UnauthorizedError();
|
|
109410
|
-
(
|
|
109414
|
+
(_b310 = this.onerror) == null ? void 0 : _b310.call(this, error48);
|
|
109411
109415
|
return reject(error48);
|
|
109412
109416
|
}
|
|
109413
109417
|
} catch (error48) {
|
|
@@ -109492,10 +109496,10 @@ var SseMCPTransport = class {
|
|
|
109492
109496
|
});
|
|
109493
109497
|
}
|
|
109494
109498
|
async close() {
|
|
109495
|
-
var _a310,
|
|
109499
|
+
var _a310, _b310, _c11;
|
|
109496
109500
|
this.connected = false;
|
|
109497
109501
|
(_a310 = this.sseConnection) == null ? void 0 : _a310.close();
|
|
109498
|
-
(
|
|
109502
|
+
(_b310 = this.abortController) == null ? void 0 : _b310.abort();
|
|
109499
109503
|
(_c11 = this.onclose) == null ? void 0 : _c11.call(this);
|
|
109500
109504
|
}
|
|
109501
109505
|
async send(message) {
|
|
@@ -109506,7 +109510,7 @@ var SseMCPTransport = class {
|
|
|
109506
109510
|
}
|
|
109507
109511
|
const endpoint = this.endpoint;
|
|
109508
109512
|
const attempt = async (triedAuth = false) => {
|
|
109509
|
-
var _a310,
|
|
109513
|
+
var _a310, _b310, _c11, _d8, _e7;
|
|
109510
109514
|
try {
|
|
109511
109515
|
const headers = await this.commonHeaders({
|
|
109512
109516
|
"Content-Type": "application/json"
|
|
@@ -109527,7 +109531,7 @@ var SseMCPTransport = class {
|
|
|
109527
109531
|
});
|
|
109528
109532
|
if (result !== "AUTHORIZED") {
|
|
109529
109533
|
const error48 = new UnauthorizedError();
|
|
109530
|
-
(
|
|
109534
|
+
(_b310 = this.onerror) == null ? void 0 : _b310.call(this, error48);
|
|
109531
109535
|
return;
|
|
109532
109536
|
}
|
|
109533
109537
|
} catch (error48) {
|
|
@@ -109600,7 +109604,7 @@ var HttpMCPTransport = class {
|
|
|
109600
109604
|
void this.openInboundSse();
|
|
109601
109605
|
}
|
|
109602
109606
|
async close() {
|
|
109603
|
-
var _a310,
|
|
109607
|
+
var _a310, _b310, _c11;
|
|
109604
109608
|
(_a310 = this.inboundSseConnection) == null ? void 0 : _a310.close();
|
|
109605
109609
|
try {
|
|
109606
109610
|
if (this.sessionId && this.abortController && !this.abortController.signal.aborted) {
|
|
@@ -109613,12 +109617,12 @@ var HttpMCPTransport = class {
|
|
|
109613
109617
|
}
|
|
109614
109618
|
} catch (e2) {
|
|
109615
109619
|
}
|
|
109616
|
-
(
|
|
109620
|
+
(_b310 = this.abortController) == null ? void 0 : _b310.abort();
|
|
109617
109621
|
(_c11 = this.onclose) == null ? void 0 : _c11.call(this);
|
|
109618
109622
|
}
|
|
109619
109623
|
async send(message) {
|
|
109620
109624
|
const attempt = async (triedAuth = false) => {
|
|
109621
|
-
var _a310,
|
|
109625
|
+
var _a310, _b310, _c11, _d8, _e7, _f3, _g6;
|
|
109622
109626
|
try {
|
|
109623
109627
|
const headers = await this.commonHeaders({
|
|
109624
109628
|
"Content-Type": "application/json",
|
|
@@ -109647,7 +109651,7 @@ var HttpMCPTransport = class {
|
|
|
109647
109651
|
throw error210;
|
|
109648
109652
|
}
|
|
109649
109653
|
} catch (error210) {
|
|
109650
|
-
(
|
|
109654
|
+
(_b310 = this.onerror) == null ? void 0 : _b310.call(this, error210);
|
|
109651
109655
|
throw error210;
|
|
109652
109656
|
}
|
|
109653
109657
|
return attempt(true);
|
|
@@ -109766,7 +109770,7 @@ var HttpMCPTransport = class {
|
|
|
109766
109770
|
}
|
|
109767
109771
|
// Open optional inbound SSE stream; best-effort and resumable
|
|
109768
109772
|
async openInboundSse(triedAuth = false, resumeToken) {
|
|
109769
|
-
var _a310,
|
|
109773
|
+
var _a310, _b310, _c11, _d8, _e7, _f3;
|
|
109770
109774
|
try {
|
|
109771
109775
|
const headers = await this.commonHeaders({
|
|
109772
109776
|
Accept: "text/event-stream"
|
|
@@ -109792,7 +109796,7 @@ var HttpMCPTransport = class {
|
|
|
109792
109796
|
});
|
|
109793
109797
|
if (result !== "AUTHORIZED") {
|
|
109794
109798
|
const error48 = new UnauthorizedError();
|
|
109795
|
-
(
|
|
109799
|
+
(_b310 = this.onerror) == null ? void 0 : _b310.call(this, error48);
|
|
109796
109800
|
return;
|
|
109797
109801
|
}
|
|
109798
109802
|
} catch (error48) {
|
|
@@ -110199,7 +110203,7 @@ var DefaultMCPClient = class {
|
|
|
110199
110203
|
* Creates AI SDK tools from tool definitions without fetching from the server.
|
|
110200
110204
|
*/
|
|
110201
110205
|
toolsFromDefinitions(definitions, { schemas = "automatic" } = {}) {
|
|
110202
|
-
var _a310,
|
|
110206
|
+
var _a310, _b310;
|
|
110203
110207
|
const tools = {};
|
|
110204
110208
|
for (const {
|
|
110205
110209
|
name: name34,
|
|
@@ -110229,7 +110233,7 @@ var DefaultMCPClient = class {
|
|
|
110229
110233
|
title: resolvedTitle,
|
|
110230
110234
|
inputSchema: jsonSchema({
|
|
110231
110235
|
...inputSchema,
|
|
110232
|
-
properties: (
|
|
110236
|
+
properties: (_b310 = inputSchema.properties) != null ? _b310 : {},
|
|
110233
110237
|
additionalProperties: false
|
|
110234
110238
|
}),
|
|
110235
110239
|
execute,
|
|
@@ -112846,12 +112850,12 @@ function registerGlobal(type22, instance, diag, allowOverride) {
|
|
|
112846
112850
|
return true;
|
|
112847
112851
|
}
|
|
112848
112852
|
function getGlobal(type22) {
|
|
112849
|
-
var _a51,
|
|
112853
|
+
var _a51, _b40;
|
|
112850
112854
|
var globalVersion = (_a51 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a51 === void 0 ? void 0 : _a51.version;
|
|
112851
112855
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
112852
112856
|
return;
|
|
112853
112857
|
}
|
|
112854
|
-
return (
|
|
112858
|
+
return (_b40 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b40 === void 0 ? void 0 : _b40[type22];
|
|
112855
112859
|
}
|
|
112856
112860
|
function unregisterGlobal(type22, diag) {
|
|
112857
112861
|
diag.debug("@opentelemetry/api: Unregistering a global for " + type22 + " v" + VERSION4 + ".");
|
|
@@ -113024,7 +113028,7 @@ var DiagAPI = (
|
|
|
113024
113028
|
}
|
|
113025
113029
|
var self2 = this;
|
|
113026
113030
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
113027
|
-
var _a51,
|
|
113031
|
+
var _a51, _b40, _c11;
|
|
113028
113032
|
if (optionsOrLogLevel === void 0) {
|
|
113029
113033
|
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
113030
113034
|
}
|
|
@@ -113039,7 +113043,7 @@ var DiagAPI = (
|
|
|
113039
113043
|
};
|
|
113040
113044
|
}
|
|
113041
113045
|
var oldLogger = getGlobal("diag");
|
|
113042
|
-
var newLogger = createLogLevelDiagLogger((
|
|
113046
|
+
var newLogger = createLogLevelDiagLogger((_b40 = optionsOrLogLevel.logLevel) !== null && _b40 !== void 0 ? _b40 : DiagLogLevel.INFO, logger);
|
|
113043
113047
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
113044
113048
|
var stack = (_c11 = new Error().stack) !== null && _c11 !== void 0 ? _c11 : "<failed to generate stacktrace>";
|
|
113045
113049
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -114174,8 +114178,8 @@ var dataContentSchema = external_exports.union([
|
|
|
114174
114178
|
external_exports.custom(
|
|
114175
114179
|
// Buffer might not be available in some environments such as CloudFlare:
|
|
114176
114180
|
(value) => {
|
|
114177
|
-
var _a212,
|
|
114178
|
-
return (
|
|
114181
|
+
var _a212, _b40;
|
|
114182
|
+
return (_b40 = (_a212 = globalThis.Buffer) == null ? void 0 : _a212.isBuffer(value)) != null ? _b40 : false;
|
|
114179
114183
|
},
|
|
114180
114184
|
{ message: "Must be a Buffer" }
|
|
114181
114185
|
)
|
|
@@ -115261,13 +115265,13 @@ function createNullLanguageModelUsage() {
|
|
|
115261
115265
|
};
|
|
115262
115266
|
}
|
|
115263
115267
|
function addLanguageModelUsage(usage1, usage2) {
|
|
115264
|
-
var _a212,
|
|
115268
|
+
var _a212, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2;
|
|
115265
115269
|
return {
|
|
115266
115270
|
inputTokens: addTokenCounts(usage1.inputTokens, usage2.inputTokens),
|
|
115267
115271
|
inputTokenDetails: {
|
|
115268
115272
|
noCacheTokens: addTokenCounts(
|
|
115269
115273
|
(_a212 = usage1.inputTokenDetails) == null ? void 0 : _a212.noCacheTokens,
|
|
115270
|
-
(
|
|
115274
|
+
(_b40 = usage2.inputTokenDetails) == null ? void 0 : _b40.noCacheTokens
|
|
115271
115275
|
),
|
|
115272
115276
|
cacheReadTokens: addTokenCounts(
|
|
115273
115277
|
(_c11 = usage1.inputTokenDetails) == null ? void 0 : _c11.cacheReadTokens,
|
|
@@ -115531,8 +115535,8 @@ function collectToolApprovals({
|
|
|
115531
115535
|
return { approvedToolApprovals, deniedToolApprovals };
|
|
115532
115536
|
}
|
|
115533
115537
|
function now() {
|
|
115534
|
-
var _a212,
|
|
115535
|
-
return (
|
|
115538
|
+
var _a212, _b40;
|
|
115539
|
+
return (_b40 = (_a212 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a212.now()) != null ? _b40 : Date.now();
|
|
115536
115540
|
}
|
|
115537
115541
|
async function executeToolCall({
|
|
115538
115542
|
toolCall,
|
|
@@ -116855,7 +116859,7 @@ async function generateText({
|
|
|
116855
116859
|
}),
|
|
116856
116860
|
tracer,
|
|
116857
116861
|
fn: async (span) => {
|
|
116858
|
-
var _a212,
|
|
116862
|
+
var _a212, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m;
|
|
116859
116863
|
const initialMessages = initialPrompt.messages;
|
|
116860
116864
|
const responseMessages = [];
|
|
116861
116865
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -116962,7 +116966,7 @@ async function generateText({
|
|
|
116962
116966
|
};
|
|
116963
116967
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
116964
116968
|
prompt: {
|
|
116965
|
-
system: (
|
|
116969
|
+
system: (_b40 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b40 : initialPrompt.system,
|
|
116966
116970
|
messages: (_c11 = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _c11 : stepInputMessages
|
|
116967
116971
|
},
|
|
116968
116972
|
supportedUrls: await stepModel.supportedUrls,
|
|
@@ -117917,7 +117921,7 @@ function processUIMessageStream({
|
|
|
117917
117921
|
new TransformStream({
|
|
117918
117922
|
async transform(chunk, controller) {
|
|
117919
117923
|
await runUpdateMessageJob(async ({ state, write }) => {
|
|
117920
|
-
var _a212,
|
|
117924
|
+
var _a212, _b40, _c11, _d8;
|
|
117921
117925
|
function getToolInvocation(toolCallId) {
|
|
117922
117926
|
const toolInvocations = state.message.parts.filter(isToolUIPart);
|
|
117923
117927
|
const toolInvocation = toolInvocations.find(
|
|
@@ -118060,7 +118064,7 @@ function processUIMessageStream({
|
|
|
118060
118064
|
});
|
|
118061
118065
|
}
|
|
118062
118066
|
textPart.state = "done";
|
|
118063
|
-
textPart.providerMetadata = (
|
|
118067
|
+
textPart.providerMetadata = (_b40 = chunk.providerMetadata) != null ? _b40 : textPart.providerMetadata;
|
|
118064
118068
|
delete state.activeTextParts[chunk.id];
|
|
118065
118069
|
write();
|
|
118066
118070
|
break;
|
|
@@ -119170,7 +119174,7 @@ var DefaultStreamTextResult = class {
|
|
|
119170
119174
|
let activeReasoningContent = {};
|
|
119171
119175
|
const eventProcessor = new TransformStream({
|
|
119172
119176
|
async transform(chunk, controller) {
|
|
119173
|
-
var _a212,
|
|
119177
|
+
var _a212, _b40, _c11, _d8;
|
|
119174
119178
|
controller.enqueue(chunk);
|
|
119175
119179
|
const { part } = chunk;
|
|
119176
119180
|
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") {
|
|
@@ -119214,7 +119218,7 @@ var DefaultStreamTextResult = class {
|
|
|
119214
119218
|
});
|
|
119215
119219
|
return;
|
|
119216
119220
|
}
|
|
119217
|
-
activeText.providerMetadata = (
|
|
119221
|
+
activeText.providerMetadata = (_b40 = part.providerMetadata) != null ? _b40 : activeText.providerMetadata;
|
|
119218
119222
|
delete activeTextContent[part.id];
|
|
119219
119223
|
}
|
|
119220
119224
|
if (part.type === "reasoning-start") {
|
|
@@ -119641,7 +119645,7 @@ var DefaultStreamTextResult = class {
|
|
|
119641
119645
|
responseMessages,
|
|
119642
119646
|
usage
|
|
119643
119647
|
}) {
|
|
119644
|
-
var _a212,
|
|
119648
|
+
var _a212, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i;
|
|
119645
119649
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
119646
119650
|
const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
|
|
119647
119651
|
let chunkTimeoutId = void 0;
|
|
@@ -119686,7 +119690,7 @@ var DefaultStreamTextResult = class {
|
|
|
119686
119690
|
};
|
|
119687
119691
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
119688
119692
|
prompt: {
|
|
119689
|
-
system: (
|
|
119693
|
+
system: (_b40 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b40 : initialPrompt.system,
|
|
119690
119694
|
messages: (_c11 = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _c11 : stepInputMessages
|
|
119691
119695
|
},
|
|
119692
119696
|
supportedUrls: await stepModel.supportedUrls,
|
|
@@ -120276,11 +120280,11 @@ var DefaultStreamTextResult = class {
|
|
|
120276
120280
|
);
|
|
120277
120281
|
}
|
|
120278
120282
|
get elementStream() {
|
|
120279
|
-
var _a212,
|
|
120283
|
+
var _a212, _b40, _c11;
|
|
120280
120284
|
const transform2 = (_a212 = this.outputSpecification) == null ? void 0 : _a212.createElementStreamTransform();
|
|
120281
120285
|
if (transform2 == null) {
|
|
120282
120286
|
throw new UnsupportedFunctionalityError({
|
|
120283
|
-
functionality: `element streams in ${(_c11 = (
|
|
120287
|
+
functionality: `element streams in ${(_c11 = (_b40 = this.outputSpecification) == null ? void 0 : _b40.name) != null ? _c11 : "text"} mode`
|
|
120284
120288
|
});
|
|
120285
120289
|
}
|
|
120286
120290
|
return createAsyncIterableStream(this.teeStream().pipeThrough(transform2));
|
|
@@ -120941,7 +120945,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
120941
120945
|
};
|
|
120942
120946
|
}
|
|
120943
120947
|
function convertOpenAIChatUsage(usage) {
|
|
120944
|
-
var _a51,
|
|
120948
|
+
var _a51, _b40, _c11, _d8, _e7, _f3;
|
|
120945
120949
|
if (usage == null) {
|
|
120946
120950
|
return {
|
|
120947
120951
|
inputTokens: {
|
|
@@ -120959,7 +120963,7 @@ function convertOpenAIChatUsage(usage) {
|
|
|
120959
120963
|
};
|
|
120960
120964
|
}
|
|
120961
120965
|
const promptTokens = (_a51 = usage.prompt_tokens) != null ? _a51 : 0;
|
|
120962
|
-
const completionTokens = (
|
|
120966
|
+
const completionTokens = (_b40 = usage.completion_tokens) != null ? _b40 : 0;
|
|
120963
120967
|
const cachedTokens = (_d8 = (_c11 = usage.prompt_tokens_details) == null ? void 0 : _c11.cached_tokens) != null ? _d8 : 0;
|
|
120964
120968
|
const reasoningTokens = (_f3 = (_e7 = usage.completion_tokens_details) == null ? void 0 : _e7.reasoning_tokens) != null ? _f3 : 0;
|
|
120965
120969
|
return {
|
|
@@ -121020,7 +121024,7 @@ function convertToOpenAIChatMessages({
|
|
|
121020
121024
|
messages.push({
|
|
121021
121025
|
role: "user",
|
|
121022
121026
|
content: content.map((part, index) => {
|
|
121023
|
-
var _a210,
|
|
121027
|
+
var _a210, _b40, _c11;
|
|
121024
121028
|
switch (part.type) {
|
|
121025
121029
|
case "text": {
|
|
121026
121030
|
return { type: "text", text: part.text };
|
|
@@ -121033,7 +121037,7 @@ function convertToOpenAIChatMessages({
|
|
|
121033
121037
|
image_url: {
|
|
121034
121038
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
|
|
121035
121039
|
// OpenAI specific extension: image detail
|
|
121036
|
-
detail: (
|
|
121040
|
+
detail: (_b40 = (_a210 = part.providerOptions) == null ? void 0 : _a210.openai) == null ? void 0 : _b40.imageDetail
|
|
121037
121041
|
}
|
|
121038
121042
|
};
|
|
121039
121043
|
} else if (part.mediaType.startsWith("audio/")) {
|
|
@@ -121523,7 +121527,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121523
121527
|
toolChoice,
|
|
121524
121528
|
providerOptions
|
|
121525
121529
|
}) {
|
|
121526
|
-
var _a51,
|
|
121530
|
+
var _a51, _b40, _c11, _d8, _e7;
|
|
121527
121531
|
const warnings = [];
|
|
121528
121532
|
const openaiOptions = (_a51 = await parseProviderOptions({
|
|
121529
121533
|
provider: "openai",
|
|
@@ -121531,7 +121535,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121531
121535
|
schema: openaiLanguageModelChatOptions
|
|
121532
121536
|
})) != null ? _a51 : {};
|
|
121533
121537
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
121534
|
-
const isReasoningModel = (
|
|
121538
|
+
const isReasoningModel = (_b40 = openaiOptions.forceReasoning) != null ? _b40 : modelCapabilities.isReasoningModel;
|
|
121535
121539
|
if (topK != null) {
|
|
121536
121540
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
121537
121541
|
}
|
|
@@ -121690,7 +121694,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121690
121694
|
};
|
|
121691
121695
|
}
|
|
121692
121696
|
async doGenerate(options) {
|
|
121693
|
-
var _a51,
|
|
121697
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6;
|
|
121694
121698
|
const { args: body, warnings } = await this.getArgs(options);
|
|
121695
121699
|
const {
|
|
121696
121700
|
responseHeaders,
|
|
@@ -121719,7 +121723,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121719
121723
|
for (const toolCall of (_a51 = choice2.message.tool_calls) != null ? _a51 : []) {
|
|
121720
121724
|
content.push({
|
|
121721
121725
|
type: "tool-call",
|
|
121722
|
-
toolCallId: (
|
|
121726
|
+
toolCallId: (_b40 = toolCall.id) != null ? _b40 : generateId(),
|
|
121723
121727
|
toolName: toolCall.function.name,
|
|
121724
121728
|
input: toolCall.function.arguments
|
|
121725
121729
|
});
|
|
@@ -121801,7 +121805,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121801
121805
|
controller.enqueue({ type: "stream-start", warnings });
|
|
121802
121806
|
},
|
|
121803
121807
|
transform(chunk, controller) {
|
|
121804
|
-
var _a51,
|
|
121808
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m, _n, _o2, _p2, _q2;
|
|
121805
121809
|
if (options.includeRawChunks) {
|
|
121806
121810
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
121807
121811
|
}
|
|
@@ -121829,7 +121833,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121829
121833
|
if (value.usage != null) {
|
|
121830
121834
|
usage = value.usage;
|
|
121831
121835
|
if (((_a51 = value.usage.completion_tokens_details) == null ? void 0 : _a51.accepted_prediction_tokens) != null) {
|
|
121832
|
-
providerMetadata.openai.acceptedPredictionTokens = (
|
|
121836
|
+
providerMetadata.openai.acceptedPredictionTokens = (_b40 = value.usage.completion_tokens_details) == null ? void 0 : _b40.accepted_prediction_tokens;
|
|
121833
121837
|
}
|
|
121834
121838
|
if (((_c11 = value.usage.completion_tokens_details) == null ? void 0 : _c11.rejected_prediction_tokens) != null) {
|
|
121835
121839
|
providerMetadata.openai.rejectedPredictionTokens = (_d8 = value.usage.completion_tokens_details) == null ? void 0 : _d8.rejected_prediction_tokens;
|
|
@@ -121979,7 +121983,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121979
121983
|
}
|
|
121980
121984
|
};
|
|
121981
121985
|
function convertOpenAICompletionUsage(usage) {
|
|
121982
|
-
var _a51,
|
|
121986
|
+
var _a51, _b40, _c11, _d8;
|
|
121983
121987
|
if (usage == null) {
|
|
121984
121988
|
return {
|
|
121985
121989
|
inputTokens: {
|
|
@@ -121997,7 +122001,7 @@ function convertOpenAICompletionUsage(usage) {
|
|
|
121997
122001
|
};
|
|
121998
122002
|
}
|
|
121999
122003
|
const promptTokens = (_a51 = usage.prompt_tokens) != null ? _a51 : 0;
|
|
122000
|
-
const completionTokens = (
|
|
122004
|
+
const completionTokens = (_b40 = usage.completion_tokens) != null ? _b40 : 0;
|
|
122001
122005
|
return {
|
|
122002
122006
|
inputTokens: {
|
|
122003
122007
|
total: (_c11 = usage.prompt_tokens) != null ? _c11 : void 0,
|
|
@@ -122593,7 +122597,7 @@ var OpenAIImageModel = class {
|
|
|
122593
122597
|
headers,
|
|
122594
122598
|
abortSignal
|
|
122595
122599
|
}) {
|
|
122596
|
-
var _a51,
|
|
122600
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3;
|
|
122597
122601
|
const warnings = [];
|
|
122598
122602
|
if (aspectRatio != null) {
|
|
122599
122603
|
warnings.push({
|
|
@@ -122605,7 +122609,7 @@ var OpenAIImageModel = class {
|
|
|
122605
122609
|
if (seed != null) {
|
|
122606
122610
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
122607
122611
|
}
|
|
122608
|
-
const currentDate = (_c11 = (
|
|
122612
|
+
const currentDate = (_c11 = (_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : /* @__PURE__ */ new Date();
|
|
122609
122613
|
if (files != null) {
|
|
122610
122614
|
const { value: response2, responseHeaders: responseHeaders2 } = await postFormDataToApi({
|
|
122611
122615
|
url: this.config.url({
|
|
@@ -123311,7 +123315,7 @@ var openaiTools = {
|
|
|
123311
123315
|
mcp
|
|
123312
123316
|
};
|
|
123313
123317
|
function convertOpenAIResponsesUsage(usage) {
|
|
123314
|
-
var _a51,
|
|
123318
|
+
var _a51, _b40, _c11, _d8;
|
|
123315
123319
|
if (usage == null) {
|
|
123316
123320
|
return {
|
|
123317
123321
|
inputTokens: {
|
|
@@ -123330,7 +123334,7 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
123330
123334
|
}
|
|
123331
123335
|
const inputTokens = usage.input_tokens;
|
|
123332
123336
|
const outputTokens = usage.output_tokens;
|
|
123333
|
-
const cachedTokens = (
|
|
123337
|
+
const cachedTokens = (_b40 = (_a51 = usage.input_tokens_details) == null ? void 0 : _a51.cached_tokens) != null ? _b40 : 0;
|
|
123334
123338
|
const reasoningTokens = (_d8 = (_c11 = usage.output_tokens_details) == null ? void 0 : _c11.reasoning_tokens) != null ? _d8 : 0;
|
|
123335
123339
|
return {
|
|
123336
123340
|
inputTokens: {
|
|
@@ -123364,7 +123368,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
123364
123368
|
hasApplyPatchTool = false,
|
|
123365
123369
|
customProviderToolNames
|
|
123366
123370
|
}) {
|
|
123367
|
-
var _a51,
|
|
123371
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m;
|
|
123368
123372
|
const input = [];
|
|
123369
123373
|
const warnings = [];
|
|
123370
123374
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -123464,7 +123468,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
123464
123468
|
break;
|
|
123465
123469
|
}
|
|
123466
123470
|
case "tool-call": {
|
|
123467
|
-
const id = (_f3 = (_c11 = (
|
|
123471
|
+
const id = (_f3 = (_c11 = (_b40 = part.providerOptions) == null ? void 0 : _b40[providerOptionsName]) == null ? void 0 : _c11.itemId) != null ? _f3 : (_e7 = (_d8 = part.providerMetadata) == null ? void 0 : _d8[providerOptionsName]) == null ? void 0 : _e7.itemId;
|
|
123468
123472
|
if (hasConversation && id != null) {
|
|
123469
123473
|
break;
|
|
123470
123474
|
}
|
|
@@ -125115,13 +125119,13 @@ function mapShellSkills(skills) {
|
|
|
125115
125119
|
);
|
|
125116
125120
|
}
|
|
125117
125121
|
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
125118
|
-
var _a51,
|
|
125122
|
+
var _a51, _b40;
|
|
125119
125123
|
const mapping = {};
|
|
125120
125124
|
for (const message of prompt) {
|
|
125121
125125
|
if (message.role !== "assistant") continue;
|
|
125122
125126
|
for (const part of message.content) {
|
|
125123
125127
|
if (part.type !== "tool-call") continue;
|
|
125124
|
-
const approvalRequestId = (
|
|
125128
|
+
const approvalRequestId = (_b40 = (_a51 = part.providerOptions) == null ? void 0 : _a51.openai) == null ? void 0 : _b40.approvalRequestId;
|
|
125125
125129
|
if (approvalRequestId != null) {
|
|
125126
125130
|
mapping[approvalRequestId] = part.toolCallId;
|
|
125127
125131
|
}
|
|
@@ -125157,7 +125161,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125157
125161
|
toolChoice,
|
|
125158
125162
|
responseFormat
|
|
125159
125163
|
}) {
|
|
125160
|
-
var _a51,
|
|
125164
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i;
|
|
125161
125165
|
const warnings = [];
|
|
125162
125166
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
125163
125167
|
if (topK != null) {
|
|
@@ -125225,7 +125229,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125225
125229
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
125226
125230
|
prompt,
|
|
125227
125231
|
toolNameMapping,
|
|
125228
|
-
systemMessageMode: (
|
|
125232
|
+
systemMessageMode: (_b40 = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _b40 : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
125229
125233
|
providerOptionsName,
|
|
125230
125234
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
125231
125235
|
store: (_c11 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _c11 : true,
|
|
@@ -125385,7 +125389,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125385
125389
|
};
|
|
125386
125390
|
}
|
|
125387
125391
|
async doGenerate(options) {
|
|
125388
|
-
var _a51,
|
|
125392
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m, _n, _o2, _p2, _q2, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
125389
125393
|
const {
|
|
125390
125394
|
args: body,
|
|
125391
125395
|
warnings,
|
|
@@ -125521,7 +125525,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125521
125525
|
}
|
|
125522
125526
|
case "message": {
|
|
125523
125527
|
for (const contentPart of part.content) {
|
|
125524
|
-
if (((_c11 = (
|
|
125528
|
+
if (((_c11 = (_b40 = options.providerOptions) == null ? void 0 : _b40[providerOptionsName]) == null ? void 0 : _c11.logprobs) && contentPart.logprobs) {
|
|
125525
125529
|
logprobs.push(contentPart.logprobs);
|
|
125526
125530
|
}
|
|
125527
125531
|
const providerMetadata2 = {
|
|
@@ -125687,7 +125691,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125687
125691
|
}
|
|
125688
125692
|
case "mcp_approval_request": {
|
|
125689
125693
|
const approvalRequestId = (_q2 = part.approval_request_id) != null ? _q2 : part.id;
|
|
125690
|
-
const dummyToolCallId = (_t = (_s = (
|
|
125694
|
+
const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId();
|
|
125691
125695
|
const toolName = `mcp.${part.name}`;
|
|
125692
125696
|
content.push({
|
|
125693
125697
|
type: "tool-call",
|
|
@@ -125868,7 +125872,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125868
125872
|
controller.enqueue({ type: "stream-start", warnings });
|
|
125869
125873
|
},
|
|
125870
125874
|
transform(chunk, controller) {
|
|
125871
|
-
var _a51,
|
|
125875
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m, _n, _o2, _p2, _q2, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
125872
125876
|
if (options.includeRawChunks) {
|
|
125873
125877
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
125874
125878
|
}
|
|
@@ -126046,7 +126050,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
126046
126050
|
providerMetadata: {
|
|
126047
126051
|
[providerOptionsName]: {
|
|
126048
126052
|
itemId: value.item.id,
|
|
126049
|
-
reasoningEncryptedContent: (
|
|
126053
|
+
reasoningEncryptedContent: (_b40 = value.item.encrypted_content) != null ? _b40 : null
|
|
126050
126054
|
}
|
|
126051
126055
|
}
|
|
126052
126056
|
});
|
|
@@ -126516,7 +126520,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
126516
126520
|
} else if (isResponseFinishedChunk(value)) {
|
|
126517
126521
|
finishReason = {
|
|
126518
126522
|
unified: mapOpenAIResponseFinishReason({
|
|
126519
|
-
finishReason: (
|
|
126523
|
+
finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
|
|
126520
126524
|
hasFunctionCall
|
|
126521
126525
|
}),
|
|
126522
126526
|
raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
|
|
@@ -126752,8 +126756,8 @@ var OpenAISpeechModel = class {
|
|
|
126752
126756
|
};
|
|
126753
126757
|
}
|
|
126754
126758
|
async doGenerate(options) {
|
|
126755
|
-
var _a51,
|
|
126756
|
-
const currentDate = (_c11 = (
|
|
126759
|
+
var _a51, _b40, _c11;
|
|
126760
|
+
const currentDate = (_c11 = (_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : /* @__PURE__ */ new Date();
|
|
126757
126761
|
const { requestBody, warnings } = await this.getArgs(options);
|
|
126758
126762
|
const {
|
|
126759
126763
|
value: audio,
|
|
@@ -126964,8 +126968,8 @@ var OpenAITranscriptionModel = class {
|
|
|
126964
126968
|
};
|
|
126965
126969
|
}
|
|
126966
126970
|
async doGenerate(options) {
|
|
126967
|
-
var _a51,
|
|
126968
|
-
const currentDate = (_c11 = (
|
|
126971
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2;
|
|
126972
|
+
const currentDate = (_c11 = (_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : /* @__PURE__ */ new Date();
|
|
126969
126973
|
const { formData, warnings } = await this.getArgs(options);
|
|
126970
126974
|
const {
|
|
126971
126975
|
value: response,
|
|
@@ -127011,14 +127015,14 @@ var OpenAITranscriptionModel = class {
|
|
|
127011
127015
|
};
|
|
127012
127016
|
var VERSION6 = true ? "3.0.39" : "0.0.0-test";
|
|
127013
127017
|
function createOpenAI(options = {}) {
|
|
127014
|
-
var _a51,
|
|
127018
|
+
var _a51, _b40;
|
|
127015
127019
|
const baseURL = (_a51 = withoutTrailingSlash(
|
|
127016
127020
|
loadOptionalSetting({
|
|
127017
127021
|
settingValue: options.baseURL,
|
|
127018
127022
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
127019
127023
|
})
|
|
127020
127024
|
)) != null ? _a51 : "https://api.openai.com/v1";
|
|
127021
|
-
const providerName = (
|
|
127025
|
+
const providerName = (_b40 = options.name) != null ? _b40 : "openai";
|
|
127022
127026
|
const getHeaders = () => withUserAgentSuffix(
|
|
127023
127027
|
{
|
|
127024
127028
|
Authorization: `Bearer ${loadApiKey({
|
|
@@ -128453,9 +128457,9 @@ function convertAnthropicMessagesUsage({
|
|
|
128453
128457
|
usage,
|
|
128454
128458
|
rawUsage
|
|
128455
128459
|
}) {
|
|
128456
|
-
var _a51,
|
|
128460
|
+
var _a51, _b40;
|
|
128457
128461
|
const cacheCreationTokens = (_a51 = usage.cache_creation_input_tokens) != null ? _a51 : 0;
|
|
128458
|
-
const cacheReadTokens = (
|
|
128462
|
+
const cacheReadTokens = (_b40 = usage.cache_read_input_tokens) != null ? _b40 : 0;
|
|
128459
128463
|
let inputTokens;
|
|
128460
128464
|
let outputTokens;
|
|
128461
128465
|
if (usage.iterations && usage.iterations.length > 0) {
|
|
@@ -128695,7 +128699,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128695
128699
|
cacheControlValidator,
|
|
128696
128700
|
toolNameMapping
|
|
128697
128701
|
}) {
|
|
128698
|
-
var _a51,
|
|
128702
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m, _n, _o2, _p2, _q2, _r;
|
|
128699
128703
|
const betas = /* @__PURE__ */ new Set();
|
|
128700
128704
|
const blocks = groupIntoBlocks(prompt);
|
|
128701
128705
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -128799,7 +128803,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128799
128803
|
media_type: "application/pdf",
|
|
128800
128804
|
data: convertToBase64(part.data)
|
|
128801
128805
|
},
|
|
128802
|
-
title: (
|
|
128806
|
+
title: (_b40 = metadata.title) != null ? _b40 : part.filename,
|
|
128803
128807
|
...metadata.context && { context: metadata.context },
|
|
128804
128808
|
...enableCitations && {
|
|
128805
128809
|
citations: { enabled: true }
|
|
@@ -129290,7 +129294,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
129290
129294
|
tool_use_id: part.toolCallId,
|
|
129291
129295
|
content: {
|
|
129292
129296
|
type: "web_fetch_tool_result_error",
|
|
129293
|
-
error_code: (
|
|
129297
|
+
error_code: (_r = errorValue.errorCode) != null ? _r : "unknown"
|
|
129294
129298
|
},
|
|
129295
129299
|
cache_control: cacheControl
|
|
129296
129300
|
});
|
|
@@ -129543,8 +129547,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129543
129547
|
return dotIndex === -1 ? provider : provider.substring(0, dotIndex);
|
|
129544
129548
|
}
|
|
129545
129549
|
get supportedUrls() {
|
|
129546
|
-
var _a51,
|
|
129547
|
-
return (_c11 = (
|
|
129550
|
+
var _a51, _b40, _c11;
|
|
129551
|
+
return (_c11 = (_b40 = (_a51 = this.config).supportedUrls) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : {};
|
|
129548
129552
|
}
|
|
129549
129553
|
async getArgs({
|
|
129550
129554
|
userSuppliedBetas,
|
|
@@ -129563,7 +129567,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129563
129567
|
providerOptions,
|
|
129564
129568
|
stream
|
|
129565
129569
|
}) {
|
|
129566
|
-
var _a51,
|
|
129570
|
+
var _a51, _b40, _c11, _d8, _e7, _f3;
|
|
129567
129571
|
const warnings = [];
|
|
129568
129572
|
if (frequencyPenalty != null) {
|
|
129569
129573
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -129621,7 +129625,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129621
129625
|
isKnownModel
|
|
129622
129626
|
} = getModelCapabilities(this.modelId);
|
|
129623
129627
|
const supportsStructuredOutput = ((_a51 = this.config.supportsNativeStructuredOutput) != null ? _a51 : true) && modelSupportsStructuredOutput;
|
|
129624
|
-
const structureOutputMode = (
|
|
129628
|
+
const structureOutputMode = (_b40 = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b40 : "auto";
|
|
129625
129629
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
129626
129630
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
129627
129631
|
type: "function",
|
|
@@ -129919,10 +129923,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129919
129923
|
);
|
|
129920
129924
|
}
|
|
129921
129925
|
async getBetasFromHeaders(requestHeaders) {
|
|
129922
|
-
var _a51,
|
|
129926
|
+
var _a51, _b40;
|
|
129923
129927
|
const configHeaders = await resolve2(this.config.headers);
|
|
129924
129928
|
const configBetaHeader = (_a51 = configHeaders["anthropic-beta"]) != null ? _a51 : "";
|
|
129925
|
-
const requestBetaHeader = (
|
|
129929
|
+
const requestBetaHeader = (_b40 = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b40 : "";
|
|
129926
129930
|
return new Set(
|
|
129927
129931
|
[
|
|
129928
129932
|
...configBetaHeader.toLowerCase().split(","),
|
|
@@ -129931,16 +129935,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129931
129935
|
);
|
|
129932
129936
|
}
|
|
129933
129937
|
buildRequestUrl(isStreaming) {
|
|
129934
|
-
var _a51,
|
|
129935
|
-
return (_c11 = (
|
|
129938
|
+
var _a51, _b40, _c11;
|
|
129939
|
+
return (_c11 = (_b40 = (_a51 = this.config).buildRequestUrl) == null ? void 0 : _b40.call(_a51, this.config.baseURL, isStreaming)) != null ? _c11 : `${this.config.baseURL}/messages`;
|
|
129936
129940
|
}
|
|
129937
129941
|
transformRequestBody(args) {
|
|
129938
|
-
var _a51,
|
|
129939
|
-
return (_c11 = (
|
|
129942
|
+
var _a51, _b40, _c11;
|
|
129943
|
+
return (_c11 = (_b40 = (_a51 = this.config).transformRequestBody) == null ? void 0 : _b40.call(_a51, args)) != null ? _c11 : args;
|
|
129940
129944
|
}
|
|
129941
129945
|
extractCitationDocuments(prompt) {
|
|
129942
129946
|
const isCitationPart = (part) => {
|
|
129943
|
-
var _a51,
|
|
129947
|
+
var _a51, _b40;
|
|
129944
129948
|
if (part.type !== "file") {
|
|
129945
129949
|
return false;
|
|
129946
129950
|
}
|
|
@@ -129949,7 +129953,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129949
129953
|
}
|
|
129950
129954
|
const anthropic2 = (_a51 = part.providerOptions) == null ? void 0 : _a51.anthropic;
|
|
129951
129955
|
const citationsConfig = anthropic2 == null ? void 0 : anthropic2.citations;
|
|
129952
|
-
return (
|
|
129956
|
+
return (_b40 = citationsConfig == null ? void 0 : citationsConfig.enabled) != null ? _b40 : false;
|
|
129953
129957
|
};
|
|
129954
129958
|
return prompt.filter((message) => message.role === "user").flatMap((message) => message.content).filter(isCitationPart).map((part) => {
|
|
129955
129959
|
var _a51;
|
|
@@ -129962,7 +129966,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129962
129966
|
});
|
|
129963
129967
|
}
|
|
129964
129968
|
async doGenerate(options) {
|
|
129965
|
-
var _a51,
|
|
129969
|
+
var _a51, _b40, _c11, _d8, _e7, _f3;
|
|
129966
129970
|
const {
|
|
129967
129971
|
args,
|
|
129968
129972
|
warnings,
|
|
@@ -130210,7 +130214,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130210
130214
|
title: result.title,
|
|
130211
130215
|
providerMetadata: {
|
|
130212
130216
|
anthropic: {
|
|
130213
|
-
pageAge: (
|
|
130217
|
+
pageAge: (_b40 = result.page_age) != null ? _b40 : null
|
|
130214
130218
|
}
|
|
130215
130219
|
}
|
|
130216
130220
|
});
|
|
@@ -130366,7 +130370,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130366
130370
|
};
|
|
130367
130371
|
}
|
|
130368
130372
|
async doStream(options) {
|
|
130369
|
-
var _a51,
|
|
130373
|
+
var _a51, _b40;
|
|
130370
130374
|
const {
|
|
130371
130375
|
args: body,
|
|
130372
130376
|
warnings,
|
|
@@ -131095,7 +131099,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
131095
131099
|
if (((_a51 = result.value) == null ? void 0 : _a51.type) === "raw") {
|
|
131096
131100
|
result = await firstChunkReader.read();
|
|
131097
131101
|
}
|
|
131098
|
-
if (((
|
|
131102
|
+
if (((_b40 = result.value) == null ? void 0 : _b40.type) === "error") {
|
|
131099
131103
|
const error48 = result.value.error;
|
|
131100
131104
|
throw new APICallError({
|
|
131101
131105
|
message: error48.message,
|
|
@@ -131724,14 +131728,14 @@ var anthropicTools = {
|
|
|
131724
131728
|
toolSearchBm25_20251119
|
|
131725
131729
|
};
|
|
131726
131730
|
function createAnthropic(options = {}) {
|
|
131727
|
-
var _a51,
|
|
131731
|
+
var _a51, _b40;
|
|
131728
131732
|
const baseURL = (_a51 = withoutTrailingSlash(
|
|
131729
131733
|
loadOptionalSetting({
|
|
131730
131734
|
settingValue: options.baseURL,
|
|
131731
131735
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
131732
131736
|
})
|
|
131733
131737
|
)) != null ? _a51 : "https://api.anthropic.com/v1";
|
|
131734
|
-
const providerName = (
|
|
131738
|
+
const providerName = (_b40 = options.name) != null ? _b40 : "anthropic.messages";
|
|
131735
131739
|
if (options.apiKey && options.authToken) {
|
|
131736
131740
|
throw new InvalidArgumentError({
|
|
131737
131741
|
argument: "apiKey/authToken",
|
|
@@ -131952,7 +131956,7 @@ var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema(
|
|
|
131952
131956
|
)
|
|
131953
131957
|
);
|
|
131954
131958
|
function convertGoogleGenerativeAIUsage(usage) {
|
|
131955
|
-
var _a51,
|
|
131959
|
+
var _a51, _b40, _c11, _d8;
|
|
131956
131960
|
if (usage == null) {
|
|
131957
131961
|
return {
|
|
131958
131962
|
inputTokens: {
|
|
@@ -131970,7 +131974,7 @@ function convertGoogleGenerativeAIUsage(usage) {
|
|
|
131970
131974
|
};
|
|
131971
131975
|
}
|
|
131972
131976
|
const promptTokens = (_a51 = usage.promptTokenCount) != null ? _a51 : 0;
|
|
131973
|
-
const candidatesTokens = (
|
|
131977
|
+
const candidatesTokens = (_b40 = usage.candidatesTokenCount) != null ? _b40 : 0;
|
|
131974
131978
|
const cachedContentTokens = (_c11 = usage.cachedContentTokenCount) != null ? _c11 : 0;
|
|
131975
131979
|
const thoughtsTokens = (_d8 = usage.thoughtsTokenCount) != null ? _d8 : 0;
|
|
131976
131980
|
return {
|
|
@@ -132103,12 +132107,12 @@ function isEmptyObjectSchema(jsonSchema2) {
|
|
|
132103
132107
|
return jsonSchema2 != null && typeof jsonSchema2 === "object" && jsonSchema2.type === "object" && (jsonSchema2.properties == null || Object.keys(jsonSchema2.properties).length === 0) && !jsonSchema2.additionalProperties;
|
|
132104
132108
|
}
|
|
132105
132109
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
132106
|
-
var _a51,
|
|
132110
|
+
var _a51, _b40, _c11;
|
|
132107
132111
|
const systemInstructionParts = [];
|
|
132108
132112
|
const contents = [];
|
|
132109
132113
|
let systemMessagesAllowed = true;
|
|
132110
132114
|
const isGemmaModel = (_a51 = options == null ? void 0 : options.isGemmaModel) != null ? _a51 : false;
|
|
132111
|
-
const providerOptionsName = (
|
|
132115
|
+
const providerOptionsName = (_b40 = options == null ? void 0 : options.providerOptionsName) != null ? _b40 : "google";
|
|
132112
132116
|
for (const { role, content } of prompt) {
|
|
132113
132117
|
switch (role) {
|
|
132114
132118
|
case "system": {
|
|
@@ -132628,8 +132632,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132628
132632
|
return this.config.provider;
|
|
132629
132633
|
}
|
|
132630
132634
|
get supportedUrls() {
|
|
132631
|
-
var _a51,
|
|
132632
|
-
return (_c11 = (
|
|
132635
|
+
var _a51, _b40, _c11;
|
|
132636
|
+
return (_c11 = (_b40 = (_a51 = this.config).supportedUrls) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : {};
|
|
132633
132637
|
}
|
|
132634
132638
|
async getArgs({
|
|
132635
132639
|
prompt,
|
|
@@ -132730,7 +132734,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132730
132734
|
};
|
|
132731
132735
|
}
|
|
132732
132736
|
async doGenerate(options) {
|
|
132733
|
-
var _a51,
|
|
132737
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2;
|
|
132734
132738
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
132735
132739
|
const mergedHeaders = combineHeaders(
|
|
132736
132740
|
await resolve2(this.config.headers),
|
|
@@ -132753,7 +132757,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132753
132757
|
});
|
|
132754
132758
|
const candidate = response.candidates[0];
|
|
132755
132759
|
const content = [];
|
|
132756
|
-
const parts = (
|
|
132760
|
+
const parts = (_b40 = (_a51 = candidate.content) == null ? void 0 : _a51.parts) != null ? _b40 : [];
|
|
132757
132761
|
const usageMetadata = response.usageMetadata;
|
|
132758
132762
|
let lastCodeExecutionToolCallId;
|
|
132759
132763
|
for (const part of parts) {
|
|
@@ -132897,7 +132901,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132897
132901
|
controller.enqueue({ type: "stream-start", warnings });
|
|
132898
132902
|
},
|
|
132899
132903
|
transform(chunk, controller) {
|
|
132900
|
-
var _a51,
|
|
132904
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2;
|
|
132901
132905
|
if (options.includeRawChunks) {
|
|
132902
132906
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
132903
132907
|
}
|
|
@@ -132928,7 +132932,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132928
132932
|
}
|
|
132929
132933
|
}
|
|
132930
132934
|
if (content != null) {
|
|
132931
|
-
const parts = (
|
|
132935
|
+
const parts = (_b40 = content.parts) != null ? _b40 : [];
|
|
132932
132936
|
for (const part of parts) {
|
|
132933
132937
|
if ("executableCode" in part && ((_c11 = part.executableCode) == null ? void 0 : _c11.code)) {
|
|
132934
132938
|
const toolCallId = generateId3();
|
|
@@ -133129,7 +133133,7 @@ function extractSources({
|
|
|
133129
133133
|
groundingMetadata,
|
|
133130
133134
|
generateId: generateId3
|
|
133131
133135
|
}) {
|
|
133132
|
-
var _a51,
|
|
133136
|
+
var _a51, _b40, _c11, _d8, _e7;
|
|
133133
133137
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
133134
133138
|
return void 0;
|
|
133135
133139
|
}
|
|
@@ -133152,7 +133156,7 @@ function extractSources({
|
|
|
133152
133156
|
sourceType: "url",
|
|
133153
133157
|
id: generateId3(),
|
|
133154
133158
|
url: uri,
|
|
133155
|
-
title: (
|
|
133159
|
+
title: (_b40 = chunk.retrievedContext.title) != null ? _b40 : void 0
|
|
133156
133160
|
});
|
|
133157
133161
|
} else if (uri) {
|
|
133158
133162
|
const title = (_c11 = chunk.retrievedContext.title) != null ? _c11 : "Unknown Document";
|
|
@@ -133498,7 +133502,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133498
133502
|
return this.doGenerateImagen(options);
|
|
133499
133503
|
}
|
|
133500
133504
|
async doGenerateImagen(options) {
|
|
133501
|
-
var _a51,
|
|
133505
|
+
var _a51, _b40, _c11;
|
|
133502
133506
|
const {
|
|
133503
133507
|
prompt,
|
|
133504
133508
|
n: n3 = 1,
|
|
@@ -133541,7 +133545,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133541
133545
|
providerOptions,
|
|
133542
133546
|
schema: googleImageModelOptionsSchema
|
|
133543
133547
|
});
|
|
133544
|
-
const currentDate = (_c11 = (
|
|
133548
|
+
const currentDate = (_c11 = (_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : /* @__PURE__ */ new Date();
|
|
133545
133549
|
const parameters = {
|
|
133546
133550
|
sampleCount: n3
|
|
133547
133551
|
};
|
|
@@ -133586,7 +133590,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133586
133590
|
};
|
|
133587
133591
|
}
|
|
133588
133592
|
async doGenerateGemini(options) {
|
|
133589
|
-
var _a51,
|
|
133593
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i;
|
|
133590
133594
|
const {
|
|
133591
133595
|
prompt,
|
|
133592
133596
|
n: n3,
|
|
@@ -133646,7 +133650,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133646
133650
|
baseURL: this.config.baseURL,
|
|
133647
133651
|
headers: (_a51 = this.config.headers) != null ? _a51 : {},
|
|
133648
133652
|
fetch: this.config.fetch,
|
|
133649
|
-
generateId: (
|
|
133653
|
+
generateId: (_b40 = this.config.generateId) != null ? _b40 : generateId
|
|
133650
133654
|
});
|
|
133651
133655
|
const result = await languageModel.doGenerate({
|
|
133652
133656
|
prompt: languageModelPrompt,
|
|
@@ -133722,8 +133726,8 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
133722
133726
|
return 4;
|
|
133723
133727
|
}
|
|
133724
133728
|
async doGenerate(options) {
|
|
133725
|
-
var _a51,
|
|
133726
|
-
const currentDate = (_c11 = (
|
|
133729
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2;
|
|
133730
|
+
const currentDate = (_c11 = (_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : /* @__PURE__ */ new Date();
|
|
133727
133731
|
const warnings = [];
|
|
133728
133732
|
const googleOptions = await parseProviderOptions({
|
|
133729
133733
|
provider: "google",
|
|
@@ -133957,9 +133961,9 @@ var googleVideoModelOptionsSchema = lazySchema(
|
|
|
133957
133961
|
)
|
|
133958
133962
|
);
|
|
133959
133963
|
function createGoogleGenerativeAI(options = {}) {
|
|
133960
|
-
var _a51,
|
|
133964
|
+
var _a51, _b40;
|
|
133961
133965
|
const baseURL = (_a51 = withoutTrailingSlash(options.baseURL)) != null ? _a51 : "https://generativelanguage.googleapis.com/v1beta";
|
|
133962
|
-
const providerName = (
|
|
133966
|
+
const providerName = (_b40 = options.name) != null ? _b40 : "google.generative-ai";
|
|
133963
133967
|
const getHeaders = () => withUserAgentSuffix(
|
|
133964
133968
|
{
|
|
133965
133969
|
"x-goog-api-key": loadApiKey({
|
|
@@ -134300,7 +134304,7 @@ var OllamaCompletionLanguageModel = class {
|
|
|
134300
134304
|
};
|
|
134301
134305
|
}
|
|
134302
134306
|
async doGenerate(options) {
|
|
134303
|
-
var _a51,
|
|
134307
|
+
var _a51, _b40;
|
|
134304
134308
|
const { args: body, warnings } = this.getArgs(options);
|
|
134305
134309
|
const {
|
|
134306
134310
|
responseHeaders,
|
|
@@ -134337,7 +134341,7 @@ var OllamaCompletionLanguageModel = class {
|
|
|
134337
134341
|
cacheWrite: void 0
|
|
134338
134342
|
},
|
|
134339
134343
|
outputTokens: {
|
|
134340
|
-
total: (
|
|
134344
|
+
total: (_b40 = typedResponse.eval_count) != null ? _b40 : 0,
|
|
134341
134345
|
text: void 0,
|
|
134342
134346
|
reasoning: void 0
|
|
134343
134347
|
}
|
|
@@ -134471,13 +134475,13 @@ var ollamaEmbeddingProviderOptions = external_exports.object({
|
|
|
134471
134475
|
var OllamaEmbeddingModel = class {
|
|
134472
134476
|
constructor(modelId, settings, config2) {
|
|
134473
134477
|
this.specificationVersion = "v3";
|
|
134474
|
-
var _a51,
|
|
134478
|
+
var _a51, _b40;
|
|
134475
134479
|
this.modelId = modelId;
|
|
134476
134480
|
this.settings = settings;
|
|
134477
134481
|
this.config = config2;
|
|
134478
134482
|
this.provider = config2.provider;
|
|
134479
134483
|
this.maxEmbeddingsPerCall = (_a51 = settings.maxEmbeddingsPerCall) != null ? _a51 : 2048;
|
|
134480
|
-
this.supportsParallelCalls = (
|
|
134484
|
+
this.supportsParallelCalls = (_b40 = settings.supportsParallelCalls) != null ? _b40 : true;
|
|
134481
134485
|
}
|
|
134482
134486
|
getArgs({
|
|
134483
134487
|
values
|
|
@@ -134498,7 +134502,7 @@ var OllamaEmbeddingModel = class {
|
|
|
134498
134502
|
abortSignal,
|
|
134499
134503
|
providerOptions
|
|
134500
134504
|
}) {
|
|
134501
|
-
var _a51,
|
|
134505
|
+
var _a51, _b40, _c11;
|
|
134502
134506
|
if (this.maxEmbeddingsPerCall && values.length > this.maxEmbeddingsPerCall) {
|
|
134503
134507
|
throw new TooManyEmbeddingValuesForCallError({
|
|
134504
134508
|
provider: this.provider,
|
|
@@ -134513,7 +134517,7 @@ var OllamaEmbeddingModel = class {
|
|
|
134513
134517
|
schema: ollamaEmbeddingProviderOptions
|
|
134514
134518
|
});
|
|
134515
134519
|
const dimensions = (_a51 = ollamaOptions == null ? void 0 : ollamaOptions.dimensions) != null ? _a51 : this.settings.dimensions;
|
|
134516
|
-
const truncate = (
|
|
134520
|
+
const truncate = (_b40 = ollamaOptions == null ? void 0 : ollamaOptions.truncate) != null ? _b40 : this.settings.truncate;
|
|
134517
134521
|
const keepAlive = (_c11 = ollamaOptions == null ? void 0 : ollamaOptions.keepAlive) != null ? _c11 : this.settings.keepAlive;
|
|
134518
134522
|
const body = {
|
|
134519
134523
|
model: this.modelId,
|
|
@@ -134599,7 +134603,7 @@ var OllamaResponseProcessor = class {
|
|
|
134599
134603
|
};
|
|
134600
134604
|
}
|
|
134601
134605
|
extractContent(response) {
|
|
134602
|
-
var _a51,
|
|
134606
|
+
var _a51, _b40, _c11, _d8, _e7;
|
|
134603
134607
|
const content = [];
|
|
134604
134608
|
const text2 = response.message.content;
|
|
134605
134609
|
if (text2 != null && text2.length > 0) {
|
|
@@ -134618,7 +134622,7 @@ var OllamaResponseProcessor = class {
|
|
|
134618
134622
|
for (const toolCall of (_a51 = response.message.tool_calls) != null ? _a51 : []) {
|
|
134619
134623
|
content.push({
|
|
134620
134624
|
type: "tool-call",
|
|
134621
|
-
toolCallId: (_e7 = toolCall.id) != null ? _e7 : (_d8 = (_c11 = (
|
|
134625
|
+
toolCallId: (_e7 = toolCall.id) != null ? _e7 : (_d8 = (_c11 = (_b40 = this.config).generateId) == null ? void 0 : _c11.call(_b40)) != null ? _d8 : generateId(),
|
|
134622
134626
|
toolName: toolCall.function.name,
|
|
134623
134627
|
input: JSON.stringify(toolCall.function.arguments)
|
|
134624
134628
|
});
|
|
@@ -134626,7 +134630,7 @@ var OllamaResponseProcessor = class {
|
|
|
134626
134630
|
return content;
|
|
134627
134631
|
}
|
|
134628
134632
|
extractUsage(response) {
|
|
134629
|
-
var _a51,
|
|
134633
|
+
var _a51, _b40;
|
|
134630
134634
|
return {
|
|
134631
134635
|
inputTokens: {
|
|
134632
134636
|
total: (_a51 = response.prompt_eval_count) != null ? _a51 : 0,
|
|
@@ -134635,7 +134639,7 @@ var OllamaResponseProcessor = class {
|
|
|
134635
134639
|
cacheWrite: void 0
|
|
134636
134640
|
},
|
|
134637
134641
|
outputTokens: {
|
|
134638
|
-
total: (
|
|
134642
|
+
total: (_b40 = response.eval_count) != null ? _b40 : 0,
|
|
134639
134643
|
text: void 0,
|
|
134640
134644
|
reasoning: void 0
|
|
134641
134645
|
}
|
|
@@ -134839,7 +134843,7 @@ function convertToOllamaResponsesMessages({
|
|
|
134839
134843
|
messages.push({
|
|
134840
134844
|
role: "user",
|
|
134841
134845
|
content: content.map((part, index) => {
|
|
134842
|
-
var _a51,
|
|
134846
|
+
var _a51, _b40, _c11;
|
|
134843
134847
|
switch (part.type) {
|
|
134844
134848
|
case "text": {
|
|
134845
134849
|
return { type: "input_text", text: part.text };
|
|
@@ -134851,7 +134855,7 @@ function convertToOllamaResponsesMessages({
|
|
|
134851
134855
|
type: "input_image",
|
|
134852
134856
|
image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${part.data}`,
|
|
134853
134857
|
// Ollama specific extension: image detail
|
|
134854
|
-
detail: (
|
|
134858
|
+
detail: (_b40 = (_a51 = part.providerOptions) == null ? void 0 : _a51.ollama) == null ? void 0 : _b40.imageDetail
|
|
134855
134859
|
};
|
|
134856
134860
|
} else if (part.mediaType === "application/pdf") {
|
|
134857
134861
|
if (part.data instanceof URL) {
|
|
@@ -135095,7 +135099,7 @@ var OllamaRequestBuilder = class {
|
|
|
135095
135099
|
responseFormat,
|
|
135096
135100
|
ollamaOptions
|
|
135097
135101
|
}) {
|
|
135098
|
-
var _a51,
|
|
135102
|
+
var _a51, _b40;
|
|
135099
135103
|
return {
|
|
135100
135104
|
model: modelId,
|
|
135101
135105
|
messages: convertToOllamaChatMessages({
|
|
@@ -135109,7 +135113,7 @@ var OllamaRequestBuilder = class {
|
|
|
135109
135113
|
format: responseFormat.schema != null ? responseFormat.schema : "json"
|
|
135110
135114
|
},
|
|
135111
135115
|
think: (_a51 = ollamaOptions == null ? void 0 : ollamaOptions.think) != null ? _a51 : false,
|
|
135112
|
-
options: (
|
|
135116
|
+
options: (_b40 = ollamaOptions == null ? void 0 : ollamaOptions.options) != null ? _b40 : void 0
|
|
135113
135117
|
};
|
|
135114
135118
|
}
|
|
135115
135119
|
};
|
|
@@ -135252,9 +135256,9 @@ var OllamaStreamProcessor = class {
|
|
|
135252
135256
|
}
|
|
135253
135257
|
}
|
|
135254
135258
|
processToolCalls(delta, controller) {
|
|
135255
|
-
var _a51,
|
|
135259
|
+
var _a51, _b40, _c11, _d8;
|
|
135256
135260
|
for (const toolCall of (_a51 = delta.tool_calls) != null ? _a51 : []) {
|
|
135257
|
-
if (((
|
|
135261
|
+
if (((_b40 = toolCall.function) == null ? void 0 : _b40.name) == null) {
|
|
135258
135262
|
throw new InvalidResponseDataError({
|
|
135259
135263
|
data: toolCall,
|
|
135260
135264
|
message: `Expected 'function.name' to be a string.`
|
|
@@ -135266,8 +135270,8 @@ var OllamaStreamProcessor = class {
|
|
|
135266
135270
|
}
|
|
135267
135271
|
}
|
|
135268
135272
|
emitToolCall(toolCall, controller) {
|
|
135269
|
-
var _a51,
|
|
135270
|
-
const id = (_d8 = toolCall.id) != null ? _d8 : (_c11 = (
|
|
135273
|
+
var _a51, _b40, _c11, _d8;
|
|
135274
|
+
const id = (_d8 = toolCall.id) != null ? _d8 : (_c11 = (_b40 = (_a51 = this.config).generateId) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : generateId();
|
|
135271
135275
|
controller.enqueue({
|
|
135272
135276
|
type: "tool-input-start",
|
|
135273
135277
|
id,
|
|
@@ -135388,9 +135392,9 @@ var OllamaResponsesLanguageModel = class {
|
|
|
135388
135392
|
}
|
|
135389
135393
|
};
|
|
135390
135394
|
function createOllama(options = {}) {
|
|
135391
|
-
var _a51,
|
|
135395
|
+
var _a51, _b40;
|
|
135392
135396
|
const baseURL = (_a51 = withoutTrailingSlash(options.baseURL)) != null ? _a51 : "http://127.0.0.1:11434/api";
|
|
135393
|
-
const providerName = (
|
|
135397
|
+
const providerName = (_b40 = options.name) != null ? _b40 : "ollama";
|
|
135394
135398
|
const getHeaders = () => ({
|
|
135395
135399
|
"Ollama-Organization": options.organization,
|
|
135396
135400
|
"Ollama-Project": options.project,
|
|
@@ -135448,8 +135452,8 @@ var ollama = createOllama();
|
|
|
135448
135452
|
|
|
135449
135453
|
// ../../node_modules/.pnpm/@ai-sdk+openai-compatible@1.0.30_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
|
|
135450
135454
|
function getOpenAIMetadata(message) {
|
|
135451
|
-
var _a51,
|
|
135452
|
-
return (
|
|
135455
|
+
var _a51, _b40;
|
|
135456
|
+
return (_b40 = (_a51 = message == null ? void 0 : message.providerOptions) == null ? void 0 : _a51.openaiCompatible) != null ? _b40 : {};
|
|
135453
135457
|
}
|
|
135454
135458
|
function convertToOpenAICompatibleChatMessages(prompt) {
|
|
135455
135459
|
const messages = [];
|
|
@@ -135674,7 +135678,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135674
135678
|
// type inferred via constructor
|
|
135675
135679
|
constructor(modelId, config2) {
|
|
135676
135680
|
this.specificationVersion = "v2";
|
|
135677
|
-
var _a51,
|
|
135681
|
+
var _a51, _b40;
|
|
135678
135682
|
this.modelId = modelId;
|
|
135679
135683
|
this.config = config2;
|
|
135680
135684
|
const errorStructure = (_a51 = config2.errorStructure) != null ? _a51 : defaultOpenAICompatibleErrorStructure;
|
|
@@ -135682,7 +135686,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135682
135686
|
errorStructure.errorSchema
|
|
135683
135687
|
);
|
|
135684
135688
|
this.failedResponseHandler = createJsonErrorResponseHandler(errorStructure);
|
|
135685
|
-
this.supportsStructuredOutputs = (
|
|
135689
|
+
this.supportsStructuredOutputs = (_b40 = config2.supportsStructuredOutputs) != null ? _b40 : false;
|
|
135686
135690
|
}
|
|
135687
135691
|
get provider() {
|
|
135688
135692
|
return this.config.provider;
|
|
@@ -135691,8 +135695,8 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135691
135695
|
return this.config.provider.split(".")[0].trim();
|
|
135692
135696
|
}
|
|
135693
135697
|
get supportedUrls() {
|
|
135694
|
-
var _a51,
|
|
135695
|
-
return (_c11 = (
|
|
135698
|
+
var _a51, _b40, _c11;
|
|
135699
|
+
return (_c11 = (_b40 = (_a51 = this.config).supportedUrls) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : {};
|
|
135696
135700
|
}
|
|
135697
135701
|
async getArgs({
|
|
135698
135702
|
prompt,
|
|
@@ -135709,7 +135713,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135709
135713
|
toolChoice,
|
|
135710
135714
|
tools
|
|
135711
135715
|
}) {
|
|
135712
|
-
var _a51,
|
|
135716
|
+
var _a51, _b40, _c11, _d8;
|
|
135713
135717
|
const warnings = [];
|
|
135714
135718
|
const compatibleOptions = Object.assign(
|
|
135715
135719
|
(_a51 = await parseProviderOptions({
|
|
@@ -135717,11 +135721,11 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135717
135721
|
providerOptions,
|
|
135718
135722
|
schema: openaiCompatibleProviderOptions
|
|
135719
135723
|
})) != null ? _a51 : {},
|
|
135720
|
-
(
|
|
135724
|
+
(_b40 = await parseProviderOptions({
|
|
135721
135725
|
provider: this.providerOptionsName,
|
|
135722
135726
|
providerOptions,
|
|
135723
135727
|
schema: openaiCompatibleProviderOptions
|
|
135724
|
-
})) != null ?
|
|
135728
|
+
})) != null ? _b40 : {}
|
|
135725
135729
|
);
|
|
135726
135730
|
if (topK != null) {
|
|
135727
135731
|
warnings.push({ type: "unsupported-setting", setting: "topK" });
|
|
@@ -135782,7 +135786,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135782
135786
|
};
|
|
135783
135787
|
}
|
|
135784
135788
|
async doGenerate(options) {
|
|
135785
|
-
var _a51,
|
|
135789
|
+
var _a51, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m, _n, _o2, _p2, _q2;
|
|
135786
135790
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
135787
135791
|
const body = JSON.stringify(args);
|
|
135788
135792
|
const {
|
|
@@ -135820,7 +135824,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135820
135824
|
for (const toolCall of choice2.message.tool_calls) {
|
|
135821
135825
|
content.push({
|
|
135822
135826
|
type: "tool-call",
|
|
135823
|
-
toolCallId: (
|
|
135827
|
+
toolCallId: (_b40 = toolCall.id) != null ? _b40 : generateId(),
|
|
135824
135828
|
toolName: toolCall.function.name,
|
|
135825
135829
|
input: toolCall.function.arguments
|
|
135826
135830
|
});
|
|
@@ -135910,7 +135914,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135910
135914
|
},
|
|
135911
135915
|
// TODO we lost type safety on Chunk, most likely due to the error schema. MUST FIX
|
|
135912
135916
|
transform(chunk, controller) {
|
|
135913
|
-
var _a210,
|
|
135917
|
+
var _a210, _b40, _c11, _d8, _e7, _f3, _g6, _h2, _i, _j2, _k3, _l, _m;
|
|
135914
135918
|
if (options.includeRawChunks) {
|
|
135915
135919
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
135916
135920
|
}
|
|
@@ -136003,7 +136007,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
136003
136007
|
message: `Expected 'id' to be a string.`
|
|
136004
136008
|
});
|
|
136005
136009
|
}
|
|
136006
|
-
if (((
|
|
136010
|
+
if (((_b40 = toolCallDelta.function) == null ? void 0 : _b40.name) == null) {
|
|
136007
136011
|
throw new InvalidResponseDataError({
|
|
136008
136012
|
data: toolCallDelta,
|
|
136009
136013
|
message: `Expected 'function.name' to be a string.`
|
|
@@ -136077,7 +136081,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
136077
136081
|
}
|
|
136078
136082
|
},
|
|
136079
136083
|
flush(controller) {
|
|
136080
|
-
var _a210,
|
|
136084
|
+
var _a210, _b40, _c11, _d8, _e7, _f3;
|
|
136081
136085
|
if (isActiveReasoning) {
|
|
136082
136086
|
controller.enqueue({ type: "reasoning-end", id: "reasoning-0" });
|
|
136083
136087
|
}
|
|
@@ -136112,7 +136116,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
136112
136116
|
type: "finish",
|
|
136113
136117
|
finishReason,
|
|
136114
136118
|
usage: {
|
|
136115
|
-
inputTokens: (
|
|
136119
|
+
inputTokens: (_b40 = usage.promptTokens) != null ? _b40 : void 0,
|
|
136116
136120
|
outputTokens: (_c11 = usage.completionTokens) != null ? _c11 : void 0,
|
|
136117
136121
|
totalTokens: (_d8 = usage.totalTokens) != null ? _d8 : void 0,
|
|
136118
136122
|
reasoningTokens: (_e7 = usage.completionTokensDetails.reasoningTokens) != null ? _e7 : void 0,
|
|
@@ -136339,8 +136343,8 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136339
136343
|
return this.config.provider.split(".")[0].trim();
|
|
136340
136344
|
}
|
|
136341
136345
|
get supportedUrls() {
|
|
136342
|
-
var _a51,
|
|
136343
|
-
return (_c11 = (
|
|
136346
|
+
var _a51, _b40, _c11;
|
|
136347
|
+
return (_c11 = (_b40 = (_a51 = this.config).supportedUrls) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : {};
|
|
136344
136348
|
}
|
|
136345
136349
|
async getArgs({
|
|
136346
136350
|
prompt,
|
|
@@ -136408,7 +136412,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136408
136412
|
};
|
|
136409
136413
|
}
|
|
136410
136414
|
async doGenerate(options) {
|
|
136411
|
-
var _a51,
|
|
136415
|
+
var _a51, _b40, _c11, _d8, _e7, _f3;
|
|
136412
136416
|
const { args, warnings } = await this.getArgs(options);
|
|
136413
136417
|
const {
|
|
136414
136418
|
responseHeaders,
|
|
@@ -136436,7 +136440,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136436
136440
|
return {
|
|
136437
136441
|
content,
|
|
136438
136442
|
usage: {
|
|
136439
|
-
inputTokens: (
|
|
136443
|
+
inputTokens: (_b40 = (_a51 = response.usage) == null ? void 0 : _a51.prompt_tokens) != null ? _b40 : void 0,
|
|
136440
136444
|
outputTokens: (_d8 = (_c11 = response.usage) == null ? void 0 : _c11.completion_tokens) != null ? _d8 : void 0,
|
|
136441
136445
|
totalTokens: (_f3 = (_e7 = response.usage) == null ? void 0 : _e7.total_tokens) != null ? _f3 : void 0
|
|
136442
136446
|
},
|
|
@@ -136486,7 +136490,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136486
136490
|
controller.enqueue({ type: "stream-start", warnings });
|
|
136487
136491
|
},
|
|
136488
136492
|
transform(chunk, controller) {
|
|
136489
|
-
var _a51,
|
|
136493
|
+
var _a51, _b40, _c11;
|
|
136490
136494
|
if (options.includeRawChunks) {
|
|
136491
136495
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
136492
136496
|
}
|
|
@@ -136514,7 +136518,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136514
136518
|
}
|
|
136515
136519
|
if (value.usage != null) {
|
|
136516
136520
|
usage.inputTokens = (_a51 = value.usage.prompt_tokens) != null ? _a51 : void 0;
|
|
136517
|
-
usage.outputTokens = (
|
|
136521
|
+
usage.outputTokens = (_b40 = value.usage.completion_tokens) != null ? _b40 : void 0;
|
|
136518
136522
|
usage.totalTokens = (_c11 = value.usage.total_tokens) != null ? _c11 : void 0;
|
|
136519
136523
|
}
|
|
136520
136524
|
const choice2 = value.choices[0];
|
|
@@ -136619,18 +136623,18 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
|
136619
136623
|
abortSignal,
|
|
136620
136624
|
providerOptions
|
|
136621
136625
|
}) {
|
|
136622
|
-
var _a51,
|
|
136626
|
+
var _a51, _b40, _c11;
|
|
136623
136627
|
const compatibleOptions = Object.assign(
|
|
136624
136628
|
(_a51 = await parseProviderOptions({
|
|
136625
136629
|
provider: "openai-compatible",
|
|
136626
136630
|
providerOptions,
|
|
136627
136631
|
schema: openaiCompatibleEmbeddingProviderOptions
|
|
136628
136632
|
})) != null ? _a51 : {},
|
|
136629
|
-
(
|
|
136633
|
+
(_b40 = await parseProviderOptions({
|
|
136630
136634
|
provider: this.providerOptionsName,
|
|
136631
136635
|
providerOptions,
|
|
136632
136636
|
schema: openaiCompatibleEmbeddingProviderOptions
|
|
136633
|
-
})) != null ?
|
|
136637
|
+
})) != null ? _b40 : {}
|
|
136634
136638
|
);
|
|
136635
136639
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
136636
136640
|
throw new TooManyEmbeddingValuesForCallError({
|
|
@@ -136699,7 +136703,7 @@ var OpenAICompatibleImageModel = class {
|
|
|
136699
136703
|
headers,
|
|
136700
136704
|
abortSignal
|
|
136701
136705
|
}) {
|
|
136702
|
-
var _a51,
|
|
136706
|
+
var _a51, _b40, _c11, _d8, _e7;
|
|
136703
136707
|
const warnings = [];
|
|
136704
136708
|
if (aspectRatio != null) {
|
|
136705
136709
|
warnings.push({
|
|
@@ -136711,7 +136715,7 @@ var OpenAICompatibleImageModel = class {
|
|
|
136711
136715
|
if (seed != null) {
|
|
136712
136716
|
warnings.push({ type: "unsupported-setting", setting: "seed" });
|
|
136713
136717
|
}
|
|
136714
|
-
const currentDate = (_c11 = (
|
|
136718
|
+
const currentDate = (_c11 = (_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) != null ? _c11 : /* @__PURE__ */ new Date();
|
|
136715
136719
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
136716
136720
|
url: this.config.url({
|
|
136717
136721
|
path: "/images/generations",
|
|
@@ -137041,8 +137045,8 @@ var InfomaniakTranscriptionModel = class {
|
|
|
137041
137045
|
throw new Error(`Transcription timed out after ${maxRetries} attempts`);
|
|
137042
137046
|
}
|
|
137043
137047
|
async doGenerate(options) {
|
|
137044
|
-
var _a51,
|
|
137045
|
-
const currentDate = ((
|
|
137048
|
+
var _a51, _b40, _c11, _d8;
|
|
137049
|
+
const currentDate = ((_b40 = (_a51 = this.config._internal) == null ? void 0 : _a51.currentDate) == null ? void 0 : _b40.call(_a51)) ?? /* @__PURE__ */ new Date();
|
|
137046
137050
|
const { formData, warnings } = await this.getArgs(options);
|
|
137047
137051
|
const { value: batchResponse } = await postFormDataToApi({
|
|
137048
137052
|
url: this.config.url({
|
|
@@ -143736,6 +143740,9 @@ var StdioServerTransport = class {
|
|
|
143736
143740
|
// src/services/file.service.ts
|
|
143737
143741
|
var fs3 = __toESM(require("fs"));
|
|
143738
143742
|
var path2 = __toESM(require("path"));
|
|
143743
|
+
var import_node_crypto3 = require("node:crypto");
|
|
143744
|
+
var import_promises = require("node:stream/promises");
|
|
143745
|
+
var import_node_stream = require("node:stream");
|
|
143739
143746
|
var __decorate8 = function(decorators, target, key, desc) {
|
|
143740
143747
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
143741
143748
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -143759,6 +143766,14 @@ var AssetTooLargeError = class extends Error {
|
|
|
143759
143766
|
this.name = "AssetTooLargeError";
|
|
143760
143767
|
}
|
|
143761
143768
|
};
|
|
143769
|
+
var AssetTruncatedError = class extends Error {
|
|
143770
|
+
constructor(receivedBytes, expectedBytes) {
|
|
143771
|
+
super(`Asset stream truncated: received ${receivedBytes} bytes, expected ${expectedBytes}`);
|
|
143772
|
+
this.receivedBytes = receivedBytes;
|
|
143773
|
+
this.expectedBytes = expectedBytes;
|
|
143774
|
+
this.name = "AssetTruncatedError";
|
|
143775
|
+
}
|
|
143776
|
+
};
|
|
143762
143777
|
var FileService = class FileService2 extends Service {
|
|
143763
143778
|
constructor(loggerService) {
|
|
143764
143779
|
super();
|
|
@@ -143804,41 +143819,42 @@ var FileService = class FileService2 extends Service {
|
|
|
143804
143819
|
SKILDER_MAX_FILE_SIZE_MB: String(this.maxFileSizeMB)
|
|
143805
143820
|
};
|
|
143806
143821
|
}
|
|
143807
|
-
async
|
|
143822
|
+
async sweepDirByAge(dir, maxAgeMs, label) {
|
|
143808
143823
|
let deletedCount = 0;
|
|
143809
143824
|
let bytesFreed = 0;
|
|
143810
143825
|
try {
|
|
143811
|
-
const entries = await fs3.promises.readdir(
|
|
143826
|
+
const entries = await fs3.promises.readdir(dir);
|
|
143812
143827
|
const now2 = Date.now();
|
|
143813
143828
|
for (const entry of entries) {
|
|
143814
|
-
const filePath = path2.join(
|
|
143829
|
+
const filePath = path2.join(dir, entry);
|
|
143815
143830
|
try {
|
|
143816
143831
|
const stat = await fs3.promises.lstat(filePath);
|
|
143817
143832
|
if (stat.isSymbolicLink()) {
|
|
143818
|
-
this.logger.warn({ filePath },
|
|
143833
|
+
this.logger.warn({ filePath }, `${label} removing unexpected symlink`);
|
|
143834
|
+
await fs3.promises.unlink(filePath);
|
|
143819
143835
|
bytesFreed += stat.size;
|
|
143820
143836
|
deletedCount++;
|
|
143837
|
+
} else if (stat.isFile() && now2 - stat.mtimeMs > maxAgeMs) {
|
|
143821
143838
|
await fs3.promises.unlink(filePath);
|
|
143822
|
-
} else if (stat.isFile() && now2 - stat.mtimeMs > this.gcMaxAgeMs) {
|
|
143823
143839
|
bytesFreed += stat.size;
|
|
143824
143840
|
deletedCount++;
|
|
143825
|
-
await fs3.promises.unlink(filePath);
|
|
143826
|
-
} else if (stat.isDirectory()) {
|
|
143827
|
-
this.logger.debug({ filePath }, "GC skipping directory in working directory");
|
|
143828
143841
|
}
|
|
143829
143842
|
} catch (error48) {
|
|
143830
|
-
if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT")
|
|
143843
|
+
if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT")
|
|
143831
143844
|
continue;
|
|
143832
|
-
}
|
|
143833
|
-
this.logger.warn({ filePath, error: error48 }, "GC failed to process file");
|
|
143845
|
+
this.logger.warn({ filePath, error: error48 }, `${label} failed to process file`);
|
|
143834
143846
|
}
|
|
143835
143847
|
}
|
|
143836
143848
|
} catch (error48) {
|
|
143837
143849
|
if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT") {
|
|
143838
|
-
return;
|
|
143850
|
+
return { deletedCount, bytesFreed };
|
|
143839
143851
|
}
|
|
143840
|
-
this.logger.warn({ error: error48 },
|
|
143852
|
+
this.logger.warn({ error: error48 }, `${label} failed to read directory`);
|
|
143841
143853
|
}
|
|
143854
|
+
return { deletedCount, bytesFreed };
|
|
143855
|
+
}
|
|
143856
|
+
async runGarbageCollection() {
|
|
143857
|
+
const { deletedCount, bytesFreed } = await this.sweepDirByAge(this.workingDir, this.gcMaxAgeMs, "GC");
|
|
143842
143858
|
if (deletedCount > 0) {
|
|
143843
143859
|
this.logger.info({ deletedCount, bytesFreed }, `GC completed: ${deletedCount} file(s) deleted, ${bytesFreed} bytes freed`);
|
|
143844
143860
|
}
|
|
@@ -143893,6 +143909,49 @@ var FileService = class FileService2 extends Service {
|
|
|
143893
143909
|
}
|
|
143894
143910
|
return writeAssetCache(assetPath, buffer, this.getFileConfig());
|
|
143895
143911
|
}
|
|
143912
|
+
/**
|
|
143913
|
+
* Stream an asset to the local cache without buffering the whole payload in
|
|
143914
|
+
* memory. Used by the runtime's `download_asset` flow to handle large files
|
|
143915
|
+
* (the new content-addressed `/assets/:id` endpoint streams bytes directly).
|
|
143916
|
+
*
|
|
143917
|
+
* Enforces the same size limit as `cacheAsset`. Returns the absolute path
|
|
143918
|
+
* of the cached file.
|
|
143919
|
+
*/
|
|
143920
|
+
async cacheAssetFromStream(assetPath, source, options = {}) {
|
|
143921
|
+
const maxBytes = this.maxFileSizeMB * 1024 * 1024;
|
|
143922
|
+
const cachePath = resolveAssetCachePath(assetPath, this.getFileConfig());
|
|
143923
|
+
await fs3.promises.mkdir(path2.dirname(cachePath), { recursive: true, mode: 448 });
|
|
143924
|
+
let totalBytes = 0;
|
|
143925
|
+
const sizeGuard = new import_node_stream.Transform({
|
|
143926
|
+
transform(chunk, _enc, cb) {
|
|
143927
|
+
totalBytes += chunk.length;
|
|
143928
|
+
if (totalBytes > maxBytes) {
|
|
143929
|
+
cb(new AssetTooLargeError(totalBytes, maxBytes));
|
|
143930
|
+
return;
|
|
143931
|
+
}
|
|
143932
|
+
cb(null, chunk);
|
|
143933
|
+
}
|
|
143934
|
+
});
|
|
143935
|
+
const tmpPath = `${cachePath}.${(0, import_node_crypto3.randomUUID)()}.partial`;
|
|
143936
|
+
try {
|
|
143937
|
+
await (0, import_promises.pipeline)(source, sizeGuard, fs3.createWriteStream(tmpPath, { flags: "wx" }));
|
|
143938
|
+
if (options.expectedBytes !== void 0 && totalBytes !== options.expectedBytes) {
|
|
143939
|
+
throw new AssetTruncatedError(totalBytes, options.expectedBytes);
|
|
143940
|
+
}
|
|
143941
|
+
await fs3.promises.rename(tmpPath, cachePath);
|
|
143942
|
+
} catch (err) {
|
|
143943
|
+
await fs3.promises.unlink(tmpPath).catch((unlinkErr) => {
|
|
143944
|
+
if (unlinkErr instanceof Error && "code" in unlinkErr && unlinkErr.code === "ENOENT")
|
|
143945
|
+
return;
|
|
143946
|
+
this.logger.warn({ tmpPath, err: unlinkErr }, "Failed to clean up partial asset cache file");
|
|
143947
|
+
});
|
|
143948
|
+
throw err;
|
|
143949
|
+
}
|
|
143950
|
+
return cachePath;
|
|
143951
|
+
}
|
|
143952
|
+
get maxAssetBytes() {
|
|
143953
|
+
return this.maxFileSizeMB * 1024 * 1024;
|
|
143954
|
+
}
|
|
143896
143955
|
/**
|
|
143897
143956
|
* Get the local cache path for a @skilder-asset:/ path (may or may not exist).
|
|
143898
143957
|
*/
|
|
@@ -143904,39 +143963,7 @@ var FileService = class FileService2 extends Service {
|
|
|
143904
143963
|
* main working dir (5 min), but both are configurable via environment variables.
|
|
143905
143964
|
*/
|
|
143906
143965
|
async runAssetCacheGC() {
|
|
143907
|
-
const
|
|
143908
|
-
let deletedCount = 0;
|
|
143909
|
-
let bytesFreed = 0;
|
|
143910
|
-
try {
|
|
143911
|
-
const entries = await fs3.promises.readdir(cacheDir);
|
|
143912
|
-
const now2 = Date.now();
|
|
143913
|
-
for (const entry of entries) {
|
|
143914
|
-
const filePath = path2.join(cacheDir, entry);
|
|
143915
|
-
try {
|
|
143916
|
-
const stat = await fs3.promises.lstat(filePath);
|
|
143917
|
-
if (stat.isSymbolicLink()) {
|
|
143918
|
-
this.logger.warn({ filePath }, "Asset cache GC removing unexpected symlink");
|
|
143919
|
-
await fs3.promises.unlink(filePath);
|
|
143920
|
-
bytesFreed += stat.size;
|
|
143921
|
-
deletedCount++;
|
|
143922
|
-
} else if (stat.isFile() && now2 - stat.mtimeMs > this.assetCacheMaxAgeMs) {
|
|
143923
|
-
await fs3.promises.unlink(filePath);
|
|
143924
|
-
bytesFreed += stat.size;
|
|
143925
|
-
deletedCount++;
|
|
143926
|
-
}
|
|
143927
|
-
} catch (error48) {
|
|
143928
|
-
if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT") {
|
|
143929
|
-
continue;
|
|
143930
|
-
}
|
|
143931
|
-
this.logger.warn({ filePath, error: error48 }, "Asset cache GC failed to process file");
|
|
143932
|
-
}
|
|
143933
|
-
}
|
|
143934
|
-
} catch (error48) {
|
|
143935
|
-
if (error48 instanceof Error && "code" in error48 && error48.code === "ENOENT") {
|
|
143936
|
-
return;
|
|
143937
|
-
}
|
|
143938
|
-
this.logger.warn({ error: error48 }, "Asset cache GC failed to read cache directory");
|
|
143939
|
-
}
|
|
143966
|
+
const { deletedCount, bytesFreed } = await this.sweepDirByAge(this.getAssetCacheDir(), this.assetCacheMaxAgeMs, "Asset cache GC");
|
|
143940
143967
|
if (deletedCount > 0) {
|
|
143941
143968
|
this.logger.info({ deletedCount, bytesFreed }, `Asset cache GC completed: ${deletedCount} file(s) deleted, ${bytesFreed} bytes freed`);
|
|
143942
143969
|
}
|
|
@@ -144359,7 +144386,7 @@ var ScriptService = class ScriptService2 {
|
|
|
144359
144386
|
* @returns Result with content array and optional error/skill tracking
|
|
144360
144387
|
*/
|
|
144361
144388
|
async execute(params) {
|
|
144362
|
-
const { path: path4, workspaceId, userId, userKey, runtimeExecutionId, delegateDepth } = params;
|
|
144389
|
+
const { path: path4, workspaceId, userId, userKey, runtimeExecutionId, delegateDepth, args: structuredArgs } = params;
|
|
144363
144390
|
if (!path4) {
|
|
144364
144391
|
return {
|
|
144365
144392
|
content: [
|
|
@@ -144455,7 +144482,7 @@ For other resources, use the \`learn\` tool instead.`
|
|
|
144455
144482
|
isError: true
|
|
144456
144483
|
};
|
|
144457
144484
|
}
|
|
144458
|
-
const args = lookupArgs ? parseScriptArgs(lookupArgs) : [];
|
|
144485
|
+
const args = structuredArgs !== void 0 ? structuredArgs : lookupArgs ? parseScriptArgs(lookupArgs) : [];
|
|
144459
144486
|
return this.routeScriptToRuntime(scriptEntry, skill, args, workspaceId, userId, userKey, runtimeExecutionId, delegateDepth);
|
|
144460
144487
|
}
|
|
144461
144488
|
/**
|
|
@@ -145175,6 +145202,10 @@ ${JSON.stringify(toolConfig.inputSchema, null, 2)}`
|
|
|
145175
145202
|
}
|
|
145176
145203
|
|
|
145177
145204
|
// src/services/static-tools/download-asset.handler.ts
|
|
145205
|
+
var import_node_stream2 = require("node:stream");
|
|
145206
|
+
function getBackendUrl3() {
|
|
145207
|
+
return (process.env.SKILDER_BACKEND_URL || "http://localhost:3000").replace(/\/$/, "");
|
|
145208
|
+
}
|
|
145178
145209
|
var DownloadAssetError = class extends Error {
|
|
145179
145210
|
constructor(userMessage, skillId) {
|
|
145180
145211
|
super(userMessage);
|
|
@@ -145259,16 +145290,6 @@ To execute this script:
|
|
|
145259
145290
|
skill.id
|
|
145260
145291
|
);
|
|
145261
145292
|
}
|
|
145262
|
-
if (!deps.skillContentService) {
|
|
145263
|
-
deps.logger.error(
|
|
145264
|
-
{ skillId: skill.id, assetId: item.id },
|
|
145265
|
-
"SkillContentService not injected \u2014 cannot download assets"
|
|
145266
|
-
);
|
|
145267
|
-
throw new DownloadAssetError(
|
|
145268
|
-
"Error: Content service is not available. Cannot download assets in this runtime configuration.",
|
|
145269
|
-
skill.id
|
|
145270
|
-
);
|
|
145271
|
-
}
|
|
145272
145293
|
if (!deps.userKey) {
|
|
145273
145294
|
deps.logger.error(
|
|
145274
145295
|
{ skillId: skill.id, assetId: item.id },
|
|
@@ -145279,33 +145300,81 @@ To execute this script:
|
|
|
145279
145300
|
skill.id
|
|
145280
145301
|
);
|
|
145281
145302
|
}
|
|
145282
|
-
|
|
145303
|
+
const assetUrl = `${getBackendUrl3()}/assets/${encodeURIComponent(item.id)}`;
|
|
145304
|
+
let response;
|
|
145283
145305
|
try {
|
|
145284
|
-
|
|
145306
|
+
response = await fetch(assetUrl, {
|
|
145307
|
+
headers: { Authorization: `Bearer ${deps.userKey}` }
|
|
145308
|
+
});
|
|
145285
145309
|
} catch (error48) {
|
|
145286
|
-
deps.logger.error(
|
|
145310
|
+
deps.logger.error(
|
|
145311
|
+
{ err: error48, assetName: item.name, assetId: item.id, url: assetUrl },
|
|
145312
|
+
"Failed to fetch skill asset from backend"
|
|
145313
|
+
);
|
|
145287
145314
|
throw new DownloadAssetError(
|
|
145288
|
-
`Error: Failed to download asset "${item.name}". Please try again. If the issue persists, verify that the Skilder backend is
|
|
145315
|
+
`Error: Failed to download asset "${item.name}". Please try again. If the issue persists, verify that the Skilder backend is reachable and your authentication is valid.`,
|
|
145289
145316
|
skill.id
|
|
145290
145317
|
);
|
|
145291
145318
|
}
|
|
145292
|
-
if (
|
|
145319
|
+
if (!response.ok) {
|
|
145320
|
+
if (response.status === 404) {
|
|
145321
|
+
throw new DownloadAssetError(
|
|
145322
|
+
`Error: Asset "${item.name}" has not been uploaded yet, or no longer exists.`,
|
|
145323
|
+
skill.id
|
|
145324
|
+
);
|
|
145325
|
+
}
|
|
145326
|
+
if (response.status === 401 || response.status === 403) {
|
|
145327
|
+
throw new DownloadAssetError(
|
|
145328
|
+
`Error: Not authorized to download asset "${item.name}". Verify your user key has access to this workspace.`,
|
|
145329
|
+
skill.id
|
|
145330
|
+
);
|
|
145331
|
+
}
|
|
145332
|
+
const body = await response.text().catch((err) => {
|
|
145333
|
+
deps.logger.warn({ err }, "Failed to read backend error response body");
|
|
145334
|
+
return "";
|
|
145335
|
+
});
|
|
145293
145336
|
deps.logger.error(
|
|
145294
|
-
{
|
|
145295
|
-
|
|
145337
|
+
{
|
|
145338
|
+
assetName: item.name,
|
|
145339
|
+
assetId: item.id,
|
|
145340
|
+
status: response.status,
|
|
145341
|
+
body: body.slice(0, 200)
|
|
145342
|
+
},
|
|
145343
|
+
"Backend returned non-OK response for asset download"
|
|
145296
145344
|
);
|
|
145297
145345
|
throw new DownloadAssetError(
|
|
145298
|
-
`Error:
|
|
145346
|
+
`Error: Failed to download asset "${item.name}" (HTTP ${response.status}). Please try again.`,
|
|
145347
|
+
skill.id
|
|
145348
|
+
);
|
|
145349
|
+
}
|
|
145350
|
+
const contentLengthHeader = response.headers.get("content-length");
|
|
145351
|
+
let expectedBytes;
|
|
145352
|
+
if (contentLengthHeader) {
|
|
145353
|
+
const contentLength = Number.parseInt(contentLengthHeader, 10);
|
|
145354
|
+
if (Number.isFinite(contentLength)) {
|
|
145355
|
+
if (contentLength > deps.fileService.maxAssetBytes) {
|
|
145356
|
+
const maxMB = Math.floor(deps.fileService.maxAssetBytes / (1024 * 1024));
|
|
145357
|
+
throw new DownloadAssetError(
|
|
145358
|
+
`Error: Asset "${item.name}" is too large to download (${contentLength} bytes exceeds the ${maxMB}MB limit). Consider requesting a smaller version or processing the data differently.`,
|
|
145359
|
+
skill.id
|
|
145360
|
+
);
|
|
145361
|
+
}
|
|
145362
|
+
expectedBytes = contentLength;
|
|
145363
|
+
}
|
|
145364
|
+
}
|
|
145365
|
+
if (!response.body) {
|
|
145366
|
+
throw new DownloadAssetError(
|
|
145367
|
+
`Error: Backend returned no body for asset "${item.name}".`,
|
|
145299
145368
|
skill.id
|
|
145300
145369
|
);
|
|
145301
145370
|
}
|
|
145302
|
-
const buffer = Buffer.from(rawContent, "base64");
|
|
145303
145371
|
const assetPath = generateSkilderAssetPath(item.id, item.name);
|
|
145372
|
+
const nodeStream = import_node_stream2.Readable.fromWeb(response.body);
|
|
145304
145373
|
try {
|
|
145305
|
-
await deps.fileService.
|
|
145374
|
+
await deps.fileService.cacheAssetFromStream(assetPath, nodeStream, { expectedBytes });
|
|
145306
145375
|
} catch (writeError) {
|
|
145307
145376
|
deps.logger.error(
|
|
145308
|
-
{ err: writeError, assetName: item.name, assetId: item.id },
|
|
145377
|
+
{ err: writeError, assetName: item.name, assetId: item.id, expectedBytes },
|
|
145309
145378
|
"Failed to write downloaded asset to disk"
|
|
145310
145379
|
);
|
|
145311
145380
|
if (writeError instanceof AssetTooLargeError) {
|
|
@@ -145315,6 +145384,12 @@ To execute this script:
|
|
|
145315
145384
|
skill.id
|
|
145316
145385
|
);
|
|
145317
145386
|
}
|
|
145387
|
+
if (writeError instanceof AssetTruncatedError) {
|
|
145388
|
+
throw new DownloadAssetError(
|
|
145389
|
+
`Error: Asset "${item.name}" download was truncated (received ${writeError.receivedBytes} of ${writeError.expectedBytes} bytes). Please retry.`,
|
|
145390
|
+
skill.id
|
|
145391
|
+
);
|
|
145392
|
+
}
|
|
145318
145393
|
throw new DownloadAssetError(
|
|
145319
145394
|
`Error: Failed to write asset "${item.name}" to disk. Please try again.`,
|
|
145320
145395
|
skill.id
|
|
@@ -145351,7 +145426,6 @@ Examples:
|
|
|
145351
145426
|
const { assetPath, itemName, mimetype, skillId } = await downloadSkillAsset(path4, {
|
|
145352
145427
|
catalog: ctx.catalog,
|
|
145353
145428
|
fileService: ctx.fileService,
|
|
145354
|
-
skillContentService: ctx.skillContentService,
|
|
145355
145429
|
userKey: ctx.identity.userKey,
|
|
145356
145430
|
logger: ctx.logger
|
|
145357
145431
|
});
|
|
@@ -147210,7 +147284,7 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
147210
147284
|
};
|
|
147211
147285
|
|
|
147212
147286
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js
|
|
147213
|
-
var
|
|
147287
|
+
var import_node_crypto4 = require("node:crypto");
|
|
147214
147288
|
var import_node_tls = require("node:tls");
|
|
147215
147289
|
var import_raw_body = __toESM(require_raw_body(), 1);
|
|
147216
147290
|
var import_content_type = __toESM(require_content_type(), 1);
|
|
@@ -147223,7 +147297,7 @@ var SSEServerTransport = class {
|
|
|
147223
147297
|
constructor(_endpoint, res, options) {
|
|
147224
147298
|
this._endpoint = _endpoint;
|
|
147225
147299
|
this.res = res;
|
|
147226
|
-
this._sessionId = (0,
|
|
147300
|
+
this._sessionId = (0, import_node_crypto4.randomUUID)();
|
|
147227
147301
|
this._options = options || { enableDnsRebindingProtection: false };
|
|
147228
147302
|
}
|
|
147229
147303
|
/**
|
|
@@ -149205,7 +149279,7 @@ var StreamableHTTPServerTransport = class {
|
|
|
149205
149279
|
};
|
|
149206
149280
|
|
|
149207
149281
|
// src/services/mcp.streamable.service.ts
|
|
149208
|
-
var
|
|
149282
|
+
var import_node_crypto5 = require("node:crypto");
|
|
149209
149283
|
var __decorate18 = function(decorators, target, key, desc) {
|
|
149210
149284
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
149211
149285
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -149442,7 +149516,7 @@ var McpStreamableService = class McpStreamableService2 extends Service {
|
|
|
149442
149516
|
* Each session gets its own Server instance to avoid the "Already connected" error.
|
|
149443
149517
|
*/
|
|
149444
149518
|
async createStreamableTransport() {
|
|
149445
|
-
const sessionId = (0,
|
|
149519
|
+
const sessionId = (0, import_node_crypto5.randomUUID)();
|
|
149446
149520
|
const partialSession = {};
|
|
149447
149521
|
const server = new McpServer({ name: "Remote Skilder Server", version: "1.0.0" }, { capabilities: { tools: { listChanged: true } } });
|
|
149448
149522
|
registerMcpHandlers(server, this.sessions, this.logger);
|
|
@@ -149565,10 +149639,183 @@ McpStreamableService = __decorate18([
|
|
|
149565
149639
|
|
|
149566
149640
|
// src/services/script-executor.service.ts
|
|
149567
149641
|
var import_child_process = require("child_process");
|
|
149568
|
-
var
|
|
149642
|
+
var import_promises2 = require("fs/promises");
|
|
149569
149643
|
var import_path2 = require("path");
|
|
149570
149644
|
var import_os4 = require("os");
|
|
149571
149645
|
var import_readline = require("readline");
|
|
149646
|
+
|
|
149647
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
149648
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
149649
|
+
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
149650
|
+
var import_node_stream3 = require("node:stream");
|
|
149651
|
+
var DEFAULT_INHERITED_ENV_VARS = import_node_process2.default.platform === "win32" ? [
|
|
149652
|
+
"APPDATA",
|
|
149653
|
+
"HOMEDRIVE",
|
|
149654
|
+
"HOMEPATH",
|
|
149655
|
+
"LOCALAPPDATA",
|
|
149656
|
+
"PATH",
|
|
149657
|
+
"PROCESSOR_ARCHITECTURE",
|
|
149658
|
+
"SYSTEMDRIVE",
|
|
149659
|
+
"SYSTEMROOT",
|
|
149660
|
+
"TEMP",
|
|
149661
|
+
"USERNAME",
|
|
149662
|
+
"USERPROFILE",
|
|
149663
|
+
"PROGRAMFILES"
|
|
149664
|
+
] : (
|
|
149665
|
+
/* list inspired by the default env inheritance of sudo */
|
|
149666
|
+
["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"]
|
|
149667
|
+
);
|
|
149668
|
+
function getDefaultEnvironment() {
|
|
149669
|
+
const env = {};
|
|
149670
|
+
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
149671
|
+
const value = import_node_process2.default.env[key];
|
|
149672
|
+
if (value === void 0) {
|
|
149673
|
+
continue;
|
|
149674
|
+
}
|
|
149675
|
+
if (value.startsWith("()")) {
|
|
149676
|
+
continue;
|
|
149677
|
+
}
|
|
149678
|
+
env[key] = value;
|
|
149679
|
+
}
|
|
149680
|
+
return env;
|
|
149681
|
+
}
|
|
149682
|
+
var StdioClientTransport = class {
|
|
149683
|
+
constructor(server) {
|
|
149684
|
+
this._readBuffer = new ReadBuffer();
|
|
149685
|
+
this._stderrStream = null;
|
|
149686
|
+
this._serverParams = server;
|
|
149687
|
+
if (server.stderr === "pipe" || server.stderr === "overlapped") {
|
|
149688
|
+
this._stderrStream = new import_node_stream3.PassThrough();
|
|
149689
|
+
}
|
|
149690
|
+
}
|
|
149691
|
+
/**
|
|
149692
|
+
* Starts the server process and prepares to communicate with it.
|
|
149693
|
+
*/
|
|
149694
|
+
async start() {
|
|
149695
|
+
if (this._process) {
|
|
149696
|
+
throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
149697
|
+
}
|
|
149698
|
+
return new Promise((resolve5, reject) => {
|
|
149699
|
+
this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
|
|
149700
|
+
// merge default env with server env because mcp server needs some env vars
|
|
149701
|
+
env: {
|
|
149702
|
+
...getDefaultEnvironment(),
|
|
149703
|
+
...this._serverParams.env
|
|
149704
|
+
},
|
|
149705
|
+
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
149706
|
+
shell: false,
|
|
149707
|
+
windowsHide: import_node_process2.default.platform === "win32" && isElectron(),
|
|
149708
|
+
cwd: this._serverParams.cwd
|
|
149709
|
+
});
|
|
149710
|
+
this._process.on("error", (error48) => {
|
|
149711
|
+
reject(error48);
|
|
149712
|
+
this.onerror?.(error48);
|
|
149713
|
+
});
|
|
149714
|
+
this._process.on("spawn", () => {
|
|
149715
|
+
resolve5();
|
|
149716
|
+
});
|
|
149717
|
+
this._process.on("close", (_code) => {
|
|
149718
|
+
this._process = void 0;
|
|
149719
|
+
this.onclose?.();
|
|
149720
|
+
});
|
|
149721
|
+
this._process.stdin?.on("error", (error48) => {
|
|
149722
|
+
this.onerror?.(error48);
|
|
149723
|
+
});
|
|
149724
|
+
this._process.stdout?.on("data", (chunk) => {
|
|
149725
|
+
this._readBuffer.append(chunk);
|
|
149726
|
+
this.processReadBuffer();
|
|
149727
|
+
});
|
|
149728
|
+
this._process.stdout?.on("error", (error48) => {
|
|
149729
|
+
this.onerror?.(error48);
|
|
149730
|
+
});
|
|
149731
|
+
if (this._stderrStream && this._process.stderr) {
|
|
149732
|
+
this._process.stderr.pipe(this._stderrStream);
|
|
149733
|
+
}
|
|
149734
|
+
});
|
|
149735
|
+
}
|
|
149736
|
+
/**
|
|
149737
|
+
* The stderr stream of the child process, if `StdioServerParameters.stderr` was set to "pipe" or "overlapped".
|
|
149738
|
+
*
|
|
149739
|
+
* If stderr piping was requested, a PassThrough stream is returned _immediately_, allowing callers to
|
|
149740
|
+
* attach listeners before the start method is invoked. This prevents loss of any early
|
|
149741
|
+
* error output emitted by the child process.
|
|
149742
|
+
*/
|
|
149743
|
+
get stderr() {
|
|
149744
|
+
if (this._stderrStream) {
|
|
149745
|
+
return this._stderrStream;
|
|
149746
|
+
}
|
|
149747
|
+
return this._process?.stderr ?? null;
|
|
149748
|
+
}
|
|
149749
|
+
/**
|
|
149750
|
+
* The child process pid spawned by this transport.
|
|
149751
|
+
*
|
|
149752
|
+
* This is only available after the transport has been started.
|
|
149753
|
+
*/
|
|
149754
|
+
get pid() {
|
|
149755
|
+
return this._process?.pid ?? null;
|
|
149756
|
+
}
|
|
149757
|
+
processReadBuffer() {
|
|
149758
|
+
while (true) {
|
|
149759
|
+
try {
|
|
149760
|
+
const message = this._readBuffer.readMessage();
|
|
149761
|
+
if (message === null) {
|
|
149762
|
+
break;
|
|
149763
|
+
}
|
|
149764
|
+
this.onmessage?.(message);
|
|
149765
|
+
} catch (error48) {
|
|
149766
|
+
this.onerror?.(error48);
|
|
149767
|
+
}
|
|
149768
|
+
}
|
|
149769
|
+
}
|
|
149770
|
+
async close() {
|
|
149771
|
+
if (this._process) {
|
|
149772
|
+
const processToClose = this._process;
|
|
149773
|
+
this._process = void 0;
|
|
149774
|
+
const closePromise = new Promise((resolve5) => {
|
|
149775
|
+
processToClose.once("close", () => {
|
|
149776
|
+
resolve5();
|
|
149777
|
+
});
|
|
149778
|
+
});
|
|
149779
|
+
try {
|
|
149780
|
+
processToClose.stdin?.end();
|
|
149781
|
+
} catch {
|
|
149782
|
+
}
|
|
149783
|
+
await Promise.race([closePromise, new Promise((resolve5) => setTimeout(resolve5, 2e3).unref())]);
|
|
149784
|
+
if (processToClose.exitCode === null) {
|
|
149785
|
+
try {
|
|
149786
|
+
processToClose.kill("SIGTERM");
|
|
149787
|
+
} catch {
|
|
149788
|
+
}
|
|
149789
|
+
await Promise.race([closePromise, new Promise((resolve5) => setTimeout(resolve5, 2e3).unref())]);
|
|
149790
|
+
}
|
|
149791
|
+
if (processToClose.exitCode === null) {
|
|
149792
|
+
try {
|
|
149793
|
+
processToClose.kill("SIGKILL");
|
|
149794
|
+
} catch {
|
|
149795
|
+
}
|
|
149796
|
+
}
|
|
149797
|
+
}
|
|
149798
|
+
this._readBuffer.clear();
|
|
149799
|
+
}
|
|
149800
|
+
send(message) {
|
|
149801
|
+
return new Promise((resolve5) => {
|
|
149802
|
+
if (!this._process?.stdin) {
|
|
149803
|
+
throw new Error("Not connected");
|
|
149804
|
+
}
|
|
149805
|
+
const json3 = serializeMessage(message);
|
|
149806
|
+
if (this._process.stdin.write(json3)) {
|
|
149807
|
+
resolve5();
|
|
149808
|
+
} else {
|
|
149809
|
+
this._process.stdin.once("drain", resolve5);
|
|
149810
|
+
}
|
|
149811
|
+
});
|
|
149812
|
+
}
|
|
149813
|
+
};
|
|
149814
|
+
function isElectron() {
|
|
149815
|
+
return "type" in import_node_process2.default;
|
|
149816
|
+
}
|
|
149817
|
+
|
|
149818
|
+
// src/services/script-executor.service.ts
|
|
149572
149819
|
var __decorate19 = function(decorators, target, key, desc) {
|
|
149573
149820
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
149574
149821
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -149584,24 +149831,36 @@ var __param16 = function(paramIndex, decorator) {
|
|
|
149584
149831
|
};
|
|
149585
149832
|
};
|
|
149586
149833
|
var _a41;
|
|
149834
|
+
var _b31;
|
|
149587
149835
|
var ScriptType2 = dgraph_resolvers_types_exports.ScriptType;
|
|
149588
149836
|
var ScriptExecutorService = class ScriptExecutorService2 {
|
|
149589
|
-
constructor(loggerService) {
|
|
149837
|
+
constructor(loggerService, fileService) {
|
|
149838
|
+
this.fileService = fileService;
|
|
149590
149839
|
this.logger = loggerService.getLogger("script-executor");
|
|
149591
149840
|
}
|
|
149841
|
+
buildScriptEnv(extra = {}) {
|
|
149842
|
+
const env = {
|
|
149843
|
+
...getDefaultEnvironment(),
|
|
149844
|
+
...this.fileService.getEnvVars(),
|
|
149845
|
+
...extra
|
|
149846
|
+
};
|
|
149847
|
+
this.logger.debug({ envKeys: Object.keys(env) }, "Built script environment");
|
|
149848
|
+
return env;
|
|
149849
|
+
}
|
|
149592
149850
|
async execute(options) {
|
|
149593
149851
|
const { code, scriptType, args = [], timeout: timeout2 = DEFAULT_SCRIPT_TIMEOUT_MS } = options;
|
|
149594
149852
|
this.logger.debug({ scriptType, argsCount: args.length, timeout: timeout2 }, "Executing script");
|
|
149595
149853
|
let tempDir;
|
|
149596
149854
|
let tempFile;
|
|
149597
149855
|
try {
|
|
149598
|
-
tempDir = await (0,
|
|
149856
|
+
tempDir = await (0, import_promises2.mkdtemp)((0, import_path2.join)((0, import_os4.tmpdir)(), "skilder-script-"));
|
|
149599
149857
|
const extension = this.getFileExtension(scriptType);
|
|
149600
149858
|
tempFile = (0, import_path2.join)(tempDir, `script${extension}`);
|
|
149601
|
-
await (0,
|
|
149859
|
+
await (0, import_promises2.writeFile)(tempFile, code, "utf-8");
|
|
149602
149860
|
const { command, commandArgs } = this.getCommand(scriptType, tempFile, args);
|
|
149603
149861
|
this.logger.debug({ command, commandArgs }, "Spawning process");
|
|
149604
|
-
const
|
|
149862
|
+
const scriptEnv = this.buildScriptEnv();
|
|
149863
|
+
const result = await this.spawnProcess(command, commandArgs, timeout2, scriptEnv);
|
|
149605
149864
|
return result;
|
|
149606
149865
|
} catch (error48) {
|
|
149607
149866
|
this.logger.error({ error: error48 }, "Script execution failed");
|
|
@@ -149642,7 +149901,7 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149642
149901
|
throw new Error(`Unsupported script type: ${scriptType}`);
|
|
149643
149902
|
}
|
|
149644
149903
|
}
|
|
149645
|
-
spawnProcess(command, args, timeout2) {
|
|
149904
|
+
spawnProcess(command, args, timeout2, env) {
|
|
149646
149905
|
return new Promise((resolve5) => {
|
|
149647
149906
|
let stdout = "";
|
|
149648
149907
|
let stderr = "";
|
|
@@ -149651,8 +149910,8 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149651
149910
|
let totalOutputSize = 0;
|
|
149652
149911
|
const child = (0, import_child_process.spawn)(command, args, {
|
|
149653
149912
|
stdio: ["pipe", "pipe", "pipe"],
|
|
149654
|
-
|
|
149655
|
-
|
|
149913
|
+
shell: process.platform === "win32",
|
|
149914
|
+
env
|
|
149656
149915
|
});
|
|
149657
149916
|
const timeoutId = setTimeout(() => {
|
|
149658
149917
|
killed = true;
|
|
@@ -149687,6 +149946,7 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149687
149946
|
});
|
|
149688
149947
|
child.on("error", (error48) => {
|
|
149689
149948
|
clearTimeout(timeoutId);
|
|
149949
|
+
this.logger.error({ err: error48, command }, "Spawned process emitted error");
|
|
149690
149950
|
resolve5({
|
|
149691
149951
|
success: false,
|
|
149692
149952
|
stdout,
|
|
@@ -149701,7 +149961,7 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149701
149961
|
success: false,
|
|
149702
149962
|
stdout,
|
|
149703
149963
|
stderr,
|
|
149704
|
-
error:
|
|
149964
|
+
error: `Script output exceeded maximum size of ${MAX_SCRIPT_OUTPUT_SIZE / (1024 * 1024)}MB`
|
|
149705
149965
|
});
|
|
149706
149966
|
return;
|
|
149707
149967
|
}
|
|
@@ -149742,18 +150002,19 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149742
150002
|
this.logger.debug({ scriptType, argsCount: args.length }, "Executing interactive script");
|
|
149743
150003
|
let tempDir;
|
|
149744
150004
|
try {
|
|
149745
|
-
tempDir = await (0,
|
|
150005
|
+
tempDir = await (0, import_promises2.mkdtemp)((0, import_path2.join)((0, import_os4.tmpdir)(), "skilder-script-"));
|
|
149746
150006
|
const extension = this.getFileExtension(scriptType);
|
|
149747
150007
|
const tempFile = (0, import_path2.join)(tempDir, `script${extension}`);
|
|
149748
|
-
await (0,
|
|
149749
|
-
await (0,
|
|
150008
|
+
await (0, import_promises2.writeFile)(tempFile, code, "utf-8");
|
|
150009
|
+
await (0, import_promises2.writeFile)((0, import_path2.join)(tempDir, "package.json"), JSON.stringify({ type: "module" }), "utf-8");
|
|
149750
150010
|
const sdkDir = (0, import_path2.join)(tempDir, "node_modules", "@skilder-ai", "script-sdk");
|
|
149751
|
-
await (0,
|
|
149752
|
-
await (0,
|
|
149753
|
-
await (0,
|
|
150011
|
+
await (0, import_promises2.mkdir)(sdkDir, { recursive: true });
|
|
150012
|
+
await (0, import_promises2.writeFile)((0, import_path2.join)(sdkDir, "index.cjs"), sdkBundleContent, "utf-8");
|
|
150013
|
+
await (0, import_promises2.writeFile)((0, import_path2.join)(sdkDir, "package.json"), JSON.stringify({ name: "@skilder-ai/script-sdk", version: "0.1.0", main: "index.cjs", exports: { ".": { require: "./index.cjs", default: "./index.cjs" } } }), "utf-8");
|
|
149754
150014
|
const { command, commandArgs } = this.getCommand(scriptType, tempFile, args);
|
|
149755
150015
|
this.logger.debug({ command, commandArgs }, "Spawning interactive process");
|
|
149756
|
-
const
|
|
150016
|
+
const scriptEnv = this.buildScriptEnv({ SKILDER_INTERACTIVE: "1", NODE_PATH: (0, import_path2.join)(tempDir, "node_modules") });
|
|
150017
|
+
const result = await this.spawnInteractiveProcess(command, commandArgs, timeout2, toolCallTimeout, onRequest, scriptEnv);
|
|
149757
150018
|
return result;
|
|
149758
150019
|
} catch (error48) {
|
|
149759
150020
|
this.logger.error({ error: error48 }, "Interactive script execution failed");
|
|
@@ -149766,25 +150027,22 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149766
150027
|
await this.cleanupRecursive(tempDir);
|
|
149767
150028
|
}
|
|
149768
150029
|
}
|
|
149769
|
-
spawnInteractiveProcess(command, args,
|
|
150030
|
+
spawnInteractiveProcess(command, args, timeout2, toolCallTimeout, onRequest, env) {
|
|
149770
150031
|
return new Promise((resolve5) => {
|
|
149771
150032
|
let stderr = "";
|
|
149772
150033
|
let killed = false;
|
|
149773
150034
|
let outputTruncated = false;
|
|
149774
150035
|
let totalOutputSize = 0;
|
|
149775
150036
|
let childExited = false;
|
|
149776
|
-
const
|
|
150037
|
+
const outputChunks = [];
|
|
150038
|
+
const consoleChunks = [];
|
|
149777
150039
|
const totalStartTime = Date.now();
|
|
149778
150040
|
let inflightCount = 0;
|
|
149779
150041
|
let inflightDone;
|
|
149780
150042
|
const child = (0, import_child_process.spawn)(command, args, {
|
|
149781
150043
|
stdio: ["pipe", "pipe", "pipe"],
|
|
149782
150044
|
shell: process.platform === "win32",
|
|
149783
|
-
env
|
|
149784
|
-
...process.env,
|
|
149785
|
-
SKILDER_INTERACTIVE: "1",
|
|
149786
|
-
NODE_PATH: (0, import_path2.join)(tempDir, "node_modules")
|
|
149787
|
-
}
|
|
150045
|
+
env
|
|
149788
150046
|
});
|
|
149789
150047
|
const pendingIds = /* @__PURE__ */ new Set();
|
|
149790
150048
|
let currentTimeout = timeout2;
|
|
@@ -149866,15 +150124,20 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149866
150124
|
try {
|
|
149867
150125
|
msg = JSON.parse(line);
|
|
149868
150126
|
} catch {
|
|
149869
|
-
|
|
150127
|
+
consoleChunks.push(line);
|
|
150128
|
+
this.logger.debug({ line }, "Script console line (non-JSON)");
|
|
149870
150129
|
return;
|
|
149871
150130
|
}
|
|
149872
150131
|
if (msg.jsonrpc !== "2.0" || !msg.method) {
|
|
149873
|
-
|
|
150132
|
+
consoleChunks.push(line);
|
|
149874
150133
|
return;
|
|
149875
150134
|
}
|
|
149876
150135
|
if (msg.id === void 0) {
|
|
149877
|
-
|
|
150136
|
+
if (msg.method === "$output" && msg.params !== null && typeof msg.params === "object" && typeof msg.params.text === "string") {
|
|
150137
|
+
outputChunks.push(msg.params.text);
|
|
150138
|
+
} else {
|
|
150139
|
+
this.logger.debug({ method: msg.method }, "Received JSON-RPC notification (no id) \u2014 ignoring");
|
|
150140
|
+
}
|
|
149878
150141
|
return;
|
|
149879
150142
|
}
|
|
149880
150143
|
inflightCount++;
|
|
@@ -149915,34 +150178,46 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149915
150178
|
totalOutputSize += dataSize;
|
|
149916
150179
|
stderr += data.toString();
|
|
149917
150180
|
});
|
|
149918
|
-
child.on("error", (error48) => {
|
|
150181
|
+
child.on("error", async (error48) => {
|
|
149919
150182
|
childExited = true;
|
|
149920
150183
|
clearTimeout(timeoutId);
|
|
149921
|
-
|
|
150184
|
+
this.logger.error({ err: error48, command }, "Spawned interactive process emitted error");
|
|
150185
|
+
rl.close();
|
|
150186
|
+
if (inflightCount > 0) {
|
|
150187
|
+
await new Promise((done) => {
|
|
150188
|
+
inflightDone = done;
|
|
150189
|
+
});
|
|
150190
|
+
}
|
|
150191
|
+
const stdout = outputChunks.join("\n");
|
|
150192
|
+
const consoleOutput = consoleChunks.join("\n") || void 0;
|
|
150193
|
+
resolve5({ success: false, stdout, consoleOutput, stderr, error: error48.message });
|
|
149922
150194
|
});
|
|
149923
150195
|
child.on("close", async (exitCode) => {
|
|
149924
150196
|
childExited = true;
|
|
149925
150197
|
clearTimeout(timeoutId);
|
|
150198
|
+
rl.close();
|
|
149926
150199
|
if (inflightCount > 0) {
|
|
149927
150200
|
await new Promise((done) => {
|
|
149928
150201
|
inflightDone = done;
|
|
149929
150202
|
});
|
|
149930
150203
|
}
|
|
149931
|
-
const stdout =
|
|
150204
|
+
const stdout = outputChunks.join("\n");
|
|
150205
|
+
const consoleOutput = consoleChunks.join("\n") || void 0;
|
|
149932
150206
|
if (outputTruncated) {
|
|
149933
|
-
resolve5({ success: false, stdout, stderr, error:
|
|
150207
|
+
resolve5({ success: false, stdout, consoleOutput, stderr, error: `Script output exceeded maximum size of ${MAX_SCRIPT_OUTPUT_SIZE / (1024 * 1024)}MB` });
|
|
149934
150208
|
return;
|
|
149935
150209
|
}
|
|
149936
150210
|
if (killed) {
|
|
149937
|
-
resolve5({ success: false, stdout, stderr, error: `Script execution timed out after ${currentTimeout}ms` });
|
|
150211
|
+
resolve5({ success: false, stdout, consoleOutput, stderr, error: `Script execution timed out after ${currentTimeout}ms` });
|
|
149938
150212
|
return;
|
|
149939
150213
|
}
|
|
149940
150214
|
if (exitCode === 0) {
|
|
149941
|
-
resolve5({ success: true, stdout, stderr: stderr || void 0, exitCode: 0 });
|
|
150215
|
+
resolve5({ success: true, stdout, consoleOutput, stderr: stderr || void 0, exitCode: 0 });
|
|
149942
150216
|
} else {
|
|
149943
150217
|
resolve5({
|
|
149944
150218
|
success: false,
|
|
149945
150219
|
stdout,
|
|
150220
|
+
consoleOutput,
|
|
149946
150221
|
stderr,
|
|
149947
150222
|
exitCode: exitCode ?? void 0,
|
|
149948
150223
|
error: stderr || `Script exited with code ${exitCode}`
|
|
@@ -149954,7 +150229,7 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149954
150229
|
async cleanupRecursive(tempDir) {
|
|
149955
150230
|
try {
|
|
149956
150231
|
if (tempDir) {
|
|
149957
|
-
await (0,
|
|
150232
|
+
await (0, import_promises2.rm)(tempDir, { recursive: true, force: true });
|
|
149958
150233
|
}
|
|
149959
150234
|
} catch (error48) {
|
|
149960
150235
|
this.logger.warn({ error: error48, tempDir }, "Failed to cleanup temp files");
|
|
@@ -149964,11 +150239,12 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149964
150239
|
ScriptExecutorService = __decorate19([
|
|
149965
150240
|
W(),
|
|
149966
150241
|
__param16(0, U(LoggerService)),
|
|
149967
|
-
|
|
150242
|
+
__param16(1, U(FileService)),
|
|
150243
|
+
__metadata18("design:paramtypes", [typeof (_a41 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a41 : Object, typeof (_b31 = typeof FileService !== "undefined" && FileService) === "function" ? _b31 : Object])
|
|
149968
150244
|
], ScriptExecutorService);
|
|
149969
150245
|
|
|
149970
150246
|
// src/services/tool.service.ts
|
|
149971
|
-
var
|
|
150247
|
+
var import_promises3 = require("fs/promises");
|
|
149972
150248
|
var import_path3 = require("path");
|
|
149973
150249
|
|
|
149974
150250
|
// src/services/tool.mcp.server.service.ts
|
|
@@ -150648,177 +150924,6 @@ var Client = class extends Protocol {
|
|
|
150648
150924
|
}
|
|
150649
150925
|
};
|
|
150650
150926
|
|
|
150651
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
150652
|
-
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
150653
|
-
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
150654
|
-
var import_node_stream = require("node:stream");
|
|
150655
|
-
var DEFAULT_INHERITED_ENV_VARS = import_node_process2.default.platform === "win32" ? [
|
|
150656
|
-
"APPDATA",
|
|
150657
|
-
"HOMEDRIVE",
|
|
150658
|
-
"HOMEPATH",
|
|
150659
|
-
"LOCALAPPDATA",
|
|
150660
|
-
"PATH",
|
|
150661
|
-
"PROCESSOR_ARCHITECTURE",
|
|
150662
|
-
"SYSTEMDRIVE",
|
|
150663
|
-
"SYSTEMROOT",
|
|
150664
|
-
"TEMP",
|
|
150665
|
-
"USERNAME",
|
|
150666
|
-
"USERPROFILE",
|
|
150667
|
-
"PROGRAMFILES"
|
|
150668
|
-
] : (
|
|
150669
|
-
/* list inspired by the default env inheritance of sudo */
|
|
150670
|
-
["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"]
|
|
150671
|
-
);
|
|
150672
|
-
function getDefaultEnvironment() {
|
|
150673
|
-
const env = {};
|
|
150674
|
-
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
150675
|
-
const value = import_node_process2.default.env[key];
|
|
150676
|
-
if (value === void 0) {
|
|
150677
|
-
continue;
|
|
150678
|
-
}
|
|
150679
|
-
if (value.startsWith("()")) {
|
|
150680
|
-
continue;
|
|
150681
|
-
}
|
|
150682
|
-
env[key] = value;
|
|
150683
|
-
}
|
|
150684
|
-
return env;
|
|
150685
|
-
}
|
|
150686
|
-
var StdioClientTransport = class {
|
|
150687
|
-
constructor(server) {
|
|
150688
|
-
this._readBuffer = new ReadBuffer();
|
|
150689
|
-
this._stderrStream = null;
|
|
150690
|
-
this._serverParams = server;
|
|
150691
|
-
if (server.stderr === "pipe" || server.stderr === "overlapped") {
|
|
150692
|
-
this._stderrStream = new import_node_stream.PassThrough();
|
|
150693
|
-
}
|
|
150694
|
-
}
|
|
150695
|
-
/**
|
|
150696
|
-
* Starts the server process and prepares to communicate with it.
|
|
150697
|
-
*/
|
|
150698
|
-
async start() {
|
|
150699
|
-
if (this._process) {
|
|
150700
|
-
throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
150701
|
-
}
|
|
150702
|
-
return new Promise((resolve5, reject) => {
|
|
150703
|
-
this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
|
|
150704
|
-
// merge default env with server env because mcp server needs some env vars
|
|
150705
|
-
env: {
|
|
150706
|
-
...getDefaultEnvironment(),
|
|
150707
|
-
...this._serverParams.env
|
|
150708
|
-
},
|
|
150709
|
-
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
150710
|
-
shell: false,
|
|
150711
|
-
windowsHide: import_node_process2.default.platform === "win32" && isElectron(),
|
|
150712
|
-
cwd: this._serverParams.cwd
|
|
150713
|
-
});
|
|
150714
|
-
this._process.on("error", (error48) => {
|
|
150715
|
-
reject(error48);
|
|
150716
|
-
this.onerror?.(error48);
|
|
150717
|
-
});
|
|
150718
|
-
this._process.on("spawn", () => {
|
|
150719
|
-
resolve5();
|
|
150720
|
-
});
|
|
150721
|
-
this._process.on("close", (_code) => {
|
|
150722
|
-
this._process = void 0;
|
|
150723
|
-
this.onclose?.();
|
|
150724
|
-
});
|
|
150725
|
-
this._process.stdin?.on("error", (error48) => {
|
|
150726
|
-
this.onerror?.(error48);
|
|
150727
|
-
});
|
|
150728
|
-
this._process.stdout?.on("data", (chunk) => {
|
|
150729
|
-
this._readBuffer.append(chunk);
|
|
150730
|
-
this.processReadBuffer();
|
|
150731
|
-
});
|
|
150732
|
-
this._process.stdout?.on("error", (error48) => {
|
|
150733
|
-
this.onerror?.(error48);
|
|
150734
|
-
});
|
|
150735
|
-
if (this._stderrStream && this._process.stderr) {
|
|
150736
|
-
this._process.stderr.pipe(this._stderrStream);
|
|
150737
|
-
}
|
|
150738
|
-
});
|
|
150739
|
-
}
|
|
150740
|
-
/**
|
|
150741
|
-
* The stderr stream of the child process, if `StdioServerParameters.stderr` was set to "pipe" or "overlapped".
|
|
150742
|
-
*
|
|
150743
|
-
* If stderr piping was requested, a PassThrough stream is returned _immediately_, allowing callers to
|
|
150744
|
-
* attach listeners before the start method is invoked. This prevents loss of any early
|
|
150745
|
-
* error output emitted by the child process.
|
|
150746
|
-
*/
|
|
150747
|
-
get stderr() {
|
|
150748
|
-
if (this._stderrStream) {
|
|
150749
|
-
return this._stderrStream;
|
|
150750
|
-
}
|
|
150751
|
-
return this._process?.stderr ?? null;
|
|
150752
|
-
}
|
|
150753
|
-
/**
|
|
150754
|
-
* The child process pid spawned by this transport.
|
|
150755
|
-
*
|
|
150756
|
-
* This is only available after the transport has been started.
|
|
150757
|
-
*/
|
|
150758
|
-
get pid() {
|
|
150759
|
-
return this._process?.pid ?? null;
|
|
150760
|
-
}
|
|
150761
|
-
processReadBuffer() {
|
|
150762
|
-
while (true) {
|
|
150763
|
-
try {
|
|
150764
|
-
const message = this._readBuffer.readMessage();
|
|
150765
|
-
if (message === null) {
|
|
150766
|
-
break;
|
|
150767
|
-
}
|
|
150768
|
-
this.onmessage?.(message);
|
|
150769
|
-
} catch (error48) {
|
|
150770
|
-
this.onerror?.(error48);
|
|
150771
|
-
}
|
|
150772
|
-
}
|
|
150773
|
-
}
|
|
150774
|
-
async close() {
|
|
150775
|
-
if (this._process) {
|
|
150776
|
-
const processToClose = this._process;
|
|
150777
|
-
this._process = void 0;
|
|
150778
|
-
const closePromise = new Promise((resolve5) => {
|
|
150779
|
-
processToClose.once("close", () => {
|
|
150780
|
-
resolve5();
|
|
150781
|
-
});
|
|
150782
|
-
});
|
|
150783
|
-
try {
|
|
150784
|
-
processToClose.stdin?.end();
|
|
150785
|
-
} catch {
|
|
150786
|
-
}
|
|
150787
|
-
await Promise.race([closePromise, new Promise((resolve5) => setTimeout(resolve5, 2e3).unref())]);
|
|
150788
|
-
if (processToClose.exitCode === null) {
|
|
150789
|
-
try {
|
|
150790
|
-
processToClose.kill("SIGTERM");
|
|
150791
|
-
} catch {
|
|
150792
|
-
}
|
|
150793
|
-
await Promise.race([closePromise, new Promise((resolve5) => setTimeout(resolve5, 2e3).unref())]);
|
|
150794
|
-
}
|
|
150795
|
-
if (processToClose.exitCode === null) {
|
|
150796
|
-
try {
|
|
150797
|
-
processToClose.kill("SIGKILL");
|
|
150798
|
-
} catch {
|
|
150799
|
-
}
|
|
150800
|
-
}
|
|
150801
|
-
}
|
|
150802
|
-
this._readBuffer.clear();
|
|
150803
|
-
}
|
|
150804
|
-
send(message) {
|
|
150805
|
-
return new Promise((resolve5) => {
|
|
150806
|
-
if (!this._process?.stdin) {
|
|
150807
|
-
throw new Error("Not connected");
|
|
150808
|
-
}
|
|
150809
|
-
const json3 = serializeMessage(message);
|
|
150810
|
-
if (this._process.stdin.write(json3)) {
|
|
150811
|
-
resolve5();
|
|
150812
|
-
} else {
|
|
150813
|
-
this._process.stdin.once("drain", resolve5);
|
|
150814
|
-
}
|
|
150815
|
-
});
|
|
150816
|
-
}
|
|
150817
|
-
};
|
|
150818
|
-
function isElectron() {
|
|
150819
|
-
return "type" in import_node_process2.default;
|
|
150820
|
-
}
|
|
150821
|
-
|
|
150822
150927
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
|
|
150823
150928
|
function normalizeHeaders2(headers) {
|
|
150824
150929
|
if (!headers)
|
|
@@ -152047,8 +152152,8 @@ var ErrorEvent = class extends Event {
|
|
|
152047
152152
|
* @param errorEventInitDict - Optional properties to include in the error event
|
|
152048
152153
|
*/
|
|
152049
152154
|
constructor(type22, errorEventInitDict) {
|
|
152050
|
-
var _a51,
|
|
152051
|
-
super(type22), this.code = (_a51 = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a51 : void 0, this.message = (
|
|
152155
|
+
var _a51, _b40;
|
|
152156
|
+
super(type22), this.code = (_a51 = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a51 : void 0, this.message = (_b40 = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b40 : void 0;
|
|
152052
152157
|
}
|
|
152053
152158
|
/**
|
|
152054
152159
|
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -152130,7 +152235,7 @@ var scheduleReconnect_fn;
|
|
|
152130
152235
|
var _reconnect;
|
|
152131
152236
|
var EventSource = class extends EventTarget {
|
|
152132
152237
|
constructor(url2, eventSourceInitDict) {
|
|
152133
|
-
var _a51,
|
|
152238
|
+
var _a51, _b40;
|
|
152134
152239
|
super(), __privateAdd(this, _EventSource_instances), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, __privateAdd(this, _readyState), __privateAdd(this, _url2), __privateAdd(this, _redirectUrl), __privateAdd(this, _withCredentials), __privateAdd(this, _fetch), __privateAdd(this, _reconnectInterval), __privateAdd(this, _reconnectTimer), __privateAdd(this, _lastEventId, null), __privateAdd(this, _controller), __privateAdd(this, _parser), __privateAdd(this, _onError, null), __privateAdd(this, _onMessage, null), __privateAdd(this, _onOpen, null), __privateAdd(this, _onFetchResponse, async (response) => {
|
|
152135
152240
|
var _a210;
|
|
152136
152241
|
__privateGet(this, _parser).reset();
|
|
@@ -152189,7 +152294,7 @@ var EventSource = class extends EventTarget {
|
|
|
152189
152294
|
__privateSet(this, _parser, createParser({
|
|
152190
152295
|
onEvent: __privateGet(this, _onEvent),
|
|
152191
152296
|
onRetry: __privateGet(this, _onRetryChange)
|
|
152192
|
-
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a51 = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a51 : globalThis.fetch), __privateSet(this, _withCredentials, (
|
|
152297
|
+
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a51 = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a51 : globalThis.fetch), __privateSet(this, _withCredentials, (_b40 = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b40 : false), __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
152193
152298
|
}
|
|
152194
152299
|
/**
|
|
152195
152300
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -152537,7 +152642,7 @@ var __metadata19 = function(k3, v2) {
|
|
|
152537
152642
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
152538
152643
|
};
|
|
152539
152644
|
var _a44;
|
|
152540
|
-
var
|
|
152645
|
+
var _b33;
|
|
152541
152646
|
var _c8;
|
|
152542
152647
|
var ToolServerService = class ToolServerService2 extends Service {
|
|
152543
152648
|
constructor(logger, config2, roots = [], additionalEnv = {}, authProvider) {
|
|
@@ -152754,7 +152859,7 @@ var ToolServerService = class ToolServerService2 extends Service {
|
|
|
152754
152859
|
};
|
|
152755
152860
|
ToolServerService = __decorate20([
|
|
152756
152861
|
W(),
|
|
152757
|
-
__metadata19("design:paramtypes", [typeof (_a44 = typeof import_pino2.default !== "undefined" && import_pino2.default.Logger) === "function" ? _a44 : Object, typeof (
|
|
152862
|
+
__metadata19("design:paramtypes", [typeof (_a44 = typeof import_pino2.default !== "undefined" && import_pino2.default.Logger) === "function" ? _a44 : Object, typeof (_b33 = typeof dgraph_resolvers_types_exports !== "undefined" && dgraph_resolvers_types_exports.McpServer) === "function" ? _b33 : Object, Array, typeof (_c8 = typeof Record !== "undefined" && Record) === "function" ? _c8 : Object, Object])
|
|
152758
152863
|
], ToolServerService);
|
|
152759
152864
|
var getConfigSignature = (config2, roots) => {
|
|
152760
152865
|
return `${config2.transport}-${config2.config}-${roots.length}`;
|
|
@@ -152776,7 +152881,7 @@ var __param17 = function(paramIndex, decorator) {
|
|
|
152776
152881
|
};
|
|
152777
152882
|
};
|
|
152778
152883
|
var _a45;
|
|
152779
|
-
var
|
|
152884
|
+
var _b34;
|
|
152780
152885
|
var OAuthTokenService = class OAuthTokenService2 {
|
|
152781
152886
|
constructor(loggerService, natsService) {
|
|
152782
152887
|
this.loggerService = loggerService;
|
|
@@ -152859,7 +152964,7 @@ OAuthTokenService = __decorate21([
|
|
|
152859
152964
|
W(),
|
|
152860
152965
|
__param17(0, U(LoggerService)),
|
|
152861
152966
|
__param17(1, U(NatsService)),
|
|
152862
|
-
__metadata20("design:paramtypes", [typeof (_a45 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a45 : Object, typeof (
|
|
152967
|
+
__metadata20("design:paramtypes", [typeof (_a45 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a45 : Object, typeof (_b34 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b34 : Object])
|
|
152863
152968
|
], OAuthTokenService);
|
|
152864
152969
|
|
|
152865
152970
|
// src/services/oauth-client-info.service.ts
|
|
@@ -152878,7 +152983,7 @@ var __param18 = function(paramIndex, decorator) {
|
|
|
152878
152983
|
};
|
|
152879
152984
|
};
|
|
152880
152985
|
var _a46;
|
|
152881
|
-
var
|
|
152986
|
+
var _b35;
|
|
152882
152987
|
var CACHE_TTL_MS = 10 * 60 * 1e3;
|
|
152883
152988
|
var CACHE_MAX_SIZE = 100;
|
|
152884
152989
|
var OAuthClientInfoService = class OAuthClientInfoService2 {
|
|
@@ -152941,7 +153046,7 @@ OAuthClientInfoService = __decorate22([
|
|
|
152941
153046
|
W(),
|
|
152942
153047
|
__param18(0, U(LoggerService)),
|
|
152943
153048
|
__param18(1, U(NatsService)),
|
|
152944
|
-
__metadata21("design:paramtypes", [typeof (_a46 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a46 : Object, typeof (
|
|
153049
|
+
__metadata21("design:paramtypes", [typeof (_a46 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a46 : Object, typeof (_b35 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b35 : Object])
|
|
152945
153050
|
], OAuthClientInfoService);
|
|
152946
153051
|
|
|
152947
153052
|
// src/services/dynamic-tool-router.service.ts
|
|
@@ -152960,7 +153065,7 @@ var __param19 = function(paramIndex, decorator) {
|
|
|
152960
153065
|
};
|
|
152961
153066
|
};
|
|
152962
153067
|
var _a47;
|
|
152963
|
-
var
|
|
153068
|
+
var _b36;
|
|
152964
153069
|
var DynamicToolRouter = class DynamicToolRouter2 {
|
|
152965
153070
|
constructor(loggerService, natsService) {
|
|
152966
153071
|
this.natsService = natsService;
|
|
@@ -153005,7 +153110,7 @@ DynamicToolRouter = __decorate23([
|
|
|
153005
153110
|
W(),
|
|
153006
153111
|
__param19(0, U(LoggerService)),
|
|
153007
153112
|
__param19(1, U(NatsService)),
|
|
153008
|
-
__metadata22("design:paramtypes", [typeof (_a47 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a47 : Object, typeof (
|
|
153113
|
+
__metadata22("design:paramtypes", [typeof (_a47 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a47 : Object, typeof (_b36 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b36 : Object])
|
|
153009
153114
|
], DynamicToolRouter);
|
|
153010
153115
|
|
|
153011
153116
|
// src/services/runtime-bus.service.ts
|
|
@@ -153024,7 +153129,7 @@ var __param20 = function(paramIndex, decorator) {
|
|
|
153024
153129
|
};
|
|
153025
153130
|
};
|
|
153026
153131
|
var _a48;
|
|
153027
|
-
var
|
|
153132
|
+
var _b37;
|
|
153028
153133
|
var RuntimeBusService = class RuntimeBusService2 {
|
|
153029
153134
|
constructor(loggerService, natsService) {
|
|
153030
153135
|
this.natsService = natsService;
|
|
@@ -153106,7 +153211,7 @@ RuntimeBusService = __decorate24([
|
|
|
153106
153211
|
__param20(0, U(LoggerService)),
|
|
153107
153212
|
__param20(1, U(NatsService)),
|
|
153108
153213
|
__param20(1, se()),
|
|
153109
|
-
__metadata23("design:paramtypes", [typeof (_a48 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a48 : Object, typeof (
|
|
153214
|
+
__metadata23("design:paramtypes", [typeof (_a48 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a48 : Object, typeof (_b37 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b37 : Object])
|
|
153110
153215
|
], RuntimeBusService);
|
|
153111
153216
|
|
|
153112
153217
|
// src/services/tool.service.ts
|
|
@@ -153125,7 +153230,7 @@ var __param21 = function(paramIndex, decorator) {
|
|
|
153125
153230
|
};
|
|
153126
153231
|
};
|
|
153127
153232
|
var _a49;
|
|
153128
|
-
var
|
|
153233
|
+
var _b38;
|
|
153129
153234
|
var _c9;
|
|
153130
153235
|
var _d6;
|
|
153131
153236
|
var _e6;
|
|
@@ -153136,7 +153241,6 @@ var _k;
|
|
|
153136
153241
|
var _o;
|
|
153137
153242
|
var _p;
|
|
153138
153243
|
var _q;
|
|
153139
|
-
var _r;
|
|
153140
153244
|
var GET_SKILL_RELATED_QUERY = `
|
|
153141
153245
|
query GetSkillRelated($id: ID!) {
|
|
153142
153246
|
skillRelated(id: $id) {
|
|
@@ -153177,7 +153281,7 @@ function formatScriptError(stderr, exitCode) {
|
|
|
153177
153281
|
return result;
|
|
153178
153282
|
}
|
|
153179
153283
|
var ToolService = class ToolService2 extends Service {
|
|
153180
|
-
constructor(loggerService, natsService, cacheService, authService, healthService, toolServerServiceFactory, oauthTokenService, oauthClientInfoService, mcpStdioService, fileService, runtimeExecutionId, scriptExecutorService, delegateService, scriptService,
|
|
153284
|
+
constructor(loggerService, natsService, cacheService, authService, healthService, toolServerServiceFactory, oauthTokenService, oauthClientInfoService, mcpStdioService, fileService, runtimeExecutionId, scriptExecutorService, delegateService, scriptService, runtimeCatalogService, dynamicToolRouter, runtimeBusService) {
|
|
153181
153285
|
super();
|
|
153182
153286
|
this.loggerService = loggerService;
|
|
153183
153287
|
this.natsService = natsService;
|
|
@@ -153192,7 +153296,6 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153192
153296
|
this.scriptExecutorService = scriptExecutorService;
|
|
153193
153297
|
this.delegateService = delegateService;
|
|
153194
153298
|
this.scriptService = scriptService;
|
|
153195
|
-
this.skillContentService = skillContentService;
|
|
153196
153299
|
this.runtimeCatalogService = runtimeCatalogService;
|
|
153197
153300
|
this.dynamicToolRouter = dynamicToolRouter;
|
|
153198
153301
|
this.runtimeBusService = runtimeBusService;
|
|
@@ -153404,7 +153507,7 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153404
153507
|
await this.stopMCPServer(mcpServer);
|
|
153405
153508
|
}
|
|
153406
153509
|
if (existingDormant) {
|
|
153407
|
-
this.
|
|
153510
|
+
this.removeDormantServer(mcpServer.id);
|
|
153408
153511
|
}
|
|
153409
153512
|
this.activationFailures.delete(mcpServer.id);
|
|
153410
153513
|
const isStdio = mcpServer.transport === dgraph_resolvers_types_exports.McpTransportType.Stdio;
|
|
@@ -153910,11 +154013,17 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153910
154013
|
}
|
|
153911
154014
|
if (!toolCalled) {
|
|
153912
154015
|
const catalogEntry = this.runtimeCatalogService?.findEntryByToolId(msg.data.workspaceId, toolId);
|
|
153913
|
-
|
|
153914
|
-
|
|
154016
|
+
const selfId = identity?.id;
|
|
154017
|
+
if (catalogEntry && selfId && catalogEntry.runtimeId !== selfId) {
|
|
154018
|
+
this.logger.warn({ toolId, ownerRuntimeId: catalogEntry.runtimeId, selfId }, "Tool call arrived at wrong runtime \u2014 tool belongs to another runtime");
|
|
153915
154019
|
msg.respond(new ErrorResponse({
|
|
153916
154020
|
error: `Tool ${toolId} is served by runtime ${catalogEntry.runtimeId}, not this runtime. The request was misrouted.`
|
|
153917
154021
|
}));
|
|
154022
|
+
} else if (catalogEntry && selfId && catalogEntry.runtimeId === selfId) {
|
|
154023
|
+
this.logger.warn({ toolId, selfId }, "Tool call arrived but tool not loaded \u2014 MCP server may be initializing or restarting");
|
|
154024
|
+
msg.respond(new ErrorResponse({
|
|
154025
|
+
error: `Tool ${toolId} is not currently loaded on this runtime. The MCP server may be initializing. Please retry.`
|
|
154026
|
+
}));
|
|
153918
154027
|
} else {
|
|
153919
154028
|
this.logger.warn(`Tool ${toolId} not found in any MCP Server or workspace catalog`);
|
|
153920
154029
|
msg.respond(new ErrorResponse({
|
|
@@ -154088,16 +154197,21 @@ ${result.stderr}`;
|
|
|
154088
154197
|
}
|
|
154089
154198
|
respond(new RuntimeCallToolResponse({
|
|
154090
154199
|
result: {
|
|
154091
|
-
content: [{ type: "text", text: output || "(Script executed successfully with no output)" }]
|
|
154200
|
+
content: [{ type: "text", text: output || (useInteractive ? "(Script executed with no output() call)" : "(Script executed successfully with no output)") }]
|
|
154092
154201
|
},
|
|
154093
154202
|
executedBy
|
|
154094
154203
|
}));
|
|
154095
154204
|
} else {
|
|
154096
154205
|
const cleanError = result.stderr ? formatScriptError(result.stderr, result.exitCode) : result.error || "Unknown error";
|
|
154097
|
-
const
|
|
154206
|
+
const consolePart = result.consoleOutput ? `Console output:
|
|
154207
|
+
${result.consoleOutput}
|
|
154208
|
+
|
|
154209
|
+
` : "";
|
|
154210
|
+
const stdoutPart = result.stdout ? `Output:
|
|
154098
154211
|
${result.stdout}
|
|
154099
154212
|
|
|
154100
|
-
|
|
154213
|
+
` : "";
|
|
154214
|
+
const fullOutput = stdoutPart || consolePart ? `${stdoutPart}${consolePart}${cleanError}` : cleanError;
|
|
154101
154215
|
respond(new RuntimeCallToolResponse({
|
|
154102
154216
|
result: {
|
|
154103
154217
|
content: [{ type: "text", text: fullOutput }],
|
|
@@ -154131,9 +154245,15 @@ ${cleanError}` : cleanError;
|
|
|
154131
154245
|
if (!params || typeof params !== "object" || typeof params.path !== "string") {
|
|
154132
154246
|
throw new Error("Invalid scripts/execute params: expected { path: string, arguments?: string[] }");
|
|
154133
154247
|
}
|
|
154134
|
-
const { path: path4, arguments:
|
|
154135
|
-
|
|
154136
|
-
|
|
154248
|
+
const { path: path4, arguments: rawArgs } = params;
|
|
154249
|
+
if (rawArgs !== void 0 && !Array.isArray(rawArgs)) {
|
|
154250
|
+
throw new Error("Invalid scripts/execute params: arguments must be a string array");
|
|
154251
|
+
}
|
|
154252
|
+
if (rawArgs !== void 0 && !rawArgs.every((a3) => typeof a3 === "string")) {
|
|
154253
|
+
throw new Error("Invalid scripts/execute params: arguments must be a string array");
|
|
154254
|
+
}
|
|
154255
|
+
const scriptArgs = rawArgs;
|
|
154256
|
+
return this.handleScriptExecuteFromSdk(path4, workspaceId, userId, userKey, runtimeId, delegateDepth, scriptArgs);
|
|
154137
154257
|
}
|
|
154138
154258
|
case "assets/download": {
|
|
154139
154259
|
if (!params || typeof params !== "object" || typeof params.path !== "string") {
|
|
@@ -154166,7 +154286,6 @@ ${cleanError}` : cleanError;
|
|
|
154166
154286
|
const result = await downloadSkillAsset(path4, {
|
|
154167
154287
|
catalog,
|
|
154168
154288
|
fileService: this.fileService,
|
|
154169
|
-
skillContentService: this.skillContentService,
|
|
154170
154289
|
userKey,
|
|
154171
154290
|
logger: this.logger
|
|
154172
154291
|
});
|
|
@@ -154185,7 +154304,7 @@ ${cleanError}` : cleanError;
|
|
|
154185
154304
|
* Handle a script execute request from a TypeScript script via JSON-RPC IPC.
|
|
154186
154305
|
* Resolves the path and routes execution using ScriptService.
|
|
154187
154306
|
*/
|
|
154188
|
-
async handleScriptExecuteFromSdk(path4, workspaceId, userId, userKey, runtimeId, delegateDepth) {
|
|
154307
|
+
async handleScriptExecuteFromSdk(path4, workspaceId, userId, userKey, runtimeId, delegateDepth, args) {
|
|
154189
154308
|
if (!this.scriptService) {
|
|
154190
154309
|
this.logger.warn({ event: "script_service_unavailable" }, "Script execute requested but ScriptService not injected");
|
|
154191
154310
|
return {
|
|
@@ -154204,7 +154323,8 @@ ${cleanError}` : cleanError;
|
|
|
154204
154323
|
userId,
|
|
154205
154324
|
userKey,
|
|
154206
154325
|
runtimeExecutionId: runtimeId,
|
|
154207
|
-
delegateDepth
|
|
154326
|
+
delegateDepth,
|
|
154327
|
+
args
|
|
154208
154328
|
});
|
|
154209
154329
|
return {
|
|
154210
154330
|
content: result.content,
|
|
@@ -154326,7 +154446,7 @@ ${cleanError}` : cleanError;
|
|
|
154326
154446
|
];
|
|
154327
154447
|
for (const candidate of candidates) {
|
|
154328
154448
|
try {
|
|
154329
|
-
this.sdkBundleContent = await (0,
|
|
154449
|
+
this.sdkBundleContent = await (0, import_promises3.readFile)(candidate, "utf-8");
|
|
154330
154450
|
this.logger.debug({ path: candidate }, "Loaded script SDK bundle");
|
|
154331
154451
|
return this.sdkBundleContent;
|
|
154332
154452
|
} catch (err) {
|
|
@@ -154390,6 +154510,18 @@ ${cleanError}` : cleanError;
|
|
|
154390
154510
|
this.toolSubscriptions.set(mcpServerId, /* @__PURE__ */ new Map());
|
|
154391
154511
|
}
|
|
154392
154512
|
const serverToolSubs = this.toolSubscriptions.get(mcpServerId);
|
|
154513
|
+
const currentToolIds = new Set(tools.filter(Boolean).map((t4) => t4.id));
|
|
154514
|
+
for (const [toolId, subscription] of serverToolSubs.entries()) {
|
|
154515
|
+
if (!currentToolIds.has(toolId)) {
|
|
154516
|
+
this.logger.debug(`Unsubscribing stale tool ${toolId} from server ${mcpServerId}`);
|
|
154517
|
+
try {
|
|
154518
|
+
subscription.unsubscribe();
|
|
154519
|
+
} catch (error48) {
|
|
154520
|
+
this.logger.warn({ toolId, err: error48 }, "Failed to unsubscribe stale tool");
|
|
154521
|
+
}
|
|
154522
|
+
serverToolSubs.delete(toolId);
|
|
154523
|
+
}
|
|
154524
|
+
}
|
|
154393
154525
|
for (const tool2 of tools) {
|
|
154394
154526
|
if (tool2 && !serverToolSubs.has(tool2.id)) {
|
|
154395
154527
|
this.logger.debug(`Subscribing to tool ${tool2.name} (${tool2.id})`);
|
|
@@ -154482,15 +154614,13 @@ ToolService = __decorate25([
|
|
|
154482
154614
|
__param21(12, se()),
|
|
154483
154615
|
__param21(13, U(ScriptService)),
|
|
154484
154616
|
__param21(13, se()),
|
|
154485
|
-
__param21(14, U(
|
|
154617
|
+
__param21(14, U(RuntimeCatalogService)),
|
|
154486
154618
|
__param21(14, se()),
|
|
154487
|
-
__param21(15, U(
|
|
154619
|
+
__param21(15, U(DynamicToolRouter)),
|
|
154488
154620
|
__param21(15, se()),
|
|
154489
|
-
__param21(16, U(
|
|
154621
|
+
__param21(16, U(RuntimeBusService)),
|
|
154490
154622
|
__param21(16, se()),
|
|
154491
|
-
|
|
154492
|
-
__param21(17, se()),
|
|
154493
|
-
__metadata24("design:paramtypes", [typeof (_a49 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a49 : Object, typeof (_b37 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b37 : Object, typeof (_c9 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c9 : Object, typeof (_d6 = typeof AuthService !== "undefined" && AuthService) === "function" ? _d6 : Object, typeof (_e6 = typeof HealthService !== "undefined" && HealthService) === "function" ? _e6 : Object, Object, typeof (_f2 = typeof OAuthTokenService !== "undefined" && OAuthTokenService) === "function" ? _f2 : Object, typeof (_g5 = typeof OAuthClientInfoService !== "undefined" && OAuthClientInfoService) === "function" ? _g5 : Object, Object, typeof (_j = typeof FileService !== "undefined" && FileService) === "function" ? _j : Object, String, typeof (_k = typeof ScriptExecutorService !== "undefined" && ScriptExecutorService) === "function" ? _k : Object, Object, Object, typeof (_o = typeof SkillContentService !== "undefined" && SkillContentService) === "function" ? _o : Object, typeof (_p = typeof RuntimeCatalogService !== "undefined" && RuntimeCatalogService) === "function" ? _p : Object, typeof (_q = typeof DynamicToolRouter !== "undefined" && DynamicToolRouter) === "function" ? _q : Object, typeof (_r = typeof RuntimeBusService !== "undefined" && RuntimeBusService) === "function" ? _r : Object])
|
|
154623
|
+
__metadata24("design:paramtypes", [typeof (_a49 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a49 : Object, typeof (_b38 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b38 : Object, typeof (_c9 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c9 : Object, typeof (_d6 = typeof AuthService !== "undefined" && AuthService) === "function" ? _d6 : Object, typeof (_e6 = typeof HealthService !== "undefined" && HealthService) === "function" ? _e6 : Object, Object, typeof (_f2 = typeof OAuthTokenService !== "undefined" && OAuthTokenService) === "function" ? _f2 : Object, typeof (_g5 = typeof OAuthClientInfoService !== "undefined" && OAuthClientInfoService) === "function" ? _g5 : Object, Object, typeof (_j = typeof FileService !== "undefined" && FileService) === "function" ? _j : Object, String, typeof (_k = typeof ScriptExecutorService !== "undefined" && ScriptExecutorService) === "function" ? _k : Object, Object, Object, typeof (_o = typeof RuntimeCatalogService !== "undefined" && RuntimeCatalogService) === "function" ? _o : Object, typeof (_p = typeof DynamicToolRouter !== "undefined" && DynamicToolRouter) === "function" ? _p : Object, typeof (_q = typeof RuntimeBusService !== "undefined" && RuntimeBusService) === "function" ? _q : Object])
|
|
154494
154624
|
], ToolService);
|
|
154495
154625
|
|
|
154496
154626
|
// src/services/runtime.main.service.ts
|
|
@@ -154509,7 +154639,7 @@ var __param22 = function(paramIndex, decorator) {
|
|
|
154509
154639
|
};
|
|
154510
154640
|
};
|
|
154511
154641
|
var _a50;
|
|
154512
|
-
var
|
|
154642
|
+
var _b39;
|
|
154513
154643
|
var _c10;
|
|
154514
154644
|
var _d7;
|
|
154515
154645
|
var _k2;
|
|
@@ -154798,7 +154928,7 @@ MainService = __decorate26([
|
|
|
154798
154928
|
__param22(11, se()),
|
|
154799
154929
|
__param22(12, U(RuntimeCatalogService)),
|
|
154800
154930
|
__param22(12, se()),
|
|
154801
|
-
__metadata25("design:paramtypes", [typeof (_a50 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a50 : Object, typeof (
|
|
154931
|
+
__metadata25("design:paramtypes", [typeof (_a50 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a50 : Object, typeof (_b39 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b39 : Object, typeof (_c10 = typeof AuthService !== "undefined" && AuthService) === "function" ? _c10 : Object, typeof (_d7 = typeof HealthService !== "undefined" && HealthService) === "function" ? _d7 : Object, Object, Object, Object, Object, Object, Object, typeof (_k2 = typeof FileService !== "undefined" && FileService) === "function" ? _k2 : Object, Object, Object])
|
|
154802
154932
|
], MainService);
|
|
154803
154933
|
|
|
154804
154934
|
// src/di/container.ts
|