@agentconnect.md/computer 2.12.0-rc.11 → 2.12.0-rc.13
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/agentconnect-computer.mjs +436 -255
- package/package.json +1 -1
|
@@ -23952,7 +23952,7 @@ var require_x509_cjs = __commonJS({
|
|
|
23952
23952
|
}
|
|
23953
23953
|
toJSON() {
|
|
23954
23954
|
var _a4;
|
|
23955
|
-
const
|
|
23955
|
+
const json5 = [];
|
|
23956
23956
|
for (const rdn of this.asn) {
|
|
23957
23957
|
const jsonItem = {};
|
|
23958
23958
|
for (const attr of rdn) {
|
|
@@ -23960,9 +23960,9 @@ var require_x509_cjs = __commonJS({
|
|
|
23960
23960
|
(_a4 = jsonItem[type]) !== null && _a4 !== void 0 ? _a4 : jsonItem[type] = [];
|
|
23961
23961
|
jsonItem[type].push(attr.value.anyValue ? `#${pvtsutils.Convert.ToHex(attr.value.anyValue)}` : attr.value.toString());
|
|
23962
23962
|
}
|
|
23963
|
-
|
|
23963
|
+
json5.push(jsonItem);
|
|
23964
23964
|
}
|
|
23965
|
-
return
|
|
23965
|
+
return json5;
|
|
23966
23966
|
}
|
|
23967
23967
|
fromString(data) {
|
|
23968
23968
|
const asn = new asn1X509.Name();
|
|
@@ -48370,13 +48370,13 @@ function initializeContext(params) {
|
|
|
48370
48370
|
external: params?.external ?? void 0
|
|
48371
48371
|
};
|
|
48372
48372
|
}
|
|
48373
|
-
function handleUnrepresentable(schema, ctx,
|
|
48373
|
+
function handleUnrepresentable(schema, ctx, json5, params, message) {
|
|
48374
48374
|
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable;
|
|
48375
48375
|
if (result === "any")
|
|
48376
48376
|
return false;
|
|
48377
48377
|
if (result === void 0 || result === "throw")
|
|
48378
48378
|
throw new Error(message);
|
|
48379
|
-
Object.assign(
|
|
48379
|
+
Object.assign(json5, result);
|
|
48380
48380
|
return true;
|
|
48381
48381
|
}
|
|
48382
48382
|
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
@@ -48612,12 +48612,12 @@ function foldObjects(members2) {
|
|
|
48612
48612
|
}
|
|
48613
48613
|
return folded;
|
|
48614
48614
|
}
|
|
48615
|
-
function foldIntersection(
|
|
48616
|
-
const allOf =
|
|
48615
|
+
function foldIntersection(json5) {
|
|
48616
|
+
const allOf = json5.allOf;
|
|
48617
48617
|
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
48618
48618
|
return;
|
|
48619
48619
|
for (const key of FOLDABLE_KEYS)
|
|
48620
|
-
if (key in
|
|
48620
|
+
if (key in json5)
|
|
48621
48621
|
return;
|
|
48622
48622
|
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
48623
48623
|
let folded = null;
|
|
@@ -48636,8 +48636,8 @@ function foldIntersection(json4) {
|
|
|
48636
48636
|
}
|
|
48637
48637
|
if (!folded)
|
|
48638
48638
|
return;
|
|
48639
|
-
delete
|
|
48640
|
-
assignProps(
|
|
48639
|
+
delete json5.allOf;
|
|
48640
|
+
assignProps(json5, folded);
|
|
48641
48641
|
}
|
|
48642
48642
|
function finalize(ctx, schema) {
|
|
48643
48643
|
const root = ctx.seen.get(schema);
|
|
@@ -48719,20 +48719,20 @@ function finalize(ctx, schema) {
|
|
|
48719
48719
|
if (ctx.intersections.length) {
|
|
48720
48720
|
const carriers = /* @__PURE__ */ new Map();
|
|
48721
48721
|
for (const seen of ctx.seen.values()) {
|
|
48722
|
-
for (const
|
|
48723
|
-
const allOf =
|
|
48722
|
+
for (const json5 of [seen.schema, seen.def]) {
|
|
48723
|
+
const allOf = json5?.allOf;
|
|
48724
48724
|
if (!Array.isArray(allOf))
|
|
48725
48725
|
continue;
|
|
48726
48726
|
const existing = carriers.get(allOf);
|
|
48727
48727
|
if (existing)
|
|
48728
|
-
existing.push(
|
|
48728
|
+
existing.push(json5);
|
|
48729
48729
|
else
|
|
48730
|
-
carriers.set(allOf, [
|
|
48730
|
+
carriers.set(allOf, [json5]);
|
|
48731
48731
|
}
|
|
48732
48732
|
}
|
|
48733
48733
|
for (const allOf of ctx.intersections) {
|
|
48734
|
-
for (const
|
|
48735
|
-
foldIntersection(
|
|
48734
|
+
for (const json5 of carriers.get(allOf) ?? [])
|
|
48735
|
+
foldIntersection(json5);
|
|
48736
48736
|
}
|
|
48737
48737
|
}
|
|
48738
48738
|
}
|
|
@@ -48968,29 +48968,29 @@ var exactPatterns = /* @__PURE__ */ new Map([
|
|
|
48968
48968
|
]);
|
|
48969
48969
|
var exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
48970
48970
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
48971
|
-
const
|
|
48972
|
-
|
|
48971
|
+
const json5 = _json;
|
|
48972
|
+
json5.type = "string";
|
|
48973
48973
|
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
48974
48974
|
if (typeof minimum === "number")
|
|
48975
|
-
|
|
48975
|
+
json5.minLength = minimum;
|
|
48976
48976
|
if (typeof maximum === "number")
|
|
48977
|
-
|
|
48977
|
+
json5.maxLength = maximum;
|
|
48978
48978
|
if (format) {
|
|
48979
|
-
|
|
48980
|
-
if (
|
|
48981
|
-
delete
|
|
48979
|
+
json5.format = formatMap[format] ?? format;
|
|
48980
|
+
if (json5.format === "")
|
|
48981
|
+
delete json5.format;
|
|
48982
48982
|
if (format === "time" || laxFormat) {
|
|
48983
|
-
delete
|
|
48983
|
+
delete json5.format;
|
|
48984
48984
|
}
|
|
48985
48985
|
}
|
|
48986
48986
|
if (contentEncoding)
|
|
48987
|
-
|
|
48987
|
+
json5.contentEncoding = contentEncoding;
|
|
48988
48988
|
if (patterns && patterns.size > 0) {
|
|
48989
48989
|
const patternList = [...patterns].map(exactPattern);
|
|
48990
48990
|
if (patternList.length === 1)
|
|
48991
|
-
|
|
48991
|
+
json5.pattern = patternList[0].source;
|
|
48992
48992
|
else if (patternList.length > 1) {
|
|
48993
|
-
|
|
48993
|
+
json5.allOf = [
|
|
48994
48994
|
...patternList.map((regex) => ({
|
|
48995
48995
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
48996
48996
|
pattern: regex.source
|
|
@@ -49000,31 +49000,31 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
49000
49000
|
}
|
|
49001
49001
|
};
|
|
49002
49002
|
var numberProcessor = (schema, ctx, _json, params) => {
|
|
49003
|
-
const
|
|
49003
|
+
const json5 = _json;
|
|
49004
49004
|
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
49005
|
-
|
|
49005
|
+
json5.type = isInt ? "integer" : "number";
|
|
49006
49006
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
49007
49007
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
49008
49008
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
49009
49009
|
if (exMin) {
|
|
49010
49010
|
if (legacy) {
|
|
49011
|
-
|
|
49012
|
-
|
|
49011
|
+
json5.minimum = exclusiveMinimum;
|
|
49012
|
+
json5.exclusiveMinimum = true;
|
|
49013
49013
|
} else {
|
|
49014
|
-
|
|
49014
|
+
json5.exclusiveMinimum = exclusiveMinimum;
|
|
49015
49015
|
}
|
|
49016
49016
|
} else if (typeof minimum === "number") {
|
|
49017
|
-
|
|
49017
|
+
json5.minimum = minimum;
|
|
49018
49018
|
}
|
|
49019
49019
|
if (exMax) {
|
|
49020
49020
|
if (legacy) {
|
|
49021
|
-
|
|
49022
|
-
|
|
49021
|
+
json5.maximum = exclusiveMaximum;
|
|
49022
|
+
json5.exclusiveMaximum = true;
|
|
49023
49023
|
} else {
|
|
49024
|
-
|
|
49024
|
+
json5.exclusiveMaximum = exclusiveMaximum;
|
|
49025
49025
|
}
|
|
49026
49026
|
} else if (typeof maximum === "number") {
|
|
49027
|
-
|
|
49027
|
+
json5.maximum = maximum;
|
|
49028
49028
|
}
|
|
49029
49029
|
if (multipleOf) {
|
|
49030
49030
|
const divisors = /* @__PURE__ */ new Set();
|
|
@@ -49032,75 +49032,75 @@ var numberProcessor = (schema, ctx, _json, params) => {
|
|
|
49032
49032
|
if (Number.isFinite(divisor) && divisor !== 0)
|
|
49033
49033
|
divisors.add(Math.abs(divisor));
|
|
49034
49034
|
else
|
|
49035
|
-
handleUnrepresentable(schema, ctx,
|
|
49035
|
+
handleUnrepresentable(schema, ctx, json5, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
49036
49036
|
}
|
|
49037
49037
|
const [first, ...rest] = divisors;
|
|
49038
49038
|
if (first !== void 0)
|
|
49039
|
-
|
|
49039
|
+
json5.multipleOf = first;
|
|
49040
49040
|
if (rest.length)
|
|
49041
|
-
|
|
49041
|
+
json5.allOf = [...json5.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
49042
49042
|
}
|
|
49043
49043
|
};
|
|
49044
|
-
var booleanProcessor = (_schema, _ctx,
|
|
49045
|
-
|
|
49044
|
+
var booleanProcessor = (_schema, _ctx, json5, _params) => {
|
|
49045
|
+
json5.type = "boolean";
|
|
49046
49046
|
};
|
|
49047
|
-
var bigintProcessor = (schema, ctx,
|
|
49048
|
-
handleUnrepresentable(schema, ctx,
|
|
49047
|
+
var bigintProcessor = (schema, ctx, json5, params) => {
|
|
49048
|
+
handleUnrepresentable(schema, ctx, json5, params, "BigInt cannot be represented in JSON Schema");
|
|
49049
49049
|
};
|
|
49050
|
-
var symbolProcessor = (schema, ctx,
|
|
49051
|
-
handleUnrepresentable(schema, ctx,
|
|
49050
|
+
var symbolProcessor = (schema, ctx, json5, params) => {
|
|
49051
|
+
handleUnrepresentable(schema, ctx, json5, params, "Symbols cannot be represented in JSON Schema");
|
|
49052
49052
|
};
|
|
49053
|
-
var nullProcessor = (_schema, ctx,
|
|
49053
|
+
var nullProcessor = (_schema, ctx, json5, _params) => {
|
|
49054
49054
|
if (ctx.target === "openapi-3.0") {
|
|
49055
|
-
|
|
49056
|
-
|
|
49057
|
-
|
|
49055
|
+
json5.type = "string";
|
|
49056
|
+
json5.nullable = true;
|
|
49057
|
+
json5.enum = [null];
|
|
49058
49058
|
} else {
|
|
49059
|
-
|
|
49059
|
+
json5.type = "null";
|
|
49060
49060
|
}
|
|
49061
49061
|
};
|
|
49062
|
-
var undefinedProcessor = (schema, ctx,
|
|
49063
|
-
handleUnrepresentable(schema, ctx,
|
|
49062
|
+
var undefinedProcessor = (schema, ctx, json5, params) => {
|
|
49063
|
+
handleUnrepresentable(schema, ctx, json5, params, "Undefined cannot be represented in JSON Schema");
|
|
49064
49064
|
};
|
|
49065
|
-
var voidProcessor = (schema, ctx,
|
|
49066
|
-
handleUnrepresentable(schema, ctx,
|
|
49065
|
+
var voidProcessor = (schema, ctx, json5, params) => {
|
|
49066
|
+
handleUnrepresentable(schema, ctx, json5, params, "Void cannot be represented in JSON Schema");
|
|
49067
49067
|
};
|
|
49068
|
-
var neverProcessor = (_schema, _ctx,
|
|
49069
|
-
|
|
49068
|
+
var neverProcessor = (_schema, _ctx, json5, _params) => {
|
|
49069
|
+
json5.not = {};
|
|
49070
49070
|
};
|
|
49071
49071
|
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
49072
49072
|
};
|
|
49073
49073
|
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
49074
49074
|
};
|
|
49075
|
-
var dateProcessor = (schema, ctx,
|
|
49076
|
-
handleUnrepresentable(schema, ctx,
|
|
49075
|
+
var dateProcessor = (schema, ctx, json5, params) => {
|
|
49076
|
+
handleUnrepresentable(schema, ctx, json5, params, "Date cannot be represented in JSON Schema");
|
|
49077
49077
|
};
|
|
49078
|
-
var enumProcessor = (schema, _ctx,
|
|
49078
|
+
var enumProcessor = (schema, _ctx, json5, _params) => {
|
|
49079
49079
|
const def = schema._zod.def;
|
|
49080
49080
|
const values = getEnumValues(def.entries);
|
|
49081
49081
|
if (values.length === 0) {
|
|
49082
|
-
|
|
49082
|
+
json5.not = {};
|
|
49083
49083
|
return;
|
|
49084
49084
|
}
|
|
49085
49085
|
if (values.every((v) => typeof v === "number"))
|
|
49086
|
-
|
|
49086
|
+
json5.type = "number";
|
|
49087
49087
|
if (values.every((v) => typeof v === "string"))
|
|
49088
|
-
|
|
49089
|
-
|
|
49088
|
+
json5.type = "string";
|
|
49089
|
+
json5.enum = values;
|
|
49090
49090
|
};
|
|
49091
|
-
var literalProcessor = (schema, ctx,
|
|
49091
|
+
var literalProcessor = (schema, ctx, json5, params) => {
|
|
49092
49092
|
const def = schema._zod.def;
|
|
49093
49093
|
if (def.values.length === 0) {
|
|
49094
|
-
|
|
49094
|
+
json5.not = {};
|
|
49095
49095
|
return;
|
|
49096
49096
|
}
|
|
49097
49097
|
const vals = [];
|
|
49098
49098
|
for (const val of def.values) {
|
|
49099
49099
|
if (val === void 0) {
|
|
49100
|
-
if (handleUnrepresentable(schema, ctx,
|
|
49100
|
+
if (handleUnrepresentable(schema, ctx, json5, params, "Literal `undefined` cannot be represented in JSON Schema"))
|
|
49101
49101
|
return;
|
|
49102
49102
|
} else if (typeof val === "bigint") {
|
|
49103
|
-
if (handleUnrepresentable(schema, ctx,
|
|
49103
|
+
if (handleUnrepresentable(schema, ctx, json5, params, "BigInt literals cannot be represented in JSON Schema"))
|
|
49104
49104
|
return;
|
|
49105
49105
|
vals.push(Number(val));
|
|
49106
49106
|
} else {
|
|
@@ -49110,37 +49110,37 @@ var literalProcessor = (schema, ctx, json4, params) => {
|
|
|
49110
49110
|
if (vals.length === 0) {
|
|
49111
49111
|
} else if (vals.length === 1) {
|
|
49112
49112
|
const val = vals[0];
|
|
49113
|
-
|
|
49113
|
+
json5.type = val === null ? "null" : typeof val;
|
|
49114
49114
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
49115
|
-
|
|
49115
|
+
json5.enum = [val];
|
|
49116
49116
|
} else {
|
|
49117
|
-
|
|
49117
|
+
json5.const = val;
|
|
49118
49118
|
}
|
|
49119
49119
|
} else {
|
|
49120
49120
|
if (vals.every((v) => typeof v === "number"))
|
|
49121
|
-
|
|
49121
|
+
json5.type = "number";
|
|
49122
49122
|
if (vals.every((v) => typeof v === "string"))
|
|
49123
|
-
|
|
49123
|
+
json5.type = "string";
|
|
49124
49124
|
if (vals.every((v) => typeof v === "boolean"))
|
|
49125
|
-
|
|
49125
|
+
json5.type = "boolean";
|
|
49126
49126
|
if (vals.every((v) => v === null))
|
|
49127
|
-
|
|
49128
|
-
|
|
49127
|
+
json5.type = "null";
|
|
49128
|
+
json5.enum = vals;
|
|
49129
49129
|
}
|
|
49130
49130
|
};
|
|
49131
|
-
var nanProcessor = (schema, ctx,
|
|
49132
|
-
handleUnrepresentable(schema, ctx,
|
|
49131
|
+
var nanProcessor = (schema, ctx, json5, params) => {
|
|
49132
|
+
handleUnrepresentable(schema, ctx, json5, params, "NaN cannot be represented in JSON Schema");
|
|
49133
49133
|
};
|
|
49134
|
-
var templateLiteralProcessor = (schema, _ctx,
|
|
49135
|
-
const _json =
|
|
49134
|
+
var templateLiteralProcessor = (schema, _ctx, json5, _params) => {
|
|
49135
|
+
const _json = json5;
|
|
49136
49136
|
const pattern = schema._zod.pattern;
|
|
49137
49137
|
if (!pattern)
|
|
49138
49138
|
throw new Error("Pattern not found in template literal");
|
|
49139
49139
|
_json.type = "string";
|
|
49140
49140
|
_json.pattern = pattern.source;
|
|
49141
49141
|
};
|
|
49142
|
-
var fileProcessor = (schema, _ctx,
|
|
49143
|
-
const _json =
|
|
49142
|
+
var fileProcessor = (schema, _ctx, json5, _params) => {
|
|
49143
|
+
const _json = json5;
|
|
49144
49144
|
_json.type = "string";
|
|
49145
49145
|
_json.format = "binary";
|
|
49146
49146
|
_json.contentEncoding = "binary";
|
|
@@ -49158,34 +49158,34 @@ var fileProcessor = (schema, _ctx, json4, _params) => {
|
|
|
49158
49158
|
else
|
|
49159
49159
|
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
49160
49160
|
};
|
|
49161
|
-
var successProcessor = (_schema, _ctx,
|
|
49162
|
-
|
|
49161
|
+
var successProcessor = (_schema, _ctx, json5, _params) => {
|
|
49162
|
+
json5.type = "boolean";
|
|
49163
49163
|
};
|
|
49164
|
-
var customProcessor = (schema, ctx,
|
|
49165
|
-
handleUnrepresentable(schema, ctx,
|
|
49164
|
+
var customProcessor = (schema, ctx, json5, params) => {
|
|
49165
|
+
handleUnrepresentable(schema, ctx, json5, params, "Custom types cannot be represented in JSON Schema");
|
|
49166
49166
|
};
|
|
49167
|
-
var functionProcessor = (schema, ctx,
|
|
49168
|
-
handleUnrepresentable(schema, ctx,
|
|
49167
|
+
var functionProcessor = (schema, ctx, json5, params) => {
|
|
49168
|
+
handleUnrepresentable(schema, ctx, json5, params, "Function types cannot be represented in JSON Schema");
|
|
49169
49169
|
};
|
|
49170
|
-
var transformProcessor = (schema, ctx,
|
|
49171
|
-
handleUnrepresentable(schema, ctx,
|
|
49170
|
+
var transformProcessor = (schema, ctx, json5, params) => {
|
|
49171
|
+
handleUnrepresentable(schema, ctx, json5, params, "Transforms cannot be represented in JSON Schema");
|
|
49172
49172
|
};
|
|
49173
|
-
var mapProcessor = (schema, ctx,
|
|
49174
|
-
handleUnrepresentable(schema, ctx,
|
|
49173
|
+
var mapProcessor = (schema, ctx, json5, params) => {
|
|
49174
|
+
handleUnrepresentable(schema, ctx, json5, params, "Map cannot be represented in JSON Schema");
|
|
49175
49175
|
};
|
|
49176
|
-
var setProcessor = (schema, ctx,
|
|
49177
|
-
handleUnrepresentable(schema, ctx,
|
|
49176
|
+
var setProcessor = (schema, ctx, json5, params) => {
|
|
49177
|
+
handleUnrepresentable(schema, ctx, json5, params, "Set cannot be represented in JSON Schema");
|
|
49178
49178
|
};
|
|
49179
49179
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
49180
|
-
const
|
|
49180
|
+
const json5 = _json;
|
|
49181
49181
|
const def = schema._zod.def;
|
|
49182
49182
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
49183
49183
|
if (typeof minimum === "number")
|
|
49184
|
-
|
|
49184
|
+
json5.minItems = minimum;
|
|
49185
49185
|
if (typeof maximum === "number")
|
|
49186
|
-
|
|
49187
|
-
|
|
49188
|
-
|
|
49186
|
+
json5.maxItems = maximum;
|
|
49187
|
+
json5.type = "array";
|
|
49188
|
+
json5.items = processSchema(def.element, ctx, {
|
|
49189
49189
|
...params,
|
|
49190
49190
|
path: [...params.path, "items"]
|
|
49191
49191
|
});
|
|
@@ -49201,17 +49201,17 @@ function inputOptin(schema) {
|
|
|
49201
49201
|
return schema._zod.optin;
|
|
49202
49202
|
}
|
|
49203
49203
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
49204
|
-
const
|
|
49204
|
+
const json5 = _json;
|
|
49205
49205
|
const def = schema._zod.def;
|
|
49206
49206
|
const shape = def.shape;
|
|
49207
49207
|
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
49208
|
-
if (symbolKeys.length && handleUnrepresentable(schema, ctx,
|
|
49208
|
+
if (symbolKeys.length && handleUnrepresentable(schema, ctx, json5, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
49209
49209
|
return;
|
|
49210
49210
|
}
|
|
49211
|
-
|
|
49212
|
-
|
|
49211
|
+
json5.type = "object";
|
|
49212
|
+
json5.properties = {};
|
|
49213
49213
|
for (const key in shape) {
|
|
49214
|
-
assignProp(
|
|
49214
|
+
assignProp(json5.properties, key, processSchema(shape[key], ctx, {
|
|
49215
49215
|
...params,
|
|
49216
49216
|
path: [...params.path, "properties", key]
|
|
49217
49217
|
}));
|
|
@@ -49224,21 +49224,21 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
49224
49224
|
}
|
|
49225
49225
|
}
|
|
49226
49226
|
if (requiredKeys.length > 0) {
|
|
49227
|
-
|
|
49227
|
+
json5.required = requiredKeys;
|
|
49228
49228
|
}
|
|
49229
49229
|
if (def.catchall?._zod.def.type === "never") {
|
|
49230
|
-
|
|
49230
|
+
json5.additionalProperties = false;
|
|
49231
49231
|
} else if (!def.catchall) {
|
|
49232
49232
|
if (ctx.io === "output")
|
|
49233
|
-
|
|
49233
|
+
json5.additionalProperties = false;
|
|
49234
49234
|
} else if (def.catchall) {
|
|
49235
|
-
|
|
49235
|
+
json5.additionalProperties = processSchema(def.catchall, ctx, {
|
|
49236
49236
|
...params,
|
|
49237
49237
|
path: [...params.path, "additionalProperties"]
|
|
49238
49238
|
});
|
|
49239
49239
|
}
|
|
49240
49240
|
};
|
|
49241
|
-
var unionProcessor = (schema, ctx,
|
|
49241
|
+
var unionProcessor = (schema, ctx, json5, params) => {
|
|
49242
49242
|
const def = schema._zod.def;
|
|
49243
49243
|
const isExclusive = def.inclusive === false;
|
|
49244
49244
|
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
@@ -49246,12 +49246,12 @@ var unionProcessor = (schema, ctx, json4, params) => {
|
|
|
49246
49246
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
49247
49247
|
}));
|
|
49248
49248
|
if (isExclusive) {
|
|
49249
|
-
|
|
49249
|
+
json5.oneOf = options;
|
|
49250
49250
|
} else {
|
|
49251
|
-
|
|
49251
|
+
json5.anyOf = options;
|
|
49252
49252
|
}
|
|
49253
49253
|
};
|
|
49254
|
-
var intersectionProcessor = (schema, ctx,
|
|
49254
|
+
var intersectionProcessor = (schema, ctx, json5, params) => {
|
|
49255
49255
|
const def = schema._zod.def;
|
|
49256
49256
|
const a = processSchema(def.left, ctx, {
|
|
49257
49257
|
...params,
|
|
@@ -49266,13 +49266,13 @@ var intersectionProcessor = (schema, ctx, json4, params) => {
|
|
|
49266
49266
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
49267
49267
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
49268
49268
|
];
|
|
49269
|
-
|
|
49269
|
+
json5.allOf = allOf;
|
|
49270
49270
|
ctx.intersections.push(allOf);
|
|
49271
49271
|
};
|
|
49272
49272
|
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
49273
|
-
const
|
|
49273
|
+
const json5 = _json;
|
|
49274
49274
|
const def = schema._zod.def;
|
|
49275
|
-
|
|
49275
|
+
json5.type = "array";
|
|
49276
49276
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
49277
49277
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
49278
49278
|
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
|
|
@@ -49294,70 +49294,70 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
49294
49294
|
const maxItems = def.items.length;
|
|
49295
49295
|
const isClosed = !def.rest;
|
|
49296
49296
|
if (ctx.target === "draft-2020-12") {
|
|
49297
|
-
|
|
49297
|
+
json5.prefixItems = prefixItems;
|
|
49298
49298
|
if (isClosed) {
|
|
49299
|
-
|
|
49299
|
+
json5.items = false;
|
|
49300
49300
|
} else if (rest) {
|
|
49301
|
-
|
|
49301
|
+
json5.items = rest;
|
|
49302
49302
|
}
|
|
49303
49303
|
if (minItems > 0)
|
|
49304
|
-
|
|
49304
|
+
json5.minItems = minItems;
|
|
49305
49305
|
if (isClosed)
|
|
49306
|
-
|
|
49306
|
+
json5.maxItems = maxItems;
|
|
49307
49307
|
} else if (ctx.target === "openapi-3.0") {
|
|
49308
|
-
|
|
49308
|
+
json5.items = {
|
|
49309
49309
|
anyOf: prefixItems
|
|
49310
49310
|
};
|
|
49311
49311
|
if (rest) {
|
|
49312
|
-
|
|
49312
|
+
json5.items.anyOf.push(rest);
|
|
49313
49313
|
}
|
|
49314
49314
|
if (minItems > 0)
|
|
49315
|
-
|
|
49315
|
+
json5.minItems = minItems;
|
|
49316
49316
|
if (isClosed)
|
|
49317
|
-
|
|
49317
|
+
json5.maxItems = maxItems;
|
|
49318
49318
|
} else {
|
|
49319
|
-
|
|
49319
|
+
json5.items = prefixItems;
|
|
49320
49320
|
if (isClosed) {
|
|
49321
|
-
|
|
49321
|
+
json5.additionalItems = false;
|
|
49322
49322
|
} else if (rest) {
|
|
49323
|
-
|
|
49323
|
+
json5.additionalItems = rest;
|
|
49324
49324
|
}
|
|
49325
49325
|
if (minItems > 0)
|
|
49326
|
-
|
|
49326
|
+
json5.minItems = minItems;
|
|
49327
49327
|
if (isClosed)
|
|
49328
|
-
|
|
49328
|
+
json5.maxItems = maxItems;
|
|
49329
49329
|
}
|
|
49330
49330
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
49331
49331
|
if (typeof minimum === "number")
|
|
49332
|
-
|
|
49332
|
+
json5.minItems = minimum;
|
|
49333
49333
|
if (typeof maximum === "number")
|
|
49334
|
-
|
|
49335
|
-
};
|
|
49336
|
-
function stringifyKeyNames(bySchema,
|
|
49337
|
-
if (
|
|
49338
|
-
if (visited.has(
|
|
49339
|
-
return
|
|
49340
|
-
visited.add(
|
|
49341
|
-
const def = bySchema.get(
|
|
49334
|
+
json5.maxItems = maximum;
|
|
49335
|
+
};
|
|
49336
|
+
function stringifyKeyNames(bySchema, json5, visited) {
|
|
49337
|
+
if (json5.$ref) {
|
|
49338
|
+
if (visited.has(json5))
|
|
49339
|
+
return json5;
|
|
49340
|
+
visited.add(json5);
|
|
49341
|
+
const def = bySchema.get(json5)?.def;
|
|
49342
49342
|
if (!def)
|
|
49343
|
-
return
|
|
49343
|
+
return json5;
|
|
49344
49344
|
const inlined = stringifyKeyNames(bySchema, def, visited);
|
|
49345
|
-
return inlined === def ?
|
|
49345
|
+
return inlined === def ? json5 : inlined;
|
|
49346
49346
|
}
|
|
49347
49347
|
for (const keyword of ["anyOf", "oneOf"]) {
|
|
49348
|
-
const branches =
|
|
49348
|
+
const branches = json5[keyword];
|
|
49349
49349
|
if (!Array.isArray(branches))
|
|
49350
49350
|
continue;
|
|
49351
49351
|
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
|
|
49352
49352
|
if (mapped.some((branch, i) => branch !== branches[i]))
|
|
49353
|
-
|
|
49353
|
+
json5 = { ...json5, [keyword]: mapped };
|
|
49354
49354
|
}
|
|
49355
|
-
const types22 = Array.isArray(
|
|
49355
|
+
const types22 = Array.isArray(json5.type) ? json5.type : [json5.type];
|
|
49356
49356
|
const numericType = !types22.includes("string") && types22.some((t) => t === "number" || t === "integer");
|
|
49357
|
-
const values =
|
|
49357
|
+
const values = json5.enum ?? (json5.const !== void 0 ? [json5.const] : void 0);
|
|
49358
49358
|
if (!numericType && !values?.some((v) => typeof v === "number"))
|
|
49359
|
-
return
|
|
49360
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } =
|
|
49359
|
+
return json5;
|
|
49360
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json5;
|
|
49361
49361
|
if (rest.enum)
|
|
49362
49362
|
rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
|
|
49363
49363
|
else if (typeof rest.const === "number")
|
|
@@ -49397,9 +49397,9 @@ function rewriteKeyNames(ctx) {
|
|
|
49397
49397
|
}
|
|
49398
49398
|
}
|
|
49399
49399
|
var recordProcessor = (schema, ctx, _json, params) => {
|
|
49400
|
-
const
|
|
49400
|
+
const json5 = _json;
|
|
49401
49401
|
const def = schema._zod.def;
|
|
49402
|
-
|
|
49402
|
+
json5.type = "object";
|
|
49403
49403
|
const keyType = def.keyType;
|
|
49404
49404
|
const patterns = aggregateChecks(keyType).patterns;
|
|
49405
49405
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
@@ -49407,13 +49407,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
49407
49407
|
...params,
|
|
49408
49408
|
path: [...params.path, "patternProperties", "*"]
|
|
49409
49409
|
});
|
|
49410
|
-
|
|
49410
|
+
json5.patternProperties = {};
|
|
49411
49411
|
for (const pattern of patterns) {
|
|
49412
|
-
assignProp(
|
|
49412
|
+
assignProp(json5.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
49413
49413
|
}
|
|
49414
49414
|
} else {
|
|
49415
49415
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
49416
|
-
|
|
49416
|
+
json5.propertyNames = processSchema(def.keyType, ctx, {
|
|
49417
49417
|
...params,
|
|
49418
49418
|
path: [...params.path, "propertyNames"]
|
|
49419
49419
|
});
|
|
@@ -49425,7 +49425,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
49425
49425
|
}
|
|
49426
49426
|
pending.push(schema);
|
|
49427
49427
|
}
|
|
49428
|
-
|
|
49428
|
+
json5.additionalProperties = processSchema(def.valueType, ctx, {
|
|
49429
49429
|
...params,
|
|
49430
49430
|
path: [...params.path, "additionalProperties"]
|
|
49431
49431
|
});
|
|
@@ -49435,19 +49435,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
49435
49435
|
if (keyValues && !def.partial && !omittableOnInput) {
|
|
49436
49436
|
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
49437
49437
|
if (validKeyValues.length > 0) {
|
|
49438
|
-
|
|
49438
|
+
json5.required = validKeyValues.map(String);
|
|
49439
49439
|
}
|
|
49440
49440
|
}
|
|
49441
49441
|
};
|
|
49442
|
-
var nullableProcessor = (schema, ctx,
|
|
49442
|
+
var nullableProcessor = (schema, ctx, json5, params) => {
|
|
49443
49443
|
const def = schema._zod.def;
|
|
49444
49444
|
const inner = processSchema(def.innerType, ctx, params);
|
|
49445
49445
|
const seen = ctx.seen.get(schema);
|
|
49446
49446
|
if (ctx.target === "openapi-3.0") {
|
|
49447
49447
|
seen.ref = def.innerType;
|
|
49448
|
-
|
|
49448
|
+
json5.nullable = true;
|
|
49449
49449
|
} else {
|
|
49450
|
-
|
|
49450
|
+
json5.anyOf = [inner, { type: "null" }];
|
|
49451
49451
|
}
|
|
49452
49452
|
};
|
|
49453
49453
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
@@ -49457,7 +49457,7 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
49457
49457
|
seen.ref = def.innerType;
|
|
49458
49458
|
};
|
|
49459
49459
|
var UNREPRESENTABLE_DEFAULT = /* @__PURE__ */ Symbol();
|
|
49460
|
-
function serializeDefaultValue(value, schema, ctx,
|
|
49460
|
+
function serializeDefaultValue(value, schema, ctx, json5, params) {
|
|
49461
49461
|
let unrepresentable = false;
|
|
49462
49462
|
const serialized = JSON.stringify(value, (_, val) => {
|
|
49463
49463
|
if (typeof val !== "bigint")
|
|
@@ -49467,30 +49467,30 @@ function serializeDefaultValue(value, schema, ctx, json4, params) {
|
|
|
49467
49467
|
});
|
|
49468
49468
|
if (!unrepresentable)
|
|
49469
49469
|
return JSON.parse(serialized);
|
|
49470
|
-
handleUnrepresentable(schema, ctx,
|
|
49470
|
+
handleUnrepresentable(schema, ctx, json5, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
49471
49471
|
return UNREPRESENTABLE_DEFAULT;
|
|
49472
49472
|
}
|
|
49473
|
-
var defaultProcessor = (schema, ctx,
|
|
49473
|
+
var defaultProcessor = (schema, ctx, json5, params) => {
|
|
49474
49474
|
const def = schema._zod.def;
|
|
49475
49475
|
processSchema(def.innerType, ctx, params);
|
|
49476
49476
|
const seen = ctx.seen.get(schema);
|
|
49477
49477
|
seen.ref = def.innerType;
|
|
49478
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
49478
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json5, params);
|
|
49479
49479
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
49480
|
-
|
|
49480
|
+
json5.default = value;
|
|
49481
49481
|
};
|
|
49482
|
-
var prefaultProcessor = (schema, ctx,
|
|
49482
|
+
var prefaultProcessor = (schema, ctx, json5, params) => {
|
|
49483
49483
|
const def = schema._zod.def;
|
|
49484
49484
|
processSchema(def.innerType, ctx, params);
|
|
49485
49485
|
const seen = ctx.seen.get(schema);
|
|
49486
49486
|
seen.ref = def.innerType;
|
|
49487
49487
|
if (ctx.io !== "input")
|
|
49488
49488
|
return;
|
|
49489
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
49489
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json5, params);
|
|
49490
49490
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
49491
|
-
|
|
49491
|
+
json5._prefault = value;
|
|
49492
49492
|
};
|
|
49493
|
-
var catchProcessor = (schema, ctx,
|
|
49493
|
+
var catchProcessor = (schema, ctx, json5, params) => {
|
|
49494
49494
|
const def = schema._zod.def;
|
|
49495
49495
|
processSchema(def.innerType, ctx, params);
|
|
49496
49496
|
const seen = ctx.seen.get(schema);
|
|
@@ -49499,10 +49499,10 @@ var catchProcessor = (schema, ctx, json4, params) => {
|
|
|
49499
49499
|
try {
|
|
49500
49500
|
catchValue = def.catchValue(void 0);
|
|
49501
49501
|
} catch {
|
|
49502
|
-
handleUnrepresentable(schema, ctx,
|
|
49502
|
+
handleUnrepresentable(schema, ctx, json5, params, "Dynamic catch values are not supported in JSON Schema");
|
|
49503
49503
|
return;
|
|
49504
49504
|
}
|
|
49505
|
-
|
|
49505
|
+
json5.default = catchValue;
|
|
49506
49506
|
};
|
|
49507
49507
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
49508
49508
|
const def = schema._zod.def;
|
|
@@ -49512,12 +49512,12 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
49512
49512
|
const seen = ctx.seen.get(schema);
|
|
49513
49513
|
seen.ref = innerType;
|
|
49514
49514
|
};
|
|
49515
|
-
var readonlyProcessor = (schema, ctx,
|
|
49515
|
+
var readonlyProcessor = (schema, ctx, json5, params) => {
|
|
49516
49516
|
const def = schema._zod.def;
|
|
49517
49517
|
processSchema(def.innerType, ctx, params);
|
|
49518
49518
|
const seen = ctx.seen.get(schema);
|
|
49519
49519
|
seen.ref = def.innerType;
|
|
49520
|
-
|
|
49520
|
+
json5.readOnly = true;
|
|
49521
49521
|
};
|
|
49522
49522
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
49523
49523
|
const def = schema._zod.def;
|
|
@@ -50167,7 +50167,7 @@ var _ZodString = /* @__PURE__ */ $constructor(
|
|
|
50167
50167
|
(inst, def) => {
|
|
50168
50168
|
$ZodString.init(inst, def);
|
|
50169
50169
|
ZodType.init(inst, def);
|
|
50170
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50170
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => stringProcessor(inst, ctx, json5, params);
|
|
50171
50171
|
},
|
|
50172
50172
|
/* @__PURE__ */ util_exports.derived({
|
|
50173
50173
|
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
@@ -50526,7 +50526,7 @@ var ZodNumber = /* @__PURE__ */ $constructor(
|
|
|
50526
50526
|
(inst, def) => {
|
|
50527
50527
|
$ZodNumber.init(inst, def);
|
|
50528
50528
|
ZodType.init(inst, def);
|
|
50529
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50529
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => numberProcessor(inst, ctx, json5, params);
|
|
50530
50530
|
inst.isFinite = true;
|
|
50531
50531
|
},
|
|
50532
50532
|
/* @__PURE__ */ util_exports.derived({
|
|
@@ -50616,7 +50616,7 @@ function uint32(params) {
|
|
|
50616
50616
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
50617
50617
|
$ZodBoolean.init(inst, def);
|
|
50618
50618
|
ZodType.init(inst, def);
|
|
50619
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50619
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => booleanProcessor(inst, ctx, json5, params);
|
|
50620
50620
|
});
|
|
50621
50621
|
function boolean2(params) {
|
|
50622
50622
|
return _boolean(ZodBoolean, params);
|
|
@@ -50626,7 +50626,7 @@ var ZodBigInt = /* @__PURE__ */ $constructor(
|
|
|
50626
50626
|
(inst, def) => {
|
|
50627
50627
|
$ZodBigInt.init(inst, def);
|
|
50628
50628
|
ZodType.init(inst, def);
|
|
50629
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50629
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => bigintProcessor(inst, ctx, json5, params);
|
|
50630
50630
|
},
|
|
50631
50631
|
/* @__PURE__ */ util_exports.derived({
|
|
50632
50632
|
minValue: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
@@ -50684,7 +50684,7 @@ function uint64(params) {
|
|
|
50684
50684
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
50685
50685
|
$ZodSymbol.init(inst, def);
|
|
50686
50686
|
ZodType.init(inst, def);
|
|
50687
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50687
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => symbolProcessor(inst, ctx, json5, params);
|
|
50688
50688
|
});
|
|
50689
50689
|
function symbol(params) {
|
|
50690
50690
|
return _symbol(ZodSymbol, params);
|
|
@@ -50692,7 +50692,7 @@ function symbol(params) {
|
|
|
50692
50692
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
50693
50693
|
$ZodUndefined.init(inst, def);
|
|
50694
50694
|
ZodType.init(inst, def);
|
|
50695
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50695
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => undefinedProcessor(inst, ctx, json5, params);
|
|
50696
50696
|
});
|
|
50697
50697
|
function _undefined3(params) {
|
|
50698
50698
|
return _undefined2(ZodUndefined, params);
|
|
@@ -50700,7 +50700,7 @@ function _undefined3(params) {
|
|
|
50700
50700
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
50701
50701
|
$ZodNull.init(inst, def);
|
|
50702
50702
|
ZodType.init(inst, def);
|
|
50703
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50703
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => nullProcessor(inst, ctx, json5, params);
|
|
50704
50704
|
});
|
|
50705
50705
|
function _null3(params) {
|
|
50706
50706
|
return _null2(ZodNull, params);
|
|
@@ -50708,7 +50708,7 @@ function _null3(params) {
|
|
|
50708
50708
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
50709
50709
|
$ZodAny.init(inst, def);
|
|
50710
50710
|
ZodType.init(inst, def);
|
|
50711
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50711
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => anyProcessor(inst, ctx, json5, params);
|
|
50712
50712
|
});
|
|
50713
50713
|
function any() {
|
|
50714
50714
|
return _any(ZodAny);
|
|
@@ -50716,7 +50716,7 @@ function any() {
|
|
|
50716
50716
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
50717
50717
|
$ZodUnknown.init(inst, def);
|
|
50718
50718
|
ZodType.init(inst, def);
|
|
50719
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50719
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => unknownProcessor(inst, ctx, json5, params);
|
|
50720
50720
|
});
|
|
50721
50721
|
function unknown() {
|
|
50722
50722
|
return _unknown(ZodUnknown);
|
|
@@ -50724,7 +50724,7 @@ function unknown() {
|
|
|
50724
50724
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
50725
50725
|
$ZodNever.init(inst, def);
|
|
50726
50726
|
ZodType.init(inst, def);
|
|
50727
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50727
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => neverProcessor(inst, ctx, json5, params);
|
|
50728
50728
|
});
|
|
50729
50729
|
function never(params) {
|
|
50730
50730
|
return _never(ZodNever, params);
|
|
@@ -50732,7 +50732,7 @@ function never(params) {
|
|
|
50732
50732
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
50733
50733
|
$ZodVoid.init(inst, def);
|
|
50734
50734
|
ZodType.init(inst, def);
|
|
50735
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50735
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => voidProcessor(inst, ctx, json5, params);
|
|
50736
50736
|
});
|
|
50737
50737
|
function _void2(params) {
|
|
50738
50738
|
return _void(ZodVoid, params);
|
|
@@ -50742,7 +50742,7 @@ var ZodDate = /* @__PURE__ */ $constructor(
|
|
|
50742
50742
|
(inst, def) => {
|
|
50743
50743
|
$ZodDate.init(inst, def);
|
|
50744
50744
|
ZodType.init(inst, def);
|
|
50745
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50745
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => dateProcessor(inst, ctx, json5, params);
|
|
50746
50746
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
50747
50747
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
50748
50748
|
},
|
|
@@ -50764,7 +50764,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
50764
50764
|
_ensureDefaultMemoizer();
|
|
50765
50765
|
$ZodArray.init(inst, def);
|
|
50766
50766
|
ZodType.init(inst, def);
|
|
50767
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50767
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => arrayProcessor(inst, ctx, json5, params);
|
|
50768
50768
|
inst.element = def.element;
|
|
50769
50769
|
}, {
|
|
50770
50770
|
min(n, params) {
|
|
@@ -50794,7 +50794,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
50794
50794
|
_ensureDefaultMemoizer();
|
|
50795
50795
|
$ZodObjectJIT.init(inst, def);
|
|
50796
50796
|
ZodType.init(inst, def);
|
|
50797
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50797
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => objectProcessor(inst, ctx, json5, params);
|
|
50798
50798
|
util_exports.installLazyProp(inst, "shape", (self2) => self2._zod.def.shape, false);
|
|
50799
50799
|
}, {
|
|
50800
50800
|
keyof() {
|
|
@@ -50867,7 +50867,7 @@ function looseObject(shape, params) {
|
|
|
50867
50867
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
50868
50868
|
$ZodUnion.init(inst, def);
|
|
50869
50869
|
ZodType.init(inst, def);
|
|
50870
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50870
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => unionProcessor(inst, ctx, json5, params);
|
|
50871
50871
|
inst.options = def.options;
|
|
50872
50872
|
});
|
|
50873
50873
|
function union(options, params) {
|
|
@@ -50880,7 +50880,7 @@ function union(options, params) {
|
|
|
50880
50880
|
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
50881
50881
|
ZodUnion.init(inst, def);
|
|
50882
50882
|
$ZodXor.init(inst, def);
|
|
50883
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50883
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => unionProcessor(inst, ctx, json5, params);
|
|
50884
50884
|
inst.options = def.options;
|
|
50885
50885
|
});
|
|
50886
50886
|
function xor(options, params) {
|
|
@@ -50906,7 +50906,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
50906
50906
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
50907
50907
|
$ZodIntersection.init(inst, def);
|
|
50908
50908
|
ZodType.init(inst, def);
|
|
50909
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50909
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => intersectionProcessor(inst, ctx, json5, params);
|
|
50910
50910
|
});
|
|
50911
50911
|
function intersection(left, right) {
|
|
50912
50912
|
return new ZodIntersection({
|
|
@@ -50919,7 +50919,7 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
50919
50919
|
_ensureDefaultMemoizer();
|
|
50920
50920
|
$ZodTuple.init(inst, def);
|
|
50921
50921
|
ZodType.init(inst, def);
|
|
50922
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50922
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => tupleProcessor(inst, ctx, json5, params);
|
|
50923
50923
|
}, {
|
|
50924
50924
|
rest(rest) {
|
|
50925
50925
|
return this.clone({
|
|
@@ -50952,7 +50952,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
50952
50952
|
_ensureDefaultMemoizer();
|
|
50953
50953
|
$ZodRecord.init(inst, def);
|
|
50954
50954
|
ZodType.init(inst, def);
|
|
50955
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50955
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => recordProcessor(inst, ctx, json5, params);
|
|
50956
50956
|
inst.keyType = def.keyType;
|
|
50957
50957
|
inst.valueType = def.valueType;
|
|
50958
50958
|
});
|
|
@@ -50994,7 +50994,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
|
50994
50994
|
_ensureDefaultMemoizer();
|
|
50995
50995
|
$ZodMap.init(inst, def);
|
|
50996
50996
|
ZodType.init(inst, def);
|
|
50997
|
-
inst._zod.processJSONSchema = (ctx,
|
|
50997
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => mapProcessor(inst, ctx, json5, params);
|
|
50998
50998
|
inst.keyType = def.keyType;
|
|
50999
50999
|
inst.valueType = def.valueType;
|
|
51000
51000
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
@@ -51014,7 +51014,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
|
51014
51014
|
_ensureDefaultMemoizer();
|
|
51015
51015
|
$ZodSet.init(inst, def);
|
|
51016
51016
|
ZodType.init(inst, def);
|
|
51017
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51017
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => setProcessor(inst, ctx, json5, params);
|
|
51018
51018
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
51019
51019
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
51020
51020
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
@@ -51030,7 +51030,7 @@ function set(valueType, params) {
|
|
|
51030
51030
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
51031
51031
|
$ZodEnum.init(inst, def);
|
|
51032
51032
|
ZodType.init(inst, def);
|
|
51033
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51033
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => enumProcessor(inst, ctx, json5, params);
|
|
51034
51034
|
inst.enum = def.entries;
|
|
51035
51035
|
inst.options = [...inst._zod.values];
|
|
51036
51036
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -51083,7 +51083,7 @@ function nativeEnum(entries2, params) {
|
|
|
51083
51083
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
51084
51084
|
$ZodLiteral.init(inst, def);
|
|
51085
51085
|
ZodType.init(inst, def);
|
|
51086
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51086
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => literalProcessor(inst, ctx, json5, params);
|
|
51087
51087
|
inst.values = new Set(def.values);
|
|
51088
51088
|
Object.defineProperty(inst, "value", {
|
|
51089
51089
|
get() {
|
|
@@ -51104,7 +51104,7 @@ function literal(value, params) {
|
|
|
51104
51104
|
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
51105
51105
|
$ZodFile.init(inst, def);
|
|
51106
51106
|
ZodType.init(inst, def);
|
|
51107
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51107
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => fileProcessor(inst, ctx, json5, params);
|
|
51108
51108
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
51109
51109
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
51110
51110
|
inst.mime = (types22, params) => inst.check(_mime(Array.isArray(types22) ? types22 : [types22], params));
|
|
@@ -51116,7 +51116,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
51116
51116
|
_ensureDefaultMemoizer();
|
|
51117
51117
|
$ZodTransform.init(inst, def);
|
|
51118
51118
|
ZodType.init(inst, def);
|
|
51119
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51119
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => transformProcessor(inst, ctx, json5, params);
|
|
51120
51120
|
inst._zod.parse = (payload, _ctx) => {
|
|
51121
51121
|
if (_ctx.direction === "backward") {
|
|
51122
51122
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -51155,7 +51155,7 @@ function transform(fn) {
|
|
|
51155
51155
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
51156
51156
|
$ZodOptional.init(inst, def);
|
|
51157
51157
|
ZodType.init(inst, def);
|
|
51158
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51158
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => optionalProcessor(inst, ctx, json5, params);
|
|
51159
51159
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51160
51160
|
});
|
|
51161
51161
|
function optional(innerType) {
|
|
@@ -51167,7 +51167,7 @@ function optional(innerType) {
|
|
|
51167
51167
|
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
51168
51168
|
$ZodExactOptional.init(inst, def);
|
|
51169
51169
|
ZodType.init(inst, def);
|
|
51170
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51170
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => optionalProcessor(inst, ctx, json5, params);
|
|
51171
51171
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51172
51172
|
});
|
|
51173
51173
|
function exactOptional(innerType) {
|
|
@@ -51179,7 +51179,7 @@ function exactOptional(innerType) {
|
|
|
51179
51179
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
51180
51180
|
$ZodNullable.init(inst, def);
|
|
51181
51181
|
ZodType.init(inst, def);
|
|
51182
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51182
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => nullableProcessor(inst, ctx, json5, params);
|
|
51183
51183
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51184
51184
|
});
|
|
51185
51185
|
function nullable(innerType) {
|
|
@@ -51194,7 +51194,7 @@ function nullish2(innerType) {
|
|
|
51194
51194
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
51195
51195
|
$ZodDefault.init(inst, def);
|
|
51196
51196
|
ZodType.init(inst, def);
|
|
51197
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51197
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => defaultProcessor(inst, ctx, json5, params);
|
|
51198
51198
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51199
51199
|
inst.removeDefault = inst.unwrap;
|
|
51200
51200
|
});
|
|
@@ -51210,7 +51210,7 @@ function _default2(innerType, defaultValue) {
|
|
|
51210
51210
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
51211
51211
|
$ZodPrefault.init(inst, def);
|
|
51212
51212
|
ZodType.init(inst, def);
|
|
51213
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51213
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => prefaultProcessor(inst, ctx, json5, params);
|
|
51214
51214
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51215
51215
|
});
|
|
51216
51216
|
function prefault(innerType, defaultValue) {
|
|
@@ -51225,7 +51225,7 @@ function prefault(innerType, defaultValue) {
|
|
|
51225
51225
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
51226
51226
|
$ZodNonOptional.init(inst, def);
|
|
51227
51227
|
ZodType.init(inst, def);
|
|
51228
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51228
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => nonoptionalProcessor(inst, ctx, json5, params);
|
|
51229
51229
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51230
51230
|
});
|
|
51231
51231
|
function nonoptional(innerType, params) {
|
|
@@ -51238,7 +51238,7 @@ function nonoptional(innerType, params) {
|
|
|
51238
51238
|
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
51239
51239
|
$ZodSuccess.init(inst, def);
|
|
51240
51240
|
ZodType.init(inst, def);
|
|
51241
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51241
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => successProcessor(inst, ctx, json5, params);
|
|
51242
51242
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51243
51243
|
});
|
|
51244
51244
|
function success(innerType) {
|
|
@@ -51250,7 +51250,7 @@ function success(innerType) {
|
|
|
51250
51250
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
51251
51251
|
$ZodCatch.init(inst, def);
|
|
51252
51252
|
ZodType.init(inst, def);
|
|
51253
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51253
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => catchProcessor(inst, ctx, json5, params);
|
|
51254
51254
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51255
51255
|
inst.removeCatch = inst.unwrap;
|
|
51256
51256
|
});
|
|
@@ -51264,7 +51264,7 @@ function _catch2(innerType, catchValue) {
|
|
|
51264
51264
|
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
51265
51265
|
$ZodNaN.init(inst, def);
|
|
51266
51266
|
ZodType.init(inst, def);
|
|
51267
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51267
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => nanProcessor(inst, ctx, json5, params);
|
|
51268
51268
|
});
|
|
51269
51269
|
function nan(params) {
|
|
51270
51270
|
return _nan(ZodNaN, params);
|
|
@@ -51272,7 +51272,7 @@ function nan(params) {
|
|
|
51272
51272
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
51273
51273
|
$ZodPipe.init(inst, def);
|
|
51274
51274
|
ZodType.init(inst, def);
|
|
51275
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51275
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => pipeProcessor(inst, ctx, json5, params);
|
|
51276
51276
|
inst.in = def.in;
|
|
51277
51277
|
inst.out = def.out;
|
|
51278
51278
|
});
|
|
@@ -51314,7 +51314,7 @@ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) =>
|
|
|
51314
51314
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
51315
51315
|
$ZodReadonly.init(inst, def);
|
|
51316
51316
|
ZodType.init(inst, def);
|
|
51317
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51317
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => readonlyProcessor(inst, ctx, json5, params);
|
|
51318
51318
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51319
51319
|
});
|
|
51320
51320
|
function readonly(innerType) {
|
|
@@ -51326,7 +51326,7 @@ function readonly(innerType) {
|
|
|
51326
51326
|
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
51327
51327
|
$ZodTemplateLiteral.init(inst, def);
|
|
51328
51328
|
ZodType.init(inst, def);
|
|
51329
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51329
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => templateLiteralProcessor(inst, ctx, json5, params);
|
|
51330
51330
|
});
|
|
51331
51331
|
function templateLiteral(parts, params) {
|
|
51332
51332
|
return new ZodTemplateLiteral({
|
|
@@ -51338,7 +51338,7 @@ function templateLiteral(parts, params) {
|
|
|
51338
51338
|
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
51339
51339
|
$ZodLazy.init(inst, def);
|
|
51340
51340
|
ZodType.init(inst, def);
|
|
51341
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51341
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => lazyProcessor(inst, ctx, json5, params);
|
|
51342
51342
|
inst.unwrap = () => inst._zod.def.getter();
|
|
51343
51343
|
});
|
|
51344
51344
|
function lazy(getter) {
|
|
@@ -51350,7 +51350,7 @@ function lazy(getter) {
|
|
|
51350
51350
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
51351
51351
|
$ZodPromise.init(inst, def);
|
|
51352
51352
|
ZodType.init(inst, def);
|
|
51353
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51353
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => promiseProcessor(inst, ctx, json5, params);
|
|
51354
51354
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
51355
51355
|
});
|
|
51356
51356
|
function promise(innerType) {
|
|
@@ -51362,7 +51362,7 @@ function promise(innerType) {
|
|
|
51362
51362
|
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
51363
51363
|
$ZodFunction.init(inst, def);
|
|
51364
51364
|
ZodType.init(inst, def);
|
|
51365
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51365
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => functionProcessor(inst, ctx, json5, params);
|
|
51366
51366
|
});
|
|
51367
51367
|
function _function(params) {
|
|
51368
51368
|
return new ZodFunction({
|
|
@@ -51374,7 +51374,7 @@ function _function(params) {
|
|
|
51374
51374
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
51375
51375
|
$ZodCustom.init(inst, def);
|
|
51376
51376
|
ZodType.init(inst, def);
|
|
51377
|
-
inst._zod.processJSONSchema = (ctx,
|
|
51377
|
+
inst._zod.processJSONSchema = (ctx, json5, params) => customProcessor(inst, ctx, json5, params);
|
|
51378
51378
|
});
|
|
51379
51379
|
function check(fn) {
|
|
51380
51380
|
const ch = new $ZodCheck({
|
|
@@ -54531,8 +54531,8 @@ var memo$1;
|
|
|
54531
54531
|
function buildSchemas2025() {
|
|
54532
54532
|
return memo$1 ??= build$1();
|
|
54533
54533
|
}
|
|
54534
|
-
function isNonObjectJsonSchemaRoot(
|
|
54535
|
-
return
|
|
54534
|
+
function isNonObjectJsonSchemaRoot(json5) {
|
|
54535
|
+
return json5["type"] !== "object";
|
|
54536
54536
|
}
|
|
54537
54537
|
var REF_REWRITE_DATA_POSITION_KEYS = /* @__PURE__ */ new Set([
|
|
54538
54538
|
"const",
|
|
@@ -66570,9 +66570,9 @@ var McpServer = class {
|
|
|
66570
66570
|
if (Object.hasOwn(this._toolInputSchemaJson, name)) return this._toolInputSchemaJson[name];
|
|
66571
66571
|
if (tool.inputSchema === void 0) return EMPTY_OBJECT_JSON_SCHEMA;
|
|
66572
66572
|
try {
|
|
66573
|
-
const
|
|
66574
|
-
this._toolInputSchemaJson[name] =
|
|
66575
|
-
return
|
|
66573
|
+
const json5 = standardSchemaToJsonSchema(tool.inputSchema, "input");
|
|
66574
|
+
this._toolInputSchemaJson[name] = json5;
|
|
66575
|
+
return json5;
|
|
66576
66576
|
} catch {
|
|
66577
66577
|
return;
|
|
66578
66578
|
}
|
|
@@ -67124,10 +67124,10 @@ var EMPTY_OBJECT_JSON_SCHEMA = {
|
|
|
67124
67124
|
properties: {}
|
|
67125
67125
|
};
|
|
67126
67126
|
function convertListedInputSchema(name, inputSchema) {
|
|
67127
|
-
const
|
|
67128
|
-
const scan = scanXMcpHeaderDeclarations(
|
|
67127
|
+
const json5 = standardSchemaToJsonSchema(inputSchema, "input");
|
|
67128
|
+
const scan = scanXMcpHeaderDeclarations(json5);
|
|
67129
67129
|
if (!scan.valid) console.warn(`[mcp-sdk] tool '${name}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${scan.reason}`);
|
|
67130
|
-
return
|
|
67130
|
+
return json5;
|
|
67131
67131
|
}
|
|
67132
67132
|
function convertOutputSchemaJson(outputSchema) {
|
|
67133
67133
|
if (outputSchema === void 0) return void 0;
|
|
@@ -67253,7 +67253,7 @@ var StdioServerTransport = class {
|
|
|
67253
67253
|
send(message) {
|
|
67254
67254
|
if (this._closed) return Promise.reject(/* @__PURE__ */ new Error("StdioServerTransport is closed"));
|
|
67255
67255
|
return new Promise((resolve5, reject) => {
|
|
67256
|
-
const
|
|
67256
|
+
const json5 = serializeMessage(message);
|
|
67257
67257
|
let settled = false;
|
|
67258
67258
|
const onError = (error63) => {
|
|
67259
67259
|
if (settled) return;
|
|
@@ -67270,7 +67270,7 @@ var StdioServerTransport = class {
|
|
|
67270
67270
|
resolve5();
|
|
67271
67271
|
};
|
|
67272
67272
|
this._stdout.once("error", onError);
|
|
67273
|
-
if (this._stdout.write(
|
|
67273
|
+
if (this._stdout.write(json5)) {
|
|
67274
67274
|
if (settled) return;
|
|
67275
67275
|
settled = true;
|
|
67276
67276
|
this._stdout.off("error", onError);
|
|
@@ -68690,9 +68690,9 @@ var textEncoder = new TextEncoder();
|
|
|
68690
68690
|
function byteLength(text) {
|
|
68691
68691
|
return textEncoder.encode(text).length;
|
|
68692
68692
|
}
|
|
68693
|
-
function extractControlExt(
|
|
68694
|
-
if (typeof
|
|
68695
|
-
const o =
|
|
68693
|
+
function extractControlExt(json5) {
|
|
68694
|
+
if (typeof json5 !== "object" || json5 === null) return void 0;
|
|
68695
|
+
const o = json5;
|
|
68696
68696
|
const ext = {};
|
|
68697
68697
|
if (typeof o.epoch === "number") ext.epoch = o.epoch;
|
|
68698
68698
|
if (typeof o.agentId === "string") ext.agentId = o.agentId;
|
|
@@ -68703,15 +68703,15 @@ function decodeEnvelopeWith(schemas, text, opts = {}) {
|
|
|
68703
68703
|
if (byteLength(text) > (opts.maxBytes ?? MAX_FRAME_BYTES)) {
|
|
68704
68704
|
return { ok: false, id: NIL_UUID, msg: "FRAME_TOO_LARGE" };
|
|
68705
68705
|
}
|
|
68706
|
-
let
|
|
68706
|
+
let json5;
|
|
68707
68707
|
try {
|
|
68708
|
-
|
|
68708
|
+
json5 = JSON.parse(text);
|
|
68709
68709
|
} catch {
|
|
68710
68710
|
return { ok: false, id: NIL_UUID, msg: "invalid json" };
|
|
68711
68711
|
}
|
|
68712
|
-
const env = Envelope.safeParse(
|
|
68712
|
+
const env = Envelope.safeParse(json5);
|
|
68713
68713
|
if (!env.success) {
|
|
68714
|
-
const id = typeof
|
|
68714
|
+
const id = typeof json5 === "object" && json5 !== null && typeof json5.id === "string" ? json5.id : NIL_UUID;
|
|
68715
68715
|
return { ok: false, id, msg: env.error.message };
|
|
68716
68716
|
}
|
|
68717
68717
|
const schema = Object.hasOwn(schemas, env.data.type) ? schemas[env.data.type] : void 0;
|
|
@@ -68732,7 +68732,7 @@ function decodeEnvelopeWith(schemas, text, opts = {}) {
|
|
|
68732
68732
|
...env.data.corr ? { corr: env.data.corr } : {}
|
|
68733
68733
|
};
|
|
68734
68734
|
}
|
|
68735
|
-
const ext = extractControlExt(
|
|
68735
|
+
const ext = extractControlExt(json5);
|
|
68736
68736
|
return {
|
|
68737
68737
|
ok: true,
|
|
68738
68738
|
frame: { ...env.data, payload: payload.data },
|
|
@@ -70537,8 +70537,8 @@ var memo$12;
|
|
|
70537
70537
|
function buildSchemas20252() {
|
|
70538
70538
|
return memo$12 ??= build$12();
|
|
70539
70539
|
}
|
|
70540
|
-
function isNonObjectJsonSchemaRoot2(
|
|
70541
|
-
return
|
|
70540
|
+
function isNonObjectJsonSchemaRoot2(json5) {
|
|
70541
|
+
return json5["type"] !== "object";
|
|
70542
70542
|
}
|
|
70543
70543
|
var REF_REWRITE_DATA_POSITION_KEYS2 = /* @__PURE__ */ new Set([
|
|
70544
70544
|
"const",
|
|
@@ -82090,14 +82090,14 @@ var ClientResponseCache = class {
|
|
|
82090
82090
|
}
|
|
82091
82091
|
};
|
|
82092
82092
|
function encodeCacheValue(value) {
|
|
82093
|
-
let
|
|
82093
|
+
let json5;
|
|
82094
82094
|
try {
|
|
82095
|
-
|
|
82095
|
+
json5 = JSON.stringify(value);
|
|
82096
82096
|
} catch (error63) {
|
|
82097
82097
|
throw new TypeError(`cache value is not JSON-serializable: ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
82098
82098
|
}
|
|
82099
|
-
if (typeof
|
|
82100
|
-
return
|
|
82099
|
+
if (typeof json5 !== "string") throw new TypeError("cache value is not JSON-serializable: it has no JSON representation");
|
|
82100
|
+
return json5;
|
|
82101
82101
|
}
|
|
82102
82102
|
var AUTH_SEAM = /* @__PURE__ */ Symbol.for("mcp.authSeamEscape");
|
|
82103
82103
|
function isAuthSeamEscape(error63) {
|
|
@@ -84227,8 +84227,8 @@ var StdioClientTransport = class {
|
|
|
84227
84227
|
send(message) {
|
|
84228
84228
|
return new Promise((resolve5) => {
|
|
84229
84229
|
if (!this._process?.stdin) throw new SdkError2(SdkErrorCode2.NotConnected, "Not connected");
|
|
84230
|
-
const
|
|
84231
|
-
if (this._process.stdin.write(
|
|
84230
|
+
const json5 = serializeMessage2(message);
|
|
84231
|
+
if (this._process.stdin.write(json5)) resolve5();
|
|
84232
84232
|
else this._process.stdin.once("drain", resolve5);
|
|
84233
84233
|
});
|
|
84234
84234
|
}
|
|
@@ -85619,7 +85619,7 @@ var DesktopManager = class {
|
|
|
85619
85619
|
// At the limit, the least recently used desktop nobody holds makes room; a full machine has no holder or queue (§4.4).
|
|
85620
85620
|
async makeRoom() {
|
|
85621
85621
|
if (this.running.size < this.max()) return;
|
|
85622
|
-
const idle = [...this.running.values()].filter((desktop) => !desktop
|
|
85622
|
+
const idle = [...this.running.values()].filter((desktop) => !inUse(desktop)).sort((a, b) => a.lastActivity - b.lastActivity)[0];
|
|
85623
85623
|
if (!idle) {
|
|
85624
85624
|
throw new ComputerError("unavailable", `all ${this.max()} desktops of this computer are in use`, {
|
|
85625
85625
|
reason: "desktops_full"
|
|
@@ -85659,7 +85659,7 @@ var DesktopManager = class {
|
|
|
85659
85659
|
const now = this.now();
|
|
85660
85660
|
for (const desktop of [...this.running.values()]) {
|
|
85661
85661
|
if (desktop.stopping) continue;
|
|
85662
|
-
if (desktop
|
|
85662
|
+
if (inUse(desktop)) desktop.lastActivity = now;
|
|
85663
85663
|
const idle = now - desktop.lastActivity;
|
|
85664
85664
|
if (idle > this.deps.config.desktopIdleMinutes * 6e4) {
|
|
85665
85665
|
await this.stop(desktop.record.id, `idle for ${this.deps.config.desktopIdleMinutes} min`);
|
|
@@ -85673,6 +85673,7 @@ var DesktopManager = class {
|
|
|
85673
85673
|
}
|
|
85674
85674
|
}
|
|
85675
85675
|
};
|
|
85676
|
+
var inUse = (desktop) => desktop.computer.leaseActivity() !== void 0 || desktop.computer.liveStatus() === "human_in_control";
|
|
85676
85677
|
var MAIN_SESSION_VARS = /^(WAYLAND_DISPLAY|DBUS_SESSION_BUS_ADDRESS|SESSION_MANAGER|DESKTOP_STARTUP_ID|XDG_ACTIVATION_TOKEN|DESKTOP_SESSION|GDMSESSION|XDG_SESSION_(DESKTOP|ID|CLASS)|XDG_SEAT|XDG_VTNR|XDG_MENU_PREFIX|XMODIFIERS|(GTK|QT|CLUTTER|SDL)_IM_MODULE|IM_CONFIG_\w+|GNOME_\w+|KDE_\w+|PLASMA_\w+|GIO_LAUNCHED_DESKTOP_FILE\w*|XAUTHORITY)$/;
|
|
85677
85678
|
function desktopEnv(base) {
|
|
85678
85679
|
const env = {};
|
|
@@ -90294,7 +90295,7 @@ var serviceEntry = () => managedEntry() ?? resolve3(process.argv[1]);
|
|
|
90294
90295
|
|
|
90295
90296
|
// src/version.ts
|
|
90296
90297
|
init_define_AGENTCONNECT_COMPUTER_WINDOWS_SOURCES();
|
|
90297
|
-
var COMPUTER_DAEMON_VERSION = true ? "2.12.0-rc.
|
|
90298
|
+
var COMPUTER_DAEMON_VERSION = true ? "2.12.0-rc.13" : JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
90298
90299
|
|
|
90299
90300
|
// src/http-server.ts
|
|
90300
90301
|
var CONTROL_HEADER = "x-agentconnect-computer";
|
|
@@ -90616,8 +90617,17 @@ async function downloadFfmpeg(dataDir2, target, log40) {
|
|
|
90616
90617
|
log40(`Installed ffmpeg ${build3.version} at ${target}`);
|
|
90617
90618
|
return target;
|
|
90618
90619
|
}
|
|
90619
|
-
function captureInputs(fps, dataDir2, frames = 0, cursor = true) {
|
|
90620
|
+
function captureInputs(fps, dataDir2, frames = 0, cursor = true, display) {
|
|
90620
90621
|
const mouse = cursor ? "1" : "0";
|
|
90622
|
+
if (display) {
|
|
90623
|
+
return [
|
|
90624
|
+
{
|
|
90625
|
+
name: "x11grab",
|
|
90626
|
+
args: ["-f", "x11grab", "-draw_mouse", mouse, "-framerate", String(fps), "-i", display],
|
|
90627
|
+
filters: []
|
|
90628
|
+
}
|
|
90629
|
+
];
|
|
90630
|
+
}
|
|
90621
90631
|
const override = process.env.AGENTCONNECT_COMPUTER_CAPTURE;
|
|
90622
90632
|
if (override) return [{ name: "override", args: override.split(" ").filter(Boolean), filters: [] }];
|
|
90623
90633
|
if (process.platform === "win32") {
|
|
@@ -113408,7 +113418,7 @@ var ScreenStream = class {
|
|
|
113408
113418
|
spawn() {
|
|
113409
113419
|
if (!this.running || !this.socket) return;
|
|
113410
113420
|
this.cursor = this.options.cursor?.() ?? true;
|
|
113411
|
-
const inputs = captureInputs(this.options.fps, this.options.dataDir, 0, this.cursor);
|
|
113421
|
+
const inputs = captureInputs(this.options.fps, this.options.dataDir, 0, this.cursor, this.options.display);
|
|
113412
113422
|
const input2 = inputs[Math.min(this.inputIndex, inputs.length - 1)];
|
|
113413
113423
|
const args = [
|
|
113414
113424
|
"-hide_banner",
|
|
@@ -113873,7 +113883,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113873
113883
|
body { margin: 0; background: #111; color: #ddd; display: flex; flex-direction: column; height: 100vh; }
|
|
113874
113884
|
header { display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: #1c1c1c; border-bottom: 1px solid #333; flex-wrap: wrap; }
|
|
113875
113885
|
header .grow { flex: 1; }
|
|
113876
|
-
button, input { font: inherit; color: inherit; background: #2a2a2a; border: 1px solid #444; border-radius: 4px; padding: 4px 10px; }
|
|
113886
|
+
button, input, select { font: inherit; color: inherit; background: #2a2a2a; border: 1px solid #444; border-radius: 4px; padding: 4px 10px; }
|
|
113877
113887
|
button:hover { background: #333; }
|
|
113878
113888
|
button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
|
|
113879
113889
|
button.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
|
|
@@ -113893,6 +113903,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113893
113903
|
</head>
|
|
113894
113904
|
<body>
|
|
113895
113905
|
<header>
|
|
113906
|
+
<select id="desktop" title="Which desktop to watch" hidden></select>
|
|
113896
113907
|
<span id="state">connecting\u2026</span>
|
|
113897
113908
|
<span id="meta"></span>
|
|
113898
113909
|
<span id="error"></span>
|
|
@@ -113914,7 +113925,11 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113914
113925
|
(() => {
|
|
113915
113926
|
const $ = (id) => document.getElementById(id)
|
|
113916
113927
|
const video = $('video'), image = $('image'), surface = $('surface'), screenBox = $('screen')
|
|
113917
|
-
|
|
113928
|
+
const hash = new URLSearchParams(location.hash.slice(1))
|
|
113929
|
+
let token = hash.get('token') || localStorage.getItem('acd-viewer-token') || ''
|
|
113930
|
+
// Per-agent desktops (computer-use.md \xA73.9): the main one, or an agent's under /view/api/d/<id>.
|
|
113931
|
+
const desktop = hash.get('desktop') || sessionStorage.getItem('acd-viewer-desktop') || 'main'
|
|
113932
|
+
const base = desktop === 'main' ? '/view/api' : '/view/api/d/' + encodeURIComponent(desktop)
|
|
113918
113933
|
if (location.hash) history.replaceState(null, '', location.pathname)
|
|
113919
113934
|
let status = null, channel = null, mode = 'none', seq = 0
|
|
113920
113935
|
const pending = new Map()
|
|
@@ -113931,7 +113946,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113931
113946
|
|
|
113932
113947
|
async function refresh() {
|
|
113933
113948
|
try {
|
|
113934
|
-
const res = await api('GET', '/
|
|
113949
|
+
const res = await api('GET', base + '/status')
|
|
113935
113950
|
status = await res.json()
|
|
113936
113951
|
const ctl = status.inControl
|
|
113937
113952
|
$('state').textContent = ctl ? 'You are in control \u2014 agents are blocked' : status.paused ? 'Paused: ' + status.paused.reason : status.lease ? 'Agent ' + status.lease.holder + ' is working' : 'Watching (agents allowed)'
|
|
@@ -113951,7 +113966,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113951
113966
|
let lastRtcTry = 0
|
|
113952
113967
|
|
|
113953
113968
|
async function control(action) {
|
|
113954
|
-
const res = await api('POST', '/
|
|
113969
|
+
const res = await api('POST', base + '/control', { action })
|
|
113955
113970
|
const body = await res.json()
|
|
113956
113971
|
showError(res.ok ? '' : body.message)
|
|
113957
113972
|
await refresh()
|
|
@@ -113962,7 +113977,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113962
113977
|
|
|
113963
113978
|
// ---- video: WebRTC first, screenshot polling if it cannot start ----
|
|
113964
113979
|
async function startWebRtc() {
|
|
113965
|
-
const offerRes = await api('POST', '/
|
|
113980
|
+
const offerRes = await api('POST', base + '/rtc/offer')
|
|
113966
113981
|
if (!offerRes.ok) throw new Error((await offerRes.json()).message || 'webrtc unavailable')
|
|
113967
113982
|
const offer = await offerRes.json()
|
|
113968
113983
|
const pc = new RTCPeerConnection()
|
|
@@ -113981,7 +113996,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
113981
113996
|
pc.onconnectionstatechange = () => { if (['failed', 'closed', 'disconnected'].includes(pc.connectionState)) { pc.close(); fallback('WebRTC ' + pc.connectionState) } }
|
|
113982
113997
|
await pc.setRemoteDescription({ type: 'offer', sdp: offer.sdp })
|
|
113983
113998
|
await pc.setLocalDescription(await pc.createAnswer())
|
|
113984
|
-
await api('POST', '/
|
|
113999
|
+
await api('POST', base + '/rtc/answer', { id: offer.id, sdp: pc.localDescription.sdp })
|
|
113985
114000
|
try {
|
|
113986
114001
|
await new Promise((resolve, reject) => {
|
|
113987
114002
|
const timer = setTimeout(() => reject(new Error('no video within 10s')), 10000)
|
|
@@ -114004,7 +114019,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
114004
114019
|
if (document.hidden) { await sleep(500); continue }
|
|
114005
114020
|
const started = performance.now()
|
|
114006
114021
|
try {
|
|
114007
|
-
const res = await api('GET', '/
|
|
114022
|
+
const res = await api('GET', base + '/frame')
|
|
114008
114023
|
if (res.ok) {
|
|
114009
114024
|
const url = URL.createObjectURL(await res.blob())
|
|
114010
114025
|
const old = image.src
|
|
@@ -114033,7 +114048,7 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
114033
114048
|
if (!reply.ok) { showError(reply.error); if (/take control/.test(reply.error)) refresh() } else showError('')
|
|
114034
114049
|
return
|
|
114035
114050
|
}
|
|
114036
|
-
const res = await api('POST', '/
|
|
114051
|
+
const res = await api('POST', base + '/input', input)
|
|
114037
114052
|
if (!res.ok) showError((await res.json()).message); else showError('')
|
|
114038
114053
|
}
|
|
114039
114054
|
|
|
@@ -114117,8 +114132,28 @@ var VIEWER_PAGE = `<!doctype html>
|
|
|
114117
114132
|
$('send').onclick = sendText
|
|
114118
114133
|
$('text').addEventListener('keydown', (event) => { if (event.key === 'Enter' && !event.isComposing) { event.preventDefault(); sendText() } })
|
|
114119
114134
|
|
|
114135
|
+
async function desktops() {
|
|
114136
|
+
try {
|
|
114137
|
+
const res = await api('GET', '/view/api/desktops')
|
|
114138
|
+
if (!res.ok) return
|
|
114139
|
+
const list = await res.json()
|
|
114140
|
+
const select = $('desktop')
|
|
114141
|
+
select.hidden = !list.perAgent && list.desktops.length < 2
|
|
114142
|
+
select.replaceChildren(...list.desktops.map((d) => {
|
|
114143
|
+
const option = document.createElement('option')
|
|
114144
|
+
option.value = d.id
|
|
114145
|
+
option.textContent = (d.id === 'main' ? d.label : d.label + ' (' + d.id + ')') + ' \xB7 ' + (d.holder ? 'working' : d.status)
|
|
114146
|
+
option.selected = d.id === desktop
|
|
114147
|
+
return option
|
|
114148
|
+
}))
|
|
114149
|
+
} catch (error) { /* an older daemon has no desktops */ }
|
|
114150
|
+
}
|
|
114151
|
+
$('desktop').onchange = (event) => { sessionStorage.setItem('acd-viewer-desktop', event.target.value); location.reload() }
|
|
114152
|
+
|
|
114120
114153
|
async function start() {
|
|
114121
114154
|
if (!token) return showLogin()
|
|
114155
|
+
await desktops()
|
|
114156
|
+
setInterval(desktops, 5000)
|
|
114122
114157
|
await refresh()
|
|
114123
114158
|
if (!status) return
|
|
114124
114159
|
setInterval(refresh, 2000)
|
|
@@ -114343,6 +114378,124 @@ function createViewer(options) {
|
|
|
114343
114378
|
};
|
|
114344
114379
|
}
|
|
114345
114380
|
|
|
114381
|
+
// src/viewer-router.ts
|
|
114382
|
+
init_define_AGENTCONNECT_COMPUTER_WINDOWS_SOURCES();
|
|
114383
|
+
var DESKTOP_PATH = /^\/view\/api\/d\/([A-Za-z0-9_-]{1,32})(\/.*)$/;
|
|
114384
|
+
var MAX_BODY_BYTES2 = 64 * 1024;
|
|
114385
|
+
var json4 = (status, body) => ({
|
|
114386
|
+
status,
|
|
114387
|
+
headers: { "content-type": "application/json", "cache-control": "no-store" },
|
|
114388
|
+
body: Buffer.from(JSON.stringify(body))
|
|
114389
|
+
});
|
|
114390
|
+
function createViewerRouter(options) {
|
|
114391
|
+
const viewers = /* @__PURE__ */ new Map();
|
|
114392
|
+
const list2 = () => {
|
|
114393
|
+
const main2 = options.mainInfo();
|
|
114394
|
+
const manager = options.desktops();
|
|
114395
|
+
return {
|
|
114396
|
+
perAgent: Boolean(manager?.enabled()),
|
|
114397
|
+
desktops: [
|
|
114398
|
+
{
|
|
114399
|
+
id: "main",
|
|
114400
|
+
label: "Main desktop",
|
|
114401
|
+
name: main2.name,
|
|
114402
|
+
running: true,
|
|
114403
|
+
status: main2.status,
|
|
114404
|
+
holder: main2.lease?.holder ?? null
|
|
114405
|
+
},
|
|
114406
|
+
...(manager?.list() ?? []).map((desktop) => {
|
|
114407
|
+
const running = manager?.runningDesktops().find((candidate) => candidate.record.id === desktop.id);
|
|
114408
|
+
return {
|
|
114409
|
+
id: desktop.id,
|
|
114410
|
+
label: desktop.label,
|
|
114411
|
+
running: desktop.running,
|
|
114412
|
+
status: desktop.status ?? "stopped",
|
|
114413
|
+
holder: running?.computer.leaseActivity()?.holder ?? null
|
|
114414
|
+
};
|
|
114415
|
+
})
|
|
114416
|
+
]
|
|
114417
|
+
};
|
|
114418
|
+
};
|
|
114419
|
+
async function api(request2) {
|
|
114420
|
+
if (request2.path === "/view/api/desktops") {
|
|
114421
|
+
if (!options.authenticate(request2.authorization, request2.via)) return json4(401, { error: "unauthorized" });
|
|
114422
|
+
return json4(200, list2());
|
|
114423
|
+
}
|
|
114424
|
+
const match = DESKTOP_PATH.exec(request2.path);
|
|
114425
|
+
if (!match || match[1] === "main") {
|
|
114426
|
+
return options.main.api(match ? { ...request2, path: `/view/api${match[2]}` } : request2);
|
|
114427
|
+
}
|
|
114428
|
+
if (!options.authenticate(request2.authorization, request2.via)) return json4(401, { error: "unauthorized" });
|
|
114429
|
+
const manager = options.desktops();
|
|
114430
|
+
if (!manager?.enabled()) return json4(404, { error: "not_found", message: "per-agent desktops are off" });
|
|
114431
|
+
const id = match[1];
|
|
114432
|
+
let desktop;
|
|
114433
|
+
try {
|
|
114434
|
+
desktop = await manager.byId(id);
|
|
114435
|
+
} catch (error63) {
|
|
114436
|
+
return json4(503, { error: "unavailable", message: error63.message });
|
|
114437
|
+
}
|
|
114438
|
+
if (!desktop) return json4(404, { error: "not_found", message: `no desktop ${id}` });
|
|
114439
|
+
if (desktop.stopping) return json4(503, { error: "unavailable", message: `desktop ${id} is stopping` });
|
|
114440
|
+
manager.touch(id);
|
|
114441
|
+
let viewer = viewers.get(id);
|
|
114442
|
+
if (!viewer) {
|
|
114443
|
+
viewer = options.forDesktop(desktop);
|
|
114444
|
+
viewers.set(id, viewer);
|
|
114445
|
+
}
|
|
114446
|
+
return viewer.api({ ...request2, path: `/view/api${match[2]}` });
|
|
114447
|
+
}
|
|
114448
|
+
return {
|
|
114449
|
+
api,
|
|
114450
|
+
channelMessage: (principal, message) => options.main.channelMessage(principal, message),
|
|
114451
|
+
async handle(req, res, path) {
|
|
114452
|
+
if (!(path === "/view/api/desktops" || DESKTOP_PATH.test(path))) return options.main.handle(req, res, path);
|
|
114453
|
+
const chunks = [];
|
|
114454
|
+
let size = 0;
|
|
114455
|
+
if (req.method === "POST") {
|
|
114456
|
+
for await (const chunk of req) {
|
|
114457
|
+
size += chunk.length;
|
|
114458
|
+
if (size > MAX_BODY_BYTES2) {
|
|
114459
|
+
res.writeHead(400, { "content-type": "application/json" });
|
|
114460
|
+
return void res.end(JSON.stringify({ error: "invalid_argument", message: "request body too large" }));
|
|
114461
|
+
}
|
|
114462
|
+
chunks.push(chunk);
|
|
114463
|
+
}
|
|
114464
|
+
}
|
|
114465
|
+
const out = await api({
|
|
114466
|
+
method: req.method ?? "GET",
|
|
114467
|
+
path,
|
|
114468
|
+
authorization: req.headers.authorization,
|
|
114469
|
+
via: "local",
|
|
114470
|
+
...req.method === "POST" ? { body: Buffer.concat(chunks) } : {},
|
|
114471
|
+
...req.socket.localAddress ? { hostAddress: req.socket.localAddress } : {}
|
|
114472
|
+
});
|
|
114473
|
+
res.writeHead(out.status, out.headers);
|
|
114474
|
+
res.end(out.body);
|
|
114475
|
+
},
|
|
114476
|
+
disconnectAll(reason) {
|
|
114477
|
+
options.main.disconnectAll(reason);
|
|
114478
|
+
for (const viewer of viewers.values()) viewer.disconnectAll(reason);
|
|
114479
|
+
},
|
|
114480
|
+
close() {
|
|
114481
|
+
options.main.close();
|
|
114482
|
+
for (const viewer of viewers.values()) viewer.close();
|
|
114483
|
+
viewers.clear();
|
|
114484
|
+
},
|
|
114485
|
+
statusChanged() {
|
|
114486
|
+
options.main.statusChanged();
|
|
114487
|
+
for (const viewer of viewers.values()) viewer.statusChanged();
|
|
114488
|
+
},
|
|
114489
|
+
dropDesktop(id) {
|
|
114490
|
+
const viewer = viewers.get(id);
|
|
114491
|
+
if (!viewer) return;
|
|
114492
|
+
viewers.delete(id);
|
|
114493
|
+
viewer.disconnectAll("the desktop stopped");
|
|
114494
|
+
viewer.close();
|
|
114495
|
+
}
|
|
114496
|
+
};
|
|
114497
|
+
}
|
|
114498
|
+
|
|
114346
114499
|
// src/keep-awake.ts
|
|
114347
114500
|
init_define_AGENTCONNECT_COMPUTER_WINDOWS_SOURCES();
|
|
114348
114501
|
import { spawn as spawn10, spawnSync as spawnSync6 } from "node:child_process";
|
|
@@ -117796,12 +117949,12 @@ function startCpChannel(options) {
|
|
|
117796
117949
|
}
|
|
117797
117950
|
};
|
|
117798
117951
|
}
|
|
117799
|
-
function buildViewer(dir, config2, computer, refusal, consoleViewer, advertiseAddress, onFfmpegInstalled) {
|
|
117952
|
+
function buildViewer(dir, config2, computer, refusal, consoleViewer, advertiseAddress, onFfmpegInstalled, display) {
|
|
117800
117953
|
const ffmpeg = () => resolveFfmpegPath(dir, config2.ffmpegPath);
|
|
117801
117954
|
let ffmpegState = "missing";
|
|
117802
117955
|
if (config2.webrtc) {
|
|
117803
117956
|
ffmpegState = ffmpegAvailable(ffmpeg()) ? "ok" : "missing";
|
|
117804
|
-
if (ffmpegState === "missing" && canInstallFfmpeg() && !config2.ffmpegPath) {
|
|
117957
|
+
if (ffmpegState === "missing" && canInstallFfmpeg() && !config2.ffmpegPath && !display) {
|
|
117805
117958
|
ffmpegState = "downloading";
|
|
117806
117959
|
installFfmpeg(dir, log39).then(() => {
|
|
117807
117960
|
ffmpegState = ffmpegAvailable(ffmpeg()) ? "ok" : "missing";
|
|
@@ -117821,6 +117974,7 @@ function buildViewer(dir, config2, computer, refusal, consoleViewer, advertiseAd
|
|
|
117821
117974
|
bitrateKbps: config2.streamBitrateKbps,
|
|
117822
117975
|
// A person driving sees their browser's pointer at once, so the delayed one in the frames would be a second cursor.
|
|
117823
117976
|
cursor: () => computer.liveStatus() !== "human_in_control",
|
|
117977
|
+
...display ? { display } : {},
|
|
117824
117978
|
log: log39
|
|
117825
117979
|
});
|
|
117826
117980
|
const rtc = config2.webrtc ? new RtcSessions({
|
|
@@ -118010,7 +118164,8 @@ async function run3(dir, initial, clientName) {
|
|
|
118010
118164
|
return { driver: desktopDriver, computer: desktop };
|
|
118011
118165
|
},
|
|
118012
118166
|
log: log39,
|
|
118013
|
-
onChange: () => live2.local?.update()
|
|
118167
|
+
onChange: () => live2.local?.update(),
|
|
118168
|
+
onStopped: (id) => live2.viewerRouter?.dropDesktop(id)
|
|
118014
118169
|
});
|
|
118015
118170
|
}
|
|
118016
118171
|
const setDesktops = async (on) => {
|
|
@@ -118042,16 +118197,42 @@ async function run3(dir, initial, clientName) {
|
|
|
118042
118197
|
}
|
|
118043
118198
|
const releaseDisplay = config2.keepAwake ? keepDisplayAwake(log39) : () => void 0;
|
|
118044
118199
|
const driverTools = await loadDriverTools(driver, config2);
|
|
118045
|
-
const
|
|
118200
|
+
const consoleViewer = registration ? (header) => viewerPrincipal(header, authority, () => registration.computerId) : void 0;
|
|
118201
|
+
const advertiseAddress = config2.webrtc ? await rtcAdvertiseAddress(config2, void 0, log39) : void 0;
|
|
118202
|
+
const mainViewer = buildViewer(
|
|
118046
118203
|
dir,
|
|
118047
118204
|
config2,
|
|
118048
118205
|
computer,
|
|
118049
118206
|
() => authority.refusal(),
|
|
118050
|
-
|
|
118051
|
-
|
|
118207
|
+
consoleViewer,
|
|
118208
|
+
advertiseAddress,
|
|
118052
118209
|
// A first start downloads ffmpeg, so report the viewer then instead of at the next 30-minute doctor run.
|
|
118053
118210
|
() => live2.channel?.refreshDoctor()
|
|
118054
118211
|
);
|
|
118212
|
+
live2.viewerRouter = live2.desktops ? createViewerRouter({
|
|
118213
|
+
main: mainViewer,
|
|
118214
|
+
desktops: () => live2.desktops,
|
|
118215
|
+
forDesktop: (desktop) => buildViewer(
|
|
118216
|
+
dir,
|
|
118217
|
+
config2,
|
|
118218
|
+
desktop.computer,
|
|
118219
|
+
() => authority.refusal(),
|
|
118220
|
+
consoleViewer,
|
|
118221
|
+
advertiseAddress,
|
|
118222
|
+
void 0,
|
|
118223
|
+
desktop.display
|
|
118224
|
+
),
|
|
118225
|
+
authenticate: viewerAuthenticator(
|
|
118226
|
+
(header) => consoleViewer?.(header),
|
|
118227
|
+
(header) => authenticate(config2, header)
|
|
118228
|
+
),
|
|
118229
|
+
mainInfo: () => ({
|
|
118230
|
+
name: String(computer.info().name),
|
|
118231
|
+
status: computer.liveStatus(),
|
|
118232
|
+
lease: computer.leaseActivity() ?? null
|
|
118233
|
+
})
|
|
118234
|
+
}) : void 0;
|
|
118235
|
+
const viewer = live2.viewerRouter ?? mainViewer;
|
|
118055
118236
|
live2.viewer = viewer;
|
|
118056
118237
|
const adminPromptsLocked = () => !registration || registration.revokedAt || live2.channel?.client.servesAdminPrompts() ? void 0 : "Connect to the Control Plane to change this";
|
|
118057
118238
|
const keepAdminPrompts = (mode) => {
|