@skilder-ai/runtime 0.6.1 → 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 +237 -173
- 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);
|
|
@@ -87998,33 +87998,33 @@ ZodUnion2.create = (types, params) => {
|
|
|
87998
87998
|
...processCreateParams(params)
|
|
87999
87999
|
});
|
|
88000
88000
|
};
|
|
88001
|
-
var getDiscriminator = (
|
|
88002
|
-
if (
|
|
88003
|
-
return getDiscriminator(
|
|
88004
|
-
} else if (
|
|
88005
|
-
return getDiscriminator(
|
|
88006
|
-
} else if (
|
|
88007
|
-
return [
|
|
88008
|
-
} else if (
|
|
88009
|
-
return
|
|
88010
|
-
} else if (
|
|
88011
|
-
return util.objectValues(
|
|
88012
|
-
} else if (
|
|
88013
|
-
return getDiscriminator(
|
|
88014
|
-
} 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) {
|
|
88015
88015
|
return [void 0];
|
|
88016
|
-
} else if (
|
|
88016
|
+
} else if (type18 instanceof ZodNull2) {
|
|
88017
88017
|
return [null];
|
|
88018
|
-
} else if (
|
|
88019
|
-
return [void 0, ...getDiscriminator(
|
|
88020
|
-
} else if (
|
|
88021
|
-
return [null, ...getDiscriminator(
|
|
88022
|
-
} else if (
|
|
88023
|
-
return getDiscriminator(
|
|
88024
|
-
} else if (
|
|
88025
|
-
return getDiscriminator(
|
|
88026
|
-
} else if (
|
|
88027
|
-
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);
|
|
88028
88028
|
} else {
|
|
88029
88029
|
return [];
|
|
88030
88030
|
}
|
|
@@ -88084,8 +88084,8 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
|
|
|
88084
88084
|
*/
|
|
88085
88085
|
static create(discriminator, options, params) {
|
|
88086
88086
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
88087
|
-
for (const
|
|
88088
|
-
const discriminatorValues = getDiscriminator(
|
|
88087
|
+
for (const type18 of options) {
|
|
88088
|
+
const discriminatorValues = getDiscriminator(type18.shape[discriminator]);
|
|
88089
88089
|
if (!discriminatorValues.length) {
|
|
88090
88090
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
88091
88091
|
}
|
|
@@ -88093,7 +88093,7 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
|
|
|
88093
88093
|
if (optionsMap.has(value)) {
|
|
88094
88094
|
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
|
|
88095
88095
|
}
|
|
88096
|
-
optionsMap.set(value,
|
|
88096
|
+
optionsMap.set(value, type18);
|
|
88097
88097
|
}
|
|
88098
88098
|
}
|
|
88099
88099
|
return new _ZodDiscriminatedUnion({
|
|
@@ -88904,9 +88904,9 @@ var ZodOptional2 = class extends ZodType2 {
|
|
|
88904
88904
|
return this._def.innerType;
|
|
88905
88905
|
}
|
|
88906
88906
|
};
|
|
88907
|
-
ZodOptional2.create = (
|
|
88907
|
+
ZodOptional2.create = (type18, params) => {
|
|
88908
88908
|
return new ZodOptional2({
|
|
88909
|
-
innerType:
|
|
88909
|
+
innerType: type18,
|
|
88910
88910
|
typeName: ZodFirstPartyTypeKind2.ZodOptional,
|
|
88911
88911
|
...processCreateParams(params)
|
|
88912
88912
|
});
|
|
@@ -88923,9 +88923,9 @@ var ZodNullable2 = class extends ZodType2 {
|
|
|
88923
88923
|
return this._def.innerType;
|
|
88924
88924
|
}
|
|
88925
88925
|
};
|
|
88926
|
-
ZodNullable2.create = (
|
|
88926
|
+
ZodNullable2.create = (type18, params) => {
|
|
88927
88927
|
return new ZodNullable2({
|
|
88928
|
-
innerType:
|
|
88928
|
+
innerType: type18,
|
|
88929
88929
|
typeName: ZodFirstPartyTypeKind2.ZodNullable,
|
|
88930
88930
|
...processCreateParams(params)
|
|
88931
88931
|
});
|
|
@@ -88947,9 +88947,9 @@ var ZodDefault2 = class extends ZodType2 {
|
|
|
88947
88947
|
return this._def.innerType;
|
|
88948
88948
|
}
|
|
88949
88949
|
};
|
|
88950
|
-
ZodDefault2.create = (
|
|
88950
|
+
ZodDefault2.create = (type18, params) => {
|
|
88951
88951
|
return new ZodDefault2({
|
|
88952
|
-
innerType:
|
|
88952
|
+
innerType: type18,
|
|
88953
88953
|
typeName: ZodFirstPartyTypeKind2.ZodDefault,
|
|
88954
88954
|
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
88955
88955
|
...processCreateParams(params)
|
|
@@ -89000,9 +89000,9 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
89000
89000
|
return this._def.innerType;
|
|
89001
89001
|
}
|
|
89002
89002
|
};
|
|
89003
|
-
ZodCatch2.create = (
|
|
89003
|
+
ZodCatch2.create = (type18, params) => {
|
|
89004
89004
|
return new ZodCatch2({
|
|
89005
|
-
innerType:
|
|
89005
|
+
innerType: type18,
|
|
89006
89006
|
typeName: ZodFirstPartyTypeKind2.ZodCatch,
|
|
89007
89007
|
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
89008
89008
|
...processCreateParams(params)
|
|
@@ -89113,9 +89113,9 @@ var ZodReadonly2 = class extends ZodType2 {
|
|
|
89113
89113
|
return this._def.innerType;
|
|
89114
89114
|
}
|
|
89115
89115
|
};
|
|
89116
|
-
ZodReadonly2.create = (
|
|
89116
|
+
ZodReadonly2.create = (type18, params) => {
|
|
89117
89117
|
return new ZodReadonly2({
|
|
89118
|
-
innerType:
|
|
89118
|
+
innerType: type18,
|
|
89119
89119
|
typeName: ZodFirstPartyTypeKind2.ZodReadonly,
|
|
89120
89120
|
...processCreateParams(params)
|
|
89121
89121
|
});
|
|
@@ -90031,9 +90031,9 @@ function parseEnumDef(def) {
|
|
|
90031
90031
|
enum: Array.from(def.values)
|
|
90032
90032
|
};
|
|
90033
90033
|
}
|
|
90034
|
-
var isJsonSchema7AllOfType = (
|
|
90035
|
-
if ("type" in
|
|
90036
|
-
return "allOf" in
|
|
90034
|
+
var isJsonSchema7AllOfType = (type18) => {
|
|
90035
|
+
if ("type" in type18 && type18.type === "string") return false;
|
|
90036
|
+
return "allOf" in type18;
|
|
90037
90037
|
};
|
|
90038
90038
|
function parseIntersectionDef(def, refs) {
|
|
90039
90039
|
const allOf = [
|
|
@@ -90417,7 +90417,7 @@ function parseRecordDef(def, refs) {
|
|
|
90417
90417
|
})) != null ? _a210 : refs.allowedAdditionalProperties
|
|
90418
90418
|
};
|
|
90419
90419
|
if (((_b210 = def.keyType) == null ? void 0 : _b210._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((_c9 = def.keyType._def.checks) == null ? void 0 : _c9.length)) {
|
|
90420
|
-
const { type:
|
|
90420
|
+
const { type: type18, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
90421
90421
|
return {
|
|
90422
90422
|
...schema,
|
|
90423
90423
|
propertyNames: keyType
|
|
@@ -90430,7 +90430,7 @@ function parseRecordDef(def, refs) {
|
|
|
90430
90430
|
}
|
|
90431
90431
|
};
|
|
90432
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)) {
|
|
90433
|
-
const { type:
|
|
90433
|
+
const { type: type18, ...keyType } = parseBrandedDef(
|
|
90434
90434
|
def.keyType._def,
|
|
90435
90435
|
refs
|
|
90436
90436
|
);
|
|
@@ -90499,8 +90499,8 @@ function parseUnionDef(def, refs) {
|
|
|
90499
90499
|
(x3) => x3._def.typeName in primitiveMappings && (!x3._def.checks || !x3._def.checks.length)
|
|
90500
90500
|
)) {
|
|
90501
90501
|
const types = options.reduce((types2, x3) => {
|
|
90502
|
-
const
|
|
90503
|
-
return
|
|
90502
|
+
const type18 = primitiveMappings[x3._def.typeName];
|
|
90503
|
+
return type18 && !types2.includes(type18) ? [...types2, type18] : types2;
|
|
90504
90504
|
}, []);
|
|
90505
90505
|
return {
|
|
90506
90506
|
type: types.length > 1 ? types : types[0]
|
|
@@ -90508,12 +90508,12 @@ function parseUnionDef(def, refs) {
|
|
|
90508
90508
|
} else if (options.every((x3) => x3._def.typeName === "ZodLiteral" && !x3.description)) {
|
|
90509
90509
|
const types = options.reduce(
|
|
90510
90510
|
(acc, x3) => {
|
|
90511
|
-
const
|
|
90512
|
-
switch (
|
|
90511
|
+
const type18 = typeof x3._def.value;
|
|
90512
|
+
switch (type18) {
|
|
90513
90513
|
case "string":
|
|
90514
90514
|
case "number":
|
|
90515
90515
|
case "boolean":
|
|
90516
|
-
return [...acc,
|
|
90516
|
+
return [...acc, type18];
|
|
90517
90517
|
case "bigint":
|
|
90518
90518
|
return [...acc, "integer"];
|
|
90519
90519
|
case "object":
|
|
@@ -92472,7 +92472,7 @@ var isCompatible = _makeCompatibilityCheck(VERSION3);
|
|
|
92472
92472
|
var major = VERSION3.split(".")[0];
|
|
92473
92473
|
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
92474
92474
|
var _global = _globalThis;
|
|
92475
|
-
function registerGlobal(
|
|
92475
|
+
function registerGlobal(type18, instance, diag, allowOverride) {
|
|
92476
92476
|
var _a39;
|
|
92477
92477
|
if (allowOverride === void 0) {
|
|
92478
92478
|
allowOverride = false;
|
|
@@ -92480,33 +92480,33 @@ function registerGlobal(type17, instance, diag, allowOverride) {
|
|
|
92480
92480
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a39 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a39 !== void 0 ? _a39 : {
|
|
92481
92481
|
version: VERSION3
|
|
92482
92482
|
};
|
|
92483
|
-
if (!allowOverride && api[
|
|
92484
|
-
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);
|
|
92485
92485
|
diag.error(err.stack || err.message);
|
|
92486
92486
|
return false;
|
|
92487
92487
|
}
|
|
92488
92488
|
if (api.version !== VERSION3) {
|
|
92489
|
-
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);
|
|
92490
92490
|
diag.error(err.stack || err.message);
|
|
92491
92491
|
return false;
|
|
92492
92492
|
}
|
|
92493
|
-
api[
|
|
92494
|
-
diag.debug("@opentelemetry/api: Registered a global for " +
|
|
92493
|
+
api[type18] = instance;
|
|
92494
|
+
diag.debug("@opentelemetry/api: Registered a global for " + type18 + " v" + VERSION3 + ".");
|
|
92495
92495
|
return true;
|
|
92496
92496
|
}
|
|
92497
|
-
function getGlobal(
|
|
92497
|
+
function getGlobal(type18) {
|
|
92498
92498
|
var _a39, _b31;
|
|
92499
92499
|
var globalVersion = (_a39 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a39 === void 0 ? void 0 : _a39.version;
|
|
92500
92500
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
92501
92501
|
return;
|
|
92502
92502
|
}
|
|
92503
|
-
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];
|
|
92504
92504
|
}
|
|
92505
|
-
function unregisterGlobal(
|
|
92506
|
-
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 + ".");
|
|
92507
92507
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
92508
92508
|
if (api) {
|
|
92509
|
-
delete api[
|
|
92509
|
+
delete api[type18];
|
|
92510
92510
|
}
|
|
92511
92511
|
}
|
|
92512
92512
|
|
|
@@ -93989,8 +93989,8 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
93989
93989
|
};
|
|
93990
93990
|
}
|
|
93991
93991
|
let originalData;
|
|
93992
|
-
const
|
|
93993
|
-
switch (
|
|
93992
|
+
const type18 = part.type;
|
|
93993
|
+
switch (type18) {
|
|
93994
93994
|
case "image":
|
|
93995
93995
|
originalData = part.image;
|
|
93996
93996
|
break;
|
|
@@ -93998,7 +93998,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
93998
93998
|
originalData = part.data;
|
|
93999
93999
|
break;
|
|
94000
94000
|
default:
|
|
94001
|
-
throw new Error(`Unsupported part type: ${
|
|
94001
|
+
throw new Error(`Unsupported part type: ${type18}`);
|
|
94002
94002
|
}
|
|
94003
94003
|
const { data: convertedData, mediaType: convertedMediaType } = convertToLanguageModelV3DataContent(originalData);
|
|
94004
94004
|
let mediaType = convertedMediaType != null ? convertedMediaType : part.mediaType;
|
|
@@ -94010,7 +94010,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
94010
94010
|
mediaType != null ? mediaType : mediaType = downloadedFile.mediaType;
|
|
94011
94011
|
}
|
|
94012
94012
|
}
|
|
94013
|
-
switch (
|
|
94013
|
+
switch (type18) {
|
|
94014
94014
|
case "image": {
|
|
94015
94015
|
if (data instanceof Uint8Array || typeof data === "string") {
|
|
94016
94016
|
mediaType = (_a162 = detectMediaType({ data, signatures: imageMediaTypeSignatures })) != null ? _a162 : mediaType;
|
|
@@ -100495,12 +100495,12 @@ function prepareChatTools({
|
|
|
100495
100495
|
if (toolChoice == null) {
|
|
100496
100496
|
return { tools: openaiTools2, toolChoice: void 0, toolWarnings };
|
|
100497
100497
|
}
|
|
100498
|
-
const
|
|
100499
|
-
switch (
|
|
100498
|
+
const type18 = toolChoice.type;
|
|
100499
|
+
switch (type18) {
|
|
100500
100500
|
case "auto":
|
|
100501
100501
|
case "none":
|
|
100502
100502
|
case "required":
|
|
100503
|
-
return { tools: openaiTools2, toolChoice:
|
|
100503
|
+
return { tools: openaiTools2, toolChoice: type18, toolWarnings };
|
|
100504
100504
|
case "tool":
|
|
100505
100505
|
return {
|
|
100506
100506
|
tools: openaiTools2,
|
|
@@ -100513,7 +100513,7 @@ function prepareChatTools({
|
|
|
100513
100513
|
toolWarnings
|
|
100514
100514
|
};
|
|
100515
100515
|
default: {
|
|
100516
|
-
const _exhaustiveCheck =
|
|
100516
|
+
const _exhaustiveCheck = type18;
|
|
100517
100517
|
throw new UnsupportedFunctionalityError({
|
|
100518
100518
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
100519
100519
|
});
|
|
@@ -103717,12 +103717,12 @@ async function prepareResponsesTools({
|
|
|
103717
103717
|
if (toolChoice == null) {
|
|
103718
103718
|
return { tools: openaiTools2, toolChoice: void 0, toolWarnings };
|
|
103719
103719
|
}
|
|
103720
|
-
const
|
|
103721
|
-
switch (
|
|
103720
|
+
const type18 = toolChoice.type;
|
|
103721
|
+
switch (type18) {
|
|
103722
103722
|
case "auto":
|
|
103723
103723
|
case "none":
|
|
103724
103724
|
case "required":
|
|
103725
|
-
return { tools: openaiTools2, toolChoice:
|
|
103725
|
+
return { tools: openaiTools2, toolChoice: type18, toolWarnings };
|
|
103726
103726
|
case "tool":
|
|
103727
103727
|
return {
|
|
103728
103728
|
tools: openaiTools2,
|
|
@@ -103730,7 +103730,7 @@ async function prepareResponsesTools({
|
|
|
103730
103730
|
toolWarnings
|
|
103731
103731
|
};
|
|
103732
103732
|
default: {
|
|
103733
|
-
const _exhaustiveCheck =
|
|
103733
|
+
const _exhaustiveCheck = type18;
|
|
103734
103734
|
throw new UnsupportedFunctionalityError({
|
|
103735
103735
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
103736
103736
|
});
|
|
@@ -106810,8 +106810,8 @@ async function prepareTools({
|
|
|
106810
106810
|
betas
|
|
106811
106811
|
};
|
|
106812
106812
|
}
|
|
106813
|
-
const
|
|
106814
|
-
switch (
|
|
106813
|
+
const type18 = toolChoice.type;
|
|
106814
|
+
switch (type18) {
|
|
106815
106815
|
case "auto":
|
|
106816
106816
|
return {
|
|
106817
106817
|
tools: anthropicTools2,
|
|
@@ -106846,7 +106846,7 @@ async function prepareTools({
|
|
|
106846
106846
|
betas
|
|
106847
106847
|
};
|
|
106848
106848
|
default: {
|
|
106849
|
-
const _exhaustiveCheck =
|
|
106849
|
+
const _exhaustiveCheck = type18;
|
|
106850
106850
|
throw new UnsupportedFunctionalityError({
|
|
106851
106851
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
106852
106852
|
});
|
|
@@ -107101,8 +107101,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
107101
107101
|
for (let i2 = 0; i2 < blocks.length; i2++) {
|
|
107102
107102
|
const block = blocks[i2];
|
|
107103
107103
|
const isLastBlock = i2 === blocks.length - 1;
|
|
107104
|
-
const
|
|
107105
|
-
switch (
|
|
107104
|
+
const type18 = block.type;
|
|
107105
|
+
switch (type18) {
|
|
107106
107106
|
case "system": {
|
|
107107
107107
|
if (system != null) {
|
|
107108
107108
|
throw new UnsupportedFunctionalityError({
|
|
@@ -107738,7 +107738,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
107738
107738
|
break;
|
|
107739
107739
|
}
|
|
107740
107740
|
default: {
|
|
107741
|
-
const _exhaustiveCheck =
|
|
107741
|
+
const _exhaustiveCheck = type18;
|
|
107742
107742
|
throw new Error(`content type: ${_exhaustiveCheck}`);
|
|
107743
107743
|
}
|
|
107744
107744
|
}
|
|
@@ -109962,7 +109962,7 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
109962
109962
|
return { type: "boolean", properties: {} };
|
|
109963
109963
|
}
|
|
109964
109964
|
const {
|
|
109965
|
-
type:
|
|
109965
|
+
type: type18,
|
|
109966
109966
|
description,
|
|
109967
109967
|
required: required2,
|
|
109968
109968
|
properties,
|
|
@@ -109982,10 +109982,10 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
109982
109982
|
if (constValue !== void 0) {
|
|
109983
109983
|
result.enum = [constValue];
|
|
109984
109984
|
}
|
|
109985
|
-
if (
|
|
109986
|
-
if (Array.isArray(
|
|
109987
|
-
const hasNull =
|
|
109988
|
-
const nonNullTypes =
|
|
109985
|
+
if (type18) {
|
|
109986
|
+
if (Array.isArray(type18)) {
|
|
109987
|
+
const hasNull = type18.includes("null");
|
|
109988
|
+
const nonNullTypes = type18.filter((t4) => t4 !== "null");
|
|
109989
109989
|
if (nonNullTypes.length === 0) {
|
|
109990
109990
|
result.type = "null";
|
|
109991
109991
|
} else {
|
|
@@ -109995,7 +109995,7 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
109995
109995
|
}
|
|
109996
109996
|
}
|
|
109997
109997
|
} else {
|
|
109998
|
-
result.type =
|
|
109998
|
+
result.type = type18;
|
|
109999
109999
|
}
|
|
110000
110000
|
}
|
|
110001
110001
|
if (enumValues !== void 0) {
|
|
@@ -110506,8 +110506,8 @@ function prepareTools2({
|
|
|
110506
110506
|
toolWarnings
|
|
110507
110507
|
};
|
|
110508
110508
|
}
|
|
110509
|
-
const
|
|
110510
|
-
switch (
|
|
110509
|
+
const type18 = toolChoice.type;
|
|
110510
|
+
switch (type18) {
|
|
110511
110511
|
case "auto":
|
|
110512
110512
|
return {
|
|
110513
110513
|
tools: [{ functionDeclarations }],
|
|
@@ -110538,7 +110538,7 @@ function prepareTools2({
|
|
|
110538
110538
|
toolWarnings
|
|
110539
110539
|
};
|
|
110540
110540
|
default: {
|
|
110541
|
-
const _exhaustiveCheck =
|
|
110541
|
+
const _exhaustiveCheck = type18;
|
|
110542
110542
|
throw new UnsupportedFunctionalityError({
|
|
110543
110543
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
110544
110544
|
});
|
|
@@ -112553,12 +112553,12 @@ function prepareResponsesTools2({
|
|
|
112553
112553
|
if (toolChoice == null) {
|
|
112554
112554
|
return { tools: ollamaTools, toolChoice: void 0, toolWarnings };
|
|
112555
112555
|
}
|
|
112556
|
-
const
|
|
112557
|
-
switch (
|
|
112556
|
+
const type18 = toolChoice.type;
|
|
112557
|
+
switch (type18) {
|
|
112558
112558
|
case "auto":
|
|
112559
112559
|
case "none":
|
|
112560
112560
|
case "required":
|
|
112561
|
-
return { tools: ollamaTools, toolChoice:
|
|
112561
|
+
return { tools: ollamaTools, toolChoice: type18, toolWarnings };
|
|
112562
112562
|
case "tool":
|
|
112563
112563
|
return {
|
|
112564
112564
|
tools: ollamaTools,
|
|
@@ -112566,7 +112566,7 @@ function prepareResponsesTools2({
|
|
|
112566
112566
|
toolWarnings
|
|
112567
112567
|
};
|
|
112568
112568
|
default: {
|
|
112569
|
-
const _exhaustiveCheck =
|
|
112569
|
+
const _exhaustiveCheck = type18;
|
|
112570
112570
|
throw new UnsupportedFunctionalityError({
|
|
112571
112571
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
112572
112572
|
});
|
|
@@ -113216,12 +113216,12 @@ function prepareTools3({
|
|
|
113216
113216
|
if (toolChoice == null) {
|
|
113217
113217
|
return { tools: openaiCompatTools, toolChoice: void 0, toolWarnings };
|
|
113218
113218
|
}
|
|
113219
|
-
const
|
|
113220
|
-
switch (
|
|
113219
|
+
const type18 = toolChoice.type;
|
|
113220
|
+
switch (type18) {
|
|
113221
113221
|
case "auto":
|
|
113222
113222
|
case "none":
|
|
113223
113223
|
case "required":
|
|
113224
|
-
return { tools: openaiCompatTools, toolChoice:
|
|
113224
|
+
return { tools: openaiCompatTools, toolChoice: type18, toolWarnings };
|
|
113225
113225
|
case "tool":
|
|
113226
113226
|
return {
|
|
113227
113227
|
tools: openaiCompatTools,
|
|
@@ -113232,7 +113232,7 @@ function prepareTools3({
|
|
|
113232
113232
|
toolWarnings
|
|
113233
113233
|
};
|
|
113234
113234
|
default: {
|
|
113235
|
-
const _exhaustiveCheck =
|
|
113235
|
+
const _exhaustiveCheck = type18;
|
|
113236
113236
|
throw new UnsupportedFunctionalityError({
|
|
113237
113237
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
113238
113238
|
});
|
|
@@ -115844,6 +115844,28 @@ var SkillFetchScriptResponse = class extends NatsResponse {
|
|
|
115844
115844
|
};
|
|
115845
115845
|
NatsMessage.register(SkillFetchScriptResponse);
|
|
115846
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
|
+
|
|
115847
115869
|
// ../common/src/graphql/dgraph.resolvers.types.ts
|
|
115848
115870
|
var dgraph_resolvers_types_exports = {};
|
|
115849
115871
|
__export(dgraph_resolvers_types_exports, {
|
|
@@ -120349,6 +120371,36 @@ Scripts run based on their configured execution target (AGENT or EDGE).`,
|
|
|
120349
120371
|
getIdentity() {
|
|
120350
120372
|
return this.identity;
|
|
120351
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
|
+
}
|
|
120352
120404
|
/**
|
|
120353
120405
|
* Set publishAllTools from a client-detection default.
|
|
120354
120406
|
* If the user explicitly provided publishAllTools via query param, this is a no-op.
|
|
@@ -121317,6 +121369,12 @@ var McpStdioService = class McpStdioService2 extends Service {
|
|
|
121317
121369
|
}
|
|
121318
121370
|
}
|
|
121319
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
|
+
}
|
|
121320
121378
|
await this.skillService.waitForTools();
|
|
121321
121379
|
return response;
|
|
121322
121380
|
});
|
|
@@ -121354,8 +121412,8 @@ var McpStdioService = class McpStdioService2 extends Service {
|
|
|
121354
121412
|
const result = await this.skillService.callTool(request.params.name, request.params.arguments);
|
|
121355
121413
|
return result;
|
|
121356
121414
|
} catch (error48) {
|
|
121357
|
-
this.logger.error(`Error
|
|
121358
|
-
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)}`);
|
|
121359
121417
|
}
|
|
121360
121418
|
});
|
|
121361
121419
|
}
|
|
@@ -121937,6 +121995,12 @@ var McpRequestHandlers = class {
|
|
|
121937
121995
|
const negotiatedVersion = negotiateProtocolVersion(initRequest.params.protocolVersion);
|
|
121938
121996
|
session.negotiatedProtocolVersion = negotiatedVersion;
|
|
121939
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
|
+
}
|
|
121940
122004
|
const identity = session.skillService.getIdentity();
|
|
121941
122005
|
const response = {
|
|
121942
122006
|
serverInfo: {
|
|
@@ -125162,8 +125226,8 @@ function extractWWWAuthenticateParams(res) {
|
|
|
125162
125226
|
if (!authenticateHeader) {
|
|
125163
125227
|
return {};
|
|
125164
125228
|
}
|
|
125165
|
-
const [
|
|
125166
|
-
if (
|
|
125229
|
+
const [type18, scheme] = authenticateHeader.split(" ");
|
|
125230
|
+
if (type18.toLowerCase() !== "bearer" || !scheme) {
|
|
125167
125231
|
return {};
|
|
125168
125232
|
}
|
|
125169
125233
|
const resourceMetadataMatch = extractFieldFromWwwAuth(res, "resource_metadata") || void 0;
|
|
@@ -125295,7 +125359,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
125295
125359
|
Accept: "application/json"
|
|
125296
125360
|
};
|
|
125297
125361
|
const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);
|
|
125298
|
-
for (const { url: endpointUrl, type:
|
|
125362
|
+
for (const { url: endpointUrl, type: type18 } of urlsToTry) {
|
|
125299
125363
|
const response = await fetchWithCorsRetry(endpointUrl, headers, fetchFn);
|
|
125300
125364
|
if (!response) {
|
|
125301
125365
|
continue;
|
|
@@ -125305,9 +125369,9 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
125305
125369
|
if (response.status >= 400 && response.status < 500) {
|
|
125306
125370
|
continue;
|
|
125307
125371
|
}
|
|
125308
|
-
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}`);
|
|
125309
125373
|
}
|
|
125310
|
-
if (
|
|
125374
|
+
if (type18 === "oauth") {
|
|
125311
125375
|
return OAuthMetadataSchema.parse(await response.json());
|
|
125312
125376
|
} else {
|
|
125313
125377
|
return OpenIdProviderDiscoveryMetadataSchema.parse(await response.json());
|
|
@@ -125853,9 +125917,9 @@ var ErrorEvent = class extends Event {
|
|
|
125853
125917
|
* @param type - The type of the event (should be "error")
|
|
125854
125918
|
* @param errorEventInitDict - Optional properties to include in the error event
|
|
125855
125919
|
*/
|
|
125856
|
-
constructor(
|
|
125920
|
+
constructor(type18, errorEventInitDict) {
|
|
125857
125921
|
var _a39, _b31;
|
|
125858
|
-
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;
|
|
125859
125923
|
}
|
|
125860
125924
|
/**
|
|
125861
125925
|
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -126050,13 +126114,13 @@ var EventSource = class extends EventTarget {
|
|
|
126050
126114
|
set onopen(value) {
|
|
126051
126115
|
__privateSet(this, _onOpen, value);
|
|
126052
126116
|
}
|
|
126053
|
-
addEventListener(
|
|
126117
|
+
addEventListener(type18, listener, options) {
|
|
126054
126118
|
const listen = listener;
|
|
126055
|
-
super.addEventListener(
|
|
126119
|
+
super.addEventListener(type18, listen, options);
|
|
126056
126120
|
}
|
|
126057
|
-
removeEventListener(
|
|
126121
|
+
removeEventListener(type18, listener, options) {
|
|
126058
126122
|
const listen = listener;
|
|
126059
|
-
super.removeEventListener(
|
|
126123
|
+
super.removeEventListener(type18, listen, options);
|
|
126060
126124
|
}
|
|
126061
126125
|
/**
|
|
126062
126126
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|