@skilder-ai/runtime 0.6.0 → 0.6.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 +262 -181
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3327,14 +3327,14 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
3327
3327
|
if (args[a3] === void 0) break;
|
|
3328
3328
|
if (lastPos < i2)
|
|
3329
3329
|
str += f2.slice(lastPos, i2);
|
|
3330
|
-
var
|
|
3331
|
-
if (
|
|
3330
|
+
var type18 = typeof args[a3];
|
|
3331
|
+
if (type18 === "string") {
|
|
3332
3332
|
str += "'" + args[a3] + "'";
|
|
3333
3333
|
lastPos = i2 + 2;
|
|
3334
3334
|
i2++;
|
|
3335
3335
|
break;
|
|
3336
3336
|
}
|
|
3337
|
-
if (
|
|
3337
|
+
if (type18 === "function") {
|
|
3338
3338
|
str += args[a3].name || "<anonymous>";
|
|
3339
3339
|
lastPos = i2 + 2;
|
|
3340
3340
|
i2++;
|
|
@@ -7506,8 +7506,8 @@ var require_cjs = __commonJS({
|
|
|
7506
7506
|
if (stringTag) {
|
|
7507
7507
|
return stringTag;
|
|
7508
7508
|
}
|
|
7509
|
-
const
|
|
7510
|
-
return
|
|
7509
|
+
const type18 = toStringObject.call(value);
|
|
7510
|
+
return type18.substring(8, type18.length - 1);
|
|
7511
7511
|
}
|
|
7512
7512
|
var { hasOwnProperty, propertyIsEnumerable } = Object.prototype;
|
|
7513
7513
|
function copyOwnDescriptor(original, clone2, property, state) {
|
|
@@ -25243,8 +25243,8 @@ var require_applicability = __commonJS({
|
|
|
25243
25243
|
"use strict";
|
|
25244
25244
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25245
25245
|
exports2.shouldUseRule = exports2.shouldUseGroup = exports2.schemaHasRulesForType = void 0;
|
|
25246
|
-
function schemaHasRulesForType({ schema, self: self2 },
|
|
25247
|
-
const group = self2.RULES.types[
|
|
25246
|
+
function schemaHasRulesForType({ schema, self: self2 }, type18) {
|
|
25247
|
+
const group = self2.RULES.types[type18];
|
|
25248
25248
|
return group && group !== true && shouldUseGroup(schema, group);
|
|
25249
25249
|
}
|
|
25250
25250
|
exports2.schemaHasRulesForType = schemaHasRulesForType;
|
|
@@ -26345,9 +26345,9 @@ var require_validate = __commonJS({
|
|
|
26345
26345
|
for (const keyword in rules) {
|
|
26346
26346
|
const rule = rules[keyword];
|
|
26347
26347
|
if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it2.schema, rule)) {
|
|
26348
|
-
const { type:
|
|
26349
|
-
if (
|
|
26350
|
-
strictTypesError(it2, `missing type "${
|
|
26348
|
+
const { type: type18 } = rule.definition;
|
|
26349
|
+
if (type18.length && !type18.some((t4) => hasApplicableType(ts, t4))) {
|
|
26350
|
+
strictTypesError(it2, `missing type "${type18.join(",")}" for keyword "${keyword}"`);
|
|
26351
26351
|
}
|
|
26352
26352
|
}
|
|
26353
26353
|
}
|
|
@@ -42769,7 +42769,7 @@ var require_server = __commonJS({
|
|
|
42769
42769
|
session.once("close", function() {
|
|
42770
42770
|
http2Server[kHttp2ServerSessions].delete(session);
|
|
42771
42771
|
});
|
|
42772
|
-
session.once("frameError", function(
|
|
42772
|
+
session.once("frameError", function(type18, code, streamId) {
|
|
42773
42773
|
if (streamId === 0) {
|
|
42774
42774
|
http2Server[kHttp2ServerSessions].delete(session);
|
|
42775
42775
|
}
|
|
@@ -44613,8 +44613,8 @@ var require_reply = __commonJS({
|
|
|
44613
44613
|
this[kReplySerializer] = fn;
|
|
44614
44614
|
return this;
|
|
44615
44615
|
};
|
|
44616
|
-
Reply.prototype.type = function(
|
|
44617
|
-
this[kReplyHeaders]["content-type"] =
|
|
44616
|
+
Reply.prototype.type = function(type18) {
|
|
44617
|
+
this[kReplyHeaders]["content-type"] = type18;
|
|
44618
44618
|
return this;
|
|
44619
44619
|
};
|
|
44620
44620
|
Reply.prototype.redirect = function(url2, code) {
|
|
@@ -47364,7 +47364,7 @@ var require_content_type_parser = __commonJS({
|
|
|
47364
47364
|
if (!opts) opts = {};
|
|
47365
47365
|
if (!opts.bodyLimit) opts.bodyLimit = this[kBodyLimit];
|
|
47366
47366
|
if (Array.isArray(contentType2)) {
|
|
47367
|
-
contentType2.forEach((
|
|
47367
|
+
contentType2.forEach((type18) => this[kContentTypeParser].add(type18, opts, parser));
|
|
47368
47368
|
} else {
|
|
47369
47369
|
this[kContentTypeParser].add(contentType2, opts, parser);
|
|
47370
47370
|
}
|
|
@@ -47378,8 +47378,8 @@ var require_content_type_parser = __commonJS({
|
|
|
47378
47378
|
throw new FST_ERR_CTP_INSTANCE_ALREADY_STARTED("removeContentTypeParser");
|
|
47379
47379
|
}
|
|
47380
47380
|
if (Array.isArray(contentType2)) {
|
|
47381
|
-
for (const
|
|
47382
|
-
this[kContentTypeParser].remove(
|
|
47381
|
+
for (const type18 of contentType2) {
|
|
47382
|
+
this[kContentTypeParser].remove(type18);
|
|
47383
47383
|
}
|
|
47384
47384
|
} else {
|
|
47385
47385
|
this[kContentTypeParser].remove(contentType2);
|
|
@@ -49908,9 +49908,9 @@ ${contextFunctionCode}`,
|
|
|
49908
49908
|
context.functions.push(functionCode);
|
|
49909
49909
|
return functionName;
|
|
49910
49910
|
}
|
|
49911
|
-
function buildArrayTypeCondition(
|
|
49911
|
+
function buildArrayTypeCondition(type18, accessor) {
|
|
49912
49912
|
let condition;
|
|
49913
|
-
switch (
|
|
49913
|
+
switch (type18) {
|
|
49914
49914
|
case "null":
|
|
49915
49915
|
condition = "value === null";
|
|
49916
49916
|
break;
|
|
@@ -49941,8 +49941,8 @@ ${contextFunctionCode}`,
|
|
|
49941
49941
|
condition = "Array.isArray(value)";
|
|
49942
49942
|
break;
|
|
49943
49943
|
default:
|
|
49944
|
-
if (Array.isArray(
|
|
49945
|
-
const conditions =
|
|
49944
|
+
if (Array.isArray(type18)) {
|
|
49945
|
+
const conditions = type18.map((subType) => {
|
|
49946
49946
|
return buildArrayTypeCondition(subType, accessor);
|
|
49947
49947
|
});
|
|
49948
49948
|
condition = `(${conditions.join(" || ")})`;
|
|
@@ -49957,11 +49957,11 @@ ${contextFunctionCode}`,
|
|
|
49957
49957
|
const schema = location.schema;
|
|
49958
49958
|
const types = schema.type.sort((t1) => t1 === "null" ? -1 : 1);
|
|
49959
49959
|
let code = "";
|
|
49960
|
-
types.forEach((
|
|
49961
|
-
location.schema = { ...location.schema, type:
|
|
49960
|
+
types.forEach((type18, index) => {
|
|
49961
|
+
location.schema = { ...location.schema, type: type18 };
|
|
49962
49962
|
const nestedResult = buildSingleTypeSerializer(context, location, input);
|
|
49963
49963
|
const statement = index === 0 ? "if" : "else if";
|
|
49964
|
-
switch (
|
|
49964
|
+
switch (type18) {
|
|
49965
49965
|
case "null":
|
|
49966
49966
|
code += `
|
|
49967
49967
|
${statement} (${input} === null)
|
|
@@ -50001,7 +50001,7 @@ ${contextFunctionCode}`,
|
|
|
50001
50001
|
}
|
|
50002
50002
|
default: {
|
|
50003
50003
|
code += `
|
|
50004
|
-
${statement}(typeof ${input} === "${
|
|
50004
|
+
${statement}(typeof ${input} === "${type18}" || ${input} === null)
|
|
50005
50005
|
${nestedResult}
|
|
50006
50006
|
`;
|
|
50007
50007
|
break;
|
|
@@ -50071,8 +50071,8 @@ ${contextFunctionCode}`,
|
|
|
50071
50071
|
}
|
|
50072
50072
|
function buildConstSerializer(location, input) {
|
|
50073
50073
|
const schema = location.schema;
|
|
50074
|
-
const
|
|
50075
|
-
const hasNullType = Array.isArray(
|
|
50074
|
+
const type18 = schema.type;
|
|
50075
|
+
const hasNullType = Array.isArray(type18) && type18.includes("null");
|
|
50076
50076
|
let code = "";
|
|
50077
50077
|
if (hasNullType) {
|
|
50078
50078
|
code += `
|
|
@@ -50116,14 +50116,14 @@ ${contextFunctionCode}`,
|
|
|
50116
50116
|
function buildOneOf(context, location, input) {
|
|
50117
50117
|
context.validatorSchemasIds.add(location.schemaId);
|
|
50118
50118
|
const schema = location.schema;
|
|
50119
|
-
const
|
|
50120
|
-
const { [
|
|
50119
|
+
const type18 = schema.anyOf ? "anyOf" : "oneOf";
|
|
50120
|
+
const { [type18]: oneOfs, ...schemaWithoutAnyOf } = location.schema;
|
|
50121
50121
|
const locationWithoutOneOf = new Location(
|
|
50122
50122
|
schemaWithoutAnyOf,
|
|
50123
50123
|
location.schemaId,
|
|
50124
50124
|
location.jsonPointer
|
|
50125
50125
|
);
|
|
50126
|
-
const oneOfsLocation = location.getPropertyLocation(
|
|
50126
|
+
const oneOfsLocation = location.getPropertyLocation(type18);
|
|
50127
50127
|
let code = "";
|
|
50128
50128
|
for (let index = 0; index < oneOfs.length; index++) {
|
|
50129
50129
|
const optionLocation = oneOfsLocation.getPropertyLocation(index);
|
|
@@ -50239,7 +50239,7 @@ ${contextFunctionCode}`,
|
|
|
50239
50239
|
}
|
|
50240
50240
|
}
|
|
50241
50241
|
let code = "";
|
|
50242
|
-
const
|
|
50242
|
+
const type18 = schema.type;
|
|
50243
50243
|
const nullable2 = schema.nullable === true;
|
|
50244
50244
|
if (nullable2) {
|
|
50245
50245
|
code += `
|
|
@@ -50250,7 +50250,7 @@ ${contextFunctionCode}`,
|
|
|
50250
50250
|
}
|
|
50251
50251
|
if (schema.const !== void 0) {
|
|
50252
50252
|
code += buildConstSerializer(location, input);
|
|
50253
|
-
} else if (Array.isArray(
|
|
50253
|
+
} else if (Array.isArray(type18)) {
|
|
50254
50254
|
code += buildMultiTypeSerializer(context, location, input);
|
|
50255
50255
|
} else {
|
|
50256
50256
|
code += buildSingleTypeSerializer(context, location, input);
|
|
@@ -54909,9 +54909,9 @@ var require_fast_decode_uri_component = __commonJS({
|
|
|
54909
54909
|
var high = hexCodeToInt(uri[percentPosition + 1], 4);
|
|
54910
54910
|
var low = hexCodeToInt(uri[percentPosition + 2], 0);
|
|
54911
54911
|
var byte = high | low;
|
|
54912
|
-
var
|
|
54913
|
-
state = UTF8_DATA[256 + state +
|
|
54914
|
-
codepoint = codepoint << 6 | byte & UTF8_DATA[364 +
|
|
54912
|
+
var type18 = UTF8_DATA[byte];
|
|
54913
|
+
state = UTF8_DATA[256 + state + type18];
|
|
54914
|
+
codepoint = codepoint << 6 | byte & UTF8_DATA[364 + type18];
|
|
54915
54915
|
if (state === UTF8_ACCEPT) {
|
|
54916
54916
|
decoded += uri.slice(last, startOfOctets);
|
|
54917
54917
|
decoded += codepoint <= 65535 ? String.fromCharCode(codepoint) : String.fromCharCode(
|
|
@@ -55252,14 +55252,14 @@ var require_stringify = __commonJS({
|
|
|
55252
55252
|
"use strict";
|
|
55253
55253
|
var { encodeString } = require_querystring();
|
|
55254
55254
|
function getAsPrimitive(value) {
|
|
55255
|
-
const
|
|
55256
|
-
if (
|
|
55255
|
+
const type18 = typeof value;
|
|
55256
|
+
if (type18 === "string") {
|
|
55257
55257
|
return encodeString(value);
|
|
55258
|
-
} else if (
|
|
55258
|
+
} else if (type18 === "bigint") {
|
|
55259
55259
|
return value.toString();
|
|
55260
|
-
} else if (
|
|
55260
|
+
} else if (type18 === "boolean") {
|
|
55261
55261
|
return value ? "true" : "false";
|
|
55262
|
-
} else if (
|
|
55262
|
+
} else if (type18 === "number" && Number.isFinite(value)) {
|
|
55263
55263
|
return value < 1e21 ? "" + value : encodeString("" + value);
|
|
55264
55264
|
}
|
|
55265
55265
|
return "";
|
|
@@ -56097,11 +56097,11 @@ var require_http_method = __commonJS({
|
|
|
56097
56097
|
storage: function() {
|
|
56098
56098
|
const handlers = /* @__PURE__ */ new Map();
|
|
56099
56099
|
return {
|
|
56100
|
-
get: (
|
|
56101
|
-
return handlers.get(
|
|
56100
|
+
get: (type18) => {
|
|
56101
|
+
return handlers.get(type18) || null;
|
|
56102
56102
|
},
|
|
56103
|
-
set: (
|
|
56104
|
-
handlers.set(
|
|
56103
|
+
set: (type18, store) => {
|
|
56104
|
+
handlers.set(type18, store);
|
|
56105
56105
|
}
|
|
56106
56106
|
};
|
|
56107
56107
|
},
|
|
@@ -62884,8 +62884,8 @@ var require_depd = __commonJS({
|
|
|
62884
62884
|
deprecate.property = wrapproperty;
|
|
62885
62885
|
return deprecate;
|
|
62886
62886
|
}
|
|
62887
|
-
function eehaslisteners(emitter,
|
|
62888
|
-
var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(
|
|
62887
|
+
function eehaslisteners(emitter, type18) {
|
|
62888
|
+
var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type18).length : emitter.listenerCount(type18);
|
|
62889
62889
|
return count > 0;
|
|
62890
62890
|
}
|
|
62891
62891
|
function isignored(namespace) {
|
|
@@ -63365,18 +63365,18 @@ var require_http_errors = __commonJS({
|
|
|
63365
63365
|
var props = {};
|
|
63366
63366
|
for (var i2 = 0; i2 < arguments.length; i2++) {
|
|
63367
63367
|
var arg = arguments[i2];
|
|
63368
|
-
var
|
|
63369
|
-
if (
|
|
63368
|
+
var type18 = typeof arg;
|
|
63369
|
+
if (type18 === "object" && arg instanceof Error) {
|
|
63370
63370
|
err = arg;
|
|
63371
63371
|
status = err.status || err.statusCode || status;
|
|
63372
|
-
} else if (
|
|
63372
|
+
} else if (type18 === "number" && i2 === 0) {
|
|
63373
63373
|
status = arg;
|
|
63374
|
-
} else if (
|
|
63374
|
+
} else if (type18 === "string") {
|
|
63375
63375
|
msg = arg;
|
|
63376
|
-
} else if (
|
|
63376
|
+
} else if (type18 === "object") {
|
|
63377
63377
|
props = arg;
|
|
63378
63378
|
} else {
|
|
63379
|
-
throw new TypeError("argument #" + (i2 + 1) + " unsupported type " +
|
|
63379
|
+
throw new TypeError("argument #" + (i2 + 1) + " unsupported type " + type18);
|
|
63380
63380
|
}
|
|
63381
63381
|
}
|
|
63382
63382
|
if (typeof status === "number" && (status < 400 || status >= 600)) {
|
|
@@ -67533,11 +67533,11 @@ var require_content_type = __commonJS({
|
|
|
67533
67533
|
throw new TypeError("argument obj is required");
|
|
67534
67534
|
}
|
|
67535
67535
|
var parameters = obj.parameters;
|
|
67536
|
-
var
|
|
67537
|
-
if (!
|
|
67536
|
+
var type18 = obj.type;
|
|
67537
|
+
if (!type18 || !TYPE_REGEXP.test(type18)) {
|
|
67538
67538
|
throw new TypeError("invalid type");
|
|
67539
67539
|
}
|
|
67540
|
-
var string4 =
|
|
67540
|
+
var string4 = type18;
|
|
67541
67541
|
if (parameters && typeof parameters === "object") {
|
|
67542
67542
|
var param;
|
|
67543
67543
|
var params = Object.keys(parameters).sort();
|
|
@@ -67560,11 +67560,11 @@ var require_content_type = __commonJS({
|
|
|
67560
67560
|
throw new TypeError("argument string is required to be a string");
|
|
67561
67561
|
}
|
|
67562
67562
|
var index = header.indexOf(";");
|
|
67563
|
-
var
|
|
67564
|
-
if (!TYPE_REGEXP.test(
|
|
67563
|
+
var type18 = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
67564
|
+
if (!TYPE_REGEXP.test(type18)) {
|
|
67565
67565
|
throw new TypeError("invalid media type");
|
|
67566
67566
|
}
|
|
67567
|
-
var obj = new ContentType(
|
|
67567
|
+
var obj = new ContentType(type18.toLowerCase());
|
|
67568
67568
|
if (index !== -1) {
|
|
67569
67569
|
var key;
|
|
67570
67570
|
var match;
|
|
@@ -67613,9 +67613,9 @@ var require_content_type = __commonJS({
|
|
|
67613
67613
|
}
|
|
67614
67614
|
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
67615
67615
|
}
|
|
67616
|
-
function ContentType(
|
|
67616
|
+
function ContentType(type18) {
|
|
67617
67617
|
this.parameters = /* @__PURE__ */ Object.create(null);
|
|
67618
|
-
this.type =
|
|
67618
|
+
this.type = type18;
|
|
67619
67619
|
}
|
|
67620
67620
|
}
|
|
67621
67621
|
});
|
|
@@ -83829,9 +83829,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
83829
83829
|
if (schema.const !== void 0) {
|
|
83830
83830
|
return z3.literal(schema.const);
|
|
83831
83831
|
}
|
|
83832
|
-
const
|
|
83833
|
-
if (Array.isArray(
|
|
83834
|
-
const typeSchemas =
|
|
83832
|
+
const type18 = schema.type;
|
|
83833
|
+
if (Array.isArray(type18)) {
|
|
83834
|
+
const typeSchemas = type18.map((t4) => {
|
|
83835
83835
|
const typeSchema = { ...schema, type: t4 };
|
|
83836
83836
|
return convertBaseSchema(typeSchema, ctx);
|
|
83837
83837
|
});
|
|
@@ -83843,11 +83843,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
83843
83843
|
}
|
|
83844
83844
|
return z3.union(typeSchemas);
|
|
83845
83845
|
}
|
|
83846
|
-
if (!
|
|
83846
|
+
if (!type18) {
|
|
83847
83847
|
return z3.any();
|
|
83848
83848
|
}
|
|
83849
83849
|
let zodSchema2;
|
|
83850
|
-
switch (
|
|
83850
|
+
switch (type18) {
|
|
83851
83851
|
case "string": {
|
|
83852
83852
|
let stringSchema = z3.string();
|
|
83853
83853
|
if (schema.format) {
|
|
@@ -83914,7 +83914,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
83914
83914
|
}
|
|
83915
83915
|
case "number":
|
|
83916
83916
|
case "integer": {
|
|
83917
|
-
let numberSchema =
|
|
83917
|
+
let numberSchema = type18 === "integer" ? z3.number().int() : z3.number();
|
|
83918
83918
|
if (typeof schema.minimum === "number") {
|
|
83919
83919
|
numberSchema = numberSchema.min(schema.minimum);
|
|
83920
83920
|
}
|
|
@@ -84049,7 +84049,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
84049
84049
|
break;
|
|
84050
84050
|
}
|
|
84051
84051
|
default:
|
|
84052
|
-
throw new Error(`Unsupported type: ${
|
|
84052
|
+
throw new Error(`Unsupported type: ${type18}`);
|
|
84053
84053
|
}
|
|
84054
84054
|
if (schema.description) {
|
|
84055
84055
|
zodSchema2 = zodSchema2.describe(schema.description);
|
|
@@ -84584,7 +84584,10 @@ var NatsMessage = class {
|
|
|
84584
84584
|
}
|
|
84585
84585
|
constructor(data, originalMsg = void 0) {
|
|
84586
84586
|
try {
|
|
84587
|
-
this.validate(data);
|
|
84587
|
+
const isValid2 = this.validate(data);
|
|
84588
|
+
if (!isValid2) {
|
|
84589
|
+
throw new Error(`validation failed for type '${this.constructor.type}'`);
|
|
84590
|
+
}
|
|
84588
84591
|
} catch (error48) {
|
|
84589
84592
|
throw new Error(`Invalid message data: ${error48}`);
|
|
84590
84593
|
}
|
|
@@ -84632,7 +84635,11 @@ var NatsMessage = class {
|
|
|
84632
84635
|
}
|
|
84633
84636
|
return message;
|
|
84634
84637
|
} catch (error48) {
|
|
84635
|
-
|
|
84638
|
+
try {
|
|
84639
|
+
return this.getError(`Invalid message ${data.type}: ${error48}`);
|
|
84640
|
+
} catch {
|
|
84641
|
+
throw new Error(`Invalid message ${data.type}: ${error48}`);
|
|
84642
|
+
}
|
|
84636
84643
|
}
|
|
84637
84644
|
}
|
|
84638
84645
|
/**
|
|
@@ -84653,7 +84660,11 @@ var NatsMessage = class {
|
|
|
84653
84660
|
}
|
|
84654
84661
|
return message;
|
|
84655
84662
|
} catch (error48) {
|
|
84656
|
-
|
|
84663
|
+
try {
|
|
84664
|
+
return this.getError(`Invalid message ${rawData.type}: ${error48}`);
|
|
84665
|
+
} catch {
|
|
84666
|
+
throw new Error(`Invalid message ${rawData.type}: ${error48}`);
|
|
84667
|
+
}
|
|
84657
84668
|
}
|
|
84658
84669
|
}
|
|
84659
84670
|
static getError(message) {
|
|
@@ -87987,33 +87998,33 @@ ZodUnion2.create = (types, params) => {
|
|
|
87987
87998
|
...processCreateParams(params)
|
|
87988
87999
|
});
|
|
87989
88000
|
};
|
|
87990
|
-
var getDiscriminator = (
|
|
87991
|
-
if (
|
|
87992
|
-
return getDiscriminator(
|
|
87993
|
-
} else if (
|
|
87994
|
-
return getDiscriminator(
|
|
87995
|
-
} else if (
|
|
87996
|
-
return [
|
|
87997
|
-
} else if (
|
|
87998
|
-
return
|
|
87999
|
-
} else if (
|
|
88000
|
-
return util.objectValues(
|
|
88001
|
-
} else if (
|
|
88002
|
-
return getDiscriminator(
|
|
88003
|
-
} else if (
|
|
88001
|
+
var getDiscriminator = (type18) => {
|
|
88002
|
+
if (type18 instanceof ZodLazy2) {
|
|
88003
|
+
return getDiscriminator(type18.schema);
|
|
88004
|
+
} else if (type18 instanceof ZodEffects) {
|
|
88005
|
+
return getDiscriminator(type18.innerType());
|
|
88006
|
+
} else if (type18 instanceof ZodLiteral2) {
|
|
88007
|
+
return [type18.value];
|
|
88008
|
+
} else if (type18 instanceof ZodEnum2) {
|
|
88009
|
+
return type18.options;
|
|
88010
|
+
} else if (type18 instanceof ZodNativeEnum) {
|
|
88011
|
+
return util.objectValues(type18.enum);
|
|
88012
|
+
} else if (type18 instanceof ZodDefault2) {
|
|
88013
|
+
return getDiscriminator(type18._def.innerType);
|
|
88014
|
+
} else if (type18 instanceof ZodUndefined2) {
|
|
88004
88015
|
return [void 0];
|
|
88005
|
-
} else if (
|
|
88016
|
+
} else if (type18 instanceof ZodNull2) {
|
|
88006
88017
|
return [null];
|
|
88007
|
-
} else if (
|
|
88008
|
-
return [void 0, ...getDiscriminator(
|
|
88009
|
-
} else if (
|
|
88010
|
-
return [null, ...getDiscriminator(
|
|
88011
|
-
} else if (
|
|
88012
|
-
return getDiscriminator(
|
|
88013
|
-
} else if (
|
|
88014
|
-
return getDiscriminator(
|
|
88015
|
-
} else if (
|
|
88016
|
-
return getDiscriminator(
|
|
88018
|
+
} else if (type18 instanceof ZodOptional2) {
|
|
88019
|
+
return [void 0, ...getDiscriminator(type18.unwrap())];
|
|
88020
|
+
} else if (type18 instanceof ZodNullable2) {
|
|
88021
|
+
return [null, ...getDiscriminator(type18.unwrap())];
|
|
88022
|
+
} else if (type18 instanceof ZodBranded) {
|
|
88023
|
+
return getDiscriminator(type18.unwrap());
|
|
88024
|
+
} else if (type18 instanceof ZodReadonly2) {
|
|
88025
|
+
return getDiscriminator(type18.unwrap());
|
|
88026
|
+
} else if (type18 instanceof ZodCatch2) {
|
|
88027
|
+
return getDiscriminator(type18._def.innerType);
|
|
88017
88028
|
} else {
|
|
88018
88029
|
return [];
|
|
88019
88030
|
}
|
|
@@ -88073,8 +88084,8 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
|
|
|
88073
88084
|
*/
|
|
88074
88085
|
static create(discriminator, options, params) {
|
|
88075
88086
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
88076
|
-
for (const
|
|
88077
|
-
const discriminatorValues = getDiscriminator(
|
|
88087
|
+
for (const type18 of options) {
|
|
88088
|
+
const discriminatorValues = getDiscriminator(type18.shape[discriminator]);
|
|
88078
88089
|
if (!discriminatorValues.length) {
|
|
88079
88090
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
88080
88091
|
}
|
|
@@ -88082,7 +88093,7 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
|
|
|
88082
88093
|
if (optionsMap.has(value)) {
|
|
88083
88094
|
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
|
|
88084
88095
|
}
|
|
88085
|
-
optionsMap.set(value,
|
|
88096
|
+
optionsMap.set(value, type18);
|
|
88086
88097
|
}
|
|
88087
88098
|
}
|
|
88088
88099
|
return new _ZodDiscriminatedUnion({
|
|
@@ -88893,9 +88904,9 @@ var ZodOptional2 = class extends ZodType2 {
|
|
|
88893
88904
|
return this._def.innerType;
|
|
88894
88905
|
}
|
|
88895
88906
|
};
|
|
88896
|
-
ZodOptional2.create = (
|
|
88907
|
+
ZodOptional2.create = (type18, params) => {
|
|
88897
88908
|
return new ZodOptional2({
|
|
88898
|
-
innerType:
|
|
88909
|
+
innerType: type18,
|
|
88899
88910
|
typeName: ZodFirstPartyTypeKind2.ZodOptional,
|
|
88900
88911
|
...processCreateParams(params)
|
|
88901
88912
|
});
|
|
@@ -88912,9 +88923,9 @@ var ZodNullable2 = class extends ZodType2 {
|
|
|
88912
88923
|
return this._def.innerType;
|
|
88913
88924
|
}
|
|
88914
88925
|
};
|
|
88915
|
-
ZodNullable2.create = (
|
|
88926
|
+
ZodNullable2.create = (type18, params) => {
|
|
88916
88927
|
return new ZodNullable2({
|
|
88917
|
-
innerType:
|
|
88928
|
+
innerType: type18,
|
|
88918
88929
|
typeName: ZodFirstPartyTypeKind2.ZodNullable,
|
|
88919
88930
|
...processCreateParams(params)
|
|
88920
88931
|
});
|
|
@@ -88936,9 +88947,9 @@ var ZodDefault2 = class extends ZodType2 {
|
|
|
88936
88947
|
return this._def.innerType;
|
|
88937
88948
|
}
|
|
88938
88949
|
};
|
|
88939
|
-
ZodDefault2.create = (
|
|
88950
|
+
ZodDefault2.create = (type18, params) => {
|
|
88940
88951
|
return new ZodDefault2({
|
|
88941
|
-
innerType:
|
|
88952
|
+
innerType: type18,
|
|
88942
88953
|
typeName: ZodFirstPartyTypeKind2.ZodDefault,
|
|
88943
88954
|
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
88944
88955
|
...processCreateParams(params)
|
|
@@ -88989,9 +89000,9 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
88989
89000
|
return this._def.innerType;
|
|
88990
89001
|
}
|
|
88991
89002
|
};
|
|
88992
|
-
ZodCatch2.create = (
|
|
89003
|
+
ZodCatch2.create = (type18, params) => {
|
|
88993
89004
|
return new ZodCatch2({
|
|
88994
|
-
innerType:
|
|
89005
|
+
innerType: type18,
|
|
88995
89006
|
typeName: ZodFirstPartyTypeKind2.ZodCatch,
|
|
88996
89007
|
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
88997
89008
|
...processCreateParams(params)
|
|
@@ -89102,9 +89113,9 @@ var ZodReadonly2 = class extends ZodType2 {
|
|
|
89102
89113
|
return this._def.innerType;
|
|
89103
89114
|
}
|
|
89104
89115
|
};
|
|
89105
|
-
ZodReadonly2.create = (
|
|
89116
|
+
ZodReadonly2.create = (type18, params) => {
|
|
89106
89117
|
return new ZodReadonly2({
|
|
89107
|
-
innerType:
|
|
89118
|
+
innerType: type18,
|
|
89108
89119
|
typeName: ZodFirstPartyTypeKind2.ZodReadonly,
|
|
89109
89120
|
...processCreateParams(params)
|
|
89110
89121
|
});
|
|
@@ -90020,9 +90031,9 @@ function parseEnumDef(def) {
|
|
|
90020
90031
|
enum: Array.from(def.values)
|
|
90021
90032
|
};
|
|
90022
90033
|
}
|
|
90023
|
-
var isJsonSchema7AllOfType = (
|
|
90024
|
-
if ("type" in
|
|
90025
|
-
return "allOf" in
|
|
90034
|
+
var isJsonSchema7AllOfType = (type18) => {
|
|
90035
|
+
if ("type" in type18 && type18.type === "string") return false;
|
|
90036
|
+
return "allOf" in type18;
|
|
90026
90037
|
};
|
|
90027
90038
|
function parseIntersectionDef(def, refs) {
|
|
90028
90039
|
const allOf = [
|
|
@@ -90406,7 +90417,7 @@ function parseRecordDef(def, refs) {
|
|
|
90406
90417
|
})) != null ? _a210 : refs.allowedAdditionalProperties
|
|
90407
90418
|
};
|
|
90408
90419
|
if (((_b210 = def.keyType) == null ? void 0 : _b210._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((_c9 = def.keyType._def.checks) == null ? void 0 : _c9.length)) {
|
|
90409
|
-
const { type:
|
|
90420
|
+
const { type: type18, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
90410
90421
|
return {
|
|
90411
90422
|
...schema,
|
|
90412
90423
|
propertyNames: keyType
|
|
@@ -90419,7 +90430,7 @@ function parseRecordDef(def, refs) {
|
|
|
90419
90430
|
}
|
|
90420
90431
|
};
|
|
90421
90432
|
} else if (((_e6 = def.keyType) == null ? void 0 : _e6._def.typeName) === ZodFirstPartyTypeKind2.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind2.ZodString && ((_f5 = def.keyType._def.type._def.checks) == null ? void 0 : _f5.length)) {
|
|
90422
|
-
const { type:
|
|
90433
|
+
const { type: type18, ...keyType } = parseBrandedDef(
|
|
90423
90434
|
def.keyType._def,
|
|
90424
90435
|
refs
|
|
90425
90436
|
);
|
|
@@ -90488,8 +90499,8 @@ function parseUnionDef(def, refs) {
|
|
|
90488
90499
|
(x3) => x3._def.typeName in primitiveMappings && (!x3._def.checks || !x3._def.checks.length)
|
|
90489
90500
|
)) {
|
|
90490
90501
|
const types = options.reduce((types2, x3) => {
|
|
90491
|
-
const
|
|
90492
|
-
return
|
|
90502
|
+
const type18 = primitiveMappings[x3._def.typeName];
|
|
90503
|
+
return type18 && !types2.includes(type18) ? [...types2, type18] : types2;
|
|
90493
90504
|
}, []);
|
|
90494
90505
|
return {
|
|
90495
90506
|
type: types.length > 1 ? types : types[0]
|
|
@@ -90497,12 +90508,12 @@ function parseUnionDef(def, refs) {
|
|
|
90497
90508
|
} else if (options.every((x3) => x3._def.typeName === "ZodLiteral" && !x3.description)) {
|
|
90498
90509
|
const types = options.reduce(
|
|
90499
90510
|
(acc, x3) => {
|
|
90500
|
-
const
|
|
90501
|
-
switch (
|
|
90511
|
+
const type18 = typeof x3._def.value;
|
|
90512
|
+
switch (type18) {
|
|
90502
90513
|
case "string":
|
|
90503
90514
|
case "number":
|
|
90504
90515
|
case "boolean":
|
|
90505
|
-
return [...acc,
|
|
90516
|
+
return [...acc, type18];
|
|
90506
90517
|
case "bigint":
|
|
90507
90518
|
return [...acc, "integer"];
|
|
90508
90519
|
case "object":
|
|
@@ -92461,7 +92472,7 @@ var isCompatible = _makeCompatibilityCheck(VERSION3);
|
|
|
92461
92472
|
var major = VERSION3.split(".")[0];
|
|
92462
92473
|
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
92463
92474
|
var _global = _globalThis;
|
|
92464
|
-
function registerGlobal(
|
|
92475
|
+
function registerGlobal(type18, instance, diag, allowOverride) {
|
|
92465
92476
|
var _a39;
|
|
92466
92477
|
if (allowOverride === void 0) {
|
|
92467
92478
|
allowOverride = false;
|
|
@@ -92469,33 +92480,33 @@ function registerGlobal(type17, instance, diag, allowOverride) {
|
|
|
92469
92480
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a39 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a39 !== void 0 ? _a39 : {
|
|
92470
92481
|
version: VERSION3
|
|
92471
92482
|
};
|
|
92472
|
-
if (!allowOverride && api[
|
|
92473
|
-
var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " +
|
|
92483
|
+
if (!allowOverride && api[type18]) {
|
|
92484
|
+
var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type18);
|
|
92474
92485
|
diag.error(err.stack || err.message);
|
|
92475
92486
|
return false;
|
|
92476
92487
|
}
|
|
92477
92488
|
if (api.version !== VERSION3) {
|
|
92478
|
-
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " +
|
|
92489
|
+
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type18 + " does not match previously registered API v" + VERSION3);
|
|
92479
92490
|
diag.error(err.stack || err.message);
|
|
92480
92491
|
return false;
|
|
92481
92492
|
}
|
|
92482
|
-
api[
|
|
92483
|
-
diag.debug("@opentelemetry/api: Registered a global for " +
|
|
92493
|
+
api[type18] = instance;
|
|
92494
|
+
diag.debug("@opentelemetry/api: Registered a global for " + type18 + " v" + VERSION3 + ".");
|
|
92484
92495
|
return true;
|
|
92485
92496
|
}
|
|
92486
|
-
function getGlobal(
|
|
92497
|
+
function getGlobal(type18) {
|
|
92487
92498
|
var _a39, _b31;
|
|
92488
92499
|
var globalVersion = (_a39 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a39 === void 0 ? void 0 : _a39.version;
|
|
92489
92500
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
92490
92501
|
return;
|
|
92491
92502
|
}
|
|
92492
|
-
return (_b31 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b31 === void 0 ? void 0 : _b31[
|
|
92503
|
+
return (_b31 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b31 === void 0 ? void 0 : _b31[type18];
|
|
92493
92504
|
}
|
|
92494
|
-
function unregisterGlobal(
|
|
92495
|
-
diag.debug("@opentelemetry/api: Unregistering a global for " +
|
|
92505
|
+
function unregisterGlobal(type18, diag) {
|
|
92506
|
+
diag.debug("@opentelemetry/api: Unregistering a global for " + type18 + " v" + VERSION3 + ".");
|
|
92496
92507
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
92497
92508
|
if (api) {
|
|
92498
|
-
delete api[
|
|
92509
|
+
delete api[type18];
|
|
92499
92510
|
}
|
|
92500
92511
|
}
|
|
92501
92512
|
|
|
@@ -93978,8 +93989,8 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
93978
93989
|
};
|
|
93979
93990
|
}
|
|
93980
93991
|
let originalData;
|
|
93981
|
-
const
|
|
93982
|
-
switch (
|
|
93992
|
+
const type18 = part.type;
|
|
93993
|
+
switch (type18) {
|
|
93983
93994
|
case "image":
|
|
93984
93995
|
originalData = part.image;
|
|
93985
93996
|
break;
|
|
@@ -93987,7 +93998,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
93987
93998
|
originalData = part.data;
|
|
93988
93999
|
break;
|
|
93989
94000
|
default:
|
|
93990
|
-
throw new Error(`Unsupported part type: ${
|
|
94001
|
+
throw new Error(`Unsupported part type: ${type18}`);
|
|
93991
94002
|
}
|
|
93992
94003
|
const { data: convertedData, mediaType: convertedMediaType } = convertToLanguageModelV3DataContent(originalData);
|
|
93993
94004
|
let mediaType = convertedMediaType != null ? convertedMediaType : part.mediaType;
|
|
@@ -93999,7 +94010,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
93999
94010
|
mediaType != null ? mediaType : mediaType = downloadedFile.mediaType;
|
|
94000
94011
|
}
|
|
94001
94012
|
}
|
|
94002
|
-
switch (
|
|
94013
|
+
switch (type18) {
|
|
94003
94014
|
case "image": {
|
|
94004
94015
|
if (data instanceof Uint8Array || typeof data === "string") {
|
|
94005
94016
|
mediaType = (_a162 = detectMediaType({ data, signatures: imageMediaTypeSignatures })) != null ? _a162 : mediaType;
|
|
@@ -100484,12 +100495,12 @@ function prepareChatTools({
|
|
|
100484
100495
|
if (toolChoice == null) {
|
|
100485
100496
|
return { tools: openaiTools2, toolChoice: void 0, toolWarnings };
|
|
100486
100497
|
}
|
|
100487
|
-
const
|
|
100488
|
-
switch (
|
|
100498
|
+
const type18 = toolChoice.type;
|
|
100499
|
+
switch (type18) {
|
|
100489
100500
|
case "auto":
|
|
100490
100501
|
case "none":
|
|
100491
100502
|
case "required":
|
|
100492
|
-
return { tools: openaiTools2, toolChoice:
|
|
100503
|
+
return { tools: openaiTools2, toolChoice: type18, toolWarnings };
|
|
100493
100504
|
case "tool":
|
|
100494
100505
|
return {
|
|
100495
100506
|
tools: openaiTools2,
|
|
@@ -100502,7 +100513,7 @@ function prepareChatTools({
|
|
|
100502
100513
|
toolWarnings
|
|
100503
100514
|
};
|
|
100504
100515
|
default: {
|
|
100505
|
-
const _exhaustiveCheck =
|
|
100516
|
+
const _exhaustiveCheck = type18;
|
|
100506
100517
|
throw new UnsupportedFunctionalityError({
|
|
100507
100518
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
100508
100519
|
});
|
|
@@ -103706,12 +103717,12 @@ async function prepareResponsesTools({
|
|
|
103706
103717
|
if (toolChoice == null) {
|
|
103707
103718
|
return { tools: openaiTools2, toolChoice: void 0, toolWarnings };
|
|
103708
103719
|
}
|
|
103709
|
-
const
|
|
103710
|
-
switch (
|
|
103720
|
+
const type18 = toolChoice.type;
|
|
103721
|
+
switch (type18) {
|
|
103711
103722
|
case "auto":
|
|
103712
103723
|
case "none":
|
|
103713
103724
|
case "required":
|
|
103714
|
-
return { tools: openaiTools2, toolChoice:
|
|
103725
|
+
return { tools: openaiTools2, toolChoice: type18, toolWarnings };
|
|
103715
103726
|
case "tool":
|
|
103716
103727
|
return {
|
|
103717
103728
|
tools: openaiTools2,
|
|
@@ -103719,7 +103730,7 @@ async function prepareResponsesTools({
|
|
|
103719
103730
|
toolWarnings
|
|
103720
103731
|
};
|
|
103721
103732
|
default: {
|
|
103722
|
-
const _exhaustiveCheck =
|
|
103733
|
+
const _exhaustiveCheck = type18;
|
|
103723
103734
|
throw new UnsupportedFunctionalityError({
|
|
103724
103735
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
103725
103736
|
});
|
|
@@ -106799,8 +106810,8 @@ async function prepareTools({
|
|
|
106799
106810
|
betas
|
|
106800
106811
|
};
|
|
106801
106812
|
}
|
|
106802
|
-
const
|
|
106803
|
-
switch (
|
|
106813
|
+
const type18 = toolChoice.type;
|
|
106814
|
+
switch (type18) {
|
|
106804
106815
|
case "auto":
|
|
106805
106816
|
return {
|
|
106806
106817
|
tools: anthropicTools2,
|
|
@@ -106835,7 +106846,7 @@ async function prepareTools({
|
|
|
106835
106846
|
betas
|
|
106836
106847
|
};
|
|
106837
106848
|
default: {
|
|
106838
|
-
const _exhaustiveCheck =
|
|
106849
|
+
const _exhaustiveCheck = type18;
|
|
106839
106850
|
throw new UnsupportedFunctionalityError({
|
|
106840
106851
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
106841
106852
|
});
|
|
@@ -107090,8 +107101,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
107090
107101
|
for (let i2 = 0; i2 < blocks.length; i2++) {
|
|
107091
107102
|
const block = blocks[i2];
|
|
107092
107103
|
const isLastBlock = i2 === blocks.length - 1;
|
|
107093
|
-
const
|
|
107094
|
-
switch (
|
|
107104
|
+
const type18 = block.type;
|
|
107105
|
+
switch (type18) {
|
|
107095
107106
|
case "system": {
|
|
107096
107107
|
if (system != null) {
|
|
107097
107108
|
throw new UnsupportedFunctionalityError({
|
|
@@ -107727,7 +107738,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
107727
107738
|
break;
|
|
107728
107739
|
}
|
|
107729
107740
|
default: {
|
|
107730
|
-
const _exhaustiveCheck =
|
|
107741
|
+
const _exhaustiveCheck = type18;
|
|
107731
107742
|
throw new Error(`content type: ${_exhaustiveCheck}`);
|
|
107732
107743
|
}
|
|
107733
107744
|
}
|
|
@@ -109951,7 +109962,7 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
109951
109962
|
return { type: "boolean", properties: {} };
|
|
109952
109963
|
}
|
|
109953
109964
|
const {
|
|
109954
|
-
type:
|
|
109965
|
+
type: type18,
|
|
109955
109966
|
description,
|
|
109956
109967
|
required: required2,
|
|
109957
109968
|
properties,
|
|
@@ -109971,10 +109982,10 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
109971
109982
|
if (constValue !== void 0) {
|
|
109972
109983
|
result.enum = [constValue];
|
|
109973
109984
|
}
|
|
109974
|
-
if (
|
|
109975
|
-
if (Array.isArray(
|
|
109976
|
-
const hasNull =
|
|
109977
|
-
const nonNullTypes =
|
|
109985
|
+
if (type18) {
|
|
109986
|
+
if (Array.isArray(type18)) {
|
|
109987
|
+
const hasNull = type18.includes("null");
|
|
109988
|
+
const nonNullTypes = type18.filter((t4) => t4 !== "null");
|
|
109978
109989
|
if (nonNullTypes.length === 0) {
|
|
109979
109990
|
result.type = "null";
|
|
109980
109991
|
} else {
|
|
@@ -109984,7 +109995,7 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
109984
109995
|
}
|
|
109985
109996
|
}
|
|
109986
109997
|
} else {
|
|
109987
|
-
result.type =
|
|
109998
|
+
result.type = type18;
|
|
109988
109999
|
}
|
|
109989
110000
|
}
|
|
109990
110001
|
if (enumValues !== void 0) {
|
|
@@ -110495,8 +110506,8 @@ function prepareTools2({
|
|
|
110495
110506
|
toolWarnings
|
|
110496
110507
|
};
|
|
110497
110508
|
}
|
|
110498
|
-
const
|
|
110499
|
-
switch (
|
|
110509
|
+
const type18 = toolChoice.type;
|
|
110510
|
+
switch (type18) {
|
|
110500
110511
|
case "auto":
|
|
110501
110512
|
return {
|
|
110502
110513
|
tools: [{ functionDeclarations }],
|
|
@@ -110527,7 +110538,7 @@ function prepareTools2({
|
|
|
110527
110538
|
toolWarnings
|
|
110528
110539
|
};
|
|
110529
110540
|
default: {
|
|
110530
|
-
const _exhaustiveCheck =
|
|
110541
|
+
const _exhaustiveCheck = type18;
|
|
110531
110542
|
throw new UnsupportedFunctionalityError({
|
|
110532
110543
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
110533
110544
|
});
|
|
@@ -112542,12 +112553,12 @@ function prepareResponsesTools2({
|
|
|
112542
112553
|
if (toolChoice == null) {
|
|
112543
112554
|
return { tools: ollamaTools, toolChoice: void 0, toolWarnings };
|
|
112544
112555
|
}
|
|
112545
|
-
const
|
|
112546
|
-
switch (
|
|
112556
|
+
const type18 = toolChoice.type;
|
|
112557
|
+
switch (type18) {
|
|
112547
112558
|
case "auto":
|
|
112548
112559
|
case "none":
|
|
112549
112560
|
case "required":
|
|
112550
|
-
return { tools: ollamaTools, toolChoice:
|
|
112561
|
+
return { tools: ollamaTools, toolChoice: type18, toolWarnings };
|
|
112551
112562
|
case "tool":
|
|
112552
112563
|
return {
|
|
112553
112564
|
tools: ollamaTools,
|
|
@@ -112555,7 +112566,7 @@ function prepareResponsesTools2({
|
|
|
112555
112566
|
toolWarnings
|
|
112556
112567
|
};
|
|
112557
112568
|
default: {
|
|
112558
|
-
const _exhaustiveCheck =
|
|
112569
|
+
const _exhaustiveCheck = type18;
|
|
112559
112570
|
throw new UnsupportedFunctionalityError({
|
|
112560
112571
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
112561
112572
|
});
|
|
@@ -113205,12 +113216,12 @@ function prepareTools3({
|
|
|
113205
113216
|
if (toolChoice == null) {
|
|
113206
113217
|
return { tools: openaiCompatTools, toolChoice: void 0, toolWarnings };
|
|
113207
113218
|
}
|
|
113208
|
-
const
|
|
113209
|
-
switch (
|
|
113219
|
+
const type18 = toolChoice.type;
|
|
113220
|
+
switch (type18) {
|
|
113210
113221
|
case "auto":
|
|
113211
113222
|
case "none":
|
|
113212
113223
|
case "required":
|
|
113213
|
-
return { tools: openaiCompatTools, toolChoice:
|
|
113224
|
+
return { tools: openaiCompatTools, toolChoice: type18, toolWarnings };
|
|
113214
113225
|
case "tool":
|
|
113215
113226
|
return {
|
|
113216
113227
|
tools: openaiCompatTools,
|
|
@@ -113221,7 +113232,7 @@ function prepareTools3({
|
|
|
113221
113232
|
toolWarnings
|
|
113222
113233
|
};
|
|
113223
113234
|
default: {
|
|
113224
|
-
const _exhaustiveCheck =
|
|
113235
|
+
const _exhaustiveCheck = type18;
|
|
113225
113236
|
throw new UnsupportedFunctionalityError({
|
|
113226
113237
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
113227
113238
|
});
|
|
@@ -115601,15 +115612,15 @@ NatsMessage.register(RuntimeSmartSkillsPublish);
|
|
|
115601
115612
|
// ../common/src/messages/skill.call-tool.request.ts
|
|
115602
115613
|
var type10 = "call-tool";
|
|
115603
115614
|
var SkillCallToolRequest = class extends NatsRequest {
|
|
115604
|
-
constructor() {
|
|
115605
|
-
|
|
115615
|
+
constructor(data, originalMsg) {
|
|
115616
|
+
data.isTest ??= false;
|
|
115617
|
+
super(data, originalMsg);
|
|
115606
115618
|
this.type = type10;
|
|
115607
115619
|
}
|
|
115608
115620
|
static {
|
|
115609
115621
|
this.type = type10;
|
|
115610
115622
|
}
|
|
115611
115623
|
validate(data) {
|
|
115612
|
-
data.isTest ??= false;
|
|
115613
115624
|
if (data.workspaceId === void 0 || data.arguments === void 0) {
|
|
115614
115625
|
return false;
|
|
115615
115626
|
}
|
|
@@ -115833,6 +115844,28 @@ var SkillFetchScriptResponse = class extends NatsResponse {
|
|
|
115833
115844
|
};
|
|
115834
115845
|
NatsMessage.register(SkillFetchScriptResponse);
|
|
115835
115846
|
|
|
115847
|
+
// ../common/src/messages/client-connection.publish.ts
|
|
115848
|
+
var type17 = "client-connection";
|
|
115849
|
+
var ClientConnectionPublish = class extends NatsPublish {
|
|
115850
|
+
constructor() {
|
|
115851
|
+
super(...arguments);
|
|
115852
|
+
this.type = type17;
|
|
115853
|
+
}
|
|
115854
|
+
static {
|
|
115855
|
+
this.type = type17;
|
|
115856
|
+
}
|
|
115857
|
+
validate(data) {
|
|
115858
|
+
return typeof data.workspaceId === "string" && data.workspaceId.length > 0 && typeof data.clientName === "string" && data.clientName.length > 0 && typeof data.protocolVersion === "string" && data.protocolVersion.length > 0;
|
|
115859
|
+
}
|
|
115860
|
+
getSubject() {
|
|
115861
|
+
return `${this.data.workspaceId}.${type17}`;
|
|
115862
|
+
}
|
|
115863
|
+
static subscribeToAll() {
|
|
115864
|
+
return `*.${type17}`;
|
|
115865
|
+
}
|
|
115866
|
+
};
|
|
115867
|
+
NatsMessage.register(ClientConnectionPublish);
|
|
115868
|
+
|
|
115836
115869
|
// ../common/src/graphql/dgraph.resolvers.types.ts
|
|
115837
115870
|
var dgraph_resolvers_types_exports = {};
|
|
115838
115871
|
__export(dgraph_resolvers_types_exports, {
|
|
@@ -120338,6 +120371,36 @@ Scripts run based on their configured execution target (AGENT or EDGE).`,
|
|
|
120338
120371
|
getIdentity() {
|
|
120339
120372
|
return this.identity;
|
|
120340
120373
|
}
|
|
120374
|
+
/**
|
|
120375
|
+
* Publish a client connection event for monitoring.
|
|
120376
|
+
* Called when an MCP client completes the initialize handshake.
|
|
120377
|
+
*/
|
|
120378
|
+
publishClientConnection(clientInfo, protocolVersion) {
|
|
120379
|
+
const { name: name17, ...metadata } = clientInfo;
|
|
120380
|
+
const metadataStr = JSON.stringify(metadata);
|
|
120381
|
+
let safeMetadata = { ...metadata };
|
|
120382
|
+
if (metadataStr.length > 10240) {
|
|
120383
|
+
this.logger.warn({ metadataSize: metadataStr.length }, "Client connection metadata exceeds 10KB limit, truncating");
|
|
120384
|
+
safeMetadata = {};
|
|
120385
|
+
}
|
|
120386
|
+
if (this.identity.publishAllTools != null) {
|
|
120387
|
+
safeMetadata.publishAllTools = this.identity.publishAllTools;
|
|
120388
|
+
}
|
|
120389
|
+
if (this.identity.preloadedSkillIds != null) {
|
|
120390
|
+
safeMetadata.skillIds = this.identity.preloadedSkillIds;
|
|
120391
|
+
}
|
|
120392
|
+
if (this.identity.preloadedHatIds != null) {
|
|
120393
|
+
safeMetadata.hatIds = this.identity.preloadedHatIds;
|
|
120394
|
+
}
|
|
120395
|
+
const message = ClientConnectionPublish.create({
|
|
120396
|
+
workspaceId: this.identity.workspaceId,
|
|
120397
|
+
clientName: String(name17 || "unknown"),
|
|
120398
|
+
protocolVersion: String(protocolVersion || "unknown"),
|
|
120399
|
+
metadata: safeMetadata,
|
|
120400
|
+
userId: this.identity.id
|
|
120401
|
+
});
|
|
120402
|
+
this.natsService.publish(message);
|
|
120403
|
+
}
|
|
120341
120404
|
/**
|
|
120342
120405
|
* Set publishAllTools from a client-detection default.
|
|
120343
120406
|
* If the user explicitly provided publishAllTools via query param, this is a no-op.
|
|
@@ -121306,6 +121369,12 @@ var McpStdioService = class McpStdioService2 extends Service {
|
|
|
121306
121369
|
}
|
|
121307
121370
|
}
|
|
121308
121371
|
};
|
|
121372
|
+
try {
|
|
121373
|
+
const rawClientInfo = request.params.clientInfo || {};
|
|
121374
|
+
this.skillService.publishClientConnection(rawClientInfo, negotiatedVersion);
|
|
121375
|
+
} catch (error48) {
|
|
121376
|
+
this.logger.error({ err: error48 }, "Failed to publish client connection event");
|
|
121377
|
+
}
|
|
121309
121378
|
await this.skillService.waitForTools();
|
|
121310
121379
|
return response;
|
|
121311
121380
|
});
|
|
@@ -121343,8 +121412,8 @@ var McpStdioService = class McpStdioService2 extends Service {
|
|
|
121343
121412
|
const result = await this.skillService.callTool(request.params.name, request.params.arguments);
|
|
121344
121413
|
return result;
|
|
121345
121414
|
} catch (error48) {
|
|
121346
|
-
this.logger.error(`Error
|
|
121347
|
-
throw new Error(`Error
|
|
121415
|
+
this.logger.error(`Error calling tool: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
121416
|
+
throw new Error(`Error calling tool: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
121348
121417
|
}
|
|
121349
121418
|
});
|
|
121350
121419
|
}
|
|
@@ -121926,6 +121995,12 @@ var McpRequestHandlers = class {
|
|
|
121926
121995
|
const negotiatedVersion = negotiateProtocolVersion(initRequest.params.protocolVersion);
|
|
121927
121996
|
session.negotiatedProtocolVersion = negotiatedVersion;
|
|
121928
121997
|
logger.debug(`Negotiated protocol version: ${negotiatedVersion}`);
|
|
121998
|
+
try {
|
|
121999
|
+
const rawClientInfo = initRequest.params.clientInfo || {};
|
|
122000
|
+
session.skillService.publishClientConnection(rawClientInfo, negotiatedVersion);
|
|
122001
|
+
} catch (error48) {
|
|
122002
|
+
logger.error({ err: error48 }, "Failed to publish client connection event");
|
|
122003
|
+
}
|
|
121929
122004
|
const identity = session.skillService.getIdentity();
|
|
121930
122005
|
const response = {
|
|
121931
122006
|
serverInfo: {
|
|
@@ -125151,8 +125226,8 @@ function extractWWWAuthenticateParams(res) {
|
|
|
125151
125226
|
if (!authenticateHeader) {
|
|
125152
125227
|
return {};
|
|
125153
125228
|
}
|
|
125154
|
-
const [
|
|
125155
|
-
if (
|
|
125229
|
+
const [type18, scheme] = authenticateHeader.split(" ");
|
|
125230
|
+
if (type18.toLowerCase() !== "bearer" || !scheme) {
|
|
125156
125231
|
return {};
|
|
125157
125232
|
}
|
|
125158
125233
|
const resourceMetadataMatch = extractFieldFromWwwAuth(res, "resource_metadata") || void 0;
|
|
@@ -125284,7 +125359,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
125284
125359
|
Accept: "application/json"
|
|
125285
125360
|
};
|
|
125286
125361
|
const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);
|
|
125287
|
-
for (const { url: endpointUrl, type:
|
|
125362
|
+
for (const { url: endpointUrl, type: type18 } of urlsToTry) {
|
|
125288
125363
|
const response = await fetchWithCorsRetry(endpointUrl, headers, fetchFn);
|
|
125289
125364
|
if (!response) {
|
|
125290
125365
|
continue;
|
|
@@ -125294,9 +125369,9 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
125294
125369
|
if (response.status >= 400 && response.status < 500) {
|
|
125295
125370
|
continue;
|
|
125296
125371
|
}
|
|
125297
|
-
throw new Error(`HTTP ${response.status} trying to load ${
|
|
125372
|
+
throw new Error(`HTTP ${response.status} trying to load ${type18 === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
125298
125373
|
}
|
|
125299
|
-
if (
|
|
125374
|
+
if (type18 === "oauth") {
|
|
125300
125375
|
return OAuthMetadataSchema.parse(await response.json());
|
|
125301
125376
|
} else {
|
|
125302
125377
|
return OpenIdProviderDiscoveryMetadataSchema.parse(await response.json());
|
|
@@ -125842,9 +125917,9 @@ var ErrorEvent = class extends Event {
|
|
|
125842
125917
|
* @param type - The type of the event (should be "error")
|
|
125843
125918
|
* @param errorEventInitDict - Optional properties to include in the error event
|
|
125844
125919
|
*/
|
|
125845
|
-
constructor(
|
|
125920
|
+
constructor(type18, errorEventInitDict) {
|
|
125846
125921
|
var _a39, _b31;
|
|
125847
|
-
super(
|
|
125922
|
+
super(type18), this.code = (_a39 = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a39 : void 0, this.message = (_b31 = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b31 : void 0;
|
|
125848
125923
|
}
|
|
125849
125924
|
/**
|
|
125850
125925
|
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -126039,13 +126114,13 @@ var EventSource = class extends EventTarget {
|
|
|
126039
126114
|
set onopen(value) {
|
|
126040
126115
|
__privateSet(this, _onOpen, value);
|
|
126041
126116
|
}
|
|
126042
|
-
addEventListener(
|
|
126117
|
+
addEventListener(type18, listener, options) {
|
|
126043
126118
|
const listen = listener;
|
|
126044
|
-
super.addEventListener(
|
|
126119
|
+
super.addEventListener(type18, listen, options);
|
|
126045
126120
|
}
|
|
126046
|
-
removeEventListener(
|
|
126121
|
+
removeEventListener(type18, listener, options) {
|
|
126047
126122
|
const listen = listener;
|
|
126048
|
-
super.removeEventListener(
|
|
126123
|
+
super.removeEventListener(type18, listen, options);
|
|
126049
126124
|
}
|
|
126050
126125
|
/**
|
|
126051
126126
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -126827,7 +126902,10 @@ var ToolService = class ToolService2 extends Service {
|
|
|
126827
126902
|
if (event.operation !== "PUT" || !event.value)
|
|
126828
126903
|
continue;
|
|
126829
126904
|
const msg = NatsMessage.fromRawData(event.value);
|
|
126830
|
-
if (msg instanceof
|
|
126905
|
+
if (msg instanceof ErrorResponse) {
|
|
126906
|
+
this.logger.error(`Failed to parse MCP servers update: ${msg.data.error}`);
|
|
126907
|
+
continue;
|
|
126908
|
+
} else if (msg instanceof RuntimeMCPServersPublish) {
|
|
126831
126909
|
this.logger.debug(`Processing MCP Servers update with ${msg.data.mcpServers.length} MCP Servers`);
|
|
126832
126910
|
this.roots = msg.data.roots;
|
|
126833
126911
|
const mcpServerIds = msg.data.mcpServers.map((mcpServer) => mcpServer.id);
|
|
@@ -127230,7 +127308,10 @@ ${errorOutput}` }],
|
|
|
127230
127308
|
if (event.operation !== "PUT" || !event.value)
|
|
127231
127309
|
continue;
|
|
127232
127310
|
const msg = NatsMessage.fromRawData(event.value);
|
|
127233
|
-
if (msg instanceof
|
|
127311
|
+
if (msg instanceof ErrorResponse) {
|
|
127312
|
+
this.logger.error(`Failed to parse smart skills update: ${msg.data.error}`);
|
|
127313
|
+
continue;
|
|
127314
|
+
} else if (msg instanceof RuntimeSmartSkillsPublish) {
|
|
127234
127315
|
this.logger.debug(`Received smart skills update: ${msg.data.smartSkills.map((skill) => skill.name).join(", ")}`);
|
|
127235
127316
|
const skillIds = msg.data.smartSkills.map((skill) => skill.id);
|
|
127236
127317
|
const skillsToStop = Array.from(this.smartSkills.keys()).filter((skillId) => !skillIds.includes(skillId));
|