@skilder-ai/runtime 0.7.1 → 0.7.2
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 +895 -805
- package/dist/index.js.map +4 -4
- package/dist/script-sdk-bundle.cjs +11 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -306,8 +306,8 @@ var require_Reflect = __commonJS({
|
|
|
306
306
|
keys.push(key);
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
for (var
|
|
310
|
-
var key = parentKeys_1[
|
|
309
|
+
for (var _a46 = 0, parentKeys_1 = parentKeys; _a46 < parentKeys_1.length; _a46++) {
|
|
310
|
+
var key = parentKeys_1[_a46];
|
|
311
311
|
var hasKey = set2.has(key);
|
|
312
312
|
if (!hasKey) {
|
|
313
313
|
set2.add(key);
|
|
@@ -1351,8 +1351,8 @@ var require_ReflectLite = __commonJS({
|
|
|
1351
1351
|
keys.push(key);
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
for (var
|
|
1355
|
-
var key = parentKeys_1[
|
|
1354
|
+
for (var _a46 = 0, parentKeys_1 = parentKeys; _a46 < parentKeys_1.length; _a46++) {
|
|
1355
|
+
var key = parentKeys_1[_a46];
|
|
1356
1356
|
var hasKey = set2.has(key);
|
|
1357
1357
|
if (!hasKey) {
|
|
1358
1358
|
set2.add(key);
|
|
@@ -24742,7 +24742,7 @@ var require_cjs = __commonJS({
|
|
|
24742
24742
|
if (Constructor && ~toStringFunction.call(Constructor).indexOf("[native code]")) {
|
|
24743
24743
|
try {
|
|
24744
24744
|
return new Constructor();
|
|
24745
|
-
} catch (
|
|
24745
|
+
} catch (_a46) {
|
|
24746
24746
|
}
|
|
24747
24747
|
}
|
|
24748
24748
|
return Object.create(prototype);
|
|
@@ -24771,7 +24771,7 @@ var require_cjs = __commonJS({
|
|
|
24771
24771
|
};
|
|
24772
24772
|
try {
|
|
24773
24773
|
Object.defineProperty(clone2, property, descriptor);
|
|
24774
|
-
} catch (
|
|
24774
|
+
} catch (_a46) {
|
|
24775
24775
|
clone2[property] = descriptor.get ? descriptor.get() : descriptor.value;
|
|
24776
24776
|
}
|
|
24777
24777
|
}
|
|
@@ -41097,12 +41097,12 @@ var require_code = __commonJS({
|
|
|
41097
41097
|
return item === "" || item === '""';
|
|
41098
41098
|
}
|
|
41099
41099
|
get str() {
|
|
41100
|
-
var
|
|
41101
|
-
return (
|
|
41100
|
+
var _a46;
|
|
41101
|
+
return (_a46 = this._str) !== null && _a46 !== void 0 ? _a46 : this._str = this._items.reduce((s, c3) => `${s}${c3}`, "");
|
|
41102
41102
|
}
|
|
41103
41103
|
get names() {
|
|
41104
|
-
var
|
|
41105
|
-
return (
|
|
41104
|
+
var _a46;
|
|
41105
|
+
return (_a46 = this._names) !== null && _a46 !== void 0 ? _a46 : this._names = this._items.reduce((names, c3) => {
|
|
41106
41106
|
if (c3 instanceof Name)
|
|
41107
41107
|
names[c3.str] = (names[c3.str] || 0) + 1;
|
|
41108
41108
|
return names;
|
|
@@ -41248,8 +41248,8 @@ var require_scope = __commonJS({
|
|
|
41248
41248
|
return `${prefix}${ng.index++}`;
|
|
41249
41249
|
}
|
|
41250
41250
|
_nameGroup(prefix) {
|
|
41251
|
-
var
|
|
41252
|
-
if (((
|
|
41251
|
+
var _a46, _b35;
|
|
41252
|
+
if (((_b35 = (_a46 = this._parent) === null || _a46 === void 0 ? void 0 : _a46._prefixes) === null || _b35 === void 0 ? void 0 : _b35.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 };
|
|
@@ -41282,12 +41282,12 @@ var require_scope = __commonJS({
|
|
|
41282
41282
|
return new ValueScopeName(prefix, this._newName(prefix));
|
|
41283
41283
|
}
|
|
41284
41284
|
value(nameOrPrefix, value) {
|
|
41285
|
-
var
|
|
41285
|
+
var _a46;
|
|
41286
41286
|
if (value.ref === void 0)
|
|
41287
41287
|
throw new Error("CodeGen: ref must be passed in value");
|
|
41288
41288
|
const name21 = this.toName(nameOrPrefix);
|
|
41289
41289
|
const { prefix } = name21;
|
|
41290
|
-
const valueKey = (
|
|
41290
|
+
const valueKey = (_a46 = value.key) !== null && _a46 !== void 0 ? _a46 : value.ref;
|
|
41291
41291
|
let vs = this._values[prefix];
|
|
41292
41292
|
if (vs) {
|
|
41293
41293
|
const _name = vs.get(valueKey);
|
|
@@ -41605,8 +41605,8 @@ var require_codegen = __commonJS({
|
|
|
41605
41605
|
return this;
|
|
41606
41606
|
}
|
|
41607
41607
|
optimizeNames(names, constants) {
|
|
41608
|
-
var
|
|
41609
|
-
this.else = (
|
|
41608
|
+
var _a46;
|
|
41609
|
+
this.else = (_a46 = this.else) === null || _a46 === void 0 ? void 0 : _a46.optimizeNames(names, constants);
|
|
41610
41610
|
if (!(super.optimizeNames(names, constants) || this.else))
|
|
41611
41611
|
return;
|
|
41612
41612
|
this.condition = optimizeExpr(this.condition, names, constants);
|
|
@@ -41710,17 +41710,17 @@ var require_codegen = __commonJS({
|
|
|
41710
41710
|
return code;
|
|
41711
41711
|
}
|
|
41712
41712
|
optimizeNodes() {
|
|
41713
|
-
var
|
|
41713
|
+
var _a46, _b35;
|
|
41714
41714
|
super.optimizeNodes();
|
|
41715
|
-
(
|
|
41716
|
-
(
|
|
41715
|
+
(_a46 = this.catch) === null || _a46 === void 0 ? void 0 : _a46.optimizeNodes();
|
|
41716
|
+
(_b35 = this.finally) === null || _b35 === void 0 ? void 0 : _b35.optimizeNodes();
|
|
41717
41717
|
return this;
|
|
41718
41718
|
}
|
|
41719
41719
|
optimizeNames(names, constants) {
|
|
41720
|
-
var
|
|
41720
|
+
var _a46, _b35;
|
|
41721
41721
|
super.optimizeNames(names, constants);
|
|
41722
|
-
(
|
|
41723
|
-
(
|
|
41722
|
+
(_a46 = this.catch) === null || _a46 === void 0 ? void 0 : _a46.optimizeNames(names, constants);
|
|
41723
|
+
(_b35 = this.finally) === null || _b35 === void 0 ? void 0 : _b35.optimizeNames(names, constants);
|
|
41724
41724
|
return this;
|
|
41725
41725
|
}
|
|
41726
41726
|
get names() {
|
|
@@ -42499,8 +42499,8 @@ var require_applicability = __commonJS({
|
|
|
42499
42499
|
}
|
|
42500
42500
|
exports2.shouldUseGroup = shouldUseGroup;
|
|
42501
42501
|
function shouldUseRule(schema, rule) {
|
|
42502
|
-
var
|
|
42503
|
-
return schema[rule.keyword] !== void 0 || ((
|
|
42502
|
+
var _a46;
|
|
42503
|
+
return schema[rule.keyword] !== void 0 || ((_a46 = rule.definition.implements) === null || _a46 === void 0 ? void 0 : _a46.some((kwd) => schema[kwd] !== void 0));
|
|
42504
42504
|
}
|
|
42505
42505
|
exports2.shouldUseRule = shouldUseRule;
|
|
42506
42506
|
}
|
|
@@ -42888,14 +42888,14 @@ var require_keyword = __commonJS({
|
|
|
42888
42888
|
}
|
|
42889
42889
|
exports2.macroKeywordCode = macroKeywordCode;
|
|
42890
42890
|
function funcKeywordCode(cxt, def) {
|
|
42891
|
-
var
|
|
42891
|
+
var _a46;
|
|
42892
42892
|
const { gen, keyword, schema, parentSchema, $data, it: it2 } = cxt;
|
|
42893
42893
|
checkAsyncKeyword(it2, def);
|
|
42894
42894
|
const validate = !$data && def.compile ? def.compile.call(it2.self, schema, parentSchema, it2) : def.validate;
|
|
42895
42895
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
42896
42896
|
const valid = gen.let("valid");
|
|
42897
42897
|
cxt.block$data(valid, validateKeyword);
|
|
42898
|
-
cxt.ok((
|
|
42898
|
+
cxt.ok((_a46 = def.valid) !== null && _a46 !== void 0 ? _a46 : valid);
|
|
42899
42899
|
function validateKeyword() {
|
|
42900
42900
|
if (def.errors === false) {
|
|
42901
42901
|
assignValid();
|
|
@@ -42926,8 +42926,8 @@ var require_keyword = __commonJS({
|
|
|
42926
42926
|
gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
|
42927
42927
|
}
|
|
42928
42928
|
function reportErrs(errors) {
|
|
42929
|
-
var
|
|
42930
|
-
gen.if((0, codegen_1.not)((
|
|
42929
|
+
var _a47;
|
|
42930
|
+
gen.if((0, codegen_1.not)((_a47 = def.valid) !== null && _a47 !== void 0 ? _a47 : valid), errors);
|
|
42931
42931
|
}
|
|
42932
42932
|
}
|
|
42933
42933
|
exports2.funcKeywordCode = funcKeywordCode;
|
|
@@ -43895,7 +43895,7 @@ var require_compile = __commonJS({
|
|
|
43895
43895
|
var validate_1 = require_validate3();
|
|
43896
43896
|
var SchemaEnv = class {
|
|
43897
43897
|
constructor(env) {
|
|
43898
|
-
var
|
|
43898
|
+
var _a46;
|
|
43899
43899
|
this.refs = {};
|
|
43900
43900
|
this.dynamicAnchors = {};
|
|
43901
43901
|
let schema;
|
|
@@ -43904,7 +43904,7 @@ var require_compile = __commonJS({
|
|
|
43904
43904
|
this.schema = env.schema;
|
|
43905
43905
|
this.schemaId = env.schemaId;
|
|
43906
43906
|
this.root = env.root || this;
|
|
43907
|
-
this.baseId = (
|
|
43907
|
+
this.baseId = (_a46 = env.baseId) !== null && _a46 !== void 0 ? _a46 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
43908
43908
|
this.schemaPath = env.schemaPath;
|
|
43909
43909
|
this.localRefs = env.localRefs;
|
|
43910
43910
|
this.meta = env.meta;
|
|
@@ -44000,14 +44000,14 @@ var require_compile = __commonJS({
|
|
|
44000
44000
|
}
|
|
44001
44001
|
exports2.compileSchema = compileSchema;
|
|
44002
44002
|
function resolveRef2(root, baseId, ref) {
|
|
44003
|
-
var
|
|
44003
|
+
var _a46;
|
|
44004
44004
|
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
44005
44005
|
const schOrFunc = root.refs[ref];
|
|
44006
44006
|
if (schOrFunc)
|
|
44007
44007
|
return schOrFunc;
|
|
44008
44008
|
let _sch = resolve5.call(this, root, ref);
|
|
44009
44009
|
if (_sch === void 0) {
|
|
44010
|
-
const schema = (
|
|
44010
|
+
const schema = (_a46 = root.localRefs) === null || _a46 === void 0 ? void 0 : _a46[ref];
|
|
44011
44011
|
const { schemaId } = this.opts;
|
|
44012
44012
|
if (schema)
|
|
44013
44013
|
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
@@ -44076,8 +44076,8 @@ var require_compile = __commonJS({
|
|
|
44076
44076
|
"definitions"
|
|
44077
44077
|
]);
|
|
44078
44078
|
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
44079
|
-
var
|
|
44080
|
-
if (((
|
|
44079
|
+
var _a46;
|
|
44080
|
+
if (((_a46 = parsedRef.fragment) === null || _a46 === void 0 ? void 0 : _a46[0]) !== "/")
|
|
44081
44081
|
return;
|
|
44082
44082
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
44083
44083
|
if (typeof schema === "boolean")
|
|
@@ -44938,11 +44938,11 @@ var require_core2 = __commonJS({
|
|
|
44938
44938
|
};
|
|
44939
44939
|
var MAX_EXPRESSION = 200;
|
|
44940
44940
|
function requiredOptions(o) {
|
|
44941
|
-
var
|
|
44941
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _j2, _k2, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
44942
44942
|
const s = o.strict;
|
|
44943
|
-
const _optz = (
|
|
44943
|
+
const _optz = (_a46 = o.code) === null || _a46 === void 0 ? void 0 : _a46.optimize;
|
|
44944
44944
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
44945
|
-
const regExp = (
|
|
44945
|
+
const regExp = (_c10 = (_b35 = o.code) === null || _b35 === void 0 ? void 0 : _b35.regExp) !== null && _c10 !== void 0 ? _c10 : defaultRegExp;
|
|
44946
44946
|
const uriResolver = (_d8 = o.uriResolver) !== null && _d8 !== void 0 ? _d8 : uri_1.default;
|
|
44947
44947
|
return {
|
|
44948
44948
|
strictSchema: (_f2 = (_e6 = o.strictSchema) !== null && _e6 !== void 0 ? _e6 : s) !== null && _f2 !== void 0 ? _f2 : true,
|
|
@@ -45414,7 +45414,7 @@ var require_core2 = __commonJS({
|
|
|
45414
45414
|
}
|
|
45415
45415
|
}
|
|
45416
45416
|
function addRule(keyword, definition, dataType) {
|
|
45417
|
-
var
|
|
45417
|
+
var _a46;
|
|
45418
45418
|
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
45419
45419
|
if (dataType && post)
|
|
45420
45420
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
@@ -45440,7 +45440,7 @@ var require_core2 = __commonJS({
|
|
|
45440
45440
|
else
|
|
45441
45441
|
ruleGroup.rules.push(rule);
|
|
45442
45442
|
RULES.all[keyword] = rule;
|
|
45443
|
-
(
|
|
45443
|
+
(_a46 = definition.implements) === null || _a46 === void 0 ? void 0 : _a46.forEach((kwd) => this.addKeyword(kwd));
|
|
45444
45444
|
}
|
|
45445
45445
|
function addBeforeRule(ruleGroup, rule, before) {
|
|
45446
45446
|
const i2 = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
@@ -45574,10 +45574,10 @@ var require_ref = __commonJS({
|
|
|
45574
45574
|
gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
|
|
45575
45575
|
}
|
|
45576
45576
|
function addEvaluatedFrom(source) {
|
|
45577
|
-
var
|
|
45577
|
+
var _a46;
|
|
45578
45578
|
if (!it2.opts.unevaluated)
|
|
45579
45579
|
return;
|
|
45580
|
-
const schEvaluated = (
|
|
45580
|
+
const schEvaluated = (_a46 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a46 === void 0 ? void 0 : _a46.evaluated;
|
|
45581
45581
|
if (it2.props !== true) {
|
|
45582
45582
|
if (schEvaluated && !schEvaluated.dynamicProps) {
|
|
45583
45583
|
if (schEvaluated.props !== void 0) {
|
|
@@ -47219,7 +47219,7 @@ var require_discriminator = __commonJS({
|
|
|
47219
47219
|
return _valid;
|
|
47220
47220
|
}
|
|
47221
47221
|
function getMapping() {
|
|
47222
|
-
var
|
|
47222
|
+
var _a46;
|
|
47223
47223
|
const oneOfMapping = {};
|
|
47224
47224
|
const topRequired = hasRequired(parentSchema);
|
|
47225
47225
|
let tagRequired = true;
|
|
@@ -47233,7 +47233,7 @@ var require_discriminator = __commonJS({
|
|
|
47233
47233
|
if (sch === void 0)
|
|
47234
47234
|
throw new ref_error_1.default(it2.opts.uriResolver, it2.baseId, ref);
|
|
47235
47235
|
}
|
|
47236
|
-
const propSch = (
|
|
47236
|
+
const propSch = (_a46 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a46 === void 0 ? void 0 : _a46[tagName];
|
|
47237
47237
|
if (typeof propSch != "object") {
|
|
47238
47238
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
|
|
47239
47239
|
}
|
|
@@ -47802,9 +47802,9 @@ var require_dist2 = __commonJS({
|
|
|
47802
47802
|
return f2;
|
|
47803
47803
|
};
|
|
47804
47804
|
function addFormats(ajv, list, fs5, exportName) {
|
|
47805
|
-
var
|
|
47806
|
-
var
|
|
47807
|
-
(
|
|
47805
|
+
var _a46;
|
|
47806
|
+
var _b35;
|
|
47807
|
+
(_a46 = (_b35 = ajv.opts.code).formats) !== null && _a46 !== void 0 ? _a46 : _b35.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,
|
|
47936
|
+
var e_1, _a46, e_2, _b35;
|
|
47937
47937
|
var errors;
|
|
47938
47938
|
if (!this.closed) {
|
|
47939
47939
|
this.closed = true;
|
|
@@ -47950,7 +47950,7 @@ var require_Subscription = __commonJS({
|
|
|
47950
47950
|
e_1 = { error: e_1_1 };
|
|
47951
47951
|
} finally {
|
|
47952
47952
|
try {
|
|
47953
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (
|
|
47953
|
+
if (_parentage_1_1 && !_parentage_1_1.done && (_a46 = _parentage_1.return)) _a46.call(_parentage_1);
|
|
47954
47954
|
} finally {
|
|
47955
47955
|
if (e_1) throw e_1.error;
|
|
47956
47956
|
}
|
|
@@ -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 && (_b35 = _finalizers_1.return)) _b35.call(_finalizers_1);
|
|
47992
47992
|
} finally {
|
|
47993
47993
|
if (e_2) throw e_2.error;
|
|
47994
47994
|
}
|
|
@@ -48000,7 +48000,7 @@ var require_Subscription = __commonJS({
|
|
|
48000
48000
|
}
|
|
48001
48001
|
};
|
|
48002
48002
|
Subscription2.prototype.add = function(teardown) {
|
|
48003
|
-
var
|
|
48003
|
+
var _a46;
|
|
48004
48004
|
if (teardown && teardown !== this) {
|
|
48005
48005
|
if (this.closed) {
|
|
48006
48006
|
execFinalizer(teardown);
|
|
@@ -48011,7 +48011,7 @@ var require_Subscription = __commonJS({
|
|
|
48011
48011
|
}
|
|
48012
48012
|
teardown._addParent(this);
|
|
48013
48013
|
}
|
|
48014
|
-
(this._finalizers = (
|
|
48014
|
+
(this._finalizers = (_a46 = this._finalizers) !== null && _a46 !== void 0 ? _a46 : []).push(teardown);
|
|
48015
48015
|
}
|
|
48016
48016
|
}
|
|
48017
48017
|
};
|
|
@@ -48204,7 +48204,7 @@ var require_errorContext = __commonJS({
|
|
|
48204
48204
|
}
|
|
48205
48205
|
cb();
|
|
48206
48206
|
if (isRoot) {
|
|
48207
|
-
var
|
|
48207
|
+
var _a46 = context2, errorThrown = _a46.errorThrown, error48 = _a46.error;
|
|
48208
48208
|
context2 = null;
|
|
48209
48209
|
if (errorThrown) {
|
|
48210
48210
|
throw error48;
|
|
@@ -48512,7 +48512,7 @@ var require_Observable = __commonJS({
|
|
|
48512
48512
|
var _this = this;
|
|
48513
48513
|
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new Subscriber_1.SafeSubscriber(observerOrNext, error48, complete);
|
|
48514
48514
|
errorContext_1.errorContext(function() {
|
|
48515
|
-
var
|
|
48515
|
+
var _a46 = _this, operator = _a46.operator, source = _a46.source;
|
|
48516
48516
|
subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
|
|
48517
48517
|
});
|
|
48518
48518
|
return subscriber;
|
|
@@ -48544,8 +48544,8 @@ var require_Observable = __commonJS({
|
|
|
48544
48544
|
});
|
|
48545
48545
|
};
|
|
48546
48546
|
Observable2.prototype._subscribe = function(subscriber) {
|
|
48547
|
-
var
|
|
48548
|
-
return (
|
|
48547
|
+
var _a46;
|
|
48548
|
+
return (_a46 = this.source) === null || _a46 === void 0 ? void 0 : _a46.subscribe(subscriber);
|
|
48549
48549
|
};
|
|
48550
48550
|
Observable2.prototype[observable_1.observable] = function() {
|
|
48551
48551
|
return this;
|
|
@@ -48578,8 +48578,8 @@ var require_Observable = __commonJS({
|
|
|
48578
48578
|
})();
|
|
48579
48579
|
exports2.Observable = Observable;
|
|
48580
48580
|
function getPromiseCtor(promiseCtor) {
|
|
48581
|
-
var
|
|
48582
|
-
return (
|
|
48581
|
+
var _a46;
|
|
48582
|
+
return (_a46 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config_1.config.Promise) !== null && _a46 !== void 0 ? _a46 : Promise;
|
|
48583
48583
|
}
|
|
48584
48584
|
function isObserver(value) {
|
|
48585
48585
|
return value && isFunction_1.isFunction(value.next) && isFunction_1.isFunction(value.error) && isFunction_1.isFunction(value.complete);
|
|
@@ -48683,11 +48683,11 @@ var require_OperatorSubscriber = __commonJS({
|
|
|
48683
48683
|
return _this;
|
|
48684
48684
|
}
|
|
48685
48685
|
OperatorSubscriber2.prototype.unsubscribe = function() {
|
|
48686
|
-
var
|
|
48686
|
+
var _a46;
|
|
48687
48687
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
48688
48688
|
var closed_1 = this.closed;
|
|
48689
48689
|
_super.prototype.unsubscribe.call(this);
|
|
48690
|
-
!closed_1 && ((
|
|
48690
|
+
!closed_1 && ((_a46 = this.onFinalize) === null || _a46 === void 0 ? void 0 : _a46.call(this));
|
|
48691
48691
|
}
|
|
48692
48692
|
};
|
|
48693
48693
|
return OperatorSubscriber2;
|
|
@@ -49030,22 +49030,22 @@ var require_Subject = __commonJS({
|
|
|
49030
49030
|
Subject2.prototype.next = function(value) {
|
|
49031
49031
|
var _this = this;
|
|
49032
49032
|
errorContext_1.errorContext(function() {
|
|
49033
|
-
var e_1,
|
|
49033
|
+
var e_1, _a46;
|
|
49034
49034
|
_this._throwIfClosed();
|
|
49035
49035
|
if (!_this.isStopped) {
|
|
49036
49036
|
if (!_this.currentObservers) {
|
|
49037
49037
|
_this.currentObservers = Array.from(_this.observers);
|
|
49038
49038
|
}
|
|
49039
49039
|
try {
|
|
49040
|
-
for (var
|
|
49041
|
-
var observer =
|
|
49040
|
+
for (var _b35 = __values(_this.currentObservers), _c10 = _b35.next(); !_c10.done; _c10 = _b35.next()) {
|
|
49041
|
+
var observer = _c10.value;
|
|
49042
49042
|
observer.next(value);
|
|
49043
49043
|
}
|
|
49044
49044
|
} catch (e_1_1) {
|
|
49045
49045
|
e_1 = { error: e_1_1 };
|
|
49046
49046
|
} finally {
|
|
49047
49047
|
try {
|
|
49048
|
-
if (
|
|
49048
|
+
if (_c10 && !_c10.done && (_a46 = _b35.return)) _a46.call(_b35);
|
|
49049
49049
|
} finally {
|
|
49050
49050
|
if (e_1) throw e_1.error;
|
|
49051
49051
|
}
|
|
@@ -49086,8 +49086,8 @@ var require_Subject = __commonJS({
|
|
|
49086
49086
|
};
|
|
49087
49087
|
Object.defineProperty(Subject2.prototype, "observed", {
|
|
49088
49088
|
get: function() {
|
|
49089
|
-
var
|
|
49090
|
-
return ((
|
|
49089
|
+
var _a46;
|
|
49090
|
+
return ((_a46 = this.observers) === null || _a46 === void 0 ? void 0 : _a46.length) > 0;
|
|
49091
49091
|
},
|
|
49092
49092
|
enumerable: false,
|
|
49093
49093
|
configurable: true
|
|
@@ -49103,7 +49103,7 @@ var require_Subject = __commonJS({
|
|
|
49103
49103
|
};
|
|
49104
49104
|
Subject2.prototype._innerSubscribe = function(subscriber) {
|
|
49105
49105
|
var _this = this;
|
|
49106
|
-
var
|
|
49106
|
+
var _a46 = this, hasError = _a46.hasError, isStopped = _a46.isStopped, observers = _a46.observers;
|
|
49107
49107
|
if (hasError || isStopped) {
|
|
49108
49108
|
return Subscription_1.EMPTY_SUBSCRIPTION;
|
|
49109
49109
|
}
|
|
@@ -49115,7 +49115,7 @@ var require_Subject = __commonJS({
|
|
|
49115
49115
|
});
|
|
49116
49116
|
};
|
|
49117
49117
|
Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
|
|
49118
|
-
var
|
|
49118
|
+
var _a46 = this, hasError = _a46.hasError, thrownError = _a46.thrownError, isStopped = _a46.isStopped;
|
|
49119
49119
|
if (hasError) {
|
|
49120
49120
|
subscriber.error(thrownError);
|
|
49121
49121
|
} else if (isStopped) {
|
|
@@ -49142,20 +49142,20 @@ var require_Subject = __commonJS({
|
|
|
49142
49142
|
return _this;
|
|
49143
49143
|
}
|
|
49144
49144
|
AnonymousSubject2.prototype.next = function(value) {
|
|
49145
|
-
var
|
|
49146
|
-
(
|
|
49145
|
+
var _a46, _b35;
|
|
49146
|
+
(_b35 = (_a46 = this.destination) === null || _a46 === void 0 ? void 0 : _a46.next) === null || _b35 === void 0 ? void 0 : _b35.call(_a46, value);
|
|
49147
49147
|
};
|
|
49148
49148
|
AnonymousSubject2.prototype.error = function(err) {
|
|
49149
|
-
var
|
|
49150
|
-
(
|
|
49149
|
+
var _a46, _b35;
|
|
49150
|
+
(_b35 = (_a46 = this.destination) === null || _a46 === void 0 ? void 0 : _a46.error) === null || _b35 === void 0 ? void 0 : _b35.call(_a46, err);
|
|
49151
49151
|
};
|
|
49152
49152
|
AnonymousSubject2.prototype.complete = function() {
|
|
49153
|
-
var
|
|
49154
|
-
(
|
|
49153
|
+
var _a46, _b35;
|
|
49154
|
+
(_b35 = (_a46 = this.destination) === null || _a46 === void 0 ? void 0 : _a46.complete) === null || _b35 === void 0 ? void 0 : _b35.call(_a46);
|
|
49155
49155
|
};
|
|
49156
49156
|
AnonymousSubject2.prototype._subscribe = function(subscriber) {
|
|
49157
|
-
var
|
|
49158
|
-
return (
|
|
49157
|
+
var _a46, _b35;
|
|
49158
|
+
return (_b35 = (_a46 = this.source) === null || _a46 === void 0 ? void 0 : _a46.subscribe(subscriber)) !== null && _b35 !== void 0 ? _b35 : Subscription_1.EMPTY_SUBSCRIPTION;
|
|
49159
49159
|
};
|
|
49160
49160
|
return AnonymousSubject2;
|
|
49161
49161
|
})(Subject);
|
|
@@ -49209,7 +49209,7 @@ var require_BehaviorSubject = __commonJS({
|
|
|
49209
49209
|
return subscription;
|
|
49210
49210
|
};
|
|
49211
49211
|
BehaviorSubject5.prototype.getValue = function() {
|
|
49212
|
-
var
|
|
49212
|
+
var _a46 = this, hasError = _a46.hasError, thrownError = _a46.thrownError, _value = _a46._value;
|
|
49213
49213
|
if (hasError) {
|
|
49214
49214
|
throw thrownError;
|
|
49215
49215
|
}
|
|
@@ -49291,7 +49291,7 @@ var require_ReplaySubject = __commonJS({
|
|
|
49291
49291
|
return _this;
|
|
49292
49292
|
}
|
|
49293
49293
|
ReplaySubject2.prototype.next = function(value) {
|
|
49294
|
-
var
|
|
49294
|
+
var _a46 = this, isStopped = _a46.isStopped, _buffer = _a46._buffer, _infiniteTimeWindow = _a46._infiniteTimeWindow, _timestampProvider = _a46._timestampProvider, _windowTime = _a46._windowTime;
|
|
49295
49295
|
if (!isStopped) {
|
|
49296
49296
|
_buffer.push(value);
|
|
49297
49297
|
!_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
|
|
@@ -49303,7 +49303,7 @@ var require_ReplaySubject = __commonJS({
|
|
|
49303
49303
|
this._throwIfClosed();
|
|
49304
49304
|
this._trimBuffer();
|
|
49305
49305
|
var subscription = this._innerSubscribe(subscriber);
|
|
49306
|
-
var
|
|
49306
|
+
var _a46 = this, _infiniteTimeWindow = _a46._infiniteTimeWindow, _buffer = _a46._buffer;
|
|
49307
49307
|
var copy = _buffer.slice();
|
|
49308
49308
|
for (var i2 = 0; i2 < copy.length && !subscriber.closed; i2 += _infiniteTimeWindow ? 1 : 2) {
|
|
49309
49309
|
subscriber.next(copy[i2]);
|
|
@@ -49312,7 +49312,7 @@ var require_ReplaySubject = __commonJS({
|
|
|
49312
49312
|
return subscription;
|
|
49313
49313
|
};
|
|
49314
49314
|
ReplaySubject2.prototype._trimBuffer = function() {
|
|
49315
|
-
var
|
|
49315
|
+
var _a46 = this, _bufferSize = _a46._bufferSize, _timestampProvider = _a46._timestampProvider, _buffer = _a46._buffer, _infiniteTimeWindow = _a46._infiniteTimeWindow;
|
|
49316
49316
|
var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
|
|
49317
49317
|
_bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
|
|
49318
49318
|
if (!_infiniteTimeWindow) {
|
|
@@ -49366,7 +49366,7 @@ var require_AsyncSubject = __commonJS({
|
|
|
49366
49366
|
return _this;
|
|
49367
49367
|
}
|
|
49368
49368
|
AsyncSubject2.prototype._checkFinalizedStatuses = function(subscriber) {
|
|
49369
|
-
var
|
|
49369
|
+
var _a46 = this, hasError = _a46.hasError, _hasValue = _a46._hasValue, _value = _a46._value, thrownError = _a46.thrownError, isStopped = _a46.isStopped, _isComplete = _a46._isComplete;
|
|
49370
49370
|
if (hasError) {
|
|
49371
49371
|
subscriber.error(thrownError);
|
|
49372
49372
|
} else if (isStopped || _isComplete) {
|
|
@@ -49381,7 +49381,7 @@ var require_AsyncSubject = __commonJS({
|
|
|
49381
49381
|
}
|
|
49382
49382
|
};
|
|
49383
49383
|
AsyncSubject2.prototype.complete = function() {
|
|
49384
|
-
var
|
|
49384
|
+
var _a46 = this, _hasValue = _a46._hasValue, _value = _a46._value, _isComplete = _a46._isComplete;
|
|
49385
49385
|
if (!_isComplete) {
|
|
49386
49386
|
this._isComplete = true;
|
|
49387
49387
|
_hasValue && _super.prototype.next.call(this, _value);
|
|
@@ -49524,7 +49524,7 @@ var require_AsyncAction = __commonJS({
|
|
|
49524
49524
|
return _this;
|
|
49525
49525
|
}
|
|
49526
49526
|
AsyncAction2.prototype.schedule = function(state, delay2) {
|
|
49527
|
-
var
|
|
49527
|
+
var _a46;
|
|
49528
49528
|
if (delay2 === void 0) {
|
|
49529
49529
|
delay2 = 0;
|
|
49530
49530
|
}
|
|
@@ -49539,7 +49539,7 @@ var require_AsyncAction = __commonJS({
|
|
|
49539
49539
|
}
|
|
49540
49540
|
this.pending = true;
|
|
49541
49541
|
this.delay = delay2;
|
|
49542
|
-
this.id = (
|
|
49542
|
+
this.id = (_a46 = this.id) !== null && _a46 !== void 0 ? _a46 : this.requestAsyncId(scheduler2, this.id, delay2);
|
|
49543
49543
|
return this;
|
|
49544
49544
|
};
|
|
49545
49545
|
AsyncAction2.prototype.requestAsyncId = function(scheduler2, _id, delay2) {
|
|
@@ -49588,7 +49588,7 @@ var require_AsyncAction = __commonJS({
|
|
|
49588
49588
|
};
|
|
49589
49589
|
AsyncAction2.prototype.unsubscribe = function() {
|
|
49590
49590
|
if (!this.closed) {
|
|
49591
|
-
var
|
|
49591
|
+
var _a46 = this, id = _a46.id, scheduler2 = _a46.scheduler;
|
|
49592
49592
|
var actions = scheduler2.actions;
|
|
49593
49593
|
this.work = this.state = this.scheduler = null;
|
|
49594
49594
|
this.pending = false;
|
|
@@ -49741,7 +49741,7 @@ var require_AsapAction = __commonJS({
|
|
|
49741
49741
|
return scheduler2._scheduled || (scheduler2._scheduled = immediateProvider_1.immediateProvider.setImmediate(scheduler2.flush.bind(scheduler2, void 0)));
|
|
49742
49742
|
};
|
|
49743
49743
|
AsapAction2.prototype.recycleAsyncId = function(scheduler2, id, delay2) {
|
|
49744
|
-
var
|
|
49744
|
+
var _a46;
|
|
49745
49745
|
if (delay2 === void 0) {
|
|
49746
49746
|
delay2 = 0;
|
|
49747
49747
|
}
|
|
@@ -49749,7 +49749,7 @@ var require_AsapAction = __commonJS({
|
|
|
49749
49749
|
return _super.prototype.recycleAsyncId.call(this, scheduler2, id, delay2);
|
|
49750
49750
|
}
|
|
49751
49751
|
var actions = scheduler2.actions;
|
|
49752
|
-
if (id != null && ((
|
|
49752
|
+
if (id != null && ((_a46 = actions[actions.length - 1]) === null || _a46 === void 0 ? void 0 : _a46.id) !== id) {
|
|
49753
49753
|
immediateProvider_1.immediateProvider.clearImmediate(id);
|
|
49754
49754
|
if (scheduler2._scheduled === id) {
|
|
49755
49755
|
scheduler2._scheduled = void 0;
|
|
@@ -50101,7 +50101,7 @@ var require_AnimationFrameAction = __commonJS({
|
|
|
50101
50101
|
}));
|
|
50102
50102
|
};
|
|
50103
50103
|
AnimationFrameAction2.prototype.recycleAsyncId = function(scheduler2, id, delay2) {
|
|
50104
|
-
var
|
|
50104
|
+
var _a46;
|
|
50105
50105
|
if (delay2 === void 0) {
|
|
50106
50106
|
delay2 = 0;
|
|
50107
50107
|
}
|
|
@@ -50109,7 +50109,7 @@ var require_AnimationFrameAction = __commonJS({
|
|
|
50109
50109
|
return _super.prototype.recycleAsyncId.call(this, scheduler2, id, delay2);
|
|
50110
50110
|
}
|
|
50111
50111
|
var actions = scheduler2.actions;
|
|
50112
|
-
if (id != null && id === scheduler2._scheduled && ((
|
|
50112
|
+
if (id != null && id === scheduler2._scheduled && ((_a46 = actions[actions.length - 1]) === null || _a46 === void 0 ? void 0 : _a46.id) !== id) {
|
|
50113
50113
|
animationFrameProvider_1.animationFrameProvider.cancelAnimationFrame(id);
|
|
50114
50114
|
scheduler2._scheduled = void 0;
|
|
50115
50115
|
}
|
|
@@ -50242,7 +50242,7 @@ var require_VirtualTimeScheduler = __commonJS({
|
|
|
50242
50242
|
return _this;
|
|
50243
50243
|
}
|
|
50244
50244
|
VirtualTimeScheduler2.prototype.flush = function() {
|
|
50245
|
-
var
|
|
50245
|
+
var _a46 = this, actions = _a46.actions, maxFrames = _a46.maxFrames;
|
|
50246
50246
|
var error48;
|
|
50247
50247
|
var action;
|
|
50248
50248
|
while ((action = actions[0]) && action.delay <= maxFrames) {
|
|
@@ -50613,30 +50613,30 @@ var require_isReadableStreamLike = __commonJS({
|
|
|
50613
50613
|
var isFunction_1 = require_isFunction();
|
|
50614
50614
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
50615
50615
|
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
50616
|
-
var reader,
|
|
50617
|
-
return __generator(this, function(
|
|
50618
|
-
switch (
|
|
50616
|
+
var reader, _a46, value, done;
|
|
50617
|
+
return __generator(this, function(_b35) {
|
|
50618
|
+
switch (_b35.label) {
|
|
50619
50619
|
case 0:
|
|
50620
50620
|
reader = readableStream.getReader();
|
|
50621
|
-
|
|
50621
|
+
_b35.label = 1;
|
|
50622
50622
|
case 1:
|
|
50623
|
-
|
|
50624
|
-
|
|
50623
|
+
_b35.trys.push([1, , 9, 10]);
|
|
50624
|
+
_b35.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
|
-
|
|
50629
|
+
_a46 = _b35.sent(), value = _a46.value, done = _a46.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, _b35.sent()];
|
|
50634
50634
|
case 5:
|
|
50635
50635
|
return [4, __await(value)];
|
|
50636
50636
|
case 6:
|
|
50637
|
-
return [4,
|
|
50637
|
+
return [4, _b35.sent()];
|
|
50638
50638
|
case 7:
|
|
50639
|
-
|
|
50639
|
+
_b35.sent();
|
|
50640
50640
|
return [3, 2];
|
|
50641
50641
|
case 8:
|
|
50642
50642
|
return [3, 10];
|
|
@@ -50861,7 +50861,7 @@ var require_innerFrom = __commonJS({
|
|
|
50861
50861
|
exports2.fromPromise = fromPromise;
|
|
50862
50862
|
function fromIterable(iterable) {
|
|
50863
50863
|
return new Observable_1.Observable(function(subscriber) {
|
|
50864
|
-
var e_1,
|
|
50864
|
+
var e_1, _a46;
|
|
50865
50865
|
try {
|
|
50866
50866
|
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
50867
50867
|
var value = iterable_1_1.value;
|
|
@@ -50874,7 +50874,7 @@ var require_innerFrom = __commonJS({
|
|
|
50874
50874
|
e_1 = { error: e_1_1 };
|
|
50875
50875
|
} finally {
|
|
50876
50876
|
try {
|
|
50877
|
-
if (iterable_1_1 && !iterable_1_1.done && (
|
|
50877
|
+
if (iterable_1_1 && !iterable_1_1.done && (_a46 = iterable_1.return)) _a46.call(iterable_1);
|
|
50878
50878
|
} finally {
|
|
50879
50879
|
if (e_1) throw e_1.error;
|
|
50880
50880
|
}
|
|
@@ -50897,40 +50897,40 @@ var require_innerFrom = __commonJS({
|
|
|
50897
50897
|
exports2.fromReadableStreamLike = fromReadableStreamLike;
|
|
50898
50898
|
function process5(asyncIterable, subscriber) {
|
|
50899
50899
|
var asyncIterable_1, asyncIterable_1_1;
|
|
50900
|
-
var e_2,
|
|
50900
|
+
var e_2, _a46;
|
|
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(_b35) {
|
|
50904
|
+
switch (_b35.label) {
|
|
50905
50905
|
case 0:
|
|
50906
|
-
|
|
50906
|
+
_b35.trys.push([0, 5, 6, 11]);
|
|
50907
50907
|
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
50908
|
-
|
|
50908
|
+
_b35.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 = _b35.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
|
+
_b35.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 = _b35.sent();
|
|
50925
50925
|
e_2 = { error: e_2_1 };
|
|
50926
50926
|
return [3, 11];
|
|
50927
50927
|
case 6:
|
|
50928
|
-
|
|
50929
|
-
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (
|
|
50930
|
-
return [4,
|
|
50928
|
+
_b35.trys.push([6, , 9, 10]);
|
|
50929
|
+
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a46 = asyncIterable_1.return))) return [3, 8];
|
|
50930
|
+
return [4, _a46.call(asyncIterable_1)];
|
|
50931
50931
|
case 7:
|
|
50932
|
-
|
|
50933
|
-
|
|
50932
|
+
_b35.sent();
|
|
50933
|
+
_b35.label = 8;
|
|
50934
50934
|
case 8:
|
|
50935
50935
|
return [3, 10];
|
|
50936
50936
|
case 9:
|
|
@@ -51106,11 +51106,11 @@ var require_scheduleIterable = __commonJS({
|
|
|
51106
51106
|
executeSchedule_1.executeSchedule(subscriber, scheduler2, function() {
|
|
51107
51107
|
iterator = input[iterator_1.iterator]();
|
|
51108
51108
|
executeSchedule_1.executeSchedule(subscriber, scheduler2, function() {
|
|
51109
|
-
var
|
|
51109
|
+
var _a46;
|
|
51110
51110
|
var value;
|
|
51111
51111
|
var done;
|
|
51112
51112
|
try {
|
|
51113
|
-
|
|
51113
|
+
_a46 = iterator.next(), value = _a46.value, done = _a46.done;
|
|
51114
51114
|
} catch (err) {
|
|
51115
51115
|
subscriber.error(err);
|
|
51116
51116
|
return;
|
|
@@ -51308,15 +51308,15 @@ var require_Notification = __commonJS({
|
|
|
51308
51308
|
return observeNotification(this, observer);
|
|
51309
51309
|
};
|
|
51310
51310
|
Notification2.prototype.do = function(nextHandler, errorHandler, completeHandler) {
|
|
51311
|
-
var
|
|
51311
|
+
var _a46 = this, kind = _a46.kind, value = _a46.value, error48 = _a46.error;
|
|
51312
51312
|
return kind === "N" ? nextHandler === null || nextHandler === void 0 ? void 0 : nextHandler(value) : kind === "E" ? errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error48) : completeHandler === null || completeHandler === void 0 ? void 0 : completeHandler();
|
|
51313
51313
|
};
|
|
51314
51314
|
Notification2.prototype.accept = function(nextOrObserver, error48, complete) {
|
|
51315
|
-
var
|
|
51316
|
-
return isFunction_1.isFunction((
|
|
51315
|
+
var _a46;
|
|
51316
|
+
return isFunction_1.isFunction((_a46 = nextOrObserver) === null || _a46 === void 0 ? void 0 : _a46.next) ? this.observe(nextOrObserver) : this.do(nextOrObserver, error48, complete);
|
|
51317
51317
|
};
|
|
51318
51318
|
Notification2.prototype.toObservable = function() {
|
|
51319
|
-
var
|
|
51319
|
+
var _a46 = this, kind = _a46.kind, value = _a46.value, error48 = _a46.error;
|
|
51320
51320
|
var result = kind === "N" ? of_1.of(value) : kind === "E" ? throwError_1.throwError(function() {
|
|
51321
51321
|
return error48;
|
|
51322
51322
|
}) : kind === "C" ? empty_1.EMPTY : 0;
|
|
@@ -51339,12 +51339,12 @@ var require_Notification = __commonJS({
|
|
|
51339
51339
|
})();
|
|
51340
51340
|
exports2.Notification = Notification;
|
|
51341
51341
|
function observeNotification(notification, observer) {
|
|
51342
|
-
var
|
|
51342
|
+
var _a46, _b35, _c10;
|
|
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" ? (
|
|
51347
|
+
kind === "N" ? (_a46 = observer.next) === null || _a46 === void 0 ? void 0 : _a46.call(observer, value) : kind === "E" ? (_b35 = observer.error) === null || _b35 === void 0 ? void 0 : _b35.call(observer, error48) : (_c10 = observer.complete) === null || _c10 === void 0 ? void 0 : _c10.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 timeout(config2, schedulerArg) {
|
|
51540
|
-
var
|
|
51540
|
+
var _a46 = isDate_1.isValidDate(config2) ? { first: config2 } : typeof config2 === "number" ? { each: config2 } : config2, first = _a46.first, each = _a46.each, _b35 = _a46.with, _with = _b35 === void 0 ? timeoutErrorFactory : _b35, _c10 = _a46.scheduler, scheduler2 = _c10 === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : async_1.asyncScheduler : _c10, _d8 = _a46.meta, meta3 = _d8 === void 0 ? null : _d8;
|
|
51541
51541
|
if (first == null && each == null) {
|
|
51542
51542
|
throw new TypeError("No timeout provided.");
|
|
51543
51543
|
}
|
|
@@ -51847,7 +51847,7 @@ var require_combineLatest = __commonJS({
|
|
|
51847
51847
|
}
|
|
51848
51848
|
var scheduler2 = args_1.popScheduler(args);
|
|
51849
51849
|
var resultSelector = args_1.popResultSelector(args);
|
|
51850
|
-
var
|
|
51850
|
+
var _a46 = argsArgArrayOrObject_1.argsArgArrayOrObject(args), observables = _a46.args, keys = _a46.keys;
|
|
51851
51851
|
if (observables.length === 0) {
|
|
51852
51852
|
return from_1.from([], scheduler2);
|
|
51853
51853
|
}
|
|
@@ -52096,7 +52096,7 @@ var require_connectable = __commonJS({
|
|
|
52096
52096
|
config2 = DEFAULT_CONFIG;
|
|
52097
52097
|
}
|
|
52098
52098
|
var connection = null;
|
|
52099
|
-
var connector = config2.connector,
|
|
52099
|
+
var connector = config2.connector, _a46 = config2.resetOnDisconnect, resetOnDisconnect = _a46 === void 0 ? true : _a46;
|
|
52100
52100
|
var subject = connector();
|
|
52101
52101
|
var result = new Observable_1.Observable(function(subscriber) {
|
|
52102
52102
|
return subject.subscribe(subscriber);
|
|
@@ -52139,7 +52139,7 @@ var require_forkJoin = __commonJS({
|
|
|
52139
52139
|
args[_i] = arguments[_i];
|
|
52140
52140
|
}
|
|
52141
52141
|
var resultSelector = args_1.popResultSelector(args);
|
|
52142
|
-
var
|
|
52142
|
+
var _a46 = argsArgArrayOrObject_1.argsArgArrayOrObject(args), sources = _a46.args, keys = _a46.keys;
|
|
52143
52143
|
var result = new Observable_1.Observable(function(subscriber) {
|
|
52144
52144
|
var length = sources.length;
|
|
52145
52145
|
if (!length) {
|
|
@@ -52218,11 +52218,11 @@ var require_fromEvent = __commonJS({
|
|
|
52218
52218
|
if (resultSelector) {
|
|
52219
52219
|
return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector));
|
|
52220
52220
|
}
|
|
52221
|
-
var
|
|
52221
|
+
var _a46 = __read5(isEventTarget(target) ? eventTargetMethods.map(function(methodName) {
|
|
52222
52222
|
return function(handler) {
|
|
52223
52223
|
return target[methodName](eventName, handler, options);
|
|
52224
52224
|
};
|
|
52225
|
-
}) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [], 2), add =
|
|
52225
|
+
}) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [], 2), add = _a46[0], remove = _a46[1];
|
|
52226
52226
|
if (!add) {
|
|
52227
52227
|
if (isArrayLike_1.isArrayLike(target)) {
|
|
52228
52228
|
return mergeMap_1.mergeMap(function(subTarget) {
|
|
@@ -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
|
|
52381
|
+
var _a46, _b35;
|
|
52382
52382
|
var resultSelector;
|
|
52383
52383
|
var initialState;
|
|
52384
52384
|
if (arguments.length === 1) {
|
|
52385
|
-
|
|
52385
|
+
_a46 = initialStateOrOptions, initialState = _a46.initialState, condition = _a46.condition, iterate = _a46.iterate, _b35 = _a46.resultSelector, resultSelector = _b35 === void 0 ? identity_1.identity : _b35, scheduler2 = _a46.scheduler;
|
|
52386
52386
|
} else {
|
|
52387
52387
|
initialState = initialStateOrOptions;
|
|
52388
52388
|
if (!resultSelectorOrScheduler || isScheduler_1.isScheduler(resultSelectorOrScheduler)) {
|
|
@@ -52394,17 +52394,17 @@ var require_generate = __commonJS({
|
|
|
52394
52394
|
}
|
|
52395
52395
|
function gen() {
|
|
52396
52396
|
var state;
|
|
52397
|
-
return __generator(this, function(
|
|
52398
|
-
switch (
|
|
52397
|
+
return __generator(this, function(_a47) {
|
|
52398
|
+
switch (_a47.label) {
|
|
52399
52399
|
case 0:
|
|
52400
52400
|
state = initialState;
|
|
52401
|
-
|
|
52401
|
+
_a47.label = 1;
|
|
52402
52402
|
case 1:
|
|
52403
52403
|
if (!(!condition || condition(state))) return [3, 4];
|
|
52404
52404
|
return [4, resultSelector(state)];
|
|
52405
52405
|
case 2:
|
|
52406
|
-
|
|
52407
|
-
|
|
52406
|
+
_a47.sent();
|
|
52407
|
+
_a47.label = 3;
|
|
52408
52408
|
case 3:
|
|
52409
52409
|
state = iterate(state);
|
|
52410
52410
|
return [3, 1];
|
|
@@ -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,
|
|
53001
|
+
var e_1, _a46, e_2, _b35;
|
|
53002
53002
|
var toEmit = null;
|
|
53003
53003
|
if (count++ % startBufferEvery === 0) {
|
|
53004
53004
|
buffers.push([]);
|
|
@@ -53016,7 +53016,7 @@ var require_bufferCount = __commonJS({
|
|
|
53016
53016
|
e_1 = { error: e_1_1 };
|
|
53017
53017
|
} finally {
|
|
53018
53018
|
try {
|
|
53019
|
-
if (buffers_1_1 && !buffers_1_1.done && (
|
|
53019
|
+
if (buffers_1_1 && !buffers_1_1.done && (_a46 = buffers_1.return)) _a46.call(buffers_1);
|
|
53020
53020
|
} finally {
|
|
53021
53021
|
if (e_1) throw e_1.error;
|
|
53022
53022
|
}
|
|
@@ -53032,14 +53032,14 @@ 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 && (_b35 = toEmit_1.return)) _b35.call(toEmit_1);
|
|
53036
53036
|
} finally {
|
|
53037
53037
|
if (e_2) throw e_2.error;
|
|
53038
53038
|
}
|
|
53039
53039
|
}
|
|
53040
53040
|
}
|
|
53041
53041
|
}, function() {
|
|
53042
|
-
var e_3,
|
|
53042
|
+
var e_3, _a46;
|
|
53043
53043
|
try {
|
|
53044
53044
|
for (var buffers_2 = __values(buffers), buffers_2_1 = buffers_2.next(); !buffers_2_1.done; buffers_2_1 = buffers_2.next()) {
|
|
53045
53045
|
var buffer = buffers_2_1.value;
|
|
@@ -53049,7 +53049,7 @@ var require_bufferCount = __commonJS({
|
|
|
53049
53049
|
e_3 = { error: e_3_1 };
|
|
53050
53050
|
} finally {
|
|
53051
53051
|
try {
|
|
53052
|
-
if (buffers_2_1 && !buffers_2_1.done && (
|
|
53052
|
+
if (buffers_2_1 && !buffers_2_1.done && (_a46 = buffers_2.return)) _a46.call(buffers_2);
|
|
53053
53053
|
} finally {
|
|
53054
53054
|
if (e_3) throw e_3.error;
|
|
53055
53055
|
}
|
|
@@ -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
|
|
53092
|
+
var _a46, _b35;
|
|
53093
53093
|
var otherArgs = [];
|
|
53094
53094
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
53095
53095
|
otherArgs[_i - 1] = arguments[_i];
|
|
53096
53096
|
}
|
|
53097
|
-
var scheduler2 = (
|
|
53098
|
-
var bufferCreationInterval = (
|
|
53097
|
+
var scheduler2 = (_a46 = args_1.popScheduler(otherArgs)) !== null && _a46 !== void 0 ? _a46 : async_1.asyncScheduler;
|
|
53098
|
+
var bufferCreationInterval = (_b35 = otherArgs[0]) !== null && _b35 !== void 0 ? _b35 : null;
|
|
53099
53099
|
var maxBufferSize = otherArgs[1] || Infinity;
|
|
53100
53100
|
return lift_1.operate(function(source, subscriber) {
|
|
53101
53101
|
var bufferRecords = [];
|
|
@@ -53129,7 +53129,7 @@ var require_bufferTime = __commonJS({
|
|
|
53129
53129
|
}
|
|
53130
53130
|
startBuffer();
|
|
53131
53131
|
var bufferTimeSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
|
|
53132
|
-
var e_1,
|
|
53132
|
+
var e_1, _a47;
|
|
53133
53133
|
var recordsCopy = bufferRecords.slice();
|
|
53134
53134
|
try {
|
|
53135
53135
|
for (var recordsCopy_1 = __values(recordsCopy), recordsCopy_1_1 = recordsCopy_1.next(); !recordsCopy_1_1.done; recordsCopy_1_1 = recordsCopy_1.next()) {
|
|
@@ -53142,7 +53142,7 @@ var require_bufferTime = __commonJS({
|
|
|
53142
53142
|
e_1 = { error: e_1_1 };
|
|
53143
53143
|
} finally {
|
|
53144
53144
|
try {
|
|
53145
|
-
if (recordsCopy_1_1 && !recordsCopy_1_1.done && (
|
|
53145
|
+
if (recordsCopy_1_1 && !recordsCopy_1_1.done && (_a47 = recordsCopy_1.return)) _a47.call(recordsCopy_1);
|
|
53146
53146
|
} finally {
|
|
53147
53147
|
if (e_1) throw e_1.error;
|
|
53148
53148
|
}
|
|
@@ -53202,7 +53202,7 @@ var require_bufferToggle = __commonJS({
|
|
|
53202
53202
|
closingSubscription.add(innerFrom_1.innerFrom(closingSelector(openValue)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, emitBuffer, noop_1.noop)));
|
|
53203
53203
|
}, noop_1.noop));
|
|
53204
53204
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
|
|
53205
|
-
var e_1,
|
|
53205
|
+
var e_1, _a46;
|
|
53206
53206
|
try {
|
|
53207
53207
|
for (var buffers_1 = __values(buffers), buffers_1_1 = buffers_1.next(); !buffers_1_1.done; buffers_1_1 = buffers_1.next()) {
|
|
53208
53208
|
var buffer = buffers_1_1.value;
|
|
@@ -53212,7 +53212,7 @@ var require_bufferToggle = __commonJS({
|
|
|
53212
53212
|
e_1 = { error: e_1_1 };
|
|
53213
53213
|
} finally {
|
|
53214
53214
|
try {
|
|
53215
|
-
if (buffers_1_1 && !buffers_1_1.done && (
|
|
53215
|
+
if (buffers_1_1 && !buffers_1_1.done && (_a46 = buffers_1.return)) _a46.call(buffers_1);
|
|
53216
53216
|
} finally {
|
|
53217
53217
|
if (e_1) throw e_1.error;
|
|
53218
53218
|
}
|
|
@@ -54453,7 +54453,7 @@ var require_takeLast = __commonJS({
|
|
|
54453
54453
|
buffer.push(value);
|
|
54454
54454
|
count < buffer.length && buffer.shift();
|
|
54455
54455
|
}, function() {
|
|
54456
|
-
var e_1,
|
|
54456
|
+
var e_1, _a46;
|
|
54457
54457
|
try {
|
|
54458
54458
|
for (var buffer_1 = __values(buffer), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) {
|
|
54459
54459
|
var value = buffer_1_1.value;
|
|
@@ -54463,7 +54463,7 @@ var require_takeLast = __commonJS({
|
|
|
54463
54463
|
e_1 = { error: e_1_1 };
|
|
54464
54464
|
} finally {
|
|
54465
54465
|
try {
|
|
54466
|
-
if (buffer_1_1 && !buffer_1_1.done && (
|
|
54466
|
+
if (buffer_1_1 && !buffer_1_1.done && (_a46 = buffer_1.return)) _a46.call(buffer_1);
|
|
54467
54467
|
} finally {
|
|
54468
54468
|
if (e_1) throw e_1.error;
|
|
54469
54469
|
}
|
|
@@ -54987,12 +54987,12 @@ var require_repeat = __commonJS({
|
|
|
54987
54987
|
var innerFrom_1 = require_innerFrom();
|
|
54988
54988
|
var timer_1 = require_timer();
|
|
54989
54989
|
function repeat(countOrConfig) {
|
|
54990
|
-
var
|
|
54990
|
+
var _a46;
|
|
54991
54991
|
var count = Infinity;
|
|
54992
54992
|
var delay2;
|
|
54993
54993
|
if (countOrConfig != null) {
|
|
54994
54994
|
if (typeof countOrConfig === "object") {
|
|
54995
|
-
|
|
54995
|
+
_a46 = countOrConfig.count, count = _a46 === void 0 ? Infinity : _a46, delay2 = countOrConfig.delay;
|
|
54996
54996
|
} else {
|
|
54997
54997
|
count = countOrConfig;
|
|
54998
54998
|
}
|
|
@@ -55119,7 +55119,7 @@ var require_retry = __commonJS({
|
|
|
55119
55119
|
count: configOrCount
|
|
55120
55120
|
};
|
|
55121
55121
|
}
|
|
55122
|
-
var
|
|
55122
|
+
var _a46 = config2.count, count = _a46 === void 0 ? Infinity : _a46, delay2 = config2.delay, _b35 = config2.resetOnSuccess, resetOnSuccess = _b35 === void 0 ? false : _b35;
|
|
55123
55123
|
return count <= 0 ? identity_1.identity : lift_1.operate(function(source, subscriber) {
|
|
55124
55124
|
var soFar = 0;
|
|
55125
55125
|
var innerSub;
|
|
@@ -55365,9 +55365,9 @@ var require_share = __commonJS({
|
|
|
55365
55365
|
if (options === void 0) {
|
|
55366
55366
|
options = {};
|
|
55367
55367
|
}
|
|
55368
|
-
var
|
|
55368
|
+
var _a46 = options.connector, connector = _a46 === void 0 ? function() {
|
|
55369
55369
|
return new Subject_1.Subject();
|
|
55370
|
-
} :
|
|
55370
|
+
} : _a46, _b35 = options.resetOnError, resetOnError = _b35 === void 0 ? true : _b35, _c10 = options.resetOnComplete, resetOnComplete = _c10 === void 0 ? true : _c10, _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
|
|
55461
|
+
var _a46, _b35, _c10;
|
|
55462
55462
|
var bufferSize;
|
|
55463
55463
|
var refCount = false;
|
|
55464
55464
|
if (configOrBufferSize && typeof configOrBufferSize === "object") {
|
|
55465
|
-
|
|
55465
|
+
_a46 = configOrBufferSize.bufferSize, bufferSize = _a46 === void 0 ? Infinity : _a46, _b35 = configOrBufferSize.windowTime, windowTime = _b35 === void 0 ? Infinity : _b35, _c10 = configOrBufferSize.refCount, refCount = _c10 === void 0 ? false : _c10, scheduler2 = configOrBufferSize.scheduler;
|
|
55466
55466
|
} else {
|
|
55467
55467
|
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
|
|
55468
55468
|
}
|
|
@@ -55793,29 +55793,29 @@ var require_tap = __commonJS({
|
|
|
55793
55793
|
function tap(observerOrNext, error48, complete) {
|
|
55794
55794
|
var tapObserver = isFunction_1.isFunction(observerOrNext) || error48 || complete ? { next: observerOrNext, error: error48, complete } : observerOrNext;
|
|
55795
55795
|
return tapObserver ? lift_1.operate(function(source, subscriber) {
|
|
55796
|
-
var
|
|
55797
|
-
(
|
|
55796
|
+
var _a46;
|
|
55797
|
+
(_a46 = tapObserver.subscribe) === null || _a46 === void 0 ? void 0 : _a46.call(tapObserver);
|
|
55798
55798
|
var isUnsub = true;
|
|
55799
55799
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
|
|
55800
|
-
var
|
|
55801
|
-
(
|
|
55800
|
+
var _a47;
|
|
55801
|
+
(_a47 = tapObserver.next) === null || _a47 === void 0 ? void 0 : _a47.call(tapObserver, value);
|
|
55802
55802
|
subscriber.next(value);
|
|
55803
55803
|
}, function() {
|
|
55804
|
-
var
|
|
55804
|
+
var _a47;
|
|
55805
55805
|
isUnsub = false;
|
|
55806
|
-
(
|
|
55806
|
+
(_a47 = tapObserver.complete) === null || _a47 === void 0 ? void 0 : _a47.call(tapObserver);
|
|
55807
55807
|
subscriber.complete();
|
|
55808
55808
|
}, function(err) {
|
|
55809
|
-
var
|
|
55809
|
+
var _a47;
|
|
55810
55810
|
isUnsub = false;
|
|
55811
|
-
(
|
|
55811
|
+
(_a47 = tapObserver.error) === null || _a47 === void 0 ? void 0 : _a47.call(tapObserver, err);
|
|
55812
55812
|
subscriber.error(err);
|
|
55813
55813
|
}, function() {
|
|
55814
|
-
var
|
|
55814
|
+
var _a47, _b35;
|
|
55815
55815
|
if (isUnsub) {
|
|
55816
|
-
(
|
|
55816
|
+
(_a47 = tapObserver.unsubscribe) === null || _a47 === void 0 ? void 0 : _a47.call(tapObserver);
|
|
55817
55817
|
}
|
|
55818
|
-
(
|
|
55818
|
+
(_b35 = tapObserver.finalize) === null || _b35 === void 0 ? void 0 : _b35.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
|
|
55837
|
+
var _a46 = config2 !== null && config2 !== void 0 ? config2 : {}, _b35 = _a46.leading, leading = _b35 === void 0 ? true : _b35, _c10 = _a46.trailing, trailing = _c10 === void 0 ? false : _c10;
|
|
55838
55838
|
var hasValue = false;
|
|
55839
55839
|
var sendValue = null;
|
|
55840
55840
|
var throttled = null;
|
|
@@ -56064,7 +56064,7 @@ var require_windowCount = __commonJS({
|
|
|
56064
56064
|
var count = 0;
|
|
56065
56065
|
subscriber.next(windows[0].asObservable());
|
|
56066
56066
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
|
|
56067
|
-
var e_1,
|
|
56067
|
+
var e_1, _a46;
|
|
56068
56068
|
try {
|
|
56069
56069
|
for (var windows_1 = __values(windows), windows_1_1 = windows_1.next(); !windows_1_1.done; windows_1_1 = windows_1.next()) {
|
|
56070
56070
|
var window_1 = windows_1_1.value;
|
|
@@ -56074,7 +56074,7 @@ var require_windowCount = __commonJS({
|
|
|
56074
56074
|
e_1 = { error: e_1_1 };
|
|
56075
56075
|
} finally {
|
|
56076
56076
|
try {
|
|
56077
|
-
if (windows_1_1 && !windows_1_1.done && (
|
|
56077
|
+
if (windows_1_1 && !windows_1_1.done && (_a46 = windows_1.return)) _a46.call(windows_1);
|
|
56078
56078
|
} finally {
|
|
56079
56079
|
if (e_1) throw e_1.error;
|
|
56080
56080
|
}
|
|
@@ -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
|
|
56126
|
+
var _a46, _b35;
|
|
56127
56127
|
var otherArgs = [];
|
|
56128
56128
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
56129
56129
|
otherArgs[_i - 1] = arguments[_i];
|
|
56130
56130
|
}
|
|
56131
|
-
var scheduler2 = (
|
|
56132
|
-
var windowCreationInterval = (
|
|
56131
|
+
var scheduler2 = (_a46 = args_1.popScheduler(otherArgs)) !== null && _a46 !== void 0 ? _a46 : async_1.asyncScheduler;
|
|
56132
|
+
var windowCreationInterval = (_b35 = otherArgs[0]) !== null && _b35 !== void 0 ? _b35 : null;
|
|
56133
56133
|
var maxWindowSize = otherArgs[1] || Infinity;
|
|
56134
56134
|
return lift_1.operate(function(source, subscriber) {
|
|
56135
56135
|
var windowRecords = [];
|
|
@@ -56168,8 +56168,8 @@ var require_windowTime = __commonJS({
|
|
|
56168
56168
|
return windowRecords.slice().forEach(cb);
|
|
56169
56169
|
};
|
|
56170
56170
|
var terminate = function(cb) {
|
|
56171
|
-
loop(function(
|
|
56172
|
-
var window2 =
|
|
56171
|
+
loop(function(_a47) {
|
|
56172
|
+
var window2 = _a47.window;
|
|
56173
56173
|
return cb(window2);
|
|
56174
56174
|
});
|
|
56175
56175
|
cb(subscriber);
|
|
@@ -56251,7 +56251,7 @@ var require_windowToggle = __commonJS({
|
|
|
56251
56251
|
closingSubscription.add(closingNotifier.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, closeWindow, noop_1.noop, handleError)));
|
|
56252
56252
|
}, noop_1.noop));
|
|
56253
56253
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
|
|
56254
|
-
var e_1,
|
|
56254
|
+
var e_1, _a46;
|
|
56255
56255
|
var windowsCopy = windows.slice();
|
|
56256
56256
|
try {
|
|
56257
56257
|
for (var windowsCopy_1 = __values(windowsCopy), windowsCopy_1_1 = windowsCopy_1.next(); !windowsCopy_1_1.done; windowsCopy_1_1 = windowsCopy_1.next()) {
|
|
@@ -56262,7 +56262,7 @@ var require_windowToggle = __commonJS({
|
|
|
56262
56262
|
e_1 = { error: e_1_1 };
|
|
56263
56263
|
} finally {
|
|
56264
56264
|
try {
|
|
56265
|
-
if (windowsCopy_1_1 && !windowsCopy_1_1.done && (
|
|
56265
|
+
if (windowsCopy_1_1 && !windowsCopy_1_1.done && (_a46 = windowsCopy_1.return)) _a46.call(windowsCopy_1);
|
|
56266
56266
|
} finally {
|
|
56267
56267
|
if (e_1) throw e_1.error;
|
|
56268
56268
|
}
|
|
@@ -67641,8 +67641,8 @@ var require_ref2 = __commonJS({
|
|
|
67641
67641
|
}
|
|
67642
67642
|
cxt.ok(valid);
|
|
67643
67643
|
function validateJtdRef() {
|
|
67644
|
-
var
|
|
67645
|
-
const refSchema = (
|
|
67644
|
+
var _a46;
|
|
67645
|
+
const refSchema = (_a46 = root.schema.definitions) === null || _a46 === void 0 ? void 0 : _a46[ref];
|
|
67646
67646
|
if (!refSchema) {
|
|
67647
67647
|
throw new ref_error_1.default(it2.opts.uriResolver, "", ref, `No definition ${ref}`);
|
|
67648
67648
|
}
|
|
@@ -69392,7 +69392,7 @@ var require_standalone3 = __commonJS({
|
|
|
69392
69392
|
return `"use strict";${_n}module.exports = ${n3};${_n}module.exports.default = ${n3};${_n}${vCode}`;
|
|
69393
69393
|
}
|
|
69394
69394
|
function multiExportsCode(schemas, getValidateFunc) {
|
|
69395
|
-
var
|
|
69395
|
+
var _a46;
|
|
69396
69396
|
const usedValues = {};
|
|
69397
69397
|
let code = (0, code_1._)`"use strict";`;
|
|
69398
69398
|
for (const name21 in schemas) {
|
|
@@ -69400,7 +69400,7 @@ var require_standalone3 = __commonJS({
|
|
|
69400
69400
|
if (v2) {
|
|
69401
69401
|
const vCode = validateCode(usedValues, v2.source);
|
|
69402
69402
|
const exportSyntax = ajv.opts.code.esm ? (0, code_1._)`export const ${(0, code_1.getEsmExportName)(name21)}` : (0, code_1._)`exports${(0, code_1.getProperty)(name21)}`;
|
|
69403
|
-
code = (0, code_1._)`${code}${_n}${exportSyntax} = ${(
|
|
69403
|
+
code = (0, code_1._)`${code}${_n}${exportSyntax} = ${(_a46 = v2.source) === null || _a46 === void 0 ? void 0 : _a46.validateName};${_n}${vCode}`;
|
|
69404
69404
|
}
|
|
69405
69405
|
}
|
|
69406
69406
|
return `${code}`;
|
|
@@ -69415,8 +69415,8 @@ var require_standalone3 = __commonJS({
|
|
|
69415
69415
|
const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`);
|
|
69416
69416
|
return s.evaluated ? (0, code_1._)`${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code;
|
|
69417
69417
|
function refValidateCode(n3) {
|
|
69418
|
-
var
|
|
69419
|
-
const vRef = (
|
|
69418
|
+
var _a46;
|
|
69419
|
+
const vRef = (_a46 = n3.value) === null || _a46 === void 0 ? void 0 : _a46.ref;
|
|
69420
69420
|
if (n3.prefix === "validate" && typeof vRef == "function") {
|
|
69421
69421
|
const v2 = vRef;
|
|
69422
69422
|
return validateCode(usedValues, v2.source);
|
|
@@ -69434,8 +69434,8 @@ var require_standalone3 = __commonJS({
|
|
|
69434
69434
|
return void 0;
|
|
69435
69435
|
}
|
|
69436
69436
|
function usedState(name21) {
|
|
69437
|
-
var
|
|
69438
|
-
return (
|
|
69437
|
+
var _a46;
|
|
69438
|
+
return (_a46 = usedValues[name21.prefix]) === null || _a46 === void 0 ? void 0 : _a46.get(name21);
|
|
69439
69439
|
}
|
|
69440
69440
|
function setUsedState(name21, state) {
|
|
69441
69441
|
const { prefix } = name21;
|
|
@@ -72720,11 +72720,11 @@ var require_util4 = __commonJS({
|
|
|
72720
72720
|
});
|
|
72721
72721
|
};
|
|
72722
72722
|
exports2.tokenizeClass = (str, regexpStr) => {
|
|
72723
|
-
var
|
|
72723
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5;
|
|
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 = (_g5 = (_f2 = (_e6 = (_d8 = (
|
|
72727
|
+
const p2 = (_g5 = (_f2 = (_e6 = (_d8 = (_c10 = (_b35 = (_a46 = rs[1] && sets.words()) !== null && _a46 !== void 0 ? _a46 : rs[2] && sets.ints()) !== null && _b35 !== void 0 ? _b35 : rs[3] && sets.whitespace()) !== null && _c10 !== void 0 ? _c10 : rs[4] && sets.notWords()) !== null && _d8 !== void 0 ? _d8 : rs[5] && sets.notInts()) !== null && _e6 !== void 0 ? _e6 : rs[6] && sets.notWhitespace()) !== null && _f2 !== void 0 ? _f2 : 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)
|
|
@@ -88199,8 +88199,8 @@ Error message: ${getErrorMessage(cause)}`,
|
|
|
88199
88199
|
cause,
|
|
88200
88200
|
context: context2
|
|
88201
88201
|
}) {
|
|
88202
|
-
var _a153, _b152,
|
|
88203
|
-
if (_TypeValidationError.isInstance(cause) && cause.value === value && ((_a153 = cause.context) == null ? void 0 : _a153.field) === (context2 == null ? void 0 : context2.field) && ((_b152 = cause.context) == null ? void 0 : _b152.entityName) === (context2 == null ? void 0 : context2.entityName) && ((
|
|
88202
|
+
var _a153, _b152, _c10;
|
|
88203
|
+
if (_TypeValidationError.isInstance(cause) && cause.value === value && ((_a153 = cause.context) == null ? void 0 : _a153.field) === (context2 == null ? void 0 : context2.field) && ((_b152 = cause.context) == null ? void 0 : _b152.entityName) === (context2 == null ? void 0 : context2.entityName) && ((_c10 = cause.context) == null ? void 0 : _c10.entityId) === (context2 == null ? void 0 : context2.entityId)) {
|
|
88204
88204
|
return cause;
|
|
88205
88205
|
}
|
|
88206
88206
|
return new _TypeValidationError({ value, cause, context: context2 });
|
|
@@ -88780,10 +88780,10 @@ function $constructor(name21, initializer3, params) {
|
|
|
88780
88780
|
}
|
|
88781
88781
|
Object.defineProperty(Definition, "name", { value: name21 });
|
|
88782
88782
|
function _3(def) {
|
|
88783
|
-
var
|
|
88783
|
+
var _a46;
|
|
88784
88784
|
const inst = params?.Parent ? new Definition() : this;
|
|
88785
88785
|
init(inst, def);
|
|
88786
|
-
(
|
|
88786
|
+
(_a46 = inst._zod).deferred ?? (_a46.deferred = []);
|
|
88787
88787
|
for (const fn of inst._zod.deferred) {
|
|
88788
88788
|
fn();
|
|
88789
88789
|
}
|
|
@@ -89380,8 +89380,8 @@ function aborted(x3, startIndex = 0) {
|
|
|
89380
89380
|
}
|
|
89381
89381
|
function prefixIssues(path4, issues) {
|
|
89382
89382
|
return issues.map((iss) => {
|
|
89383
|
-
var
|
|
89384
|
-
(
|
|
89383
|
+
var _a46;
|
|
89384
|
+
(_a46 = iss).path ?? (_a46.path = []);
|
|
89385
89385
|
iss.path.unshift(path4);
|
|
89386
89386
|
return iss;
|
|
89387
89387
|
});
|
|
@@ -89566,7 +89566,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
89566
89566
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
89567
89567
|
const result = { errors: [] };
|
|
89568
89568
|
const processError = (error49, path4 = []) => {
|
|
89569
|
-
var
|
|
89569
|
+
var _a46, _b35;
|
|
89570
89570
|
for (const issue2 of error49.issues) {
|
|
89571
89571
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
89572
89572
|
issue2.errors.map((issues) => processError({ issues }, issue2.path));
|
|
@@ -89587,11 +89587,11 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
89587
89587
|
const terminal = i2 === fullpath.length - 1;
|
|
89588
89588
|
if (typeof el === "string") {
|
|
89589
89589
|
curr.properties ?? (curr.properties = {});
|
|
89590
|
-
(
|
|
89590
|
+
(_a46 = curr.properties)[el] ?? (_a46[el] = { errors: [] });
|
|
89591
89591
|
curr = curr.properties[el];
|
|
89592
89592
|
} else {
|
|
89593
89593
|
curr.items ?? (curr.items = []);
|
|
89594
|
-
(
|
|
89594
|
+
(_b35 = curr.items)[el] ?? (_b35[el] = { errors: [] });
|
|
89595
89595
|
curr = curr.items[el];
|
|
89596
89596
|
}
|
|
89597
89597
|
if (terminal) {
|
|
@@ -89881,10 +89881,10 @@ var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
|
|
|
89881
89881
|
|
|
89882
89882
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
89883
89883
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
89884
|
-
var
|
|
89884
|
+
var _a46;
|
|
89885
89885
|
inst._zod ?? (inst._zod = {});
|
|
89886
89886
|
inst._zod.def = def;
|
|
89887
|
-
(
|
|
89887
|
+
(_a46 = inst._zod).onattach ?? (_a46.onattach = []);
|
|
89888
89888
|
});
|
|
89889
89889
|
var numericOriginMap = {
|
|
89890
89890
|
number: "number",
|
|
@@ -89950,8 +89950,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
89950
89950
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
89951
89951
|
$ZodCheck.init(inst, def);
|
|
89952
89952
|
inst._zod.onattach.push((inst2) => {
|
|
89953
|
-
var
|
|
89954
|
-
(
|
|
89953
|
+
var _a46;
|
|
89954
|
+
(_a46 = inst2._zod.bag).multipleOf ?? (_a46.multipleOf = def.value);
|
|
89955
89955
|
});
|
|
89956
89956
|
inst._zod.check = (payload) => {
|
|
89957
89957
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -90084,9 +90084,9 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
90084
90084
|
};
|
|
90085
90085
|
});
|
|
90086
90086
|
var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
90087
|
-
var
|
|
90087
|
+
var _a46;
|
|
90088
90088
|
$ZodCheck.init(inst, def);
|
|
90089
|
-
(
|
|
90089
|
+
(_a46 = inst._zod.def).when ?? (_a46.when = (payload) => {
|
|
90090
90090
|
const val = payload.value;
|
|
90091
90091
|
return !nullish(val) && val.size !== void 0;
|
|
90092
90092
|
});
|
|
@@ -90112,9 +90112,9 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
90112
90112
|
};
|
|
90113
90113
|
});
|
|
90114
90114
|
var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
|
|
90115
|
-
var
|
|
90115
|
+
var _a46;
|
|
90116
90116
|
$ZodCheck.init(inst, def);
|
|
90117
|
-
(
|
|
90117
|
+
(_a46 = inst._zod.def).when ?? (_a46.when = (payload) => {
|
|
90118
90118
|
const val = payload.value;
|
|
90119
90119
|
return !nullish(val) && val.size !== void 0;
|
|
90120
90120
|
});
|
|
@@ -90140,9 +90140,9 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
90140
90140
|
};
|
|
90141
90141
|
});
|
|
90142
90142
|
var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
90143
|
-
var
|
|
90143
|
+
var _a46;
|
|
90144
90144
|
$ZodCheck.init(inst, def);
|
|
90145
|
-
(
|
|
90145
|
+
(_a46 = inst._zod.def).when ?? (_a46.when = (payload) => {
|
|
90146
90146
|
const val = payload.value;
|
|
90147
90147
|
return !nullish(val) && val.size !== void 0;
|
|
90148
90148
|
});
|
|
@@ -90170,9 +90170,9 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
90170
90170
|
};
|
|
90171
90171
|
});
|
|
90172
90172
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
90173
|
-
var
|
|
90173
|
+
var _a46;
|
|
90174
90174
|
$ZodCheck.init(inst, def);
|
|
90175
|
-
(
|
|
90175
|
+
(_a46 = inst._zod.def).when ?? (_a46.when = (payload) => {
|
|
90176
90176
|
const val = payload.value;
|
|
90177
90177
|
return !nullish(val) && val.length !== void 0;
|
|
90178
90178
|
});
|
|
@@ -90199,9 +90199,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
90199
90199
|
};
|
|
90200
90200
|
});
|
|
90201
90201
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
90202
|
-
var
|
|
90202
|
+
var _a46;
|
|
90203
90203
|
$ZodCheck.init(inst, def);
|
|
90204
|
-
(
|
|
90204
|
+
(_a46 = inst._zod.def).when ?? (_a46.when = (payload) => {
|
|
90205
90205
|
const val = payload.value;
|
|
90206
90206
|
return !nullish(val) && val.length !== void 0;
|
|
90207
90207
|
});
|
|
@@ -90228,9 +90228,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
90228
90228
|
};
|
|
90229
90229
|
});
|
|
90230
90230
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
90231
|
-
var
|
|
90231
|
+
var _a46;
|
|
90232
90232
|
$ZodCheck.init(inst, def);
|
|
90233
|
-
(
|
|
90233
|
+
(_a46 = inst._zod.def).when ?? (_a46.when = (payload) => {
|
|
90234
90234
|
const val = payload.value;
|
|
90235
90235
|
return !nullish(val) && val.length !== void 0;
|
|
90236
90236
|
});
|
|
@@ -90259,7 +90259,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
90259
90259
|
};
|
|
90260
90260
|
});
|
|
90261
90261
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
90262
|
-
var
|
|
90262
|
+
var _a46, _b35;
|
|
90263
90263
|
$ZodCheck.init(inst, def);
|
|
90264
90264
|
inst._zod.onattach.push((inst2) => {
|
|
90265
90265
|
const bag = inst2._zod.bag;
|
|
@@ -90270,7 +90270,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
90270
90270
|
}
|
|
90271
90271
|
});
|
|
90272
90272
|
if (def.pattern)
|
|
90273
|
-
(
|
|
90273
|
+
(_a46 = inst._zod).check ?? (_a46.check = (payload) => {
|
|
90274
90274
|
def.pattern.lastIndex = 0;
|
|
90275
90275
|
if (def.pattern.test(payload.value))
|
|
90276
90276
|
return;
|
|
@@ -90285,7 +90285,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
90285
90285
|
});
|
|
90286
90286
|
});
|
|
90287
90287
|
else
|
|
90288
|
-
(
|
|
90288
|
+
(_b35 = inst._zod).check ?? (_b35.check = () => {
|
|
90289
90289
|
});
|
|
90290
90290
|
});
|
|
90291
90291
|
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
@@ -90472,7 +90472,7 @@ var version = {
|
|
|
90472
90472
|
|
|
90473
90473
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
90474
90474
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
90475
|
-
var
|
|
90475
|
+
var _a46;
|
|
90476
90476
|
inst ?? (inst = {});
|
|
90477
90477
|
inst._zod.def = def;
|
|
90478
90478
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -90487,7 +90487,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
90487
90487
|
}
|
|
90488
90488
|
}
|
|
90489
90489
|
if (checks.length === 0) {
|
|
90490
|
-
(
|
|
90490
|
+
(_a46 = inst._zod).deferred ?? (_a46.deferred = []);
|
|
90491
90491
|
inst._zod.deferred?.push(() => {
|
|
90492
90492
|
inst._zod.run = inst._zod.parse;
|
|
90493
90493
|
});
|
|
@@ -99130,7 +99130,7 @@ function initializeContext(params) {
|
|
|
99130
99130
|
};
|
|
99131
99131
|
}
|
|
99132
99132
|
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
99133
|
-
var
|
|
99133
|
+
var _a46;
|
|
99134
99134
|
const def = schema._zod.def;
|
|
99135
99135
|
const seen = ctx.seen.get(schema);
|
|
99136
99136
|
if (seen) {
|
|
@@ -99178,7 +99178,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
99178
99178
|
delete result.schema.default;
|
|
99179
99179
|
}
|
|
99180
99180
|
if (ctx.io === "input" && result.schema._prefault)
|
|
99181
|
-
(
|
|
99181
|
+
(_a46 = result.schema).default ?? (_a46.default = result.schema._prefault);
|
|
99182
99182
|
delete result.schema._prefault;
|
|
99183
99183
|
const _result = ctx.seen.get(schema);
|
|
99184
99184
|
return _result.schema;
|
|
@@ -106347,14 +106347,14 @@ function handleFetchError({
|
|
|
106347
106347
|
return error48;
|
|
106348
106348
|
}
|
|
106349
106349
|
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
106350
|
-
var _a210, _b210,
|
|
106350
|
+
var _a210, _b210, _c10;
|
|
106351
106351
|
if (globalThisAny.window) {
|
|
106352
106352
|
return `runtime/browser`;
|
|
106353
106353
|
}
|
|
106354
106354
|
if ((_a210 = globalThisAny.navigator) == null ? void 0 : _a210.userAgent) {
|
|
106355
106355
|
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
106356
106356
|
}
|
|
106357
|
-
if ((
|
|
106357
|
+
if ((_c10 = (_b210 = globalThisAny.process) == null ? void 0 : _b210.versions) == null ? void 0 : _c10.node) {
|
|
106358
106358
|
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
106359
106359
|
}
|
|
106360
106360
|
if (globalThisAny.EdgeRuntime) {
|
|
@@ -106683,11 +106683,11 @@ function parseAnyDef() {
|
|
|
106683
106683
|
return {};
|
|
106684
106684
|
}
|
|
106685
106685
|
function parseArrayDef(def, refs) {
|
|
106686
|
-
var _a210, _b210,
|
|
106686
|
+
var _a210, _b210, _c10;
|
|
106687
106687
|
const res = {
|
|
106688
106688
|
type: "array"
|
|
106689
106689
|
};
|
|
106690
|
-
if (((_a210 = def.type) == null ? void 0 : _a210._def) && ((
|
|
106690
|
+
if (((_a210 = def.type) == null ? void 0 : _a210._def) && ((_c10 = (_b210 = def.type) == null ? void 0 : _b210._def) == null ? void 0 : _c10.typeName) !== ZodFirstPartyTypeKind2.ZodAny) {
|
|
106691
106691
|
res.items = parseDef(def.type._def, {
|
|
106692
106692
|
...refs,
|
|
106693
106693
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -107175,7 +107175,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
107175
107175
|
return pattern;
|
|
107176
107176
|
}
|
|
107177
107177
|
function parseRecordDef(def, refs) {
|
|
107178
|
-
var _a210, _b210,
|
|
107178
|
+
var _a210, _b210, _c10, _d8, _e6, _f2;
|
|
107179
107179
|
const schema = {
|
|
107180
107180
|
type: "object",
|
|
107181
107181
|
additionalProperties: (_a210 = parseDef(def.valueType._def, {
|
|
@@ -107183,7 +107183,7 @@ function parseRecordDef(def, refs) {
|
|
|
107183
107183
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
107184
107184
|
})) != null ? _a210 : refs.allowedAdditionalProperties
|
|
107185
107185
|
};
|
|
107186
|
-
if (((_b210 = def.keyType) == null ? void 0 : _b210._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((
|
|
107186
|
+
if (((_b210 = def.keyType) == null ? void 0 : _b210._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((_c10 = def.keyType._def.checks) == null ? void 0 : _c10.length)) {
|
|
107187
107187
|
const { type: type21, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
107188
107188
|
return {
|
|
107189
107189
|
...schema,
|
|
@@ -108807,7 +108807,7 @@ function shouldAttemptFallback(response, pathname) {
|
|
|
108807
108807
|
return !response || response.status >= 400 && response.status < 500 && pathname !== "/";
|
|
108808
108808
|
}
|
|
108809
108809
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
108810
|
-
var _a310,
|
|
108810
|
+
var _a310, _b35;
|
|
108811
108811
|
const issuer = new URL(serverUrl);
|
|
108812
108812
|
const protocolVersion = (_a310 = opts == null ? void 0 : opts.protocolVersion) != null ? _a310 : LATEST_PROTOCOL_VERSION;
|
|
108813
108813
|
let url2;
|
|
@@ -108815,7 +108815,7 @@ async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, o
|
|
|
108815
108815
|
url2 = new URL(opts.metadataUrl);
|
|
108816
108816
|
} else {
|
|
108817
108817
|
const wellKnownPath = buildWellKnownPath(wellKnownType, issuer.pathname);
|
|
108818
|
-
url2 = new URL(wellKnownPath, (
|
|
108818
|
+
url2 = new URL(wellKnownPath, (_b35 = opts == null ? void 0 : opts.metadataServerUrl) != null ? _b35 : issuer);
|
|
108819
108819
|
url2.search = issuer.search;
|
|
108820
108820
|
}
|
|
108821
108821
|
let response = await tryMetadataDiscovery(url2, protocolVersion, fetchFn);
|
|
@@ -109175,7 +109175,7 @@ async function registerClient(authorizationServerUrl, {
|
|
|
109175
109175
|
return OAuthClientInformationFullSchema.parse(await response.json());
|
|
109176
109176
|
}
|
|
109177
109177
|
async function auth(provider, options) {
|
|
109178
|
-
var _a310,
|
|
109178
|
+
var _a310, _b35;
|
|
109179
109179
|
try {
|
|
109180
109180
|
return await authInternal(provider, options);
|
|
109181
109181
|
} catch (error48) {
|
|
@@ -109183,7 +109183,7 @@ async function auth(provider, options) {
|
|
|
109183
109183
|
await ((_a310 = provider.invalidateCredentials) == null ? void 0 : _a310.call(provider, "all"));
|
|
109184
109184
|
return await authInternal(provider, options);
|
|
109185
109185
|
} else if (error48 instanceof InvalidGrantError) {
|
|
109186
|
-
await ((
|
|
109186
|
+
await ((_b35 = provider.invalidateCredentials) == null ? void 0 : _b35.call(provider, "tokens"));
|
|
109187
109187
|
return await authInternal(provider, options);
|
|
109188
109188
|
}
|
|
109189
109189
|
throw error48;
|
|
@@ -109354,7 +109354,7 @@ var SseMCPTransport = class {
|
|
|
109354
109354
|
}
|
|
109355
109355
|
this.abortController = new AbortController();
|
|
109356
109356
|
const establishConnection = async (triedAuth = false) => {
|
|
109357
|
-
var _a310,
|
|
109357
|
+
var _a310, _b35, _c10, _d8, _e6;
|
|
109358
109358
|
try {
|
|
109359
109359
|
const headers = await this.commonHeaders({
|
|
109360
109360
|
Accept: "text/event-stream"
|
|
@@ -109372,11 +109372,11 @@ var SseMCPTransport = class {
|
|
|
109372
109372
|
});
|
|
109373
109373
|
if (result !== "AUTHORIZED") {
|
|
109374
109374
|
const error48 = new UnauthorizedError();
|
|
109375
|
-
(
|
|
109375
|
+
(_b35 = this.onerror) == null ? void 0 : _b35.call(this, error48);
|
|
109376
109376
|
return reject(error48);
|
|
109377
109377
|
}
|
|
109378
109378
|
} catch (error48) {
|
|
109379
|
-
(
|
|
109379
|
+
(_c10 = this.onerror) == null ? void 0 : _c10.call(this, error48);
|
|
109380
109380
|
return reject(error48);
|
|
109381
109381
|
}
|
|
109382
109382
|
return establishConnection(true);
|
|
@@ -109395,7 +109395,7 @@ var SseMCPTransport = class {
|
|
|
109395
109395
|
const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());
|
|
109396
109396
|
const reader = stream.getReader();
|
|
109397
109397
|
const processEvents = async () => {
|
|
109398
|
-
var
|
|
109398
|
+
var _a46, _b43, _c22;
|
|
109399
109399
|
try {
|
|
109400
109400
|
while (true) {
|
|
109401
109401
|
const { done, value } = await reader.read();
|
|
@@ -109423,7 +109423,7 @@ var SseMCPTransport = class {
|
|
|
109423
109423
|
const message = JSONRPCMessageSchema.parse(
|
|
109424
109424
|
JSON.parse(data)
|
|
109425
109425
|
);
|
|
109426
|
-
(
|
|
109426
|
+
(_a46 = this.onmessage) == null ? void 0 : _a46.call(this, message);
|
|
109427
109427
|
} catch (error48) {
|
|
109428
109428
|
const e2 = new MCPClientError({
|
|
109429
109429
|
message: "MCP SSE Transport Error: Failed to parse message",
|
|
@@ -109457,11 +109457,11 @@ var SseMCPTransport = class {
|
|
|
109457
109457
|
});
|
|
109458
109458
|
}
|
|
109459
109459
|
async close() {
|
|
109460
|
-
var _a310,
|
|
109460
|
+
var _a310, _b35, _c10;
|
|
109461
109461
|
this.connected = false;
|
|
109462
109462
|
(_a310 = this.sseConnection) == null ? void 0 : _a310.close();
|
|
109463
|
-
(
|
|
109464
|
-
(
|
|
109463
|
+
(_b35 = this.abortController) == null ? void 0 : _b35.abort();
|
|
109464
|
+
(_c10 = this.onclose) == null ? void 0 : _c10.call(this);
|
|
109465
109465
|
}
|
|
109466
109466
|
async send(message) {
|
|
109467
109467
|
if (!this.endpoint || !this.connected) {
|
|
@@ -109471,7 +109471,7 @@ var SseMCPTransport = class {
|
|
|
109471
109471
|
}
|
|
109472
109472
|
const endpoint = this.endpoint;
|
|
109473
109473
|
const attempt = async (triedAuth = false) => {
|
|
109474
|
-
var _a310,
|
|
109474
|
+
var _a310, _b35, _c10, _d8, _e6;
|
|
109475
109475
|
try {
|
|
109476
109476
|
const headers = await this.commonHeaders({
|
|
109477
109477
|
"Content-Type": "application/json"
|
|
@@ -109492,11 +109492,11 @@ var SseMCPTransport = class {
|
|
|
109492
109492
|
});
|
|
109493
109493
|
if (result !== "AUTHORIZED") {
|
|
109494
109494
|
const error48 = new UnauthorizedError();
|
|
109495
|
-
(
|
|
109495
|
+
(_b35 = this.onerror) == null ? void 0 : _b35.call(this, error48);
|
|
109496
109496
|
return;
|
|
109497
109497
|
}
|
|
109498
109498
|
} catch (error48) {
|
|
109499
|
-
(
|
|
109499
|
+
(_c10 = this.onerror) == null ? void 0 : _c10.call(this, error48);
|
|
109500
109500
|
return;
|
|
109501
109501
|
}
|
|
109502
109502
|
return attempt(true);
|
|
@@ -109565,7 +109565,7 @@ var HttpMCPTransport = class {
|
|
|
109565
109565
|
void this.openInboundSse();
|
|
109566
109566
|
}
|
|
109567
109567
|
async close() {
|
|
109568
|
-
var _a310,
|
|
109568
|
+
var _a310, _b35, _c10;
|
|
109569
109569
|
(_a310 = this.inboundSseConnection) == null ? void 0 : _a310.close();
|
|
109570
109570
|
try {
|
|
109571
109571
|
if (this.sessionId && this.abortController && !this.abortController.signal.aborted) {
|
|
@@ -109578,12 +109578,12 @@ var HttpMCPTransport = class {
|
|
|
109578
109578
|
}
|
|
109579
109579
|
} catch (e2) {
|
|
109580
109580
|
}
|
|
109581
|
-
(
|
|
109582
|
-
(
|
|
109581
|
+
(_b35 = this.abortController) == null ? void 0 : _b35.abort();
|
|
109582
|
+
(_c10 = this.onclose) == null ? void 0 : _c10.call(this);
|
|
109583
109583
|
}
|
|
109584
109584
|
async send(message) {
|
|
109585
109585
|
const attempt = async (triedAuth = false) => {
|
|
109586
|
-
var _a310,
|
|
109586
|
+
var _a310, _b35, _c10, _d8, _e6, _f2, _g5;
|
|
109587
109587
|
try {
|
|
109588
109588
|
const headers = await this.commonHeaders({
|
|
109589
109589
|
"Content-Type": "application/json",
|
|
@@ -109612,7 +109612,7 @@ var HttpMCPTransport = class {
|
|
|
109612
109612
|
throw error210;
|
|
109613
109613
|
}
|
|
109614
109614
|
} catch (error210) {
|
|
109615
|
-
(
|
|
109615
|
+
(_b35 = this.onerror) == null ? void 0 : _b35.call(this, error210);
|
|
109616
109616
|
throw error210;
|
|
109617
109617
|
}
|
|
109618
109618
|
return attempt(true);
|
|
@@ -109632,7 +109632,7 @@ var HttpMCPTransport = class {
|
|
|
109632
109632
|
const error210 = new MCPClientError({
|
|
109633
109633
|
message: errorMessage
|
|
109634
109634
|
});
|
|
109635
|
-
(
|
|
109635
|
+
(_c10 = this.onerror) == null ? void 0 : _c10.call(this, error210);
|
|
109636
109636
|
throw error210;
|
|
109637
109637
|
}
|
|
109638
109638
|
const isNotification = !("id" in message);
|
|
@@ -109657,7 +109657,7 @@ var HttpMCPTransport = class {
|
|
|
109657
109657
|
const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());
|
|
109658
109658
|
const reader = stream.getReader();
|
|
109659
109659
|
const processEvents = async () => {
|
|
109660
|
-
var
|
|
109660
|
+
var _a46, _b43, _c22;
|
|
109661
109661
|
try {
|
|
109662
109662
|
while (true) {
|
|
109663
109663
|
const { done, value } = await reader.read();
|
|
@@ -109666,7 +109666,7 @@ var HttpMCPTransport = class {
|
|
|
109666
109666
|
if (event === "message") {
|
|
109667
109667
|
try {
|
|
109668
109668
|
const msg = JSONRPCMessageSchema.parse(JSON.parse(data));
|
|
109669
|
-
(
|
|
109669
|
+
(_a46 = this.onmessage) == null ? void 0 : _a46.call(this, msg);
|
|
109670
109670
|
} catch (error210) {
|
|
109671
109671
|
const e2 = new MCPClientError({
|
|
109672
109672
|
message: "MCP HTTP Transport Error: Failed to parse message",
|
|
@@ -109724,14 +109724,14 @@ var HttpMCPTransport = class {
|
|
|
109724
109724
|
const delay2 = this.getNextReconnectionDelay(this.inboundReconnectAttempts);
|
|
109725
109725
|
this.inboundReconnectAttempts += 1;
|
|
109726
109726
|
setTimeout(async () => {
|
|
109727
|
-
var
|
|
109728
|
-
if ((
|
|
109727
|
+
var _a46;
|
|
109728
|
+
if ((_a46 = this.abortController) == null ? void 0 : _a46.signal.aborted) return;
|
|
109729
109729
|
await this.openInboundSse(false, this.lastInboundEventId);
|
|
109730
109730
|
}, delay2);
|
|
109731
109731
|
}
|
|
109732
109732
|
// Open optional inbound SSE stream; best-effort and resumable
|
|
109733
109733
|
async openInboundSse(triedAuth = false, resumeToken) {
|
|
109734
|
-
var _a310,
|
|
109734
|
+
var _a310, _b35, _c10, _d8, _e6, _f2;
|
|
109735
109735
|
try {
|
|
109736
109736
|
const headers = await this.commonHeaders({
|
|
109737
109737
|
Accept: "text/event-stream"
|
|
@@ -109757,11 +109757,11 @@ var HttpMCPTransport = class {
|
|
|
109757
109757
|
});
|
|
109758
109758
|
if (result !== "AUTHORIZED") {
|
|
109759
109759
|
const error48 = new UnauthorizedError();
|
|
109760
|
-
(
|
|
109760
|
+
(_b35 = this.onerror) == null ? void 0 : _b35.call(this, error48);
|
|
109761
109761
|
return;
|
|
109762
109762
|
}
|
|
109763
109763
|
} catch (error48) {
|
|
109764
|
-
(
|
|
109764
|
+
(_c10 = this.onerror) == null ? void 0 : _c10.call(this, error48);
|
|
109765
109765
|
return;
|
|
109766
109766
|
}
|
|
109767
109767
|
return this.openInboundSse(true, resumeToken);
|
|
@@ -109779,7 +109779,7 @@ var HttpMCPTransport = class {
|
|
|
109779
109779
|
const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());
|
|
109780
109780
|
const reader = stream.getReader();
|
|
109781
109781
|
const processEvents = async () => {
|
|
109782
|
-
var
|
|
109782
|
+
var _a46, _b43, _c22, _d22;
|
|
109783
109783
|
try {
|
|
109784
109784
|
while (true) {
|
|
109785
109785
|
const { done, value } = await reader.read();
|
|
@@ -109791,7 +109791,7 @@ var HttpMCPTransport = class {
|
|
|
109791
109791
|
if (event === "message") {
|
|
109792
109792
|
try {
|
|
109793
109793
|
const msg = JSONRPCMessageSchema.parse(JSON.parse(data));
|
|
109794
|
-
(
|
|
109794
|
+
(_a46 = this.onmessage) == null ? void 0 : _a46.call(this, msg);
|
|
109795
109795
|
} catch (error48) {
|
|
109796
109796
|
const e2 = new MCPClientError({
|
|
109797
109797
|
message: "MCP HTTP Transport Error: Failed to parse message",
|
|
@@ -110164,7 +110164,7 @@ var DefaultMCPClient = class {
|
|
|
110164
110164
|
* Creates AI SDK tools from tool definitions without fetching from the server.
|
|
110165
110165
|
*/
|
|
110166
110166
|
toolsFromDefinitions(definitions, { schemas = "automatic" } = {}) {
|
|
110167
|
-
var _a310,
|
|
110167
|
+
var _a310, _b35;
|
|
110168
110168
|
const tools = {};
|
|
110169
110169
|
for (const {
|
|
110170
110170
|
name: name34,
|
|
@@ -110181,8 +110181,8 @@ var DefaultMCPClient = class {
|
|
|
110181
110181
|
const self2 = this;
|
|
110182
110182
|
const outputSchema2 = schemas !== "automatic" ? (_a310 = schemas[name34]) == null ? void 0 : _a310.outputSchema : void 0;
|
|
110183
110183
|
const execute = async (args, options) => {
|
|
110184
|
-
var
|
|
110185
|
-
(
|
|
110184
|
+
var _a46;
|
|
110185
|
+
(_a46 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a46.throwIfAborted();
|
|
110186
110186
|
const result = await self2.callTool({ name: name34, args, options });
|
|
110187
110187
|
if (outputSchema2 != null) {
|
|
110188
110188
|
return self2.extractStructuredContent(result, outputSchema2, name34);
|
|
@@ -110194,7 +110194,7 @@ var DefaultMCPClient = class {
|
|
|
110194
110194
|
title: resolvedTitle,
|
|
110195
110195
|
inputSchema: jsonSchema({
|
|
110196
110196
|
...inputSchema,
|
|
110197
|
-
properties: (
|
|
110197
|
+
properties: (_b35 = inputSchema.properties) != null ? _b35 : {},
|
|
110198
110198
|
additionalProperties: false
|
|
110199
110199
|
}),
|
|
110200
110200
|
execute,
|
|
@@ -112063,7 +112063,7 @@ var GatewayImageModel = class {
|
|
|
112063
112063
|
headers,
|
|
112064
112064
|
abortSignal
|
|
112065
112065
|
}) {
|
|
112066
|
-
var _a93, _b92,
|
|
112066
|
+
var _a93, _b92, _c10, _d8;
|
|
112067
112067
|
const resolvedHeaders = await resolve2(this.config.headers());
|
|
112068
112068
|
try {
|
|
112069
112069
|
const {
|
|
@@ -112113,7 +112113,7 @@ var GatewayImageModel = class {
|
|
|
112113
112113
|
...responseBody.usage != null && {
|
|
112114
112114
|
usage: {
|
|
112115
112115
|
inputTokens: (_b92 = responseBody.usage.inputTokens) != null ? _b92 : void 0,
|
|
112116
|
-
outputTokens: (
|
|
112116
|
+
outputTokens: (_c10 = responseBody.usage.outputTokens) != null ? _c10 : void 0,
|
|
112117
112117
|
totalTokens: (_d8 = responseBody.usage.totalTokens) != null ? _d8 : void 0
|
|
112118
112118
|
}
|
|
112119
112119
|
}
|
|
@@ -112612,8 +112612,8 @@ function createGatewayProvider(options = {}) {
|
|
|
112612
112612
|
});
|
|
112613
112613
|
};
|
|
112614
112614
|
const getAvailableModels = async () => {
|
|
112615
|
-
var _a103, _b102,
|
|
112616
|
-
const now2 = (
|
|
112615
|
+
var _a103, _b102, _c10;
|
|
112616
|
+
const now2 = (_c10 = (_b102 = (_a103 = options._internal) == null ? void 0 : _a103.currentDate) == null ? void 0 : _b102.call(_a103).getTime()) != null ? _c10 : Date.now();
|
|
112617
112617
|
if (!pendingMetadata || now2 - lastFetchTime > cacheRefreshMillis) {
|
|
112618
112618
|
lastFetchTime = now2;
|
|
112619
112619
|
pendingMetadata = new GatewayFetchMetadata({
|
|
@@ -112789,11 +112789,11 @@ var major = VERSION4.split(".")[0];
|
|
|
112789
112789
|
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
112790
112790
|
var _global = _globalThis;
|
|
112791
112791
|
function registerGlobal(type21, instance, diag, allowOverride) {
|
|
112792
|
-
var
|
|
112792
|
+
var _a46;
|
|
112793
112793
|
if (allowOverride === void 0) {
|
|
112794
112794
|
allowOverride = false;
|
|
112795
112795
|
}
|
|
112796
|
-
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
112796
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a46 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a46 !== void 0 ? _a46 : {
|
|
112797
112797
|
version: VERSION4
|
|
112798
112798
|
};
|
|
112799
112799
|
if (!allowOverride && api[type21]) {
|
|
@@ -112811,12 +112811,12 @@ function registerGlobal(type21, instance, diag, allowOverride) {
|
|
|
112811
112811
|
return true;
|
|
112812
112812
|
}
|
|
112813
112813
|
function getGlobal(type21) {
|
|
112814
|
-
var
|
|
112815
|
-
var globalVersion = (
|
|
112814
|
+
var _a46, _b35;
|
|
112815
|
+
var globalVersion = (_a46 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a46 === void 0 ? void 0 : _a46.version;
|
|
112816
112816
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
112817
112817
|
return;
|
|
112818
112818
|
}
|
|
112819
|
-
return (
|
|
112819
|
+
return (_b35 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b35 === void 0 ? void 0 : _b35[type21];
|
|
112820
112820
|
}
|
|
112821
112821
|
function unregisterGlobal(type21, diag) {
|
|
112822
112822
|
diag.debug("@opentelemetry/api: Unregistering a global for " + type21 + " v" + VERSION4 + ".");
|
|
@@ -112989,13 +112989,13 @@ var DiagAPI = (
|
|
|
112989
112989
|
}
|
|
112990
112990
|
var self2 = this;
|
|
112991
112991
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
112992
|
-
var
|
|
112992
|
+
var _a46, _b35, _c10;
|
|
112993
112993
|
if (optionsOrLogLevel === void 0) {
|
|
112994
112994
|
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
112995
112995
|
}
|
|
112996
112996
|
if (logger === self2) {
|
|
112997
112997
|
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
112998
|
-
self2.error((
|
|
112998
|
+
self2.error((_a46 = err.stack) !== null && _a46 !== void 0 ? _a46 : err.message);
|
|
112999
112999
|
return false;
|
|
113000
113000
|
}
|
|
113001
113001
|
if (typeof optionsOrLogLevel === "number") {
|
|
@@ -113004,9 +113004,9 @@ var DiagAPI = (
|
|
|
113004
113004
|
};
|
|
113005
113005
|
}
|
|
113006
113006
|
var oldLogger = getGlobal("diag");
|
|
113007
|
-
var newLogger = createLogLevelDiagLogger((
|
|
113007
|
+
var newLogger = createLogLevelDiagLogger((_b35 = optionsOrLogLevel.logLevel) !== null && _b35 !== void 0 ? _b35 : DiagLogLevel.INFO, logger);
|
|
113008
113008
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
113009
|
-
var stack = (
|
|
113009
|
+
var stack = (_c10 = new Error().stack) !== null && _c10 !== void 0 ? _c10 : "<failed to generate stacktrace>";
|
|
113010
113010
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
113011
113011
|
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
113012
113012
|
}
|
|
@@ -113166,12 +113166,12 @@ var ContextAPI = (
|
|
|
113166
113166
|
return this._getContextManager().active();
|
|
113167
113167
|
};
|
|
113168
113168
|
ContextAPI2.prototype.with = function(context2, fn, thisArg) {
|
|
113169
|
-
var
|
|
113169
|
+
var _a46;
|
|
113170
113170
|
var args = [];
|
|
113171
113171
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
113172
113172
|
args[_i - 3] = arguments[_i];
|
|
113173
113173
|
}
|
|
113174
|
-
return (
|
|
113174
|
+
return (_a46 = this._getContextManager()).with.apply(_a46, __spreadArray4([context2, fn, thisArg], __read4(args), false));
|
|
113175
113175
|
};
|
|
113176
113176
|
ContextAPI2.prototype.bind = function(context2, target) {
|
|
113177
113177
|
return this._getContextManager().bind(context2, target);
|
|
@@ -113266,8 +113266,8 @@ function setSpanContext(context2, spanContext) {
|
|
|
113266
113266
|
return setSpan(context2, new NonRecordingSpan(spanContext));
|
|
113267
113267
|
}
|
|
113268
113268
|
function getSpanContext(context2) {
|
|
113269
|
-
var
|
|
113270
|
-
return (
|
|
113269
|
+
var _a46;
|
|
113270
|
+
return (_a46 = getSpan(context2)) === null || _a46 === void 0 ? void 0 : _a46.spanContext();
|
|
113271
113271
|
}
|
|
113272
113272
|
|
|
113273
113273
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
@@ -113390,19 +113390,19 @@ var ProxyTracerProvider = (
|
|
|
113390
113390
|
function ProxyTracerProvider2() {
|
|
113391
113391
|
}
|
|
113392
113392
|
ProxyTracerProvider2.prototype.getTracer = function(name21, version2, options) {
|
|
113393
|
-
var
|
|
113394
|
-
return (
|
|
113393
|
+
var _a46;
|
|
113394
|
+
return (_a46 = this.getDelegateTracer(name21, version2, options)) !== null && _a46 !== void 0 ? _a46 : new ProxyTracer(this, name21, version2, options);
|
|
113395
113395
|
};
|
|
113396
113396
|
ProxyTracerProvider2.prototype.getDelegate = function() {
|
|
113397
|
-
var
|
|
113398
|
-
return (
|
|
113397
|
+
var _a46;
|
|
113398
|
+
return (_a46 = this._delegate) !== null && _a46 !== void 0 ? _a46 : NOOP_TRACER_PROVIDER;
|
|
113399
113399
|
};
|
|
113400
113400
|
ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
|
|
113401
113401
|
this._delegate = delegate;
|
|
113402
113402
|
};
|
|
113403
113403
|
ProxyTracerProvider2.prototype.getDelegateTracer = function(name21, version2, options) {
|
|
113404
|
-
var
|
|
113405
|
-
return (
|
|
113404
|
+
var _a46;
|
|
113405
|
+
return (_a46 = this._delegate) === null || _a46 === void 0 ? void 0 : _a46.getTracer(name21, version2, options);
|
|
113406
113406
|
};
|
|
113407
113407
|
return ProxyTracerProvider2;
|
|
113408
113408
|
})()
|
|
@@ -114139,8 +114139,8 @@ var dataContentSchema = external_exports.union([
|
|
|
114139
114139
|
external_exports.custom(
|
|
114140
114140
|
// Buffer might not be available in some environments such as CloudFlare:
|
|
114141
114141
|
(value) => {
|
|
114142
|
-
var _a212,
|
|
114143
|
-
return (
|
|
114142
|
+
var _a212, _b35;
|
|
114143
|
+
return (_b35 = (_a212 = globalThis.Buffer) == null ? void 0 : _a212.isBuffer(value)) != null ? _b35 : false;
|
|
114144
114144
|
},
|
|
114145
114145
|
{ message: "Must be a Buffer" }
|
|
114146
114146
|
)
|
|
@@ -115226,16 +115226,16 @@ function createNullLanguageModelUsage() {
|
|
|
115226
115226
|
};
|
|
115227
115227
|
}
|
|
115228
115228
|
function addLanguageModelUsage(usage1, usage2) {
|
|
115229
|
-
var _a212,
|
|
115229
|
+
var _a212, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2;
|
|
115230
115230
|
return {
|
|
115231
115231
|
inputTokens: addTokenCounts(usage1.inputTokens, usage2.inputTokens),
|
|
115232
115232
|
inputTokenDetails: {
|
|
115233
115233
|
noCacheTokens: addTokenCounts(
|
|
115234
115234
|
(_a212 = usage1.inputTokenDetails) == null ? void 0 : _a212.noCacheTokens,
|
|
115235
|
-
(
|
|
115235
|
+
(_b35 = usage2.inputTokenDetails) == null ? void 0 : _b35.noCacheTokens
|
|
115236
115236
|
),
|
|
115237
115237
|
cacheReadTokens: addTokenCounts(
|
|
115238
|
-
(
|
|
115238
|
+
(_c10 = usage1.inputTokenDetails) == null ? void 0 : _c10.cacheReadTokens,
|
|
115239
115239
|
(_d8 = usage2.inputTokenDetails) == null ? void 0 : _d8.cacheReadTokens
|
|
115240
115240
|
),
|
|
115241
115241
|
cacheWriteTokens: addTokenCounts(
|
|
@@ -115496,8 +115496,8 @@ function collectToolApprovals({
|
|
|
115496
115496
|
return { approvedToolApprovals, deniedToolApprovals };
|
|
115497
115497
|
}
|
|
115498
115498
|
function now() {
|
|
115499
|
-
var _a212,
|
|
115500
|
-
return (
|
|
115499
|
+
var _a212, _b35;
|
|
115500
|
+
return (_b35 = (_a212 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a212.now()) != null ? _b35 : Date.now();
|
|
115501
115501
|
}
|
|
115502
115502
|
async function executeToolCall({
|
|
115503
115503
|
toolCall,
|
|
@@ -116820,7 +116820,7 @@ async function generateText({
|
|
|
116820
116820
|
}),
|
|
116821
116821
|
tracer,
|
|
116822
116822
|
fn: async (span) => {
|
|
116823
|
-
var _a212,
|
|
116823
|
+
var _a212, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m;
|
|
116824
116824
|
const initialMessages = initialPrompt.messages;
|
|
116825
116825
|
const responseMessages = [];
|
|
116826
116826
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -116927,8 +116927,8 @@ async function generateText({
|
|
|
116927
116927
|
};
|
|
116928
116928
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
116929
116929
|
prompt: {
|
|
116930
|
-
system: (
|
|
116931
|
-
messages: (
|
|
116930
|
+
system: (_b35 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b35 : initialPrompt.system,
|
|
116931
|
+
messages: (_c10 = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _c10 : stepInputMessages
|
|
116932
116932
|
},
|
|
116933
116933
|
supportedUrls: await stepModel.supportedUrls,
|
|
116934
116934
|
download: download2
|
|
@@ -117882,7 +117882,7 @@ function processUIMessageStream({
|
|
|
117882
117882
|
new TransformStream({
|
|
117883
117883
|
async transform(chunk, controller) {
|
|
117884
117884
|
await runUpdateMessageJob(async ({ state, write }) => {
|
|
117885
|
-
var _a212,
|
|
117885
|
+
var _a212, _b35, _c10, _d8;
|
|
117886
117886
|
function getToolInvocation(toolCallId) {
|
|
117887
117887
|
const toolInvocations = state.message.parts.filter(isToolUIPart);
|
|
117888
117888
|
const toolInvocation = toolInvocations.find(
|
|
@@ -118025,7 +118025,7 @@ function processUIMessageStream({
|
|
|
118025
118025
|
});
|
|
118026
118026
|
}
|
|
118027
118027
|
textPart.state = "done";
|
|
118028
|
-
textPart.providerMetadata = (
|
|
118028
|
+
textPart.providerMetadata = (_b35 = chunk.providerMetadata) != null ? _b35 : textPart.providerMetadata;
|
|
118029
118029
|
delete state.activeTextParts[chunk.id];
|
|
118030
118030
|
write();
|
|
118031
118031
|
break;
|
|
@@ -118052,7 +118052,7 @@ function processUIMessageStream({
|
|
|
118052
118052
|
});
|
|
118053
118053
|
}
|
|
118054
118054
|
reasoningPart.text += chunk.delta;
|
|
118055
|
-
reasoningPart.providerMetadata = (
|
|
118055
|
+
reasoningPart.providerMetadata = (_c10 = chunk.providerMetadata) != null ? _c10 : reasoningPart.providerMetadata;
|
|
118056
118056
|
write();
|
|
118057
118057
|
break;
|
|
118058
118058
|
}
|
|
@@ -119135,7 +119135,7 @@ var DefaultStreamTextResult = class {
|
|
|
119135
119135
|
let activeReasoningContent = {};
|
|
119136
119136
|
const eventProcessor = new TransformStream({
|
|
119137
119137
|
async transform(chunk, controller) {
|
|
119138
|
-
var _a212,
|
|
119138
|
+
var _a212, _b35, _c10, _d8;
|
|
119139
119139
|
controller.enqueue(chunk);
|
|
119140
119140
|
const { part } = chunk;
|
|
119141
119141
|
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") {
|
|
@@ -119179,7 +119179,7 @@ var DefaultStreamTextResult = class {
|
|
|
119179
119179
|
});
|
|
119180
119180
|
return;
|
|
119181
119181
|
}
|
|
119182
|
-
activeText.providerMetadata = (
|
|
119182
|
+
activeText.providerMetadata = (_b35 = part.providerMetadata) != null ? _b35 : activeText.providerMetadata;
|
|
119183
119183
|
delete activeTextContent[part.id];
|
|
119184
119184
|
}
|
|
119185
119185
|
if (part.type === "reasoning-start") {
|
|
@@ -119203,7 +119203,7 @@ var DefaultStreamTextResult = class {
|
|
|
119203
119203
|
return;
|
|
119204
119204
|
}
|
|
119205
119205
|
activeReasoning.text += part.text;
|
|
119206
|
-
activeReasoning.providerMetadata = (
|
|
119206
|
+
activeReasoning.providerMetadata = (_c10 = part.providerMetadata) != null ? _c10 : activeReasoning.providerMetadata;
|
|
119207
119207
|
}
|
|
119208
119208
|
if (part.type === "reasoning-end") {
|
|
119209
119209
|
const activeReasoning = activeReasoningContent[part.id];
|
|
@@ -119606,7 +119606,7 @@ var DefaultStreamTextResult = class {
|
|
|
119606
119606
|
responseMessages,
|
|
119607
119607
|
usage
|
|
119608
119608
|
}) {
|
|
119609
|
-
var _a212,
|
|
119609
|
+
var _a212, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i;
|
|
119610
119610
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
119611
119611
|
const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
|
|
119612
119612
|
let chunkTimeoutId = void 0;
|
|
@@ -119651,8 +119651,8 @@ var DefaultStreamTextResult = class {
|
|
|
119651
119651
|
};
|
|
119652
119652
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
119653
119653
|
prompt: {
|
|
119654
|
-
system: (
|
|
119655
|
-
messages: (
|
|
119654
|
+
system: (_b35 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b35 : initialPrompt.system,
|
|
119655
|
+
messages: (_c10 = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _c10 : stepInputMessages
|
|
119656
119656
|
},
|
|
119657
119657
|
supportedUrls: await stepModel.supportedUrls,
|
|
119658
119658
|
download: download2
|
|
@@ -120241,11 +120241,11 @@ var DefaultStreamTextResult = class {
|
|
|
120241
120241
|
);
|
|
120242
120242
|
}
|
|
120243
120243
|
get elementStream() {
|
|
120244
|
-
var _a212,
|
|
120244
|
+
var _a212, _b35, _c10;
|
|
120245
120245
|
const transform2 = (_a212 = this.outputSpecification) == null ? void 0 : _a212.createElementStreamTransform();
|
|
120246
120246
|
if (transform2 == null) {
|
|
120247
120247
|
throw new UnsupportedFunctionalityError({
|
|
120248
|
-
functionality: `element streams in ${(
|
|
120248
|
+
functionality: `element streams in ${(_c10 = (_b35 = this.outputSpecification) == null ? void 0 : _b35.name) != null ? _c10 : "text"} mode`
|
|
120249
120249
|
});
|
|
120250
120250
|
}
|
|
120251
120251
|
return createAsyncIterableStream(this.teeStream().pipeThrough(transform2));
|
|
@@ -120906,7 +120906,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
120906
120906
|
};
|
|
120907
120907
|
}
|
|
120908
120908
|
function convertOpenAIChatUsage(usage) {
|
|
120909
|
-
var
|
|
120909
|
+
var _a46, _b35, _c10, _d8, _e6, _f2;
|
|
120910
120910
|
if (usage == null) {
|
|
120911
120911
|
return {
|
|
120912
120912
|
inputTokens: {
|
|
@@ -120923,9 +120923,9 @@ function convertOpenAIChatUsage(usage) {
|
|
|
120923
120923
|
raw: void 0
|
|
120924
120924
|
};
|
|
120925
120925
|
}
|
|
120926
|
-
const promptTokens = (
|
|
120927
|
-
const completionTokens = (
|
|
120928
|
-
const cachedTokens = (_d8 = (
|
|
120926
|
+
const promptTokens = (_a46 = usage.prompt_tokens) != null ? _a46 : 0;
|
|
120927
|
+
const completionTokens = (_b35 = usage.completion_tokens) != null ? _b35 : 0;
|
|
120928
|
+
const cachedTokens = (_d8 = (_c10 = usage.prompt_tokens_details) == null ? void 0 : _c10.cached_tokens) != null ? _d8 : 0;
|
|
120929
120929
|
const reasoningTokens = (_f2 = (_e6 = usage.completion_tokens_details) == null ? void 0 : _e6.reasoning_tokens) != null ? _f2 : 0;
|
|
120930
120930
|
return {
|
|
120931
120931
|
inputTokens: {
|
|
@@ -120946,7 +120946,7 @@ function convertToOpenAIChatMessages({
|
|
|
120946
120946
|
prompt,
|
|
120947
120947
|
systemMessageMode = "system"
|
|
120948
120948
|
}) {
|
|
120949
|
-
var
|
|
120949
|
+
var _a46;
|
|
120950
120950
|
const messages = [];
|
|
120951
120951
|
const warnings = [];
|
|
120952
120952
|
for (const { role, content } of prompt) {
|
|
@@ -120985,7 +120985,7 @@ function convertToOpenAIChatMessages({
|
|
|
120985
120985
|
messages.push({
|
|
120986
120986
|
role: "user",
|
|
120987
120987
|
content: content.map((part, index) => {
|
|
120988
|
-
var _a210,
|
|
120988
|
+
var _a210, _b35, _c10;
|
|
120989
120989
|
switch (part.type) {
|
|
120990
120990
|
case "text": {
|
|
120991
120991
|
return { type: "text", text: part.text };
|
|
@@ -120998,7 +120998,7 @@ function convertToOpenAIChatMessages({
|
|
|
120998
120998
|
image_url: {
|
|
120999
120999
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
|
|
121000
121000
|
// OpenAI specific extension: image detail
|
|
121001
|
-
detail: (
|
|
121001
|
+
detail: (_b35 = (_a210 = part.providerOptions) == null ? void 0 : _a210.openai) == null ? void 0 : _b35.imageDetail
|
|
121002
121002
|
}
|
|
121003
121003
|
};
|
|
121004
121004
|
} else if (part.mediaType.startsWith("audio/")) {
|
|
@@ -121042,7 +121042,7 @@ function convertToOpenAIChatMessages({
|
|
|
121042
121042
|
return {
|
|
121043
121043
|
type: "file",
|
|
121044
121044
|
file: typeof part.data === "string" && part.data.startsWith("file-") ? { file_id: part.data } : {
|
|
121045
|
-
filename: (
|
|
121045
|
+
filename: (_c10 = part.filename) != null ? _c10 : `part-${index}.pdf`,
|
|
121046
121046
|
file_data: `data:application/pdf;base64,${convertToBase64(part.data)}`
|
|
121047
121047
|
}
|
|
121048
121048
|
};
|
|
@@ -121099,7 +121099,7 @@ function convertToOpenAIChatMessages({
|
|
|
121099
121099
|
contentValue = output.value;
|
|
121100
121100
|
break;
|
|
121101
121101
|
case "execution-denied":
|
|
121102
|
-
contentValue = (
|
|
121102
|
+
contentValue = (_a46 = output.reason) != null ? _a46 : "Tool execution denied.";
|
|
121103
121103
|
break;
|
|
121104
121104
|
case "content":
|
|
121105
121105
|
case "json":
|
|
@@ -121488,22 +121488,22 @@ var OpenAIChatLanguageModel = class {
|
|
|
121488
121488
|
toolChoice,
|
|
121489
121489
|
providerOptions
|
|
121490
121490
|
}) {
|
|
121491
|
-
var
|
|
121491
|
+
var _a46, _b35, _c10, _d8, _e6;
|
|
121492
121492
|
const warnings = [];
|
|
121493
|
-
const openaiOptions = (
|
|
121493
|
+
const openaiOptions = (_a46 = await parseProviderOptions({
|
|
121494
121494
|
provider: "openai",
|
|
121495
121495
|
providerOptions,
|
|
121496
121496
|
schema: openaiLanguageModelChatOptions
|
|
121497
|
-
})) != null ?
|
|
121497
|
+
})) != null ? _a46 : {};
|
|
121498
121498
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
121499
|
-
const isReasoningModel = (
|
|
121499
|
+
const isReasoningModel = (_b35 = openaiOptions.forceReasoning) != null ? _b35 : modelCapabilities.isReasoningModel;
|
|
121500
121500
|
if (topK != null) {
|
|
121501
121501
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
121502
121502
|
}
|
|
121503
121503
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
121504
121504
|
{
|
|
121505
121505
|
prompt,
|
|
121506
|
-
systemMessageMode: (
|
|
121506
|
+
systemMessageMode: (_c10 = openaiOptions.systemMessageMode) != null ? _c10 : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode
|
|
121507
121507
|
}
|
|
121508
121508
|
);
|
|
121509
121509
|
warnings.push(...messageWarnings);
|
|
@@ -121655,7 +121655,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121655
121655
|
};
|
|
121656
121656
|
}
|
|
121657
121657
|
async doGenerate(options) {
|
|
121658
|
-
var
|
|
121658
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5;
|
|
121659
121659
|
const { args: body, warnings } = await this.getArgs(options);
|
|
121660
121660
|
const {
|
|
121661
121661
|
responseHeaders,
|
|
@@ -121681,15 +121681,15 @@ var OpenAIChatLanguageModel = class {
|
|
|
121681
121681
|
if (text2 != null && text2.length > 0) {
|
|
121682
121682
|
content.push({ type: "text", text: text2 });
|
|
121683
121683
|
}
|
|
121684
|
-
for (const toolCall of (
|
|
121684
|
+
for (const toolCall of (_a46 = choice2.message.tool_calls) != null ? _a46 : []) {
|
|
121685
121685
|
content.push({
|
|
121686
121686
|
type: "tool-call",
|
|
121687
|
-
toolCallId: (
|
|
121687
|
+
toolCallId: (_b35 = toolCall.id) != null ? _b35 : generateId(),
|
|
121688
121688
|
toolName: toolCall.function.name,
|
|
121689
121689
|
input: toolCall.function.arguments
|
|
121690
121690
|
});
|
|
121691
121691
|
}
|
|
121692
|
-
for (const annotation of (
|
|
121692
|
+
for (const annotation of (_c10 = choice2.message.annotations) != null ? _c10 : []) {
|
|
121693
121693
|
content.push({
|
|
121694
121694
|
type: "source",
|
|
121695
121695
|
sourceType: "url",
|
|
@@ -121766,7 +121766,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121766
121766
|
controller.enqueue({ type: "stream-start", warnings });
|
|
121767
121767
|
},
|
|
121768
121768
|
transform(chunk, controller) {
|
|
121769
|
-
var
|
|
121769
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m, _n, _o, _p, _q;
|
|
121770
121770
|
if (options.includeRawChunks) {
|
|
121771
121771
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
121772
121772
|
}
|
|
@@ -121793,10 +121793,10 @@ var OpenAIChatLanguageModel = class {
|
|
|
121793
121793
|
}
|
|
121794
121794
|
if (value.usage != null) {
|
|
121795
121795
|
usage = value.usage;
|
|
121796
|
-
if (((
|
|
121797
|
-
providerMetadata.openai.acceptedPredictionTokens = (
|
|
121796
|
+
if (((_a46 = value.usage.completion_tokens_details) == null ? void 0 : _a46.accepted_prediction_tokens) != null) {
|
|
121797
|
+
providerMetadata.openai.acceptedPredictionTokens = (_b35 = value.usage.completion_tokens_details) == null ? void 0 : _b35.accepted_prediction_tokens;
|
|
121798
121798
|
}
|
|
121799
|
-
if (((
|
|
121799
|
+
if (((_c10 = value.usage.completion_tokens_details) == null ? void 0 : _c10.rejected_prediction_tokens) != null) {
|
|
121800
121800
|
providerMetadata.openai.rejectedPredictionTokens = (_d8 = value.usage.completion_tokens_details) == null ? void 0 : _d8.rejected_prediction_tokens;
|
|
121801
121801
|
}
|
|
121802
121802
|
}
|
|
@@ -121944,7 +121944,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
121944
121944
|
}
|
|
121945
121945
|
};
|
|
121946
121946
|
function convertOpenAICompletionUsage(usage) {
|
|
121947
|
-
var
|
|
121947
|
+
var _a46, _b35, _c10, _d8;
|
|
121948
121948
|
if (usage == null) {
|
|
121949
121949
|
return {
|
|
121950
121950
|
inputTokens: {
|
|
@@ -121961,11 +121961,11 @@ function convertOpenAICompletionUsage(usage) {
|
|
|
121961
121961
|
raw: void 0
|
|
121962
121962
|
};
|
|
121963
121963
|
}
|
|
121964
|
-
const promptTokens = (
|
|
121965
|
-
const completionTokens = (
|
|
121964
|
+
const promptTokens = (_a46 = usage.prompt_tokens) != null ? _a46 : 0;
|
|
121965
|
+
const completionTokens = (_b35 = usage.completion_tokens) != null ? _b35 : 0;
|
|
121966
121966
|
return {
|
|
121967
121967
|
inputTokens: {
|
|
121968
|
-
total: (
|
|
121968
|
+
total: (_c10 = usage.prompt_tokens) != null ? _c10 : void 0,
|
|
121969
121969
|
noCache: promptTokens,
|
|
121970
121970
|
cacheRead: void 0,
|
|
121971
121971
|
cacheWrite: void 0
|
|
@@ -122261,7 +122261,7 @@ var OpenAICompletionLanguageModel = class {
|
|
|
122261
122261
|
};
|
|
122262
122262
|
}
|
|
122263
122263
|
async doGenerate(options) {
|
|
122264
|
-
var
|
|
122264
|
+
var _a46;
|
|
122265
122265
|
const { args, warnings } = await this.getArgs(options);
|
|
122266
122266
|
const {
|
|
122267
122267
|
responseHeaders,
|
|
@@ -122291,7 +122291,7 @@ var OpenAICompletionLanguageModel = class {
|
|
|
122291
122291
|
usage: convertOpenAICompletionUsage(response.usage),
|
|
122292
122292
|
finishReason: {
|
|
122293
122293
|
unified: mapOpenAIFinishReason2(choice2.finish_reason),
|
|
122294
|
-
raw: (
|
|
122294
|
+
raw: (_a46 = choice2.finish_reason) != null ? _a46 : void 0
|
|
122295
122295
|
},
|
|
122296
122296
|
request: { body: args },
|
|
122297
122297
|
response: {
|
|
@@ -122442,7 +122442,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
122442
122442
|
abortSignal,
|
|
122443
122443
|
providerOptions
|
|
122444
122444
|
}) {
|
|
122445
|
-
var
|
|
122445
|
+
var _a46;
|
|
122446
122446
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
122447
122447
|
throw new TooManyEmbeddingValuesForCallError({
|
|
122448
122448
|
provider: this.provider,
|
|
@@ -122451,11 +122451,11 @@ var OpenAIEmbeddingModel = class {
|
|
|
122451
122451
|
values
|
|
122452
122452
|
});
|
|
122453
122453
|
}
|
|
122454
|
-
const openaiOptions = (
|
|
122454
|
+
const openaiOptions = (_a46 = await parseProviderOptions({
|
|
122455
122455
|
provider: "openai",
|
|
122456
122456
|
providerOptions,
|
|
122457
122457
|
schema: openaiEmbeddingModelOptions
|
|
122458
|
-
})) != null ?
|
|
122458
|
+
})) != null ? _a46 : {};
|
|
122459
122459
|
const {
|
|
122460
122460
|
responseHeaders,
|
|
122461
122461
|
value: response,
|
|
@@ -122540,8 +122540,8 @@ var OpenAIImageModel = class {
|
|
|
122540
122540
|
this.specificationVersion = "v3";
|
|
122541
122541
|
}
|
|
122542
122542
|
get maxImagesPerCall() {
|
|
122543
|
-
var
|
|
122544
|
-
return (
|
|
122543
|
+
var _a46;
|
|
122544
|
+
return (_a46 = modelMaxImagesPerCall[this.modelId]) != null ? _a46 : 1;
|
|
122545
122545
|
}
|
|
122546
122546
|
get provider() {
|
|
122547
122547
|
return this.config.provider;
|
|
@@ -122558,7 +122558,7 @@ var OpenAIImageModel = class {
|
|
|
122558
122558
|
headers,
|
|
122559
122559
|
abortSignal
|
|
122560
122560
|
}) {
|
|
122561
|
-
var
|
|
122561
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2;
|
|
122562
122562
|
const warnings = [];
|
|
122563
122563
|
if (aspectRatio != null) {
|
|
122564
122564
|
warnings.push({
|
|
@@ -122570,7 +122570,7 @@ var OpenAIImageModel = class {
|
|
|
122570
122570
|
if (seed != null) {
|
|
122571
122571
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
122572
122572
|
}
|
|
122573
|
-
const currentDate = (
|
|
122573
|
+
const currentDate = (_c10 = (_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : /* @__PURE__ */ new Date();
|
|
122574
122574
|
if (files != null) {
|
|
122575
122575
|
const { value: response2, responseHeaders: responseHeaders2 } = await postFormDataToApi({
|
|
122576
122576
|
url: this.config.url({
|
|
@@ -123276,7 +123276,7 @@ var openaiTools = {
|
|
|
123276
123276
|
mcp
|
|
123277
123277
|
};
|
|
123278
123278
|
function convertOpenAIResponsesUsage(usage) {
|
|
123279
|
-
var
|
|
123279
|
+
var _a46, _b35, _c10, _d8;
|
|
123280
123280
|
if (usage == null) {
|
|
123281
123281
|
return {
|
|
123282
123282
|
inputTokens: {
|
|
@@ -123295,8 +123295,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
123295
123295
|
}
|
|
123296
123296
|
const inputTokens = usage.input_tokens;
|
|
123297
123297
|
const outputTokens = usage.output_tokens;
|
|
123298
|
-
const cachedTokens = (
|
|
123299
|
-
const reasoningTokens = (_d8 = (
|
|
123298
|
+
const cachedTokens = (_b35 = (_a46 = usage.input_tokens_details) == null ? void 0 : _a46.cached_tokens) != null ? _b35 : 0;
|
|
123299
|
+
const reasoningTokens = (_d8 = (_c10 = usage.output_tokens_details) == null ? void 0 : _c10.reasoning_tokens) != null ? _d8 : 0;
|
|
123300
123300
|
return {
|
|
123301
123301
|
inputTokens: {
|
|
123302
123302
|
total: inputTokens,
|
|
@@ -123329,7 +123329,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
123329
123329
|
hasApplyPatchTool = false,
|
|
123330
123330
|
customProviderToolNames
|
|
123331
123331
|
}) {
|
|
123332
|
-
var
|
|
123332
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m;
|
|
123333
123333
|
const input = [];
|
|
123334
123334
|
const warnings = [];
|
|
123335
123335
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -123410,7 +123410,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
123410
123410
|
for (const part of content) {
|
|
123411
123411
|
switch (part.type) {
|
|
123412
123412
|
case "text": {
|
|
123413
|
-
const providerOpts = (
|
|
123413
|
+
const providerOpts = (_a46 = part.providerOptions) == null ? void 0 : _a46[providerOptionsName];
|
|
123414
123414
|
const id = providerOpts == null ? void 0 : providerOpts.itemId;
|
|
123415
123415
|
const phase = providerOpts == null ? void 0 : providerOpts.phase;
|
|
123416
123416
|
if (hasConversation && id != null) {
|
|
@@ -123429,7 +123429,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
123429
123429
|
break;
|
|
123430
123430
|
}
|
|
123431
123431
|
case "tool-call": {
|
|
123432
|
-
const id = (_f2 = (
|
|
123432
|
+
const id = (_f2 = (_c10 = (_b35 = part.providerOptions) == null ? void 0 : _b35[providerOptionsName]) == null ? void 0 : _c10.itemId) != null ? _f2 : (_e6 = (_d8 = part.providerMetadata) == null ? void 0 : _d8[providerOptionsName]) == null ? void 0 : _e6.itemId;
|
|
123433
123433
|
if (hasConversation && id != null) {
|
|
123434
123434
|
break;
|
|
123435
123435
|
}
|
|
@@ -124834,7 +124834,7 @@ async function prepareResponsesTools({
|
|
|
124834
124834
|
toolNameMapping,
|
|
124835
124835
|
customProviderToolNames
|
|
124836
124836
|
}) {
|
|
124837
|
-
var
|
|
124837
|
+
var _a46;
|
|
124838
124838
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
124839
124839
|
const toolWarnings = [];
|
|
124840
124840
|
if (tools == null) {
|
|
@@ -125018,7 +125018,7 @@ async function prepareResponsesTools({
|
|
|
125018
125018
|
case "required":
|
|
125019
125019
|
return { tools: openaiTools2, toolChoice: type21, toolWarnings };
|
|
125020
125020
|
case "tool": {
|
|
125021
|
-
const resolvedToolName = (
|
|
125021
|
+
const resolvedToolName = (_a46 = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a46 : toolChoice.toolName;
|
|
125022
125022
|
return {
|
|
125023
125023
|
tools: openaiTools2,
|
|
125024
125024
|
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
@@ -125080,13 +125080,13 @@ function mapShellSkills(skills) {
|
|
|
125080
125080
|
);
|
|
125081
125081
|
}
|
|
125082
125082
|
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
125083
|
-
var
|
|
125083
|
+
var _a46, _b35;
|
|
125084
125084
|
const mapping = {};
|
|
125085
125085
|
for (const message of prompt) {
|
|
125086
125086
|
if (message.role !== "assistant") continue;
|
|
125087
125087
|
for (const part of message.content) {
|
|
125088
125088
|
if (part.type !== "tool-call") continue;
|
|
125089
|
-
const approvalRequestId = (
|
|
125089
|
+
const approvalRequestId = (_b35 = (_a46 = part.providerOptions) == null ? void 0 : _a46.openai) == null ? void 0 : _b35.approvalRequestId;
|
|
125090
125090
|
if (approvalRequestId != null) {
|
|
125091
125091
|
mapping[approvalRequestId] = part.toolCallId;
|
|
125092
125092
|
}
|
|
@@ -125122,7 +125122,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125122
125122
|
toolChoice,
|
|
125123
125123
|
responseFormat
|
|
125124
125124
|
}) {
|
|
125125
|
-
var
|
|
125125
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i;
|
|
125126
125126
|
const warnings = [];
|
|
125127
125127
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
125128
125128
|
if (topK != null) {
|
|
@@ -125153,7 +125153,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125153
125153
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
125154
125154
|
});
|
|
125155
125155
|
}
|
|
125156
|
-
const isReasoningModel = (
|
|
125156
|
+
const isReasoningModel = (_a46 = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _a46 : modelCapabilities.isReasoningModel;
|
|
125157
125157
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
125158
125158
|
warnings.push({
|
|
125159
125159
|
type: "unsupported",
|
|
@@ -125190,10 +125190,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125190
125190
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
125191
125191
|
prompt,
|
|
125192
125192
|
toolNameMapping,
|
|
125193
|
-
systemMessageMode: (
|
|
125193
|
+
systemMessageMode: (_b35 = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _b35 : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
125194
125194
|
providerOptionsName,
|
|
125195
125195
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
125196
|
-
store: (
|
|
125196
|
+
store: (_c10 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _c10 : true,
|
|
125197
125197
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
125198
125198
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
125199
125199
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
@@ -125350,7 +125350,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125350
125350
|
};
|
|
125351
125351
|
}
|
|
125352
125352
|
async doGenerate(options) {
|
|
125353
|
-
var
|
|
125353
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
125354
125354
|
const {
|
|
125355
125355
|
args: body,
|
|
125356
125356
|
warnings,
|
|
@@ -125406,7 +125406,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125406
125406
|
providerMetadata: {
|
|
125407
125407
|
[providerOptionsName]: {
|
|
125408
125408
|
itemId: part.id,
|
|
125409
|
-
reasoningEncryptedContent: (
|
|
125409
|
+
reasoningEncryptedContent: (_a46 = part.encrypted_content) != null ? _a46 : null
|
|
125410
125410
|
}
|
|
125411
125411
|
}
|
|
125412
125412
|
});
|
|
@@ -125486,7 +125486,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125486
125486
|
}
|
|
125487
125487
|
case "message": {
|
|
125488
125488
|
for (const contentPart of part.content) {
|
|
125489
|
-
if (((
|
|
125489
|
+
if (((_c10 = (_b35 = options.providerOptions) == null ? void 0 : _b35[providerOptionsName]) == null ? void 0 : _c10.logprobs) && contentPart.logprobs) {
|
|
125490
125490
|
logprobs.push(contentPart.logprobs);
|
|
125491
125491
|
}
|
|
125492
125492
|
const providerMetadata2 = {
|
|
@@ -125833,7 +125833,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125833
125833
|
controller.enqueue({ type: "stream-start", warnings });
|
|
125834
125834
|
},
|
|
125835
125835
|
transform(chunk, controller) {
|
|
125836
|
-
var
|
|
125836
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
125837
125837
|
if (options.includeRawChunks) {
|
|
125838
125838
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
125839
125839
|
}
|
|
@@ -125987,7 +125987,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
125987
125987
|
} else if (value.item.type === "shell_call_output") {
|
|
125988
125988
|
} else if (value.item.type === "message") {
|
|
125989
125989
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
125990
|
-
activeMessagePhase = (
|
|
125990
|
+
activeMessagePhase = (_a46 = value.item.phase) != null ? _a46 : void 0;
|
|
125991
125991
|
controller.enqueue({
|
|
125992
125992
|
type: "text-start",
|
|
125993
125993
|
id: value.item.id,
|
|
@@ -126011,14 +126011,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
126011
126011
|
providerMetadata: {
|
|
126012
126012
|
[providerOptionsName]: {
|
|
126013
126013
|
itemId: value.item.id,
|
|
126014
|
-
reasoningEncryptedContent: (
|
|
126014
|
+
reasoningEncryptedContent: (_b35 = value.item.encrypted_content) != null ? _b35 : null
|
|
126015
126015
|
}
|
|
126016
126016
|
}
|
|
126017
126017
|
});
|
|
126018
126018
|
}
|
|
126019
126019
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
126020
126020
|
if (value.item.type === "message") {
|
|
126021
|
-
const phase = (
|
|
126021
|
+
const phase = (_c10 = value.item.phase) != null ? _c10 : activeMessagePhase;
|
|
126022
126022
|
activeMessagePhase = void 0;
|
|
126023
126023
|
controller.enqueue({
|
|
126024
126024
|
type: "text-end",
|
|
@@ -126618,14 +126618,14 @@ function isErrorChunk(chunk) {
|
|
|
126618
126618
|
return chunk.type === "error";
|
|
126619
126619
|
}
|
|
126620
126620
|
function mapWebSearchOutput(action) {
|
|
126621
|
-
var
|
|
126621
|
+
var _a46;
|
|
126622
126622
|
if (action == null) {
|
|
126623
126623
|
return {};
|
|
126624
126624
|
}
|
|
126625
126625
|
switch (action.type) {
|
|
126626
126626
|
case "search":
|
|
126627
126627
|
return {
|
|
126628
|
-
action: { type: "search", query: (
|
|
126628
|
+
action: { type: "search", query: (_a46 = action.query) != null ? _a46 : void 0 },
|
|
126629
126629
|
// include sources when provided by the Responses API (behind include flag)
|
|
126630
126630
|
...action.sources != null && { sources: action.sources }
|
|
126631
126631
|
};
|
|
@@ -126717,8 +126717,8 @@ var OpenAISpeechModel = class {
|
|
|
126717
126717
|
};
|
|
126718
126718
|
}
|
|
126719
126719
|
async doGenerate(options) {
|
|
126720
|
-
var
|
|
126721
|
-
const currentDate = (
|
|
126720
|
+
var _a46, _b35, _c10;
|
|
126721
|
+
const currentDate = (_c10 = (_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : /* @__PURE__ */ new Date();
|
|
126722
126722
|
const { requestBody, warnings } = await this.getArgs(options);
|
|
126723
126723
|
const {
|
|
126724
126724
|
value: audio,
|
|
@@ -126929,8 +126929,8 @@ var OpenAITranscriptionModel = class {
|
|
|
126929
126929
|
};
|
|
126930
126930
|
}
|
|
126931
126931
|
async doGenerate(options) {
|
|
126932
|
-
var
|
|
126933
|
-
const currentDate = (
|
|
126932
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h;
|
|
126933
|
+
const currentDate = (_c10 = (_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : /* @__PURE__ */ new Date();
|
|
126934
126934
|
const { formData, warnings } = await this.getArgs(options);
|
|
126935
126935
|
const {
|
|
126936
126936
|
value: response,
|
|
@@ -126976,14 +126976,14 @@ var OpenAITranscriptionModel = class {
|
|
|
126976
126976
|
};
|
|
126977
126977
|
var VERSION6 = true ? "3.0.39" : "0.0.0-test";
|
|
126978
126978
|
function createOpenAI(options = {}) {
|
|
126979
|
-
var
|
|
126980
|
-
const baseURL = (
|
|
126979
|
+
var _a46, _b35;
|
|
126980
|
+
const baseURL = (_a46 = withoutTrailingSlash(
|
|
126981
126981
|
loadOptionalSetting({
|
|
126982
126982
|
settingValue: options.baseURL,
|
|
126983
126983
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
126984
126984
|
})
|
|
126985
|
-
)) != null ?
|
|
126986
|
-
const providerName = (
|
|
126985
|
+
)) != null ? _a46 : "https://api.openai.com/v1";
|
|
126986
|
+
const providerName = (_b35 = options.name) != null ? _b35 : "openai";
|
|
126987
126987
|
const getHeaders = () => withUserAgentSuffix(
|
|
126988
126988
|
{
|
|
126989
126989
|
Authorization: `Bearer ${loadApiKey({
|
|
@@ -127953,9 +127953,9 @@ var anthropicLanguageModelOptions = external_exports.object({
|
|
|
127953
127953
|
});
|
|
127954
127954
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
127955
127955
|
function getCacheControl(providerMetadata) {
|
|
127956
|
-
var
|
|
127956
|
+
var _a46;
|
|
127957
127957
|
const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
127958
|
-
const cacheControlValue = (
|
|
127958
|
+
const cacheControlValue = (_a46 = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a46 : anthropic2 == null ? void 0 : anthropic2.cache_control;
|
|
127959
127959
|
return cacheControlValue;
|
|
127960
127960
|
}
|
|
127961
127961
|
var CacheControlValidator = class {
|
|
@@ -128124,7 +128124,7 @@ async function prepareTools({
|
|
|
128124
128124
|
cacheControlValidator,
|
|
128125
128125
|
supportsStructuredOutput
|
|
128126
128126
|
}) {
|
|
128127
|
-
var
|
|
128127
|
+
var _a46;
|
|
128128
128128
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
128129
128129
|
const toolWarnings = [];
|
|
128130
128130
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -128140,7 +128140,7 @@ async function prepareTools({
|
|
|
128140
128140
|
type: "tool definition",
|
|
128141
128141
|
canCache: true
|
|
128142
128142
|
});
|
|
128143
|
-
const anthropicOptions = (
|
|
128143
|
+
const anthropicOptions = (_a46 = tool2.providerOptions) == null ? void 0 : _a46.anthropic;
|
|
128144
128144
|
const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
|
|
128145
128145
|
const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
|
|
128146
128146
|
anthropicTools2.push({
|
|
@@ -128418,9 +128418,9 @@ function convertAnthropicMessagesUsage({
|
|
|
128418
128418
|
usage,
|
|
128419
128419
|
rawUsage
|
|
128420
128420
|
}) {
|
|
128421
|
-
var
|
|
128422
|
-
const cacheCreationTokens = (
|
|
128423
|
-
const cacheReadTokens = (
|
|
128421
|
+
var _a46, _b35;
|
|
128422
|
+
const cacheCreationTokens = (_a46 = usage.cache_creation_input_tokens) != null ? _a46 : 0;
|
|
128423
|
+
const cacheReadTokens = (_b35 = usage.cache_read_input_tokens) != null ? _b35 : 0;
|
|
128424
128424
|
let inputTokens;
|
|
128425
128425
|
let outputTokens;
|
|
128426
128426
|
if (usage.iterations && usage.iterations.length > 0) {
|
|
@@ -128660,7 +128660,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128660
128660
|
cacheControlValidator,
|
|
128661
128661
|
toolNameMapping
|
|
128662
128662
|
}) {
|
|
128663
|
-
var
|
|
128663
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m, _n, _o, _p, _q, _r;
|
|
128664
128664
|
const betas = /* @__PURE__ */ new Set();
|
|
128665
128665
|
const blocks = groupIntoBlocks(prompt);
|
|
128666
128666
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -128716,10 +128716,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128716
128716
|
for (let j3 = 0; j3 < content.length; j3++) {
|
|
128717
128717
|
const part = content[j3];
|
|
128718
128718
|
const isLastPart = j3 === content.length - 1;
|
|
128719
|
-
const cacheControl = (
|
|
128719
|
+
const cacheControl = (_a46 = validator.getCacheControl(part.providerOptions, {
|
|
128720
128720
|
type: "user message part",
|
|
128721
128721
|
canCache: true
|
|
128722
|
-
})) != null ?
|
|
128722
|
+
})) != null ? _a46 : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
128723
128723
|
type: "user message",
|
|
128724
128724
|
canCache: true
|
|
128725
128725
|
}) : void 0;
|
|
@@ -128764,7 +128764,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128764
128764
|
media_type: "application/pdf",
|
|
128765
128765
|
data: convertToBase64(part.data)
|
|
128766
128766
|
},
|
|
128767
|
-
title: (
|
|
128767
|
+
title: (_b35 = metadata.title) != null ? _b35 : part.filename,
|
|
128768
128768
|
...metadata.context && { context: metadata.context },
|
|
128769
128769
|
...enableCitations && {
|
|
128770
128770
|
citations: { enabled: true }
|
|
@@ -128788,7 +128788,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128788
128788
|
media_type: "text/plain",
|
|
128789
128789
|
data: convertToString(part.data)
|
|
128790
128790
|
},
|
|
128791
|
-
title: (
|
|
128791
|
+
title: (_c10 = metadata.title) != null ? _c10 : part.filename,
|
|
128792
128792
|
...metadata.context && { context: metadata.context },
|
|
128793
128793
|
...enableCitations && {
|
|
128794
128794
|
citations: { enabled: true }
|
|
@@ -129441,7 +129441,7 @@ function mapAnthropicStopReason({
|
|
|
129441
129441
|
}
|
|
129442
129442
|
}
|
|
129443
129443
|
function createCitationSource(citation, citationDocuments, generateId3) {
|
|
129444
|
-
var
|
|
129444
|
+
var _a46;
|
|
129445
129445
|
if (citation.type === "web_search_result_location") {
|
|
129446
129446
|
return {
|
|
129447
129447
|
type: "source",
|
|
@@ -129469,7 +129469,7 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
129469
129469
|
sourceType: "document",
|
|
129470
129470
|
id: generateId3(),
|
|
129471
129471
|
mediaType: documentInfo.mediaType,
|
|
129472
|
-
title: (
|
|
129472
|
+
title: (_a46 = citation.document_title) != null ? _a46 : documentInfo.title,
|
|
129473
129473
|
filename: documentInfo.filename,
|
|
129474
129474
|
providerMetadata: {
|
|
129475
129475
|
anthropic: citation.type === "page_location" ? {
|
|
@@ -129487,10 +129487,10 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
129487
129487
|
var AnthropicMessagesLanguageModel = class {
|
|
129488
129488
|
constructor(modelId, config2) {
|
|
129489
129489
|
this.specificationVersion = "v3";
|
|
129490
|
-
var
|
|
129490
|
+
var _a46;
|
|
129491
129491
|
this.modelId = modelId;
|
|
129492
129492
|
this.config = config2;
|
|
129493
|
-
this.generateId = (
|
|
129493
|
+
this.generateId = (_a46 = config2.generateId) != null ? _a46 : generateId;
|
|
129494
129494
|
}
|
|
129495
129495
|
supportsUrl(url2) {
|
|
129496
129496
|
return url2.protocol === "https:";
|
|
@@ -129508,8 +129508,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129508
129508
|
return dotIndex === -1 ? provider : provider.substring(0, dotIndex);
|
|
129509
129509
|
}
|
|
129510
129510
|
get supportedUrls() {
|
|
129511
|
-
var
|
|
129512
|
-
return (
|
|
129511
|
+
var _a46, _b35, _c10;
|
|
129512
|
+
return (_c10 = (_b35 = (_a46 = this.config).supportedUrls) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : {};
|
|
129513
129513
|
}
|
|
129514
129514
|
async getArgs({
|
|
129515
129515
|
userSuppliedBetas,
|
|
@@ -129528,7 +129528,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129528
129528
|
providerOptions,
|
|
129529
129529
|
stream
|
|
129530
129530
|
}) {
|
|
129531
|
-
var
|
|
129531
|
+
var _a46, _b35, _c10, _d8, _e6, _f2;
|
|
129532
129532
|
const warnings = [];
|
|
129533
129533
|
if (frequencyPenalty != null) {
|
|
129534
129534
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -129585,8 +129585,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129585
129585
|
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
129586
129586
|
isKnownModel
|
|
129587
129587
|
} = getModelCapabilities(this.modelId);
|
|
129588
|
-
const supportsStructuredOutput = ((
|
|
129589
|
-
const structureOutputMode = (
|
|
129588
|
+
const supportsStructuredOutput = ((_a46 = this.config.supportsNativeStructuredOutput) != null ? _a46 : true) && modelSupportsStructuredOutput;
|
|
129589
|
+
const structureOutputMode = (_b35 = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b35 : "auto";
|
|
129590
129590
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
129591
129591
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
129592
129592
|
type: "function",
|
|
@@ -129619,7 +129619,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129619
129619
|
});
|
|
129620
129620
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
129621
129621
|
prompt,
|
|
129622
|
-
sendReasoning: (
|
|
129622
|
+
sendReasoning: (_c10 = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c10 : true,
|
|
129623
129623
|
warnings,
|
|
129624
129624
|
cacheControlValidator,
|
|
129625
129625
|
toolNameMapping
|
|
@@ -129884,10 +129884,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129884
129884
|
);
|
|
129885
129885
|
}
|
|
129886
129886
|
async getBetasFromHeaders(requestHeaders) {
|
|
129887
|
-
var
|
|
129887
|
+
var _a46, _b35;
|
|
129888
129888
|
const configHeaders = await resolve2(this.config.headers);
|
|
129889
|
-
const configBetaHeader = (
|
|
129890
|
-
const requestBetaHeader = (
|
|
129889
|
+
const configBetaHeader = (_a46 = configHeaders["anthropic-beta"]) != null ? _a46 : "";
|
|
129890
|
+
const requestBetaHeader = (_b35 = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b35 : "";
|
|
129891
129891
|
return new Set(
|
|
129892
129892
|
[
|
|
129893
129893
|
...configBetaHeader.toLowerCase().split(","),
|
|
@@ -129896,38 +129896,38 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
129896
129896
|
);
|
|
129897
129897
|
}
|
|
129898
129898
|
buildRequestUrl(isStreaming) {
|
|
129899
|
-
var
|
|
129900
|
-
return (
|
|
129899
|
+
var _a46, _b35, _c10;
|
|
129900
|
+
return (_c10 = (_b35 = (_a46 = this.config).buildRequestUrl) == null ? void 0 : _b35.call(_a46, this.config.baseURL, isStreaming)) != null ? _c10 : `${this.config.baseURL}/messages`;
|
|
129901
129901
|
}
|
|
129902
129902
|
transformRequestBody(args) {
|
|
129903
|
-
var
|
|
129904
|
-
return (
|
|
129903
|
+
var _a46, _b35, _c10;
|
|
129904
|
+
return (_c10 = (_b35 = (_a46 = this.config).transformRequestBody) == null ? void 0 : _b35.call(_a46, args)) != null ? _c10 : args;
|
|
129905
129905
|
}
|
|
129906
129906
|
extractCitationDocuments(prompt) {
|
|
129907
129907
|
const isCitationPart = (part) => {
|
|
129908
|
-
var
|
|
129908
|
+
var _a46, _b35;
|
|
129909
129909
|
if (part.type !== "file") {
|
|
129910
129910
|
return false;
|
|
129911
129911
|
}
|
|
129912
129912
|
if (part.mediaType !== "application/pdf" && part.mediaType !== "text/plain") {
|
|
129913
129913
|
return false;
|
|
129914
129914
|
}
|
|
129915
|
-
const anthropic2 = (
|
|
129915
|
+
const anthropic2 = (_a46 = part.providerOptions) == null ? void 0 : _a46.anthropic;
|
|
129916
129916
|
const citationsConfig = anthropic2 == null ? void 0 : anthropic2.citations;
|
|
129917
|
-
return (
|
|
129917
|
+
return (_b35 = citationsConfig == null ? void 0 : citationsConfig.enabled) != null ? _b35 : false;
|
|
129918
129918
|
};
|
|
129919
129919
|
return prompt.filter((message) => message.role === "user").flatMap((message) => message.content).filter(isCitationPart).map((part) => {
|
|
129920
|
-
var
|
|
129920
|
+
var _a46;
|
|
129921
129921
|
const filePart = part;
|
|
129922
129922
|
return {
|
|
129923
|
-
title: (
|
|
129923
|
+
title: (_a46 = filePart.filename) != null ? _a46 : "Untitled Document",
|
|
129924
129924
|
filename: filePart.filename,
|
|
129925
129925
|
mediaType: filePart.mediaType
|
|
129926
129926
|
};
|
|
129927
129927
|
});
|
|
129928
129928
|
}
|
|
129929
129929
|
async doGenerate(options) {
|
|
129930
|
-
var
|
|
129930
|
+
var _a46, _b35, _c10, _d8, _e6, _f2;
|
|
129931
129931
|
const {
|
|
129932
129932
|
args,
|
|
129933
129933
|
warnings,
|
|
@@ -130112,7 +130112,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130112
130112
|
case "web_fetch_tool_result": {
|
|
130113
130113
|
if (part.content.type === "web_fetch_result") {
|
|
130114
130114
|
citationDocuments.push({
|
|
130115
|
-
title: (
|
|
130115
|
+
title: (_a46 = part.content.content.title) != null ? _a46 : part.content.url,
|
|
130116
130116
|
mediaType: part.content.content.source.media_type
|
|
130117
130117
|
});
|
|
130118
130118
|
content.push({
|
|
@@ -130175,7 +130175,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130175
130175
|
title: result.title,
|
|
130176
130176
|
providerMetadata: {
|
|
130177
130177
|
anthropic: {
|
|
130178
|
-
pageAge: (
|
|
130178
|
+
pageAge: (_b35 = result.page_age) != null ? _b35 : null
|
|
130179
130179
|
}
|
|
130180
130180
|
}
|
|
130181
130181
|
});
|
|
@@ -130206,7 +130206,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130206
130206
|
stdout: part.content.stdout,
|
|
130207
130207
|
stderr: part.content.stderr,
|
|
130208
130208
|
return_code: part.content.return_code,
|
|
130209
|
-
content: (
|
|
130209
|
+
content: (_c10 = part.content.content) != null ? _c10 : []
|
|
130210
130210
|
}
|
|
130211
130211
|
});
|
|
130212
130212
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
@@ -130331,7 +130331,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130331
130331
|
};
|
|
130332
130332
|
}
|
|
130333
130333
|
async doStream(options) {
|
|
130334
|
-
var
|
|
130334
|
+
var _a46, _b35;
|
|
130335
130335
|
const {
|
|
130336
130336
|
args: body,
|
|
130337
130337
|
warnings,
|
|
@@ -130388,7 +130388,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130388
130388
|
controller.enqueue({ type: "stream-start", warnings });
|
|
130389
130389
|
},
|
|
130390
130390
|
transform(chunk, controller) {
|
|
130391
|
-
var _a210, _b210,
|
|
130391
|
+
var _a210, _b210, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m;
|
|
130392
130392
|
if (options.includeRawChunks) {
|
|
130393
130393
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
130394
130394
|
}
|
|
@@ -130632,7 +130632,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
130632
130632
|
stdout: part.content.stdout,
|
|
130633
130633
|
stderr: part.content.stderr,
|
|
130634
130634
|
return_code: part.content.return_code,
|
|
130635
|
-
content: (
|
|
130635
|
+
content: (_c10 = part.content.content) != null ? _c10 : []
|
|
130636
130636
|
}
|
|
130637
130637
|
});
|
|
130638
130638
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
@@ -131057,10 +131057,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
131057
131057
|
try {
|
|
131058
131058
|
await firstChunkReader.read();
|
|
131059
131059
|
let result = await firstChunkReader.read();
|
|
131060
|
-
if (((
|
|
131060
|
+
if (((_a46 = result.value) == null ? void 0 : _a46.type) === "raw") {
|
|
131061
131061
|
result = await firstChunkReader.read();
|
|
131062
131062
|
}
|
|
131063
|
-
if (((
|
|
131063
|
+
if (((_b35 = result.value) == null ? void 0 : _b35.type) === "error") {
|
|
131064
131064
|
const error48 = result.value.error;
|
|
131065
131065
|
throw new APICallError({
|
|
131066
131066
|
message: error48.message,
|
|
@@ -131689,14 +131689,14 @@ var anthropicTools = {
|
|
|
131689
131689
|
toolSearchBm25_20251119
|
|
131690
131690
|
};
|
|
131691
131691
|
function createAnthropic(options = {}) {
|
|
131692
|
-
var
|
|
131693
|
-
const baseURL = (
|
|
131692
|
+
var _a46, _b35;
|
|
131693
|
+
const baseURL = (_a46 = withoutTrailingSlash(
|
|
131694
131694
|
loadOptionalSetting({
|
|
131695
131695
|
settingValue: options.baseURL,
|
|
131696
131696
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
131697
131697
|
})
|
|
131698
|
-
)) != null ?
|
|
131699
|
-
const providerName = (
|
|
131698
|
+
)) != null ? _a46 : "https://api.anthropic.com/v1";
|
|
131699
|
+
const providerName = (_b35 = options.name) != null ? _b35 : "anthropic.messages";
|
|
131700
131700
|
if (options.apiKey && options.authToken) {
|
|
131701
131701
|
throw new InvalidArgumentError({
|
|
131702
131702
|
argument: "apiKey/authToken",
|
|
@@ -131917,7 +131917,7 @@ var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema(
|
|
|
131917
131917
|
)
|
|
131918
131918
|
);
|
|
131919
131919
|
function convertGoogleGenerativeAIUsage(usage) {
|
|
131920
|
-
var
|
|
131920
|
+
var _a46, _b35, _c10, _d8;
|
|
131921
131921
|
if (usage == null) {
|
|
131922
131922
|
return {
|
|
131923
131923
|
inputTokens: {
|
|
@@ -131934,9 +131934,9 @@ function convertGoogleGenerativeAIUsage(usage) {
|
|
|
131934
131934
|
raw: void 0
|
|
131935
131935
|
};
|
|
131936
131936
|
}
|
|
131937
|
-
const promptTokens = (
|
|
131938
|
-
const candidatesTokens = (
|
|
131939
|
-
const cachedContentTokens = (
|
|
131937
|
+
const promptTokens = (_a46 = usage.promptTokenCount) != null ? _a46 : 0;
|
|
131938
|
+
const candidatesTokens = (_b35 = usage.candidatesTokenCount) != null ? _b35 : 0;
|
|
131939
|
+
const cachedContentTokens = (_c10 = usage.cachedContentTokenCount) != null ? _c10 : 0;
|
|
131940
131940
|
const thoughtsTokens = (_d8 = usage.thoughtsTokenCount) != null ? _d8 : 0;
|
|
131941
131941
|
return {
|
|
131942
131942
|
inputTokens: {
|
|
@@ -132068,12 +132068,12 @@ function isEmptyObjectSchema(jsonSchema2) {
|
|
|
132068
132068
|
return jsonSchema2 != null && typeof jsonSchema2 === "object" && jsonSchema2.type === "object" && (jsonSchema2.properties == null || Object.keys(jsonSchema2.properties).length === 0) && !jsonSchema2.additionalProperties;
|
|
132069
132069
|
}
|
|
132070
132070
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
132071
|
-
var
|
|
132071
|
+
var _a46, _b35, _c10;
|
|
132072
132072
|
const systemInstructionParts = [];
|
|
132073
132073
|
const contents = [];
|
|
132074
132074
|
let systemMessagesAllowed = true;
|
|
132075
|
-
const isGemmaModel = (
|
|
132076
|
-
const providerOptionsName = (
|
|
132075
|
+
const isGemmaModel = (_a46 = options == null ? void 0 : options.isGemmaModel) != null ? _a46 : false;
|
|
132076
|
+
const providerOptionsName = (_b35 = options == null ? void 0 : options.providerOptionsName) != null ? _b35 : "google";
|
|
132077
132077
|
for (const { role, content } of prompt) {
|
|
132078
132078
|
switch (role) {
|
|
132079
132079
|
case "system": {
|
|
@@ -132212,7 +132212,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
132212
132212
|
name: part.toolName,
|
|
132213
132213
|
response: {
|
|
132214
132214
|
name: part.toolName,
|
|
132215
|
-
content: output.type === "execution-denied" ? (
|
|
132215
|
+
content: output.type === "execution-denied" ? (_c10 = output.reason) != null ? _c10 : "Tool execution denied." : output.value
|
|
132216
132216
|
}
|
|
132217
132217
|
}
|
|
132218
132218
|
});
|
|
@@ -132361,7 +132361,7 @@ function prepareTools2({
|
|
|
132361
132361
|
toolChoice,
|
|
132362
132362
|
modelId
|
|
132363
132363
|
}) {
|
|
132364
|
-
var
|
|
132364
|
+
var _a46;
|
|
132365
132365
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
132366
132366
|
const toolWarnings = [];
|
|
132367
132367
|
const isLatest = [
|
|
@@ -132499,7 +132499,7 @@ function prepareTools2({
|
|
|
132499
132499
|
case "function":
|
|
132500
132500
|
functionDeclarations.push({
|
|
132501
132501
|
name: tool2.name,
|
|
132502
|
-
description: (
|
|
132502
|
+
description: (_a46 = tool2.description) != null ? _a46 : "",
|
|
132503
132503
|
parameters: convertJSONSchemaToOpenAPISchema(tool2.inputSchema)
|
|
132504
132504
|
});
|
|
132505
132505
|
break;
|
|
@@ -132584,17 +132584,17 @@ function mapGoogleGenerativeAIFinishReason({
|
|
|
132584
132584
|
var GoogleGenerativeAILanguageModel = class {
|
|
132585
132585
|
constructor(modelId, config2) {
|
|
132586
132586
|
this.specificationVersion = "v3";
|
|
132587
|
-
var
|
|
132587
|
+
var _a46;
|
|
132588
132588
|
this.modelId = modelId;
|
|
132589
132589
|
this.config = config2;
|
|
132590
|
-
this.generateId = (
|
|
132590
|
+
this.generateId = (_a46 = config2.generateId) != null ? _a46 : generateId;
|
|
132591
132591
|
}
|
|
132592
132592
|
get provider() {
|
|
132593
132593
|
return this.config.provider;
|
|
132594
132594
|
}
|
|
132595
132595
|
get supportedUrls() {
|
|
132596
|
-
var
|
|
132597
|
-
return (
|
|
132596
|
+
var _a46, _b35, _c10;
|
|
132597
|
+
return (_c10 = (_b35 = (_a46 = this.config).supportedUrls) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : {};
|
|
132598
132598
|
}
|
|
132599
132599
|
async getArgs({
|
|
132600
132600
|
prompt,
|
|
@@ -132611,7 +132611,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132611
132611
|
toolChoice,
|
|
132612
132612
|
providerOptions
|
|
132613
132613
|
}) {
|
|
132614
|
-
var
|
|
132614
|
+
var _a46;
|
|
132615
132615
|
const warnings = [];
|
|
132616
132616
|
const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
|
|
132617
132617
|
let googleOptions = await parseProviderOptions({
|
|
@@ -132665,7 +132665,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132665
132665
|
responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
|
|
132666
132666
|
// so this is needed as an escape hatch:
|
|
132667
132667
|
// TODO convert into provider option
|
|
132668
|
-
((
|
|
132668
|
+
((_a46 = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a46 : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
|
|
132669
132669
|
...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
|
|
132670
132670
|
audioTimestamp: googleOptions.audioTimestamp
|
|
132671
132671
|
},
|
|
@@ -132695,7 +132695,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132695
132695
|
};
|
|
132696
132696
|
}
|
|
132697
132697
|
async doGenerate(options) {
|
|
132698
|
-
var
|
|
132698
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2;
|
|
132699
132699
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
132700
132700
|
const mergedHeaders = combineHeaders(
|
|
132701
132701
|
await resolve2(this.config.headers),
|
|
@@ -132718,11 +132718,11 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132718
132718
|
});
|
|
132719
132719
|
const candidate = response.candidates[0];
|
|
132720
132720
|
const content = [];
|
|
132721
|
-
const parts = (
|
|
132721
|
+
const parts = (_b35 = (_a46 = candidate.content) == null ? void 0 : _a46.parts) != null ? _b35 : [];
|
|
132722
132722
|
const usageMetadata = response.usageMetadata;
|
|
132723
132723
|
let lastCodeExecutionToolCallId;
|
|
132724
132724
|
for (const part of parts) {
|
|
132725
|
-
if ("executableCode" in part && ((
|
|
132725
|
+
if ("executableCode" in part && ((_c10 = part.executableCode) == null ? void 0 : _c10.code)) {
|
|
132726
132726
|
const toolCallId = this.config.generateId();
|
|
132727
132727
|
lastCodeExecutionToolCallId = toolCallId;
|
|
132728
132728
|
content.push({
|
|
@@ -132862,7 +132862,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132862
132862
|
controller.enqueue({ type: "stream-start", warnings });
|
|
132863
132863
|
},
|
|
132864
132864
|
transform(chunk, controller) {
|
|
132865
|
-
var
|
|
132865
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h;
|
|
132866
132866
|
if (options.includeRawChunks) {
|
|
132867
132867
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
132868
132868
|
}
|
|
@@ -132875,7 +132875,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132875
132875
|
if (usageMetadata != null) {
|
|
132876
132876
|
usage = usageMetadata;
|
|
132877
132877
|
}
|
|
132878
|
-
const candidate = (
|
|
132878
|
+
const candidate = (_a46 = value.candidates) == null ? void 0 : _a46[0];
|
|
132879
132879
|
if (candidate == null) {
|
|
132880
132880
|
return;
|
|
132881
132881
|
}
|
|
@@ -132893,9 +132893,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
132893
132893
|
}
|
|
132894
132894
|
}
|
|
132895
132895
|
if (content != null) {
|
|
132896
|
-
const parts = (
|
|
132896
|
+
const parts = (_b35 = content.parts) != null ? _b35 : [];
|
|
132897
132897
|
for (const part of parts) {
|
|
132898
|
-
if ("executableCode" in part && ((
|
|
132898
|
+
if ("executableCode" in part && ((_c10 = part.executableCode) == null ? void 0 : _c10.code)) {
|
|
132899
132899
|
const toolCallId = generateId3();
|
|
132900
132900
|
lastCodeExecutionToolCallId = toolCallId;
|
|
132901
132901
|
controller.enqueue({
|
|
@@ -133094,7 +133094,7 @@ function extractSources({
|
|
|
133094
133094
|
groundingMetadata,
|
|
133095
133095
|
generateId: generateId3
|
|
133096
133096
|
}) {
|
|
133097
|
-
var
|
|
133097
|
+
var _a46, _b35, _c10, _d8, _e6;
|
|
133098
133098
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
133099
133099
|
return void 0;
|
|
133100
133100
|
}
|
|
@@ -133106,7 +133106,7 @@ function extractSources({
|
|
|
133106
133106
|
sourceType: "url",
|
|
133107
133107
|
id: generateId3(),
|
|
133108
133108
|
url: chunk.web.uri,
|
|
133109
|
-
title: (
|
|
133109
|
+
title: (_a46 = chunk.web.title) != null ? _a46 : void 0
|
|
133110
133110
|
});
|
|
133111
133111
|
} else if (chunk.retrievedContext != null) {
|
|
133112
133112
|
const uri = chunk.retrievedContext.uri;
|
|
@@ -133117,10 +133117,10 @@ function extractSources({
|
|
|
133117
133117
|
sourceType: "url",
|
|
133118
133118
|
id: generateId3(),
|
|
133119
133119
|
url: uri,
|
|
133120
|
-
title: (
|
|
133120
|
+
title: (_b35 = chunk.retrievedContext.title) != null ? _b35 : void 0
|
|
133121
133121
|
});
|
|
133122
133122
|
} else if (uri) {
|
|
133123
|
-
const title = (
|
|
133123
|
+
const title = (_c10 = chunk.retrievedContext.title) != null ? _c10 : "Unknown Document";
|
|
133124
133124
|
let mediaType = "application/octet-stream";
|
|
133125
133125
|
let filename = void 0;
|
|
133126
133126
|
if (uri.endsWith(".pdf")) {
|
|
@@ -133463,7 +133463,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133463
133463
|
return this.doGenerateImagen(options);
|
|
133464
133464
|
}
|
|
133465
133465
|
async doGenerateImagen(options) {
|
|
133466
|
-
var
|
|
133466
|
+
var _a46, _b35, _c10;
|
|
133467
133467
|
const {
|
|
133468
133468
|
prompt,
|
|
133469
133469
|
n: n3 = 1,
|
|
@@ -133506,7 +133506,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133506
133506
|
providerOptions,
|
|
133507
133507
|
schema: googleImageModelOptionsSchema
|
|
133508
133508
|
});
|
|
133509
|
-
const currentDate = (
|
|
133509
|
+
const currentDate = (_c10 = (_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : /* @__PURE__ */ new Date();
|
|
133510
133510
|
const parameters = {
|
|
133511
133511
|
sampleCount: n3
|
|
133512
133512
|
};
|
|
@@ -133551,7 +133551,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133551
133551
|
};
|
|
133552
133552
|
}
|
|
133553
133553
|
async doGenerateGemini(options) {
|
|
133554
|
-
var
|
|
133554
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i;
|
|
133555
133555
|
const {
|
|
133556
133556
|
prompt,
|
|
133557
133557
|
n: n3,
|
|
@@ -133609,9 +133609,9 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133609
133609
|
const languageModel = new GoogleGenerativeAILanguageModel(this.modelId, {
|
|
133610
133610
|
provider: this.config.provider,
|
|
133611
133611
|
baseURL: this.config.baseURL,
|
|
133612
|
-
headers: (
|
|
133612
|
+
headers: (_a46 = this.config.headers) != null ? _a46 : {},
|
|
133613
133613
|
fetch: this.config.fetch,
|
|
133614
|
-
generateId: (
|
|
133614
|
+
generateId: (_b35 = this.config.generateId) != null ? _b35 : generateId
|
|
133615
133615
|
});
|
|
133616
133616
|
const result = await languageModel.doGenerate({
|
|
133617
133617
|
prompt: languageModelPrompt,
|
|
@@ -133622,7 +133622,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
133622
133622
|
imageConfig: aspectRatio ? {
|
|
133623
133623
|
aspectRatio
|
|
133624
133624
|
} : void 0,
|
|
133625
|
-
...(
|
|
133625
|
+
...(_c10 = providerOptions == null ? void 0 : providerOptions.google) != null ? _c10 : {}
|
|
133626
133626
|
}
|
|
133627
133627
|
},
|
|
133628
133628
|
headers,
|
|
@@ -133687,8 +133687,8 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
133687
133687
|
return 4;
|
|
133688
133688
|
}
|
|
133689
133689
|
async doGenerate(options) {
|
|
133690
|
-
var
|
|
133691
|
-
const currentDate = (
|
|
133690
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h;
|
|
133691
|
+
const currentDate = (_c10 = (_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : /* @__PURE__ */ new Date();
|
|
133692
133692
|
const warnings = [];
|
|
133693
133693
|
const googleOptions = await parseProviderOptions({
|
|
133694
133694
|
provider: "google",
|
|
@@ -133922,9 +133922,9 @@ var googleVideoModelOptionsSchema = lazySchema(
|
|
|
133922
133922
|
)
|
|
133923
133923
|
);
|
|
133924
133924
|
function createGoogleGenerativeAI(options = {}) {
|
|
133925
|
-
var
|
|
133926
|
-
const baseURL = (
|
|
133927
|
-
const providerName = (
|
|
133925
|
+
var _a46, _b35;
|
|
133926
|
+
const baseURL = (_a46 = withoutTrailingSlash(options.baseURL)) != null ? _a46 : "https://generativelanguage.googleapis.com/v1beta";
|
|
133927
|
+
const providerName = (_b35 = options.name) != null ? _b35 : "google.generative-ai";
|
|
133928
133928
|
const getHeaders = () => withUserAgentSuffix(
|
|
133929
133929
|
{
|
|
133930
133930
|
"x-goog-api-key": loadApiKey({
|
|
@@ -134265,7 +134265,7 @@ var OllamaCompletionLanguageModel = class {
|
|
|
134265
134265
|
};
|
|
134266
134266
|
}
|
|
134267
134267
|
async doGenerate(options) {
|
|
134268
|
-
var
|
|
134268
|
+
var _a46, _b35;
|
|
134269
134269
|
const { args: body, warnings } = this.getArgs(options);
|
|
134270
134270
|
const {
|
|
134271
134271
|
responseHeaders,
|
|
@@ -134296,13 +134296,13 @@ var OllamaCompletionLanguageModel = class {
|
|
|
134296
134296
|
],
|
|
134297
134297
|
usage: {
|
|
134298
134298
|
inputTokens: {
|
|
134299
|
-
total: (
|
|
134299
|
+
total: (_a46 = typedResponse.prompt_eval_count) != null ? _a46 : 0,
|
|
134300
134300
|
noCache: void 0,
|
|
134301
134301
|
cacheRead: void 0,
|
|
134302
134302
|
cacheWrite: void 0
|
|
134303
134303
|
},
|
|
134304
134304
|
outputTokens: {
|
|
134305
|
-
total: (
|
|
134305
|
+
total: (_b35 = typedResponse.eval_count) != null ? _b35 : 0,
|
|
134306
134306
|
text: void 0,
|
|
134307
134307
|
reasoning: void 0
|
|
134308
134308
|
}
|
|
@@ -134436,13 +134436,13 @@ var ollamaEmbeddingProviderOptions = external_exports.object({
|
|
|
134436
134436
|
var OllamaEmbeddingModel = class {
|
|
134437
134437
|
constructor(modelId, settings, config2) {
|
|
134438
134438
|
this.specificationVersion = "v3";
|
|
134439
|
-
var
|
|
134439
|
+
var _a46, _b35;
|
|
134440
134440
|
this.modelId = modelId;
|
|
134441
134441
|
this.settings = settings;
|
|
134442
134442
|
this.config = config2;
|
|
134443
134443
|
this.provider = config2.provider;
|
|
134444
|
-
this.maxEmbeddingsPerCall = (
|
|
134445
|
-
this.supportsParallelCalls = (
|
|
134444
|
+
this.maxEmbeddingsPerCall = (_a46 = settings.maxEmbeddingsPerCall) != null ? _a46 : 2048;
|
|
134445
|
+
this.supportsParallelCalls = (_b35 = settings.supportsParallelCalls) != null ? _b35 : true;
|
|
134446
134446
|
}
|
|
134447
134447
|
getArgs({
|
|
134448
134448
|
values
|
|
@@ -134463,7 +134463,7 @@ var OllamaEmbeddingModel = class {
|
|
|
134463
134463
|
abortSignal,
|
|
134464
134464
|
providerOptions
|
|
134465
134465
|
}) {
|
|
134466
|
-
var
|
|
134466
|
+
var _a46, _b35, _c10;
|
|
134467
134467
|
if (this.maxEmbeddingsPerCall && values.length > this.maxEmbeddingsPerCall) {
|
|
134468
134468
|
throw new TooManyEmbeddingValuesForCallError({
|
|
134469
134469
|
provider: this.provider,
|
|
@@ -134477,9 +134477,9 @@ var OllamaEmbeddingModel = class {
|
|
|
134477
134477
|
providerOptions,
|
|
134478
134478
|
schema: ollamaEmbeddingProviderOptions
|
|
134479
134479
|
});
|
|
134480
|
-
const dimensions = (
|
|
134481
|
-
const truncate = (
|
|
134482
|
-
const keepAlive = (
|
|
134480
|
+
const dimensions = (_a46 = ollamaOptions == null ? void 0 : ollamaOptions.dimensions) != null ? _a46 : this.settings.dimensions;
|
|
134481
|
+
const truncate = (_b35 = ollamaOptions == null ? void 0 : ollamaOptions.truncate) != null ? _b35 : this.settings.truncate;
|
|
134482
|
+
const keepAlive = (_c10 = ollamaOptions == null ? void 0 : ollamaOptions.keepAlive) != null ? _c10 : this.settings.keepAlive;
|
|
134483
134483
|
const body = {
|
|
134484
134484
|
model: this.modelId,
|
|
134485
134485
|
input: values
|
|
@@ -134564,7 +134564,7 @@ var OllamaResponseProcessor = class {
|
|
|
134564
134564
|
};
|
|
134565
134565
|
}
|
|
134566
134566
|
extractContent(response) {
|
|
134567
|
-
var
|
|
134567
|
+
var _a46, _b35, _c10, _d8, _e6;
|
|
134568
134568
|
const content = [];
|
|
134569
134569
|
const text2 = response.message.content;
|
|
134570
134570
|
if (text2 != null && text2.length > 0) {
|
|
@@ -134580,10 +134580,10 @@ var OllamaResponseProcessor = class {
|
|
|
134580
134580
|
text: thinking
|
|
134581
134581
|
});
|
|
134582
134582
|
}
|
|
134583
|
-
for (const toolCall of (
|
|
134583
|
+
for (const toolCall of (_a46 = response.message.tool_calls) != null ? _a46 : []) {
|
|
134584
134584
|
content.push({
|
|
134585
134585
|
type: "tool-call",
|
|
134586
|
-
toolCallId: (_e6 = toolCall.id) != null ? _e6 : (_d8 = (
|
|
134586
|
+
toolCallId: (_e6 = toolCall.id) != null ? _e6 : (_d8 = (_c10 = (_b35 = this.config).generateId) == null ? void 0 : _c10.call(_b35)) != null ? _d8 : generateId(),
|
|
134587
134587
|
toolName: toolCall.function.name,
|
|
134588
134588
|
input: JSON.stringify(toolCall.function.arguments)
|
|
134589
134589
|
});
|
|
@@ -134591,16 +134591,16 @@ var OllamaResponseProcessor = class {
|
|
|
134591
134591
|
return content;
|
|
134592
134592
|
}
|
|
134593
134593
|
extractUsage(response) {
|
|
134594
|
-
var
|
|
134594
|
+
var _a46, _b35;
|
|
134595
134595
|
return {
|
|
134596
134596
|
inputTokens: {
|
|
134597
|
-
total: (
|
|
134597
|
+
total: (_a46 = response.prompt_eval_count) != null ? _a46 : 0,
|
|
134598
134598
|
noCache: void 0,
|
|
134599
134599
|
cacheRead: void 0,
|
|
134600
134600
|
cacheWrite: void 0
|
|
134601
134601
|
},
|
|
134602
134602
|
outputTokens: {
|
|
134603
|
-
total: (
|
|
134603
|
+
total: (_b35 = response.eval_count) != null ? _b35 : 0,
|
|
134604
134604
|
text: void 0,
|
|
134605
134605
|
reasoning: void 0
|
|
134606
134606
|
}
|
|
@@ -134608,12 +134608,12 @@ var OllamaResponseProcessor = class {
|
|
|
134608
134608
|
}
|
|
134609
134609
|
};
|
|
134610
134610
|
function extractOllamaResponseObjectsFromChunk(chunk) {
|
|
134611
|
-
var
|
|
134611
|
+
var _a46;
|
|
134612
134612
|
if (chunk.success) {
|
|
134613
134613
|
return [chunk.value];
|
|
134614
134614
|
}
|
|
134615
134615
|
const results = [];
|
|
134616
|
-
const raw = (
|
|
134616
|
+
const raw = (_a46 = chunk.error) == null ? void 0 : _a46.text;
|
|
134617
134617
|
if (typeof raw !== "string" || raw.length === 0) {
|
|
134618
134618
|
return results;
|
|
134619
134619
|
}
|
|
@@ -134804,7 +134804,7 @@ function convertToOllamaResponsesMessages({
|
|
|
134804
134804
|
messages.push({
|
|
134805
134805
|
role: "user",
|
|
134806
134806
|
content: content.map((part, index) => {
|
|
134807
|
-
var
|
|
134807
|
+
var _a46, _b35, _c10;
|
|
134808
134808
|
switch (part.type) {
|
|
134809
134809
|
case "text": {
|
|
134810
134810
|
return { type: "input_text", text: part.text };
|
|
@@ -134816,7 +134816,7 @@ function convertToOllamaResponsesMessages({
|
|
|
134816
134816
|
type: "input_image",
|
|
134817
134817
|
image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${part.data}`,
|
|
134818
134818
|
// Ollama specific extension: image detail
|
|
134819
|
-
detail: (
|
|
134819
|
+
detail: (_b35 = (_a46 = part.providerOptions) == null ? void 0 : _a46.ollama) == null ? void 0 : _b35.imageDetail
|
|
134820
134820
|
};
|
|
134821
134821
|
} else if (part.mediaType === "application/pdf") {
|
|
134822
134822
|
if (part.data instanceof URL) {
|
|
@@ -134826,7 +134826,7 @@ function convertToOllamaResponsesMessages({
|
|
|
134826
134826
|
}
|
|
134827
134827
|
return {
|
|
134828
134828
|
type: "input_file",
|
|
134829
|
-
filename: (
|
|
134829
|
+
filename: (_c10 = part.filename) != null ? _c10 : `part-${index}.pdf`,
|
|
134830
134830
|
file_data: `data:application/pdf;base64,${part.data}`
|
|
134831
134831
|
};
|
|
134832
134832
|
} else {
|
|
@@ -135060,7 +135060,7 @@ var OllamaRequestBuilder = class {
|
|
|
135060
135060
|
responseFormat,
|
|
135061
135061
|
ollamaOptions
|
|
135062
135062
|
}) {
|
|
135063
|
-
var
|
|
135063
|
+
var _a46, _b35;
|
|
135064
135064
|
return {
|
|
135065
135065
|
model: modelId,
|
|
135066
135066
|
messages: convertToOllamaChatMessages({
|
|
@@ -135073,8 +135073,8 @@ var OllamaRequestBuilder = class {
|
|
|
135073
135073
|
...(responseFormat == null ? void 0 : responseFormat.type) === "json" && {
|
|
135074
135074
|
format: responseFormat.schema != null ? responseFormat.schema : "json"
|
|
135075
135075
|
},
|
|
135076
|
-
think: (
|
|
135077
|
-
options: (
|
|
135076
|
+
think: (_a46 = ollamaOptions == null ? void 0 : ollamaOptions.think) != null ? _a46 : false,
|
|
135077
|
+
options: (_b35 = ollamaOptions == null ? void 0 : ollamaOptions.options) != null ? _b35 : void 0
|
|
135078
135078
|
};
|
|
135079
135079
|
}
|
|
135080
135080
|
};
|
|
@@ -135217,22 +135217,22 @@ var OllamaStreamProcessor = class {
|
|
|
135217
135217
|
}
|
|
135218
135218
|
}
|
|
135219
135219
|
processToolCalls(delta, controller) {
|
|
135220
|
-
var
|
|
135221
|
-
for (const toolCall of (
|
|
135222
|
-
if (((
|
|
135220
|
+
var _a46, _b35, _c10, _d8;
|
|
135221
|
+
for (const toolCall of (_a46 = delta.tool_calls) != null ? _a46 : []) {
|
|
135222
|
+
if (((_b35 = toolCall.function) == null ? void 0 : _b35.name) == null) {
|
|
135223
135223
|
throw new InvalidResponseDataError({
|
|
135224
135224
|
data: toolCall,
|
|
135225
135225
|
message: `Expected 'function.name' to be a string.`
|
|
135226
135226
|
});
|
|
135227
135227
|
}
|
|
135228
|
-
if (((
|
|
135228
|
+
if (((_c10 = toolCall.function) == null ? void 0 : _c10.name) != null && ((_d8 = toolCall.function) == null ? void 0 : _d8.arguments) != null) {
|
|
135229
135229
|
this.emitToolCall(toolCall, controller);
|
|
135230
135230
|
}
|
|
135231
135231
|
}
|
|
135232
135232
|
}
|
|
135233
135233
|
emitToolCall(toolCall, controller) {
|
|
135234
|
-
var
|
|
135235
|
-
const id = (_d8 = toolCall.id) != null ? _d8 : (
|
|
135234
|
+
var _a46, _b35, _c10, _d8;
|
|
135235
|
+
const id = (_d8 = toolCall.id) != null ? _d8 : (_c10 = (_b35 = (_a46 = this.config).generateId) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : generateId();
|
|
135236
135236
|
controller.enqueue({
|
|
135237
135237
|
type: "tool-input-start",
|
|
135238
135238
|
id,
|
|
@@ -135353,9 +135353,9 @@ var OllamaResponsesLanguageModel = class {
|
|
|
135353
135353
|
}
|
|
135354
135354
|
};
|
|
135355
135355
|
function createOllama(options = {}) {
|
|
135356
|
-
var
|
|
135357
|
-
const baseURL = (
|
|
135358
|
-
const providerName = (
|
|
135356
|
+
var _a46, _b35;
|
|
135357
|
+
const baseURL = (_a46 = withoutTrailingSlash(options.baseURL)) != null ? _a46 : "http://127.0.0.1:11434/api";
|
|
135358
|
+
const providerName = (_b35 = options.name) != null ? _b35 : "ollama";
|
|
135359
135359
|
const getHeaders = () => ({
|
|
135360
135360
|
"Ollama-Organization": options.organization,
|
|
135361
135361
|
"Ollama-Project": options.project,
|
|
@@ -135413,8 +135413,8 @@ var ollama = createOllama();
|
|
|
135413
135413
|
|
|
135414
135414
|
// ../../node_modules/.pnpm/@ai-sdk+openai-compatible@1.0.30_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
|
|
135415
135415
|
function getOpenAIMetadata(message) {
|
|
135416
|
-
var
|
|
135417
|
-
return (
|
|
135416
|
+
var _a46, _b35;
|
|
135417
|
+
return (_b35 = (_a46 = message == null ? void 0 : message.providerOptions) == null ? void 0 : _a46.openaiCompatible) != null ? _b35 : {};
|
|
135418
135418
|
}
|
|
135419
135419
|
function convertToOpenAICompatibleChatMessages(prompt) {
|
|
135420
135420
|
const messages = [];
|
|
@@ -135639,15 +135639,15 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135639
135639
|
// type inferred via constructor
|
|
135640
135640
|
constructor(modelId, config2) {
|
|
135641
135641
|
this.specificationVersion = "v2";
|
|
135642
|
-
var
|
|
135642
|
+
var _a46, _b35;
|
|
135643
135643
|
this.modelId = modelId;
|
|
135644
135644
|
this.config = config2;
|
|
135645
|
-
const errorStructure = (
|
|
135645
|
+
const errorStructure = (_a46 = config2.errorStructure) != null ? _a46 : defaultOpenAICompatibleErrorStructure;
|
|
135646
135646
|
this.chunkSchema = createOpenAICompatibleChatChunkSchema(
|
|
135647
135647
|
errorStructure.errorSchema
|
|
135648
135648
|
);
|
|
135649
135649
|
this.failedResponseHandler = createJsonErrorResponseHandler(errorStructure);
|
|
135650
|
-
this.supportsStructuredOutputs = (
|
|
135650
|
+
this.supportsStructuredOutputs = (_b35 = config2.supportsStructuredOutputs) != null ? _b35 : false;
|
|
135651
135651
|
}
|
|
135652
135652
|
get provider() {
|
|
135653
135653
|
return this.config.provider;
|
|
@@ -135656,8 +135656,8 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135656
135656
|
return this.config.provider.split(".")[0].trim();
|
|
135657
135657
|
}
|
|
135658
135658
|
get supportedUrls() {
|
|
135659
|
-
var
|
|
135660
|
-
return (
|
|
135659
|
+
var _a46, _b35, _c10;
|
|
135660
|
+
return (_c10 = (_b35 = (_a46 = this.config).supportedUrls) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : {};
|
|
135661
135661
|
}
|
|
135662
135662
|
async getArgs({
|
|
135663
135663
|
prompt,
|
|
@@ -135674,19 +135674,19 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135674
135674
|
toolChoice,
|
|
135675
135675
|
tools
|
|
135676
135676
|
}) {
|
|
135677
|
-
var
|
|
135677
|
+
var _a46, _b35, _c10, _d8;
|
|
135678
135678
|
const warnings = [];
|
|
135679
135679
|
const compatibleOptions = Object.assign(
|
|
135680
|
-
(
|
|
135680
|
+
(_a46 = await parseProviderOptions({
|
|
135681
135681
|
provider: "openai-compatible",
|
|
135682
135682
|
providerOptions,
|
|
135683
135683
|
schema: openaiCompatibleProviderOptions
|
|
135684
|
-
})) != null ?
|
|
135685
|
-
(
|
|
135684
|
+
})) != null ? _a46 : {},
|
|
135685
|
+
(_b35 = await parseProviderOptions({
|
|
135686
135686
|
provider: this.providerOptionsName,
|
|
135687
135687
|
providerOptions,
|
|
135688
135688
|
schema: openaiCompatibleProviderOptions
|
|
135689
|
-
})) != null ?
|
|
135689
|
+
})) != null ? _b35 : {}
|
|
135690
135690
|
);
|
|
135691
135691
|
if (topK != null) {
|
|
135692
135692
|
warnings.push({ type: "unsupported-setting", setting: "topK" });
|
|
@@ -135722,7 +135722,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135722
135722
|
type: "json_schema",
|
|
135723
135723
|
json_schema: {
|
|
135724
135724
|
schema: responseFormat.schema,
|
|
135725
|
-
name: (
|
|
135725
|
+
name: (_c10 = responseFormat.name) != null ? _c10 : "response",
|
|
135726
135726
|
description: responseFormat.description
|
|
135727
135727
|
}
|
|
135728
135728
|
} : { type: "json_object" } : void 0,
|
|
@@ -135747,7 +135747,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135747
135747
|
};
|
|
135748
135748
|
}
|
|
135749
135749
|
async doGenerate(options) {
|
|
135750
|
-
var
|
|
135750
|
+
var _a46, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m, _n, _o, _p, _q;
|
|
135751
135751
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
135752
135752
|
const body = JSON.stringify(args);
|
|
135753
135753
|
const {
|
|
@@ -135774,7 +135774,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135774
135774
|
if (text2 != null && text2.length > 0) {
|
|
135775
135775
|
content.push({ type: "text", text: text2 });
|
|
135776
135776
|
}
|
|
135777
|
-
const reasoning = (
|
|
135777
|
+
const reasoning = (_a46 = choice2.message.reasoning_content) != null ? _a46 : choice2.message.reasoning;
|
|
135778
135778
|
if (reasoning != null && reasoning.length > 0) {
|
|
135779
135779
|
content.push({
|
|
135780
135780
|
type: "reasoning",
|
|
@@ -135785,7 +135785,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135785
135785
|
for (const toolCall of choice2.message.tool_calls) {
|
|
135786
135786
|
content.push({
|
|
135787
135787
|
type: "tool-call",
|
|
135788
|
-
toolCallId: (
|
|
135788
|
+
toolCallId: (_b35 = toolCall.id) != null ? _b35 : generateId(),
|
|
135789
135789
|
toolName: toolCall.function.name,
|
|
135790
135790
|
input: toolCall.function.arguments
|
|
135791
135791
|
});
|
|
@@ -135793,7 +135793,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135793
135793
|
}
|
|
135794
135794
|
const providerMetadata = {
|
|
135795
135795
|
[this.providerOptionsName]: {},
|
|
135796
|
-
...await ((_d8 = (
|
|
135796
|
+
...await ((_d8 = (_c10 = this.config.metadataExtractor) == null ? void 0 : _c10.extractMetadata) == null ? void 0 : _d8.call(_c10, {
|
|
135797
135797
|
parsedBody: rawResponse
|
|
135798
135798
|
}))
|
|
135799
135799
|
};
|
|
@@ -135825,7 +135825,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135825
135825
|
};
|
|
135826
135826
|
}
|
|
135827
135827
|
async doStream(options) {
|
|
135828
|
-
var
|
|
135828
|
+
var _a46;
|
|
135829
135829
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
135830
135830
|
const body = {
|
|
135831
135831
|
...args,
|
|
@@ -135833,7 +135833,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135833
135833
|
// only include stream_options when in strict compatibility mode:
|
|
135834
135834
|
stream_options: this.config.includeUsage ? { include_usage: true } : void 0
|
|
135835
135835
|
};
|
|
135836
|
-
const metadataExtractor = (
|
|
135836
|
+
const metadataExtractor = (_a46 = this.config.metadataExtractor) == null ? void 0 : _a46.createStreamExtractor();
|
|
135837
135837
|
const { responseHeaders, value: response } = await postJsonToApi({
|
|
135838
135838
|
url: this.config.url({
|
|
135839
135839
|
path: "/chat/completions",
|
|
@@ -135875,7 +135875,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135875
135875
|
},
|
|
135876
135876
|
// TODO we lost type safety on Chunk, most likely due to the error schema. MUST FIX
|
|
135877
135877
|
transform(chunk, controller) {
|
|
135878
|
-
var _a210,
|
|
135878
|
+
var _a210, _b35, _c10, _d8, _e6, _f2, _g5, _h, _i, _j2, _k2, _l, _m;
|
|
135879
135879
|
if (options.includeRawChunks) {
|
|
135880
135880
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
135881
135881
|
}
|
|
@@ -135968,7 +135968,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135968
135968
|
message: `Expected 'id' to be a string.`
|
|
135969
135969
|
});
|
|
135970
135970
|
}
|
|
135971
|
-
if (((
|
|
135971
|
+
if (((_b35 = toolCallDelta.function) == null ? void 0 : _b35.name) == null) {
|
|
135972
135972
|
throw new InvalidResponseDataError({
|
|
135973
135973
|
data: toolCallDelta,
|
|
135974
135974
|
message: `Expected 'function.name' to be a string.`
|
|
@@ -135984,7 +135984,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
135984
135984
|
type: "function",
|
|
135985
135985
|
function: {
|
|
135986
135986
|
name: toolCallDelta.function.name,
|
|
135987
|
-
arguments: (
|
|
135987
|
+
arguments: (_c10 = toolCallDelta.function.arguments) != null ? _c10 : ""
|
|
135988
135988
|
},
|
|
135989
135989
|
hasFinished: false
|
|
135990
135990
|
};
|
|
@@ -136042,7 +136042,7 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
136042
136042
|
}
|
|
136043
136043
|
},
|
|
136044
136044
|
flush(controller) {
|
|
136045
|
-
var _a210,
|
|
136045
|
+
var _a210, _b35, _c10, _d8, _e6, _f2;
|
|
136046
136046
|
if (isActiveReasoning) {
|
|
136047
136047
|
controller.enqueue({ type: "reasoning-end", id: "reasoning-0" });
|
|
136048
136048
|
}
|
|
@@ -136077,8 +136077,8 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
136077
136077
|
type: "finish",
|
|
136078
136078
|
finishReason,
|
|
136079
136079
|
usage: {
|
|
136080
|
-
inputTokens: (
|
|
136081
|
-
outputTokens: (
|
|
136080
|
+
inputTokens: (_b35 = usage.promptTokens) != null ? _b35 : void 0,
|
|
136081
|
+
outputTokens: (_c10 = usage.completionTokens) != null ? _c10 : void 0,
|
|
136082
136082
|
totalTokens: (_d8 = usage.totalTokens) != null ? _d8 : void 0,
|
|
136083
136083
|
reasoningTokens: (_e6 = usage.completionTokensDetails.reasoningTokens) != null ? _e6 : void 0,
|
|
136084
136084
|
cachedInputTokens: (_f2 = usage.promptTokensDetails.cachedTokens) != null ? _f2 : void 0
|
|
@@ -136288,10 +136288,10 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136288
136288
|
// type inferred via constructor
|
|
136289
136289
|
constructor(modelId, config2) {
|
|
136290
136290
|
this.specificationVersion = "v2";
|
|
136291
|
-
var
|
|
136291
|
+
var _a46;
|
|
136292
136292
|
this.modelId = modelId;
|
|
136293
136293
|
this.config = config2;
|
|
136294
|
-
const errorStructure = (
|
|
136294
|
+
const errorStructure = (_a46 = config2.errorStructure) != null ? _a46 : defaultOpenAICompatibleErrorStructure;
|
|
136295
136295
|
this.chunkSchema = createOpenAICompatibleCompletionChunkSchema(
|
|
136296
136296
|
errorStructure.errorSchema
|
|
136297
136297
|
);
|
|
@@ -136304,8 +136304,8 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136304
136304
|
return this.config.provider.split(".")[0].trim();
|
|
136305
136305
|
}
|
|
136306
136306
|
get supportedUrls() {
|
|
136307
|
-
var
|
|
136308
|
-
return (
|
|
136307
|
+
var _a46, _b35, _c10;
|
|
136308
|
+
return (_c10 = (_b35 = (_a46 = this.config).supportedUrls) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : {};
|
|
136309
136309
|
}
|
|
136310
136310
|
async getArgs({
|
|
136311
136311
|
prompt,
|
|
@@ -136322,13 +136322,13 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136322
136322
|
tools,
|
|
136323
136323
|
toolChoice
|
|
136324
136324
|
}) {
|
|
136325
|
-
var
|
|
136325
|
+
var _a46;
|
|
136326
136326
|
const warnings = [];
|
|
136327
|
-
const completionOptions = (
|
|
136327
|
+
const completionOptions = (_a46 = await parseProviderOptions({
|
|
136328
136328
|
provider: this.providerOptionsName,
|
|
136329
136329
|
providerOptions,
|
|
136330
136330
|
schema: openaiCompatibleCompletionProviderOptions
|
|
136331
|
-
})) != null ?
|
|
136331
|
+
})) != null ? _a46 : {};
|
|
136332
136332
|
if (topK != null) {
|
|
136333
136333
|
warnings.push({ type: "unsupported-setting", setting: "topK" });
|
|
136334
136334
|
}
|
|
@@ -136373,7 +136373,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136373
136373
|
};
|
|
136374
136374
|
}
|
|
136375
136375
|
async doGenerate(options) {
|
|
136376
|
-
var
|
|
136376
|
+
var _a46, _b35, _c10, _d8, _e6, _f2;
|
|
136377
136377
|
const { args, warnings } = await this.getArgs(options);
|
|
136378
136378
|
const {
|
|
136379
136379
|
responseHeaders,
|
|
@@ -136401,8 +136401,8 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136401
136401
|
return {
|
|
136402
136402
|
content,
|
|
136403
136403
|
usage: {
|
|
136404
|
-
inputTokens: (
|
|
136405
|
-
outputTokens: (_d8 = (
|
|
136404
|
+
inputTokens: (_b35 = (_a46 = response.usage) == null ? void 0 : _a46.prompt_tokens) != null ? _b35 : void 0,
|
|
136405
|
+
outputTokens: (_d8 = (_c10 = response.usage) == null ? void 0 : _c10.completion_tokens) != null ? _d8 : void 0,
|
|
136406
136406
|
totalTokens: (_f2 = (_e6 = response.usage) == null ? void 0 : _e6.total_tokens) != null ? _f2 : void 0
|
|
136407
136407
|
},
|
|
136408
136408
|
finishReason: mapOpenAICompatibleFinishReason2(choice2.finish_reason),
|
|
@@ -136451,7 +136451,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136451
136451
|
controller.enqueue({ type: "stream-start", warnings });
|
|
136452
136452
|
},
|
|
136453
136453
|
transform(chunk, controller) {
|
|
136454
|
-
var
|
|
136454
|
+
var _a46, _b35, _c10;
|
|
136455
136455
|
if (options.includeRawChunks) {
|
|
136456
136456
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
136457
136457
|
}
|
|
@@ -136478,9 +136478,9 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
136478
136478
|
});
|
|
136479
136479
|
}
|
|
136480
136480
|
if (value.usage != null) {
|
|
136481
|
-
usage.inputTokens = (
|
|
136482
|
-
usage.outputTokens = (
|
|
136483
|
-
usage.totalTokens = (
|
|
136481
|
+
usage.inputTokens = (_a46 = value.usage.prompt_tokens) != null ? _a46 : void 0;
|
|
136482
|
+
usage.outputTokens = (_b35 = value.usage.completion_tokens) != null ? _b35 : void 0;
|
|
136483
|
+
usage.totalTokens = (_c10 = value.usage.total_tokens) != null ? _c10 : void 0;
|
|
136484
136484
|
}
|
|
136485
136485
|
const choice2 = value.choices[0];
|
|
136486
136486
|
if ((choice2 == null ? void 0 : choice2.finish_reason) != null) {
|
|
@@ -136568,12 +136568,12 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
|
136568
136568
|
return this.config.provider;
|
|
136569
136569
|
}
|
|
136570
136570
|
get maxEmbeddingsPerCall() {
|
|
136571
|
-
var
|
|
136572
|
-
return (
|
|
136571
|
+
var _a46;
|
|
136572
|
+
return (_a46 = this.config.maxEmbeddingsPerCall) != null ? _a46 : 2048;
|
|
136573
136573
|
}
|
|
136574
136574
|
get supportsParallelCalls() {
|
|
136575
|
-
var
|
|
136576
|
-
return (
|
|
136575
|
+
var _a46;
|
|
136576
|
+
return (_a46 = this.config.supportsParallelCalls) != null ? _a46 : true;
|
|
136577
136577
|
}
|
|
136578
136578
|
get providerOptionsName() {
|
|
136579
136579
|
return this.config.provider.split(".")[0].trim();
|
|
@@ -136584,18 +136584,18 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
|
136584
136584
|
abortSignal,
|
|
136585
136585
|
providerOptions
|
|
136586
136586
|
}) {
|
|
136587
|
-
var
|
|
136587
|
+
var _a46, _b35, _c10;
|
|
136588
136588
|
const compatibleOptions = Object.assign(
|
|
136589
|
-
(
|
|
136589
|
+
(_a46 = await parseProviderOptions({
|
|
136590
136590
|
provider: "openai-compatible",
|
|
136591
136591
|
providerOptions,
|
|
136592
136592
|
schema: openaiCompatibleEmbeddingProviderOptions
|
|
136593
|
-
})) != null ?
|
|
136594
|
-
(
|
|
136593
|
+
})) != null ? _a46 : {},
|
|
136594
|
+
(_b35 = await parseProviderOptions({
|
|
136595
136595
|
provider: this.providerOptionsName,
|
|
136596
136596
|
providerOptions,
|
|
136597
136597
|
schema: openaiCompatibleEmbeddingProviderOptions
|
|
136598
|
-
})) != null ?
|
|
136598
|
+
})) != null ? _b35 : {}
|
|
136599
136599
|
);
|
|
136600
136600
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
136601
136601
|
throw new TooManyEmbeddingValuesForCallError({
|
|
@@ -136623,7 +136623,7 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
|
136623
136623
|
user: compatibleOptions.user
|
|
136624
136624
|
},
|
|
136625
136625
|
failedResponseHandler: createJsonErrorResponseHandler(
|
|
136626
|
-
(
|
|
136626
|
+
(_c10 = this.config.errorStructure) != null ? _c10 : defaultOpenAICompatibleErrorStructure
|
|
136627
136627
|
),
|
|
136628
136628
|
successfulResponseHandler: createJsonResponseHandler(
|
|
136629
136629
|
openaiTextEmbeddingResponseSchema2
|
|
@@ -136664,7 +136664,7 @@ var OpenAICompatibleImageModel = class {
|
|
|
136664
136664
|
headers,
|
|
136665
136665
|
abortSignal
|
|
136666
136666
|
}) {
|
|
136667
|
-
var
|
|
136667
|
+
var _a46, _b35, _c10, _d8, _e6;
|
|
136668
136668
|
const warnings = [];
|
|
136669
136669
|
if (aspectRatio != null) {
|
|
136670
136670
|
warnings.push({
|
|
@@ -136676,7 +136676,7 @@ var OpenAICompatibleImageModel = class {
|
|
|
136676
136676
|
if (seed != null) {
|
|
136677
136677
|
warnings.push({ type: "unsupported-setting", setting: "seed" });
|
|
136678
136678
|
}
|
|
136679
|
-
const currentDate = (
|
|
136679
|
+
const currentDate = (_c10 = (_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) != null ? _c10 : /* @__PURE__ */ new Date();
|
|
136680
136680
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
136681
136681
|
url: this.config.url({
|
|
136682
136682
|
path: "/images/generations",
|
|
@@ -136770,8 +136770,8 @@ var infomaniakErrorDataSchema = external_exports.object({
|
|
|
136770
136770
|
var infomaniakFailedResponseHandler = createJsonErrorResponseHandler({
|
|
136771
136771
|
errorSchema: infomaniakErrorDataSchema,
|
|
136772
136772
|
errorToMessage: (data) => {
|
|
136773
|
-
var
|
|
136774
|
-
return ((
|
|
136773
|
+
var _a46;
|
|
136774
|
+
return ((_a46 = data.error) == null ? void 0 : _a46.description) || data.result;
|
|
136775
136775
|
}
|
|
136776
136776
|
});
|
|
136777
136777
|
var infomaniakTranscriptionProviderOptions = external_exports.object({
|
|
@@ -137006,8 +137006,8 @@ var InfomaniakTranscriptionModel = class {
|
|
|
137006
137006
|
throw new Error(`Transcription timed out after ${maxRetries} attempts`);
|
|
137007
137007
|
}
|
|
137008
137008
|
async doGenerate(options) {
|
|
137009
|
-
var
|
|
137010
|
-
const currentDate = ((
|
|
137009
|
+
var _a46, _b35, _c10, _d8;
|
|
137010
|
+
const currentDate = ((_b35 = (_a46 = this.config._internal) == null ? void 0 : _a46.currentDate) == null ? void 0 : _b35.call(_a46)) ?? /* @__PURE__ */ new Date();
|
|
137011
137011
|
const { formData, warnings } = await this.getArgs(options);
|
|
137012
137012
|
const { value: batchResponse } = await postFormDataToApi({
|
|
137013
137013
|
url: this.config.url({
|
|
@@ -137029,7 +137029,7 @@ var InfomaniakTranscriptionModel = class {
|
|
|
137029
137029
|
const language = result.language != null && result.language in languageMap2 ? languageMap2[result.language] : void 0;
|
|
137030
137030
|
return {
|
|
137031
137031
|
text: result.text,
|
|
137032
|
-
segments: ((
|
|
137032
|
+
segments: ((_c10 = result.segments) == null ? void 0 : _c10.map((segment) => ({
|
|
137033
137033
|
text: segment.text,
|
|
137034
137034
|
startSecond: segment.start,
|
|
137035
137035
|
endSecond: segment.end
|
|
@@ -143853,7 +143853,7 @@ function loadPrompt(name21) {
|
|
|
143853
143853
|
return body;
|
|
143854
143854
|
}
|
|
143855
143855
|
|
|
143856
|
-
// src/services/
|
|
143856
|
+
// src/services/delegate.service.ts
|
|
143857
143857
|
var __decorate9 = function(decorators, target, key, desc) {
|
|
143858
143858
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
143859
143859
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -143863,13 +143863,156 @@ var __decorate9 = function(decorators, target, key, desc) {
|
|
|
143863
143863
|
var __metadata9 = function(k3, v2) {
|
|
143864
143864
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
143865
143865
|
};
|
|
143866
|
+
var __param8 = function(paramIndex, decorator) {
|
|
143867
|
+
return function(target, key) {
|
|
143868
|
+
decorator(target, key, paramIndex);
|
|
143869
|
+
};
|
|
143870
|
+
};
|
|
143866
143871
|
var _a30;
|
|
143867
143872
|
var _b24;
|
|
143868
143873
|
var _c2;
|
|
143869
|
-
var _d2;
|
|
143870
143874
|
var MAX_DELEGATE_DEPTH = 3;
|
|
143871
143875
|
var DELEGATE_MCP_CLIENT_TIMEOUT_MS = 3e4;
|
|
143872
143876
|
var DELEGATE_GENERATE_TEXT_TIMEOUT_MS = 12e4;
|
|
143877
|
+
var DelegateService = class DelegateService2 {
|
|
143878
|
+
constructor(loggerService, natsService, aiProviderService) {
|
|
143879
|
+
this.natsService = natsService;
|
|
143880
|
+
this.aiProviderService = aiProviderService;
|
|
143881
|
+
this.logger = loggerService.getLogger("delegate");
|
|
143882
|
+
}
|
|
143883
|
+
async execute(params) {
|
|
143884
|
+
const { context: context2, model: modelOverride, temperature: temperatureOverride, workspaceId, userKey, delegateDepth: currentDepth = 0 } = params;
|
|
143885
|
+
if (!context2) {
|
|
143886
|
+
return { isError: true, content: [{ type: "text", text: "Error: context is required." }] };
|
|
143887
|
+
}
|
|
143888
|
+
if (modelOverride && !/^[a-zA-Z0-9-]+\/[a-zA-Z0-9._-]+$/.test(modelOverride)) {
|
|
143889
|
+
return { isError: true, content: [{ type: "text", text: "Error: Invalid model format. Expected: provider/model-name" }] };
|
|
143890
|
+
}
|
|
143891
|
+
const temperature = temperatureOverride != null ? Math.min(2, Math.max(0, temperatureOverride)) : DEFAULT_TEMPERATURE;
|
|
143892
|
+
if (currentDepth >= MAX_DELEGATE_DEPTH) {
|
|
143893
|
+
return {
|
|
143894
|
+
isError: true,
|
|
143895
|
+
content: [{ type: "text", text: `Error: Maximum delegate depth (${MAX_DELEGATE_DEPTH}) reached. Cannot nest further.` }]
|
|
143896
|
+
};
|
|
143897
|
+
}
|
|
143898
|
+
try {
|
|
143899
|
+
const configRequest = DelegateAIConfigRequest.create({ workspaceId });
|
|
143900
|
+
const configResponse = await this.natsService.request(configRequest, { timeout: 1e4 });
|
|
143901
|
+
if (configResponse instanceof ErrorResponse) {
|
|
143902
|
+
return { isError: true, content: [{ type: "text", text: `Error: ${configResponse.data.error}` }] };
|
|
143903
|
+
}
|
|
143904
|
+
if (!(configResponse instanceof DelegateAIConfigResponse)) {
|
|
143905
|
+
return { isError: true, content: [{ type: "text", text: "Error: Invalid AI config response from backend" }] };
|
|
143906
|
+
}
|
|
143907
|
+
const { providerConfig, defaultModel } = configResponse.data;
|
|
143908
|
+
const modelString = modelOverride || defaultModel;
|
|
143909
|
+
const { provider, modelName } = this.aiProviderService.parseModelString(modelString);
|
|
143910
|
+
const model = this.aiProviderService.getProviderModel(provider, modelName, providerConfig);
|
|
143911
|
+
const runtimeUrl = process.env.RUNTIME_MCP_URL || "http://localhost:3001/mcp";
|
|
143912
|
+
if (!process.env.RUNTIME_MCP_URL) {
|
|
143913
|
+
this.logger.warn({ runtimeUrl, event: "delegate_mcp_url_fallback" }, "RUNTIME_MCP_URL not set, falling back to default");
|
|
143914
|
+
}
|
|
143915
|
+
if (!userKey) {
|
|
143916
|
+
return { isError: true, content: [{ type: "text", text: "Error: User key not available for delegate MCP connection." }] };
|
|
143917
|
+
}
|
|
143918
|
+
let mcpClient;
|
|
143919
|
+
let connectionTimer;
|
|
143920
|
+
try {
|
|
143921
|
+
mcpClient = await Promise.race([
|
|
143922
|
+
createSkilderMCPClient({
|
|
143923
|
+
url: runtimeUrl,
|
|
143924
|
+
userKey,
|
|
143925
|
+
delegateDepth: currentDepth + 1
|
|
143926
|
+
}),
|
|
143927
|
+
new Promise((_3, reject) => {
|
|
143928
|
+
connectionTimer = setTimeout(() => reject(new Error("MCP client connection timeout")), DELEGATE_MCP_CLIENT_TIMEOUT_MS);
|
|
143929
|
+
})
|
|
143930
|
+
]);
|
|
143931
|
+
clearTimeout(connectionTimer);
|
|
143932
|
+
} catch (err) {
|
|
143933
|
+
clearTimeout(connectionTimer);
|
|
143934
|
+
this.logger.error({ err, runtimeUrl, delegateDepth: currentDepth + 1 }, "Failed to create MCP client for delegate");
|
|
143935
|
+
return {
|
|
143936
|
+
isError: true,
|
|
143937
|
+
content: [{ type: "text", text: `Error: Failed to connect delegate to runtime: ${err instanceof Error ? err.message : String(err)}` }]
|
|
143938
|
+
};
|
|
143939
|
+
}
|
|
143940
|
+
try {
|
|
143941
|
+
const tools = await mcpClient.tools();
|
|
143942
|
+
let systemPrompt;
|
|
143943
|
+
try {
|
|
143944
|
+
systemPrompt = loadPrompt("delegate-agent");
|
|
143945
|
+
} catch (err) {
|
|
143946
|
+
this.logger.error({ err, event: "delegate_prompt_load_failed" }, "Failed to load delegate-agent prompt");
|
|
143947
|
+
return {
|
|
143948
|
+
isError: true,
|
|
143949
|
+
content: [{ type: "text", text: "Error: Delegate system prompt could not be loaded. This indicates a deployment issue." }]
|
|
143950
|
+
};
|
|
143951
|
+
}
|
|
143952
|
+
const abortController = new AbortController();
|
|
143953
|
+
const generateTimeout = setTimeout(() => abortController.abort(), DELEGATE_GENERATE_TEXT_TIMEOUT_MS);
|
|
143954
|
+
try {
|
|
143955
|
+
const result = await generateText({
|
|
143956
|
+
model,
|
|
143957
|
+
system: systemPrompt,
|
|
143958
|
+
tools,
|
|
143959
|
+
stopWhen: stepCountIs(25),
|
|
143960
|
+
messages: [{ role: "user", content: context2 }],
|
|
143961
|
+
temperature,
|
|
143962
|
+
abortSignal: abortController.signal
|
|
143963
|
+
});
|
|
143964
|
+
const textContent = result.text || "(No text output from delegate)";
|
|
143965
|
+
this.logger.info({
|
|
143966
|
+
event: "delegate_completed",
|
|
143967
|
+
delegateDepth: currentDepth + 1,
|
|
143968
|
+
steps: result.steps.length,
|
|
143969
|
+
usage: result.usage
|
|
143970
|
+
}, "Delegate sub-agent completed");
|
|
143971
|
+
return { content: [{ type: "text", text: textContent }] };
|
|
143972
|
+
} finally {
|
|
143973
|
+
clearTimeout(generateTimeout);
|
|
143974
|
+
}
|
|
143975
|
+
} finally {
|
|
143976
|
+
await mcpClient.close().catch((err) => {
|
|
143977
|
+
this.logger.warn({ err }, "Failed to close delegate MCP client");
|
|
143978
|
+
});
|
|
143979
|
+
}
|
|
143980
|
+
} catch (error48) {
|
|
143981
|
+
this.logger.error({ err: error48 }, "Delegate tool call failed");
|
|
143982
|
+
return {
|
|
143983
|
+
isError: true,
|
|
143984
|
+
content: [
|
|
143985
|
+
{
|
|
143986
|
+
type: "text",
|
|
143987
|
+
text: `Error: Delegate failed: ${error48 instanceof Error ? error48.message : String(error48)}`
|
|
143988
|
+
}
|
|
143989
|
+
]
|
|
143990
|
+
};
|
|
143991
|
+
}
|
|
143992
|
+
}
|
|
143993
|
+
};
|
|
143994
|
+
DelegateService = __decorate9([
|
|
143995
|
+
W(),
|
|
143996
|
+
__param8(0, U(LoggerService)),
|
|
143997
|
+
__param8(1, U(NatsService)),
|
|
143998
|
+
__param8(2, U(AIProviderService)),
|
|
143999
|
+
__metadata9("design:paramtypes", [typeof (_a30 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a30 : Object, typeof (_b24 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b24 : Object, typeof (_c2 = typeof AIProviderService !== "undefined" && AIProviderService) === "function" ? _c2 : Object])
|
|
144000
|
+
], DelegateService);
|
|
144001
|
+
|
|
144002
|
+
// src/services/skill.service.ts
|
|
144003
|
+
var __decorate10 = function(decorators, target, key, desc) {
|
|
144004
|
+
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
144005
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
144006
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
144007
|
+
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
144008
|
+
};
|
|
144009
|
+
var __metadata10 = function(k3, v2) {
|
|
144010
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
144011
|
+
};
|
|
144012
|
+
var _a31;
|
|
144013
|
+
var _b25;
|
|
144014
|
+
var _c3;
|
|
144015
|
+
var _d2;
|
|
143873
144016
|
var GET_SKILL_RELATED_QUERY = `
|
|
143874
144017
|
query GetSkillRelated($id: ID!) {
|
|
143875
144018
|
skillRelated(id: $id) {
|
|
@@ -143898,7 +144041,11 @@ var SkillService = class SkillService2 extends Service {
|
|
|
143898
144041
|
learnedSkillIds: /* @__PURE__ */ new Set(),
|
|
143899
144042
|
learnedHatIds: /* @__PURE__ */ new Set()
|
|
143900
144043
|
};
|
|
144044
|
+
this.delegateService = null;
|
|
143901
144045
|
this.logger = this.loggerService.getLogger(`${this.name}`);
|
|
144046
|
+
if (this.aiProviderService) {
|
|
144047
|
+
this.delegateService = new DelegateService(this.loggerService, this.natsService, this.aiProviderService);
|
|
144048
|
+
}
|
|
143902
144049
|
}
|
|
143903
144050
|
async initialize() {
|
|
143904
144051
|
this.logger.info(`Starting skill service for ${this.identity.name}`);
|
|
@@ -144246,123 +144393,30 @@ The path must point to a downloadable (binary) resource in a skill's related ite
|
|
|
144246
144393
|
* Handle delegate tool call — spawns a sub-agent with Skilder MCP access.
|
|
144247
144394
|
*/
|
|
144248
144395
|
async handleDelegate(args) {
|
|
144249
|
-
|
|
144250
|
-
const modelOverride = args.model;
|
|
144251
|
-
const temperatureOverride = args.temperature;
|
|
144252
|
-
if (!context2) {
|
|
144253
|
-
return {
|
|
144254
|
-
response: { isError: true, content: [{ type: "text", text: "Error: context is required." }] }
|
|
144255
|
-
};
|
|
144256
|
-
}
|
|
144257
|
-
if (modelOverride && !/^[a-zA-Z0-9-]+\/[a-zA-Z0-9._-]+$/.test(modelOverride)) {
|
|
144258
|
-
return {
|
|
144259
|
-
response: { isError: true, content: [{ type: "text", text: "Error: Invalid model format. Expected: provider/model-name" }] }
|
|
144260
|
-
};
|
|
144261
|
-
}
|
|
144262
|
-
const temperature = temperatureOverride != null ? Math.min(2, Math.max(0, temperatureOverride)) : DEFAULT_TEMPERATURE;
|
|
144263
|
-
const currentDepth = this.identity.delegateDepth ?? 0;
|
|
144264
|
-
if (currentDepth >= MAX_DELEGATE_DEPTH) {
|
|
144396
|
+
if (!this.delegateService) {
|
|
144265
144397
|
return {
|
|
144266
|
-
response: { isError: true, content: [{ type: "text", text:
|
|
144267
|
-
};
|
|
144268
|
-
}
|
|
144269
|
-
if (!this.aiProviderService) {
|
|
144270
|
-
return {
|
|
144271
|
-
response: { isError: true, content: [{ type: "text", text: "Error: AI provider service not available." }] }
|
|
144398
|
+
response: { isError: true, content: [{ type: "text", text: "Error: Delegate service not available." }] }
|
|
144272
144399
|
};
|
|
144273
144400
|
}
|
|
144401
|
+
const context2 = typeof args.context === "string" ? args.context : void 0;
|
|
144402
|
+
const model = typeof args.model === "string" ? args.model : void 0;
|
|
144403
|
+
const temperature = typeof args.temperature === "number" ? args.temperature : void 0;
|
|
144274
144404
|
try {
|
|
144275
|
-
const
|
|
144276
|
-
|
|
144405
|
+
const response = await this.delegateService.execute({
|
|
144406
|
+
context: context2,
|
|
144407
|
+
model,
|
|
144408
|
+
temperature,
|
|
144409
|
+
workspaceId: this.identity.workspaceId,
|
|
144410
|
+
userKey: this.identity.userKey,
|
|
144411
|
+
delegateDepth: this.identity.delegateDepth ?? 0
|
|
144277
144412
|
});
|
|
144278
|
-
|
|
144279
|
-
if (configResponse instanceof ErrorResponse) {
|
|
144280
|
-
return {
|
|
144281
|
-
response: { isError: true, content: [{ type: "text", text: `Error: ${configResponse.data.error}` }] }
|
|
144282
|
-
};
|
|
144283
|
-
}
|
|
144284
|
-
if (!(configResponse instanceof DelegateAIConfigResponse)) {
|
|
144285
|
-
return {
|
|
144286
|
-
response: { isError: true, content: [{ type: "text", text: "Error: Invalid AI config response from backend" }] }
|
|
144287
|
-
};
|
|
144288
|
-
}
|
|
144289
|
-
const { providerConfig, defaultModel } = configResponse.data;
|
|
144290
|
-
const modelString = modelOverride || defaultModel;
|
|
144291
|
-
const { provider, modelName } = this.aiProviderService.parseModelString(modelString);
|
|
144292
|
-
const model = this.aiProviderService.getProviderModel(provider, modelName, providerConfig);
|
|
144293
|
-
const runtimeUrl = process.env.RUNTIME_MCP_URL || "http://localhost:3001/mcp";
|
|
144294
|
-
this.logger.debug({ runtimeUrl, event: "delegate_mcp_url_resolved" }, "Resolved runtime MCP URL for delegate");
|
|
144295
|
-
if (!this.identity.userKey) {
|
|
144296
|
-
return {
|
|
144297
|
-
response: { isError: true, content: [{ type: "text", text: "Error: User key not available for delegate MCP connection." }] }
|
|
144298
|
-
};
|
|
144299
|
-
}
|
|
144300
|
-
let mcpClient;
|
|
144301
|
-
try {
|
|
144302
|
-
mcpClient = await Promise.race([
|
|
144303
|
-
createSkilderMCPClient({
|
|
144304
|
-
url: runtimeUrl,
|
|
144305
|
-
userKey: this.identity.userKey,
|
|
144306
|
-
delegateDepth: currentDepth + 1
|
|
144307
|
-
}),
|
|
144308
|
-
new Promise((_3, reject) => setTimeout(() => reject(new Error("MCP client connection timeout")), DELEGATE_MCP_CLIENT_TIMEOUT_MS))
|
|
144309
|
-
]);
|
|
144310
|
-
} catch (err) {
|
|
144311
|
-
this.logger.error({ err, runtimeUrl, delegateDepth: currentDepth + 1 }, "Failed to create MCP client for delegate");
|
|
144312
|
-
return {
|
|
144313
|
-
response: { isError: true, content: [{ type: "text", text: `Error: Failed to connect delegate to runtime: ${err instanceof Error ? err.message : String(err)}` }] }
|
|
144314
|
-
};
|
|
144315
|
-
}
|
|
144316
|
-
try {
|
|
144317
|
-
const tools = await mcpClient.tools();
|
|
144318
|
-
let systemPrompt;
|
|
144319
|
-
try {
|
|
144320
|
-
systemPrompt = loadPrompt("delegate-agent");
|
|
144321
|
-
} catch (err) {
|
|
144322
|
-
this.logger.error({ err, event: "delegate_prompt_load_failed" }, "Failed to load delegate-agent prompt \u2014 using minimal fallback");
|
|
144323
|
-
systemPrompt = "You are a task-focused sub-agent. Use the available tools to complete the task efficiently.";
|
|
144324
|
-
}
|
|
144325
|
-
const abortController = new AbortController();
|
|
144326
|
-
const generateTimeout = setTimeout(() => abortController.abort(), DELEGATE_GENERATE_TEXT_TIMEOUT_MS);
|
|
144327
|
-
try {
|
|
144328
|
-
const result = await generateText({
|
|
144329
|
-
model,
|
|
144330
|
-
system: systemPrompt,
|
|
144331
|
-
tools,
|
|
144332
|
-
stopWhen: stepCountIs(25),
|
|
144333
|
-
messages: [{ role: "user", content: context2 }],
|
|
144334
|
-
temperature,
|
|
144335
|
-
abortSignal: abortController.signal
|
|
144336
|
-
});
|
|
144337
|
-
const textContent = result.text || "(No text output from delegate)";
|
|
144338
|
-
this.logger.info({
|
|
144339
|
-
event: "delegate_completed",
|
|
144340
|
-
delegateDepth: currentDepth + 1,
|
|
144341
|
-
steps: result.steps.length,
|
|
144342
|
-
usage: result.usage
|
|
144343
|
-
}, "Delegate sub-agent completed");
|
|
144344
|
-
return {
|
|
144345
|
-
response: { content: [{ type: "text", text: textContent }] }
|
|
144346
|
-
};
|
|
144347
|
-
} finally {
|
|
144348
|
-
clearTimeout(generateTimeout);
|
|
144349
|
-
}
|
|
144350
|
-
} finally {
|
|
144351
|
-
await mcpClient.close().catch((err) => {
|
|
144352
|
-
this.logger.warn({ err }, "Failed to close delegate MCP client");
|
|
144353
|
-
});
|
|
144354
|
-
}
|
|
144413
|
+
return { response };
|
|
144355
144414
|
} catch (error48) {
|
|
144356
|
-
this.logger.error({ err: error48 }, "
|
|
144415
|
+
this.logger.error({ err: error48 }, "Unexpected error in delegate execution");
|
|
144357
144416
|
return {
|
|
144358
144417
|
response: {
|
|
144359
144418
|
isError: true,
|
|
144360
|
-
content: [
|
|
144361
|
-
{
|
|
144362
|
-
type: "text",
|
|
144363
|
-
text: `Error: Delegate failed: ${error48 instanceof Error ? error48.message : String(error48)}`
|
|
144364
|
-
}
|
|
144365
|
-
]
|
|
144419
|
+
content: [{ type: "text", text: `Error: Delegate failed unexpectedly: ${error48 instanceof Error ? error48.message : String(error48)}` }]
|
|
144366
144420
|
}
|
|
144367
144421
|
};
|
|
144368
144422
|
}
|
|
@@ -144832,8 +144886,10 @@ For other resources, use the \`learn\` tool instead.`
|
|
|
144832
144886
|
workspaceId: this.identity.workspaceId,
|
|
144833
144887
|
from: this.identity.runtimeExecutionId,
|
|
144834
144888
|
userId: this.identity.id,
|
|
144889
|
+
userKey: this.identity.userKey,
|
|
144835
144890
|
arguments: { args },
|
|
144836
|
-
skillIds: [skill.id]
|
|
144891
|
+
skillIds: [skill.id],
|
|
144892
|
+
delegateDepth: this.identity.delegateDepth
|
|
144837
144893
|
});
|
|
144838
144894
|
try {
|
|
144839
144895
|
const response = await this.natsService.request(toolCallRequest, { timeout: MCP_CALL_TOOL_TIMEOUT });
|
|
@@ -145672,9 +145728,9 @@ ${JSON.stringify(toolConfig.inputSchema, null, 2)}`
|
|
|
145672
145728
|
}
|
|
145673
145729
|
}
|
|
145674
145730
|
};
|
|
145675
|
-
SkillService =
|
|
145731
|
+
SkillService = __decorate10([
|
|
145676
145732
|
W(),
|
|
145677
|
-
|
|
145733
|
+
__metadata10("design:paramtypes", [typeof (_a31 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a31 : Object, typeof (_b25 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b25 : Object, typeof (_c3 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c3 : Object, Object, Object, typeof (_d2 = typeof AIProviderService !== "undefined" && AIProviderService) === "function" ? _d2 : Object])
|
|
145678
145734
|
], SkillService);
|
|
145679
145735
|
|
|
145680
145736
|
// src/di/symbols.ts
|
|
@@ -145687,23 +145743,23 @@ function negotiateProtocolVersion(requestedVersion) {
|
|
|
145687
145743
|
}
|
|
145688
145744
|
|
|
145689
145745
|
// src/services/mcp.stdio.service.ts
|
|
145690
|
-
var
|
|
145746
|
+
var __decorate11 = function(decorators, target, key, desc) {
|
|
145691
145747
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
145692
145748
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
145693
145749
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
145694
145750
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
145695
145751
|
};
|
|
145696
|
-
var
|
|
145752
|
+
var __metadata11 = function(k3, v2) {
|
|
145697
145753
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
145698
145754
|
};
|
|
145699
|
-
var
|
|
145755
|
+
var __param9 = function(paramIndex, decorator) {
|
|
145700
145756
|
return function(target, key) {
|
|
145701
145757
|
decorator(target, key, paramIndex);
|
|
145702
145758
|
};
|
|
145703
145759
|
};
|
|
145704
|
-
var
|
|
145705
|
-
var
|
|
145706
|
-
var
|
|
145760
|
+
var _a34;
|
|
145761
|
+
var _b26;
|
|
145762
|
+
var _c4;
|
|
145707
145763
|
var _d3;
|
|
145708
145764
|
var _e2;
|
|
145709
145765
|
var _g;
|
|
@@ -145875,38 +145931,38 @@ var McpStdioService = class McpStdioService2 extends Service {
|
|
|
145875
145931
|
return this.clientRoots.asObservable();
|
|
145876
145932
|
}
|
|
145877
145933
|
};
|
|
145878
|
-
McpStdioService =
|
|
145934
|
+
McpStdioService = __decorate11([
|
|
145879
145935
|
W(),
|
|
145880
|
-
|
|
145881
|
-
|
|
145882
|
-
|
|
145883
|
-
|
|
145884
|
-
|
|
145885
|
-
|
|
145886
|
-
|
|
145887
|
-
|
|
145888
|
-
|
|
145889
|
-
|
|
145936
|
+
__param9(0, U(LoggerService)),
|
|
145937
|
+
__param9(1, U(NatsService)),
|
|
145938
|
+
__param9(2, U(NatsCacheService)),
|
|
145939
|
+
__param9(3, U(HealthService)),
|
|
145940
|
+
__param9(4, U(AuthService)),
|
|
145941
|
+
__param9(5, U(RUNTIME_EXECUTION_ID)),
|
|
145942
|
+
__param9(6, U(FileService)),
|
|
145943
|
+
__param9(6, se()),
|
|
145944
|
+
__param9(7, U(AIProviderService)),
|
|
145945
|
+
__metadata11("design:paramtypes", [typeof (_a34 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a34 : Object, typeof (_b26 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b26 : Object, typeof (_c4 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c4 : Object, typeof (_d3 = typeof HealthService !== "undefined" && HealthService) === "function" ? _d3 : Object, typeof (_e2 = typeof AuthService !== "undefined" && AuthService) === "function" ? _e2 : Object, String, Object, typeof (_g = typeof AIProviderService !== "undefined" && AIProviderService) === "function" ? _g : Object])
|
|
145890
145946
|
], McpStdioService);
|
|
145891
145947
|
|
|
145892
145948
|
// src/services/fastify.manager.service.ts
|
|
145893
145949
|
var import_fastify = __toESM(require_fastify());
|
|
145894
145950
|
var import_cors = __toESM(require_cors());
|
|
145895
|
-
var
|
|
145951
|
+
var __decorate12 = function(decorators, target, key, desc) {
|
|
145896
145952
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
145897
145953
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
145898
145954
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
145899
145955
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
145900
145956
|
};
|
|
145901
|
-
var
|
|
145957
|
+
var __metadata12 = function(k3, v2) {
|
|
145902
145958
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
145903
145959
|
};
|
|
145904
|
-
var
|
|
145960
|
+
var __param10 = function(paramIndex, decorator) {
|
|
145905
145961
|
return function(target, key) {
|
|
145906
145962
|
decorator(target, key, paramIndex);
|
|
145907
145963
|
};
|
|
145908
145964
|
};
|
|
145909
|
-
var
|
|
145965
|
+
var _a35;
|
|
145910
145966
|
var FastifyManagerService = class FastifyManagerService2 extends Service {
|
|
145911
145967
|
constructor(loggerService) {
|
|
145912
145968
|
super();
|
|
@@ -146007,10 +146063,10 @@ var FastifyManagerService = class FastifyManagerService2 extends Service {
|
|
|
146007
146063
|
this.logger.info("Fastify instance configured (not listening yet)");
|
|
146008
146064
|
}
|
|
146009
146065
|
};
|
|
146010
|
-
FastifyManagerService =
|
|
146066
|
+
FastifyManagerService = __decorate12([
|
|
146011
146067
|
W(),
|
|
146012
|
-
|
|
146013
|
-
|
|
146068
|
+
__param10(0, U(LoggerService)),
|
|
146069
|
+
__metadata12("design:paramtypes", [typeof (_a35 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a35 : Object])
|
|
146014
146070
|
], FastifyManagerService);
|
|
146015
146071
|
|
|
146016
146072
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
@@ -147483,23 +147539,23 @@ function logSecurityConfig(logger, preventDnsRebindingAttack, allowedOrigins) {
|
|
|
147483
147539
|
}
|
|
147484
147540
|
|
|
147485
147541
|
// src/services/mcp.sse.service.ts
|
|
147486
|
-
var
|
|
147542
|
+
var __decorate13 = function(decorators, target, key, desc) {
|
|
147487
147543
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
147488
147544
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
147489
147545
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
147490
147546
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
147491
147547
|
};
|
|
147492
|
-
var
|
|
147548
|
+
var __metadata13 = function(k3, v2) {
|
|
147493
147549
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
147494
147550
|
};
|
|
147495
|
-
var
|
|
147551
|
+
var __param11 = function(paramIndex, decorator) {
|
|
147496
147552
|
return function(target, key) {
|
|
147497
147553
|
decorator(target, key, paramIndex);
|
|
147498
147554
|
};
|
|
147499
147555
|
};
|
|
147500
|
-
var
|
|
147501
|
-
var
|
|
147502
|
-
var
|
|
147556
|
+
var _a36;
|
|
147557
|
+
var _b27;
|
|
147558
|
+
var _c5;
|
|
147503
147559
|
var _d4;
|
|
147504
147560
|
var _e3;
|
|
147505
147561
|
var _g2;
|
|
@@ -147619,18 +147675,18 @@ var McpSseService = class McpSseService2 extends Service {
|
|
|
147619
147675
|
return true;
|
|
147620
147676
|
}
|
|
147621
147677
|
};
|
|
147622
|
-
McpSseService =
|
|
147678
|
+
McpSseService = __decorate13([
|
|
147623
147679
|
W(),
|
|
147624
|
-
|
|
147625
|
-
|
|
147626
|
-
|
|
147627
|
-
|
|
147628
|
-
|
|
147629
|
-
|
|
147630
|
-
|
|
147631
|
-
|
|
147632
|
-
|
|
147633
|
-
|
|
147680
|
+
__param11(0, U(LoggerService)),
|
|
147681
|
+
__param11(1, U(NatsService)),
|
|
147682
|
+
__param11(2, U(NatsCacheService)),
|
|
147683
|
+
__param11(3, U(HealthService)),
|
|
147684
|
+
__param11(4, U(FastifyManagerService)),
|
|
147685
|
+
__param11(5, U(RUNTIME_EXECUTION_ID)),
|
|
147686
|
+
__param11(6, U(FileService)),
|
|
147687
|
+
__param11(6, se()),
|
|
147688
|
+
__param11(7, U(AIProviderService)),
|
|
147689
|
+
__metadata13("design:paramtypes", [typeof (_a36 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a36 : Object, typeof (_b27 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b27 : Object, typeof (_c5 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c5 : Object, typeof (_d4 = typeof HealthService !== "undefined" && HealthService) === "function" ? _d4 : Object, typeof (_e3 = typeof FastifyManagerService !== "undefined" && FastifyManagerService) === "function" ? _e3 : Object, String, Object, typeof (_g2 = typeof AIProviderService !== "undefined" && AIProviderService) === "function" ? _g2 : Object])
|
|
147634
147690
|
], McpSseService);
|
|
147635
147691
|
|
|
147636
147692
|
// ../../node_modules/.pnpm/@hono+node-server@1.19.10_hono@4.12.4/node_modules/@hono/node-server/dist/index.mjs
|
|
@@ -148871,23 +148927,23 @@ var StreamableHTTPServerTransport = class {
|
|
|
148871
148927
|
|
|
148872
148928
|
// src/services/mcp.streamable.service.ts
|
|
148873
148929
|
var import_node_crypto4 = require("node:crypto");
|
|
148874
|
-
var
|
|
148930
|
+
var __decorate14 = function(decorators, target, key, desc) {
|
|
148875
148931
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
148876
148932
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
148877
148933
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
148878
148934
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
148879
148935
|
};
|
|
148880
|
-
var
|
|
148936
|
+
var __metadata14 = function(k3, v2) {
|
|
148881
148937
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
148882
148938
|
};
|
|
148883
|
-
var
|
|
148939
|
+
var __param12 = function(paramIndex, decorator) {
|
|
148884
148940
|
return function(target, key) {
|
|
148885
148941
|
decorator(target, key, paramIndex);
|
|
148886
148942
|
};
|
|
148887
148943
|
};
|
|
148888
|
-
var
|
|
148889
|
-
var
|
|
148890
|
-
var
|
|
148944
|
+
var _a37;
|
|
148945
|
+
var _b28;
|
|
148946
|
+
var _c6;
|
|
148891
148947
|
var _d5;
|
|
148892
148948
|
var _e4;
|
|
148893
148949
|
var _g3;
|
|
@@ -149196,18 +149252,18 @@ var McpStreamableService = class McpStreamableService2 extends Service {
|
|
|
149196
149252
|
cleanupSession(sessionId, this.sessions, this.healthService, this.logger).catch((err) => this.logger.error({ err, sessionId }, "Session cleanup failed in onsessionclosed callback"));
|
|
149197
149253
|
}
|
|
149198
149254
|
};
|
|
149199
|
-
McpStreamableService =
|
|
149255
|
+
McpStreamableService = __decorate14([
|
|
149200
149256
|
W(),
|
|
149201
|
-
|
|
149202
|
-
|
|
149203
|
-
|
|
149204
|
-
|
|
149205
|
-
|
|
149206
|
-
|
|
149207
|
-
|
|
149208
|
-
|
|
149209
|
-
|
|
149210
|
-
|
|
149257
|
+
__param12(0, U(LoggerService)),
|
|
149258
|
+
__param12(1, U(NatsService)),
|
|
149259
|
+
__param12(2, U(NatsCacheService)),
|
|
149260
|
+
__param12(3, U(HealthService)),
|
|
149261
|
+
__param12(4, U(FastifyManagerService)),
|
|
149262
|
+
__param12(5, U(RUNTIME_EXECUTION_ID)),
|
|
149263
|
+
__param12(6, U(FileService)),
|
|
149264
|
+
__param12(6, se()),
|
|
149265
|
+
__param12(7, U(AIProviderService)),
|
|
149266
|
+
__metadata14("design:paramtypes", [typeof (_a37 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a37 : Object, typeof (_b28 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b28 : Object, typeof (_c6 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c6 : Object, typeof (_d5 = typeof HealthService !== "undefined" && HealthService) === "function" ? _d5 : Object, typeof (_e4 = typeof FastifyManagerService !== "undefined" && FastifyManagerService) === "function" ? _e4 : Object, String, Object, typeof (_g3 = typeof AIProviderService !== "undefined" && AIProviderService) === "function" ? _g3 : Object])
|
|
149211
149267
|
], McpStreamableService);
|
|
149212
149268
|
|
|
149213
149269
|
// src/services/script-executor.service.ts
|
|
@@ -149216,21 +149272,21 @@ var import_promises = require("fs/promises");
|
|
|
149216
149272
|
var import_path2 = require("path");
|
|
149217
149273
|
var import_os4 = require("os");
|
|
149218
149274
|
var import_readline = require("readline");
|
|
149219
|
-
var
|
|
149275
|
+
var __decorate15 = function(decorators, target, key, desc) {
|
|
149220
149276
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
149221
149277
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
149222
149278
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
149223
149279
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
149224
149280
|
};
|
|
149225
|
-
var
|
|
149281
|
+
var __metadata15 = function(k3, v2) {
|
|
149226
149282
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
149227
149283
|
};
|
|
149228
|
-
var
|
|
149284
|
+
var __param13 = function(paramIndex, decorator) {
|
|
149229
149285
|
return function(target, key) {
|
|
149230
149286
|
decorator(target, key, paramIndex);
|
|
149231
149287
|
};
|
|
149232
149288
|
};
|
|
149233
|
-
var
|
|
149289
|
+
var _a38;
|
|
149234
149290
|
var ScriptType2 = dgraph_resolvers_types_exports.ScriptType;
|
|
149235
149291
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
149236
149292
|
var MAX_INTERACTIVE_TIMEOUT_MS = 3e5;
|
|
@@ -149503,7 +149559,9 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149503
149559
|
inflightCount++;
|
|
149504
149560
|
(async () => {
|
|
149505
149561
|
try {
|
|
149506
|
-
if (msg.method === "
|
|
149562
|
+
if (msg.method === "delegate") {
|
|
149563
|
+
resetTimeout(DELEGATE_GENERATE_TEXT_TIMEOUT_MS + timeout);
|
|
149564
|
+
} else if (msg.method === "tools/call") {
|
|
149507
149565
|
resetTimeout(toolCallTimeout + timeout);
|
|
149508
149566
|
}
|
|
149509
149567
|
const result = await onRequest(msg.method, msg.params);
|
|
@@ -149576,10 +149634,10 @@ var ScriptExecutorService = class ScriptExecutorService2 {
|
|
|
149576
149634
|
}
|
|
149577
149635
|
}
|
|
149578
149636
|
};
|
|
149579
|
-
ScriptExecutorService =
|
|
149637
|
+
ScriptExecutorService = __decorate15([
|
|
149580
149638
|
W(),
|
|
149581
|
-
|
|
149582
|
-
|
|
149639
|
+
__param13(0, U(LoggerService)),
|
|
149640
|
+
__metadata15("design:paramtypes", [typeof (_a38 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a38 : Object])
|
|
149583
149641
|
], ScriptExecutorService);
|
|
149584
149642
|
|
|
149585
149643
|
// src/services/tool.service.ts
|
|
@@ -151662,8 +151720,8 @@ var ErrorEvent = class extends Event {
|
|
|
151662
151720
|
* @param errorEventInitDict - Optional properties to include in the error event
|
|
151663
151721
|
*/
|
|
151664
151722
|
constructor(type21, errorEventInitDict) {
|
|
151665
|
-
var
|
|
151666
|
-
super(type21), this.code = (
|
|
151723
|
+
var _a46, _b35;
|
|
151724
|
+
super(type21), this.code = (_a46 = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a46 : void 0, this.message = (_b35 = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b35 : void 0;
|
|
151667
151725
|
}
|
|
151668
151726
|
/**
|
|
151669
151727
|
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -151745,7 +151803,7 @@ var scheduleReconnect_fn;
|
|
|
151745
151803
|
var _reconnect;
|
|
151746
151804
|
var EventSource = class extends EventTarget {
|
|
151747
151805
|
constructor(url2, eventSourceInitDict) {
|
|
151748
|
-
var
|
|
151806
|
+
var _a46, _b35;
|
|
151749
151807
|
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) => {
|
|
151750
151808
|
var _a210;
|
|
151751
151809
|
__privateGet(this, _parser).reset();
|
|
@@ -151804,7 +151862,7 @@ var EventSource = class extends EventTarget {
|
|
|
151804
151862
|
__privateSet(this, _parser, createParser({
|
|
151805
151863
|
onEvent: __privateGet(this, _onEvent),
|
|
151806
151864
|
onRetry: __privateGet(this, _onRetryChange)
|
|
151807
|
-
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (
|
|
151865
|
+
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a46 = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a46 : globalThis.fetch), __privateSet(this, _withCredentials, (_b35 = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b35 : false), __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
151808
151866
|
}
|
|
151809
151867
|
/**
|
|
151810
151868
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -151891,7 +151949,7 @@ connect_fn = function() {
|
|
|
151891
151949
|
* @internal
|
|
151892
151950
|
*/
|
|
151893
151951
|
getRequestOptions_fn = function() {
|
|
151894
|
-
var
|
|
151952
|
+
var _a46;
|
|
151895
151953
|
const init = {
|
|
151896
151954
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
151897
151955
|
// [spec] …will have their mode set to "cors"…
|
|
@@ -151899,7 +151957,7 @@ getRequestOptions_fn = function() {
|
|
|
151899
151957
|
redirect: "follow",
|
|
151900
151958
|
headers: { Accept: "text/event-stream", ...__privateGet(this, _lastEventId) ? { "Last-Event-ID": __privateGet(this, _lastEventId) } : void 0 },
|
|
151901
151959
|
cache: "no-store",
|
|
151902
|
-
signal: (
|
|
151960
|
+
signal: (_a46 = __privateGet(this, _controller)) == null ? void 0 : _a46.signal
|
|
151903
151961
|
};
|
|
151904
151962
|
return "window" in globalThis && (init.credentials = this.withCredentials ? "include" : "same-origin"), init;
|
|
151905
151963
|
}, _onEvent = /* @__PURE__ */ new WeakMap(), _onRetryChange = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -151910,10 +151968,10 @@ getRequestOptions_fn = function() {
|
|
|
151910
151968
|
* @internal
|
|
151911
151969
|
*/
|
|
151912
151970
|
failConnection_fn = function(message, code) {
|
|
151913
|
-
var
|
|
151971
|
+
var _a46;
|
|
151914
151972
|
__privateGet(this, _readyState) !== this.CLOSED && __privateSet(this, _readyState, this.CLOSED);
|
|
151915
151973
|
const errorEvent = new ErrorEvent("error", { code, message });
|
|
151916
|
-
(
|
|
151974
|
+
(_a46 = __privateGet(this, _onError)) == null || _a46.call(this, errorEvent), this.dispatchEvent(errorEvent);
|
|
151917
151975
|
}, /**
|
|
151918
151976
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
151919
151977
|
*
|
|
@@ -151922,12 +151980,12 @@ failConnection_fn = function(message, code) {
|
|
|
151922
151980
|
* @internal
|
|
151923
151981
|
*/
|
|
151924
151982
|
scheduleReconnect_fn = function(message, code) {
|
|
151925
|
-
var
|
|
151983
|
+
var _a46;
|
|
151926
151984
|
if (__privateGet(this, _readyState) === this.CLOSED)
|
|
151927
151985
|
return;
|
|
151928
151986
|
__privateSet(this, _readyState, this.CONNECTING);
|
|
151929
151987
|
const errorEvent = new ErrorEvent("error", { code, message });
|
|
151930
|
-
(
|
|
151988
|
+
(_a46 = __privateGet(this, _onError)) == null || _a46.call(this, errorEvent), this.dispatchEvent(errorEvent), __privateSet(this, _reconnectTimer, setTimeout(__privateGet(this, _reconnect), __privateGet(this, _reconnectInterval)));
|
|
151931
151989
|
}, _reconnect = /* @__PURE__ */ new WeakMap(), /**
|
|
151932
151990
|
* ReadyState representing an EventSource currently trying to connect
|
|
151933
151991
|
*
|
|
@@ -152142,18 +152200,18 @@ var SSEClientTransport = class {
|
|
|
152142
152200
|
|
|
152143
152201
|
// src/services/tool.mcp.server.service.ts
|
|
152144
152202
|
var import_rxjs3 = __toESM(require_cjs2());
|
|
152145
|
-
var
|
|
152203
|
+
var __decorate16 = function(decorators, target, key, desc) {
|
|
152146
152204
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
152147
152205
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
152148
152206
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
152149
152207
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
152150
152208
|
};
|
|
152151
|
-
var
|
|
152209
|
+
var __metadata16 = function(k3, v2) {
|
|
152152
152210
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
152153
152211
|
};
|
|
152154
|
-
var
|
|
152155
|
-
var
|
|
152156
|
-
var
|
|
152212
|
+
var _a39;
|
|
152213
|
+
var _b29;
|
|
152214
|
+
var _c7;
|
|
152157
152215
|
var ToolServerService = class ToolServerService2 extends Service {
|
|
152158
152216
|
constructor(logger, config2, roots = [], additionalEnv = {}, authProvider) {
|
|
152159
152217
|
super();
|
|
@@ -152341,31 +152399,31 @@ var ToolServerService = class ToolServerService2 extends Service {
|
|
|
152341
152399
|
this.client.sendRootsListChanged();
|
|
152342
152400
|
}
|
|
152343
152401
|
};
|
|
152344
|
-
ToolServerService =
|
|
152402
|
+
ToolServerService = __decorate16([
|
|
152345
152403
|
W(),
|
|
152346
|
-
|
|
152404
|
+
__metadata16("design:paramtypes", [typeof (_a39 = typeof import_pino2.default !== "undefined" && import_pino2.default.Logger) === "function" ? _a39 : Object, typeof (_b29 = typeof dgraph_resolvers_types_exports !== "undefined" && dgraph_resolvers_types_exports.McpServer) === "function" ? _b29 : Object, Array, typeof (_c7 = typeof Record !== "undefined" && Record) === "function" ? _c7 : Object, Object])
|
|
152347
152405
|
], ToolServerService);
|
|
152348
152406
|
var getConfigSignature = (config2, roots) => {
|
|
152349
152407
|
return `${config2.transport}-${config2.config}-${roots.length}`;
|
|
152350
152408
|
};
|
|
152351
152409
|
|
|
152352
152410
|
// src/services/oauth-token.service.ts
|
|
152353
|
-
var
|
|
152411
|
+
var __decorate17 = function(decorators, target, key, desc) {
|
|
152354
152412
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
152355
152413
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
152356
152414
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
152357
152415
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
152358
152416
|
};
|
|
152359
|
-
var
|
|
152417
|
+
var __metadata17 = function(k3, v2) {
|
|
152360
152418
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
152361
152419
|
};
|
|
152362
|
-
var
|
|
152420
|
+
var __param14 = function(paramIndex, decorator) {
|
|
152363
152421
|
return function(target, key) {
|
|
152364
152422
|
decorator(target, key, paramIndex);
|
|
152365
152423
|
};
|
|
152366
152424
|
};
|
|
152367
|
-
var
|
|
152368
|
-
var
|
|
152425
|
+
var _a40;
|
|
152426
|
+
var _b30;
|
|
152369
152427
|
var OAuthTokenService = class OAuthTokenService2 {
|
|
152370
152428
|
constructor(loggerService, natsService) {
|
|
152371
152429
|
this.loggerService = loggerService;
|
|
@@ -152444,30 +152502,30 @@ var OAuthTokenService = class OAuthTokenService2 {
|
|
|
152444
152502
|
}
|
|
152445
152503
|
}
|
|
152446
152504
|
};
|
|
152447
|
-
OAuthTokenService =
|
|
152505
|
+
OAuthTokenService = __decorate17([
|
|
152448
152506
|
W(),
|
|
152449
|
-
|
|
152450
|
-
|
|
152451
|
-
|
|
152507
|
+
__param14(0, U(LoggerService)),
|
|
152508
|
+
__param14(1, U(NatsService)),
|
|
152509
|
+
__metadata17("design:paramtypes", [typeof (_a40 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a40 : Object, typeof (_b30 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b30 : Object])
|
|
152452
152510
|
], OAuthTokenService);
|
|
152453
152511
|
|
|
152454
152512
|
// src/services/oauth-client-info.service.ts
|
|
152455
|
-
var
|
|
152513
|
+
var __decorate18 = function(decorators, target, key, desc) {
|
|
152456
152514
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
152457
152515
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
152458
152516
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
152459
152517
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
152460
152518
|
};
|
|
152461
|
-
var
|
|
152519
|
+
var __metadata18 = function(k3, v2) {
|
|
152462
152520
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
152463
152521
|
};
|
|
152464
|
-
var
|
|
152522
|
+
var __param15 = function(paramIndex, decorator) {
|
|
152465
152523
|
return function(target, key) {
|
|
152466
152524
|
decorator(target, key, paramIndex);
|
|
152467
152525
|
};
|
|
152468
152526
|
};
|
|
152469
|
-
var
|
|
152470
|
-
var
|
|
152527
|
+
var _a41;
|
|
152528
|
+
var _b31;
|
|
152471
152529
|
var CACHE_TTL_MS = 10 * 60 * 1e3;
|
|
152472
152530
|
var CACHE_MAX_SIZE = 100;
|
|
152473
152531
|
var OAuthClientInfoService = class OAuthClientInfoService2 {
|
|
@@ -152526,38 +152584,38 @@ var OAuthClientInfoService = class OAuthClientInfoService2 {
|
|
|
152526
152584
|
}
|
|
152527
152585
|
}
|
|
152528
152586
|
};
|
|
152529
|
-
OAuthClientInfoService =
|
|
152587
|
+
OAuthClientInfoService = __decorate18([
|
|
152530
152588
|
W(),
|
|
152531
|
-
|
|
152532
|
-
|
|
152533
|
-
|
|
152589
|
+
__param15(0, U(LoggerService)),
|
|
152590
|
+
__param15(1, U(NatsService)),
|
|
152591
|
+
__metadata18("design:paramtypes", [typeof (_a41 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a41 : Object, typeof (_b31 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b31 : Object])
|
|
152534
152592
|
], OAuthClientInfoService);
|
|
152535
152593
|
|
|
152536
152594
|
// src/services/tool.service.ts
|
|
152537
|
-
var
|
|
152595
|
+
var __decorate19 = function(decorators, target, key, desc) {
|
|
152538
152596
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
152539
152597
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
152540
152598
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
152541
152599
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
152542
152600
|
};
|
|
152543
|
-
var
|
|
152601
|
+
var __metadata19 = function(k3, v2) {
|
|
152544
152602
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
152545
152603
|
};
|
|
152546
|
-
var
|
|
152604
|
+
var __param16 = function(paramIndex, decorator) {
|
|
152547
152605
|
return function(target, key) {
|
|
152548
152606
|
decorator(target, key, paramIndex);
|
|
152549
152607
|
};
|
|
152550
152608
|
};
|
|
152551
|
-
var
|
|
152552
|
-
var
|
|
152553
|
-
var
|
|
152609
|
+
var _a44;
|
|
152610
|
+
var _b33;
|
|
152611
|
+
var _c8;
|
|
152554
152612
|
var _d6;
|
|
152555
152613
|
var _e5;
|
|
152556
152614
|
var _f;
|
|
152557
152615
|
var _g4;
|
|
152558
152616
|
var _j;
|
|
152559
152617
|
var ToolService = class ToolService2 extends Service {
|
|
152560
|
-
constructor(loggerService, natsService, cacheService, authService, healthService, toolServerServiceFactory, oauthTokenService, oauthClientInfoService, mcpStdioService, runtimeExecutionId, scriptExecutorService) {
|
|
152618
|
+
constructor(loggerService, natsService, cacheService, authService, healthService, toolServerServiceFactory, oauthTokenService, oauthClientInfoService, mcpStdioService, runtimeExecutionId, scriptExecutorService, delegateService) {
|
|
152561
152619
|
super();
|
|
152562
152620
|
this.loggerService = loggerService;
|
|
152563
152621
|
this.natsService = natsService;
|
|
@@ -152570,6 +152628,7 @@ var ToolService = class ToolService2 extends Service {
|
|
|
152570
152628
|
this.mcpStdioService = mcpStdioService;
|
|
152571
152629
|
this.runtimeExecutionId = runtimeExecutionId;
|
|
152572
152630
|
this.scriptExecutorService = scriptExecutorService;
|
|
152631
|
+
this.delegateService = delegateService;
|
|
152573
152632
|
this.name = "tool";
|
|
152574
152633
|
this.natsSubscriptions = [];
|
|
152575
152634
|
this.cacheSubscriptions = [];
|
|
@@ -153079,7 +153138,7 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153079
153138
|
sdkBundleContent: sdkBundle,
|
|
153080
153139
|
toolCallTimeout: MCP_CALL_TOOL_TIMEOUT,
|
|
153081
153140
|
onRequest: async (method, params) => {
|
|
153082
|
-
return this.handleScriptIpcRequest(method, params, workspaceId, msg.data.userId, msg.data.userKey, identity?.id ?? void 0);
|
|
153141
|
+
return this.handleScriptIpcRequest(method, params, workspaceId, msg.data.userId, msg.data.userKey, identity?.id ?? void 0, msg.data.delegateDepth);
|
|
153083
153142
|
}
|
|
153084
153143
|
});
|
|
153085
153144
|
} else {
|
|
@@ -153120,9 +153179,9 @@ ${errorOutput}`;
|
|
|
153120
153179
|
}
|
|
153121
153180
|
/**
|
|
153122
153181
|
* Handle a JSON-RPC request from an interactive script.
|
|
153123
|
-
* Routes tool calls
|
|
153182
|
+
* Routes tool calls and delegate requests to the appropriate service.
|
|
153124
153183
|
*/
|
|
153125
|
-
async handleScriptIpcRequest(method, params, workspaceId, userId, userKey, runtimeId) {
|
|
153184
|
+
async handleScriptIpcRequest(method, params, workspaceId, userId, userKey, runtimeId, delegateDepth) {
|
|
153126
153185
|
switch (method) {
|
|
153127
153186
|
case "tools/call": {
|
|
153128
153187
|
if (!params || typeof params !== "object" || typeof params.name !== "string") {
|
|
@@ -153131,10 +153190,38 @@ ${errorOutput}`;
|
|
|
153131
153190
|
const { name: name21, arguments: toolArgs } = params;
|
|
153132
153191
|
return this.routeScriptToolCall(name21, toolArgs ?? {}, workspaceId, userId, userKey, runtimeId);
|
|
153133
153192
|
}
|
|
153193
|
+
case "delegate": {
|
|
153194
|
+
if (!params || typeof params !== "object" || typeof params.context !== "string") {
|
|
153195
|
+
throw new Error("Invalid delegate params: expected { context: string, model?: string, temperature?: number }");
|
|
153196
|
+
}
|
|
153197
|
+
const { context: context2, model, temperature } = params;
|
|
153198
|
+
return this.handleScriptDelegate(context2, model, temperature, workspaceId, userKey, delegateDepth);
|
|
153199
|
+
}
|
|
153134
153200
|
default:
|
|
153135
153201
|
throw new Error(`Unknown script IPC method: ${method}`);
|
|
153136
153202
|
}
|
|
153137
153203
|
}
|
|
153204
|
+
/**
|
|
153205
|
+
* Handle a delegate request from a TypeScript script via JSON-RPC IPC.
|
|
153206
|
+
* Spawns a sub-agent using DelegateService and returns the result as a CallToolResult.
|
|
153207
|
+
*/
|
|
153208
|
+
async handleScriptDelegate(context2, model, temperature, workspaceId, userKey, delegateDepth) {
|
|
153209
|
+
if (!this.delegateService) {
|
|
153210
|
+
this.logger.warn({ event: "delegate_service_unavailable" }, "Delegate requested but DelegateService not injected");
|
|
153211
|
+
return {
|
|
153212
|
+
content: [{ type: "text", text: "Error: Delegate service is not available. Ensure the runtime is configured with AI provider support." }],
|
|
153213
|
+
isError: true
|
|
153214
|
+
};
|
|
153215
|
+
}
|
|
153216
|
+
return this.delegateService.execute({
|
|
153217
|
+
context: context2,
|
|
153218
|
+
model,
|
|
153219
|
+
temperature,
|
|
153220
|
+
workspaceId,
|
|
153221
|
+
userKey,
|
|
153222
|
+
delegateDepth: delegateDepth ?? 0
|
|
153223
|
+
});
|
|
153224
|
+
}
|
|
153138
153225
|
/**
|
|
153139
153226
|
* Route a tool call from a script to the appropriate MCP server via NATS.
|
|
153140
153227
|
*/
|
|
@@ -153324,41 +153411,43 @@ ${errorOutput}`;
|
|
|
153324
153411
|
return false;
|
|
153325
153412
|
}
|
|
153326
153413
|
};
|
|
153327
|
-
ToolService =
|
|
153414
|
+
ToolService = __decorate19([
|
|
153328
153415
|
W(),
|
|
153329
|
-
|
|
153330
|
-
|
|
153331
|
-
|
|
153332
|
-
|
|
153333
|
-
|
|
153334
|
-
|
|
153335
|
-
|
|
153336
|
-
|
|
153337
|
-
|
|
153338
|
-
|
|
153339
|
-
|
|
153340
|
-
|
|
153341
|
-
|
|
153416
|
+
__param16(0, U(LoggerService)),
|
|
153417
|
+
__param16(1, U(NatsService)),
|
|
153418
|
+
__param16(2, U(NatsCacheService)),
|
|
153419
|
+
__param16(3, U(AuthService)),
|
|
153420
|
+
__param16(4, U(HealthService)),
|
|
153421
|
+
__param16(5, U(ToolServerService)),
|
|
153422
|
+
__param16(6, U(OAuthTokenService)),
|
|
153423
|
+
__param16(7, U(OAuthClientInfoService)),
|
|
153424
|
+
__param16(8, U(McpStdioService)),
|
|
153425
|
+
__param16(8, se()),
|
|
153426
|
+
__param16(9, U(RUNTIME_EXECUTION_ID)),
|
|
153427
|
+
__param16(10, U(ScriptExecutorService)),
|
|
153428
|
+
__param16(11, U(DelegateService)),
|
|
153429
|
+
__param16(11, se()),
|
|
153430
|
+
__metadata19("design:paramtypes", [typeof (_a44 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a44 : Object, typeof (_b33 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b33 : Object, typeof (_c8 = typeof NatsCacheService !== "undefined" && NatsCacheService) === "function" ? _c8 : Object, typeof (_d6 = typeof AuthService !== "undefined" && AuthService) === "function" ? _d6 : Object, typeof (_e5 = typeof HealthService !== "undefined" && HealthService) === "function" ? _e5 : Object, Object, typeof (_f = typeof OAuthTokenService !== "undefined" && OAuthTokenService) === "function" ? _f : Object, typeof (_g4 = typeof OAuthClientInfoService !== "undefined" && OAuthClientInfoService) === "function" ? _g4 : Object, Object, String, typeof (_j = typeof ScriptExecutorService !== "undefined" && ScriptExecutorService) === "function" ? _j : Object, Object])
|
|
153342
153431
|
], ToolService);
|
|
153343
153432
|
|
|
153344
153433
|
// src/services/runtime.main.service.ts
|
|
153345
|
-
var
|
|
153434
|
+
var __decorate20 = function(decorators, target, key, desc) {
|
|
153346
153435
|
var c3 = arguments.length, r2 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d2;
|
|
153347
153436
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
153348
153437
|
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d2 = decorators[i2]) r2 = (c3 < 3 ? d2(r2) : c3 > 3 ? d2(target, key, r2) : d2(target, key)) || r2;
|
|
153349
153438
|
return c3 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
153350
153439
|
};
|
|
153351
|
-
var
|
|
153440
|
+
var __metadata20 = function(k3, v2) {
|
|
153352
153441
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k3, v2);
|
|
153353
153442
|
};
|
|
153354
|
-
var
|
|
153443
|
+
var __param17 = function(paramIndex, decorator) {
|
|
153355
153444
|
return function(target, key) {
|
|
153356
153445
|
decorator(target, key, paramIndex);
|
|
153357
153446
|
};
|
|
153358
153447
|
};
|
|
153359
|
-
var
|
|
153360
|
-
var
|
|
153361
|
-
var
|
|
153448
|
+
var _a45;
|
|
153449
|
+
var _b34;
|
|
153450
|
+
var _c9;
|
|
153362
153451
|
var _d7;
|
|
153363
153452
|
var _k;
|
|
153364
153453
|
var MainService = class MainService2 extends Service {
|
|
@@ -153617,25 +153706,25 @@ var MainService = class MainService2 extends Service {
|
|
|
153617
153706
|
}
|
|
153618
153707
|
}
|
|
153619
153708
|
};
|
|
153620
|
-
MainService =
|
|
153709
|
+
MainService = __decorate20([
|
|
153621
153710
|
W(),
|
|
153622
|
-
|
|
153623
|
-
|
|
153624
|
-
|
|
153625
|
-
|
|
153626
|
-
|
|
153627
|
-
|
|
153628
|
-
|
|
153629
|
-
|
|
153630
|
-
|
|
153631
|
-
|
|
153632
|
-
|
|
153633
|
-
|
|
153634
|
-
|
|
153635
|
-
|
|
153636
|
-
|
|
153637
|
-
|
|
153638
|
-
|
|
153711
|
+
__param17(0, U(LoggerService)),
|
|
153712
|
+
__param17(1, U(NatsService)),
|
|
153713
|
+
__param17(2, U(AuthService)),
|
|
153714
|
+
__param17(3, U(HealthService)),
|
|
153715
|
+
__param17(4, U(RUNTIME_MODE)),
|
|
153716
|
+
__param17(5, U(McpStdioService)),
|
|
153717
|
+
__param17(5, se()),
|
|
153718
|
+
__param17(6, U(FastifyManagerService)),
|
|
153719
|
+
__param17(6, se()),
|
|
153720
|
+
__param17(7, U(McpSseService)),
|
|
153721
|
+
__param17(7, se()),
|
|
153722
|
+
__param17(8, U(McpStreamableService)),
|
|
153723
|
+
__param17(8, se()),
|
|
153724
|
+
__param17(9, U(ToolService)),
|
|
153725
|
+
__param17(9, se()),
|
|
153726
|
+
__param17(10, U(FileService)),
|
|
153727
|
+
__metadata20("design:paramtypes", [typeof (_a45 = typeof LoggerService !== "undefined" && LoggerService) === "function" ? _a45 : Object, typeof (_b34 = typeof NatsService !== "undefined" && NatsService) === "function" ? _b34 : Object, typeof (_c9 = typeof AuthService !== "undefined" && AuthService) === "function" ? _c9 : Object, typeof (_d7 = typeof HealthService !== "undefined" && HealthService) === "function" ? _d7 : Object, Object, Object, Object, Object, Object, Object, typeof (_k = typeof FileService !== "undefined" && FileService) === "function" ? _k : Object])
|
|
153639
153728
|
], MainService);
|
|
153640
153729
|
|
|
153641
153730
|
// src/di/container.ts
|
|
@@ -153732,6 +153821,7 @@ var start = () => {
|
|
|
153732
153821
|
container.bind(OAuthTokenService).toSelf().inSingletonScope();
|
|
153733
153822
|
container.bind(OAuthClientInfoService).toSelf().inSingletonScope();
|
|
153734
153823
|
container.bind(ScriptExecutorService).toSelf().inSingletonScope();
|
|
153824
|
+
container.bind(DelegateService).toSelf().inSingletonScope();
|
|
153735
153825
|
container.bind(HEARTBEAT_INTERVAL).toConstantValue(process.env.HEARTBEAT_INTERVAL || "5000");
|
|
153736
153826
|
container.bind(HealthService).toSelf().inSingletonScope();
|
|
153737
153827
|
container.bind(MainService).toSelf().inSingletonScope();
|